@f5-sales-demo/xcsh 21.24.4 → 21.27.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 (210) hide show
  1. package/bin/xcsh.ts +0 -0
  2. package/package.json +11 -10
  3. package/src/async/job-manager.ts +48 -16
  4. package/src/autoresearch/dashboard.ts +5 -5
  5. package/src/browser/acquire.ts +36 -1
  6. package/src/browser/input-commit.ts +1 -1
  7. package/src/browser/provider.ts +7 -5
  8. package/src/capability/index.ts +6 -1
  9. package/src/cli/args.ts +9 -1
  10. package/src/cli/flag-spec.ts +5 -0
  11. package/src/cli.ts +1 -0
  12. package/src/commands/remote-control.ts +29 -0
  13. package/src/config/keybindings.ts +1 -1
  14. package/src/config/model-registry.ts +4 -3
  15. package/src/config/settings.ts +33 -2
  16. package/src/debug/index.ts +383 -226
  17. package/src/debug/log-viewer.ts +65 -58
  18. package/src/debug/report-bundle.ts +78 -1
  19. package/src/discovery/helpers.ts +4 -4
  20. package/src/discovery/index.ts +1 -0
  21. package/src/edit/index.ts +12 -1
  22. package/src/edit/modes/hashline.ts +5 -3
  23. package/src/edit/modes/patch.ts +3 -1
  24. package/src/edit/renderer.ts +2 -0
  25. package/src/exec/bash-executor.ts +23 -12
  26. package/src/exec/shell-output-filter.ts +39 -0
  27. package/src/export/html/index.ts +47 -5
  28. package/src/extensibility/custom-commands/types.ts +5 -1
  29. package/src/extensibility/extensions/bundled/herdr-reporter.ts +9 -9
  30. package/src/extensibility/extensions/bundled/native-lifecycle-control.ts +1 -1
  31. package/src/extensibility/extensions/bundled/sandbox-guard.ts +32 -3
  32. package/src/extensibility/extensions/runner.ts +40 -4
  33. package/src/extensibility/extensions/types.ts +9 -0
  34. package/src/extensibility/extensions/wrapper.ts +32 -12
  35. package/src/extensibility/hooks/types.ts +5 -3
  36. package/src/extensibility/plugins/marketplace/manager.ts +10 -1
  37. package/src/extensibility/slash-commands.ts +20 -3
  38. package/src/internal-urls/build-info.generated.ts +8 -8
  39. package/src/internal-urls/docs-index.generated.ts +6 -5
  40. package/src/lsp/index.ts +101 -88
  41. package/src/main.ts +13 -1
  42. package/src/mcp/smithery-auth.ts +2 -1
  43. package/src/memories/index.ts +161 -1
  44. package/src/modes/background-terminal.ts +49 -0
  45. package/src/modes/components/agent-dashboard.ts +725 -908
  46. package/src/modes/components/assistant-message.ts +1 -1
  47. package/src/modes/components/auth-link-presenter.ts +1 -14
  48. package/src/modes/components/bash-execution.ts +3 -1
  49. package/src/modes/components/bordered-loader.ts +11 -3
  50. package/src/modes/components/btw-panel.ts +39 -33
  51. package/src/modes/components/context-add-wizard.ts +71 -43
  52. package/src/modes/components/copy-selector.ts +333 -173
  53. package/src/modes/components/custom-editor.ts +6 -1
  54. package/src/modes/components/extensions/extension-dashboard.ts +541 -327
  55. package/src/modes/components/extensions/index.ts +0 -2
  56. package/src/modes/components/extensions/state-manager.ts +8 -5
  57. package/src/modes/components/extensions/types.ts +10 -0
  58. package/src/modes/components/history-search.ts +106 -126
  59. package/src/modes/components/hook-editor.ts +81 -33
  60. package/src/modes/components/hook-input.ts +67 -50
  61. package/src/modes/components/hook-selector.ts +162 -142
  62. package/src/modes/components/litellm-model-selector.ts +9 -9
  63. package/src/modes/components/login-dialog.ts +55 -12
  64. package/src/modes/components/mcp-add-wizard.ts +102 -72
  65. package/src/modes/components/model-selector.ts +5 -5
  66. package/src/modes/components/oauth-selector.ts +11 -1
  67. package/src/modes/components/plan-preview.ts +25 -0
  68. package/src/modes/components/plugin-settings-drafts.ts +203 -0
  69. package/src/modes/components/plugin-settings.ts +235 -200
  70. package/src/modes/components/plugins/index.ts +0 -2
  71. package/src/modes/components/plugins/plugin-dashboard.ts +1008 -369
  72. package/src/modes/components/plugins/state-manager.ts +16 -17
  73. package/src/modes/components/plugins/types.ts +18 -0
  74. package/src/modes/components/python-execution.ts +3 -1
  75. package/src/modes/components/question-flow.ts +324 -0
  76. package/src/modes/components/queue-mode-selector.ts +9 -10
  77. package/src/modes/components/reviewed-action-dialog.ts +192 -0
  78. package/src/modes/components/reviewed-action.ts +27 -0
  79. package/src/modes/components/searchable-select-list.ts +182 -0
  80. package/src/modes/components/selector-frame.ts +113 -2
  81. package/src/modes/components/session-observer-overlay.ts +94 -77
  82. package/src/modes/components/session-selector.ts +257 -286
  83. package/src/modes/components/settings-browser.ts +132 -0
  84. package/src/modes/components/settings-editors.ts +200 -0
  85. package/src/modes/components/settings-selector.ts +273 -251
  86. package/src/modes/components/show-images-selector.ts +9 -10
  87. package/src/modes/components/status-line.ts +3 -3
  88. package/src/modes/components/theme-selector.ts +9 -10
  89. package/src/modes/components/thinking-selector.ts +9 -10
  90. package/src/modes/components/transcript-notice.ts +49 -0
  91. package/src/modes/components/tree-selector.ts +403 -816
  92. package/src/modes/components/user-message-selector.ts +133 -115
  93. package/src/modes/components/vllm-model-selector.ts +9 -9
  94. package/src/modes/components/welcome.ts +20 -64
  95. package/src/modes/controllers/btw-controller.ts +44 -2
  96. package/src/modes/controllers/command-controller.ts +1580 -428
  97. package/src/modes/controllers/context-command-controller.ts +495 -12
  98. package/src/modes/controllers/event-controller.ts +37 -12
  99. package/src/modes/controllers/extension-ui-controller.ts +164 -68
  100. package/src/modes/controllers/input-controller.ts +77 -33
  101. package/src/modes/controllers/mcp-command-controller.ts +766 -198
  102. package/src/modes/controllers/model-selection.ts +68 -0
  103. package/src/modes/controllers/provider-connection-flow.ts +2 -0
  104. package/src/modes/controllers/selector-controller.ts +882 -291
  105. package/src/modes/controllers/ssh-command-controller.ts +133 -59
  106. package/src/modes/index.ts +1 -6
  107. package/src/modes/interactive-mode.ts +962 -123
  108. package/src/modes/slash-command-discovery.ts +68 -0
  109. package/src/modes/terminal-restore.ts +17 -0
  110. package/src/modes/types.ts +20 -11
  111. package/src/modes/utils/clipboard-action.ts +79 -0
  112. package/src/modes/utils/keybinding-matchers.ts +12 -6
  113. package/src/modes/utils/open-action.ts +96 -0
  114. package/src/modes/utils/ui-helpers.ts +2 -2
  115. package/src/prompts/internal-urls/containment.md +1 -1
  116. package/src/prompts/system/remote-voice-context.md +6 -0
  117. package/src/prompts/system/remote-voice-delegation.md +9 -0
  118. package/src/prompts/system/remote-voice-input.md +3 -0
  119. package/src/prompts/system/remote-voice-mode-end.md +3 -0
  120. package/src/prompts/system/remote-voice-mode-start.md +9 -0
  121. package/src/prompts/system/remote-voice-tail.md +1 -0
  122. package/src/prompts/system/remote-voice.md +3 -0
  123. package/src/remote-control/ACCEPTANCE.md +427 -0
  124. package/src/remote-control/IMPLEMENTATION.md +2682 -0
  125. package/src/remote-control/LICENSE +201 -0
  126. package/src/remote-control/NOTICE.md +179 -0
  127. package/src/remote-control/PARITY.md +1119 -0
  128. package/src/remote-control/auth.ts +60 -0
  129. package/src/remote-control/bridge.ts +118 -0
  130. package/src/remote-control/clients.ts +154 -0
  131. package/src/remote-control/control.ts +222 -0
  132. package/src/remote-control/discovery.ts +156 -0
  133. package/src/remote-control/enrollment.ts +148 -0
  134. package/src/remote-control/errors.ts +8 -0
  135. package/src/remote-control/file-changes.ts +39 -0
  136. package/src/remote-control/history-page.ts +87 -0
  137. package/src/remote-control/history.ts +559 -0
  138. package/src/remote-control/host.ts +393 -0
  139. package/src/remote-control/interactions.ts +290 -0
  140. package/src/remote-control/ipc.ts +128 -0
  141. package/src/remote-control/metadata.ts +77 -0
  142. package/src/remote-control/pairing.ts +79 -0
  143. package/src/remote-control/process.ts +180 -0
  144. package/src/remote-control/protocol-methods.json +192 -0
  145. package/src/remote-control/relay.ts +197 -0
  146. package/src/remote-control/router.ts +521 -0
  147. package/src/remote-control/session-voice-history.ts +98 -0
  148. package/src/remote-control/session.ts +1577 -0
  149. package/src/remote-control/timeline.ts +125 -0
  150. package/src/remote-control/trace-client.ts +25 -0
  151. package/src/remote-control/trace-collector.ts +97 -0
  152. package/src/remote-control/trace-report.ts +59 -0
  153. package/src/remote-control/trace-runtime.ts +46 -0
  154. package/src/remote-control/trace.ts +291 -0
  155. package/src/remote-control/voice-call.ts +157 -0
  156. package/src/remote-control/voice-delegation.ts +26 -0
  157. package/src/remote-control/voice-handoff.ts +198 -0
  158. package/src/remote-control/voice-history.ts +60 -0
  159. package/src/remote-control/voice-input.ts +54 -0
  160. package/src/remote-control/voice-legacy.ts +57 -0
  161. package/src/remote-control/voice-persona.ts +143 -0
  162. package/src/remote-control/voice-protocol.ts +270 -0
  163. package/src/remote-control/voice-socket.ts +72 -0
  164. package/src/remote-control/voice-standalone.ts +145 -0
  165. package/src/remote-control/voice-timeline.ts +182 -0
  166. package/src/remote-control/voice.ts +889 -0
  167. package/src/routing/commands.ts +11 -5
  168. package/src/sandbox/containment.ts +3 -1
  169. package/src/sandbox/enforce.ts +6 -0
  170. package/src/sandbox/remote-permissions.ts +78 -0
  171. package/src/sandbox/session-fence.ts +10 -1
  172. package/src/sdk.ts +31 -2
  173. package/src/services/xcsh-api-client.ts +3 -3
  174. package/src/services/xcsh-context.ts +73 -33
  175. package/src/services/xcsh-knowledge.ts +2 -2
  176. package/src/session/agent-session.ts +1014 -393
  177. package/src/session/messages.ts +2 -1
  178. package/src/session/question-types.ts +56 -0
  179. package/src/session/realtime-context.ts +48 -0
  180. package/src/session/session-manager.ts +265 -27
  181. package/src/session/session-storage.ts +7 -2
  182. package/src/session/session-transitions.ts +94 -0
  183. package/src/session/streaming-output.ts +64 -11
  184. package/src/session/user-interactions.ts +186 -0
  185. package/src/slash-commands/browser-command.ts +293 -0
  186. package/src/slash-commands/builtin-registry.ts +984 -302
  187. package/src/slash-commands/export-command.ts +243 -103
  188. package/src/slash-commands/fast-command.ts +107 -0
  189. package/src/slash-commands/plugin-reviewed-actions.ts +569 -0
  190. package/src/slash-commands/resource-commands.ts +283 -65
  191. package/src/sweep/spec-probe.ts +1 -1
  192. package/src/sweep/sweep-params.ts +1 -1
  193. package/src/tools/ask.ts +30 -375
  194. package/src/tools/bash.ts +89 -29
  195. package/src/tools/browser.ts +2 -1
  196. package/src/tools/catalog-workflow-runner.ts +1 -1
  197. package/src/tools/context.ts +25 -1
  198. package/src/tools/execution-metadata.ts +42 -0
  199. package/src/tools/file-mutations.ts +133 -0
  200. package/src/tools/output-meta.ts +17 -8
  201. package/src/tools/tool-errors.ts +8 -5
  202. package/src/tools/write.ts +41 -26
  203. package/src/utils/clipboard.ts +27 -31
  204. package/src/utils/open.ts +28 -18
  205. package/src/modes/components/extensions/extension-list.ts +0 -514
  206. package/src/modes/components/extensions/inspector-panel.ts +0 -317
  207. package/src/modes/components/plugin-selector.ts +0 -95
  208. package/src/modes/components/plugins/plugin-inspector-pane.ts +0 -84
  209. package/src/modes/components/plugins/plugin-list-pane.ts +0 -109
  210. 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.27.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,8 +38,8 @@
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",
42
- "test": "bun run generate-build-info && bun scripts/bun-test-guarded.ts --max-concurrency 1",
41
+ "pretest": "bun ../../scripts/check-installed-dependencies.ts && bun ../../scripts/ensure-dev-native.ts",
42
+ "test": "bun run generate-build-info && bun scripts/bun-test-guarded.ts --max-concurrency=2",
43
43
  "bench:routing-matrix": "bun scripts/bench-routing-matrix.ts",
44
44
  "bench:copy-selector": "bun scripts/bench-copy-selector.ts",
45
45
  "fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index && bun run generate-api-spec-index && bun run generate-build-info",
@@ -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.27.0",
66
+ "@f5-sales-demo/pi-ai": "21.27.0",
67
+ "@f5-sales-demo/pi-natives": "21.27.0",
68
+ "@f5-sales-demo/pi-resource-management": "21.27.0",
69
+ "@f5-sales-demo/pi-tui": "21.27.0",
70
+ "@f5-sales-demo/pi-utils": "21.27.0",
71
+ "@f5-sales-demo/xcsh-stats": "21.27.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": {
@@ -11,21 +11,29 @@ export interface AsyncJob {
11
11
  type: "bash" | "task";
12
12
  status: "running" | "completed" | "failed" | "cancelled";
13
13
  startTime: number;
14
+ ownerId?: string;
14
15
  label: string;
15
16
  abortController: AbortController;
16
17
  promise: Promise<void>;
17
18
  resultText?: string;
19
+ /** Latest structured executor facts, retained for the durable completion message. */
20
+ resultDetails?: Record<string, unknown>;
18
21
  errorText?: string;
19
22
  }
20
23
 
21
24
  export interface AsyncJobManagerOptions {
22
25
  onJobComplete: (jobId: string, text: string, job?: AsyncJob) => void | Promise<void>;
26
+ getOwnerId?: () => string | undefined;
27
+ onJobCancelled?: (job: AsyncJob) => void | Promise<void>;
28
+ onJobProgress?: (jobId: string, details?: Record<string, unknown>) => void | Promise<void>;
23
29
  maxRunningJobs?: number;
24
30
  retentionMs?: number;
25
31
  }
26
32
 
27
33
  interface AsyncJobDelivery {
28
34
  jobId: string;
35
+ job: AsyncJob;
36
+ cancelled: boolean;
29
37
  text: string;
30
38
  attempt: number;
31
39
  nextAttemptAt: number;
@@ -50,7 +58,10 @@ export class AsyncJobManager {
50
58
  readonly #suppressedDeliveries = new Set<string>();
51
59
  readonly #watchedJobs = new Set<string>();
52
60
  readonly #evictionTimers = new Map<string, NodeJS.Timeout>();
61
+ readonly #onJobCancelled: AsyncJobManagerOptions["onJobCancelled"];
62
+ readonly #getOwnerId: AsyncJobManagerOptions["getOwnerId"];
53
63
  readonly #onJobComplete: AsyncJobManagerOptions["onJobComplete"];
64
+ readonly #onJobProgress: AsyncJobManagerOptions["onJobProgress"];
54
65
  readonly #maxRunningJobs: number;
55
66
  readonly #retentionMs: number;
56
67
  #deliveryLoop: Promise<void> | undefined;
@@ -58,6 +69,9 @@ export class AsyncJobManager {
58
69
 
59
70
  constructor(options: AsyncJobManagerOptions) {
60
71
  this.#onJobComplete = options.onJobComplete;
72
+ this.#onJobCancelled = options.onJobCancelled;
73
+ this.#getOwnerId = options.getOwnerId;
74
+ this.#onJobProgress = options.onJobProgress;
61
75
  this.#maxRunningJobs = Math.max(1, Math.floor(options.maxRunningJobs ?? DEFAULT_MAX_RUNNING_JOBS));
62
76
  this.#retentionMs = Math.max(0, Math.floor(options.retentionMs ?? DEFAULT_RETENTION_MS));
63
77
  }
@@ -92,15 +106,18 @@ export class AsyncJobManager {
92
106
  type,
93
107
  status: "running",
94
108
  startTime,
109
+ ownerId: this.#getOwnerId?.(),
95
110
  label,
96
111
  abortController,
97
112
  promise: Promise.resolve(),
98
113
  };
99
114
 
100
115
  const reportProgress = async (text: string, details?: Record<string, unknown>): Promise<void> => {
101
- if (!options?.onProgress) return;
116
+ if (details) job.resultDetails = details;
102
117
  try {
103
- await options.onProgress(text, details);
118
+ const notified = this.#onJobProgress?.(id, details);
119
+ if (notified) await notified;
120
+ await options?.onProgress?.(text, details);
104
121
  } catch (error) {
105
122
  logger.warn("Async job progress callback failed", {
106
123
  jobId: id,
@@ -113,6 +130,7 @@ export class AsyncJobManager {
113
130
  const text = await run({ jobId: id, signal: abortController.signal, reportProgress });
114
131
  if (job.status === "cancelled") {
115
132
  job.resultText = text;
133
+ this.#enqueueDelivery(id, text, true);
116
134
  this.#scheduleEviction(id);
117
135
  return;
118
136
  }
@@ -123,6 +141,7 @@ export class AsyncJobManager {
123
141
  } catch (error) {
124
142
  if (job.status === "cancelled") {
125
143
  job.errorText = error instanceof Error ? error.message : String(error);
144
+ this.#enqueueDelivery(id, job.errorText, true);
126
145
  this.#scheduleEviction(id);
127
146
  return;
128
147
  }
@@ -144,7 +163,6 @@ export class AsyncJobManager {
144
163
  if (job.status !== "running") return false;
145
164
  job.status = "cancelled";
146
165
  job.abortController.abort();
147
- this.#scheduleEviction(id);
148
166
  return true;
149
167
  }
150
168
 
@@ -216,7 +234,7 @@ export class AsyncJobManager {
216
234
  this.#deliveries.splice(
217
235
  0,
218
236
  this.#deliveries.length,
219
- ...this.#deliveries.filter(delivery => !this.isDeliverySuppressed(delivery.jobId)),
237
+ ...this.#deliveries.filter(delivery => delivery.cancelled || !this.isDeliverySuppressed(delivery.jobId)),
220
238
  );
221
239
  return before - this.#deliveries.length;
222
240
  }
@@ -225,7 +243,6 @@ export class AsyncJobManager {
225
243
  for (const job of this.getRunningJobs()) {
226
244
  job.status = "cancelled";
227
245
  job.abortController.abort();
228
- this.#scheduleEviction(job.id);
229
246
  }
230
247
  }
231
248
 
@@ -278,13 +295,17 @@ export class AsyncJobManager {
278
295
  return drained;
279
296
  }
280
297
 
298
+ #jobIdInUse(id: string): boolean {
299
+ return this.#jobs.has(id) || this.#deliveries.some(delivery => delivery.jobId === id);
300
+ }
301
+
281
302
  #resolveJobId(preferredId?: string): string {
282
303
  preferredId = preferredId?.trim();
283
304
  if (!preferredId) {
284
305
  let candidate = 1;
285
306
  while (true) {
286
307
  const id = `bg_${candidate}`;
287
- if (!this.#jobs.has(id)) {
308
+ if (!this.#jobIdInUse(id)) {
288
309
  return id;
289
310
  }
290
311
  candidate += 1;
@@ -292,11 +313,11 @@ export class AsyncJobManager {
292
313
  }
293
314
 
294
315
  const base = preferredId.trim();
295
- if (!this.#jobs.has(base)) return base;
316
+ if (!this.#jobIdInUse(base)) return base;
296
317
 
297
318
  let suffix = 2;
298
319
  let candidate = `${base}-${suffix}`;
299
- while (this.#jobs.has(candidate)) {
320
+ while (this.#jobIdInUse(candidate)) {
300
321
  suffix += 1;
301
322
  candidate = `${base}-${suffix}`;
302
323
  }
@@ -335,13 +356,18 @@ export class AsyncJobManager {
335
356
  return this.#suppressedDeliveries.has(jobId) || this.#watchedJobs.has(jobId);
336
357
  }
337
358
 
338
- #enqueueDelivery(jobId: string, text: string): void {
359
+ #enqueueDelivery(jobId: string, text: string, cancelled = false): void {
360
+ if (cancelled && !this.#onJobCancelled) return;
361
+ const job = this.#jobs.get(jobId);
362
+ if (!job) return;
339
363
  // Skip delivery if already acknowledged
340
- if (this.isDeliverySuppressed(jobId)) {
364
+ if (!cancelled && this.isDeliverySuppressed(jobId)) {
341
365
  return;
342
366
  }
343
367
  this.#deliveries.push({
344
368
  jobId,
369
+ job,
370
+ cancelled,
345
371
  text,
346
372
  attempt: 0,
347
373
  nextAttemptAt: Date.now(),
@@ -366,10 +392,15 @@ export class AsyncJobManager {
366
392
  });
367
393
  }
368
394
 
395
+ #removeDelivery(delivery: AsyncJobDelivery): void {
396
+ const index = this.#deliveries.indexOf(delivery);
397
+ if (index >= 0) this.#deliveries.splice(index, 1);
398
+ }
399
+
369
400
  async #runDeliveryLoop(): Promise<void> {
370
401
  while (this.#deliveries.length > 0) {
371
402
  const delivery = this.#deliveries[0];
372
- if (this.isDeliverySuppressed(delivery.jobId)) {
403
+ if (!delivery.cancelled && this.isDeliverySuppressed(delivery.jobId)) {
373
404
  this.#deliveries.shift();
374
405
  continue;
375
406
  }
@@ -381,20 +412,21 @@ export class AsyncJobManager {
381
412
  continue;
382
413
  }
383
414
  // Check again after sleep
384
- if (this.isDeliverySuppressed(delivery.jobId)) {
415
+ if (!delivery.cancelled && this.isDeliverySuppressed(delivery.jobId)) {
385
416
  this.#deliveries.shift();
386
417
  continue;
387
418
  }
388
419
 
389
420
  try {
390
- await this.#onJobComplete(delivery.jobId, delivery.text, this.#jobs.get(delivery.jobId));
391
- this.#deliveries.shift();
421
+ if (delivery.cancelled) await this.#onJobCancelled?.(delivery.job);
422
+ else await this.#onJobComplete(delivery.jobId, delivery.text, delivery.job);
423
+ this.#removeDelivery(delivery);
392
424
  } catch (error) {
393
425
  delivery.attempt += 1;
394
426
  delivery.lastError = error instanceof Error ? error.message : String(error);
395
427
  delivery.nextAttemptAt = Date.now() + this.#getRetryDelay(delivery.attempt);
396
- this.#deliveries.shift();
397
- if (!this.isDeliverySuppressed(delivery.jobId)) {
428
+ this.#removeDelivery(delivery);
429
+ if (delivery.cancelled || !this.isDeliverySuppressed(delivery.jobId)) {
398
430
  this.#deliveries.push(delivery);
399
431
  }
400
432
  logger.warn("Async job completion delivery failed", {
@@ -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
  // =============================================================================
package/src/cli/args.ts CHANGED
@@ -55,6 +55,8 @@ export interface Args {
55
55
  hooks?: string[];
56
56
  extensions?: string[];
57
57
  noExtensions?: boolean;
58
+ /** Trusted built-in extensions to retain while --no-extensions disables discovery. */
59
+ bundledExtensions?: string[];
58
60
  pluginDirs?: string[];
59
61
  print?: boolean;
60
62
  export?: string;
@@ -195,6 +197,9 @@ const APPLY: Record<LaunchFlagName, (result: Args, value: string | true) => void
195
197
  "no-extensions": r => {
196
198
  r.noExtensions = true;
197
199
  },
200
+ "bundled-extension": (r, v) => {
201
+ r.bundledExtensions = [...(r.bundledExtensions ?? []), v as string];
202
+ },
198
203
  "no-skills": r => {
199
204
  r.noSkills = true;
200
205
  },
@@ -235,11 +240,12 @@ export interface LaunchBootstrapArgs {
235
240
  hooks: string[];
236
241
  extensions: string[];
237
242
  noExtensions?: boolean;
243
+ bundledExtensions: string[];
238
244
  pluginDirs: string[];
239
245
  preExtensionExit: boolean;
240
246
  }
241
247
 
242
- const BOOTSTRAP_VALUE_FLAGS = new Set(["allow-path", "hook", "extension", "plugin-dir"]);
248
+ const BOOTSTRAP_VALUE_FLAGS = new Set(["allow-path", "hook", "extension", "bundled-extension", "plugin-dir"]);
243
249
  const PRE_EXTENSION_EXITS = new Set(["version", "list-models", "export"]);
244
250
 
245
251
  /**
@@ -254,6 +260,7 @@ export function scanLaunchBootstrapArgs(args: readonly string[]): LaunchBootstra
254
260
  allowPath: [],
255
261
  hooks: [],
256
262
  extensions: [],
263
+ bundledExtensions: [],
257
264
  pluginDirs: [],
258
265
  preExtensionExit: false,
259
266
  };
@@ -286,6 +293,7 @@ export function scanLaunchBootstrapArgs(args: readonly string[]): LaunchBootstra
286
293
  if (name === "allow-path") result.allowPath.push(value);
287
294
  if (name === "hook") result.hooks.push(value);
288
295
  if (name === "extension") result.extensions.push(value);
296
+ if (name === "bundled-extension") result.bundledExtensions.push(value);
289
297
  if (name === "plugin-dir") result.pluginDirs.push(value);
290
298
  }
291
299
  }
@@ -99,6 +99,11 @@ export const LAUNCH_FLAGS = defineFlags({
99
99
  arity: "boolean",
100
100
  description: "Disable extension discovery (explicit -e paths still work)",
101
101
  },
102
+ "bundled-extension": {
103
+ arity: "repeatable-value",
104
+ description: "Load a named trusted bundled extension while discovery is disabled",
105
+ hidden: true,
106
+ },
102
107
  "no-skills": { arity: "boolean", description: "Disable skills discovery and loading" },
103
108
  skills: {
104
109
  arity: "value",
package/src/cli.ts CHANGED
@@ -50,6 +50,7 @@ if (Bun.stringWidth("\x1b[0m\x1b]8;;\x07") !== 0) {
50
50
  process.title = APP_NAME;
51
51
 
52
52
  const commands: CommandEntry[] = [
53
+ { name: "remote-control", load: () => import("./commands/remote-control").then(m => m.default) },
53
54
  { name: "apply", load: () => import("./commands/apply").then(m => m.default) },
54
55
  { name: "launch", load: () => import("./commands/launch").then(m => m.default) },
55
56
  { name: "agents", load: () => import("./commands/agents").then(m => m.default) },
@@ -0,0 +1,29 @@
1
+ import { Args, Command, Flags } from "@f5-sales-demo/pi-utils/cli";
2
+ import { runRemoteControl } from "../remote-control/control";
3
+ export default class RemoteControl extends Command {
4
+ static description = "Native remote interoperability preview: enable, disable, status, pair, clients, revoke";
5
+ static args = {
6
+ action: Args.string({ required: true, description: "enable | disable | status | pair | clients | revoke" }),
7
+ clientId: Args.string({ description: "Client identity to revoke (from clients output)" }),
8
+ };
9
+ static flags = {
10
+ json: Flags.boolean({ description: "Machine-readable status" }),
11
+ cursor: Flags.string({ description: "Client-list pagination cursor" }),
12
+ limit: Flags.integer({ description: "Client-list page size (1–100)" }),
13
+ order: Flags.string({ description: "Client-list order", options: ["asc", "desc"] }),
14
+ };
15
+ async run(): Promise<void> {
16
+ const { args, flags } = await this.parse(RemoteControl);
17
+ if (!args.action) throw new Error("A remote action is required");
18
+ if (args.clientId && args.action !== "revoke") throw new Error("A client identity applies only to revoke");
19
+ if (args.action !== "clients" && (flags.cursor != null || flags.limit != null || flags.order != null))
20
+ throw new Error("Pagination flags apply only to clients");
21
+ const result = await runRemoteControl(args.action, {
22
+ clientId: args.clientId,
23
+ cursor: flags.cursor,
24
+ limit: flags.limit,
25
+ order: flags.order as "asc" | "desc" | undefined,
26
+ });
27
+ if (result !== undefined) process.stdout.write(`${JSON.stringify(result)}\n`);
28
+ }
29
+ }
@@ -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": {
@@ -1068,7 +1068,7 @@ export class ModelRegistry {
1068
1068
 
1069
1069
  this.#addImplicitDiscoverableProviders(configuredProviders);
1070
1070
  const builtInModels = this.#applyHardcodedModelPolicies(this.#loadBuiltInModels(overrides));
1071
- const cachedDiscoveries = this.#applyHardcodedModelPolicies(this.#loadCachedDiscoverableModels());
1071
+ const cachedDiscoveries = this.#applyHardcodedModelPolicies(this.#loadCachedDiscoverableModels(), true);
1072
1072
  const resolvedDefaults = this.#mergeResolvedModels(builtInModels, cachedDiscoveries);
1073
1073
  const withConfigModels = this.#mergeCustomModels(resolvedDefaults, this.#customModelOverlays);
1074
1074
  // Merge runtime extension models so they survive refresh() cycles
@@ -1395,6 +1395,7 @@ export class ModelRegistry {
1395
1395
  }
1396
1396
  : model;
1397
1397
  }),
1398
+ true,
1398
1399
  );
1399
1400
  this.#models = this.#models.filter(
1400
1401
  model => !refreshed.has(model.provider) || this.#providerDiscoveryStates.get(model.provider)?.status !== "ok",
@@ -2091,11 +2092,11 @@ export class ModelRegistry {
2091
2092
  return applyModelOverride(model, override);
2092
2093
  });
2093
2094
  }
2094
- #applyHardcodedModelPolicies(models: Model<Api>[]): Model<Api>[] {
2095
+ #applyHardcodedModelPolicies(models: Model<Api>[], preserveDiscoveredThinking = false): Model<Api>[] {
2095
2096
  // Discovery caches contain provider-advertised metadata, which can lag the
2096
2097
  // bundled corrections. Reapply generated-model policy before a cached entry
2097
2098
  // replaces its bundled peer; explicit user overrides still run afterward.
2098
- applyGeneratedModelPolicies(models);
2099
+ applyGeneratedModelPolicies(models, { preserveDiscoveredThinking });
2099
2100
  return models.map(model => {
2100
2101
  if (model.id !== "gpt-5.4" || model.provider === "github-copilot") {
2101
2102
  return model;
@@ -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
  /**