mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 04:11:12 +00:00
New openclaw delegation tool relays to openclaw.chat in-process; persistent writes surface through the existing durable operator-approval registry as a third system-agent kind (no parallel store), armed only by a human operator in the Control UI — a delegated agent can never self-approve. Setup wizards (channel/model/open-setup/open-tui) are refused in delegated mode so a machine agent cannot complete setup or persist credentials unattended. Vendor-neutral inference fallback ladder (requester route first, then other authed providers by provider id). update.run removed from the gateway tool. Caveman system-prompt fragment steers config/channels/plugins/agents/updates to the openclaw tool. Doctor-owned state migration widens the approval-kind constraint; runtime stays canonical-only. Refs #107237
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
/**
|
|
* Tests baseline tool availability for assembled agent tools.
|
|
* Ensures control-plane tools remain present and node-originated runs receive
|
|
* the restricted node-safe subset.
|
|
*/
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import "./test-helpers/fast-coding-tools.js";
|
|
import "./test-helpers/fast-openclaw-tools.js";
|
|
import { createOpenClawCodingTools } from "./agent-tools.js";
|
|
|
|
vi.mock("./channel-tools.js", () => {
|
|
const passthrough = <T>(tool: T) => tool;
|
|
const stubTool = (name: string) => ({
|
|
name,
|
|
description: `${name} stub`,
|
|
parameters: { type: "object", properties: {} },
|
|
execute: vi.fn(),
|
|
});
|
|
return {
|
|
listChannelAgentTools: () => [stubTool("plugin_login")],
|
|
copyChannelAgentToolMeta: passthrough,
|
|
getChannelAgentToolMeta: () => undefined,
|
|
};
|
|
});
|
|
|
|
describe("tool availability", () => {
|
|
it("keeps control-plane tools available", () => {
|
|
const tools = createOpenClawCodingTools();
|
|
const toolNames = tools.map((tool) => tool.name);
|
|
expect(toolNames).toContain("plugin_login");
|
|
expect(toolNames).toContain("cron");
|
|
expect(toolNames).toContain("gateway");
|
|
expect(toolNames).toContain("nodes");
|
|
expect(toolNames).toContain("openclaw");
|
|
});
|
|
|
|
it("keeps canvas available by current trust model", () => {
|
|
const tools = createOpenClawCodingTools();
|
|
const toolNames = tools.map((tool) => tool.name);
|
|
expect(toolNames).toContain("canvas");
|
|
});
|
|
|
|
it("restricts node-originated runs to the node-safe tool subset", () => {
|
|
const tools = createOpenClawCodingTools({ messageProvider: "node" });
|
|
const toolNames = tools.map((tool) => tool.name);
|
|
expect(toolNames).toContain("canvas");
|
|
expect(toolNames).not.toContain("exec");
|
|
expect(toolNames).not.toContain("read");
|
|
expect(toolNames).not.toContain("write");
|
|
expect(toolNames).not.toContain("edit");
|
|
expect(toolNames).not.toContain("message");
|
|
expect(toolNames).not.toContain("sessions_send");
|
|
expect(toolNames).not.toContain("subagents");
|
|
});
|
|
});
|