@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,975 @@
|
|
|
1
|
+
import { getOwner, setOwner } from '@ember/owner';
|
|
2
|
+
import type Owner from '@ember/owner';
|
|
3
|
+
|
|
4
|
+
import { debounce, schedule } from '@ember/runloop';
|
|
5
|
+
import Service, { service } from '@ember/service';
|
|
6
|
+
import { buildWaiter } from '@ember/test-waiters';
|
|
7
|
+
import { isTesting } from '@embroider/macros';
|
|
8
|
+
|
|
9
|
+
import Ajv from 'ajv';
|
|
10
|
+
|
|
11
|
+
import { task, timeout, all } from 'ember-concurrency';
|
|
12
|
+
|
|
13
|
+
import { TrackedSet } from 'tracked-built-ins';
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
15
|
+
|
|
16
|
+
import type { Command, CommandContext } from '@cardstack/runtime-common';
|
|
17
|
+
import {
|
|
18
|
+
Deferred,
|
|
19
|
+
CommandContextStamp,
|
|
20
|
+
delay,
|
|
21
|
+
getClass,
|
|
22
|
+
identifyCard,
|
|
23
|
+
rri,
|
|
24
|
+
type PatchData,
|
|
25
|
+
} from '@cardstack/runtime-common';
|
|
26
|
+
|
|
27
|
+
import { basicMappings } from '@cardstack/runtime-common/helpers/ai';
|
|
28
|
+
import { APP_BOXEL_COMMAND_REQUESTS_KEY } from '@cardstack/runtime-common/matrix-constants';
|
|
29
|
+
|
|
30
|
+
import CheckCorrectnessCommand from '@cardstack/host/commands/check-correctness';
|
|
31
|
+
import PatchCodeCommand from '@cardstack/host/commands/patch-code';
|
|
32
|
+
|
|
33
|
+
import type MatrixService from '@cardstack/host/services/matrix-service';
|
|
34
|
+
import type Realm from '@cardstack/host/services/realm';
|
|
35
|
+
|
|
36
|
+
import type { CardDef } from 'https://cardstack.com/base/card-api';
|
|
37
|
+
import type { CodePatchStatus } from 'https://cardstack.com/base/matrix-event';
|
|
38
|
+
|
|
39
|
+
import LimitedSet from '../lib/limited-set';
|
|
40
|
+
|
|
41
|
+
import type LoaderService from './loader-service';
|
|
42
|
+
import type MessageService from './message-service';
|
|
43
|
+
import type OperatorModeStateService from './operator-mode-state-service';
|
|
44
|
+
import type RealmServerService from './realm-server';
|
|
45
|
+
import type ResetService from './reset';
|
|
46
|
+
import type StoreService from './store';
|
|
47
|
+
import type { CodeData } from '../lib/formatted-message/utils';
|
|
48
|
+
import type MessageCodePatchResult from '../lib/matrix-classes/message-code-patch-result';
|
|
49
|
+
import type MessageCommand from '../lib/matrix-classes/message-command';
|
|
50
|
+
import type { IEvent } from 'matrix-js-sdk';
|
|
51
|
+
|
|
52
|
+
const DELAY_FOR_APPLYING_UI = isTesting() ? 50 : 500;
|
|
53
|
+
const CHECK_CORRECTNESS_COMMAND_NAME = 'checkCorrectness';
|
|
54
|
+
|
|
55
|
+
type GenericCommand = Command<
|
|
56
|
+
typeof CardDef | undefined,
|
|
57
|
+
typeof CardDef | undefined
|
|
58
|
+
>;
|
|
59
|
+
|
|
60
|
+
const commandProcessingWaiter = buildWaiter(
|
|
61
|
+
'command-service:command-processing',
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export default class CommandService extends Service {
|
|
65
|
+
@service declare private loaderService: LoaderService;
|
|
66
|
+
@service declare private matrixService: MatrixService;
|
|
67
|
+
@service declare private messageService: MessageService;
|
|
68
|
+
@service declare private operatorModeStateService: OperatorModeStateService;
|
|
69
|
+
@service declare private realm: Realm;
|
|
70
|
+
@service declare private realmServer: RealmServerService;
|
|
71
|
+
@service declare private reset: ResetService;
|
|
72
|
+
@service declare private store: StoreService;
|
|
73
|
+
currentlyExecutingCommandRequestIds = new TrackedSet<string>();
|
|
74
|
+
executedCommandRequestIds = new TrackedSet<string>();
|
|
75
|
+
acceptingAllRoomIds = new TrackedSet<string>();
|
|
76
|
+
private aiAssistantClientRequestIdsByRoom = new Map<
|
|
77
|
+
string,
|
|
78
|
+
LimitedSet<string>
|
|
79
|
+
>();
|
|
80
|
+
private aiAssistantInvalidations = new Map<
|
|
81
|
+
string,
|
|
82
|
+
{
|
|
83
|
+
clientRequestId: string;
|
|
84
|
+
roomId: string;
|
|
85
|
+
targetHref: string;
|
|
86
|
+
deferred: Deferred<void>;
|
|
87
|
+
}
|
|
88
|
+
>();
|
|
89
|
+
private aiAssistantInvalidationWaiters = new Map<
|
|
90
|
+
string,
|
|
91
|
+
{ unsubscribe: () => void; timeoutId: ReturnType<typeof setTimeout> }
|
|
92
|
+
>();
|
|
93
|
+
private commandProcessingEventQueue: string[] = [];
|
|
94
|
+
private codePatchProcessingEventQueue: string[] = [];
|
|
95
|
+
private flushCommandProcessingQueue: Promise<void> | undefined;
|
|
96
|
+
private flushCodePatchProcessingQueue: Promise<void> | undefined;
|
|
97
|
+
|
|
98
|
+
constructor(owner: Owner) {
|
|
99
|
+
super(owner);
|
|
100
|
+
this.reset.register(this);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
resetState() {
|
|
104
|
+
this.currentlyExecutingCommandRequestIds.clear();
|
|
105
|
+
this.executedCommandRequestIds.clear();
|
|
106
|
+
this.acceptingAllRoomIds.clear();
|
|
107
|
+
this.aiAssistantClientRequestIdsByRoom.clear();
|
|
108
|
+
for (let invalidation of this.aiAssistantInvalidations.values()) {
|
|
109
|
+
invalidation.deferred.fulfill();
|
|
110
|
+
}
|
|
111
|
+
this.aiAssistantInvalidations.clear();
|
|
112
|
+
for (let key of this.aiAssistantInvalidationWaiters.keys()) {
|
|
113
|
+
this.cleanupInvalidationWaiter(key);
|
|
114
|
+
}
|
|
115
|
+
this.commandProcessingEventQueue = [];
|
|
116
|
+
this.codePatchProcessingEventQueue = [];
|
|
117
|
+
this.flushCommandProcessingQueue = undefined;
|
|
118
|
+
this.flushCodePatchProcessingQueue = undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
registerAiAssistantClientRequestId(action: string, roomId: string): string {
|
|
122
|
+
let encodedRoom = encodeURIComponent(roomId);
|
|
123
|
+
let clientRequestId = `bot-patch:${encodedRoom}:${action}:${uuidv4()}`;
|
|
124
|
+
|
|
125
|
+
let roomSet = this.aiAssistantClientRequestIdsByRoom.get(roomId!);
|
|
126
|
+
if (!roomSet) {
|
|
127
|
+
roomSet = new LimitedSet<string>(250);
|
|
128
|
+
this.aiAssistantClientRequestIdsByRoom.set(roomId!, roomSet);
|
|
129
|
+
}
|
|
130
|
+
roomSet.add(clientRequestId);
|
|
131
|
+
|
|
132
|
+
return clientRequestId;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
trackAiAssistantCardRequest({
|
|
136
|
+
action,
|
|
137
|
+
roomId,
|
|
138
|
+
fileUrl,
|
|
139
|
+
}: {
|
|
140
|
+
action: string;
|
|
141
|
+
roomId: string;
|
|
142
|
+
fileUrl: string;
|
|
143
|
+
}): string | undefined {
|
|
144
|
+
if (!action || !roomId || !fileUrl) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
let clientRequestId = this.registerAiAssistantClientRequestId(
|
|
148
|
+
action,
|
|
149
|
+
roomId,
|
|
150
|
+
);
|
|
151
|
+
// We only track invalidations for card instances and card definitions
|
|
152
|
+
if (!fileUrl.endsWith('.gts') && !fileUrl.endsWith('.json')) {
|
|
153
|
+
return clientRequestId;
|
|
154
|
+
}
|
|
155
|
+
let normalizedTarget = fileUrl.endsWith('.json')
|
|
156
|
+
? fileUrl.replace(/\.json$/, '')
|
|
157
|
+
: fileUrl;
|
|
158
|
+
let key = `${roomId}::${normalizedTarget}`;
|
|
159
|
+
|
|
160
|
+
let realmURL: string | undefined;
|
|
161
|
+
try {
|
|
162
|
+
realmURL = this.realm.realmOf(rri(fileUrl)) ?? undefined;
|
|
163
|
+
} catch (_e) {
|
|
164
|
+
return clientRequestId;
|
|
165
|
+
}
|
|
166
|
+
if (!realmURL) {
|
|
167
|
+
return clientRequestId;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let deferred = new Deferred<void>();
|
|
171
|
+
this.aiAssistantInvalidations.get(key)?.deferred.fulfill();
|
|
172
|
+
this.cleanupInvalidationWaiter(key);
|
|
173
|
+
this.aiAssistantInvalidations.set(key, {
|
|
174
|
+
clientRequestId,
|
|
175
|
+
roomId,
|
|
176
|
+
targetHref: normalizedTarget,
|
|
177
|
+
deferred,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
let unsubscribe = this.messageService.subscribe(realmURL, (event) => {
|
|
181
|
+
if (
|
|
182
|
+
!(
|
|
183
|
+
event &&
|
|
184
|
+
event.eventName === 'index' &&
|
|
185
|
+
event.indexType === 'incremental' &&
|
|
186
|
+
event.clientRequestId === clientRequestId
|
|
187
|
+
)
|
|
188
|
+
) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.cleanupInvalidationWaiter(key);
|
|
192
|
+
let current = this.aiAssistantInvalidations.get(key);
|
|
193
|
+
current?.deferred.fulfill();
|
|
194
|
+
});
|
|
195
|
+
let timeoutId = setTimeout(
|
|
196
|
+
() => {
|
|
197
|
+
this.cleanupInvalidationWaiter(key);
|
|
198
|
+
let current = this.aiAssistantInvalidations.get(key);
|
|
199
|
+
current?.deferred.fulfill();
|
|
200
|
+
this.aiAssistantInvalidations.delete(key);
|
|
201
|
+
},
|
|
202
|
+
5 * 60 * 1000,
|
|
203
|
+
);
|
|
204
|
+
this.aiAssistantInvalidationWaiters.set(key, {
|
|
205
|
+
unsubscribe,
|
|
206
|
+
timeoutId,
|
|
207
|
+
});
|
|
208
|
+
return clientRequestId;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private cleanupInvalidationWaiter(key: string) {
|
|
212
|
+
let waiter = this.aiAssistantInvalidationWaiters.get(key);
|
|
213
|
+
if (!waiter) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
waiter.unsubscribe();
|
|
217
|
+
clearTimeout(waiter.timeoutId);
|
|
218
|
+
this.aiAssistantInvalidationWaiters.delete(key);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async waitForInvalidationAfterAIAssistantRequest(
|
|
222
|
+
roomId: string,
|
|
223
|
+
targetHref: string,
|
|
224
|
+
timeoutMs?: number,
|
|
225
|
+
): Promise<void> {
|
|
226
|
+
if (!roomId || !targetHref) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
let normalizedTarget = targetHref.endsWith('.json')
|
|
230
|
+
? targetHref.replace(/\.json$/, '')
|
|
231
|
+
: targetHref;
|
|
232
|
+
let key = `${roomId}::${normalizedTarget}`;
|
|
233
|
+
let existing = this.aiAssistantInvalidations.get(key);
|
|
234
|
+
if (!existing) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
let waitPromise: Promise<void> = existing.deferred.promise;
|
|
239
|
+
if (timeoutMs) {
|
|
240
|
+
waitPromise = Promise.race([
|
|
241
|
+
waitPromise,
|
|
242
|
+
delay(timeoutMs).then(() => {}),
|
|
243
|
+
]);
|
|
244
|
+
}
|
|
245
|
+
await waitPromise;
|
|
246
|
+
this.aiAssistantInvalidations.delete(key);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public queueEventForCommandProcessing(event: Partial<IEvent>) {
|
|
250
|
+
let eventId = event.event_id;
|
|
251
|
+
if (event.content?.['m.relates_to']?.rel_type === 'm.replace') {
|
|
252
|
+
eventId = event.content?.['m.relates_to']!.event_id;
|
|
253
|
+
}
|
|
254
|
+
if (!eventId) {
|
|
255
|
+
throw new Error(
|
|
256
|
+
'No event id found for event with commands, this should not happen',
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
let roomId = event.room_id;
|
|
260
|
+
if (!roomId) {
|
|
261
|
+
throw new Error(
|
|
262
|
+
'No room id found for event with commands, this should not happen',
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
let compoundKey = `${roomId}|${eventId}`;
|
|
266
|
+
if (this.commandProcessingEventQueue.includes(compoundKey)) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
this.commandProcessingEventQueue.push(compoundKey);
|
|
271
|
+
|
|
272
|
+
debounce(this, this.drainCommandProcessingQueue, 100);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
public queueEventForCodePatchProcessing(event: Partial<IEvent>) {
|
|
276
|
+
let eventId = event.event_id;
|
|
277
|
+
if (event.content?.['m.relates_to']?.rel_type === 'm.replace') {
|
|
278
|
+
eventId = event.content?.['m.relates_to']!.event_id;
|
|
279
|
+
}
|
|
280
|
+
if (!eventId) {
|
|
281
|
+
throw new Error(
|
|
282
|
+
'No event id found for event with code patches, this should not happen',
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
let roomId = event.room_id;
|
|
286
|
+
if (!roomId) {
|
|
287
|
+
throw new Error(
|
|
288
|
+
'No room id found for event with code patches, this should not happen',
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
let compoundKey = `${roomId}|${eventId}`;
|
|
292
|
+
if (this.codePatchProcessingEventQueue.includes(compoundKey)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
this.codePatchProcessingEventQueue.push(compoundKey);
|
|
297
|
+
|
|
298
|
+
debounce(this, this.drainCodePatchProcessingQueue, 100);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private async drainCommandProcessingQueue() {
|
|
302
|
+
let waiterToken = commandProcessingWaiter.beginAsync();
|
|
303
|
+
try {
|
|
304
|
+
await this.flushCommandProcessingQueue;
|
|
305
|
+
|
|
306
|
+
let finishedProcessingCommands: () => void;
|
|
307
|
+
this.flushCommandProcessingQueue = new Promise(
|
|
308
|
+
(res) => (finishedProcessingCommands = res),
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
let commandSpecs = [...this.commandProcessingEventQueue];
|
|
312
|
+
this.commandProcessingEventQueue = [];
|
|
313
|
+
|
|
314
|
+
while (commandSpecs.length > 0) {
|
|
315
|
+
let [roomId, eventId] = commandSpecs.shift()!.split('|');
|
|
316
|
+
|
|
317
|
+
let roomResource = this.matrixService.roomResources.get(roomId!);
|
|
318
|
+
if (!roomResource) {
|
|
319
|
+
throw new Error(
|
|
320
|
+
`Room resource not found for room id ${roomId}, this should not happen`,
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
let timeout = Date.now() + 60_000; // reset the timer to avoid a long wait if the room resource is processing
|
|
324
|
+
let currentRoomProcessingTimestamp =
|
|
325
|
+
roomResource.processingLastStartedAt;
|
|
326
|
+
while (
|
|
327
|
+
roomResource.isProcessing &&
|
|
328
|
+
currentRoomProcessingTimestamp ===
|
|
329
|
+
roomResource.processingLastStartedAt &&
|
|
330
|
+
Date.now() < timeout
|
|
331
|
+
) {
|
|
332
|
+
// wait for the room resource to finish processing
|
|
333
|
+
await delay(100);
|
|
334
|
+
}
|
|
335
|
+
if (
|
|
336
|
+
roomResource.isProcessing &&
|
|
337
|
+
currentRoomProcessingTimestamp ===
|
|
338
|
+
roomResource.processingLastStartedAt
|
|
339
|
+
) {
|
|
340
|
+
// room seems to be stuck processing, so we will log and skip this event
|
|
341
|
+
console.error(
|
|
342
|
+
`Room resource for room ${roomId} seems to be stuck processing, skipping event ${eventId}`,
|
|
343
|
+
);
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
let message = roomResource.messages.find((m) => m.eventId === eventId);
|
|
348
|
+
if (!message) {
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (message.agentId !== this.matrixService.agentId) {
|
|
352
|
+
// This command was sent by another agent, so we will not auto-execute it
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Collect all ready commands for this message
|
|
357
|
+
let readyCommands: any[] = [];
|
|
358
|
+
for (let messageCommand of message.commands) {
|
|
359
|
+
if (
|
|
360
|
+
this.currentlyExecutingCommandRequestIds.has(messageCommand.id!)
|
|
361
|
+
) {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (this.executedCommandRequestIds.has(messageCommand.id!)) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (
|
|
368
|
+
messageCommand.status === 'applied' ||
|
|
369
|
+
messageCommand.status === 'invalid'
|
|
370
|
+
) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (!messageCommand.name) {
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
let isValid = await this.validate(messageCommand);
|
|
378
|
+
if (!isValid) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Get the LLM mode that was active when this message was created
|
|
383
|
+
let messageTimestamp = message.created.getTime();
|
|
384
|
+
let activeModeAtMessageTime =
|
|
385
|
+
roomResource.getActiveLLMModeAtTimestamp(messageTimestamp);
|
|
386
|
+
|
|
387
|
+
// Auto-execute if LLM mode is 'act' AND the command came after the LLM mode was set to 'act',
|
|
388
|
+
// or if requiresApproval is false
|
|
389
|
+
let shouldAutoExecute = false;
|
|
390
|
+
let isCheckCorrectnessCommand =
|
|
391
|
+
messageCommand.name === CHECK_CORRECTNESS_COMMAND_NAME;
|
|
392
|
+
|
|
393
|
+
if (
|
|
394
|
+
isCheckCorrectnessCommand ||
|
|
395
|
+
messageCommand.requiresApproval === false ||
|
|
396
|
+
activeModeAtMessageTime === 'act'
|
|
397
|
+
) {
|
|
398
|
+
shouldAutoExecute = true;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (shouldAutoExecute) {
|
|
402
|
+
readyCommands.push(messageCommand);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Execute ready commands, tracking accept-all state if multiple commands
|
|
407
|
+
if (readyCommands.length > 0) {
|
|
408
|
+
// This is an "accept all" operation - multiple commands ready for execution
|
|
409
|
+
this.acceptingAllRoomIds.add(roomId!);
|
|
410
|
+
try {
|
|
411
|
+
for (let command of readyCommands) {
|
|
412
|
+
this.run.perform(command);
|
|
413
|
+
}
|
|
414
|
+
} finally {
|
|
415
|
+
this.acceptingAllRoomIds.delete(roomId!);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
finishedProcessingCommands!();
|
|
420
|
+
} finally {
|
|
421
|
+
commandProcessingWaiter.endAsync(waiterToken);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
private async drainCodePatchProcessingQueue() {
|
|
426
|
+
let waiterToken = commandProcessingWaiter.beginAsync();
|
|
427
|
+
try {
|
|
428
|
+
await this.flushCodePatchProcessingQueue;
|
|
429
|
+
|
|
430
|
+
let finishedProcessingCodePatches: () => void;
|
|
431
|
+
this.flushCodePatchProcessingQueue = new Promise(
|
|
432
|
+
(res) => (finishedProcessingCodePatches = res),
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
let codePatchSpecs = [...this.codePatchProcessingEventQueue];
|
|
436
|
+
this.codePatchProcessingEventQueue = [];
|
|
437
|
+
|
|
438
|
+
while (codePatchSpecs.length > 0) {
|
|
439
|
+
let [roomId, eventId] = codePatchSpecs.shift()!.split('|');
|
|
440
|
+
|
|
441
|
+
let roomResource = this.matrixService.roomResources.get(roomId!);
|
|
442
|
+
if (!roomResource) {
|
|
443
|
+
throw new Error(
|
|
444
|
+
`Room resource not found for room id ${roomId}, this should not happen`,
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
let timeout = Date.now() + 60_000; // reset the timer to avoid a long wait if the room resource is processing
|
|
448
|
+
let currentRoomProcessingTimestamp =
|
|
449
|
+
roomResource.processingLastStartedAt;
|
|
450
|
+
while (
|
|
451
|
+
roomResource.isProcessing &&
|
|
452
|
+
currentRoomProcessingTimestamp ===
|
|
453
|
+
roomResource.processingLastStartedAt &&
|
|
454
|
+
Date.now() < timeout
|
|
455
|
+
) {
|
|
456
|
+
// wait for the room resource to finish processing
|
|
457
|
+
await delay(100);
|
|
458
|
+
}
|
|
459
|
+
if (
|
|
460
|
+
roomResource.isProcessing &&
|
|
461
|
+
currentRoomProcessingTimestamp ===
|
|
462
|
+
roomResource.processingLastStartedAt
|
|
463
|
+
) {
|
|
464
|
+
// room seems to be stuck processing, so we will log and skip this event
|
|
465
|
+
console.error(
|
|
466
|
+
`Room resource for room ${roomId} seems to be stuck processing, skipping code patch event ${eventId}`,
|
|
467
|
+
);
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
let message = roomResource.messages.find((m) => m.eventId === eventId);
|
|
471
|
+
if (!message) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
if (message.agentId !== this.matrixService.agentId) {
|
|
475
|
+
// This code patch was sent by another agent, so we will not auto-execute it
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Get the LLM mode that was active when this message was created
|
|
480
|
+
let messageTimestamp = message.created.getTime();
|
|
481
|
+
let activeModeAtMessageTime =
|
|
482
|
+
roomResource.getActiveLLMModeAtTimestamp(messageTimestamp);
|
|
483
|
+
// Only auto-apply if in 'act' mode
|
|
484
|
+
if (activeModeAtMessageTime !== 'act') {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Auto-apply all ready code patches from this message
|
|
489
|
+
if (message.htmlParts) {
|
|
490
|
+
let readyCodePatches = this.getReadyCodePatches(message.htmlParts);
|
|
491
|
+
let uniqueFiles = new Set(
|
|
492
|
+
readyCodePatches.map((patch) => patch.fileUrl),
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
if (readyCodePatches.length > 0 || uniqueFiles.size > 0) {
|
|
496
|
+
// This is an "accept all" operation - multiple patches OR patches across multiple files
|
|
497
|
+
this.acceptingAllRoomIds.add(roomId!);
|
|
498
|
+
try {
|
|
499
|
+
await this.executeReadyCodePatches(roomId!, message.htmlParts);
|
|
500
|
+
} finally {
|
|
501
|
+
this.acceptingAllRoomIds.delete(roomId!);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
finishedProcessingCodePatches!();
|
|
507
|
+
} finally {
|
|
508
|
+
commandProcessingWaiter.endAsync(waiterToken);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
get commandContext(): CommandContext {
|
|
513
|
+
let result = {
|
|
514
|
+
[CommandContextStamp]: true,
|
|
515
|
+
};
|
|
516
|
+
setOwner(result, getOwner(this)!);
|
|
517
|
+
|
|
518
|
+
return result;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// CS-11045: Find the bot message in current room state that currently owns
|
|
522
|
+
// the given commandRequestId. Walks events newest-first so the latest event
|
|
523
|
+
// wins (handles the streaming → m.replace shape: the original streaming
|
|
524
|
+
// event and later replace events both carry the commandRequests array; the
|
|
525
|
+
// latest replace is the one ai-bot's /messages view agrees on).
|
|
526
|
+
private getCurrentEventIdForCommandRequest(
|
|
527
|
+
roomId: string | undefined,
|
|
528
|
+
commandRequestId: string | undefined,
|
|
529
|
+
): string | undefined {
|
|
530
|
+
if (!roomId || !commandRequestId) {
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
let roomResource = this.matrixService.roomResources.get(roomId);
|
|
534
|
+
if (!roomResource) {
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
537
|
+
let events = roomResource.events;
|
|
538
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
539
|
+
let e = events[i] as any;
|
|
540
|
+
if (e?.type !== 'm.room.message') {
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
let requests = e.content?.[APP_BOXEL_COMMAND_REQUESTS_KEY];
|
|
544
|
+
if (
|
|
545
|
+
Array.isArray(requests) &&
|
|
546
|
+
requests.some((r: any) => r?.id === commandRequestId)
|
|
547
|
+
) {
|
|
548
|
+
return e.event_id;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return undefined;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
//TODO: Convert to non-EC async method after fixing CS-6987
|
|
555
|
+
run = task(async (command: MessageCommand) => {
|
|
556
|
+
let { arguments: payload, id: commandRequestId } = command;
|
|
557
|
+
// CS-11045: Source the bot-message event_id from current room state at
|
|
558
|
+
// execute time rather than the snapshot taken when the MessageCommand was
|
|
559
|
+
// constructed. The snapshot is the streaming/original event_id; once a
|
|
560
|
+
// later m.replace event in room.events owns the commandRequest, that
|
|
561
|
+
// event's id is the canonical link the rest of the system (including
|
|
562
|
+
// ai-bot's view of /messages) will agree on. Fall back to the snapshot if
|
|
563
|
+
// no matching event is found in current room state.
|
|
564
|
+
let eventId =
|
|
565
|
+
this.getCurrentEventIdForCommandRequest(
|
|
566
|
+
command.message.roomId,
|
|
567
|
+
commandRequestId,
|
|
568
|
+
) ?? command.eventId;
|
|
569
|
+
let resultCard: CardDef | undefined;
|
|
570
|
+
// There may be some race conditions where the command is already being executed when this task starts
|
|
571
|
+
if (
|
|
572
|
+
this.currentlyExecutingCommandRequestIds.has(commandRequestId!) ||
|
|
573
|
+
this.executedCommandRequestIds.has(commandRequestId!)
|
|
574
|
+
) {
|
|
575
|
+
return; // already executing this command
|
|
576
|
+
}
|
|
577
|
+
try {
|
|
578
|
+
this.matrixService.failedCommandState.delete(commandRequestId!);
|
|
579
|
+
this.currentlyExecutingCommandRequestIds.add(commandRequestId!);
|
|
580
|
+
|
|
581
|
+
let commandToRun;
|
|
582
|
+
|
|
583
|
+
// If we don't find it in the one-offs, start searching for
|
|
584
|
+
// one in the skills we can construct
|
|
585
|
+
let commandCodeRef = command.codeRef;
|
|
586
|
+
if (commandCodeRef) {
|
|
587
|
+
let CommandConstructor = (await getClass(
|
|
588
|
+
commandCodeRef,
|
|
589
|
+
this.loaderService.loader,
|
|
590
|
+
)) as { new (context: CommandContext): Command<any, any> };
|
|
591
|
+
commandToRun = new CommandConstructor(this.commandContext);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (!commandToRun && command.name === CHECK_CORRECTNESS_COMMAND_NAME) {
|
|
595
|
+
commandToRun = new CheckCorrectnessCommand(this.commandContext);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (commandToRun) {
|
|
599
|
+
let typedInput = await this.instantiateCommandInput(
|
|
600
|
+
commandToRun,
|
|
601
|
+
payload?.attributes,
|
|
602
|
+
payload?.relationships,
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
[resultCard] = await all([
|
|
606
|
+
await commandToRun.execute(typedInput as any),
|
|
607
|
+
await timeout(DELAY_FOR_APPLYING_UI), // leave a beat for the "applying" state of the UI to be shown
|
|
608
|
+
]);
|
|
609
|
+
} else if (command.name === 'patchCardInstance') {
|
|
610
|
+
if (!hasPatchData(payload)) {
|
|
611
|
+
throw new Error(
|
|
612
|
+
"Patch command can't run because it doesn't have all the fields in arguments returned by open ai",
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
let cardId = payload.attributes.cardId;
|
|
616
|
+
|
|
617
|
+
let clientRequestId = this.trackAiAssistantCardRequest({
|
|
618
|
+
action: 'patch-instance',
|
|
619
|
+
roomId: command.message.roomId,
|
|
620
|
+
fileUrl: `${cardId}.json`,
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
await this.store.patch(
|
|
624
|
+
cardId,
|
|
625
|
+
{
|
|
626
|
+
attributes: payload?.attributes?.patch?.attributes,
|
|
627
|
+
relationships: payload?.attributes?.patch?.relationships,
|
|
628
|
+
},
|
|
629
|
+
{ doNotWaitForPersist: true, clientRequestId },
|
|
630
|
+
);
|
|
631
|
+
} else {
|
|
632
|
+
// Unrecognized command. This can happen if a programmatically-provided command is no longer available due to a browser refresh.
|
|
633
|
+
throw new Error(
|
|
634
|
+
`Unrecognized command: ${command.name}. This command may have been associated with a previous browser session.`,
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
this.executedCommandRequestIds.add(commandRequestId!);
|
|
638
|
+
await this.matrixService.updateSkillsAndCommandsIfNeeded(
|
|
639
|
+
command.message.roomId,
|
|
640
|
+
);
|
|
641
|
+
let userContextForAiBot =
|
|
642
|
+
await this.operatorModeStateService.getSummaryForAIBot();
|
|
643
|
+
|
|
644
|
+
await this.matrixService.sendCommandResultEvent({
|
|
645
|
+
roomId: command.message.roomId,
|
|
646
|
+
invokedToolFromEventId: eventId,
|
|
647
|
+
toolCallId: commandRequestId!,
|
|
648
|
+
status: 'applied',
|
|
649
|
+
resultCard,
|
|
650
|
+
context: userContextForAiBot,
|
|
651
|
+
});
|
|
652
|
+
} catch (e) {
|
|
653
|
+
let error =
|
|
654
|
+
typeof e === 'string'
|
|
655
|
+
? new Error(e)
|
|
656
|
+
: e instanceof Error
|
|
657
|
+
? e
|
|
658
|
+
: new Error('Command failed.');
|
|
659
|
+
console.error(error);
|
|
660
|
+
await timeout(DELAY_FOR_APPLYING_UI); // leave a beat for the "applying" state of the UI to be shown
|
|
661
|
+
this.matrixService.failedCommandState.set(commandRequestId!, error);
|
|
662
|
+
} finally {
|
|
663
|
+
this.currentlyExecutingCommandRequestIds.delete(commandRequestId!);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
async validate(command: MessageCommand): Promise<boolean> {
|
|
668
|
+
let error: string | undefined;
|
|
669
|
+
if (!command.name) {
|
|
670
|
+
console.warn(
|
|
671
|
+
`Command with id ${command.id} has no name, skipping validation`,
|
|
672
|
+
);
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
if (command.name === 'patchCardInstance') {
|
|
677
|
+
// special case for patchCardInstance command
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
let commandCodeRef = command.codeRef;
|
|
682
|
+
let commandInstance: GenericCommand | undefined;
|
|
683
|
+
|
|
684
|
+
if (command.name === CHECK_CORRECTNESS_COMMAND_NAME) {
|
|
685
|
+
commandInstance = new CheckCorrectnessCommand(this.commandContext);
|
|
686
|
+
} else if (!commandCodeRef) {
|
|
687
|
+
error = `No command for the name "${command.name}" was found`;
|
|
688
|
+
} else {
|
|
689
|
+
let CommandConstructor = (await getClass(
|
|
690
|
+
commandCodeRef,
|
|
691
|
+
this.loaderService.loader,
|
|
692
|
+
)) as { new (context: CommandContext): Command<any, any> };
|
|
693
|
+
if (!CommandConstructor) {
|
|
694
|
+
error = `No command for the name "${command.name}" was found`;
|
|
695
|
+
} else {
|
|
696
|
+
commandInstance = new CommandConstructor(this.commandContext);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
if (commandInstance && !error) {
|
|
701
|
+
let loader = (
|
|
702
|
+
getOwner(this.commandContext)!.lookup(
|
|
703
|
+
'service:loader-service',
|
|
704
|
+
) as LoaderService
|
|
705
|
+
).loader;
|
|
706
|
+
let mappings = await basicMappings(loader);
|
|
707
|
+
let jsonSchema = {
|
|
708
|
+
type: 'object',
|
|
709
|
+
properties: {
|
|
710
|
+
description: {
|
|
711
|
+
type: 'string',
|
|
712
|
+
},
|
|
713
|
+
...(await commandInstance.getInputJsonSchema(
|
|
714
|
+
this.matrixService.cardAPI,
|
|
715
|
+
mappings,
|
|
716
|
+
)),
|
|
717
|
+
},
|
|
718
|
+
required: ['attributes', 'description'],
|
|
719
|
+
additionalProperties: false,
|
|
720
|
+
};
|
|
721
|
+
const ajv = new Ajv();
|
|
722
|
+
const valid = ajv.validate(jsonSchema, command.arguments);
|
|
723
|
+
if (!valid) {
|
|
724
|
+
error = `Command "${command.name}" validation failed: ${ajv.errorsText()}`;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (error) {
|
|
728
|
+
// CS-11045: Same canonical-event-id resolution as the run task — emit
|
|
729
|
+
// the invalid commandResult linked to the bot-message event currently
|
|
730
|
+
// owning the commandRequest in room state, so ai-bot's /messages view
|
|
731
|
+
// and the host's own m.replace-aware bookkeeping agree on the linkage.
|
|
732
|
+
let invokedToolFromEventId =
|
|
733
|
+
this.getCurrentEventIdForCommandRequest(
|
|
734
|
+
command.message.roomId,
|
|
735
|
+
command.commandRequest.id,
|
|
736
|
+
) ?? command.eventId;
|
|
737
|
+
await this.matrixService.sendCommandResultEvent({
|
|
738
|
+
roomId: command.message.roomId,
|
|
739
|
+
invokedToolFromEventId,
|
|
740
|
+
toolCallId: command.commandRequest.id!,
|
|
741
|
+
status: 'invalid',
|
|
742
|
+
failureReason: error,
|
|
743
|
+
context: await this.operatorModeStateService.getSummaryForAIBot(),
|
|
744
|
+
});
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return true;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// Construct a new instance of the input type with the
|
|
752
|
+
// The input is undefined if the command has no input type
|
|
753
|
+
private async instantiateCommandInput(
|
|
754
|
+
command: GenericCommand,
|
|
755
|
+
attributes: Record<string, any> | undefined,
|
|
756
|
+
relationships: Record<string, any> | undefined,
|
|
757
|
+
) {
|
|
758
|
+
// Get the input type and validate/construct the payload
|
|
759
|
+
let typedInput;
|
|
760
|
+
let InputType = await command.getInputType();
|
|
761
|
+
if (InputType) {
|
|
762
|
+
let adoptsFrom = identifyCard(InputType);
|
|
763
|
+
if (adoptsFrom) {
|
|
764
|
+
let inputDoc = {
|
|
765
|
+
type: 'card',
|
|
766
|
+
data: {
|
|
767
|
+
meta: {
|
|
768
|
+
adoptsFrom,
|
|
769
|
+
},
|
|
770
|
+
attributes: attributes ?? {},
|
|
771
|
+
relationships: relationships ?? {},
|
|
772
|
+
},
|
|
773
|
+
};
|
|
774
|
+
typedInput = await this.store.add(inputDoc, { doNotPersist: true });
|
|
775
|
+
} else {
|
|
776
|
+
// identifyCard can fail in some circumstances where the input type is not exported
|
|
777
|
+
// in that case, we'll fall back to this less reliable method of constructing the input type
|
|
778
|
+
typedInput = new InputType({ ...attributes, ...relationships });
|
|
779
|
+
}
|
|
780
|
+
} else {
|
|
781
|
+
typedInput = undefined;
|
|
782
|
+
}
|
|
783
|
+
return typedInput;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
patchCode = async (
|
|
787
|
+
roomId: string,
|
|
788
|
+
fileUrl: string | null,
|
|
789
|
+
codeDataItems: {
|
|
790
|
+
searchReplaceBlock?: string | null;
|
|
791
|
+
eventId: string;
|
|
792
|
+
codeBlockIndex: number;
|
|
793
|
+
}[],
|
|
794
|
+
) => {
|
|
795
|
+
if (!fileUrl) {
|
|
796
|
+
throw new Error('File URL is required to patch code');
|
|
797
|
+
}
|
|
798
|
+
for (const codeData of codeDataItems) {
|
|
799
|
+
this.currentlyExecutingCommandRequestIds.add(
|
|
800
|
+
`${codeData.eventId}:${codeData.codeBlockIndex}`,
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
// Give Glimmer one render turn to reflect the "applying" state before we
|
|
804
|
+
// start mutating files and emitting result events.
|
|
805
|
+
await new Promise<void>((resolve) => schedule('afterRender', resolve));
|
|
806
|
+
let finalFileIdentifier: string | undefined;
|
|
807
|
+
|
|
808
|
+
try {
|
|
809
|
+
let patchCodeCommand = new PatchCodeCommand(this.commandContext);
|
|
810
|
+
|
|
811
|
+
let patchCodeResult = await patchCodeCommand.execute({
|
|
812
|
+
fileIdentifier: fileUrl,
|
|
813
|
+
codeBlocks: codeDataItems.map(
|
|
814
|
+
(codeData) => codeData.searchReplaceBlock!,
|
|
815
|
+
),
|
|
816
|
+
roomId,
|
|
817
|
+
});
|
|
818
|
+
finalFileIdentifier = patchCodeResult.finalFileIdentifier;
|
|
819
|
+
|
|
820
|
+
for (let i = 0; i < codeDataItems.length; i++) {
|
|
821
|
+
const codeData = codeDataItems[i];
|
|
822
|
+
const patchResult = patchCodeResult.results[i];
|
|
823
|
+
if (patchResult.status === 'applied') {
|
|
824
|
+
this.executedCommandRequestIds.add(
|
|
825
|
+
`${codeData.eventId}:${codeData.codeBlockIndex}`,
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
await this.matrixService.updateSkillsAndCommandsIfNeeded(roomId);
|
|
831
|
+
let fileDef = this.matrixService.fileAPI.createFileDef({
|
|
832
|
+
sourceUrl: finalFileIdentifier ?? fileUrl,
|
|
833
|
+
name: fileUrl.split('/').pop(),
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
let context = await this.operatorModeStateService.getSummaryForAIBot();
|
|
837
|
+
|
|
838
|
+
let resultSends: Promise<unknown>[] = [];
|
|
839
|
+
for (let i = 0; i < codeDataItems.length; i++) {
|
|
840
|
+
const codeData = codeDataItems[i];
|
|
841
|
+
const result = patchCodeResult.results[i];
|
|
842
|
+
resultSends.push(
|
|
843
|
+
this.matrixService.sendCodePatchResultEvent(
|
|
844
|
+
roomId,
|
|
845
|
+
codeData.eventId,
|
|
846
|
+
codeData.codeBlockIndex,
|
|
847
|
+
result.status as CodePatchStatus,
|
|
848
|
+
[],
|
|
849
|
+
[fileDef],
|
|
850
|
+
context,
|
|
851
|
+
patchCodeResult.lintIssues,
|
|
852
|
+
result.failureReason,
|
|
853
|
+
),
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
await Promise.all(resultSends);
|
|
857
|
+
} finally {
|
|
858
|
+
// remove the code blocks from the currently executing command request ids
|
|
859
|
+
for (const codeData of codeDataItems) {
|
|
860
|
+
this.currentlyExecutingCommandRequestIds.delete(
|
|
861
|
+
`${codeData.eventId}:${codeData.codeBlockIndex}`,
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
getReadyCodePatches = (
|
|
868
|
+
htmlParts: Array<{ codeData: CodeData | null }>,
|
|
869
|
+
): CodeData[] => {
|
|
870
|
+
let result: CodeData[] = [];
|
|
871
|
+
for (let i = 0; i < htmlParts.length; i++) {
|
|
872
|
+
let htmlPart = htmlParts[i];
|
|
873
|
+
let codeData = htmlPart.codeData;
|
|
874
|
+
if (!codeData || !codeData.searchReplaceBlock) continue;
|
|
875
|
+
let status = this.getCodePatchStatus(codeData);
|
|
876
|
+
if (status && status === 'ready') {
|
|
877
|
+
result.push(codeData);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return result;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
executeReadyCodePatches = async (
|
|
884
|
+
roomId: string,
|
|
885
|
+
htmlParts: Array<{ codeData: CodeData | null }>,
|
|
886
|
+
) => {
|
|
887
|
+
let readyCodePatches = this.getReadyCodePatches(htmlParts);
|
|
888
|
+
|
|
889
|
+
// Group code patches by fileUrl and apply them
|
|
890
|
+
let grouped: Record<string, CodeData[]> = {};
|
|
891
|
+
for (let codeData of readyCodePatches) {
|
|
892
|
+
if (!codeData.fileUrl) continue;
|
|
893
|
+
if (!grouped[codeData.fileUrl]) grouped[codeData.fileUrl] = [];
|
|
894
|
+
grouped[codeData.fileUrl].push(codeData);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
for (let [fileUrl, codeDataItems] of Object.entries(grouped)) {
|
|
898
|
+
let patchItems = codeDataItems.map((codeData) => ({
|
|
899
|
+
searchReplaceBlock: codeData.searchReplaceBlock,
|
|
900
|
+
eventId: codeData.eventId,
|
|
901
|
+
codeBlockIndex: codeData.codeBlockIndex,
|
|
902
|
+
}));
|
|
903
|
+
await this.patchCode(roomId, fileUrl, patchItems);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
private isCodeBlockApplying(codeData: {
|
|
908
|
+
eventId: string;
|
|
909
|
+
codeBlockIndex: number;
|
|
910
|
+
}) {
|
|
911
|
+
return this.currentlyExecutingCommandRequestIds.has(
|
|
912
|
+
`${codeData.eventId}:${codeData.codeBlockIndex}`,
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
private isCodeBlockRecentlyApplied(codeBlock: {
|
|
917
|
+
eventId: string;
|
|
918
|
+
codeBlockIndex: number;
|
|
919
|
+
}) {
|
|
920
|
+
return this.executedCommandRequestIds.has(
|
|
921
|
+
`${codeBlock.eventId}:${codeBlock.codeBlockIndex}`,
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
getCodePatchStatus = (codeData: {
|
|
926
|
+
roomId: string;
|
|
927
|
+
eventId: string;
|
|
928
|
+
codeBlockIndex: number;
|
|
929
|
+
}): CodePatchStatus | 'applying' | 'ready' => {
|
|
930
|
+
if (this.isCodeBlockApplying(codeData)) {
|
|
931
|
+
return 'applying';
|
|
932
|
+
}
|
|
933
|
+
if (this.isCodeBlockRecentlyApplied(codeData)) {
|
|
934
|
+
return 'applied';
|
|
935
|
+
}
|
|
936
|
+
return this.getCodePatchResult(codeData)?.status ?? 'ready';
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
getCodePatchResult = (codeData: {
|
|
940
|
+
roomId: string;
|
|
941
|
+
eventId: string;
|
|
942
|
+
codeBlockIndex: number;
|
|
943
|
+
}): MessageCodePatchResult | undefined => {
|
|
944
|
+
let roomResource = this.matrixService.roomResources.get(codeData.roomId);
|
|
945
|
+
if (!roomResource) {
|
|
946
|
+
return undefined;
|
|
947
|
+
}
|
|
948
|
+
let message = roomResource.messages.find(
|
|
949
|
+
(m) => m.eventId === codeData.eventId,
|
|
950
|
+
);
|
|
951
|
+
return message?.codePatchResults?.find(
|
|
952
|
+
(c) => c.index === codeData.codeBlockIndex,
|
|
953
|
+
);
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
isPerformingAcceptAllForRoom(roomId: string): boolean {
|
|
957
|
+
return this.acceptingAllRoomIds.has(roomId);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
type PatchPayload = { attributes: { cardId: string; patch: PatchData } };
|
|
962
|
+
|
|
963
|
+
function hasPatchData(payload: any): payload is PatchPayload {
|
|
964
|
+
return (
|
|
965
|
+
payload.attributes?.cardId &&
|
|
966
|
+
(payload.attributes?.patch?.attributes ||
|
|
967
|
+
payload.attributes?.patch?.relationships)
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
declare module '@ember/service' {
|
|
972
|
+
interface Registry {
|
|
973
|
+
'command-service': CommandService;
|
|
974
|
+
}
|
|
975
|
+
}
|