@f5-sales-demo/xcsh 21.15.1 → 21.17.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/CHANGELOG.md +8 -0
- package/package.json +8 -8
- package/src/browser/capabilities.generated.ts +5 -3
- package/src/browser/capabilities.json +4 -2
- package/src/browser/chat-conformance.json +40 -1
- package/src/browser/chat-handler.ts +54 -5
- package/src/browser/chat-protocol.ts +19 -1
- package/src/browser/host-profiles.ts +18 -4
- package/src/cli/session-picker.ts +2 -1
- package/src/debug/index.ts +22 -5
- package/src/debug/log-viewer.ts +46 -5
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/internal-urls/docs-index.generated.ts +1 -1
- package/src/internal-urls/extension-tools.generated.ts +1 -1
- package/src/lsp/client.ts +2 -9
- package/src/modes/components/extensions/extension-dashboard.ts +87 -12
- package/src/modes/components/extensions/extension-list.ts +48 -26
- package/src/modes/components/session-selector.ts +80 -18
- package/src/modes/controllers/btw-controller.ts +2 -7
- package/src/modes/controllers/event-controller.ts +18 -5
- package/src/modes/controllers/input-controller.ts +17 -7
- package/src/modes/controllers/login-model.ts +2 -2
- package/src/modes/controllers/login-options.ts +1 -1
- package/src/modes/controllers/selector-controller.ts +64 -41
- package/src/modes/controllers/vertex-login-flow.ts +1 -1
- package/src/modes/interactive-mode.ts +19 -6
- package/src/modes/print-mode.ts +3 -5
- package/src/modes/session-teardown.test.ts +54 -0
- package/src/modes/session-teardown.ts +26 -0
- package/src/prompts/system/system-prompt.md +4 -0
- package/src/session/agent-session.ts +13 -9
- package/src/session/final-answer.ts +15 -0
- package/src/session/session-manager.ts +100 -5
- package/src/tools/ask.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
|
|
41
41
|
### Fixed
|
|
42
42
|
|
|
43
|
+
- Made the session picker, extension dashboard, and debug-log viewer fullscreen and mouse-aware while
|
|
44
|
+
retaining their keyboard behavior, pinned chrome, and non-action row semantics
|
|
45
|
+
([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
|
|
46
|
+
- Persisted unsent editor drafts for one-shot resume recovery, unified interactive and signal-driven
|
|
47
|
+
teardown, made session disposal idempotent, and restored POSIX Ctrl-Z suspension with self-`SIGSTOP`.
|
|
48
|
+
Semantically ported from [can1357/oh-my-pi#4121](https://github.com/can1357/oh-my-pi/pull/4121)
|
|
49
|
+
and [#3463](https://github.com/can1357/oh-my-pi/pull/3463)
|
|
50
|
+
([#3748](https://github.com/f5-sales-demo/xcsh/issues/3748)).
|
|
43
51
|
- Prevented malformed task `submit_result` data, non-string write content, and invalid renderer path
|
|
44
52
|
values from crashing task, read, write, edit, inspect-image, or browser output. Semantically
|
|
45
53
|
ported from [can1357/oh-my-pi#1989](https://github.com/can1357/oh-my-pi/pull/1989),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.17.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.17.0",
|
|
65
|
+
"@f5-sales-demo/pi-ai": "21.17.0",
|
|
66
|
+
"@f5-sales-demo/pi-natives": "21.17.0",
|
|
67
|
+
"@f5-sales-demo/pi-resource-management": "21.17.0",
|
|
68
|
+
"@f5-sales-demo/pi-tui": "21.17.0",
|
|
69
|
+
"@f5-sales-demo/pi-utils": "21.17.0",
|
|
70
|
+
"@f5-sales-demo/xcsh-stats": "21.17.0",
|
|
71
71
|
"@mozilla/readability": "^0.6",
|
|
72
72
|
"@sinclair/typebox": "^0.34",
|
|
73
73
|
"@xterm/headless": "^6.0",
|
|
@@ -46,7 +46,7 @@ export interface ExtensionCapabilities {
|
|
|
46
46
|
|
|
47
47
|
export const EXTENSION_CAPABILITIES: ExtensionCapabilities = {
|
|
48
48
|
"version": "0.1.0",
|
|
49
|
-
"contractVersion": "2.
|
|
49
|
+
"contractVersion": "2.2.0",
|
|
50
50
|
"multiPortDiscovery": true,
|
|
51
51
|
"protocol": "tool_request/result",
|
|
52
52
|
"tools": [
|
|
@@ -804,7 +804,9 @@ export const EXTENSION_CAPABILITIES: ExtensionCapabilities = {
|
|
|
804
804
|
],
|
|
805
805
|
"messages": [
|
|
806
806
|
"chat_request",
|
|
807
|
+
"chat_message_start",
|
|
807
808
|
"chat_delta",
|
|
809
|
+
"chat_message_end",
|
|
808
810
|
"chat_done",
|
|
809
811
|
"chat_error",
|
|
810
812
|
"chat_stop",
|
|
@@ -821,7 +823,7 @@ export const EXTENSION_CAPABILITIES: ExtensionCapabilities = {
|
|
|
821
823
|
"media_asset_chunk",
|
|
822
824
|
"media_asset_error"
|
|
823
825
|
],
|
|
824
|
-
"description": "User ↔ xcsh chat over the bridge. The extension side panel sends chat_request (with mode and page-context snapshot); xcsh streams chat_delta tokens
|
|
826
|
+
"description": "User ↔ xcsh chat over the bridge. The extension side panel sends chat_request (with mode and page-context snapshot); xcsh streams ordered assistant items using chat_message_start, correlated chat_delta tokens, and chat_message_end. Each item declares commentary or final_answer phase. Exactly one terminal chat_done (with reference links) or chat_error closes the whole turn. Chat ids are prefixed \"c-\". Tool calls during a turn use the normal tool_request flow. chat_stop halts a streaming response. chat_tool_notice is emitted by the EXTENSION (the service worker) to the panel as a best-effort UI signal when a tool runs during a turn — it is NOT sent by xcsh; xcsh must not produce it to avoid double-rendering in the panel. Rich media uses chat_media descriptors and bounded media_asset_read/media_asset_chunk exchanges; media_asset_error reports unavailable assets.",
|
|
825
827
|
"promptHints": {
|
|
826
828
|
"role": "You are xcsh, the AI assistant embedded in the F5 Distributed Cloud (XC) console side panel. The user is viewing a live console page; help them drive automation and understand settings and their purpose.",
|
|
827
829
|
"grounding": "Every user message carries a page-context snapshot: url/path, title, a trimmed accessibility tree, and — when available — the live XC API resource JSON the page loaded (context.api.body). Treat context.api.body as the authoritative current state of the resource and ground answers in it instead of guessing; respect the truncated flags.",
|
|
@@ -839,6 +841,6 @@ export const EXTENSION_CAPABILITIES: ExtensionCapabilities = {
|
|
|
839
841
|
}
|
|
840
842
|
};
|
|
841
843
|
|
|
842
|
-
export const EXTENSION_CONTRACT_VERSION = "2.
|
|
844
|
+
export const EXTENSION_CONTRACT_VERSION = "2.2.0";
|
|
843
845
|
|
|
844
846
|
export const EXTENSION_TOOL_NAMES: readonly string[] = ["ping","capabilities","reload","debug_exec","detach","set_bridge_port","navigate","scroll_to","resize_window","tabs_list","tabs_create","tabs_close","click","click_element","click_xy","type_text","form_input","key_press","select_option","label_select","file_upload","read_ax","get_page_text","query_dom","find","wait_for","assert_text","screenshot","read_console","read_network","diag_suspension","diag_bridges","diag_activation","diag_ttft","wait_for_api_response","get_page_context","javascript_tool","browser_batch","set_explain_mode","annotate"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
|
-
"contractVersion": "2.
|
|
3
|
+
"contractVersion": "2.2.0",
|
|
4
4
|
"multiPortDiscovery": true,
|
|
5
5
|
"protocol": "tool_request/result",
|
|
6
6
|
"tools": [
|
|
@@ -758,7 +758,9 @@
|
|
|
758
758
|
],
|
|
759
759
|
"messages": [
|
|
760
760
|
"chat_request",
|
|
761
|
+
"chat_message_start",
|
|
761
762
|
"chat_delta",
|
|
763
|
+
"chat_message_end",
|
|
762
764
|
"chat_done",
|
|
763
765
|
"chat_error",
|
|
764
766
|
"chat_stop",
|
|
@@ -775,7 +777,7 @@
|
|
|
775
777
|
"media_asset_chunk",
|
|
776
778
|
"media_asset_error"
|
|
777
779
|
],
|
|
778
|
-
"description": "User ↔ xcsh chat over the bridge. The extension side panel sends chat_request (with mode and page-context snapshot); xcsh streams chat_delta tokens
|
|
780
|
+
"description": "User ↔ xcsh chat over the bridge. The extension side panel sends chat_request (with mode and page-context snapshot); xcsh streams ordered assistant items using chat_message_start, correlated chat_delta tokens, and chat_message_end. Each item declares commentary or final_answer phase. Exactly one terminal chat_done (with reference links) or chat_error closes the whole turn. Chat ids are prefixed \"c-\". Tool calls during a turn use the normal tool_request flow. chat_stop halts a streaming response. chat_tool_notice is emitted by the EXTENSION (the service worker) to the panel as a best-effort UI signal when a tool runs during a turn — it is NOT sent by xcsh; xcsh must not produce it to avoid double-rendering in the panel. Rich media uses chat_media descriptors and bounded media_asset_read/media_asset_chunk exchanges; media_asset_error reports unavailable assets.",
|
|
779
781
|
"promptHints": {
|
|
780
782
|
"role": "You are xcsh, the AI assistant embedded in the F5 Distributed Cloud (XC) console side panel. The user is viewing a live console page; help them drive automation and understand settings and their purpose.",
|
|
781
783
|
"grounding": "Every user message carries a page-context snapshot: url/path, title, a trimmed accessibility tree, and — when available — the live XC API resource JSON the page loaded (context.api.body). Treat context.api.body as the authoritative current state of the resource and ground answers in it instead of guessing; respect the truncated flags.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractVersion": "2.
|
|
2
|
+
"contractVersion": "2.2.0",
|
|
3
3
|
"schemas": {
|
|
4
4
|
"chat_request": {
|
|
5
5
|
"type": "object",
|
|
@@ -180,11 +180,22 @@
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
|
+
"chat_message_start": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"required": ["type", "id", "itemId", "phase"],
|
|
186
|
+
"properties": {
|
|
187
|
+
"type": { "const": "chat_message_start", "type": "string" },
|
|
188
|
+
"id": { "pattern": "^c-", "type": "string" },
|
|
189
|
+
"itemId": { "minLength": 1, "type": "string" },
|
|
190
|
+
"phase": { "enum": ["commentary", "final_answer"], "type": "string" }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
183
193
|
"chat_delta": {
|
|
184
194
|
"type": "object",
|
|
185
195
|
"required": [
|
|
186
196
|
"type",
|
|
187
197
|
"id",
|
|
198
|
+
"itemId",
|
|
188
199
|
"seq",
|
|
189
200
|
"delta"
|
|
190
201
|
],
|
|
@@ -197,6 +208,10 @@
|
|
|
197
208
|
"pattern": "^c-",
|
|
198
209
|
"type": "string"
|
|
199
210
|
},
|
|
211
|
+
"itemId": {
|
|
212
|
+
"minLength": 1,
|
|
213
|
+
"type": "string"
|
|
214
|
+
},
|
|
200
215
|
"seq": {
|
|
201
216
|
"type": "number"
|
|
202
217
|
},
|
|
@@ -205,6 +220,16 @@
|
|
|
205
220
|
}
|
|
206
221
|
}
|
|
207
222
|
},
|
|
223
|
+
"chat_message_end": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"required": ["type", "id", "itemId", "phase"],
|
|
226
|
+
"properties": {
|
|
227
|
+
"type": { "const": "chat_message_end", "type": "string" },
|
|
228
|
+
"id": { "pattern": "^c-", "type": "string" },
|
|
229
|
+
"itemId": { "minLength": 1, "type": "string" },
|
|
230
|
+
"phase": { "enum": ["commentary", "final_answer"], "type": "string" }
|
|
231
|
+
}
|
|
232
|
+
},
|
|
208
233
|
"chat_done": {
|
|
209
234
|
"type": "object",
|
|
210
235
|
"required": [
|
|
@@ -1179,18 +1204,32 @@
|
|
|
1179
1204
|
"type": "chat_stop",
|
|
1180
1205
|
"id": "c-1111"
|
|
1181
1206
|
},
|
|
1207
|
+
"chat_message_start": {
|
|
1208
|
+
"type": "chat_message_start",
|
|
1209
|
+
"id": "c-1111",
|
|
1210
|
+
"itemId": "c-1111:assistant:0",
|
|
1211
|
+
"phase": "commentary"
|
|
1212
|
+
},
|
|
1182
1213
|
"chat_delta": {
|
|
1183
1214
|
"type": "chat_delta",
|
|
1184
1215
|
"id": "c-1111",
|
|
1216
|
+
"itemId": "c-1111:assistant:0",
|
|
1185
1217
|
"seq": 0,
|
|
1186
1218
|
"delta": "This LB "
|
|
1187
1219
|
},
|
|
1188
1220
|
"chat_delta_1": {
|
|
1189
1221
|
"type": "chat_delta",
|
|
1190
1222
|
"id": "c-1111",
|
|
1223
|
+
"itemId": "c-1111:assistant:0",
|
|
1191
1224
|
"seq": 1,
|
|
1192
1225
|
"delta": "routes traffic."
|
|
1193
1226
|
},
|
|
1227
|
+
"chat_message_end": {
|
|
1228
|
+
"type": "chat_message_end",
|
|
1229
|
+
"id": "c-1111",
|
|
1230
|
+
"itemId": "c-1111:assistant:0",
|
|
1231
|
+
"phase": "commentary"
|
|
1232
|
+
},
|
|
1194
1233
|
"chat_done": {
|
|
1195
1234
|
"type": "chat_done",
|
|
1196
1235
|
"id": "c-1111",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import type { AssistantMessage, ImageContent } from "@f5-sales-demo/pi-ai";
|
|
3
|
+
import type { AssistantMessage, AssistantMessagePhase, ImageContent } from "@f5-sales-demo/pi-ai";
|
|
4
4
|
import { parseModelString } from "../config/model-resolver";
|
|
5
5
|
import { settings } from "../config/settings";
|
|
6
6
|
import { DEFAULT_MODEL_ROLE } from "../config/settings-schema";
|
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
type ChatErrorReason,
|
|
30
30
|
type ChatKeepalive,
|
|
31
31
|
type ChatMedia,
|
|
32
|
+
type ChatMessageEnd,
|
|
33
|
+
type ChatMessageStart,
|
|
32
34
|
type ChatRequest,
|
|
33
35
|
type Configure,
|
|
34
36
|
type ConfigureAck,
|
|
@@ -77,7 +79,8 @@ export function shouldSendKeepalive(nowMs: number, lastKeepaliveAt: number): boo
|
|
|
77
79
|
|
|
78
80
|
interface ActiveChat {
|
|
79
81
|
id: string;
|
|
80
|
-
seq: number
|
|
82
|
+
items: Map<number, { itemId: string; phase: AssistantMessagePhase; seq: number }>;
|
|
83
|
+
nextItem: number;
|
|
81
84
|
terminalSent: boolean;
|
|
82
85
|
unsubscribe: () => void;
|
|
83
86
|
entryAt: number;
|
|
@@ -215,7 +218,8 @@ export class ChatHandler {
|
|
|
215
218
|
|
|
216
219
|
const chat: ActiveChat = {
|
|
217
220
|
id,
|
|
218
|
-
|
|
221
|
+
items: new Map(),
|
|
222
|
+
nextItem: 0,
|
|
219
223
|
terminalSent: false,
|
|
220
224
|
unsubscribe: () => {},
|
|
221
225
|
entryAt: Date.now(),
|
|
@@ -359,11 +363,44 @@ export class ChatHandler {
|
|
|
359
363
|
|
|
360
364
|
if (event.type === "message_update" && "assistantMessageEvent" in event) {
|
|
361
365
|
const ame = event.assistantMessageEvent;
|
|
362
|
-
if (ame.type === "
|
|
366
|
+
if (ame.type === "text_start") {
|
|
367
|
+
const item = {
|
|
368
|
+
itemId: `${chat.id}:assistant:${chat.nextItem++}`,
|
|
369
|
+
phase: ame.phase ?? "final_answer",
|
|
370
|
+
seq: 0,
|
|
371
|
+
};
|
|
372
|
+
chat.items.set(ame.contentIndex, item);
|
|
373
|
+
this.#server.send({
|
|
374
|
+
type: "chat_message_start",
|
|
375
|
+
id: chat.id,
|
|
376
|
+
itemId: item.itemId,
|
|
377
|
+
phase: item.phase,
|
|
378
|
+
} satisfies ChatMessageStart);
|
|
379
|
+
} else if (ame.type === "text_delta") {
|
|
380
|
+
let item = chat.items.get(ame.contentIndex);
|
|
381
|
+
if (!item) {
|
|
382
|
+
// Legacy/synthetic streams can omit text_start (and older test or proxy
|
|
383
|
+
// emitters can omit partial entirely). Keep that compatibility path
|
|
384
|
+
// deterministic: missing metadata has final-answer semantics.
|
|
385
|
+
const content = ame.partial?.content?.[ame.contentIndex];
|
|
386
|
+
item = {
|
|
387
|
+
itemId: `${chat.id}:assistant:${chat.nextItem++}`,
|
|
388
|
+
phase: content?.type === "text" && content.phase === "commentary" ? "commentary" : "final_answer",
|
|
389
|
+
seq: 0,
|
|
390
|
+
};
|
|
391
|
+
chat.items.set(ame.contentIndex, item);
|
|
392
|
+
this.#server.send({
|
|
393
|
+
type: "chat_message_start",
|
|
394
|
+
id: chat.id,
|
|
395
|
+
itemId: item.itemId,
|
|
396
|
+
phase: item.phase,
|
|
397
|
+
} satisfies ChatMessageStart);
|
|
398
|
+
}
|
|
363
399
|
this.#server.send({
|
|
364
400
|
type: "chat_delta",
|
|
365
401
|
id: chat.id,
|
|
366
|
-
|
|
402
|
+
itemId: item.itemId,
|
|
403
|
+
seq: item.seq++,
|
|
367
404
|
delta: ame.delta,
|
|
368
405
|
} satisfies ChatDelta);
|
|
369
406
|
// TTFT Phase 2: first token out — emit the chat-segment spans once, keyed by
|
|
@@ -375,6 +412,18 @@ export class ChatHandler {
|
|
|
375
412
|
this.#server.send(s);
|
|
376
413
|
}
|
|
377
414
|
}
|
|
415
|
+
} else if (ame.type === "text_end") {
|
|
416
|
+
const item = chat.items.get(ame.contentIndex);
|
|
417
|
+
if (item) {
|
|
418
|
+
item.phase = ame.phase ?? item.phase;
|
|
419
|
+
this.#server.send({
|
|
420
|
+
type: "chat_message_end",
|
|
421
|
+
id: chat.id,
|
|
422
|
+
itemId: item.itemId,
|
|
423
|
+
phase: item.phase,
|
|
424
|
+
} satisfies ChatMessageEnd);
|
|
425
|
+
chat.items.delete(ame.contentIndex);
|
|
426
|
+
}
|
|
378
427
|
} else if (ame.type === "thinking_delta") {
|
|
379
428
|
// LIVENESS: the model is streaming extended thinking before any visible
|
|
380
429
|
// token. Emit a throttled chat_keepalive so the panel re-arms its
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wire protocol types for the Chrome extension chat side window.
|
|
3
|
-
* Contract source of truth: capabilities.json v2.
|
|
3
|
+
* Contract source of truth: capabilities.json v2.2.0.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import type { AssistantMessagePhase } from "@f5-sales-demo/pi-ai";
|
|
6
7
|
// Import the guards + wire types from the PURE leaf modules (not the `../host-tools`
|
|
7
8
|
// barrel), so this browser-safe contract can be consumed by a lib.dom (React)
|
|
8
9
|
// TypeScript program without pulling the RpcHostToolBridge's theme/tool-proxy graph.
|
|
@@ -198,13 +199,30 @@ export interface MediaAssetRead extends MediaAssetReadRequest {
|
|
|
198
199
|
// Outbound messages (xcsh → extension)
|
|
199
200
|
// ---------------------------------------------------------------------------
|
|
200
201
|
|
|
202
|
+
export type { AssistantMessagePhase };
|
|
203
|
+
|
|
204
|
+
export interface ChatMessageStart {
|
|
205
|
+
type: "chat_message_start";
|
|
206
|
+
id: string;
|
|
207
|
+
itemId: string;
|
|
208
|
+
phase: AssistantMessagePhase;
|
|
209
|
+
}
|
|
210
|
+
|
|
201
211
|
export interface ChatDelta {
|
|
202
212
|
type: "chat_delta";
|
|
203
213
|
id: string;
|
|
214
|
+
itemId: string;
|
|
204
215
|
seq: number;
|
|
205
216
|
delta: string;
|
|
206
217
|
}
|
|
207
218
|
|
|
219
|
+
export interface ChatMessageEnd {
|
|
220
|
+
type: "chat_message_end";
|
|
221
|
+
id: string;
|
|
222
|
+
itemId: string;
|
|
223
|
+
phase: AssistantMessagePhase;
|
|
224
|
+
}
|
|
225
|
+
|
|
208
226
|
export interface ChatDone {
|
|
209
227
|
type: "chat_done";
|
|
210
228
|
id: string;
|
|
@@ -40,6 +40,12 @@ export interface HostProfile {
|
|
|
40
40
|
systemPrompt: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const COMMENTARY_POLICY = `COMMENTARY POLICY:
|
|
44
|
+
- No commentary for trivial no-tool work; answer directly.
|
|
45
|
+
- Before non-trivial tool work, emit one concise commentary sentence describing the immediate action.
|
|
46
|
+
- During long work, report meaningful progress at natural intervals and avoid roughly 60 seconds of unexplained silence.
|
|
47
|
+
- Do not narrate every routine read or command. Keep the final answer self-contained.`;
|
|
48
|
+
|
|
43
49
|
/**
|
|
44
50
|
* Chrome-extension self-awareness prompt. Injected when xcsh is serving a browser
|
|
45
51
|
* chat (not the CLI TUI). Tells the LLM it's in a Chrome side panel alongside the
|
|
@@ -48,7 +54,9 @@ export interface HostProfile {
|
|
|
48
54
|
export const CHROME_CHAT_SYSTEM_PROMPT = `<system-directive>
|
|
49
55
|
You are still xcsh, the F5 Distributed Cloud technical coworker defined in your role above; this session is a Chrome side panel alongside the F5 XC console — an additional surface, not a new identity. Keep your xcsh/F5 purpose and adopt this browser context on top of it.
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
${COMMENTARY_POLICY}
|
|
58
|
+
|
|
59
|
+
For questions ("what page am I on?", "what is this?"), answer with text using the page context below — no tools needed. Only use tools when the user explicitly asks you to DO something (create, navigate, click, modify).
|
|
52
60
|
|
|
53
61
|
CONTEXT: The user sees a small chat window alongside the F5 XC admin console. You receive page-aware context each turn: the current URL (interpreted as workspace/resource/CRUD operation/namespace), the API resource JSON, and the accessibility tree. USE THIS CONTEXT to answer questions — don't call tools to find information you already have.
|
|
54
62
|
|
|
@@ -112,7 +120,9 @@ SAFETY:
|
|
|
112
120
|
const EXCEL_CHAT_SYSTEM_PROMPT = `<system-directive>
|
|
113
121
|
You are still xcsh, the F5 Distributed Cloud technical coworker defined in your role above. This session reaches you through a Microsoft Excel task pane instead of the terminal — an additional surface, not a new identity. Help the F5 SE with the OPEN workbook (often demo data, MEDDPICC sheets, account plans, pricing models) using the Excel host tools available to you. Keep your xcsh/F5 purpose AND adopt the Excel context on top of it.
|
|
114
122
|
|
|
115
|
-
|
|
123
|
+
${COMMENTARY_POLICY}
|
|
124
|
+
|
|
125
|
+
Answer questions from the data you read; only WRITE to the workbook when the user asks you to.
|
|
116
126
|
|
|
117
127
|
CONTEXT: Your workspace centers on the open workbook. Think in cells, ranges, and — above all — FORMULAS and their dependencies:
|
|
118
128
|
- Preserve formula relationships. When you change a cell, let dependent cells recompute; do not overwrite a formula with its current value unless asked.
|
|
@@ -143,7 +153,9 @@ BEHAVIOR:
|
|
|
143
153
|
const POWERPOINT_CHAT_SYSTEM_PROMPT = `<system-directive>
|
|
144
154
|
You are still xcsh, the F5 Distributed Cloud technical coworker defined in your role above. This session reaches you through a Microsoft PowerPoint task pane instead of the terminal — an additional surface, not a new identity. Help the F5 SE with the OPEN presentation (often a customer deck, demo walkthrough, or QBR) using the PowerPoint host tools available to you. Keep your xcsh/F5 purpose AND adopt the PowerPoint context on top of it.
|
|
145
155
|
|
|
146
|
-
|
|
156
|
+
${COMMENTARY_POLICY}
|
|
157
|
+
|
|
158
|
+
Answer questions from what you read; only edit the deck when the user asks you to.
|
|
147
159
|
|
|
148
160
|
CONTEXT: Your workspace centers on the open presentation. Think in slides, shapes, and the slide master:
|
|
149
161
|
- Conform any new content to the deck's existing template, fonts, and colors — do not introduce a different look.
|
|
@@ -172,7 +184,9 @@ BEHAVIOR:
|
|
|
172
184
|
const WORD_CHAT_SYSTEM_PROMPT = `<system-directive>
|
|
173
185
|
You are still xcsh, the F5 Distributed Cloud technical coworker defined in your role above. This session reaches you through a Microsoft Word task pane instead of the terminal — an additional surface, not a new identity. Help the F5 SE with the OPEN document (often a proposal, SOW, discovery write-up, or technical brief) using the Word host tools available to you. Keep your xcsh/F5 purpose AND adopt the Word context on top of it.
|
|
174
186
|
|
|
175
|
-
|
|
187
|
+
${COMMENTARY_POLICY}
|
|
188
|
+
|
|
189
|
+
Answer questions from what you read; only edit the document when the user asks you to.
|
|
176
190
|
|
|
177
191
|
CONTEXT: Your workspace centers on the open document. Think in paragraphs, the current selection, comments, and tracked changes:
|
|
178
192
|
- Preserve the document's styles and numbering — do not flatten formatting.
|
|
@@ -39,13 +39,14 @@ export async function selectSession(sessions: SessionInfo[]): Promise<string | n
|
|
|
39
39
|
await storage.deleteSessionWithArtifacts(session.path);
|
|
40
40
|
return true;
|
|
41
41
|
},
|
|
42
|
+
{ fillHeight: true, getTerminalRows: () => ui.terminal.rows },
|
|
42
43
|
);
|
|
43
44
|
return selector;
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
const selector = showSelector();
|
|
47
48
|
selector.setOnRequestRender(() => ui.requestRender());
|
|
48
|
-
ui.
|
|
49
|
+
ui.showOverlay(selector, { fullscreen: true, anchor: "top-left", width: "100%", maxHeight: "100%", margin: 0 });
|
|
49
50
|
ui.setFocus(selector);
|
|
50
51
|
ui.start();
|
|
51
52
|
return promise;
|
package/src/debug/index.ts
CHANGED
|
@@ -6,7 +6,15 @@
|
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
7
7
|
import * as url from "node:url";
|
|
8
8
|
import { getWorkProfile } from "@f5-sales-demo/pi-natives";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Container,
|
|
11
|
+
Loader,
|
|
12
|
+
type OverlayHandle,
|
|
13
|
+
type SelectItem,
|
|
14
|
+
SelectList,
|
|
15
|
+
Spacer,
|
|
16
|
+
Text,
|
|
17
|
+
} from "@f5-sales-demo/pi-tui";
|
|
10
18
|
import { getSessionsDir } from "@f5-sales-demo/pi-utils";
|
|
11
19
|
import type { ContextProfile } from "../context/profile";
|
|
12
20
|
import { DynamicBorder } from "../modes/components/dynamic-border";
|
|
@@ -302,18 +310,27 @@ export class DebugSelectorComponent extends Container {
|
|
|
302
310
|
return;
|
|
303
311
|
}
|
|
304
312
|
|
|
313
|
+
let overlay: OverlayHandle | undefined;
|
|
305
314
|
const viewer = new DebugLogViewerComponent({
|
|
306
315
|
logs,
|
|
307
|
-
terminalRows: this.ctx.ui.terminal.rows,
|
|
308
|
-
onExit: () =>
|
|
316
|
+
terminalRows: () => this.ctx.ui.terminal.rows,
|
|
317
|
+
onExit: () => {
|
|
318
|
+
overlay?.hide();
|
|
319
|
+
this.ctx.showDebugSelector();
|
|
320
|
+
},
|
|
309
321
|
onStatus: message => this.ctx.showStatus(message, { dim: true }),
|
|
310
322
|
onError: message => this.ctx.showError(message),
|
|
311
323
|
onUpdate: () => this.ctx.ui.requestRender(),
|
|
312
324
|
logSource,
|
|
313
325
|
});
|
|
314
326
|
|
|
315
|
-
this.ctx.
|
|
316
|
-
|
|
327
|
+
overlay = this.ctx.ui.showOverlay(viewer, {
|
|
328
|
+
fullscreen: true,
|
|
329
|
+
anchor: "top-left",
|
|
330
|
+
width: "100%",
|
|
331
|
+
maxHeight: "100%",
|
|
332
|
+
margin: 0,
|
|
333
|
+
});
|
|
317
334
|
this.ctx.ui.setFocus(viewer);
|
|
318
335
|
} catch (err) {
|
|
319
336
|
this.ctx.showError(`Failed to read logs: ${err instanceof Error ? err.message : String(err)}`);
|
package/src/debug/log-viewer.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { sanitizeText } from "@f5-sales-demo/pi-natives";
|
|
|
2
2
|
import {
|
|
3
3
|
type Component,
|
|
4
4
|
extractPrintableText,
|
|
5
|
+
type MouseRoutable,
|
|
5
6
|
matchesKey,
|
|
6
7
|
padding,
|
|
7
8
|
replaceTabs,
|
|
9
|
+
type SgrMouseEvent,
|
|
8
10
|
truncateToWidth,
|
|
9
11
|
visibleWidth,
|
|
10
12
|
} from "@f5-sales-demo/pi-tui";
|
|
@@ -184,6 +186,14 @@ export class DebugLogViewerModel {
|
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
moveCursorToRow(rowIndex: number): boolean {
|
|
190
|
+
const selectableIndex = this.#selectableRowIndices.indexOf(rowIndex);
|
|
191
|
+
if (selectableIndex < 0) return false;
|
|
192
|
+
this.#cursorSelectableIndex = selectableIndex;
|
|
193
|
+
this.#selectionAnchorSelectableIndex = undefined;
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
187
197
|
getSelectedLogIndices(): number[] {
|
|
188
198
|
if (this.#selectableRowIndices.length === 0) {
|
|
189
199
|
return [];
|
|
@@ -462,7 +472,7 @@ export class DebugLogViewerModel {
|
|
|
462
472
|
|
|
463
473
|
interface DebugLogViewerComponentOptions {
|
|
464
474
|
logs: string;
|
|
465
|
-
terminalRows: number;
|
|
475
|
+
terminalRows: number | (() => number);
|
|
466
476
|
onExit: () => void;
|
|
467
477
|
onStatus?: (message: string) => void;
|
|
468
478
|
onError?: (message: string) => void;
|
|
@@ -472,9 +482,9 @@ interface DebugLogViewerComponentOptions {
|
|
|
472
482
|
onUpdate?: () => void;
|
|
473
483
|
}
|
|
474
484
|
|
|
475
|
-
export class DebugLogViewerComponent implements Component {
|
|
485
|
+
export class DebugLogViewerComponent implements Component, MouseRoutable {
|
|
476
486
|
#model: DebugLogViewerModel;
|
|
477
|
-
#
|
|
487
|
+
#getTerminalRows: () => number;
|
|
478
488
|
#onExit: () => void;
|
|
479
489
|
#onStatus?: (message: string) => void;
|
|
480
490
|
#onError?: (message: string) => void;
|
|
@@ -484,6 +494,9 @@ export class DebugLogViewerComponent implements Component {
|
|
|
484
494
|
#scrollRowOffset = 0;
|
|
485
495
|
#statusMessage: string | undefined;
|
|
486
496
|
#loadingOlder = false;
|
|
497
|
+
#bodyRowStart = 5;
|
|
498
|
+
#bodyRowCount = 0;
|
|
499
|
+
#bodyLineToRowIndex: Array<number | undefined> = [];
|
|
487
500
|
|
|
488
501
|
constructor(options: DebugLogViewerComponentOptions) {
|
|
489
502
|
this.#logSource = options.logSource;
|
|
@@ -493,7 +506,8 @@ export class DebugLogViewerComponent implements Component {
|
|
|
493
506
|
hasOlderLogs: this.#logSource?.hasOlderLogs.bind(this.#logSource),
|
|
494
507
|
loadOlderLogs: this.#logSource?.loadOlderLogs.bind(this.#logSource),
|
|
495
508
|
});
|
|
496
|
-
|
|
509
|
+
const terminalRows = options.terminalRows;
|
|
510
|
+
this.#getTerminalRows = typeof terminalRows === "function" ? terminalRows : () => terminalRows;
|
|
497
511
|
this.#onExit = options.onExit;
|
|
498
512
|
this.#onStatus = options.onStatus;
|
|
499
513
|
this.#onError = options.onError;
|
|
@@ -610,6 +624,7 @@ export class DebugLogViewerComponent implements Component {
|
|
|
610
624
|
const bodyHeight = this.#bodyHeight();
|
|
611
625
|
|
|
612
626
|
const rows = this.#renderRows(innerWidth);
|
|
627
|
+
this.#bodyRowCount = bodyHeight;
|
|
613
628
|
const visibleBodyLines = this.#renderVisibleBodyLines(rows, innerWidth, bodyHeight);
|
|
614
629
|
|
|
615
630
|
return [
|
|
@@ -624,6 +639,28 @@ export class DebugLogViewerComponent implements Component {
|
|
|
624
639
|
];
|
|
625
640
|
}
|
|
626
641
|
|
|
642
|
+
routeMouse(event: SgrMouseEvent, _line: number, _col: number): void {
|
|
643
|
+
const overBody = event.row >= this.#bodyRowStart && event.row < this.#bodyRowStart + this.#bodyRowCount;
|
|
644
|
+
if (event.wheel !== null && overBody) {
|
|
645
|
+
this.#model.moveCursor(event.wheel * 3, false);
|
|
646
|
+
this.#ensureCursorVisible();
|
|
647
|
+
this.#onUpdate?.();
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (!event.leftClick || !overBody) return;
|
|
651
|
+
const rowIndex = this.#bodyLineToRowIndex[event.row - this.#bodyRowStart];
|
|
652
|
+
if (rowIndex === undefined || !this.#model.moveCursorToRow(rowIndex)) return;
|
|
653
|
+
const target = this.#model.rows[rowIndex];
|
|
654
|
+
if (target?.kind === "load-older") {
|
|
655
|
+
void this.#handleLoadOlder();
|
|
656
|
+
} else if (target?.kind === "log") {
|
|
657
|
+
if (this.#model.isExpanded(target.logIndex)) this.#model.collapseSelected();
|
|
658
|
+
else this.#model.expandSelected();
|
|
659
|
+
}
|
|
660
|
+
this.#ensureCursorVisible();
|
|
661
|
+
this.#onUpdate?.();
|
|
662
|
+
}
|
|
663
|
+
|
|
627
664
|
#summaryText(): string {
|
|
628
665
|
return ` # ${this.#model.visibleLogCount}/${this.#model.logCount} logs | ${this.#controlsText()}`;
|
|
629
666
|
}
|
|
@@ -650,7 +687,7 @@ export class DebugLogViewerComponent implements Component {
|
|
|
650
687
|
}
|
|
651
688
|
|
|
652
689
|
#bodyHeight(): number {
|
|
653
|
-
return Math.max(3, this.#
|
|
690
|
+
return Math.max(3, this.#getTerminalRows() - 8);
|
|
654
691
|
}
|
|
655
692
|
|
|
656
693
|
async #handleLoadOlder(additionalCount: number = LOAD_OLDER_CHUNK): Promise<void> {
|
|
@@ -785,8 +822,10 @@ export class DebugLogViewerComponent implements Component {
|
|
|
785
822
|
innerWidth: number,
|
|
786
823
|
bodyHeight: number,
|
|
787
824
|
): string[] {
|
|
825
|
+
this.#bodyLineToRowIndex = [];
|
|
788
826
|
const lines: string[] = [];
|
|
789
827
|
if (rows.length === 0) {
|
|
828
|
+
this.#bodyLineToRowIndex.push(undefined);
|
|
790
829
|
lines.push(this.#frameLine(theme.fg("muted", "no matches"), innerWidth));
|
|
791
830
|
}
|
|
792
831
|
for (let i = this.#scrollRowOffset; i < rows.length; i++) {
|
|
@@ -799,6 +838,7 @@ export class DebugLogViewerComponent implements Component {
|
|
|
799
838
|
if (lines.length >= bodyHeight) {
|
|
800
839
|
break;
|
|
801
840
|
}
|
|
841
|
+
this.#bodyLineToRowIndex.push(row.rowIndex);
|
|
802
842
|
lines.push(this.#frameLine(line, innerWidth));
|
|
803
843
|
}
|
|
804
844
|
|
|
@@ -808,6 +848,7 @@ export class DebugLogViewerComponent implements Component {
|
|
|
808
848
|
}
|
|
809
849
|
|
|
810
850
|
while (lines.length < bodyHeight) {
|
|
851
|
+
this.#bodyLineToRowIndex.push(undefined);
|
|
811
852
|
lines.push(this.#frameLine("", innerWidth));
|
|
812
853
|
}
|
|
813
854
|
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "21.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
20
|
+
"version": "21.17.0",
|
|
21
|
+
"commit": "2bad5cbd5994bd35b0c3c28432d35b05f3641a65",
|
|
22
|
+
"shortCommit": "2bad5cb",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.17.0",
|
|
25
|
+
"commitDate": "2026-09-07T05:17:42+00:00",
|
|
26
|
+
"buildDate": "2026-09-07T06:06:54.827Z",
|
|
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/2bad5cbd5994bd35b0c3c28432d35b05f3641a65",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.17.0"
|
|
33
33
|
};
|