@f5-sales-demo/xcsh 21.24.0 → 21.25.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/bin/xcsh.ts +0 -0
- package/package.json +17 -16
- package/src/autoresearch/dashboard.ts +5 -5
- package/src/browser/acquire.ts +36 -1
- package/src/browser/input-commit.ts +1 -1
- package/src/browser/provider.ts +7 -5
- package/src/capability/index.ts +6 -1
- package/src/cli/sandbox-check.ts +24 -1
- package/src/config/keybindings.ts +1 -1
- package/src/config/settings.ts +33 -2
- package/src/debug/index.ts +383 -226
- package/src/debug/log-viewer.ts +65 -58
- package/src/debug/report-bundle.ts +78 -1
- package/src/discovery/helpers.ts +4 -4
- package/src/discovery/index.ts +1 -0
- package/src/export/html/index.ts +47 -5
- package/src/extensibility/custom-commands/types.ts +5 -1
- package/src/extensibility/extensions/bundled/herdr-reporter.ts +9 -9
- package/src/extensibility/extensions/bundled/native-lifecycle-control.ts +1 -1
- package/src/extensibility/extensions/runner.ts +38 -4
- package/src/extensibility/extensions/wrapper.ts +1 -2
- package/src/extensibility/hooks/types.ts +5 -3
- package/src/extensibility/plugins/marketplace/manager.ts +10 -1
- package/src/extensibility/slash-commands.ts +20 -3
- package/src/internal-urls/api-catalog-index.generated.ts +166 -166
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/internal-urls/docs-index.generated.ts +6 -5
- package/src/mcp/smithery-auth.ts +2 -1
- package/src/memories/index.ts +161 -1
- package/src/modes/background-terminal.ts +49 -0
- package/src/modes/components/agent-dashboard.ts +725 -908
- package/src/modes/components/assistant-message.ts +1 -1
- package/src/modes/components/auth-link-presenter.ts +1 -14
- package/src/modes/components/bash-execution.ts +3 -1
- package/src/modes/components/bordered-loader.ts +11 -3
- package/src/modes/components/btw-panel.ts +39 -33
- package/src/modes/components/context-add-wizard.ts +71 -43
- package/src/modes/components/copy-selector.ts +333 -173
- package/src/modes/components/custom-editor.ts +6 -1
- package/src/modes/components/extensions/extension-dashboard.ts +541 -327
- package/src/modes/components/extensions/index.ts +0 -2
- package/src/modes/components/extensions/state-manager.ts +8 -5
- package/src/modes/components/extensions/types.ts +10 -0
- package/src/modes/components/history-search.ts +106 -126
- package/src/modes/components/hook-editor.ts +81 -33
- package/src/modes/components/hook-input.ts +67 -50
- package/src/modes/components/hook-selector.ts +162 -142
- package/src/modes/components/litellm-model-selector.ts +9 -9
- package/src/modes/components/login-dialog.ts +55 -12
- package/src/modes/components/mcp-add-wizard.ts +102 -72
- package/src/modes/components/model-selector.ts +8 -7
- package/src/modes/components/oauth-selector.ts +11 -1
- package/src/modes/components/plan-preview.ts +25 -0
- package/src/modes/components/plugin-settings-drafts.ts +203 -0
- package/src/modes/components/plugin-settings.ts +235 -200
- package/src/modes/components/plugins/index.ts +0 -2
- package/src/modes/components/plugins/plugin-dashboard.ts +1008 -369
- package/src/modes/components/plugins/state-manager.ts +16 -17
- package/src/modes/components/plugins/types.ts +18 -0
- package/src/modes/components/python-execution.ts +3 -1
- package/src/modes/components/queue-mode-selector.ts +9 -10
- package/src/modes/components/reviewed-action-dialog.ts +192 -0
- package/src/modes/components/reviewed-action.ts +27 -0
- package/src/modes/components/searchable-select-list.ts +182 -0
- package/src/modes/components/selector-frame.ts +113 -2
- package/src/modes/components/session-observer-overlay.ts +94 -77
- package/src/modes/components/session-selector.ts +257 -286
- package/src/modes/components/settings-browser.ts +132 -0
- package/src/modes/components/settings-editors.ts +200 -0
- package/src/modes/components/settings-selector.ts +273 -251
- package/src/modes/components/show-images-selector.ts +9 -10
- package/src/modes/components/status-line.ts +3 -3
- package/src/modes/components/theme-selector.ts +9 -10
- package/src/modes/components/thinking-selector.ts +9 -10
- package/src/modes/components/transcript-notice.ts +49 -0
- package/src/modes/components/tree-selector.ts +403 -816
- package/src/modes/components/user-message-selector.ts +133 -115
- package/src/modes/components/vllm-model-selector.ts +9 -9
- package/src/modes/components/welcome.ts +20 -64
- package/src/modes/controllers/btw-controller.ts +44 -2
- package/src/modes/controllers/command-controller.ts +1565 -426
- package/src/modes/controllers/context-command-controller.ts +495 -12
- package/src/modes/controllers/event-controller.ts +36 -11
- package/src/modes/controllers/extension-ui-controller.ts +85 -68
- package/src/modes/controllers/input-controller.ts +77 -33
- package/src/modes/controllers/mcp-command-controller.ts +766 -198
- package/src/modes/controllers/model-selection.ts +68 -0
- package/src/modes/controllers/provider-connection-flow.ts +2 -0
- package/src/modes/controllers/selector-controller.ts +882 -291
- package/src/modes/controllers/ssh-command-controller.ts +133 -59
- package/src/modes/index.ts +1 -6
- package/src/modes/interactive-mode.ts +778 -106
- package/src/modes/slash-command-discovery.ts +68 -0
- package/src/modes/terminal-restore.ts +17 -0
- package/src/modes/types.ts +9 -7
- package/src/modes/utils/clipboard-action.ts +79 -0
- package/src/modes/utils/keybinding-matchers.ts +12 -6
- package/src/modes/utils/open-action.ts +96 -0
- package/src/modes/utils/ui-helpers.ts +2 -2
- package/src/prompts/internal-urls/containment.md +1 -1
- package/src/routing/commands.ts +11 -5
- package/src/sdk.ts +2 -2
- package/src/services/xcsh-api-client.ts +3 -3
- package/src/services/xcsh-context.ts +73 -33
- package/src/services/xcsh-knowledge.ts +2 -2
- package/src/session/agent-session.ts +397 -168
- package/src/session/session-manager.ts +233 -20
- package/src/session/session-storage.ts +7 -2
- package/src/slash-commands/browser-command.ts +293 -0
- package/src/slash-commands/builtin-registry.ts +974 -302
- package/src/slash-commands/export-command.ts +243 -103
- package/src/slash-commands/fast-command.ts +107 -0
- package/src/slash-commands/plugin-reviewed-actions.ts +569 -0
- package/src/slash-commands/resource-commands.ts +283 -65
- package/src/sweep/spec-probe.ts +1 -1
- package/src/sweep/sweep-params.ts +1 -1
- package/src/tools/ask.ts +1 -3
- package/src/tools/browser.ts +2 -1
- package/src/tools/catalog-workflow-runner.ts +1 -1
- package/src/utils/clipboard.ts +27 -31
- package/src/utils/image-convert.ts +2 -3
- package/src/utils/image-pipeline.ts +7 -0
- package/src/utils/image-resize.ts +11 -9
- package/src/utils/open.ts +28 -18
- package/src/modes/components/extensions/extension-list.ts +0 -514
- package/src/modes/components/extensions/inspector-panel.ts +0 -317
- package/src/modes/components/plugin-selector.ts +0 -95
- package/src/modes/components/plugins/plugin-inspector-pane.ts +0 -84
- package/src/modes/components/plugins/plugin-list-pane.ts +0 -109
- package/src/modes/components/status-line-segment-editor.ts +0 -361
package/bin/xcsh.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.25.0",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"check:types": "bun run generate-build-info && tsgo -p tsconfig.json --noEmit",
|
|
39
39
|
"lint": "biome lint .",
|
|
40
40
|
"check:bundle": "bun scripts/check-bundle.ts",
|
|
41
|
-
"pretest": "bun ../../scripts/check-installed-dependencies.ts",
|
|
41
|
+
"pretest": "bun ../../scripts/check-installed-dependencies.ts && bun ../../scripts/ensure-dev-native.ts",
|
|
42
42
|
"test": "bun run generate-build-info && bun scripts/bun-test-guarded.ts --max-concurrency 1",
|
|
43
43
|
"bench:routing-matrix": "bun scripts/bench-routing-matrix.ts",
|
|
44
44
|
"bench:copy-selector": "bun scripts/bench-copy-selector.ts",
|
|
@@ -61,34 +61,35 @@
|
|
|
61
61
|
"check-workflow-field-coverage": "bun scripts/check-workflow-field-coverage.ts"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@agentclientprotocol/sdk": "1.
|
|
65
|
-
"@f5-sales-demo/pi-agent-core": "21.
|
|
66
|
-
"@f5-sales-demo/pi-ai": "21.
|
|
67
|
-
"@f5-sales-demo/pi-natives": "21.
|
|
68
|
-
"@f5-sales-demo/pi-resource-management": "21.
|
|
69
|
-
"@f5-sales-demo/pi-tui": "21.
|
|
70
|
-
"@f5-sales-demo/pi-utils": "21.
|
|
71
|
-
"@f5-sales-demo/xcsh-stats": "21.
|
|
64
|
+
"@agentclientprotocol/sdk": "1.4.0",
|
|
65
|
+
"@f5-sales-demo/pi-agent-core": "21.25.0",
|
|
66
|
+
"@f5-sales-demo/pi-ai": "21.25.0",
|
|
67
|
+
"@f5-sales-demo/pi-natives": "21.25.0",
|
|
68
|
+
"@f5-sales-demo/pi-resource-management": "21.25.0",
|
|
69
|
+
"@f5-sales-demo/pi-tui": "21.25.0",
|
|
70
|
+
"@f5-sales-demo/pi-utils": "21.25.0",
|
|
71
|
+
"@f5-sales-demo/xcsh-stats": "21.25.0",
|
|
72
72
|
"@mozilla/readability": "^0.6",
|
|
73
|
-
"@sinclair/typebox": "
|
|
73
|
+
"@sinclair/typebox": "0.34.52",
|
|
74
74
|
"@xterm/headless": "^6.0",
|
|
75
75
|
"ajv": "^8.20",
|
|
76
|
-
"chalk": "
|
|
76
|
+
"chalk": "6.0.0",
|
|
77
77
|
"diff": "^9.0",
|
|
78
78
|
"fflate": "0.8.3",
|
|
79
79
|
"google-auth-library": "10.9.1",
|
|
80
|
-
"linkedom": "
|
|
80
|
+
"linkedom": "0.18.13",
|
|
81
81
|
"lru-cache": "11.5.2",
|
|
82
82
|
"markit-ai": "0.5.3",
|
|
83
|
-
"puppeteer": "
|
|
83
|
+
"puppeteer": "25.10.0",
|
|
84
84
|
"yaml": "2.9.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@types/bun": "
|
|
87
|
+
"@types/bun": "1.4.2",
|
|
88
|
+
"@xterm/addon-unicode11": "0.9.0",
|
|
88
89
|
"handlebars": "^4.7"
|
|
89
90
|
},
|
|
90
91
|
"engines": {
|
|
91
|
-
"bun": ">=1.
|
|
92
|
+
"bun": ">=1.4.2"
|
|
92
93
|
},
|
|
93
94
|
"files": [
|
|
94
95
|
"bin",
|
|
@@ -43,7 +43,7 @@ export function createDashboardController(): DashboardController {
|
|
|
43
43
|
if (state.results.length === 0 && runtime.runningExperiment)
|
|
44
44
|
return new Text(renderRunningOnly(runtime, state, theme), 0, 0);
|
|
45
45
|
if (runtime.dashboardExpanded) {
|
|
46
|
-
const width = process.stdout.columns
|
|
46
|
+
const width = _tui.terminal.columns || process.stdout.columns || 120;
|
|
47
47
|
const lines = [
|
|
48
48
|
renderExpandedHeader(runtime, width, theme),
|
|
49
49
|
...renderDashboardLines(runtime, width, theme, 8),
|
|
@@ -68,7 +68,7 @@ export function createDashboardController(): DashboardController {
|
|
|
68
68
|
let scrollOffset = 0;
|
|
69
69
|
return {
|
|
70
70
|
render(width: number): string[] {
|
|
71
|
-
const terminalRows = process.stdout.rows
|
|
71
|
+
const terminalRows = tui.terminal.rows || process.stdout.rows || 40;
|
|
72
72
|
const header = renderExpandedHeader(runtime, width, theme);
|
|
73
73
|
const body = renderDashboardLines(runtime, width, theme, 0);
|
|
74
74
|
if (runtime.runningExperiment)
|
|
@@ -87,9 +87,9 @@ export function createDashboardController(): DashboardController {
|
|
|
87
87
|
},
|
|
88
88
|
handleInput(data: string): void {
|
|
89
89
|
const totalRows =
|
|
90
|
-
renderDashboardLines(runtime, process.stdout.columns
|
|
91
|
-
|
|
92
|
-
const viewportRows = Math.max(4, (process.stdout.rows
|
|
90
|
+
renderDashboardLines(runtime, tui.terminal.columns || process.stdout.columns || 120, theme, 0)
|
|
91
|
+
.length + (runtime.runningExperiment ? 1 : 0);
|
|
92
|
+
const viewportRows = Math.max(4, (tui.terminal.rows || process.stdout.rows || 40) - 4);
|
|
93
93
|
const maxScroll = Math.max(0, totalRows - viewportRows);
|
|
94
94
|
if (matchesKey(data, "escape") || matchesKey(data, "esc") || data === "q") {
|
|
95
95
|
done(undefined);
|
package/src/browser/acquire.ts
CHANGED
|
@@ -176,10 +176,19 @@ async function launch(executablePath: string, args: string[]): Promise<Browser>
|
|
|
176
176
|
return puppeteer.launch({ headless: false, executablePath, args, defaultViewport: null });
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
export interface BrowserAcquisitionStep {
|
|
180
|
+
action: "attach" | "launch" | "quit";
|
|
181
|
+
endpoint: string;
|
|
182
|
+
executable?: string;
|
|
183
|
+
profile?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
179
186
|
export async function acquirePage(opts: {
|
|
180
187
|
settings: { get(key: string): unknown };
|
|
181
188
|
debugPort?: number;
|
|
182
189
|
allowRelaunch?: boolean;
|
|
190
|
+
/** Internal interactive review boundary; omitted by existing CLI/tool callers. */
|
|
191
|
+
beforeAction?: (step: BrowserAcquisitionStep) => Promise<void>;
|
|
183
192
|
}): Promise<{ browser: Browser; page: Page; mode: AcquireMode }> {
|
|
184
193
|
const debugPort = opts.debugPort ?? DEFAULT_DEBUG_PORT;
|
|
185
194
|
const configuredUrl = resolveBrowserConnectUrl(opts.settings);
|
|
@@ -187,14 +196,16 @@ export async function acquirePage(opts: {
|
|
|
187
196
|
assertLoopbackBrowserUrl(attachUrl);
|
|
188
197
|
|
|
189
198
|
// 1) Attach to a Chrome already exposing the debug port.
|
|
199
|
+
await opts.beforeAction?.({ action: "attach", endpoint: attachUrl });
|
|
190
200
|
const attached = await tryAttach(attachUrl);
|
|
191
201
|
if (attached) return { ...attached, mode: "attached" };
|
|
192
202
|
|
|
193
203
|
// If the user explicitly configured connectUrl but nothing is there, that is an error
|
|
194
204
|
// (do not silently launch a different browser than they asked to attach to).
|
|
195
205
|
if (configuredUrl) {
|
|
206
|
+
const configuredPort = new URL(configuredUrl).port || "80";
|
|
196
207
|
throw new Error(
|
|
197
|
-
`Could not attach to Chrome at ${configuredUrl}. Start Chrome with --remote-debugging-port=${
|
|
208
|
+
`Could not attach to Chrome at ${configuredUrl}. Start Chrome with --remote-debugging-port=${configuredPort} and retry, or unset browser.connectUrl to let xcsh launch Chrome.`,
|
|
198
209
|
);
|
|
199
210
|
}
|
|
200
211
|
|
|
@@ -213,6 +224,12 @@ export async function acquirePage(opts: {
|
|
|
213
224
|
const defaultDir = defaultProfileDir();
|
|
214
225
|
if (defaultDir) {
|
|
215
226
|
try {
|
|
227
|
+
await opts.beforeAction?.({
|
|
228
|
+
action: "launch",
|
|
229
|
+
endpoint: attachUrl,
|
|
230
|
+
executable: located.path,
|
|
231
|
+
profile: defaultDir,
|
|
232
|
+
});
|
|
216
233
|
const browser = await withLaunchTimeout(
|
|
217
234
|
launch(located.path, buildLaunchArgs({ debugPort, profileDir: defaultDir })),
|
|
218
235
|
12_000,
|
|
@@ -232,9 +249,21 @@ export async function acquirePage(opts: {
|
|
|
232
249
|
if (allowRelaunch) {
|
|
233
250
|
const quit = quitChromeCommand();
|
|
234
251
|
if (quit) {
|
|
252
|
+
await opts.beforeAction?.({
|
|
253
|
+
action: "quit",
|
|
254
|
+
endpoint: attachUrl,
|
|
255
|
+
executable: located.path,
|
|
256
|
+
profile: defaultDir,
|
|
257
|
+
});
|
|
235
258
|
await runChromeControlCommand(quit);
|
|
236
259
|
const exited = await waitForChromeExit();
|
|
237
260
|
if (exited) {
|
|
261
|
+
await opts.beforeAction?.({
|
|
262
|
+
action: "launch",
|
|
263
|
+
endpoint: attachUrl,
|
|
264
|
+
executable: located.path,
|
|
265
|
+
profile: defaultDir,
|
|
266
|
+
});
|
|
238
267
|
const browser = await withLaunchTimeout(
|
|
239
268
|
launch(located.path, buildLaunchArgs({ debugPort, profileDir: defaultDir })),
|
|
240
269
|
12_000,
|
|
@@ -257,6 +286,12 @@ export async function acquirePage(opts: {
|
|
|
257
286
|
const profileDir = dedicatedProfileDir();
|
|
258
287
|
let browser: Browser;
|
|
259
288
|
try {
|
|
289
|
+
await opts.beforeAction?.({
|
|
290
|
+
action: "launch",
|
|
291
|
+
endpoint: attachUrl,
|
|
292
|
+
executable: located.path,
|
|
293
|
+
profile: profileDir,
|
|
294
|
+
});
|
|
260
295
|
browser = await withLaunchTimeout(launch(located.path, buildLaunchArgs({ debugPort, profileDir })), 12_000);
|
|
261
296
|
} catch (err) {
|
|
262
297
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Commit a value into a form control so that a framework which patched the
|
|
3
3
|
* element's `value` descriptor still observes the change.
|
|
4
4
|
*
|
|
5
|
-
* Why this exists: the
|
|
5
|
+
* Why this exists: the xcsh console's `vsui-input` (e.g. over the HTTP-LB
|
|
6
6
|
* "Domains" ngx-datatable cell) overrides the native `<input>` `value`
|
|
7
7
|
* descriptor with its own accessor. Typing real keystrokes — or assigning
|
|
8
8
|
* `el.value = …` directly — leaves the text in the DOM but never reaches the
|
package/src/browser/provider.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { logger } from "@f5-sales-demo/pi-utils";
|
|
2
|
+
import { resolveBrowserConnectUrl } from "../tools/browser";
|
|
2
3
|
import {
|
|
3
4
|
type AcquireAction,
|
|
4
5
|
acquirePage,
|
|
@@ -35,10 +36,11 @@ export interface BrowserProvider {
|
|
|
35
36
|
type Settings = { get(key: string): unknown };
|
|
36
37
|
const DEBUG_PORT = 9222;
|
|
37
38
|
|
|
38
|
-
/** Probe the loopback debug endpoint without attaching. */
|
|
39
|
-
async function probeDebuggableDefault(): Promise<boolean> {
|
|
39
|
+
/** Probe the selected loopback debug endpoint without attaching. */
|
|
40
|
+
async function probeDebuggableDefault(settings: Settings): Promise<boolean> {
|
|
40
41
|
try {
|
|
41
|
-
const
|
|
42
|
+
const endpoint = resolveBrowserConnectUrl(settings) ?? `http://127.0.0.1:${DEBUG_PORT}`;
|
|
43
|
+
const r = await fetch(new URL("/json/version", endpoint));
|
|
42
44
|
return r.ok;
|
|
43
45
|
} catch {
|
|
44
46
|
return false;
|
|
@@ -46,7 +48,7 @@ async function probeDebuggableDefault(): Promise<boolean> {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
const DETAIL: Record<AcquireAction, string> = {
|
|
49
|
-
attach: "A debuggable Chrome is reachable on
|
|
51
|
+
attach: "A debuggable Chrome is reachable on the selected loopback endpoint — xcsh will attach and co-drive it.",
|
|
50
52
|
launch: "Chrome is installed and not running — xcsh will launch it on your real profile with a loopback debug port.",
|
|
51
53
|
relaunch:
|
|
52
54
|
"Your Chrome is running without a debug port — xcsh will gracefully quit and reopen it on your real profile (consent granted).",
|
|
@@ -80,7 +82,7 @@ export class CdpBrowserProvider implements BrowserProvider {
|
|
|
80
82
|
) {
|
|
81
83
|
this.#settings = settings;
|
|
82
84
|
this.#probes = probes ?? {
|
|
83
|
-
probeDebuggable: probeDebuggableDefault,
|
|
85
|
+
probeDebuggable: () => probeDebuggableDefault(settings),
|
|
84
86
|
chromeRunning: () => isChromeRunning(),
|
|
85
87
|
chromeInstalled: () => locateChrome({ settings }) != null,
|
|
86
88
|
};
|
package/src/capability/index.ts
CHANGED
|
@@ -303,11 +303,16 @@ export function getDisabledProviders(): string[] {
|
|
|
303
303
|
* Set disabled providers from a list (replaces current set).
|
|
304
304
|
*/
|
|
305
305
|
export function setDisabledProviders(providerIds: string[]): void {
|
|
306
|
+
setDisabledProvidersRuntime(providerIds);
|
|
307
|
+
persistDisabledProviders();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Update runtime discovery state after an independently durable reviewed save. */
|
|
311
|
+
export function setDisabledProvidersRuntime(providerIds: string[]): void {
|
|
306
312
|
disabledProviders.clear();
|
|
307
313
|
for (const id of providerIds) {
|
|
308
314
|
disabledProviders.add(id);
|
|
309
315
|
}
|
|
310
|
-
persistDisabledProviders();
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
// =============================================================================
|
package/src/cli/sandbox-check.ts
CHANGED
|
@@ -66,6 +66,18 @@ function quote(value: string): string {
|
|
|
66
66
|
return JSON.stringify(value);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
async function canonicalDirectory(value: string): Promise<string> {
|
|
70
|
+
try {
|
|
71
|
+
return await fs.realpath(value);
|
|
72
|
+
} catch {
|
|
73
|
+
return path.resolve(value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function sameDirectory(actual: string, expected: string): boolean {
|
|
78
|
+
return path.relative(expected, actual) === "";
|
|
79
|
+
}
|
|
80
|
+
|
|
69
81
|
function errorCode(error: unknown): string | undefined {
|
|
70
82
|
if (typeof error !== "object" || error === null || !("code" in error)) return undefined;
|
|
71
83
|
const code = (error as { code?: unknown }).code;
|
|
@@ -728,7 +740,18 @@ export async function runSandboxCheck(options: SandboxCheckOptions = {}): Promis
|
|
|
728
740
|
.map(part => part.text)
|
|
729
741
|
.join("")
|
|
730
742
|
.trim();
|
|
731
|
-
const
|
|
743
|
+
const [movedDirectory, resetDirectory, explicitDirectory, expectedNested, expectedWorkspace] =
|
|
744
|
+
await Promise.all([
|
|
745
|
+
canonicalDirectory(text(moved)),
|
|
746
|
+
canonicalDirectory(text(reset)),
|
|
747
|
+
canonicalDirectory(text(explicit)),
|
|
748
|
+
canonicalDirectory(nested),
|
|
749
|
+
canonicalDirectory(workspace),
|
|
750
|
+
]);
|
|
751
|
+
const passed =
|
|
752
|
+
sameDirectory(movedDirectory, expectedNested) &&
|
|
753
|
+
sameDirectory(resetDirectory, expectedWorkspace) &&
|
|
754
|
+
sameDirectory(explicitDirectory, expectedNested);
|
|
732
755
|
return passed
|
|
733
756
|
? { passed: true }
|
|
734
757
|
: {
|
package/src/config/settings.ts
CHANGED
|
@@ -233,6 +233,27 @@ export class Settings {
|
|
|
233
233
|
return getDefault(path);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
/** Read-only scope provenance for internal interactive reviews; this does not write or change precedence. */
|
|
237
|
+
inspectScopes<P extends SettingPath>(
|
|
238
|
+
path: P,
|
|
239
|
+
): {
|
|
240
|
+
userValue: SettingValue<P>;
|
|
241
|
+
effectiveValue: SettingValue<P>;
|
|
242
|
+
userExplicit: boolean;
|
|
243
|
+
projectValue: SettingValue<P> | undefined;
|
|
244
|
+
runtimeValue: SettingValue<P> | undefined;
|
|
245
|
+
} {
|
|
246
|
+
const segments = path.split(".");
|
|
247
|
+
const user = getByPath(this.#global, segments);
|
|
248
|
+
return structuredClone({
|
|
249
|
+
userValue: (user === undefined ? getDefault(path) : user) as SettingValue<P>,
|
|
250
|
+
effectiveValue: this.get(path),
|
|
251
|
+
userExplicit: user !== undefined,
|
|
252
|
+
projectValue: getByPath(this.#project, segments) as SettingValue<P> | undefined,
|
|
253
|
+
runtimeValue: getByPath(this.#overrides, segments) as SettingValue<P> | undefined,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
236
257
|
/**
|
|
237
258
|
* Set a setting value (sync).
|
|
238
259
|
* Updates global settings and queues a background save.
|
|
@@ -393,8 +414,18 @@ export class Settings {
|
|
|
393
414
|
* Set a model role (helper for modelRoles record).
|
|
394
415
|
*/
|
|
395
416
|
setModelRole(role: ModelRole | string, modelId: string): void {
|
|
396
|
-
|
|
397
|
-
|
|
417
|
+
// Track the individual role path so the locked save can re-read and
|
|
418
|
+
// preserve other roles written by a concurrent settings instance or a
|
|
419
|
+
// preceding reviewed action. Treating the whole modelRoles map as one
|
|
420
|
+
// modified value allowed a stale in-memory map to overwrite those writes.
|
|
421
|
+
const explicitRoles = getByPath(this.#global, ["modelRoles"]);
|
|
422
|
+
setByPath(this.#global, ["modelRoles"], {
|
|
423
|
+
...(explicitRoles && typeof explicitRoles === "object" ? explicitRoles : {}),
|
|
424
|
+
[role]: modelId,
|
|
425
|
+
});
|
|
426
|
+
this.#modified.add(`modelRoles.${role}`);
|
|
427
|
+
this.#rebuildMerged();
|
|
428
|
+
this.#queueSave();
|
|
398
429
|
}
|
|
399
430
|
|
|
400
431
|
/**
|