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

@@ -175,6 +175,28 @@ API key auth, and dynamic model resolution.
`openclaw onboard --acme-ai-api-key <key>` and select
`acme-ai/acme-large` as their model.
If the upstream provider uses different control tokens than OpenClaw, add a
small bidirectional text transform instead of replacing the stream path:
```typescript
api.registerTextTransforms({
input: [
{ from: /red basket/g, to: "blue basket" },
{ from: /paper ticket/g, to: "digital ticket" },
{ from: /left shelf/g, to: "right shelf" },
],
output: [
{ from: /blue basket/g, to: "red basket" },
{ from: /digital ticket/g, to: "paper ticket" },
{ from: /right shelf/g, to: "left shelf" },
],
});
```
`input` rewrites the final system prompt and text message content before
transport. `output` rewrites assistant text deltas and final text before
OpenClaw parses its own control markers or channel delivery.
For bundled providers that only register one text provider with API-key
auth plus a single catalog-backed runtime, prefer the narrower
`defineSingleProviderPluginEntry(...)` helper: