mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
3.1 KiB
3.1 KiB
title, summary, description, read_when
| title | summary | description | read_when | ||
|---|---|---|---|---|---|
| Diffs | Read-only diff viewer and PNG renderer for agents (optional plugin tool) | Use the optional Diffs plugin to render before/after text or unified patches as a gateway-hosted diff view or a PNG. |
|
Diffs
diffs is an optional plugin tool that renders a read-only diff from either:
- arbitrary
before/aftertext - a unified patch
The tool can produce:
- a gateway-hosted viewer URL for canvas use
- a PNG image for message delivery
- both outputs together
Enable the plugin
{
plugins: {
entries: {
diffs: {
enabled: true,
},
},
},
}
What agents get back
mode: "view"returnsdetails.viewerUrlanddetails.viewerPathmode: "image"returnsdetails.imagePathonlymode: "both"returns the viewer details plusdetails.imagePath
Typical agent patterns:
- open
details.viewerUrlin canvas withcanvas present - send
details.imagePathwith themessagetool usingpathorfilePath
Tool inputs
Before/after input:
{
"before": "# Hello\n\nOne",
"after": "# Hello\n\nTwo",
"path": "docs/example.md",
"mode": "view"
}
Patch input:
{
"patch": "diff --git a/src/example.ts b/src/example.ts\n--- a/src/example.ts\n+++ b/src/example.ts\n@@ -1 +1 @@\n-const x = 1;\n+const x = 2;\n",
"mode": "both"
}
Useful options:
mode:view,image, orbothlayout:unifiedorsplittheme:lightordarkexpandUnchanged: expand unchanged sections instead of collapsing thempath: display name for before/after inputtitle: explicit diff titlettlSeconds: viewer artifact lifetimebaseUrl: override the gateway base URL used in the returned viewer link
Plugin defaults
Set plugin-wide defaults in ~/.openclaw/openclaw.json:
{
plugins: {
entries: {
diffs: {
enabled: true,
config: {
defaults: {
fontFamily: "Fira Code",
fontSize: 15,
lineSpacing: 1.6,
layout: "unified",
showLineNumbers: true,
diffIndicators: "bars",
wordWrap: true,
background: true,
theme: "dark",
mode: "both",
},
},
},
},
},
}
Supported defaults:
fontFamilyfontSizelineSpacinglayoutshowLineNumbersdiffIndicatorswordWrapbackgroundthememode
Explicit tool parameters override the plugin defaults.
Notes
- Viewer pages are hosted locally by the gateway under
/plugins/diffs/.... - Viewer artifacts are ephemeral and stored locally.
mode: "image"uses a faster image-only render path and does not create a viewer URL.- PNG rendering requires a Chromium-compatible browser. If auto-detection is not enough, set
browser.executablePath. - Diff rendering is powered by Diffs.