feat(memory): restrict registerMemoryPromptSection to memory plugins
Throw if a non-memory plugin attempts to register a memory prompt section builder, enforcing the exclusive slot constraint at the API level.
This commit is contained in:
parent
02222b93c5
commit
d827603bc9
@ -2,6 +2,7 @@ import path from "node:path";
|
||||
import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import { registerContextEngineForOwner } from "../context-engine/registry.js";
|
||||
import { registerMemoryPromptSection } from "../memory/prompt-section.js";
|
||||
import type {
|
||||
GatewayRequestHandler,
|
||||
GatewayRequestHandlers,
|
||||
@ -979,6 +980,21 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
|
||||
});
|
||||
}
|
||||
},
|
||||
registerMemoryPromptSection: (builder) => {
|
||||
if (registrationMode !== "full") {
|
||||
return;
|
||||
}
|
||||
if (record.kind !== "memory") {
|
||||
pushDiagnostic({
|
||||
level: "error",
|
||||
pluginId: record.id,
|
||||
source: record.source,
|
||||
message: "only memory plugins can register a memory prompt section",
|
||||
});
|
||||
return;
|
||||
}
|
||||
registerMemoryPromptSection(builder);
|
||||
},
|
||||
resolvePath: (input: string) => resolveUserPath(input),
|
||||
on: (hookName, handler, opts) =>
|
||||
registrationMode === "full"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user