@tpsdev-ai/flair 0.62.0 → 0.63.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 (232) hide show
  1. package/README.md +6 -6
  2. package/SECURITY.md +18 -10
  3. package/config.yaml +11 -11
  4. package/dist/bridges/runtime/execute.js +1 -0
  5. package/dist/bridges/types.js +1 -0
  6. package/dist/build-info.json +3 -3
  7. package/dist/cli.js +66 -122
  8. package/dist/commands/agent.js +27 -65
  9. package/dist/commands/backup-approval.js +218 -0
  10. package/dist/commands/backup.js +37 -33
  11. package/dist/commands/bootstrap.js +3 -1
  12. package/dist/commands/deploy.js +37 -7
  13. package/dist/commands/doctor.js +119 -0
  14. package/dist/commands/export.js +3 -4
  15. package/dist/commands/federation.js +653 -68
  16. package/dist/commands/grant.js +5 -6
  17. package/dist/commands/help.js +25 -0
  18. package/dist/commands/idp.js +14 -19
  19. package/dist/commands/import.js +131 -19
  20. package/dist/commands/init.js +7 -7
  21. package/dist/commands/integrity.js +5 -6
  22. package/dist/commands/mcp.js +11 -17
  23. package/dist/commands/memory.js +33 -15
  24. package/dist/commands/orgevent.js +5 -10
  25. package/dist/commands/principal.js +13 -25
  26. package/dist/commands/quality.js +3 -0
  27. package/dist/commands/rem.js +484 -65
  28. package/dist/commands/restore.js +352 -44
  29. package/dist/commands/service.js +84 -2
  30. package/dist/commands/soul.js +0 -6
  31. package/dist/commands/status.js +51 -33
  32. package/dist/commands/test.js +4 -1
  33. package/dist/commands/upgrade.js +53 -22
  34. package/dist/commands/workspace.js +7 -8
  35. package/dist/deploy.js +59 -3
  36. package/dist/doctor-client.js +7 -2
  37. package/dist/fabric-upgrade.js +12 -2
  38. package/dist/federation/presence-send.js +139 -0
  39. package/dist/federation-verify.js +269 -177
  40. package/dist/install/clients.js +171 -35
  41. package/dist/lib/agent-id-rule.js +44 -2
  42. package/dist/lib/atomic-write.js +1 -1
  43. package/dist/lib/auth-resolve.js +1028 -52
  44. package/dist/lib/backup-approval-store.js +612 -0
  45. package/dist/lib/backup-artifact.js +343 -0
  46. package/dist/lib/config-critical-section.js +212 -25
  47. package/dist/lib/connect-phase.js +33 -0
  48. package/dist/lib/daemon-liveness.js +2 -1
  49. package/dist/lib/federation-pair-access.js +4 -0
  50. package/dist/lib/federation-retry-queue.js +283 -0
  51. package/dist/lib/federation-retry-row.js +101 -0
  52. package/dist/lib/instruction-event-contract.js +17 -0
  53. package/dist/lib/instruction-event-doctor.js +102 -0
  54. package/dist/lib/launchd-management.js +14 -3
  55. package/dist/lib/mcp-enable.js +14 -15
  56. package/dist/lib/memory-attributes.js +2 -0
  57. package/dist/lib/memory-provider-timeout.js +33 -0
  58. package/dist/lib/mqtt-config.js +132 -0
  59. package/dist/lib/mqtt-listener-doctor.js +104 -0
  60. package/dist/lib/open-live-row.js +20 -0
  61. package/dist/lib/ops-url.js +52 -0
  62. package/dist/lib/promotion-content-hash.js +20 -0
  63. package/dist/lib/restore-archive.js +760 -0
  64. package/dist/lib/restore-verify.js +1 -1
  65. package/dist/lib/skill-assignment-preflight.js +159 -0
  66. package/dist/lib/skill-seed.js +91 -8
  67. package/dist/lib/skill-tombstone-doctor.js +133 -0
  68. package/dist/lib/soul-scope-fields.js +26 -0
  69. package/dist/lib/uninstall-purge.js +266 -11
  70. package/dist/lib/upgrade-prior-liveness.js +2 -1
  71. package/dist/mcp-client-assertion.js +2 -10
  72. package/dist/memory-id-checkpoint.js +28 -7
  73. package/dist/mqtt-off-deploy.js +550 -0
  74. package/dist/rem/promote-policy.js +3 -3
  75. package/dist/rem/restore.js +302 -26
  76. package/dist/rem/runner.js +220 -58
  77. package/dist/rem/scheduler.js +21 -4
  78. package/dist/resources/A2AAdapter.js +131 -178
  79. package/dist/resources/AdminMemory.js +2 -0
  80. package/dist/resources/AdminMemoryCandidates.js +116 -0
  81. package/dist/resources/Agent.js +155 -45
  82. package/dist/resources/AgentCard.js +4 -0
  83. package/dist/resources/AgentKeyRegister.js +56 -22
  84. package/dist/resources/AgentReadPosition.js +7 -0
  85. package/dist/resources/AgentSeed.js +232 -107
  86. package/dist/resources/AutoPromoteCandidates.js +413 -84
  87. package/dist/resources/Credential.js +6 -8
  88. package/dist/resources/Federation.js +219 -57
  89. package/dist/resources/FederationRetry.js +4 -4
  90. package/dist/resources/InstructionVersion.js +1 -1
  91. package/dist/resources/MCPClientMetadata.js +6 -3
  92. package/dist/resources/Memory.js +1303 -270
  93. package/dist/resources/MemoryArchive.js +149 -64
  94. package/dist/resources/MemoryBootstrap.js +12 -22
  95. package/dist/resources/MemoryCandidate.js +16 -2
  96. package/dist/resources/MemoryConsolidate.js +2 -2
  97. package/dist/resources/MemoryFeed.js +360 -147
  98. package/dist/resources/MemoryMaintenance.js +290 -72
  99. package/dist/resources/MemoryPurge.js +138 -22
  100. package/dist/resources/MemoryReflect.js +68 -14
  101. package/dist/resources/MemoryReindex.js +91 -13
  102. package/dist/resources/Message.js +11 -2
  103. package/dist/resources/OAuth.js +156 -39
  104. package/dist/resources/OAuthClient.js +1 -1
  105. package/dist/resources/OrgEvent.js +292 -29
  106. package/dist/resources/OrgEventCatchup.js +7 -0
  107. package/dist/resources/OrgEventMaintenance.js +48 -10
  108. package/dist/resources/PairingToken.js +1 -1
  109. package/dist/resources/Presence.js +31 -11
  110. package/dist/resources/PromoteMemoryCandidate.js +8 -2
  111. package/dist/resources/RecordUsage.js +2 -4
  112. package/dist/resources/Soul.js +2 -0
  113. package/dist/resources/SoulFeed.js +2 -1
  114. package/dist/resources/WorkspaceLatest.js +4 -0
  115. package/dist/resources/XAA.js +36 -10
  116. package/dist/resources/a2a-stream.js +313 -0
  117. package/dist/resources/a2a-url.js +4 -5
  118. package/dist/resources/agent-admin.js +10 -1
  119. package/dist/resources/agent-auth.js +98 -68
  120. package/dist/resources/agent-read-position-lib.js +4 -1
  121. package/dist/resources/agent-status-guard.js +9 -7
  122. package/dist/resources/auth-middleware.js +166 -42
  123. package/dist/resources/authority-field-guard.js +9 -11
  124. package/dist/resources/auto-promote-lib.js +8 -5
  125. package/dist/resources/basic-auth-header.js +21 -0
  126. package/dist/resources/bm25-index-service.js +4 -5
  127. package/dist/resources/dedup-cluster.js +6 -1
  128. package/dist/resources/embeddings-provider.js +25 -0
  129. package/dist/resources/federation-classify.js +89 -0
  130. package/dist/resources/federation-retry-lib.js +6 -81
  131. package/dist/resources/health.js +43 -4
  132. package/dist/resources/host-pointer/registry.js +29 -0
  133. package/dist/resources/host-pointer-adapter.js +1 -0
  134. package/dist/resources/in-process.js +24 -22
  135. package/dist/resources/instruction-version-record.js +251 -7
  136. package/dist/resources/internal-authority.js +13 -0
  137. package/dist/resources/mcp-handler.js +106 -12
  138. package/dist/resources/mcp-oauth-flag.js +12 -14
  139. package/dist/resources/mcp-oauth.js +430 -53
  140. package/dist/resources/mcp-tools.js +60 -22
  141. package/dist/resources/memory-declared-attributes.js +1 -0
  142. package/dist/resources/memory-embed-hash.js +56 -0
  143. package/dist/resources/memory-host-source.js +5 -2
  144. package/dist/resources/memory-reflect-lib.js +1 -1
  145. package/dist/resources/memory-write-lock.js +202 -23
  146. package/dist/resources/memory-write-response.js +1 -1
  147. package/dist/resources/memory-write-transaction.js +243 -0
  148. package/dist/resources/migration-boot.js +17 -12
  149. package/dist/resources/migrations/boot-progress.js +25 -0
  150. package/dist/resources/migrations/data-dir.js +16 -3
  151. package/dist/resources/migrations/dir-safety.js +60 -2
  152. package/dist/resources/migrations/embedding-stamp.js +315 -49
  153. package/dist/resources/migrations/graph-heal.js +9 -2
  154. package/dist/resources/migrations/ledger.js +5 -2
  155. package/dist/resources/migrations/lock.js +867 -80
  156. package/dist/resources/migrations/progress.js +71 -10
  157. package/dist/resources/migrations/runner.js +212 -18
  158. package/dist/resources/migrations/state.js +36 -1
  159. package/dist/resources/migrations/status.js +2 -13
  160. package/dist/resources/migrations/synthetic-test-migration.js +78 -12
  161. package/dist/resources/migrations/types.js +26 -1
  162. package/dist/resources/migrations/visibility-backfill.js +111 -70
  163. package/dist/resources/oauth-discovery.js +0 -5
  164. package/dist/resources/object-body-guard.js +12 -5
  165. package/dist/resources/org-event-reserved.js +92 -0
  166. package/dist/resources/org-event-write-fault.js +19 -0
  167. package/dist/resources/owner-field-guard.js +1 -1
  168. package/dist/resources/owner-scoped-write-policy.js +65 -21
  169. package/dist/resources/owner-scoped-writes.js +37 -6
  170. package/dist/resources/path-id-rewrite.js +76 -0
  171. package/dist/resources/presence-internal.js +5 -5
  172. package/dist/resources/promotion-binding.js +43 -0
  173. package/dist/resources/promotion-stamp.js +124 -33
  174. package/dist/resources/protocol-context.js +189 -0
  175. package/dist/resources/record-type-kit.js +2 -4
  176. package/dist/resources/request-target.js +28 -1
  177. package/dist/resources/request-transaction.js +11 -1
  178. package/dist/resources/seed-reservation.js +1 -2
  179. package/dist/resources/semantic-retrieval-core.js +7 -6
  180. package/dist/resources/server-row-validation.js +71 -0
  181. package/dist/resources/skill-manifest.js +4 -3
  182. package/dist/resources/skill-version-write.js +384 -27
  183. package/dist/resources/skill-write-fault.js +6 -3
  184. package/dist/resources/skill-write-policy.js +2 -1
  185. package/dist/resources/soul-write-policy.js +26 -7
  186. package/dist/resources/table-helpers.js +1 -1
  187. package/dist/resources/table-subscription-policy.js +518 -85
  188. package/dist/resources/table-subscriptions.js +20 -7
  189. package/dist/resources/txn-pause-point.js +122 -5
  190. package/dist/resources/usage-recording.js +54 -46
  191. package/dist/resources/write-back.js +176 -11
  192. package/dist/resources/write-journal-context.js +5 -0
  193. package/dist/resources/write-journal.js +289 -0
  194. package/dist/src/lib/agent-id-rule.js +44 -2
  195. package/dist/src/lib/atomic-write.js +1 -1
  196. package/dist/src/lib/federation-retry-row.js +101 -0
  197. package/dist/src/lib/instruction-event-contract.js +17 -0
  198. package/dist/src/lib/memory-attributes.js +2 -0
  199. package/dist/src/lib/open-live-row.js +20 -0
  200. package/dist/src/lib/soul-scope-fields.js +26 -0
  201. package/dist/src/rem/promote-policy.js +3 -3
  202. package/dist/src/rem/scheduler.js +21 -4
  203. package/docs/access-control.md +18 -9
  204. package/docs/api-reference.md +126 -28
  205. package/docs/auth.md +40 -18
  206. package/docs/claude-code.md +3 -3
  207. package/docs/deploying-on-fabric.md +108 -0
  208. package/docs/deployment.md +17 -0
  209. package/docs/embedding-in-a-harper-app.md +16 -14
  210. package/docs/entity-vocabulary.md +3 -6
  211. package/docs/federation.md +29 -2
  212. package/docs/integrations.md +11 -11
  213. package/docs/mcp-clients.md +7 -5
  214. package/docs/notes/mcp-agent-auth-consumer.md +4 -9
  215. package/docs/notes/mcp-oauth-model2.md +6 -6
  216. package/docs/openclaw.md +1 -1
  217. package/docs/quickstart-fabric.md +2 -2
  218. package/docs/quickstart.md +3 -3
  219. package/docs/releasing.md +13 -13
  220. package/docs/rem.md +24 -3
  221. package/docs/secrets-and-keys.md +2 -2
  222. package/docs/standalone-local.md +29 -2
  223. package/docs/supply-chain-policy.md +28 -20
  224. package/docs/the-team.md +2 -2
  225. package/docs/upgrade.md +14 -0
  226. package/package.json +18 -11
  227. package/schemas/agent.graphql +3 -3
  228. package/schemas/federation.graphql +10 -7
  229. package/schemas/memory.graphql +7 -2
  230. package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
  231. package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
  232. package/dist/resources/soul-adk-guard.js +0 -68
package/README.md CHANGED
@@ -166,7 +166,7 @@ Embeddings are generated in-process by [nomic-embed-text](https://huggingface.co
166
166
 
167
167
  Requests are signed as `agentId:timestamp:nonce:METHOD:/path` and verified against the agent's registered public key, with a 30-second replay window and nonce deduplication.
168
168
 
169
- See **[DESIGN.md](DESIGN.md)** for the invariants behind the three primitives — why they're shaped the way they are.
169
+ See **[DESIGN.md](https://github.com/tpsdev-ai/flair/blob/main/DESIGN.md)** for the invariants behind the three primitives — why they're shaped the way they are.
170
170
 
171
171
  ## Features
172
172
 
@@ -187,7 +187,7 @@ See **[DESIGN.md](DESIGN.md)** for the invariants behind the three primitives
187
187
  | **OAuth 2.1 server** | PKCE, dynamic client registration, standards-compliant token endpoint. Delegate auth to Flair without a separate IdP. [docs/auth.md](docs/auth.md) |
188
188
  | **XAA** | Bind agent identities to Google Workspace, Azure AD or Okta accounts. |
189
189
  | **Web admin** | Server-rendered UI for principals, connectors, IdPs and instance config. No separate dashboard service. |
190
- | **Benchmarks** | [`flair-bench`](packages/flair-bench/README.md) scores candidate embedding models against the same recall corpus Flair's CI gates on. Runs standalone — no Flair install, no server. |
190
+ | **Benchmarks** | [`flair-bench`](https://github.com/tpsdev-ai/flair/blob/main/packages/flair-bench/README.md) scores candidate embedding models against the same recall corpus Flair's CI gates on. Runs standalone — no Flair install, no server. |
191
191
 
192
192
  Trust-graded recall reaches the authenticated HTTP API and the built-in `/mcp` tools today — the latter being off by default, see [One install, one binary](#one-install-one-binary). CLI, `@tpsdev-ai/flair-client` and `flair-mcp` exposure is a follow-up. REM needs a configured generative backend (Ollama, OpenAI, Anthropic, …) — without one, `flair rem rapid` fails with `Reflection error: No generative backend configured`.
193
193
 
@@ -227,7 +227,7 @@ Flair works with any agent runtime. Pick the path that fits yours — **[full ca
227
227
  }
228
228
  ```
229
229
 
230
- Then add to your `CLAUDE.md`:
230
+ Then add to your `CLAUDE.md`: <!-- docs-freshness-allow: names a file in the reader's project -->
231
231
 
232
232
  At the start of every session, run mcp__flair__bootstrap before responding.
233
233
 
@@ -243,7 +243,7 @@ Per-CLI config snippets (Gemini CLI's `~/.gemini/settings.json`, Codex CLI's `~/
243
243
  openclaw plugins install @tpsdev-ai/openclaw-flair
244
244
  ```
245
245
 
246
- Auto-detects the agent identity, provides `memory_store` / `memory_search` / `memory_get`, and provides bootstrap context from `before_prompt_build` (requires host opt-in). See the [plugin README](packages/openclaw-flair/README.md).
246
+ Auto-detects the agent identity, provides `memory_store` / `memory_search` / `memory_get`, and provides bootstrap context from `before_prompt_build` (requires host opt-in). See the [plugin README](https://github.com/tpsdev-ai/flair/blob/main/packages/openclaw-flair/README.md).
247
247
 
248
248
  ### n8n
249
249
 
@@ -289,7 +289,7 @@ const ctx = await flair.bootstrap({ maxTokens: 4000 })
289
289
  await flair.soul.get('role')
290
290
  ```
291
291
 
292
- No Harper, no embeddings — just HTTP and auth. Full API in the [client README](packages/flair-client/README.md).
292
+ No Harper, no embeddings — just HTTP and auth. Full API in the [client README](https://github.com/tpsdev-ai/flair/blob/main/packages/flair-client/README.md).
293
293
 
294
294
  ### HTTP API (any language)
295
295
 
@@ -415,7 +415,7 @@ bun run build # compile TypeScript → dist/
415
415
  bun test # unit + integration tests
416
416
  ```
417
417
 
418
- Integration tests spin up a real Harper instance on a random port and tear it down afterwards — no mocks for the database layer. Every commit runs unit tests, integration tests, type check, dependency audit, Semgrep and CodeQL SAST, and a from-scratch Docker validation. See [CONTRIBUTING.md](CONTRIBUTING.md).
418
+ Integration tests spin up a real Harper instance on a random port and tear it down afterwards — no mocks for the database layer. CI for pull requests to main and pushes to main runs unit and integration tests, type checks, dependency audit, Semgrep and CodeQL SAST. See [CONTRIBUTING.md](https://github.com/tpsdev-ai/flair/blob/main/CONTRIBUTING.md).
419
419
 
420
420
  ## Status
421
421
 
package/SECURITY.md CHANGED
@@ -63,8 +63,8 @@ Reads are open **within an org**; writes are isolated per agent. Enforced at
63
63
  the database layer (Harper resource `search()` override via a single
64
64
  centralized read-scope rule), not application logic:
65
65
 
66
- - `GET /Memory/` — returns the authenticated agent's own memories (any
67
- visibility) plus every **non-private** memory in the org
66
+ - `GET /Memory/` — applies the owner/visibility base scope and omits retained
67
+ closed skill payloads that fail the non-admin reader's current-authority check
68
68
  - `POST /MemorySearch` — same read scope: own memories plus all non-private
69
69
  - `POST /Memory` — writes are attributed to the authenticated agent; an
70
70
  agent cannot write as another (write isolation)
@@ -92,11 +92,14 @@ OrgEvent, WorkspaceState, Presence):
92
92
  non-empty path segments, no `.` in the decoded id), for which Harper resolves
93
93
  the same record id. Other addressed forms are left to the guard, which uses
94
94
  Harper's resolved id.
95
- - If reached, the guard checks a differing string or number body `id` on POST/PUT/PATCH
96
- first (`403 write_id_not_addressed`), then stored ownership (the same owner
97
- refusal), using Harper's resolved record id. An absent or matching body `id`
98
- passes the body-id check. OrgEvent and Memory bind an addressed POST's
99
- missing body `id` to the addressed id.
95
+ - If reached, the guard checks the body `id` on POST/PUT/PATCH first, then
96
+ stored ownership (the same owner refusal), using Harper's resolved record id.
97
+ An absent, null or matching body `id` passes the body-id check; a differing
98
+ string or number `id` gets `403 write_id_not_addressed`, and a present,
99
+ non-null `id` of any other type that is not the addressed key gets
100
+ `400 id_target_mismatch`. Each
101
+ object element of an array body is checked the same way. OrgEvent and Memory
102
+ bind an addressed POST's missing body `id` to the addressed id.
100
103
  - For a collection PUT, PATCH or DELETE, if reached, the table guard returns
101
104
  `403 forbidden: a non-admin write to <Table> must address one record by its id`;
102
105
  existing DELETE middleware may refuse earlier.
@@ -115,11 +118,16 @@ its own ownership rule.
115
118
  The guard exempts administrator and in-process calls. OrgEvent POST id
116
119
  selection also applies to administrator and in-process calls.
117
120
 
121
+ Credential records are owner-scoped by `principalId`: non-admin callers read and
122
+ modify only their own records, and administrators and trusted internal callers
123
+ are unscoped. Anonymous HTTP access is refused.
124
+
118
125
  ### Cross-Agent Access (within an org)
119
126
 
120
- Within an org, an agent reads every non-private memory directly — no grant
121
- required. This is deliberate: the goal is relevance (surface what's useful to
122
- the org) over secrecy. A writer keeps something private by marking it
127
+ Within an org, non-private memories pass the base read-scope check without a
128
+ grant; non-admin by-id and collection reads of retained closed skills
129
+ additionally require readable current authority. This is deliberate: the goal
130
+ is relevance (surface what's useful to the org) over secrecy. A writer keeps something private by marking it
123
131
  `visibility: private`, which keeps it strictly owner-only. The access boundary
124
132
  that stays hard is the **federation edge** (cross-instance / cross-org), not
125
133
  within-org reads.
package/config.yaml CHANGED
@@ -30,20 +30,20 @@ authentication:
30
30
  # (flair#1152). Requires @harperfast/oauth >= 2.5.0 (resolved-version
31
31
  # assertion + behavioral gate: test/integration/mcp-oauth-boot-safety.test.ts).
32
32
  #
33
- # ASYMMETRY (load-bearing, measured on oauth 2.5.0): the two readers of
34
- # this flag accept DIFFERENT vocabularies. The component's
35
- # coerceConfigBoolean accepts ONLY "true"/"false" and DELETES any other
36
- # string (unresolved placeholder, "1", "yes", garbage) so its disabled
37
- # default applies. flair's mcpOAuthEnabled() accepts 1/true/yes/on.
33
+ # ASYMMETRY (load-bearing, measured on @harperfast/oauth 2.9.0): the two
34
+ # readers of this flag accept DIFFERENT vocabularies. The component's
35
+ # coerceConfigBoolean trims and lowercases, mapping "true"/"false" to a
36
+ # boolean, and normalizeBooleanField deletes strings it cannot coerce
37
+ # (unresolved placeholder, "1", "yes", garbage), so its disabled default
38
+ # applies (dist/lib/config.js). flair's mcpOAuthEnabled() accepts
39
+ # 1/true/yes/on.
38
40
  #
39
- # Failure modes (oauth 2.5.0):
41
+ # Failure modes (oauth 2.9.0):
40
42
  # unset -> placeholder deleted -> both sides OFF, clean boot
41
- # true -> BOTH sides ON — the one working enable value
42
- # (`flair mcp enable` stages exactly this)
43
+ # true -> both flag readers accept this value
43
44
  # false -> both sides OFF
44
- # 1 / yes / on -> flair /mcp handler ON, component AS OFF ->
45
- # fail-closed broken-on: every /mcp request 401s,
46
- # no AS is advertised. Use "true" instead.
45
+ # 1 / yes / on -> flair's reader is ON, the component deletes the
46
+ # value (AS stays OFF); /mcp is not mounted.
47
47
  # garbage (maybe) -> deleted -> component OFF; flair strict -> OFF.
48
48
  # Inert: no /mcp handler, no data path (flair's own
49
49
  # discovery documents still serve, by design).
@@ -20,6 +20,7 @@ const FLAIR_RESERVED_FIELDS_SET = new Set([
20
20
  "retrievalCount",
21
21
  "lastRetrieved",
22
22
  "promotionStatus",
23
+ "promotionContentHash",
23
24
  "_safetyFlags",
24
25
  "createdBy",
25
26
  "updatedBy",
@@ -16,6 +16,7 @@ export const FLAIR_RESERVED_FIELDS = [
16
16
  "retrievalCount",
17
17
  "lastRetrieved",
18
18
  "promotionStatus",
19
+ "promotionContentHash",
19
20
  "_safetyFlags",
20
21
  "createdBy",
21
22
  "updatedBy",
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.62.0",
3
- "commit": "2461721a17f346ef922f9665a14e940e257415d1",
4
- "builtAt": "2026-10-17T20:48:39.747Z",
2
+ "version": "0.63.0",
3
+ "commit": "2684290e86191bdaf14560a45c5d1d0ec6c7d3e4",
4
+ "builtAt": "2026-11-24T15:09:23.643Z",
5
5
  "builder": "tsc"
6
6
  }
package/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ import { proveLocalInstancePair } from "./lib/local-instance-pair.js";
28
28
  import { httpBind, httpCorsAccessList, preserveHttpPortValue, preserveSecurePort, qualifySecureBindValue, DEFAULT_HTTP_BIND_HOST, } from "./lib/http-bind.js";
29
29
  import { isNodeKeyId, partitionKeyIds, } from "./doctor-client.js";
30
30
  import { cliBootPathWarning, } from "./install/global-bin-path.js";
31
- import { ApiHttpError, readSecretFileSecure, readAdminPassFileSecure, defaultAdminPassPath, defaultKeysDir, resolveLocalAdminPass, resolveAdminPassFromSources, ADMIN_PASS_FLAG, ADMIN_PASS_HELP, ADMIN_PASS_FILE_FLAG, ADMIN_PASS_FILE_HELP, DEFAULT_ADMIN_USER, resolveAdminUser, resolveKeyPath, buildEd25519Auth, authFetch, KeyLoadError, isLocalBase, authedRequest, } from "./lib/auth-resolve.js";
31
+ import { ApiHttpError, ApiRequestOutcomeUnknown, isConnectPhaseFailure, readSecretFileSecure, readAdminPassFileSecure, defaultAdminPassPath, defaultKeysDir, resolveLocalAdminPass, addAdminPassOptions, DEFAULT_ADMIN_USER, resolveAdminUser, resolveKeyPath, buildEd25519Auth, authFetch, KeyLoadError, isLocalBase, authedRequest, } from "./lib/auth-resolve.js";
32
32
  import { resolveSigningIdentity, emitSigningIdentityDebug, } from "./lib/signing-identity.js";
33
33
  import { entityFormatHint, parseEntitiesCsv } from "./lib/entity-vocab-cli.js";
34
34
  import { escapeXml, unescapeXml } from "./lib/xml-escape.js";
@@ -43,6 +43,8 @@ import { applyRepointPlan, repointSystemdUserUnit, restartOnLinux } from "./lib/
43
43
  import { snapshotRegularFile } from "./lib/atomic-write.js";
44
44
  import { preferVersionManagerAlias } from "./lib/node-alias-path.js";
45
45
  import { stabilizeMqttNetworkKeyOrder } from "./lib/stabilize-mqtt-network.js";
46
+ import { MQTT_DISABLED_CONFIG } from "./lib/mqtt-config.js";
47
+ import { FABRIC_OPS_PORT, resolveOpsUrlFromTarget } from "./lib/ops-url.js";
46
48
  import { detectOpsApiAllInterfacesBind } from "./lib/ops-api-bind.js";
47
49
  import { applyUpgradeHookConsent, runDoctorChecks, } from "./lib/doctor-run.js";
48
50
  import { classifyInstalledVersion, shouldPrintUpgradeLine, upgradeStatusSuffix } from "./lib/upgrade-status.js";
@@ -54,7 +56,7 @@ import { bindCli as bindFederationCli, register as registerFederation, signReque
54
56
  import { describeFederationPairHubAccessError, describeFederationPairLocalAccessError, rewriteFederationPairHubAccessError, rewriteFederationPairLocalAccessError, } from "./lib/federation-pair-access.js";
55
57
  import { bindCli as bindMemoryCli, register as registerMemory, categorizeForHygiene, HYGIENE_TEST_CONTENT_PATTERNS, } from "./commands/memory.js";
56
58
  import { bindCli as bindSoulCli, register as registerSoul, } from "./commands/soul.js";
57
- import { bindCli as bindRemCli, register as registerRem, } from "./commands/rem.js";
59
+ import { bindCli as bindRemCli, exitUnknownOutcome, register as registerRem, } from "./commands/rem.js";
58
60
  import { bindCli as bindFleetCli, register as registerFleet, } from "./commands/fleet.js";
59
61
  import { bindCli as bindMcpCli, register as registerMcp, } from "./commands/mcp.js";
60
62
  import { bindCli as bindIdpCli, register as registerIdp, } from "./commands/idp.js";
@@ -73,6 +75,7 @@ import { defaultReadProcessCmdline, defaultReadProcessCwd, findFlairPackageDir,
73
75
  import { applyPlainTreeUpgrade, userSystemdDir, } from "./lib/upgrade-plain-tree.js";
74
76
  import { bindCli as bindOrgeventCli, register as registerOrgevent, MAX_ORGEVENT_DETAIL_LENGTH, MAX_ORGEVENT_SUMMARY_LENGTH, publishOrgEvent, } from "./commands/orgevent.js";
75
77
  import { bindCli as bindAttentionCli, register as registerAttention, } from "./commands/attention.js";
78
+ import { registerHelp } from "./commands/help.js";
76
79
  import { bindCli as bindBootstrapCli, register as registerBootstrap, } from "./commands/bootstrap.js";
77
80
  import { bindCli as bindTestCli, register as registerTest, } from "./commands/test.js";
78
81
  import { bindCli as bindReembedCli, register as registerReembed, } from "./commands/reembed.js";
@@ -82,6 +85,7 @@ import { bindCli as bindMigrateHarnessMemoryCli, register as registerMigrateHarn
82
85
  import { bindCli as bindSearchCli, register as registerSearch, } from "./commands/search.js";
83
86
  import { bindCli as bindBackupCli, register as registerBackup, } from "./commands/backup.js";
84
87
  import { bindCli as bindRestoreCli, register as registerRestore, } from "./commands/restore.js";
88
+ import { bindCli as bindBackupApprovalCli, register as registerBackupApproval, } from "./commands/backup-approval.js";
85
89
  import { bindCli as bindExportCli, register as registerExport, } from "./commands/export.js";
86
90
  import { bindCli as bindImportCli, register as registerImport, } from "./commands/import.js";
87
91
  import { register as registerInspect, } from "./commands/inspect.js";
@@ -144,8 +148,8 @@ function shouldShowInlineSecretWarning(optValue, fromEnv, secretFlagNames, flagN
144
148
  }
145
149
  // ─── Defaults ────────────────────────────────────────────────────────────────
146
150
  const DEFAULT_PORT = 19926;
147
- const DEFAULT_OPS_PORT = 19925;
148
- const FABRIC_OPS_PORT = 9925;
151
+ // DEFAULT_OPS_PORT and FABRIC_OPS_PORT live in src/lib/ops-url.ts with
152
+ // resolveOpsUrlFromTarget, shared with the deploy channel (src/deploy.ts).
149
153
  // DEFAULT_ADMIN_USER + resolveAdminUser (flag > FLAIR_ADMIN_USER env > "admin")
150
154
  // live in src/lib/auth-resolve.ts — imported above (flair#1345).
151
155
  //
@@ -929,50 +933,12 @@ export const SHARED_IDENTITY_FLAGS = {
929
933
  agent: "--agent <id>",
930
934
  };
931
935
  function addSharedCredentialOptions(cmd) {
932
- return cmd
933
- .option(ADMIN_PASS_FLAG, ADMIN_PASS_HELP)
934
- .option(ADMIN_PASS_FILE_FLAG, ADMIN_PASS_FILE_HELP)
936
+ return addAdminPassOptions(cmd)
935
937
  .option(SHARED_CREDENTIAL_FLAGS.adminUser, "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)");
936
938
  }
937
939
  function addSharedIdentityOption(cmd) {
938
940
  return cmd.option(SHARED_IDENTITY_FLAGS.agent, "Agent ID (or set FLAIR_AGENT_ID env)");
939
941
  }
940
- /**
941
- * Resolve the admin password for the commands that declare the shared
942
- * credential flags, through the ONE resolver (`resolveAdminPassFromSources` —
943
- * the same one `federation token`/`pair` use, flair#1873/#1910). The resolved
944
- * value is written back into the `adminPass` slot every call site reads.
945
- *
946
- * Precedence, as the usage text states: an explicit `--admin-pass-file` or
947
- * `--admin-pass` over the ambient `FLAIR_ADMIN_PASS`/`HDB_ADMIN_PASSWORD`.
948
- * Supplying BOTH the file and the flag is a usage error (it used to let the
949
- * flag silently win); a file that is missing, empty or group-/world-readable
950
- * is refused naming the path and its mode. Never prints the value.
951
- */
952
- function applyAdminPassFile(opts) {
953
- try {
954
- // envPass is DELIBERATELY omitted: this wrapper folds an explicit
955
- // `--admin-pass-file` (or `--admin-pass`) into `opts.adminPass`, and each
956
- // call site keeps its own `opts.adminPass ?? FLAIR_ADMIN_PASS` fallback —
957
- // exactly main's shape. Resolving the ambient env HERE would pre-fill
958
- // `opts.adminPass`, and a call site that threads it as `explicitAdminPass`
959
- // (memory add, soul, …) would then send ambient admin Basic auth where it
960
- // used to send nothing and let the `--agent`/env tier decide (flair#1910
961
- // round 2: `federation sync` merged nothing in the mixed-version compat
962
- // lane because `memory add --agent X` with FLAIR_ADMIN_PASS set signed as
963
- // admin, not as X).
964
- const pass = resolveAdminPassFromSources({
965
- adminPassFile: opts.adminPassFile,
966
- adminPass: opts.adminPass,
967
- });
968
- if (pass)
969
- opts.adminPass = pass;
970
- }
971
- catch (err) {
972
- console.error(`Error: ${err.message}`);
973
- process.exit(1);
974
- }
975
- }
976
942
  // Ops port resolution: valid --ops-port flag > FLAIR_OPS_PORT env > config opsPort > httpPort - 1.
977
943
  // An explicit invalid --ops-port refuses; it never falls through to another rung.
978
944
  //
@@ -1362,26 +1328,9 @@ export function buildOperationsApiConfig(opsPort, opsSocket, opsBindHost) {
1362
1328
  network: { port: opsNetworkPortValue(opsBindHost, opsPort), cors: true, domainSocket: opsSocket },
1363
1329
  };
1364
1330
  }
1365
- /**
1366
- * Harper config that fully disables the MQTT broker (flair#1586).
1367
- *
1368
- * Flair does not use MQTT. Harper's mqtt component (server/mqtt.ts
1369
- * `handleApplication`) binds a TCP listener on `mqtt.network.port` (1883) and
1370
- * a TLS listener on `mqtt.network.securePort` (8883) whenever EITHER is truthy
1371
- * (`if (port || securePort)`), plus a WebSocket upgrade path when
1372
- * `mqtt.webSocket` is true. Nulling only `network.port` leaves
1373
- * `network.securePort` at its 8883 default, so the TLS listener still binds.
1374
- * Fully disabling MQTT requires nulling BOTH ports and turning off the
1375
- * WebSocket path.
1376
- *
1377
- * Note: config-root.schema.json still documents a flat `mqtt.port` /
1378
- * `mqtt.securePort`, but the runtime reads the nested `mqtt.network.*` form
1379
- * (see static/defaultConfig.yaml) — the flat keys are stale.
1380
- */
1381
- const MQTT_DISABLED_CONFIG = {
1382
- network: { port: null, securePort: null },
1383
- webSocket: false,
1384
- };
1331
+ // MQTT_DISABLED_CONFIG — the Harper `mqtt` section with every MQTT listener
1332
+ // off — lives in src/lib/mqtt-config.ts, shared with the component-deployment
1333
+ // channel (src/deploy.ts) and `flair doctor`.
1385
1334
  /**
1386
1335
  * Build the flair-owned environment overrides for a DIRECT (non-launchd)
1387
1336
  * Harper spawn (flair#863) — shared by `flair start`'s fallback path and
@@ -1848,17 +1797,6 @@ function resolveTarget(opts) {
1848
1797
  function resolveOpsTarget(opts) {
1849
1798
  return opts.opsTarget || process.env.FLAIR_OPS_TARGET || undefined;
1850
1799
  }
1851
- /** Derive the ops API URL from a Flair base URL.
1852
- * https with effective port 443 (no explicit port, or explicit :443): returns
1853
- * <host>:9925 (FABRIC_OPS_PORT) — the Fabric managed case where port-1/:442
1854
- * is a dead-end.
1855
- * All other cases unchanged:
1856
- * https with non-443 explicit port → port-1 (self-hosted TLS: 19926→19925, 8443→8442)
1857
- * http with explicit port → port-1 (19926→19925)
1858
- * http with no port → DEFAULT_OPS_PORT (19925)
1859
- * Bare hosts are normalised to https:// (effective-443 → Fabric path).
1860
- * Throws on unparseable URLs or out-of-range ports.
1861
- */
1862
1800
  /** Compute the effective ops API URL for remote commands.
1863
1801
  * - If --ops-target is set, use it directly (no derivation).
1864
1802
  * - Else if --target is set, derive ops URL via resolveOpsUrlFromTarget.
@@ -1873,37 +1811,6 @@ function resolveEffectiveOpsUrl(opts) {
1873
1811
  return resolveOpsUrlFromTarget(target);
1874
1812
  return undefined;
1875
1813
  }
1876
- function resolveOpsUrlFromTarget(targetUrl) {
1877
- // Normalise bare hosts: add https:// prefix so URL parser can handle them.
1878
- const normalised = targetUrl.includes("://") ? targetUrl : `https://${targetUrl}`;
1879
- const url = new URL(normalised);
1880
- // https target with effective port 443 (no explicit port, or explicit :443):
1881
- // this is the Fabric managed case — the ops API is on the well-known Fabric
1882
- // ops port, never REST-adjacent. The port-1 / :442 logic is a dead-end here.
1883
- if (url.protocol === "https:" && (url.port === "" || url.port === "443")) {
1884
- url.port = String(FABRIC_OPS_PORT);
1885
- return url.toString().replace(/\/$/, "");
1886
- }
1887
- // All other cases: unchanged port-1 convention.
1888
- // https with non-443 explicit port → port-1 (self-hosted TLS: 19926→19925, 8443→8442)
1889
- // http with explicit port → port-1 (19926→19925)
1890
- // http with no port → DEFAULT_OPS_PORT (19925)
1891
- const port = parseInt(url.port, 10);
1892
- if (!isNaN(port) && port > 0 && port <= 65535) {
1893
- const opsPort = port - 1;
1894
- if (opsPort < 1)
1895
- throw new Error(`Derived ops port ${opsPort} is out of range; target port must be > 1`);
1896
- url.port = String(opsPort);
1897
- return url.toString().replace(/\/$/, "");
1898
- }
1899
- // No valid explicit port — reject port 0 or out-of-range
1900
- if (url.port !== "" && url.port !== undefined) {
1901
- throw new Error(`Invalid target port: ${url.port} (must be 1-65535)`);
1902
- }
1903
- // No explicit port on http — use the default ops port.
1904
- url.port = String(DEFAULT_OPS_PORT);
1905
- return url.toString().replace(/\/$/, "");
1906
- }
1907
1814
  /**
1908
1815
  * Persist the instance coordinates other commands need to find and re-assert
1909
1816
  * this install (flair#863).
@@ -2171,16 +2078,37 @@ async function api(method, path, body, options) {
2171
2078
  adminUser: options?.adminUser,
2172
2079
  agentIdSource: options?.agentIdSource,
2173
2080
  signedOnly: options?.signedOnly,
2081
+ refuseRedirects: options?.refuseRedirects,
2082
+ deadlineMs: options?.deadlineMs,
2083
+ deadlineSource: options?.deadlineSource,
2084
+ tolerateUnparsedSuccessBody: options?.tolerateUnparsedSuccessBody,
2174
2085
  };
2086
+ // The port the operator wrote in ~/.flair/config.yaml, when it differs from
2087
+ // the resolved one and no explicit base was given: the only port a
2088
+ // connect-phase failure may fall back to (flair#1719).
2089
+ const altPort = hasExplicitBase ? null : alternateConfiguredLocalPort({});
2090
+ const readOnly = method.toUpperCase() === "GET" || method.toUpperCase() === "HEAD";
2091
+ // Following a redirect can start another connection attempt; a connect-phase
2092
+ // failure there could cause the original write to be replayed on the alternate.
2093
+ // Refusing it (redirect: "manual") yields a named HTTP 3xx error, which is
2094
+ // never fallback-eligible because it is not a connect-phase failure.
2095
+ if (altPort !== null && !readOnly)
2096
+ requestOptions.refuseRedirects = true;
2175
2097
  try {
2176
2098
  return await authedRequest(method, path, body, requestOptions);
2177
2099
  }
2178
2100
  catch (err) {
2101
+ // A write that reached its deadline may have committed. Never replay it
2102
+ // against another port: that is a blind retry of an unknown outcome.
2103
+ // pinned by test/unit/request-deadline-2789.test.ts "a write whose deadline
2104
+ // expires exits 3 and the alternate configured port receives no request"
2105
+ if (err instanceof ApiRequestOutcomeUnknown)
2106
+ throw err;
2179
2107
  // flair#1719: the resolved port came from Harper's boot record, which can
2180
2108
  // be stale for the default install. Before surfacing a connect failure,
2181
- // try the port the operator actually wrote in ~/.flair/config.yaml.
2182
- const altPort = hasExplicitBase ? null : alternateConfiguredLocalPort({});
2183
- if (altPort !== null && isFederationStatusConnectFailure(err)) {
2109
+ // try the port the operator actually wrote in ~/.flair/config.yaml. Only a
2110
+ // connect-phase failure qualifies (flair#2869).
2111
+ if (altPort !== null && isConnectPhaseFailure(err)) {
2184
2112
  const altUrl = `http://127.0.0.1:${altPort}`;
2185
2113
  try {
2186
2114
  return await authedRequest(method, path, body, { ...requestOptions, baseUrl: altUrl });
@@ -2193,15 +2121,11 @@ async function api(method, path, body, options) {
2193
2121
  }
2194
2122
  }
2195
2123
  /**
2196
- * Turn undici/Node's bare `TypeError: fetch failed` into a sentence naming the
2197
- * actor (the Flair instance URL), the state (no HTTP response) and a remedy
2198
- * the operator can act on — flair#1719 requirement 3. Non-connect errors
2199
- * (HTTP 401/403/5xx, auth failures) pass through unchanged so callers keep
2200
- * their own handling. The `flairFriendly` marker lets the top-level CLI entry
2201
- * print just the message instead of a stack.
2124
+ * Give connect-phase errors a URL and remedy; pass other errors through.
2125
+ * `flairFriendly` prints the message without a stack.
2202
2126
  */
2203
2127
  function describeApiConnectFailure(err, url) {
2204
- if (!isFederationStatusConnectFailure(err))
2128
+ if (!isConnectPhaseFailure(err))
2205
2129
  return err;
2206
2130
  const friendly = new Error(`Cannot reach the Flair instance at ${url} — the connection failed (no HTTP response).\n`
2207
2131
  + ` Start it with \`flair start\`, or point this command at the right instance with `
@@ -3917,6 +3841,10 @@ program.configureHelp({ showGlobalOptions: true });
3917
3841
  program.hook("preAction", async (_thisCommand, actionCommand) => {
3918
3842
  if (actionCommand.name() === "doctor")
3919
3843
  return;
3844
+ // flair#2887: `help` only prints. Skip the handshake probe so showing help
3845
+ // never reaches the server.
3846
+ if (actionCommand.name() === "help")
3847
+ return;
3920
3848
  // flair#2034 §2: `status` reports the server's version itself, next to this
3921
3849
  // CLI's and the install tree that serves it, and decides the advice from
3922
3850
  // that one comparison — a second, tree-blind "run: flair restart" line here
@@ -4099,7 +4027,6 @@ bindFederationCli({
4099
4027
  resolveBaseUrl,
4100
4028
  resolveEffectiveOpsUrl,
4101
4029
  resolveOpsPort,
4102
- applyAdminPassFile,
4103
4030
  addSharedCredentialOptions,
4104
4031
  addSharedIdentityOption,
4105
4032
  shouldShowInlineSecretWarning,
@@ -4111,10 +4038,12 @@ registerFederation(program);
4111
4038
  bindRemCli({
4112
4039
  api,
4113
4040
  resolveOpsPort,
4114
- applyAdminPassFile,
4115
4041
  addSharedCredentialOptions,
4116
4042
  readPortFromConfig,
4117
4043
  resolveHttpPort,
4044
+ resolveOpsUrlFromTarget,
4045
+ resolveAgentHomeTarget,
4046
+ INSTANCE_TARGET_REMEDY,
4118
4047
  humanBytes,
4119
4048
  relativeTime,
4120
4049
  DEFAULT_PORT,
@@ -4299,6 +4228,7 @@ bindUpgradeCli({
4299
4228
  probeOpenclawPluginVersion,
4300
4229
  relativeTime,
4301
4230
  resolveFabricCredentials,
4231
+ resolveEffectiveOpsUrl,
4302
4232
  resolveFlairMcpFinding,
4303
4233
  resolveHttpPort,
4304
4234
  resolveInstalledFlairCli,
@@ -5662,9 +5592,10 @@ export async function proveAdminPassAgainstInstance(port, adminPass) {
5662
5592
  if (err instanceof ApiHttpError && (err.status === 401 || err.status === 403)) {
5663
5593
  return `the supplied admin credential was rejected (HTTP ${err.status})`;
5664
5594
  }
5595
+ // Each ApiHttpError sendJsonRequest raises for this request begins its
5596
+ // message with `HTTP <status>`.
5665
5597
  const detail = err instanceof Error ? err.message : String(err);
5666
- const status = err instanceof ApiHttpError ? `HTTP ${err.status}: ` : "";
5667
- return `admin credential verification could not be completed (${status}${detail})`;
5598
+ return `admin credential verification could not be completed (${detail})`;
5668
5599
  }
5669
5600
  }
5670
5601
  /**
@@ -7633,7 +7564,6 @@ bindMemoryCli({
7633
7564
  api,
7634
7565
  resolveBaseUrl,
7635
7566
  resolveSigningAgentId,
7636
- applyAdminPassFile,
7637
7567
  addSharedCredentialOptions,
7638
7568
  addSharedIdentityOption,
7639
7569
  resolveOpsPort,
@@ -7673,7 +7603,6 @@ registerRelationship(program);
7673
7603
  bindSoulCli({
7674
7604
  api,
7675
7605
  resolveSigningAgentId,
7676
- applyAdminPassFile,
7677
7606
  addSharedCredentialOptions,
7678
7607
  });
7679
7608
  registerSoul(program);
@@ -7690,7 +7619,6 @@ registerBridge(program);
7690
7619
  // Bind shared cli-locals first so the extracted module never imports this file.
7691
7620
  bindBackupCli({
7692
7621
  addSharedCredentialOptions,
7693
- applyAdminPassFile,
7694
7622
  resolveHttpPort,
7695
7623
  resolveOpsPort,
7696
7624
  resolveOpsTarget,
@@ -7704,6 +7632,14 @@ bindRestoreCli({
7704
7632
  resolveHttpPort,
7705
7633
  });
7706
7634
  registerRestore(program);
7635
+ // ─── flair backup-approval ───────────────────────────────────────────────────
7636
+ // Command registration lives in src/commands/backup-approval.ts (flair#2664).
7637
+ // Bind shared cli-locals first so the extracted module never imports this file.
7638
+ bindBackupApprovalCli({
7639
+ addSharedCredentialOptions,
7640
+ resolveOpsPort,
7641
+ });
7642
+ registerBackupApproval(program);
7707
7643
  // ─── flair export ────────────────────────────────────────────────────────────
7708
7644
  // Command registration lives in src/commands/export.ts (flair#1636).
7709
7645
  // Bind shared cli-locals first so the extracted module never imports this file.
@@ -7771,6 +7707,9 @@ bindAttentionCli({
7771
7707
  resolveSigningAgentId,
7772
7708
  });
7773
7709
  registerAttention(program);
7710
+ // ─── flair help ──────────────────────────────────────────────────────────────
7711
+ // Command registration lives in src/commands/help.ts (flair#2887).
7712
+ registerHelp(program);
7774
7713
  // Parse argv and run the CLI. Exported so the CommonJS preflight shim
7775
7714
  // (cli-shim.cts → dist/cli-shim.cjs, the real bin entry) can invoke it after
7776
7715
  // its Node-version check passes. The shim imports this module, so import.meta.main
@@ -7808,6 +7747,11 @@ async function runCli() {
7808
7747
  await program.parseAsync();
7809
7748
  }
7810
7749
  catch (err) {
7750
+ // A write that crossed its whole-request deadline may have committed.
7751
+ // Report it exactly as `flair rem` does and exit 3 ("unknown"), so every
7752
+ // command that lets the error propagate gives the same answer.
7753
+ if (err instanceof ApiRequestOutcomeUnknown)
7754
+ exitUnknownOutcome(err);
7811
7755
  // Errors the API layer already translated (flair#1719) carry a sentence
7812
7756
  // naming the actor, state and remedy; print it without the undici stack.
7813
7757
  if (err && typeof err === "object" && err.flairFriendly === true) {