fix: stabilize contract loader seams

This commit is contained in:
Peter Steinberger
2026-04-06 04:39:22 +01:00
parent 4a690b452a
commit 4aeabf95cc
7 changed files with 40 additions and 85 deletions

View File

@@ -41,10 +41,9 @@ const sendMessageMatrixMock = vi.hoisted(() =>
roomId: to.replace(/^room:/, ""),
})),
);
const matrixRuntimeApiModuleId = new URL(
"../../../../extensions/matrix/runtime-api.js",
import.meta.url,
).href;
const matrixRuntimeApiModuleId = vi.hoisted(
() => new URL("../../../../extensions/matrix/runtime-api.js", import.meta.url).href,
);
const lineContractApi = await importBundledChannelContractArtifact<{
listLineAccountIds: () => string[];

View File

@@ -1,11 +1,19 @@
// Manual facade. Keep loader boundary explicit.
type FacadeModule = typeof import("@openclaw/mattermost/api.js");
type MattermostSenderAllowed = (params: {
senderId: string;
senderName?: string;
allowFrom: string[];
allowNameMatching?: boolean;
}) => boolean;
type FacadeModule = {
isMattermostSenderAllowed: MattermostSenderAllowed;
};
import { loadBundledPluginPublicSurfaceModuleSync } from "./facade-runtime.js";
function loadFacadeModule(): FacadeModule {
return loadBundledPluginPublicSurfaceModuleSync<FacadeModule>({
dirName: "mattermost",
artifactBasename: "api.js",
artifactBasename: "policy-api.js",
});
}
export const isMattermostSenderAllowed: FacadeModule["isMattermostSenderAllowed"] = ((...args) =>