@mrclrchtr/supi-lsp 2.1.0 → 2.2.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/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/package.json +3 -3
- package/src/config/lsp-settings.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
|
@@ -1,79 +1,21 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Declarative settings overlay for SuPi extensions.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Thin orchestration layer that collects settings contributions and opens the
|
|
4
|
+
// scoped settings list inside a pi-tui custom component overlay.
|
|
5
5
|
|
|
6
6
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
Input,
|
|
11
|
-
Key,
|
|
12
|
-
matchesKey,
|
|
13
|
-
type SelectItem,
|
|
14
|
-
SelectList,
|
|
15
|
-
type SelectListTheme,
|
|
16
|
-
type SettingItem,
|
|
17
|
-
SettingsList,
|
|
18
|
-
Text,
|
|
19
|
-
} from "@earendil-works/pi-tui";
|
|
20
|
-
import { getSelectableModels } from "../model-selection.ts";
|
|
7
|
+
import { Container, Key, matchesKey, Text } from "@earendil-works/pi-tui";
|
|
8
|
+
import { ScopedSettingsList } from "./scoped-settings-list.ts";
|
|
9
|
+
import type { SettingsCollectionDiagnostic, SettingsScope } from "./settings-registry.ts";
|
|
21
10
|
import {
|
|
22
11
|
createSettingsContributionCollector,
|
|
23
|
-
type SettingsCollectionDiagnostic,
|
|
24
|
-
type SettingsScope,
|
|
25
|
-
type SettingsSection,
|
|
26
12
|
SUPI_SETTINGS_COLLECT_EVENT,
|
|
27
13
|
} from "./settings-registry.ts";
|
|
28
14
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a pi-tui Input-backed submenu component with enter-to-confirm
|
|
33
|
-
* and escape-to-cancel handling.
|
|
34
|
-
*
|
|
35
|
-
* @param currentValue - Initial value for the text input.
|
|
36
|
-
* @param label - Label text displayed above the input.
|
|
37
|
-
* @param done - Callback invoked with the confirmed value, or undefined on cancel.
|
|
38
|
-
*/
|
|
39
|
-
export function createInputSubmenu(
|
|
40
|
-
currentValue: string,
|
|
41
|
-
label: string,
|
|
42
|
-
done: (selectedValue?: string) => void,
|
|
43
|
-
): {
|
|
44
|
-
render: (width: number) => string[];
|
|
45
|
-
invalidate: () => void;
|
|
46
|
-
handleInput: (data: string) => boolean;
|
|
47
|
-
} {
|
|
48
|
-
const input = new Input();
|
|
49
|
-
input.setValue(currentValue);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
render: (_width: number) => {
|
|
53
|
-
const lines = [` ${label}`];
|
|
54
|
-
lines.push(...input.render(_width));
|
|
55
|
-
lines.push(" enter confirm • esc cancel");
|
|
56
|
-
return lines;
|
|
57
|
-
},
|
|
58
|
-
invalidate: () => {
|
|
59
|
-
input.invalidate();
|
|
60
|
-
},
|
|
61
|
-
handleInput: (data: string) => {
|
|
62
|
-
if (matchesKey(data, Key.escape)) {
|
|
63
|
-
done();
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
if (matchesKey(data, Key.enter)) {
|
|
67
|
-
done(input.getValue());
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
input.handleInput(data);
|
|
71
|
-
return true;
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
15
|
+
// Re-export submenu helpers
|
|
16
|
+
export { createInputSubmenu, createModelPickerSubmenu } from "./settings-submenus.ts";
|
|
75
17
|
|
|
76
|
-
// ──
|
|
18
|
+
// ── Overlay ────────────────────────────────────────────────────────────────
|
|
77
19
|
|
|
78
20
|
interface OverlayStatus {
|
|
79
21
|
kind: "warning" | "error";
|
|
@@ -86,45 +28,10 @@ interface OverlayState {
|
|
|
86
28
|
status?: OverlayStatus;
|
|
87
29
|
}
|
|
88
30
|
|
|
89
|
-
// ── Pure helpers ─────────────────────────────────────────────
|
|
90
|
-
|
|
91
31
|
function getScopeLabel(scope: SettingsScope): string {
|
|
92
32
|
return scope === "project" ? "Project" : "Global";
|
|
93
33
|
}
|
|
94
34
|
|
|
95
|
-
function buildFlatItems(
|
|
96
|
-
sections: SettingsSection[],
|
|
97
|
-
scope: SettingsScope,
|
|
98
|
-
cwd: string,
|
|
99
|
-
ctx?: ExtensionContext,
|
|
100
|
-
): SettingItem[] {
|
|
101
|
-
const items: SettingItem[] = [];
|
|
102
|
-
for (const section of sections) {
|
|
103
|
-
const sectionItems = section.loadValues(scope, cwd, ctx);
|
|
104
|
-
for (const item of sectionItems) {
|
|
105
|
-
items.push({
|
|
106
|
-
...item,
|
|
107
|
-
id: `${section.id}.${item.id}`,
|
|
108
|
-
label: `${section.label}: ${item.label}`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return items;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function findSectionAndId(
|
|
116
|
-
sections: SettingsSection[],
|
|
117
|
-
flatId: string,
|
|
118
|
-
): { section: SettingsSection; itemId: string } | null {
|
|
119
|
-
const dotIndex = flatId.indexOf(".");
|
|
120
|
-
if (dotIndex === -1) return null;
|
|
121
|
-
const sectionId = flatId.slice(0, dotIndex);
|
|
122
|
-
const itemId = flatId.slice(dotIndex + 1);
|
|
123
|
-
const section = sections.find((s) => s.id === sectionId);
|
|
124
|
-
if (!section) return null;
|
|
125
|
-
return { section, itemId };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
35
|
function collectSettingsSections(pi: ExtensionAPI) {
|
|
129
36
|
const collector = createSettingsContributionCollector();
|
|
130
37
|
pi.events.emit(SUPI_SETTINGS_COLLECT_EVENT, collector);
|
|
@@ -136,199 +43,6 @@ function latestStatus(diagnostics: SettingsCollectionDiagnostic[]): OverlayStatu
|
|
|
136
43
|
return latest ? { kind: latest.kind, message: latest.message } : undefined;
|
|
137
44
|
}
|
|
138
45
|
|
|
139
|
-
function formatSettingsError(settingId: string, error: unknown): string {
|
|
140
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
141
|
-
return `Could not save SuPi setting "${settingId}": ${message}`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ── Component ────────────────────────────────────────────────
|
|
145
|
-
|
|
146
|
-
interface SettingsOverlayDeps {
|
|
147
|
-
ctx: ExtensionContext;
|
|
148
|
-
sections: SettingsSection[];
|
|
149
|
-
state: OverlayState;
|
|
150
|
-
container: Container;
|
|
151
|
-
settingsList: SettingsList | null;
|
|
152
|
-
tui: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[0];
|
|
153
|
-
theme: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[1];
|
|
154
|
-
done: () => void;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function createSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
158
|
-
const items = buildFlatItems(deps.sections, deps.state.scope, deps.state.cwd, deps.ctx);
|
|
159
|
-
const onChange = (flatId: string, newValue: string) => {
|
|
160
|
-
const found = findSectionAndId(deps.sections, flatId);
|
|
161
|
-
try {
|
|
162
|
-
if (found) {
|
|
163
|
-
found.section.persistChange(deps.state.scope, deps.state.cwd, found.itemId, newValue);
|
|
164
|
-
deps.state.status = undefined;
|
|
165
|
-
}
|
|
166
|
-
} catch (error) {
|
|
167
|
-
deps.state.status = {
|
|
168
|
-
kind: "error",
|
|
169
|
-
message: formatSettingsError(found?.itemId ?? flatId, error),
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
// Re-read all values to reflect persisted changes, but keep the list
|
|
173
|
-
// instance (and its selectedIndex) intact.
|
|
174
|
-
const updatedItems = buildFlatItems(deps.sections, deps.state.scope, deps.state.cwd, deps.ctx);
|
|
175
|
-
for (const updated of updatedItems) {
|
|
176
|
-
const existing = items.find((i) => i.id === updated.id);
|
|
177
|
-
if (existing && existing.currentValue !== updated.currentValue) {
|
|
178
|
-
settingsList.updateValue(updated.id, updated.currentValue);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
deps.tui.requestRender();
|
|
182
|
-
};
|
|
183
|
-
const settingsList = new SettingsList(
|
|
184
|
-
items,
|
|
185
|
-
Math.min(items.length + 4, 20),
|
|
186
|
-
getSettingsListTheme(),
|
|
187
|
-
onChange,
|
|
188
|
-
() => deps.done(),
|
|
189
|
-
{ enableSearch: true },
|
|
190
|
-
);
|
|
191
|
-
return settingsList;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function rebuildSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
195
|
-
const settingsList = createSettingsList(deps);
|
|
196
|
-
deps.settingsList = settingsList;
|
|
197
|
-
|
|
198
|
-
deps.container.clear();
|
|
199
|
-
deps.container.addChild(createHeaderComponent(deps));
|
|
200
|
-
deps.container.addChild(createStatusComponent(deps));
|
|
201
|
-
deps.container.addChild(settingsList);
|
|
202
|
-
|
|
203
|
-
return settingsList;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function createHeaderComponent(deps: SettingsOverlayDeps): Text {
|
|
207
|
-
const { theme, state } = deps;
|
|
208
|
-
const scopeLabel = getScopeLabel(state.scope);
|
|
209
|
-
const otherScope = state.scope === "project" ? "Global" : "Project";
|
|
210
|
-
const headerText = new Text(
|
|
211
|
-
`${theme.fg("accent", theme.bold("SuPi Settings"))} ${theme.fg("text", `Scope: ${scopeLabel}`)} ${theme.fg("dim", `(tab → ${otherScope})`)}`,
|
|
212
|
-
0,
|
|
213
|
-
0,
|
|
214
|
-
);
|
|
215
|
-
return headerText;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function createStatusComponent(deps: SettingsOverlayDeps): {
|
|
219
|
-
render: () => string[];
|
|
220
|
-
invalidate: () => void;
|
|
221
|
-
} {
|
|
222
|
-
return {
|
|
223
|
-
render: () => {
|
|
224
|
-
const status = deps.state.status;
|
|
225
|
-
if (!status) return [];
|
|
226
|
-
return [deps.theme.fg(status.kind, status.message)];
|
|
227
|
-
},
|
|
228
|
-
invalidate: () => {},
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function handleScopeToggle(deps: SettingsOverlayDeps): void {
|
|
233
|
-
deps.state.scope = deps.state.scope === "project" ? "global" : "project";
|
|
234
|
-
rebuildSettingsList(deps);
|
|
235
|
-
deps.tui.requestRender();
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/** Minimal SelectList theme — uses identity so the parent SettingsList provides styling context. */
|
|
239
|
-
const PASSTHROUGH_THEME: SelectListTheme = {
|
|
240
|
-
selectedPrefix: (text) => `› ${text}`,
|
|
241
|
-
selectedText: (text) => text,
|
|
242
|
-
description: (text) => text,
|
|
243
|
-
scrollInfo: (text) => text,
|
|
244
|
-
noMatch: (text) => text,
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Create a model picker submenu for settings.
|
|
249
|
-
*
|
|
250
|
-
* Shows a scrollable list of selectable models from the scoped model set,
|
|
251
|
-
* with the current session model annotated `[current]`. The first entry is
|
|
252
|
-
* always `"disabled"`.
|
|
253
|
-
*
|
|
254
|
-
* @param currentValue - Currently configured canonical model id or `"disabled"`.
|
|
255
|
-
* @param done - Callback invoked with the selected value, or undefined on cancel.
|
|
256
|
-
* @param ctx - Extension context for model listing. When undefined, only
|
|
257
|
-
* `"disabled"` is offered.
|
|
258
|
-
*/
|
|
259
|
-
export function createModelPickerSubmenu(
|
|
260
|
-
currentValue: string,
|
|
261
|
-
done: (selectedValue?: string) => void,
|
|
262
|
-
ctx?: ExtensionContext,
|
|
263
|
-
): {
|
|
264
|
-
render: (width: number) => string[];
|
|
265
|
-
invalidate: () => void;
|
|
266
|
-
handleInput: (data: string) => boolean;
|
|
267
|
-
} {
|
|
268
|
-
const items = buildModelItems(ctx);
|
|
269
|
-
|
|
270
|
-
const initialIndex =
|
|
271
|
-
currentValue === "disabled"
|
|
272
|
-
? 0
|
|
273
|
-
: Math.max(
|
|
274
|
-
0,
|
|
275
|
-
items.findIndex((item) => item.value === currentValue),
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
const container = new Container();
|
|
279
|
-
container.addChild(new Text(" Select suggestion model", 1, 0));
|
|
280
|
-
container.addChild(new Text("", 1, 0));
|
|
281
|
-
|
|
282
|
-
const selectList = new SelectList(items, Math.min(items.length, 15), PASSTHROUGH_THEME);
|
|
283
|
-
|
|
284
|
-
if (initialIndex >= 0) {
|
|
285
|
-
selectList.setSelectedIndex(initialIndex);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
selectList.onSelect = (item) => done(item.value);
|
|
289
|
-
selectList.onCancel = () => done();
|
|
290
|
-
|
|
291
|
-
container.addChild(selectList);
|
|
292
|
-
container.addChild(new Text(" ↑↓ navigate • enter select • esc cancel", 1, 0));
|
|
293
|
-
|
|
294
|
-
return {
|
|
295
|
-
render: (width: number) => container.render(width),
|
|
296
|
-
invalidate: () => container.invalidate(),
|
|
297
|
-
handleInput: (data: string) => {
|
|
298
|
-
selectList.handleInput(data);
|
|
299
|
-
return true;
|
|
300
|
-
},
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/** Build selectable model items with "disabled" first. */
|
|
305
|
-
function buildModelItems(ctx?: ExtensionContext): SelectItem[] {
|
|
306
|
-
const items: SelectItem[] = [
|
|
307
|
-
{
|
|
308
|
-
value: "disabled",
|
|
309
|
-
label: "disabled",
|
|
310
|
-
description: "No prompt suggestions",
|
|
311
|
-
},
|
|
312
|
-
];
|
|
313
|
-
|
|
314
|
-
if (!ctx) return items;
|
|
315
|
-
|
|
316
|
-
const models = getSelectableModels(ctx);
|
|
317
|
-
|
|
318
|
-
for (const model of models) {
|
|
319
|
-
const suffix = model.isCurrent ? " [current]" : "";
|
|
320
|
-
items.push({
|
|
321
|
-
value: model.canonicalId,
|
|
322
|
-
label: `${model.canonicalId}${suffix}`,
|
|
323
|
-
description: model.label !== model.canonicalId ? model.label : undefined,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return items;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// ── Entry point ──────────────────────────────────────────────
|
|
331
|
-
|
|
332
46
|
export function openSettingsOverlay(pi: ExtensionAPI, ctx: ExtensionContext): void {
|
|
333
47
|
const collection = collectSettingsSections(pi);
|
|
334
48
|
if (collection.sections.length === 0) {
|
|
@@ -342,32 +56,59 @@ export function openSettingsOverlay(pi: ExtensionAPI, ctx: ExtensionContext): vo
|
|
|
342
56
|
cwd: ctx.cwd,
|
|
343
57
|
status: latestStatus(collection.diagnostics),
|
|
344
58
|
};
|
|
345
|
-
const container = new Container();
|
|
346
59
|
|
|
347
|
-
const
|
|
60
|
+
const container = new Container();
|
|
61
|
+
const scopedList = new ScopedSettingsList(
|
|
62
|
+
collection.sections,
|
|
63
|
+
state.scope,
|
|
64
|
+
state.cwd,
|
|
348
65
|
ctx,
|
|
349
|
-
sections: collection.sections,
|
|
350
|
-
state,
|
|
351
|
-
container,
|
|
352
|
-
settingsList: null,
|
|
353
|
-
tui,
|
|
354
66
|
theme,
|
|
67
|
+
tui,
|
|
355
68
|
done,
|
|
69
|
+
(message) => {
|
|
70
|
+
state.status = { kind: "error", message };
|
|
71
|
+
rebuildOverlay();
|
|
72
|
+
tui.requestRender();
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
scopedList.enableSearch();
|
|
76
|
+
|
|
77
|
+
const rebuildOverlay = () => {
|
|
78
|
+
container.clear();
|
|
79
|
+
const scopeLabel = getScopeLabel(state.scope);
|
|
80
|
+
const otherScope = state.scope === "project" ? "Global" : "Project";
|
|
81
|
+
container.addChild(
|
|
82
|
+
new Text(
|
|
83
|
+
`${theme.fg("accent", theme.bold("SuPi Settings"))} ${theme.fg("text", `Scope: ${scopeLabel}`)} ${theme.fg("dim", `(tab → ${otherScope})`)}`,
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
if (state.status) {
|
|
89
|
+
container.addChild(new Text(theme.fg(state.status.kind, state.status.message), 0, 0));
|
|
90
|
+
}
|
|
356
91
|
};
|
|
357
92
|
|
|
358
|
-
|
|
93
|
+
rebuildOverlay();
|
|
359
94
|
|
|
360
95
|
const component = {
|
|
361
|
-
render: (width: number) => container.render(width),
|
|
362
|
-
invalidate: () =>
|
|
96
|
+
render: (width: number) => [...container.render(width), ...scopedList.render(width)],
|
|
97
|
+
invalidate: () => {
|
|
98
|
+
container.invalidate();
|
|
99
|
+
scopedList.invalidate();
|
|
100
|
+
},
|
|
363
101
|
handleInput: (data: string) => {
|
|
364
102
|
if (matchesKey(data, Key.tab)) {
|
|
365
|
-
|
|
103
|
+
state.scope = state.scope === "project" ? "global" : "project";
|
|
104
|
+
state.status = undefined;
|
|
105
|
+
scopedList.reload(state.scope, state.cwd, ctx);
|
|
106
|
+
rebuildOverlay();
|
|
107
|
+
tui.requestRender();
|
|
366
108
|
return true;
|
|
367
109
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
deps.tui.requestRender();
|
|
110
|
+
scopedList.handleInput(data);
|
|
111
|
+
tui.requestRender();
|
|
371
112
|
return true;
|
|
372
113
|
},
|
|
373
114
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
// supi-core settings-ui domain — settings TUI components (imports pi-tui at runtime, heavy).
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
createModelPickerSubmenu,
|
|
5
|
-
openSettingsOverlay,
|
|
6
|
-
} from "./settings/settings-ui.ts";
|
|
2
|
+
export { createInputSubmenu, createModelPickerSubmenu } from "./settings/settings-submenus.ts";
|
|
3
|
+
export { openSettingsOverlay } from "./settings/settings-ui.ts";
|
package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// supi-core settings domain — event-backed settings
|
|
1
|
+
// supi-core settings domain — event-backed declarative settings contributions and command wiring.
|
|
2
2
|
|
|
3
3
|
export { registerSettingsCommand } from "./settings/settings-command.ts";
|
|
4
4
|
export type {
|
|
@@ -13,3 +13,19 @@ export {
|
|
|
13
13
|
isSettingsContributionCollector,
|
|
14
14
|
SUPI_SETTINGS_COLLECT_EVENT,
|
|
15
15
|
} from "./settings/settings-registry.ts";
|
|
16
|
+
export type {
|
|
17
|
+
BoolField,
|
|
18
|
+
ConfigHelpers,
|
|
19
|
+
CustomField,
|
|
20
|
+
DeclarativeSettingsOptions,
|
|
21
|
+
EnumField,
|
|
22
|
+
ModelPickerField,
|
|
23
|
+
NumberField,
|
|
24
|
+
ScopedFieldValue,
|
|
25
|
+
SettingsField,
|
|
26
|
+
SettingsFieldAction,
|
|
27
|
+
SettingsPersistedChange,
|
|
28
|
+
StringListField,
|
|
29
|
+
ValueSource,
|
|
30
|
+
} from "./settings/settings-schema.ts";
|
|
31
|
+
export { registerDeclarativeSettings } from "./settings/settings-schema.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-runtime",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "SuPi code-runtime — shared workspace context, capability contracts, and canonical types for the code-understanding stack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"!__tests__"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@mrclrchtr/supi-core": "2.
|
|
32
|
+
"@mrclrchtr/supi-core": "2.2.0"
|
|
33
33
|
},
|
|
34
34
|
"bundledDependencies": [
|
|
35
35
|
"@mrclrchtr/supi-core"
|
|
@@ -39,14 +39,17 @@ Config file locations:
|
|
|
39
39
|
|
|
40
40
|
### Settings helpers
|
|
41
41
|
|
|
42
|
-
- `
|
|
42
|
+
- `registerDeclarativeSettings(pi, options)` — contribute a config-backed declarative settings section with source-aware scoped persistence
|
|
43
43
|
- `registerSettingsCommand(pi)` — register `/supi-settings` (used by `@mrclrchtr/supi-settings`)
|
|
44
44
|
- `openSettingsOverlay(pi, ctx)` — open the shared settings UI directly
|
|
45
45
|
- `createInputSubmenu()` — helper for simple text-entry submenus
|
|
46
|
+
- `createModelPickerSubmenu()` — helper for scoped model selection submenus
|
|
46
47
|
|
|
47
48
|
The built-in settings UI supports:
|
|
48
49
|
|
|
49
50
|
- project/global scope toggle
|
|
51
|
+
- source badges for project, global, and default values
|
|
52
|
+
- Inherit/Reset actions that delete scoped config keys
|
|
50
53
|
- grouped extension sections
|
|
51
54
|
- searchable setting lists
|
|
52
55
|
|
|
@@ -83,24 +86,22 @@ The built-in settings UI supports:
|
|
|
83
86
|
|
|
84
87
|
```ts
|
|
85
88
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
86
|
-
import { loadSupiConfig,
|
|
89
|
+
import { loadSupiConfig, registerDeclarativeSettings, wrapExtensionContext } from "@mrclrchtr/supi-core/api";
|
|
87
90
|
|
|
88
91
|
export default function myExtension(pi: ExtensionAPI) {
|
|
89
92
|
const defaults = { enabled: true };
|
|
90
93
|
const config = loadSupiConfig("my-extension", process.cwd(), defaults);
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
registerDeclarativeSettings(pi, {
|
|
93
96
|
id: "my-extension",
|
|
94
97
|
label: "My Extension",
|
|
95
98
|
section: "my-extension",
|
|
96
99
|
defaults,
|
|
97
|
-
|
|
100
|
+
fields: [
|
|
98
101
|
{
|
|
99
|
-
|
|
102
|
+
kind: "boolean" as const,
|
|
103
|
+
key: "enabled",
|
|
100
104
|
label: "Enabled",
|
|
101
|
-
currentValue: settings.enabled ? "on" : "off",
|
|
102
|
-
values: ["on", "off"],
|
|
103
|
-
configType: "boolean" as const,
|
|
104
105
|
},
|
|
105
106
|
],
|
|
106
107
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// supi-core config domain — config loading
|
|
1
|
+
// supi-core config domain — config loading.
|
|
2
2
|
export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
|
|
3
3
|
export {
|
|
4
4
|
loadSectionConfig,
|
|
5
5
|
loadSupiConfig,
|
|
6
6
|
loadSupiConfigForScope,
|
|
7
|
+
loadSupiConfigSectionForScope,
|
|
7
8
|
readJsonFile,
|
|
8
9
|
removeSupiConfigKey,
|
|
9
10
|
writeSupiConfig,
|
|
10
11
|
} from "./config/config.ts";
|
|
11
|
-
export type { ConfigSettingsHelpers, ConfigSettingsOptions } from "./config/config-settings.ts";
|
|
12
|
-
export { registerConfigSettings } from "./config/config-settings.ts";
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
export type DebugLevel = "debug" | "info" | "warning" | "error";
|
|
8
8
|
export type DebugAgentAccess = "off" | "sanitized" | "raw";
|
|
9
|
-
export type DebugNotifyLevel = "off" | "warning" | "error";
|
|
10
|
-
|
|
11
9
|
export interface DebugRegistryConfig {
|
|
12
10
|
/** Whether producers should retain debug events. */
|
|
13
11
|
enabled: boolean;
|
|
@@ -15,15 +13,12 @@ export interface DebugRegistryConfig {
|
|
|
15
13
|
agentAccess: DebugAgentAccess;
|
|
16
14
|
/** Maximum number of session-local events to keep in memory. */
|
|
17
15
|
maxEvents: number;
|
|
18
|
-
/** Minimum level that should notify the user; interpreted by UI extensions. */
|
|
19
|
-
notifyLevel: DebugNotifyLevel;
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
export const DEBUG_REGISTRY_DEFAULTS: DebugRegistryConfig = {
|
|
23
19
|
enabled: false,
|
|
24
20
|
agentAccess: "sanitized",
|
|
25
21
|
maxEvents: 100,
|
|
26
|
-
notifyLevel: "off",
|
|
27
22
|
};
|
|
28
23
|
|
|
29
24
|
export interface DebugEventInput {
|