@f5-sales-demo/xcsh 21.16.0 → 21.17.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/CHANGELOG.md CHANGED
@@ -40,6 +40,14 @@
40
40
 
41
41
  ### Fixed
42
42
 
43
+ - Made the session picker, extension dashboard, and debug-log viewer fullscreen and mouse-aware while
44
+ retaining their keyboard behavior, pinned chrome, and non-action row semantics
45
+ ([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
46
+ - Persisted unsent editor drafts for one-shot resume recovery, unified interactive and signal-driven
47
+ teardown, made session disposal idempotent, and restored POSIX Ctrl-Z suspension with self-`SIGSTOP`.
48
+ Semantically ported from [can1357/oh-my-pi#4121](https://github.com/can1357/oh-my-pi/pull/4121)
49
+ and [#3463](https://github.com/can1357/oh-my-pi/pull/3463)
50
+ ([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
43
51
  - Prevented malformed task `submit_result` data, non-string write content, and invalid renderer path
44
52
  values from crashing task, read, write, edit, inspect-image, or browser output. Semantically
45
53
  ported from [can1357/oh-my-pi#1989](https://github.com/can1357/oh-my-pi/pull/1989),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/xcsh",
4
- "version": "21.16.0",
4
+ "version": "21.17.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",
@@ -61,13 +61,13 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@agentclientprotocol/sdk": "1.3.0",
64
- "@f5-sales-demo/pi-agent-core": "21.16.0",
65
- "@f5-sales-demo/pi-ai": "21.16.0",
66
- "@f5-sales-demo/pi-natives": "21.16.0",
67
- "@f5-sales-demo/pi-resource-management": "21.16.0",
68
- "@f5-sales-demo/pi-tui": "21.16.0",
69
- "@f5-sales-demo/pi-utils": "21.16.0",
70
- "@f5-sales-demo/xcsh-stats": "21.16.0",
64
+ "@f5-sales-demo/pi-agent-core": "21.17.0",
65
+ "@f5-sales-demo/pi-ai": "21.17.0",
66
+ "@f5-sales-demo/pi-natives": "21.17.0",
67
+ "@f5-sales-demo/pi-resource-management": "21.17.0",
68
+ "@f5-sales-demo/pi-tui": "21.17.0",
69
+ "@f5-sales-demo/pi-utils": "21.17.0",
70
+ "@f5-sales-demo/xcsh-stats": "21.17.0",
71
71
  "@mozilla/readability": "^0.6",
72
72
  "@sinclair/typebox": "^0.34",
73
73
  "@xterm/headless": "^6.0",
@@ -39,13 +39,14 @@ export async function selectSession(sessions: SessionInfo[]): Promise<string | n
39
39
  await storage.deleteSessionWithArtifacts(session.path);
40
40
  return true;
41
41
  },
42
+ { fillHeight: true, getTerminalRows: () => ui.terminal.rows },
42
43
  );
43
44
  return selector;
44
45
  };
45
46
 
46
47
  const selector = showSelector();
47
48
  selector.setOnRequestRender(() => ui.requestRender());
48
- ui.addChild(selector);
49
+ ui.showOverlay(selector, { fullscreen: true, anchor: "top-left", width: "100%", maxHeight: "100%", margin: 0 });
49
50
  ui.setFocus(selector);
50
51
  ui.start();
51
52
  return promise;
@@ -6,7 +6,15 @@
6
6
  import * as fs from "node:fs/promises";
7
7
  import * as url from "node:url";
8
8
  import { getWorkProfile } from "@f5-sales-demo/pi-natives";
9
- import { Container, Loader, type SelectItem, SelectList, Spacer, Text } from "@f5-sales-demo/pi-tui";
9
+ import {
10
+ Container,
11
+ Loader,
12
+ type OverlayHandle,
13
+ type SelectItem,
14
+ SelectList,
15
+ Spacer,
16
+ Text,
17
+ } from "@f5-sales-demo/pi-tui";
10
18
  import { getSessionsDir } from "@f5-sales-demo/pi-utils";
11
19
  import type { ContextProfile } from "../context/profile";
12
20
  import { DynamicBorder } from "../modes/components/dynamic-border";
@@ -302,18 +310,27 @@ export class DebugSelectorComponent extends Container {
302
310
  return;
303
311
  }
304
312
 
313
+ let overlay: OverlayHandle | undefined;
305
314
  const viewer = new DebugLogViewerComponent({
306
315
  logs,
307
- terminalRows: this.ctx.ui.terminal.rows,
308
- onExit: () => this.ctx.showDebugSelector(),
316
+ terminalRows: () => this.ctx.ui.terminal.rows,
317
+ onExit: () => {
318
+ overlay?.hide();
319
+ this.ctx.showDebugSelector();
320
+ },
309
321
  onStatus: message => this.ctx.showStatus(message, { dim: true }),
310
322
  onError: message => this.ctx.showError(message),
311
323
  onUpdate: () => this.ctx.ui.requestRender(),
312
324
  logSource,
313
325
  });
314
326
 
315
- this.ctx.editorContainer.clear();
316
- this.ctx.editorContainer.addChild(viewer);
327
+ overlay = this.ctx.ui.showOverlay(viewer, {
328
+ fullscreen: true,
329
+ anchor: "top-left",
330
+ width: "100%",
331
+ maxHeight: "100%",
332
+ margin: 0,
333
+ });
317
334
  this.ctx.ui.setFocus(viewer);
318
335
  } catch (err) {
319
336
  this.ctx.showError(`Failed to read logs: ${err instanceof Error ? err.message : String(err)}`);
@@ -2,9 +2,11 @@ import { sanitizeText } from "@f5-sales-demo/pi-natives";
2
2
  import {
3
3
  type Component,
4
4
  extractPrintableText,
5
+ type MouseRoutable,
5
6
  matchesKey,
6
7
  padding,
7
8
  replaceTabs,
9
+ type SgrMouseEvent,
8
10
  truncateToWidth,
9
11
  visibleWidth,
10
12
  } from "@f5-sales-demo/pi-tui";
@@ -184,6 +186,14 @@ export class DebugLogViewerModel {
184
186
  }
185
187
  }
186
188
 
189
+ moveCursorToRow(rowIndex: number): boolean {
190
+ const selectableIndex = this.#selectableRowIndices.indexOf(rowIndex);
191
+ if (selectableIndex < 0) return false;
192
+ this.#cursorSelectableIndex = selectableIndex;
193
+ this.#selectionAnchorSelectableIndex = undefined;
194
+ return true;
195
+ }
196
+
187
197
  getSelectedLogIndices(): number[] {
188
198
  if (this.#selectableRowIndices.length === 0) {
189
199
  return [];
@@ -462,7 +472,7 @@ export class DebugLogViewerModel {
462
472
 
463
473
  interface DebugLogViewerComponentOptions {
464
474
  logs: string;
465
- terminalRows: number;
475
+ terminalRows: number | (() => number);
466
476
  onExit: () => void;
467
477
  onStatus?: (message: string) => void;
468
478
  onError?: (message: string) => void;
@@ -472,9 +482,9 @@ interface DebugLogViewerComponentOptions {
472
482
  onUpdate?: () => void;
473
483
  }
474
484
 
475
- export class DebugLogViewerComponent implements Component {
485
+ export class DebugLogViewerComponent implements Component, MouseRoutable {
476
486
  #model: DebugLogViewerModel;
477
- #terminalRows: number;
487
+ #getTerminalRows: () => number;
478
488
  #onExit: () => void;
479
489
  #onStatus?: (message: string) => void;
480
490
  #onError?: (message: string) => void;
@@ -484,6 +494,9 @@ export class DebugLogViewerComponent implements Component {
484
494
  #scrollRowOffset = 0;
485
495
  #statusMessage: string | undefined;
486
496
  #loadingOlder = false;
497
+ #bodyRowStart = 5;
498
+ #bodyRowCount = 0;
499
+ #bodyLineToRowIndex: Array<number | undefined> = [];
487
500
 
488
501
  constructor(options: DebugLogViewerComponentOptions) {
489
502
  this.#logSource = options.logSource;
@@ -493,7 +506,8 @@ export class DebugLogViewerComponent implements Component {
493
506
  hasOlderLogs: this.#logSource?.hasOlderLogs.bind(this.#logSource),
494
507
  loadOlderLogs: this.#logSource?.loadOlderLogs.bind(this.#logSource),
495
508
  });
496
- this.#terminalRows = options.terminalRows;
509
+ const terminalRows = options.terminalRows;
510
+ this.#getTerminalRows = typeof terminalRows === "function" ? terminalRows : () => terminalRows;
497
511
  this.#onExit = options.onExit;
498
512
  this.#onStatus = options.onStatus;
499
513
  this.#onError = options.onError;
@@ -610,6 +624,7 @@ export class DebugLogViewerComponent implements Component {
610
624
  const bodyHeight = this.#bodyHeight();
611
625
 
612
626
  const rows = this.#renderRows(innerWidth);
627
+ this.#bodyRowCount = bodyHeight;
613
628
  const visibleBodyLines = this.#renderVisibleBodyLines(rows, innerWidth, bodyHeight);
614
629
 
615
630
  return [
@@ -624,6 +639,28 @@ export class DebugLogViewerComponent implements Component {
624
639
  ];
625
640
  }
626
641
 
642
+ routeMouse(event: SgrMouseEvent, _line: number, _col: number): void {
643
+ const overBody = event.row >= this.#bodyRowStart && event.row < this.#bodyRowStart + this.#bodyRowCount;
644
+ if (event.wheel !== null && overBody) {
645
+ this.#model.moveCursor(event.wheel * 3, false);
646
+ this.#ensureCursorVisible();
647
+ this.#onUpdate?.();
648
+ return;
649
+ }
650
+ if (!event.leftClick || !overBody) return;
651
+ const rowIndex = this.#bodyLineToRowIndex[event.row - this.#bodyRowStart];
652
+ if (rowIndex === undefined || !this.#model.moveCursorToRow(rowIndex)) return;
653
+ const target = this.#model.rows[rowIndex];
654
+ if (target?.kind === "load-older") {
655
+ void this.#handleLoadOlder();
656
+ } else if (target?.kind === "log") {
657
+ if (this.#model.isExpanded(target.logIndex)) this.#model.collapseSelected();
658
+ else this.#model.expandSelected();
659
+ }
660
+ this.#ensureCursorVisible();
661
+ this.#onUpdate?.();
662
+ }
663
+
627
664
  #summaryText(): string {
628
665
  return ` # ${this.#model.visibleLogCount}/${this.#model.logCount} logs | ${this.#controlsText()}`;
629
666
  }
@@ -650,7 +687,7 @@ export class DebugLogViewerComponent implements Component {
650
687
  }
651
688
 
652
689
  #bodyHeight(): number {
653
- return Math.max(3, this.#terminalRows - 8);
690
+ return Math.max(3, this.#getTerminalRows() - 8);
654
691
  }
655
692
 
656
693
  async #handleLoadOlder(additionalCount: number = LOAD_OLDER_CHUNK): Promise<void> {
@@ -785,8 +822,10 @@ export class DebugLogViewerComponent implements Component {
785
822
  innerWidth: number,
786
823
  bodyHeight: number,
787
824
  ): string[] {
825
+ this.#bodyLineToRowIndex = [];
788
826
  const lines: string[] = [];
789
827
  if (rows.length === 0) {
828
+ this.#bodyLineToRowIndex.push(undefined);
790
829
  lines.push(this.#frameLine(theme.fg("muted", "no matches"), innerWidth));
791
830
  }
792
831
  for (let i = this.#scrollRowOffset; i < rows.length; i++) {
@@ -799,6 +838,7 @@ export class DebugLogViewerComponent implements Component {
799
838
  if (lines.length >= bodyHeight) {
800
839
  break;
801
840
  }
841
+ this.#bodyLineToRowIndex.push(row.rowIndex);
802
842
  lines.push(this.#frameLine(line, innerWidth));
803
843
  }
804
844
 
@@ -808,6 +848,7 @@ export class DebugLogViewerComponent implements Component {
808
848
  }
809
849
 
810
850
  while (lines.length < bodyHeight) {
851
+ this.#bodyLineToRowIndex.push(undefined);
811
852
  lines.push(this.#frameLine("", innerWidth));
812
853
  }
813
854
 
@@ -17,17 +17,17 @@ export interface BuildInfo {
17
17
  }
18
18
 
19
19
  export const BUILD_INFO: BuildInfo = {
20
- "version": "21.16.0",
21
- "commit": "2ee9c73e64d26cdd744468c74b92968709a8be86",
22
- "shortCommit": "2ee9c73",
20
+ "version": "21.17.0",
21
+ "commit": "2bad5cbd5994bd35b0c3c28432d35b05f3641a65",
22
+ "shortCommit": "2bad5cb",
23
23
  "branch": "main",
24
- "tag": "v21.16.0",
25
- "commitDate": "2026-09-07T04:11:15+00:00",
26
- "buildDate": "2026-09-07T05:10:58.140Z",
24
+ "tag": "v21.17.0",
25
+ "commitDate": "2026-09-07T05:17:42+00:00",
26
+ "buildDate": "2026-09-07T06:06:54.827Z",
27
27
  "dirty": true,
28
28
  "prNumber": "",
29
29
  "repoUrl": "https://github.com/f5-sales-demo/xcsh",
30
30
  "repoSlug": "f5-sales-demo/xcsh",
31
- "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/2ee9c73e64d26cdd744468c74b92968709a8be86",
32
- "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.16.0"
31
+ "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/2bad5cbd5994bd35b0c3c28432d35b05f3641a65",
32
+ "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.17.0"
33
33
  };
@@ -14,7 +14,7 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
14
14
  "en/architecture-contribution/storage-artifacts.mdx": "---\ntitle: \"Storage, blobs, and artifacts\"\ndescription: \"Trace configuration roots, session JSONL, binary blobs, text artifacts, scan caches, and move semantics.\"\nsidebar:\n order: 2\n label: \"Storage and artifacts\"\n---\n\nxcsh separates append-only conversation state from large or generated payloads. Session JSON Lines (JSONL) preserves the event graph; blob and artifact stores keep bulky data addressable without inflating every session entry.\n\n## How are stored values allocated and resolved?\n\nStorage helpers choose user or project roots, allocate collision-resistant identifiers, and record names separately from content addresses. Text artifacts remain inspectable; binary blobs are externalized and referenced by uniform resource locator (URL)-like identifiers. URL handlers validate the scheme and authority before opening the backing object.\n\n## How do resume, fork, and move treat state?\n\nResume rebuilds context from the selected session leaf. Forking creates a new branch without rewriting the source branch. Moves must update the session reference and its dependent stored values as one operation or leave the original valid; partial copies are not a successful move.\n\n## How is filesystem discovery cached?\n\nThe scan cache partitions keys by root and discovery options, evicts by freshness policy, and uses a short empty-result recheck so a newly created configuration file is noticed. Mutating code owns invalidation. A new consumer must define its cache key, freshness need, and invalidation points explicitly.\n\nRead `packages/coding-agent/src/session` for the append-only event graph and `packages/coding-agent/src/discovery` for the scan cache.\n",
15
15
  "en/architecture-contribution/tool-runtime.mdx": "---\ntitle: \"Tool runtime\"\ndescription: \"Trace Bash, notebook, deferred-action, custom-tool, context, and task-agent execution boundaries.\"\nsidebar:\n order: 3\n label: \"Tool runtime\"\n---\n\nThe agent loop sees a common tool contract, but each runtime owns its validation, cancellation, output, and side effects.\n\n## How do shell and notebook work execute?\n\nThe Bash tool validates the request, launches through the configured shell boundary, streams bounded output, and spills oversized results to an artifact. Notebook editing changes cell structure; kernel execution is a separate Python gateway operation with its own environment and Multipurpose Internet Mail Extensions (MIME) rendering.\n\n## How are deferred actions resolved?\n\nDeferred actions are pushed onto a last-in, first-out stack and resolved only at the runtime checkpoint that owns them. Custom tools use the host application programming interface (API) to register actions; they must pair cancellation and cleanup with any external resource they create.\n\n## How are commands and task agents discovered?\n\nSlash-command templates and agent definitions are discovered from normalized user, project, plugin, and bundled providers. Precedence resolves duplicate identifiers before execution. Argument expansion produces prompt input; it must not bypass tool policy or agent execution guardrails.\n\nRead `packages/coding-agent/src/tools/bash.ts` for the shell boundary, `packages/coding-agent/src/tools/notebook.ts` for cell editing, and `packages/coding-agent/src/slash-commands/builtin-registry.ts` for command discovery.\n",
16
16
  "en/architecture-contribution/tui-runtime.mdx": "---\ntitle: \"TUI runtime\"\ndescription: \"Trace component contracts, differential rendering, terminal input, modal UI, and custom tool renderers.\"\nsidebar:\n order: 8\n label: \"TUI runtime\"\n---\n\nThe terminal user interface (TUI) renders session and runtime state through components. Components return terminal cells and semantic styles; the renderer computes a differential update instead of repainting unrelated rows.\n\n## How are input and rendering routed?\n\nTerminal decoding turns bytes and escape sequences into key events. Focused overlays receive input before the prompt editor and global actions. State changes schedule a render, layout produces the next frame, and the diff layer emits only changed terminal regions.\n\n## How do I extend interactive surfaces?\n\nExtensions can open a modal through `ctx.ui.custom` only when an interactive UI host exists. Custom tools may provide renderers for calls and results while preserving a plain-text representation for headless clients. A renderer must not become the only copy of durable tool output.\n\nRead `packages/tui/src` for the component and rendering contracts, and `packages/coding-agent/src/tui` for the session-aware components built on them.\n",
17
- "en/architecture-contribution/upstream-pi.mdx": "---\ntitle: \"Relationship to pi\"\ndescription: \"Understand what xcsh inherits from pi and where the project deliberately specializes.\"\nsidebar:\n order: 9\n label: \"Relationship to pi\"\n---\n\nxcsh is derived from the open-source pi coding agent and adds F5 Distributed Cloud resource workflows, integrations, packaging, and project-specific governance.\n\n## Which upstream range was reviewed?\n\nThe last proven sync with `can1357/oh-my-pi` was `d350ea60e` on April 9, 2026. The first-pass\nsecurity and shared-runtime audit reviewed the divergent line through `b2f25dbfe1` on September 5,\n2026. The second-pass TUI and renderer audit extends that lineage through the frozen tip\n`6d3bc569d16cd7351073eaa767caed51021befbb` on September 6, 2026.\nBecause the repositories no longer share a usable linear history, accepted changes are semantic\nports with adapted regressions rather than merges or ancestry-based cherry-picks.\n\n## Which changes were accepted?\n\nThe four implementation waves accepted these upstream pull requests:\n\n| Wave | Upstream pull requests | xcsh delivery |\n| --- | --- | --- |\n| Provider and prompt security | #2147, the opaque-thinking portion of #3239, #7067, and #8727 | #3710 |\n| Configuration and execution security | #7362 and #5636 | #3720 |\n| Core runtime | #7743, #10415, #10523, #10325, and #10550 | #3723 |\n| Terminal and platform | #10613, #10997, #10492, #9233, and #7634 | #3724 |\n| TUI and renderer crash containment | #1989, #4497, #4529, #2047, #5837, and #6788 | #3743 |\n\nThese ports protect provider-bound secrets and compaction boundaries, enforce exact-case\nenvironment references and complete protocol tails, repair Responses replay and shared MCP\nresults, improve rate-limit and retained-string behavior, chain directory completion, extend\npower assertions across supported platforms, and harden stats persistence and network exposure.\nThe source pull requests remain attributable to `can1357/oh-my-pi`; the xcsh deliveries link the\nexact commits and regression evidence.\n\nThe second-pass renderer work normalizes malformed task result data, accepts only strings at path\nboundaries, bounds ANSI-heavy rows before width measurement, and treats terminal disconnect\ncleanup as best effort before SIGHUP. Upstream #5438 is equivalent because `Container.render()`\nalready isolates child-render exceptions; its richer fallback display remains deferred.\n\n## Where does xcsh deliberately diverge?\n\nxcsh retains its own:\n\n- F5-scoped packages, prompts-as-files, tool factories, and capability discovery;\n- SQLite multi-credential storage, multi-account authentication, and provider routing;\n- MCP, SSH, F5 Distributed Cloud, Office, and browser integrations;\n- Bun-first runtime, session semantics, release pipeline, branding, and governance.\n\nPublic interfaces use prerelease clean breaks. In this wave,\n`MacOSPowerAssertion`/`MacOSPowerAssertionOptions` became\n`PowerAssertion`/`PowerAssertionOptions` without aliases, and `power.sleepPrevention` was added with\nan `idle` default.\n\n## What remains excluded or deferred?\n\nUpstream workflows, branding, release machinery, generated model catalogs, compatibility shims,\nnew packages, and large unrelated subsystems are excluded. The security-scan subsystem in #7048\nand the native minimizer in #2176 remain deferred. The range-dashboard optimization in #9327 and\nearendil-works/pi-only fullscreen transcript, mouse, clipboard, and renderer subsystems also remain\noutside this campaign. MCP, OpenCode, Herdr, #10625, and #10491 are explicitly excluded from the\nsecond-pass batch. Commits after the frozen source tip require a later audit.\n\n## How do I decide where a fix belongs?\n\nTrace the affected module and compare it with the pinned upstream lineage. A generic agent-loop\ndefect may belong upstream; an xcsh resource command, integration, or packaging change belongs\nhere.\n\n## How do I preserve attribution?\n\nKeep upstream license notices and document imported changes. Avoid copying a patch blindly across\ndiverged modules; port the behavior with tests against the current xcsh architecture.\n",
17
+ "en/architecture-contribution/upstream-pi.mdx": "---\ntitle: \"Relationship to pi\"\ndescription: \"Understand what xcsh inherits from pi and where the project deliberately specializes.\"\nsidebar:\n order: 9\n label: \"Relationship to pi\"\n---\n\nxcsh is derived from the open-source pi coding agent and adds F5 Distributed Cloud resource workflows, integrations, packaging, and project-specific governance.\n\n## Which upstream range was reviewed?\n\nThe last proven sync with `can1357/oh-my-pi` was `d350ea60e` on April 9, 2026. The first-pass\nsecurity and shared-runtime audit reviewed the divergent line through `b2f25dbfe1` on September 5,\n2026. The second-pass TUI and renderer audit extends that lineage through the frozen tip\n`6d3bc569d16cd7351073eaa767caed51021befbb` on September 6, 2026.\nThe third-pass terminal-interaction audit extends the reviewed lineage through\n`a1b254047d12e143b7c6011536e918c6c35c5906`, also frozen on September 6, 2026.\nBecause the repositories no longer share a usable linear history, accepted changes are semantic\nports with adapted regressions rather than merges or ancestry-based cherry-picks.\n\n## Which changes were accepted?\n\nThe four implementation waves accepted these upstream pull requests:\n\n| Wave | Upstream pull requests | xcsh delivery |\n| --- | --- | --- |\n| Provider and prompt security | #2147, the opaque-thinking portion of #3239, #7067, and #8727 | #3710 |\n| Configuration and execution security | #7362 and #5636 | #3720 |\n| Core runtime | #7743, #10415, #10523, #10325, and #10550 | #3723 |\n| Terminal and platform | #10613, #10997, #10492, #9233, and #7634 | #3724 |\n| TUI and renderer crash containment | #1989, #4497, #4529, #2047, #5837, and #6788 | #3743 |\n| Herdr, signals, and mouse interaction | #7810, #8433, #11054, #4121, #3463, #3402, and #11045 | #3748 |\n\nThese ports protect provider-bound secrets and compaction boundaries, enforce exact-case\nenvironment references and complete protocol tails, repair Responses replay and shared MCP\nresults, improve rate-limit and retained-string behavior, chain directory completion, extend\npower assertions across supported platforms, and harden stats persistence and network exposure.\nThe source pull requests remain attributable to `can1357/oh-my-pi`; the xcsh deliveries link the\nexact commits and regression evidence.\n\nThe second-pass renderer work normalizes malformed task result data, accepts only strings at path\nboundaries, bounds ANSI-heavy rows before width measurement, and treats terminal disconnect\ncleanup as best effort before SIGHUP. Upstream #5438 is equivalent because `Container.render()`\nalready isolates child-render exceptions; its richer fallback display remains deferred.\n\nThe third-pass work adds a shared fullscreen/mouse framework, applies it to the session picker,\nextension dashboard, and debug-log viewer, and keeps terminal state restoration idempotent across\nnormal exit, resize, disconnect, and emergency cleanup. Herdr pane identity now participates in\nmultiplexer redraw decisions, while notifications use validated argv-only `herdr notification show`\ndelivery with terminal fallback. Interactive and signal exits share one draft-preserving teardown,\nand POSIX Ctrl-Z suspends only the xcsh process with `SIGSTOP`.\n\n| Third-pass candidate | Disposition |\n| --- | --- |\n| Herdr #7810, #8433, and #11054 | Ported: scrollback-safe rendering, resize behavior, and notification delivery |\n| Herdr #10356 and #10479 | Equivalent: explicit `HERDR_KITTY_GRAPHICS` gating and synchronized rendering already cover the behavior |\n| Herdr #7554 | Not applicable: xcsh uses its compiled executable and dedicated launcher |\n| Signal #4121 (`73a12c7e`) | Ported: shared idempotent teardown and one-shot draft recovery |\n| Signal #3463 (`8506fbdf`) | Ported: interactive self-`SIGSTOP`; deliberate background process-group `SIGTSTP` remains unchanged |\n| Mouse #3402 and #11045 | Ported: shared SGR parsing/routing and horizontal-wheel rejection |\n| `cffb804d`, `27ed9f7a`, and log-viewer portion of `5fbe8876` | Ported to the session picker, extension dashboard, and debug-log viewer |\n| `7eca774c` and raw-SSE portion of `5fbe8876` | Not applicable: those surfaces do not exist in xcsh |\n| Plan Review `2976847e` | Deferred: xcsh retains its compact plan-review selector |\n| MCP, OpenCode, and unrelated renderer/UI changes | Excluded from this pass |\n\n## Where does xcsh deliberately diverge?\n\nxcsh retains its own:\n\n- F5-scoped packages, prompts-as-files, tool factories, and capability discovery;\n- SQLite multi-credential storage, multi-account authentication, and provider routing;\n- MCP, SSH, F5 Distributed Cloud, Office, and browser integrations;\n- Bun-first runtime, session semantics, release pipeline, branding, and governance.\n\nPublic interfaces use prerelease clean breaks. In this wave,\n`MacOSPowerAssertion`/`MacOSPowerAssertionOptions` became\n`PowerAssertion`/`PowerAssertionOptions` without aliases, and `power.sleepPrevention` was added with\nan `idle` default.\n\n## What remains excluded or deferred?\n\nUpstream workflows, branding, release machinery, generated model catalogs, compatibility shims,\nnew packages, and large unrelated subsystems are excluded. The security-scan subsystem in #7048\nand the native minimizer in #2176 remain deferred. The range-dashboard optimization in #9327 and\nearendil-works/pi-only fullscreen transcript, mouse, clipboard, and renderer subsystems also remain\noutside this campaign. MCP, OpenCode, Herdr, #10625, and #10491 were explicitly excluded from the\nsecond-pass batch; the Herdr work is now covered by the third pass. Commits after the new frozen\nsource tip require a later audit.\n\n## How do I decide where a fix belongs?\n\nTrace the affected module and compare it with the pinned upstream lineage. A generic agent-loop\ndefect may belong upstream; an xcsh resource command, integration, or packaging change belongs\nhere.\n\n## How do I preserve attribution?\n\nKeep upstream license notices and document imported changes. Avoid copying a patch blindly across\ndiverged modules; port the behavior with tests against the current xcsh architecture.\n",
18
18
  "en/automate-extend/extensions-custom-tools.mdx": "---\ntitle: \"Build extensions and custom tools\"\ndescription: \"Add TypeScript behavior, slash commands, providers, or schema-validated tools.\"\nsidebar:\n order: 3\n label: \"Build extensions and custom tools\"\n---\n\nExtensions load TypeScript behavior with `--extension` or `--hook`; project discovery can also load extensions, tools, hooks, commands, and rules under `.xcsh/`.\n\n## How do I test an extension boundary?\n\nLoad one explicit file with `-e <PATH>` and disable discovery with `--no-extensions`. Confirm its registered command or tool, then test shutdown and error handling.\n\n## Where do hooks and rules belong?\n\nHooks observe or alter lifecycle events; rules add durable instructions. Keep each rule narrow and each hook deterministic. Use `--no-rules` to prove whether a rule changes the result.\n",
19
19
  "en/automate-extend/headless-protocols.mdx": "---\ntitle: \"Headless modes\"\ndescription: \"Integrate xcsh with scripts through print, JSON, JSON-RPC, agent client protocol, manager, and worker modes.\"\nsidebar:\n order: 1\n label: \"Headless modes\"\n---\n\nHeadless integrations select `json`, `rpc`, or `acp` with `--mode`: a JavaScript Object Notation (JSON) event stream, JSON remote procedure call (RPC), or the agent client protocol (ACP). Each mode has a different framing contract; consumers must parse that protocol rather than decorated terminal text.\n\n## How do I start with the smallest surface?\n\n```bash\nxcsh --mode json --no-session --no-tools -p \"Return one sentence\"\n```\n\nCapture stdout as protocol data and stderr as diagnostics. Pin the xcsh version in automation and test framing against the exact release.\n\n## When do I use the software development kit (SDK) instead?\n\nUse the SDK when the host process needs in-memory session control, tool registration, or provider events. See [SDK automation](./sdk/).\n",
20
20
  "en/automate-extend/hooks-rules.mdx": "---\ntitle: \"Apply hooks and rules\"\ndescription: \"Choose event-driven mutation or declarative prompt guidance and understand discovery precedence.\"\nsidebar:\n order: 4\n label: \"Hooks and rules\"\n---\n\nRules contribute normalized instructions to the prompt. Hooks execute code at named lifecycle events. Use rules for guidance that does not need side effects; use a hook only when an event must inspect, transform, or reject runtime data.\n\n## How are rules discovered and classified?\n\nRule providers scan project and user roots, parse frontmatter, normalize identifiers, then deduplicate by precedence. Classification separates ordinary rulebook entries, always-apply guidance, and time-to-self-reflect material. The `rule://` handler resolves the final normalized item rather than reading an arbitrary path.\n\n## What determines hook execution order?\n\nA hook module exports handlers for supported events. Discovery determines the module set, and registration order determines sequential mutation when more than one handler sees the same payload. A thrown error follows the event's propagation contract; it is not converted into a successful empty result.\n\n## How do I test the hook boundary?\n\nExercise each of these separately:\n\n1. Discovery, so the module set is the one you expect.\n2. The exact event, with a representative payload.\n3. Mutation ordering, with more than one handler registered.\n4. Cancellation.\n5. A handler that throws.\n\nInterface calls made by hooks require an interactive host, so a headless integration must not assume a modal interface exists.\n",
package/src/lsp/client.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { isEnoent, logger, ptree, untilAborted } from "@f5-sales-demo/pi-utils";
1
+ import { isEnoent, logger, postmortem, ptree, untilAborted } from "@f5-sales-demo/pi-utils";
2
2
  import { ToolAbortError, throwIfAborted } from "../tools/tool-errors";
3
3
  import { applyWorkspaceEdit } from "./edits";
4
4
  import { getLspmuxCommand, isLspmuxSupported } from "./lspmux";
@@ -930,12 +930,5 @@ export function getActiveClients(): LspServerStatus[] {
930
930
  // Register cleanup on module unload
931
931
  if (typeof process !== "undefined") {
932
932
  process.on("beforeExit", shutdownAll);
933
- process.on("SIGINT", () => {
934
- shutdownAll();
935
- process.exit(0);
936
- });
937
- process.on("SIGTERM", () => {
938
- shutdownAll();
939
- process.exit(0);
940
- });
933
+ postmortem.register("lsp-shutdown", async () => void (await shutdownAll()));
941
934
  }
@@ -14,8 +14,10 @@
14
14
  import {
15
15
  type Component,
16
16
  Container,
17
+ type MouseRoutable,
17
18
  matchesKey,
18
19
  padding,
20
+ type SgrMouseEvent,
19
21
  Spacer,
20
22
  Text,
21
23
  truncateToWidth,
@@ -30,17 +32,21 @@ import { InspectorPanel } from "./inspector-panel";
30
32
  import { applyFilter, createInitialState, filterByProvider, refreshState, toggleProvider } from "./state-manager";
31
33
  import type { DashboardState } from "./types";
32
34
 
33
- export class ExtensionDashboard extends Container {
35
+ export class ExtensionDashboard extends Container implements MouseRoutable {
34
36
  #state!: DashboardState;
35
37
  #mainList!: ExtensionList;
36
38
  #inspector!: InspectorPanel;
39
+ #body!: TwoColumnBody;
40
+ #tabRanges: Array<{ start: number; end: number; index: number }> = [];
41
+ #hoveredTabIndex: number | null = null;
37
42
 
38
43
  onClose?: () => void;
44
+ onRequestRender?: () => void;
39
45
 
40
46
  private constructor(
41
47
  private readonly cwd: string,
42
48
  private readonly settings: Settings | null,
43
- private readonly terminalHeight: number,
49
+ private readonly getTerminalHeight: () => number,
44
50
  ) {
45
51
  super();
46
52
  }
@@ -48,9 +54,11 @@ export class ExtensionDashboard extends Container {
48
54
  static async create(
49
55
  cwd: string,
50
56
  settings: Settings | null = null,
51
- terminalHeight?: number,
57
+ terminalHeight?: number | (() => number),
52
58
  ): Promise<ExtensionDashboard> {
53
- const dashboard = new ExtensionDashboard(cwd, settings, terminalHeight ?? process.stdout.rows ?? 24);
59
+ const getTerminalHeight =
60
+ typeof terminalHeight === "function" ? terminalHeight : () => terminalHeight ?? process.stdout.rows ?? 24;
61
+ const dashboard = new ExtensionDashboard(cwd, settings, getTerminalHeight);
54
62
  await dashboard.#init();
55
63
  return dashboard;
56
64
  }
@@ -62,7 +70,7 @@ export class ExtensionDashboard extends Container {
62
70
 
63
71
  // Calculate max visible items based on terminal height
64
72
  // Reserve ~10 lines for header, tabs, help text, borders
65
- const maxVisible = Math.max(5, Math.floor((this.terminalHeight - 10) / 2));
73
+ const maxVisible = Math.max(5, Math.floor((this.getTerminalHeight() - 10) / 2));
66
74
 
67
75
  // Create main list - always focused
68
76
  this.#mainList = new ExtensionList(
@@ -108,13 +116,13 @@ export class ExtensionDashboard extends Container {
108
116
  this.addChild(new Text(theme.bold(theme.fg("contentAccent", " Extension Control Center")), 0, 0));
109
117
 
110
118
  // Tab bar
111
- this.addChild(new Text(this.#renderTabBar(), 0, 0));
119
+ this.addChild({ render: () => [this.#renderTabBar()], invalidate: () => {} });
112
120
  this.addChild(new Spacer(1));
113
121
 
114
122
  // 2-column body with height limit
115
123
  // Reserve ~8 lines for header, tabs, help text, borders
116
- const bodyMaxHeight = Math.max(5, this.terminalHeight - 8);
117
- this.addChild(new TwoColumnBody(this.#mainList, this.#inspector, bodyMaxHeight));
124
+ this.#body = new TwoColumnBody(this.#mainList, this.#inspector, () => Math.max(5, this.getTerminalHeight() - 8));
125
+ this.addChild(this.#body);
118
126
 
119
127
  this.addChild(new Spacer(1));
120
128
  this.addChild(new Text(theme.fg("dim", " ↑/↓: navigate Space: toggle Tab: next provider Esc: close"), 0, 0));
@@ -125,6 +133,8 @@ export class ExtensionDashboard extends Container {
125
133
 
126
134
  #renderTabBar(): string {
127
135
  const parts: string[] = [" "];
136
+ this.#tabRanges = [];
137
+ let column = 1;
128
138
 
129
139
  for (let i = 0; i < this.#state.tabs.length; i++) {
130
140
  const tab = this.#state.tabs[i];
@@ -139,8 +149,11 @@ export class ExtensionDashboard extends Container {
139
149
  }
140
150
 
141
151
  const displayLabel = isDisabled ? `${theme.status.disabled} ${label}` : label;
152
+ const rawLabel = ` ${displayLabel} `;
153
+ this.#tabRanges.push({ start: column, end: column + visibleWidth(rawLabel), index: i });
154
+ column += visibleWidth(rawLabel);
142
155
 
143
- if (isActive) {
156
+ if (isActive || i === this.#hoveredTabIndex) {
144
157
  // Active tab: background highlight
145
158
  parts.push(theme.bg("selectedBg", ` ${displayLabel} `));
146
159
  } else if (isDisabled) {
@@ -223,6 +236,11 @@ export class ExtensionDashboard extends Container {
223
236
  if (!isEmptyEnabled) break;
224
237
  }
225
238
  this.#state.activeTabIndex = nextIndex;
239
+ this.#activateTab(nextIndex);
240
+ }
241
+
242
+ #activateTab(index: number): void {
243
+ this.#state.activeTabIndex = index;
226
244
 
227
245
  // Re-filter for new tab
228
246
  const tab = this.#state.tabs[this.#state.activeTabIndex];
@@ -244,6 +262,38 @@ export class ExtensionDashboard extends Container {
244
262
  this.#buildLayout();
245
263
  }
246
264
 
265
+ routeMouse(event: SgrMouseEvent, _line: number, _col: number): void {
266
+ if (event.motion) {
267
+ const hoveredTab =
268
+ event.row === 2
269
+ ? (this.#tabRanges.find(range => event.col >= range.start && event.col < range.end)?.index ?? null)
270
+ : null;
271
+ this.#hoveredTabIndex = hoveredTab;
272
+ }
273
+ if (event.leftClick && event.row === 2) {
274
+ const hit = this.#tabRanges.find(range => event.col >= range.start && event.col < range.end);
275
+ const tab = hit ? this.#state.tabs[hit.index] : undefined;
276
+ if (hit && tab && !(tab.count === 0 && tab.enabled && tab.id !== "all")) this.#activateTab(hit.index);
277
+ return;
278
+ }
279
+ const bodyLine = event.row - 4;
280
+ if (bodyLine < 0 || bodyLine >= this.#body.maxHeight) {
281
+ if (event.motion) this.#mainList.setHoverIndex(null);
282
+ this.onRequestRender?.();
283
+ return;
284
+ }
285
+ if (event.col < this.#body.leftWidth) {
286
+ if (event.wheel !== null) this.#mainList.handleWheel(event.wheel);
287
+ else if (event.motion) this.#mainList.setHoverIndex(this.#mainList.hitTest(bodyLine));
288
+ else if (event.leftClick) this.#mainList.handleClick(bodyLine);
289
+ } else if (event.col >= this.#body.leftWidth + 3 && event.wheel !== null) {
290
+ this.#body.scrollInspector(event.wheel);
291
+ } else if (event.motion) {
292
+ this.#mainList.setHoverIndex(null);
293
+ }
294
+ this.onRequestRender?.();
295
+ }
296
+
247
297
  handleInput(data: string): void {
248
298
  // Ctrl+C - close immediately
249
299
  if (matchesKey(data, "ctrl+c")) {
@@ -291,28 +341,53 @@ export class ExtensionDashboard extends Container {
291
341
  * Two-column body component for side-by-side rendering.
292
342
  */
293
343
  class TwoColumnBody implements Component {
344
+ #leftWidth = 0;
345
+ #rightScroll = 0;
346
+ #rightTotal = 0;
294
347
  constructor(
295
348
  private readonly leftPane: ExtensionList,
296
349
  private readonly rightPane: InspectorPanel,
297
- private readonly maxHeight: number,
350
+ private readonly getMaxHeight: () => number,
298
351
  ) {}
299
352
 
353
+ get leftWidth(): number {
354
+ return this.#leftWidth;
355
+ }
356
+
357
+ get maxHeight(): number {
358
+ return this.getMaxHeight();
359
+ }
360
+
361
+ scrollInspector(delta: -1 | 1): void {
362
+ this.#rightScroll = Math.max(
363
+ 0,
364
+ Math.min(Math.max(0, this.#rightTotal - this.maxHeight), this.#rightScroll + delta),
365
+ );
366
+ }
367
+
300
368
  render(width: number): string[] {
369
+ const maxHeight = this.maxHeight;
370
+ this.leftPane.setMaxVisible(Math.max(5, Math.floor((maxHeight - 2) / 2)));
301
371
  const leftWidth = Math.floor(width * 0.5);
372
+ this.#leftWidth = leftWidth;
302
373
  const rightWidth = Math.max(0, width - leftWidth - 3);
303
374
 
304
375
  const leftLines = this.leftPane.render(leftWidth);
305
376
  const rightLines = this.rightPane.render(rightWidth);
377
+ this.#rightTotal = rightLines.length;
378
+ const maxScroll = Math.max(0, rightLines.length - maxHeight);
379
+ this.#rightScroll = Math.min(this.#rightScroll, maxScroll);
380
+ const visibleRight = rightLines.slice(this.#rightScroll, this.#rightScroll + maxHeight);
306
381
 
307
382
  // Limit to maxHeight lines
308
- const numLines = Math.min(this.maxHeight, Math.max(leftLines.length, rightLines.length));
383
+ const numLines = maxHeight;
309
384
  const combined: string[] = [];
310
385
  const separator = theme.fg("dim", ` ${theme.boxSharp.vertical} `);
311
386
 
312
387
  for (let i = 0; i < numLines; i++) {
313
388
  const left = truncateToWidth(leftLines[i] ?? "", leftWidth);
314
389
  const leftPadded = left + padding(Math.max(0, leftWidth - visibleWidth(left)));
315
- const right = truncateToWidth(rightLines[i] ?? "", rightWidth);
390
+ const right = truncateToWidth(visibleRight[i] ?? "", rightWidth);
316
391
  combined.push(leftPadded + separator + right);
317
392
  }
318
393
 
@@ -45,6 +45,8 @@ export class ExtensionList implements Component {
45
45
  #focused = false;
46
46
  #masterSwitchProvider: string | null = null;
47
47
  #maxVisible: number;
48
+ #hoveredIndex: number | null = null;
49
+ #visibleCount = 0;
48
50
 
49
51
  constructor(
50
52
  private extensions: Extension[],
@@ -113,6 +115,7 @@ export class ExtensionList implements Component {
113
115
 
114
116
  render(width: number): string[] {
115
117
  const lines: string[] = [];
118
+ this.#visibleCount = 0;
116
119
 
117
120
  // Search bar
118
121
  const searchPrefix = theme.fg("muted", "Search: ");
@@ -137,14 +140,18 @@ export class ExtensionList implements Component {
137
140
  for (let i = startIdx; i < endIdx; i++) {
138
141
  const listItem = this.#listItems[i];
139
142
  const isSelected = this.#focused && i === this.#selectedIndex;
143
+ const hovered = this.#focused && i === this.#hoveredIndex && !isSelected;
140
144
 
145
+ let rendered: string;
141
146
  if (listItem.type === "master") {
142
- lines.push(this.#renderMasterSwitch(listItem, isSelected, width));
147
+ rendered = this.#renderMasterSwitch(listItem, isSelected, width);
143
148
  } else if (listItem.type === "kind-header") {
144
- lines.push(this.#renderKindHeader(listItem, isSelected, width));
149
+ rendered = this.#renderKindHeader(listItem, isSelected, width);
145
150
  } else {
146
- lines.push(this.#renderExtensionRow(listItem.item, isSelected, width, masterDisabled));
151
+ rendered = this.#renderExtensionRow(listItem.item, isSelected, width, masterDisabled);
147
152
  }
153
+ lines.push(hovered ? theme.bg("selectedBg", rendered) : rendered);
154
+ this.#visibleCount++;
148
155
  }
149
156
 
150
157
  // Scroll indicator
@@ -398,6 +405,42 @@ export class ExtensionList implements Component {
398
405
  }
399
406
  }
400
407
 
408
+ setHoverIndex(index: number | null): void {
409
+ this.#hoveredIndex = index;
410
+ }
411
+
412
+ hitTest(line: number): number | null {
413
+ const itemLine = line - 2;
414
+ if (itemLine < 0 || itemLine >= this.#visibleCount) return null;
415
+ return this.#scrollOffset + itemLine;
416
+ }
417
+
418
+ handleWheel(delta: -1 | 1): void {
419
+ if (delta < 0) this.#moveSelectionUp();
420
+ else this.#moveSelectionDown();
421
+ }
422
+
423
+ handleClick(line: number): void {
424
+ const index = this.hitTest(line);
425
+ if (index === null) return;
426
+ if (index !== this.#selectedIndex) {
427
+ this.#selectedIndex = index;
428
+ this.#notifySelectionChange();
429
+ return;
430
+ }
431
+ this.#activateSelected();
432
+ }
433
+
434
+ #activateSelected(): void {
435
+ const item = this.#listItems[this.#selectedIndex];
436
+ if (item?.type === "master") {
437
+ this.callbacks.onMasterToggle?.(item.providerId);
438
+ } else if (item?.type === "extension") {
439
+ const masterDisabled = this.#masterSwitchProvider !== null && !isProviderEnabled(this.#masterSwitchProvider);
440
+ if (!masterDisabled) this.callbacks.onToggle?.(item.item.id, item.item.state === "disabled");
441
+ }
442
+ }
443
+
401
444
  handleInput(data: string): void {
402
445
  // Navigation
403
446
  if (matchesKey(data, "up") || data === "k") {
@@ -412,34 +455,13 @@ export class ExtensionList implements Component {
412
455
 
413
456
  // Space: Toggle selected item
414
457
  if (data === " ") {
415
- const item = this.#listItems[this.#selectedIndex];
416
- if (item?.type === "master") {
417
- this.callbacks.onMasterToggle?.(item.providerId);
418
- } else if (item?.type === "extension") {
419
- // Only allow toggling if master is enabled
420
- const masterDisabled =
421
- this.#masterSwitchProvider !== null && !isProviderEnabled(this.#masterSwitchProvider);
422
- if (!masterDisabled) {
423
- const newEnabled = item.item.state === "disabled";
424
- this.callbacks.onToggle?.(item.item.id, newEnabled);
425
- }
426
- }
458
+ this.#activateSelected();
427
459
  return;
428
460
  }
429
461
 
430
462
  // Enter: Same as space - toggle selected item
431
463
  if (matchesKey(data, "enter") || matchesKey(data, "return") || data === "\n") {
432
- const item = this.#listItems[this.#selectedIndex];
433
- if (item?.type === "master") {
434
- this.callbacks.onMasterToggle?.(item.providerId);
435
- } else if (item?.type === "extension") {
436
- const masterDisabled =
437
- this.#masterSwitchProvider !== null && !isProviderEnabled(this.#masterSwitchProvider);
438
- if (!masterDisabled) {
439
- const newEnabled = item.item.state === "disabled";
440
- this.callbacks.onToggle?.(item.item.id, newEnabled);
441
- }
442
- }
464
+ this.#activateSelected();
443
465
  return;
444
466
  }
445
467