mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 02:41:12 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
// Verifies plugin control-plane context construction and boundaries.
|
|
import { describe, expect, it } from "vitest";
|
|
import type { InstalledPluginIndex } from "./installed-plugin-index.js";
|
|
import { resolvePluginControlPlaneFingerprint } from "./plugin-control-plane-context.js";
|
|
|
|
function createIndex(pluginId: string): InstalledPluginIndex {
|
|
return {
|
|
version: 1,
|
|
hostContractVersion: "test",
|
|
compatRegistryVersion: "test",
|
|
migrationVersion: 1,
|
|
policyHash: "policy",
|
|
generatedAtMs: 1,
|
|
installRecords: {},
|
|
diagnostics: [],
|
|
plugins: [
|
|
{
|
|
pluginId,
|
|
manifestPath: `/plugins/${pluginId}/openclaw.plugin.json`,
|
|
manifestHash: `${pluginId}-manifest-hash`,
|
|
rootDir: `/plugins/${pluginId}`,
|
|
origin: "global",
|
|
enabled: true,
|
|
startup: {
|
|
sidecar: false,
|
|
memory: false,
|
|
deferConfiguredChannelFullLoadUntilAfterListen: false,
|
|
agentHarnesses: [],
|
|
},
|
|
compat: [],
|
|
},
|
|
],
|
|
};
|
|
}
|
|
|
|
describe("plugin control-plane context", () => {
|
|
it("includes policy, inventory, and activation in one control-plane fingerprint", () => {
|
|
const config = { plugins: { allow: ["demo"] } };
|
|
const base = resolvePluginControlPlaneFingerprint({
|
|
config,
|
|
env: { HOME: "/home/a", OPENCLAW_HOME: "/openclaw/a" } as NodeJS.ProcessEnv,
|
|
index: createIndex("demo"),
|
|
activationFingerprint: "activation-a",
|
|
});
|
|
|
|
expect(
|
|
resolvePluginControlPlaneFingerprint({
|
|
config,
|
|
env: { HOME: "/home/a", OPENCLAW_HOME: "/openclaw/a" } as NodeJS.ProcessEnv,
|
|
index: createIndex("other"),
|
|
activationFingerprint: "activation-a",
|
|
}),
|
|
).not.toBe(base);
|
|
expect(
|
|
resolvePluginControlPlaneFingerprint({
|
|
config,
|
|
env: { HOME: "/home/a", OPENCLAW_HOME: "/openclaw/a" } as NodeJS.ProcessEnv,
|
|
index: createIndex("demo"),
|
|
activationFingerprint: "activation-b",
|
|
}),
|
|
).not.toBe(base);
|
|
expect(
|
|
resolvePluginControlPlaneFingerprint({
|
|
config: { plugins: { deny: ["demo"] } },
|
|
env: { HOME: "/home/a", OPENCLAW_HOME: "/openclaw/a" } as NodeJS.ProcessEnv,
|
|
index: createIndex("demo"),
|
|
activationFingerprint: "activation-a",
|
|
}),
|
|
).not.toBe(base);
|
|
});
|
|
});
|