@openclaw/llama-cpp-provider 2026.9.6 → 2026.9.7

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/assets/icon.png CHANGED
Binary file
@@ -9,9 +9,6 @@ const LLAMA_CPP_LOCAL_AUTH_MARKER = "llama-cpp-local";
9
9
  const LLAMA_CPP_DEFAULT_PORT = 19432;
10
10
  const LLAMA_CPP_READY_TIMEOUT_MS = 3e4;
11
11
  const LLAMA_CPP_IDLE_STOP_MS = 6e5;
12
- function resolveLlamaCppSyntheticApiKey() {
13
- return LLAMA_CPP_LOCAL_AUTH_MARKER;
14
- }
15
12
  const DEFAULT_LLAMA_CPP_MODEL_ID = "gemma-4-e4b-it-q4_k_m";
16
13
  const DEFAULT_LLAMA_CPP_MODEL_URI = "hf:unsloth/gemma-4-E4B-it-GGUF/gemma-4-E4B-it-Q4_K_M.gguf";
17
14
  const DEFAULT_LLAMA_CPP_MODEL_REVISION = "bfc15c382204943c3a8fff0c750b94ae2364d7a3";
@@ -62,12 +59,12 @@ function resolveCachedLlamaCppModelPath(params) {
62
59
  if (/^(?:hf:|https?:\/\/)/iu.test(source)) return null;
63
60
  return path.isAbsolute(source) ? source : path.resolve(cacheDir, source);
64
61
  }
65
- function buildDefaultLlamaCppModel() {
62
+ function buildLlamaCppModel(model) {
66
63
  return {
67
- id: DEFAULT_LLAMA_CPP_MODEL_ID,
68
- name: "Gemma 4 E4B (Q4_K_M)",
64
+ id: model.id,
65
+ name: model.name,
69
66
  api: "openai-completions",
70
- reasoning: false,
67
+ reasoning: model.reasoning ?? false,
71
68
  input: ["text"],
72
69
  cost: {
73
70
  input: 0,
@@ -77,9 +74,9 @@ function buildDefaultLlamaCppModel() {
77
74
  },
78
75
  contextWindow: DEFAULT_LLAMA_CPP_CONTEXT_SIZE,
79
76
  contextTokens: DEFAULT_LLAMA_CPP_CONTEXT_SIZE,
80
- maxTokens: 2048,
77
+ maxTokens: model.maxTokens ?? 2048,
81
78
  params: {
82
- modelPath: DEFAULT_LLAMA_CPP_MODEL_URI,
79
+ modelPath: model.source,
83
80
  contextSize: DEFAULT_LLAMA_CPP_CONTEXT_SIZE
84
81
  },
85
82
  compat: {
@@ -91,13 +88,17 @@ function buildDefaultLlamaCppModel() {
91
88
  }
92
89
  function buildLlamaCppProviderConfig(params = {}) {
93
90
  const { existing, managed, modelInventory } = params;
94
- const defaultModel = buildDefaultLlamaCppModel();
91
+ const defaultModel = buildLlamaCppModel({
92
+ id: DEFAULT_LLAMA_CPP_MODEL_ID,
93
+ name: "Gemma 4 E4B (Q4_K_M)",
94
+ source: DEFAULT_LLAMA_CPP_MODEL_URI
95
+ });
95
96
  const configuredModels = existing?.models ?? [];
96
97
  const models = modelInventory ?? (configuredModels.some((model) => model.id === defaultModel.id) ? configuredModels : [...configuredModels, defaultModel]);
97
98
  return {
98
99
  ...existing,
99
100
  baseUrl: managed?.baseUrl ?? existing?.baseUrl ?? `http://127.0.0.1:19432/v1`,
100
- apiKey: existing?.apiKey ?? resolveLlamaCppSyntheticApiKey(),
101
+ apiKey: existing?.apiKey ?? "llama-cpp-local",
101
102
  api: "openai-completions",
102
103
  timeoutSeconds: existing?.timeoutSeconds ?? 600,
103
104
  ...managed ? { localService: {
@@ -119,4 +120,4 @@ function resolveManagedLlamaCppProviderConfig(config) {
119
120
  return provider;
120
121
  }
121
122
  //#endregion
122
- export { resolveLlamaCppDataDir as C, resolveLlamaCppSyntheticApiKey as D, resolveLlamaCppModelSource as E, resolveLegacyLlamaCppModelCacheDir as S, resolveLlamaCppModelCacheDir as T, LLAMA_CPP_PROVIDER_ID as _, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL as a, resolveCachedLlamaCppModelPath as b, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 as c, DEFAULT_LLAMA_CPP_MODEL_ID as d, DEFAULT_LLAMA_CPP_MODEL_REVISION as f, LLAMA_CPP_DEFAULT_PORT as g, DEFAULT_LLAMA_CPP_MODEL_URI as h, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE as i, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES as l, DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES as m, resolveManagedLlamaCppProviderConfig as n, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID as o, DEFAULT_LLAMA_CPP_MODEL_SHA256 as p, DEFAULT_LLAMA_CPP_CONTEXT_SIZE as r, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION as s, MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE as t, DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE as u, LLAMA_CPP_PROVIDER_LABEL as v, resolveLlamaCppEmbeddingModel as w, resolveHomePath as x, buildLlamaCppProviderConfig as y };
123
+ export { resolveHomePath as C, resolveLlamaCppModelCacheDir as D, resolveLlamaCppEmbeddingModel as E, resolveLlamaCppModelSource as O, resolveCachedLlamaCppModelPath as S, resolveLlamaCppDataDir as T, LLAMA_CPP_LOCAL_AUTH_MARKER as _, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL as a, buildLlamaCppModel as b, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256 as c, DEFAULT_LLAMA_CPP_MODEL_ID as d, DEFAULT_LLAMA_CPP_MODEL_REVISION as f, LLAMA_CPP_DEFAULT_PORT as g, DEFAULT_LLAMA_CPP_MODEL_URI as h, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE as i, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES as l, DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES as m, resolveManagedLlamaCppProviderConfig as n, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID as o, DEFAULT_LLAMA_CPP_MODEL_SHA256 as p, DEFAULT_LLAMA_CPP_CONTEXT_SIZE as r, DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION as s, MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE as t, DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE as u, LLAMA_CPP_PROVIDER_ID as v, resolveLegacyLlamaCppModelCacheDir as w, buildLlamaCppProviderConfig as x, LLAMA_CPP_PROVIDER_LABEL as y };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as resolveLlamaCppDataDir, D as resolveLlamaCppSyntheticApiKey, E as resolveLlamaCppModelSource, S as resolveLegacyLlamaCppModelCacheDir, T as resolveLlamaCppModelCacheDir, _ as LLAMA_CPP_PROVIDER_ID, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, b as resolveCachedLlamaCppModelPath, c as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256, d as DEFAULT_LLAMA_CPP_MODEL_ID, f as DEFAULT_LLAMA_CPP_MODEL_REVISION, g as LLAMA_CPP_DEFAULT_PORT, h as DEFAULT_LLAMA_CPP_MODEL_URI, i as DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE, l as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES, m as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, n as resolveManagedLlamaCppProviderConfig, o as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, p as DEFAULT_LLAMA_CPP_MODEL_SHA256, r as DEFAULT_LLAMA_CPP_CONTEXT_SIZE, s as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION, u as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, v as LLAMA_CPP_PROVIDER_LABEL, w as resolveLlamaCppEmbeddingModel, x as resolveHomePath, y as buildLlamaCppProviderConfig } from "./.setup/managed-provider-config-BYvyYdAs.mjs";
1
+ import { C as resolveHomePath, D as resolveLlamaCppModelCacheDir, E as resolveLlamaCppEmbeddingModel, O as resolveLlamaCppModelSource, S as resolveCachedLlamaCppModelPath, T as resolveLlamaCppDataDir, _ as LLAMA_CPP_LOCAL_AUTH_MARKER, a as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, b as buildLlamaCppModel, c as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SHA256, d as DEFAULT_LLAMA_CPP_MODEL_ID, f as DEFAULT_LLAMA_CPP_MODEL_REVISION, g as LLAMA_CPP_DEFAULT_PORT, h as DEFAULT_LLAMA_CPP_MODEL_URI, i as DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE, l as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_SIZE_BYTES, m as DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES, n as resolveManagedLlamaCppProviderConfig, o as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID, p as DEFAULT_LLAMA_CPP_MODEL_SHA256, s as DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_REVISION, u as DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE, v as LLAMA_CPP_PROVIDER_ID, w as resolveLegacyLlamaCppModelCacheDir, x as buildLlamaCppProviderConfig, y as LLAMA_CPP_PROVIDER_LABEL } from "./.setup/managed-provider-config-B99gmBnE.mjs";
2
2
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
3
  import path from "node:path";
4
4
  import { getEmbeddingProvider } from "openclaw/plugin-sdk/embedding-providers";
@@ -19,7 +19,7 @@ import { CUSTOM_LOCAL_AUTH_MARKER, applyAuthProfileConfig, buildApiKeyCredential
19
19
  import { buildProviderToolCompatFamilyHooks } from "openclaw/plugin-sdk/provider-tools";
20
20
  import { removeAuthProfileConfig, removeProviderAuthProfilesWithLock, resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
21
21
  import { resolveConfiguredSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
22
- import * as liveCatalogRuntime from "openclaw/plugin-sdk/provider-catalog-live-runtime";
22
+ import { LiveModelCatalogHttpError, runLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
23
23
  import { getCachedLiveCatalogValue } from "openclaw/plugin-sdk/provider-catalog-shared";
24
24
  import { SELF_HOSTED_DEFAULT_CONTEXT_WINDOW, SELF_HOSTED_DEFAULT_COST, SELF_HOSTED_DEFAULT_MAX_TOKENS, applyProviderDefaultModel, discoverOpenAICompatibleLocalModels } from "openclaw/plugin-sdk/provider-setup";
25
25
  import { selectPreferredLocalModelId } from "openclaw/plugin-sdk/provider-model-shared";
@@ -728,31 +728,10 @@ const GIB = 1024 ** 3;
728
728
  function modelRecipe(params) {
729
729
  const source = params.source ?? `hf:${params.repository}/${params.file}#${params.revision}`;
730
730
  return {
731
- model: {
732
- id: params.id,
733
- name: params.name,
734
- api: "openai-completions",
735
- reasoning: params.reasoning ?? false,
736
- input: ["text"],
737
- cost: {
738
- input: 0,
739
- output: 0,
740
- cacheRead: 0,
741
- cacheWrite: 0
742
- },
743
- contextWindow: DEFAULT_LLAMA_CPP_CONTEXT_SIZE,
744
- contextTokens: DEFAULT_LLAMA_CPP_CONTEXT_SIZE,
745
- maxTokens: params.maxTokens ?? 2048,
746
- params: {
747
- modelPath: source,
748
- contextSize: DEFAULT_LLAMA_CPP_CONTEXT_SIZE
749
- },
750
- compat: {
751
- supportsTools: true,
752
- supportsUsageInStreaming: true,
753
- toolSchemaProfile: "llamacpp"
754
- }
755
- },
731
+ model: buildLlamaCppModel({
732
+ ...params,
733
+ source
734
+ }),
756
735
  sizeBytes: params.sizeBytes,
757
736
  memoryBytes: params.memoryGiB * GIB,
758
737
  minimumSystemMemoryBytes: params.minimumSystemGiB * GIB,
@@ -1289,11 +1268,8 @@ async function inspectLlamaServerRuntime(params) {
1289
1268
  //#endregion
1290
1269
  //#region extensions/llama-cpp/src/embedding-provider.ts
1291
1270
  const LOCAL_EMBEDDING_RUNTIME_FACTS = Symbol.for("openclaw.localEmbeddingRuntimeFacts");
1292
- function readLocalOptions(options) {
1293
- return options.local ?? {};
1294
- }
1295
1271
  function readIdentityLocalOptions(options) {
1296
- const local = readLocalOptions(options);
1272
+ const local = options.local ?? {};
1297
1273
  const provider = options.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
1298
1274
  return provider?.localService ? {
1299
1275
  ...local,
@@ -1309,39 +1285,30 @@ function createCacheKeyData(model, dimensions) {
1309
1285
  }
1310
1286
  function resolveModelIdentity(local, dimensions) {
1311
1287
  const embeddingModel = resolveLlamaCppEmbeddingModel(local);
1312
- const configuredCacheDir = embeddingModel.cacheDir;
1313
- const currentDefaultPath = path.resolve(configuredCacheDir, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE);
1314
- const legacyDefaultPath = path.resolve(resolveLegacyLlamaCppModelCacheDir(), DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE);
1315
- if (!embeddingModel.isDefault) return {
1316
- model: embeddingModel.source,
1317
- cacheKeyData: createCacheKeyData(embeddingModel.source, dimensions),
1318
- aliases: []
1319
- };
1320
- const aliases = /* @__PURE__ */ new Set([
1321
- currentDefaultPath,
1322
- legacyDefaultPath,
1323
- DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE
1324
- ]);
1325
- if (embeddingModel.source !== "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf") aliases.add(embeddingModel.source);
1288
+ const model = embeddingModel.isDefault ? DEFAULT_LLAMA_CPP_EMBEDDING_MODEL : embeddingModel.source;
1289
+ const aliases = /* @__PURE__ */ new Set();
1290
+ if (embeddingModel.isDefault) {
1291
+ aliases.add(path.resolve(embeddingModel.cacheDir, DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE));
1292
+ aliases.add(path.resolve(resolveLegacyLlamaCppModelCacheDir(), DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE));
1293
+ aliases.add(DEFAULT_LLAMA_CPP_EMBEDDING_CACHE_FILE);
1294
+ if (embeddingModel.source !== model) aliases.add(embeddingModel.source);
1295
+ }
1326
1296
  return {
1327
- model: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL,
1328
- cacheKeyData: createCacheKeyData(DEFAULT_LLAMA_CPP_EMBEDDING_MODEL, dimensions),
1329
- aliases: [...aliases].map((model) => ({
1330
- model,
1331
- cacheKeyData: createCacheKeyData(model, dimensions)
1297
+ model,
1298
+ cacheKeyData: createCacheKeyData(model, dimensions),
1299
+ aliases: [...aliases].map((alias) => ({
1300
+ model: alias,
1301
+ cacheKeyData: createCacheKeyData(alias, dimensions)
1332
1302
  }))
1333
1303
  };
1334
1304
  }
1335
- function resolveConfiguredProvider(options) {
1336
- return resolveManagedLlamaCppProviderConfig(options.config);
1337
- }
1338
1305
  function resolveProviderPort(provider) {
1339
1306
  const port = Number(new URL(provider.baseUrl ?? "").port);
1340
1307
  if (!Number.isInteger(port) || port <= 0) throw new Error("Managed llama.cpp provider baseUrl must include a loopback port.");
1341
1308
  return port;
1342
1309
  }
1343
1310
  async function prepareEmbeddingServer(options, embeddingSource, embeddingModelIsDefault) {
1344
- const provider = resolveConfiguredProvider(options);
1311
+ const provider = resolveManagedLlamaCppProviderConfig(options.config);
1345
1312
  const embeddingModelPath = await ensureLlamaCppModel({
1346
1313
  source: embeddingSource,
1347
1314
  cacheDir: resolveLlamaCppModelCacheDir(provider),
@@ -1422,7 +1389,7 @@ const llamaCppEmbeddingProviderAdapter = {
1422
1389
  provider: wrapProvider({
1423
1390
  provider: result.provider,
1424
1391
  canonicalModel: identity.model,
1425
- baseUrl: resolveConfiguredProvider(options).baseUrl ?? ""
1392
+ baseUrl: resolveManagedLlamaCppProviderConfig(options.config).baseUrl ?? ""
1426
1393
  }),
1427
1394
  runtime: {
1428
1395
  id: "local",
@@ -1443,7 +1410,7 @@ function hasLlamaServerAuthorizationHeader(headers) {
1443
1410
  }
1444
1411
  function shouldUseLlamaServerSyntheticAuth(providerConfig) {
1445
1412
  const apiKey = normalizeOptionalSecretInput(providerConfig?.apiKey)?.trim();
1446
- return !(hasConfiguredSecretInput(providerConfig?.apiKey) && apiKey !== resolveLlamaCppSyntheticApiKey() && apiKey !== CUSTOM_LOCAL_AUTH_MARKER);
1413
+ return !(hasConfiguredSecretInput(providerConfig?.apiKey) && apiKey !== "llama-cpp-local" && apiKey !== CUSTOM_LOCAL_AUTH_MARKER);
1447
1414
  }
1448
1415
  async function resolveLlamaServerProviderHeaders(params) {
1449
1416
  const headers = asOptionalRecord(params.headers);
@@ -1483,14 +1450,10 @@ const LLAMA_SERVER_DEFAULT_ORIGIN = "http://127.0.0.1:8080";
1483
1450
  const LLAMA_SERVER_DEFAULT_API_KEY_ENV_VAR = "LLAMA_SERVER_API_KEY";
1484
1451
  //#endregion
1485
1452
  //#region extensions/llama-cpp/src/external-server/endpoint.ts
1486
- function toFetchableBaseUrl(value) {
1487
- if (/^[a-z][a-z\d+.-]*:\/\//iu.test(value)) return value;
1488
- return `http://${value}`;
1489
- }
1490
1453
  /** Resolves the server origin and its OpenAI-compatible `/v1` inference base. */
1491
1454
  function resolveLlamaServerEndpoint(configuredBaseUrl) {
1492
1455
  const configured = configuredBaseUrl?.trim() || "http://127.0.0.1:8080";
1493
- const parsed = new URL(toFetchableBaseUrl(configured));
1456
+ const parsed = new URL(/^[a-z][a-z\d+.-]*:\/\//iu.test(configured) ? configured : `http://${configured}`);
1494
1457
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new TypeError(`Unsupported llama-server protocol: ${parsed.protocol}`);
1495
1458
  if (parsed.username || parsed.password) throw new TypeError("llama-server base URL must not contain credentials");
1496
1459
  parsed.pathname = parsed.pathname.replace(/\/+$/u, "").replace(/\/v1$/iu, "") || "/";
@@ -1580,26 +1543,18 @@ function mapLlamaServerModel(row, props) {
1580
1543
  failed: row.status?.failed === true
1581
1544
  };
1582
1545
  }
1583
- /** Keeps explicit rows first and appends models discovered from the server. */
1584
- function mergeLlamaServerModels(params) {
1585
- const explicit = Array.isArray(params.explicitModels) ? params.explicitModels : [];
1586
- const merged = [...explicit];
1587
- const seen = new Set(explicit.map((model) => model.id));
1546
+ function buildLlamaServerProviderConfig(params) {
1547
+ const models = Array.isArray(params.configured?.models) ? [...params.configured.models] : [];
1548
+ const seen = new Set(models.map((model) => model.id));
1588
1549
  for (const discovered of params.discoveredModels) {
1589
1550
  if (seen.has(discovered.config.id)) continue;
1590
1551
  seen.add(discovered.config.id);
1591
- merged.push(discovered.config);
1552
+ models.push(discovered.config);
1592
1553
  }
1593
- return merged;
1594
- }
1595
- function buildLlamaServerProviderConfig(params) {
1596
1554
  return normalizeLlamaServerProviderConfig({
1597
1555
  ...params.configured,
1598
1556
  baseUrl: params.configured?.baseUrl ?? "http://127.0.0.1:8080",
1599
- models: mergeLlamaServerModels({
1600
- explicitModels: params.configured?.models,
1601
- discoveredModels: params.discoveredModels
1602
- })
1557
+ models
1603
1558
  });
1604
1559
  }
1605
1560
  //#endregion
@@ -1648,36 +1603,6 @@ async function discoverLlamaServer(params) {
1648
1603
  }
1649
1604
  //#endregion
1650
1605
  //#region extensions/llama-cpp/src/external-server/provider.ts
1651
- const liveCatalogSdk = liveCatalogRuntime;
1652
- async function runLlamaServerCatalog(params) {
1653
- if (liveCatalogSdk.runLiveProviderCatalog) return await liveCatalogSdk.runLiveProviderCatalog(params);
1654
- const identity = {
1655
- provider: params.providerId,
1656
- ...params.profileId ? { profileId: params.profileId } : {}
1657
- };
1658
- try {
1659
- const result = await params.run();
1660
- return result ? {
1661
- ...result,
1662
- outcomes: [...result.outcomes ?? [], {
1663
- ...identity,
1664
- status: "ready"
1665
- }]
1666
- } : result;
1667
- } catch (error) {
1668
- return {
1669
- providers: {},
1670
- outcomes: [error instanceof liveCatalogRuntime.LiveModelCatalogHttpError && (error.status === 401 || error.status === 403) ? {
1671
- ...identity,
1672
- status: "auth-rejected",
1673
- rejectionScope: "catalog"
1674
- } : {
1675
- ...identity,
1676
- status: "unavailable"
1677
- }]
1678
- };
1679
- }
1680
- }
1681
1606
  /** Discovers external llama-server models for provider runtime resolution. */
1682
1607
  async function discoverLlamaServerProvider(ctx) {
1683
1608
  const configured = ctx.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
@@ -1689,7 +1614,7 @@ async function discoverLlamaServerProvider(ctx) {
1689
1614
  });
1690
1615
  const authApiKey = auth.discoveryApiKey ?? auth.apiKey;
1691
1616
  const apiKey = hasLlamaServerAuthorizationHeader(headers) || authApiKey && isNonSecretApiKeyMarker(authApiKey) ? void 0 : authApiKey;
1692
- return await runLlamaServerCatalog({
1617
+ return await runLiveProviderCatalog({
1693
1618
  providerId: LLAMA_CPP_PROVIDER_ID,
1694
1619
  profileId: apiKey ? auth.profileId : void 0,
1695
1620
  run: async () => {
@@ -1701,7 +1626,7 @@ async function discoverLlamaServerProvider(ctx) {
1701
1626
  });
1702
1627
  if (discovery.kind !== "success") {
1703
1628
  if (!configured && !apiKey && !headers) return null;
1704
- throw discovery.kind === "http-error" ? new liveCatalogRuntime.LiveModelCatalogHttpError(LLAMA_CPP_PROVIDER_ID, discovery.status) : discovery.error;
1629
+ throw discovery.kind === "http-error" ? new LiveModelCatalogHttpError(LLAMA_CPP_PROVIDER_ID, discovery.status) : discovery.error;
1705
1630
  }
1706
1631
  return { provider: buildLlamaServerProviderConfig({
1707
1632
  configured,
@@ -1878,15 +1803,6 @@ async function discoverForSetup(ctx) {
1878
1803
  return null;
1879
1804
  }
1880
1805
  }
1881
- async function discoverWithAccess(params) {
1882
- return await discoverLlamaServer({
1883
- baseUrl: params.baseUrl,
1884
- apiKey: params.apiKey,
1885
- headers: params.headers,
1886
- signal: params.signal,
1887
- cacheTtlMs: 0
1888
- });
1889
- }
1890
1806
  /** Read-only discovery for the guided local-provider setup ladder. */
1891
1807
  async function detectLlamaServerSetup(ctx) {
1892
1808
  const discovery = await discoverForSetup(ctx);
@@ -1971,11 +1887,12 @@ async function runLlamaServerSetup(ctx) {
1971
1887
  };
1972
1888
  }
1973
1889
  }
1974
- const discovery = await discoverWithAccess({
1890
+ const discovery = await discoverLlamaServer({
1975
1891
  baseUrl: endpoint.inferenceBaseUrl,
1976
1892
  apiKey,
1977
1893
  headers,
1978
- signal: ctx.signal
1894
+ signal: ctx.signal,
1895
+ cacheTtlMs: 0
1979
1896
  });
1980
1897
  if (discovery.kind !== "success") throw new Error(describeDiscoveryFailure(discovery));
1981
1898
  const modelId = selectSetupModelId(discovery);
@@ -2031,10 +1948,11 @@ async function validateNonInteractiveDiscovery(ctx) {
2031
1948
  credential: resolvedApiKey
2032
1949
  };
2033
1950
  } else persistence = { kind: "remove" };
2034
- const discovery = await discoverWithAccess({
1951
+ const discovery = await discoverLlamaServer({
2035
1952
  baseUrl,
2036
1953
  apiKey,
2037
- headers
1954
+ headers,
1955
+ cacheTtlMs: 0
2038
1956
  });
2039
1957
  if (discovery.kind !== "success") {
2040
1958
  ctx.runtime.error(describeDiscoveryFailure(discovery));
@@ -2065,9 +1983,7 @@ async function configureLlamaServerNonInteractive(ctx) {
2065
1983
  if (!validated) return null;
2066
1984
  const providerConfig = buildExistingProviderConfig({
2067
1985
  config: ctx.config,
2068
- discovery: validated.discovery,
2069
- resetEndpoint: validated.resetEndpoint,
2070
- persistence: validated.persistence
1986
+ ...validated
2071
1987
  });
2072
1988
  let config = {
2073
1989
  ...ctx.config,
@@ -2464,7 +2380,7 @@ function registerLlamaCppProvider(api) {
2464
2380
  },
2465
2381
  run: runLlamaServerSetup,
2466
2382
  validateNonInteractive: validateLlamaServerNonInteractive,
2467
- runNonInteractive: async (ctx) => await configureLlamaServerNonInteractive(ctx)
2383
+ runNonInteractive: configureLlamaServerNonInteractive
2468
2384
  }],
2469
2385
  catalog: {
2470
2386
  order: "late",
@@ -2481,11 +2397,11 @@ function registerLlamaCppProvider(api) {
2481
2397
  run: async () => ({ provider: buildLlamaCppProviderConfig() })
2482
2398
  },
2483
2399
  resolveSyntheticAuth: ({ providerConfig }) => providerConfig?.localService || shouldUseLlamaServerSyntheticAuth(providerConfig) ? {
2484
- apiKey: resolveLlamaCppSyntheticApiKey(),
2400
+ apiKey: LLAMA_CPP_LOCAL_AUTH_MARKER,
2485
2401
  source: providerConfig?.localService ? "managed local llama.cpp server" : hasLlamaServerAuthorizationHeader(providerConfig?.headers) ? "models.providers.llama-cpp.headers.Authorization" : "models.providers.llama-cpp (synthetic local key)",
2486
2402
  mode: "api-key"
2487
2403
  } : void 0,
2488
- shouldDeferSyntheticProfileAuth: ({ resolvedApiKey }) => resolvedApiKey?.trim() === resolveLlamaCppSyntheticApiKey() || resolvedApiKey?.trim() === CUSTOM_LOCAL_AUTH_MARKER,
2404
+ shouldDeferSyntheticProfileAuth: ({ resolvedApiKey }) => resolvedApiKey?.trim() === "llama-cpp-local" || resolvedApiKey?.trim() === CUSTOM_LOCAL_AUTH_MARKER,
2489
2405
  normalizeConfig: ({ providerConfig }) => providerConfig.localService ? providerConfig : normalizeLlamaServerProviderConfig(providerConfig),
2490
2406
  prepareDynamicModel: async (ctx) => ctx.config?.models?.providers?.["llama-cpp"]?.localService ? void 0 : await prepareLlamaServerDynamicModel(ctx),
2491
2407
  reconcileLocalService: reconcileManagedLlamaServer,
@@ -1,4 +1,4 @@
1
- import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./.setup/managed-provider-config-BYvyYdAs.mjs";
1
+ import { n as resolveManagedLlamaCppProviderConfig, t as MANAGED_LLAMA_CPP_CONFIG_REQUIRED_MESSAGE } from "./.setup/managed-provider-config-B99gmBnE.mjs";
2
2
  //#region extensions/llama-cpp/provider-policy-api.ts
3
3
  function inspectEmbeddingProviderSetup(params) {
4
4
  if (params.provider !== "local") return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/llama-cpp-provider",
3
- "version": "2026.9.6",
3
+ "version": "2026.9.7",
4
4
  "description": "OpenClaw provider for managed and external llama.cpp servers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,10 +21,10 @@
21
21
  "minHostVersion": ">=2026.6.2"
22
22
  },
23
23
  "compat": {
24
- "pluginApi": ">=2026.9.6"
24
+ "pluginApi": ">=2026.9.7"
25
25
  },
26
26
  "build": {
27
- "openclawVersion": "2026.9.6"
27
+ "openclawVersion": "2026.9.7"
28
28
  },
29
29
  "release": {
30
30
  "bundleRuntimeDependencies": false,
@@ -36,7 +36,7 @@
36
36
  ]
37
37
  },
38
38
  "dependencies": {
39
- "@openclaw/fs-safe": "0.18.1"
39
+ "@openclaw/fs-safe": "0.21.1"
40
40
  },
41
41
  "files": [
42
42
  "dist/**",
@@ -46,7 +46,7 @@
46
46
  "assets/activity.svg"
47
47
  ],
48
48
  "peerDependencies": {
49
- "openclaw": ">=2026.9.6"
49
+ "openclaw": ">=2026.9.7"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "openclaw": {