@tpsdev-ai/flair 0.55.1 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +3 -3
  2. package/dist/bridges/builtins/markdown.js +2 -2
  3. package/dist/bridges/discover.js +2 -2
  4. package/dist/bridges/runtime/allow-list.js +2 -2
  5. package/dist/build-info.json +3 -3
  6. package/dist/cli.js +201 -95
  7. package/dist/commands/attention.js +2 -2
  8. package/dist/commands/backup.js +2 -2
  9. package/dist/commands/doctor.js +168 -37
  10. package/dist/commands/export.js +2 -2
  11. package/dist/commands/federation.js +229 -95
  12. package/dist/commands/hook.js +4 -4
  13. package/dist/commands/init.js +94 -70
  14. package/dist/commands/mcp.js +2 -2
  15. package/dist/commands/migrate-harness-memory.js +8 -8
  16. package/dist/commands/rem.js +31 -4
  17. package/dist/commands/service.js +25 -1
  18. package/dist/commands/session.js +2 -2
  19. package/dist/commands/uninstall.js +2 -2
  20. package/dist/commands/upgrade.js +88 -69
  21. package/dist/doctor-client.js +341 -161
  22. package/dist/engine-version.js +2 -2
  23. package/dist/federation/scheduler.js +5 -5
  24. package/dist/hook-install.js +359 -176
  25. package/dist/install/clients.js +908 -214
  26. package/dist/keystore.js +10 -2
  27. package/dist/lib/auth-resolve.js +5 -5
  28. package/dist/lib/config-critical-section.js +557 -0
  29. package/dist/lib/doctor-config-path.js +2 -2
  30. package/dist/lib/doctor-run.js +107 -27
  31. package/dist/lib/flair-paths.js +29 -0
  32. package/dist/lib/home.js +60 -0
  33. package/dist/lib/launchd-repair.js +109 -0
  34. package/dist/lib/mcp-enable.js +4 -4
  35. package/dist/lib/owned-pins.js +256 -94
  36. package/dist/lib/pin-write-guard.js +87 -0
  37. package/dist/lib/settings-bytes.js +85 -0
  38. package/dist/lib/socket-path-limit.js +120 -0
  39. package/dist/lib/uninstall-purge.js +2 -18
  40. package/dist/lib/upgrade-plain-tree.js +2 -2
  41. package/dist/lib/upgrade-status.js +164 -0
  42. package/dist/lib/wiring-spec.js +238 -0
  43. package/dist/mcp-client-assertion.js +3 -3
  44. package/dist/rem/promote-policy.js +102 -0
  45. package/dist/rem/runner.js +3 -3
  46. package/dist/rem/scheduler.js +5 -5
  47. package/dist/rem/snapshot.js +2 -2
  48. package/dist/resources/MemoryReflect.js +10 -0
  49. package/dist/resources/OAuth.js +62 -11
  50. package/dist/resources/Presence.js +135 -47
  51. package/dist/resources/admin-layout.js +7 -2
  52. package/dist/resources/auto-promote-lib.js +56 -0
  53. package/dist/resources/health.js +26 -0
  54. package/dist/resources/memory-reflect-lib.js +215 -6
  55. package/dist/resources/migrations/progress.js +17 -0
  56. package/dist/resources/migrations/runner.js +46 -27
  57. package/dist/resources/migrations/status.js +2 -1
  58. package/dist/src/keystore.js +10 -2
  59. package/dist/src/lib/home.js +60 -0
  60. package/dist/src/rem/promote-policy.js +102 -0
  61. package/dist/src/rem/scheduler.js +5 -5
  62. package/dist/version-check.js +2 -2
  63. package/dist/version-handshake.js +2 -2
  64. package/docs/api-reference.md +31 -6
  65. package/docs/auth.md +14 -2
  66. package/docs/deploying-on-fabric.md +5 -4
  67. package/docs/deployment.md +26 -37
  68. package/docs/embedding-in-a-harper-app.md +4 -2
  69. package/docs/entity-vocabulary.md +5 -5
  70. package/docs/federation.md +58 -19
  71. package/docs/hosted-on-fabric.md +7 -5
  72. package/docs/mcp-clients.md +29 -12
  73. package/docs/releasing.md +66 -22
  74. package/docs/spoke-bringup.md +41 -22
  75. package/docs/standalone-local.md +12 -16
  76. package/package.json +3 -1
@@ -213,16 +213,18 @@ See [upgrade.md](upgrade.md#upgrading-a-fabric-deployed-instance) for the full w
213
213
  Available. Pair a local spoke to a Fabric-hosted hub:
214
214
 
215
215
  ```bash
216
- # On any machine (no shell on the hub) — generate a pairing token triple
217
- FLAIR_ADMIN_PASS=<hub-admin-password> flair federation token \
216
+ # On any machine (no shell on the hub) — generate a pairing token triple. /path/to/hub-admin-pass is a 0600 file holding the HUB admin password (never a literal on the command line: it would land in shell history)
217
+ (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat /path/to/hub-admin-pass)" flair federation token \
218
218
  --target https://<cluster>.<org>.harperfabric.com \
219
- --ops-target <ops-url> > ./pair-triple.json
219
+ --ops-target <ops-url> > ./pair-triple.json)
220
220
 
221
- # On the spoke — pair to the Fabric hub
222
- flair federation pair https://<cluster>.<org>.harperfabric.com \
221
+ # On the spoke — the SPOKE admin password (its own ~/.flair/admin-pass) writes the local Peer row
222
+ FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<cluster>.<org>.harperfabric.com \
223
223
  --token-from ./pair-triple.json
224
224
  ```
225
225
 
226
+ `set -C` refuses an existing `./pair-triple.json`; remove an old one first (`rm ./pair-triple.json`).
227
+
226
228
  ### Pairing limitation
227
229
 
228
230
  The scheduled sync driver (`flair federation sync enable`) writes a launchd job or systemd timer **on the machine running the CLI** — it cannot be installed on a Fabric node. A periodic one-shot from the spoke machine is the workaround.
@@ -32,7 +32,20 @@ flair status
32
32
 
33
33
  > **`flair: command not found` right after installing?** Your npm global prefix's bin dir isn't on PATH (common with a user prefix like `~/.npm-global`) — run `export PATH="$(npm prefix -g)/bin:$PATH"`, persist that line in your shell profile, and `flair doctor` will print the exact line for your shell any time.
34
34
 
35
- Flair runs as a local server at `http://127.0.0.1:19926` by default. The MCP server connects to it on demand via Ed25519-signed requests; nothing leaves your machine unless you explicitly route to a remote Flair instance.
35
+ Flair runs as a local server at `http://127.0.0.1:19926` by default. The MCP server this page configures connects to it on demand via Ed25519-signed requests; nothing leaves your machine unless you explicitly route to a remote Flair instance.
36
+
37
+ ## Two MCP paths
38
+
39
+ The snippets below are the **local** path. Flair also has a native `/mcp` endpoint, and the two are not substitutes. The [README](../README.md#one-install-one-binary) names both; this section is why each exists.
40
+
41
+ | Client | Path | Auth |
42
+ |--------|------|------|
43
+ | MCP client on this machine (Claude Code, Cursor, Codex, Gemini, and the snippets below) | `npx -y @tpsdev-ai/flair-mcp@<version>` stdio adapter | Ed25519 over HTTP to the instance |
44
+ | Remote MCP client that must dial a public HTTPS origin | Native `/mcp` on the instance | OAuth bearer. Unmounted until `FLAIR_MCP_OAUTH=true` and a public issuer are set (otherwise the path 404s). |
45
+
46
+ Native `/mcp` is remote-only by design. The OAuth authorization server fetches client metadata over HTTPS and refuses private, loopback, and link-local hosts. `flair mcp enable` refuses localhost, loopback, RFC1918, IPv4 link-local, and `.local`. Set `FLAIR_MCP_OAUTH=true` — that is the one value that enables both Flair's `/mcp` route and the OAuth component. A loopback Flair cannot be the origin those clients dial. The stdio adapter is the local path because it speaks the instance's Ed25519 HTTP API and does not need that public origin.
47
+
48
+ `flair init` writes the stdio adapter. Turning on native `/mcp` is a separate operator step for a publicly reachable instance, documented from the API side in [api-reference.md](api-reference.md#mcp-tools).
36
49
 
37
50
  ---
38
51
 
@@ -286,22 +299,26 @@ If you see (a) the agent calling the `bootstrap` tool returning soul + recent me
286
299
 
287
300
  ## What the MCP server exposes
288
301
 
289
- Twelve tools, kept deliberately small:
302
+ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools/list` advertises these sixteen tools, in this order. The embedded HTTP `/mcp` handler is a different set: it also advertises `memory_basement`, `memory_restore`, and `attention`, and it does not advertise `relationship_store` or `flair_catchup`.
290
303
 
291
304
  | Tool | What it does |
292
305
  |---|---|
293
- | `memory_search` | Semantic search across your agent's memories |
294
- | `memory_store` | Save a memory with type, durability, tags, visibility. Auto-dedups near-duplicates. Optional `usedMemoryIds` cites memories that informed the write |
295
- | `memory_update` | Update an existing memory by ID — overwrite in place, or version it with `preserveHistory`. Optional `usedMemoryIds` for citation-on-write |
306
+ | `memory_search` | Semantic search across the caller's own and other agents' non-private memories |
307
+ | `memory_store` | Save a memory (type, durability, tags, visibility), attributed to the authenticated agent. Optional `usedMemoryIds` cites memories that informed the write |
308
+ | `skill_store` | Write a skill-tagged memory. `trigger` is the recall text; `content` is the procedure. Durability is forced to persistent, and SkillScan rejects a dangerous payload before embed |
309
+ | `skill_search` | Rank skills by their trigger against a task. Returns a catalog (id, name, trigger, description, tags, agentId), not the procedure |
310
+ | `skill_get` | Fetch one skill's full procedure by id. Own skills and shared skills only; a private skill owned by someone else is not returned |
311
+ | `memory_update` | Update a memory by id. Overwrites in place, or pass `preserveHistory` to write a superseding version. Optional `usedMemoryIds` |
296
312
  | `memory_get` | Fetch a specific memory by ID |
297
- | `memory_delete` | Remove a memory |
298
- | `relationship_store` | Record a subject-predicate-object relationship triple (e.g. "nathan manages flair") |
299
- | `bootstrap` | Get session-start context: soul + recent memories + predicted-relevant context |
300
- | `soul_set` | Runtime writes are refused; use operator credentials through `flair soul set` |
313
+ | `memory_delete` | Delete one of your own memories |
314
+ | `relationship_store` | Assert a subject-predicate-object triple (for example "nathan manages flair"). Asserting the same triple again updates that row |
315
+ | `bootstrap` | Session-start context: soul, memories, and predicted context. Pass `subjects` for predictive loading |
316
+ | `soul_set` | Advertised as setting a soul entry. The server refuses runtime Soul writes, including this tool's Ed25519 call; operators use `flair soul set` |
301
317
  | `soul_get` | Get a soul entry |
302
- | `flair_workspace_set` | Set your agent's current workspace state (ref/branch, phase, task) in the Office Space |
303
- | `flair_orgevent` | Publish an org-wide coordination event (claim/release/status) to the Office Space |
304
- | `record_usage` | Report that recalled memories were actually used (id + optional one-line how-it-was-used). Drives `usageCount` / `usageBoost` |
318
+ | `flair_workspace_set` | Set this agent's workspace state (ref, label, provider, task, phase, summary) in the Office Space |
319
+ | `flair_orgevent` | Publish an org-wide coordination event (claim, release, or status), attributed to the caller |
320
+ | `flair_catchup` | Drain this agent's own org-event catch-up feed. Page with `after`; advance the watermark with `ack` |
321
+ | `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
305
322
 
306
323
  Writes are scoped per-agent (your `FLAIR_AGENT_ID`) and enforced by Flair's server, not by client convention — you can't write as another agent. Reads are more open by design: any agent on the same Flair instance can read any other agent's **non-private** memories, with no grant to set up (open-within-org read; see [SECURITY.md](../SECURITY.md)).
307
324
 
package/docs/releasing.md CHANGED
@@ -7,8 +7,9 @@ Flair publishes nine workspace packages to npm under `@tpsdev-ai/*`. Releases ar
7
7
  the staged tarballs on npmjs.com with 2FA. Approval makes the version public, but
8
8
  **not `latest`** — a credential-less post-publish canary installs that exact version
9
9
  from the registry and boots it on Linux and macOS. Only a canary PASS prints the
10
- sha256-bound promote command that moves `latest`; the canary runs on the same
11
- definition of "it boots" the rockit ritual uses (`scripts/ci/check-instance-boot.sh`).
10
+ sha256-bound promote commands that move `latest` — one per lockstep package, all
11
+ or none; the canary runs on the same definition of "it boots" the rockit ritual
12
+ uses (`scripts/ci/check-instance-boot.sh`).
12
13
 
13
14
  The staging tag is an **immutable property of the staged package** (`npm help stage`):
14
15
  re-staging the same version under a different tag requires `npm stage reject` first.
@@ -29,7 +30,7 @@ There is no "fix the stage in place" — you reject it and re-cut the next patch
29
30
  │ version + boots it
30
31
  canary PASS ───────┘
31
32
  │
32
- paste the emitted promote line
33
+ paste the emitted promote block
33
34
  ▼
34
35
  latest moves
35
36
  ```
@@ -94,10 +95,11 @@ workflow, which:
94
95
 
95
96
  1. Resolves the version from the tag and validates it as semver.
96
97
  2. Verifies the tagged commit is an ancestor of `main` (a tag can't ship un-merged code).
97
- 3. Verifies all 8 `package.json` files are at that version.
98
+ 3. Verifies every lockstep package's `package.json` is at that version.
98
99
  4. Builds every package.
99
- 5. Runs `npm stage publish` for each package in dependency order (flair-client first),
100
- then `flair-bench` in its own step. Any one of the eight failing fails the release.
100
+ 5. Runs `npm stage publish` for each lockstep package in dependency order
101
+ (flair-client first), then `flair-bench` in its own step. Any lockstep package
102
+ failing to stage fails the release.
101
103
 
102
104
  It authenticates via OIDC — no secrets, and it does **not** create or move any tag (the
103
105
  tag you pushed is the trigger). Watch the run; when it's green, the packages are staged
@@ -130,9 +132,10 @@ npm stage view <stage-id> # inspect one
130
132
  npm stage approve <stage-id> # 2FA prompt; package is made public under `staged`
131
133
  ```
132
134
 
133
- There are eight lockstep-staged packages, so eight approvals (the web UI lists them on
134
- one page). Approve in dependency order if installing immediately — flair-client before
135
- its dependents — though staging does not itself resolve dependencies.
135
+ The lockstep set is nine today (`node scripts/ci/lockstep-packages.mjs` prints the
136
+ list), so that many approvals (the web UI lists them on one page). Approve in dependency
137
+ order if installing immediately — flair-client before its dependents — though staging
138
+ does not itself resolve dependencies.
136
139
 
137
140
  Approval makes each version **public but not `latest`**: a user who runs the bare
138
141
  `npm install -g @tpsdev-ai/flair` still gets the previous `latest` until the promote
@@ -176,18 +179,59 @@ not run must not read as a pass.
176
179
 
177
180
  ### Phase 5 — promote `latest` (or deprecate)
178
181
 
179
- - **On PASS**, the canary emits the complete, sha256-bound promote command. Run it
180
- from a repo checkout on a machine logged into npm:
182
+ The promote is **lockstep**: every package the release staged moves together, or
183
+ none does. `flair` at `latest` 0.55.1 while `flair-client` / `flair-mcp` / the
184
+ plugins sit at 0.54.2 is exactly the mismatch `flair#1383` detects at runtime —
185
+ and 0.55.1's promote had to be assembled by hand, line by line, for this reason.
186
+
187
+ - **On PASS**, the canary emits the complete, sha256-bound promote block as ONE
188
+ snippet to paste once, from a repo checkout on a machine logged into npm. It
189
+ runs in two phases: it verifies EVERY package's published-tarball sha256 first
190
+ (so a registry hiccup mid-paste touches no tag), then runs the `npm dist-tag
191
+ add` lines — `@tpsdev-ai/flair` LAST, so a partial paste never leaves the CLI
192
+ ahead of its client library — then the skew check. Under 2FA each `dist-tag add`
193
+ may prompt for an OTP separately, so capture one code and pass it to all of them
194
+ with `--otp`:
181
195
 
182
196
  ```bash
183
- test "$(node scripts/ci/registry-tarball-sha256.mjs <ver>)" = "<sha256>" && npm dist-tag add @tpsdev-ai/flair@<ver> latest
197
+ set -e
198
+ OTP=123456 # fresh from your authenticator; valid for a short window
199
+
200
+ # 1. Preflight — every published tarball must hash to its recorded sha256.
201
+ test "$(node scripts/ci/registry-tarball-sha256.mjs <ver> @tpsdev-ai/flair-client)" = "<sha>"
202
+ test "$(node scripts/ci/registry-tarball-sha256.mjs <ver> @tpsdev-ai/flair-mcp)" = "<sha>"
203
+ # … one line per lockstep package; @tpsdev-ai/flair last …
204
+ test "$(node scripts/ci/registry-tarball-sha256.mjs <ver> @tpsdev-ai/flair)" = "<sha>"
205
+
206
+ # 2. Promote every lockstep package (`@tpsdev-ai/flair` LAST).
207
+ npm dist-tag add @tpsdev-ai/flair-client@<ver> latest --otp "$OTP"
208
+ npm dist-tag add @tpsdev-ai/flair-mcp@<ver> latest --otp "$OTP"
209
+ # … one line per lockstep package …
210
+ npm dist-tag add @tpsdev-ai/flair@<ver> latest --otp "$OTP"
211
+
212
+ # 3. Confirm the set converged.
213
+ node scripts/ci/registry-latest-skew.mjs <ver>
184
214
  ```
185
215
 
186
- The `test` is the integrity guard: a stale PASS, a re-cut version, or a paste from a
187
- failed run aborts before `latest` moves.
188
- - **On FAIL**, the version stays public but unpromoted. The canary emits the
189
- `npm deprecate` command; run it, then re-cut the next patch. A version is never
190
- refreshed in place.
216
+ The preflight `test` guards integrity: a stale PASS, a re-cut version, or a
217
+ paste from a failed run aborts before `latest` moves. Paste **all** of the block
218
+ or **none** — a partial paste is the skew this phase exists to prevent.
219
+
220
+ The block runs under bash; `scripts/ci/canary-verdict.sh` is bash **3.2**-safe,
221
+ so stock macOS `/bin/bash` runs it (and the emitted block) locally — no newer
222
+ bash required. Anything older than 3.2 fails fast with a clear message.
223
+ - **Confirm the set converged** — the last step, after pasting:
224
+
225
+ ```bash
226
+ node scripts/ci/registry-latest-skew.mjs <ver>
227
+ ```
228
+
229
+ It reads `dist-tags.latest` for every lockstep package and exits non-zero
230
+ naming any that disagree (or that differ from `<ver>`). The canary runs the same
231
+ check BEFORE the verdict, so a pre-existing skew is visible there too.
232
+ - **On FAIL**, the version stays public but unpromoted. The canary emits one
233
+ `npm deprecate` line per package; run them, then re-cut the next patch. A
234
+ version is never refreshed in place.
191
235
 
192
236
  ## One-time setup
193
237
 
@@ -195,7 +239,8 @@ These are configured once and reused for every release.
195
239
 
196
240
  ### npm trusted publisher (per package)
197
241
 
198
- For **each** of the eight packages, on npmjs.com → the package → **Settings → Trusted
242
+ For **each** lockstep package (nine today; `node scripts/ci/lockstep-packages.mjs`
243
+ prints the list), on npmjs.com → the package → **Settings → Trusted
199
244
  Publisher → Add**:
200
245
 
201
246
  | Field | Value |
@@ -211,10 +256,9 @@ Leave `npm publish` **unchecked** under allowed actions. This structurally preve
211
256
  CI/OIDC identity from publishing anything live directly — the only path to live is the
212
257
  human 2FA approval of a staged package.
213
258
 
214
- Packages: `flair-client`, `flair-mcp`, `flair`,
215
- `openclaw-flair`, `pi-flair`, `n8n-nodes-flair`, `langgraph-flair`, `flair-bench`.
216
-
217
- > `flair-tool-descriptors` is private and never published. Since flair#1683 it is a
259
+ Lockstep packages: the list `node scripts/ci/lockstep-packages.mjs` prints (root +
260
+ `packages/*` that are not `private`). `flair-tool-descriptors` is private and never
261
+ published; since flair#1683 it is a
218
262
  > **build-time source**: `scripts/vendor-tool-descriptors.mjs` copies it into each
219
263
  > consumer's own tree at prebuild (`resources/tool-descriptors/` for `flair`,
220
264
  > `packages/flair-mcp/src/tool-descriptors/` for `flair-mcp`) and the consumers
@@ -97,15 +97,9 @@ At this point you'll see your instance ID, public key, and role: `spoke`. The pe
97
97
 
98
98
  ## 5. Pair with the Hub
99
99
 
100
- ### 5a. Generate a pairing token on the hub
100
+ ### 5a. Generate a pairing token
101
101
 
102
- On the **hub host**, an admin runs:
103
-
104
- ```bash
105
- flair federation token --admin-pass <hub-admin-pass> > pair-triple.json
106
- ```
107
-
108
- Output (a single JSON object):
102
+ The command prints one JSON object. Tokens expire after **60 minutes** by default. Use `--ttl <minutes>` to extend.
109
103
 
110
104
  ```json
111
105
  {
@@ -116,23 +110,47 @@ Output (a single JSON object):
116
110
  }
117
111
  ```
118
112
 
119
- Tokens expire after **60 minutes** by default. Use `--ttl <minutes>` to extend.
113
+ #### Hub you can shell into
114
+
115
+ On the **hub host**, an admin runs:
116
+
117
+ ```bash
118
+ (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation token > pair-triple.json)
119
+ ```
120
+
121
+ `umask 077` sets the mode of a file the redirect CREATES; an existing file keeps its mode, so `set -C` (noclobber) makes the redirect refuse to overwrite it. Remove an old `pair-triple.json` first (`rm pair-triple.json`).
122
+
123
+ #### Harper Fabric hub (no shell)
124
+
125
+ A Fabric-deployed hub is a Harper component on a managed cluster. There is no host to shell into. Mint the triple from any machine that can reach the hub — for a personal spoke, that machine is the spoke — and name both the data URL and the ops URL:
126
+
127
+ ```bash
128
+ (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat /path/to/hub-admin-pass)" flair federation token \
129
+ --target https://<hub>.<org>.harperfabric.com \
130
+ --ttl 60 \
131
+ --ops-target https://<hub>.<org>.harperfabric.com:9925 > pair-triple.json) # docs-freshness-allow: Fabric ops API port, not legacy data port
132
+ ```
133
+
134
+ `/path/to/hub-admin-pass` is a 0600 file holding the **HUB** admin password on the minting machine, not the spoke's `~/.flair/admin-pass`, which authenticates only the spoke. A literal on the command line would land in shell history, so read it from the file (or a secret manager). `--ops-target` is the Harper operations API on the same hostname at port 9925. <!-- docs-freshness-allow: Fabric ops API port, not legacy data port --> A portless `https://` `--target` derives that same port. Pass `--ops-target` so the URL is the one you chose. An explicit port other than 443 still derives as REST port minus one, which is not this ops port. `federation token` reads the admin password from `FLAIR_ADMIN_PASS` (or from `--admin-pass`). `--admin-pass` is also accepted but puts the password in shell history and process listings; prefer the file form above (or a secret manager).
120
135
 
121
136
  ### 5b. Transfer the triple to the spoke
122
137
 
138
+ When the triple was minted **on the hub host**, copy it to the spoke:
139
+
123
140
  ```bash
124
141
  scp hub-host:/path/to/pair-triple.json ./pair-triple.json
125
142
  ```
126
143
 
144
+ When it was minted with `--target` against a Fabric hub, the file is already on the machine that ran the command. If that machine is the spoke, this step is done. The file holds a one-time credential — delete it after pairing.
145
+
127
146
  ### 5c. Pair from the spoke
128
147
 
129
148
  ```bash
130
- flair federation pair https://<hub-url> \
131
- --token-from ./pair-triple.json \
132
- --admin-pass "$FLAIR_ADMIN_PASS"
149
+ FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<hub-url> \
150
+ --token-from ./pair-triple.json
133
151
  ```
134
152
 
135
- The `--admin-pass` is required so the CLI can write the hub as a local `Peer` record. Without it, pairing succeeds on the hub side but the spoke never records its peer, and `flair federation sync` reports "No hub peer configured."
153
+ The spoke admin credential (`FLAIR_ADMIN_PASS` as above, or `--admin-pass`) is required so the CLI can write the hub as a local `Peer` record. Without it, pairing succeeds on the hub side but the spoke never records its peer, and `flair federation sync` reports "No hub peer configured."
136
154
 
137
155
  ### 5d. What pairing does
138
156
 
@@ -267,18 +285,19 @@ grep port ~/.flair/config.yaml
267
285
  export FLAIR_URL=http://127.0.0.1:9926
268
286
  ```
269
287
 
270
- ### 🔸 Fabric hosts split REST and ops ports
288
+ ### 🔸 Harper Fabric hub vs a self-hosted explicit port
271
289
 
272
- Fabric deployments split the REST API and the Harper operations API onto adjacent ports. The derivation rule is **ops = REST − 1**. When pointing a CLI at a remote Fabric instance, pass the REST URL and the ops URL is derived automatically — substitute the hub's actual REST port (19926 for a fresh deployment, or whatever it was provisioned with):
290
+ A managed Harper Fabric hub (`https://<hub>.<org>.harperfabric.com`, HTTPS on 443) serves the operations API on port 9925 of the same hostname. <!-- docs-freshness-allow: Fabric ops API port, not legacy data port --> Mint the pairing token with `--target` and `--ops-target` as in [§5a](#harper-fabric-hub-no-shell). Pairing from the spoke still uses the public hub URL:
273
291
 
274
292
  ```bash
275
- flair federation pair https://fabric-node.example.com:19926/<instance> --token-from triple.json
293
+ FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<hub>.<org>.harperfabric.com \
294
+ --token-from ./pair-triple.json
276
295
  ```
277
296
 
278
- For explicit ops control:
297
+ A self-hosted instance that publishes an explicit REST port still uses ops = REST − 1 (a fresh local install is 19926 → 19925). Pass that ops URL with `--ops-target` when you are not on the box:
279
298
 
280
299
  ```bash
281
- flair federation pair https://fabric-node.example.com:19926/<instance> \
300
+ FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://fabric-node.example.com:19926/<instance> \
282
301
  --token-from triple.json \
283
302
  --ops-target https://fabric-node.example.com:19925
284
303
  ```
@@ -292,10 +311,10 @@ flair federation pair https://fabric-node.example.com:19926/<instance> \
292
311
  | Install | `npm install -g @tpsdev-ai/flair` |
293
312
  | Init spoke | `flair init --agent-id <id> --data-dir /data/flair --skip-soul` |
294
313
  | Check status | `flair status` / `flair federation status` |
295
- | Hub: mint token | `flair federation token --admin-pass <pass> > triple.json` |
296
- | Spoke: pair | `flair federation pair <hub-url> --token-from ./triple.json --admin-pass <pass>` |
297
- | Spoke: sync | `flair federation sync --admin-pass <pass>` |
298
- | Spoke: verify | `flair federation verify --admin-pass <pass>` then `flair federation reachability` |
314
+ | Hub: mint token | On the hub host: `(umask 077; set -C; FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation token > triple.json)`. Harper Fabric hub (no shell): §5a `--target` + `--ops-target` |
315
+ | Spoke: pair | `FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair <hub-url> --token-from ./triple.json` |
316
+ | Spoke: sync | `FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation sync` |
317
+ | Spoke: verify | `FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation verify` then `flair federation reachability` |
299
318
  | Watch loop | `flair federation watch --interval 30` |
300
319
 
301
320
  ---
@@ -79,27 +79,21 @@ All configuration lives in `~/.flair/`:
79
79
 
80
80
  ```
81
81
  ~/.flair/
82
- ├── config.yaml # port, bind host, embedding model
83
- ├── data/ # Harper database (RocksDB)
82
+ ├── config.yaml # port, opsPort, opsBind, httpBind
83
+ ├── data/ # Harper database (RocksDB); harper-config.yaml lives here
84
84
  ├── keys/ # Ed25519 keypairs per agent (mode 0600)
85
85
  └── backups/ # flair backup output
86
86
  ```
87
87
 
88
88
  ### Key config options (`~/.flair/config.yaml`)
89
89
 
90
- Flair's own config file uses **top-level** keys — there is no nested `http:`
91
- block, and no `http.host` (see [`deployment.md` — Direct network access](deployment.md#direct-network-access) for widening):
90
+ Flair reads four top-level keys from this file: `port`, `opsPort`, `opsBind`, and `httpBind`. There is no nested `http:` block and no `http.host`. `flair init` rewrites the file and drops every other key, so a `clustering:` or `logging:` block placed here does not survive and is not read. Embedding settings are the environment variables below, not keys in this file. Widening the HTTP listener is covered in [`deployment.md` — Direct network access](deployment.md#direct-network-access).
92
91
 
93
92
  ```yaml
94
- port: 19926 # API port (ops port = this - 1)
93
+ port: 19926
94
+ opsPort: 19925 # Harper operations API port
95
+ opsBind: 127.0.0.1 # operations API bind host
95
96
  httpBind: 127.0.0.1 # HTTP bind host; 0.0.0.0 widens (must include IPv4 loopback)
96
-
97
- clustering:
98
- nodeName: flair
99
-
100
- logging:
101
- level: warn
102
- stdStreams: true
103
97
  ```
104
98
 
105
99
  ### Environment variables
@@ -110,7 +104,7 @@ logging:
110
104
  | `HDB_ADMIN_PASSWORD` | Bootstrap password for the embedded Harper. After first start, the persisted user record is the source of truth. | Set at install time. See [secrets-and-keys.md](secrets-and-keys.md) for rotation. |
111
105
  | `FLAIR_KEY_PASSPHRASE` | Passphrase for AES-256-GCM encryption of federation private-key seeds. | Set explicitly for production federation deployments. |
112
106
  | `FLAIR_URL` | Override the Flair base URL for CLI commands (points to a remote instance). | When connecting from a different machine. |
113
- | `FLAIR_HTTP_BIND` | HTTP API bind host. Resolution order: `flair init --http-bind` > this variable > top-level `httpBind` in `~/.flair/config.yaml` > `127.0.0.1`. Only `127.0.0.1` or a wildcard (`0.0.0.0` / `::`) is accepted. | When the HTTP API must be reachable off-host; prefer recording it once with `flair init --http-bind 0.0.0.0`. See [deployment.md](deployment.md#direct-network-access). |
107
+ | `FLAIR_HTTP_BIND` | HTTP API bind host. On start, restart, and upgrade: this variable, then top-level `httpBind` in `~/.flair/config.yaml`, then `127.0.0.1`. `flair init --http-bind` writes that key. On Linux the CLI resolves this on every start, and an env var in the service's environment overrides the file. On macOS the resolved bind is stored in the launchd job instead of being re-read on the launchd reload path: any restart that goes through it — `flair restart` included, and a restart launchd starts itself (a reboot, a crash, KeepAlive) — reuses that stored value and does not re-read this variable or the file; only `flair init` writes it. Only `127.0.0.1` or a wildcard (`0.0.0.0` / `::`) is accepted. | When the HTTP API must be reachable off-host; prefer recording it once with `flair init --http-bind 0.0.0.0`. See [deployment.md](deployment.md#direct-network-access). |
114
108
  | `FLAIR_EMBED_THREADS` | CPU threads for in-process embedding. Default is `max(1, availableParallelism() − 1)` — host-aware, one core left for Harper. | Pin a positive integer on a dedicated ingest host, or when the default leaves cores idle / oversubscribed. See [deployment.md](deployment.md#performance-related-environment-variables). |
115
109
  | `FLAIR_EMBED_GPU_LAYERS` | GPU layers to offload. Unset derives Metal (`99`) on Apple Silicon with a usable Metal prebuilt, else CPU (`0`). Stated on `/Health`. | Pin CPU with `0` on a Metal Mac, or force a layer count. See [deployment.md](deployment.md#performance-related-environment-variables). |
116
110
  | `FLAIR_HYBRID_RETRIEVAL` | Hybrid BM25 + vector retrieval (default on). | Set `false` to revert to HNSW-only. |
@@ -227,15 +221,17 @@ Available. Pair a local instance as a hub or spoke with another Flair instance:
227
221
 
228
222
  ```bash
229
223
  # On the hub — generate a one-time pairing token triple
230
- FLAIR_ADMIN_PASS=<hub-admin-password> flair federation token > triple.json
224
+ (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation token > triple.json)
231
225
 
232
- # On the spoke — pair to the hub
233
- flair federation pair <hub-url> --token-from ./triple.json
226
+ # On the spoke — its own admin password writes the local Peer row
227
+ FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair <hub-url> --token-from ./triple.json
234
228
 
235
229
  # Sync (one-shot)
236
230
  flair federation sync --admin-pass-file ~/.flair/admin-pass
237
231
  ```
238
232
 
233
+ `set -C` refuses an existing `triple.json`; remove an old one first (`rm triple.json`).
234
+
239
235
  Full walkthrough: [federation.md](federation.md).
240
236
 
241
237
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/flair",
3
- "version": "0.55.1",
3
+ "version": "0.56.0",
4
4
  "packageManager": "bun@1.3.10",
5
5
  "description": "Identity, memory, and soul for AI agents. Cryptographic identity (Ed25519), semantic memory with local embeddings, and persistent personality — all in a single process.",
6
6
  "type": "module",
@@ -70,6 +70,7 @@
70
70
  "harper-fabric-embeddings": "^0.5.0",
71
71
  "jose": "6.2.2",
72
72
  "js-yaml": "^4.3.2",
73
+ "semver": "^7.8.5",
73
74
  "tar": "^7.5.22",
74
75
  "tweetnacl": "1.0.3"
75
76
  },
@@ -94,6 +95,7 @@
94
95
  "devDependencies": {
95
96
  "@playwright/test": "1.59.1",
96
97
  "@types/node": "24.11.0",
98
+ "@types/semver": "^7.8.0",
97
99
  "@types/tar": "7.0.87",
98
100
  "bun-types": "1.3.11",
99
101
  "typescript": "5.9.3"