@theia/ai-core-ui 1.77.0-next.95 → 1.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/lib/browser/ai-configuration/ai-configuration-category-registry.d.ts +1 -1
  2. package/lib/browser/ai-configuration/ai-configuration-category-registry.d.ts.map +1 -1
  3. package/lib/browser/ai-configuration/ai-configuration-category-registry.js +11 -15
  4. package/lib/browser/ai-configuration/ai-configuration-category-registry.js.map +1 -1
  5. package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.js +35 -38
  6. package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.js.map +1 -1
  7. package/lib/browser/ai-configuration/ai-configuration-category.d.ts +1 -1
  8. package/lib/browser/ai-configuration/ai-configuration-category.d.ts.map +1 -1
  9. package/lib/browser/ai-configuration/ai-configuration-category.js +7 -10
  10. package/lib/browser/ai-configuration/ai-configuration-category.js.map +1 -1
  11. package/lib/browser/ai-configuration/ai-configuration-selection-model.d.ts +1 -1
  12. package/lib/browser/ai-configuration/ai-configuration-selection-model.d.ts.map +1 -1
  13. package/lib/browser/ai-configuration/ai-configuration-selection-model.js +7 -10
  14. package/lib/browser/ai-configuration/ai-configuration-selection-model.js.map +1 -1
  15. package/lib/browser/ai-configuration/ai-configuration-setting-commands.js +26 -32
  16. package/lib/browser/ai-configuration/ai-configuration-setting-commands.js.map +1 -1
  17. package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.js +20 -22
  18. package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.js.map +1 -1
  19. package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js +175 -178
  20. package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js.map +1 -1
  21. package/lib/browser/ai-configuration/components/ai-configuration-controls.js +26 -39
  22. package/lib/browser/ai-configuration/components/ai-configuration-controls.js.map +1 -1
  23. package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts +2 -2
  24. package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts.map +1 -1
  25. package/lib/browser/ai-configuration/components/ai-configuration-item-row.js +14 -19
  26. package/lib/browser/ai-configuration/components/ai-configuration-item-row.js.map +1 -1
  27. package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.js +18 -23
  28. package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.js.map +1 -1
  29. package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts +2 -2
  30. package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts.map +1 -1
  31. package/lib/browser/ai-configuration/components/ai-configuration-primitives.js +23 -38
  32. package/lib/browser/ai-configuration/components/ai-configuration-primitives.js.map +1 -1
  33. package/lib/browser/ai-configuration/components/ai-configuration-setting-row.js +23 -30
  34. package/lib/browser/ai-configuration/components/ai-configuration-setting-row.js.map +1 -1
  35. package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts +2 -2
  36. package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts.map +1 -1
  37. package/lib/browser/ai-configuration/components/ai-settings-row-service.js +38 -46
  38. package/lib/browser/ai-configuration/components/ai-settings-row-service.js.map +1 -1
  39. package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js +72 -74
  40. package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js.map +1 -1
  41. package/lib/browser/ai-configuration/components/ai-settings-row.d.ts +2 -2
  42. package/lib/browser/ai-configuration/components/ai-settings-row.d.ts.map +1 -1
  43. package/lib/browser/ai-configuration/components/ai-settings-row.js +15 -21
  44. package/lib/browser/ai-configuration/components/ai-settings-row.js.map +1 -1
  45. package/lib/browser/ai-configuration/components/collapsible-list.d.ts +1 -1
  46. package/lib/browser/ai-configuration/components/collapsible-list.d.ts.map +1 -1
  47. package/lib/browser/ai-configuration/components/collapsible-list.js +15 -21
  48. package/lib/browser/ai-configuration/components/collapsible-list.js.map +1 -1
  49. package/lib/browser/ai-configuration/components/prompt-customization-dialogs.js +13 -16
  50. package/lib/browser/ai-configuration/components/prompt-customization-dialogs.js.map +1 -1
  51. package/lib/browser/ai-configuration/components/variant-set-card.d.ts +1 -1
  52. package/lib/browser/ai-configuration/components/variant-set-card.d.ts.map +1 -1
  53. package/lib/browser/ai-configuration/components/variant-set-card.js +29 -34
  54. package/lib/browser/ai-configuration/components/variant-set-card.js.map +1 -1
  55. package/lib/browser/ai-configuration/renderers/collection-category-renderer.d.ts +1 -1
  56. package/lib/browser/ai-configuration/renderers/collection-category-renderer.d.ts.map +1 -1
  57. package/lib/browser/ai-configuration/renderers/collection-category-renderer.js +13 -17
  58. package/lib/browser/ai-configuration/renderers/collection-category-renderer.js.map +1 -1
  59. package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.js +18 -20
  60. package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.js.map +1 -1
  61. package/lib/browser/ai-configuration/renderers/single-page-category-renderer.d.ts +1 -1
  62. package/lib/browser/ai-configuration/renderers/single-page-category-renderer.d.ts.map +1 -1
  63. package/lib/browser/ai-configuration/renderers/single-page-category-renderer.js +3 -7
  64. package/lib/browser/ai-configuration/renderers/single-page-category-renderer.js.map +1 -1
  65. package/lib/browser/ai-core-ui-frontend-module.js +18 -20
  66. package/lib/browser/ai-core-ui-frontend-module.js.map +1 -1
  67. package/lib/package.spec.d.ts +1 -0
  68. package/lib/package.spec.js +1 -1
  69. package/lib/package.spec.js.map +1 -1
  70. package/package.json +14 -6
  71. package/src/browser/ai-configuration/ai-configuration-category-registry.spec.ts +2 -2
  72. package/src/browser/ai-configuration/ai-configuration-category-registry.ts +1 -1
  73. package/src/browser/ai-configuration/ai-configuration-category.ts +1 -1
  74. package/src/browser/ai-configuration/ai-configuration-selection-model.ts +1 -1
  75. package/src/browser/ai-configuration/ai-configuration-setting-commands.spec.ts +1 -1
  76. package/src/browser/ai-configuration/components/ai-configuration-components.spec.ts +9 -9
  77. package/src/browser/ai-configuration/components/ai-configuration-item-row.tsx +4 -4
  78. package/src/browser/ai-configuration/components/ai-configuration-primitives.tsx +2 -2
  79. package/src/browser/ai-configuration/components/ai-configuration-setting-row.tsx +1 -1
  80. package/src/browser/ai-configuration/components/ai-settings-row-service.spec.ts +1 -1
  81. package/src/browser/ai-configuration/components/ai-settings-row-service.ts +2 -2
  82. package/src/browser/ai-configuration/components/ai-settings-row.tsx +4 -4
  83. package/src/browser/ai-configuration/components/collapsible-list.tsx +2 -2
  84. package/src/browser/ai-configuration/components/variant-set-card.tsx +5 -5
  85. package/src/browser/ai-configuration/renderers/collection-category-renderer.spec.ts +2 -2
  86. package/src/browser/ai-configuration/renderers/collection-category-renderer.tsx +3 -3
  87. package/src/browser/ai-configuration/renderers/single-page-category-renderer.tsx +1 -1
  88. package/src/browser/ai-core-ui-frontend-module.ts +5 -5
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2026 EclipseSource and others.
4
3
  //
@@ -14,10 +13,8 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
20
- let disableJSDOM = (0, jsdom_1.enableJSDOM)();
16
+ import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
17
+ let disableJSDOM = enableJSDOM();
21
18
  // @lumino/dragdrop (pulled in transitively via `codicon` from `@theia/core/lib/browser`) extends the
22
19
  // DragEvent DOM global at module load, which JSDOM does not provide; stub it so the import succeeds.
23
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -26,19 +23,19 @@ if (!global.DragEvent) {
26
23
  global.DragEvent = class DragEvent extends global.Event {
27
24
  };
28
25
  }
29
- const chai_1 = require("chai");
30
- const React = tslib_1.__importStar(require("@theia/core/shared/react"));
31
- const react_dom_1 = require("@theia/core/shared/react-dom");
32
- const client_1 = require("@theia/core/shared/react-dom/client");
33
- const ai_configuration_item_row_1 = require("./ai-configuration-item-row");
34
- const ai_configuration_primitives_1 = require("./ai-configuration-primitives");
35
- const ai_configuration_origin_badge_1 = require("./ai-configuration-origin-badge");
36
- const ai_configuration_setting_row_1 = require("./ai-configuration-setting-row");
37
- const ai_configuration_controls_1 = require("./ai-configuration-controls");
38
- const browser_1 = require("@theia/core/lib/browser");
39
- const prompt_customization_dialogs_1 = require("./prompt-customization-dialogs");
40
- const variant_set_card_1 = require("./variant-set-card");
41
- const ai_settings_row_1 = require("./ai-settings-row");
26
+ import { expect } from 'chai';
27
+ import * as React from '@theia/core/shared/react';
28
+ import { flushSync } from '@theia/core/shared/react-dom';
29
+ import { createRoot } from '@theia/core/shared/react-dom/client';
30
+ import { AiConfigurationItemRow } from './ai-configuration-item-row.js';
31
+ import { AiConfigurationCallout, AiConfigurationEmptyState, AiConfigurationItemDetailHeader, AiConfigurationSection } from './ai-configuration-primitives.js';
32
+ import { AiConfigurationOrigin, AiConfigurationOriginBadge, AiConfigurationOriginBadges } from './ai-configuration-origin-badge.js';
33
+ import { AiConfigurationSettingRow } from './ai-configuration-setting-row.js';
34
+ import { AiArrayInput, AiEnumSelect, AiNumberStepper } from './ai-configuration-controls.js';
35
+ import { ConfirmDialog } from '@theia/core/lib/browser';
36
+ import { PromptCustomizationDialogs } from './prompt-customization-dialogs.js';
37
+ import { VariantSetCard } from './variant-set-card.js';
38
+ import { AiSettingsRow } from './ai-settings-row.js';
42
39
  disableJSDOM();
43
40
  /** Replaces the (single) input's text the way a keystroke does, and flushes the resulting render. */
44
41
  function typeInto(container, value) {
@@ -48,7 +45,7 @@ function typeInto(container, value) {
48
45
  // Assigning `value` directly goes through React's patched setter, which then treats the change as
49
46
  // already handled and never calls `onChange`; the prototype's setter is what a real keystroke uses.
50
47
  const nativeSetter = Object.getOwnPropertyDescriptor(view.HTMLInputElement.prototype, 'value').set;
51
- (0, react_dom_1.flushSync)(() => {
48
+ flushSync(() => {
52
49
  nativeSetter.call(input, value);
53
50
  input.dispatchEvent(new view.Event('input', { bubbles: true }));
54
51
  });
@@ -95,28 +92,28 @@ function textOf(node, into = []) {
95
92
  return into;
96
93
  }
97
94
  describe('AI Configuration primitives', () => {
98
- before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
95
+ before(() => disableJSDOM = enableJSDOM());
99
96
  after(() => disableJSDOM());
100
97
  /** Renders a component into a detached container; the caller disposes it. */
101
98
  function mount(element) {
102
99
  const container = document.createElement('div');
103
100
  document.body.appendChild(container);
104
- const root = (0, client_1.createRoot)(container);
105
- (0, react_dom_1.flushSync)(() => root.render(element));
106
- return { container, dispose: () => { (0, react_dom_1.flushSync)(() => root.unmount()); container.remove(); } };
101
+ const root = createRoot(container);
102
+ flushSync(() => root.render(element));
103
+ return { container, dispose: () => { flushSync(() => root.unmount()); container.remove(); } };
107
104
  }
108
105
  it('AiConfigurationCallout keeps a long message inside the box and repeats it on hover', () => {
109
106
  // A provider's failure ends up here verbatim, keys and URLs included, with nothing to wrap at.
110
107
  const message = '401 Incorrect API key provided: sk-proj-' + 'x'.repeat(120) + '. See https://platform.openai.com/account/api-keys.';
111
- const { container, dispose } = mount(React.createElement(ai_configuration_primitives_1.AiConfigurationCallout, {
108
+ const { container, dispose } = mount(React.createElement(AiConfigurationCallout, {
112
109
  message,
113
110
  action: React.createElement('button', {}, 'Retry')
114
111
  }));
115
112
  try {
116
113
  const text = container.querySelector('.ai-configuration-callout-text');
117
- (0, chai_1.expect)(text.title).to.equal(message);
114
+ expect(text.title).to.equal(message);
118
115
  // The action stays a sibling of the text rather than being pushed out of the row.
119
- (0, chai_1.expect)(container.querySelector('.ai-configuration-callout button')?.textContent).to.equal('Retry');
116
+ expect(container.querySelector('.ai-configuration-callout button')?.textContent).to.equal('Retry');
120
117
  }
121
118
  finally {
122
119
  dispose();
@@ -125,61 +122,61 @@ describe('AI Configuration primitives', () => {
125
122
  it('AiEnumSelect passes a separator on as one, not as a selectable option', () => {
126
123
  // A separator that loses its flag on the way to SelectComponent becomes a selectable entry with
127
124
  // no label, and picking it commits the empty value. The field skipping it is what says it did not.
128
- const { container, dispose } = mount(React.createElement(ai_configuration_controls_1.AiEnumSelect, {
125
+ const { container, dispose } = mount(React.createElement(AiEnumSelect, {
129
126
  value: undefined,
130
127
  options: [{ value: '', label: '', separator: true }, { value: 'a', label: 'A' }],
131
128
  ariaLabel: 'Model',
132
129
  onCommit: () => { }
133
130
  }));
134
131
  try {
135
- (0, chai_1.expect)(container.querySelector('.theia-select-component-label')?.textContent).to.equal('A');
132
+ expect(container.querySelector('.theia-select-component-label')?.textContent).to.equal('A');
136
133
  }
137
134
  finally {
138
135
  dispose();
139
136
  }
140
137
  });
141
138
  it('AiConfigurationSection renders its title and children', () => {
142
- const { container, dispose } = mount(React.createElement(ai_configuration_primitives_1.AiConfigurationSection, { title: 'General', children: React.createElement('span', {}, 'row') }));
139
+ const { container, dispose } = mount(React.createElement(AiConfigurationSection, { title: 'General', children: React.createElement('span', {}, 'row') }));
143
140
  try {
144
- (0, chai_1.expect)(Boolean(container.querySelector('.ai-configuration-section'))).to.equal(true);
145
- (0, chai_1.expect)(container.textContent).to.include('General').and.to.include('row');
141
+ expect(Boolean(container.querySelector('.ai-configuration-section'))).to.equal(true);
142
+ expect(container.textContent).to.include('General').and.to.include('row');
146
143
  // Not foldable unless asked: no chevron, and the content is not gated behind one.
147
- (0, chai_1.expect)(Boolean(container.querySelector('.ai-configuration-section-chevron'))).to.equal(false);
144
+ expect(Boolean(container.querySelector('.ai-configuration-section-chevron'))).to.equal(false);
148
145
  }
149
146
  finally {
150
147
  dispose();
151
148
  }
152
149
  });
153
150
  it('AiConfigurationSection shows an entry count next to the title', () => {
154
- const { container, dispose } = mount(React.createElement(ai_configuration_primitives_1.AiConfigurationSection, { title: 'Skills', count: 14, children: React.createElement('span', {}, 'row') }));
151
+ const { container, dispose } = mount(React.createElement(AiConfigurationSection, { title: 'Skills', count: 14, children: React.createElement('span', {}, 'row') }));
155
152
  try {
156
- (0, chai_1.expect)(container.querySelector('.ai-configuration-section-count')?.textContent).to.equal('14');
153
+ expect(container.querySelector('.ai-configuration-section-count')?.textContent).to.equal('14');
157
154
  }
158
155
  finally {
159
156
  dispose();
160
157
  }
161
158
  });
162
159
  it('AiConfigurationSection folds its content away when collapsible, starting expanded', () => {
163
- const { container, dispose } = mount(React.createElement(ai_configuration_primitives_1.AiConfigurationSection, { title: 'Skills', collapsible: true, children: React.createElement('span', {}, 'row') }));
160
+ const { container, dispose } = mount(React.createElement(AiConfigurationSection, { title: 'Skills', collapsible: true, children: React.createElement('span', {}, 'row') }));
164
161
  try {
165
162
  const header = container.querySelector('.ai-configuration-section-title.foldable');
166
163
  // Browsing pages open showing their content; folding is the user's choice.
167
- (0, chai_1.expect)(header?.getAttribute('aria-expanded')).to.equal('true');
168
- (0, chai_1.expect)(container.textContent).to.include('row');
169
- (0, react_dom_1.flushSync)(() => header.click());
170
- (0, chai_1.expect)(header.getAttribute('aria-expanded')).to.equal('false');
171
- (0, chai_1.expect)(container.textContent).to.not.include('row');
164
+ expect(header?.getAttribute('aria-expanded')).to.equal('true');
165
+ expect(container.textContent).to.include('row');
166
+ flushSync(() => header.click());
167
+ expect(header.getAttribute('aria-expanded')).to.equal('false');
168
+ expect(container.textContent).to.not.include('row');
172
169
  }
173
170
  finally {
174
171
  dispose();
175
172
  }
176
173
  });
177
174
  it('AiConfigurationSection keeps a folded section open while forced, so a filter match stays reachable', () => {
178
- const { container, dispose } = mount(React.createElement(ai_configuration_primitives_1.AiConfigurationSection, { title: 'Skills', collapsible: true, forceExpanded: true, children: React.createElement('span', {}, 'row') }));
175
+ const { container, dispose } = mount(React.createElement(AiConfigurationSection, { title: 'Skills', collapsible: true, forceExpanded: true, children: React.createElement('span', {}, 'row') }));
179
176
  try {
180
177
  const header = container.querySelector('.ai-configuration-section-title.foldable');
181
- (0, react_dom_1.flushSync)(() => header.click());
182
- (0, chai_1.expect)(container.textContent).to.include('row');
178
+ flushSync(() => header.click());
179
+ expect(container.textContent).to.include('row');
183
180
  }
184
181
  finally {
185
182
  dispose();
@@ -187,36 +184,36 @@ describe('AI Configuration primitives', () => {
187
184
  });
188
185
  it('AiConfigurationItemRow exposes the label, status and an onSelect handler', () => {
189
186
  let selected = false;
190
- const tree = (0, ai_configuration_item_row_1.AiConfigurationItemRow)({
187
+ const tree = AiConfigurationItemRow({
191
188
  label: 'Universal',
192
189
  iconClass: 'codicon-copilot',
193
190
  status: { kind: 'on', label: 'Enabled' },
194
191
  onSelect: () => { selected = true; }
195
192
  });
196
- (0, chai_1.expect)(textOf(tree)).to.include('Universal').and.to.include('Enabled');
197
- (0, chai_1.expect)(classNames(tree)).to.include('ai-configuration-status-on');
193
+ expect(textOf(tree)).to.include('Universal').and.to.include('Enabled');
194
+ expect(classNames(tree)).to.include('ai-configuration-status-on');
198
195
  tree.props.onClick();
199
- (0, chai_1.expect)(selected).to.equal(true);
196
+ expect(selected).to.equal(true);
200
197
  });
201
198
  it('AiConfigurationItemRow shows the modified bar and a gear that anchors its menu at the gear', () => {
202
199
  const host = document.createElement('div');
203
200
  document.body.appendChild(host);
204
- const root = (0, client_1.createRoot)(host);
201
+ const root = createRoot(host);
205
202
  const opened = [];
206
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_item_row_1.AiConfigurationItemRow, {
203
+ flushSync(() => root.render(React.createElement(AiConfigurationItemRow, {
207
204
  label: 'chat',
208
205
  modified: true,
209
206
  onOpenMenu: gearEl => { opened.push(gearEl); }
210
207
  })));
211
208
  const row = host.querySelector('.ai-configuration-item-row');
212
- (0, chai_1.expect)(row.classList.contains('modified')).to.equal(true);
209
+ expect(row.classList.contains('modified')).to.equal(true);
213
210
  // A non-navigable row (no onSelect) shows no chevron.
214
- (0, chai_1.expect)(Boolean(host.querySelector('.ai-configuration-item-row-chevron'))).to.equal(false);
211
+ expect(Boolean(host.querySelector('.ai-configuration-item-row-chevron'))).to.equal(false);
215
212
  const gear = host.querySelector('.ai-settings-row-gear');
216
- (0, chai_1.expect)(Boolean(gear)).to.equal(true);
217
- (0, react_dom_1.flushSync)(() => gear.click());
218
- (0, chai_1.expect)(opened.length).to.equal(1);
219
- (0, chai_1.expect)(opened[0]).to.equal(gear);
213
+ expect(Boolean(gear)).to.equal(true);
214
+ flushSync(() => gear.click());
215
+ expect(opened.length).to.equal(1);
216
+ expect(opened[0]).to.equal(gear);
220
217
  root.unmount();
221
218
  host.remove();
222
219
  });
@@ -246,22 +243,22 @@ describe('AI Configuration primitives', () => {
246
243
  // A tool description running past the two-line clamp is otherwise unreadable in the list.
247
244
  withClampedText(120, () => {
248
245
  let rowOpened = 0;
249
- const { container, dispose } = mount(React.createElement(ai_configuration_item_row_1.AiConfigurationItemRow, {
246
+ const { container, dispose } = mount(React.createElement(AiConfigurationItemRow, {
250
247
  label: 'writeFileReplacements',
251
248
  description: 'Replace text in a file. The old text must be unique in the file.',
252
249
  onSelect: () => { rowOpened++; }
253
250
  }));
254
251
  try {
255
252
  const description = container.querySelector('.ai-configuration-item-row-description');
256
- (0, chai_1.expect)(description.classList.contains('expanded')).to.equal(false);
253
+ expect(description.classList.contains('expanded')).to.equal(false);
257
254
  const toggle = container.querySelector('.ai-configuration-item-row-description-toggle');
258
- (0, chai_1.expect)(Boolean(toggle)).to.equal(true);
259
- (0, chai_1.expect)(toggle.getAttribute('aria-expanded')).to.equal('false');
260
- (0, react_dom_1.flushSync)(() => toggle.click());
261
- (0, chai_1.expect)(description.classList.contains('expanded')).to.equal(true);
262
- (0, chai_1.expect)(container.querySelector('.ai-configuration-item-row-description-toggle').getAttribute('aria-expanded')).to.equal('true');
255
+ expect(Boolean(toggle)).to.equal(true);
256
+ expect(toggle.getAttribute('aria-expanded')).to.equal('false');
257
+ flushSync(() => toggle.click());
258
+ expect(description.classList.contains('expanded')).to.equal(true);
259
+ expect(container.querySelector('.ai-configuration-item-row-description-toggle').getAttribute('aria-expanded')).to.equal('true');
263
260
  // Reading the description must not also open the row's detail page.
264
- (0, chai_1.expect)(rowOpened).to.equal(0);
261
+ expect(rowOpened).to.equal(0);
265
262
  }
266
263
  finally {
267
264
  dispose();
@@ -269,9 +266,9 @@ describe('AI Configuration primitives', () => {
269
266
  });
270
267
  // Nothing hidden, so no toggle to offer.
271
268
  withClampedText(40, () => {
272
- const { container, dispose } = mount(React.createElement(ai_configuration_item_row_1.AiConfigurationItemRow, { label: 'readFile', description: 'Read a file.' }));
269
+ const { container, dispose } = mount(React.createElement(AiConfigurationItemRow, { label: 'readFile', description: 'Read a file.' }));
273
270
  try {
274
- (0, chai_1.expect)(Boolean(container.querySelector('.ai-configuration-item-row-description-toggle'))).to.equal(false);
271
+ expect(Boolean(container.querySelector('.ai-configuration-item-row-description-toggle'))).to.equal(false);
275
272
  }
276
273
  finally {
277
274
  dispose();
@@ -279,40 +276,40 @@ describe('AI Configuration primitives', () => {
279
276
  });
280
277
  });
281
278
  it('AiConfigurationEmptyState renders the message and an optional action', async () => {
282
- const tree = await (0, ai_configuration_primitives_1.AiConfigurationEmptyState)({ message: 'Nothing here', action: React.createElement('button', {}, 'Add') });
283
- (0, chai_1.expect)(textOf(tree)).to.include('Nothing here').and.to.include('Add');
279
+ const tree = await AiConfigurationEmptyState({ message: 'Nothing here', action: React.createElement('button', {}, 'Add') });
280
+ expect(textOf(tree)).to.include('Nothing here').and.to.include('Add');
284
281
  });
285
282
  it('AiConfigurationItemDetailHeader renders title and subtitle', async () => {
286
- const tree = await (0, ai_configuration_primitives_1.AiConfigurationItemDetailHeader)({ title: 'Coder', subtitle: 'agent-id-1' });
287
- (0, chai_1.expect)(textOf(tree)).to.include('Coder').and.to.include('agent-id-1');
283
+ const tree = await AiConfigurationItemDetailHeader({ title: 'Coder', subtitle: 'agent-id-1' });
284
+ expect(textOf(tree)).to.include('Coder').and.to.include('agent-id-1');
288
285
  });
289
286
  it('AiConfigurationOriginBadge is a button that activates its origin, and does not open the row it sits in', () => {
290
287
  let activated = 0;
291
288
  let rowOpened = 0;
292
- const { container, dispose } = mount(React.createElement('div', { onClick: () => { rowOpened++; } }, React.createElement(ai_configuration_origin_badge_1.AiConfigurationOriginBadge, {
289
+ const { container, dispose } = mount(React.createElement('div', { onClick: () => { rowOpened++; } }, React.createElement(AiConfigurationOriginBadge, {
293
290
  origin: { label: 'From registry', iconClass: 'codicon-link-external', tooltip: 'Open in AI registry: x', activate: () => { activated++; } }
294
291
  })));
295
292
  try {
296
293
  const badge = container.querySelector('button.ai-configuration-origin-badge');
297
- (0, chai_1.expect)(badge.getAttribute('title')).to.equal('Open in AI registry: x');
298
- (0, chai_1.expect)(badge.textContent).to.include('From registry');
299
- (0, react_dom_1.flushSync)(() => badge.click());
300
- (0, chai_1.expect)(activated).to.equal(1);
294
+ expect(badge.getAttribute('title')).to.equal('Open in AI registry: x');
295
+ expect(badge.textContent).to.include('From registry');
296
+ flushSync(() => badge.click());
297
+ expect(activated).to.equal(1);
301
298
  // The surrounding row and detail header are clickable themselves; following the badge must
302
299
  // not also open them.
303
- (0, chai_1.expect)(rowOpened).to.equal(0);
300
+ expect(rowOpened).to.equal(0);
304
301
  }
305
302
  finally {
306
303
  dispose();
307
304
  }
308
305
  });
309
306
  it('AiConfigurationOriginBadge is not focusable when the origin leads nowhere', () => {
310
- const { container, dispose } = mount(React.createElement(ai_configuration_origin_badge_1.AiConfigurationOriginBadge, {
307
+ const { container, dispose } = mount(React.createElement(AiConfigurationOriginBadge, {
311
308
  origin: { label: 'via Acme', iconClass: 'codicon-package', tooltip: 'Acme' }
312
309
  }));
313
310
  try {
314
- (0, chai_1.expect)(container.querySelector('button')).to.be.null;
315
- (0, chai_1.expect)(container.querySelector('span.ai-configuration-origin-badge')?.textContent).to.include('via Acme');
311
+ expect(container.querySelector('button')).to.be.null;
312
+ expect(container.querySelector('span.ai-configuration-origin-badge')?.textContent).to.include('via Acme');
316
313
  }
317
314
  finally {
318
315
  dispose();
@@ -320,37 +317,37 @@ describe('AI Configuration primitives', () => {
320
317
  });
321
318
  it('AiConfigurationOriginBadges renders one badge per origin, in order, and nothing without any', () => {
322
319
  const origin = (label) => ({ label, iconClass: 'codicon-link-external', tooltip: label, activate: () => { } });
323
- const { container, dispose } = mount(React.createElement(ai_configuration_origin_badge_1.AiConfigurationOriginBadges, { origins: [origin('From registry'), origin('via Acme Devtools')] }));
320
+ const { container, dispose } = mount(React.createElement(AiConfigurationOriginBadges, { origins: [origin('From registry'), origin('via Acme Devtools')] }));
324
321
  try {
325
- (0, chai_1.expect)(Array.from(container.querySelectorAll('.ai-configuration-origin-badge')).map(badge => badge.textContent))
322
+ expect(Array.from(container.querySelectorAll('.ai-configuration-origin-badge')).map(badge => badge.textContent))
326
323
  .to.deep.equal(['From registry', 'via Acme Devtools']);
327
324
  }
328
325
  finally {
329
326
  dispose();
330
327
  }
331
- const empty = mount(React.createElement('div', {}, React.createElement(ai_configuration_origin_badge_1.AiConfigurationOriginBadges, { origins: [] })));
328
+ const empty = mount(React.createElement('div', {}, React.createElement(AiConfigurationOriginBadges, { origins: [] })));
332
329
  try {
333
- (0, chai_1.expect)(empty.container.querySelector('.ai-configuration-origin-badges')).to.be.null;
330
+ expect(empty.container.querySelector('.ai-configuration-origin-badges')).to.be.null;
334
331
  }
335
332
  finally {
336
333
  empty.dispose();
337
334
  }
338
335
  });
339
336
  it('AiConfigurationOrigin builds the same registry and Agent Plugin badges for every page to use', () => {
340
- const registry = ai_configuration_origin_badge_1.AiConfigurationOrigin.registry('io.github.acme/validator', () => { });
341
- (0, chai_1.expect)(registry.label).to.equal('From registry');
342
- (0, chai_1.expect)(registry.iconClass).to.contain('codicon-link-external');
343
- (0, chai_1.expect)(registry.tooltip).to.contain('io.github.acme/validator');
344
- const plugin = ai_configuration_origin_badge_1.AiConfigurationOrigin.agentPlugin({ pluginId: 'io.github.acme/devtools', name: 'Acme Devtools' }, () => { });
345
- (0, chai_1.expect)(plugin.label).to.equal('via Acme Devtools');
346
- (0, chai_1.expect)(plugin.iconClass).to.contain('codicon-package');
347
- (0, chai_1.expect)(plugin.tooltip).to.contain('Acme Devtools');
337
+ const registry = AiConfigurationOrigin.registry('io.github.acme/validator', () => { });
338
+ expect(registry.label).to.equal('From registry');
339
+ expect(registry.iconClass).to.contain('codicon-link-external');
340
+ expect(registry.tooltip).to.contain('io.github.acme/validator');
341
+ const plugin = AiConfigurationOrigin.agentPlugin({ pluginId: 'io.github.acme/devtools', name: 'Acme Devtools' }, () => { });
342
+ expect(plugin.label).to.equal('via Acme Devtools');
343
+ expect(plugin.iconClass).to.contain('codicon-package');
344
+ expect(plugin.tooltip).to.contain('Acme Devtools');
348
345
  });
349
346
  it('AiConfigurationSettingRow renders title and control, marks modified rows, and hides the raw id', () => {
350
347
  const host = document.createElement('div');
351
348
  document.body.appendChild(host);
352
- const root = (0, client_1.createRoot)(host);
353
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, {
349
+ const root = createRoot(host);
350
+ flushSync(() => root.render(React.createElement(AiConfigurationSettingRow, {
354
351
  preferenceId: 'ai-features.demo',
355
352
  title: 'Demo',
356
353
  renderMarkdown: () => document.createElement('div'),
@@ -358,33 +355,33 @@ describe('AI Configuration primitives', () => {
358
355
  control: React.createElement('span', {}, 'ctrl')
359
356
  })));
360
357
  const row = host.querySelector('.ai-settings-row');
361
- (0, chai_1.expect)(row.classList.contains('modified')).to.equal(true);
362
- (0, chai_1.expect)(row.textContent).to.include('Demo').and.to.include('ctrl');
358
+ expect(row.classList.contains('modified')).to.equal(true);
359
+ expect(row.textContent).to.include('Demo').and.to.include('ctrl');
363
360
  // The raw preference id is no longer shown inline; it is copied through the gear menu instead.
364
- (0, chai_1.expect)(row.textContent).to.not.include('ai-features.demo');
365
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, {
361
+ expect(row.textContent).to.not.include('ai-features.demo');
362
+ flushSync(() => root.render(React.createElement(AiConfigurationSettingRow, {
366
363
  preferenceId: 'ai-features.demo',
367
364
  title: 'Demo',
368
365
  renderMarkdown: () => document.createElement('div'),
369
366
  modified: false
370
367
  })));
371
- (0, chai_1.expect)(host.querySelector('.ai-settings-row').classList.contains('modified')).to.equal(false);
368
+ expect(host.querySelector('.ai-settings-row').classList.contains('modified')).to.equal(false);
372
369
  root.unmount();
373
370
  host.remove();
374
371
  });
375
372
  it('AiConfigurationSettingRow marks a row with a session value and shows the value on hover', () => {
376
373
  const props = { preferenceId: 'ai-features.demo', title: 'Demo', modified: false };
377
- const { container, dispose } = mount(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, { ...props, sessionValue: 'session text' }));
374
+ const { container, dispose } = mount(React.createElement(AiConfigurationSettingRow, { ...props, sessionValue: 'session text' }));
378
375
  const marker = container.querySelector('.ai-settings-row-title .ai-settings-row-session');
379
- (0, chai_1.expect)(marker.textContent).to.equal('Overridden by session');
380
- (0, chai_1.expect)(marker.title).to.include('--session-preference').and.to.include('"session text"');
376
+ expect(marker.textContent).to.equal('Overridden by session');
377
+ expect(marker.title).to.include('--session-preference').and.to.include('"session text"');
381
378
  dispose();
382
379
  // `false` is a session value like any other; only `undefined` means there is none.
383
- const withFalse = mount(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, { ...props, sessionValue: false }));
384
- (0, chai_1.expect)(withFalse.container.querySelector('.ai-settings-row-session')).to.exist;
380
+ const withFalse = mount(React.createElement(AiConfigurationSettingRow, { ...props, sessionValue: false }));
381
+ expect(withFalse.container.querySelector('.ai-settings-row-session')).to.exist;
385
382
  withFalse.dispose();
386
- const without = mount(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, props));
387
- (0, chai_1.expect)(without.container.querySelector('.ai-settings-row-session')).to.not.exist;
383
+ const without = mount(React.createElement(AiConfigurationSettingRow, props));
384
+ expect(without.container.querySelector('.ai-settings-row-session')).to.not.exist;
388
385
  without.dispose();
389
386
  });
390
387
  it('AiSettingsRow marks a session value, and shows it in the tooltip only for a primitive that isn\'t a secret', () => {
@@ -395,7 +392,7 @@ describe('AI Configuration primitives', () => {
395
392
  renderMarkdown: () => document.createElement('div')
396
393
  });
397
394
  const tooltip = (sessionValue, control) => {
398
- const { container, dispose } = mount(React.createElement(ai_settings_row_1.AiSettingsRow, {
395
+ const { container, dispose } = mount(React.createElement(AiSettingsRow, {
399
396
  service: service(sessionValue), preferenceId: 'ai-features.demo', scope: 'user', control
400
397
  }));
401
398
  const title = container.querySelector('.ai-settings-row-session')?.title;
@@ -403,36 +400,36 @@ describe('AI Configuration primitives', () => {
403
400
  return title;
404
401
  };
405
402
  const secret = tooltip('sk-session-key', { type: 'string', password: true });
406
- (0, chai_1.expect)(secret).to.include('--session-preference').and.to.not.include('sk-session-key');
403
+ expect(secret).to.include('--session-preference').and.to.not.include('sk-session-key');
407
404
  // A list or an object can hold a key as well, e.g. the `apiKey` of a custom OpenAI model.
408
405
  const models = tooltip([{ model: 'demo', apiKey: 'sk-model-key' }], { type: 'json' });
409
- (0, chai_1.expect)(models).to.include('--session-preference').and.to.not.include('sk-model-key');
410
- (0, chai_1.expect)(tooltip({ token: 'sk-object-key' }, { type: 'json' })).to.include('--session-preference').and.to.not.include('sk-object-key');
411
- (0, chai_1.expect)(tooltip(['curl *'], { type: 'array' })).to.include('--session-preference').and.to.not.include('curl *');
412
- (0, chai_1.expect)(tooltip('session text', { type: 'string' })).to.include('"session text"');
413
- (0, chai_1.expect)(tooltip(false, { type: 'boolean' })).to.include('false');
414
- (0, chai_1.expect)(tooltip(3, { type: 'number' })).to.include('3');
415
- (0, chai_1.expect)(tooltip(undefined, { type: 'string' })).to.equal(undefined);
406
+ expect(models).to.include('--session-preference').and.to.not.include('sk-model-key');
407
+ expect(tooltip({ token: 'sk-object-key' }, { type: 'json' })).to.include('--session-preference').and.to.not.include('sk-object-key');
408
+ expect(tooltip(['curl *'], { type: 'array' })).to.include('--session-preference').and.to.not.include('curl *');
409
+ expect(tooltip('session text', { type: 'string' })).to.include('"session text"');
410
+ expect(tooltip(false, { type: 'boolean' })).to.include('false');
411
+ expect(tooltip(3, { type: 'number' })).to.include('3');
412
+ expect(tooltip(undefined, { type: 'string' })).to.equal(undefined);
416
413
  });
417
414
  it('AiConfigurationItemRow uses its own session tooltip, given the value only for a primitive', () => {
418
415
  const tooltip = (sessionValue) => {
419
- const { container, dispose } = mount(React.createElement(ai_configuration_item_row_1.AiConfigurationItemRow, {
416
+ const { container, dispose } = mount(React.createElement(AiConfigurationItemRow, {
420
417
  label: 'item', sessionValue, sessionTooltip: (shownValue) => `entry: ${shownValue}`
421
418
  }));
422
419
  const title = container.querySelector('.ai-settings-row-session')?.title;
423
420
  dispose();
424
421
  return title;
425
422
  };
426
- (0, chai_1.expect)(tooltip('always_allow')).to.equal('entry: "always_allow"');
427
- (0, chai_1.expect)(tooltip({ apiKey: 'sk-entry-key' })).to.equal('entry: undefined');
428
- (0, chai_1.expect)(tooltip(undefined)).to.equal(undefined);
423
+ expect(tooltip('always_allow')).to.equal('entry: "always_allow"');
424
+ expect(tooltip({ apiKey: 'sk-entry-key' })).to.equal('entry: undefined');
425
+ expect(tooltip(undefined)).to.equal(undefined);
429
426
  });
430
427
  it('the setting-row gear delegates to the preference context menu, anchored at the gear', () => {
431
428
  const host = document.createElement('div');
432
429
  document.body.appendChild(host);
433
- const root = (0, client_1.createRoot)(host);
430
+ const root = createRoot(host);
434
431
  const opened = [];
435
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, {
432
+ flushSync(() => root.render(React.createElement(AiConfigurationSettingRow, {
436
433
  preferenceId: 'ai-features.demo',
437
434
  title: 'Demo',
438
435
  renderMarkdown: () => document.createElement('div'),
@@ -443,46 +440,46 @@ describe('AI Configuration primitives', () => {
443
440
  // The gear defers to the owner's opener (which renders the Settings UI's own preference context
444
441
  // menu via ContextMenuRenderer), passing the gear element as the anchor. No inline popover.
445
442
  const gear = host.querySelector('.ai-settings-row-gear');
446
- (0, chai_1.expect)(Boolean(gear)).to.equal(true);
447
- (0, react_dom_1.flushSync)(() => gear.click());
448
- (0, chai_1.expect)(opened.length).to.equal(1);
449
- (0, chai_1.expect)(opened[0]).to.equal(gear);
443
+ expect(Boolean(gear)).to.equal(true);
444
+ flushSync(() => gear.click());
445
+ expect(opened.length).to.equal(1);
446
+ expect(opened[0]).to.equal(gear);
450
447
  root.unmount();
451
448
  host.remove();
452
449
  });
453
450
  it('AiConfigurationSettingRow hides the gear when no menu opener is provided', () => {
454
451
  const host = document.createElement('div');
455
452
  document.body.appendChild(host);
456
- const root = (0, client_1.createRoot)(host);
457
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, {
453
+ const root = createRoot(host);
454
+ flushSync(() => root.render(React.createElement(AiConfigurationSettingRow, {
458
455
  preferenceId: 'ai-features.demo',
459
456
  title: 'Demo',
460
457
  renderMarkdown: () => document.createElement('div'),
461
458
  modified: true
462
459
  })));
463
- (0, chai_1.expect)(Boolean(host.querySelector('.ai-settings-row-gear'))).to.equal(false);
460
+ expect(Boolean(host.querySelector('.ai-settings-row-gear'))).to.equal(false);
464
461
  root.unmount();
465
462
  host.remove();
466
463
  });
467
464
  it('AiConfigurationSettingRow places a full-width control in the below slot', () => {
468
465
  const host = document.createElement('div');
469
466
  document.body.appendChild(host);
470
- const root = (0, client_1.createRoot)(host);
471
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_setting_row_1.AiConfigurationSettingRow, {
467
+ const root = createRoot(host);
468
+ flushSync(() => root.render(React.createElement(AiConfigurationSettingRow, {
472
469
  preferenceId: 'ai-features.demo',
473
470
  title: 'Demo',
474
471
  renderMarkdown: () => document.createElement('div'),
475
472
  modified: false,
476
473
  below: React.createElement('span', {}, 'wide')
477
474
  })));
478
- (0, chai_1.expect)(Boolean(host.querySelector('.ai-settings-row-below'))).to.equal(true);
479
- (0, chai_1.expect)(host.textContent).to.include('wide');
475
+ expect(Boolean(host.querySelector('.ai-settings-row-below'))).to.equal(true);
476
+ expect(host.textContent).to.include('wide');
480
477
  root.unmount();
481
478
  host.remove();
482
479
  });
483
480
  });
484
481
  describe('PromptCustomizationDialogs', () => {
485
- before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
482
+ before(() => disableJSDOM = enableJSDOM());
486
483
  after(() => disableJSDOM());
487
484
  function promptServiceWith(fragments) {
488
485
  const map = new Map(Object.entries(fragments).map(([id, list]) => [id, list.map(fragment => ({ id, template: '', ...fragment }))]));
@@ -495,7 +492,7 @@ describe('PromptCustomizationDialogs', () => {
495
492
  const promptService = promptServiceWith({
496
493
  'coder-system-agent-mode': [{ customizationId: 'user', priority: 1 }, {}]
497
494
  });
498
- (0, chai_1.expect)(prompt_customization_dialogs_1.PromptCustomizationDialogs.hasBuiltIn(promptService, 'coder-system-agent-mode')).to.equal(true);
495
+ expect(PromptCustomizationDialogs.hasBuiltIn(promptService, 'coder-system-agent-mode')).to.equal(true);
499
496
  });
500
497
  it('reports no built-in for a user-authored variant, whose reset would silently do nothing', () => {
501
498
  // A file named after the variant set becomes a custom variant of it; `PromptService.resetToBuiltIn`
@@ -503,19 +500,19 @@ describe('PromptCustomizationDialogs', () => {
503
500
  const promptService = promptServiceWith({
504
501
  'coder-system-agent-mode-nina': [{ customizationId: 'promptTemplateFolder', priority: 1 }]
505
502
  });
506
- (0, chai_1.expect)(prompt_customization_dialogs_1.PromptCustomizationDialogs.hasBuiltIn(promptService, 'coder-system-agent-mode-nina')).to.equal(false);
503
+ expect(PromptCustomizationDialogs.hasBuiltIn(promptService, 'coder-system-agent-mode-nina')).to.equal(false);
507
504
  });
508
505
  it('does not prompt for a fragment that carries no customization to remove', async () => {
509
506
  let removed = false;
510
507
  const promptService = promptServiceWith({ 'coder-system': [{}] });
511
508
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
512
509
  promptService.removeCustomization = () => { removed = true; };
513
- const result = await prompt_customization_dialogs_1.PromptCustomizationDialogs.confirmAndRemove(promptService, 'coder-system', {
510
+ const result = await PromptCustomizationDialogs.confirmAndRemove(promptService, 'coder-system', {
514
511
  title: 'Remove',
515
512
  message: () => 'Remove?'
516
513
  });
517
- (0, chai_1.expect)(result).to.equal(false);
518
- (0, chai_1.expect)(removed).to.equal(false);
514
+ expect(result).to.equal(false);
515
+ expect(removed).to.equal(false);
519
516
  });
520
517
  it('removes the customization the effective fragment came from, after confirmation', async () => {
521
518
  const promptService = promptServiceWith({
@@ -530,30 +527,30 @@ describe('PromptCustomizationDialogs', () => {
530
527
  });
531
528
  let shownMessage;
532
529
  // Auto-confirm the dialog: it resolves through `ConfirmDialog.open`, which needs a real accept click.
533
- const originalOpen = browser_1.ConfirmDialog.prototype.open;
534
- browser_1.ConfirmDialog.prototype.open = async function () {
530
+ const originalOpen = ConfirmDialog.prototype.open;
531
+ ConfirmDialog.prototype.open = async function () {
535
532
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
536
533
  shownMessage = this.contentNode?.textContent;
537
534
  return true;
538
535
  };
539
536
  try {
540
- const result = await prompt_customization_dialogs_1.PromptCustomizationDialogs.confirmAndRemove(promptService, 'coder-system-agent-mode-nina', {
537
+ const result = await PromptCustomizationDialogs.confirmAndRemove(promptService, 'coder-system-agent-mode-nina', {
541
538
  title: 'Remove Prompt Template',
542
539
  message: ({ type, description }) => `${type} :: ${description}`
543
540
  });
544
- (0, chai_1.expect)(result).to.equal(true);
545
- (0, chai_1.expect)(removals).to.deep.equal(['coder-system-agent-mode-nina/promptTemplateFolder']);
541
+ expect(result).to.equal(true);
542
+ expect(removals).to.deep.equal(['coder-system-agent-mode-nina/promptTemplateFolder']);
546
543
  // The dialog names where the customization lives, so the user sees which file goes away.
547
- (0, chai_1.expect)(shownMessage).to.include('Prompt Templates Folder');
548
- (0, chai_1.expect)(shownMessage).to.include('coder-system-agent-mode-nina.prompttemplate');
544
+ expect(shownMessage).to.include('Prompt Templates Folder');
545
+ expect(shownMessage).to.include('coder-system-agent-mode-nina.prompttemplate');
549
546
  }
550
547
  finally {
551
- browser_1.ConfirmDialog.prototype.open = originalOpen;
548
+ ConfirmDialog.prototype.open = originalOpen;
552
549
  }
553
550
  });
554
551
  });
555
552
  describe('VariantSetCard', () => {
556
- before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
553
+ before(() => disableJSDOM = enableJSDOM());
557
554
  after(() => disableJSDOM());
558
555
  /** A set with a built-in default plus a user-authored variant, which is the one currently selected. */
559
556
  function setup() {
@@ -584,22 +581,22 @@ describe('VariantSetCard', () => {
584
581
  function render(promptService) {
585
582
  const container = document.createElement('div');
586
583
  document.body.appendChild(container);
587
- const root = (0, client_1.createRoot)(container);
588
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(variant_set_card_1.VariantSetCard, {
584
+ const root = createRoot(container);
585
+ flushSync(() => root.render(React.createElement(VariantSetCard, {
589
586
  agentId: 'coder',
590
587
  promptVariantSetId: 'coder-system-agent-mode',
591
588
  promptService,
592
589
  settingsRowService: { openResetMenu: () => { } }
593
590
  })));
594
- return { container, dispose: () => { (0, react_dom_1.flushSync)(() => root.unmount()); container.remove(); } };
591
+ return { container, dispose: () => { flushSync(() => root.unmount()); container.remove(); } };
595
592
  }
596
593
  it('offers deletion, not a dead reset, for a selected variant that only exists as a user file', () => {
597
594
  const { promptService } = setup();
598
595
  const { container, dispose } = render(promptService);
599
596
  try {
600
597
  // `PromptService.resetToBuiltIn` is a no-op without a built-in, so the action must be a delete.
601
- (0, chai_1.expect)(Boolean(container.querySelector('.codicon-trash'))).to.equal(true);
602
- (0, chai_1.expect)(Boolean(container.querySelector('.codicon-discard'))).to.equal(false);
598
+ expect(Boolean(container.querySelector('.codicon-trash'))).to.equal(true);
599
+ expect(Boolean(container.querySelector('.codicon-discard'))).to.equal(false);
603
600
  }
604
601
  finally {
605
602
  dispose();
@@ -608,46 +605,46 @@ describe('VariantSetCard', () => {
608
605
  it('falls back to the default variant after deleting the selected one, instead of leaving it unavailable', async () => {
609
606
  const { promptService, selections, removals } = setup();
610
607
  const { container, dispose } = render(promptService);
611
- const originalOpen = browser_1.ConfirmDialog.prototype.open;
612
- browser_1.ConfirmDialog.prototype.open = async () => true;
608
+ const originalOpen = ConfirmDialog.prototype.open;
609
+ ConfirmDialog.prototype.open = async () => true;
613
610
  try {
614
611
  const remove = container.querySelector('.ai-configuration-icon-button:last-of-type');
615
612
  remove.click();
616
613
  // Let the confirmation and both service calls settle.
617
614
  await new Promise(resolve => setTimeout(resolve, 0));
618
- (0, chai_1.expect)(removals).to.deep.equal(['coder-system-agent-mode-nina']);
619
- (0, chai_1.expect)(selections).to.deep.equal([['coder', 'coder-system-agent-mode']]);
615
+ expect(removals).to.deep.equal(['coder-system-agent-mode-nina']);
616
+ expect(selections).to.deep.equal([['coder', 'coder-system-agent-mode']]);
620
617
  }
621
618
  finally {
622
- browser_1.ConfirmDialog.prototype.open = originalOpen;
619
+ ConfirmDialog.prototype.open = originalOpen;
623
620
  dispose();
624
621
  }
625
622
  });
626
623
  });
627
624
  describe('AiArrayInput', () => {
628
- before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
625
+ before(() => disableJSDOM = enableJSDOM());
629
626
  after(() => disableJSDOM());
630
627
  /** Renders the editor with a validator that refuses anything containing `*`, and reports the adds. */
631
628
  function mountList(values) {
632
629
  const added = [];
633
630
  const container = document.createElement('div');
634
631
  document.body.appendChild(container);
635
- const root = (0, client_1.createRoot)(container);
636
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_controls_1.AiArrayInput, {
632
+ const root = createRoot(container);
633
+ flushSync(() => root.render(React.createElement(AiArrayInput, {
637
634
  values,
638
635
  ariaLabel: 'Patterns',
639
636
  addPlaceholder: 'Add pattern…',
640
637
  validate: (value) => value.includes('*') ? `"${value}" is not allowed` : undefined,
641
638
  onChange: (next) => { added.push(next); }
642
639
  })));
643
- return { container, added, dispose: () => { (0, react_dom_1.flushSync)(() => root.unmount()); container.remove(); } };
640
+ return { container, added, dispose: () => { flushSync(() => root.unmount()); container.remove(); } };
644
641
  }
645
642
  it('adds an accepted entry', () => {
646
643
  const { container, added, dispose } = mountList(['git log ']);
647
644
  try {
648
645
  typeInto(container, 'npm test');
649
- (0, react_dom_1.flushSync)(() => container.querySelector('.codicon-add').click());
650
- (0, chai_1.expect)(added).to.deep.equal([['git log ', 'npm test']]);
646
+ flushSync(() => container.querySelector('.codicon-add').click());
647
+ expect(added).to.deep.equal([['git log ', 'npm test']]);
651
648
  }
652
649
  finally {
653
650
  dispose();
@@ -657,11 +654,11 @@ describe('AiArrayInput', () => {
657
654
  const { container, added, dispose } = mountList([]);
658
655
  try {
659
656
  typeInto(container, 'git log*');
660
- (0, react_dom_1.flushSync)(() => container.querySelector('.codicon-add').click());
657
+ flushSync(() => container.querySelector('.codicon-add').click());
661
658
  // Nothing written, the reason is shown, and the input still holds what was typed.
662
- (0, chai_1.expect)(added).to.be.empty;
663
- (0, chai_1.expect)(container.textContent).to.include('"git log*" is not allowed');
664
- (0, chai_1.expect)(container.querySelector('input').value).to.equal('git log*');
659
+ expect(added).to.be.empty;
660
+ expect(container.textContent).to.include('"git log*" is not allowed');
661
+ expect(container.querySelector('input').value).to.equal('git log*');
665
662
  }
666
663
  finally {
667
664
  dispose();
@@ -671,10 +668,10 @@ describe('AiArrayInput', () => {
671
668
  const { container, dispose } = mountList([]);
672
669
  try {
673
670
  typeInto(container, '*');
674
- (0, react_dom_1.flushSync)(() => container.querySelector('.codicon-add').click());
675
- (0, chai_1.expect)(container.textContent).to.include('not allowed');
671
+ flushSync(() => container.querySelector('.codicon-add').click());
672
+ expect(container.textContent).to.include('not allowed');
676
673
  typeInto(container, 'npm test');
677
- (0, chai_1.expect)(container.textContent).to.not.include('not allowed');
674
+ expect(container.textContent).to.not.include('not allowed');
678
675
  }
679
676
  finally {
680
677
  dispose();
@@ -682,36 +679,36 @@ describe('AiArrayInput', () => {
682
679
  });
683
680
  });
684
681
  describe('AiNumberStepper', () => {
685
- before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
682
+ before(() => disableJSDOM = enableJSDOM());
686
683
  after(() => disableJSDOM());
687
684
  function mountStepper(value, integer) {
688
685
  const committed = [];
689
686
  const container = document.createElement('div');
690
687
  document.body.appendChild(container);
691
- const root = (0, client_1.createRoot)(container);
692
- (0, react_dom_1.flushSync)(() => root.render(React.createElement(ai_configuration_controls_1.AiNumberStepper, {
688
+ const root = createRoot(container);
689
+ flushSync(() => root.render(React.createElement(AiNumberStepper, {
693
690
  value,
694
691
  ariaLabel: 'Retry delay',
695
692
  integer,
696
693
  min: 0,
697
694
  onCommit: (next) => { committed.push(next); }
698
695
  })));
699
- return { container, committed, dispose: () => { (0, react_dom_1.flushSync)(() => root.unmount()); container.remove(); } };
696
+ return { container, committed, dispose: () => { flushSync(() => root.unmount()); container.remove(); } };
700
697
  }
701
698
  /** React listens for `focusout`, not `blur`, so that is what a real focus loss delivers to it. */
702
699
  function commitByBlur(container) {
703
700
  const input = container.querySelector('input');
704
701
  const view = container.ownerDocument.defaultView;
705
- (0, react_dom_1.flushSync)(() => input.dispatchEvent(new view.FocusEvent('focusout', { bubbles: true })));
702
+ flushSync(() => input.dispatchEvent(new view.FocusEvent('focusout', { bubbles: true })));
706
703
  }
707
704
  it('keeps a fractional value for a `number` preference', () => {
708
705
  const { container, committed, dispose } = mountStepper(60);
709
706
  try {
710
707
  typeInto(container, '1.5');
711
708
  commitByBlur(container);
712
- (0, chai_1.expect)(committed).to.deep.equal([1.5]);
709
+ expect(committed).to.deep.equal([1.5]);
713
710
  // Also displayed as typed: rounding it away would hide what was just stored.
714
- (0, chai_1.expect)(container.querySelector('input').value).to.equal('1.5');
711
+ expect(container.querySelector('input').value).to.equal('1.5');
715
712
  }
716
713
  finally {
717
714
  dispose();
@@ -722,7 +719,7 @@ describe('AiNumberStepper', () => {
722
719
  try {
723
720
  typeInto(container, '1.5');
724
721
  commitByBlur(container);
725
- (0, chai_1.expect)(committed).to.deep.equal([2]);
722
+ expect(committed).to.deep.equal([2]);
726
723
  }
727
724
  finally {
728
725
  dispose();
@@ -733,8 +730,8 @@ describe('AiNumberStepper', () => {
733
730
  try {
734
731
  typeInto(container, 'soon');
735
732
  commitByBlur(container);
736
- (0, chai_1.expect)(committed).to.be.empty;
737
- (0, chai_1.expect)(container.querySelector('input').value).to.equal('60');
733
+ expect(committed).to.be.empty;
734
+ expect(container.querySelector('input').value).to.equal('60');
738
735
  }
739
736
  finally {
740
737
  dispose();