Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11),
free to diverge. Tree copied sans upstream .git; upstream remote added for
future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19.
Preserves docs/ARCHITECTURE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

View File

@@ -0,0 +1,181 @@
// Canvas tests cover tool plugin behavior.
import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createCanvasTool } from "./tool.js";
const mocks = vi.hoisted(() => ({
callGatewayTool: vi.fn(),
imageResultFromFile: vi.fn(async (params) => ({ content: [], details: params })),
listNodes: vi.fn(async () => []),
resolveNodeIdFromList: vi.fn(() => "node-1"),
}));
vi.mock("openclaw/plugin-sdk/agent-harness-runtime", () => ({
callGatewayTool: mocks.callGatewayTool,
listNodes: mocks.listNodes,
resolveNodeIdFromList: mocks.resolveNodeIdFromList,
}));
vi.mock("openclaw/plugin-sdk/channel-actions", async (importOriginal) => ({
...(await importOriginal<typeof import("openclaw/plugin-sdk/channel-actions")>()),
imageResultFromFile: mocks.imageResultFromFile,
}));
describe("Canvas tool", () => {
let tempRoot: string | undefined;
beforeEach(() => {
mocks.callGatewayTool.mockReset();
mocks.imageResultFromFile.mockClear();
mocks.listNodes.mockClear();
mocks.listNodes.mockResolvedValue([]);
mocks.resolveNodeIdFromList.mockClear();
mocks.resolveNodeIdFromList.mockReturnValue("node-1");
});
afterEach(async () => {
if (tempRoot) {
await rm(tempRoot, { recursive: true, force: true });
tempRoot = undefined;
}
});
it.skipIf(process.platform === "win32")(
"rejects jsonlPath symlinks that resolve outside the workspace",
async () => {
tempRoot = await mkdtemp(path.join(os.tmpdir(), "openclaw-canvas-tool-"));
const workspaceDir = path.join(tempRoot, "workspace");
await mkdir(workspaceDir);
const outsidePath = path.join(tempRoot, "outside.jsonl");
await writeFile(outsidePath, '{"secret":true}\n');
await symlink(outsidePath, path.join(workspaceDir, "events.jsonl"));
const tool = createCanvasTool({ workspaceDir });
await expect(
tool.execute("tool-call-1", {
action: "a2ui_push",
jsonlPath: "events.jsonl",
}),
).rejects.toThrow("jsonlPath outside workspace");
expect(mocks.callGatewayTool).not.toHaveBeenCalled();
},
);
it("applies configured image limits to canvas snapshots", async () => {
mocks.callGatewayTool.mockResolvedValue({
payload: {
format: "png",
base64: Buffer.from("not-a-real-png").toString("base64"),
},
});
const tool = createCanvasTool({
config: {
agents: {
defaults: {
imageMaxDimensionPx: 1600.9,
},
},
},
});
await tool.execute("tool-call-1", { action: "snapshot" });
expect(mocks.imageResultFromFile).toHaveBeenCalledTimes(1);
const imageResultParams = mocks.imageResultFromFile.mock.calls[0]?.[0] as
| {
label?: string;
path?: string;
details?: unknown;
imageSanitization?: unknown;
}
| undefined;
expect(imageResultParams?.label).toBe("canvas:snapshot");
expect(imageResultParams?.path).toMatch(/openclaw-canvas-snapshot-.*\.png$/);
expect(imageResultParams?.details).toEqual({ format: "png" });
expect(imageResultParams?.imageSanitization).toEqual({ maxDimensionPx: 1600 });
});
it("normalizes numeric string params before invoking node canvas commands", async () => {
mocks.callGatewayTool.mockResolvedValue({
payload: {
format: "png",
base64: Buffer.from("not-a-real-png").toString("base64"),
},
});
const tool = createCanvasTool();
await tool.execute("tool-call-1", {
action: "present",
timeoutMs: "1500",
x: "10.5",
y: "-2",
width: "640",
height: "480",
});
expect(mocks.callGatewayTool).toHaveBeenLastCalledWith(
"node.invoke",
{ timeoutMs: 1500 },
expect.objectContaining({
command: "canvas.present",
params: {
placement: {
x: 10.5,
y: -2,
width: 640,
height: 480,
},
},
}),
);
await tool.execute("tool-call-2", {
action: "snapshot",
maxWidth: "800",
quality: "0.75",
});
expect(mocks.callGatewayTool).toHaveBeenLastCalledWith(
"node.invoke",
{},
expect.objectContaining({
command: "canvas.snapshot",
params: {
format: "png",
maxWidth: 800,
quality: 0.75,
},
}),
);
});
it("rejects malformed numeric canvas params before invoking node commands", async () => {
const tool = createCanvasTool();
await expect(
tool.execute("tool-call-1", {
action: "snapshot",
maxWidth: "800px",
}),
).rejects.toThrow("maxWidth must be a positive integer");
expect(mocks.callGatewayTool).not.toHaveBeenCalled();
});
it("rejects node-controlled snapshot formats before creating image results", async () => {
mocks.callGatewayTool.mockResolvedValue({
payload: {
format: "/../../target.sh",
base64: Buffer.from("not-a-real-png").toString("base64"),
},
});
const tool = createCanvasTool();
await expect(tool.execute("tool-call-1", { action: "snapshot" })).rejects.toThrow(
/invalid canvas\.snapshot payload/i,
);
expect(mocks.imageResultFromFile).not.toHaveBeenCalled();
});
});