Files
Plexum-fabric-channel-plugin/README.md
hzhang f8d43ae70e feat: Phase F-1 — Plexum-fabric-channel-plugin foundation
Ports the foundation of Fabric.OpenclawPlugin to a native Plexum
channel plugin (Go). F-2+ phases (socket.io inbound, wakeup gate,
tools, presence, etc.) follow.

Layout:
  internal/identity/      — fabric-identity.json registry (agent → API key)
  internal/fabric/        — REST client (Center auth + Guild messaging)
  internal/config/        — channels/<name>.json fabric extension parser
  cmd/plexum-fabric-register/      — agent registration CLI
  cmd/plexum-fabric-channel-plugin/— Plexum SDK plugin entry
  scripts/install.sh      — build + install + manifest generator

Plugin behavior (F-1):
- Reads <profile>/channels/*.json, filters plugin=plexum-fabric-channel,
  builds (plexum-channel-name → fabric channel-id) index
- Validates each bound agent's API key against Center at init
  (warmSessions); logs warning but doesn't refuse init on bad keys
- `send` MCP tool: POST plain text to the bound Fabric channel as the
  agent user; selects guild endpoint+token from cached session
- Manifest channels[] is generated by install.sh from current
  channels/*.json — re-run with --reset-manifest after adding bindings
- Plugin-private config at
  <profile>/plugins/plexum-fabric-channel/config.json
  (center_api_base, default http://localhost:7001/api)

Live smoke verified:
- plexum-fabric-register against running Fabric Center (port 7001):
  validated fak_..., wrote identity file with user_id + email captured

Tests: identity (5) + config (6) = 11 unit tests.

F-2 will hook socket.io for inbound + wakeup gating + token refresh.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 15:13:34 +01:00

86 lines
2.3 KiB
Markdown

# Plexum-fabric-channel-plugin
Native Plexum channel plugin connecting Plexum agents to **Fabric** guilds as
real channel members. Inspired by `Fabric.OpenclawPlugin` — Plexum port,
delivered in phases.
## Status
**Phase F-1 (foundation) — current**: identity registry, Center auth, REST
client, plugin scaffold, channel-binding discovery. The `send` outbound tool
posts plain text to a Fabric channel as the bound agent.
**Phase F-2 (deferred)**: socket.io inbound, wakeup-gated dispatch, token
refresh, per-channel serial queue.
**Phase F-3+ (deferred)**: tools.ts port (~15 MCP tools — channel/canvas/
sub-discussion/etc.), presence sync, command sync, attachments, coalesce
parity.
## Install
```bash
cd ~/Plexum-fabric-channel-plugin
./scripts/install.sh # build + install plugin + register CLI
```
Then:
1. **Mint a Center API key** for each Plexum agent that should speak in Fabric:
```bash
docker exec fabric-backend-center node dist/cli.js user apikey --email <agent-email>
```
2. **Register the key** with Plexum:
```bash
plexum-fabric-register --agent-id alice --api-key fak_xxxx
# writes ~/.plexum/fabric-identity.json
```
3. **Configure plugin-level settings** at
`~/.plexum/plugins/plexum-fabric-channel/config.json`:
```json
{
"center_api_base": "http://localhost:7001/api"
}
```
4. **Bind a Plexum channel name to a Fabric channel** at
`~/.plexum/channels/<plexum-channel-name>.json`:
```json
{
"agent_id": "alice",
"plugin": "plexum-fabric-channel",
"fabric": {
"guild_node_id": "test-guild1",
"channel_id": "ch_xxxxxxxxx"
}
}
```
5. **Allow the plugin** in `~/.plexum/plexum.json`:
```json
{"plugins": {"allow": ["plexum-fabric-channel"]}}
```
6. **Restart the gateway**: `systemctl --user restart plexum`
## What you get in F-1
- Plugin loads at gateway start, validates every bound agent's API key
against Center via `agentLogin`, and warms a session per agent.
- `send` MCP tool posts plain text to the bound Fabric channel as the
agent user.
- No inbound yet — Fabric → Plexum routing arrives in F-2.
## Build manually
```bash
go build -o bin/plexum-fabric-channel-plugin ./cmd/plexum-fabric-channel-plugin
go build -o bin/plexum-fabric-register ./cmd/plexum-fabric-register
```
## License
Same as Plexum.