mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:31:00 +00:00
fix(plugins): tighten register rollback
This commit is contained in:
@@ -1795,6 +1795,18 @@ module.exports = { id: "throws-after-import", register() {} };`,
|
||||
description: "Fail me",
|
||||
handler: async () => ({ text: "nope" }),
|
||||
});
|
||||
api.registerReload({
|
||||
onConfigReload: async () => {},
|
||||
});
|
||||
api.registerNodeHostCommand({
|
||||
command: "failme",
|
||||
description: "failme",
|
||||
run: async () => ({ ok: true }),
|
||||
});
|
||||
api.registerSecurityAuditCollector({
|
||||
id: "failme",
|
||||
collect: async () => [],
|
||||
});
|
||||
api.registerInteractiveHandler({
|
||||
channel: "slack",
|
||||
namespace: "failme",
|
||||
@@ -1831,6 +1843,9 @@ module.exports = { id: "throws-after-import", register() {} };`,
|
||||
);
|
||||
expect(getRegisteredEventKeys()).toEqual([]);
|
||||
expect(getPluginCommandSpecs()).toEqual([]);
|
||||
expect(registry.reloads).toEqual([]);
|
||||
expect(registry.nodeHostCommands).toEqual([]);
|
||||
expect(registry.securityAuditCollectors).toEqual([]);
|
||||
expect(resolvePluginInteractiveNamespaceMatch("slack", "failme:payload")).toBeNull();
|
||||
expect(getContextEngineFactory("failme-context")).toBeUndefined();
|
||||
expect(listContextEngineIds()).not.toContain("failme-context");
|
||||
|
||||
@@ -2209,6 +2209,7 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
hookPolicy: entry?.hooks,
|
||||
registrationMode,
|
||||
});
|
||||
const registrySnapshot = snapshotPluginRegistry(registry);
|
||||
const previousAgentHarnesses = listRegisteredAgentHarnesses();
|
||||
const previousCompactionProviders = listRegisteredCompactionProviders();
|
||||
const previousMemoryEmbeddingProviders = listRegisteredMemoryEmbeddingProviders();
|
||||
@@ -2217,7 +2218,6 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
const previousMemoryCorpusSupplements = listMemoryCorpusSupplements();
|
||||
const previousMemoryPromptSupplements = listMemoryPromptSupplements();
|
||||
const previousMemoryRuntime = getMemoryRuntime();
|
||||
const registrySnapshot = snapshotPluginRegistry(registry);
|
||||
|
||||
try {
|
||||
runPluginRegisterSync(register, api);
|
||||
|
||||
Reference in New Issue
Block a user