feat: add plugin text transforms

This commit is contained in:
Peter Steinberger
2026-04-11 02:03:11 +01:00
parent a2dbc1b63c
commit 202f80792e
32 changed files with 866 additions and 50 deletions

View File

@@ -719,6 +719,37 @@ describe("loadOpenClawPlugins", () => {
expect(bundled?.status).toBe("disabled");
});
it("registers standalone text transforms", () => {
useNoBundledPlugins();
const plugin = writePlugin({
id: "text-shim",
filename: "text-shim.cjs",
body: `module.exports = {
id: "text-shim",
register(api) {
api.registerTextTransforms({
input: [{ from: /red basket/g, to: "blue basket" }],
output: [{ from: /blue basket/g, to: "red basket" }],
});
},
};`,
});
const registry = loadRegistryFromSinglePlugin({
plugin,
pluginConfig: { allow: ["text-shim"] },
});
expect(registry.textTransforms).toHaveLength(1);
expect(registry.textTransforms[0]).toMatchObject({
pluginId: "text-shim",
transforms: {
input: expect.any(Array),
output: expect.any(Array),
},
});
});
it.each([
{
name: "loads bundled telegram plugin when enabled",