refactor(plugin-sdk): split infra runtime barrel

This commit is contained in:
Peter Steinberger
2026-04-27 20:48:09 +01:00
parent d7c3a77b93
commit f0000ab72d
104 changed files with 405 additions and 165 deletions

View File

@@ -1137,8 +1137,8 @@ describe("plugin-sdk subpath exports", () => {
expect(typeof textRuntimeSdk.createScopedExpiringIdCache).toBe("function");
expect(typeof textRuntimeSdk.resolveGlobalMap).toBe("function");
expect(typeof textRuntimeSdk.resolveGlobalSingleton).toBe("function");
expectSourceMentions("infra-runtime", ["createRuntimeOutboundDelegates"]);
expectSourceContains("infra-runtime", "../infra/outbound/send-deps.js");
expectSourceMentions("delivery-queue-runtime", ["drainPendingDeliveries"]);
expectSourceContains("delivery-queue-runtime", "../infra/outbound/deliver-runtime.js");
expectSourceMentions("error-runtime", ["formatUncaughtError", "isApprovalNotFoundError"]);
expect(typeof channelLifecycleSdk.createDraftStreamLoop).toBe("function");

View File

@@ -7,8 +7,8 @@ const ALLOWED_PLUGIN_SDK_FIXTURE_IMPORTS = new Set([
'src/plugins/loader.test.ts:configSchema: (require("openclaw/plugin-sdk").emptyPluginConfigSchema)(),',
'src/plugins/loader.test.ts:const { onDiagnosticEvent } = require("openclaw/plugin-sdk");',
// Intentional jiti alias regression test.
'src/plugins/loader.git-path-regression.test.ts:`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime";',
'src/plugins/loader.git-path-regression.test.ts: "openclaw/plugin-sdk/infra-runtime": ${JSON.stringify(copiedChannelRuntimeShim)},',
'src/plugins/loader.git-path-regression.test.ts:`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-send-deps";',
'src/plugins/loader.git-path-regression.test.ts: "openclaw/plugin-sdk/outbound-send-deps": ${JSON.stringify(copiedChannelRuntimeShim)},',
// Intentional packaged bundled-plugin SDK alias regression tests.
'src/plugins/loader.test.ts:`import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";`,',
]);

View File

@@ -21,7 +21,7 @@ afterEach(() => {
});
describe("plugin loader git path regression", () => {
it("loads git-style package extension entries when they import plugin-sdk infra-runtime (#49806)", async () => {
it("loads git-style package extension entries when they import plugin-sdk subpaths (#49806)", async () => {
const copiedExtensionRoot = path.join(makeTempDir(), "extensions", "imessage");
const copiedSourceDir = path.join(copiedExtensionRoot, "src");
const copiedPluginSdkDir = path.join(copiedExtensionRoot, "plugin-sdk");
@@ -31,7 +31,7 @@ describe("plugin loader git path regression", () => {
fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8");
fs.writeFileSync(
path.join(copiedSourceDir, "channel.runtime.ts"),
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime";
`import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-send-deps";
import { PAIRING_APPROVED_MESSAGE } from "../runtime-api.js";
export const copiedRuntimeMarker = {
@@ -47,7 +47,7 @@ export const copiedRuntimeMarker = {
`,
"utf-8",
);
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts");
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "outbound-send-deps.ts");
fs.writeFileSync(
copiedChannelRuntimeShim,
`export function resolveOutboundSendDep() {
@@ -75,7 +75,7 @@ export const copiedRuntimeMarker = {
tryNative: false,
extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
alias: {
"openclaw/plugin-sdk/infra-runtime": ${JSON.stringify(copiedChannelRuntimeShim)},
"openclaw/plugin-sdk/outbound-send-deps": ${JSON.stringify(copiedChannelRuntimeShim)},
},
});
const mod = withAlias(${JSON.stringify(copiedChannelRuntime)});

View File

@@ -1063,7 +1063,7 @@ describe("plugin sdk alias helpers", () => {
fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8");
fs.writeFileSync(
path.join(copiedSourceDir, "channel.runtime.ts"),
`import { resolveOutboundSendDep } from "@openclaw/plugin-sdk/infra-runtime";
`import { resolveOutboundSendDep } from "@openclaw/plugin-sdk/outbound-send-deps";
export const syntheticRuntimeMarker = {
resolveOutboundSendDep,
@@ -1071,7 +1071,7 @@ export const syntheticRuntimeMarker = {
`,
"utf-8",
);
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts");
const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "outbound-send-deps.ts");
fs.writeFileSync(
copiedChannelRuntimeShim,
`export function resolveOutboundSendDep() {
@@ -1092,8 +1092,8 @@ export const syntheticRuntimeMarker = {
const withAlias = createJiti(jitiBaseUrl, {
...buildPluginLoaderJitiOptions({
"openclaw/plugin-sdk/infra-runtime": copiedChannelRuntimeShim,
"@openclaw/plugin-sdk/infra-runtime": copiedChannelRuntimeShim,
"openclaw/plugin-sdk/outbound-send-deps": copiedChannelRuntimeShim,
"@openclaw/plugin-sdk/outbound-send-deps": copiedChannelRuntimeShim,
}),
tryNative: false,
});