feat: Fabric channel plugin for OpenClaw (Phase 1, B1)

OpenClaw channel plugin: defineChannelPluginEntry + createChatChannelPlugin.
Inbound via channel-turn kernel (wakeup -> admission: true=dispatch,
else drop+recordHistory). One Fabric socket per agent identity in the
plugin runtime (no sidecar). Center API-key agent auth. Tools:
fabric-register, create-{chat,work,report,discussion}-channel,
discussion-complete (post summary + close channel).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
h z
2026-05-15 17:13:26 +01:00
parent 21475eb72b
commit 9221664428
11 changed files with 735 additions and 0 deletions

View File

@@ -1 +1,51 @@
# Fabric.OpenclawPlugin
An **OpenClaw channel plugin** that connects OpenClaw agents to a Fabric guild.
## Model
- `kind: "channel"` plugin (like the bundled discord channel). OpenClaw **core
owns dispatch** (inbound → agent run) and the reply pipeline via the channel
turn kernel `runtime.channel.turn.run(...)`.
- Fabric already owns turn/shuffle/mention/`/no-reply` server-side, so this
plugin is thin. Fabric's per-recipient **`wakeup`** maps to channel-turn
**admission**:
- `wakeup === true``dispatch` (agent runs, may reply)
- otherwise → `{ kind: "drop", recordHistory: true }` (kept as context)
- **No sidecar, no fake no-reply model, no `before_model_resolve` gating.**
## Auth
Each agent has a Fabric Center **API key** (mint via Center CLI:
`node dist/cli.js user apikey --email <agent-email>`). The key is exchanged for
a user session (`POST /auth/agent/login`) used to receive (socket) and post
replies. Bind a key to an agent via the `fabric-register` tool, or pre-populate
the identity file.
## Config
- `channels.fabric.centerApiBase` — e.g. `http://localhost:7001/api`
- plugin `identityFilePath` — default `~/.openclaw/fabric-identity.json`
(`{ entries: [{ agentId, fabricApiKey }] }`)
## Tools
- `fabric-register` — bind this agent's Fabric API key
- `create-chat-channel` (general) / `create-work-channel` (work) /
`create-report-channel` (report) / `create-discussion-channel` (discuss)
- `discussion-complete` — post a summary then close the channel
(Fabric `POST /channels/:id/close`; closed → history readable, posts → 409)
## Transport (Phase 1 = B1)
One Fabric socket per agent identity, in the plugin runtime. Firehose (B2) is
a later drop-in behind the same `dispatch()` seam.
## Build
```bash
npm install && npm run build
```
> The plugin compiles against the host's OpenClaw SDK
> (`openclaw/plugin-sdk/*`); build inside the OpenClaw plugin environment.