@f5xc-salesdemos/xcsh 17.1.1 → 17.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5xc-salesdemos/xcsh",
4
- "version": "17.1.1",
4
+ "version": "17.1.2",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/f5xc-salesdemos/xcsh",
7
7
  "author": "Can Boluk",
@@ -46,12 +46,12 @@
46
46
  "dependencies": {
47
47
  "@agentclientprotocol/sdk": "0.16.1",
48
48
  "@mozilla/readability": "^0.6",
49
- "@f5xc-salesdemos/xcsh-stats": "17.1.1",
50
- "@f5xc-salesdemos/pi-agent-core": "17.1.1",
51
- "@f5xc-salesdemos/pi-ai": "17.1.1",
52
- "@f5xc-salesdemos/pi-natives": "17.1.1",
53
- "@f5xc-salesdemos/pi-tui": "17.1.1",
54
- "@f5xc-salesdemos/pi-utils": "17.1.1",
49
+ "@f5xc-salesdemos/xcsh-stats": "17.1.2",
50
+ "@f5xc-salesdemos/pi-agent-core": "17.1.2",
51
+ "@f5xc-salesdemos/pi-ai": "17.1.2",
52
+ "@f5xc-salesdemos/pi-natives": "17.1.2",
53
+ "@f5xc-salesdemos/pi-tui": "17.1.2",
54
+ "@f5xc-salesdemos/pi-utils": "17.1.2",
55
55
  "@sinclair/typebox": "^0.34",
56
56
  "@xterm/headless": "^6.0",
57
57
  "ajv": "^8.18",
@@ -247,7 +247,12 @@ const ModelOverrideSchema = Type.Object({
247
247
  type ModelOverride = Static<typeof ModelOverrideSchema>;
248
248
 
249
249
  const ProviderDiscoverySchema = Type.Object({
250
- type: Type.Union([Type.Literal("ollama"), Type.Literal("llama.cpp"), Type.Literal("lm-studio")]),
250
+ type: Type.Union([
251
+ Type.Literal("ollama"),
252
+ Type.Literal("llama.cpp"),
253
+ Type.Literal("lm-studio"),
254
+ Type.Literal("openai-compat"),
255
+ ]),
251
256
  });
252
257
 
253
258
  const ProviderAuthSchema = Type.Union([Type.Literal("apiKey"), Type.Literal("none")]);
@@ -1308,6 +1313,8 @@ export class ModelRegistry {
1308
1313
  return this.#discoverLlamaCppModels(providerConfig);
1309
1314
  case "lm-studio":
1310
1315
  return this.#discoverLmStudioModels(providerConfig);
1316
+ case "openai-compat":
1317
+ return this.#discoverOpenAICompatModels(providerConfig);
1311
1318
  }
1312
1319
  }
1313
1320
 
@@ -1669,6 +1676,53 @@ export class ModelRegistry {
1669
1676
  return this.#applyProviderModelOverrides(providerConfig.provider, discovered);
1670
1677
  }
1671
1678
 
1679
+ async #discoverOpenAICompatModels(providerConfig: DiscoveryProviderConfig): Promise<Model<Api>[]> {
1680
+ const baseUrl = (providerConfig.baseUrl ?? "").replace(/\/+$/, "");
1681
+ if (!baseUrl) {
1682
+ throw new Error("openai-compat discovery requires a baseUrl");
1683
+ }
1684
+
1685
+ const headers: Record<string, string> = { ...(providerConfig.headers ?? {}) };
1686
+ const apiKey =
1687
+ this.#customProviderApiKeys.get(providerConfig.provider) ??
1688
+ (await this.#peekApiKeyForProvider(providerConfig.provider));
1689
+ if (apiKey && apiKey !== DEFAULT_LOCAL_TOKEN && apiKey !== kNoAuth) {
1690
+ headers.Authorization = `Bearer ${apiKey}`;
1691
+ }
1692
+
1693
+ const modelsUrl = `${baseUrl}/models`;
1694
+ const response = await fetch(modelsUrl, {
1695
+ headers: { Accept: "application/json", ...headers },
1696
+ signal: AbortSignal.timeout(3000),
1697
+ });
1698
+ if (!response.ok) {
1699
+ throw new Error(`HTTP ${response.status} from ${modelsUrl}`);
1700
+ }
1701
+ const payload = (await response.json()) as { data?: Array<{ id: string }> };
1702
+ const items = payload.data ?? [];
1703
+ const discovered: Model<Api>[] = [];
1704
+ for (const item of items) {
1705
+ const id = item.id;
1706
+ if (!id) continue;
1707
+ discovered.push(
1708
+ enrichModelThinking({
1709
+ id,
1710
+ name: id,
1711
+ api: providerConfig.api,
1712
+ provider: providerConfig.provider,
1713
+ baseUrl,
1714
+ reasoning: false,
1715
+ input: ["text"],
1716
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1717
+ contextWindow: 128000,
1718
+ maxTokens: 8192,
1719
+ headers,
1720
+ }),
1721
+ );
1722
+ }
1723
+ return this.#applyProviderModelOverrides(providerConfig.provider, discovered);
1724
+ }
1725
+
1672
1726
  #normalizeLlamaCppBaseUrl(baseUrl?: string): string {
1673
1727
  const defaultBaseUrl = "http://127.0.0.1:8080";
1674
1728
  const raw = baseUrl || defaultBaseUrl;