@openclaw/llama-cpp-provider 2026.8.1-beta.3 → 2026.9.1-beta.1

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.
Files changed (2) hide show
  1. package/dist/index.js +152 -102
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -23,8 +23,8 @@ import { selectPreferredLocalModelId } from "openclaw/plugin-sdk/provider-model-
23
23
  import { streamSimple } from "openclaw/plugin-sdk/llm";
24
24
  import { setQwenChatTemplateThinking } from "openclaw/plugin-sdk/provider-stream-shared";
25
25
  //#region extensions/llama-cpp/src/llama-server-assets.ts
26
- const LLAMA_SERVER_RELEASE = "b10357";
27
- const LLAMA_SERVER_COMMIT = "689e227db485c6b33d061555e74034c93a867649";
26
+ const LLAMA_SERVER_RELEASE = "b10488";
27
+ const LLAMA_SERVER_COMMIT = "9d77fa17254e1dee4b9e92504c91611a60b1359f";
28
28
  const LLAMA_SERVER_ASSETS = [
29
29
  {
30
30
  platform: "darwin",
@@ -32,7 +32,7 @@ const LLAMA_SERVER_ASSETS = [
32
32
  backend: "metal",
33
33
  archive: "tar.gz",
34
34
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-arm64.tar.gz`,
35
- sha256: "7f464a2d473d53ebb9c1d7d16db1258ec98c371569816491850686e6a4334c52",
35
+ sha256: "ada90bbc4787caac49fbb95ed2487a03fb4bbb456057a31e316878e1a895827a",
36
36
  executable: "llama-server"
37
37
  },
38
38
  {
@@ -41,7 +41,7 @@ const LLAMA_SERVER_ASSETS = [
41
41
  backend: "cpu",
42
42
  archive: "tar.gz",
43
43
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-macos-x64.tar.gz`,
44
- sha256: "8282cf6b30bfab87080044e98b7b78f2896bfc60414926fae6039a89c0fb6ec2",
44
+ sha256: "80567f47511d5e11872835614b99cd678fa276b05553563e8aab3f2cb6b90abd",
45
45
  executable: "llama-server"
46
46
  },
47
47
  {
@@ -50,7 +50,7 @@ const LLAMA_SERVER_ASSETS = [
50
50
  backend: "cpu",
51
51
  archive: "tar.gz",
52
52
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-arm64.tar.gz`,
53
- sha256: "0653b6aa14de35920824045bca7e48f98f629f41943d0fefab1e317bbe8e22a8",
53
+ sha256: "e977e13e9d72b8ee0068336bb9196f4f8158e8b53b8d502dc8bdb55eaea1222f",
54
54
  executable: "llama-server"
55
55
  },
56
56
  {
@@ -59,7 +59,7 @@ const LLAMA_SERVER_ASSETS = [
59
59
  backend: "cpu",
60
60
  archive: "tar.gz",
61
61
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-ubuntu-x64.tar.gz`,
62
- sha256: "6b0ba012036e6d727521100158bfcaa73b460fbb31acab2931c9485f347bd16b",
62
+ sha256: "5a7073371d5a9b8e39978b35f49b2ff244f7a064edb92f0326d94e12b52261dd",
63
63
  executable: "llama-server"
64
64
  },
65
65
  {
@@ -68,7 +68,7 @@ const LLAMA_SERVER_ASSETS = [
68
68
  backend: "cpu",
69
69
  archive: "zip",
70
70
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-arm64.zip`,
71
- sha256: "a0d73be8d3151d9401fa193f1b83c6d7401191b41786e75f0a60184058333e86",
71
+ sha256: "97a883831728862568a0e7e38380e7a179b6bcb292167f648a5598586dd65635",
72
72
  executable: "llama-server.exe"
73
73
  },
74
74
  {
@@ -77,7 +77,7 @@ const LLAMA_SERVER_ASSETS = [
77
77
  backend: "cpu",
78
78
  archive: "zip",
79
79
  name: `llama-${LLAMA_SERVER_RELEASE}-bin-win-cpu-x64.zip`,
80
- sha256: "6c64cc7db679980fcb34bbbe96b2b1df6127e90ccdad2bd6fbe39532fee2fc4e",
80
+ sha256: "6c938f6d79aac96cb90fda673aade20cff9b1b6c1e97de04f4d5d60bca107082",
81
81
  executable: "llama-server.exe"
82
82
  }
83
83
  ];
@@ -243,7 +243,10 @@ async function validateInstalledServer(command) {
243
243
  } catch (error) {
244
244
  throw formatRuntimeDependencyError(error);
245
245
  }
246
- if (!version.includes(`version: 10357`) || !version.includes("689e227db485c6b33d061555e74034c93a867649".slice(0, 9))) throw new Error(`Unexpected llama-server build at ${command}: expected ${LLAMA_SERVER_RELEASE} (${LLAMA_SERVER_COMMIT.slice(0, 9)}), got ${version || "no version output"}`);
246
+ const match = (version.split(/\r?\n/u, 1)[0]?.trim() ?? "").match(/^version: .+ \(build (\d+), commit ([a-f\d]{9})\)$/u);
247
+ const build = match?.[1] ? Number(match[1]) : void 0;
248
+ const commit = match?.[2];
249
+ if (build !== 10488 || commit !== "9d77fa17254e1dee4b9e92504c91611a60b1359f".slice(0, 9)) throw new Error(`Unexpected llama-server build at ${command}: expected ${LLAMA_SERVER_RELEASE} (${LLAMA_SERVER_COMMIT.slice(0, 9)}), got ${version || "no version output"}`);
247
250
  }
248
251
  async function installLlamaServer(asset) {
249
252
  assertSupportedLinuxRuntime(asset);
@@ -306,6 +309,8 @@ async function ensureLlamaServerInstalled() {
306
309
  //#region extensions/llama-cpp/src/managed-server.ts
307
310
  const modelPromises = /* @__PURE__ */ new Map();
308
311
  const chatPreparationPromises = /* @__PURE__ */ new Map();
312
+ const presetWritePromises = /* @__PURE__ */ new Map();
313
+ const LLAMA_CPP_EMBEDDING_UBATCH_SIZE = 2048;
309
314
  function parseHuggingFaceSource(source) {
310
315
  const [pathPart, revisionPart] = source.replace(/^(?:hf|huggingface):(?:\/\/)?/iu, "").split("#", 2);
311
316
  const [user, repositoryWithTag, ...fileParts] = (pathPart ?? "").split("/");
@@ -462,18 +467,46 @@ function assertIniValue(value, label) {
462
467
  if (/\r|\n/u.test(value)) throw new Error(`${label} cannot contain a newline`);
463
468
  return value;
464
469
  }
470
+ function renderChatModelSection(params) {
471
+ const id = assertIniValue(params.id, "llama.cpp model id");
472
+ if (id.includes("]")) throw new Error("llama.cpp model ids cannot contain ]");
473
+ return [
474
+ `[${id}]`,
475
+ `model = ${assertIniValue(params.modelPath, "llama.cpp model path")}`,
476
+ `ctx-size = ${params.contextSize ?? 65536}`,
477
+ `n-predict = ${params.maxTokens ?? 2048}`,
478
+ "jinja = true"
479
+ ].join("\n");
480
+ }
481
+ function renderEmbeddingModelSection(params) {
482
+ return [
483
+ `[${DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID}]`,
484
+ `model = ${assertIniValue(params.modelPath, "llama.cpp embedding model path")}`,
485
+ ...params.isDefault ? [`ubatch-size = ${LLAMA_CPP_EMBEDDING_UBATCH_SIZE}`] : [],
486
+ "embedding = true"
487
+ ].join("\n");
488
+ }
489
+ function readModelSection(contents, id) {
490
+ if (!contents) return;
491
+ const lines = contents.split(/\r?\n/u);
492
+ const start = lines.indexOf(`[${id}]`);
493
+ if (start < 0) return;
494
+ let end = start + 1;
495
+ while (end < lines.length && !/^\[[^\]]+\]$/u.test(lines[end] ?? "")) end += 1;
496
+ return lines.slice(start, end).join("\n").trimEnd();
497
+ }
498
+ function readChatModelSection(contents) {
499
+ const id = contents?.split(/\r?\n/u).map((line) => /^\[([^\]]+)\]$/u.exec(line)?.[1]).find((candidate) => candidate && candidate !== "embeddinggemma-300m-qat-q8_0");
500
+ return id ? readModelSection(contents, id) : void 0;
501
+ }
465
502
  function renderLlamaServerPreset(params) {
466
- const embeddingId = assertIniValue(params.embeddingModelId, "llama.cpp embedding model id");
467
- if (embeddingId.includes("]")) throw new Error("llama.cpp model ids cannot contain ]");
468
- const lines = ["version = 1", ""];
469
- if (params.chatModelId || params.chatModelPath) {
470
- if (!params.chatModelId || !params.chatModelPath) throw new Error("llama.cpp chat model id and path must be provided together");
471
- const chatId = assertIniValue(params.chatModelId, "llama.cpp model id");
472
- if (chatId.includes("]")) throw new Error("llama.cpp model ids cannot contain ]");
473
- lines.push(`[${chatId}]`, `model = ${assertIniValue(params.chatModelPath, "llama.cpp model path")}`, `ctx-size = ${params.contextSize ?? 65536}`, `n-predict = ${params.maxTokens ?? 2048}`, "jinja = true", "");
474
- }
475
- lines.push(`[${embeddingId}]`, `model = ${assertIniValue(params.embeddingModelPath, "llama.cpp embedding model path")}`, "embedding = true", "");
476
- return lines.join("\n");
503
+ return [
504
+ "version = 1",
505
+ "",
506
+ ...params.chatSection ? [params.chatSection, ""] : [],
507
+ params.embeddingSection,
508
+ ""
509
+ ].join("\n");
477
510
  }
478
511
  async function writePreset(presetPath, contents) {
479
512
  await fsp.mkdir(path.dirname(presetPath), { recursive: true });
@@ -481,6 +514,41 @@ async function writePreset(presetPath, contents) {
481
514
  await fsp.writeFile(temporary, contents, { mode: 384 });
482
515
  await fsp.rename(temporary, presetPath);
483
516
  }
517
+ async function updatePreset(presetPath, params) {
518
+ const pending = (presetWritePromises.get(presetPath) ?? Promise.resolve()).catch(() => void 0).then(async () => {
519
+ const existing = await fsp.readFile(presetPath, "utf8").catch((error) => {
520
+ if (asOptionalRecord(error)?.code === "ENOENT") return;
521
+ throw error;
522
+ });
523
+ if (params.chatModelId || params.chatModelPath) {
524
+ if (!params.chatModelId || !params.chatModelPath) throw new Error("llama.cpp chat model id and path must be provided together");
525
+ }
526
+ const chatSection = params.chatModelPath ? renderChatModelSection({
527
+ id: params.chatModelId ?? "gemma-4-e4b-it-q4_k_m",
528
+ modelPath: params.chatModelPath,
529
+ contextSize: params.contextSize,
530
+ maxTokens: params.maxTokens
531
+ }) : readChatModelSection(existing);
532
+ const embeddingSection = params.embeddingModelPath ? renderEmbeddingModelSection({
533
+ isDefault: params.embeddingModelIsDefault,
534
+ modelPath: params.embeddingModelPath
535
+ }) : readModelSection(existing, "embeddinggemma-300m-qat-q8_0") ?? (params.defaultEmbeddingModelPath ? renderEmbeddingModelSection({
536
+ isDefault: true,
537
+ modelPath: params.defaultEmbeddingModelPath
538
+ }) : void 0);
539
+ if (!embeddingSection) throw new Error("llama.cpp embedding model path is required for a new managed preset");
540
+ await writePreset(presetPath, renderLlamaServerPreset({
541
+ chatSection,
542
+ embeddingSection
543
+ }));
544
+ });
545
+ presetWritePromises.set(presetPath, pending);
546
+ try {
547
+ await pending;
548
+ } finally {
549
+ if (presetWritePromises.get(presetPath) === pending) presetWritePromises.delete(presetPath);
550
+ }
551
+ }
484
552
  async function findAvailableLlamaServerPort(preferred = LLAMA_CPP_DEFAULT_PORT) {
485
553
  const tryPort = async (port) => await new Promise((resolve) => {
486
554
  const server = net.createServer();
@@ -497,16 +565,17 @@ async function findAvailableLlamaServerPort(preferred = LLAMA_CPP_DEFAULT_PORT)
497
565
  async function prepareManagedLlamaServer(params) {
498
566
  const { command, asset } = await ensureLlamaServerInstalled();
499
567
  const { presetPath } = resolveManagedLlamaServerPaths(asset);
500
- await writePreset(presetPath, renderLlamaServerPreset({
568
+ await updatePreset(presetPath, {
501
569
  ...params.chatModelPath ? {
502
570
  chatModelId: params.chatModelId ?? "gemma-4-e4b-it-q4_k_m",
503
571
  chatModelPath: params.chatModelPath
504
572
  } : {},
505
573
  contextSize: params.contextSize,
506
574
  maxTokens: params.maxTokens,
507
- embeddingModelId: DEFAULT_LLAMA_CPP_EMBEDDING_MODEL_ID,
508
- embeddingModelPath: params.embeddingModelPath
509
- }));
575
+ embeddingModelIsDefault: params.embeddingModelIsDefault,
576
+ embeddingModelPath: params.embeddingModelPath,
577
+ defaultEmbeddingModelPath: params.defaultEmbeddingModelPath
578
+ });
510
579
  const port = params.port ?? await findAvailableLlamaServerPort();
511
580
  const rootUrl = `http://127.0.0.1:${port}`;
512
581
  return {
@@ -557,7 +626,7 @@ async function ensureManagedLlamaServerForChat(params) {
557
626
  chatModelPath,
558
627
  contextSize: typeof configuredContext === "number" && configuredContext > 0 ? Math.floor(configuredContext) : params.model.contextTokens,
559
628
  maxTokens: params.model.maxTokens,
560
- embeddingModelPath: path.join(cacheDir, "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf"),
629
+ defaultEmbeddingModelPath: path.join(cacheDir, "hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf"),
561
630
  port: Number.isInteger(port) && port > 0 ? port : void 0
562
631
  });
563
632
  })();
@@ -635,6 +704,14 @@ const preparedEmbeddingServers = /* @__PURE__ */ new Map();
635
704
  function readLocalOptions(options) {
636
705
  return options.local ?? {};
637
706
  }
707
+ function readIdentityLocalOptions(options) {
708
+ const local = readLocalOptions(options);
709
+ const provider = options.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
710
+ return provider?.localService ? {
711
+ ...local,
712
+ modelCacheDir: resolveLlamaCppModelCacheDir(provider)
713
+ } : local;
714
+ }
638
715
  function createCacheKeyData(model, dimensions) {
639
716
  return {
640
717
  provider: "local",
@@ -667,6 +744,14 @@ function resolveModelIdentity(local, modelPath, dimensions) {
667
744
  }))
668
745
  };
669
746
  }
747
+ function resolveLlamaCppEmbeddingModel(localValue) {
748
+ const local = readLocalOptions({ local: localValue });
749
+ const source = normalizeOptionalString(local.modelPath) ?? "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
750
+ return {
751
+ source,
752
+ isDefault: resolveModelIdentity(local, source).model === DEFAULT_LLAMA_CPP_EMBEDDING_MODEL
753
+ };
754
+ }
670
755
  function resolveConfiguredProvider(options) {
671
756
  return resolveManagedLlamaCppProviderConfig(options.config);
672
757
  }
@@ -675,36 +760,22 @@ function resolveProviderPort(provider) {
675
760
  if (!Number.isInteger(port) || port <= 0) throw new Error("Managed llama.cpp provider baseUrl must include a loopback port.");
676
761
  return port;
677
762
  }
678
- async function prepareEmbeddingServer(options, embeddingSource) {
763
+ async function prepareEmbeddingServer(options, embeddingSource, embeddingModelIsDefault) {
679
764
  const provider = resolveConfiguredProvider(options);
680
- const configuredPrimary = options.config.agents?.defaults?.model;
681
- const primaryRef = typeof configuredPrimary === "string" ? configuredPrimary : configuredPrimary?.primary;
682
- const primaryId = primaryRef?.startsWith(`llama-cpp/`) ? primaryRef.slice(LLAMA_CPP_PROVIDER_ID.length + 1) : void 0;
683
- const chatModel = provider.models.find((model) => model.id === primaryId) ?? provider.models.find((model) => model.id !== "gemma-4-e4b-it-q4_k_m") ?? provider.models[0];
684
765
  const cacheDir = resolveLlamaCppModelCacheDir(provider);
685
766
  const key = JSON.stringify([
686
767
  provider.baseUrl,
687
- chatModel?.id ?? null,
688
768
  embeddingSource,
689
769
  cacheDir
690
770
  ]);
691
771
  const pending = preparedEmbeddingServers.get(key) ?? (async () => {
692
- const [chatModelPath, embeddingModelPath] = await Promise.all([chatModel ? ensureLlamaCppModel({
693
- source: resolveLlamaCppModelSource(chatModel),
694
- cacheDir,
695
- download: false
696
- }) : Promise.resolve(void 0), ensureLlamaCppModel({
697
- source: embeddingSource,
698
- cacheDir,
699
- download: true
700
- })]);
701
- const configuredContext = chatModel?.params?.contextSize;
702
772
  await prepareManagedLlamaServer({
703
- ...chatModel ? { chatModelId: chatModel.id } : {},
704
- chatModelPath,
705
- contextSize: typeof configuredContext === "number" && configuredContext > 0 ? Math.floor(configuredContext) : chatModel?.contextTokens,
706
- maxTokens: chatModel?.maxTokens,
707
- embeddingModelPath,
773
+ embeddingModelIsDefault,
774
+ embeddingModelPath: await ensureLlamaCppModel({
775
+ source: embeddingSource,
776
+ cacheDir,
777
+ download: true
778
+ }),
708
779
  port: resolveProviderPort(provider)
709
780
  });
710
781
  })();
@@ -757,13 +828,14 @@ const llamaCppEmbeddingProviderAdapter = {
757
828
  transport: "local",
758
829
  formatSetupError: (error) => `Managed local embeddings are unavailable. Run \`openclaw configure\`, choose llama.cpp, and retry. ${error instanceof Error ? error.message : String(error)}`,
759
830
  resolveIndexIdentity: (options) => {
760
- const local = readLocalOptions(options);
831
+ const local = readIdentityLocalOptions(options);
761
832
  return resolveModelIdentity(local, normalizeOptionalString(local.modelPath) ?? "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf", options.dimensions);
762
833
  },
763
834
  create: async (options) => {
764
- const local = readLocalOptions(options);
765
- const modelPath = normalizeOptionalString(local.modelPath) ?? "hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";
766
- await prepareEmbeddingServer(options, modelPath);
835
+ const local = readIdentityLocalOptions(options);
836
+ const embeddingModel = resolveLlamaCppEmbeddingModel(local);
837
+ const identity = resolveModelIdentity(local, embeddingModel.source, options.dimensions);
838
+ await prepareEmbeddingServer(options, embeddingModel.source, embeddingModel.isDefault);
767
839
  const genericAdapter = getEmbeddingProvider("openai-compatible", options.config);
768
840
  if (!genericAdapter) throw new Error("OpenAI-compatible embedding transport is unavailable.");
769
841
  const result = await genericAdapter.create({
@@ -773,7 +845,6 @@ const llamaCppEmbeddingProviderAdapter = {
773
845
  remote: void 0
774
846
  });
775
847
  if (!result.provider) return result;
776
- const identity = resolveModelIdentity(local, modelPath, options.dimensions);
777
848
  return {
778
849
  provider: wrapProvider({
779
850
  provider: result.provider,
@@ -905,7 +976,7 @@ function buildCompat(props) {
905
976
  supportsReasoningEffort: false,
906
977
  supportsTemperature: true,
907
978
  supportsUsageInStreaming: true,
908
- supportsTools: asBoolean(caps?.supports_tools) === true && asBoolean(caps?.supports_tool_calls) === true,
979
+ supportsTools: asBoolean(caps?.supports_tool_calls) === true,
909
980
  supportsStrictMode: false,
910
981
  supportsJsonSchemaResponseFormat: true,
911
982
  requiresStringContent: !(asBoolean(caps?.supports_typed_content) === true),
@@ -1073,12 +1144,9 @@ function buildLlamaCppAuthProfileRemovalPatch(config) {
1073
1144
  //#endregion
1074
1145
  //#region extensions/llama-cpp/src/external-server/setup.ts
1075
1146
  function selectSetupModelId(discovery) {
1076
- const healthy = discovery.models.filter((model) => !model.failed);
1077
- const ids = (healthy.length > 0 ? healthy : discovery.models).toSorted((left, right) => {
1078
- const leftLoaded = left.status === "loaded" || left.status === "sleeping";
1079
- const rightLoaded = right.status === "loaded" || right.status === "sleeping";
1080
- return Number(rightLoaded) - Number(leftLoaded);
1081
- }).map((model) => model.config.id);
1147
+ const candidates = discovery.models.filter((model) => !model.failed);
1148
+ const ready = candidates.filter((model) => model.status === "loaded" || model.status === "sleeping");
1149
+ const ids = (ready.length > 0 ? ready : candidates).map((model) => model.config.id);
1082
1150
  return selectPreferredLocalModelId(ids) ?? ids[0];
1083
1151
  }
1084
1152
  function describeDiscoveryFailure(result) {
@@ -1176,21 +1244,27 @@ async function removeDefaultAuthProfile(agentDir) {
1176
1244
  profileIds: [LLAMA_CPP_DEFAULT_PROFILE_ID]
1177
1245
  })) throw new Error("Failed to remove the previous llama-server auth profile; wait a moment and retry.");
1178
1246
  }
1179
- async function discoverForSetup(params) {
1180
- const providerConfig = params.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
1181
- const headers = await resolveLlamaServerProviderHeaders({
1182
- config: params.config,
1183
- env: params.env,
1184
- headers: providerConfig?.headers
1185
- });
1186
- const resolvedApiKey = !hasLlamaServerAuthorizationHeader(headers) ? await resolveLlamaServerRuntimeApiKey({ config: params.config }) : void 0;
1187
- return await discoverLlamaServer({
1188
- baseUrl: params.baseUrl,
1189
- apiKey: resolvedApiKey,
1190
- headers,
1191
- signal: params.signal,
1192
- cacheTtlMs: 0
1193
- });
1247
+ async function discoverForSetup(ctx) {
1248
+ const provider = ctx.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
1249
+ if (provider?.localService) return null;
1250
+ try {
1251
+ const headers = await resolveLlamaServerProviderHeaders({
1252
+ config: ctx.config,
1253
+ env: ctx.env,
1254
+ headers: provider?.headers
1255
+ });
1256
+ const apiKey = !hasLlamaServerAuthorizationHeader(headers) ? await resolveLlamaServerRuntimeApiKey({ config: ctx.config }) : void 0;
1257
+ const discovery = await discoverLlamaServer({
1258
+ baseUrl: provider?.baseUrl ?? "http://127.0.0.1:8080",
1259
+ apiKey,
1260
+ headers,
1261
+ signal: ctx.signal,
1262
+ cacheTtlMs: 0
1263
+ });
1264
+ return discovery.kind === "success" ? discovery : null;
1265
+ } catch {
1266
+ return null;
1267
+ }
1194
1268
  }
1195
1269
  async function discoverWithAccess(params) {
1196
1270
  return await discoverLlamaServer({
@@ -1203,21 +1277,8 @@ async function discoverWithAccess(params) {
1203
1277
  }
1204
1278
  /** Read-only discovery for the guided local-provider setup ladder. */
1205
1279
  async function detectLlamaServerSetup(ctx) {
1206
- const provider = ctx.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
1207
- if (provider?.localService) return null;
1208
- const baseUrl = provider?.baseUrl ?? "http://127.0.0.1:8080";
1209
- let discovery;
1210
- try {
1211
- discovery = await discoverForSetup({
1212
- config: ctx.config,
1213
- baseUrl,
1214
- env: ctx.env,
1215
- signal: ctx.signal
1216
- });
1217
- } catch {
1218
- return null;
1219
- }
1220
- if (discovery.kind !== "success") return null;
1280
+ const discovery = await discoverForSetup(ctx);
1281
+ if (!discovery) return null;
1221
1282
  const modelId = selectSetupModelId(discovery);
1222
1283
  if (!modelId) return null;
1223
1284
  return {
@@ -1227,20 +1288,8 @@ async function detectLlamaServerSetup(ctx) {
1227
1288
  }
1228
1289
  /** Rechecks one guided candidate and returns the config needed for a live probe. */
1229
1290
  async function prepareLlamaServerSetup(ctx) {
1230
- const provider = ctx.config.models?.providers?.[LLAMA_CPP_PROVIDER_ID];
1231
- if (provider?.localService) return null;
1232
- let discovery;
1233
- try {
1234
- discovery = await discoverForSetup({
1235
- config: ctx.config,
1236
- baseUrl: provider?.baseUrl ?? "http://127.0.0.1:8080",
1237
- env: ctx.env,
1238
- signal: ctx.signal
1239
- });
1240
- } catch {
1241
- return null;
1242
- }
1243
- if (discovery.kind !== "success") return null;
1291
+ const discovery = await discoverForSetup(ctx);
1292
+ if (!discovery) return null;
1244
1293
  const prefix = `${LLAMA_CPP_PROVIDER_ID}/`;
1245
1294
  const modelId = ctx.modelRef.startsWith(prefix) ? ctx.modelRef.slice(prefix.length) : "";
1246
1295
  if (!modelId || !discovery.models.some((model) => model.config.id === modelId)) return null;
@@ -1615,6 +1664,7 @@ async function runLlamaCppSetup(ctx) {
1615
1664
  chatModelPath,
1616
1665
  contextSize,
1617
1666
  maxTokens: selected.model.maxTokens,
1667
+ embeddingModelIsDefault: true,
1618
1668
  embeddingModelPath,
1619
1669
  port: readConfiguredPort(managedExisting)
1620
1670
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/llama-cpp-provider",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.9.1-beta.1",
4
4
  "description": "OpenClaw provider for managed and external llama.cpp servers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,10 +24,10 @@
24
24
  "minHostVersion": ">=2026.6.2"
25
25
  },
26
26
  "compat": {
27
- "pluginApi": ">=2026.8.1-beta.3"
27
+ "pluginApi": ">=2026.9.1-beta.1"
28
28
  },
29
29
  "build": {
30
- "openclawVersion": "2026.8.1-beta.3"
30
+ "openclawVersion": "2026.9.1-beta.1"
31
31
  },
32
32
  "release": {
33
33
  "bundleRuntimeDependencies": false,
@@ -44,7 +44,7 @@
44
44
  "README.md"
45
45
  ],
46
46
  "peerDependencies": {
47
- "openclaw": ">=2026.8.1-beta.3"
47
+ "openclaw": ">=2026.9.1-beta.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "openclaw": {