@constructive-io/ui 0.12.0 → 0.14.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/README.md +1 -1
- package/dist/{ai-CiaH2sfF.js → ai-4JrVVL3q.js} +1794 -250
- package/dist/ai-4JrVVL3q.js.map +1 -0
- package/dist/{ai-lAkichk8.cjs → ai-B08ufcbD.cjs} +1888 -248
- package/dist/ai-B08ufcbD.cjs.map +1 -0
- package/dist/{alert-BXuP0ayz.d.ts → alert-CJ4Qyk6W.d.cts} +4 -2
- package/dist/{alert-BXuP0ayz.d.cts → alert-CJ4Qyk6W.d.ts} +4 -2
- package/dist/components/accordion.cjs +60 -0
- package/dist/components/accordion.cjs.map +1 -0
- package/dist/components/accordion.d.cts +14 -0
- package/dist/components/accordion.d.ts +14 -0
- package/dist/components/accordion.js +54 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/ai/index.cjs +17 -1
- package/dist/components/ai/index.d.cts +2 -2
- package/dist/components/ai/index.d.ts +2 -2
- package/dist/components/ai/index.js +2 -2
- package/dist/components/alert-dialog.cjs +17 -8
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +17 -8
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +18 -8
- package/dist/components/alert.cjs.map +1 -1
- package/dist/components/alert.d.cts +2 -2
- package/dist/components/alert.d.ts +2 -2
- package/dist/components/alert.js +18 -9
- package/dist/components/alert.js.map +1 -1
- package/dist/components/autocomplete.cjs +9 -5
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +9 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +9 -3
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.d.cts +6 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.js +9 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +25 -18
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +2 -2
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +25 -18
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +9 -6
- package/dist/components/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb.js +9 -6
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.cjs +57 -0
- package/dist/components/button-group.cjs.map +1 -0
- package/dist/components/button-group.d.cts +16 -0
- package/dist/components/button-group.d.ts +16 -0
- package/dist/components/button-group.js +51 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.cjs +62 -18
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +32 -2
- package/dist/components/button.d.ts +32 -2
- package/dist/components/button.js +62 -18
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +14 -8
- package/dist/components/calendar-rac.cjs.map +1 -1
- package/dist/components/calendar-rac.js +14 -8
- package/dist/components/calendar-rac.js.map +1 -1
- package/dist/components/card.cjs +35 -23
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +3 -2
- package/dist/components/card.d.ts +3 -2
- package/dist/components/card.js +35 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox.cjs +5 -5
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +5 -5
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +3 -3
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.js +3 -3
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +24 -12
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -1
- package/dist/components/combobox.d.ts +2 -1
- package/dist/components/combobox.js +24 -12
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +30 -14
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +9 -2
- package/dist/components/command.d.ts +9 -2
- package/dist/components/command.js +30 -14
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +22 -12
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +5 -2
- package/dist/components/dialog.d.ts +5 -2
- package/dist/components/dialog.js +22 -12
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +50 -27
- package/dist/components/dock.cjs.map +1 -1
- package/dist/components/dock.d.cts +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +51 -28
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +22 -14
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.js +22 -14
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +34 -28
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +2 -2
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.js +52 -46
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +4 -4
- package/dist/components/empty.cjs.map +1 -1
- package/dist/components/empty.js +4 -4
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.cjs +33 -33
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +34 -34
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +1 -1
- package/dist/components/flickering-grid.cjs.map +1 -1
- package/dist/components/flickering-grid.js +1 -1
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +10 -5
- package/dist/components/flow-zoom-panel.cjs.map +1 -1
- package/dist/components/flow-zoom-panel.d.cts +8 -1
- package/dist/components/flow-zoom-panel.d.ts +8 -1
- package/dist/components/flow-zoom-panel.js +10 -5
- package/dist/components/flow-zoom-panel.js.map +1 -1
- package/dist/components/form-control.cjs +12 -8
- package/dist/components/form-control.cjs.map +1 -1
- package/dist/components/form-control.js +12 -8
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +5 -5
- package/dist/components/form.cjs.map +1 -1
- package/dist/components/form.js +5 -5
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +13 -7
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +2 -2
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input-group.js +11 -7
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +252 -0
- package/dist/components/input-otp.cjs.map +1 -0
- package/dist/components/input-otp.d.cts +44 -0
- package/dist/components/input-otp.d.ts +44 -0
- package/dist/components/input-otp.js +251 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.cjs +10 -4
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +11 -2
- package/dist/components/input.d.ts +11 -2
- package/dist/components/input.js +10 -4
- package/dist/components/input.js.map +1 -1
- package/dist/components/item.cjs +151 -0
- package/dist/components/item.cjs.map +1 -0
- package/dist/components/item.d.cts +37 -0
- package/dist/components/item.d.ts +37 -0
- package/dist/components/item.js +137 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/json-input.cjs +4 -143
- package/dist/components/json-input.d.cts +6 -4
- package/dist/components/json-input.d.ts +6 -4
- package/dist/components/json-input.js +2 -140
- package/dist/components/kbd.cjs +35 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +16 -0
- package/dist/components/kbd.d.ts +16 -0
- package/dist/components/kbd.js +31 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.cjs +3 -3
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/label.js +3 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +20 -8
- package/dist/components/motion-grid.cjs.map +1 -1
- package/dist/components/motion-grid.js +20 -8
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +77 -67
- package/dist/components/multi-select.cjs.map +1 -1
- package/dist/components/multi-select.js +77 -67
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +12 -9
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.js +12 -9
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.cjs +10 -4
- package/dist/components/pagination.cjs.map +1 -1
- package/dist/components/pagination.d.cts +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +10 -4
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/phone-input.cjs +228 -0
- package/dist/components/phone-input.cjs.map +1 -0
- package/dist/components/phone-input.d.cts +42 -0
- package/dist/components/phone-input.d.ts +42 -0
- package/dist/components/phone-input.js +220 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/popover.cjs +12 -4
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.d.cts +7 -1
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.js +12 -5
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.cjs +20 -3
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +1 -1
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +20 -3
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +2 -2
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
- package/dist/components/progressive-blur-scroll-container.d.cts +1 -1
- package/dist/components/progressive-blur-scroll-container.d.ts +1 -1
- package/dist/components/progressive-blur-scroll-container.js +2 -2
- package/dist/components/progressive-blur-scroll-container.js.map +1 -1
- package/dist/components/progressive-blur.cjs +3 -2
- package/dist/components/progressive-blur.cjs.map +1 -1
- package/dist/components/progressive-blur.js +3 -2
- package/dist/components/progressive-blur.js.map +1 -1
- package/dist/components/radio-group.cjs +2 -2
- package/dist/components/radio-group.cjs.map +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +1 -1
- package/dist/components/record-picker.js +1 -1
- package/dist/components/resizable.cjs +2 -2
- package/dist/components/resizable.cjs.map +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +43 -21
- package/dist/components/responsive-diagram.cjs.map +1 -1
- package/dist/components/responsive-diagram.d.cts +7 -1
- package/dist/components/responsive-diagram.d.ts +7 -1
- package/dist/components/responsive-diagram.js +43 -21
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/scroll-area.cjs +2 -2
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/scroll-area.js +2 -2
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +84 -20
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +12 -7
- package/dist/components/select.d.ts +12 -7
- package/dist/components/select.js +84 -20
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +11 -2
- package/dist/components/separator.d.ts +11 -2
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.d.cts +11 -5
- package/dist/components/sheet.d.ts +12 -6
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.cjs +2 -1
- package/dist/components/sidebar.d.cts +8 -7
- package/dist/components/sidebar.d.ts +8 -7
- package/dist/components/sidebar.js +2 -1
- package/dist/components/slider.cjs +47 -0
- package/dist/components/slider.cjs.map +1 -0
- package/dist/components/slider.d.cts +8 -0
- package/dist/components/slider.d.ts +8 -0
- package/dist/components/slider.js +44 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.cjs +15 -4
- package/dist/components/sonner.cjs.map +1 -1
- package/dist/components/sonner.d.cts +10 -1
- package/dist/components/sonner.d.ts +10 -1
- package/dist/components/sonner.js +16 -5
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.cjs +25 -0
- package/dist/components/spinner.cjs.map +1 -0
- package/dist/components/spinner.d.cts +16 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stack/index.cjs +1 -1
- package/dist/components/stack/index.d.cts +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stepper.cjs +23 -17
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +2 -2
- package/dist/components/stepper.d.ts +2 -2
- package/dist/components/stepper.js +23 -17
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +5 -5
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +5 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +26 -7
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.d.cts +20 -2
- package/dist/components/table.d.ts +20 -2
- package/dist/components/table.js +26 -8
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +64 -8
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +13 -2
- package/dist/components/tabs.d.ts +13 -2
- package/dist/components/tabs.js +66 -11
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +10 -5
- package/dist/components/tags.cjs.map +1 -1
- package/dist/components/tags.d.cts +1 -1
- package/dist/components/tags.d.ts +1 -1
- package/dist/components/tags.js +10 -5
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +5 -4
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +5 -4
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +1 -1
- package/dist/components/toast/index.d.cts +2 -2
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toggle-group.cjs +69 -0
- package/dist/components/toggle-group.cjs.map +1 -0
- package/dist/components/toggle-group.d.cts +27 -0
- package/dist/components/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group.js +65 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.cjs +54 -0
- package/dist/components/toggle.cjs.map +1 -0
- package/dist/components/toggle.d.cts +13 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +50 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.cjs +18 -6
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +18 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +2 -2
- package/dist/components/unlink-button.cjs.map +1 -1
- package/dist/components/unlink-button.d.cts +1 -0
- package/dist/components/unlink-button.d.ts +1 -0
- package/dist/components/unlink-button.js +2 -2
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/components/workspace-kit/index.cjs +1507 -0
- package/dist/components/workspace-kit/index.cjs.map +1 -0
- package/dist/components/workspace-kit/index.d.cts +728 -0
- package/dist/components/workspace-kit/index.d.ts +728 -0
- package/dist/components/workspace-kit/index.js +1440 -0
- package/dist/components/workspace-kit/index.js.map +1 -0
- package/dist/compose-refs-Mbma1O3M.js +47 -0
- package/dist/compose-refs-Mbma1O3M.js.map +1 -0
- package/dist/compose-refs-uPrvNoiU.cjs +52 -0
- package/dist/compose-refs-uPrvNoiU.cjs.map +1 -0
- package/dist/fluid-highlight-CNELHV8o.js +134 -0
- package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
- package/dist/fluid-highlight-YWFRZXsw.cjs +145 -0
- package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
- package/dist/{index-BzLmDsId.d.cts → index-B7cT7gZU.d.cts} +3 -3
- package/dist/{index-BzLmDsId.d.ts → index-B7cT7gZU.d.ts} +3 -3
- package/dist/{index-UnM04j0t.d.ts → index-BQZxmMpw.d.cts} +11 -31
- package/dist/{index-UnM04j0t.d.cts → index-BQZxmMpw.d.ts} +11 -31
- package/dist/{index-CyaFaZe2.d.cts → index-Cluc_xc5.d.ts} +345 -20
- package/dist/{index-B0wXxIAb.d.ts → index-DXoG0ghv.d.cts} +345 -20
- package/dist/index.cjs +107 -17
- package/dist/index.d.cts +64 -14
- package/dist/index.d.ts +64 -14
- package/dist/index.js +27 -14
- package/dist/initial-focus-B8RLtyOZ.cjs +67 -0
- package/dist/initial-focus-B8RLtyOZ.cjs.map +1 -0
- package/dist/initial-focus-j2E0EnIx.js +61 -0
- package/dist/initial-focus-j2E0EnIx.js.map +1 -0
- package/dist/initials-DSkWTOb0.cjs +127 -0
- package/dist/initials-DSkWTOb0.cjs.map +1 -0
- package/dist/initials-kCcHgrSy.js +97 -0
- package/dist/initials-kCcHgrSy.js.map +1 -0
- package/dist/json-input-CH5aEmoA.js +293 -0
- package/dist/json-input-CH5aEmoA.js.map +1 -0
- package/dist/json-input-D8yM578l.cjs +311 -0
- package/dist/json-input-D8yM578l.cjs.map +1 -0
- package/dist/{motion-config-COCFHq1L.cjs → motion-config-DZ7w5Uhq.cjs} +32 -2
- package/dist/motion-config-DZ7w5Uhq.cjs.map +1 -0
- package/dist/{motion-config-COsZ6azM.js → motion-config-DoFp4I8f.js} +21 -3
- package/dist/motion-config-DoFp4I8f.js.map +1 -0
- package/dist/{record-picker-Bz4FApxD.cjs → record-picker-BQ1-Vx0g.cjs} +23 -8
- package/dist/record-picker-BQ1-Vx0g.cjs.map +1 -0
- package/dist/{record-picker-BbxngCeV.js → record-picker-DSRo4RXV.js} +23 -8
- package/dist/record-picker-DSRo4RXV.js.map +1 -0
- package/dist/{sheet-BdA0rfIz.cjs → sheet-OxWlnT_G.cjs} +25 -32
- package/dist/sheet-OxWlnT_G.cjs.map +1 -0
- package/dist/{sheet-BLHnhLRH.js → sheet-wPF_l9Cn.js} +25 -32
- package/dist/sheet-wPF_l9Cn.js.map +1 -0
- package/dist/{sidebar-BavjjJp0.cjs → sidebar-BEEWmJwC.cjs} +74 -57
- package/dist/sidebar-BEEWmJwC.cjs.map +1 -0
- package/dist/{sidebar-DeoL2ttp.js → sidebar-DWl1Azyv.js} +74 -57
- package/dist/sidebar-DWl1Azyv.js.map +1 -0
- package/dist/{stack-ci2lkfkr.cjs → stack-CEvmUSwF.cjs} +12 -10
- package/dist/stack-CEvmUSwF.cjs.map +1 -0
- package/dist/{stack-C9GROTGA.js → stack-Kqu7YaR0.js} +12 -10
- package/dist/stack-Kqu7YaR0.js.map +1 -0
- package/dist/text-runs-CdmlS5C7.cjs +52 -0
- package/dist/text-runs-CdmlS5C7.cjs.map +1 -0
- package/dist/text-runs-DqcEO8L_.js +45 -0
- package/dist/text-runs-DqcEO8L_.js.map +1 -0
- package/dist/theme-CKpIa4Fj.d.cts +536 -0
- package/dist/theme-CKpIa4Fj.d.ts +536 -0
- package/dist/theme-dials-config.cjs +273 -0
- package/dist/theme-dials-config.cjs.map +1 -0
- package/dist/theme-dials-config.d.cts +95 -0
- package/dist/theme-dials-config.d.ts +95 -0
- package/dist/theme-dials-config.js +269 -0
- package/dist/theme-dials-config.js.map +1 -0
- package/dist/theme-presets.cjs +922 -0
- package/dist/theme-presets.cjs.map +1 -0
- package/dist/theme-presets.d.cts +89 -0
- package/dist/theme-presets.d.ts +89 -0
- package/dist/theme-presets.js +912 -0
- package/dist/theme-presets.js.map +1 -0
- package/dist/theme-tuning-CTOHSrsh.d.cts +158 -0
- package/dist/theme-tuning-DOko6Pmy.d.ts +158 -0
- package/dist/theme-tuning.cjs +349 -0
- package/dist/theme-tuning.cjs.map +1 -0
- package/dist/theme-tuning.d.cts +2 -0
- package/dist/theme-tuning.d.ts +2 -0
- package/dist/theme-tuning.js +333 -0
- package/dist/theme-tuning.js.map +1 -0
- package/dist/theme.cjs +438 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +2 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +436 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast-08jF1DBQ.cjs +193 -0
- package/dist/toast-08jF1DBQ.cjs.map +1 -0
- package/dist/toast-CVW5XY4u.js +164 -0
- package/dist/toast-CVW5XY4u.js.map +1 -0
- package/dist/toast-details-BdxxSLlN.cjs +209 -0
- package/dist/toast-details-BdxxSLlN.cjs.map +1 -0
- package/dist/toast-details-CfsB1Vxb.js +198 -0
- package/dist/toast-details-CfsB1Vxb.js.map +1 -0
- package/dist/{tooltip-CTRQoN1A.d.ts → tooltip-Fqb4JK-g.d.cts} +2 -2
- package/dist/{tooltip-CTRQoN1A.d.cts → tooltip-Fqb4JK-g.d.ts} +2 -2
- package/dist/tuning-BKVFsxLr.js +48 -0
- package/dist/tuning-BKVFsxLr.js.map +1 -0
- package/dist/tuning-BRPG7U1U.cjs +71 -0
- package/dist/tuning-BRPG7U1U.cjs.map +1 -0
- package/dist/use-document-theme-BSEuNsEE.cjs +43 -0
- package/dist/use-document-theme-BSEuNsEE.cjs.map +1 -0
- package/dist/use-document-theme-Ch_PqxZz.js +38 -0
- package/dist/use-document-theme-Ch_PqxZz.js.map +1 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs +79 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs.map +1 -0
- package/dist/use-scroll-fade-ilq-o00-.js +72 -0
- package/dist/use-scroll-fade-ilq-o00-.js.map +1 -0
- package/package.json +166 -27
- package/src/styles/globals.css +194 -97
- package/dist/ai-CiaH2sfF.js.map +0 -1
- package/dist/ai-lAkichk8.cjs.map +0 -1
- package/dist/button-Bvh83YGs.d.cts +0 -20
- package/dist/button-Bvh83YGs.d.ts +0 -20
- package/dist/components/app-bar.cjs +0 -81
- package/dist/components/app-bar.cjs.map +0 -1
- package/dist/components/app-bar.d.cts +0 -27
- package/dist/components/app-bar.d.ts +0 -27
- package/dist/components/app-bar.js +0 -77
- package/dist/components/app-bar.js.map +0 -1
- package/dist/components/app-shell.cjs +0 -267
- package/dist/components/app-shell.cjs.map +0 -1
- package/dist/components/app-shell.d.cts +0 -98
- package/dist/components/app-shell.d.ts +0 -98
- package/dist/components/app-shell.js +0 -264
- package/dist/components/app-shell.js.map +0 -1
- package/dist/components/json-input.cjs.map +0 -1
- package/dist/components/json-input.js.map +0 -1
- package/dist/input-CBrCuMH8.d.cts +0 -11
- package/dist/input-CBrCuMH8.d.ts +0 -11
- package/dist/motion-config-COCFHq1L.cjs.map +0 -1
- package/dist/motion-config-COsZ6azM.js.map +0 -1
- package/dist/record-picker-BbxngCeV.js.map +0 -1
- package/dist/record-picker-Bz4FApxD.cjs.map +0 -1
- package/dist/separator-BQEsr0Rc.d.cts +0 -11
- package/dist/separator-BQEsr0Rc.d.ts +0 -11
- package/dist/sheet-BLHnhLRH.js.map +0 -1
- package/dist/sheet-BdA0rfIz.cjs.map +0 -1
- package/dist/sidebar-BavjjJp0.cjs.map +0 -1
- package/dist/sidebar-DeoL2ttp.js.map +0 -1
- package/dist/stack-C9GROTGA.js.map +0 -1
- package/dist/stack-ci2lkfkr.cjs.map +0 -1
- package/dist/toast-D6MqijT2.cjs +0 -316
- package/dist/toast-D6MqijT2.cjs.map +0 -1
- package/dist/toast-D_BOLzm3.js +0 -287
- package/dist/toast-D_BOLzm3.js.map +0 -1
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
import { t as cn } from "./utils-BkMLyah9.js";
|
|
3
3
|
import { Button } from "./components/button.js";
|
|
4
4
|
import { Badge } from "./components/badge.js";
|
|
5
|
+
import { Kbd } from "./components/kbd.js";
|
|
6
|
+
import { Spinner } from "./components/spinner.js";
|
|
5
7
|
import { Alert, AlertDescription, AlertTitle } from "./components/alert.js";
|
|
8
|
+
import { n as unscaledRect } from "./fluid-highlight-CNELHV8o.js";
|
|
6
9
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
10
|
+
import { Popover, PopoverContent, PopoverTrigger, popoverSurfaceClass } from "./components/popover.js";
|
|
11
|
+
import { t as useMergedRefs } from "./compose-refs-Mbma1O3M.js";
|
|
7
12
|
import { Collapsible, CollapsibleContent as CollapsiblePanel, CollapsibleTrigger } from "./components/collapsible.js";
|
|
8
13
|
import { Avatar, AvatarFallback, AvatarImage } from "./components/avatar.js";
|
|
14
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "./components/command.js";
|
|
9
15
|
import * as React$1 from "react";
|
|
10
16
|
import { useEffect, useRef, useState } from "react";
|
|
11
17
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { ArrowDown, ArrowUp, Brain, Check, CheckCircle2, ChevronDown, Circle, CircleDashed, CircleX, Copy, ExternalLink, FileCode2, FileText, Globe, ListChecks, Loader2, Paperclip, RefreshCw, RotateCcw,
|
|
18
|
+
import { ArrowDown, ArrowUp, Ban, BookOpen, Bot, Brain, Check, CheckCircle2, ChevronDown, ChevronRight, ChevronUp, Circle, CircleAlert, CircleCheck, CircleDashed, CircleDollarSign, CircleHelp, CircleX, Copy, ExternalLink, FileCode2, FileText, Gauge, Globe, ListChecks, Loader2, Paperclip, RefreshCw, RotateCcw, Sparkles, Terminal, ThumbsDown, ThumbsUp, TriangleAlert, Upload, X } from "lucide-react";
|
|
13
19
|
import { highlight } from "sugar-high";
|
|
14
20
|
import { c, css, diff, go, java, python, rust } from "sugar-high/presets";
|
|
15
21
|
|
|
@@ -23,7 +29,8 @@ function TextShimmer({ className, active = true, children, ...props }) {
|
|
|
23
29
|
"data-slot": "text-shimmer",
|
|
24
30
|
"data-active": active ? "true" : "false",
|
|
25
31
|
className: cn("inline-block font-medium", active ? [
|
|
26
|
-
"bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)]",
|
|
32
|
+
"bg-[linear-gradient(90deg,var(--muted-foreground)_35%,color-mix(in_oklab,var(--muted-foreground),var(--background)_55%)_50%,var(--muted-foreground)_65%)]",
|
|
33
|
+
"dark:bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)]",
|
|
27
34
|
"bg-size-[200%_100%] bg-clip-text text-transparent",
|
|
28
35
|
"animate-[ai-shimmer-text_1.4s_linear_infinite]",
|
|
29
36
|
"motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-muted-foreground"
|
|
@@ -37,7 +44,7 @@ function TextShimmer({ className, active = true, children, ...props }) {
|
|
|
37
44
|
//#region src/components/ai/agent-loader.tsx
|
|
38
45
|
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
39
46
|
function subscribeToReducedMotion(onStoreChange) {
|
|
40
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () =>
|
|
47
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
|
|
41
48
|
const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
42
49
|
mediaQuery.addEventListener("change", onStoreChange);
|
|
43
50
|
return () => mediaQuery.removeEventListener("change", onStoreChange);
|
|
@@ -81,7 +88,7 @@ const PIXEL_PATTERNS = {
|
|
|
81
88
|
round: false
|
|
82
89
|
}
|
|
83
90
|
};
|
|
84
|
-
function formatElapsed(totalSeconds) {
|
|
91
|
+
function formatElapsed$1(totalSeconds) {
|
|
85
92
|
if (totalSeconds < 60) return `${totalSeconds.toFixed(1)}s`;
|
|
86
93
|
return `${Math.floor(totalSeconds / 60)}m ${(totalSeconds % 60).toFixed(1)}s`;
|
|
87
94
|
}
|
|
@@ -208,8 +215,8 @@ function PulseDot({ size, className }) {
|
|
|
208
215
|
});
|
|
209
216
|
}
|
|
210
217
|
/**
|
|
211
|
-
* Agent loading indicator. Pixel variants (drive / dots / orbit)
|
|
212
|
-
*
|
|
218
|
+
* Agent loading indicator. Pixel variants (drive / dots / orbit) give the
|
|
219
|
+
* agent a distinct presence; simple variants cover common chat spinners.
|
|
213
220
|
*/
|
|
214
221
|
function AgentLoader({ variant = "drive", label = "Working", showElapsed = true, elapsedMs, size = "md", className, text }) {
|
|
215
222
|
const reducedMotion = React$1.useSyncExternalStore(subscribeToReducedMotion, getReducedMotionSnapshot, () => true);
|
|
@@ -228,16 +235,16 @@ function AgentLoader({ variant = "drive", label = "Working", showElapsed = true,
|
|
|
228
235
|
reducedMotion
|
|
229
236
|
}),
|
|
230
237
|
/* @__PURE__ */ jsx(TextShimmer, {
|
|
231
|
-
className: "text-[
|
|
238
|
+
className: "text-[0.8125rem]",
|
|
232
239
|
children: statusText
|
|
233
240
|
}),
|
|
234
241
|
showElapsed ? /* @__PURE__ */ jsx("span", {
|
|
235
242
|
className: "font-mono text-xs tabular-nums text-muted-foreground",
|
|
236
|
-
children: formatElapsed(elapsed)
|
|
243
|
+
children: formatElapsed$1(elapsed)
|
|
237
244
|
}) : null,
|
|
238
245
|
/* @__PURE__ */ jsxs("span", {
|
|
239
246
|
className: "sr-only",
|
|
240
|
-
children: [statusText, showElapsed ? `, ${formatElapsed(elapsed)}` : ""]
|
|
247
|
+
children: [statusText, showElapsed ? `, ${formatElapsed$1(elapsed)}` : ""]
|
|
241
248
|
})
|
|
242
249
|
]
|
|
243
250
|
});
|
|
@@ -253,7 +260,7 @@ function AgentLoader({ variant = "drive", label = "Working", showElapsed = true,
|
|
|
253
260
|
if (variant === "loading-dots") return /* @__PURE__ */ jsxs("span", {
|
|
254
261
|
"data-slot": "agent-loader",
|
|
255
262
|
role: "status",
|
|
256
|
-
className: cn("inline-flex items-center gap-0.5 font-medium text-
|
|
263
|
+
className: cn("inline-flex items-center gap-0.5 font-medium text-link", className),
|
|
257
264
|
children: [/* @__PURE__ */ jsx("span", {
|
|
258
265
|
className: cn(size === "sm" && "text-xs", size === "md" && "text-sm", size === "lg" && "text-base"),
|
|
259
266
|
children: statusText
|
|
@@ -331,7 +338,7 @@ function PromptInput({ className, isLoading = false, maxHeight = 240, value, onV
|
|
|
331
338
|
"data-shape": shape,
|
|
332
339
|
"data-loading": isLoading ? "true" : "false",
|
|
333
340
|
onClick: handleClick,
|
|
334
|
-
className: cn("cursor-text border border-input bg-background p-2 shadow-xs", "transition-shadow focus-within:border-
|
|
341
|
+
className: cn("cursor-text border border-input bg-background p-2 shadow-xs", "transition-shadow focus-within:border-ring/60 focus-within:ring-[3px] focus-within:ring-ring/35", shape === "pill" ? "rounded-3xl" : "rounded-lg", disabled && "cursor-not-allowed opacity-60", className),
|
|
335
342
|
...props,
|
|
336
343
|
children
|
|
337
344
|
})
|
|
@@ -374,7 +381,7 @@ function PromptInputTextarea({ className, onKeyDown, disableAutosize = false, ..
|
|
|
374
381
|
onKeyDown: handleKeyDown,
|
|
375
382
|
disabled,
|
|
376
383
|
rows: 1,
|
|
377
|
-
className: cn("min-h-11 w-full resize-none border-none bg-transparent px-2 py-1.5 text-sm outline-none", "placeholder:text-
|
|
384
|
+
className: cn("min-h-11 w-full resize-none border-none bg-transparent px-2 py-1.5 text-sm outline-none pointer-coarse:text-base", "placeholder:text-subtle-foreground disabled:cursor-not-allowed", className),
|
|
378
385
|
...props
|
|
379
386
|
});
|
|
380
387
|
}
|
|
@@ -459,10 +466,24 @@ function escapeHtml(value) {
|
|
|
459
466
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
460
467
|
}
|
|
461
468
|
/**
|
|
469
|
+
* `*` starts emphasis only in front of text, at the start of a word, and ends
|
|
470
|
+
* it only right after text. That keeps `A * B * C`, `src/**\/*.test.ts` and
|
|
471
|
+
* `*.md files` as the characters the writer typed instead of eating them.
|
|
472
|
+
*
|
|
473
|
+
* The text between the markers cannot contain the marker itself (`**` for
|
|
474
|
+
* strong, `***` for both), so an opener that never finds its closer gives up at
|
|
475
|
+
* the next marker instead of scanning to the end of the line: a long line of
|
|
476
|
+
* unmatched `**` takes time in proportion to its length, not its square.
|
|
477
|
+
*/
|
|
478
|
+
const STRONG_EM = /(?<![\w*])\*\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*\*))*?[^\s*])\*\*\*(?![\w*])/g;
|
|
479
|
+
const STRONG = /(?<![\w*])\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*))*?[^\s*])\*\*(?![\w*])/g;
|
|
480
|
+
const EM = /(?<![\w*])\*(?=[^\s*])([^\n*]*?[^\s*])\*(?![\w*])/g;
|
|
481
|
+
/**
|
|
462
482
|
* Lightweight markdown → HTML without hard deps.
|
|
463
|
-
* Handles paragraphs
|
|
464
|
-
*
|
|
465
|
-
*
|
|
483
|
+
* Handles paragraphs (consecutive lines stay together, joined with line
|
|
484
|
+
* breaks), headings, bold, italic, inline code, fenced code, links, lists.
|
|
485
|
+
* Tables and footnotes are outside this subset: hosts that need full GFM wrap
|
|
486
|
+
* their own marked+DOMPurify pipeline.
|
|
466
487
|
*/
|
|
467
488
|
function renderBasicMarkdown(source) {
|
|
468
489
|
const fences = [];
|
|
@@ -473,9 +494,15 @@ function renderBasicMarkdown(source) {
|
|
|
473
494
|
return `\u0000FENCE${index}\u0000`;
|
|
474
495
|
});
|
|
475
496
|
text = escapeHtml(text);
|
|
476
|
-
|
|
477
|
-
text = text.replace(
|
|
478
|
-
|
|
497
|
+
const spans = [];
|
|
498
|
+
text = text.replace(/`([^`\n]+)`/g, (_match, code) => {
|
|
499
|
+
spans.push(`<code class="ai-md-code">${code}</code>`);
|
|
500
|
+
return `\u0001CODE${spans.length - 1}\u0001`;
|
|
501
|
+
});
|
|
502
|
+
text = text.replace(STRONG_EM, "<strong><em>$1</em></strong>");
|
|
503
|
+
text = text.replace(STRONG, "<strong>$1</strong>");
|
|
504
|
+
text = text.replace(EM, "<em>$1</em>");
|
|
505
|
+
text = text.replace(/\u0001CODE(\d+)\u0001/g, (_match, index) => spans[Number(index)] ?? "");
|
|
479
506
|
text = text.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ai-md-link\">$1</a>");
|
|
480
507
|
const lines = text.split("\n");
|
|
481
508
|
const html = [];
|
|
@@ -486,11 +513,19 @@ function renderBasicMarkdown(source) {
|
|
|
486
513
|
listOpen = null;
|
|
487
514
|
}
|
|
488
515
|
};
|
|
516
|
+
let paragraph = [];
|
|
517
|
+
const flushParagraph = () => {
|
|
518
|
+
if (paragraph.length > 0) {
|
|
519
|
+
html.push(`<p class="ai-md-p">${paragraph.join("<br>")}</p>`);
|
|
520
|
+
paragraph = [];
|
|
521
|
+
}
|
|
522
|
+
};
|
|
489
523
|
for (const line of lines) {
|
|
490
524
|
const unordered = line.match(/^[-*]\s+(.+)$/);
|
|
491
525
|
const ordered = line.match(/^\d+\.\s+(.+)$/);
|
|
492
|
-
const heading = line.match(/^(#{1,
|
|
526
|
+
const heading = line.match(/^(#{1,6})\s+(.+)$/);
|
|
493
527
|
if (unordered) {
|
|
528
|
+
flushParagraph();
|
|
494
529
|
if (listOpen !== "ul") {
|
|
495
530
|
closeList();
|
|
496
531
|
html.push("<ul class=\"ai-md-list\">");
|
|
@@ -500,6 +535,7 @@ function renderBasicMarkdown(source) {
|
|
|
500
535
|
continue;
|
|
501
536
|
}
|
|
502
537
|
if (ordered) {
|
|
538
|
+
flushParagraph();
|
|
503
539
|
if (listOpen !== "ol") {
|
|
504
540
|
closeList();
|
|
505
541
|
html.push("<ol class=\"ai-md-list\">");
|
|
@@ -510,20 +546,23 @@ function renderBasicMarkdown(source) {
|
|
|
510
546
|
}
|
|
511
547
|
closeList();
|
|
512
548
|
if (heading) {
|
|
549
|
+
flushParagraph();
|
|
513
550
|
const level = heading[1].length;
|
|
514
551
|
html.push(`<h${level} class="ai-md-h">${heading[2]}</h${level}>`);
|
|
515
552
|
continue;
|
|
516
553
|
}
|
|
517
554
|
if (line.trim() === "") {
|
|
518
|
-
|
|
555
|
+
flushParagraph();
|
|
519
556
|
continue;
|
|
520
557
|
}
|
|
521
558
|
if (line.includes("\0FENCE")) {
|
|
559
|
+
flushParagraph();
|
|
522
560
|
html.push(line.replace(/\u0000FENCE(\d+)\u0000/g, (_m, i) => fences[Number(i)] ?? ""));
|
|
523
561
|
continue;
|
|
524
562
|
}
|
|
525
|
-
|
|
563
|
+
paragraph.push(line);
|
|
526
564
|
}
|
|
565
|
+
flushParagraph();
|
|
527
566
|
closeList();
|
|
528
567
|
return html.join("\n").replace(/\u0000FENCE(\d+)\u0000/g, (_m, i) => fences[Number(i)] ?? "");
|
|
529
568
|
}
|
|
@@ -538,7 +577,7 @@ function Markdown({ className, children, streaming = false, ...props }) {
|
|
|
538
577
|
return /* @__PURE__ */ jsx("div", {
|
|
539
578
|
"data-slot": "markdown",
|
|
540
579
|
"data-streaming": streaming ? "true" : "false",
|
|
541
|
-
className: cn("ai-markdown max-w-none space-y-3
|
|
580
|
+
className: cn("ai-markdown max-w-none space-y-3 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]", "[&_.ai-md-p]:my-0", "[&_.ai-md-h]:font-semibold", "[&_h1.ai-md-h]:text-lg [&_h2.ai-md-h]:text-base [&_h3.ai-md-h]:text-sm [&_h4.ai-md-h]:text-sm [&_h5.ai-md-h]:text-[0.8125rem] [&_h6.ai-md-h]:text-xs", "[&_.ai-md-list]:my-1 [&_.ai-md-list]:list-disc [&_.ai-md-list]:space-y-1 [&_.ai-md-list]:ps-5", "[&_ol.ai-md-list]:list-decimal", "[&_.ai-md-code]:rounded-md [&_.ai-md-code]:bg-muted [&_.ai-md-code]:px-1 [&_.ai-md-code]:py-0.5 [&_.ai-md-code]:font-mono [&_.ai-md-code]:text-[0.85em]", "[&_.ai-md-pre]:overflow-x-auto [&_.ai-md-pre]:rounded-lg [&_.ai-md-pre]:border [&_.ai-md-pre]:border-border [&_.ai-md-pre]:bg-muted/50 [&_.ai-md-pre]:p-3 [&_.ai-md-pre]:font-mono [&_.ai-md-pre]:text-xs", "[&_.ai-md-link]:text-link [&_.ai-md-link]:underline-offset-2 hover:[&_.ai-md-link]:underline", className),
|
|
542
581
|
dangerouslySetInnerHTML: { __html: html },
|
|
543
582
|
...props
|
|
544
583
|
});
|
|
@@ -568,9 +607,10 @@ function MessageAvatar({ src, alt = "", fallback, className, delay }) {
|
|
|
568
607
|
});
|
|
569
608
|
}
|
|
570
609
|
function MessageContent({ className, markdown = false, streaming = false, children, ...props }) {
|
|
571
|
-
const contentClassName = cn("min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground", className);
|
|
610
|
+
const contentClassName = cn("min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]", typeof children === "string" && !markdown && "whitespace-pre-wrap", className);
|
|
572
611
|
if (markdown && typeof children === "string") return /* @__PURE__ */ jsx(Markdown, {
|
|
573
612
|
"data-slot": "message-content",
|
|
613
|
+
dir: "auto",
|
|
574
614
|
streaming,
|
|
575
615
|
className: contentClassName,
|
|
576
616
|
...props,
|
|
@@ -578,6 +618,7 @@ function MessageContent({ className, markdown = false, streaming = false, childr
|
|
|
578
618
|
});
|
|
579
619
|
return /* @__PURE__ */ jsx("div", {
|
|
580
620
|
"data-slot": "message-content",
|
|
621
|
+
dir: "auto",
|
|
581
622
|
className: contentClassName,
|
|
582
623
|
...props,
|
|
583
624
|
children
|
|
@@ -717,28 +758,28 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
|
|
|
717
758
|
children: [
|
|
718
759
|
hasHeader ? /* @__PURE__ */ jsxs("div", {
|
|
719
760
|
"data-slot": "code-block-header",
|
|
720
|
-
className: "flex items-center gap-2 border-b border-border
|
|
761
|
+
className: "flex items-center gap-2 border-b border-border bg-muted/50 px-2.5 py-1.5",
|
|
721
762
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
722
763
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
723
764
|
children: [
|
|
724
765
|
filename ? /* @__PURE__ */ jsx("span", {
|
|
725
766
|
"data-slot": "code-block-filename",
|
|
726
|
-
className: "min-w-0 truncate font-mono text-[
|
|
767
|
+
className: "min-w-0 truncate font-mono text-[0.75rem] text-foreground/80",
|
|
727
768
|
title: filename,
|
|
728
769
|
children: filename
|
|
729
770
|
}) : language ? /* @__PURE__ */ jsx("span", {
|
|
730
771
|
"data-slot": "code-block-language",
|
|
731
|
-
className: "min-w-0 truncate font-mono text-[
|
|
772
|
+
className: "min-w-0 truncate font-mono text-[0.75rem] text-foreground/80",
|
|
732
773
|
children: language
|
|
733
774
|
}) : null,
|
|
734
775
|
filename && language ? /* @__PURE__ */ jsx("span", {
|
|
735
776
|
"data-slot": "code-block-language",
|
|
736
|
-
className: cn("inline-flex shrink-0 items-center rounded-md px-1.5 py-0.5", "border border-border
|
|
777
|
+
className: cn("inline-flex shrink-0 items-center rounded-md px-1.5 py-0.5", "border border-border bg-background/50", "font-sans text-[0.625rem] font-medium tracking-wide text-muted-foreground uppercase"),
|
|
737
778
|
children: language
|
|
738
779
|
}) : null,
|
|
739
780
|
collapsible ? /* @__PURE__ */ jsxs("span", {
|
|
740
781
|
"data-slot": "code-block-meta",
|
|
741
|
-
className: "hidden shrink-0 font-sans text-[
|
|
782
|
+
className: "hidden shrink-0 font-sans text-[0.6875rem] tabular-nums text-muted-foreground/70 sm:inline",
|
|
742
783
|
children: [lineCount, " lines"]
|
|
743
784
|
}) : null
|
|
744
785
|
]
|
|
@@ -756,7 +797,7 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
|
|
|
756
797
|
"data-slot": "code-block-body",
|
|
757
798
|
className: "relative",
|
|
758
799
|
children: [/* @__PURE__ */ jsx("pre", {
|
|
759
|
-
className: cn("overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground", "[&_.sh__line]:block", "transition-[max-height] duration-
|
|
800
|
+
className: cn("overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground", "[&_.sh__line]:block", "transition-[max-height] duration-(--duration-slow) ease-out motion-reduce:transition-none", isCollapsed && "overflow-y-hidden", !isCollapsed && maxExpandedHeight !== false && collapsible && "overflow-y-auto"),
|
|
760
801
|
style: isCollapsed ? { maxHeight: collapsedMaxHeight } : collapsible && maxExpandedHeight !== false ? { maxHeight: maxExpandedHeight } : void 0,
|
|
761
802
|
children: highlightedHtml ? /* @__PURE__ */ jsx("code", { dangerouslySetInnerHTML: { __html: highlightedHtml } }) : /* @__PURE__ */ jsx("code", { children: visible })
|
|
762
803
|
}), isCollapsed ? /* @__PURE__ */ jsx("div", {
|
|
@@ -767,15 +808,15 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
|
|
|
767
808
|
}),
|
|
768
809
|
collapsible ? /* @__PURE__ */ jsx("div", {
|
|
769
810
|
"data-slot": "code-block-footer",
|
|
770
|
-
className: "border-t border-border
|
|
811
|
+
className: "border-t border-border bg-muted/40",
|
|
771
812
|
children: /* @__PURE__ */ jsxs("button", {
|
|
772
813
|
type: "button",
|
|
773
814
|
"data-slot": "code-block-expand",
|
|
774
815
|
"aria-expanded": expanded,
|
|
775
816
|
onClick: () => setExpanded(!expanded),
|
|
776
|
-
className: cn("flex w-full items-center justify-center gap-1.5 px-3 py-2", "text-[
|
|
817
|
+
className: cn("flex w-full items-center justify-center gap-1.5 px-3 py-2", "text-[0.75rem] font-medium text-muted-foreground", "outline-none transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate)", "hover:bg-muted/70 hover:text-foreground", "focus-visible:bg-muted/70 focus-visible:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset"),
|
|
777
818
|
children: [/* @__PURE__ */ jsx("span", { children: expanded ? "Show less" : hiddenLineCount === 1 ? "Show 1 more line" : `Show ${hiddenLineCount} more lines` }), /* @__PURE__ */ jsx(ChevronDown, {
|
|
778
|
-
className: cn("size-3.5 opacity-70 transition-transform duration-
|
|
819
|
+
className: cn("size-3.5 opacity-70 transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none", expanded && "rotate-180"),
|
|
779
820
|
"aria-hidden": true
|
|
780
821
|
})]
|
|
781
822
|
})
|
|
@@ -825,7 +866,7 @@ function ResponseStream({ text, mode = "typewriter", speed = 2, className, markd
|
|
|
825
866
|
className: cn("whitespace-pre-wrap text-sm leading-relaxed text-foreground", mode === "fade" && streaming && "animate-[fade-in_200ms_ease-out]", className),
|
|
826
867
|
children: [visible, streaming ? /* @__PURE__ */ jsx("span", {
|
|
827
868
|
"aria-hidden": true,
|
|
828
|
-
className: "
|
|
869
|
+
className: "ms-0.5 inline-block h-3.5 w-px translate-y-0.5 bg-foreground/70 animate-pulse motion-reduce:animate-none"
|
|
829
870
|
}) : null]
|
|
830
871
|
});
|
|
831
872
|
}
|
|
@@ -842,8 +883,9 @@ function useChatContainer() {
|
|
|
842
883
|
* Scroll region for chat transcripts with stick-to-bottom tracking.
|
|
843
884
|
* Pair with ScrollButton for jump-to-latest.
|
|
844
885
|
*/
|
|
845
|
-
function ChatContainer({ className, children, bottomThreshold = 48, autoScroll = true, ...props }) {
|
|
886
|
+
function ChatContainer({ className, children, bottomThreshold = 48, autoScroll = true, ref, ...props }) {
|
|
846
887
|
const scrollRef = React$1.useRef(null);
|
|
888
|
+
const mergedRef = useMergedRefs(scrollRef, ref);
|
|
847
889
|
const [isAtBottom, setIsAtBottom] = React$1.useState(true);
|
|
848
890
|
const isAtBottomRef = React$1.useRef(true);
|
|
849
891
|
const scrollToBottom = React$1.useCallback((behavior = "smooth") => {
|
|
@@ -890,7 +932,7 @@ function ChatContainer({ className, children, bottomThreshold = 48, autoScroll =
|
|
|
890
932
|
scrollToBottom
|
|
891
933
|
},
|
|
892
934
|
children: /* @__PURE__ */ jsx("div", {
|
|
893
|
-
ref:
|
|
935
|
+
ref: mergedRef,
|
|
894
936
|
"data-slot": "chat-container",
|
|
895
937
|
"data-at-bottom": isAtBottom ? "true" : "false",
|
|
896
938
|
className: cn("relative min-h-0 flex-1 overflow-y-auto overscroll-contain", className),
|
|
@@ -923,7 +965,7 @@ function ScrollButton({ className, visible, label = "Scroll to latest", onClick,
|
|
|
923
965
|
type,
|
|
924
966
|
"aria-label": label,
|
|
925
967
|
"data-slot": "scroll-button",
|
|
926
|
-
className: cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border
|
|
968
|
+
className: cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border bg-background/95 text-muted-foreground", "shadow-lg backdrop-blur-md", "dark:border-border dark:bg-card/90 dark:shadow-black/40", "outline-none transition-[transform,box-shadow] duration-(--duration-moderate) ease-out", "hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg", "focus-visible:ring-[3px] focus-visible:ring-ring/50", "motion-safe:active:scale-[0.96]", "animate-[fade-in_150ms_ease-out] motion-reduce:animate-none", className),
|
|
927
969
|
onClick: (event) => {
|
|
928
970
|
scrollToBottom("smooth");
|
|
929
971
|
onClick?.(event);
|
|
@@ -946,7 +988,7 @@ function SystemMessage({ className, title, variant = "info", children, ...props
|
|
|
946
988
|
return /* @__PURE__ */ jsxs(Alert, {
|
|
947
989
|
"data-slot": "system-message",
|
|
948
990
|
variant,
|
|
949
|
-
className: cn("text-
|
|
991
|
+
className: cn("text-start", className),
|
|
950
992
|
...props,
|
|
951
993
|
children: [title ? /* @__PURE__ */ jsx(AlertTitle, { children: title }) : null, children ? /* @__PURE__ */ jsx(AlertDescription, { children }) : null]
|
|
952
994
|
});
|
|
@@ -956,12 +998,17 @@ function SystemMessage({ className, title, variant = "info", children, ...props
|
|
|
956
998
|
//#region src/components/ai/format-duration.ts
|
|
957
999
|
/** Format elapsed ms for "Thought for …" / "Worked for …" labels. */
|
|
958
1000
|
function formatDuration(ms) {
|
|
959
|
-
|
|
1001
|
+
const wholeMs = Math.round(ms);
|
|
1002
|
+
if (wholeMs < 1e3) return `${Math.max(1, wholeMs)}ms`;
|
|
960
1003
|
const seconds = ms / 1e3;
|
|
961
|
-
|
|
962
|
-
if (
|
|
963
|
-
const
|
|
964
|
-
|
|
1004
|
+
const tenths = Math.round(seconds * 10) / 10;
|
|
1005
|
+
if (tenths < 10) return `${tenths.toFixed(1)}s`;
|
|
1006
|
+
const total = Math.round(seconds);
|
|
1007
|
+
if (total < 60) return `${total}s`;
|
|
1008
|
+
const hours = Math.floor(total / 3600);
|
|
1009
|
+
const minutes = Math.floor(total % 3600 / 60);
|
|
1010
|
+
const rem = total % 60;
|
|
1011
|
+
if (hours > 0) return minutes === 0 ? `${hours}h` : `${hours}h ${minutes}m`;
|
|
965
1012
|
return rem === 0 ? `${minutes}m` : `${minutes}m ${rem}s`;
|
|
966
1013
|
}
|
|
967
1014
|
|
|
@@ -1010,31 +1057,31 @@ function Reasoning({ children, content, isStreaming = false, durationMs = null,
|
|
|
1010
1057
|
className: cn("w-full", className),
|
|
1011
1058
|
"data-slot": "reasoning",
|
|
1012
1059
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
1013
|
-
className: cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-
|
|
1060
|
+
className: cn("group -mx-1.5 flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "text-muted-foreground transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent hover:text-foreground", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"),
|
|
1014
1061
|
children: [
|
|
1015
1062
|
/* @__PURE__ */ jsx(Brain, { className: "size-3.5 shrink-0 opacity-80" }),
|
|
1016
1063
|
isStreaming ? /* @__PURE__ */ jsx(TextShimmer, {
|
|
1017
|
-
className: "text-[
|
|
1064
|
+
className: "text-[0.8125rem] font-medium tabular-nums",
|
|
1018
1065
|
children: label
|
|
1019
1066
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1020
|
-
className: "font-medium",
|
|
1067
|
+
className: "font-medium tabular-nums",
|
|
1021
1068
|
children: label
|
|
1022
1069
|
}),
|
|
1023
1070
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
1024
1071
|
"data-slot": "collapsible-icon",
|
|
1025
|
-
className: "size-3.5 shrink-0 opacity-60 transition-transform duration-
|
|
1072
|
+
className: "size-3.5 shrink-0 opacity-60 transition-transform duration-(--duration-slow)"
|
|
1026
1073
|
})
|
|
1027
1074
|
]
|
|
1028
1075
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
1029
1076
|
innerClassName: "py-0",
|
|
1030
1077
|
children: /* @__PURE__ */ jsx("div", {
|
|
1031
|
-
className: "my-1
|
|
1078
|
+
className: "my-1 ms-1.5 border-s border-border/70 py-1 ps-3",
|
|
1032
1079
|
children: markdown && typeof body === "string" ? /* @__PURE__ */ jsx(Markdown, {
|
|
1033
1080
|
streaming: isStreaming,
|
|
1034
|
-
className: "text-[
|
|
1081
|
+
className: "text-[0.8125rem] text-muted-foreground",
|
|
1035
1082
|
children: body
|
|
1036
1083
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1037
|
-
className: "whitespace-pre-wrap text-[
|
|
1084
|
+
className: "whitespace-pre-wrap text-[0.8125rem] leading-relaxed text-muted-foreground",
|
|
1038
1085
|
children: body
|
|
1039
1086
|
})
|
|
1040
1087
|
})
|
|
@@ -1049,7 +1096,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
|
|
|
1049
1096
|
children: [onClick ? /* @__PURE__ */ jsxs("button", {
|
|
1050
1097
|
type: "button",
|
|
1051
1098
|
onClick,
|
|
1052
|
-
className: "flex items-center gap-1 text-sm transition-opacity duration-
|
|
1099
|
+
className: "flex items-center gap-1 text-sm transition-opacity duration-(--duration-moderate) hover:opacity-80",
|
|
1053
1100
|
children: [/* @__PURE__ */ jsx(TextShimmer, {
|
|
1054
1101
|
className: "font-medium",
|
|
1055
1102
|
children: text
|
|
@@ -1060,7 +1107,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
|
|
|
1060
1107
|
}), onStop ? /* @__PURE__ */ jsx("button", {
|
|
1061
1108
|
type: "button",
|
|
1062
1109
|
onClick: onStop,
|
|
1063
|
-
className: "border-b border-dotted border-muted-foreground/50 text-sm text-muted-foreground transition-
|
|
1110
|
+
className: "border-b border-dotted border-muted-foreground/50 text-sm text-muted-foreground transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate) hover:border-foreground hover:text-foreground",
|
|
1064
1111
|
children: stopLabel
|
|
1065
1112
|
}) : null]
|
|
1066
1113
|
});
|
|
@@ -1069,7 +1116,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
|
|
|
1069
1116
|
//#endregion
|
|
1070
1117
|
//#region src/components/ai/thinking-trace.tsx
|
|
1071
1118
|
/**
|
|
1072
|
-
*
|
|
1119
|
+
* Expandable agent trace with mode variants.
|
|
1073
1120
|
* Production hosts pass rows + streaming; demos can drive visibleCount.
|
|
1074
1121
|
*/
|
|
1075
1122
|
function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = null, isStreaming = false, rows, query, open: openProp, onOpenChange, className, visibleCount }) {
|
|
@@ -1107,14 +1154,14 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
|
|
|
1107
1154
|
open,
|
|
1108
1155
|
onOpenChange: setOpen,
|
|
1109
1156
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
1110
|
-
className: cn("group -mx-1.5 flex w-fit items-center gap-2 rounded-md px-1.5 py-1 text-
|
|
1157
|
+
className: cn("group -mx-1.5 flex w-fit items-center gap-2 rounded-md px-1.5 py-1.5 text-start", "hover:bg-accent"),
|
|
1111
1158
|
children: [
|
|
1112
1159
|
/* @__PURE__ */ jsx(Sparkles, { className: cn("size-3.5 shrink-0", isStreaming ? "text-muted-foreground" : "text-muted-foreground/70") }),
|
|
1113
1160
|
isStreaming ? /* @__PURE__ */ jsx(TextShimmer, {
|
|
1114
|
-
className: "text-[
|
|
1161
|
+
className: "text-[0.8125rem] font-medium whitespace-nowrap",
|
|
1115
1162
|
children: workingLabel
|
|
1116
1163
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1117
|
-
className: "text-[
|
|
1164
|
+
className: "text-[0.8125rem] font-medium whitespace-nowrap text-muted-foreground animate-[fade-in_350ms_ease-out_both] motion-reduce:animate-none",
|
|
1118
1165
|
children: settledLabel
|
|
1119
1166
|
}),
|
|
1120
1167
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
@@ -1125,10 +1172,11 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
|
|
|
1125
1172
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
1126
1173
|
innerClassName: "py-0",
|
|
1127
1174
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1128
|
-
className: "relative mt-1
|
|
1175
|
+
className: "relative mt-1 ms-1.5 border-s border-border/70 ps-3",
|
|
1129
1176
|
children: [mode === "search" && query ? /* @__PURE__ */ jsxs("div", {
|
|
1130
|
-
className: "mb-2 flex items-center gap-1.5 text-[
|
|
1177
|
+
className: "mb-2 flex items-center gap-1.5 text-[0.75rem] text-muted-foreground",
|
|
1131
1178
|
children: [/* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
1179
|
+
title: query,
|
|
1132
1180
|
className: "truncate font-mono",
|
|
1133
1181
|
children: query
|
|
1134
1182
|
})]
|
|
@@ -1137,7 +1185,7 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
|
|
|
1137
1185
|
children: shown.map((row, index) => {
|
|
1138
1186
|
const settled = !isStreaming || index < shown.length - 1 || count >= rows.length;
|
|
1139
1187
|
return /* @__PURE__ */ jsxs("li", {
|
|
1140
|
-
className: "flex min-w-0 items-start gap-2 text-[
|
|
1188
|
+
className: "flex min-w-0 items-start gap-2 text-[0.8125rem] animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none",
|
|
1141
1189
|
style: { animationDelay: `${Math.min(index, 6) * 40}ms` },
|
|
1142
1190
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1143
1191
|
className: "mt-0.5 shrink-0",
|
|
@@ -1155,20 +1203,20 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
|
|
|
1155
1203
|
className: "font-medium text-foreground underline-offset-2 hover:underline",
|
|
1156
1204
|
children: row.primary
|
|
1157
1205
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1158
|
-
className: cn("text-foreground", row.mono && "font-mono text-[
|
|
1206
|
+
className: cn("text-foreground", row.mono && "font-mono text-[0.75rem]", mode === "reasoning" && "text-muted-foreground"),
|
|
1159
1207
|
children: row.primary
|
|
1160
1208
|
}),
|
|
1161
1209
|
row.secondary ? /* @__PURE__ */ jsx("span", {
|
|
1162
|
-
className: cn("
|
|
1210
|
+
className: cn("ms-1.5 text-muted-foreground", row.mono && "font-mono text-[0.75rem]"),
|
|
1163
1211
|
children: row.secondary
|
|
1164
1212
|
}) : null,
|
|
1165
1213
|
(row.add != null || row.del != null) && /* @__PURE__ */ jsxs("span", {
|
|
1166
|
-
className: "
|
|
1214
|
+
className: "ms-1.5 font-mono text-[0.6875rem] tabular-nums",
|
|
1167
1215
|
children: [row.add != null ? /* @__PURE__ */ jsxs("span", {
|
|
1168
1216
|
className: "text-success",
|
|
1169
1217
|
children: ["+", row.add]
|
|
1170
1218
|
}) : null, row.del != null ? /* @__PURE__ */ jsxs("span", {
|
|
1171
|
-
className: "
|
|
1219
|
+
className: "ms-1 text-destructive",
|
|
1172
1220
|
children: ["-", row.del]
|
|
1173
1221
|
}) : null]
|
|
1174
1222
|
})
|
|
@@ -1220,7 +1268,7 @@ const MODE_DEFAULTS = {
|
|
|
1220
1268
|
const RAIL = 15;
|
|
1221
1269
|
/** Air between icon edge and the vertical segment (px). */
|
|
1222
1270
|
const GAP = 6;
|
|
1223
|
-
const STATUS_LABEL = {
|
|
1271
|
+
const STATUS_LABEL$1 = {
|
|
1224
1272
|
pending: "Pending",
|
|
1225
1273
|
running: "In progress",
|
|
1226
1274
|
done: "Completed",
|
|
@@ -1248,7 +1296,7 @@ function Steps({ children, className, open, onOpenChange, defaultOpen = true, ti
|
|
|
1248
1296
|
className: cn("w-full min-w-0", className),
|
|
1249
1297
|
"data-slot": "steps",
|
|
1250
1298
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
1251
|
-
className: cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-[
|
|
1299
|
+
className: cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.8125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
|
|
1252
1300
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1253
1301
|
className: "min-w-0 truncate font-medium",
|
|
1254
1302
|
children: title
|
|
@@ -1315,7 +1363,7 @@ function Step({ children, title, description, status = "pending", className }) {
|
|
|
1315
1363
|
}
|
|
1316
1364
|
})]
|
|
1317
1365
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1318
|
-
className: cn("min-w-0 flex-1 text-[
|
|
1366
|
+
className: cn("min-w-0 flex-1 text-[0.8125rem]", "pb-3.5 group-last/step:pb-0"),
|
|
1319
1367
|
children: [
|
|
1320
1368
|
/* @__PURE__ */ jsxs("div", {
|
|
1321
1369
|
className: cn("break-words font-medium", status === "running" && "text-foreground", status === "done" && "text-muted-foreground", status === "pending" && "text-muted-foreground/80", status === "error" && "text-destructive"),
|
|
@@ -1325,16 +1373,16 @@ function Step({ children, title, description, status = "pending", className }) {
|
|
|
1325
1373
|
},
|
|
1326
1374
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1327
1375
|
className: "sr-only",
|
|
1328
|
-
children: [STATUS_LABEL[status], ": "]
|
|
1376
|
+
children: [STATUS_LABEL$1[status], ": "]
|
|
1329
1377
|
}), title]
|
|
1330
1378
|
}),
|
|
1331
1379
|
description ? /* @__PURE__ */ jsx("div", {
|
|
1332
|
-
className: "mt-1 break-words text-[
|
|
1380
|
+
className: "mt-1 break-words text-[0.75rem] leading-snug text-muted-foreground",
|
|
1333
1381
|
children: description
|
|
1334
1382
|
}) : null,
|
|
1335
1383
|
children ? /* @__PURE__ */ jsx("div", {
|
|
1336
1384
|
"data-slot": "step-body",
|
|
1337
|
-
className: cn("mt-1.5 min-w-0 break-words text-[
|
|
1385
|
+
className: cn("mt-1.5 min-w-0 break-words text-[0.75rem] leading-snug text-muted-foreground", "[&_pre]:mt-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/40 [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-[0.6875rem] [&_pre]:leading-relaxed", "[&_code]:rounded-sm [&_code]:bg-muted/50 [&_code]:px-1 [&_code]:py-px [&_code]:font-mono [&_code]:text-[0.71875rem]"),
|
|
1338
1386
|
children
|
|
1339
1387
|
}) : null
|
|
1340
1388
|
]
|
|
@@ -1376,11 +1424,11 @@ function formatValue(value) {
|
|
|
1376
1424
|
}
|
|
1377
1425
|
function StatusIcon({ status }) {
|
|
1378
1426
|
switch (status) {
|
|
1379
|
-
case "pending": return /* @__PURE__ */ jsx(
|
|
1380
|
-
case "running": return /* @__PURE__ */ jsx(
|
|
1381
|
-
case "success": return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-3.5 text-success" });
|
|
1382
|
-
case "error": return /* @__PURE__ */ jsx(CircleX, { className: "size-3.5 text-destructive" });
|
|
1383
|
-
case "aborted": return /* @__PURE__ */ jsx(
|
|
1427
|
+
case "pending": return /* @__PURE__ */ jsx(CircleDashed, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
1428
|
+
case "running": return /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none" });
|
|
1429
|
+
case "success": return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-3.5 shrink-0 text-success" });
|
|
1430
|
+
case "error": return /* @__PURE__ */ jsx(CircleX, { className: "size-3.5 shrink-0 text-destructive" });
|
|
1431
|
+
case "aborted": return /* @__PURE__ */ jsx(Ban, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
1384
1432
|
}
|
|
1385
1433
|
}
|
|
1386
1434
|
function statusBadge(status) {
|
|
@@ -1418,91 +1466,98 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
|
|
|
1418
1466
|
"data-slot": "tool",
|
|
1419
1467
|
"data-variant": "chip",
|
|
1420
1468
|
"data-status": status,
|
|
1421
|
-
className: cn("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border
|
|
1469
|
+
className: cn("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1 text-[0.75rem]", className),
|
|
1422
1470
|
children: [
|
|
1423
1471
|
/* @__PURE__ */ jsx(StatusIcon, { status }),
|
|
1424
1472
|
/* @__PURE__ */ jsx("span", {
|
|
1425
|
-
|
|
1473
|
+
title: name,
|
|
1474
|
+
className: "max-w-[9rem] shrink-0 truncate font-medium text-foreground",
|
|
1426
1475
|
children: name
|
|
1427
1476
|
}),
|
|
1428
1477
|
summary ? /* @__PURE__ */ jsx("span", {
|
|
1478
|
+
dir: "auto",
|
|
1479
|
+
title: typeof summary === "string" ? summary : void 0,
|
|
1429
1480
|
className: "min-w-0 truncate font-mono text-muted-foreground",
|
|
1430
1481
|
children: summary
|
|
1431
1482
|
}) : null
|
|
1432
1483
|
]
|
|
1433
1484
|
});
|
|
1434
1485
|
const trigger = /* @__PURE__ */ jsxs("span", {
|
|
1435
|
-
className: cn("flex min-w-0 max-w-full items-center gap-1.5 text-[
|
|
1486
|
+
className: cn("flex min-w-0 max-w-full items-center gap-1.5 text-[0.8125rem] text-muted-foreground", variant === "card" && "w-full justify-between font-normal"),
|
|
1436
1487
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1437
1488
|
className: "flex min-w-0 items-center gap-1.5",
|
|
1438
1489
|
children: [
|
|
1439
1490
|
/* @__PURE__ */ jsx(StatusIcon, { status }),
|
|
1440
1491
|
/* @__PURE__ */ jsx("span", {
|
|
1441
|
-
|
|
1492
|
+
title: name,
|
|
1493
|
+
className: "max-w-[45%] shrink-0 truncate font-medium text-foreground/90",
|
|
1442
1494
|
children: name
|
|
1443
1495
|
}),
|
|
1444
1496
|
summary ? /* @__PURE__ */ jsx("span", {
|
|
1445
|
-
|
|
1497
|
+
dir: "auto",
|
|
1498
|
+
title: typeof summary === "string" ? summary : void 0,
|
|
1499
|
+
className: cn("min-w-0 truncate rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.71875rem] text-muted-foreground"),
|
|
1446
1500
|
children: summary
|
|
1447
1501
|
}) : null,
|
|
1448
1502
|
variant === "card" ? /* @__PURE__ */ jsx("span", {
|
|
1449
|
-
className: cn("rounded-full border px-2 py-0.5 text-[
|
|
1503
|
+
className: cn("shrink-0 rounded-full border px-2 py-0.5 text-[0.6875rem] font-medium", statusBadge(status).className),
|
|
1450
1504
|
children: statusBadge(status).label
|
|
1451
1505
|
}) : null
|
|
1452
1506
|
]
|
|
1453
1507
|
}), hasBody ? /* @__PURE__ */ jsx(ChevronDown, {
|
|
1454
1508
|
"data-slot": "collapsible-icon",
|
|
1455
|
-
className: "size-3.5 shrink-0 opacity-0 transition-[opacity,transform] duration-
|
|
1509
|
+
className: "size-3.5 shrink-0 opacity-0 transition-[opacity,transform] duration-(--duration-moderate) group-hover/tool:opacity-100 group-data-[panel-open]/collapsible:opacity-100"
|
|
1456
1510
|
}) : null]
|
|
1457
1511
|
});
|
|
1458
1512
|
if (!hasBody) return /* @__PURE__ */ jsx("div", {
|
|
1459
1513
|
"data-slot": "tool",
|
|
1460
1514
|
"data-variant": variant,
|
|
1461
1515
|
"data-status": status,
|
|
1462
|
-
className: cn("flex w-full items-center py-0.5 text-
|
|
1516
|
+
className: cn("flex w-full items-center py-0.5 text-start", className),
|
|
1463
1517
|
children: trigger
|
|
1464
1518
|
});
|
|
1465
1519
|
const body = /* @__PURE__ */ jsxs("div", {
|
|
1466
|
-
className: "space-y-2 text-[
|
|
1520
|
+
className: "space-y-2 text-[0.78125rem]",
|
|
1467
1521
|
children: [
|
|
1468
1522
|
children,
|
|
1469
1523
|
detail?.map((line, i) => /* @__PURE__ */ jsx("div", {
|
|
1470
|
-
className: cn("font-mono leading-relaxed text-muted-foreground", line.tone === "add" && "text-success"),
|
|
1524
|
+
className: cn("font-mono leading-relaxed text-muted-foreground [overflow-wrap:anywhere]", line.tone === "add" && "text-success"),
|
|
1471
1525
|
children: line.text
|
|
1472
1526
|
}, i)),
|
|
1473
1527
|
input !== void 0 ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("h4", {
|
|
1474
1528
|
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
1475
1529
|
children: "Input"
|
|
1476
1530
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1477
|
-
className: "max-h-40 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[
|
|
1531
|
+
className: "max-h-40 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed",
|
|
1478
1532
|
children: formatValue(input)
|
|
1479
1533
|
})] }) : null,
|
|
1480
1534
|
output !== void 0 ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("h4", {
|
|
1481
1535
|
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
1482
1536
|
children: "Output"
|
|
1483
1537
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1484
|
-
className: "max-h-48 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[
|
|
1538
|
+
className: "max-h-48 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed",
|
|
1485
1539
|
children: formatValue(output)
|
|
1486
1540
|
})] }) : null,
|
|
1487
1541
|
errorText ? /* @__PURE__ */ jsx("section", {
|
|
1488
|
-
className: "rounded-md border border-destructive/30 bg-destructive/8 p-2 text-destructive",
|
|
1542
|
+
className: "rounded-md border border-destructive/30 bg-destructive/8 p-2 text-destructive [overflow-wrap:anywhere]",
|
|
1489
1543
|
children: errorText
|
|
1490
1544
|
}) : null,
|
|
1491
1545
|
diffs.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
1492
1546
|
className: "flex flex-wrap gap-1.5 pt-0.5",
|
|
1493
1547
|
children: diffs.map((d) => /* @__PURE__ */ jsxs("span", {
|
|
1494
|
-
className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[
|
|
1548
|
+
className: "inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[0.6875rem]",
|
|
1495
1549
|
children: [
|
|
1496
1550
|
/* @__PURE__ */ jsx("span", {
|
|
1497
|
-
|
|
1551
|
+
title: d.file,
|
|
1552
|
+
className: "min-w-0 break-all text-foreground",
|
|
1498
1553
|
children: d.file
|
|
1499
1554
|
}),
|
|
1500
1555
|
d.add != null ? /* @__PURE__ */ jsxs("span", {
|
|
1501
|
-
className: "text-success",
|
|
1556
|
+
className: "shrink-0 text-success",
|
|
1502
1557
|
children: ["+", d.add]
|
|
1503
1558
|
}) : null,
|
|
1504
1559
|
d.del != null ? /* @__PURE__ */ jsxs("span", {
|
|
1505
|
-
className: "text-destructive",
|
|
1560
|
+
className: "shrink-0 text-destructive",
|
|
1506
1561
|
children: ["-", d.del]
|
|
1507
1562
|
}) : null
|
|
1508
1563
|
]
|
|
@@ -1521,7 +1576,7 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
|
|
|
1521
1576
|
onOpenChange,
|
|
1522
1577
|
className: "group/tool group/collapsible",
|
|
1523
1578
|
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
1524
|
-
className: "w-full bg-background px-3 py-2 hover:bg-accent/40",
|
|
1579
|
+
className: "w-full bg-background px-3 py-2.5 hover:bg-accent/40",
|
|
1525
1580
|
children: trigger
|
|
1526
1581
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
1527
1582
|
className: "border-t border-border",
|
|
@@ -1541,10 +1596,10 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
|
|
|
1541
1596
|
onOpenChange,
|
|
1542
1597
|
className: "group/tool group/collapsible",
|
|
1543
1598
|
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
1544
|
-
className: cn("group/row -mx-1 flex min-h-8 w-[calc(100%+0.5rem)] min-w-0 items-center gap-2 rounded-md px-1 py-1 text-
|
|
1599
|
+
className: cn("group/row -mx-1 flex min-h-8 w-[calc(100%+0.5rem)] min-w-0 items-center gap-2 rounded-md px-1 py-1 text-start", "hover:bg-accent", "pointer-coarse:min-h-11"),
|
|
1545
1600
|
children: trigger
|
|
1546
1601
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
1547
|
-
innerClassName: "py-1
|
|
1602
|
+
innerClassName: "py-1 ps-5",
|
|
1548
1603
|
children: body
|
|
1549
1604
|
})]
|
|
1550
1605
|
})
|
|
@@ -1558,10 +1613,10 @@ function ToolGroup({ label, children, defaultOpen = true, className }) {
|
|
|
1558
1613
|
defaultOpen,
|
|
1559
1614
|
className: "group/collapsible",
|
|
1560
1615
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
1561
|
-
className: cn("-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1 text-[
|
|
1616
|
+
className: cn("-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.78125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
|
|
1562
1617
|
children: [/* @__PURE__ */ jsx(ChevronDown, {
|
|
1563
1618
|
"data-slot": "collapsible-icon",
|
|
1564
|
-
className: "size-3"
|
|
1619
|
+
className: "size-3.5 shrink-0"
|
|
1565
1620
|
}), /* @__PURE__ */ jsx("span", {
|
|
1566
1621
|
className: "tabular-nums",
|
|
1567
1622
|
children: label
|
|
@@ -1582,7 +1637,7 @@ function ToolGroup({ label, children, defaultOpen = true, className }) {
|
|
|
1582
1637
|
/**
|
|
1583
1638
|
* Human-in-the-loop approval: simple confirm/skip or multi-question flow.
|
|
1584
1639
|
*/
|
|
1585
|
-
function ApprovalCard({ title, description, questions, confirmLabel = "Confirm", skipLabel = "Skip", destructive = false, preview, onConfirm, onSkip, onDismiss, className, defaultSent = false }) {
|
|
1640
|
+
function ApprovalCard({ title, description, questions, confirmLabel = "Confirm", skipLabel = "Skip", destructive = false, preview, eyebrow, onConfirm, onSkip, onDismiss, className, defaultSent = false }) {
|
|
1586
1641
|
const multi = Boolean(questions?.length);
|
|
1587
1642
|
const [qi, setQi] = React$1.useState(0);
|
|
1588
1643
|
const [answers, setAnswers] = React$1.useState({});
|
|
@@ -1620,7 +1675,7 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1620
1675
|
};
|
|
1621
1676
|
if (sent) return /* @__PURE__ */ jsxs("div", {
|
|
1622
1677
|
"data-slot": "approval-card",
|
|
1623
|
-
className: cn("flex min-h-28 w-full max-w-sm flex-col items-center justify-center gap-2 rounded-
|
|
1678
|
+
className: cn("flex min-h-28 w-full max-w-sm flex-col items-center justify-center gap-2 rounded-lg bg-card p-4 shadow-card", className),
|
|
1624
1679
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1625
1680
|
className: "flex size-6 items-center justify-center rounded-full bg-success text-white animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both]",
|
|
1626
1681
|
children: /* @__PURE__ */ jsx(Check, {
|
|
@@ -1628,26 +1683,33 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1628
1683
|
strokeWidth: 3
|
|
1629
1684
|
})
|
|
1630
1685
|
}), /* @__PURE__ */ jsx("span", {
|
|
1631
|
-
className: "text-[
|
|
1686
|
+
className: "text-[0.8125rem] font-medium text-foreground",
|
|
1632
1687
|
children: "Approved"
|
|
1633
1688
|
})]
|
|
1634
1689
|
});
|
|
1635
1690
|
if (!multi) return /* @__PURE__ */ jsxs("div", {
|
|
1636
1691
|
"data-slot": "approval-card",
|
|
1637
1692
|
"data-destructive": destructive ? "true" : "false",
|
|
1638
|
-
className: cn("w-full max-w-md overflow-hidden rounded-
|
|
1693
|
+
className: cn("w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card", destructive ? "border-destructive/35" : "border-border", className),
|
|
1639
1694
|
children: [
|
|
1640
1695
|
/* @__PURE__ */ jsxs("div", {
|
|
1641
1696
|
className: "flex items-start justify-between gap-2 px-3 pt-3",
|
|
1642
1697
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1643
1698
|
className: "min-w-0 space-y-1",
|
|
1644
|
-
children: [
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1699
|
+
children: [
|
|
1700
|
+
eyebrow ? /* @__PURE__ */ jsx("div", {
|
|
1701
|
+
className: "mb-1.5 flex min-h-4 items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0",
|
|
1702
|
+
children: eyebrow
|
|
1703
|
+
}) : null,
|
|
1704
|
+
title ? /* @__PURE__ */ jsx("div", {
|
|
1705
|
+
className: "text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
|
|
1706
|
+
children: title
|
|
1707
|
+
}) : null,
|
|
1708
|
+
description ? /* @__PURE__ */ jsx("div", {
|
|
1709
|
+
className: "text-xs text-pretty text-muted-foreground [overflow-wrap:anywhere]",
|
|
1710
|
+
children: description
|
|
1711
|
+
}) : null
|
|
1712
|
+
]
|
|
1651
1713
|
}), onDismiss ? /* @__PURE__ */ jsx(Button, {
|
|
1652
1714
|
type: "button",
|
|
1653
1715
|
variant: "ghost",
|
|
@@ -1658,20 +1720,22 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1658
1720
|
}) : null]
|
|
1659
1721
|
}),
|
|
1660
1722
|
preview ? /* @__PURE__ */ jsx("div", {
|
|
1661
|
-
className: "px-3 pt-2",
|
|
1723
|
+
className: "min-w-0 overflow-x-auto px-3 pt-2 [overflow-wrap:anywhere]",
|
|
1662
1724
|
children: preview
|
|
1663
1725
|
}) : null,
|
|
1664
1726
|
/* @__PURE__ */ jsxs("div", {
|
|
1665
|
-
className: "flex items-center justify-end gap-1.5
|
|
1727
|
+
className: "flex flex-wrap items-center justify-end gap-1.5 p-3",
|
|
1666
1728
|
children: [onSkip ? /* @__PURE__ */ jsx(Button, {
|
|
1667
1729
|
type: "button",
|
|
1668
|
-
variant: "
|
|
1730
|
+
variant: "secondary",
|
|
1669
1731
|
size: "sm",
|
|
1732
|
+
wrap: true,
|
|
1670
1733
|
onClick: onSkip,
|
|
1671
1734
|
children: skipLabel
|
|
1672
1735
|
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
1673
1736
|
type: "button",
|
|
1674
1737
|
size: "sm",
|
|
1738
|
+
wrap: true,
|
|
1675
1739
|
variant: destructive ? "destructive" : "default",
|
|
1676
1740
|
onClick: () => {
|
|
1677
1741
|
setSent(true);
|
|
@@ -1686,21 +1750,21 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1686
1750
|
const canAdvance = selected.length > 0;
|
|
1687
1751
|
return /* @__PURE__ */ jsx("div", {
|
|
1688
1752
|
"data-slot": "approval-card",
|
|
1689
|
-
className: cn("w-full max-w-sm overflow-hidden rounded-
|
|
1753
|
+
className: cn("w-full max-w-sm overflow-hidden rounded-lg shadow-card", className),
|
|
1690
1754
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1691
1755
|
className: "p-3 animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none",
|
|
1692
1756
|
children: [
|
|
1693
1757
|
/* @__PURE__ */ jsxs("div", {
|
|
1694
1758
|
className: "flex items-start justify-between gap-2",
|
|
1695
1759
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1696
|
-
className: "text-[
|
|
1760
|
+
className: "min-w-0 text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
|
|
1697
1761
|
children: question.prompt
|
|
1698
1762
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1699
|
-
className: "flex items-center gap-1",
|
|
1763
|
+
className: "flex shrink-0 items-center gap-1",
|
|
1700
1764
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1701
|
-
className: "flex items-center gap-0.5",
|
|
1765
|
+
className: cn("flex items-center gap-0.5", progress.length < 2 && "hidden"),
|
|
1702
1766
|
"aria-hidden": true,
|
|
1703
|
-
children: progress.map((on, i) => /* @__PURE__ */ jsx("span", { className: cn("h-1 rounded-full transition-[width,background-color] duration-
|
|
1767
|
+
children: progress.map((on, i) => /* @__PURE__ */ jsx("span", { className: cn("h-1 rounded-full transition-[width,background-color] duration-(--duration-slow)", on ? "w-3 bg-primary" : "w-1.5 bg-border") }, i))
|
|
1704
1768
|
}), onDismiss ? /* @__PURE__ */ jsx(Button, {
|
|
1705
1769
|
type: "button",
|
|
1706
1770
|
variant: "ghost",
|
|
@@ -1719,9 +1783,9 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1719
1783
|
type: "button",
|
|
1720
1784
|
"aria-pressed": on,
|
|
1721
1785
|
onClick: () => toggleOption(option.id),
|
|
1722
|
-
className: cn("-mx-1.5 flex min-h-10
|
|
1786
|
+
className: cn("-mx-1.5 flex min-h-10 gap-2 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", option.description ? "items-start" : "items-center", "transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", on && "bg-accent"),
|
|
1723
1787
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1724
|
-
className: cn("
|
|
1788
|
+
className: cn("flex size-4 shrink-0 items-center justify-center rounded-full border", option.description && "mt-0.5", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
|
|
1725
1789
|
children: on ? /* @__PURE__ */ jsx(Check, {
|
|
1726
1790
|
className: "size-2.5",
|
|
1727
1791
|
strokeWidth: 3
|
|
@@ -1729,10 +1793,10 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1729
1793
|
}), /* @__PURE__ */ jsxs("span", {
|
|
1730
1794
|
className: "min-w-0",
|
|
1731
1795
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1732
|
-
className: "font-medium text-foreground",
|
|
1796
|
+
className: "font-medium text-foreground [overflow-wrap:anywhere]",
|
|
1733
1797
|
children: option.label
|
|
1734
1798
|
}), option.description ? /* @__PURE__ */ jsx("span", {
|
|
1735
|
-
className: "mt-0.5 block text-xs text-muted-foreground",
|
|
1799
|
+
className: "mt-0.5 block text-xs text-muted-foreground [overflow-wrap:anywhere]",
|
|
1736
1800
|
children: option.description
|
|
1737
1801
|
}) : null]
|
|
1738
1802
|
})]
|
|
@@ -1755,22 +1819,68 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
|
|
|
1755
1819
|
});
|
|
1756
1820
|
}
|
|
1757
1821
|
|
|
1822
|
+
//#endregion
|
|
1823
|
+
//#region src/components/ai/use-image-failed.ts
|
|
1824
|
+
/**
|
|
1825
|
+
* Whether an `<img>` failed to load, for a fallback such as initials or an icon.
|
|
1826
|
+
*
|
|
1827
|
+
* `onError` alone misses an image that failed before React was listening: a
|
|
1828
|
+
* server-rendered page can hydrate after the browser has already given up on a
|
|
1829
|
+
* dead URL, and that `error` event is never replayed. So the ref also checks the
|
|
1830
|
+
* element when it mounts. A finished image with no pixels either failed or is an
|
|
1831
|
+
* SVG without an intrinsic size (which reports a natural width of 0 as well), and
|
|
1832
|
+
* `decode()` tells the two apart; a browser without it counts the image as failed.
|
|
1833
|
+
*
|
|
1834
|
+
* `failed` stays set for the life of the component that calls the hook, so key
|
|
1835
|
+
* that component by the image address and a new address gets a fresh attempt:
|
|
1836
|
+
*
|
|
1837
|
+
* ```tsx
|
|
1838
|
+
* function Photo({ src, fallback }: { src: string; fallback: React.ReactNode }) {
|
|
1839
|
+
* const { failed, ref, onError } = useImageFailed();
|
|
1840
|
+
* return failed ? fallback : <img ref={ref} src={src} onError={onError} alt="" />;
|
|
1841
|
+
* }
|
|
1842
|
+
* // <Photo key={url} src={url} fallback={<Initials />} />
|
|
1843
|
+
* ```
|
|
1844
|
+
*/
|
|
1845
|
+
function useImageFailed() {
|
|
1846
|
+
const [failed, setFailed] = React$1.useState(false);
|
|
1847
|
+
const onError = React$1.useCallback(() => setFailed(true), []);
|
|
1848
|
+
return {
|
|
1849
|
+
failed,
|
|
1850
|
+
ref: React$1.useCallback((image) => {
|
|
1851
|
+
if (!image || !image.complete || image.naturalWidth > 0) return;
|
|
1852
|
+
if (typeof image.decode !== "function") setFailed(true);
|
|
1853
|
+
else image.decode().catch(() => setFailed(true));
|
|
1854
|
+
}, []),
|
|
1855
|
+
onError
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1758
1859
|
//#endregion
|
|
1759
1860
|
//#region src/components/ai/source.tsx
|
|
1760
|
-
|
|
1861
|
+
/** The site's icon, or a document glyph when there is none or it does not load. */
|
|
1862
|
+
function SourceFavicon({ src }) {
|
|
1863
|
+
const { failed, ref, onError } = useImageFailed();
|
|
1864
|
+
return src && !failed ? /* @__PURE__ */ jsx("img", {
|
|
1865
|
+
ref,
|
|
1866
|
+
src,
|
|
1867
|
+
alt: "",
|
|
1868
|
+
onError,
|
|
1869
|
+
className: "size-3.5 rounded-sm outline outline-1 outline-black/10 dark:outline-white/10"
|
|
1870
|
+
}) : /* @__PURE__ */ jsx(FileText, { className: "size-3 shrink-0 opacity-70" });
|
|
1871
|
+
}
|
|
1872
|
+
function Source({ href, title, description, favicon, domain, showTitle = false, className }) {
|
|
1761
1873
|
const host = domain ?? (href ? safeHost(href) : void 0);
|
|
1874
|
+
const label = showTitle ? title : host ?? title;
|
|
1762
1875
|
const content = /* @__PURE__ */ jsxs("span", {
|
|
1763
1876
|
"data-slot": "source",
|
|
1764
|
-
className: cn("inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-
|
|
1877
|
+
className: cn("inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-1.5 text-[0.75rem]", "text-muted-foreground hover:bg-accent hover:text-foreground", className),
|
|
1765
1878
|
children: [
|
|
1766
|
-
|
|
1767
|
-
src: favicon,
|
|
1768
|
-
alt: "",
|
|
1769
|
-
className: "size-3.5 rounded-sm outline outline-1 outline-black/10 dark:outline-white/10"
|
|
1770
|
-
}) : /* @__PURE__ */ jsx(FileText, { className: "size-3 shrink-0 opacity-70" }),
|
|
1879
|
+
/* @__PURE__ */ jsx(SourceFavicon, { src: favicon }, favicon),
|
|
1771
1880
|
/* @__PURE__ */ jsx("span", {
|
|
1881
|
+
title: label,
|
|
1772
1882
|
className: "min-w-0 truncate font-medium",
|
|
1773
|
-
children:
|
|
1883
|
+
children: label
|
|
1774
1884
|
}),
|
|
1775
1885
|
href ? /* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0 opacity-50" }) : null
|
|
1776
1886
|
]
|
|
@@ -1782,7 +1892,7 @@ function Source({ href, title, description, favicon, domain, className }) {
|
|
|
1782
1892
|
className: "inline-flex max-w-full",
|
|
1783
1893
|
children: content
|
|
1784
1894
|
}) : content;
|
|
1785
|
-
if (!description && title ===
|
|
1895
|
+
if (!description && title === label) return chip;
|
|
1786
1896
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
1787
1897
|
asChild: true,
|
|
1788
1898
|
children: chip
|
|
@@ -1801,7 +1911,8 @@ function Source({ href, title, description, favicon, domain, className }) {
|
|
|
1801
1911
|
children: description
|
|
1802
1912
|
}) : null,
|
|
1803
1913
|
href ? /* @__PURE__ */ jsx("div", {
|
|
1804
|
-
|
|
1914
|
+
title: href,
|
|
1915
|
+
className: "truncate font-mono text-[0.625rem] opacity-70",
|
|
1805
1916
|
children: href
|
|
1806
1917
|
}) : null
|
|
1807
1918
|
]
|
|
@@ -1809,15 +1920,19 @@ function Source({ href, title, description, favicon, domain, className }) {
|
|
|
1809
1920
|
})] });
|
|
1810
1921
|
}
|
|
1811
1922
|
function Sources({ children, className, label }) {
|
|
1923
|
+
const hostOf = (props) => props.domain ?? (props.href ? safeHost(props.href) : void 0) ?? props.title;
|
|
1924
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1925
|
+
for (const child of React$1.Children.toArray(children)) if (React$1.isValidElement(child) && child.type === Source) counts.set(hostOf(child.props), (counts.get(hostOf(child.props)) ?? 0) + 1);
|
|
1926
|
+
const shown = React$1.Children.map(children, (child) => React$1.isValidElement(child) && child.type === Source && (counts.get(hostOf(child.props)) ?? 0) > 1 ? React$1.cloneElement(child, { showTitle: true }) : child);
|
|
1812
1927
|
return /* @__PURE__ */ jsxs("div", {
|
|
1813
1928
|
"data-slot": "sources",
|
|
1814
1929
|
className: cn("flex flex-col gap-1.5", className),
|
|
1815
1930
|
children: [label ? /* @__PURE__ */ jsx("div", {
|
|
1816
|
-
className: "text-[
|
|
1931
|
+
className: "text-[0.6875rem] font-medium text-muted-foreground",
|
|
1817
1932
|
children: label
|
|
1818
1933
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
1819
1934
|
className: "flex flex-wrap gap-1.5",
|
|
1820
|
-
children
|
|
1935
|
+
children: shown
|
|
1821
1936
|
})]
|
|
1822
1937
|
});
|
|
1823
1938
|
}
|
|
@@ -1830,65 +1945,221 @@ function safeHost(url) {
|
|
|
1830
1945
|
}
|
|
1831
1946
|
|
|
1832
1947
|
//#endregion
|
|
1833
|
-
//#region src/components/ai/
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1948
|
+
//#region src/components/ai/line-diff.ts
|
|
1949
|
+
const DIFF_LIMITS = {
|
|
1950
|
+
maxCells: 4e6,
|
|
1951
|
+
maxEdits: 2e3,
|
|
1952
|
+
maxWork: 8e6
|
|
1953
|
+
};
|
|
1954
|
+
const context = (text) => ({
|
|
1955
|
+
type: "context",
|
|
1956
|
+
text
|
|
1957
|
+
});
|
|
1958
|
+
const added = (text) => ({
|
|
1959
|
+
type: "add",
|
|
1960
|
+
text
|
|
1961
|
+
});
|
|
1962
|
+
const removed = (text) => ({
|
|
1963
|
+
type: "del",
|
|
1964
|
+
text
|
|
1965
|
+
});
|
|
1966
|
+
/** Longest-common-subsequence diff of two line lists, in order. Cost is the product of the lengths. */
|
|
1967
|
+
function exactDiff(a, b) {
|
|
1968
|
+
const cols = b.length + 1;
|
|
1969
|
+
const table = new Uint32Array((a.length + 1) * cols);
|
|
1970
|
+
for (let i = a.length - 1; i >= 0; i--) for (let j = b.length - 1; j >= 0; j--) table[i * cols + j] = a[i] === b[j] ? table[(i + 1) * cols + j + 1] + 1 : Math.max(table[(i + 1) * cols + j], table[i * cols + j + 1]);
|
|
1840
1971
|
const lines = [];
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
}
|
|
1869
|
-
if (
|
|
1972
|
+
let i = 0;
|
|
1973
|
+
let j = 0;
|
|
1974
|
+
while (i < a.length && j < b.length) if (a[i] === b[j]) {
|
|
1975
|
+
lines.push(context(a[i]));
|
|
1976
|
+
i += 1;
|
|
1977
|
+
j += 1;
|
|
1978
|
+
} else if (table[(i + 1) * cols + j] >= table[i * cols + j + 1]) {
|
|
1979
|
+
lines.push(removed(a[i]));
|
|
1980
|
+
i += 1;
|
|
1981
|
+
} else {
|
|
1982
|
+
lines.push(added(b[j]));
|
|
1983
|
+
j += 1;
|
|
1984
|
+
}
|
|
1985
|
+
for (; i < a.length; i++) lines.push(removed(a[i]));
|
|
1986
|
+
for (; j < b.length; j++) lines.push(added(b[j]));
|
|
1987
|
+
return lines;
|
|
1988
|
+
}
|
|
1989
|
+
/** Within each run of changes, every removal comes before every addition, as the exact comparison writes them. */
|
|
1990
|
+
function removalsFirst(lines) {
|
|
1991
|
+
const ordered = [];
|
|
1992
|
+
let dropped = [];
|
|
1993
|
+
let gained = [];
|
|
1994
|
+
const flush = () => {
|
|
1995
|
+
for (const line of dropped) ordered.push(line);
|
|
1996
|
+
for (const line of gained) ordered.push(line);
|
|
1997
|
+
dropped = [];
|
|
1998
|
+
gained = [];
|
|
1999
|
+
};
|
|
2000
|
+
for (const line of lines) if (line.type === "context") {
|
|
2001
|
+
flush();
|
|
2002
|
+
ordered.push(line);
|
|
2003
|
+
} else if (line.type === "del") dropped.push(line);
|
|
2004
|
+
else gained.push(line);
|
|
2005
|
+
flush();
|
|
2006
|
+
return ordered;
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Shortest edit script by Myers' greedy search, which takes time proportional
|
|
2010
|
+
* to the lines times the number of edits rather than to the product of the
|
|
2011
|
+
* lengths, so a few edits in a long file stay cheap however far apart they are.
|
|
2012
|
+
* Gives up (`null`) when more than `maxEdits` edits or `maxWork` steps are needed.
|
|
2013
|
+
*/
|
|
2014
|
+
function boundedDiff(a, b, { maxEdits, maxWork }) {
|
|
2015
|
+
const n = a.length;
|
|
2016
|
+
const m = b.length;
|
|
2017
|
+
const limit = Math.min(n + m, maxEdits);
|
|
2018
|
+
const offset = limit + 1;
|
|
2019
|
+
const furthest = new Int32Array(2 * limit + 3);
|
|
2020
|
+
const trace = [];
|
|
2021
|
+
let work = 0;
|
|
2022
|
+
for (let d = 0; d <= limit; d++) {
|
|
2023
|
+
trace.push(furthest.slice(offset - d, offset + d + 1));
|
|
2024
|
+
for (let k = -d; k <= d; k += 2) {
|
|
2025
|
+
let x = k === -d || k !== d && furthest[offset + k - 1] < furthest[offset + k + 1] ? furthest[offset + k + 1] : furthest[offset + k - 1] + 1;
|
|
2026
|
+
let y = x - k;
|
|
2027
|
+
const start = x;
|
|
2028
|
+
while (x < n && y < m && a[x] === b[y]) {
|
|
2029
|
+
x += 1;
|
|
2030
|
+
y += 1;
|
|
2031
|
+
}
|
|
2032
|
+
work += 1 + x - start;
|
|
2033
|
+
furthest[offset + k] = x;
|
|
2034
|
+
if (x >= n && y >= m) return removalsFirst(walkBack(a, b, trace, d));
|
|
2035
|
+
if (work > maxWork) return null;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
return null;
|
|
2039
|
+
}
|
|
2040
|
+
/** The path of a finished search, from the end back to the start, as lines in order. */
|
|
2041
|
+
function walkBack(a, b, trace, edits) {
|
|
2042
|
+
const lines = [];
|
|
2043
|
+
let x = a.length;
|
|
2044
|
+
let y = b.length;
|
|
2045
|
+
for (let d = edits; d >= 0; d--) {
|
|
2046
|
+
const before = trace[d];
|
|
2047
|
+
const k = x - y;
|
|
2048
|
+
let fromAbove = false;
|
|
2049
|
+
let previousX = 0;
|
|
2050
|
+
let previousY = 0;
|
|
2051
|
+
if (d > 0) {
|
|
2052
|
+
fromAbove = k === -d || k !== d && before[k - 1 + d] < before[k + 1 + d];
|
|
2053
|
+
const previousK = fromAbove ? k + 1 : k - 1;
|
|
2054
|
+
previousX = before[previousK + d];
|
|
2055
|
+
previousY = previousX - previousK;
|
|
2056
|
+
}
|
|
2057
|
+
while (x > previousX && y > previousY) {
|
|
2058
|
+
lines.push(context(a[x - 1]));
|
|
2059
|
+
x -= 1;
|
|
2060
|
+
y -= 1;
|
|
2061
|
+
}
|
|
2062
|
+
if (d > 0) lines.push(fromAbove ? added(b[y - 1]) : removed(a[x - 1]));
|
|
2063
|
+
x = previousX;
|
|
2064
|
+
y = previousY;
|
|
2065
|
+
}
|
|
2066
|
+
return lines.reverse();
|
|
2067
|
+
}
|
|
2068
|
+
/** The part of two line lists between their common head and tail, compared as exactly as `limits` allow. */
|
|
2069
|
+
function diffMiddle(a, b, limits) {
|
|
2070
|
+
if (a.length === 0) return b.map(added);
|
|
2071
|
+
if (b.length === 0) return a.map(removed);
|
|
2072
|
+
if (a.length * b.length <= limits.maxCells) return exactDiff(a, b);
|
|
2073
|
+
return boundedDiff(a, b, limits) ?? [...a.map(removed), ...b.map(added)];
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Line diff between two line lists, in order: unchanged lines as `context`,
|
|
2077
|
+
* removed lines as `del`, new lines as `add`. The common head and tail are
|
|
2078
|
+
* trimmed first, so a small edit to a long file stays cheap, and a line that
|
|
2079
|
+
* also appears elsewhere is matched by position, so a repeated line is shown as
|
|
2080
|
+
* added or removed rather than hidden.
|
|
2081
|
+
*/
|
|
2082
|
+
function diffLines(before, after, limits = DIFF_LIMITS) {
|
|
2083
|
+
let head = 0;
|
|
2084
|
+
while (head < before.length && head < after.length && before[head] === after[head]) head += 1;
|
|
2085
|
+
let tailBefore = before.length;
|
|
2086
|
+
let tailAfter = after.length;
|
|
2087
|
+
while (tailBefore > head && tailAfter > head && before[tailBefore - 1] === after[tailAfter - 1]) {
|
|
2088
|
+
tailBefore -= 1;
|
|
2089
|
+
tailAfter -= 1;
|
|
2090
|
+
}
|
|
1870
2091
|
return [
|
|
1871
|
-
...
|
|
1872
|
-
...
|
|
1873
|
-
...
|
|
1874
|
-
...shared.slice(2)
|
|
2092
|
+
...before.slice(0, head).map(context),
|
|
2093
|
+
...diffMiddle(before.slice(head, tailBefore), after.slice(head, tailAfter), limits),
|
|
2094
|
+
...before.slice(tailBefore).map(context)
|
|
1875
2095
|
];
|
|
1876
2096
|
}
|
|
2097
|
+
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region src/components/ai/inline-diff.tsx
|
|
2100
|
+
/** Unchanged lines kept on each side of a change. */
|
|
2101
|
+
const CONTEXT_LINES = 2;
|
|
2102
|
+
/**
|
|
2103
|
+
* Line diff between two texts, in order: unchanged lines as `context`, removed
|
|
2104
|
+
* lines as `del`, new lines as `add`. A line that also appears elsewhere is
|
|
2105
|
+
* matched by position, so a repeated line is shown as added or removed rather
|
|
2106
|
+
* than hidden. The common head and tail are trimmed before the comparison, and
|
|
2107
|
+
* a long file is compared by its edits rather than by a table of every pair of
|
|
2108
|
+
* lines, so a few edits stay cheap however far apart they are.
|
|
2109
|
+
*/
|
|
2110
|
+
function lineDiff(before, after) {
|
|
2111
|
+
return diffLines(before.split("\n"), after.split("\n"));
|
|
2112
|
+
}
|
|
2113
|
+
/** Keeps `CONTEXT_LINES` unchanged lines around each change and folds longer unchanged runs into one gap row. */
|
|
2114
|
+
function withContext(lines) {
|
|
2115
|
+
if (lines.every((line) => line.type === "context")) return lines;
|
|
2116
|
+
const keep = lines.map(() => false);
|
|
2117
|
+
lines.forEach((line, index) => {
|
|
2118
|
+
if (line.type === "context") return;
|
|
2119
|
+
for (let near = Math.max(0, index - CONTEXT_LINES); near <= Math.min(lines.length - 1, index + CONTEXT_LINES); near++) keep[near] = true;
|
|
2120
|
+
});
|
|
2121
|
+
const rows = [];
|
|
2122
|
+
let skipped = 0;
|
|
2123
|
+
const flush = (index) => {
|
|
2124
|
+
if (skipped === 1) rows.push(lines[index - 1]);
|
|
2125
|
+
else if (skipped > 1) rows.push({
|
|
2126
|
+
type: "gap",
|
|
2127
|
+
count: skipped
|
|
2128
|
+
});
|
|
2129
|
+
skipped = 0;
|
|
2130
|
+
};
|
|
2131
|
+
lines.forEach((line, index) => {
|
|
2132
|
+
if (keep[index]) {
|
|
2133
|
+
flush(index);
|
|
2134
|
+
rows.push(line);
|
|
2135
|
+
} else skipped += 1;
|
|
2136
|
+
});
|
|
2137
|
+
flush(lines.length);
|
|
2138
|
+
return rows;
|
|
2139
|
+
}
|
|
1877
2140
|
function InlineDiff({ source, className, maxLines = 40 }) {
|
|
1878
|
-
const lines = React$1.useMemo(() => lineDiff(source.before, source.after), [source.before, source.after]);
|
|
2141
|
+
const lines = React$1.useMemo(() => withContext(lineDiff(source.before, source.after)), [source.before, source.after]);
|
|
1879
2142
|
const visible = lines.slice(0, maxLines);
|
|
1880
2143
|
const hidden = lines.length - visible.length;
|
|
1881
2144
|
return /* @__PURE__ */ jsxs("div", {
|
|
1882
2145
|
"data-slot": "inline-diff",
|
|
1883
|
-
className: cn("overflow-hidden rounded-lg border border-border bg-muted/30 font-mono text-[
|
|
2146
|
+
className: cn("overflow-hidden rounded-lg border border-border bg-muted/30 font-mono text-[0.71875rem] leading-relaxed", className),
|
|
1884
2147
|
children: [
|
|
1885
2148
|
source.fileName ? /* @__PURE__ */ jsx("div", {
|
|
1886
|
-
|
|
2149
|
+
title: source.fileName,
|
|
2150
|
+
className: "border-b border-border bg-muted/50 px-2.5 py-1 text-xs break-all text-muted-foreground",
|
|
1887
2151
|
children: source.fileName
|
|
1888
2152
|
}) : null,
|
|
1889
2153
|
/* @__PURE__ */ jsx("pre", {
|
|
1890
2154
|
className: "overflow-x-auto p-0",
|
|
1891
|
-
children: visible.map((line, i) => /* @__PURE__ */ jsxs("div", {
|
|
2155
|
+
children: visible.map((line, i) => line.type === "gap" ? /* @__PURE__ */ jsxs("div", {
|
|
2156
|
+
className: "px-2.5 py-0.5 text-center text-[0.6875rem] text-subtle-foreground select-none",
|
|
2157
|
+
children: [
|
|
2158
|
+
line.count,
|
|
2159
|
+
" unchanged ",
|
|
2160
|
+
line.count === 1 ? "line" : "lines"
|
|
2161
|
+
]
|
|
2162
|
+
}, i) : /* @__PURE__ */ jsxs("div", {
|
|
1892
2163
|
className: cn("flex gap-2 px-2.5 py-0.5", line.type === "add" && "bg-success/10 text-success", line.type === "del" && "bg-destructive/10 text-destructive", line.type === "context" && "text-muted-foreground"),
|
|
1893
2164
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1894
2165
|
className: "w-3 shrink-0 select-none opacity-70",
|
|
@@ -1900,11 +2171,11 @@ function InlineDiff({ source, className, maxLines = 40 }) {
|
|
|
1900
2171
|
}, i))
|
|
1901
2172
|
}),
|
|
1902
2173
|
hidden > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1903
|
-
className: "border-t border-border
|
|
2174
|
+
className: "border-t border-border px-2.5 py-1 text-[0.6875rem] text-muted-foreground",
|
|
1904
2175
|
children: [
|
|
1905
|
-
"+",
|
|
1906
2176
|
hidden,
|
|
1907
|
-
" more
|
|
2177
|
+
" more ",
|
|
2178
|
+
hidden === 1 ? "line" : "lines"
|
|
1908
2179
|
]
|
|
1909
2180
|
}) : null
|
|
1910
2181
|
]
|
|
@@ -1934,7 +2205,7 @@ function FeedbackBar({ className, onCopy, onRegenerate, onFeedback, copyText, sh
|
|
|
1934
2205
|
};
|
|
1935
2206
|
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs("div", {
|
|
1936
2207
|
"data-slot": "feedback-bar",
|
|
1937
|
-
className: cn("flex items-center gap-
|
|
2208
|
+
className: cn("flex items-center gap-2 text-muted-foreground", className),
|
|
1938
2209
|
children: [
|
|
1939
2210
|
showCopy ? /* @__PURE__ */ jsx(Action, {
|
|
1940
2211
|
tip: copied ? "Copied" : "Copy",
|
|
@@ -1990,7 +2261,7 @@ function PromptSuggestion({ children, onClick, className }) {
|
|
|
1990
2261
|
type: "button",
|
|
1991
2262
|
"data-slot": "prompt-suggestion",
|
|
1992
2263
|
onClick,
|
|
1993
|
-
className: cn("inline-flex max-w-full items-center rounded-full border border-border bg-background px-3 py-1.5", "text-
|
|
2264
|
+
className: cn("inline-flex max-w-full items-center rounded-full border border-border bg-background px-3 py-1.5", "text-start text-[0.8125rem] text-foreground shadow-xs", "transition-[background-color,box-shadow,transform] duration-(--duration-moderate) ease-out", "hover:bg-accent hover:shadow-card", "motion-safe:active:scale-[0.98]", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", className),
|
|
1994
2265
|
children: /* @__PURE__ */ jsx("span", {
|
|
1995
2266
|
className: "min-w-0 truncate",
|
|
1996
2267
|
children
|
|
@@ -2002,7 +2273,7 @@ function PromptSuggestions({ children, className, label = "Follow-ups" }) {
|
|
|
2002
2273
|
"data-slot": "prompt-suggestions",
|
|
2003
2274
|
className: cn("flex flex-col gap-2", className),
|
|
2004
2275
|
children: [label ? /* @__PURE__ */ jsx("div", {
|
|
2005
|
-
className: "text-[
|
|
2276
|
+
className: "text-[0.75rem] font-medium text-muted-foreground",
|
|
2006
2277
|
children: label
|
|
2007
2278
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
2008
2279
|
className: "flex flex-wrap gap-1.5",
|
|
@@ -2058,7 +2329,7 @@ function StreamingText({ text = "", tokens, sources = [], followUps = [], onFoll
|
|
|
2058
2329
|
className: cn("flex w-full flex-col gap-3", className),
|
|
2059
2330
|
children: [
|
|
2060
2331
|
/* @__PURE__ */ jsx("div", {
|
|
2061
|
-
className: "text-[
|
|
2332
|
+
className: "text-[0.8125rem] leading-relaxed text-pretty text-foreground",
|
|
2062
2333
|
children: tokens ? tokens.slice(0, visible).map((tok, i) => {
|
|
2063
2334
|
if (tok.type === "cite") {
|
|
2064
2335
|
const src = sources.find((s) => s.id === tok.id);
|
|
@@ -2068,16 +2339,16 @@ function StreamingText({ text = "", tokens, sources = [], followUps = [], onFoll
|
|
|
2068
2339
|
title: src?.title ?? tok.id,
|
|
2069
2340
|
href: src?.href,
|
|
2070
2341
|
description: src?.description,
|
|
2071
|
-
className: "align-super text-[
|
|
2342
|
+
className: "align-super text-[0.625rem]"
|
|
2072
2343
|
})
|
|
2073
2344
|
}, i);
|
|
2074
2345
|
}
|
|
2075
2346
|
return /* @__PURE__ */ jsx("span", {
|
|
2076
|
-
className: cn("transition-[filter,opacity] duration-
|
|
2347
|
+
className: cn("transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", i === visible - 1 && revealing ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
|
|
2077
2348
|
children: tok.text
|
|
2078
2349
|
}, i);
|
|
2079
2350
|
}) : words?.slice(0, visible).map((w, i) => /* @__PURE__ */ jsx("span", {
|
|
2080
|
-
className: cn("transition-[filter,opacity] duration-
|
|
2351
|
+
className: cn("transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", i === visible - 1 && revealing && !/^\s+$/.test(w) ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
|
|
2081
2352
|
children: w
|
|
2082
2353
|
}, i))
|
|
2083
2354
|
}),
|
|
@@ -2130,31 +2401,31 @@ function DiffTable({ title = "Proposed changes", columns, rows, addedRows = [],
|
|
|
2130
2401
|
const showAdded = stage >= 2 && addedRows.length > 0;
|
|
2131
2402
|
return /* @__PURE__ */ jsxs("div", {
|
|
2132
2403
|
"data-slot": "diff-table",
|
|
2133
|
-
className: cn("w-full overflow-hidden rounded-
|
|
2404
|
+
className: cn("w-full overflow-hidden rounded-lg bg-card shadow-card", className),
|
|
2134
2405
|
children: [title ? /* @__PURE__ */ jsx("div", {
|
|
2135
2406
|
className: "flex items-center justify-between border-b border-border px-3 py-2",
|
|
2136
2407
|
children: /* @__PURE__ */ jsx("span", {
|
|
2137
|
-
className: "text-[
|
|
2408
|
+
className: "text-[0.78125rem] font-medium text-foreground",
|
|
2138
2409
|
children: title
|
|
2139
2410
|
})
|
|
2140
2411
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
2141
2412
|
className: "overflow-x-auto",
|
|
2142
2413
|
children: /* @__PURE__ */ jsxs("table", {
|
|
2143
|
-
className: "w-full border-collapse text-
|
|
2414
|
+
className: "w-full border-collapse text-start text-[0.8125rem]",
|
|
2144
2415
|
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", {
|
|
2145
2416
|
className: "border-b border-border",
|
|
2146
2417
|
children: columns.map((col) => /* @__PURE__ */ jsx("th", {
|
|
2147
2418
|
scope: "col",
|
|
2148
|
-
className: cn("px-3 py-2 text-[
|
|
2419
|
+
className: cn("px-3 py-2 text-[0.75rem] font-medium text-muted-foreground", col.className),
|
|
2149
2420
|
children: col.header
|
|
2150
2421
|
}, col.id))
|
|
2151
2422
|
}) }), /* @__PURE__ */ jsxs("tbody", { children: [rows.map((row) => {
|
|
2152
2423
|
const out = Boolean(row.removed && showRemovedTint);
|
|
2153
2424
|
return /* @__PURE__ */ jsx("tr", {
|
|
2154
2425
|
"data-removed": out ? "true" : void 0,
|
|
2155
|
-
className: cn("border-b border-border last:border-0", "transition-colors duration-
|
|
2426
|
+
className: cn("border-b border-border last:border-0", "transition-colors duration-(--duration-slow) ease-out motion-reduce:transition-none", out && "bg-destructive/8"),
|
|
2156
2427
|
children: columns.map((col, colIndex) => /* @__PURE__ */ jsx("td", {
|
|
2157
|
-
className: cn("px-3 py-2 align-middle transition-colors duration-
|
|
2428
|
+
className: cn("px-3 py-2 align-middle transition-colors duration-(--duration-slow) motion-reduce:transition-none", out && "text-destructive", out && colIndex > 0 && "line-through decoration-destructive/50", !out && colIndex === 0 && "font-medium text-foreground", !out && colIndex > 0 && "text-muted-foreground", col.className),
|
|
2158
2429
|
children: col.cell(row)
|
|
2159
2430
|
}, col.id))
|
|
2160
2431
|
}, row.id);
|
|
@@ -2164,14 +2435,14 @@ function DiffTable({ title = "Proposed changes", columns, rows, addedRows = [],
|
|
|
2164
2435
|
colSpan: columns.length,
|
|
2165
2436
|
className: "p-0",
|
|
2166
2437
|
children: /* @__PURE__ */ jsx("div", {
|
|
2167
|
-
className: cn("grid transition-[grid-template-rows,opacity] duration-
|
|
2438
|
+
className: cn("grid transition-[grid-template-rows,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", showAdded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
|
|
2168
2439
|
children: /* @__PURE__ */ jsx("div", {
|
|
2169
2440
|
className: "overflow-hidden bg-success/8",
|
|
2170
2441
|
children: /* @__PURE__ */ jsx("div", {
|
|
2171
2442
|
className: "grid items-center border-t border-border",
|
|
2172
2443
|
style: { gridTemplateColumns: `repeat(${columns.length}, minmax(0, 1fr))` },
|
|
2173
2444
|
children: row.cells.map((cell, i) => /* @__PURE__ */ jsx("div", {
|
|
2174
|
-
className: cn("px-3 py-2 text-success", i === 0 && "font-medium"),
|
|
2445
|
+
className: cn("min-w-0 px-3 py-2 text-success [overflow-wrap:anywhere]", i === 0 && "font-medium"),
|
|
2175
2446
|
children: cell
|
|
2176
2447
|
}, i))
|
|
2177
2448
|
})
|
|
@@ -2206,18 +2477,20 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
|
|
|
2206
2477
|
onOpenChange,
|
|
2207
2478
|
className: "group/collapsible",
|
|
2208
2479
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2209
|
-
className: cn("border border-input bg-muted/40", flushBottom ? "rounded-t-
|
|
2480
|
+
className: cn("border border-input bg-muted/40", flushBottom ? "rounded-t-lg border-b-0" : "rounded-lg"),
|
|
2210
2481
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
2211
|
-
className: cn("group flex w-full items-center gap-1.5 px-3 py-2 text-
|
|
2482
|
+
className: cn("group flex w-full items-center gap-1.5 px-3 py-2 text-start text-[0.8125rem]", "text-muted-foreground hover:text-foreground"),
|
|
2212
2483
|
children: [
|
|
2213
2484
|
/* @__PURE__ */ jsx(ListChecks, { className: "size-3.5 shrink-0" }),
|
|
2214
2485
|
complete ? /* @__PURE__ */ jsx("span", {
|
|
2215
|
-
className: "min-w-0 flex-1 truncate font-medium",
|
|
2486
|
+
className: "min-w-0 flex-1 truncate font-medium tabular-nums",
|
|
2216
2487
|
children: `${total}/${total} done`
|
|
2217
2488
|
}) : focusStep ? /* @__PURE__ */ jsxs("span", {
|
|
2218
|
-
|
|
2489
|
+
dir: "auto",
|
|
2490
|
+
title: focusStep.label,
|
|
2491
|
+
className: "min-w-0 flex-1 truncate font-medium [text-align:match-parent]",
|
|
2219
2492
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2220
|
-
className: "
|
|
2493
|
+
className: "me-1.5 font-mono text-[0.75rem] font-normal tabular-nums text-muted-foreground/60",
|
|
2221
2494
|
children: [
|
|
2222
2495
|
focusIndex + 1,
|
|
2223
2496
|
"/",
|
|
@@ -2246,9 +2519,13 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
|
|
|
2246
2519
|
}
|
|
2247
2520
|
function PlanRow({ step }) {
|
|
2248
2521
|
return /* @__PURE__ */ jsxs("li", {
|
|
2249
|
-
className: "flex items-
|
|
2250
|
-
children: [/* @__PURE__ */ jsx(
|
|
2251
|
-
className:
|
|
2522
|
+
className: "flex items-start gap-2 rounded-md px-1.5 py-1 text-[0.8125rem]",
|
|
2523
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2524
|
+
className: "flex h-5 shrink-0 items-center",
|
|
2525
|
+
children: /* @__PURE__ */ jsx(StepIcon, { status: step.status })
|
|
2526
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2527
|
+
dir: "auto",
|
|
2528
|
+
className: cn("min-w-0 flex-1 leading-5 text-pretty [overflow-wrap:anywhere] [text-align:match-parent]", step.status === "done" ? "text-muted-foreground line-through" : "text-foreground"),
|
|
2252
2529
|
children: step.label
|
|
2253
2530
|
})]
|
|
2254
2531
|
});
|
|
@@ -2261,16 +2538,13 @@ function StepIcon({ status }) {
|
|
|
2261
2538
|
|
|
2262
2539
|
//#endregion
|
|
2263
2540
|
//#region src/components/ai/context-ring.tsx
|
|
2541
|
+
const compactNumber = new Intl.NumberFormat("en-US", {
|
|
2542
|
+
notation: "compact",
|
|
2543
|
+
maximumFractionDigits: 1
|
|
2544
|
+
});
|
|
2545
|
+
/** `1048576` is "1M", `999500` is "999.5K" and `9960` is "10K": rounding rolls up to the next unit instead of printing "1000K" or "10.0K". */
|
|
2264
2546
|
function formatCompact(n) {
|
|
2265
|
-
|
|
2266
|
-
const m = n / 1e6;
|
|
2267
|
-
return `${Number.isInteger(m) ? m : m.toFixed(m < 10 ? 2 : 1)}M`;
|
|
2268
|
-
}
|
|
2269
|
-
if (n >= 1e3) {
|
|
2270
|
-
const k = n / 1e3;
|
|
2271
|
-
return `${Number.isInteger(k) ? k : k.toFixed(k < 10 ? 1 : 0)}K`;
|
|
2272
|
-
}
|
|
2273
|
-
return String(n);
|
|
2547
|
+
return Number.isFinite(n) ? compactNumber.format(n) : String(n);
|
|
2274
2548
|
}
|
|
2275
2549
|
function meterTone(pct, recomputing, hasUsage) {
|
|
2276
2550
|
if (!hasUsage) return "idle";
|
|
@@ -2314,7 +2588,8 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
|
|
|
2314
2588
|
const center = size / 2;
|
|
2315
2589
|
const glowPad = snap(Math.max(4, size * .18));
|
|
2316
2590
|
const recomputing = !!usage && usage.tokens === null;
|
|
2317
|
-
const
|
|
2591
|
+
const reported = usage?.percent ?? (usage && usage.tokens !== null && usage.contextWindow > 0 ? usage.tokens / usage.contextWindow * 100 : null);
|
|
2592
|
+
const pct = reported != null ? Math.max(0, Math.min(100, reported)) : 0;
|
|
2318
2593
|
const tone = meterTone(pct, recomputing, !!usage);
|
|
2319
2594
|
const color = toneStroke(tone);
|
|
2320
2595
|
const hit = Math.max(size, 32);
|
|
@@ -2329,7 +2604,7 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
|
|
|
2329
2604
|
let tooltip;
|
|
2330
2605
|
if (!usage) tooltip = "No usage yet";
|
|
2331
2606
|
else if (usage.tokens === null) tooltip = "Recomputing after compaction…";
|
|
2332
|
-
else tooltip = `${Math.round(
|
|
2607
|
+
else tooltip = `${Math.round(Math.max(0, reported ?? 0))}% used · ${formatCompact(usage.tokens)} / ${formatCompact(usage.contextWindow)}`;
|
|
2333
2608
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2334
2609
|
asChild: true,
|
|
2335
2610
|
children: /* @__PURE__ */ jsx("span", {
|
|
@@ -2383,13 +2658,14 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
|
|
|
2383
2658
|
strokeLinecap: "round",
|
|
2384
2659
|
opacity: filled ? recomputing ? .55 : isFrontier ? 1 : .92 : usage ? .38 : .28,
|
|
2385
2660
|
filter: filled ? `url(#${glowId})` : void 0,
|
|
2386
|
-
className: "transition-[stroke,opacity] duration-
|
|
2661
|
+
className: "transition-[stroke,opacity] duration-(--duration-slow) ease-out"
|
|
2387
2662
|
}, i);
|
|
2388
2663
|
})]
|
|
2389
2664
|
})
|
|
2390
2665
|
})
|
|
2391
2666
|
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
2392
2667
|
side: "top",
|
|
2668
|
+
className: "tabular-nums",
|
|
2393
2669
|
children: tooltip
|
|
2394
2670
|
})] });
|
|
2395
2671
|
}
|
|
@@ -2426,8 +2702,8 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
|
|
|
2426
2702
|
strokeDasharray: `${2 * Math.PI * 10 * .28} ${2 * Math.PI * 10 * .72}`
|
|
2427
2703
|
})]
|
|
2428
2704
|
}), progress != null ? /* @__PURE__ */ jsx("span", {
|
|
2429
|
-
className: "relative text-[
|
|
2430
|
-
children: Math.round(progress)
|
|
2705
|
+
className: "relative text-[0.625rem] font-semibold tabular-nums text-foreground",
|
|
2706
|
+
children: Math.round(Math.max(0, Math.min(100, progress)))
|
|
2431
2707
|
}) : /* @__PURE__ */ jsx(Loader2, { className: "relative size-3 animate-spin text-muted-foreground motion-reduce:animate-none" })] }) : status === "completed" ? /* @__PURE__ */ jsx("span", {
|
|
2432
2708
|
className: "flex size-5 items-center justify-center rounded-full bg-success text-white",
|
|
2433
2709
|
children: /* @__PURE__ */ jsx(Check, {
|
|
@@ -2445,20 +2721,22 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
|
|
|
2445
2721
|
/* @__PURE__ */ jsxs("div", {
|
|
2446
2722
|
className: "min-w-0 flex-1",
|
|
2447
2723
|
children: [/* @__PURE__ */ jsx("div", {
|
|
2448
|
-
|
|
2724
|
+
title: typeof label === "string" ? label : void 0,
|
|
2725
|
+
className: "truncate text-[0.8125rem] font-medium text-foreground",
|
|
2449
2726
|
children: label
|
|
2450
2727
|
}), meta ? /* @__PURE__ */ jsx("div", {
|
|
2451
|
-
|
|
2728
|
+
title: typeof meta === "string" ? meta : void 0,
|
|
2729
|
+
className: "truncate text-[0.75rem] text-muted-foreground",
|
|
2452
2730
|
children: meta
|
|
2453
2731
|
}) : null]
|
|
2454
2732
|
}),
|
|
2455
2733
|
status === "completed" ? /* @__PURE__ */ jsx("span", {
|
|
2456
|
-
className: "inline-flex h-5 items-center rounded-full bg-success/10 px-2 text-[
|
|
2734
|
+
className: "inline-flex h-5 items-center rounded-full bg-success/10 px-2 text-[0.71875rem] font-medium text-success",
|
|
2457
2735
|
children: "Completed"
|
|
2458
2736
|
}) : status === "failed" ? /* @__PURE__ */ jsxs("span", {
|
|
2459
2737
|
className: "inline-flex items-center gap-1",
|
|
2460
2738
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2461
|
-
className: "inline-flex h-5 items-center rounded-full bg-destructive/10 px-2 text-[
|
|
2739
|
+
className: "inline-flex h-5 items-center rounded-full bg-destructive/10 px-2 text-[0.71875rem] font-medium text-destructive",
|
|
2462
2740
|
children: "Failed"
|
|
2463
2741
|
}), onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
2464
2742
|
type: "button",
|
|
@@ -2478,25 +2756,25 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
|
|
|
2478
2756
|
return /* @__PURE__ */ jsx("div", {
|
|
2479
2757
|
"data-slot": "task-row",
|
|
2480
2758
|
"data-status": status,
|
|
2481
|
-
className: cn("rounded-lg
|
|
2759
|
+
className: cn("rounded-lg bg-card px-2.5 py-2 shadow-card", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
|
|
2482
2760
|
style: { animationDelay: `${index * 80}ms` },
|
|
2483
2761
|
children: hasDetails ? /* @__PURE__ */ jsxs(Collapsible, {
|
|
2484
2762
|
defaultOpen,
|
|
2485
2763
|
className: "group/collapsible",
|
|
2486
2764
|
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
2487
|
-
className: "w-full text-
|
|
2765
|
+
className: "w-full text-start",
|
|
2488
2766
|
children: header
|
|
2489
2767
|
}), /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
2490
|
-
innerClassName: "py-1.5
|
|
2768
|
+
innerClassName: "py-1.5 ps-8",
|
|
2491
2769
|
children: /* @__PURE__ */ jsx("ul", {
|
|
2492
2770
|
className: "space-y-1",
|
|
2493
2771
|
children: details.map((d, i) => /* @__PURE__ */ jsxs("li", {
|
|
2494
|
-
className: "flex items-center justify-between gap-2 text-[
|
|
2772
|
+
className: "flex items-center justify-between gap-2 text-[0.75rem]",
|
|
2495
2773
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2496
|
-
className: "text-muted-foreground",
|
|
2774
|
+
className: "min-w-0 text-muted-foreground [overflow-wrap:anywhere]",
|
|
2497
2775
|
children: d.label
|
|
2498
2776
|
}), d.meta ? /* @__PURE__ */ jsx("span", {
|
|
2499
|
-
className: "font-mono tabular-nums text-muted-foreground/80",
|
|
2777
|
+
className: "max-w-[55%] min-w-0 text-end font-mono tabular-nums text-muted-foreground/80 [overflow-wrap:anywhere]",
|
|
2500
2778
|
children: d.meta
|
|
2501
2779
|
}) : null]
|
|
2502
2780
|
}, i))
|
|
@@ -2518,34 +2796,35 @@ function TaskList({ children, className }) {
|
|
|
2518
2796
|
function ContextCard({ title, body, meta, sourceType, sourceName, className, index = 0 }) {
|
|
2519
2797
|
return /* @__PURE__ */ jsxs("article", {
|
|
2520
2798
|
"data-slot": "context-card",
|
|
2521
|
-
className: cn("rounded-
|
|
2799
|
+
className: cn("rounded-lg bg-card p-3 shadow-card", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
|
|
2522
2800
|
style: { animationDelay: `${index * 60}ms` },
|
|
2523
2801
|
children: [
|
|
2524
2802
|
/* @__PURE__ */ jsxs("div", {
|
|
2525
2803
|
className: "flex items-start justify-between gap-2",
|
|
2526
2804
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
2527
|
-
className: "text-[
|
|
2805
|
+
className: "min-w-0 text-[0.8125rem] font-medium text-balance text-foreground [overflow-wrap:anywhere]",
|
|
2528
2806
|
children: title
|
|
2529
2807
|
}), meta ? /* @__PURE__ */ jsx("span", {
|
|
2530
|
-
className: "shrink-0 text-[
|
|
2808
|
+
className: "shrink-0 text-[0.6875rem] tabular-nums text-muted-foreground",
|
|
2531
2809
|
children: meta
|
|
2532
2810
|
}) : null]
|
|
2533
2811
|
}),
|
|
2534
2812
|
/* @__PURE__ */ jsx("p", {
|
|
2535
|
-
className: "mt-1.5 text-[
|
|
2813
|
+
className: "mt-1.5 text-[0.8125rem] text-pretty leading-relaxed text-muted-foreground [overflow-wrap:anywhere]",
|
|
2536
2814
|
children: body
|
|
2537
2815
|
}),
|
|
2538
2816
|
(sourceType || sourceName) && /* @__PURE__ */ jsxs("div", {
|
|
2539
|
-
className: "mt-2.5 flex items-center gap-1.5 text-[
|
|
2817
|
+
className: "mt-2.5 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[0.75rem] text-muted-foreground",
|
|
2540
2818
|
children: [
|
|
2541
2819
|
/* @__PURE__ */ jsx(FileText, { className: "size-3 shrink-0 opacity-70" }),
|
|
2542
2820
|
sourceType ? /* @__PURE__ */ jsx(Badge, {
|
|
2543
2821
|
variant: "secondary",
|
|
2544
|
-
className: "h-5 px-1.5 text-[
|
|
2822
|
+
className: "h-5 px-1.5 text-[0.625rem] font-medium",
|
|
2545
2823
|
children: sourceType
|
|
2546
2824
|
}) : null,
|
|
2547
2825
|
sourceName ? /* @__PURE__ */ jsx("span", {
|
|
2548
|
-
|
|
2826
|
+
title: typeof sourceName === "string" ? sourceName : void 0,
|
|
2827
|
+
className: "max-w-full min-w-0 truncate",
|
|
2549
2828
|
children: sourceName
|
|
2550
2829
|
}) : null
|
|
2551
2830
|
]
|
|
@@ -2558,7 +2837,7 @@ function ContextCards({ children, className, label = "Chunks", count }) {
|
|
|
2558
2837
|
"data-slot": "context-cards",
|
|
2559
2838
|
className: cn("flex flex-col gap-2", className),
|
|
2560
2839
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2561
|
-
className: "flex items-center gap-2 text-[
|
|
2840
|
+
className: "flex items-center gap-2 text-[0.75rem] text-muted-foreground",
|
|
2562
2841
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2563
2842
|
className: "font-medium",
|
|
2564
2843
|
children: label
|
|
@@ -2585,22 +2864,22 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2585
2864
|
const pct = confidence != null ? Math.round(Math.max(0, Math.min(1, confidence)) * 100) : null;
|
|
2586
2865
|
return /* @__PURE__ */ jsx("div", {
|
|
2587
2866
|
"data-slot": "recommendation-card",
|
|
2588
|
-
className: cn("w-full max-w-md overflow-hidden rounded-
|
|
2867
|
+
className: cn("w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card", className),
|
|
2589
2868
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2590
2869
|
className: "space-y-3 p-3",
|
|
2591
2870
|
children: [
|
|
2592
2871
|
/* @__PURE__ */ jsx("div", {
|
|
2593
|
-
className: "text-[
|
|
2872
|
+
className: "text-[0.75rem] font-medium text-muted-foreground",
|
|
2594
2873
|
children: title
|
|
2595
2874
|
}),
|
|
2596
2875
|
/* @__PURE__ */ jsx("div", {
|
|
2597
|
-
className: "text-[
|
|
2876
|
+
className: "text-[0.8125rem] text-pretty leading-relaxed text-foreground [overflow-wrap:anywhere]",
|
|
2598
2877
|
children: displayBody
|
|
2599
2878
|
}),
|
|
2600
2879
|
pct != null ? /* @__PURE__ */ jsxs("div", {
|
|
2601
2880
|
className: "space-y-1",
|
|
2602
2881
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2603
|
-
className: "flex items-center justify-between text-[
|
|
2882
|
+
className: "flex items-center justify-between text-[0.6875rem] text-muted-foreground",
|
|
2604
2883
|
children: [/* @__PURE__ */ jsx("span", { children: confidenceLabel ?? "Confidence" }), /* @__PURE__ */ jsxs("span", {
|
|
2605
2884
|
className: "tabular-nums font-medium text-foreground",
|
|
2606
2885
|
children: [pct, "%"]
|
|
@@ -2608,7 +2887,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2608
2887
|
}), /* @__PURE__ */ jsx("div", {
|
|
2609
2888
|
className: "h-1.5 overflow-hidden rounded-full bg-muted",
|
|
2610
2889
|
children: /* @__PURE__ */ jsx("div", {
|
|
2611
|
-
className: "h-full origin-left rounded-full bg-primary transition-transform duration-
|
|
2890
|
+
className: "h-full origin-left rounded-full bg-primary rtl:origin-right transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none",
|
|
2612
2891
|
style: { transform: `scaleX(${pct / 100})` }
|
|
2613
2892
|
})
|
|
2614
2893
|
})]
|
|
@@ -2616,7 +2895,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2616
2895
|
alternatives.length > 0 ? /* @__PURE__ */ jsxs(Collapsible, {
|
|
2617
2896
|
className: "group/collapsible",
|
|
2618
2897
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
2619
|
-
className: cn("flex w-full items-center justify-between rounded-md border border-border
|
|
2898
|
+
className: cn("flex w-full items-center justify-between rounded-md border border-border px-2.5 py-1.5 text-[0.78125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
|
|
2620
2899
|
children: [/* @__PURE__ */ jsx("span", { children: "Other options" }), /* @__PURE__ */ jsx(ChevronDown, {
|
|
2621
2900
|
"data-slot": "collapsible-icon",
|
|
2622
2901
|
className: "size-3.5"
|
|
@@ -2633,7 +2912,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2633
2912
|
onClick: () => {
|
|
2634
2913
|
setInternalId(opt.id);
|
|
2635
2914
|
},
|
|
2636
|
-
className: cn("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-
|
|
2915
|
+
className: cn("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-start text-[0.8125rem]", "hover:bg-accent", on && "bg-accent"),
|
|
2637
2916
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2638
2917
|
className: cn("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
|
|
2639
2918
|
children: on ? /* @__PURE__ */ jsx(Check, {
|
|
@@ -2643,10 +2922,10 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2643
2922
|
}), /* @__PURE__ */ jsxs("span", {
|
|
2644
2923
|
className: "min-w-0 flex-1",
|
|
2645
2924
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2646
|
-
className: "font-medium text-foreground",
|
|
2925
|
+
className: "font-medium text-foreground [overflow-wrap:anywhere]",
|
|
2647
2926
|
children: opt.label
|
|
2648
2927
|
}), opt.badge ? /* @__PURE__ */ jsx("span", {
|
|
2649
|
-
className: "
|
|
2928
|
+
className: "ms-1.5 text-[0.6875rem] text-muted-foreground",
|
|
2650
2929
|
children: opt.badge
|
|
2651
2930
|
}) : null]
|
|
2652
2931
|
})]
|
|
@@ -2656,10 +2935,11 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
|
|
|
2656
2935
|
})]
|
|
2657
2936
|
}) : null,
|
|
2658
2937
|
/* @__PURE__ */ jsx("div", {
|
|
2659
|
-
className: "flex justify-end",
|
|
2938
|
+
className: "flex flex-wrap justify-end",
|
|
2660
2939
|
children: /* @__PURE__ */ jsx(Button, {
|
|
2661
2940
|
type: "button",
|
|
2662
2941
|
size: "sm",
|
|
2942
|
+
wrap: true,
|
|
2663
2943
|
onClick: () => onAccept?.(selectedId),
|
|
2664
2944
|
children: acceptLabel
|
|
2665
2945
|
})
|
|
@@ -2753,14 +3033,14 @@ function FileUpload({ files: filesProp, onFilesChange, multiple = true, accept,
|
|
|
2753
3033
|
onDragOver: (e) => e.preventDefault(),
|
|
2754
3034
|
onDragLeave: () => setDragging(false),
|
|
2755
3035
|
onDrop,
|
|
2756
|
-
className: cn("flex cursor-pointer
|
|
3036
|
+
className: cn("flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed px-4 text-center", "transition-colors duration-(--duration-moderate)", variant === "compact" ? "flex-row rounded-md py-3" : "flex-col py-6", dragging ? "border-primary bg-primary/5" : "border-border bg-muted/30 hover:bg-muted/50", disabled && "pointer-events-none opacity-60"),
|
|
2757
3037
|
children: [
|
|
2758
|
-
/* @__PURE__ */ jsx(Upload, { className: "
|
|
3038
|
+
/* @__PURE__ */ jsx(Upload, { className: cn("text-muted-foreground", variant === "compact" ? "size-4" : "size-5") }),
|
|
2759
3039
|
/* @__PURE__ */ jsx("div", {
|
|
2760
|
-
className: "text-[
|
|
3040
|
+
className: "text-[0.8125rem] font-medium text-foreground",
|
|
2761
3041
|
children: "Drop files or click to upload"
|
|
2762
3042
|
}),
|
|
2763
|
-
/* @__PURE__ */ jsx("div", {
|
|
3043
|
+
variant === "compact" ? null : /* @__PURE__ */ jsx("div", {
|
|
2764
3044
|
className: "text-xs text-muted-foreground",
|
|
2765
3045
|
children: multiple ? "Multiple files supported" : "Single file"
|
|
2766
3046
|
})
|
|
@@ -2769,10 +3049,11 @@ function FileUpload({ files: filesProp, onFilesChange, multiple = true, accept,
|
|
|
2769
3049
|
files.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
2770
3050
|
className: "flex flex-col gap-1",
|
|
2771
3051
|
children: files.map((file, i) => /* @__PURE__ */ jsxs("li", {
|
|
2772
|
-
className: "flex items-center gap-2 rounded-md border border-border bg-card px-2 py-1.5 text-[
|
|
3052
|
+
className: "flex items-center gap-2 rounded-md border border-border bg-card px-2 py-1.5 text-[0.78125rem]",
|
|
2773
3053
|
children: [
|
|
2774
3054
|
/* @__PURE__ */ jsx(Paperclip, { className: "size-3.5 shrink-0 text-muted-foreground" }),
|
|
2775
3055
|
/* @__PURE__ */ jsx("span", {
|
|
3056
|
+
title: file.name,
|
|
2776
3057
|
className: "min-w-0 flex-1 truncate font-medium",
|
|
2777
3058
|
children: file.name
|
|
2778
3059
|
}),
|
|
@@ -2830,11 +3111,1274 @@ function AiImage({ data, mimeType = "image/png", src, bytes, alt = "", className
|
|
|
2830
3111
|
"data-slot": "ai-image",
|
|
2831
3112
|
src: resolved,
|
|
2832
3113
|
alt,
|
|
2833
|
-
className: cn("max-h-80 max-w-full rounded-lg object-contain", "outline outline-1 outline-black/10 dark:outline-white/10", className),
|
|
3114
|
+
className: cn("max-h-80 max-w-full rounded-lg object-contain", "outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10", className),
|
|
2834
3115
|
...props
|
|
2835
3116
|
});
|
|
2836
3117
|
}
|
|
2837
3118
|
|
|
2838
3119
|
//#endregion
|
|
2839
|
-
|
|
2840
|
-
|
|
3120
|
+
//#region src/components/ai/mark-tile.tsx
|
|
3121
|
+
const SIZE = {
|
|
3122
|
+
xs: "size-4 rounded-[5px] text-[0.5625rem] [&_svg:not([class*=size-])]:size-2.5",
|
|
3123
|
+
sm: "size-6 rounded-md text-[0.6875rem] [&_svg:not([class*=size-])]:size-3.5",
|
|
3124
|
+
md: "size-8 rounded-lg text-sm [&_svg:not([class*=size-])]:size-4"
|
|
3125
|
+
};
|
|
3126
|
+
/**
|
|
3127
|
+
* Square tile that frames an app mark or glyph. The edge is an inset outline
|
|
3128
|
+
* rather than a border, so pale marks keep a shape on any surface without the
|
|
3129
|
+
* tile growing.
|
|
3130
|
+
*/
|
|
3131
|
+
function MarkTile({ size = "xs", className, children, ...props }) {
|
|
3132
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3133
|
+
"aria-hidden": "true",
|
|
3134
|
+
"data-slot": "mark-tile",
|
|
3135
|
+
className: cn("grid shrink-0 place-items-center overflow-hidden bg-card leading-none text-muted-foreground", "outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10", SIZE[size], className),
|
|
3136
|
+
...props,
|
|
3137
|
+
children
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* Enter treatment for icons that appear on a state change (a check replacing a
|
|
3142
|
+
* spinner, a settled chip). Uses `@starting-style` so it needs no keyframes.
|
|
3143
|
+
*/
|
|
3144
|
+
const iconEnterClass = "transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] starting:scale-25 starting:opacity-0 starting:blur-[4px] motion-reduce:transition-none";
|
|
3145
|
+
|
|
3146
|
+
//#endregion
|
|
3147
|
+
//#region src/components/ai/tool-trace.tsx
|
|
3148
|
+
const STATUS_LABEL = {
|
|
3149
|
+
pending: "Queued",
|
|
3150
|
+
running: "Running",
|
|
3151
|
+
done: "Done",
|
|
3152
|
+
error: "Failed"
|
|
3153
|
+
};
|
|
3154
|
+
/** Delay between rows as a trace enters, so it reads top to bottom. */
|
|
3155
|
+
const ROW_STAGGER_MS = 80;
|
|
3156
|
+
/**
|
|
3157
|
+
* Quiet tool-call trace: a heading row, then one row per call hung from a
|
|
3158
|
+
* single rail under the heading glyph. Each row morphs from spinner to check
|
|
3159
|
+
* as the call settles, or to an alert when it fails.
|
|
3160
|
+
*/
|
|
3161
|
+
function ToolTrace({ title = "Read tools", icon, steps, className, ...props }) {
|
|
3162
|
+
return /* @__PURE__ */ jsxs("ol", {
|
|
3163
|
+
"data-slot": "tool-trace",
|
|
3164
|
+
className: cn("flex flex-col", className),
|
|
3165
|
+
...props,
|
|
3166
|
+
children: [/* @__PURE__ */ jsxs("li", {
|
|
3167
|
+
className: "mb-1 flex h-7 items-center gap-2",
|
|
3168
|
+
children: [/* @__PURE__ */ jsx(MarkTile, { children: icon ?? /* @__PURE__ */ jsx(BookOpen, {}) }), /* @__PURE__ */ jsx("span", {
|
|
3169
|
+
className: "text-[0.8125rem] text-foreground",
|
|
3170
|
+
children: title
|
|
3171
|
+
})]
|
|
3172
|
+
}), steps.map((step, index) => {
|
|
3173
|
+
const status = step.status ?? "done";
|
|
3174
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
3175
|
+
"data-status": status,
|
|
3176
|
+
style: { animationDelay: `${(index + 1) * ROW_STAGGER_MS}ms` },
|
|
3177
|
+
className: "ms-2 flex h-8 animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] items-center gap-2 border-s border-subtle-foreground/25 ps-3 motion-reduce:animate-none",
|
|
3178
|
+
children: [
|
|
3179
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3180
|
+
className: "grid size-4 shrink-0 place-items-center text-subtle-foreground",
|
|
3181
|
+
children: [status === "done" ? /* @__PURE__ */ jsx(Check, {
|
|
3182
|
+
"aria-hidden": "true",
|
|
3183
|
+
className: cn("size-3", iconEnterClass),
|
|
3184
|
+
strokeWidth: 2
|
|
3185
|
+
}) : status === "error" ? /* @__PURE__ */ jsx(CircleAlert, {
|
|
3186
|
+
"aria-hidden": "true",
|
|
3187
|
+
className: cn("size-3.5 text-destructive", iconEnterClass)
|
|
3188
|
+
}) : /* @__PURE__ */ jsx(Spinner, {
|
|
3189
|
+
"aria-hidden": "true",
|
|
3190
|
+
role: void 0,
|
|
3191
|
+
className: "size-3.5",
|
|
3192
|
+
strokeWidth: 1.5
|
|
3193
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3194
|
+
className: "sr-only",
|
|
3195
|
+
children: STATUS_LABEL[status]
|
|
3196
|
+
})]
|
|
3197
|
+
}),
|
|
3198
|
+
step.icon ? /* @__PURE__ */ jsx(MarkTile, {
|
|
3199
|
+
className: "text-foreground",
|
|
3200
|
+
children: step.icon
|
|
3201
|
+
}) : null,
|
|
3202
|
+
/* @__PURE__ */ jsx("span", {
|
|
3203
|
+
className: cn("truncate text-[0.8125rem]", status === "running" || status === "error" ? "text-foreground" : "text-muted-foreground"),
|
|
3204
|
+
children: step.label
|
|
3205
|
+
})
|
|
3206
|
+
]
|
|
3207
|
+
}, step.id);
|
|
3208
|
+
})]
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
//#endregion
|
|
3213
|
+
//#region src/components/ai/thinking-status.tsx
|
|
3214
|
+
function formatElapsed(totalSeconds) {
|
|
3215
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
3216
|
+
const seconds = totalSeconds % 60;
|
|
3217
|
+
return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
|
|
3218
|
+
}
|
|
3219
|
+
function ThinkingGlyph() {
|
|
3220
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3221
|
+
"aria-hidden": "true",
|
|
3222
|
+
className: "grid size-4 grid-cols-3 place-items-center gap-px p-0.5",
|
|
3223
|
+
children: Array.from({ length: 9 }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
3224
|
+
className: "size-[3px] rounded-full bg-muted-foreground animate-[ai-pulse-dot_1.2s_ease-in-out_infinite] motion-reduce:animate-none",
|
|
3225
|
+
style: { animationDelay: `${index * 5 % 9 * 110}ms` }
|
|
3226
|
+
}, index))
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
/**
|
|
3230
|
+
* Compact in-flight status: pulsing glyph, label, elapsed time, and token
|
|
3231
|
+
* spend. Digits are tabular so the row never jitters while it ticks.
|
|
3232
|
+
*/
|
|
3233
|
+
function ThinkingStatus({ label = "Thinking", elapsedSeconds = 0, tokens, live = true, tokensPerTick = 0, className, ...props }) {
|
|
3234
|
+
const [ticks, setTicks] = React$1.useState({
|
|
3235
|
+
seconds: 0,
|
|
3236
|
+
tokens: 0
|
|
3237
|
+
});
|
|
3238
|
+
React$1.useEffect(() => {
|
|
3239
|
+
if (!live) return;
|
|
3240
|
+
const id = window.setInterval(() => {
|
|
3241
|
+
setTicks((current) => ({
|
|
3242
|
+
seconds: current.seconds + 1,
|
|
3243
|
+
tokens: current.tokens + (tokensPerTick ? Math.round(tokensPerTick * (.6 + Math.random() * .8)) : 0)
|
|
3244
|
+
}));
|
|
3245
|
+
}, 1e3);
|
|
3246
|
+
return () => window.clearInterval(id);
|
|
3247
|
+
}, [live, tokensPerTick]);
|
|
3248
|
+
const seconds = elapsedSeconds + (live ? ticks.seconds : 0);
|
|
3249
|
+
const spent = (tokens ?? 0) + (live ? ticks.tokens : 0);
|
|
3250
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3251
|
+
role: "status",
|
|
3252
|
+
"aria-live": "polite",
|
|
3253
|
+
"data-slot": "thinking-status",
|
|
3254
|
+
className: cn("flex h-7 items-center gap-2 text-[0.8125rem]", className),
|
|
3255
|
+
...props,
|
|
3256
|
+
children: [
|
|
3257
|
+
/* @__PURE__ */ jsx(ThinkingGlyph, {}),
|
|
3258
|
+
/* @__PURE__ */ jsx("span", {
|
|
3259
|
+
className: "text-muted-foreground",
|
|
3260
|
+
children: label
|
|
3261
|
+
}),
|
|
3262
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3263
|
+
"aria-hidden": "true",
|
|
3264
|
+
className: "flex items-center gap-1.5 text-subtle-foreground tabular-nums",
|
|
3265
|
+
children: [/* @__PURE__ */ jsx("span", { children: formatElapsed(seconds) }), tokens !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
3266
|
+
"aria-hidden": "true",
|
|
3267
|
+
className: "size-0.5 rounded-full bg-current"
|
|
3268
|
+
}), /* @__PURE__ */ jsxs("span", { children: [formatCompact(spent), " tokens"] })] }) : null]
|
|
3269
|
+
})
|
|
3270
|
+
]
|
|
3271
|
+
});
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
//#endregion
|
|
3275
|
+
//#region src/components/ai/prompt-input-tray.tsx
|
|
3276
|
+
const TONE_COLOR = {
|
|
3277
|
+
neutral: "var(--muted-foreground)",
|
|
3278
|
+
info: "var(--info)",
|
|
3279
|
+
warning: "var(--warning)",
|
|
3280
|
+
danger: "var(--destructive)"
|
|
3281
|
+
};
|
|
3282
|
+
/**
|
|
3283
|
+
* Tinted shell that docks status rows onto a composer so the two read as one
|
|
3284
|
+
* surface. The tray is 18px with a 4px inset, so the composer inside is
|
|
3285
|
+
* rounded to 14px (concentric). Tone tints the tray, its edge, and the icon in
|
|
3286
|
+
* each row; text stays at full contrast. Renders the composer alone when there
|
|
3287
|
+
* is nothing to dock.
|
|
3288
|
+
*/
|
|
3289
|
+
function PromptInputTray({ tone = "neutral", header, footer, children, className, style, ...props }) {
|
|
3290
|
+
if (!header && !footer) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
3291
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3292
|
+
"data-slot": "prompt-input-tray",
|
|
3293
|
+
"data-tone": tone,
|
|
3294
|
+
style: {
|
|
3295
|
+
"--tray-tone": TONE_COLOR[tone],
|
|
3296
|
+
...style
|
|
3297
|
+
},
|
|
3298
|
+
className: cn("flex flex-col rounded-[18px] p-1", "bg-[color-mix(in_oklab,var(--tray-tone)_8%,var(--card))] dark:bg-[color-mix(in_oklab,var(--tray-tone)_13%,var(--card))]", "shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--tray-tone)_22%,transparent)]", "[&_[data-slot=prompt-input]]:rounded-[14px] [&_[data-slot=prompt-input]]:bg-card", className),
|
|
3299
|
+
...props,
|
|
3300
|
+
children: [
|
|
3301
|
+
header ? /* @__PURE__ */ jsx("div", {
|
|
3302
|
+
"data-slot": "prompt-input-tray-header",
|
|
3303
|
+
children: header
|
|
3304
|
+
}) : null,
|
|
3305
|
+
children,
|
|
3306
|
+
footer ? /* @__PURE__ */ jsx("div", {
|
|
3307
|
+
"data-slot": "prompt-input-tray-footer",
|
|
3308
|
+
children: footer
|
|
3309
|
+
}) : null
|
|
3310
|
+
]
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
/** One line inside a tray: tone-colored icon, text, and trailing actions. */
|
|
3314
|
+
function PromptInputTrayRow({ icon, children, actions, className, ...props }) {
|
|
3315
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3316
|
+
"data-slot": "prompt-input-tray-row",
|
|
3317
|
+
className: cn("flex min-h-8 items-center gap-2 px-2.5 py-1 text-[0.8125rem] text-foreground", className),
|
|
3318
|
+
...props,
|
|
3319
|
+
children: [
|
|
3320
|
+
icon ? /* @__PURE__ */ jsx("span", {
|
|
3321
|
+
"aria-hidden": "true",
|
|
3322
|
+
className: "grid size-4 shrink-0 place-items-center text-[color-mix(in_oklab,var(--tray-tone,var(--muted-foreground)),var(--foreground)_20%)] [&_svg]:size-3.5",
|
|
3323
|
+
children: icon
|
|
3324
|
+
}) : null,
|
|
3325
|
+
/* @__PURE__ */ jsx("div", {
|
|
3326
|
+
className: "min-w-0 flex-1 text-pretty",
|
|
3327
|
+
children
|
|
3328
|
+
}),
|
|
3329
|
+
actions ? /* @__PURE__ */ jsx("div", {
|
|
3330
|
+
className: "flex shrink-0 items-center gap-1",
|
|
3331
|
+
children: actions
|
|
3332
|
+
}) : null
|
|
3333
|
+
]
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
//#endregion
|
|
3338
|
+
//#region src/components/ai/usage-notice.tsx
|
|
3339
|
+
/** Tray tone for a budget share: calm below 75%, warning to 90%, danger beyond. */
|
|
3340
|
+
function usageTone(percent) {
|
|
3341
|
+
if (percent >= 90) return "danger";
|
|
3342
|
+
if (percent >= 75) return "warning";
|
|
3343
|
+
return "info";
|
|
3344
|
+
}
|
|
3345
|
+
const linkClass = "rounded-sm font-medium text-link underline-offset-2 outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50";
|
|
3346
|
+
/**
|
|
3347
|
+
* Plan-budget line for the header of a `PromptInputTray`:
|
|
3348
|
+
*
|
|
3349
|
+
* ```tsx
|
|
3350
|
+
* <PromptInputTray tone={usageTone(80)} header={<UsageNotice percent={80} onDismiss={dismiss} />}>
|
|
3351
|
+
* <PromptInput … />
|
|
3352
|
+
* </PromptInputTray>
|
|
3353
|
+
* ```
|
|
3354
|
+
*/
|
|
3355
|
+
function UsageNotice({ percent, message, actionLabel = "View usage", actionHref, onAction, onDismiss, ...props }) {
|
|
3356
|
+
const tone = usageTone(percent);
|
|
3357
|
+
const action = actionHref ? /* @__PURE__ */ jsx("a", {
|
|
3358
|
+
className: linkClass,
|
|
3359
|
+
href: actionHref,
|
|
3360
|
+
onClick: onAction,
|
|
3361
|
+
children: actionLabel
|
|
3362
|
+
}) : onAction ? /* @__PURE__ */ jsx("button", {
|
|
3363
|
+
type: "button",
|
|
3364
|
+
className: cn(linkClass, "cursor-pointer"),
|
|
3365
|
+
onClick: onAction,
|
|
3366
|
+
children: actionLabel
|
|
3367
|
+
}) : null;
|
|
3368
|
+
return /* @__PURE__ */ jsx(PromptInputTrayRow, {
|
|
3369
|
+
"data-slot": "usage-notice",
|
|
3370
|
+
"data-tone": tone,
|
|
3371
|
+
icon: tone === "info" ? /* @__PURE__ */ jsx(Gauge, {}) : /* @__PURE__ */ jsx(TriangleAlert, {}),
|
|
3372
|
+
actions: onDismiss ? /* @__PURE__ */ jsx("button", {
|
|
3373
|
+
type: "button",
|
|
3374
|
+
"aria-label": "Dismiss",
|
|
3375
|
+
onClick: onDismiss,
|
|
3376
|
+
className: "relative grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-hover hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-2.5",
|
|
3377
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
3378
|
+
"aria-hidden": "true",
|
|
3379
|
+
className: "size-3.5"
|
|
3380
|
+
})
|
|
3381
|
+
}) : null,
|
|
3382
|
+
...props,
|
|
3383
|
+
children: /* @__PURE__ */ jsxs("p", { children: [message ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3384
|
+
"You've used ",
|
|
3385
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3386
|
+
className: "tabular-nums",
|
|
3387
|
+
children: [Math.round(percent), "%"]
|
|
3388
|
+
}),
|
|
3389
|
+
" of your tokens."
|
|
3390
|
+
] }), action ? /* @__PURE__ */ jsxs(Fragment, { children: [" ", action] }) : null] })
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
//#endregion
|
|
3395
|
+
//#region src/components/ai/model-selector.tsx
|
|
3396
|
+
const TAG_LABEL = {
|
|
3397
|
+
new: "New",
|
|
3398
|
+
free: "Free",
|
|
3399
|
+
beta: "Beta",
|
|
3400
|
+
preview: "Preview",
|
|
3401
|
+
deprecated: "Deprecated"
|
|
3402
|
+
};
|
|
3403
|
+
function levelOf(model, levelId) {
|
|
3404
|
+
return model.levels?.find((level) => level.id === levelId) ?? model.levels?.find((level) => level.id === model.defaultLevel) ?? model.levels?.[0];
|
|
3405
|
+
}
|
|
3406
|
+
function pricingOf(model, level) {
|
|
3407
|
+
return level?.pricing ?? model.pricing;
|
|
3408
|
+
}
|
|
3409
|
+
function formatPrice(amount, currency = "USD") {
|
|
3410
|
+
return new Intl.NumberFormat("en-US", {
|
|
3411
|
+
style: "currency",
|
|
3412
|
+
currency,
|
|
3413
|
+
minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
|
|
3414
|
+
maximumFractionDigits: amount > 0 && amount < 1 ? 3 : 2
|
|
3415
|
+
}).format(amount);
|
|
3416
|
+
}
|
|
3417
|
+
function formatTokens(tokens) {
|
|
3418
|
+
return formatCompact(tokens);
|
|
3419
|
+
}
|
|
3420
|
+
/** Blended cost used to rank models on the meter: output weighted 3:1, as in typical chat traffic. */
|
|
3421
|
+
function blendedCost(pricing) {
|
|
3422
|
+
return pricing ? (pricing.input + pricing.output * 3) / 4 : 0;
|
|
3423
|
+
}
|
|
3424
|
+
function isFree(pricing) {
|
|
3425
|
+
return pricing !== void 0 && pricing.input === 0 && pricing.output === 0;
|
|
3426
|
+
}
|
|
3427
|
+
/** Number of blocks in the cost indicator. */
|
|
3428
|
+
const COST_TIERS = 4;
|
|
3429
|
+
/** Maps a log-scaled cost share (0-1) to 1-4 blocks. Free models get 0. */
|
|
3430
|
+
function costTier(share, free) {
|
|
3431
|
+
if (free) return 0;
|
|
3432
|
+
return Math.min(COST_TIERS, Math.max(1, Math.ceil(share * COST_TIERS)));
|
|
3433
|
+
}
|
|
3434
|
+
/**
|
|
3435
|
+
* Relative cost as a row of building blocks: one to four filled, stepping up in height like a stack being built.
|
|
3436
|
+
* Discrete tiers read faster than a continuous bar, and the muted fill keeps the list calm while scanning.
|
|
3437
|
+
*/
|
|
3438
|
+
function CostBlocks({ tier }) {
|
|
3439
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3440
|
+
role: "img",
|
|
3441
|
+
"aria-label": `Cost tier ${tier} of ${COST_TIERS}`,
|
|
3442
|
+
className: "flex h-2.5 shrink-0 items-end gap-0.5",
|
|
3443
|
+
children: Array.from({ length: COST_TIERS }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
3444
|
+
"aria-hidden": "true",
|
|
3445
|
+
className: cn("w-[3px] rounded-[1px]", index < tier ? "bg-muted-foreground" : "bg-[color-mix(in_oklab,currentColor_14%,transparent)]"),
|
|
3446
|
+
style: { height: `${4 + index * 2}px` }
|
|
3447
|
+
}, index))
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
function PriceText({ pricing }) {
|
|
3451
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
3452
|
+
className: "text-[0.6875rem] text-muted-foreground tabular-nums",
|
|
3453
|
+
children: [
|
|
3454
|
+
formatPrice(pricing.input, pricing.currency),
|
|
3455
|
+
/* @__PURE__ */ jsx("span", {
|
|
3456
|
+
className: "text-subtle-foreground",
|
|
3457
|
+
children: " / "
|
|
3458
|
+
}),
|
|
3459
|
+
formatPrice(pricing.output, pricing.currency)
|
|
3460
|
+
]
|
|
3461
|
+
});
|
|
3462
|
+
}
|
|
3463
|
+
/** Tags shown on a model row before the rest collapse into a count. */
|
|
3464
|
+
const MAX_ROW_TAGS = 2;
|
|
3465
|
+
function Tag({ tag }) {
|
|
3466
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3467
|
+
className: cn("shrink-0 text-[0.6875rem] font-medium", tag === "new" ? "text-link" : tag === "deprecated" ? "text-subtle-foreground line-through" : "text-muted-foreground"),
|
|
3468
|
+
children: TAG_LABEL[tag]
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
function ModelGlyph({ model }) {
|
|
3472
|
+
return /* @__PURE__ */ jsx(MarkTile, {
|
|
3473
|
+
className: "text-foreground",
|
|
3474
|
+
children: model.icon ?? /* @__PURE__ */ jsx("span", {
|
|
3475
|
+
className: "font-semibold",
|
|
3476
|
+
children: model.provider.charAt(0)
|
|
3477
|
+
})
|
|
3478
|
+
});
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* A model's reasoning levels as compact radio rows. The description of the level under the pointer (or the chosen
|
|
3482
|
+
* one) shows once below them, in a slot sized to the longest so the card holds still while moving through them.
|
|
3483
|
+
*/
|
|
3484
|
+
function LevelMenu({ model, levelId, onPick }) {
|
|
3485
|
+
const [peek, setPeek] = React$1.useState();
|
|
3486
|
+
const levels = model.levels ?? [];
|
|
3487
|
+
const shown = peek ?? levelId;
|
|
3488
|
+
const described = levels.some((level) => level.description);
|
|
3489
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
3490
|
+
/* @__PURE__ */ jsxs("p", {
|
|
3491
|
+
className: "flex h-6 items-center justify-between gap-2 px-2 text-[0.6875rem] text-subtle-foreground",
|
|
3492
|
+
children: ["Reasoning", levels.length > 1 ? /* @__PURE__ */ jsxs("span", {
|
|
3493
|
+
"aria-hidden": "true",
|
|
3494
|
+
className: "hidden items-center gap-0.5 pointer-fine:flex",
|
|
3495
|
+
children: [/* @__PURE__ */ jsx(Kbd, {
|
|
3496
|
+
className: "h-4 min-w-4 text-[0.625rem]",
|
|
3497
|
+
children: "←"
|
|
3498
|
+
}), /* @__PURE__ */ jsx(Kbd, {
|
|
3499
|
+
className: "h-4 min-w-4 text-[0.625rem]",
|
|
3500
|
+
children: "→"
|
|
3501
|
+
})]
|
|
3502
|
+
}) : null]
|
|
3503
|
+
}),
|
|
3504
|
+
/* @__PURE__ */ jsx("div", {
|
|
3505
|
+
role: "radiogroup",
|
|
3506
|
+
"aria-label": `${model.name} reasoning level`,
|
|
3507
|
+
onPointerLeave: () => setPeek(void 0),
|
|
3508
|
+
className: "flex flex-col",
|
|
3509
|
+
children: levels.map((level) => {
|
|
3510
|
+
const checked = level.id === levelId;
|
|
3511
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
3512
|
+
type: "button",
|
|
3513
|
+
role: "radio",
|
|
3514
|
+
"aria-checked": checked,
|
|
3515
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
3516
|
+
onPointerEnter: () => setPeek(level.id),
|
|
3517
|
+
onFocus: () => setPeek(level.id),
|
|
3518
|
+
onBlur: () => setPeek(void 0),
|
|
3519
|
+
onClick: () => onPick(level.id),
|
|
3520
|
+
className: cn("flex h-7 w-full cursor-pointer items-center gap-2 rounded-sm px-2 text-start text-[0.8125rem] outline-none pointer-coarse:h-11", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50", checked ? "font-medium text-foreground" : "text-foreground/80"),
|
|
3521
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3522
|
+
className: "min-w-0 flex-1 truncate",
|
|
3523
|
+
children: level.label
|
|
3524
|
+
}), /* @__PURE__ */ jsx(Check, {
|
|
3525
|
+
"aria-hidden": "true",
|
|
3526
|
+
className: cn("size-3.5 shrink-0", checked ? "opacity-100" : "opacity-0")
|
|
3527
|
+
})]
|
|
3528
|
+
}, level.id);
|
|
3529
|
+
})
|
|
3530
|
+
}),
|
|
3531
|
+
described ? /* @__PURE__ */ jsx("div", {
|
|
3532
|
+
className: "grid px-2 pt-1 pb-1.5 text-[0.6875rem] leading-4 text-pretty text-muted-foreground",
|
|
3533
|
+
children: levels.map((level) => /* @__PURE__ */ jsx("p", {
|
|
3534
|
+
"aria-hidden": level.id !== shown,
|
|
3535
|
+
className: cn("[grid-area:1/1]", level.id === shown ? "visible" : "invisible"),
|
|
3536
|
+
children: level.description
|
|
3537
|
+
}, level.id))
|
|
3538
|
+
}) : null
|
|
3539
|
+
] });
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* The side card for the active model: what it is, its reasoning levels, and its prices. It opens beside the list like
|
|
3543
|
+
* a submenu, so the list never changes size while moving through it.
|
|
3544
|
+
*/
|
|
3545
|
+
function ModelDetails({ model, levelId, onPickLevel }) {
|
|
3546
|
+
const level = levelOf(model, levelId);
|
|
3547
|
+
const pricing = pricingOf(model, level);
|
|
3548
|
+
const free = isFree(pricing);
|
|
3549
|
+
const price = (amount) => free ? "Free" : amount === void 0 || !pricing ? "—" : formatPrice(amount, pricing.currency);
|
|
3550
|
+
const facts = [
|
|
3551
|
+
{
|
|
3552
|
+
label: "Input /1M",
|
|
3553
|
+
value: price(pricing?.input)
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
label: "Output /1M",
|
|
3557
|
+
value: price(pricing?.output)
|
|
3558
|
+
},
|
|
3559
|
+
{
|
|
3560
|
+
label: "Cached /1M",
|
|
3561
|
+
value: free ? "Free" : price(pricing?.cachedInput)
|
|
3562
|
+
},
|
|
3563
|
+
{
|
|
3564
|
+
label: "Context",
|
|
3565
|
+
value: model.contextWindow ? formatTokens(model.contextWindow) : "—"
|
|
3566
|
+
}
|
|
3567
|
+
];
|
|
3568
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3569
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3570
|
+
className: "px-2 pt-1.5 pb-2",
|
|
3571
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3572
|
+
dir: "auto",
|
|
3573
|
+
title: model.name,
|
|
3574
|
+
className: "truncate text-[0.8125rem] font-medium text-foreground",
|
|
3575
|
+
children: model.name
|
|
3576
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
3577
|
+
className: "line-clamp-2 text-[0.6875rem] leading-4 text-pretty text-muted-foreground",
|
|
3578
|
+
children: model.description ?? model.provider
|
|
3579
|
+
})]
|
|
3580
|
+
}),
|
|
3581
|
+
model.levels?.length ? /* @__PURE__ */ jsx(LevelMenu, {
|
|
3582
|
+
model,
|
|
3583
|
+
levelId: level?.id,
|
|
3584
|
+
onPick: onPickLevel
|
|
3585
|
+
}) : null,
|
|
3586
|
+
/* @__PURE__ */ jsx("div", {
|
|
3587
|
+
"aria-hidden": "true",
|
|
3588
|
+
className: "mx-2 h-px bg-border/70"
|
|
3589
|
+
}),
|
|
3590
|
+
/* @__PURE__ */ jsx("dl", {
|
|
3591
|
+
className: "grid grid-cols-2 gap-x-3 gap-y-1.5 px-2 pt-2 pb-1.5",
|
|
3592
|
+
children: facts.map((fact) => /* @__PURE__ */ jsxs("div", {
|
|
3593
|
+
className: "min-w-0",
|
|
3594
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
3595
|
+
className: "truncate text-[0.6875rem] leading-4 text-subtle-foreground",
|
|
3596
|
+
children: fact.label
|
|
3597
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
3598
|
+
className: "truncate text-xs leading-4 text-foreground tabular-nums",
|
|
3599
|
+
children: fact.value
|
|
3600
|
+
})]
|
|
3601
|
+
}, fact.label))
|
|
3602
|
+
})
|
|
3603
|
+
] });
|
|
3604
|
+
}
|
|
3605
|
+
/** Whether `point` lies inside the triangle `a b c` (sign test). */
|
|
3606
|
+
function inTriangle(point, a, b, c) {
|
|
3607
|
+
const side = (p, q, r) => (p.x - r.x) * (q.y - r.y) - (q.x - r.x) * (p.y - r.y);
|
|
3608
|
+
const d1 = side(point, a, b);
|
|
3609
|
+
const d2 = side(point, b, c);
|
|
3610
|
+
const d3 = side(point, c, a);
|
|
3611
|
+
return !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0));
|
|
3612
|
+
}
|
|
3613
|
+
/** One shared empty list, so leaving the section props out doesn't rebuild the sections on every render. */
|
|
3614
|
+
const NO_IDS = [];
|
|
3615
|
+
/** How long a row crossed on the way to the side card waits before taking it over. */
|
|
3616
|
+
const PANEL_INTENT_MS = 240;
|
|
3617
|
+
/**
|
|
3618
|
+
* Model picker for composers: searchable list with pinned routers, recent and
|
|
3619
|
+
* recommended sections, per-provider groups, reasoning levels, relative cost
|
|
3620
|
+
* or per-million pricing, tags, and a side card for the highlighted model
|
|
3621
|
+
* with its reasoning levels.
|
|
3622
|
+
* Controlled: the host owns the selection and persists recents.
|
|
3623
|
+
*/
|
|
3624
|
+
function ModelSelector({ models, value, onValueChange, pinnedIds = NO_IDS, recentIds = NO_IDS, recommendedIds = NO_IDS, priceDisplay: priceDisplayProp = "meter", allowPriceToggle, disabled, align = "start", side = "top", triggerClassName, levelClassName, contentClassName, label = "Model" }) {
|
|
3625
|
+
const [open, setOpen] = React$1.useState(false);
|
|
3626
|
+
const [query, setQuery] = React$1.useState("");
|
|
3627
|
+
const [highlighted, setHighlighted] = React$1.useState("");
|
|
3628
|
+
const [pendingLevels, setPendingLevels] = React$1.useState({});
|
|
3629
|
+
const [priceDisplay, setPriceDisplay] = React$1.useState(priceDisplayProp);
|
|
3630
|
+
/** The row the side card shows. Follows the highlight, except while the pointer heads for the card. */
|
|
3631
|
+
const [active, setActive] = React$1.useState("");
|
|
3632
|
+
const [panel, setPanel] = React$1.useState({
|
|
3633
|
+
top: 0,
|
|
3634
|
+
side: "right"
|
|
3635
|
+
});
|
|
3636
|
+
/** The list's height when filtering starts, held so a short result list doesn't move the search field. */
|
|
3637
|
+
const [listHeight, setListHeight] = React$1.useState();
|
|
3638
|
+
const contentRef = React$1.useRef(null);
|
|
3639
|
+
const listRef = React$1.useRef(null);
|
|
3640
|
+
const panelRef = React$1.useRef(null);
|
|
3641
|
+
const trail = React$1.useRef([]);
|
|
3642
|
+
const intentTimer = React$1.useRef(void 0);
|
|
3643
|
+
const byId = React$1.useMemo(() => new Map(models.map((model) => [model.id, model])), [models]);
|
|
3644
|
+
const selected = byId.get(value.modelId);
|
|
3645
|
+
const selectedLevel = selected ? levelOf(selected, value.levelId) : void 0;
|
|
3646
|
+
const hasPricing = models.some((model) => model.pricing || model.levels?.some((level) => level.pricing));
|
|
3647
|
+
const canTogglePrice = (allowPriceToggle ?? hasPricing) && priceDisplayProp !== "none";
|
|
3648
|
+
const maxCost = React$1.useMemo(() => Math.max(0, ...models.map((model) => blendedCost(pricingOf(model, levelOf(model, void 0))))), [models]);
|
|
3649
|
+
const sections = React$1.useMemo(() => {
|
|
3650
|
+
const pick = (ids) => ids.map((id) => byId.get(id)).filter((model) => Boolean(model));
|
|
3651
|
+
const providers = /* @__PURE__ */ new Map();
|
|
3652
|
+
for (const model of [...models].sort((a, b) => Number(Boolean(a.disabled)) - Number(Boolean(b.disabled)))) {
|
|
3653
|
+
if (pinnedIds.includes(model.id)) continue;
|
|
3654
|
+
const group = providers.get(model.provider);
|
|
3655
|
+
if (group) group.push(model);
|
|
3656
|
+
else providers.set(model.provider, [model]);
|
|
3657
|
+
}
|
|
3658
|
+
const browsing = [
|
|
3659
|
+
{
|
|
3660
|
+
id: "pinned",
|
|
3661
|
+
label: void 0,
|
|
3662
|
+
items: pick(pinnedIds)
|
|
3663
|
+
},
|
|
3664
|
+
{
|
|
3665
|
+
id: "recent",
|
|
3666
|
+
label: "Recently used",
|
|
3667
|
+
items: pick(recentIds)
|
|
3668
|
+
},
|
|
3669
|
+
{
|
|
3670
|
+
id: "recommended",
|
|
3671
|
+
label: "Recommended",
|
|
3672
|
+
items: pick(recommendedIds)
|
|
3673
|
+
}
|
|
3674
|
+
];
|
|
3675
|
+
const all = [...providers].map(([provider, items]) => ({
|
|
3676
|
+
id: `provider:${provider}`,
|
|
3677
|
+
label: provider,
|
|
3678
|
+
items
|
|
3679
|
+
}));
|
|
3680
|
+
return {
|
|
3681
|
+
browsing: browsing.filter((section) => section.items.length > 0),
|
|
3682
|
+
all
|
|
3683
|
+
};
|
|
3684
|
+
}, [
|
|
3685
|
+
byId,
|
|
3686
|
+
models,
|
|
3687
|
+
pinnedIds,
|
|
3688
|
+
recentIds,
|
|
3689
|
+
recommendedIds
|
|
3690
|
+
]);
|
|
3691
|
+
const levelFor = (model) => pendingLevels[model.id] ?? (model.id === value.modelId ? value.levelId : void 0) ?? levelOf(model, void 0)?.id;
|
|
3692
|
+
const choose = (model, levelId = levelFor(model)) => {
|
|
3693
|
+
if (model.disabled) return;
|
|
3694
|
+
onValueChange({
|
|
3695
|
+
modelId: model.id,
|
|
3696
|
+
levelId
|
|
3697
|
+
});
|
|
3698
|
+
setOpen(false);
|
|
3699
|
+
};
|
|
3700
|
+
const highlightedModel = byId.get(highlighted.split("::")[1] ?? "");
|
|
3701
|
+
/** Falls back to the selection so the card is present from the first frame. */
|
|
3702
|
+
const detailModel = byId.get(active.split("::")[1] ?? "") ?? selected;
|
|
3703
|
+
/** The pointer is moving toward the side card through the rows between (the submenu "safe triangle"). */
|
|
3704
|
+
const headingToPanel = () => {
|
|
3705
|
+
const card = panelRef.current?.getBoundingClientRect();
|
|
3706
|
+
const from = trail.current[0];
|
|
3707
|
+
const to = trail.current[trail.current.length - 1];
|
|
3708
|
+
if (!card || !from || !to || panel.side === "below") return false;
|
|
3709
|
+
const edge = panel.side === "right" ? card.left : card.right;
|
|
3710
|
+
return (panel.side === "right" ? to.x > from.x : to.x < from.x) && inTriangle(to, from, {
|
|
3711
|
+
x: edge,
|
|
3712
|
+
y: card.top - 8
|
|
3713
|
+
}, {
|
|
3714
|
+
x: edge,
|
|
3715
|
+
y: card.bottom + 8
|
|
3716
|
+
});
|
|
3717
|
+
};
|
|
3718
|
+
React$1.useEffect(() => {
|
|
3719
|
+
if (!open) return;
|
|
3720
|
+
if (headingToPanel()) intentTimer.current = window.setTimeout(() => setActive(highlighted), PANEL_INTENT_MS);
|
|
3721
|
+
else setActive(highlighted);
|
|
3722
|
+
return () => window.clearTimeout(intentTimer.current);
|
|
3723
|
+
}, [highlighted, open]);
|
|
3724
|
+
/** Lines the card up with its row, clamped to the list, on whichever side has room. */
|
|
3725
|
+
const placePanel = React$1.useCallback(() => {
|
|
3726
|
+
const content = contentRef.current;
|
|
3727
|
+
const card = panelRef.current;
|
|
3728
|
+
if (!content || !card) return;
|
|
3729
|
+
if (window.innerWidth < 640) {
|
|
3730
|
+
setPanel((current) => current.side === "below" ? current : {
|
|
3731
|
+
top: 0,
|
|
3732
|
+
side: "below"
|
|
3733
|
+
});
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
const box = content.getBoundingClientRect();
|
|
3737
|
+
const rows = Array.from(content.querySelectorAll("[data-model-value]"));
|
|
3738
|
+
const row = rows.find((element) => element.dataset.modelValue === active) ?? rows.find((element) => element.dataset.modelValue?.endsWith(`::${value.modelId}`));
|
|
3739
|
+
const rowTop = row ? unscaledRect(row, content, box).top - 4 : 0;
|
|
3740
|
+
const top = Math.round(Math.min(Math.max(8 - box.top, rowTop), window.innerHeight - box.top - card.offsetHeight - 8));
|
|
3741
|
+
const side = box.right + card.offsetWidth + 8 > window.innerWidth ? "left" : "right";
|
|
3742
|
+
setPanel((current) => current.top === top && current.side === side ? current : {
|
|
3743
|
+
top,
|
|
3744
|
+
side
|
|
3745
|
+
});
|
|
3746
|
+
}, [active, value.modelId]);
|
|
3747
|
+
React$1.useLayoutEffect(() => {
|
|
3748
|
+
if (!open) return;
|
|
3749
|
+
placePanel();
|
|
3750
|
+
let frame = requestAnimationFrame(() => {
|
|
3751
|
+
frame = requestAnimationFrame(placePanel);
|
|
3752
|
+
});
|
|
3753
|
+
return () => cancelAnimationFrame(frame);
|
|
3754
|
+
}, [
|
|
3755
|
+
open,
|
|
3756
|
+
placePanel,
|
|
3757
|
+
detailModel
|
|
3758
|
+
]);
|
|
3759
|
+
const onKeyDown = (event) => {
|
|
3760
|
+
window.clearTimeout(intentTimer.current);
|
|
3761
|
+
trail.current = [];
|
|
3762
|
+
if (query || !highlightedModel?.levels?.length || event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
3763
|
+
event.preventDefault();
|
|
3764
|
+
const levels = highlightedModel.levels;
|
|
3765
|
+
const index = levels.findIndex((level) => level.id === levelFor(highlightedModel));
|
|
3766
|
+
const next = levels[Math.min(levels.length - 1, Math.max(0, index + (event.key === "ArrowRight" ? 1 : -1)))];
|
|
3767
|
+
if (next) setPendingLevels((current) => ({
|
|
3768
|
+
...current,
|
|
3769
|
+
[highlightedModel.id]: next.id
|
|
3770
|
+
}));
|
|
3771
|
+
};
|
|
3772
|
+
/** Right-aligned column with a fixed minimum width, so prices, blocks, and checks line up down the list. */
|
|
3773
|
+
const trailing = (model, pricing) => {
|
|
3774
|
+
if (model.disabled && model.disabledReason) return /* @__PURE__ */ jsx("span", {
|
|
3775
|
+
title: model.disabledReason,
|
|
3776
|
+
className: "truncate text-[0.6875rem] text-muted-foreground",
|
|
3777
|
+
children: model.disabledReason
|
|
3778
|
+
});
|
|
3779
|
+
if (priceDisplay === "none" || !pricing) return null;
|
|
3780
|
+
if (isFree(pricing)) return /* @__PURE__ */ jsx("span", {
|
|
3781
|
+
className: "text-[0.6875rem] font-medium text-muted-foreground",
|
|
3782
|
+
children: "Free"
|
|
3783
|
+
});
|
|
3784
|
+
if (priceDisplay === "price") return /* @__PURE__ */ jsx(PriceText, { pricing });
|
|
3785
|
+
return /* @__PURE__ */ jsx(CostBlocks, { tier: costTier(maxCost > 0 ? Math.log1p(blendedCost(pricing)) / Math.log1p(maxCost) : 0, false) });
|
|
3786
|
+
};
|
|
3787
|
+
const renderItem = (model, section) => {
|
|
3788
|
+
const level = levelOf(model, levelFor(model));
|
|
3789
|
+
const pricing = pricingOf(model, level);
|
|
3790
|
+
const tags = model.tags?.filter((tag) => !(tag === "free" && isFree(pricing) && priceDisplay !== "none"));
|
|
3791
|
+
const current = model.id === value.modelId;
|
|
3792
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
3793
|
+
value: `${section}::${model.id}`,
|
|
3794
|
+
"data-model-value": `${section}::${model.id}`,
|
|
3795
|
+
keywords: [
|
|
3796
|
+
model.name,
|
|
3797
|
+
model.provider,
|
|
3798
|
+
...model.levels?.map((entry) => entry.label) ?? [],
|
|
3799
|
+
...model.tags ?? []
|
|
3800
|
+
],
|
|
3801
|
+
disabled: model.disabled,
|
|
3802
|
+
onSelect: () => choose(model),
|
|
3803
|
+
className: "h-7.5 gap-2 rounded-sm px-2 py-0 pointer-coarse:h-11",
|
|
3804
|
+
children: [
|
|
3805
|
+
/* @__PURE__ */ jsx(ModelGlyph, { model }),
|
|
3806
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3807
|
+
className: "flex min-w-0 flex-1 items-baseline gap-1.5",
|
|
3808
|
+
children: [
|
|
3809
|
+
/* @__PURE__ */ jsx("span", {
|
|
3810
|
+
dir: "auto",
|
|
3811
|
+
title: model.name,
|
|
3812
|
+
className: "min-w-0 truncate text-[0.8125rem] font-medium text-foreground",
|
|
3813
|
+
children: model.name
|
|
3814
|
+
}),
|
|
3815
|
+
level ? /* @__PURE__ */ jsx("span", {
|
|
3816
|
+
title: level.label,
|
|
3817
|
+
className: "min-w-0 shrink-[8] truncate text-[0.6875rem] text-muted-foreground",
|
|
3818
|
+
children: level.label
|
|
3819
|
+
}) : null,
|
|
3820
|
+
tags?.slice(0, MAX_ROW_TAGS).map((tag) => /* @__PURE__ */ jsx(Tag, { tag }, tag)),
|
|
3821
|
+
tags && tags.length > MAX_ROW_TAGS ? /* @__PURE__ */ jsxs("span", {
|
|
3822
|
+
title: tags.slice(MAX_ROW_TAGS).map((tag) => TAG_LABEL[tag]).join(", "),
|
|
3823
|
+
className: "shrink-0 text-[0.6875rem] text-muted-foreground tabular-nums",
|
|
3824
|
+
children: ["+", tags.length - MAX_ROW_TAGS]
|
|
3825
|
+
}) : null
|
|
3826
|
+
]
|
|
3827
|
+
}),
|
|
3828
|
+
/* @__PURE__ */ jsx("span", {
|
|
3829
|
+
className: "flex min-w-10 shrink-0 justify-end text-muted-foreground",
|
|
3830
|
+
children: trailing(model, pricing)
|
|
3831
|
+
}),
|
|
3832
|
+
/* @__PURE__ */ jsx(Check, {
|
|
3833
|
+
"aria-hidden": "true",
|
|
3834
|
+
className: cn("size-3.5 shrink-0 text-foreground", current ? "opacity-100" : "opacity-0")
|
|
3835
|
+
})
|
|
3836
|
+
]
|
|
3837
|
+
}, `${section}::${model.id}`);
|
|
3838
|
+
};
|
|
3839
|
+
const visible = query ? sections.all : [...sections.browsing, ...sections.all];
|
|
3840
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
3841
|
+
open,
|
|
3842
|
+
onOpenChange: (next) => {
|
|
3843
|
+
setOpen(next);
|
|
3844
|
+
if (next) {
|
|
3845
|
+
setQuery("");
|
|
3846
|
+
setListHeight(void 0);
|
|
3847
|
+
setPendingLevels({});
|
|
3848
|
+
const home = [...sections.browsing, ...sections.all].find((section) => section.items.some((model) => model.id === value.modelId));
|
|
3849
|
+
if (home) setHighlighted(`${home.id}::${value.modelId}`);
|
|
3850
|
+
}
|
|
3851
|
+
},
|
|
3852
|
+
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
3853
|
+
"aria-label": selected ? `${label}: ${selected.name}${selectedLevel ? `, ${selectedLevel.label}` : ""}` : label,
|
|
3854
|
+
disabled,
|
|
3855
|
+
onClick: (event) => event.stopPropagation(),
|
|
3856
|
+
className: cn("relative flex h-7 max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-1.5 text-xs font-medium text-foreground/85 outline-none", "hover:bg-overlay-hover hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 data-popup-open:bg-overlay-hover data-popup-open:text-foreground", "before:absolute before:inset-x-0 before:-inset-y-1.5", "transition-transform duration-(--duration-fast) motion-safe:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-64", triggerClassName),
|
|
3857
|
+
children: [
|
|
3858
|
+
selected ? /* @__PURE__ */ jsx(ModelGlyph, { model: selected }) : null,
|
|
3859
|
+
/* @__PURE__ */ jsx("span", {
|
|
3860
|
+
dir: "auto",
|
|
3861
|
+
title: selected?.name ?? "Choose a model",
|
|
3862
|
+
className: "truncate",
|
|
3863
|
+
children: selected?.name ?? "Choose a model"
|
|
3864
|
+
}),
|
|
3865
|
+
selectedLevel ? /* @__PURE__ */ jsx("span", {
|
|
3866
|
+
title: selectedLevel.label,
|
|
3867
|
+
className: cn("truncate font-normal text-muted-foreground", levelClassName),
|
|
3868
|
+
children: selectedLevel.label
|
|
3869
|
+
}) : null,
|
|
3870
|
+
/* @__PURE__ */ jsx(ChevronDown, {
|
|
3871
|
+
"aria-hidden": "true",
|
|
3872
|
+
className: "size-3 shrink-0 text-muted-foreground"
|
|
3873
|
+
})
|
|
3874
|
+
]
|
|
3875
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
3876
|
+
side,
|
|
3877
|
+
align,
|
|
3878
|
+
className: cn(popoverSurfaceClass, "relative w-[min(17rem,calc(100vw-1.5rem))] p-0 max-sm:overflow-y-auto sm:overflow-visible", contentClassName),
|
|
3879
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3880
|
+
ref: contentRef,
|
|
3881
|
+
onPointerMove: (event) => {
|
|
3882
|
+
trail.current = [...trail.current.slice(-3), {
|
|
3883
|
+
x: event.clientX,
|
|
3884
|
+
y: event.clientY
|
|
3885
|
+
}];
|
|
3886
|
+
},
|
|
3887
|
+
children: /* @__PURE__ */ jsxs(Command, {
|
|
3888
|
+
value: highlighted,
|
|
3889
|
+
onValueChange: setHighlighted,
|
|
3890
|
+
onKeyDown,
|
|
3891
|
+
loop: true,
|
|
3892
|
+
className: "rounded-[inherit]",
|
|
3893
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
3894
|
+
className: "mx-1 flex items-center gap-1 border-b border-border/70 py-1 *:data-[slot=command-input-wrapper]:min-w-0 *:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:p-0",
|
|
3895
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
3896
|
+
value: query,
|
|
3897
|
+
onValueChange: (next) => {
|
|
3898
|
+
if (next && !query && listRef.current) setListHeight(listRef.current.offsetHeight);
|
|
3899
|
+
if (!next) setListHeight(void 0);
|
|
3900
|
+
setQuery(next);
|
|
3901
|
+
},
|
|
3902
|
+
placeholder: "Search models",
|
|
3903
|
+
className: "gap-2 px-2 [&_input]:h-7 [&_input]:text-[0.8125rem] [&_svg]:size-3.5"
|
|
3904
|
+
}), canTogglePrice ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx("button", {
|
|
3905
|
+
type: "button",
|
|
3906
|
+
"aria-label": "Show prices per million tokens",
|
|
3907
|
+
"aria-pressed": priceDisplay === "price",
|
|
3908
|
+
onClick: () => setPriceDisplay((current) => current === "price" ? "meter" : "price"),
|
|
3909
|
+
className: cn("grid size-6 shrink-0 cursor-pointer place-items-center rounded-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", priceDisplay === "price" ? "bg-overlay-hover text-foreground" : "text-muted-foreground hover:bg-overlay-hover hover:text-foreground"),
|
|
3910
|
+
children: /* @__PURE__ */ jsx(CircleDollarSign, {
|
|
3911
|
+
"aria-hidden": "true",
|
|
3912
|
+
className: "size-3.5"
|
|
3913
|
+
})
|
|
3914
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: priceDisplay === "price" ? "Show relative cost" : "Show prices per 1M tokens" })] }) : null]
|
|
3915
|
+
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
3916
|
+
ref: listRef,
|
|
3917
|
+
density: "compact",
|
|
3918
|
+
style: listHeight ? { height: listHeight } : void 0,
|
|
3919
|
+
className: "max-h-[min(20rem,50vh)]",
|
|
3920
|
+
onScroll: placePanel,
|
|
3921
|
+
children: [/* @__PURE__ */ jsx(CommandEmpty, {
|
|
3922
|
+
className: "py-6 text-center text-[0.8125rem] text-muted-foreground",
|
|
3923
|
+
children: "No models matched"
|
|
3924
|
+
}), visible.map((section) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
3925
|
+
heading: section.label,
|
|
3926
|
+
children: section.items.map((model) => renderItem(model, section.id))
|
|
3927
|
+
}, section.id))]
|
|
3928
|
+
})]
|
|
3929
|
+
})
|
|
3930
|
+
}), detailModel ? /* @__PURE__ */ jsx("div", {
|
|
3931
|
+
ref: panelRef,
|
|
3932
|
+
"data-slot": "model-selector-details",
|
|
3933
|
+
onPointerEnter: () => {
|
|
3934
|
+
window.clearTimeout(intentTimer.current);
|
|
3935
|
+
if (active && active !== highlighted) setHighlighted(active);
|
|
3936
|
+
},
|
|
3937
|
+
style: panel.side === "below" ? void 0 : { top: panel.top },
|
|
3938
|
+
className: cn("p-1", panel.side === "below" ? "mx-1 border-t border-border/70 px-0" : cn(popoverSurfaceClass, "absolute w-56", panel.side === "right" ? "left-full ml-1.5" : "right-full mr-1.5")),
|
|
3939
|
+
children: /* @__PURE__ */ jsx(ModelDetails, {
|
|
3940
|
+
model: detailModel,
|
|
3941
|
+
levelId: levelFor(detailModel),
|
|
3942
|
+
onPickLevel: (levelId) => {
|
|
3943
|
+
setPendingLevels((current) => ({
|
|
3944
|
+
...current,
|
|
3945
|
+
[detailModel.id]: levelId
|
|
3946
|
+
}));
|
|
3947
|
+
choose(detailModel, levelId);
|
|
3948
|
+
}
|
|
3949
|
+
})
|
|
3950
|
+
}) : null]
|
|
3951
|
+
})]
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
//#endregion
|
|
3956
|
+
//#region src/components/ai/prompt-input-attachment.tsx
|
|
3957
|
+
/**
|
|
3958
|
+
* Staged file chip shown inside a composer before sending: thumbnail or icon,
|
|
3959
|
+
* name, meta, upload state, and remove.
|
|
3960
|
+
*/
|
|
3961
|
+
function PromptInputAttachment({ name, meta, previewUrl, icon, status = "ready", onRemove, className, ...props }) {
|
|
3962
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3963
|
+
"data-slot": "prompt-input-attachment",
|
|
3964
|
+
"data-status": status,
|
|
3965
|
+
className: cn("relative flex h-10 max-w-56 min-w-0 items-center gap-2 rounded-lg bg-muted/70 pe-1.5 ps-1 text-start dark:bg-muted", status === "error" && "bg-destructive/8 dark:bg-destructive/16", className),
|
|
3966
|
+
...props,
|
|
3967
|
+
children: [
|
|
3968
|
+
/* @__PURE__ */ jsx(MarkTile, {
|
|
3969
|
+
size: "md",
|
|
3970
|
+
className: cn("rounded-md", status === "error" && "text-destructive"),
|
|
3971
|
+
children: status === "uploading" ? /* @__PURE__ */ jsx(Spinner, {
|
|
3972
|
+
"aria-hidden": "true",
|
|
3973
|
+
role: void 0,
|
|
3974
|
+
className: "size-4",
|
|
3975
|
+
strokeWidth: 1.5
|
|
3976
|
+
}) : status === "error" ? /* @__PURE__ */ jsx(CircleAlert, {}) : previewUrl ? /* @__PURE__ */ jsx("img", {
|
|
3977
|
+
src: previewUrl,
|
|
3978
|
+
alt: "",
|
|
3979
|
+
className: "size-full object-cover"
|
|
3980
|
+
}) : icon ?? /* @__PURE__ */ jsx(FileText, {})
|
|
3981
|
+
}),
|
|
3982
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3983
|
+
className: "min-w-0 flex-1 leading-tight",
|
|
3984
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3985
|
+
title: name,
|
|
3986
|
+
className: "truncate text-[0.8125rem] text-foreground",
|
|
3987
|
+
children: name
|
|
3988
|
+
}), meta ? /* @__PURE__ */ jsx("p", {
|
|
3989
|
+
className: cn("truncate text-xs", status === "error" ? "text-destructive" : "text-muted-foreground"),
|
|
3990
|
+
children: meta
|
|
3991
|
+
}) : null]
|
|
3992
|
+
}),
|
|
3993
|
+
status === "uploading" ? /* @__PURE__ */ jsx("span", {
|
|
3994
|
+
className: "sr-only",
|
|
3995
|
+
children: "Uploading"
|
|
3996
|
+
}) : null,
|
|
3997
|
+
onRemove ? /* @__PURE__ */ jsx("button", {
|
|
3998
|
+
type: "button",
|
|
3999
|
+
"aria-label": `Remove ${name}`,
|
|
4000
|
+
onClick: onRemove,
|
|
4001
|
+
className: "relative grid size-5 shrink-0 cursor-pointer place-items-center rounded-full text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-active hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-3",
|
|
4002
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
4003
|
+
"aria-hidden": "true",
|
|
4004
|
+
className: "size-3"
|
|
4005
|
+
})
|
|
4006
|
+
}) : null
|
|
4007
|
+
]
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
/** Wrapping row of attachment chips, placed above the textarea. */
|
|
4011
|
+
function PromptInputAttachments({ className, ...props }) {
|
|
4012
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4013
|
+
role: "group",
|
|
4014
|
+
"aria-label": "Attachments",
|
|
4015
|
+
"data-slot": "prompt-input-attachments",
|
|
4016
|
+
className: cn("flex flex-wrap gap-1.5 px-1 pt-0.5 pb-1 [&>*]:shrink-0", className),
|
|
4017
|
+
...props
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
//#endregion
|
|
4022
|
+
//#region src/components/ai/ask-card.tsx
|
|
4023
|
+
function QuestionHeading({ id, icon, children }) {
|
|
4024
|
+
const glyph = icon === void 0 ? /* @__PURE__ */ jsx(CircleHelp, {}) : icon;
|
|
4025
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4026
|
+
className: "flex items-start gap-2",
|
|
4027
|
+
children: [glyph ? /* @__PURE__ */ jsx("span", {
|
|
4028
|
+
"aria-hidden": "true",
|
|
4029
|
+
className: "flex h-5 shrink-0 items-center text-muted-foreground [&_svg]:size-4",
|
|
4030
|
+
children: glyph
|
|
4031
|
+
}) : null, /* @__PURE__ */ jsx("p", {
|
|
4032
|
+
id,
|
|
4033
|
+
className: "min-w-0 text-pretty text-sm font-medium text-foreground [overflow-wrap:anywhere]",
|
|
4034
|
+
children
|
|
4035
|
+
})]
|
|
4036
|
+
});
|
|
4037
|
+
}
|
|
4038
|
+
/** Radio dot: a ring at rest, a filled disc with a pip once chosen. */
|
|
4039
|
+
function RadioMark({ checked }) {
|
|
4040
|
+
return /* @__PURE__ */ jsx("span", {
|
|
4041
|
+
"aria-hidden": "true",
|
|
4042
|
+
className: cn("mt-0.5 grid size-4 shrink-0 place-items-center rounded-full border", checked ? "border-primary bg-primary" : "border-subtle-foreground/50"),
|
|
4043
|
+
children: checked ? /* @__PURE__ */ jsx("span", { className: cn("size-1.5 rounded-full bg-primary-foreground", iconEnterClass) }) : null
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
function AskQuestionField({ question, choice, onChoose, otherLabel, icon, disabled }) {
|
|
4047
|
+
const headingId = React$1.useId();
|
|
4048
|
+
const otherValue = choice && "other" in choice ? choice.other : "";
|
|
4049
|
+
const rowClass = "-mx-1.5 flex min-h-8 items-start gap-2.5 rounded-md px-1.5 py-1.5 text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50";
|
|
4050
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4051
|
+
className: "flex flex-col gap-2",
|
|
4052
|
+
children: [/* @__PURE__ */ jsx(QuestionHeading, {
|
|
4053
|
+
id: headingId,
|
|
4054
|
+
icon,
|
|
4055
|
+
children: question.question
|
|
4056
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4057
|
+
role: "radiogroup",
|
|
4058
|
+
"aria-labelledby": headingId,
|
|
4059
|
+
className: "flex flex-col gap-0.5",
|
|
4060
|
+
children: [question.options.map((option) => {
|
|
4061
|
+
const checked = Boolean(choice && "option" in choice && choice.option === option.id);
|
|
4062
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
4063
|
+
type: "button",
|
|
4064
|
+
role: "radio",
|
|
4065
|
+
"aria-checked": checked,
|
|
4066
|
+
disabled,
|
|
4067
|
+
onClick: () => onChoose({ option: option.id }),
|
|
4068
|
+
className: cn(rowClass, "cursor-pointer hover:bg-overlay-hover disabled:cursor-not-allowed disabled:opacity-64", checked ? "bg-overlay-hover text-foreground" : "text-muted-foreground hover:text-foreground"),
|
|
4069
|
+
children: [/* @__PURE__ */ jsx(RadioMark, { checked }), /* @__PURE__ */ jsx("span", {
|
|
4070
|
+
className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
|
|
4071
|
+
children: option.label
|
|
4072
|
+
})]
|
|
4073
|
+
}, option.id);
|
|
4074
|
+
}), question.allowOther !== false ? /* @__PURE__ */ jsxs("label", {
|
|
4075
|
+
className: cn(rowClass, "cursor-text focus-within:bg-overlay-hover", otherValue && "bg-overlay-hover"),
|
|
4076
|
+
children: [/* @__PURE__ */ jsx(RadioMark, { checked: Boolean(otherValue) }), /* @__PURE__ */ jsx("input", {
|
|
4077
|
+
type: "text",
|
|
4078
|
+
value: otherValue,
|
|
4079
|
+
disabled,
|
|
4080
|
+
placeholder: `${otherLabel}…`,
|
|
4081
|
+
"aria-label": otherLabel,
|
|
4082
|
+
onChange: (event) => onChoose(event.target.value ? { other: event.target.value } : void 0),
|
|
4083
|
+
className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-subtle-foreground pointer-coarse:text-base"
|
|
4084
|
+
})]
|
|
4085
|
+
}) : null]
|
|
4086
|
+
})]
|
|
4087
|
+
});
|
|
4088
|
+
}
|
|
4089
|
+
function AnswerChip({ children, muted }) {
|
|
4090
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
4091
|
+
className: cn("inline-flex h-6 max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-1.5 text-[0.8125rem]", muted ? "text-muted-foreground" : "text-foreground"),
|
|
4092
|
+
children: [muted ? null : /* @__PURE__ */ jsx(CircleCheck, {
|
|
4093
|
+
"aria-hidden": "true",
|
|
4094
|
+
className: cn("size-3.5 shrink-0 fill-primary text-primary-foreground", iconEnterClass)
|
|
4095
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4096
|
+
title: typeof children === "string" ? children : void 0,
|
|
4097
|
+
className: "truncate",
|
|
4098
|
+
children
|
|
4099
|
+
})]
|
|
4100
|
+
});
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* Inline clarifying questions from an agent, one at a time. Each question
|
|
4104
|
+
* offers its options as radio rows plus a free-text row; Continue moves to the
|
|
4105
|
+
* next question and submits after the last. The card settles into a one-line
|
|
4106
|
+
* summary per question once answered or skipped.
|
|
4107
|
+
*/
|
|
4108
|
+
function AskCard({ questions, answer, onSubmit, onSkip, continueLabel = "Continue", skipLabel = "Skip", otherLabel = "Something else", eyebrow, icon, disabled, className, ...props }) {
|
|
4109
|
+
const [choices, setChoices] = React$1.useState({});
|
|
4110
|
+
const [page, setPage] = React$1.useState(0);
|
|
4111
|
+
const answered = (question) => {
|
|
4112
|
+
const choice = question ? choices[question.id] : void 0;
|
|
4113
|
+
return Boolean(choice && ("option" in choice || choice.other.trim().length > 0));
|
|
4114
|
+
};
|
|
4115
|
+
const complete = questions.every(answered);
|
|
4116
|
+
const current = questions[Math.min(page, questions.length - 1)];
|
|
4117
|
+
const last = page >= questions.length - 1;
|
|
4118
|
+
const paged = questions.length > 1;
|
|
4119
|
+
if (answer) return /* @__PURE__ */ jsx("div", {
|
|
4120
|
+
"data-slot": "ask-card",
|
|
4121
|
+
"data-state": "answered",
|
|
4122
|
+
className: cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-1 motion-reduce:animate-none", className),
|
|
4123
|
+
...props,
|
|
4124
|
+
children: questions.map((question) => {
|
|
4125
|
+
const choice = "choices" in answer ? answer.choices[question.id] : void 0;
|
|
4126
|
+
const label = choice ? "option" in choice ? question.options.find((option) => option.id === choice.option)?.label : `“${choice.other}”` : void 0;
|
|
4127
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4128
|
+
className: "flex items-start gap-2",
|
|
4129
|
+
children: [/* @__PURE__ */ jsx(CircleHelp, {
|
|
4130
|
+
"aria-hidden": "true",
|
|
4131
|
+
className: "mt-0.5 size-4 shrink-0 text-muted-foreground"
|
|
4132
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4133
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",
|
|
4134
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4135
|
+
className: "min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]",
|
|
4136
|
+
children: question.question
|
|
4137
|
+
}), label ? /* @__PURE__ */ jsx(AnswerChip, { children: label }) : /* @__PURE__ */ jsx(AnswerChip, {
|
|
4138
|
+
muted: true,
|
|
4139
|
+
children: "Skipped"
|
|
4140
|
+
})]
|
|
4141
|
+
})]
|
|
4142
|
+
}, question.id);
|
|
4143
|
+
})
|
|
4144
|
+
});
|
|
4145
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4146
|
+
"data-slot": "ask-card",
|
|
4147
|
+
"data-state": "open",
|
|
4148
|
+
className: cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-3 rounded-xl bg-card p-3 shadow-card motion-reduce:animate-none", className),
|
|
4149
|
+
...props,
|
|
4150
|
+
children: [
|
|
4151
|
+
eyebrow ? /* @__PURE__ */ jsx("div", {
|
|
4152
|
+
className: "-mb-1 flex min-h-4 items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0",
|
|
4153
|
+
children: eyebrow
|
|
4154
|
+
}) : null,
|
|
4155
|
+
current ? /* @__PURE__ */ jsx("div", {
|
|
4156
|
+
className: "animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] motion-reduce:animate-none",
|
|
4157
|
+
children: /* @__PURE__ */ jsx(AskQuestionField, {
|
|
4158
|
+
question: current,
|
|
4159
|
+
choice: choices[current.id],
|
|
4160
|
+
disabled,
|
|
4161
|
+
otherLabel,
|
|
4162
|
+
icon,
|
|
4163
|
+
onChoose: (choice) => setChoices((value) => {
|
|
4164
|
+
const next = { ...value };
|
|
4165
|
+
if (choice) next[current.id] = choice;
|
|
4166
|
+
else delete next[current.id];
|
|
4167
|
+
return next;
|
|
4168
|
+
})
|
|
4169
|
+
})
|
|
4170
|
+
}, current.id) : null,
|
|
4171
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4172
|
+
className: "flex flex-wrap items-center gap-2",
|
|
4173
|
+
children: [paged ? /* @__PURE__ */ jsxs("div", {
|
|
4174
|
+
className: "-ms-1 flex items-center text-xs text-muted-foreground tabular-nums",
|
|
4175
|
+
children: [
|
|
4176
|
+
/* @__PURE__ */ jsx(Button, {
|
|
4177
|
+
size: "icon-xs",
|
|
4178
|
+
variant: "ghost",
|
|
4179
|
+
"aria-label": "Previous question",
|
|
4180
|
+
disabled: page === 0,
|
|
4181
|
+
onClick: () => setPage(page - 1),
|
|
4182
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true" })
|
|
4183
|
+
}),
|
|
4184
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4185
|
+
"aria-hidden": "true",
|
|
4186
|
+
children: [
|
|
4187
|
+
page + 1,
|
|
4188
|
+
"/",
|
|
4189
|
+
questions.length
|
|
4190
|
+
]
|
|
4191
|
+
}),
|
|
4192
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4193
|
+
className: "sr-only",
|
|
4194
|
+
children: [
|
|
4195
|
+
"Question ",
|
|
4196
|
+
page + 1,
|
|
4197
|
+
" of ",
|
|
4198
|
+
questions.length
|
|
4199
|
+
]
|
|
4200
|
+
}),
|
|
4201
|
+
/* @__PURE__ */ jsx(Button, {
|
|
4202
|
+
size: "icon-xs",
|
|
4203
|
+
variant: "ghost",
|
|
4204
|
+
"aria-label": "Next question",
|
|
4205
|
+
disabled: last || !answered(current),
|
|
4206
|
+
onClick: () => setPage(page + 1),
|
|
4207
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" })
|
|
4208
|
+
})
|
|
4209
|
+
]
|
|
4210
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
4211
|
+
className: "ms-auto flex flex-wrap items-center gap-1.5",
|
|
4212
|
+
children: [onSkip ? /* @__PURE__ */ jsx(Button, {
|
|
4213
|
+
size: "sm",
|
|
4214
|
+
variant: "secondary",
|
|
4215
|
+
disabled,
|
|
4216
|
+
onClick: onSkip,
|
|
4217
|
+
children: skipLabel
|
|
4218
|
+
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
4219
|
+
size: "sm",
|
|
4220
|
+
disabled: disabled || (last ? !complete : !answered(current)),
|
|
4221
|
+
onClick: () => last ? onSubmit?.(choices) : setPage(page + 1),
|
|
4222
|
+
children: continueLabel
|
|
4223
|
+
})]
|
|
4224
|
+
})]
|
|
4225
|
+
})
|
|
4226
|
+
]
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
|
|
4230
|
+
//#endregion
|
|
4231
|
+
//#region src/components/ai/connect-prompt.tsx
|
|
4232
|
+
/**
|
|
4233
|
+
* Inline request from an agent to connect a missing app before it continues.
|
|
4234
|
+
* Settles into a quiet "Connected" or "Skipped" chip.
|
|
4235
|
+
*/
|
|
4236
|
+
function ConnectPrompt({ icon, name, description, status = "idle", connectLabel = "Connect", skipLabel, onConnect, onSkip, className, ...props }) {
|
|
4237
|
+
const settled = status === "connected" || status === "skipped";
|
|
4238
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4239
|
+
"data-slot": "connect-prompt",
|
|
4240
|
+
"data-status": status,
|
|
4241
|
+
className: cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-wrap items-center gap-x-3 gap-y-2 rounded-xl bg-card p-3 shadow-card motion-reduce:animate-none", className),
|
|
4242
|
+
...props,
|
|
4243
|
+
children: [
|
|
4244
|
+
icon ? /* @__PURE__ */ jsx(MarkTile, {
|
|
4245
|
+
size: "md",
|
|
4246
|
+
className: "text-foreground",
|
|
4247
|
+
children: icon
|
|
4248
|
+
}) : null,
|
|
4249
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4250
|
+
className: "min-w-40 flex-1",
|
|
4251
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4252
|
+
title: typeof name === "string" ? name : void 0,
|
|
4253
|
+
className: "line-clamp-2 text-sm font-medium text-foreground [overflow-wrap:anywhere]",
|
|
4254
|
+
children: name
|
|
4255
|
+
}), description ? /* @__PURE__ */ jsx("p", {
|
|
4256
|
+
title: typeof description === "string" ? description : void 0,
|
|
4257
|
+
className: "line-clamp-2 text-[0.8125rem] text-muted-foreground [overflow-wrap:anywhere]",
|
|
4258
|
+
children: description
|
|
4259
|
+
}) : null]
|
|
4260
|
+
}),
|
|
4261
|
+
settled ? /* @__PURE__ */ jsxs("span", {
|
|
4262
|
+
className: "ms-auto inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md bg-muted px-2 text-[0.8125rem] text-foreground",
|
|
4263
|
+
children: [status === "connected" ? /* @__PURE__ */ jsx(Check, {
|
|
4264
|
+
"aria-hidden": "true",
|
|
4265
|
+
className: cn("size-3.5", iconEnterClass)
|
|
4266
|
+
}) : null, status === "connected" ? "Connected" : "Skipped"]
|
|
4267
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
4268
|
+
className: "ms-auto flex max-w-full flex-wrap items-center justify-end gap-2",
|
|
4269
|
+
children: [skipLabel && onSkip ? /* @__PURE__ */ jsx(Button, {
|
|
4270
|
+
size: "xs",
|
|
4271
|
+
variant: "outline",
|
|
4272
|
+
wrap: true,
|
|
4273
|
+
disabled: status === "connecting",
|
|
4274
|
+
onClick: onSkip,
|
|
4275
|
+
children: skipLabel
|
|
4276
|
+
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
4277
|
+
size: "xs",
|
|
4278
|
+
wrap: true,
|
|
4279
|
+
disabled: status === "connecting",
|
|
4280
|
+
onClick: onConnect,
|
|
4281
|
+
children: connectLabel
|
|
4282
|
+
})]
|
|
4283
|
+
})
|
|
4284
|
+
]
|
|
4285
|
+
});
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
//#endregion
|
|
4289
|
+
//#region src/components/ai/agent-draft-card.tsx
|
|
4290
|
+
/**
|
|
4291
|
+
* Proposed agent spec an assistant drafts in chat: schedule, tools, and the
|
|
4292
|
+
* ordered steps it will run. Nothing runs until the host handles an action.
|
|
4293
|
+
*/
|
|
4294
|
+
function AgentDraftCard({ name, badge = "Draft", schedule, tools = [], steps = [], actions = [], chosenActionId, onAction, defaultOpen = true, className, ...props }) {
|
|
4295
|
+
const chosen = actions.find((action) => action.id === chosenActionId);
|
|
4296
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4297
|
+
"data-slot": "agent-draft-card",
|
|
4298
|
+
className: cn("animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] overflow-hidden rounded-xl bg-card shadow-card motion-reduce:animate-none", className),
|
|
4299
|
+
...props,
|
|
4300
|
+
children: [/* @__PURE__ */ jsxs(Collapsible, {
|
|
4301
|
+
defaultOpen,
|
|
4302
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4303
|
+
className: "flex h-10 items-center gap-2 px-2",
|
|
4304
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
4305
|
+
className: "group flex min-w-0 flex-1 cursor-pointer items-center justify-start gap-2 rounded-md font-normal py-1 text-start outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
4306
|
+
children: [
|
|
4307
|
+
/* @__PURE__ */ jsx(ChevronRight, {
|
|
4308
|
+
"aria-hidden": "true",
|
|
4309
|
+
className: "size-3.5 shrink-0 text-muted-foreground transition-transform duration-(--duration-moderate) ease-out group-data-panel-open:rotate-90 motion-reduce:transition-none rtl:-scale-x-100 rtl:group-data-panel-open:scale-x-100"
|
|
4310
|
+
}),
|
|
4311
|
+
/* @__PURE__ */ jsx(MarkTile, {
|
|
4312
|
+
className: "size-5 [&_svg:not([class*=size-])]:size-3",
|
|
4313
|
+
children: /* @__PURE__ */ jsx(Bot, {})
|
|
4314
|
+
}),
|
|
4315
|
+
/* @__PURE__ */ jsx("span", {
|
|
4316
|
+
title: typeof name === "string" ? name : void 0,
|
|
4317
|
+
className: "truncate font-mono text-[0.8125rem] text-foreground",
|
|
4318
|
+
children: name
|
|
4319
|
+
})
|
|
4320
|
+
]
|
|
4321
|
+
}), badge ? /* @__PURE__ */ jsx("span", {
|
|
4322
|
+
className: "inline-flex h-5 shrink-0 items-center rounded-[5px] border border-border px-1.5 text-xs text-muted-foreground",
|
|
4323
|
+
children: badge
|
|
4324
|
+
}) : null]
|
|
4325
|
+
}), /* @__PURE__ */ jsxs(CollapsiblePanel, { children: [schedule || tools.length ? /* @__PURE__ */ jsxs("dl", {
|
|
4326
|
+
className: "grid grid-cols-[5.5rem_minmax(0,1fr)] gap-x-3 gap-y-2 border-t border-border px-4 py-3 text-[0.8125rem]",
|
|
4327
|
+
children: [schedule ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
|
|
4328
|
+
className: "text-muted-foreground",
|
|
4329
|
+
children: "Runs"
|
|
4330
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
4331
|
+
className: "min-w-0 text-foreground [overflow-wrap:anywhere]",
|
|
4332
|
+
children: schedule
|
|
4333
|
+
})] }) : null, tools.length ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
|
|
4334
|
+
className: "text-muted-foreground",
|
|
4335
|
+
children: "Tools"
|
|
4336
|
+
}), /* @__PURE__ */ jsxs("dd", {
|
|
4337
|
+
className: "flex min-w-0 items-center gap-2 text-foreground",
|
|
4338
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4339
|
+
className: "flex -space-x-1",
|
|
4340
|
+
children: tools.map((tool) => tool.icon ? /* @__PURE__ */ jsx(MarkTile, {
|
|
4341
|
+
className: "text-foreground ring-2 ring-card",
|
|
4342
|
+
children: tool.icon
|
|
4343
|
+
}, tool.id) : null)
|
|
4344
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4345
|
+
title: tools.map((tool) => tool.label).join(", "),
|
|
4346
|
+
className: "truncate",
|
|
4347
|
+
children: tools.map((tool) => tool.label).join(", ")
|
|
4348
|
+
})]
|
|
4349
|
+
})] }) : null]
|
|
4350
|
+
}) : null, steps.length ? /* @__PURE__ */ jsx("ol", {
|
|
4351
|
+
className: "flex flex-col gap-1.5 border-t border-border px-4 py-3 text-[0.8125rem] text-muted-foreground",
|
|
4352
|
+
children: steps.map((step, index) => /* @__PURE__ */ jsxs("li", {
|
|
4353
|
+
className: "flex gap-3",
|
|
4354
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4355
|
+
className: "w-3 shrink-0 text-end tabular-nums text-subtle-foreground",
|
|
4356
|
+
children: index + 1
|
|
4357
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4358
|
+
className: "min-w-0 text-pretty [overflow-wrap:anywhere]",
|
|
4359
|
+
children: step
|
|
4360
|
+
})]
|
|
4361
|
+
}, index))
|
|
4362
|
+
}) : null] })]
|
|
4363
|
+
}), actions.length ? /* @__PURE__ */ jsx("div", {
|
|
4364
|
+
className: "flex flex-wrap items-center gap-2 border-t border-border p-2",
|
|
4365
|
+
children: chosen ? /* @__PURE__ */ jsxs("span", {
|
|
4366
|
+
className: "inline-flex min-h-7 max-w-full items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-[0.8125rem] text-foreground [overflow-wrap:anywhere]",
|
|
4367
|
+
children: [/* @__PURE__ */ jsx(Check, {
|
|
4368
|
+
"aria-hidden": "true",
|
|
4369
|
+
className: cn("size-3.5 shrink-0", iconEnterClass)
|
|
4370
|
+
}), chosen.chosenLabel ?? chosen.label]
|
|
4371
|
+
}) : actions.map((action, index) => /* @__PURE__ */ jsx(Button, {
|
|
4372
|
+
size: "xs",
|
|
4373
|
+
wrap: true,
|
|
4374
|
+
variant: action.variant ?? (index === 0 ? "default" : "outline"),
|
|
4375
|
+
onClick: () => onAction?.(action.id),
|
|
4376
|
+
children: action.label
|
|
4377
|
+
}, action.id))
|
|
4378
|
+
}) : null]
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
|
|
4382
|
+
//#endregion
|
|
4383
|
+
export { useChatContainer as $, PromptSuggestions as A, normalizeToolStatus as B, TaskRow as C, DiffTable as D, PlanTracker as E, Sources as F, ThinkingTrace as G, ChainOfThoughtStep as H, ApprovalCard as I, formatDuration as J, Reasoning as K, StatusIcon as L, InlineDiff as M, lineDiff as N, StreamingText as O, Source as P, ChatContainerContent as Q, Tool as R, TaskList as S, formatCompact as T, Step as U, ChainOfThought as V, Steps as W, ScrollButton as X, SystemMessage as Y, ChatContainer as Z, AiImage as _, AgentLoader as _t, PromptInputAttachments as a, MessageAvatar as at, ContextCard as b, UsageNotice as c, renderBasicMarkdown as ct, PromptInputTrayRow as d, PromptInput as dt, ResponseStream as et, ThinkingStatus as f, PromptInputAction as ft, iconEnterClass as g, usePromptInput as gt, MarkTile as h, PromptInputTextarea as ht, PromptInputAttachment as i, MessageActions as it, FeedbackBar as j, PromptSuggestion as k, usageTone as l, STREAM_THROTTLE_MS as lt, ToolTrace as m, PromptInputBody as mt, ConnectPrompt as n, Message as nt, CostBlocks as o, MessageContent as ot, formatElapsed as p, PromptInputActions as pt, ThinkingBar as q, AskCard as r, MessageAction as rt, ModelSelector as s, Markdown as st, AgentDraftCard as t, CodeBlock as tt, PromptInputTray as u, useThrottledText as ut, FileUpload as v, Loader as vt, ContextRing as w, ContextCards as x, RecommendationCard as y, TextShimmer as yt, ToolGroup as z };
|
|
4384
|
+
//# sourceMappingURL=ai-4JrVVL3q.js.map
|