@f5-sales-demo/xcsh 21.19.3 → 21.19.5
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 +3 -0
- package/package.json +8 -8
- package/src/extensibility/extensions/bundled/herdr-reporter.ts +64 -10
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/internal-urls/docs-index.generated.ts +2 -2
- package/src/modes/components/oauth-selector.ts +7 -4
- package/src/modes/print-mode.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
|
|
49
49
|
### Fixed
|
|
50
50
|
|
|
51
|
+
- Kept `/login` honest after live validation by reporting reachable keyless vLLM services as
|
|
52
|
+
`keyless configured` and unreachable keyless services as `unreachable`
|
|
53
|
+
([#3783](https://github.com/f5-sales-demo/xcsh/issues/3783)).
|
|
51
54
|
- Made the session picker, extension dashboard, and debug-log viewer fullscreen and mouse-aware while
|
|
52
55
|
retaining their keyboard behavior, pinned chrome, and non-action row semantics
|
|
53
56
|
([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.19.
|
|
4
|
+
"version": "21.19.5",
|
|
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",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
65
|
-
"@f5-sales-demo/pi-agent-core": "21.19.
|
|
66
|
-
"@f5-sales-demo/pi-ai": "21.19.
|
|
67
|
-
"@f5-sales-demo/pi-natives": "21.19.
|
|
68
|
-
"@f5-sales-demo/pi-resource-management": "21.19.
|
|
69
|
-
"@f5-sales-demo/pi-tui": "21.19.
|
|
70
|
-
"@f5-sales-demo/pi-utils": "21.19.
|
|
71
|
-
"@f5-sales-demo/xcsh-stats": "21.19.
|
|
65
|
+
"@f5-sales-demo/pi-agent-core": "21.19.5",
|
|
66
|
+
"@f5-sales-demo/pi-ai": "21.19.5",
|
|
67
|
+
"@f5-sales-demo/pi-natives": "21.19.5",
|
|
68
|
+
"@f5-sales-demo/pi-resource-management": "21.19.5",
|
|
69
|
+
"@f5-sales-demo/pi-tui": "21.19.5",
|
|
70
|
+
"@f5-sales-demo/pi-utils": "21.19.5",
|
|
71
|
+
"@f5-sales-demo/xcsh-stats": "21.19.5",
|
|
72
72
|
"@mozilla/readability": "^0.6",
|
|
73
73
|
"@sinclair/typebox": "^0.34",
|
|
74
74
|
"@xterm/headless": "^6.0",
|
|
@@ -72,6 +72,7 @@ const PHASE_LABEL_TTL_MS = 60_000;
|
|
|
72
72
|
const RESULT_MAX_CHARS = 80;
|
|
73
73
|
const SEMANTIC_RESULT_MAX_BYTES = 8_000;
|
|
74
74
|
const TURN_ENTRY_TYPE = "herdr.semantic-turn";
|
|
75
|
+
const EXECUTION_GENERATION_ENV = "HERDR_EXECUTION_GENERATION";
|
|
75
76
|
const SETTLED_TURN_RECONCILE_DELAY_MS = 25;
|
|
76
77
|
const PROMPT_BLOCKED_REASONS = {
|
|
77
78
|
select: "selection required",
|
|
@@ -100,6 +101,8 @@ function boundedSemanticResult(message: AssistantMessage | undefined): string {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
interface PersistedTurn {
|
|
104
|
+
executionId: string;
|
|
105
|
+
paneId: string;
|
|
103
106
|
sessionId: string;
|
|
104
107
|
turnId: string;
|
|
105
108
|
generation: number;
|
|
@@ -111,6 +114,27 @@ interface PersistedTurn {
|
|
|
111
114
|
delivered?: boolean;
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A journal event is authenticated to one execution generation. The execution
|
|
119
|
+
* backend, rather than the reporter, owns that value: guessing a generation
|
|
120
|
+
* would let an old process write into a continuation's journal. Keep ordinary
|
|
121
|
+
* pane reporting available when it is absent, but do not start semantic
|
|
122
|
+
* tracking until the backend has supplied a safe integer generation.
|
|
123
|
+
*/
|
|
124
|
+
function executionGeneration(): number | undefined {
|
|
125
|
+
const raw = process.env[EXECUTION_GENERATION_ENV];
|
|
126
|
+
if (raw === undefined || !/^(?:0|[1-9][0-9]*)$/.test(raw)) return undefined;
|
|
127
|
+
const generation = Number(raw);
|
|
128
|
+
return Number.isSafeInteger(generation) ? generation : undefined;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function executionBinding(paneId: string): { executionId: string; paneId: string; generation: number } | undefined {
|
|
132
|
+
const executionId = process.env.HERDR_EXECUTION_ID;
|
|
133
|
+
const generation = executionGeneration();
|
|
134
|
+
if (!executionId || generation === undefined) return undefined;
|
|
135
|
+
return { executionId, paneId, generation };
|
|
136
|
+
}
|
|
137
|
+
|
|
114
138
|
function persistedTurns(ctx: ExtensionContext): PersistedTurn[] {
|
|
115
139
|
try {
|
|
116
140
|
const entries = ctx.sessionManager?.getEntries?.() as unknown[] | undefined;
|
|
@@ -120,12 +144,22 @@ function persistedTurns(ctx: ExtensionContext): PersistedTurn[] {
|
|
|
120
144
|
if (record.type !== "custom" || record.customType !== TURN_ENTRY_TYPE) return [];
|
|
121
145
|
if (typeof record.data !== "object" || record.data === null) return [];
|
|
122
146
|
const turn = record.data as Record<string, unknown>;
|
|
123
|
-
if (
|
|
147
|
+
if (
|
|
148
|
+
typeof turn.executionId !== "string" ||
|
|
149
|
+
typeof turn.paneId !== "string" ||
|
|
150
|
+
typeof turn.sessionId !== "string" ||
|
|
151
|
+
typeof turn.turnId !== "string" ||
|
|
152
|
+
!Number.isSafeInteger(turn.generation) ||
|
|
153
|
+
(turn.generation as number) < 0
|
|
154
|
+
)
|
|
155
|
+
return [];
|
|
124
156
|
return [
|
|
125
157
|
{
|
|
158
|
+
executionId: turn.executionId,
|
|
159
|
+
paneId: turn.paneId,
|
|
126
160
|
sessionId: turn.sessionId,
|
|
127
161
|
turnId: turn.turnId,
|
|
128
|
-
generation:
|
|
162
|
+
generation: turn.generation as number,
|
|
129
163
|
eventRevision: typeof turn.eventRevision === "number" ? turn.eventRevision : undefined,
|
|
130
164
|
state: typeof turn.state === "string" ? (turn.state as PersistedTurn["state"]) : undefined,
|
|
131
165
|
result: typeof turn.result === "string" ? turn.result : undefined,
|
|
@@ -283,8 +317,7 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
283
317
|
state: "starting" | "working" | "waiting_input" | "completed" | "failed" | "cancelled" | "interrupted",
|
|
284
318
|
options: { result?: string; reason?: string } = {},
|
|
285
319
|
): Promise<void> => {
|
|
286
|
-
|
|
287
|
-
if (!executionId || !activeSemanticTurn) return Promise.resolve();
|
|
320
|
+
if (!executionBinding(paneId) || !activeSemanticTurn) return Promise.resolve();
|
|
288
321
|
const revision = ++semanticRevision;
|
|
289
322
|
const event: PersistedTurn = {
|
|
290
323
|
...activeSemanticTurn,
|
|
@@ -301,13 +334,21 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
301
334
|
|
|
302
335
|
const deliverSemanticEvent = (event: PersistedTurn): Promise<void> => {
|
|
303
336
|
const socketPath = process.env.HERDR_SOCKET_PATH;
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
337
|
+
const binding = executionBinding(paneId);
|
|
338
|
+
if (
|
|
339
|
+
!socketPath ||
|
|
340
|
+
!binding ||
|
|
341
|
+
event.executionId !== binding.executionId ||
|
|
342
|
+
event.paneId !== binding.paneId ||
|
|
343
|
+
event.generation !== binding.generation ||
|
|
344
|
+
event.eventRevision === undefined ||
|
|
345
|
+
event.state === undefined
|
|
346
|
+
) {
|
|
306
347
|
return Promise.resolve();
|
|
307
348
|
}
|
|
308
349
|
const frame = {
|
|
309
|
-
execution_id: executionId,
|
|
310
|
-
pane_id: paneId,
|
|
350
|
+
execution_id: event.executionId,
|
|
351
|
+
pane_id: event.paneId,
|
|
311
352
|
producer: HERDR_AGENT_LABEL,
|
|
312
353
|
session_id: event.sessionId,
|
|
313
354
|
turn_id: event.turnId,
|
|
@@ -335,9 +376,11 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
335
376
|
};
|
|
336
377
|
|
|
337
378
|
const beginSemanticTurn = async (ctx: ExtensionContext): Promise<void> => {
|
|
379
|
+
const binding = executionBinding(paneId);
|
|
380
|
+
if (!binding) return;
|
|
338
381
|
const sessionId = ctx.sessionManager?.getSessionId?.();
|
|
339
382
|
if (typeof sessionId !== "string" || !sessionId) return;
|
|
340
|
-
activeSemanticTurn = { sessionId, turnId: randomUUID()
|
|
383
|
+
activeSemanticTurn = { ...binding, sessionId, turnId: randomUUID() };
|
|
341
384
|
semanticRevision = 0;
|
|
342
385
|
pendingSemanticResult = "";
|
|
343
386
|
pi.appendEntry(TURN_ENTRY_TYPE, { ...activeSemanticTurn, eventRevision: 0 });
|
|
@@ -509,7 +552,18 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
509
552
|
byRevision.set(`${event.sessionId}:${event.turnId}:${event.generation}:${event.eventRevision}`, event);
|
|
510
553
|
}
|
|
511
554
|
}
|
|
512
|
-
const
|
|
555
|
+
const binding = executionBinding(paneId);
|
|
556
|
+
if (!binding) return;
|
|
557
|
+
const events = [...byRevision.values()].filter(event => {
|
|
558
|
+
if (
|
|
559
|
+
event.executionId === binding.executionId &&
|
|
560
|
+
event.paneId === binding.paneId &&
|
|
561
|
+
event.generation === binding.generation
|
|
562
|
+
)
|
|
563
|
+
return true;
|
|
564
|
+
onError(new Error("Persisted Herdr turn binding does not match this execution"));
|
|
565
|
+
return false;
|
|
566
|
+
});
|
|
513
567
|
for (const event of events.filter(event => !event.delivered)) await deliverSemanticEvent(event);
|
|
514
568
|
const last = events.at(-1);
|
|
515
569
|
const terminal = last && ["completed", "failed", "cancelled", "interrupted"].includes(last.state ?? "");
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "21.19.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
20
|
+
"version": "21.19.5",
|
|
21
|
+
"commit": "ee49a913f9bf8c12c4482beec1bc98b12e383a06",
|
|
22
|
+
"shortCommit": "ee49a91",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.19.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.19.5",
|
|
25
|
+
"commitDate": "2026-09-09T04:13:48+00:00",
|
|
26
|
+
"buildDate": "2026-09-09T05:19:44.578Z",
|
|
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/
|
|
32
|
-
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.19.
|
|
31
|
+
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/ee49a913f9bf8c12c4482beec1bc98b12e383a06",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.19.5"
|
|
33
33
|
};
|
|
@@ -17,7 +17,7 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
|
|
|
17
17
|
"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",
|
|
18
18
|
"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",
|
|
19
19
|
"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",
|
|
20
|
-
"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
|
+
"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## How do I retain and resume a JSON-mode session?\n\nUse a dedicated session directory when the JSON stream must survive process loss:\n\n```bash\nxcsh --mode json --session-dir /var/lib/my-controller/xcsh-sessions -p \"Return one sentence\"\n```\n\nThe first stdout line is a `SessionHeader`. Its `id` is a 16-character lowercase hexadecimal XCSH session ID.\nWith `--session-dir`, xcsh atomically writes and fsyncs the matching `<timestamp>_<id>.jsonl` file before\nemitting that header. The header's persisted `cwd`, `id`, and timestamp are the resumable record. Keep the path\ndiscovered in the session directory (or resolve the ID there), then continue through the documented resume argument:\n\n```bash\nxcsh --resume /var/lib/my-controller/xcsh-sessions/<timestamp>_<id>.jsonl \"Continue the task\"\n```\n\n`--no-session` deliberately produces no resumable file or session header. The stream's wire-only `model`, `provider`, and `thinking` fields describe the launch; they are not additional persisted session-header fields.\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",
|
|
21
21
|
"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",
|
|
22
22
|
"en/automate-extend/index.mdx": "---\ntitle: \"Automate and extend\"\ndescription: \"Add skills, plugins, MCP servers, custom tools, hooks, rules, SDK integrations, and headless workers.\"\nsidebar:\n order: 0\n label: \"Overview\"\n---\n\nExtend xcsh only when a built-in command or tool cannot express the task.\n\n## Which extension mechanism fits?\n\n- [Headless modes](./headless-protocols/) drive xcsh from a script over a process boundary.\n- [Software development kit (SDK) automation](./sdk/) embeds sessions in a host application.\n- [Extensions and custom tools](./extensions-custom-tools/) run TypeScript hooks or tools.\n- [Hooks and rules](./hooks-rules/) choose between lifecycle code and declarative guidance.\n- [Skills](./skills/) add discoverable instructions.\n- [Plugins and marketplaces](./plugins-marketplaces/) package installable capabilities.\n- [Model Context Protocol (MCP) quickstart](./mcp-quickstart/) connects one out-of-process server.\n- [MCP configuration](./mcp-configuration/) declares transports, variables, and disabled servers.\n- [MCP runtime and authoring](./mcp-runtime-authoring/) traces connection lifecycle and server contracts.\n",
|
|
23
23
|
"en/automate-extend/mcp-configuration.mdx": "---\ntitle: \"Configure MCP servers\"\ndescription: \"Declare transports, variables, authentication, and disabled discovered servers in mcp.json.\"\nsidebar:\n order: 8\n label: \"MCP configuration\"\n---\n\nModel Context Protocol (MCP) configuration is discovered from user and project roots and normalized before any connection starts. Use `xcsh mcp list` to see the effective server set instead of inferring it from one file.\n\n## Which transport and lifecycle should I declare?\n\nA local server uses a command plus arguments and communicates over stdio. A remote server declares an HTTP-capable uniform resource locator (URL) and the supported transport options. The runtime selects from the declared shape; it does not silently reinterpret a malformed local entry as a remote one.\n\n## How do I resolve variables without embedding secrets?\n\nConfiguration values can reference environment-backed variables. Credential resolution happens before connection establishment, and unresolved required variables fail that server without printing the secret. Keep tokens outside committed `mcp.json` files.\n\n## How do I disable a discovered server?\n\nAdd its normalized identifier to `disabledServers` when a higher-precedence discovery source should remain visible but inactive. Validate the resulting set with `xcsh mcp list`, then use the MCP management commands to reconnect or reload after a file change.\n",
|
|
@@ -49,7 +49,7 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
|
|
|
49
49
|
"en/index.mdx": "---\ntitle: xcsh\ndescription: Independent open-source agentic shell for terminal work and F5 Distributed Cloud workflows.\ntemplate: splash\neditUrl: false\nhero:\n tagline: An agentic shell for terminal work, extensible automation, and reviewable F5 Distributed Cloud resource workflows.\n image:\n html: '<img src=\"/xcsh/images/xcsh-workflow.svg\" alt=\"Prompt, tools, and F5 Distributed Cloud workflow\" width=\"560\" height=\"360\" />'\n actions:\n - text: Install xcsh\n link: /xcsh/en/getting-started/installation/\n icon: right-arrow\n variant: primary\n - text: Run the quickstart\n link: /xcsh/en/getting-started/quickstart/\n icon: rocket\nsidebar:\n hidden: true\n order: 0\nhead:\n - tag: style\n content: >-\n .hero img { width: min(100%, 35rem); height: auto; filter: drop-shadow(0 1rem 2.5rem color-mix(in srgb, var(--sl-color-accent) 28%, transparent)); }\n .hero h1 { text-wrap: balance; }\n---\n\nxcsh combines an interactive coding agent with deterministic F5 Distributed Cloud resource commands. It is an independent open-source project, not an F5 product.\n\n## Where should I start?\n\n- New installation: [install xcsh](./getting-started/installation/), then run the [quickstart](./getting-started/quickstart/).\n- F5 Distributed Cloud change: select a [context and namespace](./f5-distributed-cloud/contexts-namespaces/), then [validate and diff](./f5-distributed-cloud/validate-diff/).\n- Existing session: review the [interactive shell](./use-xcsh/interactive-tui/) and [session controls](./use-xcsh/sessions-memory/).\n- Automation: choose a [headless mode](./automate-extend/headless-protocols/) or use the [software development kit (SDK)](./automate-extend/sdk/).\n",
|
|
50
50
|
"en/integrations-deployment/chrome.mdx": "---\ntitle: \"Chrome\"\ndescription: \"Use the xcsh Chrome extension and native host with an isolated automation profile.\"\nsidebar:\n order: 3\n label: \"Chrome\"\n---\n\nThe Chrome integration connects xcsh to a browser session for supported console automation. The installed `xcsh chrome --help` output is the command authority.\n\n## What is the safe operating boundary?\n\nUse a dedicated profile and an authorized target. Confirm the visible account, uniform resource locator (URL), and object before an action that changes state. Prefer deterministic F5 Distributed Cloud resource commands whenever they cover the same operation.\n\n## Which Chrome capabilities does xcsh expose?\n\nThe `chrome` command inspects and arranges browser sessions, and `chrome-host` runs the native messaging host that connects the extension to the executable. Page-level interaction is driven by the browser tool inside a session rather than by a subcommand, so scope it with `--tools` in the same way as any other tool.\n",
|
|
51
51
|
"en/integrations-deployment/containers.mdx": "---\ntitle: \"Containers\"\ndescription: \"Run the published multi-architecture Alpine image with explicit mounts and credentials.\"\nsidebar:\n order: 4\n label: \"Containers\"\n---\n\nThe published container packages xcsh for process isolation and repeatable deployment. It does not grant cloud credentials or filesystem access by itself.\n\n## How do I verify an image?\n\n```bash\ndocker pull ghcr.io/f5-sales-demo/xcsh:latest\ndocker run --rm ghcr.io/f5-sales-demo/xcsh:latest --version\n```\n\nPin a version tag or digest for automation. Mount only the task directory and inject credentials through the runtime's secret mechanism.\n\n## What must remain outside the image?\n\nKeep user contexts, provider tokens, and writable session data in explicit mounts or secret stores. Do not bake them into a derived layer.\n",
|
|
52
|
-
"en/integrations-deployment/herdr.mdx": "---\ntitle: \"Integrate with Herdr\"\ndescription: \"Understand Herdr workspace launch, terminal actions, protocol negotiation, and isolation.\"\nsidebar:\n order: 5\n label: \"Herdr\"\n---\n\nHerdr support is optional and host-dependent. When the host does not provide it, xcsh terminal operation is unaffected.\n\n## How is the host protocol negotiated?\n\nThe integration checks the available socket protocol and media or graphics capabilities before it requests a workspace. Missing negotiation support leaves ordinary xcsh terminal operation intact.\n\n## How is a conversation-owned workspace launched?\n\nA workspace is tied to the conversation identity supplied at startup. Terminal-management actions create or address panes within that workspace, and lifecycle reporting stays anchored to the same startup context. Do not reuse an unrelated workspace merely because its socket is reachable.\n\n## How do I recover from socket failure?\n\nConnection and framing failures surface as integration diagnostics. The client must not open an inbound listener as a fallback. Close conversation-owned resources through the supported lifecycle and preserve unrelated Herdr workspaces.\n\n## What lifecycle state does xcsh publish?\n\nXCSH publishes native turn phases rather than inferring completion from terminal idleness or process exit. With Herdr protocol 20 and the advertised `agent_turn_journal` capability, a tracked execution publishes a persisted session/turn identity and a bounded semantic result to Herdr's durable journal. The existing 80-character metadata preview remains display-only and is never completion evidence.\nCommentary, prompt content, tool data, and failed or cancelled partial output are excluded.\n\nSession shutdown releases pane authority. It does not convert an unfinished turn into a successful completion.\n\nThe verified contract is:\n\n| Concern | XCSH signal | Herdr disposition |\n| --- | --- | --- |\n| Session start and identity | Persisted native session ID/path | Herdr resume reference plus stable semantic session identity. |\n| Turn start/progress | Persisted UUID and normalized `turn_phase` | `starting`/`working` journal events with producer revision and server revision. |\n| Waiting for input/approval | `awaiting_user` and closed prompt kind | `waiting_input` with fixed safe reason; private prompt content is excluded. |\n| Successful completion | Settlement-aware `idle` after `agent_end` | `completed` with at most 8,000 UTF-8 bytes and a matching SHA-256 digest. |\n| Failure/cancellation | `error` or `cancelled` | Distinct terminal state and bounded safe reason; no partial result. |\n| Resume/fork | Session events and persisted custom turn entries | Resume preserves identity; unfinished recovered work becomes `interrupted`; fork has separate session lineage. |\n| Reconnect/order | Serialized queue and persisted event revision | Exact duplicates are idempotent; stale/conflicting revisions fail; terminal state is immutable. |\n| Application exit | `session_shutdown` | Active turn becomes `interrupted`, then pane authority is released; never success. |\n\nXCSH implementation is tracked by [issue #3768](https://github.com/f5-sales-demo/xcsh/issues/3768). The complete cross-project work packages and acceptance gates are in [Herdr native signaling gap-closing plan](../architecture-contribution/herdr-gap-closing-plan).\n\nHerdr lifecycle reconciliation is tracked by issue #5 in the F5 Herdr fork. Current source already recognizes the exact `(\"herdr:xcsh\", \"xcsh\")` resume pair; deployed build provenance and live resume/fork acceptance remain required before feature acceptance.\n",
|
|
52
|
+
"en/integrations-deployment/herdr.mdx": "---\ntitle: \"Integrate with Herdr\"\ndescription: \"Understand Herdr workspace launch, terminal actions, protocol negotiation, and isolation.\"\nsidebar:\n order: 5\n label: \"Herdr\"\n---\n\nHerdr support is optional and host-dependent. When the host does not provide it, xcsh terminal operation is unaffected.\n\n## How is the host protocol negotiated?\n\nThe integration checks the available socket protocol and media or graphics capabilities before it requests a workspace. Missing negotiation support leaves ordinary xcsh terminal operation intact.\n\n## How is a conversation-owned workspace launched?\n\nA workspace is tied to the conversation identity supplied at startup. Terminal-management actions create or address panes within that workspace, and lifecycle reporting stays anchored to the same startup context. Do not reuse an unrelated workspace merely because its socket is reachable.\n\n## How do I recover from socket failure?\n\nConnection and framing failures surface as integration diagnostics. The client must not open an inbound listener as a fallback. Close conversation-owned resources through the supported lifecycle and preserve unrelated Herdr workspaces.\n\n## What lifecycle state does xcsh publish?\n\nXCSH publishes native turn phases rather than inferring completion from terminal idleness or process exit. With Herdr protocol 20 and the advertised `agent_turn_journal` capability, a tracked execution publishes a persisted session/turn identity and a bounded semantic result to Herdr's durable journal. The existing 80-character metadata preview remains display-only and is never completion evidence.\nCommentary, prompt content, tool data, and failed or cancelled partial output are excluded.\n\n### External execution driver contract\n\nThe supported producer is the normal `xcsh` executable launched by Herdr's execution backend; it is not a mock or a no-provider/offline actor. For a journal-tracked invocation, that backend must inject the exact allocated `HERDR_EXECUTION_ID` and decimal safe-integer `HERDR_EXECUTION_GENERATION` into the child environment before it starts `xcsh`.\n\nXCSH never guesses a generation: without both values it retains ordinary pane lifecycle reporting but emits no semantic journal event. A continuation must be launched with its newly allocated generation.\n\nThe control/manager side owns translating `execution.cancel` to the child cancellation mechanism. XCSH then reports its native `cancelled` phase; asking a model to say it was cancelled is not a lifecycle event. Likewise, an input wait is only journaled after native `awaiting_user`, not from prose that asks a question.\n\nSession shutdown releases pane authority. It does not convert an unfinished turn into a successful completion.\n\nThe verified contract is:\n\n| Concern | XCSH signal | Herdr disposition |\n| --- | --- | --- |\n| Session start and identity | Persisted native session ID/path | Herdr resume reference plus stable semantic session identity. |\n| Turn start/progress | Persisted UUID and normalized `turn_phase` | `starting`/`working` journal events with producer revision and server revision. |\n| Waiting for input/approval | `awaiting_user` and closed prompt kind | `waiting_input` with fixed safe reason; private prompt content is excluded. |\n| Successful completion | Settlement-aware `idle` after `agent_end` | `completed` with at most 8,000 UTF-8 bytes and a matching SHA-256 digest. |\n| Failure/cancellation | `error` or `cancelled` | Distinct terminal state and bounded safe reason; no partial result. |\n| Resume/fork | Session events and persisted custom turn entries | Resume preserves identity; unfinished recovered work becomes `interrupted`; fork has separate session lineage. |\n| Reconnect/order | Serialized queue and persisted event revision | Exact duplicates are idempotent; stale/conflicting revisions fail; terminal state is immutable. |\n| Application exit | `session_shutdown` | Active turn becomes `interrupted`, then pane authority is released; never success. |\n\nXCSH implementation is tracked by [issue #3768](https://github.com/f5-sales-demo/xcsh/issues/3768). The complete cross-project work packages and acceptance gates are in [Herdr native signaling gap-closing plan](../architecture-contribution/herdr-gap-closing-plan).\n\nHerdr lifecycle reconciliation is tracked by issue #5 in the F5 Herdr fork. Current source already recognizes the exact `(\"herdr:xcsh\", \"xcsh\")` resume pair; deployed build provenance and live resume/fork acceptance remain required before feature acceptance.\n",
|
|
53
53
|
"en/integrations-deployment/index.mdx": "---\ntitle: \"Integrations and deployment\"\ndescription: \"Deploy xcsh in containers and connect the editor, browser, Office, and Herdr surfaces.\"\nsidebar:\n order: 0\n label: \"Overview\"\n---\n\nChoose an integration by host, authority, and lifecycle boundary.\n\n## Which integration fits?\n\n- [Containers](./containers/) for an isolated packaged runtime.\n- [VS Code](./vscode/), [Chrome](./chrome/), [Office](./office/), or [Herdr](./herdr/) only when that companion surface is installed and the task needs it.\n",
|
|
54
54
|
"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",
|
|
55
55
|
"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",
|
|
@@ -186,14 +186,17 @@ export class OAuthSelectorComponent extends Container {
|
|
|
186
186
|
if (state === "invalid" || access?.status === "reauth-required") {
|
|
187
187
|
return theme.fg("error", ` ${theme.status.error} re-authentication required`) + excluded;
|
|
188
188
|
}
|
|
189
|
+
if (access?.status === "unreachable") {
|
|
190
|
+
return theme.fg("warning", ` ${theme.status.warning} unreachable`) + excluded;
|
|
191
|
+
}
|
|
192
|
+
if (access?.credentialSource === "keyless") {
|
|
193
|
+
return theme.fg("success", ` ${theme.status.success} keyless configured`) + excluded;
|
|
194
|
+
}
|
|
189
195
|
if (state === "valid") {
|
|
190
196
|
return theme.fg("success", ` ${theme.status.success} connected`) + excluded;
|
|
191
197
|
}
|
|
192
198
|
let label = "";
|
|
193
|
-
if (access?.
|
|
194
|
-
label = theme.fg("success", ` ${theme.status.success} keyless configured`);
|
|
195
|
-
else if (access?.status === "unreachable") label = theme.fg("warning", ` ${theme.status.warning} unreachable`);
|
|
196
|
-
else if (access?.status === "configured-unverified") label = theme.fg("warning", " credential detected");
|
|
199
|
+
if (access?.status === "configured-unverified") label = theme.fg("warning", " credential detected");
|
|
197
200
|
else if (access?.status === "connected") label = theme.fg("success", ` ${theme.status.success} connected`);
|
|
198
201
|
else if (!access && this.#authStorage.hasAuth(providerId)) label = theme.fg("warning", " credential detected");
|
|
199
202
|
return label + excluded;
|
package/src/modes/print-mode.ts
CHANGED
|
@@ -74,6 +74,10 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti
|
|
|
74
74
|
|
|
75
75
|
// Emit session header for JSON mode.
|
|
76
76
|
if (mode === "json") {
|
|
77
|
+
// A JSON header advertises a session identity to an external process. Make that
|
|
78
|
+
// identity resumable before it becomes observable, even when this invocation
|
|
79
|
+
// has no prompt and therefore would otherwise retain lazy persistence.
|
|
80
|
+
await session.sessionManager.ensureOnDisk();
|
|
77
81
|
const line = buildJsonSessionHeaderLine(session.sessionManager.getHeader(), session.model, session.thinkingLevel);
|
|
78
82
|
if (line) process.stdout.write(line);
|
|
79
83
|
}
|