refactor(plugin): fabric-register is a script, not a tool
Binding an agent's Fabric API key was an OpenClaw tool; make it a self-contained Node script installed to ~/.openclaw/bin/fabric-register instead. - bin/fabric-register.mjs: no plugin deps; AGENT_ID env wins, else --agent-id required; --api-key validated via POST /auth/agent/login; on success upserts ~/.openclaw/fabric-identity.json (format matches IdentityRegistry). Flags/env for center, identity-file, openclaw-path. - install.mjs: copy the script to ~/.openclaw/bin (chmod 0755) on install, remove on uninstall; Next-steps updated. - tools.ts: drop the fabric-register tool; ctxGuild error now points to the script / static accounts config. - README updated. Verified: missing-id -> exit 2; --agent-id and AGENT_ID both bind and write a valid identity file; bad key -> 401, no write. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
30
README.md
30
README.md
@@ -38,8 +38,31 @@ host and OpenClaw's SSRF guard would block re-fetching it.
|
||||
|
||||
Each agent has a Fabric Center **API key** (mint via Center CLI:
|
||||
`node dist/cli.js user apikey --email <agent-email>`). The key is exchanged
|
||||
for a user session (`POST /auth/agent/login`). Bind a key to an agent with
|
||||
the `fabric-register` tool, or via `channels.fabric.accounts`.
|
||||
for a user session (`POST /auth/agent/login`).
|
||||
|
||||
### Binding a key to an agent (one-time)
|
||||
|
||||
Two ways, both write the same identity registry the transport reads:
|
||||
|
||||
1. **Static config** — set `channels.fabric.accounts.<agentId> =
|
||||
{ fabricApiKey, enabled }`. The agent never runs anything.
|
||||
2. **`fabric-register` script** — installed to `~/.openclaw/bin/fabric-register`
|
||||
by the installer (it is **not** an OpenClaw tool):
|
||||
|
||||
```bash
|
||||
# agent id from $AGENT_ID (set in the agent runtime):
|
||||
~/.openclaw/bin/fabric-register --api-key fak_…
|
||||
# or pass it explicitly:
|
||||
~/.openclaw/bin/fabric-register --agent-id <agent> --api-key fak_…
|
||||
```
|
||||
|
||||
It validates the key against Center, then writes
|
||||
`~/.openclaw/fabric-identity.json`. One-time and persistent — *not* per
|
||||
login; the plugin's transport logs in and stays connected on its own.
|
||||
`AGENT_ID` env wins; otherwise `--agent-id` is required. Other flags:
|
||||
`--center`, `--identity-file`, `--openclaw-path` (env equivalents:
|
||||
`FABRIC_API_KEY`, `FABRIC_CENTER_API_BASE`, `FABRIC_IDENTITY_FILE`,
|
||||
`OPENCLAW_PATH`). Restart the gateway afterwards.
|
||||
|
||||
## Config
|
||||
|
||||
@@ -61,7 +84,8 @@ Then `openclaw gateway restart`.
|
||||
|
||||
## Tools
|
||||
|
||||
- `fabric-register` — bind this agent's Fabric API key
|
||||
(Key binding is **not** a tool — see *Binding a key to an agent* above.)
|
||||
|
||||
- `create-chat-channel` (general) / `create-work-channel` (work) /
|
||||
`create-report-channel` (report) / `create-discussion-channel` (discuss)
|
||||
- `discussion-complete` — post a summary, then close the channel
|
||||
|
||||
Reference in New Issue
Block a user