feat(fabric): dynamic-subscription via fabric-register openclaw tool #12
Reference in New Issue
Block a user
Delete Branch "feat/dynamic-account-subscription"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Plugin manifest declared
fabric-registerbut tools.ts never registered it. Standalone/root/.openclaw/bin/fabric-registerbinary 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 betweennew-agentand 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/removeAccountcross-plugin bridges in index.ts.fabric-registeropenclaw tool — validates apiKey via Center login, delegates to the bridge, returns { ok, fabricUserId, displayName }.Test plan
name: 'fabric-register'in dist/fabric/src/tools.js).new-agentshould be followed directly by theinterviewersubworkflow with the agent's socket already live (no gateway restart in between).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.