@f5-sales-demo/xcsh 21.12.2 → 21.13.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 +5 -0
- package/package.json +8 -8
- package/src/config/auto-config.ts +2 -2
- package/src/config/model-registry.ts +3 -3
- package/src/config/resolve-config-value.ts +2 -1
- package/src/extensibility/extensions/bundled/herdr-reporter.ts +50 -2
- package/src/herdr/client.ts +3 -3
- package/src/internal-urls/build-info.generated.ts +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
|
|
37
37
|
### Fixed
|
|
38
38
|
|
|
39
|
+
- Resolved user-configured environment references by exact case across config values, model
|
|
40
|
+
registry credentials, and LiteLLM YAML while preserving literal, command-backed, and unresolved
|
|
41
|
+
all-caps behavior. Semantically ported from
|
|
42
|
+
[can1357/oh-my-pi#7362](https://github.com/can1357/oh-my-pi/pull/7362)
|
|
43
|
+
([#3711](https://github.com/f5-sales-demo/xcsh/issues/3711)).
|
|
39
44
|
- Hardened provider and compaction boundaries by obfuscating every provider-visible string,
|
|
40
45
|
preserving opaque reasoning, protecting side requests and adversarial summary tags, and restoring
|
|
41
46
|
unconfigured credential-shaped values byte-exact at trusted local tool boundaries. Semantically
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.13.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.
|
|
65
|
-
"@f5-sales-demo/pi-ai": "21.
|
|
66
|
-
"@f5-sales-demo/pi-natives": "21.
|
|
67
|
-
"@f5-sales-demo/pi-resource-management": "21.
|
|
68
|
-
"@f5-sales-demo/pi-tui": "21.
|
|
69
|
-
"@f5-sales-demo/pi-utils": "21.
|
|
70
|
-
"@f5-sales-demo/xcsh-stats": "21.
|
|
64
|
+
"@f5-sales-demo/pi-agent-core": "21.13.1",
|
|
65
|
+
"@f5-sales-demo/pi-ai": "21.13.1",
|
|
66
|
+
"@f5-sales-demo/pi-natives": "21.13.1",
|
|
67
|
+
"@f5-sales-demo/pi-resource-management": "21.13.1",
|
|
68
|
+
"@f5-sales-demo/pi-tui": "21.13.1",
|
|
69
|
+
"@f5-sales-demo/pi-utils": "21.13.1",
|
|
70
|
+
"@f5-sales-demo/xcsh-stats": "21.13.1",
|
|
71
71
|
"@mozilla/readability": "^0.6",
|
|
72
72
|
"@sinclair/typebox": "^0.34",
|
|
73
73
|
"@xterm/headless": "^6.0",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as fs from "node:fs";
|
|
17
17
|
import * as path from "node:path";
|
|
18
|
-
import { $env, isEnoent, logger, readProviderFromModelsYml } from "@f5-sales-demo/pi-utils";
|
|
18
|
+
import { $env, $envExact, isEnoent, logger, readProviderFromModelsYml } from "@f5-sales-demo/pi-utils";
|
|
19
19
|
import { hardenAgentConfigFileSync, writeAgentConfigFileSync } from "./agent-config-file";
|
|
20
20
|
import { DEFAULT_MODEL_ROLE } from "./settings-schema";
|
|
21
21
|
|
|
@@ -143,7 +143,7 @@ export function readLiteLLMConfig(modelsPath: string): LiteLLMConfig | undefined
|
|
|
143
143
|
if (!apiKey) {
|
|
144
144
|
resolvedApiKey = $env.LITELLM_API_KEY;
|
|
145
145
|
} else if (apiKey.kind === "envVar") {
|
|
146
|
-
resolvedApiKey =
|
|
146
|
+
resolvedApiKey = $envExact(apiKey.name) ?? $env.LITELLM_API_KEY;
|
|
147
147
|
} else if (apiKey.kind === "shellSecret") {
|
|
148
148
|
resolvedApiKey = $env.LITELLM_API_KEY;
|
|
149
149
|
} else {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
unregisterCustomApis,
|
|
29
29
|
unregisterOAuthProviders,
|
|
30
30
|
} from "@f5-sales-demo/pi-ai";
|
|
31
|
-
import { $env, isRecord, logger } from "@f5-sales-demo/pi-utils";
|
|
31
|
+
import { $env, $envExact, isRecord, logger } from "@f5-sales-demo/pi-utils";
|
|
32
32
|
import { type Static, Type } from "@sinclair/typebox";
|
|
33
33
|
import { type ConfigError, ConfigFile } from "../config";
|
|
34
34
|
import { hasLiteLLMEnv, probeAndUpgradeLiteLLMConfig, startupHealthCheck } from "../config/auto-config";
|
|
@@ -475,7 +475,7 @@ type LlamaCppDiscoveredServerMetadata = {
|
|
|
475
475
|
* Checks environment variable first, then treats as literal.
|
|
476
476
|
*/
|
|
477
477
|
export function resolveApiKeyConfig(keyConfig: string): string | undefined {
|
|
478
|
-
const envValue =
|
|
478
|
+
const envValue = $envExact(keyConfig);
|
|
479
479
|
if (envValue) return envValue;
|
|
480
480
|
return keyConfig;
|
|
481
481
|
}
|
|
@@ -488,7 +488,7 @@ const ENV_VAR_NAME_RE = /^[A-Z][A-Z0-9]*(?:_[A-Z][A-Z0-9]*)+$/;
|
|
|
488
488
|
* names to prevent sending literal names like "LITELLM_API_KEY" as Bearer tokens.
|
|
489
489
|
*/
|
|
490
490
|
export function resolveYamlApiKeyConfig(keyConfig: string): string | undefined {
|
|
491
|
-
const envValue =
|
|
491
|
+
const envValue = $envExact(keyConfig);
|
|
492
492
|
if (envValue) return envValue;
|
|
493
493
|
if (ENV_VAR_NAME_RE.test(keyConfig)) return undefined;
|
|
494
494
|
return keyConfig;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { executeShell } from "@f5-sales-demo/pi-natives";
|
|
8
|
+
import { $envExact } from "@f5-sales-demo/pi-utils";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Matches strings that look like environment variable names: ALL_CAPS_WITH_UNDERSCORES.
|
|
@@ -33,7 +34,7 @@ export async function resolveConfigValue(config: string): Promise<string | undef
|
|
|
33
34
|
if (config.startsWith("!")) {
|
|
34
35
|
return await executeCommand(config);
|
|
35
36
|
}
|
|
36
|
-
const envValue =
|
|
37
|
+
const envValue = $envExact(config);
|
|
37
38
|
if (envValue) return envValue;
|
|
38
39
|
// Reject unresolved env var names to prevent sending literal names as API keys.
|
|
39
40
|
// Actual literal API keys (sk-ant-..., UUIDs, etc.) won't match this pattern.
|
|
@@ -10,7 +10,7 @@ import { HerdrClient } from "../../../herdr/client";
|
|
|
10
10
|
* blocked indicator.
|
|
11
11
|
*
|
|
12
12
|
* Transport: herdr injects `HERDR_SOCKET_PATH` into every pane, so state is
|
|
13
|
-
* reported over herdr's protocol-
|
|
13
|
+
* reported over herdr's protocol-19 JSONL socket via the shared `HerdrClient`
|
|
14
14
|
* (see `../../../herdr/client`) — the same client `herdr-terminal` uses. Each
|
|
15
15
|
* request reconnects independently, validates the `ping` protocol version
|
|
16
16
|
* before the first real request, and awaits herdr's typed response before
|
|
@@ -60,8 +60,10 @@ const PHASE_SOURCE = "xcsh:phase";
|
|
|
60
60
|
const REPORT_METHOD = "pane.report_agent";
|
|
61
61
|
const METADATA_METHOD = "pane.report_metadata";
|
|
62
62
|
const SESSION_METHOD = "pane.report_agent_session";
|
|
63
|
+
const HEARTBEAT_METHOD = "pane.report_agent_heartbeat";
|
|
63
64
|
const RELEASE_METHOD = "pane.release_agent";
|
|
64
65
|
const SOCKET_TIMEOUT_MS = 2000;
|
|
66
|
+
const HEARTBEAT_INTERVAL_MS = 10_000;
|
|
65
67
|
const PHASE_LABEL_TTL_MS = 60_000;
|
|
66
68
|
const SETTLED_TURN_RECONCILE_DELAY_MS = 25;
|
|
67
69
|
const PROMPT_BLOCKED_REASONS = {
|
|
@@ -89,7 +91,7 @@ function getHerdrClient(socketPath: string): HerdrClient {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
/**
|
|
92
|
-
* Send one JSON-RPC request to herdr over its protocol-
|
|
94
|
+
* Send one JSON-RPC request to herdr over its protocol-19 socket and await the
|
|
93
95
|
* typed response. Every failure path (transport error, timeout, protocol
|
|
94
96
|
* mismatch) is reported via `onError` without throwing, so a dead or
|
|
95
97
|
* incompatible herdr never disturbs the agent.
|
|
@@ -160,6 +162,12 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
160
162
|
// before their agent-end extension callback has drained. The check consults
|
|
161
163
|
// XCSH's own streaming state, so a tool boundary cannot be mistaken for idle.
|
|
162
164
|
let settledTurnReconcileTimer: ReturnType<typeof setTimeout> | undefined;
|
|
165
|
+
// Heartbeats are session-scoped liveness signals. They have no lifecycle state
|
|
166
|
+
// or metadata payload, so Herdr can refresh the authoritative reporter without
|
|
167
|
+
// changing the pane's lifecycle state, state_change_seq, phase labels, or
|
|
168
|
+
// session anchor.
|
|
169
|
+
let heartbeatTimer: ReturnType<typeof setInterval> | undefined;
|
|
170
|
+
let heartbeatActive = false;
|
|
163
171
|
// Serializes frames: herdr compares `seq` across all methods for this source,
|
|
164
172
|
// so frames must reach it in the order they were generated.
|
|
165
173
|
let queue: Promise<void> = Promise.resolve();
|
|
@@ -202,6 +210,44 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
202
210
|
seq: seq++,
|
|
203
211
|
});
|
|
204
212
|
|
|
213
|
+
// Heartbeat is deliberately socket-only. Older Herdr CLIs do not expose this
|
|
214
|
+
// new typed frame, while an unavailable socket remains nonfatal just like the
|
|
215
|
+
// lifecycle socket reports above.
|
|
216
|
+
const reportHeartbeat = (): Promise<void> => {
|
|
217
|
+
const socketPath = process.env.HERDR_SOCKET_PATH;
|
|
218
|
+
if (!socketPath) return Promise.resolve();
|
|
219
|
+
// Allocate before enqueueing: another lifecycle callback can run before this
|
|
220
|
+
// task reaches the queue head, but must still receive a later sequence.
|
|
221
|
+
const frame = {
|
|
222
|
+
pane_id: paneId,
|
|
223
|
+
source: HERDR_SOURCE,
|
|
224
|
+
agent: HERDR_AGENT_LABEL,
|
|
225
|
+
seq: seq++,
|
|
226
|
+
};
|
|
227
|
+
return enqueue(() => sendToHerdrSocket(socketPath, HEARTBEAT_METHOD, frame, onError));
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const startHeartbeat = (): void => {
|
|
231
|
+
if (heartbeatActive) return;
|
|
232
|
+
heartbeatActive = true;
|
|
233
|
+
heartbeatTimer = setInterval(() => {
|
|
234
|
+
// A callback already queued when shutdown starts must not report after
|
|
235
|
+
// the release frame has relinquished this authority.
|
|
236
|
+
if (heartbeatActive) void reportHeartbeat();
|
|
237
|
+
}, HEARTBEAT_INTERVAL_MS);
|
|
238
|
+
// Do not keep an otherwise completed process alive if its host skips an
|
|
239
|
+
// orderly session_shutdown callback.
|
|
240
|
+
(heartbeatTimer as { unref?: () => void }).unref?.();
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const stopHeartbeat = (): void => {
|
|
244
|
+
heartbeatActive = false;
|
|
245
|
+
if (heartbeatTimer !== undefined) {
|
|
246
|
+
clearInterval(heartbeatTimer);
|
|
247
|
+
heartbeatTimer = undefined;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
205
251
|
const reportMetadata = (params: Record<string, unknown>): Promise<void> => {
|
|
206
252
|
const socketPath = process.env.HERDR_SOCKET_PATH;
|
|
207
253
|
if (!socketPath) {
|
|
@@ -298,6 +344,7 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
298
344
|
|
|
299
345
|
// Announce presence and session identity as soon as the session is initialized.
|
|
300
346
|
pi.on("session_start", async (_event, ctx) => {
|
|
347
|
+
startHeartbeat();
|
|
301
348
|
await report("idle");
|
|
302
349
|
await reportSession(ctx);
|
|
303
350
|
});
|
|
@@ -376,6 +423,7 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
376
423
|
|
|
377
424
|
// Relinquish pane authority so herdr stops showing xcsh once we exit.
|
|
378
425
|
pi.on("session_shutdown", () => {
|
|
426
|
+
stopHeartbeat();
|
|
379
427
|
void send(RELEASE_METHOD, {
|
|
380
428
|
pane_id: paneId,
|
|
381
429
|
source: HERDR_SOURCE,
|
package/src/herdr/client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { connect } from "node:net";
|
|
3
3
|
|
|
4
|
-
export const HERDR_PROTOCOL_VERSION =
|
|
4
|
+
export const HERDR_PROTOCOL_VERSION = 19;
|
|
5
5
|
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
6
6
|
const MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
|
|
7
7
|
|
|
@@ -19,7 +19,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
19
19
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/** Typed, one-request-per-connection client for Herdr's protocol-
|
|
22
|
+
/** Typed, one-request-per-connection client for Herdr's protocol-19 JSONL socket. */
|
|
23
23
|
export class HerdrClient {
|
|
24
24
|
private protocolChecked = false;
|
|
25
25
|
|
|
@@ -103,7 +103,7 @@ export class HerdrClient {
|
|
|
103
103
|
});
|
|
104
104
|
socket.once("end", () => {
|
|
105
105
|
if (settled) return;
|
|
106
|
-
// Protocol
|
|
106
|
+
// Protocol 19 permits the final response to be terminated by EOF. The
|
|
107
107
|
// server normally emits JSONL, but older/current transports may omit the
|
|
108
108
|
// trailing newline when they close a one-shot connection.
|
|
109
109
|
try {
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "21.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
20
|
+
"version": "21.13.1",
|
|
21
|
+
"commit": "453dbf35d835d58bb787748bbcaad10da15ea4d3",
|
|
22
|
+
"shortCommit": "453dbf3",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.13.1",
|
|
25
|
+
"commitDate": "2026-09-06T12:50:33+00:00",
|
|
26
|
+
"buildDate": "2026-09-06T13:43:28.028Z",
|
|
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.
|
|
31
|
+
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/453dbf35d835d58bb787748bbcaad10da15ea4d3",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.13.1"
|
|
33
33
|
};
|