Files
fusion/plugins/fusion-plugin-openclaw-runtime
Fusion 0aa2bf621d feat(FN-2706): merge fusion/fn-2706 (auto-resolved)
- feat(FN-2706): complete Step 6 — document Paperclip REST runtime behavior
- test(FN-2706): cover getAgentIdentity success and request payload assertions
- fix(FN-2706): align promptWithFallback signature with runtime contract
- fix(FN-2706): add session dispose compatibility for engine callers
- fix(FN-2706): refine Paperclip API client error and config handling
- test(FN-2706): complete Step 4 — cover paperclip api client and adapter flow
- feat(FN-2706): complete Step 3 — wire plugin settings and remove engine guard
- feat(FN-2706): complete Step 2 — rewrite paperclip runtime adapter
- fix(FN-2706): restore compatibility exports during runtime migration
- feat(FN-2706): complete Step 1 — add Paperclip REST client
2026-04-27 10:52:46 -07:00
..
2026-04-26 21:27:49 -07:00

OpenClaw Runtime Plugin

fusion-plugin-openclaw-runtime provides the openclaw runtime hint for Fusion agents by calling a locally running OpenClaw gateway over HTTP.

Unlike the default runtime, this plugin does not delegate to Fusion's internal pi runtime. It talks directly to OpenClaw's OpenAI-compatible endpoint.

Prerequisites

  1. Install OpenClaw globally:
npm i -g openclaw
  1. Start your OpenClaw gateway with chat-completions endpoint enabled.
  2. Ensure the gateway is reachable from Fusion (default: http://127.0.0.1:18789).

Installation

Option 1: Copy to plugins directory

cp -r fusion-plugin-openclaw-runtime ~/.fusion/plugins/

Option 2: Install via CLI

fn plugin install ./plugins/fusion-plugin-openclaw-runtime

Runtime Metadata

  • Plugin ID: fusion-plugin-openclaw-runtime
  • Package name: @fusion-plugin-examples/openclaw-runtime
  • Runtime ID: openclaw
  • Runtime name: OpenClaw Runtime
  • Version: 0.1.0

Plugin Settings

Configure via plugin settings (ctx.settings) or environment variables.

Setting key Env fallback Default
gatewayUrl OPENCLAW_GATEWAY_URL http://127.0.0.1:18789
gatewayToken OPENCLAW_GATEWAY_TOKEN unset
agentId OPENCLAW_AGENT_ID main

Settings take precedence over environment variables.

How Execution Works

For each prompt, the runtime sends a streaming request to:

  • POST /v1/chat/completions
  • Content-Type: application/json
  • Authorization: Bearer <gatewayToken> (when configured)
  • x-openclaw-agent-id: <agentId>

Request payload includes:

  • model: "openclaw:<agentId>"
  • stream: true
  • messages: [...]
  • user: <stable-session-id> (so repeated turns share a stable gateway session)

Streaming uses SSE (data: ... + [DONE]), with callbacks wired for:

  • text deltas (choices[0].delta.content)
  • reasoning deltas (choices[0].delta.reasoning_content)
  • tool call lifecycle (choices[0].delta.tool_calls)

Agent Configuration

Configure an agent to target OpenClaw via runtimeConfig.runtimeHint:

{
  "name": "OpenClaw Executor",
  "role": "executor",
  "runtimeConfig": {
    "runtimeHint": "openclaw"
  }
}

Notes

  • This plugin no longer depends on @fusion/engine.
  • Session cleanup is a no-op client-side; OpenClaw manages gateway sessions.

Local Development

pnpm --filter @fusion-plugin-examples/openclaw-runtime test
pnpm --filter @fusion-plugin-examples/openclaw-runtime build