feat(fabric): dynamic-subscription via fabric-register openclaw tool #12

Merged
hzhang merged 1 commits from feat/dynamic-account-subscription into main 2026-06-01 07:57:10 +00:00
Contributor

Summary

Plugin manifest declared fabric-register but tools.ts never registered it. Standalone /root/.openclaw/bin/fabric-register binary writes the identity file but exits without notifying the running plugin → fabric inbound's subscription stayed a connect-time snapshot → every new agent needed a gateway restart between new-agent and the interview's sub-discussion or the message had no socket to dispatch on.

Changes

  • FabricInbound.addAccount(entry) / removeAccount(agentId) — per-agent socket + timer tracking. Idempotent (re-add replaces existing).
  • __fabric.addAccount / removeAccount cross-plugin bridges in index.ts.
  • fabric-register openclaw tool — validates apiKey via Center login, delegates to the bridge, returns { ok, fabricUserId, displayName }.
  • Reworded ctxGuild's "agent not registered" hint to point at the tool instead of the binary + restart.

Test plan

  • Local rebuild emits the new tool registration (name: 'fabric-register' in dist/fabric/src/tools.js).
  • Deploy + recruit a fresh agent: new-agent should be followed directly by the interviewer subworkflow with the agent's socket already live (no gateway restart in between).
## Summary Plugin manifest declared `fabric-register` but tools.ts never registered it. Standalone `/root/.openclaw/bin/fabric-register` binary writes the identity file but exits without notifying the running plugin → fabric inbound's subscription stayed a connect-time snapshot → every new agent needed a gateway restart between `new-agent` and the interview's sub-discussion or the message had no socket to dispatch on. ## Changes - `FabricInbound.addAccount(entry)` / `removeAccount(agentId)` — per-agent socket + timer tracking. Idempotent (re-add replaces existing). - `__fabric.addAccount` / `removeAccount` cross-plugin bridges in index.ts. - `fabric-register` openclaw tool — validates apiKey via Center login, delegates to the bridge, returns { ok, fabricUserId, displayName }. - Reworded ctxGuild's "agent not registered" hint to point at the tool instead of the binary + restart. ## Test plan - [x] Local rebuild emits the new tool registration (`name: 'fabric-register'` in dist/fabric/src/tools.js). - [ ] Deploy + recruit a fresh agent: `new-agent` should be followed directly by the `interviewer` subworkflow with the agent's socket already live (no gateway restart in between).
hzhang added 1 commit 2026-06-01 07:57:10 +00:00
The plugin manifest declared `fabric-register` as a tool name but
tools.ts never registered it — recruitment fell through to the
standalone `/root/.openclaw/bin/fabric-register` binary, which writes
~/.openclaw/fabric-identity.json correctly but exits without notifying
the running plugin. That left fabric inbound's subscription as a
connect-time snapshot: every new agent required a gateway restart
between `new-agent` and the interview's sub-discussion or the message
had no socket to dispatch on.

Wire the full path:
  - `FabricInbound.addAccount(entry)` — login, upsert identity, open socket(s),
    track per-agent so removeAccount can teardown cleanly. Idempotent: a
    second call replaces the previous socket (used post-onboard when the
    agent rotates off the shared `interviewee` placeholder onto its own
    apikey).
  - `FabricInbound.removeAccount(agentId)` — disconnect sockets, clear
    timers + per-agent caches.
  - `__fabric.addAccount` / `removeAccount` — cross-plugin bridge so the
    `fabric-register` tool can reach the live FabricInbound instance from
    its tool handler context.
  - `fabric-register` openclaw tool — validates apiKey, calls
    `__fabric.addAccount`, returns `{ok, fabricUserId, displayName}`.
    Accepts `agentId` arg so recruitment can bind on behalf of a
    freshly-created agent before that agent has a session of its own.

Removes the "restart the gateway" advice from the ctxGuild
"agent not registered" error message — operators should now call the
tool path instead.

After this lands + the ClawSkills register-agent script flip (separate
commit), `recruitment.new-agent` -> interviewer sub-discussion runs
without a gateway restart in between.
hzhang merged commit fc2ab628b2 into main 2026-06-01 07:57:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nav/Fabric.OpenclawPlugin#12