fix: make node-llama-cpp optional for npm installs

This commit is contained in:
Peter Steinberger 2026-03-12 16:45:44 +00:00
parent 9f08af1f06
commit 115f24819e
No known key found for this signature in database
4 changed files with 33 additions and 0 deletions

View File

@ -82,6 +82,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Windows/install: stop auto-installing `node-llama-cpp` during normal npm CLI installs so `openclaw@latest` no longer fails on Windows while building optional local-embedding dependencies.
- Agents/text sanitization: strip leaked model control tokens (`<|...|>` and full-width `<...>` variants) from user-facing assistant text, preventing GLM-5 and DeepSeek internal delimiters from reaching end users. (#42173) Thanks @imwyvern.
- iOS/gateway foreground recovery: reconnect immediately on foreground return after stale background sockets are torn down, so the app no longer stays disconnected until a later wake path happens. (#41384) Thanks @mbelinky.
- Gateway/Control UI: keep dashboard auth tokens in session-scoped browser storage so same-tab refreshes preserve remote token auth without restoring long-lived localStorage token persistence, while scoping tokens to the selected gateway URL and fragment-only bootstrap flow. (#40892) thanks @velvet-shark.

View File

@ -419,6 +419,11 @@
"@napi-rs/canvas": "^0.1.89",
"node-llama-cpp": "3.16.2"
},
"peerDependenciesMeta": {
"node-llama-cpp": {
"optional": true
}
},
"engines": {
"node": ">=22.16.0"
},

View File

@ -11,6 +11,8 @@ type PackageJson = {
license?: string;
repository?: { url?: string } | string;
bin?: Record<string, string>;
peerDependencies?: Record<string, string>;
peerDependenciesMeta?: Record<string, { optional?: boolean }>;
};
export type ParsedReleaseVersion = {
@ -140,6 +142,16 @@ export function collectReleasePackageMetadataErrors(pkg: PackageJson): string[]
`package.json bin.openclaw must be "openclaw.mjs"; found "${pkg.bin?.openclaw ?? ""}".`,
);
}
if (pkg.peerDependencies?.["node-llama-cpp"] !== "3.16.2") {
errors.push(
`package.json peerDependencies["node-llama-cpp"] must be "3.16.2"; found "${
pkg.peerDependencies?.["node-llama-cpp"] ?? ""
}".`,
);
}
if (pkg.peerDependenciesMeta?.["node-llama-cpp"]?.optional !== true) {
errors.push('package.json peerDependenciesMeta["node-llama-cpp"].optional must be true.');
}
return errors;
}

View File

@ -86,7 +86,22 @@ describe("collectReleasePackageMetadataErrors", () => {
license: "MIT",
repository: { url: "git+https://github.com/openclaw/openclaw.git" },
bin: { openclaw: "openclaw.mjs" },
peerDependencies: { "node-llama-cpp": "3.16.2" },
peerDependenciesMeta: { "node-llama-cpp": { optional: true } },
}),
).toEqual([]);
});
it("requires node-llama-cpp to stay an optional peer", () => {
expect(
collectReleasePackageMetadataErrors({
name: "openclaw",
description: "Multi-channel AI gateway with extensible messaging integrations",
license: "MIT",
repository: { url: "git+https://github.com/openclaw/openclaw.git" },
bin: { openclaw: "openclaw.mjs" },
peerDependencies: { "node-llama-cpp": "3.16.2" },
}),
).toContain('package.json peerDependenciesMeta["node-llama-cpp"].optional must be true.');
});
});