mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 01:41:40 +00:00
fix(channels): preserve external catalog overrides (#52988)
* fix(channels): preserve external catalog overrides * fix(channels): clarify catalog precedence * fix(channels): respect overridden install specs
This commit is contained in:
@@ -82,6 +82,29 @@ describe("plugin install plan helpers", () => {
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("rejects plugin-id bundled matches when the catalog npm spec was overridden", () => {
|
||||
const findBundledSource = vi
|
||||
.fn()
|
||||
.mockImplementation(({ kind }: { kind: "pluginId" | "npmSpec"; value: string }) => {
|
||||
if (kind === "pluginId") {
|
||||
return {
|
||||
pluginId: "whatsapp",
|
||||
localPath: "/tmp/extensions/whatsapp",
|
||||
npmSpec: "@openclaw/whatsapp",
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
const result = resolveBundledInstallPlanForCatalogEntry({
|
||||
pluginId: "whatsapp",
|
||||
npmSpec: "@vendor/whatsapp-fork",
|
||||
findBundledSource,
|
||||
});
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("uses npm-spec bundled fallback only for package-not-found", () => {
|
||||
const findBundledSource = vi.fn().mockReturnValue({
|
||||
pluginId: "voice-call",
|
||||
|
||||
@@ -23,14 +23,6 @@ export function resolveBundledInstallPlanForCatalogEntry(params: {
|
||||
return null;
|
||||
}
|
||||
|
||||
const bundledById = params.findBundledSource({
|
||||
kind: "pluginId",
|
||||
value: pluginId,
|
||||
});
|
||||
if (bundledById?.pluginId === pluginId) {
|
||||
return { bundledSource: bundledById };
|
||||
}
|
||||
|
||||
const bundledBySpec = params.findBundledSource({
|
||||
kind: "npmSpec",
|
||||
value: npmSpec,
|
||||
@@ -39,7 +31,18 @@ export function resolveBundledInstallPlanForCatalogEntry(params: {
|
||||
return { bundledSource: bundledBySpec };
|
||||
}
|
||||
|
||||
return null;
|
||||
const bundledById = params.findBundledSource({
|
||||
kind: "pluginId",
|
||||
value: pluginId,
|
||||
});
|
||||
if (bundledById?.pluginId !== pluginId) {
|
||||
return null;
|
||||
}
|
||||
if (bundledById.npmSpec && bundledById.npmSpec !== npmSpec) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { bundledSource: bundledById };
|
||||
}
|
||||
|
||||
export function resolveBundledInstallPlanBeforeNpm(params: {
|
||||
|
||||
Reference in New Issue
Block a user