@f5-sales-demo/xcsh 21.6.4 → 21.8.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/package.json +8 -8
- package/src/config/auto-config.ts +9 -3
- package/src/config/model-registry.ts +24 -6
- package/src/config/model-resolver.ts +18 -6
- package/src/extensibility/extensions/types.ts +5 -1
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/modes/acp/acp-agent.ts +3 -1
- package/src/modes/components/auth-link-presenter.ts +10 -0
- package/src/modes/components/context-add-wizard.ts +4 -31
- package/src/modes/components/model-selector.ts +346 -146
- package/src/modes/controllers/selector-controller.ts +55 -8
- package/src/services/xcsh-context.ts +29 -106
- package/src/session/agent-session.ts +1 -1
- package/src/session/session-manager.ts +4 -4
- package/src/thinking.ts +22 -5
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.8.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.8.0",
|
|
65
|
+
"@f5-sales-demo/pi-ai": "21.8.0",
|
|
66
|
+
"@f5-sales-demo/pi-natives": "21.8.0",
|
|
67
|
+
"@f5-sales-demo/pi-resource-management": "21.8.0",
|
|
68
|
+
"@f5-sales-demo/pi-tui": "21.8.0",
|
|
69
|
+
"@f5-sales-demo/pi-utils": "21.8.0",
|
|
70
|
+
"@f5-sales-demo/xcsh-stats": "21.8.0",
|
|
71
71
|
"@mozilla/readability": "^0.6",
|
|
72
72
|
"@sinclair/typebox": "^0.34",
|
|
73
73
|
"@xterm/headless": "^6.0",
|
|
@@ -20,7 +20,7 @@ import { hardenAgentConfigFileSync, writeAgentConfigFileSync } from "./agent-con
|
|
|
20
20
|
import { DEFAULT_MODEL_ROLE } from "./settings-schema";
|
|
21
21
|
|
|
22
22
|
/** Current config schema version. Bump when the generated format changes. */
|
|
23
|
-
export const CURRENT_CONFIG_VERSION =
|
|
23
|
+
export const CURRENT_CONFIG_VERSION = 5;
|
|
24
24
|
const LITELLM_CONFIG_DIR_MODE = 0o700;
|
|
25
25
|
const LITELLM_MODELS_FILE_MODE = 0o600;
|
|
26
26
|
|
|
@@ -86,8 +86,14 @@ export function generateModelsYml(baseUrl: string, options?: GenerateModelsYmlOp
|
|
|
86
86
|
" - image",
|
|
87
87
|
" thinking:",
|
|
88
88
|
" mode: effort",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
89
|
+
" defaultLevel: medium",
|
|
90
|
+
" supportedLevels:",
|
|
91
|
+
" - { effort: none, description: No reasoning }",
|
|
92
|
+
" - { effort: low, description: Light reasoning }",
|
|
93
|
+
" - { effort: medium, description: Balanced reasoning }",
|
|
94
|
+
" - { effort: high, description: Deep reasoning }",
|
|
95
|
+
" - { effort: xhigh, description: Very deep reasoning }",
|
|
96
|
+
" - { effort: max, description: Maximum reasoning }",
|
|
91
97
|
" contextWindow: 1050000",
|
|
92
98
|
" maxTokens: 128000",
|
|
93
99
|
" compat:",
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getBundledProviders,
|
|
12
12
|
googleAntigravityModelManagerOptions,
|
|
13
13
|
googleGeminiCliModelManagerOptions,
|
|
14
|
+
googleVertexModelManagerOptions,
|
|
14
15
|
type Model,
|
|
15
16
|
type ModelManagerOptions,
|
|
16
17
|
type ModelRefreshStrategy,
|
|
@@ -169,11 +170,13 @@ const OpenAICompatSchema = Type.Object({
|
|
|
169
170
|
});
|
|
170
171
|
|
|
171
172
|
const EffortSchema = Type.Union([
|
|
173
|
+
Type.Literal("none"),
|
|
172
174
|
Type.Literal("minimal"),
|
|
173
175
|
Type.Literal("low"),
|
|
174
176
|
Type.Literal("medium"),
|
|
175
177
|
Type.Literal("high"),
|
|
176
178
|
Type.Literal("xhigh"),
|
|
179
|
+
Type.Literal("max"),
|
|
177
180
|
]);
|
|
178
181
|
|
|
179
182
|
const ThinkingControlModeSchema = Type.Union([
|
|
@@ -185,10 +188,14 @@ const ThinkingControlModeSchema = Type.Union([
|
|
|
185
188
|
]);
|
|
186
189
|
|
|
187
190
|
const ModelThinkingSchema = Type.Object({
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
supportedLevels: Type.Array(
|
|
192
|
+
Type.Object({
|
|
193
|
+
effort: EffortSchema,
|
|
194
|
+
description: Type.String({ minLength: 1 }),
|
|
195
|
+
}),
|
|
196
|
+
{ minItems: 1 },
|
|
197
|
+
),
|
|
198
|
+
defaultLevel: EffortSchema,
|
|
192
199
|
mode: ThinkingControlModeSchema,
|
|
193
200
|
});
|
|
194
201
|
|
|
@@ -1402,6 +1409,11 @@ export class ModelRegistry {
|
|
|
1402
1409
|
resolveKey: (value: string | undefined) => string | undefined;
|
|
1403
1410
|
createOptions: (key: string) => ModelManagerOptions<Api>;
|
|
1404
1411
|
}> = [
|
|
1412
|
+
{
|
|
1413
|
+
providerId: "google-vertex",
|
|
1414
|
+
resolveKey: value => value,
|
|
1415
|
+
createOptions: apiKey => googleVertexModelManagerOptions({ apiKey }),
|
|
1416
|
+
},
|
|
1405
1417
|
{
|
|
1406
1418
|
providerId: "google-antigravity",
|
|
1407
1419
|
resolveKey: extractGoogleOAuthToken,
|
|
@@ -1471,6 +1483,7 @@ export class ModelRegistry {
|
|
|
1471
1483
|
options: ModelManagerOptions<Api>,
|
|
1472
1484
|
strategy: ModelRefreshStrategy,
|
|
1473
1485
|
): Promise<Model<Api>[]> {
|
|
1486
|
+
const previous = this.#providerDiscoveryStates.get(options.providerId);
|
|
1474
1487
|
try {
|
|
1475
1488
|
const manager = createModelManager({ ...options, cacheDbPath: this.#cacheDbPath });
|
|
1476
1489
|
const result = await manager.refresh(strategy);
|
|
@@ -1487,12 +1500,17 @@ export class ModelRegistry {
|
|
|
1487
1500
|
});
|
|
1488
1501
|
return models;
|
|
1489
1502
|
} catch (error) {
|
|
1503
|
+
const retained =
|
|
1504
|
+
previous && (previous.status === "ok" || previous.status === "cached") && previous.models.length > 0
|
|
1505
|
+
? previous
|
|
1506
|
+
: undefined;
|
|
1490
1507
|
this.#providerDiscoveryStates.set(options.providerId, {
|
|
1491
1508
|
provider: options.providerId,
|
|
1492
|
-
status: "unavailable",
|
|
1509
|
+
status: retained ? "cached" : "unavailable",
|
|
1493
1510
|
optional: false,
|
|
1494
1511
|
stale: true,
|
|
1495
|
-
|
|
1512
|
+
fetchedAt: retained?.fetchedAt,
|
|
1513
|
+
models: retained?.models ?? [],
|
|
1496
1514
|
error: error instanceof Error ? error.message : String(error),
|
|
1497
1515
|
});
|
|
1498
1516
|
logger.warn("model discovery failed for provider", {
|
|
@@ -601,11 +601,23 @@ export function resolveModelRoleValue(
|
|
|
601
601
|
modelRegistry: options?.modelRegistry,
|
|
602
602
|
});
|
|
603
603
|
if (resolved.model) {
|
|
604
|
+
let thinkingLevel = resolved.thinkingLevel;
|
|
605
|
+
if (resolved.explicitThinkingLevel) {
|
|
606
|
+
try {
|
|
607
|
+
thinkingLevel =
|
|
608
|
+
resolveThinkingLevelForModel(resolved.model, resolved.thinkingLevel) ?? resolved.thinkingLevel;
|
|
609
|
+
} catch (error) {
|
|
610
|
+
return {
|
|
611
|
+
model: resolved.model,
|
|
612
|
+
thinkingLevel: undefined,
|
|
613
|
+
explicitThinkingLevel: true,
|
|
614
|
+
warning: error instanceof Error ? error.message : String(error),
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
}
|
|
604
618
|
return {
|
|
605
619
|
model: resolved.model,
|
|
606
|
-
thinkingLevel
|
|
607
|
-
? (resolveThinkingLevelForModel(resolved.model, resolved.thinkingLevel) ?? resolved.thinkingLevel)
|
|
608
|
-
: resolved.thinkingLevel,
|
|
620
|
+
thinkingLevel,
|
|
609
621
|
explicitThinkingLevel: resolved.explicitThinkingLevel,
|
|
610
622
|
warning: resolved.warning,
|
|
611
623
|
};
|
|
@@ -695,18 +707,18 @@ export function resolveModelOverride(
|
|
|
695
707
|
modelPatterns: string[],
|
|
696
708
|
modelRegistry: ModelLookupRegistry,
|
|
697
709
|
settings?: Settings,
|
|
698
|
-
): { model?: Model<Api>; thinkingLevel?: ThinkingLevel; explicitThinkingLevel: boolean } {
|
|
710
|
+
): { model?: Model<Api>; thinkingLevel?: ThinkingLevel; explicitThinkingLevel: boolean; warning?: string } {
|
|
699
711
|
if (modelPatterns.length === 0) return { explicitThinkingLevel: false };
|
|
700
712
|
const availableModels = modelRegistry.getAvailable();
|
|
701
713
|
const matchPreferences = { usageOrder: settings?.getStorage()?.getModelUsageOrder() };
|
|
702
714
|
for (const pattern of modelPatterns) {
|
|
703
|
-
const { model, thinkingLevel, explicitThinkingLevel } = resolveModelRoleValue(pattern, availableModels, {
|
|
715
|
+
const { model, thinkingLevel, explicitThinkingLevel, warning } = resolveModelRoleValue(pattern, availableModels, {
|
|
704
716
|
settings,
|
|
705
717
|
matchPreferences,
|
|
706
718
|
modelRegistry,
|
|
707
719
|
});
|
|
708
720
|
if (model) {
|
|
709
|
-
return { model, thinkingLevel, explicitThinkingLevel };
|
|
721
|
+
return { model, thinkingLevel, explicitThinkingLevel, warning };
|
|
710
722
|
}
|
|
711
723
|
}
|
|
712
724
|
return { explicitThinkingLevel: false };
|
|
@@ -1183,7 +1183,11 @@ export interface ExtensionAPI {
|
|
|
1183
1183
|
* id: "claude-sonnet-4@20250514",
|
|
1184
1184
|
* name: "Claude Sonnet 4 (Vertex)",
|
|
1185
1185
|
* reasoning: true,
|
|
1186
|
-
* thinking: { mode: "anthropic-adaptive",
|
|
1186
|
+
* thinking: { mode: "anthropic-adaptive", defaultLevel: "medium", supportedLevels: [
|
|
1187
|
+
* { effort: "low", description: "Light reasoning" },
|
|
1188
|
+
* { effort: "medium", description: "Balanced reasoning" },
|
|
1189
|
+
* { effort: "high", description: "Deep reasoning" },
|
|
1190
|
+
* ] },
|
|
1187
1191
|
* input: ["text", "image"],
|
|
1188
1192
|
* cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
1189
1193
|
* contextWindow: 200000,
|
|
@@ -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.8.0",
|
|
21
|
+
"commit": "1fbf4e99094587555f6270619aa5e24a8da8f340",
|
|
22
|
+
"shortCommit": "1fbf4e9",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.8.0",
|
|
25
|
+
"commitDate": "2026-09-03T01:24:51+00:00",
|
|
26
|
+
"buildDate": "2026-09-03T01:59:18.972Z",
|
|
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/1fbf4e99094587555f6270619aa5e24a8da8f340",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.8.0"
|
|
33
33
|
};
|
|
@@ -674,7 +674,9 @@ export class AcpAgent implements Agent {
|
|
|
674
674
|
|
|
675
675
|
#buildThinkingOptions(session: AgentSession): Array<{ value: string; name: string; description?: string }> {
|
|
676
676
|
return [
|
|
677
|
-
...(session.model?.thinking?.
|
|
677
|
+
...(session.model?.thinking?.supportedLevels.some(level => level.effort === "none")
|
|
678
|
+
? [{ value: THINKING_OFF, name: "Off" }]
|
|
679
|
+
: []),
|
|
678
680
|
...session.getAvailableThinkingLevels().map(level => ({
|
|
679
681
|
value: level,
|
|
680
682
|
name: level,
|
|
@@ -34,3 +34,13 @@ export function presentAuthLink(
|
|
|
34
34
|
// Clipboard access is best-effort; the OSC 8 link remains available.
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
/** Render device verification details so they remain usable without hyperlink or clipboard support. */
|
|
39
|
+
export function presentDeviceCode(container: AuthLinkContainer, url: string, userCode: string): void {
|
|
40
|
+
const hyperlink = `\x1b]8;;${url}\x07${url}\x1b]8;;\x07`;
|
|
41
|
+
container.addChild(new Text(theme.fg("accent", hyperlink), 1, 0));
|
|
42
|
+
container.addChild(new Text(theme.fg("warning", `One-time code: ${theme.bold(userCode)}`), 1, 0));
|
|
43
|
+
container.addChild(
|
|
44
|
+
new Text(theme.fg("dim", "Press c at the prompt to copy; the code remains readable above."), 1, 0),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Container, Input, matchesKey, Spacer, Text, TruncatedText } from "@f5-sales-demo/pi-tui";
|
|
2
|
+
import { normalizeXcshApiUrlInput, normalizeXcshCredentialInput } from "@f5-sales-demo/pi-utils/xcsh-auth";
|
|
2
3
|
import type { TokenValidationResult, XCSHContext } from "../../services/xcsh-context";
|
|
3
4
|
import {
|
|
4
5
|
deriveTenantFromUrl,
|
|
5
6
|
isSensitiveEnvKey,
|
|
6
|
-
normalizeApiUrl,
|
|
7
7
|
XCSH_API_TOKEN,
|
|
8
8
|
XCSH_API_URL,
|
|
9
9
|
XCSH_CONSOLE_PASSWORD,
|
|
@@ -27,40 +27,13 @@ type WizardCredentialKey =
|
|
|
27
27
|
* tokens that contain or end with `=`.
|
|
28
28
|
*/
|
|
29
29
|
export function normalizeWizardCredential(value: string, expectedKey: WizardCredentialKey): string | null {
|
|
30
|
-
|
|
31
|
-
const trimmed = value.trim();
|
|
32
|
-
if (!trimmed) return "";
|
|
33
|
-
const assignment = trimmed.match(/^(?:#\s*)?(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
34
|
-
const isShellAssignment =
|
|
35
|
-
assignment !== null &&
|
|
36
|
-
(assignment[1] === expectedKey || assignment[1].startsWith("XCSH_") || /^(?:#\s*)?(?:export\s+)/.test(trimmed));
|
|
37
|
-
if (assignment && isShellAssignment) {
|
|
38
|
-
if (assignment[1] !== expectedKey) return null;
|
|
39
|
-
return unwrapWholeValueQuotes(assignment[2].trim());
|
|
40
|
-
}
|
|
41
|
-
if (trimmed === expectedKey || trimmed === `export ${expectedKey}` || trimmed === `#${expectedKey}`) return null;
|
|
42
|
-
// A shell-style assignment for another field must not silently become a token.
|
|
43
|
-
if (/^(?:#\s*)?(?:export\s+)?XCSH_[A-Za-z0-9_]*\s*=/.test(trimmed)) return null;
|
|
44
|
-
return unwrapWholeValueQuotes(trimmed);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function unwrapWholeValueQuotes(value: string): string | null {
|
|
48
|
-
if (value.startsWith('"') || value.endsWith('"') || value.startsWith("'") || value.endsWith("'")) {
|
|
49
|
-
if (!(value.length >= 2 && value[0] === value.at(-1))) return null;
|
|
50
|
-
}
|
|
51
|
-
if (
|
|
52
|
-
value.length >= 2 &&
|
|
53
|
-
((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'")))
|
|
54
|
-
) {
|
|
55
|
-
return value.slice(1, -1);
|
|
56
|
-
}
|
|
57
|
-
return value;
|
|
30
|
+
return normalizeXcshCredentialInput(value, expectedKey);
|
|
58
31
|
}
|
|
59
32
|
|
|
60
33
|
export function normalizeWizardUrl(value: string): string | null {
|
|
61
|
-
const normalized =
|
|
34
|
+
const normalized = normalizeXcshApiUrlInput(value);
|
|
62
35
|
if (normalized === null || validateWizardUrl(normalized)) return null;
|
|
63
|
-
return
|
|
36
|
+
return normalized;
|
|
64
37
|
}
|
|
65
38
|
|
|
66
39
|
export function validateWizardUrl(url: string): string | null {
|