mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
perf(whatsapp): add doctor contract fast path
This commit is contained in:
8
extensions/whatsapp/doctor-contract-api.ts
Normal file
8
extensions/whatsapp/doctor-contract-api.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ChannelDoctorLegacyConfigRule } from "openclaw/plugin-sdk/channel-contract";
|
||||
|
||||
export { normalizeCompatibilityConfig } from "./src/doctor-contract.js";
|
||||
|
||||
// WhatsApp currently exposes doctor compatibility fixes without extra legacy
|
||||
// rule scans. Keep that empty answer on a lightweight contract surface so
|
||||
// config validation stays off the broad contract-api import path.
|
||||
export const legacyConfigRules: ChannelDoctorLegacyConfigRule[] = [];
|
||||
@@ -13,6 +13,11 @@ const { loadBundledPluginPublicArtifactModuleSyncMock } = vi.hoisted(() => ({
|
||||
],
|
||||
};
|
||||
}
|
||||
if (dirName === "whatsapp" && artifactBasename === "doctor-contract-api.js") {
|
||||
return {
|
||||
legacyConfigRules: [],
|
||||
};
|
||||
}
|
||||
if (dirName === "telegram" && artifactBasename === "contract-api.js") {
|
||||
return {
|
||||
legacyConfigRules: [
|
||||
@@ -52,6 +57,20 @@ describe("channel doctor contract api fast path", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("treats empty explicit doctor contract rules as authoritative", () => {
|
||||
const api = loadBundledChannelDoctorContractApi("whatsapp");
|
||||
|
||||
expect(api?.legacyConfigRules).toEqual([]);
|
||||
expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({
|
||||
dirName: "whatsapp",
|
||||
artifactBasename: "doctor-contract-api.js",
|
||||
});
|
||||
expect(loadBundledPluginPublicArtifactModuleSyncMock).not.toHaveBeenCalledWith({
|
||||
dirName: "whatsapp",
|
||||
artifactBasename: "contract-api.js",
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to the generic contract artifact when the doctor artifact is absent", () => {
|
||||
const api = loadBundledChannelDoctorContractApi("telegram");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user