@f5-sales-demo/xcsh 21.16.0 → 21.18.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 (38) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +9 -8
  3. package/src/cli/session-picker.ts +2 -1
  4. package/src/config/settings-schema.ts +11 -0
  5. package/src/config/settings.ts +4 -0
  6. package/src/debug/index.ts +24 -8
  7. package/src/debug/log-viewer.ts +46 -5
  8. package/src/internal-urls/build-info.generated.ts +8 -8
  9. package/src/internal-urls/docs-index.generated.ts +1 -1
  10. package/src/locales/en.json +9 -2
  11. package/src/lsp/client.ts +2 -9
  12. package/src/modes/components/assistant-message.ts +6 -2
  13. package/src/modes/components/auth-link-presenter.ts +4 -2
  14. package/src/modes/components/copy-selector.ts +273 -0
  15. package/src/modes/components/extensions/extension-dashboard.ts +87 -12
  16. package/src/modes/components/extensions/extension-list.ts +48 -26
  17. package/src/modes/components/login-dialog.ts +10 -3
  18. package/src/modes/components/session-selector.ts +80 -18
  19. package/src/modes/components/status-line/segments.ts +2 -2
  20. package/src/modes/controllers/command-controller.ts +34 -2
  21. package/src/modes/controllers/event-controller.ts +12 -5
  22. package/src/modes/controllers/input-controller.ts +17 -7
  23. package/src/modes/controllers/login-model.ts +2 -2
  24. package/src/modes/controllers/login-options.ts +1 -1
  25. package/src/modes/controllers/selector-controller.ts +144 -47
  26. package/src/modes/controllers/vertex-login-flow.ts +9 -5
  27. package/src/modes/interactive-mode.ts +34 -6
  28. package/src/modes/session-teardown.test.ts +54 -0
  29. package/src/modes/session-teardown.ts +26 -0
  30. package/src/modes/types.ts +4 -0
  31. package/src/modes/utils/copy-targets.ts +238 -0
  32. package/src/session/agent-session.ts +11 -1
  33. package/src/session/session-manager.ts +114 -5
  34. package/src/slash-commands/builtin-registry.ts +10 -0
  35. package/src/tools/ask.ts +1 -1
  36. package/src/tui/hyperlink.ts +72 -0
  37. package/src/utils/clipboard.ts +14 -3
  38. package/src/utils/open.ts +30 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  ### Added
8
8
 
9
+ - Added capability-aware terminal hyperlinks, automatic local Vertex sign-in launch with durable
10
+ manual recovery, HTTP(S)-only `/open`, `/copy link`, and a bounded fullscreen transcript copy
11
+ picker. Semantically ported from [can1357/oh-my-pi#10196](https://github.com/can1357/oh-my-pi/pull/10196),
12
+ [#10606](https://github.com/can1357/oh-my-pi/pull/10606),
13
+ [#11002](https://github.com/can1357/oh-my-pi/pull/11002),
14
+ [#10922](https://github.com/can1357/oh-my-pi/pull/10922), and
15
+ [#11086](https://github.com/can1357/oh-my-pi/pull/11086)
16
+ ([#3758](https://github.com/f5-sales-demo/xcsh/issues/3758)).
9
17
  - Added strict `xcsh://registry/provider/<namespace>/<type>` and
10
18
  `xcsh://registry/module/<namespace>/<name>/<provider>` Terraform Registry lookups with bounded,
11
19
  protocol-native discovery and actionable failures
@@ -40,6 +48,14 @@
40
48
 
41
49
  ### Fixed
42
50
 
51
+ - Made the session picker, extension dashboard, and debug-log viewer fullscreen and mouse-aware while
52
+ retaining their keyboard behavior, pinned chrome, and non-action row semantics
53
+ ([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
54
+ - Persisted unsent editor drafts for one-shot resume recovery, unified interactive and signal-driven
55
+ teardown, made session disposal idempotent, and restored POSIX Ctrl-Z suspension with self-`SIGSTOP`.
56
+ Semantically ported from [can1357/oh-my-pi#4121](https://github.com/can1357/oh-my-pi/pull/4121)
57
+ and [#3463](https://github.com/can1357/oh-my-pi/pull/3463)
58
+ ([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
43
59
  - Prevented malformed task `submit_result` data, non-string write content, and invalid renderer path
44
60
  values from crashing task, read, write, edit, inspect-image, or browser output. Semantically
45
61
  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.18.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",
@@ -41,6 +41,7 @@
41
41
  "pretest": "bun ../../scripts/check-installed-dependencies.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
+ "bench:copy-selector": "bun scripts/bench-copy-selector.ts",
44
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",
45
46
  "fmt": "biome format --write . && bun run format-prompts",
46
47
  "format-prompts": "bun scripts/format-prompts.ts",
@@ -61,13 +62,13 @@
61
62
  },
62
63
  "dependencies": {
63
64
  "@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",
65
+ "@f5-sales-demo/pi-agent-core": "21.18.0",
66
+ "@f5-sales-demo/pi-ai": "21.18.0",
67
+ "@f5-sales-demo/pi-natives": "21.18.0",
68
+ "@f5-sales-demo/pi-resource-management": "21.18.0",
69
+ "@f5-sales-demo/pi-tui": "21.18.0",
70
+ "@f5-sales-demo/pi-utils": "21.18.0",
71
+ "@f5-sales-demo/xcsh-stats": "21.18.0",
71
72
  "@mozilla/readability": "^0.6",
72
73
  "@sinclair/typebox": "^0.34",
73
74
  "@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;
@@ -475,6 +475,17 @@ export const SETTINGS_SCHEMA = {
475
475
  description:
476
476
  "Maximum height in terminal rows for inline images. Set to 0 to use only the viewport-based limit (60% of terminal height).",
477
477
  },
478
+ "tui.hyperlinks": {
479
+ type: "enum",
480
+ values: ["off", "auto", "always"] as const,
481
+ default: "auto",
482
+ ui: {
483
+ tab: "appearance",
484
+ label: "Terminal Hyperlinks",
485
+ description: "Emit clickable terminal links automatically, always, or never",
486
+ submenu: true,
487
+ },
488
+ },
478
489
  // Display rendering
479
490
  "display.tabWidth": {
480
491
  type: "number",
@@ -34,6 +34,7 @@ import {
34
34
  setSymbolPreset,
35
35
  } from "../modes/theme/theme";
36
36
  import { AgentStorage } from "../session/agent-storage";
37
+ import { applyHyperlinkSetting } from "../tui/hyperlink";
37
38
  import { type EditMode, normalizeEditMode } from "../utils/edit-mode";
38
39
  import { hardenAgentConfigFile, writeAgentConfigFile } from "./agent-config-file";
39
40
  import { withFileLock } from "./file-lock";
@@ -712,6 +713,9 @@ const SETTING_HOOKS: Partial<Record<SettingPath, SettingHook<any>>> = {
712
713
  setDefaultTabWidth(value);
713
714
  }
714
715
  },
716
+ "tui.hyperlinks": value => {
717
+ applyHyperlinkSetting(value);
718
+ },
715
719
  };
716
720
 
717
721
  // ═══════════════════════════════════════════════════════════════════════════
@@ -4,15 +4,23 @@
4
4
  * Provides tools for debugging, bug report generation, and system diagnostics.
5
5
  */
6
6
  import * as fs from "node:fs/promises";
7
- import * as url from "node:url";
8
7
  import { getWorkProfile } from "@f5-sales-demo/pi-natives";
9
- import { Container, Loader, type SelectItem, SelectList, Spacer, Text } from "@f5-sales-demo/pi-tui";
8
+ import {
9
+ Container,
10
+ Loader,
11
+ type OverlayHandle,
12
+ type SelectItem,
13
+ SelectList,
14
+ Spacer,
15
+ Text,
16
+ } from "@f5-sales-demo/pi-tui";
10
17
  import { getSessionsDir } from "@f5-sales-demo/pi-utils";
11
18
  import type { ContextProfile } from "../context/profile";
12
19
  import { DynamicBorder } from "../modes/components/dynamic-border";
13
20
  import { getSelectListTheme, getSymbolTheme, theme } from "../modes/theme/theme";
14
21
  import type { InteractiveModeContext } from "../modes/types";
15
22
  import { formatBytes } from "../tools/render-utils";
23
+ import { fileHyperlink } from "../tui/hyperlink";
16
24
  import { openPath } from "../utils/open";
17
25
  import { DebugLogViewerComponent } from "./log-viewer";
18
26
  import { generateHeapSnapshotData, type ProfilerSession, startCpuProfile } from "./profiler";
@@ -38,8 +46,7 @@ const DEBUG_MENU_ITEMS: SelectItem[] = [
38
46
  ];
39
47
 
40
48
  const formatFileHyperlink = (path: string): string => {
41
- const fileUrl = url.pathToFileURL(path).href;
42
- return `\x1b]8;;${fileUrl}\x07${path}\x1b]8;;\x07`;
49
+ return fileHyperlink(path, path);
43
50
  };
44
51
 
45
52
  /**
@@ -302,18 +309,27 @@ export class DebugSelectorComponent extends Container {
302
309
  return;
303
310
  }
304
311
 
312
+ let overlay: OverlayHandle | undefined;
305
313
  const viewer = new DebugLogViewerComponent({
306
314
  logs,
307
- terminalRows: this.ctx.ui.terminal.rows,
308
- onExit: () => this.ctx.showDebugSelector(),
315
+ terminalRows: () => this.ctx.ui.terminal.rows,
316
+ onExit: () => {
317
+ overlay?.hide();
318
+ this.ctx.showDebugSelector();
319
+ },
309
320
  onStatus: message => this.ctx.showStatus(message, { dim: true }),
310
321
  onError: message => this.ctx.showError(message),
311
322
  onUpdate: () => this.ctx.ui.requestRender(),
312
323
  logSource,
313
324
  });
314
325
 
315
- this.ctx.editorContainer.clear();
316
- this.ctx.editorContainer.addChild(viewer);
326
+ overlay = this.ctx.ui.showOverlay(viewer, {
327
+ fullscreen: true,
328
+ anchor: "top-left",
329
+ width: "100%",
330
+ maxHeight: "100%",
331
+ margin: 0,
332
+ });
317
333
  this.ctx.ui.setFocus(viewer);
318
334
  } catch (err) {
319
335
  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.18.0",
21
+ "commit": "4d0c01d2dcba08ff1542e78e09cce5db28e815f4",
22
+ "shortCommit": "4d0c01d",
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.18.0",
25
+ "commitDate": "2026-09-07T16:32:00+00:00",
26
+ "buildDate": "2026-09-07T17:21:09.793Z",
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/4d0c01d2dcba08ff1542e78e09cce5db28e815f4",
32
+ "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.18.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.\nThe fourth-pass hyperlink, login-launch, and transcript-copy audit extends the reviewed lineage\nthrough `6e48b5ce564aa1d7eff60ffe92748f451385ad7d`, frozen on September 7, 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| Hyperlinks, login launch, and copy picker | #10196, #10606, #11002, #10922, #11086, #5887, and #6282 | #3758 |\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\nThe fourth-pass work applies an immutable startup capability snapshot to `off`, `auto`, and\n`always` hyperlink policy; safely renders and physically wraps OSC 8 spans; launches local Vertex\nlogin through an HTTP(S)-only opener while retaining manual recovery; and projects the bounded copy\npicker directly from xcsh `SessionMessageEntry` history. The semantic ports correspond to upstream\nmerge commits `db2f55888b9f500b51010d7958a9cc8712e19f5c`,\n`4d13034f5dc70e93a6dad502ea7313792480760e`,\n`72767b81bd2911ebd650cfd0fdd5f92afc7470a6`,\n`4a56732e45c6b13b01e72aeaab113d0a257df0bd`,\n`43a2913d1ee2e88ceff0851a9ed9d0345f12d8c6`,\n`c081dedd3a696c872fd818f89d2b8c6c81a45b1e`, and\n`d1979782e7851b46451e956a5855d69e7781a5f5`.\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",
@@ -137,11 +137,13 @@
137
137
  "commands.chrome.description": "Inspect or arrange the Chrome session xcsh drives for console automation",
138
138
  "commands.chrome.sub.status.description": "Show Chrome attach/launch status and the planned action",
139
139
  "commands.chrome.sub.relaunch.description": "Relaunch your real Chrome with a loopback debug port (consent granted)",
140
- "commands.copy.description": "Copy last agent message to clipboard",
140
+ "commands.copy.description": "Open the transcript copy picker",
141
141
  "commands.copy.sub.last.description": "Copy full last agent message",
142
142
  "commands.copy.sub.code.description": "Copy last code block",
143
143
  "commands.copy.sub.all.description": "Copy all code blocks from last message",
144
144
  "commands.copy.sub.cmd.description": "Copy last bash/python command",
145
+ "commands.copy.sub.link.description": "Copy the latest HTTP(S) link",
146
+ "commands.open.description": "Open the latest transcript HTTP(S) link",
145
147
  "commands.session.description": "Session management commands",
146
148
  "commands.session.sub.info.description": "Show session info and stats",
147
149
  "commands.session.sub.delete.description": "Delete current session and return to selector",
@@ -342,7 +344,7 @@
342
344
  "controller.debug.errors.noMessages": "No messages to dump yet.",
343
345
  "controller.debug.status.written": "Debug transcript written to:\n{path}",
344
346
  "controller.debug.errors.failed": "Failed to write debug transcript: {message}",
345
- "controller.copy.errors.unknownSub": "Unknown subcommand: {sub}. Use code, all, cmd, or last.",
347
+ "controller.copy.errors.unknownSub": "Unknown subcommand: {sub}. Use last, code, all, cmd, or link.",
346
348
  "controller.copy.errors.noMessages": "No agent messages to copy yet.",
347
349
  "controller.copy.status.lastMessage": "Copied last agent message to clipboard",
348
350
  "controller.copy.warnings.noCodeBlock": "No code block found in the last agent message.",
@@ -352,6 +354,11 @@
352
354
  "controller.copy.status.bashCommand": "Copied last bash command to clipboard",
353
355
  "controller.copy.status.pythonCode": "Copied last python code to clipboard",
354
356
  "controller.copy.warnings.noCommand": "No bash or python command found in the conversation.",
357
+ "controller.copy.warnings.noLink": "No HTTP(S) link found in the transcript.",
358
+ "controller.copy.status.link": "Copied last link.",
359
+ "controller.open.usage": "Usage: /open",
360
+ "controller.open.failed": "Could not open link: {message}",
361
+ "controller.open.status": "Opened latest transcript link.",
355
362
  "controller.session.title": "Session Info",
356
363
  "controller.session.file": "File:",
357
364
  "controller.session.inMemory": "In-memory",
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
  }
@@ -9,7 +9,7 @@ import {
9
9
  TERMINAL,
10
10
  Text,
11
11
  } from "@f5-sales-demo/pi-tui";
12
- import { formatNumber, logger } from "@f5-sales-demo/pi-utils";
12
+ import { formatNumber, getProjectDir, logger } from "@f5-sales-demo/pi-utils";
13
13
  import { settings } from "../../config/settings";
14
14
  import { hasPendingMermaid, mermaidThemeSignature, prerenderMermaid } from "../../modes/theme/mermaid-cache";
15
15
  import { getMarkdownTheme, theme } from "../../modes/theme/theme";
@@ -152,7 +152,11 @@ export class AssistantMessageComponent extends Container {
152
152
  // Assistant text messages with no background - trim the text
153
153
  // Set paddingY=0 to avoid extra spacing before tool executions
154
154
  this.#contentContainer.addChild(
155
- new Markdown(content.text.trim(), 0, 0, getMarkdownTheme(), undefined, 2, this.markdownMediaOptions),
155
+ new Markdown(content.text.trim(), 0, 0, getMarkdownTheme(), undefined, {
156
+ codeBlockIndent: 2,
157
+ mediaOptions: this.markdownMediaOptions,
158
+ linkBasePath: getProjectDir(),
159
+ }),
156
160
  );
157
161
  } else if (content.type === "thinking" && content.thinking.trim()) {
158
162
  // Add spacing only when another visible assistant content block follows.
@@ -1,4 +1,5 @@
1
1
  import { type Container, Text } from "@f5-sales-demo/pi-tui";
2
+ import { recoveryUrlHyperlink } from "../../tui/hyperlink";
2
3
  import { copyToClipboard } from "../../utils/clipboard";
3
4
  import { theme } from "../theme/theme";
4
5
 
@@ -17,8 +18,9 @@ export function presentAuthLink(
17
18
  ): void {
18
19
  const platform = options.platform ?? process.platform;
19
20
  const clickHint = platform === "darwin" ? "Cmd+click to open" : "Ctrl+click to open";
20
- const hyperlink = `\x1b]8;;${url}\x07Open sign-in page\x1b]8;;\x07`;
21
+ const hyperlink = recoveryUrlHyperlink(url, "Open sign-in page");
21
22
  container.addChild(new Text(`${theme.fg("accent", hyperlink)} ${theme.fg("dim", `(${clickHint})`)}`, 1, 0));
23
+ if (hyperlink === "Open sign-in page") container.addChild(new Text(theme.fg("accent", url), 1, 0));
22
24
  container.addChild(
23
25
  new Text(
24
26
  theme.fg("dim", "Sign-in URL copied when supported. Clipboard availability depends on terminal support."),
@@ -37,7 +39,7 @@ export function presentAuthLink(
37
39
 
38
40
  /** Render device verification details so they remain usable without hyperlink or clipboard support. */
39
41
  export function presentDeviceCode(container: AuthLinkContainer, url: string, userCode: string): void {
40
- const hyperlink = `\x1b]8;;${url}\x07${url}\x1b]8;;\x07`;
42
+ const hyperlink = recoveryUrlHyperlink(url, url);
41
43
  container.addChild(new Text(theme.fg("accent", hyperlink), 1, 0));
42
44
  container.addChild(new Text(theme.fg("warning", `One-time code: ${theme.bold(userCode)}`), 1, 0));
43
45
  container.addChild(