mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
Merged via squash.
Prepared head SHA: 585697a4e1
Co-authored-by: sircrumpet <4436535+sircrumpet@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import path from "node:path";
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk";
|
|
import {
|
|
diffsPluginConfigSchema,
|
|
resolveDiffsPluginDefaults,
|
|
resolveDiffsPluginSecurity,
|
|
} from "./src/config.js";
|
|
import { createDiffsHttpHandler } from "./src/http.js";
|
|
import { DiffArtifactStore } from "./src/store.js";
|
|
import { createDiffsTool } from "./src/tool.js";
|
|
|
|
const plugin = {
|
|
id: "diffs",
|
|
name: "Diffs",
|
|
description: "Read-only diff viewer and PNG/PDF renderer for agents.",
|
|
configSchema: diffsPluginConfigSchema,
|
|
register(api: OpenClawPluginApi) {
|
|
const defaults = resolveDiffsPluginDefaults(api.pluginConfig);
|
|
const security = resolveDiffsPluginSecurity(api.pluginConfig);
|
|
const store = new DiffArtifactStore({
|
|
rootDir: path.join(resolvePreferredOpenClawTmpDir(), "openclaw-diffs"),
|
|
logger: api.logger,
|
|
});
|
|
|
|
api.registerTool(createDiffsTool({ api, store, defaults }));
|
|
api.registerHttpRoute({
|
|
path: "/plugins/diffs",
|
|
auth: "plugin",
|
|
match: "prefix",
|
|
handler: createDiffsHttpHandler({
|
|
store,
|
|
logger: api.logger,
|
|
allowRemoteViewer: security.allowRemoteViewer,
|
|
}),
|
|
});
|
|
},
|
|
};
|
|
|
|
export default plugin;
|