mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 01:54:04 +00:00
* refactor: centralize inbound supplemental context * refactor: trim supplemental finalizer typing * docs: clarify supplemental context projection * refactor: move inbound finalization into core * refactor: simplify channel inbound facts * refactor: fold supplemental media into inbound finalizer * refactor: migrate channel inbound callers to builder * docs: mark inbound finalizer compat types deprecated * refactor: wire runtime turn context builder * refactor: replace channel turn runtime API * fix: respect discord quote visibility * fix: avoid deprecated line dispatch helper * refactor: deprecate channel message SDK seams * docs: trim channel outbound SDK page * test: migrate irc inbound assertion * refactor: deprecate outbound SDK facades * refactor: deprecate channel helper SDK facades * refactor: deprecate channel streaming SDK facade * refactor: move direct dm helpers into inbound SDK * chore: mark legacy test-utils SDK alias deprecated * refactor: remove unused allow-from read helper * refactor: route remaining channel dispatch through core * refactor: enforce modern extension SDK imports * test: give slow image root tests more time * ci: support node fallback on windows * fix: add transcripts tool display metadata * refactor: trim legacy channel test seams * fix: preserve channel compat after rebase * fix: keep deprecated channel inbound aliases * fix: preserve discord thread context visibility * fix: clean final rebase conflicts * fix: preserve channel message dispatch aliases * fix: sync channel refactor after rebase * fix: sync channel refactor after latest main * fix: dedupe memory-core subagent mock * test: align clickclack inbound dispatch assertions * fix: sync plugin sdk api hash after rebase * fix: sync channel refactor after latest main * fix: sync plugin sdk api hash after rebase * fix: sync plugin sdk api hash after latest main * test: remove stale inbound context awaits
101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import { execNodeEvalSync } from "../test-utils/node-process.js";
|
|
import {
|
|
cleanupTrackedTempDirs,
|
|
makeTrackedTempDir,
|
|
mkdirSafeDir,
|
|
} from "./test-helpers/fs-fixtures.js";
|
|
|
|
const tempRoots: string[] = [];
|
|
|
|
function makeTempDir() {
|
|
return makeTrackedTempDir("openclaw-plugin-loader", tempRoots);
|
|
}
|
|
|
|
const mkdirSafe = mkdirSafeDir;
|
|
|
|
afterEach(() => {
|
|
cleanupTrackedTempDirs(tempRoots);
|
|
});
|
|
|
|
describe("plugin loader git path regression", () => {
|
|
it("loads git-style package extension entries when they import plugin-sdk subpaths (#49806)", () => {
|
|
const copiedExtensionRoot = path.join(makeTempDir(), "extensions", "imessage");
|
|
const copiedSourceDir = path.join(copiedExtensionRoot, "src");
|
|
const copiedPluginSdkDir = path.join(copiedExtensionRoot, "plugin-sdk");
|
|
mkdirSafe(copiedSourceDir);
|
|
mkdirSafe(copiedPluginSdkDir);
|
|
const sourceLoaderBaseFile = path.join(copiedSourceDir, "__jiti-base__.mjs");
|
|
fs.writeFileSync(sourceLoaderBaseFile, "export {};\n", "utf-8");
|
|
fs.writeFileSync(
|
|
path.join(copiedSourceDir, "channel.runtime.ts"),
|
|
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
import { PAIRING_APPROVED_MESSAGE } from "../runtime-api.js";
|
|
|
|
export const copiedRuntimeMarker = {
|
|
resolveOutboundSendDep,
|
|
PAIRING_APPROVED_MESSAGE,
|
|
};
|
|
`,
|
|
"utf-8",
|
|
);
|
|
fs.writeFileSync(
|
|
path.join(copiedExtensionRoot, "runtime-api.ts"),
|
|
`export const PAIRING_APPROVED_MESSAGE = "paired";
|
|
`,
|
|
"utf-8",
|
|
);
|
|
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "channel-outbound.ts");
|
|
fs.writeFileSync(
|
|
copiedChannelRuntimeShim,
|
|
`export function resolveOutboundSendDep() {
|
|
return "shimmed";
|
|
}
|
|
`,
|
|
"utf-8",
|
|
);
|
|
const copiedChannelRuntime = path.join(copiedExtensionRoot, "src", "channel.runtime.ts");
|
|
const script = `
|
|
import { createJiti } from "jiti";
|
|
const withoutAlias = createJiti(${JSON.stringify(sourceLoaderBaseFile)}, {
|
|
interopDefault: true,
|
|
tryNative: false,
|
|
extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
|
|
});
|
|
let withoutAliasThrew = false;
|
|
try {
|
|
withoutAlias(${JSON.stringify(copiedChannelRuntime)});
|
|
} catch {
|
|
withoutAliasThrew = true;
|
|
}
|
|
const withAlias = createJiti(${JSON.stringify(sourceLoaderBaseFile)}, {
|
|
interopDefault: true,
|
|
tryNative: false,
|
|
extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
|
|
alias: {
|
|
"openclaw/plugin-sdk/channel-outbound": ${JSON.stringify(copiedChannelRuntimeShim)},
|
|
},
|
|
});
|
|
const mod = withAlias(${JSON.stringify(copiedChannelRuntime)});
|
|
console.log(JSON.stringify({
|
|
withoutAliasThrew,
|
|
marker: mod.copiedRuntimeMarker?.PAIRING_APPROVED_MESSAGE,
|
|
dep: mod.copiedRuntimeMarker?.resolveOutboundSendDep?.(),
|
|
}));
|
|
`;
|
|
const raw = execNodeEvalSync(script, {
|
|
cwd: process.cwd(),
|
|
});
|
|
const result = JSON.parse(raw) as {
|
|
withoutAliasThrew: boolean;
|
|
marker?: string;
|
|
dep?: string;
|
|
};
|
|
expect(result.withoutAliasThrew).toBe(true);
|
|
expect(result.marker).toBe("paired");
|
|
expect(result.dep).toBe("shimmed");
|
|
});
|
|
});
|