feat(FN-3717): add OpenClaw MCP bridge (+5 more)

Commits merged:
- docs(FN-3717): update openclaw runtime and settings docs
- test(FN-3717): fix openclaw engine test typing
- test(FN-3717): strengthen openclaw bridge coverage
- feat(FN-3717): complete Step 2 — wire engine and bundle delivery
- fix(FN-3717): address openclaw bridge review feedback
- feat(FN-3717): complete Step 1 — add OpenClaw MCP bridge

Files changed:
.changeset/fn-3717-openclaw-tool-bridge.md         |  5 ++
 docs/settings-reference.md                         | 28 +++++---
 packages/cli/src/__tests__/bundle-output.test.ts   |  9 +++
 packages/cli/tsup.config.ts                        |  7 ++
 .../src/__tests__/openclaw-runtime-e2e.test.ts     | 28 ++++++++
 .../__tests__/openclaw-runtime-integration.test.ts | 10 +++
 plugins/fusion-plugin-openclaw-runtime/README.md   | 13 ++++
 .../src/__tests__/cli-spawn.test.ts                | 82 +++++++++++++++++++---
 .../src/__tests__/mcp-config.test.ts               | 45 ++++++++++++
 .../src/__tests__/runtime-adapter.test.ts          | 46 ++++++++++++
 .../fusion-plugin-openclaw-runtime/src/index.ts    |  5 ++
 .../src/mcp-config.ts                              | 60 ++++++++++++++++
 .../src/mcp-schema-server.cjs                      | 59 ++++++++++++++++
 .../src/pi-module.ts                               | 52 ++++++++++++--
 .../src/runtime-adapter.ts                         | 26 +++++++
 .../fusion-plugin-openclaw-runtime/src/types.ts    |  4 ++
 16 files changed, 457 insertions(+), 22 deletions(-)

Fusion-Task-Id: FN-3717
This commit is contained in:
Fusion
2026-05-07 17:56:43 -07:00
committed by gsxdsm
parent f43a5fd029
commit 4c204c9485
16 changed files with 457 additions and 22 deletions

View File

@@ -116,6 +116,11 @@ describe("OpenClaw runtime E2E pipeline", () => {
return;
}
if (args.includes("mcp") && args.includes("set")) {
child.emit("close", 0);
return;
}
if (args.includes("agent") && args.includes("--json")) {
const payload = JSON.stringify({
payloads: [{ text: "OpenClaw response" }],
@@ -197,6 +202,13 @@ describe("OpenClaw runtime E2E pipeline", () => {
cwd: testRoot,
systemPrompt: "You are helpful",
tools: "coding",
customTools: [{
name: "fn_task_list",
label: "fn_task_list",
description: "list",
parameters: { type: "object" },
execute: vi.fn(),
} as any],
skills: ["bash"],
});
@@ -209,6 +221,22 @@ describe("OpenClaw runtime E2E pipeline", () => {
"openclaw/openclaw-agent/openclaw/openclaw-agent",
);
expect(mockCreateFnAgent).not.toHaveBeenCalled();
const spawnArgs = mockSpawn.mock.calls.map(([, args]) => args as string[]);
expect(spawnArgs.some((args) => args.includes("mcp") && args.includes("set"))).toBe(true);
expect(spawnArgs.some((args) => args.includes("agent") && args.includes("--profile"))).toBe(true);
});
it("keeps agent argv unchanged when no custom tools are provided", async () => {
const adapterModule = await import(pathToFileURL(openClawPluginModulePath()).href);
const adapter = new adapterModule.OpenClawRuntimeAdapter({ agentId: "openclaw-agent" });
const { session } = await adapter.createSession({ cwd: testRoot, systemPrompt: "sys" });
await adapter.promptWithFallback(session, "hello");
const agentCall = mockSpawn.mock.calls.find(([, args]) => (args as string[]).includes("agent"));
expect(agentCall).toBeTruthy();
const agentArgs = agentCall?.[1] as string[];
expect(agentArgs.includes("--profile")).toBe(false);
});
it("falls back to default pi runtime when OpenClaw plugin is not installed", async () => {

View File

@@ -145,6 +145,14 @@ describe("OpenClaw runtime integration via engine resolution pipeline", () => {
getRuntimeById: vi.fn().mockReturnValue(registration),
});
const customTool = {
name: "fn_task_show",
label: "fn_task_show",
description: "show",
parameters: { type: "object" },
execute: vi.fn(),
} as any;
const result = await createResolvedAgentSession({
sessionPurpose: "executor",
runtimeHint: "openclaw",
@@ -152,6 +160,7 @@ describe("OpenClaw runtime integration via engine resolution pipeline", () => {
cwd: "/tmp/project",
systemPrompt: "You are helpful",
tools: "coding",
customTools: [customTool],
});
expect(result.runtimeId).toBe("openclaw");
@@ -162,6 +171,7 @@ describe("OpenClaw runtime integration via engine resolution pipeline", () => {
cwd: "/tmp/project",
systemPrompt: "You are helpful",
tools: "coding",
customTools: [customTool],
});
});