@f5-sales-demo/xcsh 21.11.8 → 21.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/xcsh.ts
CHANGED
|
File without changes
|
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.12.0",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
64
|
-
"@f5-sales-demo/pi-agent-core": "21.
|
|
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.12.0",
|
|
65
|
+
"@f5-sales-demo/pi-ai": "21.12.0",
|
|
66
|
+
"@f5-sales-demo/pi-natives": "21.12.0",
|
|
67
|
+
"@f5-sales-demo/pi-resource-management": "21.12.0",
|
|
68
|
+
"@f5-sales-demo/pi-tui": "21.12.0",
|
|
69
|
+
"@f5-sales-demo/pi-utils": "21.12.0",
|
|
70
|
+
"@f5-sales-demo/xcsh-stats": "21.12.0",
|
|
71
71
|
"@mozilla/readability": "^0.6",
|
|
72
72
|
"@sinclair/typebox": "^0.34",
|
|
73
73
|
"@xterm/headless": "^6.0",
|
package/src/cli/args.ts
CHANGED
|
@@ -446,7 +446,7 @@ export function getExtraHelpText(): string {
|
|
|
446
446
|
PI_NO_PTY - Disable PTY-based interactive bash execution
|
|
447
447
|
|
|
448
448
|
For complete environment variable reference, see:
|
|
449
|
-
${chalk.dim("docs/environment-
|
|
449
|
+
${chalk.dim("docs/en/configure-secure/environment-reference.mdx")}
|
|
450
450
|
${chalk.bold("Available Tools (default-enabled unless noted):")}
|
|
451
451
|
read - Read file contents
|
|
452
452
|
bash - Execute bash commands
|
|
@@ -56,10 +56,14 @@ const HERDR_AGENT_LABEL = "xcsh";
|
|
|
56
56
|
// herdr keys its official lifecycle-authority and session-resume plumbing on the
|
|
57
57
|
// `herdr:<agent>` source convention, so report as "herdr:xcsh" (not bare "xcsh").
|
|
58
58
|
const HERDR_SOURCE = "herdr:xcsh";
|
|
59
|
+
const PHASE_SOURCE = "xcsh:phase";
|
|
59
60
|
const REPORT_METHOD = "pane.report_agent";
|
|
61
|
+
const METADATA_METHOD = "pane.report_metadata";
|
|
60
62
|
const SESSION_METHOD = "pane.report_agent_session";
|
|
61
63
|
const RELEASE_METHOD = "pane.release_agent";
|
|
62
64
|
const SOCKET_TIMEOUT_MS = 2000;
|
|
65
|
+
const PHASE_LABEL_TTL_MS = 60_000;
|
|
66
|
+
const SETTLED_TURN_RECONCILE_DELAY_MS = 25;
|
|
63
67
|
const PROMPT_BLOCKED_REASONS = {
|
|
64
68
|
select: "selection required",
|
|
65
69
|
confirm: "confirmation required",
|
|
@@ -139,12 +143,23 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
139
143
|
// process in a pane always starts above whatever the previous process reached.
|
|
140
144
|
// Matches the pi/omp reporters and stays well inside Number.MAX_SAFE_INTEGER.
|
|
141
145
|
let seq = Date.now() * 1000;
|
|
146
|
+
// Separate monotonic sequence for metadata frames (keyed by source in Herdr).
|
|
147
|
+
let phaseSeq = Date.now() * 1000;
|
|
142
148
|
// Retains the fixed reason while an interactive prompt awaits the user, so an
|
|
143
149
|
// agent_end duplicate cannot erase herdr's stored blocked message.
|
|
144
150
|
let promptBlockedReason: string | undefined;
|
|
145
151
|
// Last session ref already delivered, so repeated lifecycle events do not
|
|
146
152
|
// re-send an unchanged ref every turn.
|
|
147
153
|
let lastSessionRefKey: string | undefined;
|
|
154
|
+
// Herdr only anchors a new full-lifecycle authority after the first session
|
|
155
|
+
// reference identifies how the session began. XCSH creates that reference
|
|
156
|
+
// lazily, so retain the startup marker until there is a concrete ref to send.
|
|
157
|
+
let pendingSessionStartSource: "startup" | undefined = "startup";
|
|
158
|
+
// `agent_end` is the primary completion signal. Keep one deferred check from
|
|
159
|
+
// `turn_end` as well: some interactive UI paths render the completed response
|
|
160
|
+
// before their agent-end extension callback has drained. The check consults
|
|
161
|
+
// XCSH's own streaming state, so a tool boundary cannot be mistaken for idle.
|
|
162
|
+
let settledTurnReconcileTimer: ReturnType<typeof setTimeout> | undefined;
|
|
148
163
|
// Serializes frames: herdr compares `seq` across all methods for this source,
|
|
149
164
|
// so frames must reach it in the order they were generated.
|
|
150
165
|
let queue: Promise<void> = Promise.resolve();
|
|
@@ -187,6 +202,32 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
187
202
|
seq: seq++,
|
|
188
203
|
});
|
|
189
204
|
|
|
205
|
+
const reportMetadata = (params: Record<string, unknown>): Promise<void> => {
|
|
206
|
+
const socketPath = process.env.HERDR_SOCKET_PATH;
|
|
207
|
+
if (!socketPath) {
|
|
208
|
+
return Promise.resolve();
|
|
209
|
+
}
|
|
210
|
+
const frame = {
|
|
211
|
+
pane_id: paneId,
|
|
212
|
+
source: PHASE_SOURCE,
|
|
213
|
+
applies_to_source: HERDR_SOURCE,
|
|
214
|
+
seq: phaseSeq++,
|
|
215
|
+
...params,
|
|
216
|
+
};
|
|
217
|
+
return enqueue(() => sendToHerdrSocket(socketPath, METADATA_METHOD, frame, onError));
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const setPhaseLabel = (label: string): Promise<void> =>
|
|
221
|
+
reportMetadata({
|
|
222
|
+
state_labels: { working: label },
|
|
223
|
+
ttl_ms: PHASE_LABEL_TTL_MS,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const clearPhaseLabel = (): Promise<void> =>
|
|
227
|
+
reportMetadata({
|
|
228
|
+
clear_state_labels: true,
|
|
229
|
+
});
|
|
230
|
+
|
|
190
231
|
// Report the current session's identity so herdr can resume this pane
|
|
191
232
|
// (`xcsh --resume=<session>`) after a server restart. This is sent only over
|
|
192
233
|
// the socket; if herdr did not inject a socket path we skip it (state still
|
|
@@ -232,11 +273,29 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
232
273
|
source: HERDR_SOURCE,
|
|
233
274
|
agent: HERDR_AGENT_LABEL,
|
|
234
275
|
seq: seq++,
|
|
276
|
+
...(pendingSessionStartSource === undefined ? {} : { session_start_source: pendingSessionStartSource }),
|
|
235
277
|
...sessionRef,
|
|
236
278
|
};
|
|
279
|
+
pendingSessionStartSource = undefined;
|
|
237
280
|
return enqueue(() => sendToHerdrSocket(socketPath, SESSION_METHOD, frame, onError));
|
|
238
281
|
};
|
|
239
282
|
|
|
283
|
+
const clearSettledTurnReconcile = (): void => {
|
|
284
|
+
if (settledTurnReconcileTimer !== undefined) {
|
|
285
|
+
clearTimeout(settledTurnReconcileTimer);
|
|
286
|
+
settledTurnReconcileTimer = undefined;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const scheduleSettledTurnReconcile = (ctx: ExtensionContext): void => {
|
|
291
|
+
if (settledTurnReconcileTimer !== undefined) return;
|
|
292
|
+
settledTurnReconcileTimer = setTimeout(() => {
|
|
293
|
+
settledTurnReconcileTimer = undefined;
|
|
294
|
+
if (promptBlockedReason || !ctx.isIdle()) return;
|
|
295
|
+
void report("idle").then(() => reportSession(ctx));
|
|
296
|
+
}, SETTLED_TURN_RECONCILE_DELAY_MS);
|
|
297
|
+
};
|
|
298
|
+
|
|
240
299
|
// Announce presence and session identity as soon as the session is initialized.
|
|
241
300
|
pi.on("session_start", async (_event, ctx) => {
|
|
242
301
|
await report("idle");
|
|
@@ -246,6 +305,7 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
246
305
|
// Busy while the agent loop is streaming a response. Re-report session identity
|
|
247
306
|
// in case the active session file changed (e.g. after /new, /resume, or /fork).
|
|
248
307
|
pi.on("agent_start", async (_event, ctx) => {
|
|
308
|
+
clearSettledTurnReconcile();
|
|
249
309
|
await report("working");
|
|
250
310
|
await reportSession(ctx);
|
|
251
311
|
});
|
|
@@ -258,6 +318,12 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
258
318
|
await reportSession(ctx);
|
|
259
319
|
});
|
|
260
320
|
|
|
321
|
+
// Reconcile completion after the UI has had a chance to clear its streaming
|
|
322
|
+
// flag. This is deliberately non-blocking so it cannot delay the next turn.
|
|
323
|
+
pi.on("turn_end", (_event, ctx) => {
|
|
324
|
+
scheduleSettledTurnReconcile(ctx);
|
|
325
|
+
});
|
|
326
|
+
|
|
261
327
|
// An interactive prompt (permission gate, ask tool, confirm/input) is
|
|
262
328
|
// awaiting the user: that is herdr's "needs attention" (blocked) state.
|
|
263
329
|
pi.on("user_prompt_start", event => {
|
|
@@ -271,6 +337,39 @@ export default function herdrReporter(pi: ExtensionAPI): void {
|
|
|
271
337
|
await reportSession(ctx);
|
|
272
338
|
});
|
|
273
339
|
|
|
340
|
+
// Transient phase-label metadata (thinking / tool / retry / cleanup):
|
|
341
|
+
pi.on("message_update", async event => {
|
|
342
|
+
if (event.assistantMessageEvent.type === "thinking_start") {
|
|
343
|
+
await setPhaseLabel("thinking");
|
|
344
|
+
} else if (event.assistantMessageEvent.type === "thinking_end") {
|
|
345
|
+
await clearPhaseLabel();
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
pi.on("tool_execution_start", async () => {
|
|
350
|
+
await setPhaseLabel("tool");
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
pi.on("tool_execution_end", async () => {
|
|
354
|
+
await clearPhaseLabel();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
pi.on("auto_retry_start", async () => {
|
|
358
|
+
await setPhaseLabel("retry");
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
pi.on("auto_retry_end", async () => {
|
|
362
|
+
await clearPhaseLabel();
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
pi.on("auto_compaction_start", async () => {
|
|
366
|
+
await setPhaseLabel("cleanup");
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
pi.on("auto_compaction_end", async () => {
|
|
370
|
+
await clearPhaseLabel();
|
|
371
|
+
});
|
|
372
|
+
|
|
274
373
|
// Relinquish pane authority so herdr stops showing xcsh once we exit.
|
|
275
374
|
pi.on("session_shutdown", () => {
|
|
276
375
|
void send(RELEASE_METHOD, {
|
|
@@ -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.12.0",
|
|
21
|
+
"commit": "08e999ba3cd4ca2872fe2306da72923558b62b63",
|
|
22
|
+
"shortCommit": "08e999b",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.12.0",
|
|
25
|
+
"commitDate": "2026-09-05T23:05:01+00:00",
|
|
26
|
+
"buildDate": "2026-09-06T00:07:00.377Z",
|
|
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/08e999ba3cd4ca2872fe2306da72923558b62b63",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.12.0"
|
|
33
33
|
};
|