@cardstack/boxel-cli 0.2.0-unstable.448 → 0.3.0-unstable.13
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/bundled-types/base/-private.d.ts +1 -0
- package/bundled-types/base/address.d.ts +17 -0
- package/bundled-types/base/ai-app-generator.d.ts +14 -0
- package/bundled-types/base/amount-with-currency.d.ts +10 -0
- package/bundled-types/base/avif-image-def.d.ts +12 -0
- package/bundled-types/base/avif-meta-extractor.d.ts +4 -0
- package/bundled-types/base/base64-image.d.ts +25 -0
- package/bundled-types/base/big-integer.d.ts +12 -0
- package/bundled-types/base/boolean.d.ts +14 -0
- package/bundled-types/base/brand-functional-palette.d.ts +16 -0
- package/bundled-types/base/brand-guide.d.ts +26 -0
- package/bundled-types/base/brand-logo.d.ts +29 -0
- package/bundled-types/base/card-api.d.ts +513 -0
- package/bundled-types/base/card-serialization.d.ts +47 -0
- package/bundled-types/base/cards-grid.d.ts +10 -0
- package/bundled-types/base/code-ref.d.ts +14 -0
- package/bundled-types/base/codemirror-editor.d.ts +135 -0
- package/bundled-types/base/color-field/components/advanced-color-picker.d.ts +66 -0
- package/bundled-types/base/color-field/components/color-picker-field.d.ts +22 -0
- package/bundled-types/base/color-field/components/color-wheel-picker.d.ts +44 -0
- package/bundled-types/base/color-field/components/contrast-checker-addon.d.ts +14 -0
- package/bundled-types/base/color-field/components/recent-colors-addon.d.ts +19 -0
- package/bundled-types/base/color-field/components/slider-picker.d.ts +40 -0
- package/bundled-types/base/color-field/components/swatches-picker.d.ts +5 -0
- package/bundled-types/base/color-field/modifiers/setup-element-modifier.d.ts +10 -0
- package/bundled-types/base/color-field/util/color-field-signature.d.ts +9 -0
- package/bundled-types/base/color-field/util/color-utils.d.ts +96 -0
- package/bundled-types/base/color-field/util/css-color-parsers.d.ts +11 -0
- package/bundled-types/base/color.d.ts +10 -0
- package/bundled-types/base/command.d.ts +593 -0
- package/bundled-types/base/commands/search-card-result.d.ts +36 -0
- package/bundled-types/base/components/age.d.ts +22 -0
- package/bundled-types/base/components/business-days.d.ts +16 -0
- package/bundled-types/base/components/card-list.d.ts +25 -0
- package/bundled-types/base/components/cards-grid-layout.d.ts +58 -0
- package/bundled-types/base/components/countdown.d.ts +31 -0
- package/bundled-types/base/components/expiration-warning.d.ts +24 -0
- package/bundled-types/base/components/time-ago.d.ts +24 -0
- package/bundled-types/base/components/time-slots.d.ts +20 -0
- package/bundled-types/base/components/timeline.d.ts +22 -0
- package/bundled-types/base/contains-many-component.d.ts +7 -0
- package/bundled-types/base/coordinate.d.ts +7 -0
- package/bundled-types/base/country.d.ts +23 -0
- package/bundled-types/base/css-value.d.ts +6 -0
- package/bundled-types/base/csv-file-def.d.ts +29 -0
- package/bundled-types/base/currency.d.ts +16 -0
- package/bundled-types/base/date/day.d.ts +9 -0
- package/bundled-types/base/date/month-day.d.ts +10 -0
- package/bundled-types/base/date/month-year.d.ts +9 -0
- package/bundled-types/base/date/month.d.ts +9 -0
- package/bundled-types/base/date/quarter.d.ts +10 -0
- package/bundled-types/base/date/week.d.ts +9 -0
- package/bundled-types/base/date/year.d.ts +9 -0
- package/bundled-types/base/date-range-field.d.ts +12 -0
- package/bundled-types/base/date.d.ts +12 -0
- package/bundled-types/base/datetime-stamp.d.ts +7 -0
- package/bundled-types/base/datetime.d.ts +12 -0
- package/bundled-types/base/default-templates/atom.d.ts +10 -0
- package/bundled-types/base/default-templates/card-info.d.ts +32 -0
- package/bundled-types/base/default-templates/embedded.d.ts +11 -0
- package/bundled-types/base/default-templates/field-edit.d.ts +10 -0
- package/bundled-types/base/default-templates/file-def-edit.d.ts +8 -0
- package/bundled-types/base/default-templates/fitted.d.ts +12 -0
- package/bundled-types/base/default-templates/head.d.ts +13 -0
- package/bundled-types/base/default-templates/image-def-atom.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-embedded.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-fitted.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-isolated.d.ts +8 -0
- package/bundled-types/base/default-templates/isolated-and-edit.d.ts +15 -0
- package/bundled-types/base/default-templates/markdown-fallback.d.ts +19 -0
- package/bundled-types/base/default-templates/markdown.d.ts +60 -0
- package/bundled-types/base/default-templates/missing-template.d.ts +13 -0
- package/bundled-types/base/default-templates/theme-dashboard.d.ts +126 -0
- package/bundled-types/base/detailed-style-reference.d.ts +48 -0
- package/bundled-types/base/email.d.ts +10 -0
- package/bundled-types/base/enum.d.ts +30 -0
- package/bundled-types/base/ethereum-address.d.ts +13 -0
- package/bundled-types/base/field-component.d.ts +65 -0
- package/bundled-types/base/field-support.d.ts +55 -0
- package/bundled-types/base/file-api.d.ts +2 -0
- package/bundled-types/base/file-menu-items.d.ts +4 -0
- package/bundled-types/base/gif-image-def.d.ts +12 -0
- package/bundled-types/base/gif-meta-extractor.d.ts +4 -0
- package/bundled-types/base/gts-file-def.d.ts +7 -0
- package/bundled-types/base/helpers/country.d.ts +3198 -0
- package/bundled-types/base/helpers/sanitized-html.d.ts +2 -0
- package/bundled-types/base/helpers/set-background-image.d.ts +2 -0
- package/bundled-types/base/image-file-def.d.ts +1 -0
- package/bundled-types/base/image.d.ts +8 -0
- package/bundled-types/base/index.d.ts +1 -0
- package/bundled-types/base/join-the-community.d.ts +14 -0
- package/bundled-types/base/jpg-image-def.d.ts +12 -0
- package/bundled-types/base/jpg-meta-extractor.d.ts +4 -0
- package/bundled-types/base/json-file-def.d.ts +23 -0
- package/bundled-types/base/links-to-editor.d.ts +22 -0
- package/bundled-types/base/links-to-many-component.d.ts +7 -0
- package/bundled-types/base/llm-model.d.ts +6 -0
- package/bundled-types/base/markdown-file-def.d.ts +25 -0
- package/bundled-types/base/markdown-helpers.d.ts +26 -0
- package/bundled-types/base/markdown.d.ts +1 -0
- package/bundled-types/base/matrix-event.d.ts +400 -0
- package/bundled-types/base/menu-items.d.ts +21 -0
- package/bundled-types/base/number/components/badge-counter.d.ts +32 -0
- package/bundled-types/base/number/components/badge-metric.d.ts +34 -0
- package/bundled-types/base/number/components/badge-notification.d.ts +38 -0
- package/bundled-types/base/number/components/gauge.d.ts +45 -0
- package/bundled-types/base/number/components/number-input.d.ts +27 -0
- package/bundled-types/base/number/components/progress-bar.d.ts +44 -0
- package/bundled-types/base/number/components/progress-circle.d.ts +41 -0
- package/bundled-types/base/number/components/score.d.ts +41 -0
- package/bundled-types/base/number/components/stat.d.ts +38 -0
- package/bundled-types/base/number/util/index.d.ts +29 -0
- package/bundled-types/base/number.d.ts +52 -0
- package/bundled-types/base/percentage.d.ts +9 -0
- package/bundled-types/base/phone-number.d.ts +25 -0
- package/bundled-types/base/png-image-def.d.ts +12 -0
- package/bundled-types/base/png-meta-extractor.d.ts +4 -0
- package/bundled-types/base/positioned-card.d.ts +7 -0
- package/bundled-types/base/query-field-support.d.ts +6 -0
- package/bundled-types/base/realm-config.d.ts +16 -0
- package/bundled-types/base/realm.d.ts +7 -0
- package/bundled-types/base/resources/command-data.d.ts +43 -0
- package/bundled-types/base/response-field.d.ts +6 -0
- package/bundled-types/base/rich-markdown.d.ts +30 -0
- package/bundled-types/base/shared-state.d.ts +1 -0
- package/bundled-types/base/skill-plus.d.ts +79 -0
- package/bundled-types/base/skill-reference.d.ts +12 -0
- package/bundled-types/base/skill-set.d.ts +18 -0
- package/bundled-types/base/skill.d.ts +21 -0
- package/bundled-types/base/spec.d.ts +108 -0
- package/bundled-types/base/string.d.ts +2 -0
- package/bundled-types/base/structured-theme-variables.d.ts +85 -0
- package/bundled-types/base/structured-theme.d.ts +32 -0
- package/bundled-types/base/style-reference.d.ts +14 -0
- package/bundled-types/base/svg-image-def.d.ts +12 -0
- package/bundled-types/base/svg-meta-extractor.d.ts +12 -0
- package/bundled-types/base/system-card.d.ts +17 -0
- package/bundled-types/base/tag.d.ts +15 -0
- package/bundled-types/base/text-area.d.ts +2 -0
- package/bundled-types/base/text-file-def.d.ts +23 -0
- package/bundled-types/base/text-input-validator.d.ts +13 -0
- package/bundled-types/base/theme.d.ts +2 -0
- package/bundled-types/base/time/duration.d.ts +14 -0
- package/bundled-types/base/time/relative-time.d.ts +10 -0
- package/bundled-types/base/time/time-range.d.ts +11 -0
- package/bundled-types/base/time.d.ts +9 -0
- package/bundled-types/base/ts-file-def.d.ts +26 -0
- package/bundled-types/base/ts-highlight.d.ts +1 -0
- package/bundled-types/base/types/@cardstack/boxel-host/index.d.ts +5 -0
- package/bundled-types/base/types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/base/typography.d.ts +14 -0
- package/bundled-types/base/url.d.ts +13 -0
- package/bundled-types/base/watched-array.d.ts +7 -0
- package/bundled-types/base/webp-image-def.d.ts +12 -0
- package/bundled-types/base/webp-meta-extractor.d.ts +4 -0
- package/bundled-types/base/website.d.ts +8 -0
- package/bundled-types/base/welcome-to-boxel.d.ts +22 -0
- package/bundled-types/boxel-ui/components/accordion/index.gts +50 -0
- package/bundled-types/boxel-ui/components/accordion/item/index.gts +156 -0
- package/bundled-types/boxel-ui/components/accordion/usage.gts +157 -0
- package/bundled-types/boxel-ui/components/add-button/index.gts +46 -0
- package/bundled-types/boxel-ui/components/add-button/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/alert/index.gts +151 -0
- package/bundled-types/boxel-ui/components/alert/usage.gts +66 -0
- package/bundled-types/boxel-ui/components/avatar/index.gts +79 -0
- package/bundled-types/boxel-ui/components/avatar/usage.gts +96 -0
- package/bundled-types/boxel-ui/components/basic-fitted/index.gts +340 -0
- package/bundled-types/boxel-ui/components/basic-fitted/usage.gts +223 -0
- package/bundled-types/boxel-ui/components/button/index.gts +416 -0
- package/bundled-types/boxel-ui/components/button/usage.gts +334 -0
- package/bundled-types/boxel-ui/components/card-container/index.gts +251 -0
- package/bundled-types/boxel-ui/components/card-container/usage.gts +53 -0
- package/bundled-types/boxel-ui/components/card-header/index.gts +473 -0
- package/bundled-types/boxel-ui/components/card-header/usage.gts +295 -0
- package/bundled-types/boxel-ui/components/circle-spinner/index.gts +42 -0
- package/bundled-types/boxel-ui/components/circle-spinner/usage.gts +48 -0
- package/bundled-types/boxel-ui/components/color-palette/index.gts +134 -0
- package/bundled-types/boxel-ui/components/color-palette/usage.gts +69 -0
- package/bundled-types/boxel-ui/components/color-picker/index.gts +125 -0
- package/bundled-types/boxel-ui/components/color-picker/usage.gts +56 -0
- package/bundled-types/boxel-ui/components/container/index.gts +67 -0
- package/bundled-types/boxel-ui/components/container/usage.gts +59 -0
- package/bundled-types/boxel-ui/components/context-button/index.gts +184 -0
- package/bundled-types/boxel-ui/components/context-button/usage.gts +125 -0
- package/bundled-types/boxel-ui/components/copy-button/index.gts +79 -0
- package/bundled-types/boxel-ui/components/copy-button/usage.gts +25 -0
- package/bundled-types/boxel-ui/components/date-range-picker/index.gts +211 -0
- package/bundled-types/boxel-ui/components/date-range-picker/setup.gts +11 -0
- package/bundled-types/boxel-ui/components/date-range-picker/usage.gts +52 -0
- package/bundled-types/boxel-ui/components/drag-and-drop/index.gts +256 -0
- package/bundled-types/boxel-ui/components/drag-and-drop/usage.gts +142 -0
- package/bundled-types/boxel-ui/components/dropdown/index.gts +478 -0
- package/bundled-types/boxel-ui/components/dropdown/trigger/index.gts +70 -0
- package/bundled-types/boxel-ui/components/dropdown/trigger/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/dropdown/usage.gts +119 -0
- package/bundled-types/boxel-ui/components/email-input/index.gts +111 -0
- package/bundled-types/boxel-ui/components/email-input/usage.gts +75 -0
- package/bundled-types/boxel-ui/components/entity-icon-display/index.gts +144 -0
- package/bundled-types/boxel-ui/components/entity-icon-display/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/entity-thumbnail-display/index.gts +148 -0
- package/bundled-types/boxel-ui/components/entity-thumbnail-display/usage.gts +76 -0
- package/bundled-types/boxel-ui/components/field-container/index.gts +150 -0
- package/bundled-types/boxel-ui/components/field-container/usage.gts +188 -0
- package/bundled-types/boxel-ui/components/filter-list/index.gts +255 -0
- package/bundled-types/boxel-ui/components/filter-list/usage.gts +153 -0
- package/bundled-types/boxel-ui/components/fitted-card-container/index.gts +66 -0
- package/bundled-types/boxel-ui/components/fitted-card-container/usage.gts +81 -0
- package/bundled-types/boxel-ui/components/grid-container/grid-item-container/index.gts +37 -0
- package/bundled-types/boxel-ui/components/grid-container/index.gts +116 -0
- package/bundled-types/boxel-ui/components/grid-container/usage.gts +105 -0
- package/bundled-types/boxel-ui/components/header/index.gts +101 -0
- package/bundled-types/boxel-ui/components/header/usage.gts +116 -0
- package/bundled-types/boxel-ui/components/icon-button/index.gts +148 -0
- package/bundled-types/boxel-ui/components/icon-button/usage.gts +249 -0
- package/bundled-types/boxel-ui/components/input/index.gts +560 -0
- package/bundled-types/boxel-ui/components/input/usage.gts +449 -0
- package/bundled-types/boxel-ui/components/input-group/accessories/index.gts +191 -0
- package/bundled-types/boxel-ui/components/input-group/controls/index.gts +54 -0
- package/bundled-types/boxel-ui/components/input-group/index.gts +347 -0
- package/bundled-types/boxel-ui/components/input-group/usage.gts +437 -0
- package/bundled-types/boxel-ui/components/kanban/card.gts +89 -0
- package/bundled-types/boxel-ui/components/kanban/column-header.gts +151 -0
- package/bundled-types/boxel-ui/components/kanban/drag.gts +1007 -0
- package/bundled-types/boxel-ui/components/kanban/engine.ts +247 -0
- package/bundled-types/boxel-ui/components/kanban/ghost.gts +64 -0
- package/bundled-types/boxel-ui/components/kanban/index.gts +16 -0
- package/bundled-types/boxel-ui/components/kanban/modifiers.gts +42 -0
- package/bundled-types/boxel-ui/components/kanban/plane-inner.gts +525 -0
- package/bundled-types/boxel-ui/components/kanban/plane.gts +163 -0
- package/bundled-types/boxel-ui/components/kanban/usage.gts +392 -0
- package/bundled-types/boxel-ui/components/label/index.gts +64 -0
- package/bundled-types/boxel-ui/components/loading-indicator/index.gts +78 -0
- package/bundled-types/boxel-ui/components/loading-indicator/usage.gts +72 -0
- package/bundled-types/boxel-ui/components/menu/index.gts +267 -0
- package/bundled-types/boxel-ui/components/menu/usage.gts +100 -0
- package/bundled-types/boxel-ui/components/message/index.gts +146 -0
- package/bundled-types/boxel-ui/components/message/usage.gts +263 -0
- package/bundled-types/boxel-ui/components/modal/index.gts +159 -0
- package/bundled-types/boxel-ui/components/modal/usage.gts +206 -0
- package/bundled-types/boxel-ui/components/multi-select/after-options.gts +59 -0
- package/bundled-types/boxel-ui/components/multi-select/index.gts +230 -0
- package/bundled-types/boxel-ui/components/multi-select/selected-item.gts +91 -0
- package/bundled-types/boxel-ui/components/multi-select/trigger.gts +190 -0
- package/bundled-types/boxel-ui/components/multi-select/usage.gts +420 -0
- package/bundled-types/boxel-ui/components/phone-input/index.gts +149 -0
- package/bundled-types/boxel-ui/components/phone-input/usage.gts +73 -0
- package/bundled-types/boxel-ui/components/picker/before-options-with-search.gts +340 -0
- package/bundled-types/boxel-ui/components/picker/index.gts +427 -0
- package/bundled-types/boxel-ui/components/picker/option-row.gts +270 -0
- package/bundled-types/boxel-ui/components/picker/selected-item.gts +171 -0
- package/bundled-types/boxel-ui/components/picker/trigger-labeled.gts +216 -0
- package/bundled-types/boxel-ui/components/picker/usage.gts +179 -0
- package/bundled-types/boxel-ui/components/pill/index.gts +231 -0
- package/bundled-types/boxel-ui/components/pill/usage.gts +230 -0
- package/bundled-types/boxel-ui/components/progress-bar/index.gts +124 -0
- package/bundled-types/boxel-ui/components/progress-bar/usage.gts +131 -0
- package/bundled-types/boxel-ui/components/progress-radial/index.gts +95 -0
- package/bundled-types/boxel-ui/components/progress-radial/usage.gts +79 -0
- package/bundled-types/boxel-ui/components/radio-input/index.gts +143 -0
- package/bundled-types/boxel-ui/components/radio-input/item.gts +210 -0
- package/bundled-types/boxel-ui/components/radio-input/usage.gts +303 -0
- package/bundled-types/boxel-ui/components/realm-icon/index.gts +129 -0
- package/bundled-types/boxel-ui/components/realm-icon/usage.gts +62 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/handle.gts +180 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/index.gts +341 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/panel.gts +86 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/usage.gts +350 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/adjust-layout-by-delta.ts +231 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/assert.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/calculate-delta-percentage.ts +41 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/calculate-unsafe-default-layout.ts +53 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/compare-layouts.ts +12 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/const.ts +6 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/determine-pivot-indices.ts +15 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-element.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-elements-for-group.ts +8 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-group-element.ts +21 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-element-index.ts +14 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-element.ts +12 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-elements-for-group.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/fuzzy-layouts-equal.ts +22 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/fuzzy-numbers.ts +21 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/get-resize-event-coordinates.ts +8 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/get-resize-event-cursor-position.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/panel-resize-handle-registry.ts +446 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/resize-panel.ts +35 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/types.ts +23 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/validate-panel-group-layout.ts +86 -0
- package/bundled-types/boxel-ui/components/select/index.gts +882 -0
- package/bundled-types/boxel-ui/components/select/trigger.gts +132 -0
- package/bundled-types/boxel-ui/components/select/usage.gts +353 -0
- package/bundled-types/boxel-ui/components/skeleton-placeholder/index.gts +89 -0
- package/bundled-types/boxel-ui/components/skeleton-placeholder/usage.gts +102 -0
- package/bundled-types/boxel-ui/components/sort-dropdown/index.gts +91 -0
- package/bundled-types/boxel-ui/components/sort-dropdown/usage.gts +77 -0
- package/bundled-types/boxel-ui/components/swatch/index.gts +81 -0
- package/bundled-types/boxel-ui/components/swatch/usage.gts +57 -0
- package/bundled-types/boxel-ui/components/switch/index.gts +95 -0
- package/bundled-types/boxel-ui/components/switch/usage.gts +79 -0
- package/bundled-types/boxel-ui/components/tabbed-header/index.gts +141 -0
- package/bundled-types/boxel-ui/components/tabbed-header/usage.gts +103 -0
- package/bundled-types/boxel-ui/components/tag/index.gts +50 -0
- package/bundled-types/boxel-ui/components/tag/usage.gts +89 -0
- package/bundled-types/boxel-ui/components/tag-list/index.gts +85 -0
- package/bundled-types/boxel-ui/components/tag-list/usage.gts +129 -0
- package/bundled-types/boxel-ui/components/tooltip/index.gts +306 -0
- package/bundled-types/boxel-ui/components/tooltip/usage.gts +168 -0
- package/bundled-types/boxel-ui/components/view-selector/index.gts +166 -0
- package/bundled-types/boxel-ui/components/view-selector/usage.gts +149 -0
- package/bundled-types/boxel-ui/components.ts +169 -0
- package/bundled-types/boxel-ui/helpers/add-class-to-svg.ts +8 -0
- package/bundled-types/boxel-ui/helpers/clipboard.ts +21 -0
- package/bundled-types/boxel-ui/helpers/cn.ts +12 -0
- package/bundled-types/boxel-ui/helpers/color-tools.ts +331 -0
- package/bundled-types/boxel-ui/helpers/compact.ts +3 -0
- package/bundled-types/boxel-ui/helpers/contrast-color.ts +32 -0
- package/bundled-types/boxel-ui/helpers/css-var.ts +41 -0
- package/bundled-types/boxel-ui/helpers/currency-format.ts +25 -0
- package/bundled-types/boxel-ui/helpers/dayjs-format.ts +27 -0
- package/bundled-types/boxel-ui/helpers/deterministic-color-from-string.ts +45 -0
- package/bundled-types/boxel-ui/helpers/element.ts +16 -0
- package/bundled-types/boxel-ui/helpers/extract-css-variables.ts +126 -0
- package/bundled-types/boxel-ui/helpers/format-age.ts +72 -0
- package/bundled-types/boxel-ui/helpers/format-countdown.ts +110 -0
- package/bundled-types/boxel-ui/helpers/format-currency.ts +95 -0
- package/bundled-types/boxel-ui/helpers/format-date-time.ts +567 -0
- package/bundled-types/boxel-ui/helpers/format-duration.ts +143 -0
- package/bundled-types/boxel-ui/helpers/format-file-size.ts +49 -0
- package/bundled-types/boxel-ui/helpers/format-list.ts +73 -0
- package/bundled-types/boxel-ui/helpers/format-names.ts +103 -0
- package/bundled-types/boxel-ui/helpers/format-number.ts +140 -0
- package/bundled-types/boxel-ui/helpers/format-ordinal.ts +115 -0
- package/bundled-types/boxel-ui/helpers/format-period.ts +188 -0
- package/bundled-types/boxel-ui/helpers/format-relative-time.ts +789 -0
- package/bundled-types/boxel-ui/helpers/generate-css-variables.ts +47 -0
- package/bundled-types/boxel-ui/helpers/markdown-escape.ts +36 -0
- package/bundled-types/boxel-ui/helpers/math-helpers.ts +18 -0
- package/bundled-types/boxel-ui/helpers/menu-divider.ts +15 -0
- package/bundled-types/boxel-ui/helpers/menu-item.ts +76 -0
- package/bundled-types/boxel-ui/helpers/optional.ts +7 -0
- package/bundled-types/boxel-ui/helpers/pick.ts +11 -0
- package/bundled-types/boxel-ui/helpers/sanitize-html.ts +45 -0
- package/bundled-types/boxel-ui/helpers/string.ts +15 -0
- package/bundled-types/boxel-ui/helpers/theme-css.ts +148 -0
- package/bundled-types/boxel-ui/helpers/truth-helpers.ts +48 -0
- package/bundled-types/boxel-ui/helpers/validate-email-format.ts +138 -0
- package/bundled-types/boxel-ui/helpers/validate-phone-format.ts +201 -0
- package/bundled-types/boxel-ui/helpers.ts +134 -0
- package/bundled-types/boxel-ui/icons/ai-bw.gts +22 -0
- package/bundled-types/boxel-ui/icons/arrow-left.gts +25 -0
- package/bundled-types/boxel-ui/icons/arrow-right.gts +28 -0
- package/bundled-types/boxel-ui/icons/arrow-top-left.gts +22 -0
- package/bundled-types/boxel-ui/icons/arrow-up.gts +25 -0
- package/bundled-types/boxel-ui/icons/atom.gts +26 -0
- package/bundled-types/boxel-ui/icons/boxel-icon-with-text.gts +29 -0
- package/bundled-types/boxel-ui/icons/boxel-icon.gts +34 -0
- package/bundled-types/boxel-ui/icons/card-definition.gts +26 -0
- package/bundled-types/boxel-ui/icons/card-instance.gts +26 -0
- package/bundled-types/boxel-ui/icons/card.gts +24 -0
- package/bundled-types/boxel-ui/icons/cardbot-lg.gts +24 -0
- package/bundled-types/boxel-ui/icons/caret-down.gts +23 -0
- package/bundled-types/boxel-ui/icons/caret-up.gts +23 -0
- package/bundled-types/boxel-ui/icons/check-mark.gts +23 -0
- package/bundled-types/boxel-ui/icons/chevron-right.gts +23 -0
- package/bundled-types/boxel-ui/icons/copy.gts +28 -0
- package/bundled-types/boxel-ui/icons/diagonal-arrow-left-up.gts +21 -0
- package/bundled-types/boxel-ui/icons/download.gts +19 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-down.gts +20 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-filled.gts +19 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-up.gts +20 -0
- package/bundled-types/boxel-ui/icons/edit.gts +14 -0
- package/bundled-types/boxel-ui/icons/embedded.gts +34 -0
- package/bundled-types/boxel-ui/icons/exclamation-circle.gts +26 -0
- package/bundled-types/boxel-ui/icons/exclamation.gts +20 -0
- package/bundled-types/boxel-ui/icons/eye.gts +19 -0
- package/bundled-types/boxel-ui/icons/failure-bordered.gts +26 -0
- package/bundled-types/boxel-ui/icons/field.gts +26 -0
- package/bundled-types/boxel-ui/icons/file-alert.gts +28 -0
- package/bundled-types/boxel-ui/icons/file.gts +27 -0
- package/bundled-types/boxel-ui/icons/fitted.gts +42 -0
- package/bundled-types/boxel-ui/icons/folder.gts +26 -0
- package/bundled-types/boxel-ui/icons/form.gts +38 -0
- package/bundled-types/boxel-ui/icons/four-lines.gts +21 -0
- package/bundled-types/boxel-ui/icons/grid-3x3.gts +26 -0
- package/bundled-types/boxel-ui/icons/group.gts +22 -0
- package/bundled-types/boxel-ui/icons/head.gts +28 -0
- package/bundled-types/boxel-ui/icons/highlight-icon.gts +46 -0
- package/bundled-types/boxel-ui/icons/icon-circle-selected.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-circle.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-code.gts +22 -0
- package/bundled-types/boxel-ui/icons/icon-funnel.gts +23 -0
- package/bundled-types/boxel-ui/icons/icon-globe.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-grid.gts +68 -0
- package/bundled-types/boxel-ui/icons/icon-hexagon.gts +22 -0
- package/bundled-types/boxel-ui/icons/icon-inherit.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-link.gts +20 -0
- package/bundled-types/boxel-ui/icons/icon-list.gts +40 -0
- package/bundled-types/boxel-ui/icons/icon-minus-circle.gts +26 -0
- package/bundled-types/boxel-ui/icons/icon-pencil-crossed-out.gts +33 -0
- package/bundled-types/boxel-ui/icons/icon-pencil-not-crossed-out.gts +21 -0
- package/bundled-types/boxel-ui/icons/icon-pencil.gts +23 -0
- package/bundled-types/boxel-ui/icons/icon-plus-circle.gts +31 -0
- package/bundled-types/boxel-ui/icons/icon-plus-thin.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-plus.gts +20 -0
- package/bundled-types/boxel-ui/icons/icon-search-thick.gts +27 -0
- package/bundled-types/boxel-ui/icons/icon-search.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-table.gts +44 -0
- package/bundled-types/boxel-ui/icons/icon-trash.gts +24 -0
- package/bundled-types/boxel-ui/icons/icon-turn-down-right.gts +18 -0
- package/bundled-types/boxel-ui/icons/icon-x.gts +21 -0
- package/bundled-types/boxel-ui/icons/image-placeholder.gts +30 -0
- package/bundled-types/boxel-ui/icons/isolated.gts +20 -0
- package/bundled-types/boxel-ui/icons/loading-indicator.gts +26 -0
- package/bundled-types/boxel-ui/icons/lock.gts +23 -0
- package/bundled-types/boxel-ui/icons/markdown.gts +19 -0
- package/bundled-types/boxel-ui/icons/profile.gts +23 -0
- package/bundled-types/boxel-ui/icons/publish-site-icon.gts +25 -0
- package/bundled-types/boxel-ui/icons/rows-4.gts +26 -0
- package/bundled-types/boxel-ui/icons/select-all.gts +25 -0
- package/bundled-types/boxel-ui/icons/send.gts +21 -0
- package/bundled-types/boxel-ui/icons/sparkle.gts +21 -0
- package/bundled-types/boxel-ui/icons/star-filled.gts +25 -0
- package/bundled-types/boxel-ui/icons/star-half-fill.gts +27 -0
- package/bundled-types/boxel-ui/icons/star.gts +25 -0
- package/bundled-types/boxel-ui/icons/success-bordered.gts +30 -0
- package/bundled-types/boxel-ui/icons/three-dots-horizontal.gts +21 -0
- package/bundled-types/boxel-ui/icons/triangle-left.gts +23 -0
- package/bundled-types/boxel-ui/icons/triangle-right.gts +23 -0
- package/bundled-types/boxel-ui/icons/types.ts +10 -0
- package/bundled-types/boxel-ui/icons/upload.gts +20 -0
- package/bundled-types/boxel-ui/icons/warning.gts +19 -0
- package/bundled-types/boxel-ui/icons.gts +249 -0
- package/bundled-types/boxel-ui/modifiers/auto-focus.ts +7 -0
- package/bundled-types/boxel-ui/modifiers/set-css-var.ts +24 -0
- package/bundled-types/boxel-ui/modifiers.ts +14 -0
- package/bundled-types/boxel-ui/types/@cardstack/boxel-ui/index.d.ts +3 -0
- package/bundled-types/boxel-ui/types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/boxel-ui/types/ember-draggable-modifiers/index.d.ts +109 -0
- package/bundled-types/boxel-ui/types/ember-draggable-modifiers/utils.d.ts +7 -0
- package/bundled-types/boxel-ui/types/ember-focus-trap/index.d.ts +20 -0
- package/bundled-types/boxel-ui/types/ember-power-calendar/components/index.d.ts +9 -0
- package/bundled-types/boxel-ui/types/ember-resize-modifier/index.d.ts +14 -0
- package/bundled-types/boxel-ui/types/ember-set-body-class/index.d.ts +12 -0
- package/bundled-types/boxel-ui/types/ember-sortable/index.d.ts +52 -0
- package/bundled-types/boxel-ui/types/global.d.ts +7 -0
- package/bundled-types/boxel-ui/usage.ts +112 -0
- package/bundled-types/boxel-ui/utils/date-utils.ts +192 -0
- package/bundled-types/boxel-ui/utils/fitted-formats.ts +161 -0
- package/bundled-types/host-app/app.ts +22 -0
- package/bundled-types/host-app/commands/add-field-to-card-definition.ts +74 -0
- package/bundled-types/host-app/commands/ai-assistant.ts +203 -0
- package/bundled-types/host-app/commands/apply-markdown-edit.ts +203 -0
- package/bundled-types/host-app/commands/apply-search-replace-block.ts +225 -0
- package/bundled-types/host-app/commands/ask-ai.ts +66 -0
- package/bundled-types/host-app/commands/authed-fetch.ts +53 -0
- package/bundled-types/host-app/commands/bot-requests/create-listing-pr-request.ts +77 -0
- package/bundled-types/host-app/commands/bot-requests/send-bot-trigger-event.ts +53 -0
- package/bundled-types/host-app/commands/can-read-realm.ts +34 -0
- package/bundled-types/host-app/commands/cancel-indexing-job.ts +29 -0
- package/bundled-types/host-app/commands/check-correctness.ts +309 -0
- package/bundled-types/host-app/commands/copy-and-edit.ts +311 -0
- package/bundled-types/host-app/commands/copy-card-as-markdown.ts +41 -0
- package/bundled-types/host-app/commands/copy-card-to-stack.ts +70 -0
- package/bundled-types/host-app/commands/copy-card.ts +67 -0
- package/bundled-types/host-app/commands/copy-file-to-realm.ts +82 -0
- package/bundled-types/host-app/commands/copy-source.ts +46 -0
- package/bundled-types/host-app/commands/create-ai-assistant-room.ts +144 -0
- package/bundled-types/host-app/commands/create-and-open-submission-workflow-card.ts +30 -0
- package/bundled-types/host-app/commands/create-specs.ts +422 -0
- package/bundled-types/host-app/commands/create-submission-workflow.ts +172 -0
- package/bundled-types/host-app/commands/evaluate-module.ts +119 -0
- package/bundled-types/host-app/commands/execute-atomic-operations.ts +44 -0
- package/bundled-types/host-app/commands/fetch-card-json.ts +33 -0
- package/bundled-types/host-app/commands/full-reindex-realm.ts +30 -0
- package/bundled-types/host-app/commands/generate-example-cards.ts +298 -0
- package/bundled-types/host-app/commands/generate-readme-spec.ts +116 -0
- package/bundled-types/host-app/commands/generate-theme-example.ts +147 -0
- package/bundled-types/host-app/commands/generate-thumbnail.ts +247 -0
- package/bundled-types/host-app/commands/get-all-realm-metas.ts +38 -0
- package/bundled-types/host-app/commands/get-available-realm-identifiers.ts +29 -0
- package/bundled-types/host-app/commands/get-card-type-schema.ts +59 -0
- package/bundled-types/host-app/commands/get-card.ts +34 -0
- package/bundled-types/host-app/commands/get-catalog-realm-identifiers.ts +29 -0
- package/bundled-types/host-app/commands/get-default-writable-realm.ts +28 -0
- package/bundled-types/host-app/commands/get-events-from-room.ts +70 -0
- package/bundled-types/host-app/commands/get-realm-of-resource-identifier.ts +37 -0
- package/bundled-types/host-app/commands/get-user-system-card.ts +38 -0
- package/bundled-types/host-app/commands/index.ts +590 -0
- package/bundled-types/host-app/commands/instantiate-card.ts +185 -0
- package/bundled-types/host-app/commands/invalidate-realm-identifiers.ts +33 -0
- package/bundled-types/host-app/commands/invite-user-to-room.ts +34 -0
- package/bundled-types/host-app/commands/lint-and-fix.ts +60 -0
- package/bundled-types/host-app/commands/listing-action-build.ts +79 -0
- package/bundled-types/host-app/commands/listing-action-init.ts +106 -0
- package/bundled-types/host-app/commands/listing-create.ts +632 -0
- package/bundled-types/host-app/commands/listing-generate-example.ts +83 -0
- package/bundled-types/host-app/commands/listing-install.ts +227 -0
- package/bundled-types/host-app/commands/listing-remix.ts +150 -0
- package/bundled-types/host-app/commands/listing-update-specs.ts +116 -0
- package/bundled-types/host-app/commands/listing-use.ts +97 -0
- package/bundled-types/host-app/commands/one-shot-llm-request.ts +209 -0
- package/bundled-types/host-app/commands/open-ai-assistant-room.ts +38 -0
- package/bundled-types/host-app/commands/open-create-listing-modal.ts +52 -0
- package/bundled-types/host-app/commands/open-in-interact-mode.ts +36 -0
- package/bundled-types/host-app/commands/open-workspace.ts +38 -0
- package/bundled-types/host-app/commands/patch-card-instance.ts +108 -0
- package/bundled-types/host-app/commands/patch-code.ts +243 -0
- package/bundled-types/host-app/commands/patch-fields.ts +304 -0
- package/bundled-types/host-app/commands/patch-theme.ts +52 -0
- package/bundled-types/host-app/commands/persist-module-inspector-view.ts +41 -0
- package/bundled-types/host-app/commands/populate-with-sample-data.ts +84 -0
- package/bundled-types/host-app/commands/preview-format.ts +52 -0
- package/bundled-types/host-app/commands/read-binary-file.ts +62 -0
- package/bundled-types/host-app/commands/read-card-for-ai-assistant.ts +50 -0
- package/bundled-types/host-app/commands/read-file-for-ai-assistant.ts +46 -0
- package/bundled-types/host-app/commands/read-source.ts +46 -0
- package/bundled-types/host-app/commands/read-text-file.ts +44 -0
- package/bundled-types/host-app/commands/register-bot.ts +42 -0
- package/bundled-types/host-app/commands/reindex-realm.ts +30 -0
- package/bundled-types/host-app/commands/retry-submission-workflow.ts +119 -0
- package/bundled-types/host-app/commands/sanitize-module-list.ts +83 -0
- package/bundled-types/host-app/commands/save-card.ts +44 -0
- package/bundled-types/host-app/commands/screenshot-card.ts +148 -0
- package/bundled-types/host-app/commands/search-and-choose.ts +180 -0
- package/bundled-types/host-app/commands/search-cards.ts +102 -0
- package/bundled-types/host-app/commands/search-google-images.ts +100 -0
- package/bundled-types/host-app/commands/send-ai-assistant-message.ts +122 -0
- package/bundled-types/host-app/commands/send-request-via-proxy.ts +70 -0
- package/bundled-types/host-app/commands/serialize-card.ts +45 -0
- package/bundled-types/host-app/commands/set-active-llm.ts +39 -0
- package/bundled-types/host-app/commands/set-user-system-card.ts +29 -0
- package/bundled-types/host-app/commands/show-card.ts +102 -0
- package/bundled-types/host-app/commands/show-file.ts +39 -0
- package/bundled-types/host-app/commands/store-add.ts +37 -0
- package/bundled-types/host-app/commands/summarize-session.ts +82 -0
- package/bundled-types/host-app/commands/switch-submode.ts +112 -0
- package/bundled-types/host-app/commands/sync-openrouter-models.ts +373 -0
- package/bundled-types/host-app/commands/transform-cards.ts +59 -0
- package/bundled-types/host-app/commands/unregister-bot.ts +29 -0
- package/bundled-types/host-app/commands/update-code-path-with-selection.ts +45 -0
- package/bundled-types/host-app/commands/update-playground-selection.ts +37 -0
- package/bundled-types/host-app/commands/update-room-skills.ts +231 -0
- package/bundled-types/host-app/commands/utils.ts +178 -0
- package/bundled-types/host-app/commands/validate-realm.ts +40 -0
- package/bundled-types/host-app/commands/write-binary-file.ts +142 -0
- package/bundled-types/host-app/commands/write-text-file.ts +104 -0
- package/bundled-types/host-app/components/.gitkeep +0 -0
- package/bundled-types/host-app/components/ai-assistant/action-bar.gts +188 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg@2x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg@3x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-animated.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw@2x.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw@3x.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon@2x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon@3x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/apply-button/index.gts +226 -0
- package/bundled-types/host-app/components/ai-assistant/apply-button/usage.gts +81 -0
- package/bundled-types/host-app/components/ai-assistant/attached-file-dropdown-menu.gts +179 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/attach-button.gts +176 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/attached-items.gts +271 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/index.gts +144 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/usage.gts +127 -0
- package/bundled-types/host-app/components/ai-assistant/button.gts +60 -0
- package/bundled-types/host-app/components/ai-assistant/chat-input/index.gts +203 -0
- package/bundled-types/host-app/components/ai-assistant/chat-input/usage.gts +68 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/actions.gts +58 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/apply-code-patch-button.gts +66 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/command-header.gts +115 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/diff-editor-header.gts +209 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/index.gts +228 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/patch-footer.gts +32 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/view-code-button.gts +73 -0
- package/bundled-types/host-app/components/ai-assistant/focus-pill/index.gts +60 -0
- package/bundled-types/host-app/components/ai-assistant/focus-pill/usage.gts +45 -0
- package/bundled-types/host-app/components/ai-assistant/llm-mode-toggle.gts +113 -0
- package/bundled-types/host-app/components/ai-assistant/llm-select.gts +158 -0
- package/bundled-types/host-app/components/ai-assistant/message/aibot-message.gts +374 -0
- package/bundled-types/host-app/components/ai-assistant/message/attachments.gts +153 -0
- package/bundled-types/host-app/components/ai-assistant/message/index.gts +678 -0
- package/bundled-types/host-app/components/ai-assistant/message/meta.gts +66 -0
- package/bundled-types/host-app/components/ai-assistant/message/text-content.gts +32 -0
- package/bundled-types/host-app/components/ai-assistant/message/usage.gts +182 -0
- package/bundled-types/host-app/components/ai-assistant/message/user-message.gts +52 -0
- package/bundled-types/host-app/components/ai-assistant/new-session-button.gts +126 -0
- package/bundled-types/host-app/components/ai-assistant/new-session-settings.gts +180 -0
- package/bundled-types/host-app/components/ai-assistant/new-session.gts +83 -0
- package/bundled-types/host-app/components/ai-assistant/panel-popover.gts +102 -0
- package/bundled-types/host-app/components/ai-assistant/panel.gts +453 -0
- package/bundled-types/host-app/components/ai-assistant/past-session-item.gts +323 -0
- package/bundled-types/host-app/components/ai-assistant/past-sessions.gts +115 -0
- package/bundled-types/host-app/components/ai-assistant/rename-session.gts +144 -0
- package/bundled-types/host-app/components/ai-assistant/restore-file-modal.gts +105 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/index.gts +190 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/skill-toggle.gts +168 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/usage.gts +48 -0
- package/bundled-types/host-app/components/ai-assistant/toast.gts +293 -0
- package/bundled-types/host-app/components/card-catalog/modal.gts +579 -0
- package/bundled-types/host-app/components/card-error.gts +41 -0
- package/bundled-types/host-app/components/card-instance-picker/index.gts +54 -0
- package/bundled-types/host-app/components/card-pill.gts +189 -0
- package/bundled-types/host-app/components/card-prerender.gts +880 -0
- package/bundled-types/host-app/components/card-renderer.gts +84 -0
- package/bundled-types/host-app/components/card-search/constants.ts +76 -0
- package/bundled-types/host-app/components/card-search/item-button.gts +243 -0
- package/bundled-types/host-app/components/card-search/panel.gts +150 -0
- package/bundled-types/host-app/components/card-search/search-bar.gts +218 -0
- package/bundled-types/host-app/components/card-search/search-content.gts +604 -0
- package/bundled-types/host-app/components/card-search/search-result-header.gts +165 -0
- package/bundled-types/host-app/components/card-search/search-result-section.gts +545 -0
- package/bundled-types/host-app/components/card-search/section-header.gts +117 -0
- package/bundled-types/host-app/components/editor/directory.gts +308 -0
- package/bundled-types/host-app/components/editor/file-tree.gts +69 -0
- package/bundled-types/host-app/components/editor/import-module.gts +27 -0
- package/bundled-types/host-app/components/editor/indexed-file-tree.gts +572 -0
- package/bundled-types/host-app/components/editor/recent-files.gts +141 -0
- package/bundled-types/host-app/components/file-pill.gts +206 -0
- package/bundled-types/host-app/components/head-format-preview.gts +781 -0
- package/bundled-types/host-app/components/host-mode/breadcrumb-item.gts +150 -0
- package/bundled-types/host-app/components/host-mode/breadcrumbs.gts +131 -0
- package/bundled-types/host-app/components/host-mode/card.gts +199 -0
- package/bundled-types/host-app/components/host-mode/content.gts +195 -0
- package/bundled-types/host-app/components/host-mode/stack-item.gts +310 -0
- package/bundled-types/host-app/components/host-mode/stack.gts +91 -0
- package/bundled-types/host-app/components/matrix/auth-container.gts +66 -0
- package/bundled-types/host-app/components/matrix/auth.gts +73 -0
- package/bundled-types/host-app/components/matrix/forgot-password.gts +487 -0
- package/bundled-types/host-app/components/matrix/login.gts +241 -0
- package/bundled-types/host-app/components/matrix/register-user.gts +843 -0
- package/bundled-types/host-app/components/matrix/room-message-command.gts +330 -0
- package/bundled-types/host-app/components/matrix/room-message.gts +261 -0
- package/bundled-types/host-app/components/matrix/room.gts +1872 -0
- package/bundled-types/host-app/components/matrix/user-profile.gts +99 -0
- package/bundled-types/host-app/components/modal-container.gts +171 -0
- package/bundled-types/host-app/components/operator-mode/binary-file-info.gts +77 -0
- package/bundled-types/host-app/components/operator-mode/card-adoption-chain.gts +99 -0
- package/bundled-types/host-app/components/operator-mode/card-error-detail.gts +87 -0
- package/bundled-types/host-app/components/operator-mode/card-error.gts +177 -0
- package/bundled-types/host-app/components/operator-mode/card-schema-editor.gts +616 -0
- package/bundled-types/host-app/components/operator-mode/card-url-bar.gts +197 -0
- package/bundled-types/host-app/components/operator-mode/choose-file-modal.gts +562 -0
- package/bundled-types/host-app/components/operator-mode/choose-subscription-plan-modal.gts +517 -0
- package/bundled-types/host-app/components/operator-mode/code-editor.gts +736 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/editor-indicator.gts +128 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/format-chooser.gts +589 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/inner-container.gts +162 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/left-panel-toggle.gts +267 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/module-inspector.gts +836 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/field-chooser-modal.gts +97 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/instance-chooser-dropdown.gts +346 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-background.png +0 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-panel.gts +1274 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-preview.gts +155 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground.gts +98 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/spec-search.gts +70 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/schema-editor.gts +205 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/spec-preview-badge.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/spec-preview.gts +432 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/toggle-button.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/code-submode.gts +1030 -0
- package/bundled-types/host-app/components/operator-mode/container.gts +270 -0
- package/bundled-types/host-app/components/operator-mode/context-menu-button.gts +95 -0
- package/bundled-types/host-app/components/operator-mode/copy-button.gts +277 -0
- package/bundled-types/host-app/components/operator-mode/create-file-modal.gts +1087 -0
- package/bundled-types/host-app/components/operator-mode/create-listing-modal.gts +513 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/base.gts +222 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/clickable.gts +59 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/divider.gts +48 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/index.gts +108 -0
- package/bundled-types/host-app/components/operator-mode/delete-modal.gts +123 -0
- package/bundled-types/host-app/components/operator-mode/detail-panel-selector.gts +320 -0
- package/bundled-types/host-app/components/operator-mode/detail-panel.gts +834 -0
- package/bundled-types/host-app/components/operator-mode/edit-field-modal.gts +450 -0
- package/bundled-types/host-app/components/operator-mode/error-display.gts +590 -0
- package/bundled-types/host-app/components/operator-mode/host-submode/open-site-popover.gts +127 -0
- package/bundled-types/host-app/components/operator-mode/host-submode/publishing-realm-popover.gts +159 -0
- package/bundled-types/host-app/components/operator-mode/host-submode.gts +373 -0
- package/bundled-types/host-app/components/operator-mode/interact-submode/neighbor-stack-trigger.gts +116 -0
- package/bundled-types/host-app/components/operator-mode/interact-submode.gts +1021 -0
- package/bundled-types/host-app/components/operator-mode/new-file-button.gts +187 -0
- package/bundled-types/host-app/components/operator-mode/operator-mode-overlays.gts +511 -0
- package/bundled-types/host-app/components/operator-mode/overlays.gts +342 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/fitted-format-gallery.gts +127 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/index.gts +443 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/markdown-preview.gts +175 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/metadata-panel.gts +214 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/rendered-markdown.gts +718 -0
- package/bundled-types/host-app/components/operator-mode/private-dependency-violation.gts +70 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-email.gts +686 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-settings-modal.gts +454 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-subscription.gts +170 -0
- package/bundled-types/host-app/components/operator-mode/profile-info-popover.gts +263 -0
- package/bundled-types/host-app/components/operator-mode/publish-realm-modal.gts +1529 -0
- package/bundled-types/host-app/components/operator-mode/remove-field-modal.gts +135 -0
- package/bundled-types/host-app/components/operator-mode/send-error-to-ai-assistant.gts +195 -0
- package/bundled-types/host-app/components/operator-mode/stack-item.gts +1341 -0
- package/bundled-types/host-app/components/operator-mode/stack.gts +191 -0
- package/bundled-types/host-app/components/operator-mode/submode-layout.gts +781 -0
- package/bundled-types/host-app/components/operator-mode/syntax-error-display.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/add-workspace.gts +282 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/index.gts +299 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/item-container.gts +50 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/workspace-loading-indicator.gts +50 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/workspace.gts +1079 -0
- package/bundled-types/host-app/components/pill-menu/index.gts +281 -0
- package/bundled-types/host-app/components/pill-menu/usage.gts +64 -0
- package/bundled-types/host-app/components/prerendered-card-search.gts +274 -0
- package/bundled-types/host-app/components/realm-dropdown.gts +209 -0
- package/bundled-types/host-app/components/realm-picker/index.gts +142 -0
- package/bundled-types/host-app/components/search-sheet/index.gts +426 -0
- package/bundled-types/host-app/components/search-sheet/usage.gts +99 -0
- package/bundled-types/host-app/components/submode-switcher.gts +260 -0
- package/bundled-types/host-app/components/type-picker/index.gts +111 -0
- package/bundled-types/host-app/components/with-known-realms-loaded.gts +47 -0
- package/bundled-types/host-app/components/with-loaded-realm.gts +39 -0
- package/bundled-types/host-app/components/with-subscription-data.gts +247 -0
- package/bundled-types/host-app/config/environment.ts +66 -0
- package/bundled-types/host-app/deprecation-workflow.js +30 -0
- package/bundled-types/host-app/lib/browser-queue.ts +198 -0
- package/bundled-types/host-app/lib/codemirror-context.ts +1081 -0
- package/bundled-types/host-app/lib/command-definitions.ts +41 -0
- package/bundled-types/host-app/lib/download-realm.ts +9 -0
- package/bundled-types/host-app/lib/example-card-helpers.ts +99 -0
- package/bundled-types/host-app/lib/externals.ts +247 -0
- package/bundled-types/host-app/lib/field-path-parser.ts +520 -0
- package/bundled-types/host-app/lib/file-def-manager.ts +712 -0
- package/bundled-types/host-app/lib/file-upload-state.ts +6 -0
- package/bundled-types/host-app/lib/formatted-message/utils.ts +272 -0
- package/bundled-types/host-app/lib/gc-card-store.ts +1084 -0
- package/bundled-types/host-app/lib/host-base-command.ts +29 -0
- package/bundled-types/host-app/lib/html-component.ts +144 -0
- package/bundled-types/host-app/lib/html-to-markdown.ts +96 -0
- package/bundled-types/host-app/lib/isolated-render.gts +90 -0
- package/bundled-types/host-app/lib/known-file-meta-urls.ts +17 -0
- package/bundled-types/host-app/lib/limited-set.ts +68 -0
- package/bundled-types/host-app/lib/matrix-classes/member.ts +28 -0
- package/bundled-types/host-app/lib/matrix-classes/message-builder.ts +444 -0
- package/bundled-types/host-app/lib/matrix-classes/message-code-patch-result.ts +44 -0
- package/bundled-types/host-app/lib/matrix-classes/message-command.ts +109 -0
- package/bundled-types/host-app/lib/matrix-classes/message.ts +239 -0
- package/bundled-types/host-app/lib/matrix-classes/room.ts +174 -0
- package/bundled-types/host-app/lib/matrix-utils.ts +114 -0
- package/bundled-types/host-app/lib/mutex.ts +62 -0
- package/bundled-types/host-app/lib/prerender-fetch-headers.ts +46 -0
- package/bundled-types/host-app/lib/prerender-util.ts +31 -0
- package/bundled-types/host-app/lib/public-path.ts +1 -0
- package/bundled-types/host-app/lib/random-name.ts +26 -0
- package/bundled-types/host-app/lib/realm-utils.ts +45 -0
- package/bundled-types/host-app/lib/search-cache-key.ts +33 -0
- package/bundled-types/host-app/lib/search-in-flight-key.ts +28 -0
- package/bundled-types/host-app/lib/search-replace-block-parsing.ts +101 -0
- package/bundled-types/host-app/lib/setup-globals.ts +15 -0
- package/bundled-types/host-app/lib/sqlite-adapter.ts +510 -0
- package/bundled-types/host-app/lib/stack-item.ts +164 -0
- package/bundled-types/host-app/lib/utils.ts +84 -0
- package/bundled-types/host-app/lib/window-error-handler.ts +132 -0
- package/bundled-types/host-app/router.ts +31 -0
- package/bundled-types/host-app/services/ai-assistant-panel-service.ts +850 -0
- package/bundled-types/host-app/services/billing-service.ts +208 -0
- package/bundled-types/host-app/services/card-service.ts +373 -0
- package/bundled-types/host-app/services/card-type-service.ts +226 -0
- package/bundled-types/host-app/services/code-semantics-service.ts +297 -0
- package/bundled-types/host-app/services/command-service.ts +975 -0
- package/bundled-types/host-app/services/environment-service.ts +26 -0
- package/bundled-types/host-app/services/error-display.ts +42 -0
- package/bundled-types/host-app/services/file-upload.ts +212 -0
- package/bundled-types/host-app/services/host-mode-service.ts +381 -0
- package/bundled-types/host-app/services/host-mode-state-service.ts +160 -0
- package/bundled-types/host-app/services/loader-service.ts +148 -0
- package/bundled-types/host-app/services/local-indexer.ts +68 -0
- package/bundled-types/host-app/services/local-persistence-service.ts +296 -0
- package/bundled-types/host-app/services/logger-service.ts +13 -0
- package/bundled-types/host-app/services/matrix-sdk-loader.ts +346 -0
- package/bundled-types/host-app/services/matrix-service.ts +2287 -0
- package/bundled-types/host-app/services/message-service.ts +84 -0
- package/bundled-types/host-app/services/module-contents-service.ts +333 -0
- package/bundled-types/host-app/services/monaco-service.ts +333 -0
- package/bundled-types/host-app/services/network.ts +101 -0
- package/bundled-types/host-app/services/operator-mode-state-service.ts +1591 -0
- package/bundled-types/host-app/services/playground-panel-service.ts +236 -0
- package/bundled-types/host-app/services/queue.ts +30 -0
- package/bundled-types/host-app/services/realm-info-service.ts +37 -0
- package/bundled-types/host-app/services/realm-server.ts +1209 -0
- package/bundled-types/host-app/services/realm.ts +1413 -0
- package/bundled-types/host-app/services/recent-cards-service.ts +174 -0
- package/bundled-types/host-app/services/recent-files-service.ts +224 -0
- package/bundled-types/host-app/services/render-error-state.ts +55 -0
- package/bundled-types/host-app/services/render-service.ts +362 -0
- package/bundled-types/host-app/services/render-store.ts +27 -0
- package/bundled-types/host-app/services/reset.ts +19 -0
- package/bundled-types/host-app/services/scroll-position-service.ts +81 -0
- package/bundled-types/host-app/services/spec-panel-service.ts +107 -0
- package/bundled-types/host-app/services/store.ts +2540 -0
- package/bundled-types/host-app/utils/assert-never.ts +3 -0
- package/bundled-types/host-app/utils/auth-error-guard.ts +183 -0
- package/bundled-types/host-app/utils/auth-service-worker-registration.ts +123 -0
- package/bundled-types/host-app/utils/card-search/query-builder.ts +169 -0
- package/bundled-types/host-app/utils/card-search/section-pagination.ts +57 -0
- package/bundled-types/host-app/utils/card-search/sections.ts +240 -0
- package/bundled-types/host-app/utils/card-search/type-filter.ts +124 -0
- package/bundled-types/host-app/utils/card-search/types.ts +11 -0
- package/bundled-types/host-app/utils/card-search/url.ts +23 -0
- package/bundled-types/host-app/utils/clipboard.ts +23 -0
- package/bundled-types/host-app/utils/editor/boxel-formatter.ts +65 -0
- package/bundled-types/host-app/utils/editor/editor-language.ts +88 -0
- package/bundled-types/host-app/utils/editor/monaco-test-waiter.ts +302 -0
- package/bundled-types/host-app/utils/file-def-attributes-extractor.ts +438 -0
- package/bundled-types/host-app/utils/file-name.ts +38 -0
- package/bundled-types/host-app/utils/id-from-card-or-url.ts +11 -0
- package/bundled-types/host-app/utils/lint-formatting.ts +57 -0
- package/bundled-types/host-app/utils/local-storage-keys.ts +28 -0
- package/bundled-types/host-app/utils/normalized-dir-path.ts +3 -0
- package/bundled-types/host-app/utils/prettify-messages.ts +21 -0
- package/bundled-types/host-app/utils/prettify-prompts.ts +21 -0
- package/bundled-types/host-app/utils/realm-index-boilerplate.ts +27 -0
- package/bundled-types/host-app/utils/register-boxel-transition.ts +17 -0
- package/bundled-types/host-app/utils/render-desync-detector.ts +362 -0
- package/bundled-types/host-app/utils/render-error.ts +455 -0
- package/bundled-types/host-app/utils/render-timer-stub.ts +249 -0
- package/bundled-types/host-app/utils/run-while-active.ts +14 -0
- package/bundled-types/host-app/utils/schema-editor.ts +25 -0
- package/bundled-types/host-app/utils/text-suggestion.ts +82 -0
- package/bundled-types/host-app/utils/titleize.ts +10 -0
- package/bundled-types/host-app/utils/uuid.ts +13 -0
- package/bundled-types/host-tests/helpers/adapter.ts +464 -0
- package/bundled-types/host-tests/helpers/base-realm.ts +464 -0
- package/bundled-types/host-tests/helpers/cards/view-card-demo.ts +119 -0
- package/bundled-types/host-tests/helpers/field-test-helpers.gts +54 -0
- package/bundled-types/host-tests/helpers/image-fixture.ts +3 -0
- package/bundled-types/host-tests/helpers/index.gts +2099 -0
- package/bundled-types/host-tests/helpers/indexer.ts +293 -0
- package/bundled-types/host-tests/helpers/interact-submode-setup.gts +551 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_client.ts +1042 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_sdk.ts +71 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_server-state.ts +343 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_sliding-sync.ts +140 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_utils.ts +146 -0
- package/bundled-types/host-tests/helpers/mock-matrix.ts +200 -0
- package/bundled-types/host-tests/helpers/operator-mode-parameters-match.ts +71 -0
- package/bundled-types/host-tests/helpers/operator-mode-state.ts +18 -0
- package/bundled-types/host-tests/helpers/percy-snapshot.ts +228 -0
- package/bundled-types/host-tests/helpers/playground.ts +130 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/index.ts +100 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/routes.ts +617 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/types.ts +24 -0
- package/bundled-types/host-tests/helpers/recent-files-cards.ts +86 -0
- package/bundled-types/host-tests/helpers/render-component.ts +40 -0
- package/bundled-types/host-tests/helpers/setup-qunit.js +164 -0
- package/bundled-types/host-tests/helpers/setup.ts +349 -0
- package/bundled-types/host-tests/helpers/shard-warmup.ts +72 -0
- package/bundled-types/host-tests/helpers/stream.ts +60 -0
- package/bundled-types/host-tests/helpers/test-auth.ts +27 -0
- package/bundled-types/host-tests/helpers/test-realm-registry.ts +23 -0
- package/bundled-types/host-tests/helpers/test-realm-service-worker.ts +92 -0
- package/bundled-types/host-tests/helpers/uncaught-exceptions.ts +16 -0
- package/bundled-types/host-tests/helpers/visit-operator-mode.ts +39 -0
- package/bundled-types/host-types/@cardstack/host/index.d.ts +3 -0
- package/bundled-types/host-types/@joplin/turndown-plugin-gfm/index.d.ts +15 -0
- package/bundled-types/host-types/@sqlite.org/sqlite-wasm/index.d.ts +122 -0
- package/bundled-types/host-types/ember-click-outside/modifiers/on-click-outside.ts +16 -0
- package/bundled-types/host-types/ember-concurrency/helpers/perform.d.ts +3 -0
- package/bundled-types/host-types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/host-types/ember-data/types/registries/model.d.ts +6 -0
- package/bundled-types/host-types/ember-elsewhere/from-elsewhere.d.ts +12 -0
- package/bundled-types/host-types/ember-elsewhere/to-elsewhere.d.ts +16 -0
- package/bundled-types/host-types/ember-focus-trap/index.d.ts +4 -0
- package/bundled-types/host-types/ember-keyboard/modifiers/on-key.d.ts +15 -0
- package/bundled-types/host-types/index.d.ts +6 -0
- package/bundled-types/local-types/eslint-js.d.ts +5 -0
- package/bundled-types/local-types/index.d.ts +115 -0
- package/bundled-types/local-types/marked-gfm-heading-id.d.ts +12 -0
- package/bundled-types/local-types/matrix-js-sdk/index.d.ts +11 -0
- package/bundled-types/local-types/package.json +13 -0
- package/bundled-types/shims/boxel-cli-shims.d.ts +10 -0
- package/dist/index.js +100 -100
- package/package.json +13 -7
- package/src/commands/parse.ts +277 -34
|
@@ -0,0 +1,1872 @@
|
|
|
1
|
+
import { registerDestructor } from '@ember/destroyable';
|
|
2
|
+
import { fn } from '@ember/helper';
|
|
3
|
+
import { array } from '@ember/helper';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
5
|
+
import { action } from '@ember/object';
|
|
6
|
+
import type Owner from '@ember/owner';
|
|
7
|
+
import { schedule } from '@ember/runloop';
|
|
8
|
+
import { service } from '@ember/service';
|
|
9
|
+
import { isTesting } from '@embroider/macros';
|
|
10
|
+
import Component from '@glimmer/component';
|
|
11
|
+
import { cached, tracked } from '@glimmer/tracking';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
enqueueTask,
|
|
15
|
+
restartableTask,
|
|
16
|
+
timeout,
|
|
17
|
+
all,
|
|
18
|
+
task,
|
|
19
|
+
} from 'ember-concurrency';
|
|
20
|
+
|
|
21
|
+
import perform from 'ember-concurrency/helpers/perform';
|
|
22
|
+
import { consume } from 'ember-provide-consume-context';
|
|
23
|
+
import { resource, use } from 'ember-resources';
|
|
24
|
+
import max from 'lodash/max';
|
|
25
|
+
|
|
26
|
+
import pluralize from 'pluralize';
|
|
27
|
+
|
|
28
|
+
import { TrackedObject, TrackedMap, TrackedSet } from 'tracked-built-ins';
|
|
29
|
+
|
|
30
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
31
|
+
|
|
32
|
+
import {
|
|
33
|
+
Alert,
|
|
34
|
+
BoxelButton,
|
|
35
|
+
LoadingIndicator,
|
|
36
|
+
} from '@cardstack/boxel-ui/components';
|
|
37
|
+
import { and, eq, not } from '@cardstack/boxel-ui/helpers';
|
|
38
|
+
|
|
39
|
+
import type {
|
|
40
|
+
RealmResourceIdentifier,
|
|
41
|
+
ResolvedCodeRef,
|
|
42
|
+
} from '@cardstack/runtime-common';
|
|
43
|
+
import {
|
|
44
|
+
baseFileRef,
|
|
45
|
+
formattedError,
|
|
46
|
+
type getCard,
|
|
47
|
+
GetCardContextName,
|
|
48
|
+
inferContentType,
|
|
49
|
+
internalKeyFor,
|
|
50
|
+
isCardInstance,
|
|
51
|
+
resolveFileDefCodeRef,
|
|
52
|
+
SupportedMimeType,
|
|
53
|
+
} from '@cardstack/runtime-common';
|
|
54
|
+
import {
|
|
55
|
+
DEFAULT_LLM_LIST,
|
|
56
|
+
DEFAULT_LLM_ID_TO_NAME,
|
|
57
|
+
} from '@cardstack/runtime-common/matrix-constants';
|
|
58
|
+
|
|
59
|
+
import UpdateRoomSkillsCommand from '@cardstack/host/commands/update-room-skills';
|
|
60
|
+
import ENV from '@cardstack/host/config/environment';
|
|
61
|
+
import type { FileUploadState } from '@cardstack/host/lib/file-upload-state';
|
|
62
|
+
import type { Message } from '@cardstack/host/lib/matrix-classes/message';
|
|
63
|
+
import type { StackItem } from '@cardstack/host/lib/stack-item';
|
|
64
|
+
import { getAutoAttachment } from '@cardstack/host/resources/auto-attached-card';
|
|
65
|
+
import { isReady } from '@cardstack/host/resources/file';
|
|
66
|
+
import type { RoomResource } from '@cardstack/host/resources/room';
|
|
67
|
+
|
|
68
|
+
import type AiAssistantPanelService from '@cardstack/host/services/ai-assistant-panel-service';
|
|
69
|
+
import type CardService from '@cardstack/host/services/card-service';
|
|
70
|
+
import type CommandService from '@cardstack/host/services/command-service';
|
|
71
|
+
import type FileUploadService from '@cardstack/host/services/file-upload';
|
|
72
|
+
import type LoaderService from '@cardstack/host/services/loader-service';
|
|
73
|
+
import type MatrixService from '@cardstack/host/services/matrix-service';
|
|
74
|
+
import type { MonacoSDK } from '@cardstack/host/services/monaco-service';
|
|
75
|
+
import type NetworkService from '@cardstack/host/services/network';
|
|
76
|
+
import type OperatorModeStateService from '@cardstack/host/services/operator-mode-state-service';
|
|
77
|
+
import type PlaygroundPanelService from '@cardstack/host/services/playground-panel-service';
|
|
78
|
+
import type SpecPanelService from '@cardstack/host/services/spec-panel-service';
|
|
79
|
+
import type StoreService from '@cardstack/host/services/store';
|
|
80
|
+
import { FileDefAttributesExtractor } from '@cardstack/host/utils/file-def-attributes-extractor';
|
|
81
|
+
|
|
82
|
+
import type { CardDef } from 'https://cardstack.com/base/card-api';
|
|
83
|
+
import type { FileDef } from 'https://cardstack.com/base/file-api';
|
|
84
|
+
|
|
85
|
+
import { errorJsonApiToErrorEntry } from '../../lib/window-error-handler';
|
|
86
|
+
import AiAssistantActionBar from '../ai-assistant/action-bar';
|
|
87
|
+
import AiAssistantAttachmentPicker from '../ai-assistant/attachment-picker';
|
|
88
|
+
import AiAssistantChatInput from '../ai-assistant/chat-input';
|
|
89
|
+
import FocusPill from '../ai-assistant/focus-pill';
|
|
90
|
+
import LLMModeToggle from '../ai-assistant/llm-mode-toggle';
|
|
91
|
+
import LLMSelect, { type LLMOption } from '../ai-assistant/llm-select';
|
|
92
|
+
import { AiAssistantConversation } from '../ai-assistant/message';
|
|
93
|
+
import NewSession from '../ai-assistant/new-session';
|
|
94
|
+
import AiAssistantSkillMenu from '../ai-assistant/skill-menu';
|
|
95
|
+
|
|
96
|
+
import { Submodes } from '../submode-switcher';
|
|
97
|
+
|
|
98
|
+
import RoomMessage from './room-message';
|
|
99
|
+
|
|
100
|
+
import type RoomData from '../../lib/matrix-classes/room';
|
|
101
|
+
import type { RoomSkill } from '../../resources/room';
|
|
102
|
+
import type { MatrixEvent } from 'matrix-js-sdk';
|
|
103
|
+
|
|
104
|
+
const LOCAL_SOURCE_URL_PREFIX = 'boxel-local://';
|
|
105
|
+
|
|
106
|
+
interface Signature {
|
|
107
|
+
Element: HTMLElement;
|
|
108
|
+
Args: {
|
|
109
|
+
roomId: string;
|
|
110
|
+
roomResource: RoomResource;
|
|
111
|
+
monacoSDK: MonacoSDK;
|
|
112
|
+
selectedCardRef?: ResolvedCodeRef;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface RoomScrollState {
|
|
117
|
+
messageElements: Map<HTMLElement, number>;
|
|
118
|
+
messageScrollers: Map<number, Element['scrollIntoView']>;
|
|
119
|
+
messageVisibilityObserver: IntersectionObserver;
|
|
120
|
+
isScrolledToBottom: boolean;
|
|
121
|
+
userHasScrolled: boolean;
|
|
122
|
+
isConversationScrollable: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default class Room extends Component<Signature> {
|
|
126
|
+
<template>
|
|
127
|
+
{{#if (not this.doMatrixEventFlush.isRunning)}}
|
|
128
|
+
<section
|
|
129
|
+
class='room'
|
|
130
|
+
data-room-settled={{and
|
|
131
|
+
this.doWhenRoomChanges.isIdle
|
|
132
|
+
(not this.matrixService.isLoadingTimeline)
|
|
133
|
+
}}
|
|
134
|
+
data-test-room-settled={{and
|
|
135
|
+
this.doWhenRoomChanges.isIdle
|
|
136
|
+
(not this.matrixService.isLoadingTimeline)
|
|
137
|
+
}}
|
|
138
|
+
data-test-room-name={{@roomResource.name}}
|
|
139
|
+
data-test-room={{@roomId}}
|
|
140
|
+
data-room-id={{@roomId}}
|
|
141
|
+
...attributes
|
|
142
|
+
>
|
|
143
|
+
<AiAssistantConversation
|
|
144
|
+
@registerConversationScroller={{this.registerConversationScroller}}
|
|
145
|
+
@setScrollPosition={{this.setScrollPosition}}
|
|
146
|
+
>
|
|
147
|
+
{{#if this.matrixService.isLoadingTimeline}}
|
|
148
|
+
<div class='session-preparation-container'>
|
|
149
|
+
<LoadingIndicator
|
|
150
|
+
@color='var(--boxel-light)'
|
|
151
|
+
class='loading-indicator'
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
{{else if this.aiAssistantPanelService.isPreparingSession}}
|
|
155
|
+
<div
|
|
156
|
+
class='session-preparation-container'
|
|
157
|
+
data-test-session-preparation
|
|
158
|
+
>
|
|
159
|
+
<LoadingIndicator
|
|
160
|
+
@color='var(--boxel-light)'
|
|
161
|
+
class='loading-indicator'
|
|
162
|
+
/>
|
|
163
|
+
<span class='session-preparation-message'>
|
|
164
|
+
{{#if
|
|
165
|
+
(and
|
|
166
|
+
this.aiAssistantPanelService.isSummarizingSession
|
|
167
|
+
this.aiAssistantPanelService.isCopyingFileHistory
|
|
168
|
+
)
|
|
169
|
+
}}
|
|
170
|
+
Summarizing session and copying files
|
|
171
|
+
{{else if this.aiAssistantPanelService.isSummarizingSession}}
|
|
172
|
+
Summarizing previous session
|
|
173
|
+
{{else if this.aiAssistantPanelService.isCopyingFileHistory}}
|
|
174
|
+
Copying file history from previous session
|
|
175
|
+
{{else}}
|
|
176
|
+
Preparing session context
|
|
177
|
+
{{/if}}
|
|
178
|
+
</span>
|
|
179
|
+
<span class='session-preparation-message'>
|
|
180
|
+
Please keep Assistant open
|
|
181
|
+
</span>
|
|
182
|
+
<span class='session-preparation-small-message'>
|
|
183
|
+
Takes 10-20 seconds
|
|
184
|
+
</span>
|
|
185
|
+
<button
|
|
186
|
+
type='button'
|
|
187
|
+
class='session-preparation-skip-button'
|
|
188
|
+
{{on 'click' this.skipSessionPreparation}}
|
|
189
|
+
data-test-session-preparation-skip-button
|
|
190
|
+
>
|
|
191
|
+
Skip
|
|
192
|
+
</button>
|
|
193
|
+
</div>
|
|
194
|
+
{{else}}
|
|
195
|
+
{{#each this.messages key='eventId' as |message i|}}
|
|
196
|
+
<RoomMessage
|
|
197
|
+
@roomId={{@roomId}}
|
|
198
|
+
@roomResource={{@roomResource}}
|
|
199
|
+
@index={{i}}
|
|
200
|
+
@isMostRecentMessage={{this.isLastMessage i}}
|
|
201
|
+
@registerScroller={{this.registerMessageScroller}}
|
|
202
|
+
@unregisterScroller={{this.unregisterMessageScroller}}
|
|
203
|
+
@isPending={{this.isPendingMessage message}}
|
|
204
|
+
@monacoSDK={{@monacoSDK}}
|
|
205
|
+
@isStreaming={{this.isMessageStreaming message}}
|
|
206
|
+
@retryAction={{this.maybeRetryAction i message}}
|
|
207
|
+
data-test-message-idx={{i}}
|
|
208
|
+
/>
|
|
209
|
+
{{else}}
|
|
210
|
+
<NewSession @sendPrompt={{this.sendMessage}} />
|
|
211
|
+
{{/each}}
|
|
212
|
+
|
|
213
|
+
{{#if this.shouldShowUnknownMessageSendError}}
|
|
214
|
+
<Alert @type='error' as |Alert|>
|
|
215
|
+
<Alert.Messages
|
|
216
|
+
@messages={{array this.unknownMessageSendError}}
|
|
217
|
+
/>
|
|
218
|
+
</Alert>
|
|
219
|
+
{{/if}}
|
|
220
|
+
{{/if}}
|
|
221
|
+
</AiAssistantConversation>
|
|
222
|
+
|
|
223
|
+
<footer class='room-actions'>
|
|
224
|
+
<AiAssistantAttachmentPicker
|
|
225
|
+
@autoAttachedCardIds={{this.autoAttachedCardIds}}
|
|
226
|
+
@cardIdsToAttach={{this.cardIdsToAttach}}
|
|
227
|
+
@chooseCard={{this.chooseCard}}
|
|
228
|
+
@removeCard={{this.removeCard}}
|
|
229
|
+
@chooseFile={{perform this.chooseFileTask}}
|
|
230
|
+
@chooseLocalFile={{perform this.chooseLocalFileTask}}
|
|
231
|
+
@removeFile={{this.removeFile}}
|
|
232
|
+
@autoAttachedFiles={{this.autoAttachedFiles}}
|
|
233
|
+
@filesToAttach={{this.filesToAttach}}
|
|
234
|
+
@fileUploadStates={{this.fileUploadStates}}
|
|
235
|
+
@retryFileUpload={{this.retryFileUpload}}
|
|
236
|
+
@inputModalities={{@roomResource.activeInputModalities}}
|
|
237
|
+
@autoAttachedCardTooltipMessage={{if
|
|
238
|
+
(eq this.operatorModeStateService.state.submode Submodes.Code)
|
|
239
|
+
'Current card is shared automatically'
|
|
240
|
+
'Topmost card is shared automatically'
|
|
241
|
+
}}
|
|
242
|
+
as |AttachedItems AttachButton|
|
|
243
|
+
>
|
|
244
|
+
{{#if this.displayActionBar}}
|
|
245
|
+
<AiAssistantActionBar
|
|
246
|
+
@acceptAll={{perform this.executeAllReadyActionsTask}}
|
|
247
|
+
@cancel={{this.cancelActionBar}}
|
|
248
|
+
@acceptingAll={{this.isAcceptingAll}}
|
|
249
|
+
@acceptingAllLabel={{this.acceptingAllLabel}}
|
|
250
|
+
@generatingResults={{this.generatingResults}}
|
|
251
|
+
@stop={{perform this.stopGeneratingTask}}
|
|
252
|
+
@stopping={{this.stopGeneratingTask.isRunning}}
|
|
253
|
+
@showUnreadIndicator={{this.showUnreadIndicator}}
|
|
254
|
+
@unreadMessageText={{this.unreadMessageText}}
|
|
255
|
+
@scrollToFirstUnread={{this.scrollToFirstUnread}}
|
|
256
|
+
/>
|
|
257
|
+
{{/if}}
|
|
258
|
+
<div
|
|
259
|
+
class='chat-input-area'
|
|
260
|
+
data-test-chat-input-area
|
|
261
|
+
data-drop-zone-active={{this.isDropZoneActive}}
|
|
262
|
+
{{on 'dragover' this.handleChatInputDragOver}}
|
|
263
|
+
{{on 'dragenter' this.handleChatInputDragEnter}}
|
|
264
|
+
{{on 'dragleave' this.handleChatInputDragLeave}}
|
|
265
|
+
{{on 'drop' this.handleChatInputDrop}}
|
|
266
|
+
>
|
|
267
|
+
{{#if this.isDropZoneActive}}
|
|
268
|
+
<div
|
|
269
|
+
class='chat-input-drop-hint'
|
|
270
|
+
data-test-chat-input-drop-hint
|
|
271
|
+
>
|
|
272
|
+
Drop file to attach
|
|
273
|
+
</div>
|
|
274
|
+
{{/if}}
|
|
275
|
+
<AiAssistantChatInput
|
|
276
|
+
@attachButton={{AttachButton}}
|
|
277
|
+
@value={{this.messageToSend}}
|
|
278
|
+
@onInput={{this.setMessage}}
|
|
279
|
+
@onSend={{this.sendMessage}}
|
|
280
|
+
@onPaste={{this.handleChatInputPaste}}
|
|
281
|
+
@canSend={{this.canSend}}
|
|
282
|
+
data-test-message-field={{@roomId}}
|
|
283
|
+
/>
|
|
284
|
+
{{#if this.aiAssistantPanelService.isFocusPillVisible}}
|
|
285
|
+
<FocusPill
|
|
286
|
+
@label={{this.aiAssistantPanelService.focusPillLabel}}
|
|
287
|
+
@metaPills={{this.aiAssistantPanelService.focusPillMetaPills}}
|
|
288
|
+
class='pill-row'
|
|
289
|
+
/>
|
|
290
|
+
{{/if}}
|
|
291
|
+
{{#if this.displayAttachedItems}}
|
|
292
|
+
<AttachedItems class='pill-row' />
|
|
293
|
+
{{/if}}
|
|
294
|
+
|
|
295
|
+
<div class='chat-input-area__bottom-actions'>
|
|
296
|
+
{{#if this.displaySkillMenu}}
|
|
297
|
+
<AiAssistantSkillMenu
|
|
298
|
+
class='skill-menu'
|
|
299
|
+
@skills={{this.sortedSkills}}
|
|
300
|
+
@onChooseCard={{perform this.attachSkillTask}}
|
|
301
|
+
@onUpdateSkillIsActive={{perform
|
|
302
|
+
this.updateSkillIsActiveTask
|
|
303
|
+
}}
|
|
304
|
+
@onExpand={{fn this.setSelectedBottomAction 'skill-menu'}}
|
|
305
|
+
@onCollapse={{fn this.setSelectedBottomAction undefined}}
|
|
306
|
+
data-test-skill-menu
|
|
307
|
+
/>
|
|
308
|
+
{{/if}}
|
|
309
|
+
{{#if this.displayLLMSelect}}
|
|
310
|
+
<LLMSelect
|
|
311
|
+
class='llm-select'
|
|
312
|
+
@selected={{@roomResource.activeLLM}}
|
|
313
|
+
@onChange={{perform @roomResource.activateLLMTask}}
|
|
314
|
+
@options={{this.llmsForSelectMenu}}
|
|
315
|
+
@disabled={{@roomResource.isActivatingLLM}}
|
|
316
|
+
@onExpand={{fn this.setSelectedBottomAction 'llm-select'}}
|
|
317
|
+
@onCollapse={{fn this.setSelectedBottomAction undefined}}
|
|
318
|
+
>
|
|
319
|
+
<:footer>
|
|
320
|
+
<li class='llm-select-footer'>
|
|
321
|
+
{{#if this.systemCardId}}
|
|
322
|
+
<BoxelButton
|
|
323
|
+
@kind='text-only'
|
|
324
|
+
@size='extra-small'
|
|
325
|
+
class='llm-select-footer-action'
|
|
326
|
+
{{on 'click' this.goToSystemCard}}
|
|
327
|
+
data-test-go-to-system-card
|
|
328
|
+
>
|
|
329
|
+
Go to current system card
|
|
330
|
+
</BoxelButton>
|
|
331
|
+
{{/if}}
|
|
332
|
+
{{#unless this.isDefaultSystemCard}}
|
|
333
|
+
<BoxelButton
|
|
334
|
+
@kind='text-only'
|
|
335
|
+
@size='extra-small'
|
|
336
|
+
class='llm-select-footer-action'
|
|
337
|
+
{{on
|
|
338
|
+
'click'
|
|
339
|
+
(perform this.restoreDefaultSystemCardTask)
|
|
340
|
+
}}
|
|
341
|
+
data-test-restore-default-system-card
|
|
342
|
+
>
|
|
343
|
+
Restore default system card
|
|
344
|
+
</BoxelButton>
|
|
345
|
+
{{/unless}}
|
|
346
|
+
</li>
|
|
347
|
+
</:footer>
|
|
348
|
+
</LLMSelect>
|
|
349
|
+
{{/if}}
|
|
350
|
+
{{#if this.displayLLMModeSelect}}
|
|
351
|
+
<LLMModeToggle
|
|
352
|
+
class='llm-mode-toggle'
|
|
353
|
+
@selected={{@roomResource.activeLLMMode}}
|
|
354
|
+
@onChange={{perform @roomResource.activateLLMModeTask}}
|
|
355
|
+
@disabled={{@roomResource.isActivatingLLMMode}}
|
|
356
|
+
/>
|
|
357
|
+
{{/if}}
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
</AiAssistantAttachmentPicker>
|
|
361
|
+
</footer>
|
|
362
|
+
</section>
|
|
363
|
+
{{/if}}
|
|
364
|
+
|
|
365
|
+
<style scoped>
|
|
366
|
+
.room {
|
|
367
|
+
display: grid;
|
|
368
|
+
grid-template-rows: 1fr auto;
|
|
369
|
+
height: 100%;
|
|
370
|
+
overflow: hidden;
|
|
371
|
+
position: relative;
|
|
372
|
+
|
|
373
|
+
--chat-input-area-border-radius: var(--boxel-border-radius-xxl);
|
|
374
|
+
}
|
|
375
|
+
.room-actions {
|
|
376
|
+
position: relative;
|
|
377
|
+
padding: 0 var(--ai-assistant-panel-padding)
|
|
378
|
+
var(--ai-assistant-panel-padding);
|
|
379
|
+
box-shadow: var(--boxel-box-shadow);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.room-actions::before {
|
|
383
|
+
content: '';
|
|
384
|
+
position: absolute;
|
|
385
|
+
|
|
386
|
+
width: 100%;
|
|
387
|
+
height: calc(
|
|
388
|
+
var(--ai-assistant-panel-bottom-gradient-height) +
|
|
389
|
+
var(--chat-input-area-border-radius)
|
|
390
|
+
);
|
|
391
|
+
left: 0;
|
|
392
|
+
bottom: calc(100% - var(--chat-input-area-border-radius));
|
|
393
|
+
|
|
394
|
+
background: linear-gradient(
|
|
395
|
+
to top,
|
|
396
|
+
var(--boxel-ai-purple),
|
|
397
|
+
var(--boxel-ai-purple) 20%,
|
|
398
|
+
transparent 100%
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
z-index: 0;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.chat-input-area {
|
|
405
|
+
--boxel-pill-menu-header-padding: 0;
|
|
406
|
+
--boxel-pill-menu-content-padding: var(--boxel-sp) 0;
|
|
407
|
+
--boxel-pill-menu-footer-padding: 0;
|
|
408
|
+
--boxel-pill-menu-button-padding: 2px 6px;
|
|
409
|
+
|
|
410
|
+
--chat-input-area-bottom-padding: var(--boxel-sp-sm);
|
|
411
|
+
|
|
412
|
+
background-color: var(--boxel-light);
|
|
413
|
+
color: var(--boxel-dark);
|
|
414
|
+
border-radius: var(--chat-input-area-border-radius);
|
|
415
|
+
|
|
416
|
+
position: relative;
|
|
417
|
+
z-index: 2;
|
|
418
|
+
|
|
419
|
+
timeline-scope: --chat-input-scroll-timeline;
|
|
420
|
+
}
|
|
421
|
+
.chat-input-area[data-drop-zone-active='true'] {
|
|
422
|
+
box-shadow: inset 0 0 0 2px var(--boxel-dark);
|
|
423
|
+
background-color: #e8f0ff;
|
|
424
|
+
}
|
|
425
|
+
.chat-input-drop-hint {
|
|
426
|
+
position: absolute;
|
|
427
|
+
top: var(--boxel-sp-xs);
|
|
428
|
+
right: var(--boxel-sp-xs);
|
|
429
|
+
bottom: var(--boxel-sp-xs);
|
|
430
|
+
left: var(--boxel-sp-xs);
|
|
431
|
+
z-index: 3;
|
|
432
|
+
pointer-events: none;
|
|
433
|
+
color: var(--boxel-light-100);
|
|
434
|
+
font: 500 var(--boxel-font);
|
|
435
|
+
background-color: var(--boxel-darker-hover);
|
|
436
|
+
border-radius: var(--boxel-border-radius-lg);
|
|
437
|
+
display: flex;
|
|
438
|
+
justify-content: center;
|
|
439
|
+
align-items: center;
|
|
440
|
+
}
|
|
441
|
+
.chat-input-area__bottom-actions {
|
|
442
|
+
display: flex;
|
|
443
|
+
align-items: center;
|
|
444
|
+
padding: var(--chat-input-area-bottom-padding);
|
|
445
|
+
gap: var(--boxel-sp-sm);
|
|
446
|
+
background-color: var(--boxel-light-100);
|
|
447
|
+
border-bottom-left-radius: var(--chat-input-area-border-radius);
|
|
448
|
+
border-bottom-right-radius: var(--chat-input-area-border-radius);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.chat-input-area__bottom-actions:not(:has(.menu-content)) {
|
|
452
|
+
height: 40px;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.chat-input-area__bottom-actions:has(.menu-content) {
|
|
456
|
+
padding: 0;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.pill-row {
|
|
460
|
+
margin: var(--boxel-sp-xxxs);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.pill-row + .pill-row {
|
|
464
|
+
margin-top: 0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.llm-mode-toggle {
|
|
468
|
+
margin-left: auto;
|
|
469
|
+
flex-shrink: 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
:deep(.ai-assistant-conversation > *:first-child) {
|
|
473
|
+
margin-top: auto;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.session-preparation-container {
|
|
477
|
+
display: flex;
|
|
478
|
+
flex-direction: column;
|
|
479
|
+
justify-content: center;
|
|
480
|
+
align-items: center;
|
|
481
|
+
height: 100%;
|
|
482
|
+
gap: 4px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.loading-indicator {
|
|
486
|
+
margin-bottom: var(--boxel-sp-xxs);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.session-preparation-message {
|
|
490
|
+
text-align: center;
|
|
491
|
+
color: var(--boxel-light);
|
|
492
|
+
font: 500 var(--boxel-font-sm);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.session-preparation-small-message {
|
|
496
|
+
color: var(--boxel-400);
|
|
497
|
+
font: 500 var(--boxel-font-xs);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.session-preparation-skip-button {
|
|
501
|
+
background: none;
|
|
502
|
+
border: 1px solid var(--boxel-400);
|
|
503
|
+
border-radius: var(--boxel-border-radius-lg);
|
|
504
|
+
color: var(--boxel-light);
|
|
505
|
+
font: 500 var(--boxel-font-xs);
|
|
506
|
+
padding: 4px 12px;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
transition: all 0.2s ease;
|
|
509
|
+
margin-top: var(--boxel-sp-sm);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.session-preparation-skip-button:hover {
|
|
513
|
+
background: var(--boxel-400);
|
|
514
|
+
color: var(--boxel-light);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.chat-input-area :deep(.pill-menu-button) {
|
|
518
|
+
height: 22px;
|
|
519
|
+
gap: var(--boxel-sp-xxxs);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.chat-input-area :deep(.pill-menu-button:hover) {
|
|
523
|
+
border-color: var(--boxel-dark);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.llm-select :deep(.menu-content) {
|
|
527
|
+
margin-right: calc(-2 * var(--boxel-sp-sm));
|
|
528
|
+
width: 100%;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.llm-select-footer {
|
|
532
|
+
display: flex;
|
|
533
|
+
flex-direction: column;
|
|
534
|
+
gap: var(--boxel-sp-xxxs);
|
|
535
|
+
border-top: 1px solid var(--boxel-200);
|
|
536
|
+
padding-top: var(--boxel-sp-xxxs);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.llm-select-footer-action {
|
|
540
|
+
--boxel-button-padding: var(--boxel-sp-xxxs) var(--boxel-sp-sm);
|
|
541
|
+
--boxel-button-min-height: unset;
|
|
542
|
+
justify-content: flex-start;
|
|
543
|
+
font: 500 var(--boxel-font-xs);
|
|
544
|
+
color: var(--boxel-500);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.llm-select-footer-action:hover {
|
|
548
|
+
color: var(--boxel-dark);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.chat-input-area :deep(.minimized-arrow) {
|
|
552
|
+
margin-left: 0;
|
|
553
|
+
}
|
|
554
|
+
</style>
|
|
555
|
+
</template>
|
|
556
|
+
|
|
557
|
+
@consume(GetCardContextName) declare private getCard: getCard;
|
|
558
|
+
@tracked private selectedBottomAction:
|
|
559
|
+
| 'skill-menu'
|
|
560
|
+
| 'llm-select'
|
|
561
|
+
| undefined;
|
|
562
|
+
@tracked lastCanceledActionMessageId: string | undefined;
|
|
563
|
+
@tracked acceptingAllLabel: string | undefined;
|
|
564
|
+
@tracked private isDropZoneActive = false;
|
|
565
|
+
private dropZoneDragDepth = 0;
|
|
566
|
+
|
|
567
|
+
@service declare private store: StoreService;
|
|
568
|
+
@service declare private cardService: CardService;
|
|
569
|
+
@service declare private commandService: CommandService;
|
|
570
|
+
@service('file-upload') declare private fileUpload: FileUploadService;
|
|
571
|
+
@service('loader-service') declare private loaderService: LoaderService;
|
|
572
|
+
@service declare private matrixService: MatrixService;
|
|
573
|
+
@service declare private network: NetworkService;
|
|
574
|
+
@service declare private operatorModeStateService: OperatorModeStateService;
|
|
575
|
+
@service declare private playgroundPanelService: PlaygroundPanelService;
|
|
576
|
+
@service declare private specPanelService: SpecPanelService;
|
|
577
|
+
@service declare private aiAssistantPanelService: AiAssistantPanelService;
|
|
578
|
+
|
|
579
|
+
private autoAttachmentResource = getAutoAttachment(this, {
|
|
580
|
+
submode: () => this.operatorModeStateService.state.submode,
|
|
581
|
+
moduleInspectorPanel: () =>
|
|
582
|
+
this.operatorModeStateService.moduleInspectorPanel,
|
|
583
|
+
autoAttachedFileUrls: () => this.autoAttachedFileUrls,
|
|
584
|
+
playgroundPanelCardId: () => this.playgroundPanelCardId,
|
|
585
|
+
activeSpecId: () => this.specPanelService.specSelection,
|
|
586
|
+
topMostStackItems: () => this.topMostStackItems,
|
|
587
|
+
attachedCardIds: () => this.cardIdsToAttach,
|
|
588
|
+
removedCardIds: () => this.removedAttachedCardIds,
|
|
589
|
+
});
|
|
590
|
+
private removedAttachedCardIds = new TrackedSet<string>();
|
|
591
|
+
private removedAttachedFileUrls: string[] = [];
|
|
592
|
+
private lastAutoAttachedFileUrlsKey: string | undefined;
|
|
593
|
+
private lastKnownRoom: RoomData | undefined;
|
|
594
|
+
private getConversationScrollability: (() => boolean) | undefined;
|
|
595
|
+
private scrollConversationToBottom: (() => void) | undefined;
|
|
596
|
+
private roomScrollState: WeakMap<RoomData, RoomScrollState> = new WeakMap();
|
|
597
|
+
|
|
598
|
+
@tracked private unknownMessageSendError: string | undefined = undefined;
|
|
599
|
+
private _fileUploadStates = new TrackedMap<string, FileUploadState>();
|
|
600
|
+
|
|
601
|
+
get fileUploadStates(): ReadonlyMap<string, FileUploadState> {
|
|
602
|
+
return this._fileUploadStates;
|
|
603
|
+
}
|
|
604
|
+
private get shouldShowUnknownMessageSendError() {
|
|
605
|
+
// Since unknownMessageSendError error is coming from the catch-all block in doSendMessage,
|
|
606
|
+
// we need to check if there already exists an error message in the last message, which is
|
|
607
|
+
// more specific and would take precedence (we don't want to show the generic unknown error
|
|
608
|
+
// message if there is a more specific error message in the last message)
|
|
609
|
+
if (!this.unknownMessageSendError) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
613
|
+
return lastMessage?.errorMessage === undefined;
|
|
614
|
+
}
|
|
615
|
+
constructor(owner: Owner, args: Signature['Args']) {
|
|
616
|
+
super(owner, args);
|
|
617
|
+
this.doMatrixEventFlush.perform();
|
|
618
|
+
registerDestructor(this, () => {
|
|
619
|
+
this.cleanupScrollState();
|
|
620
|
+
this.getConversationScrollability = undefined;
|
|
621
|
+
this.scrollConversationToBottom = undefined;
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
private get existingScrollState() {
|
|
626
|
+
let room = this.roomForCleanup;
|
|
627
|
+
return room ? this.roomScrollState.get(room) : undefined;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
private ensureScrollState() {
|
|
631
|
+
let room = this.room;
|
|
632
|
+
if (!room) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (this.lastKnownRoom && this.lastKnownRoom !== room) {
|
|
636
|
+
this.cleanupScrollState(this.lastKnownRoom);
|
|
637
|
+
}
|
|
638
|
+
this.lastKnownRoom = room;
|
|
639
|
+
let state = this.roomScrollState.get(room);
|
|
640
|
+
if (!state) {
|
|
641
|
+
let nextState!: RoomScrollState;
|
|
642
|
+
nextState = new TrackedObject({
|
|
643
|
+
isScrolledToBottom: false,
|
|
644
|
+
userHasScrolled: false,
|
|
645
|
+
isConversationScrollable: false,
|
|
646
|
+
messageElements: new Map(),
|
|
647
|
+
messageScrollers: new Map(),
|
|
648
|
+
messageVisibilityObserver: new IntersectionObserver((entries) => {
|
|
649
|
+
entries.forEach((entry) => {
|
|
650
|
+
let index = nextState.messageElements.get(
|
|
651
|
+
entry.target as HTMLElement,
|
|
652
|
+
);
|
|
653
|
+
if (index != null) {
|
|
654
|
+
if (
|
|
655
|
+
(!nextState.isConversationScrollable || entry.isIntersecting) &&
|
|
656
|
+
index > this.lastReadMessageIndex
|
|
657
|
+
) {
|
|
658
|
+
this.sendReadReceipt(this.messages[index]);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}),
|
|
663
|
+
});
|
|
664
|
+
state = nextState;
|
|
665
|
+
this.roomScrollState.set(room, state);
|
|
666
|
+
}
|
|
667
|
+
return state;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
private cleanupScrollState(room = this.roomForCleanup) {
|
|
671
|
+
if (!room) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
let scrollState = this.roomScrollState.get(room);
|
|
675
|
+
if (!scrollState) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
for (let element of scrollState.messageElements.keys()) {
|
|
679
|
+
scrollState.messageVisibilityObserver.unobserve(element);
|
|
680
|
+
}
|
|
681
|
+
scrollState.messageVisibilityObserver.disconnect();
|
|
682
|
+
scrollState.messageElements.clear();
|
|
683
|
+
scrollState.messageScrollers.clear();
|
|
684
|
+
scrollState.isScrolledToBottom = false;
|
|
685
|
+
scrollState.userHasScrolled = false;
|
|
686
|
+
scrollState.isConversationScrollable = false;
|
|
687
|
+
this.roomScrollState.delete(room);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// Using a resource for automatically attached files,
|
|
691
|
+
// so the file can be reattached after being removed
|
|
692
|
+
// when the user opens a different file and then returns to this one.
|
|
693
|
+
@use private autoAttachedFileResource = resource(() => {
|
|
694
|
+
let state = new TrackedObject<{
|
|
695
|
+
value: FileDef[];
|
|
696
|
+
remove: (sourceUrl?: string) => void;
|
|
697
|
+
}>({
|
|
698
|
+
value: [],
|
|
699
|
+
remove: (sourceUrl?: string) => {
|
|
700
|
+
if (!sourceUrl) {
|
|
701
|
+
state.value = [];
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
state.value = state.value.filter(
|
|
705
|
+
(file) => file.sourceUrl !== sourceUrl,
|
|
706
|
+
);
|
|
707
|
+
},
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
let autoAttachedFileUrls = this.autoAttachedFileUrls;
|
|
711
|
+
let manuallyAttachedFiles = this.filesToAttach;
|
|
712
|
+
let autoAttachedFileUrlsKey = autoAttachedFileUrls.join('\n');
|
|
713
|
+
|
|
714
|
+
let removedFileUrls: string[];
|
|
715
|
+
if (autoAttachedFileUrlsKey !== this.lastAutoAttachedFileUrlsKey) {
|
|
716
|
+
this.removedAttachedFileUrls.splice(0);
|
|
717
|
+
removedFileUrls = this.removedAttachedFileUrls;
|
|
718
|
+
this.lastAutoAttachedFileUrlsKey = autoAttachedFileUrlsKey;
|
|
719
|
+
} else {
|
|
720
|
+
removedFileUrls = this.removedAttachedFileUrls;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
let candidateUrls = autoAttachedFileUrls.filter((url) => {
|
|
724
|
+
if (!url) {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
let isManuallyAttached = manuallyAttachedFiles.some(
|
|
728
|
+
(file) => file.sourceUrl === url,
|
|
729
|
+
);
|
|
730
|
+
let isRemoved = removedFileUrls.includes(url);
|
|
731
|
+
return !isManuallyAttached && !isRemoved;
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
state.value = candidateUrls.map((url) => {
|
|
735
|
+
let name = url.split('/').pop();
|
|
736
|
+
return this.matrixService.fileAPI.createFileDef({
|
|
737
|
+
sourceUrl: url,
|
|
738
|
+
name,
|
|
739
|
+
contentType: url.endsWith('.json')
|
|
740
|
+
? SupportedMimeType.CardJson
|
|
741
|
+
: name
|
|
742
|
+
? inferContentType(name)
|
|
743
|
+
: undefined,
|
|
744
|
+
});
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
return state;
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
private get autoAttachedFileUrls() {
|
|
751
|
+
let codePathUrl = this.operatorModeStateService.state.codePath?.href;
|
|
752
|
+
if (!codePathUrl) {
|
|
753
|
+
return [];
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
let urls = [codePathUrl];
|
|
757
|
+
|
|
758
|
+
if (codePathUrl.endsWith('.json')) {
|
|
759
|
+
let openFile = this.operatorModeStateService.openFile?.current;
|
|
760
|
+
if (openFile && isReady(openFile)) {
|
|
761
|
+
try {
|
|
762
|
+
let fileContent = JSON.parse(openFile.content);
|
|
763
|
+
let adoptsFrom = fileContent?.data?.meta?.adoptsFrom;
|
|
764
|
+
if (adoptsFrom?.module) {
|
|
765
|
+
let moduleURLWithExtension = new URL(
|
|
766
|
+
adoptsFrom.module.endsWith('.gts')
|
|
767
|
+
? adoptsFrom.module
|
|
768
|
+
: `${adoptsFrom.module}.gts`,
|
|
769
|
+
openFile.url,
|
|
770
|
+
);
|
|
771
|
+
if (!urls.includes(moduleURLWithExtension.href)) {
|
|
772
|
+
urls.push(moduleURLWithExtension.href);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
} catch (_error) {
|
|
776
|
+
// If JSON parse fails, fall back to just the current file URL.
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
return urls;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
private get autoAttachedFiles() {
|
|
785
|
+
return this.operatorModeStateService.state.submode === Submodes.Code
|
|
786
|
+
? this.autoAttachedFileResource.value
|
|
787
|
+
: [];
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
private get removeAutoAttachedFile() {
|
|
791
|
+
return (sourceUrl?: string) => {
|
|
792
|
+
this.autoAttachedFileResource.remove(sourceUrl);
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
private markAttachedFileRemoved(sourceUrl?: string | null) {
|
|
797
|
+
if (!sourceUrl) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (!this.removedAttachedFileUrls.includes(sourceUrl)) {
|
|
801
|
+
this.removedAttachedFileUrls.push(sourceUrl);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
private get filesToAttach() {
|
|
806
|
+
return this.matrixService.getFilesToSend(this.args.roomId) ?? [];
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
@use private playgroundPanelCardIdResource = resource(() => {
|
|
810
|
+
let state = new TrackedObject<{
|
|
811
|
+
value: string | undefined;
|
|
812
|
+
remove: () => void;
|
|
813
|
+
}>({
|
|
814
|
+
value: undefined,
|
|
815
|
+
remove: () => {
|
|
816
|
+
state.value = undefined;
|
|
817
|
+
},
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
(async () => {
|
|
821
|
+
if (!this.args.selectedCardRef) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
let moduleId = internalKeyFor(this.args.selectedCardRef, undefined);
|
|
825
|
+
state.value = this.playgroundPanelService.getSelection(moduleId)?.cardId;
|
|
826
|
+
})();
|
|
827
|
+
|
|
828
|
+
return state;
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
private get playgroundPanelCardId() {
|
|
832
|
+
return this.playgroundPanelCardIdResource.value;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
private get removePlaygroundPanelCard() {
|
|
836
|
+
return this.playgroundPanelCardIdResource.remove;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
private get isScrolledToBottom() {
|
|
840
|
+
return this.existingScrollState?.isScrolledToBottom ?? false;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
private get userHasScrolled() {
|
|
844
|
+
return this.existingScrollState?.userHasScrolled ?? false;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
private get isConversationScrollable() {
|
|
848
|
+
return this.existingScrollState?.isConversationScrollable ?? false;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
private registerMessageScroller = ({
|
|
852
|
+
index,
|
|
853
|
+
element,
|
|
854
|
+
scrollTo,
|
|
855
|
+
}: {
|
|
856
|
+
index: number;
|
|
857
|
+
element: HTMLElement;
|
|
858
|
+
scrollTo: (arg?: any) => void;
|
|
859
|
+
}) => {
|
|
860
|
+
let scrollState = this.ensureScrollState();
|
|
861
|
+
if (!scrollState) {
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
for (let [
|
|
865
|
+
registeredElement,
|
|
866
|
+
registeredIndex,
|
|
867
|
+
] of scrollState.messageElements) {
|
|
868
|
+
if (registeredIndex === index && registeredElement !== element) {
|
|
869
|
+
scrollState.messageElements.delete(registeredElement);
|
|
870
|
+
scrollState.messageVisibilityObserver.unobserve(registeredElement);
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
scrollState.messageElements.set(element, index);
|
|
875
|
+
scrollState.messageScrollers.set(index, scrollTo);
|
|
876
|
+
scrollState.messageVisibilityObserver.observe(element);
|
|
877
|
+
scrollState.isConversationScrollable = Boolean(
|
|
878
|
+
this.getConversationScrollability?.(),
|
|
879
|
+
);
|
|
880
|
+
if (!this.isConversationScrollable || !this.isAllowedToAutoScroll) {
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// TODO udpate this so that we preserve the scroll position as the user
|
|
885
|
+
// changes rooms and we restore the scroll position when a user enters a room
|
|
886
|
+
if (
|
|
887
|
+
// If we are permitted to auto-scroll and if there are no unread messages in the
|
|
888
|
+
// room, then scroll to the last message in the room.
|
|
889
|
+
!this.hasUnreadMessages &&
|
|
890
|
+
index === this.messages.length - 1 &&
|
|
891
|
+
!this.isScrolledToBottom
|
|
892
|
+
) {
|
|
893
|
+
scrollTo();
|
|
894
|
+
} else if (
|
|
895
|
+
// otherwise if we are permitted to auto-scroll and if there are unread
|
|
896
|
+
// messages in the room, then scroll to the first unread message in the room.
|
|
897
|
+
this.hasUnreadMessages &&
|
|
898
|
+
index === this.lastReadMessageIndex + 1
|
|
899
|
+
) {
|
|
900
|
+
scrollTo();
|
|
901
|
+
} else if (this.isScrolledToBottom) {
|
|
902
|
+
this.scrollConversationToBottom?.();
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
private unregisterMessageScroller = ({
|
|
907
|
+
index,
|
|
908
|
+
element,
|
|
909
|
+
}: {
|
|
910
|
+
index: number;
|
|
911
|
+
element: HTMLElement;
|
|
912
|
+
}) => {
|
|
913
|
+
let scrollState = this.existingScrollState;
|
|
914
|
+
if (!scrollState) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
let elementOwnsIndex = scrollState.messageElements.get(element) === index;
|
|
918
|
+
scrollState.messageElements.delete(element);
|
|
919
|
+
if (elementOwnsIndex) {
|
|
920
|
+
scrollState.messageScrollers.delete(index);
|
|
921
|
+
}
|
|
922
|
+
scrollState.messageVisibilityObserver.unobserve(element);
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
private registerConversationScroller = (
|
|
926
|
+
isConversationScrollable: () => boolean,
|
|
927
|
+
scrollToBottom: () => void,
|
|
928
|
+
) => {
|
|
929
|
+
this.getConversationScrollability = isConversationScrollable;
|
|
930
|
+
this.scrollConversationToBottom = scrollToBottom;
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
private setScrollPosition = ({ isBottom }: { isBottom: boolean }) => {
|
|
934
|
+
let scrollState = this.ensureScrollState();
|
|
935
|
+
if (!scrollState) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
scrollState.isScrolledToBottom = isBottom;
|
|
939
|
+
if (!isBottom) {
|
|
940
|
+
scrollState.userHasScrolled = true;
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
private scrollToFirstUnread = () => {
|
|
945
|
+
if (!this.hasUnreadMessages) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
let firstUnreadIndex = this.lastReadMessageIndex + 1;
|
|
950
|
+
let scrollTo =
|
|
951
|
+
this.existingScrollState?.messageScrollers.get(firstUnreadIndex);
|
|
952
|
+
if (!scrollTo) {
|
|
953
|
+
console.warn(`No scroller for message index ${firstUnreadIndex}`);
|
|
954
|
+
} else {
|
|
955
|
+
scrollTo({ behavior: 'smooth' });
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
private get isAllowedToAutoScroll() {
|
|
960
|
+
return !this.userHasScrolled || this.isScrolledToBottom;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// For efficiency, read receipts are implemented using "up to" markers. This
|
|
964
|
+
// marker indicates that the acknowledgement applies to all events "up to and
|
|
965
|
+
// including" the event specified. For example, marking an event as "read" would
|
|
966
|
+
// indicate that the user had read all events up to the referenced event.
|
|
967
|
+
@cached private get lastReadMessageIndex() {
|
|
968
|
+
let readReceiptIndicies: number[] = [];
|
|
969
|
+
for (let receipt of this.matrixService.currentUserEventReadReceipts.keys()) {
|
|
970
|
+
let maybeIndex = this.messages.findIndex((m) => m.eventId === receipt);
|
|
971
|
+
if (maybeIndex != null) {
|
|
972
|
+
readReceiptIndicies.push(maybeIndex);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return max(readReceiptIndicies) ?? -1;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
@cached private get numberOfUnreadMessages() {
|
|
979
|
+
let unreadMessagesCount = 0;
|
|
980
|
+
let firstUnreadIndex = this.lastReadMessageIndex + 1;
|
|
981
|
+
for (let i = firstUnreadIndex; i < this.messages.length; i++) {
|
|
982
|
+
if (
|
|
983
|
+
this.matrixService.profile.userId === this.messages[i].author.userId
|
|
984
|
+
) {
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
unreadMessagesCount++;
|
|
988
|
+
}
|
|
989
|
+
return unreadMessagesCount;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
private get hasUnreadMessages() {
|
|
993
|
+
return this.numberOfUnreadMessages > 0;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
private get showUnreadIndicator() {
|
|
997
|
+
// if user is already scrolled to bottom we don't show the indicator to
|
|
998
|
+
// prevent the flash of the indicator appearing and then disappearing during
|
|
999
|
+
// the read receipt acknowledgement
|
|
1000
|
+
return (
|
|
1001
|
+
this.isConversationScrollable &&
|
|
1002
|
+
this.hasUnreadMessages &&
|
|
1003
|
+
!this.isScrolledToBottom
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
private get isAcceptingAll() {
|
|
1008
|
+
return (
|
|
1009
|
+
this.executeAllReadyActionsTask.isRunning ||
|
|
1010
|
+
this.commandService.isPerformingAcceptAllForRoom(this.args.roomId)
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
private get unreadMessageText() {
|
|
1015
|
+
return `${this.numberOfUnreadMessages} New ${pluralize(
|
|
1016
|
+
'Message',
|
|
1017
|
+
this.numberOfUnreadMessages,
|
|
1018
|
+
)}`;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
private sendReadReceipt(message: Message) {
|
|
1022
|
+
if (this.matrixService.profile.userId === message.author.userId) {
|
|
1023
|
+
if (isTesting()) {
|
|
1024
|
+
console.log(
|
|
1025
|
+
`[read-receipt-trace] skip self event=${message.eventId} room=${this.args.roomId}`,
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
if (this.matrixService.currentUserEventReadReceipts.has(message.eventId)) {
|
|
1031
|
+
if (isTesting()) {
|
|
1032
|
+
console.log(
|
|
1033
|
+
`[read-receipt-trace] skip already-acked event=${message.eventId} room=${this.args.roomId}`,
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// sendReadReceipt expects an actual MatrixEvent (as defined in the matrix
|
|
1040
|
+
// SDK), but it' not available to us here - however, we can fake it by adding
|
|
1041
|
+
// the necessary methods
|
|
1042
|
+
let matrixEvent = {
|
|
1043
|
+
getId: () => message.eventId,
|
|
1044
|
+
getRoomId: () => this.args.roomId,
|
|
1045
|
+
getTs: () => message.created.getTime(),
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
if (isTesting()) {
|
|
1049
|
+
console.log(
|
|
1050
|
+
`[read-receipt-trace] schedule event=${message.eventId} room=${this.args.roomId}`,
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
// Without scheduling this after render, this produces the "attempted to
|
|
1054
|
+
// update value, but it had already been used previously in the same
|
|
1055
|
+
// computation" error
|
|
1056
|
+
schedule('afterRender', () => {
|
|
1057
|
+
if (isTesting()) {
|
|
1058
|
+
console.log(
|
|
1059
|
+
`[read-receipt-trace] dispatch event=${message.eventId} room=${this.args.roomId}`,
|
|
1060
|
+
);
|
|
1061
|
+
}
|
|
1062
|
+
this.matrixService.sendReadReceipt(matrixEvent as MatrixEvent);
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
private maybeRetryAction = (messageIndex: number, message: Message) => {
|
|
1067
|
+
if (this.isLastMessage(messageIndex) && message.isRetryable) {
|
|
1068
|
+
return this.resendLastMessage;
|
|
1069
|
+
}
|
|
1070
|
+
return undefined;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
private isMessageStreaming = (message: Message) => {
|
|
1074
|
+
return !message.isStreamingFinished;
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
private doMatrixEventFlush = restartableTask(async () => {
|
|
1078
|
+
await this.matrixService.flushMembership;
|
|
1079
|
+
await this.matrixService.flushTimeline;
|
|
1080
|
+
await this.args.roomResource.processing;
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
private get messages() {
|
|
1084
|
+
return this.args.roomResource.messages;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
private get skills(): RoomSkill[] {
|
|
1088
|
+
return this.args.roomResource.skills;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
private get llmsForSelectMenu(): LLMOption[] {
|
|
1092
|
+
// Read from the system card if available
|
|
1093
|
+
let systemCard = this.matrixService.systemCard;
|
|
1094
|
+
if (systemCard?.modelConfigurations) {
|
|
1095
|
+
let options: LLMOption[] = [];
|
|
1096
|
+
let configModelIds = new Set<string>();
|
|
1097
|
+
for (let modelConfig of systemCard.modelConfigurations) {
|
|
1098
|
+
if (modelConfig.modelId && modelConfig.id) {
|
|
1099
|
+
options.push({
|
|
1100
|
+
id: modelConfig.id,
|
|
1101
|
+
modelId: modelConfig.modelId,
|
|
1102
|
+
name: modelConfig.cardTitle || modelConfig.modelId,
|
|
1103
|
+
});
|
|
1104
|
+
configModelIds.add(modelConfig.modelId);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
// Add any used LLMs that aren't already covered by a config
|
|
1108
|
+
for (let usedLLM of this.args.roomResource.usedLLMs) {
|
|
1109
|
+
if (usedLLM && !configModelIds.has(usedLLM)) {
|
|
1110
|
+
options.push({
|
|
1111
|
+
id: usedLLM,
|
|
1112
|
+
modelId: usedLLM,
|
|
1113
|
+
name: usedLLM,
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return options;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// Fallback to hardcoded list for backwards compatibility
|
|
1121
|
+
let ids = [
|
|
1122
|
+
...new Set([...DEFAULT_LLM_LIST, ...this.args.roomResource.usedLLMs]),
|
|
1123
|
+
]
|
|
1124
|
+
.filter(Boolean)
|
|
1125
|
+
.sort();
|
|
1126
|
+
|
|
1127
|
+
return ids.map((id) => ({
|
|
1128
|
+
id,
|
|
1129
|
+
modelId: id,
|
|
1130
|
+
name: DEFAULT_LLM_ID_TO_NAME[id] ?? id,
|
|
1131
|
+
}));
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
private get systemCardId(): string | undefined {
|
|
1135
|
+
return this.matrixService.systemCard?.id;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
private get isDefaultSystemCard(): boolean {
|
|
1139
|
+
let systemCardId = this.systemCardId;
|
|
1140
|
+
let defaultSystemCardId = ENV.defaultSystemCardId;
|
|
1141
|
+
if (!defaultSystemCardId) {
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
return !systemCardId || systemCardId === defaultSystemCardId;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
@action
|
|
1148
|
+
private goToSystemCard() {
|
|
1149
|
+
let systemCardId = this.systemCardId;
|
|
1150
|
+
if (systemCardId) {
|
|
1151
|
+
let stackIndex = Math.min(
|
|
1152
|
+
this.operatorModeStateService.numberOfStacks(),
|
|
1153
|
+
1,
|
|
1154
|
+
);
|
|
1155
|
+
let stackItem = this.operatorModeStateService.createStackItem(
|
|
1156
|
+
systemCardId,
|
|
1157
|
+
stackIndex,
|
|
1158
|
+
'isolated',
|
|
1159
|
+
);
|
|
1160
|
+
this.operatorModeStateService.addItemToStack(stackItem);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
private restoreDefaultSystemCardTask = task(async () => {
|
|
1165
|
+
await this.matrixService.setUserSystemCard(undefined);
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
private get sortedSkills(): RoomSkill[] {
|
|
1169
|
+
return [...this.skills].sort((a, b) => {
|
|
1170
|
+
// Not all of the skills have a title, so we use the sourceUrl as a fallback
|
|
1171
|
+
// which should be consistent.
|
|
1172
|
+
let aTitle = a.cardId || a.fileDef.sourceUrl;
|
|
1173
|
+
let bTitle = b.cardId || b.fileDef.sourceUrl;
|
|
1174
|
+
return aTitle?.localeCompare(bTitle ?? '') ?? 0;
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
private get room() {
|
|
1179
|
+
return this.args.roomResource?.matrixRoom;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
private get roomForCleanup() {
|
|
1183
|
+
return this.room ?? this.lastKnownRoom;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
private doWhenRoomChanges = restartableTask(async () => {
|
|
1187
|
+
await all([this.cardService.cardsSettled(), timeout(500)]);
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
private get messageToSend() {
|
|
1191
|
+
return this.matrixService.getMessageToSend(this.args.roomId) ?? '';
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
private get cardIdsToAttach() {
|
|
1195
|
+
return this.matrixService.getCardsToSend(this.args.roomId);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
@action private resendLastMessage() {
|
|
1199
|
+
if (!this.room) {
|
|
1200
|
+
throw new Error(
|
|
1201
|
+
'Bug: should not be able to resend a message without a room.',
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
let myMessages = this.messages.filter(
|
|
1206
|
+
(message) => message.author.userId === this.matrixService.userId,
|
|
1207
|
+
);
|
|
1208
|
+
if (myMessages.length === 0) {
|
|
1209
|
+
throw new Error(
|
|
1210
|
+
'Bug: should not be able to resend a message that does not exist.',
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
let myLastMessage = myMessages[myMessages.length - 1];
|
|
1214
|
+
|
|
1215
|
+
this.doSendMessage.perform(
|
|
1216
|
+
myLastMessage.body,
|
|
1217
|
+
myLastMessage!.attachedCardIds || [],
|
|
1218
|
+
myLastMessage.attachedFiles,
|
|
1219
|
+
myLastMessage.clientGeneratedId,
|
|
1220
|
+
true,
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
@action
|
|
1225
|
+
private setMessage(message: string) {
|
|
1226
|
+
this.matrixService.setMessageToSend(this.args.roomId, message);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
@action
|
|
1230
|
+
private sendMessage(prompt?: string) {
|
|
1231
|
+
let cards = [];
|
|
1232
|
+
if (this.cardIdsToAttach) {
|
|
1233
|
+
cards.push(...this.cardIdsToAttach);
|
|
1234
|
+
}
|
|
1235
|
+
if (this.autoAttachedCardIds.size > 0) {
|
|
1236
|
+
this.autoAttachedCardIds.forEach((card) => {
|
|
1237
|
+
cards.push(card);
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
let files = [];
|
|
1242
|
+
if (this.autoAttachedFiles.length > 0) {
|
|
1243
|
+
files.push(...this.autoAttachedFiles);
|
|
1244
|
+
}
|
|
1245
|
+
files.push(...this.filesToAttach);
|
|
1246
|
+
|
|
1247
|
+
this.doSendMessage.perform(
|
|
1248
|
+
prompt ?? this.messageToSend,
|
|
1249
|
+
cards.length ? cards : undefined,
|
|
1250
|
+
files.length ? files : undefined,
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
@action
|
|
1255
|
+
private chooseCard(cardId: string) {
|
|
1256
|
+
// handle the case where auto-attached card pill is clicked
|
|
1257
|
+
if (this.autoAttachedCardIds.has(cardId)) {
|
|
1258
|
+
this.removedAttachedCardIds.add(cardId);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
let cardIds = this.cardIdsToAttach ?? [];
|
|
1262
|
+
if (!cardIds.includes(cardId)) {
|
|
1263
|
+
this.matrixService.setCardsToSend(this.args.roomId, [...cardIds, cardId]);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
@action
|
|
1268
|
+
private removeCard(id: string) {
|
|
1269
|
+
if (this.playgroundPanelCardId === id) {
|
|
1270
|
+
this.removePlaygroundPanelCard();
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
if (this.autoAttachedCardIds.has(id)) {
|
|
1275
|
+
this.removedAttachedCardIds.add(id);
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
let cardIds = this.cardIdsToAttach ?? [];
|
|
1280
|
+
if (!cardIds.length) {
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
let next = cardIds.filter((url) => url !== id);
|
|
1285
|
+
if (next.length === cardIds.length) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
this.matrixService.setCardsToSend(
|
|
1290
|
+
this.args.roomId,
|
|
1291
|
+
next.length ? next : undefined,
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
private chooseFileTask = enqueueTask(async (file: FileDef) => {
|
|
1296
|
+
// handle the case where auto-attached file pill is clicked
|
|
1297
|
+
if (this.isAutoAttachedFile(file)) {
|
|
1298
|
+
this.removeAutoAttachedFile(file.sourceUrl ?? undefined);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
let files = this.filesToAttach;
|
|
1302
|
+
if (!files?.find((f) => f.sourceUrl === file.sourceUrl)) {
|
|
1303
|
+
await this.matrixService.prefetchFileContent(file);
|
|
1304
|
+
this.matrixService.setFilesToSend(this.args.roomId, [...files, file]);
|
|
1305
|
+
this.startFileUploadTask.perform(file);
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
private chooseLocalFileTask = task(async () => {
|
|
1310
|
+
let localFile = await this.fileUpload.pickLocalFile();
|
|
1311
|
+
if (!localFile) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
await this.attachLocalFile(localFile);
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
@action
|
|
1318
|
+
private handleChatInputDragOver(event: Event) {
|
|
1319
|
+
let dragEvent = event as DragEvent;
|
|
1320
|
+
if (!this.isFileDrag(dragEvent.dataTransfer)) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
dragEvent.preventDefault();
|
|
1324
|
+
dragEvent.stopPropagation();
|
|
1325
|
+
this.isDropZoneActive = true;
|
|
1326
|
+
if (dragEvent.dataTransfer) {
|
|
1327
|
+
dragEvent.dataTransfer.dropEffect = 'copy';
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
@action
|
|
1332
|
+
private handleChatInputDragEnter(event: Event) {
|
|
1333
|
+
let dragEvent = event as DragEvent;
|
|
1334
|
+
if (!this.isFileDrag(dragEvent.dataTransfer)) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
dragEvent.preventDefault();
|
|
1338
|
+
dragEvent.stopPropagation();
|
|
1339
|
+
this.dropZoneDragDepth++;
|
|
1340
|
+
this.isDropZoneActive = true;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
@action
|
|
1344
|
+
private handleChatInputDragLeave(event: Event) {
|
|
1345
|
+
let dragEvent = event as DragEvent;
|
|
1346
|
+
if (!this.isFileDrag(dragEvent.dataTransfer) && !this.isDropZoneActive) {
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
dragEvent.preventDefault();
|
|
1350
|
+
dragEvent.stopPropagation();
|
|
1351
|
+
this.dropZoneDragDepth = Math.max(0, this.dropZoneDragDepth - 1);
|
|
1352
|
+
if (this.dropZoneDragDepth === 0) {
|
|
1353
|
+
this.isDropZoneActive = false;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
@action
|
|
1358
|
+
private handleChatInputDrop(event: Event) {
|
|
1359
|
+
let dragEvent = event as DragEvent;
|
|
1360
|
+
let files = Array.from(dragEvent.dataTransfer?.files ?? []);
|
|
1361
|
+
if (!files.length) {
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
dragEvent.preventDefault();
|
|
1365
|
+
dragEvent.stopPropagation();
|
|
1366
|
+
this.dropZoneDragDepth = 0;
|
|
1367
|
+
this.isDropZoneActive = false;
|
|
1368
|
+
this.attachLocalFilesTask.perform(files);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
@action
|
|
1372
|
+
private handleChatInputPaste(event: ClipboardEvent) {
|
|
1373
|
+
let files = this.getClipboardFiles(event.clipboardData);
|
|
1374
|
+
if (!files.length) {
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
event.preventDefault();
|
|
1378
|
+
event.stopPropagation();
|
|
1379
|
+
this.attachLocalFilesTask.perform(files);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
private attachLocalFilesTask = enqueueTask(async (files: File[]) => {
|
|
1383
|
+
for (let file of files) {
|
|
1384
|
+
await this.attachLocalFile(file);
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
|
|
1388
|
+
private getClipboardFiles(clipboardData: DataTransfer | null): File[] {
|
|
1389
|
+
if (!clipboardData) {
|
|
1390
|
+
return [];
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
let files = Array.from(clipboardData.files ?? []);
|
|
1394
|
+
if (files.length) {
|
|
1395
|
+
return files;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
let itemFiles: File[] = [];
|
|
1399
|
+
for (let item of Array.from(clipboardData.items ?? [])) {
|
|
1400
|
+
if (item.kind !== 'file') {
|
|
1401
|
+
continue;
|
|
1402
|
+
}
|
|
1403
|
+
let file = item.getAsFile();
|
|
1404
|
+
if (file) {
|
|
1405
|
+
itemFiles.push(file);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
return itemFiles;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
private isFileDrag(dataTransfer: DataTransfer | null | undefined): boolean {
|
|
1413
|
+
if (!dataTransfer) {
|
|
1414
|
+
return false;
|
|
1415
|
+
}
|
|
1416
|
+
return Array.from(dataTransfer.types ?? []).includes('Files');
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
private async attachLocalFile(localFile: File) {
|
|
1420
|
+
let bytes = new Uint8Array(await localFile.arrayBuffer());
|
|
1421
|
+
let file = await this.createLocalFileDef(localFile, bytes);
|
|
1422
|
+
let files = this.filesToAttach;
|
|
1423
|
+
let contentType =
|
|
1424
|
+
file.contentType || localFile.type || 'application/octet-stream';
|
|
1425
|
+
await this.matrixService.prefetchLocalFileContent(file, bytes, contentType);
|
|
1426
|
+
this.matrixService.setFilesToSend(this.args.roomId, [...files, file]);
|
|
1427
|
+
this.startFileUploadTask.perform(file);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
@action
|
|
1431
|
+
private isAutoAttachedFile(file: FileDef) {
|
|
1432
|
+
return this.autoAttachedFiles.some(
|
|
1433
|
+
(autoFile) => autoFile.sourceUrl === file.sourceUrl,
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
@action
|
|
1438
|
+
private removeFile(file: FileDef) {
|
|
1439
|
+
if (this.isAutoAttachedFile(file)) {
|
|
1440
|
+
this.removeAutoAttachedFile(file.sourceUrl ?? undefined);
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
let files = this.filesToAttach;
|
|
1445
|
+
if (!files.length) {
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
let newFiles = files.filter((f) => f.sourceUrl !== file.sourceUrl);
|
|
1450
|
+
if (newFiles.length === files.length) {
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
this.matrixService.setFilesToSend(
|
|
1455
|
+
this.args.roomId,
|
|
1456
|
+
newFiles.length ? newFiles : undefined,
|
|
1457
|
+
);
|
|
1458
|
+
|
|
1459
|
+
this.markAttachedFileRemoved(file.sourceUrl);
|
|
1460
|
+
if (file.sourceUrl) {
|
|
1461
|
+
this._fileUploadStates.delete(file.sourceUrl);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
private startFileUploadTask = task(async (file: FileDef) => {
|
|
1466
|
+
let sourceUrl = file.sourceUrl;
|
|
1467
|
+
if (!sourceUrl) return;
|
|
1468
|
+
this._fileUploadStates.set(sourceUrl, { status: 'uploading' });
|
|
1469
|
+
try {
|
|
1470
|
+
let [uploadedFile] = await this.matrixService.uploadFiles([file]);
|
|
1471
|
+
let uploadedOrOriginal = uploadedFile ?? file;
|
|
1472
|
+
// Only update state if the file is still attached (guards against
|
|
1473
|
+
// race where file is removed while upload was in-flight).
|
|
1474
|
+
let files = this.filesToAttach;
|
|
1475
|
+
if (files?.find((f) => f.sourceUrl === sourceUrl)) {
|
|
1476
|
+
let nextFiles = files.map((f) =>
|
|
1477
|
+
f.sourceUrl === sourceUrl ? uploadedOrOriginal : f,
|
|
1478
|
+
);
|
|
1479
|
+
this.matrixService.setFilesToSend(this.args.roomId, nextFiles);
|
|
1480
|
+
this._fileUploadStates.set(sourceUrl, { status: 'complete' });
|
|
1481
|
+
}
|
|
1482
|
+
} catch (e: any) {
|
|
1483
|
+
// Only set error state if the file is still attached, to avoid
|
|
1484
|
+
// blocking canSend for a file the user already removed.
|
|
1485
|
+
if (this.filesToAttach?.find((f) => f.sourceUrl === sourceUrl)) {
|
|
1486
|
+
this._fileUploadStates.set(sourceUrl, {
|
|
1487
|
+
status: 'error',
|
|
1488
|
+
error: e?.message,
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
|
|
1494
|
+
private get hasFileUploadIssues() {
|
|
1495
|
+
for (let [, state] of this._fileUploadStates) {
|
|
1496
|
+
if (state.status === 'uploading' || state.status === 'error') {
|
|
1497
|
+
return true;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
@action
|
|
1504
|
+
private retryFileUpload(file: FileDef) {
|
|
1505
|
+
this.startFileUploadTask.perform(file);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
private buildLocalSourceUrl(fileName: string): string {
|
|
1509
|
+
return `${LOCAL_SOURCE_URL_PREFIX}${uuidv4()}/${encodeURIComponent(fileName)}`;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
private async createLocalFileDef(
|
|
1513
|
+
localFile: File,
|
|
1514
|
+
bytes: Uint8Array,
|
|
1515
|
+
): Promise<FileDef> {
|
|
1516
|
+
let sourceUrl = this.buildLocalSourceUrl(localFile.name);
|
|
1517
|
+
let fileDefCodeRef = resolveFileDefCodeRef(new URL(sourceUrl));
|
|
1518
|
+
let extractor = new FileDefAttributesExtractor({
|
|
1519
|
+
loaderService: this.loaderService,
|
|
1520
|
+
network: this.network,
|
|
1521
|
+
fileURL: sourceUrl,
|
|
1522
|
+
fileDefCodeRef,
|
|
1523
|
+
baseFileDefCodeRef: baseFileRef,
|
|
1524
|
+
contentHash: undefined,
|
|
1525
|
+
contentSize: bytes.byteLength,
|
|
1526
|
+
fileBytes: bytes,
|
|
1527
|
+
buildError: (errorUrl, error) => {
|
|
1528
|
+
let errorJSONAPI = formattedError(errorUrl, error).errors[0];
|
|
1529
|
+
return errorJsonApiToErrorEntry(errorJSONAPI);
|
|
1530
|
+
},
|
|
1531
|
+
});
|
|
1532
|
+
let extracted = await extractor.extract();
|
|
1533
|
+
if (extracted.status === 'error' || !extracted.resource) {
|
|
1534
|
+
throw new Error(
|
|
1535
|
+
extracted.error?.error?.message ??
|
|
1536
|
+
`Failed to extract file metadata for ${localFile.name}`,
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
let classCodeRef =
|
|
1541
|
+
extracted.resource.meta.adoptsFrom &&
|
|
1542
|
+
'module' in extracted.resource.meta.adoptsFrom &&
|
|
1543
|
+
'name' in extracted.resource.meta.adoptsFrom
|
|
1544
|
+
? extracted.resource.meta.adoptsFrom
|
|
1545
|
+
: fileDefCodeRef;
|
|
1546
|
+
let fileDefModule = await this.loaderService.loader.import<
|
|
1547
|
+
Record<string, unknown>
|
|
1548
|
+
>(classCodeRef.module);
|
|
1549
|
+
let FileDefKlass = fileDefModule[classCodeRef.name] as
|
|
1550
|
+
| (new (attributes: Record<string, unknown>) => FileDef)
|
|
1551
|
+
| undefined;
|
|
1552
|
+
let baseAttributes = extracted.resource.attributes as Record<
|
|
1553
|
+
string,
|
|
1554
|
+
unknown
|
|
1555
|
+
>;
|
|
1556
|
+
let attributes: Record<string, unknown> = {
|
|
1557
|
+
...baseAttributes,
|
|
1558
|
+
sourceUrl,
|
|
1559
|
+
url: sourceUrl,
|
|
1560
|
+
name: (baseAttributes.name as string | undefined) ?? localFile.name,
|
|
1561
|
+
contentSize:
|
|
1562
|
+
(baseAttributes.contentSize as number | undefined) ?? bytes.byteLength,
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
if (!FileDefKlass) {
|
|
1566
|
+
return this.matrixService.fileAPI.createFileDef({
|
|
1567
|
+
sourceUrl,
|
|
1568
|
+
url: sourceUrl,
|
|
1569
|
+
name: localFile.name,
|
|
1570
|
+
contentType:
|
|
1571
|
+
(attributes.contentType as string | undefined) ??
|
|
1572
|
+
localFile.type ??
|
|
1573
|
+
'application/octet-stream',
|
|
1574
|
+
contentHash: attributes.contentHash as string | undefined,
|
|
1575
|
+
contentSize: attributes.contentSize as number | undefined,
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
return new FileDefKlass(attributes);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
private doSendMessage = enqueueTask(
|
|
1583
|
+
async (
|
|
1584
|
+
message: string | undefined,
|
|
1585
|
+
cardsOrIds?: CardDef[] | string[],
|
|
1586
|
+
files?: FileDef[],
|
|
1587
|
+
clientGeneratedId: string = uuidv4(),
|
|
1588
|
+
keepInputAndAttachments = false,
|
|
1589
|
+
) => {
|
|
1590
|
+
this.unknownMessageSendError = undefined;
|
|
1591
|
+
let messageToSend = this.matrixService.getMessageToSend(this.args.roomId);
|
|
1592
|
+
let cardsToSend =
|
|
1593
|
+
this.matrixService.getCardsToSend(this.args.roomId) ?? undefined;
|
|
1594
|
+
let cardsToSendCopy = cardsToSend ? [...cardsToSend] : undefined;
|
|
1595
|
+
let filesToSend =
|
|
1596
|
+
this.matrixService.getFilesToSend(this.args.roomId) ?? undefined;
|
|
1597
|
+
let filesToSendCopy = filesToSend ? [...filesToSend] : undefined;
|
|
1598
|
+
const shouldClearDraft = !keepInputAndAttachments;
|
|
1599
|
+
|
|
1600
|
+
// We copy the draft and attachments into local variables before clearing them
|
|
1601
|
+
// (unless we're intentionally preserving the user's current draft for a retry).
|
|
1602
|
+
// Clearing immediately empties the input so the user sees that their message is “in flight”.
|
|
1603
|
+
// If the send fails, we restore those saved values in the catch block so nothing is lost.
|
|
1604
|
+
if (shouldClearDraft) {
|
|
1605
|
+
this.matrixService.setMessageToSend(this.args.roomId, undefined);
|
|
1606
|
+
this.matrixService.setCardsToSend(this.args.roomId, undefined);
|
|
1607
|
+
this.matrixService.setFilesToSend(this.args.roomId, undefined);
|
|
1608
|
+
this._fileUploadStates.clear();
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
let openCardIds = new Set([
|
|
1612
|
+
...(this.operatorModeStateService.getOpenCardIds() || []),
|
|
1613
|
+
...this.autoAttachedCardIds,
|
|
1614
|
+
]) as Set<RealmResourceIdentifier>;
|
|
1615
|
+
let context =
|
|
1616
|
+
await this.operatorModeStateService.getSummaryForAIBot(openCardIds);
|
|
1617
|
+
try {
|
|
1618
|
+
let cards: CardDef[] | undefined = [];
|
|
1619
|
+
if (typeof cardsOrIds?.[0] === 'string') {
|
|
1620
|
+
// we use detached instances since these are just
|
|
1621
|
+
// serialized and send to matrix--these don't appear
|
|
1622
|
+
// elsewhere in our app.
|
|
1623
|
+
let cardsOrErrors = await Promise.all(
|
|
1624
|
+
(cardsOrIds as string[]).map((id) => this.store.get(id)),
|
|
1625
|
+
);
|
|
1626
|
+
cardsOrErrors = cardsOrErrors.filter(Boolean);
|
|
1627
|
+
for (let cardOrError of cardsOrErrors) {
|
|
1628
|
+
if (isCardInstance(cardOrError)) {
|
|
1629
|
+
cards?.push(cardOrError as CardDef);
|
|
1630
|
+
} else {
|
|
1631
|
+
// error, let's attach it as a file instead if possible
|
|
1632
|
+
if (cardOrError.id) {
|
|
1633
|
+
let cardFileDef = this.matrixService.fileAPI.createFileDef({
|
|
1634
|
+
sourceUrl: cardOrError.id + '.json',
|
|
1635
|
+
name: cardOrError.id.split('/').pop(),
|
|
1636
|
+
});
|
|
1637
|
+
if (!files) {
|
|
1638
|
+
files = [];
|
|
1639
|
+
}
|
|
1640
|
+
files.push(cardFileDef);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
} else {
|
|
1645
|
+
cards = cardsOrIds as CardDef[] | undefined;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
await this.matrixService.sendMessage(
|
|
1649
|
+
this.args.roomId,
|
|
1650
|
+
message,
|
|
1651
|
+
cards,
|
|
1652
|
+
files,
|
|
1653
|
+
clientGeneratedId,
|
|
1654
|
+
context,
|
|
1655
|
+
);
|
|
1656
|
+
} catch (e) {
|
|
1657
|
+
console.error(e);
|
|
1658
|
+
this.unknownMessageSendError =
|
|
1659
|
+
'There was an error sending your message. This could be due to network issues, or serialization issues with the cards or files you are trying to send. It might be helpful to refresh the page and try again.';
|
|
1660
|
+
|
|
1661
|
+
if (shouldClearDraft) {
|
|
1662
|
+
this.matrixService.setMessageToSend(this.args.roomId, messageToSend);
|
|
1663
|
+
this.matrixService.setCardsToSend(
|
|
1664
|
+
this.args.roomId,
|
|
1665
|
+
cardsToSendCopy && cardsToSendCopy.length > 0
|
|
1666
|
+
? cardsToSendCopy
|
|
1667
|
+
: undefined,
|
|
1668
|
+
);
|
|
1669
|
+
this.matrixService.setFilesToSend(
|
|
1670
|
+
this.args.roomId,
|
|
1671
|
+
filesToSendCopy && filesToSendCopy.length > 0
|
|
1672
|
+
? filesToSendCopy
|
|
1673
|
+
: undefined,
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
);
|
|
1679
|
+
|
|
1680
|
+
@cached
|
|
1681
|
+
private get topMostStackItems(): StackItem[] {
|
|
1682
|
+
// side effect: whenever the stack changes we reset the
|
|
1683
|
+
// auto-attached removed items state in a task to prevent rerender cycles
|
|
1684
|
+
this.resetAutoAttachedRemovedStateTask.perform();
|
|
1685
|
+
return this.operatorModeStateService.topMostStackItems();
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
private resetAutoAttachedRemovedStateTask = task(async () => {
|
|
1689
|
+
await Promise.resolve();
|
|
1690
|
+
this.removedAttachedCardIds.clear();
|
|
1691
|
+
});
|
|
1692
|
+
|
|
1693
|
+
private get autoAttachedCardIds() {
|
|
1694
|
+
return this.autoAttachmentResource.cardIds;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
private updateSkillIsActiveTask = task(
|
|
1698
|
+
async (isActive: boolean, skillCardId?: string) => {
|
|
1699
|
+
await new UpdateRoomSkillsCommand(
|
|
1700
|
+
this.commandService.commandContext,
|
|
1701
|
+
).execute({
|
|
1702
|
+
roomId: this.args.roomId,
|
|
1703
|
+
skillCardIdsToActivate: isActive ? [skillCardId!] : [],
|
|
1704
|
+
skillCardIdsToDeactivate: isActive ? [] : [skillCardId!],
|
|
1705
|
+
});
|
|
1706
|
+
},
|
|
1707
|
+
);
|
|
1708
|
+
|
|
1709
|
+
private get canSend() {
|
|
1710
|
+
return (
|
|
1711
|
+
!this.doSendMessage.isRunning &&
|
|
1712
|
+
Boolean(
|
|
1713
|
+
this.messageToSend?.trim() ||
|
|
1714
|
+
this.cardIdsToAttach?.length ||
|
|
1715
|
+
this.autoAttachedCardIds.size !== 0 ||
|
|
1716
|
+
this.filesToAttach?.length ||
|
|
1717
|
+
this.autoAttachedFiles.length > 0,
|
|
1718
|
+
) &&
|
|
1719
|
+
!this.hasFileUploadIssues &&
|
|
1720
|
+
!!this.room &&
|
|
1721
|
+
!this.messages.some((m) => this.isPendingMessage(m)) &&
|
|
1722
|
+
!this.matrixService.isLoadingTimeline &&
|
|
1723
|
+
!this.aiAssistantPanelService.isPreparingSession
|
|
1724
|
+
);
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
@action
|
|
1728
|
+
private isLastMessage(messageIndex: number) {
|
|
1729
|
+
return (this.room && messageIndex === this.messages.length - 1) ?? false;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
private isPendingMessage(message: Message) {
|
|
1733
|
+
return message.status === 'sending' || message.status === 'queued';
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
private attachSkillTask = task(async (cardId: string) => {
|
|
1737
|
+
let updateRoomSkillsCommand = new UpdateRoomSkillsCommand(
|
|
1738
|
+
this.commandService.commandContext,
|
|
1739
|
+
);
|
|
1740
|
+
|
|
1741
|
+
await updateRoomSkillsCommand.execute({
|
|
1742
|
+
roomId: this.args.roomId,
|
|
1743
|
+
skillCardIdsToActivate: [cardId],
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1747
|
+
@action
|
|
1748
|
+
private setSelectedBottomAction(
|
|
1749
|
+
action: 'skill-menu' | 'llm-select' | undefined,
|
|
1750
|
+
) {
|
|
1751
|
+
this.selectedBottomAction = action;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
@action
|
|
1755
|
+
private skipSessionPreparation() {
|
|
1756
|
+
this.aiAssistantPanelService.skipSessionPreparation();
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
private get displaySkillMenu() {
|
|
1760
|
+
return (
|
|
1761
|
+
!this.selectedBottomAction || this.selectedBottomAction === 'skill-menu'
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
private get displayLLMSelect() {
|
|
1766
|
+
return (
|
|
1767
|
+
!this.selectedBottomAction || this.selectedBottomAction === 'llm-select'
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
private get displayLLMModeSelect() {
|
|
1772
|
+
return this.displaySkillMenu && this.displayLLMSelect;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
private get displayAttachedItems() {
|
|
1776
|
+
return (
|
|
1777
|
+
this.filesToAttach?.length ||
|
|
1778
|
+
this.cardIdsToAttach?.length ||
|
|
1779
|
+
this.autoAttachedFiles.length > 0 ||
|
|
1780
|
+
this.autoAttachedCardIds?.size
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
@cached
|
|
1785
|
+
private get readyCommands() {
|
|
1786
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
1787
|
+
|
|
1788
|
+
if (!lastMessage || !lastMessage.commands) {
|
|
1789
|
+
return [];
|
|
1790
|
+
}
|
|
1791
|
+
return lastMessage.commands.filter(
|
|
1792
|
+
(command) =>
|
|
1793
|
+
(command.status === 'ready' || command.status === undefined) &&
|
|
1794
|
+
!this.commandService.currentlyExecutingCommandRequestIds.has(
|
|
1795
|
+
command.id!,
|
|
1796
|
+
) &&
|
|
1797
|
+
!this.commandService.executedCommandRequestIds.has(command.id!),
|
|
1798
|
+
);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
@cached
|
|
1802
|
+
private get readyCodePatches() {
|
|
1803
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
1804
|
+
if (!lastMessage || !lastMessage.htmlParts) return [];
|
|
1805
|
+
return this.commandService.getReadyCodePatches(lastMessage.htmlParts);
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
private get generatingResults() {
|
|
1809
|
+
return (
|
|
1810
|
+
this.messages[this.messages.length - 1] &&
|
|
1811
|
+
!this.messages[this.messages.length - 1].isStreamingFinished
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
@cached
|
|
1816
|
+
private get displayActionBar() {
|
|
1817
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
1818
|
+
if (
|
|
1819
|
+
(this.lastCanceledActionMessageId &&
|
|
1820
|
+
lastMessage?.eventId === this.lastCanceledActionMessageId) ||
|
|
1821
|
+
lastMessage?.isCanceled
|
|
1822
|
+
) {
|
|
1823
|
+
return false;
|
|
1824
|
+
}
|
|
1825
|
+
return (
|
|
1826
|
+
this.showUnreadIndicator ||
|
|
1827
|
+
this.generatingResults ||
|
|
1828
|
+
this.readyCommands.length > 0 ||
|
|
1829
|
+
this.readyCodePatches.length > 0 ||
|
|
1830
|
+
this.isAcceptingAll
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
private async executeReadyCommands() {
|
|
1835
|
+
for (let command of this.readyCommands) {
|
|
1836
|
+
this.acceptingAllLabel = command.actionVerb;
|
|
1837
|
+
await this.commandService.run.unlinked().perform(command);
|
|
1838
|
+
this.acceptingAllLabel = undefined;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
private async executeReadyCodePatches() {
|
|
1843
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
1844
|
+
if (!lastMessage || !lastMessage.htmlParts) return;
|
|
1845
|
+
|
|
1846
|
+
await this.commandService.executeReadyCodePatches(
|
|
1847
|
+
this.args.roomId,
|
|
1848
|
+
lastMessage.htmlParts,
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
private executeAllReadyActionsTask = task(async () => {
|
|
1853
|
+
await this.executeReadyCodePatches();
|
|
1854
|
+
await this.executeReadyCommands();
|
|
1855
|
+
});
|
|
1856
|
+
|
|
1857
|
+
@action
|
|
1858
|
+
private cancelActionBar() {
|
|
1859
|
+
let lastMessage = this.messages[this.messages.length - 1];
|
|
1860
|
+
if (lastMessage) {
|
|
1861
|
+
this.lastCanceledActionMessageId = lastMessage.eventId;
|
|
1862
|
+
this.matrixService.markActionAsCanceled(
|
|
1863
|
+
this.args.roomId,
|
|
1864
|
+
lastMessage.eventId,
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
private stopGeneratingTask = task(async () => {
|
|
1870
|
+
await this.matrixService.sendStopGeneratingEvent(this.args.roomId);
|
|
1871
|
+
});
|
|
1872
|
+
}
|