Files
Plexum-fabric-channel-plugin/README.md
hzhang 6def33161b feat: Phase F-6 — attachments + final docs (F-8 = no-op)
F-6 attachments:
- internal/attachments/ (~145 LOC + 8 tests): per-message Downloader
  that fetches Fabric attachment URLs into $TMPDIR/plexum-fabric/<msg-id>/
  with the agent's guild token, sanitizing filenames + message ids
  against path-traversal
- AppendFooter renders downloaded paths as a markdown footer
  ("Attachments:\n  - /tmp/... (mime, N bytes)\n")
- Agents access via the exec MCP tool (cat / file / etc.)

internal/inbound.Supervisor:
- new Attachments *attachments.Downloader field (nil → skip with warn)
- inbound.dispatch: when message has attachments, blocking-download +
  AppendFooter before emitting notification (so agent's first turn
  sees the paths)

cmd/plexum-fabric-channel-plugin:
- sup.Attachments = attachments.New("") wired at init

F-8 coalesce: no-op. openclaw plugin's coalesce buffered the
text→thinking→tool→text segments openclaw emits across multiple
deliver() calls per turn. Plexum's loop.Run returns ONE final assistant
text per turn (via extractFinalText), so coalescing isn't a concern.
The channel outbound posts a single message naturally.

F-5b presence-sync: deferred. The openclaw plugin pushes HarborForge
on-call status to Fabric's per-recipient presence so the backend can
busy-discard 'announce' deliveries. Plexum's state machine has
different semantics (idle/working/busy/offline) and is per-Plexum-agent
not per-user; mapping requires more design.

README updated with the phase status table + 16-tool list.

Tests: 8 new in internal/attachments (35 total in this repo).

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

98 lines
3.1 KiB
Markdown

# Plexum-fabric-channel-plugin
Native Plexum channel plugin connecting Plexum agents to **Fabric** guilds as
real channel members. Port of `Fabric.OpenclawPlugin` — delivered in phases.
## Status
| Phase | Scope | Status |
|-------|-------|--------|
| **F-1** | identity + REST + plugin scaffold + `send` outbound | ✅ |
| **F-2** | socket.io inbound + wakeup gate + token refresh + per-channel serial | ✅ |
| **F-3** | exponential reconnect backoff | ✅ |
| **F-4** | tool surface batch 1 (8 tools) | ✅ |
| **F-5** | command-sync (slash autocomplete) | ✅ |
| **F-6** | attachments → temp-dir + footer | ✅ |
| **F-7** | sub-discussion KV + create-*-channel + discussion-complete | ✅ |
| **F-8** | coalesce parity | ⏭ no-op — Plexum doesn't segment deliver |
| **F-5b** | presence-sync | ⏭ deferred — Plexum state machine ≠ HF semantics |
### Agent-facing tools (16)
- `send` — host-driven channel outbound (channel manager → plugin)
- `fabric-send-message`, `fabric-send-sys-msg` — post normal / system msgs
- `fabric-channel-list`, `fabric-guild-list` — discovery
- `fabric-message-history` — paginate by seq
- `fabric-channel`, `fabric-channel-set-purpose` — channel metadata
- `fabric-canvas` — get/share/update/remove canvas
- `create-{chat,work,report,discussion}-channel` — create new channels
- `discussion-complete` — summary + close
- `create-sub-discussion`, `close-sub-discussion` — sub-discussion lifecycle
## 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.