hzhang ed3676ebc8 feat: Phase F-5+F-7 — command-sync + sub-discussion + channel-create tools
Bundles the remaining "agent does things in Fabric" surface, skipping
presence-sync (Plexum's state machine isn't 1:1 with HF status semantics)
and attachments (Plexum has no media pipeline yet) — both deferred.

internal/subdisc/ (~140 LOC + 5 tests): persistent KV at
<profile>/state/plugin-kv/fabric-sub-discussions.json
- Entry: SubChannelID, HostAgentID, HostUserID, GuestUserIDs,
  HostGuide, GuestGuide, CallbackGuildNodeID, CallbackChannelID, CreatedAt
- Open / Lookup / LookupForHost (host-enforcement) / Add / Remove / All
- atomic tmp+rename persistence; corrupt file = start empty

internal/tools/tools.go — 7 new tools:
- create-chat-channel       (xType=general)
- create-work-channel       (xType=work)
- create-report-channel     (xType=report)
- create-discussion-channel (xType=discuss)
- discussion-complete       (post summary + close channel)
- create-sub-discussion     (create + invite + KV store + greeting)
- close-sub-discussion      (host-only; posts callback to parent + closes)

internal/fabric/client.go: CreateChannel / CloseChannel /
JoinChannel / LeaveChannel / SetChannelPurpose / Canvas CRUD /
SyncCommands (added in earlier F-4 commit; reused here)

cmd/plexum-fabric-channel-plugin/main.go:
- subdisc.Store opened from DefaultPath at init; passed into tools.Deps
- HostConfig adds commands_sync_key + sync_commands (defaults
  ["new","stop"]) — F-5 command-sync to every (agent,guild) pair at
  init when key is set; silently skips when omitted
- syncCommandsToGuilds: best-effort PUT per guild, logs per-guild
  outcome

scripts/install.sh: manifest tools[] expanded to 16 entries
(9 from F-4 + 7 new). create-channel variants share a schema shape.

Live verified:
  $ plexum plugin-call create-chat-channel \
      '{"agent_id":"fabrictester","guild_node_id":"test-guild2",
        "name":"plexum-f7-smoke","is_public":true}'
    → "created general channel plexum-f7-smoke (id=6315e636-...)"
  $ plexum plugin-call fabric-channel-list ...
    → 3 channels listed including the new one

F-6 (attachments) + F-5b (presence-sync) + F-8 (coalesce) deliberately
deferred — see DEV-NOTES.

Tests: 5 new in internal/subdisc (27 total in this repo).

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

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

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:

    docker exec fabric-backend-center node dist/cli.js user apikey --email <agent-email>
    
  2. Register the key with Plexum:

    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:

    {
      "center_api_base": "http://localhost:7001/api"
    }
    
  4. Bind a Plexum channel name to a Fabric channel at ~/.plexum/channels/<plexum-channel-name>.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:

    {"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

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.

Description
Native Plexum channel plugin for Fabric
Readme 158 KiB
Languages
Go 92.9%
Shell 7.1%