@f5-sales-demo/xcsh 21.13.2 → 21.14.1

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
@@ -22,6 +22,10 @@
22
22
 
23
23
  ### Changed
24
24
 
25
+ - Added `power.sleepPrevention` with an `idle` default and cumulative `off`, `idle`, `display`, and
26
+ `system` modes for session-scoped sleep prevention on macOS, Linux, and Windows
27
+ ([#3724](https://github.com/f5-sales-demo/xcsh/issues/3724)).
28
+
25
29
  - Unified generated and existing media publication behind the versioned `xcsh.media/v1` result
26
30
  contract so TUI, Browser, Office, RPC, and ACP transports no longer identify media by tool name
27
31
  ([#3202](https://github.com/f5-sales-demo/xcsh/issues/3202)).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/xcsh",
4
- "version": "21.13.2",
4
+ "version": "21.14.1",
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.13.2",
65
- "@f5-sales-demo/pi-ai": "21.13.2",
66
- "@f5-sales-demo/pi-natives": "21.13.2",
67
- "@f5-sales-demo/pi-resource-management": "21.13.2",
68
- "@f5-sales-demo/pi-tui": "21.13.2",
69
- "@f5-sales-demo/pi-utils": "21.13.2",
70
- "@f5-sales-demo/xcsh-stats": "21.13.2",
64
+ "@f5-sales-demo/pi-agent-core": "21.14.1",
65
+ "@f5-sales-demo/pi-ai": "21.14.1",
66
+ "@f5-sales-demo/pi-natives": "21.14.1",
67
+ "@f5-sales-demo/pi-resource-management": "21.14.1",
68
+ "@f5-sales-demo/pi-tui": "21.14.1",
69
+ "@f5-sales-demo/pi-utils": "21.14.1",
70
+ "@f5-sales-demo/xcsh-stats": "21.14.1",
71
71
  "@mozilla/readability": "^0.6",
72
72
  "@sinclair/typebox": "^0.34",
73
73
  "@xterm/headless": "^6.0",
@@ -901,6 +901,33 @@ export const SETTINGS_SCHEMA = {
901
901
  },
902
902
  },
903
903
 
904
+ // Session power management
905
+ "power.sleepPrevention": {
906
+ type: "enum",
907
+ values: ["off", "idle", "display", "system"] as const,
908
+ default: "idle",
909
+ ui: {
910
+ tab: "interaction",
911
+ group: "Power",
912
+ label: "Sleep Prevention",
913
+ description: "Prevent the system from sleeping while an agent session is active.",
914
+ options: [
915
+ { value: "off", label: "Off", description: "Allow normal system and display sleep" },
916
+ {
917
+ value: "idle",
918
+ label: "Prevent Idle Sleep",
919
+ description: "Keep the system awake while a session is open",
920
+ },
921
+ { value: "display", label: "Prevent Display Sleep", description: "Also keep the display awake" },
922
+ {
923
+ value: "system",
924
+ label: "Prevent System Sleep",
925
+ description: "Use every available sleep-prevention mode",
926
+ },
927
+ ],
928
+ },
929
+ },
930
+
904
931
  // Notifications
905
932
  "completion.notify": {
906
933
  type: "enum",
@@ -17,17 +17,17 @@ export interface BuildInfo {
17
17
  }
18
18
 
19
19
  export const BUILD_INFO: BuildInfo = {
20
- "version": "21.13.2",
21
- "commit": "bf16480aef2d385477ce939f77c2ef68009ebcec",
22
- "shortCommit": "bf16480",
20
+ "version": "21.14.1",
21
+ "commit": "66c1fc7bceccd9f8fa1b2aee69a3c08cd7aed25a",
22
+ "shortCommit": "66c1fc7",
23
23
  "branch": "main",
24
- "tag": "v21.13.2",
25
- "commitDate": "2026-09-06T14:18:28+00:00",
26
- "buildDate": "2026-09-06T15:06:52.801Z",
24
+ "tag": "v21.14.1",
25
+ "commitDate": "2026-09-06T17:46:30+00:00",
26
+ "buildDate": "2026-09-06T19:00:27.042Z",
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/bf16480aef2d385477ce939f77c2ef68009ebcec",
32
- "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.13.2"
31
+ "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/66c1fc7bceccd9f8fa1b2aee69a3c08cd7aed25a",
32
+ "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.14.1"
33
33
  };
@@ -8,13 +8,13 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
8
8
  "en/architecture-contribution/extension-discovery.mdx": "---\ntitle: \"Extension discovery architecture\"\ndescription: \"Choose between skills, commands, tools, hooks, extensions, plugins, MCP, and SDK embedding.\"\nsidebar:\n order: 5\n label: \"Extension discovery\"\n---\n\nThe TypeScript runtime owns the agent loop, configuration, discovery, protocols, and most tools. The native Rust addon supplies performance-sensitive terminal, filesystem, and platform operations behind typed bindings.\n\n## How are capabilities discovered?\n\nDiscovery providers scan bundled, user, project, plugin, and compatible manifest roots, normalize candidates into capability items, and deduplicate stable identifiers by precedence. Extension entry resolution and dynamic module loading happen only after metadata discovery.\n\nInvalid frontmatter, manifests, or module factories produce diagnostics at their own layer so one bad optional capability does not masquerade as an empty catalog.\n\n## Where should a change go?\n\nPrefer a public extension, skill, plugin, Model Context Protocol (MCP) server, or software development kit (SDK) application programming interface (API) for optional behavior. Change the native layer only when a measured platform or performance requirement cannot be met in TypeScript.\n\n## How do I validate a boundary change?\n\nRun focused TypeScript tests for the caller and Rust tests for the native implementation, then build the addon and exercise the public command. Do not expose a native detail as a public contract accidentally.\n\nRead `packages/coding-agent/src/discovery` for the provider scan and deduplication, and `packages/coding-agent/src/capability` for the normalized capability items.\n",
9
9
  "en/architecture-contribution/index.mdx": "---\ntitle: \"Architecture and contribution\"\ndescription: \"Understand xcsh internals, its pi lineage, native layer, extension boundaries, and contribution/release process.\"\nsidebar:\n order: 0\n label: \"Overview\"\n---\n\nUse these pages when changing xcsh itself rather than operating it.\n\n## Which implementation boundary matters?\n\n- [Agent loop and sessions](./agent-session-runtime/)\n- [Storage, blobs, and artifacts](./storage-artifacts/)\n- [Tool runtime](./tool-runtime/)\n- [Provider streaming](./provider-streaming/)\n- [Extension discovery](./extension-discovery/)\n- [Native runtime](./native-runtime/)\n- [Native development](./native-development/)\n- [Terminal user interface (TUI) runtime](./tui-runtime/)\n- [Relationship to upstream pi](./upstream-pi/)\n- [Prompt authoring](./prompt-authoring/)\n- [Build, test, contribute, and release](./build-release/)\n",
10
10
  "en/architecture-contribution/native-development.mdx": "---\ntitle: \"Develop the native layer\"\ndescription: \"Choose native work deliberately, add a binding, build variants, test cancellation, and debug loader failures.\"\nsidebar:\n order: 7\n label: \"Native development\"\n---\n\nPort code to Rust only for measured performance, platform integration, or resource-control needs. Keep orchestration and product policy in TypeScript.\n\n## How do I add or change a native export?\n\nDefine the Rust implementation and Node-application programming interface (API) signature, expose it from the Rust package, update TypeScript declarations and wrappers, then extend validation and contract tests. Preserve the JavaScript fallback when the public contract requires one; otherwise fail explicitly when the addon is unavailable.\n\n## How do I build target variants?\n\nThe build pipeline selects target triples and optional hardware variants, compiles release artifacts, and packages names the loader can resolve. Environment flags affect the build target or diagnostics, not the public API. Test the ordinary target plus any variant whose resolution order changed.\n\n## How do I diagnose loading and cancellation?\n\nStart with the resolved candidate list, platform identity, file permissions, and `validateNative` mismatch. For asynchronous work, test cancellation before start, during execution, and after completion; a cancellation token must never resolve the same task twice.\n\nChange `crates/pi-natives/src` and `packages/natives` together; a signature that exists on only one side fails at load rather than at build.\n",
11
- "en/architecture-contribution/native-runtime.mdx": "---\ntitle: \"Native runtime architecture\"\ndescription: \"Understand TypeScript wrappers, addon loading, Rust Node-API exports, binary selection, and binding validation.\"\nsidebar:\n order: 6\n label: \"Native runtime\"\n---\n\nThe public TypeScript layer owns ergonomic types and fallbacks. The loader selects a platform-specific addon, validates its exports, and exposes Rust Node-application programming interface (API) implementations for performance-sensitive work.\n\n## How is an addon selected and validated?\n\nResolution considers operating system, CPU architecture, and supported hardware variants before trying packaged and extracted binary candidates. Embedded binaries are materialized in a controlled cache. `validateNative` checks the runtime surface so a mismatched binary fails near loading instead of at an unrelated call.\n\n## How do I keep bindings synchronized?\n\nModule augmentation describes native exports to TypeScript, wrappers translate public inputs and outputs, and Rust functions implement the Node-API boundary. Synchronous and asynchronous variants must agree on names, data conversions, error shapes, and cancellation. Update all three layers and their contract tests together.\n\n## Which subsystems does the addon cover?\n\nThe addon covers terminal and pseudo-terminal (PTY) processes, filesystem scanning and text search, media/system utilities, and cancellable task primitives. Data crossing Node-API must have an explicit encoding and ownership rule; native tasks must release resources on both completion and cancellation.\n\nRead `packages/natives` for the TypeScript wrappers and loader, and `crates/pi-natives/src` for the Rust implementations.\n",
11
+ "en/architecture-contribution/native-runtime.mdx": "---\ntitle: \"Native runtime architecture\"\ndescription: \"Understand TypeScript wrappers, addon loading, Rust Node-API exports, binary selection, and binding validation.\"\nsidebar:\n order: 6\n label: \"Native runtime\"\n---\n\nThe public TypeScript layer owns ergonomic types and fallbacks. The loader selects a platform-specific addon, validates its exports, and exposes Rust Node-application programming interface (API) implementations for performance-sensitive work.\n\n## How is an addon selected and validated?\n\nResolution considers operating system, CPU architecture, and supported hardware variants before trying packaged and extracted binary candidates. Embedded binaries are materialized in a controlled cache. `validateNative` checks the runtime surface so a mismatched binary fails near loading instead of at an unrelated call.\n\n## How do I keep bindings synchronized?\n\nModule augmentation describes native exports to TypeScript, wrappers translate public inputs and outputs, and Rust functions implement the Node-API boundary. Synchronous and asynchronous variants must agree on names, data conversions, error shapes, and cancellation. Update all three layers and their contract tests together.\n\n## Which subsystems does the addon cover?\n\nThe addon covers terminal and pseudo-terminal (PTY) processes, filesystem scanning and text search, media/system utilities, and cancellable task primitives. Data crossing Node-API must have an explicit encoding and ownership rule; native tasks must release resources on both completion and cancellation.\n\n`PowerAssertion.start(options?)` returns an idempotently stoppable session handle. Its\n`PowerAssertionOptions` fields are `reason`, `idle`, `display`, `system`, and `user`; an omitted set\nof mode flags defaults to idle-sleep prevention. The implementation uses IOKit on macOS, login1\nand best-effort ScreenSaver inhibition on Linux, and a dedicated execution-state thread on Windows.\n\nRead `packages/natives` for the TypeScript wrappers and loader, and `crates/pi-natives/src` for the Rust implementations.\n",
12
12
  "en/architecture-contribution/prompt-authoring.mdx": "---\ntitle: \"Author system prompts\"\ndescription: \"Apply the system-prompt checklist, progressive composition, deduplication, and audit tests.\"\nsidebar:\n order: 10\n label: \"Prompt authoring\"\n---\n\nSystem prompts are executable product policy. Edit the smallest owned prompt fragment and verify the composed result; do not paste a second copy of guidance already supplied by a capability or plugin.\n\n## What does the eight-point checklist require?\n\nState role and scope, concrete objectives, available tools, tool-use rules, constraints, output contract, uncertainty behavior, and completion criteria. Use direct instructions with observable conditions. Keep provider-specific details out of shared prompts unless the adapter cannot represent them elsewhere.\n\n## How is the system prompt composed?\n\nThe runtime builds the system prompt from the core fragment plus active capabilities, workspace guidance, plan state, memory, and extension contributions. Ordering and deduplication tests protect mandatory boundaries. An absent optional plugin must not remove core safety or file-operation instructions.\n\n## How do I audit a prompt change?\n\nInspect the final composed prompt for representative capability sets, then run the template, application programming interface (API) spec, deduplication, deprecation, workspace-boundary, start-folder, and absent-plugin tests.\n\nRecord why each new sentence belongs at that layer, and remove a stale alias rather than documenting both paths.\n\nRead `packages/coding-agent/src/prompts` for the composed fragments and their ordering tests.\n",
13
13
  "en/architecture-contribution/provider-streaming.mdx": "---\ntitle: \"Provider streaming\"\ndescription: \"Follow provider events through normalized assistant messages, tool JSON accumulation, cancellation, and fallback.\"\nsidebar:\n order: 4\n label: \"Provider streaming\"\n---\n\nProvider adapters translate distinct wire events into one `AssistantMessageEvent` stream consumed by the agent loop. Text deltas, reasoning, tool starts, tool arguments, completion, usage, and errors retain their meaning across adapters.\n\n```text\nprovider wire events adapter agent loop\n text delta -> text delta -> append to message\n reasoning delta -> reasoning delta -> append to message\n tool start -> buffer call id\n tool arg fragment -> accumulate JSON (no event yet)\n tool arg complete -> tool request -> dispatch tool\n usage -> usage -> account tokens\n error or cancel -> terminal settle (once) -> stop the turn\n```\n\n## How are tool calls normalized incrementally?\n\nTool arguments can arrive as JavaScript Object Notation (JSON) fragments. The adapter accumulates fragments per call identifier and emits a tool request only after a complete valid value exists. Parse failure remains an error with provider context; silently truncating or inventing arguments would cross the provider boundary.\n\n## How does a stream cancel and finish exactly once?\n\nCancellation propagates to the active provider request and prevents later deltas from reopening the turn. A terminal success, cancellation, or error settles the stream once. Retry and model fallback happen above normalization so an adapter does not conceal which provider produced an event.\n\nRead `packages/ai/src/stream.ts` for the normalized event stream and `packages/ai/src/providers` for the per-vendor adapters.\n",
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## 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 defect may belong upstream; an xcsh resource command, integration, or packaging change belongs here.\n\n## How do I preserve attribution?\n\nKeep upstream license notices and document imported changes. Avoid copying a patch blindly across diverged 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 security-first\naudit reviewed the divergent line through the frozen tip `b2f25dbfe1` on September 5, 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\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\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. Commits after either 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",
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",
@@ -53,7 +53,7 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
53
53
  "en/integrations-deployment/office.mdx": "---\ntitle: \"Microsoft Office task pane\"\ndescription: \"Serve or sideload the embedded task pane for Excel, Word, and PowerPoint.\"\nsidebar:\n order: 2\n label: \"Microsoft Office task pane\"\n---\n\nThe Office pane packages an xcsh sidebar for supported Excel, Word, and PowerPoint hosts. `xcsh office --help` describes the installed serve, print, and sideload actions.\n\n## Who owns the test surface?\n\nPackage tests own pane components, bridge messages, and host-independent state. Office-host integration tests own document application programming interfaces (APIs), sideloading, and task-pane lifecycle. A change that crosses the bridge requires both suites; a passing browser-style component test does not prove Word, Excel, or PowerPoint host behavior.\n\n## What must be running?\n\nThe pane build and its local bridge server must match the xcsh version used for the session. One active sidebar binds to one server session at a time.\n\n## Which host steps vary by platform?\n\nRibbon placement, the sideload mechanism, and trust prompts differ across Office on Windows, Office on macOS, and Office on the web. Read the sideload action from `xcsh office --help`, then follow the Microsoft sideloading procedure for the specific host you are targeting.\n",
54
54
  "en/integrations-deployment/vscode.mdx": "---\ntitle: \"VS Code\"\ndescription: \"Use the companion VS Code integration with the same xcsh model and session foundation.\"\nsidebar:\n order: 1\n label: \"VS Code\"\n---\n\nThe companion VS Code extension embeds an xcsh conversation in an editor workspace. Its extension manifest and source repository define the supported commands and distribution channel.\n\n## What carries over from the terminal?\n\nProvider configuration, model selection, session concepts, and workspace file boundaries follow the xcsh runtime. Open the intended workspace before starting a conversation.\n\n## Which behavior should I validate in the terminal?\n\nEditor menus and command palette entries belong to the extension host and change with its release. Reproduce runtime behavior with the command-line interface (CLI) first:\n\n1. Run the same prompt with `xcsh -p` in the workspace directory.\n2. Compare the model, provider, and tool set reported there with the editor session.\n3. Inspect the persisted session file rather than the editor transcript when an exact sequence matters.\n\nA difference between the two points at extension configuration, not at the agent loop.\n",
55
55
  "en/reference-troubleshooting/cli-reference.mdx": "---\ntitle: \"CLI command and flag reference\"\ndescription: \"Look up every top-level xcsh command and every global flag a session accepts.\"\nsidebar:\n order: 1\n label: \"CLI command and flag reference\"\n---\n\nThe installed `xcsh <COMMAND> --help` output is the command-line interface (CLI) authority for its release. This page lists the command and flag names that release exposes so you can find one without starting a session.\n\n## Which top-level commands exist?\n\n| Area | Commands |\n| --- | --- |\n| Resources | `validate`, `diff`, `create`, `apply`, `update`, `get`, `export`, `delete` |\n| Runtime | `config`, `setup`, `sandbox`, `shell`, `ssh`, `stats`, `search` |\n| Files and code | `read`, `grep`, `jupyter` |\n| Extensibility | `agents`, `plugin`, `worker`, `manager` |\n| Interfaces | `chrome`, `chrome-host`, `office`, `herdr` |\n| Repository | `commit`, `grievances` |\n| Maintenance | `self-update`, `update --check` |\n\n`search` also answers to `q`. On `update`, `-f` names a resource manifest; an executable force-update uses `--force`.\n\n## Which global flags does a session accept?\n\nThese flags configure an agent launch. They precede the prompt and do not apply to a subcommand.\n\n| Group | Flags |\n| --- | --- |\n| Model | `--model`, `--smol`, `--slow`, `--plan`, `--provider`, `--models`, `--thinking`, `--list-models` |\n| Credentials and context | `--api-key`, `--context` |\n| Prompt | `--system-prompt`, `--append-system-prompt`, `--no-title` |\n| Mode | `--mode` (`text`, `json`, `rpc`, `acp`), `-p`/`--print` |\n| Session | `-c`/`--continue`, `-r`/`--resume`, `--fork`, `--session-dir`, `--no-session`, `--no-memories`, `--export` |\n| Filesystem | `--allow-home`, `--allow-path`, `--no-sandbox` |\n| Capabilities | `--tools`, `--no-tools`, `--no-mcp`, `--no-lsp`, `--no-pty` |\n| Discovery | `-e`/`--extension`, `--hook`, `--plugin-dir`, `--no-extensions`, `--skills`, `--no-skills`, `--no-rules` |\n\n`packages/coding-agent/src/cli/flag-spec.ts` is the single source that renders `--help` and drives the parser, so the two cannot disagree.\n\n## How do I script a command safely?\n\nRun these steps against the pinned executable:\n\n1. Read `xcsh <COMMAND> --help` for the release you pinned.\n2. Write long flags rather than single-character aliases.\n3. Request `--result-file` or `--mode json` wherever the command supports it.\n4. Pass `--allow-path` once per additional directory; it accumulates rather than replacing.\n",
56
- "en/reference-troubleshooting/configuration-schema.mdx": "---\ntitle: \"Configuration schema\"\ndescription: \"Look up the settings namespaces xcsh validates, and the commands that report effective values.\"\nsidebar:\n order: 3\n label: \"Configuration schema\"\n---\n\n`packages/coding-agent/src/config/settings-schema.ts` defines every recognized settings key with its type, default, and validation. It evolves with the executable, so read the key namespaces here and the values from your own installation.\n\n## Which key namespaces exist?\n\n| Area | Namespaces |\n| --- | --- |\n| Appearance | `theme`, `statusLine`, `display`, `tui`, `terminal`, `images`, `media` |\n| Model and routing | `routing`, `retry`, `thinkingBudgets`, `providers`, `exa` |\n| Interaction | `startup`, `keybindings`, `completion`, `ask`, `stt`, `marketplace` |\n| Context | `context`, `contextPromotion`, `compaction`, `branchSummary`, `memories`, `ttsr` |\n| Editing | `edit`, `read`, `lsp`, `bashInterceptor`, `python` |\n| Tools | `tools`, `todo`, `find`, `grep`, `astGrep`, `astEdit`, `notebook`, `fetch`, `browser`, `web_search`, `calc`, `checkpoint`, `debug`, `inspect_image`, `generate_image`, `renderMermaid`, `bash`, `async`, `mcp` |\n| Tasks and capabilities | `task`, `tasks`, `skills`, `commands` |\n| Security | `secrets`, `sandbox`, `xcsh` |\n| Repository workflows | `commit`, `dev` |\n\nA key is `namespace.name`, as in `compaction.thresholdPercent` or `sandbox.allowRead`. Nested groups extend that form, as in `todo.reminders.max`.\n\n## How do I inspect the effective schema-backed values?\n\n```bash\nxcsh config list --json\nxcsh config get <KEY>\n```\n\nUse `xcsh config set <KEY> <VALUE>` only for a key present in the installed schema. Reset one key with `xcsh config reset <KEY>` rather than copying defaults from another release.\n\n## Which source defines a setting?\n\nThe settings schema and its tests in the matching source release define type, default, and validation. `xcsh config list --json` reports the value after user, project, environment, and command-line precedence is applied. When the two disagree, the schema describes what is legal and the effective output describes what is active.\n",
56
+ "en/reference-troubleshooting/configuration-schema.mdx": "---\ntitle: \"Configuration schema\"\ndescription: \"Look up the settings namespaces xcsh validates, and the commands that report effective values.\"\nsidebar:\n order: 3\n label: \"Configuration schema\"\n---\n\n`packages/coding-agent/src/config/settings-schema.ts` defines every recognized settings key with its type, default, and validation. It evolves with the executable, so read the key namespaces here and the values from your own installation.\n\n## Which key namespaces exist?\n\n| Area | Namespaces |\n| --- | --- |\n| Appearance | `theme`, `statusLine`, `display`, `tui`, `terminal`, `images`, `media` |\n| Model and routing | `routing`, `retry`, `thinkingBudgets`, `providers`, `exa` |\n| Interaction | `startup`, `keybindings`, `completion`, `ask`, `stt`, `marketplace` |\n| Context and session | `context`, `contextPromotion`, `compaction`, `branchSummary`, `memories`, `ttsr`, `power` |\n| Editing | `edit`, `read`, `lsp`, `bashInterceptor`, `python` |\n| Tools | `tools`, `todo`, `find`, `grep`, `astGrep`, `astEdit`, `notebook`, `fetch`, `browser`, `web_search`, `calc`, `checkpoint`, `debug`, `inspect_image`, `generate_image`, `renderMermaid`, `bash`, `async`, `mcp` |\n| Tasks and capabilities | `task`, `tasks`, `skills`, `commands` |\n| Security | `secrets`, `sandbox`, `xcsh` |\n| Repository workflows | `commit`, `dev` |\n\nA key is `namespace.name`, as in `compaction.thresholdPercent` or `sandbox.allowRead`. Nested groups extend that form, as in `todo.reminders.max`.\n\n## How do I control session sleep prevention?\n\n`power.sleepPrevention` defaults to `idle`. Set it to `off`, `idle`, `display`, or `system`; each\nlevel is cumulative and applies only while an agent session is active. xcsh maps the setting to\nIOKit on macOS, login1 and ScreenSaver on Linux, and thread-affine execution state on Windows.\n\n## How do I inspect the effective schema-backed values?\n\n```bash\nxcsh config list --json\nxcsh config get <KEY>\n```\n\nUse `xcsh config set <KEY> <VALUE>` only for a key present in the installed schema. Reset one key with `xcsh config reset <KEY>` rather than copying defaults from another release.\n\n## Which source defines a setting?\n\nThe settings schema and its tests in the matching source release define type, default, and validation. `xcsh config list --json` reports the value after user, project, environment, and command-line precedence is applied. When the two disagree, the schema describes what is legal and the effective output describes what is active.\n",
57
57
  "en/reference-troubleshooting/diagnostics.mdx": "---\ntitle: \"Run diagnostics\"\ndescription: \"Collect version, configuration, provider, context, and sandbox evidence without exposing secrets.\"\nsidebar:\n order: 4\n label: \"Run diagnostics\"\n---\n\nCollect the smallest evidence set that identifies the failing layer. Never print credentials or raw context files.\n\n## The shell cannot find xcsh\n\nRun `command -v xcsh` and `xcsh --version`. If the path belongs to an old installation channel, remove that channel and reinstall once through the intended channel.\n\n## A model is unavailable or authentication fails\n\nRun `xcsh --list-models <PROVIDER>`. If no models appear, verify the relevant credential is present without echoing it. Retry with a provider-qualified `--model` name.\n\n## A context or resource command fails\n\nConfirm `/context status` and the explicit namespace. Run `validate` to separate local manifest errors from live application programming interface (API) errors, then retry a read-only `get` or `diff`.\n\n## A tool or extension fails during startup\n\nStart from the smallest surface, then widen it:\n\n1. Run with `--no-mcp --no-extensions --no-rules`, adding `--no-pty` if the terminal itself is suspect.\n2. Re-enable one subsystem, then repeat the failing command.\n3. Check optional dependencies with `xcsh setup <COMPONENT> --check --json`.\n4. Check plugins with `xcsh plugin doctor`.\n",
58
58
  "en/reference-troubleshooting/index.mdx": "---\ntitle: \"Reference and troubleshooting\"\ndescription: \"Diagnose installations, providers, contexts, and tools, then consult current command and configuration references.\"\nsidebar:\n order: 0\n label: \"Overview\"\n---\n\nBegin with the observed symptom and isolate one layer at a time.\n\n## Where do I look?\n\n- [Diagnostics](./diagnostics/) for installation, provider, context, and tool symptoms.\n- [command-line interface (CLI) reference](./cli-reference/) for current command shapes.\n- [Slash commands and hotkeys](./slash-keybindings/) for interactive discovery.\n- [Configuration schema](./configuration-schema/) for supported settings.\n\nTerms are defined where they are used; there is no separate glossary.\n",
59
59
  "en/reference-troubleshooting/slash-keybindings.mdx": "---\ntitle: \"Slash command reference\"\ndescription: \"Find the interactive commands for models, sessions, contexts, resources, plugins, Model Context Protocol servers, tools, and session state.\"\nsidebar:\n order: 2\n label: \"Slash command reference\"\n---\n\nSlash commands are interactive terminal user interface (TUI) controls, not shell subcommands. The registry is assembled at startup from built-in commands plus whatever the loaded plugins and extensions register.\n\n## How do I find a command or keybinding?\n\nType `/` in the prompt to list the registry active in the current session, and `/hotkeys` to read the resolved terminal key map. Autocomplete narrows the list as you type, so it reports the current release, mode, and extension set rather than a published snapshot.\n\n## Which subsystems have their own commands?\n\n| Subsystem | Entry point |\n| --- | --- |\n| Models and routing | `/model` |\n| Sessions and history | `/session`, `/resume`, `/tree`, `/branch`, `/fork`, `/compact`, `/export` |\n| F5 Distributed Cloud | `/context`, `/namespace`, `/manifest`, `/validate`, `/diff`, `/apply`, `/get`, `/create`, `/delete` |\n| Capabilities | `/tools`, `/agents`, `/plugin`, `/extensions`, `/mcp` |\n| Session state | `/settings`, `/hotkeys`, `/memory`, `/usage`, `/plan` |\n\n`/context status`, `/mcp list`, and `/plugin list` report the current state of those subsystems without changing anything.\n",
@@ -50,10 +50,11 @@ import {
50
50
  parseRateLimitReason,
51
51
  } from "@f5-sales-demo/pi-ai";
52
52
  import { getRetryAfterMsFromErrorText } from "@f5-sales-demo/pi-ai/utils/retry-after";
53
- import { killTree, MacOSPowerAssertion } from "@f5-sales-demo/pi-natives";
53
+ import { killTree, PowerAssertion, type PowerAssertionOptions } from "@f5-sales-demo/pi-natives";
54
54
  import {
55
55
  abortableSleep,
56
56
  getAgentDbPath,
57
+ isBunTestRuntime,
57
58
  isEnoent,
58
59
  logger,
59
60
  prompt,
@@ -430,12 +431,24 @@ const noOpUIContext: ExtensionUIContext = {
430
431
  // AgentSession Class
431
432
  // ============================================================================
432
433
 
434
+ /** Translate the configured sleep-prevention mode into native assertion options. */
435
+ export function powerAssertionOptions(mode: "off" | "idle" | "display" | "system"): PowerAssertionOptions | undefined {
436
+ if (mode === "off") return undefined;
437
+ return {
438
+ reason: "xcsh agent session",
439
+ idle: true,
440
+ display: mode === "display" || mode === "system",
441
+ system: mode === "system",
442
+ user: mode === "system",
443
+ };
444
+ }
445
+
433
446
  export class AgentSession {
434
447
  readonly agent: Agent;
435
448
  readonly sessionManager: SessionManager;
436
449
  readonly settings: Settings;
437
450
 
438
- #powerAssertion: MacOSPowerAssertion | undefined;
451
+ #powerAssertion: PowerAssertion | undefined;
439
452
 
440
453
  readonly configWarnings: string[] = [];
441
454
 
@@ -571,13 +584,13 @@ export class AgentSession {
571
584
  #routingCoordinator = new RoutingCoordinator();
572
585
 
573
586
  #startPowerAssertion(): void {
574
- if (process.platform !== "darwin") {
575
- return;
576
- }
587
+ if (isBunTestRuntime()) return;
588
+ const options = powerAssertionOptions(this.settings.get("power.sleepPrevention"));
589
+ if (!options) return;
577
590
  try {
578
- this.#powerAssertion = MacOSPowerAssertion.start({ reason: "xcsh agent session" });
591
+ this.#powerAssertion = PowerAssertion.start(options);
579
592
  } catch (error) {
580
- logger.warn("Failed to acquire macOS power assertion", { error: String(error) });
593
+ logger.warn("Failed to acquire power assertion", { error: String(error) });
581
594
  }
582
595
  }
583
596
 
@@ -590,7 +603,7 @@ export class AgentSession {
590
603
  try {
591
604
  assertion.stop();
592
605
  } catch (error) {
593
- logger.warn("Failed to release macOS power assertion", { error: String(error) });
606
+ logger.warn("Failed to release power assertion", { error: String(error) });
594
607
  }
595
608
  }
596
609