@f5-sales-demo/xcsh 21.24.4 → 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.
Files changed (124) hide show
  1. package/bin/xcsh.ts +0 -0
  2. package/package.json +10 -9
  3. package/src/autoresearch/dashboard.ts +5 -5
  4. package/src/browser/acquire.ts +36 -1
  5. package/src/browser/input-commit.ts +1 -1
  6. package/src/browser/provider.ts +7 -5
  7. package/src/capability/index.ts +6 -1
  8. package/src/config/keybindings.ts +1 -1
  9. package/src/config/settings.ts +33 -2
  10. package/src/debug/index.ts +383 -226
  11. package/src/debug/log-viewer.ts +65 -58
  12. package/src/debug/report-bundle.ts +78 -1
  13. package/src/discovery/helpers.ts +4 -4
  14. package/src/discovery/index.ts +1 -0
  15. package/src/export/html/index.ts +47 -5
  16. package/src/extensibility/custom-commands/types.ts +5 -1
  17. package/src/extensibility/extensions/bundled/herdr-reporter.ts +9 -9
  18. package/src/extensibility/extensions/bundled/native-lifecycle-control.ts +1 -1
  19. package/src/extensibility/extensions/runner.ts +38 -4
  20. package/src/extensibility/hooks/types.ts +5 -3
  21. package/src/extensibility/plugins/marketplace/manager.ts +10 -1
  22. package/src/extensibility/slash-commands.ts +20 -3
  23. package/src/internal-urls/build-info.generated.ts +8 -8
  24. package/src/internal-urls/docs-index.generated.ts +6 -5
  25. package/src/mcp/smithery-auth.ts +2 -1
  26. package/src/memories/index.ts +161 -1
  27. package/src/modes/background-terminal.ts +49 -0
  28. package/src/modes/components/agent-dashboard.ts +725 -908
  29. package/src/modes/components/assistant-message.ts +1 -1
  30. package/src/modes/components/auth-link-presenter.ts +1 -14
  31. package/src/modes/components/bash-execution.ts +3 -1
  32. package/src/modes/components/bordered-loader.ts +11 -3
  33. package/src/modes/components/btw-panel.ts +39 -33
  34. package/src/modes/components/context-add-wizard.ts +71 -43
  35. package/src/modes/components/copy-selector.ts +333 -173
  36. package/src/modes/components/custom-editor.ts +6 -1
  37. package/src/modes/components/extensions/extension-dashboard.ts +541 -327
  38. package/src/modes/components/extensions/index.ts +0 -2
  39. package/src/modes/components/extensions/state-manager.ts +8 -5
  40. package/src/modes/components/extensions/types.ts +10 -0
  41. package/src/modes/components/history-search.ts +106 -126
  42. package/src/modes/components/hook-editor.ts +81 -33
  43. package/src/modes/components/hook-input.ts +67 -50
  44. package/src/modes/components/hook-selector.ts +162 -142
  45. package/src/modes/components/litellm-model-selector.ts +9 -9
  46. package/src/modes/components/login-dialog.ts +55 -12
  47. package/src/modes/components/mcp-add-wizard.ts +102 -72
  48. package/src/modes/components/model-selector.ts +5 -5
  49. package/src/modes/components/oauth-selector.ts +11 -1
  50. package/src/modes/components/plan-preview.ts +25 -0
  51. package/src/modes/components/plugin-settings-drafts.ts +203 -0
  52. package/src/modes/components/plugin-settings.ts +235 -200
  53. package/src/modes/components/plugins/index.ts +0 -2
  54. package/src/modes/components/plugins/plugin-dashboard.ts +1008 -369
  55. package/src/modes/components/plugins/state-manager.ts +16 -17
  56. package/src/modes/components/plugins/types.ts +18 -0
  57. package/src/modes/components/python-execution.ts +3 -1
  58. package/src/modes/components/queue-mode-selector.ts +9 -10
  59. package/src/modes/components/reviewed-action-dialog.ts +192 -0
  60. package/src/modes/components/reviewed-action.ts +27 -0
  61. package/src/modes/components/searchable-select-list.ts +182 -0
  62. package/src/modes/components/selector-frame.ts +113 -2
  63. package/src/modes/components/session-observer-overlay.ts +94 -77
  64. package/src/modes/components/session-selector.ts +257 -286
  65. package/src/modes/components/settings-browser.ts +132 -0
  66. package/src/modes/components/settings-editors.ts +200 -0
  67. package/src/modes/components/settings-selector.ts +273 -251
  68. package/src/modes/components/show-images-selector.ts +9 -10
  69. package/src/modes/components/status-line.ts +3 -3
  70. package/src/modes/components/theme-selector.ts +9 -10
  71. package/src/modes/components/thinking-selector.ts +9 -10
  72. package/src/modes/components/transcript-notice.ts +49 -0
  73. package/src/modes/components/tree-selector.ts +403 -816
  74. package/src/modes/components/user-message-selector.ts +133 -115
  75. package/src/modes/components/vllm-model-selector.ts +9 -9
  76. package/src/modes/components/welcome.ts +20 -64
  77. package/src/modes/controllers/btw-controller.ts +44 -2
  78. package/src/modes/controllers/command-controller.ts +1565 -426
  79. package/src/modes/controllers/context-command-controller.ts +495 -12
  80. package/src/modes/controllers/event-controller.ts +36 -11
  81. package/src/modes/controllers/extension-ui-controller.ts +85 -68
  82. package/src/modes/controllers/input-controller.ts +77 -33
  83. package/src/modes/controllers/mcp-command-controller.ts +766 -198
  84. package/src/modes/controllers/model-selection.ts +68 -0
  85. package/src/modes/controllers/provider-connection-flow.ts +2 -0
  86. package/src/modes/controllers/selector-controller.ts +882 -291
  87. package/src/modes/controllers/ssh-command-controller.ts +133 -59
  88. package/src/modes/index.ts +1 -6
  89. package/src/modes/interactive-mode.ts +778 -106
  90. package/src/modes/slash-command-discovery.ts +68 -0
  91. package/src/modes/terminal-restore.ts +17 -0
  92. package/src/modes/types.ts +9 -7
  93. package/src/modes/utils/clipboard-action.ts +79 -0
  94. package/src/modes/utils/keybinding-matchers.ts +12 -6
  95. package/src/modes/utils/open-action.ts +96 -0
  96. package/src/modes/utils/ui-helpers.ts +2 -2
  97. package/src/prompts/internal-urls/containment.md +1 -1
  98. package/src/routing/commands.ts +11 -5
  99. package/src/sdk.ts +2 -2
  100. package/src/services/xcsh-api-client.ts +3 -3
  101. package/src/services/xcsh-context.ts +73 -33
  102. package/src/services/xcsh-knowledge.ts +2 -2
  103. package/src/session/agent-session.ts +397 -168
  104. package/src/session/session-manager.ts +233 -20
  105. package/src/session/session-storage.ts +7 -2
  106. package/src/slash-commands/browser-command.ts +293 -0
  107. package/src/slash-commands/builtin-registry.ts +974 -302
  108. package/src/slash-commands/export-command.ts +243 -103
  109. package/src/slash-commands/fast-command.ts +107 -0
  110. package/src/slash-commands/plugin-reviewed-actions.ts +569 -0
  111. package/src/slash-commands/resource-commands.ts +283 -65
  112. package/src/sweep/spec-probe.ts +1 -1
  113. package/src/sweep/sweep-params.ts +1 -1
  114. package/src/tools/ask.ts +1 -3
  115. package/src/tools/browser.ts +2 -1
  116. package/src/tools/catalog-workflow-runner.ts +1 -1
  117. package/src/utils/clipboard.ts +27 -31
  118. package/src/utils/open.ts +28 -18
  119. package/src/modes/components/extensions/extension-list.ts +0 -514
  120. package/src/modes/components/extensions/inspector-panel.ts +0 -317
  121. package/src/modes/components/plugin-selector.ts +0 -95
  122. package/src/modes/components/plugins/plugin-inspector-pane.ts +0 -84
  123. package/src/modes/components/plugins/plugin-list-pane.ts +0 -109
  124. 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.24.4",
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",
@@ -62,13 +62,13 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@agentclientprotocol/sdk": "1.4.0",
65
- "@f5-sales-demo/pi-agent-core": "21.24.4",
66
- "@f5-sales-demo/pi-ai": "21.24.4",
67
- "@f5-sales-demo/pi-natives": "21.24.4",
68
- "@f5-sales-demo/pi-resource-management": "21.24.4",
69
- "@f5-sales-demo/pi-tui": "21.24.4",
70
- "@f5-sales-demo/pi-utils": "21.24.4",
71
- "@f5-sales-demo/xcsh-stats": "21.24.4",
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
73
  "@sinclair/typebox": "0.34.52",
74
74
  "@xterm/headless": "^6.0",
@@ -85,6 +85,7 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@types/bun": "1.4.2",
88
+ "@xterm/addon-unicode11": "0.9.0",
88
89
  "handlebars": "^4.7"
89
90
  },
90
91
  "engines": {
@@ -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 ?? 120;
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 ?? 40;
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 ?? 120, theme, 0).length +
91
- (runtime.runningExperiment ? 1 : 0);
92
- const viewportRows = Math.max(4, (process.stdout.rows ?? 40) - 4);
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);
@@ -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=${debugPort} and retry, or unset browser.connectUrl to let xcsh launch Chrome.`,
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 XCSH console's `vsui-input` (e.g. over the HTTP-LB
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
@@ -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 r = await fetch(`http://127.0.0.1:${DEBUG_PORT}/json/version`);
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 127.0.0.1:9222 — xcsh will attach and co-drive it.",
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
  };
@@ -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
  // =============================================================================
@@ -62,7 +62,7 @@ declare module "@f5-sales-demo/pi-tui" {
62
62
  export const KEYBINDINGS = {
63
63
  ...TUI_KEYBINDINGS,
64
64
  "app.interrupt": {
65
- defaultKeys: "escape",
65
+ defaultKeys: "ctrl+c",
66
66
  description: "Interrupt current operation",
67
67
  },
68
68
  "app.clear": {
@@ -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
- const current = this.get("modelRoles");
397
- this.set("modelRoles", { ...current, [role]: modelId });
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
  /**