@theia/ai-core-ui 1.75.0-next.8 → 1.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/ai-configuration/ai-configuration-category-registry.d.ts +29 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.js +83 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.js +122 -0
- package/lib/browser/ai-configuration/ai-configuration-category-registry.spec.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-category.d.ts +204 -0
- package/lib/browser/ai-configuration/ai-configuration-category.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-category.js +86 -0
- package/lib/browser/ai-configuration/ai-configuration-category.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-selection-model.d.ts +15 -0
- package/lib/browser/ai-configuration/ai-configuration-selection-model.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-selection-model.js +44 -0
- package/lib/browser/ai-configuration/ai-configuration-selection-model.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.d.ts +48 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.js +98 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.js +70 -0
- package/lib/browser/ai-configuration/ai-configuration-setting-commands.spec.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-components.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/components/ai-configuration-components.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js +596 -0
- package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-controls.d.ts +118 -0
- package/lib/browser/ai-configuration/components/ai-configuration-controls.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-controls.js +191 -0
- package/lib/browser/ai-configuration/components/ai-configuration-controls.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts +57 -0
- package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-item-row.js +48 -0
- package/lib/browser/ai-configuration/components/ai-configuration-item-row.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.d.ts +49 -0
- package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.js +79 -0
- package/lib/browser/ai-configuration/components/ai-configuration-origin-badge.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts +161 -0
- package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-primitives.js +131 -0
- package/lib/browser/ai-configuration/components/ai-configuration-primitives.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-setting-row.d.ts +54 -0
- package/lib/browser/ai-configuration/components/ai-configuration-setting-row.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-configuration-setting-row.js +77 -0
- package/lib/browser/ai-configuration/components/ai-configuration-setting-row.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts +194 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.js +352 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js +233 -0
- package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row.d.ts +50 -0
- package/lib/browser/ai-configuration/components/ai-settings-row.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/ai-settings-row.js +85 -0
- package/lib/browser/ai-configuration/components/ai-settings-row.js.map +1 -0
- package/lib/browser/ai-configuration/components/collapsible-list.d.ts +65 -0
- package/lib/browser/ai-configuration/components/collapsible-list.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/collapsible-list.js +82 -0
- package/lib/browser/ai-configuration/components/collapsible-list.js.map +1 -0
- package/lib/browser/ai-configuration/components/prompt-customization-dialogs.d.ts +35 -0
- package/lib/browser/ai-configuration/components/prompt-customization-dialogs.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/prompt-customization-dialogs.js +83 -0
- package/lib/browser/ai-configuration/components/prompt-customization-dialogs.js.map +1 -0
- package/lib/browser/ai-configuration/components/variant-set-card.d.ts +25 -0
- package/lib/browser/ai-configuration/components/variant-set-card.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/variant-set-card.js +133 -0
- package/lib/browser/ai-configuration/components/variant-set-card.js.map +1 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.d.ts +44 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.js +106 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.js.map +1 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.js +120 -0
- package/lib/browser/ai-configuration/renderers/collection-category-renderer.spec.js.map +1 -0
- package/lib/browser/ai-configuration/renderers/single-page-category-renderer.d.ts +15 -0
- package/lib/browser/ai-configuration/renderers/single-page-category-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/renderers/single-page-category-renderer.js +20 -0
- package/lib/browser/ai-configuration/renderers/single-page-category-renderer.js.map +1 -0
- package/lib/browser/ai-core-ui-frontend-module.d.ts +1 -0
- package/lib/browser/ai-core-ui-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-core-ui-frontend-module.js +11 -0
- package/lib/browser/ai-core-ui-frontend-module.js.map +1 -1
- package/package.json +6 -5
- package/src/browser/ai-configuration/ai-configuration-category-registry.spec.ts +137 -0
- package/src/browser/ai-configuration/ai-configuration-category-registry.ts +79 -0
- package/src/browser/ai-configuration/ai-configuration-category.ts +246 -0
- package/src/browser/ai-configuration/ai-configuration-selection-model.ts +42 -0
- package/src/browser/ai-configuration/ai-configuration-setting-commands.spec.ts +82 -0
- package/src/browser/ai-configuration/ai-configuration-setting-commands.ts +104 -0
- package/src/browser/ai-configuration/components/ai-configuration-components.spec.ts +655 -0
- package/src/browser/ai-configuration/components/ai-configuration-controls.tsx +382 -0
- package/src/browser/ai-configuration/components/ai-configuration-item-row.tsx +127 -0
- package/src/browser/ai-configuration/components/ai-configuration-origin-badge.tsx +114 -0
- package/src/browser/ai-configuration/components/ai-configuration-primitives.tsx +359 -0
- package/src/browser/ai-configuration/components/ai-configuration-setting-row.tsx +154 -0
- package/src/browser/ai-configuration/components/ai-settings-row-service.spec.ts +275 -0
- package/src/browser/ai-configuration/components/ai-settings-row-service.ts +401 -0
- package/src/browser/ai-configuration/components/ai-settings-row.tsx +176 -0
- package/src/browser/ai-configuration/components/collapsible-list.tsx +205 -0
- package/src/browser/ai-configuration/components/prompt-customization-dialogs.ts +89 -0
- package/src/browser/ai-configuration/components/variant-set-card.tsx +200 -0
- package/src/browser/ai-configuration/renderers/collection-category-renderer.spec.ts +126 -0
- package/src/browser/ai-configuration/renderers/collection-category-renderer.tsx +164 -0
- package/src/browser/ai-configuration/renderers/single-page-category-renderer.tsx +41 -0
- package/src/browser/ai-core-ui-frontend-module.ts +14 -1
- package/src/browser/style/ai-configuration-components.css +1410 -0
- package/src/browser/style/index.css +17 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
|
|
19
|
+
let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
20
|
+
const common_1 = require("@theia/core/lib/common");
|
|
21
|
+
const preference_types_1 = require("@theia/preferences/lib/browser/util/preference-types");
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const ai_settings_row_service_1 = require("./ai-settings-row-service");
|
|
24
|
+
disableJSDOM();
|
|
25
|
+
class FakeAiConfigurationService {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.inspection = {};
|
|
28
|
+
this.sets = [];
|
|
29
|
+
}
|
|
30
|
+
inspect() {
|
|
31
|
+
return {
|
|
32
|
+
preferenceName: 'test',
|
|
33
|
+
defaultValue: undefined,
|
|
34
|
+
globalValue: undefined,
|
|
35
|
+
workspaceValue: undefined,
|
|
36
|
+
workspaceFolderValue: undefined,
|
|
37
|
+
value: undefined,
|
|
38
|
+
...this.inspection
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
set(preferenceId, value, scope, resourceUri) {
|
|
42
|
+
this.sets.push({ preferenceId, value, scope, resourceUri });
|
|
43
|
+
return Promise.resolve();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function createService(inspection) {
|
|
47
|
+
const preferences = new FakeAiConfigurationService();
|
|
48
|
+
preferences.inspection = inspection;
|
|
49
|
+
const service = new ai_settings_row_service_1.AiSettingsRowService();
|
|
50
|
+
service.aiConfigurationService = preferences;
|
|
51
|
+
return { service, preferences };
|
|
52
|
+
}
|
|
53
|
+
function createServiceWithSchema(property) {
|
|
54
|
+
const service = new ai_settings_row_service_1.AiSettingsRowService();
|
|
55
|
+
const schemaService = {
|
|
56
|
+
getSchemaProperty: () => property
|
|
57
|
+
};
|
|
58
|
+
service.schemaService = schemaService;
|
|
59
|
+
return service;
|
|
60
|
+
}
|
|
61
|
+
describe('AiSettingsRowService', () => {
|
|
62
|
+
before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
|
|
63
|
+
after(() => disableJSDOM());
|
|
64
|
+
describe('inspect', () => {
|
|
65
|
+
it('resolves the user-scope value falling back to the default', () => {
|
|
66
|
+
const { service } = createService({ defaultValue: 'd', globalValue: undefined });
|
|
67
|
+
const result = service.inspect('pref', 'user');
|
|
68
|
+
(0, chai_1.expect)(result.value).to.equal('d');
|
|
69
|
+
(0, chai_1.expect)(result.scopeValue).to.equal(undefined);
|
|
70
|
+
(0, chai_1.expect)(result.modified).to.equal(false);
|
|
71
|
+
});
|
|
72
|
+
it('reports a user-scope override as modified', () => {
|
|
73
|
+
const { service } = createService({ defaultValue: 'd', globalValue: 'u' });
|
|
74
|
+
const result = service.inspect('pref', 'user');
|
|
75
|
+
(0, chai_1.expect)(result.value).to.equal('u');
|
|
76
|
+
(0, chai_1.expect)(result.scopeValue).to.equal('u');
|
|
77
|
+
(0, chai_1.expect)(result.modified).to.equal(true);
|
|
78
|
+
});
|
|
79
|
+
it('resolves the workspace value falling back through user then default', () => {
|
|
80
|
+
const { service } = createService({ defaultValue: 'd', globalValue: 'u' });
|
|
81
|
+
const workspace = service.inspect('pref', 'workspace');
|
|
82
|
+
(0, chai_1.expect)(workspace.value).to.equal('u');
|
|
83
|
+
(0, chai_1.expect)(workspace.scopeValue).to.equal(undefined);
|
|
84
|
+
(0, chai_1.expect)(workspace.modified).to.equal(false);
|
|
85
|
+
const { service: service2 } = createService({ defaultValue: 'd', globalValue: 'u', workspaceValue: 'w' });
|
|
86
|
+
const workspace2 = service2.inspect('pref', 'workspace');
|
|
87
|
+
(0, chai_1.expect)(workspace2.value).to.equal('w');
|
|
88
|
+
(0, chai_1.expect)(workspace2.modified).to.equal(true);
|
|
89
|
+
});
|
|
90
|
+
it('resolves the folder value falling back through workspace, user then default', () => {
|
|
91
|
+
const { service } = createService({ defaultValue: 'd', globalValue: 'u', workspaceValue: 'w' });
|
|
92
|
+
const folder = service.inspect('pref', 'folder');
|
|
93
|
+
(0, chai_1.expect)(folder.value).to.equal('w');
|
|
94
|
+
(0, chai_1.expect)(folder.modified).to.equal(false);
|
|
95
|
+
const { service: service2 } = createService({ defaultValue: 'd', workspaceFolderValue: 'f' });
|
|
96
|
+
const folder2 = service2.inspect('pref', 'folder');
|
|
97
|
+
(0, chai_1.expect)(folder2.value).to.equal('f');
|
|
98
|
+
(0, chai_1.expect)(folder2.modified).to.equal(true);
|
|
99
|
+
});
|
|
100
|
+
it('treats a value of `false` as an explicit override (not inherited)', () => {
|
|
101
|
+
const { service } = createService({ defaultValue: true, globalValue: false });
|
|
102
|
+
const result = service.inspect('pref', 'user');
|
|
103
|
+
(0, chai_1.expect)(result.value).to.equal(false);
|
|
104
|
+
(0, chai_1.expect)(result.modified).to.equal(true);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('controlFor', () => {
|
|
108
|
+
it('maps primitive schema types to their inline controls', () => {
|
|
109
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'boolean' }).controlFor('pref').type).to.equal('boolean');
|
|
110
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'number' }).controlFor('pref').type).to.equal('number');
|
|
111
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'integer' }).controlFor('pref').type).to.equal('number');
|
|
112
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string' }).controlFor('pref').type).to.equal('string');
|
|
113
|
+
(0, chai_1.expect)(createServiceWithSchema(undefined).controlFor('pref').type).to.equal('string');
|
|
114
|
+
});
|
|
115
|
+
it('marks only an integer schema as whole-number, so a number keeps what the user typed', () => {
|
|
116
|
+
// Both render the stepper; only the integer one may round on commit.
|
|
117
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'integer' }).controlFor('pref')).to.deep.include({ type: 'number', integer: true });
|
|
118
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'number' }).controlFor('pref')).to.not.have.property('integer');
|
|
119
|
+
});
|
|
120
|
+
it('maps an enum to a select regardless of its base type', () => {
|
|
121
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string', enum: ['a', 'b'] }).controlFor('pref').type).to.equal('select');
|
|
122
|
+
});
|
|
123
|
+
it('masks secret string preferences (API keys/tokens) with a password input', () => {
|
|
124
|
+
const control = createServiceWithSchema({ type: 'string' }).controlFor('ai-features.anthropic.apiKey');
|
|
125
|
+
(0, chai_1.expect)(control).to.deep.include({ type: 'string', password: true });
|
|
126
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string' }).controlFor('ai-features.anthropic.model'))
|
|
127
|
+
.to.deep.include({ type: 'string', password: false });
|
|
128
|
+
});
|
|
129
|
+
it('renders the inline list editor for string arrays', () => {
|
|
130
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'array', items: { type: 'string' } }).controlFor('pref').type).to.equal('array');
|
|
131
|
+
});
|
|
132
|
+
it('defers object and non-string-array preferences to the Settings UI via a json control', () => {
|
|
133
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'object' }).controlFor('pref').type).to.equal('json');
|
|
134
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'array', items: { type: 'object' } }).controlFor('pref').type).to.equal('json');
|
|
135
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'array', items: { type: 'number' } }).controlFor('pref').type).to.equal('json');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
describe('enumOptions', () => {
|
|
139
|
+
it('uses the value as the label and enumDescriptions as the option description (never the description as the label)', () => {
|
|
140
|
+
const options = createServiceWithSchema({
|
|
141
|
+
type: 'string',
|
|
142
|
+
enum: ['default', 'enabled'],
|
|
143
|
+
enumDescriptions: ['Use the default', 'Force enabled']
|
|
144
|
+
}).enumOptions('pref');
|
|
145
|
+
(0, chai_1.expect)(options).to.deep.equal([
|
|
146
|
+
{ value: 'default', label: 'default', description: 'Use the default' },
|
|
147
|
+
{ value: 'enabled', label: 'enabled', description: 'Force enabled' }
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
it('prefers an explicit enumItemLabels entry for the label', () => {
|
|
151
|
+
const options = createServiceWithSchema({
|
|
152
|
+
type: 'string',
|
|
153
|
+
enum: ['a'],
|
|
154
|
+
enumItemLabels: ['Option A'],
|
|
155
|
+
enumDescriptions: ['desc']
|
|
156
|
+
}).enumOptions('pref');
|
|
157
|
+
(0, chai_1.expect)(options[0]).to.deep.equal({ value: 'a', label: 'Option A', description: 'desc' });
|
|
158
|
+
});
|
|
159
|
+
it('returns an empty list when the property declares no enum', () => {
|
|
160
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string' }).enumOptions('pref')).to.deep.equal([]);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
describe('modelProviderLabel', () => {
|
|
164
|
+
it('returns the provider label declared under the aiModelProvider typeDetails', () => {
|
|
165
|
+
const service = createServiceWithSchema({ type: 'string', typeDetails: { aiModelProvider: { label: 'Anthropic' } } });
|
|
166
|
+
(0, chai_1.expect)(service.modelProviderLabel('pref')).to.equal('Anthropic');
|
|
167
|
+
});
|
|
168
|
+
it('returns undefined when no provider label is declared', () => {
|
|
169
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string' }).modelProviderLabel('pref')).to.equal(undefined);
|
|
170
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string', typeDetails: { other: 'x' } }).modelProviderLabel('pref')).to.equal(undefined);
|
|
171
|
+
// The metadata must be an object carrying a string `label`.
|
|
172
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string', typeDetails: { aiModelProvider: 'Anthropic' } }).modelProviderLabel('pref')).to.equal(undefined);
|
|
173
|
+
(0, chai_1.expect)(createServiceWithSchema({ type: 'string', typeDetails: { aiModelProvider: { label: 42 } } }).modelProviderLabel('pref')).to.equal(undefined);
|
|
174
|
+
(0, chai_1.expect)(createServiceWithSchema(undefined).modelProviderLabel('pref')).to.equal(undefined);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe('editInSettings', () => {
|
|
178
|
+
it('opens settings.json focused on the preference via the preferences JSON command', () => {
|
|
179
|
+
const executed = [];
|
|
180
|
+
const service = new ai_settings_row_service_1.AiSettingsRowService();
|
|
181
|
+
service.commandService = {
|
|
182
|
+
executeCommand: (command, ...args) => {
|
|
183
|
+
executed.push({ command, args });
|
|
184
|
+
return Promise.resolve(undefined);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
service.editInSettings('my.pref');
|
|
188
|
+
(0, chai_1.expect)(executed).to.deep.equal([{ command: preference_types_1.PreferencesCommands.OPEN_PREFERENCES_JSON_TOOLBAR.id, args: ['my.pref'] }]);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
describe('normalizeMarkdown', () => {
|
|
192
|
+
const normalize = (markdown) => new ai_settings_row_service_1.AiSettingsRowService().normalizeMarkdown(markdown);
|
|
193
|
+
it('strips the shared indentation of continuation lines so lists render as lists', () => {
|
|
194
|
+
const raw = [
|
|
195
|
+
'Allows custom settings.',
|
|
196
|
+
' Each setting consists of:',
|
|
197
|
+
' - `scope`: when it applies',
|
|
198
|
+
' - `modelId` (optional)',
|
|
199
|
+
' - `requestSettings`: values'
|
|
200
|
+
].join('\n');
|
|
201
|
+
const expected = [
|
|
202
|
+
'Allows custom settings.',
|
|
203
|
+
'Each setting consists of:',
|
|
204
|
+
'- `scope`: when it applies',
|
|
205
|
+
' - `modelId` (optional)',
|
|
206
|
+
'- `requestSettings`: values'
|
|
207
|
+
].join('\n');
|
|
208
|
+
(0, chai_1.expect)(normalize(raw)).to.equal(expected);
|
|
209
|
+
});
|
|
210
|
+
it('leaves single-line and already-flush descriptions untouched', () => {
|
|
211
|
+
(0, chai_1.expect)(normalize('A short description.')).to.equal('A short description.');
|
|
212
|
+
(0, chai_1.expect)(normalize('First line.\nSecond line.')).to.equal('First line.\nSecond line.');
|
|
213
|
+
});
|
|
214
|
+
it('ignores blank lines when computing the shared indentation', () => {
|
|
215
|
+
(0, chai_1.expect)(normalize('Intro.\n\n - item')).to.equal('Intro.\n\n- item');
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
describe('set / reset', () => {
|
|
219
|
+
it('writes to the mapped preference scope', () => {
|
|
220
|
+
const { service, preferences } = createService({});
|
|
221
|
+
return service.set('pref', 42, 'workspace').then(() => {
|
|
222
|
+
(0, chai_1.expect)(preferences.sets).to.deep.equal([{ preferenceId: 'pref', value: 42, scope: common_1.PreferenceScope.Workspace, resourceUri: undefined }]);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
it('resets by writing `undefined` to the mapped scope', () => {
|
|
226
|
+
const { service, preferences } = createService({});
|
|
227
|
+
return service.reset('pref', 'user', 'file:///ws').then(() => {
|
|
228
|
+
(0, chai_1.expect)(preferences.sets).to.deep.equal([{ preferenceId: 'pref', value: undefined, scope: common_1.PreferenceScope.User, resourceUri: 'file:///ws' }]);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=ai-settings-row-service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-settings-row-service.spec.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/ai-settings-row-service.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AAEjC,mDAA+F;AAE/F,2FAA2F;AAE3F,+BAA8B;AAC9B,uEAAiE;AAEjE,YAAY,EAAE,CAAC;AASf,MAAM,0BAA0B;IAAhC;QACI,eAAU,GAA2C,EAAE,CAAC;QAC/C,SAAI,GAAkB,EAAE,CAAC;IAkBtC,CAAC;IAhBG,OAAO;QACH,OAAO;YACH,cAAc,EAAE,MAAM;YACtB,YAAY,EAAE,SAAS;YACvB,WAAW,EAAE,SAAS;YACtB,cAAc,EAAE,SAAS;YACzB,oBAAoB,EAAE,SAAS;YAC/B,KAAK,EAAE,SAAS;YAChB,GAAG,IAAI,CAAC,UAAU;SACrB,CAAC;IACN,CAAC;IAED,GAAG,CAAC,YAAoB,EAAE,KAAc,EAAE,KAAuB,EAAE,WAAoB;QACnF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5D,OAAO,OA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,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;YACnD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAClD,IAAA,aAAM,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,wBAAe,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAC5I,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YACzD,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;YACnD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACzD,IAAA,aAAM,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,wBAAe,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;YACjJ,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from '@theia/core/shared/react';
|
|
2
|
+
import { AiConfigurationScope } from '../ai-configuration-category';
|
|
3
|
+
import { AiSettingsControl, AiSettingsRowService } from './ai-settings-row-service';
|
|
4
|
+
export interface AiSettingsRowProps {
|
|
5
|
+
/** Service wrapping preference read/write and markdown rendering (injected by the owning widget). */
|
|
6
|
+
readonly service: AiSettingsRowService;
|
|
7
|
+
/** Preference id read and written by this row. */
|
|
8
|
+
readonly preferenceId: string;
|
|
9
|
+
/** Row label. Falls back to the preference id when omitted. */
|
|
10
|
+
readonly label?: string;
|
|
11
|
+
/** Optional markdown description rendered under the label. */
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/** Scope the row reads from and writes to (from the render context). */
|
|
14
|
+
readonly scope: AiConfigurationScope;
|
|
15
|
+
/** The control to render for the value. */
|
|
16
|
+
readonly control: AiSettingsControl;
|
|
17
|
+
/** Renders the control read-only, e.g. while the setting's feature gate is turned off. */
|
|
18
|
+
readonly disabled?: boolean;
|
|
19
|
+
/** Resource URI for `folder`-scoped preferences. */
|
|
20
|
+
readonly resourceUri?: string;
|
|
21
|
+
/** Called after a value is written or reset, so the owner can re-render. */
|
|
22
|
+
readonly onDidChange?: () => void;
|
|
23
|
+
/** Stable id used by the shell to scroll-to and flash this row after deep-search navigation. */
|
|
24
|
+
readonly rowId?: string;
|
|
25
|
+
/** Extra action(s) shown top-right (e.g. a "Reset All" button); forwarded to the presentational row. */
|
|
26
|
+
readonly actions?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Service-driven per-setting row: reads/writes a preference id via the injected
|
|
30
|
+
* {@link AiSettingsRowService} and renders through the shared {@link AiConfigurationSettingRow}, so
|
|
31
|
+
* it looks identical to the hand-authored rows on the General and Models pages. The control is chosen
|
|
32
|
+
* from {@link AiSettingsRowProps.control}; compact controls render inline, wide ones (chips, text)
|
|
33
|
+
* render full-width below.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AiSettingsRow: React.FC<AiSettingsRowProps>;
|
|
36
|
+
/**
|
|
37
|
+
* Renders the shared control for a schema-derived {@link AiSettingsControl}, so generically-discovered
|
|
38
|
+
* preferences get the same controls as the hand-authored pages. Boolean→toggle, number→stepper,
|
|
39
|
+
* enum→select, array→chip editor, object/array-of-objects→"Edit in settings.json", everything else→text.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AiSettingsRowControl: React.FC<{
|
|
42
|
+
control: AiSettingsControl;
|
|
43
|
+
value: unknown;
|
|
44
|
+
label: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
onCommit: (value: unknown) => void;
|
|
47
|
+
/** Invoked by the `json` control to open `settings.json` focused on the preference. */
|
|
48
|
+
onEditInSettings: () => void;
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=ai-settings-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-settings-row.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/ai-settings-row.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIpF,MAAM,WAAW,kBAAkB;IAC/B,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,kDAAkD;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,gGAAgG;IAChG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wGAAwG;IACxG,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC;AASD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6CtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,uFAAuF;IACvF,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAChC,CAqDA,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiSettingsRowControl = exports.AiSettingsRow = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@theia/core/shared/react/jsx-runtime");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const React = require("@theia/core/shared/react");
|
|
22
|
+
const ai_configuration_controls_1 = require("./ai-configuration-controls");
|
|
23
|
+
const ai_configuration_setting_row_1 = require("./ai-configuration-setting-row");
|
|
24
|
+
/**
|
|
25
|
+
* Every control renders full-width below the label/description except the boolean toggle, which stays inline
|
|
26
|
+
* on the right. This gives a single, consistent layout across the pages (mirroring the Settings UI, where the
|
|
27
|
+
* control sits under the description) instead of mixing right-aligned and below controls.
|
|
28
|
+
*/
|
|
29
|
+
const INLINE_CONTROL_TYPES = new Set(['boolean']);
|
|
30
|
+
/**
|
|
31
|
+
* Service-driven per-setting row: reads/writes a preference id via the injected
|
|
32
|
+
* {@link AiSettingsRowService} and renders through the shared {@link AiConfigurationSettingRow}, so
|
|
33
|
+
* it looks identical to the hand-authored rows on the General and Models pages. The control is chosen
|
|
34
|
+
* from {@link AiSettingsRowProps.control}; compact controls render inline, wide ones (chips, text)
|
|
35
|
+
* render full-width below.
|
|
36
|
+
*/
|
|
37
|
+
const AiSettingsRow = ({ service, preferenceId, label, description, scope, control, disabled, resourceUri, onDidChange, rowId, actions }) => {
|
|
38
|
+
const inspection = service.inspect(preferenceId, scope, resourceUri);
|
|
39
|
+
// Fall back to the (already-localized) label and description from the preference schema.
|
|
40
|
+
const described = service.describe(preferenceId);
|
|
41
|
+
const effectiveLabel = label ?? described.label ?? preferenceId;
|
|
42
|
+
const effectiveDescription = description ?? described.description;
|
|
43
|
+
// Stable identity so the description's effect does not re-render markdown on every render.
|
|
44
|
+
const renderMarkdown = React.useCallback((markdown) => service.renderMarkdown(markdown), [service]);
|
|
45
|
+
const commit = (value) => {
|
|
46
|
+
service.set(preferenceId, value, scope, resourceUri)
|
|
47
|
+
.then(() => onDidChange?.())
|
|
48
|
+
// `console` rather than an `ILogger`: these row components are deliberately DI-free, so there is
|
|
49
|
+
// no injection context here (the service they write through is the injected part).
|
|
50
|
+
.catch(error => console.error(`Failed to set preference '${preferenceId}'`, error));
|
|
51
|
+
};
|
|
52
|
+
const openMenu = React.useCallback((gear) => service.openSettingContextMenu(gear, preferenceId, inspection.value, scope, resourceUri), [service, preferenceId, inspection.value, scope, resourceUri]);
|
|
53
|
+
const controlNode = (0, jsx_runtime_1.jsx)(exports.AiSettingsRowControl, { control: control, value: inspection.value, label: effectiveLabel, disabled: disabled, onCommit: commit, onEditInSettings: () => service.editInSettings(preferenceId) });
|
|
54
|
+
const below = !INLINE_CONTROL_TYPES.has(control.type);
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_setting_row_1.AiConfigurationSettingRow, { preferenceId: rowId ?? preferenceId, title: effectiveLabel, description: effectiveDescription, renderMarkdown: renderMarkdown, modified: inspection.modified, tags: service.tags(preferenceId), onOpenMenu: openMenu, control: below ? undefined : controlNode, below: below ? controlNode : undefined, actions: actions });
|
|
56
|
+
};
|
|
57
|
+
exports.AiSettingsRow = AiSettingsRow;
|
|
58
|
+
/**
|
|
59
|
+
* Renders the shared control for a schema-derived {@link AiSettingsControl}, so generically-discovered
|
|
60
|
+
* preferences get the same controls as the hand-authored pages. Boolean→toggle, number→stepper,
|
|
61
|
+
* enum→select, array→chip editor, object/array-of-objects→"Edit in settings.json", everything else→text.
|
|
62
|
+
*/
|
|
63
|
+
const AiSettingsRowControl = ({ control, value, label, disabled, onCommit, onEditInSettings }) => {
|
|
64
|
+
switch (control.type) {
|
|
65
|
+
case 'boolean':
|
|
66
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiToggleSwitch, { checked: value === true, ariaLabel: label, disabled: disabled, onChange: onCommit });
|
|
67
|
+
case 'select':
|
|
68
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiEnumSelect, { value: value === undefined ? undefined : String(value), ariaLabel: label, disabled: disabled, options: control.options.map(option => ({
|
|
69
|
+
value: String(option.value ?? ''),
|
|
70
|
+
label: option.label ?? String(option.value ?? ''),
|
|
71
|
+
title: option.description
|
|
72
|
+
})), onCommit: onCommit });
|
|
73
|
+
case 'number':
|
|
74
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiNumberStepper, { value: typeof value === 'number' ? value : (control.min ?? 0), ariaLabel: label, integer: control.integer, min: control.min, max: control.max, disabled: disabled, onCommit: onCommit });
|
|
75
|
+
case 'array':
|
|
76
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiArrayInput, { values: Array.isArray(value) ? value.map(String) : [], ariaLabel: label, addPlaceholder: control.placeholder ?? core_1.nls.localize('theia/ai/core/aiConfiguration/addValue', 'Add Value...'), validate: control.validate, disabled: disabled, onChange: onCommit });
|
|
77
|
+
case 'json':
|
|
78
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiEditInSettingsButton, { label: core_1.nls.localizeByDefault('Edit in settings.json'), ariaLabel: label, disabled: disabled, onClick: onEditInSettings });
|
|
79
|
+
case 'string':
|
|
80
|
+
default:
|
|
81
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_controls_1.AiTextInput, { value: typeof value === 'string' ? value : '', ariaLabel: label, placeholder: control.type === 'string' ? control.placeholder : undefined, password: control.type === 'string' ? control.password : undefined, disabled: disabled, onCommit: onCommit });
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.AiSettingsRowControl = AiSettingsRowControl;
|
|
85
|
+
//# sourceMappingURL=ai-settings-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-settings-row.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/ai-settings-row.tsx"],"names":[],"mappings":";;;;AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,sCAAkC;AAClC,kDAAkD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C,EAAE,EACrD,SAAS,EAAE,KAAK,EAChB,cAAc,EAAE,OAAO,CAAC,WAAW,IAAI,UAAG,CAAC,QAAQ,CAAC,wCAAwC,EAAE,cAAc,CAAC,EAC7G,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GACpB,CAAC;QACP,KAAK,MAAM;YACP,OAAO,uBAAC,kDAAsB,IAC1B,KAAK,EAAE,UAAG,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,EACrD,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,GAC3B,CAAC;QACP,KAAK,QAAQ,CAAC;QACd;YACI,OAAO,uBAAC,uCAAW,IACf,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAC7C,SAAS,EAAE,KAAK,EAChB,WAAW,EAAE,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EACxE,QAAQ,EAAE,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAClE,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GACpB,CAAC;IACX,CAAC;AACL,CAAC,CAAC;AA7DW,QAAA,oBAAoB,wBA6D/B"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from '@theia/core/shared/react';
|
|
2
|
+
import { AiConfigurationOrigin } from './ai-configuration-origin-badge';
|
|
3
|
+
/** One expandable row of a {@link CollapsibleList}. */
|
|
4
|
+
export interface CollapsibleRow {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Header title (e.g. a variable reference, a skill name, a `/command`). */
|
|
7
|
+
readonly title: React.ReactNode;
|
|
8
|
+
/** One-line description; shown inline while collapsed and as a paragraph while expanded. */
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
/** Short badges shown before the actions, e.g. an argument count or the single agent using the row. */
|
|
11
|
+
readonly pills?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Where the row's entry came from, when that is not the user. Shown after the pills as the same
|
|
14
|
+
* {@link AiConfigurationOriginBadge}s a collection item carries, and reachable while the row is
|
|
15
|
+
* collapsed - provenance is something you scan a list for, not something you expand rows to find.
|
|
16
|
+
*/
|
|
17
|
+
readonly origins?: AiConfigurationOrigin[];
|
|
18
|
+
/**
|
|
19
|
+
* Actions rendered at the row's trailing edge, after the pills, and available whether the row is
|
|
20
|
+
* expanded or not. Use {@link CollapsibleRowAction}, which stops the click from toggling the row.
|
|
21
|
+
*/
|
|
22
|
+
readonly actions?: React.ReactNode;
|
|
23
|
+
/** Content revealed when the row is expanded (below the description). */
|
|
24
|
+
readonly body?: React.ReactNode;
|
|
25
|
+
/** Lower-cased haystack used by the in-list filter. */
|
|
26
|
+
readonly filterText: string;
|
|
27
|
+
}
|
|
28
|
+
/** A titled group of {@link CollapsibleRow}s. */
|
|
29
|
+
export interface CollapsibleGroup {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly title: string;
|
|
32
|
+
readonly description?: string;
|
|
33
|
+
readonly rows: CollapsibleRow[];
|
|
34
|
+
}
|
|
35
|
+
export interface CollapsibleListProps {
|
|
36
|
+
readonly groups: CollapsibleGroup[];
|
|
37
|
+
readonly filterPlaceholder: string;
|
|
38
|
+
/** Shown when there are no rows at all. */
|
|
39
|
+
readonly emptyMessage: string;
|
|
40
|
+
/** Shown when the filter query matches nothing. */
|
|
41
|
+
readonly filterEmptyMessage: (query: string) => string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A filterable list of expandable rows grouped under titled sections, available to any
|
|
45
|
+
* {@link AiConfigurationCategory} that presents a long, browsable list (the Variables and the
|
|
46
|
+
* Skills & Slash Commands pages use it). Owns the local filter and per-row expansion state so both
|
|
47
|
+
* reset when the page is navigated away from (the component unmounts).
|
|
48
|
+
*
|
|
49
|
+
* All classes are prefixed `ai-config-collapsible-` and are styled in `ai-configuration-components.css`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const CollapsibleList: React.FC<CollapsibleListProps>;
|
|
52
|
+
export interface CollapsibleRowActionProps {
|
|
53
|
+
/** `codicon(...)` class, e.g. `edit` to open the underlying text, `discard` to reset it. */
|
|
54
|
+
readonly iconClass: string;
|
|
55
|
+
/** Tooltip and accessible name; actions are icon-only. */
|
|
56
|
+
readonly label: string;
|
|
57
|
+
readonly disabled?: boolean;
|
|
58
|
+
readonly onActivate: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One icon action in a {@link CollapsibleRow}'s trailing slot. Stops the click from reaching the header,
|
|
62
|
+
* which would otherwise expand or collapse the row.
|
|
63
|
+
*/
|
|
64
|
+
export declare const CollapsibleRowAction: React.FC<CollapsibleRowActionProps>;
|
|
65
|
+
//# sourceMappingURL=collapsible-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-list.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/collapsible-list.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,iCAAiC,CAAC;AAErG,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,uGAAuG;IACvG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,E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2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollapsibleRowAction = exports.CollapsibleList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@theia/core/shared/react/jsx-runtime");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const React = require("@theia/core/shared/react");
|
|
22
|
+
const ai_configuration_primitives_1 = require("./ai-configuration-primitives");
|
|
23
|
+
const ai_configuration_origin_badge_1 = require("./ai-configuration-origin-badge");
|
|
24
|
+
/**
|
|
25
|
+
* A filterable list of expandable rows grouped under titled sections, available to any
|
|
26
|
+
* {@link AiConfigurationCategory} that presents a long, browsable list (the Variables and the
|
|
27
|
+
* Skills & Slash Commands pages use it). Owns the local filter and per-row expansion state so both
|
|
28
|
+
* reset when the page is navigated away from (the component unmounts).
|
|
29
|
+
*
|
|
30
|
+
* All classes are prefixed `ai-config-collapsible-` and are styled in `ai-configuration-components.css`.
|
|
31
|
+
*/
|
|
32
|
+
const CollapsibleList = ({ groups, filterPlaceholder, emptyMessage, filterEmptyMessage }) => {
|
|
33
|
+
const [filter, setFilter] = React.useState('');
|
|
34
|
+
const [expanded, setExpanded] = React.useState(() => new Set());
|
|
35
|
+
const toggle = React.useCallback((id) => setExpanded(previous => {
|
|
36
|
+
const next = new Set(previous);
|
|
37
|
+
if (next.has(id)) {
|
|
38
|
+
next.delete(id);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
next.add(id);
|
|
42
|
+
}
|
|
43
|
+
return next;
|
|
44
|
+
}), []);
|
|
45
|
+
const query = filter.trim().toLocaleLowerCase();
|
|
46
|
+
const filtering = query.length > 0;
|
|
47
|
+
const visibleGroups = groups
|
|
48
|
+
.map(group => ({ group, rows: filtering ? group.rows.filter(row => row.filterText.includes(query)) : group.rows }))
|
|
49
|
+
.filter(entry => entry.rows.length > 0);
|
|
50
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'ai-config-collapsible-list', children: [(0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationFilterInput, { value: filter, onChange: setFilter, placeholder: filterPlaceholder }), visibleGroups.length === 0
|
|
51
|
+
? (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationEmptyState, { iconClass: (0, browser_1.codicon)('search'), message: filtering ? filterEmptyMessage(filter.trim()) : emptyMessage })
|
|
52
|
+
: (0, jsx_runtime_1.jsx)("div", { className: 'ai-configuration-sections', children: visibleGroups.map(({ group, rows }) => (0, jsx_runtime_1.jsx)(CollapsibleGroupView, { title: group.title, description: group.description, rows: rows, expanded: expanded, onToggle: toggle, filtering: filtering }, group.id)) })] });
|
|
53
|
+
};
|
|
54
|
+
exports.CollapsibleList = CollapsibleList;
|
|
55
|
+
const CollapsibleGroupView = ({ title, description, rows, expanded, onToggle, filtering }) =>
|
|
56
|
+
// The count is of the rows actually shown, so it tracks the filter rather than promising hidden entries.
|
|
57
|
+
(0, jsx_runtime_1.jsxs)(ai_configuration_primitives_1.AiConfigurationSection, { title: title, count: rows.length, collapsible: true, forceExpanded: filtering, className: 'ai-config-collapsible-group', children: [description && (0, jsx_runtime_1.jsx)("div", { className: 'ai-config-collapsible-group-description', children: description }), rows.map(row => (0, jsx_runtime_1.jsx)(CollapsibleRowView, { row: row, expanded: expanded.has(row.id), onToggle: onToggle }, row.id))] });
|
|
58
|
+
/**
|
|
59
|
+
* One icon action in a {@link CollapsibleRow}'s trailing slot. Stops the click from reaching the header,
|
|
60
|
+
* which would otherwise expand or collapse the row.
|
|
61
|
+
*/
|
|
62
|
+
const CollapsibleRowAction = ({ iconClass, label, disabled, onActivate }) => ((0, jsx_runtime_1.jsx)("button", { type: 'button', className: 'ai-config-collapsible-row-action', "aria-label": label, title: label, disabled: disabled, onClick: event => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
onActivate();
|
|
65
|
+
}, children: (0, jsx_runtime_1.jsx)("span", { "aria-hidden": 'true', className: iconClass }) }));
|
|
66
|
+
exports.CollapsibleRowAction = CollapsibleRowAction;
|
|
67
|
+
const CollapsibleRowView = ({ row, expanded, onToggle }) => {
|
|
68
|
+
const bodyId = `ai-collapsible-body-${row.id}`;
|
|
69
|
+
const toggle = React.useCallback(() => onToggle(row.id), [onToggle, row.id]);
|
|
70
|
+
// Only toggle when the header itself has focus; keystrokes on nested controls (the action button)
|
|
71
|
+
// must not bubble up and collapse the row.
|
|
72
|
+
const onHeaderKeyDown = React.useCallback((event) => {
|
|
73
|
+
if (event.target === event.currentTarget && (event.key === 'Enter' || event.key === ' ')) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
toggle();
|
|
76
|
+
}
|
|
77
|
+
}, [toggle]);
|
|
78
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'ai-config-collapsible-row', "data-ai-config-row-id": row.id, children: [(0, jsx_runtime_1.jsxs)("div", { className: `ai-config-collapsible-row-header ${expanded ? 'expanded' : ''}`, role: 'button', tabIndex: 0, "aria-expanded": expanded, "aria-controls": expanded ? bodyId : undefined, onClick: toggle, onKeyDown: onHeaderKeyDown, children: [(0, jsx_runtime_1.jsx)("span", { "aria-hidden": 'true', className: `ai-config-collapsible-expansion-icon ${(0, browser_1.codicon)(expanded ? 'chevron-down' : 'chevron-right')}` }), (0, jsx_runtime_1.jsx)("span", { className: 'ai-config-collapsible-row-title', children: row.title }), expanded
|
|
79
|
+
? (0, jsx_runtime_1.jsx)("span", { className: 'ai-config-collapsible-inline-description-spacer', "aria-hidden": 'true' })
|
|
80
|
+
: (0, jsx_runtime_1.jsx)("span", { className: 'ai-config-collapsible-inline-description', title: row.description || undefined, children: row.description }), ((row.pills && row.pills.length > 0) || (row.origins && row.origins.length > 0)) && (0, jsx_runtime_1.jsxs)("div", { className: 'ai-config-collapsible-row-meta', children: [row.pills?.map((pill, index) => (0, jsx_runtime_1.jsx)("span", { className: 'ai-config-collapsible-count-pill', children: pill }, index)), (0, jsx_runtime_1.jsx)(ai_configuration_origin_badge_1.AiConfigurationOriginBadges, { origins: row.origins })] }), row.actions && (0, jsx_runtime_1.jsx)("div", { className: 'ai-config-collapsible-row-actions', children: row.actions })] }), expanded && (0, jsx_runtime_1.jsxs)("div", { className: 'ai-config-collapsible-row-body', id: bodyId, children: [row.description && (0, jsx_runtime_1.jsx)("p", { className: 'ai-config-collapsible-full-description', children: row.description }), row.body] })] });
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=collapsible-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-list.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/collapsible-list.tsx"],"names":[],"mappings":";;;;AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,qDAAkD;AAClD,kDAAkD;AAClD,+EAA8H;AAC9H,mFAAqG;AA6CrG;;;;;;;GAOG;AACI,MAAM,eAAe,GAAmC,CAAC,EAAE,MAAM,EAAE,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E,GAAG,CAAC,OAAO,GAAI,IACnD,EAEL,GAAG,CAAC,OAAO,IAAI,gCAAK,SAAS,EAAC,mCAAmC,YAAE,GAAG,CAAC,OAAO,GAAO,IACpF,EACL,QAAQ,IAAI,iCAAK,SAAS,EAAC,gCAAgC,EAAC,EAAE,EAAE,MAAM,aAClE,GAAG,CAAC,WAAW,IAAI,8BAAG,SAAS,EAAC,wCAAwC,YAAE,GAAG,CAAC,WAAW,GAAK,EAC9F,GAAG,CAAC,IAAI,IACP,IACJ,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PromptService } from '@theia/ai-core/lib/common/prompt-service';
|
|
2
|
+
/**
|
|
3
|
+
* The two ways to undo a customized prompt fragment, shared by every page that offers them (the agent
|
|
4
|
+
* detail's prompt variant sets and the Prompt Snippets list).
|
|
5
|
+
*
|
|
6
|
+
* Which one applies depends on whether a built-in exists: `resetToBuiltIn` deliberately does nothing for a
|
|
7
|
+
* fragment that has none — a user-authored file such as a custom prompt variant — so those must be deleted
|
|
8
|
+
* instead. Offering reset there is a dead button, which is exactly what this namespace exists to prevent.
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace PromptCustomizationDialogs {
|
|
11
|
+
/**
|
|
12
|
+
* Whether a built-in fragment stands behind `fragmentId`, i.e. whether resetting has anything to fall
|
|
13
|
+
* back to. `false` for a fragment that only exists as a user or workspace file.
|
|
14
|
+
*/
|
|
15
|
+
function hasBuiltIn(promptService: PromptService, fragmentId: string): boolean;
|
|
16
|
+
interface RemoveOptions {
|
|
17
|
+
readonly title: string;
|
|
18
|
+
/**
|
|
19
|
+
* Builds the confirmation text. `type` is where the customization lives (e.g. "Prompt Templates
|
|
20
|
+
* Folder") and `description` identifies it concretely (e.g. the file URI); either can be unavailable.
|
|
21
|
+
*/
|
|
22
|
+
readonly message: (details: {
|
|
23
|
+
type?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}) => string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Asks for confirmation — naming where the customization lives, so the user can see which file is about
|
|
29
|
+
* to go — and then deletes it. Resolves to `true` when it was removed.
|
|
30
|
+
*/
|
|
31
|
+
function confirmAndRemove(promptService: PromptService, fragmentId: string, options: RemoveOptions): Promise<boolean>;
|
|
32
|
+
/** Asks for confirmation and then drops every customization, so the built-in text applies again. */
|
|
33
|
+
function confirmAndReset(promptService: PromptService, fragmentId: string, title: string, message: string): Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=prompt-customization-dialogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-customization-dialogs.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/components/prompt-customization-dialogs.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8B,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAErG;;;;;;;GAOG;AACH,yBAAiB,0BAA0B,CAAC;IAExC;;;OAGG;IACH,SAAgB,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGpF;IAED,UAAiB,aAAa;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB;;;WAGG;QACH,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,MAAM,CAAC;KAClF;IAED;;;OAGG;IACH,SAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBjI;IAED,oGAAoG;IACpG,SAAsB,eAAe,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYxI;CACJ"}
|