@tpsdev-ai/flair 0.62.0 → 0.63.1

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 (257) hide show
  1. package/README.md +14 -13
  2. package/SECURITY.md +73 -43
  3. package/config.yaml +11 -11
  4. package/dist/bridges/runtime/execute.js +1 -0
  5. package/dist/bridges/runtime/import-runner.js +4 -0
  6. package/dist/bridges/types.js +1 -0
  7. package/dist/build-info.json +3 -3
  8. package/dist/cli.js +309 -205
  9. package/dist/commands/agent.js +325 -137
  10. package/dist/commands/attention.js +2 -0
  11. package/dist/commands/backup-approval.js +218 -0
  12. package/dist/commands/backup.js +37 -33
  13. package/dist/commands/bootstrap.js +5 -1
  14. package/dist/commands/bridge.js +10 -0
  15. package/dist/commands/deploy.js +37 -7
  16. package/dist/commands/doctor.js +206 -42
  17. package/dist/commands/export.js +144 -15
  18. package/dist/commands/federation.js +653 -68
  19. package/dist/commands/grant.js +5 -6
  20. package/dist/commands/help.js +25 -0
  21. package/dist/commands/idp.js +14 -19
  22. package/dist/commands/import.js +167 -34
  23. package/dist/commands/init.js +380 -164
  24. package/dist/commands/integrity.js +5 -6
  25. package/dist/commands/keys.js +12 -8
  26. package/dist/commands/mcp.js +157 -79
  27. package/dist/commands/memory.js +38 -17
  28. package/dist/commands/migrate-harness-memory.js +9 -3
  29. package/dist/commands/orgevent.js +5 -10
  30. package/dist/commands/principal.js +32 -39
  31. package/dist/commands/quality.js +26 -3
  32. package/dist/commands/reembed.js +468 -111
  33. package/dist/commands/rem.js +484 -65
  34. package/dist/commands/restore.js +352 -44
  35. package/dist/commands/search.js +2 -0
  36. package/dist/commands/service.js +109 -2
  37. package/dist/commands/soul.js +0 -6
  38. package/dist/commands/status.js +165 -124
  39. package/dist/commands/test.js +4 -1
  40. package/dist/commands/upgrade.js +53 -22
  41. package/dist/commands/workspace.js +7 -8
  42. package/dist/deploy.js +59 -3
  43. package/dist/doctor-client.js +9 -25
  44. package/dist/fabric-upgrade.js +12 -2
  45. package/dist/federation/presence-send.js +139 -0
  46. package/dist/federation/scheduler.js +148 -12
  47. package/dist/federation-verify.js +269 -177
  48. package/dist/install/clients.js +171 -35
  49. package/dist/keystore.js +77 -10
  50. package/dist/lib/agent-id-rule.js +44 -2
  51. package/dist/lib/agent-key-file.js +509 -0
  52. package/dist/lib/agent-rotation-lock.js +249 -0
  53. package/dist/lib/atomic-write.js +3 -3
  54. package/dist/lib/auth-resolve.js +1040 -64
  55. package/dist/lib/backup-approval-store.js +612 -0
  56. package/dist/lib/backup-artifact.js +343 -0
  57. package/dist/lib/config-critical-section.js +212 -25
  58. package/dist/lib/connect-phase.js +33 -0
  59. package/dist/lib/daemon-liveness.js +2 -1
  60. package/dist/lib/federation-pair-access.js +4 -0
  61. package/dist/lib/federation-retry-queue.js +283 -0
  62. package/dist/lib/federation-retry-row.js +101 -0
  63. package/dist/lib/instruction-event-contract.js +17 -0
  64. package/dist/lib/instruction-event-doctor.js +102 -0
  65. package/dist/lib/key-dir.js +203 -0
  66. package/dist/lib/launchd-management.js +21 -6
  67. package/dist/lib/local-instance-pair.js +8 -1
  68. package/dist/lib/mcp-enable.js +14 -15
  69. package/dist/lib/memory-attributes.js +2 -0
  70. package/dist/lib/memory-provider-timeout.js +33 -0
  71. package/dist/lib/mqtt-config.js +132 -0
  72. package/dist/lib/mqtt-listener-doctor.js +104 -0
  73. package/dist/lib/node-alias-path.js +50 -2
  74. package/dist/lib/open-live-row.js +20 -0
  75. package/dist/lib/ops-url.js +52 -0
  76. package/dist/lib/promotion-content-hash.js +20 -0
  77. package/dist/lib/remote-admin-pass.js +157 -0
  78. package/dist/lib/restore-archive.js +760 -0
  79. package/dist/lib/restore-verify.js +1 -1
  80. package/dist/lib/scheduler-platform.js +13 -0
  81. package/dist/lib/service-repoint.js +13 -4
  82. package/dist/lib/skill-assignment-preflight.js +159 -0
  83. package/dist/lib/skill-seed.js +125 -10
  84. package/dist/lib/skill-tombstone-doctor.js +133 -0
  85. package/dist/lib/soul-scope-fields.js +26 -0
  86. package/dist/lib/terminal-text.js +32 -0
  87. package/dist/lib/uninstall-purge.js +266 -11
  88. package/dist/lib/upgrade-prior-liveness.js +2 -1
  89. package/dist/mcp-client-assertion.js +7 -14
  90. package/dist/memory-id-checkpoint.js +28 -7
  91. package/dist/mqtt-off-deploy.js +550 -0
  92. package/dist/rem/promote-policy.js +3 -3
  93. package/dist/rem/restore.js +302 -26
  94. package/dist/rem/runner.js +220 -58
  95. package/dist/rem/scheduler.js +21 -4
  96. package/dist/resources/A2AAdapter.js +131 -178
  97. package/dist/resources/AdminMemory.js +2 -0
  98. package/dist/resources/AdminMemoryCandidates.js +116 -0
  99. package/dist/resources/Agent.js +155 -45
  100. package/dist/resources/AgentCard.js +4 -0
  101. package/dist/resources/AgentKeyRegister.js +56 -22
  102. package/dist/resources/AgentReadPosition.js +7 -0
  103. package/dist/resources/AgentSeed.js +232 -107
  104. package/dist/resources/AutoPromoteCandidates.js +413 -84
  105. package/dist/resources/Credential.js +6 -8
  106. package/dist/resources/Federation.js +219 -57
  107. package/dist/resources/FederationRetry.js +4 -4
  108. package/dist/resources/InstructionVersion.js +1 -1
  109. package/dist/resources/MCPClientMetadata.js +6 -3
  110. package/dist/resources/Memory.js +1348 -271
  111. package/dist/resources/MemoryArchive.js +149 -64
  112. package/dist/resources/MemoryBootstrap.js +12 -22
  113. package/dist/resources/MemoryCandidate.js +16 -2
  114. package/dist/resources/MemoryConsolidate.js +2 -2
  115. package/dist/resources/MemoryFeed.js +360 -147
  116. package/dist/resources/MemoryMaintenance.js +290 -72
  117. package/dist/resources/MemoryPurge.js +138 -22
  118. package/dist/resources/MemoryReflect.js +68 -14
  119. package/dist/resources/MemoryReindex.js +91 -13
  120. package/dist/resources/Message.js +11 -2
  121. package/dist/resources/OAuth.js +156 -39
  122. package/dist/resources/OAuthClient.js +1 -1
  123. package/dist/resources/OrgEvent.js +292 -29
  124. package/dist/resources/OrgEventCatchup.js +7 -0
  125. package/dist/resources/OrgEventMaintenance.js +48 -10
  126. package/dist/resources/PairingToken.js +1 -1
  127. package/dist/resources/Presence.js +31 -11
  128. package/dist/resources/PromoteMemoryCandidate.js +8 -2
  129. package/dist/resources/RecordUsage.js +2 -4
  130. package/dist/resources/Soul.js +2 -0
  131. package/dist/resources/SoulFeed.js +2 -1
  132. package/dist/resources/WorkspaceLatest.js +4 -0
  133. package/dist/resources/XAA.js +36 -10
  134. package/dist/resources/a2a-stream.js +313 -0
  135. package/dist/resources/a2a-url.js +4 -5
  136. package/dist/resources/agent-admin.js +10 -1
  137. package/dist/resources/agent-auth.js +98 -68
  138. package/dist/resources/agent-read-position-lib.js +4 -1
  139. package/dist/resources/agent-status-guard.js +9 -7
  140. package/dist/resources/auth-middleware.js +166 -42
  141. package/dist/resources/authority-field-guard.js +9 -11
  142. package/dist/resources/auto-promote-lib.js +8 -5
  143. package/dist/resources/basic-auth-header.js +21 -0
  144. package/dist/resources/bm25-index-service.js +4 -5
  145. package/dist/resources/dedup-cluster.js +6 -1
  146. package/dist/resources/embeddings-provider.js +25 -0
  147. package/dist/resources/federation-classify.js +89 -0
  148. package/dist/resources/federation-retry-lib.js +6 -81
  149. package/dist/resources/health.js +75 -19
  150. package/dist/resources/host-pointer/registry.js +29 -0
  151. package/dist/resources/host-pointer-adapter.js +1 -0
  152. package/dist/resources/in-process-api.js +74 -11
  153. package/dist/resources/in-process.js +24 -22
  154. package/dist/resources/instruction-version-record.js +251 -7
  155. package/dist/resources/internal-authority.js +13 -0
  156. package/dist/resources/mcp-client-metadata-fields.js +4 -0
  157. package/dist/resources/mcp-handler.js +146 -13
  158. package/dist/resources/mcp-oauth-flag.js +12 -14
  159. package/dist/resources/mcp-oauth.js +446 -53
  160. package/dist/resources/mcp-tool-scopes.js +69 -0
  161. package/dist/resources/mcp-tools.js +70 -22
  162. package/dist/resources/memory-declared-attributes.js +1 -0
  163. package/dist/resources/memory-embed-hash.js +56 -0
  164. package/dist/resources/memory-host-source.js +5 -2
  165. package/dist/resources/memory-reflect-lib.js +1 -1
  166. package/dist/resources/memory-write-lock.js +202 -23
  167. package/dist/resources/memory-write-response.js +1 -1
  168. package/dist/resources/memory-write-transaction.js +243 -0
  169. package/dist/resources/migration-boot.js +17 -12
  170. package/dist/resources/migrations/boot-progress.js +25 -0
  171. package/dist/resources/migrations/data-dir.js +16 -3
  172. package/dist/resources/migrations/dir-safety.js +60 -2
  173. package/dist/resources/migrations/embedding-stamp.js +315 -49
  174. package/dist/resources/migrations/graph-heal.js +9 -2
  175. package/dist/resources/migrations/ledger.js +5 -2
  176. package/dist/resources/migrations/lock.js +867 -80
  177. package/dist/resources/migrations/progress.js +71 -10
  178. package/dist/resources/migrations/runner.js +212 -18
  179. package/dist/resources/migrations/state.js +36 -1
  180. package/dist/resources/migrations/status.js +2 -13
  181. package/dist/resources/migrations/synthetic-test-migration.js +78 -12
  182. package/dist/resources/migrations/types.js +26 -1
  183. package/dist/resources/migrations/visibility-backfill.js +111 -70
  184. package/dist/resources/oauth-discovery.js +0 -5
  185. package/dist/resources/object-body-guard.js +12 -5
  186. package/dist/resources/org-event-reserved.js +92 -0
  187. package/dist/resources/org-event-write-fault.js +19 -0
  188. package/dist/resources/owner-field-guard.js +1 -1
  189. package/dist/resources/owner-scoped-write-policy.js +65 -21
  190. package/dist/resources/owner-scoped-writes.js +37 -6
  191. package/dist/resources/path-id-rewrite.js +76 -0
  192. package/dist/resources/presence-internal.js +5 -5
  193. package/dist/resources/promotion-binding.js +43 -0
  194. package/dist/resources/promotion-stamp.js +124 -33
  195. package/dist/resources/protocol-context.js +189 -0
  196. package/dist/resources/record-type-kit.js +2 -4
  197. package/dist/resources/request-target.js +28 -1
  198. package/dist/resources/request-transaction.js +11 -1
  199. package/dist/resources/seed-reservation.js +1 -2
  200. package/dist/resources/semantic-retrieval-core.js +7 -6
  201. package/dist/resources/server-row-validation.js +71 -0
  202. package/dist/resources/skill-manifest.js +4 -3
  203. package/dist/resources/skill-version-write.js +400 -27
  204. package/dist/resources/skill-write-fault.js +6 -3
  205. package/dist/resources/skill-write-policy.js +2 -1
  206. package/dist/resources/soul-write-policy.js +26 -7
  207. package/dist/resources/table-helpers.js +1 -1
  208. package/dist/resources/table-subscription-policy.js +518 -85
  209. package/dist/resources/table-subscriptions.js +20 -7
  210. package/dist/resources/txn-pause-point.js +122 -5
  211. package/dist/resources/usage-recording.js +54 -46
  212. package/dist/resources/write-back.js +176 -11
  213. package/dist/resources/write-journal-context.js +5 -0
  214. package/dist/resources/write-journal.js +289 -0
  215. package/dist/src/keystore.js +77 -10
  216. package/dist/src/lib/agent-id-rule.js +44 -2
  217. package/dist/src/lib/atomic-write.js +3 -3
  218. package/dist/src/lib/federation-retry-row.js +101 -0
  219. package/dist/src/lib/instruction-event-contract.js +17 -0
  220. package/dist/src/lib/key-dir.js +203 -0
  221. package/dist/src/lib/memory-attributes.js +2 -0
  222. package/dist/src/lib/open-live-row.js +20 -0
  223. package/dist/src/lib/scheduler-platform.js +13 -0
  224. package/dist/src/lib/soul-scope-fields.js +26 -0
  225. package/dist/src/rem/promote-policy.js +3 -3
  226. package/dist/src/rem/scheduler.js +21 -4
  227. package/docs/access-control.md +39 -21
  228. package/docs/api-reference.md +161 -52
  229. package/docs/auth.md +69 -38
  230. package/docs/claude-code.md +3 -3
  231. package/docs/deploying-on-fabric.md +118 -2
  232. package/docs/deployment.md +17 -0
  233. package/docs/embedding-in-a-harper-app.md +23 -21
  234. package/docs/entity-vocabulary.md +7 -11
  235. package/docs/federation.md +29 -2
  236. package/docs/hosted-on-fabric.md +1 -1
  237. package/docs/integrations.md +11 -11
  238. package/docs/mcp-clients.md +7 -5
  239. package/docs/notes/mcp-agent-auth-consumer.md +4 -9
  240. package/docs/notes/mcp-oauth-model2.md +6 -6
  241. package/docs/openclaw.md +1 -1
  242. package/docs/quickstart-fabric.md +2 -2
  243. package/docs/quickstart.md +3 -3
  244. package/docs/releasing.md +13 -13
  245. package/docs/rem.md +24 -3
  246. package/docs/secrets-and-keys.md +9 -14
  247. package/docs/standalone-local.md +29 -2
  248. package/docs/supply-chain-policy.md +28 -20
  249. package/docs/the-team.md +2 -2
  250. package/docs/upgrade.md +29 -5
  251. package/package.json +18 -11
  252. package/schemas/agent.graphql +3 -3
  253. package/schemas/federation.graphql +10 -7
  254. package/schemas/memory.graphql +7 -2
  255. package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
  256. package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
  257. package/dist/resources/soul-adk-guard.js +0 -68
@@ -1,8 +1,13 @@
1
- import { resolveAdminUser } from "../lib/auth-resolve.js";
1
+ import { addAdminPassOptions, isLocalBase, resolveAdminUser, sendJsonRequest } from "../lib/auth-resolve.js";
2
+ import { readBackupArtifact } from "../lib/backup-artifact.js";
3
+ import { loadApprovedArchive } from "../lib/backup-approval-store.js";
2
4
  import { encodeRecordId } from "../lib/record-id-path.js";
3
5
  import { comparePreservedFields } from "../lib/restore-verify.js";
6
+ import { refuseSkillAssignmentWrite, skillSourceIsFilesystemPath } from "../lib/skill-assignment-preflight.js";
7
+ import { suppliesSoulScopeFields } from "../lib/soul-scope-fields.js";
8
+ import { listAgentCandidates, requireLiveListing } from "../rem/restore.js";
4
9
  import * as render from "../render.js";
5
- import { existsSync, readFileSync } from "node:fs";
10
+ import { existsSync } from "node:fs";
6
11
  let cli;
7
12
  /** Bind the cli-locals this module depends on. */
8
13
  export function bindCli(fns) {
@@ -13,14 +18,13 @@ function resolveHttpPort(...args) {
13
18
  }
14
19
  export function register(program) {
15
20
  // ─── flair restore ────────────────────────────────────────────────────────────
16
- program
21
+ addAdminPassOptions(program
17
22
  .command("restore <path>")
18
23
  .description("Import a Flair backup archive")
19
24
  .option("--merge", "Add/update records without deleting existing (default)")
20
25
  .option("--replace", "Delete archived Soul and Memory IDs first, then import")
21
26
  .option("--port <port>", "Harper HTTP port")
22
- .option("--url <url>", "Flair base URL (overrides --port)")
23
- .option("--admin-pass <pass>", "Admin password (or set FLAIR_ADMIN_PASS env)")
27
+ .option("--url <url>", "Flair base URL (overrides --port)"), "Admin password (or set FLAIR_ADMIN_PASS env)")
24
28
  .option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
25
29
  .option("--dry-run", "Show what would be imported without making changes")
26
30
  .action(async (backupPath, opts) => {
@@ -37,12 +41,49 @@ export function register(program) {
37
41
  console.error(`Error: backup file not found: ${backupPath}`);
38
42
  process.exit(1);
39
43
  }
40
- const backup = JSON.parse(readFileSync(backupPath, "utf-8"));
41
- if (backup.version !== 1) {
42
- console.error(`Error: unsupported backup version: ${backup.version}`);
43
- process.exit(1);
44
+ // Preflight (flair#2664), before any request in every mode, dry run
45
+ // included: read the archive once, hash and parse that one buffer, and
46
+ // require the hash to equal the digest flair backup wrote to
47
+ // `<archive>.sha256`. The parse refuses ill-formed UTF-8 or JSON, a
48
+ // repeated key or row id, an unsupported version, and rows restore cannot
49
+ // write (src/lib/restore-archive.ts).
50
+ //
51
+ // An archive with no sidecar (flair#2664 slice 1c) is admitted only by an
52
+ // unrevoked approval in this host's approval store
53
+ // (src/lib/backup-approval-store.ts) for the digest of the bytes just
54
+ // read, and only when the stored copy still hashes to that digest; the
55
+ // rows restored are parsed from that rechecked copy. A sidecar-backed
56
+ // archive needs no approval here.
57
+ const artifact = readBackupArtifact(backupPath);
58
+ let archive;
59
+ let admitted;
60
+ if (artifact.ok === false && (artifact.code !== "digest-missing" || artifact.sha256 === undefined)) {
61
+ console.error(`Error: ${artifact.reason}`);
62
+ process.exitCode = 1;
63
+ return;
64
+ }
65
+ if (artifact.ok === false) {
66
+ const approved = loadApprovedArchive(artifact.sha256);
67
+ if (approved.ok === false) {
68
+ const reapprove = approved.code === "store-unsafe" || approved.code === "record-invalid"
69
+ ? ""
70
+ : ` Approve the archive again on this host with flair backup-approval legacy-admit ${backupPath}.`;
71
+ const reason = approved.code === "not-approved"
72
+ ? artifact.reason
73
+ : `archive digest sidecar ${backupPath}.sha256 not found, and ${approved.reason}; restore stopped before any write.${reapprove}`;
74
+ console.error(`Error: ${reason}`);
75
+ process.exitCode = 1;
76
+ return;
77
+ }
78
+ archive = approved.archive;
79
+ admitted = `${approved.sha256} (no digest sidecar; approved on this host by ${approved.record.approvedBy} ` +
80
+ `at ${approved.record.approvedAt}, ${approved.record.admission} admission)`;
44
81
  }
45
- const { agents, memories, souls } = backup;
82
+ else {
83
+ archive = artifact.archive;
84
+ admitted = `${artifact.sha256} (matches ${artifact.digestPath})`;
85
+ }
86
+ const { agents, memories, souls } = archive;
46
87
  const collections = [
47
88
  { name: "Agent", rows: agents },
48
89
  { name: "Soul", rows: souls },
@@ -54,32 +95,15 @@ export function register(program) {
54
95
  console.error(`Error: ${failure}`);
55
96
  process.exitCode = 1;
56
97
  }
57
- for (const { name, rows } of collections) {
58
- if (!Array.isArray(rows)) {
59
- failures.push(`${name}: archive collection is not an array`);
60
- continue;
61
- }
62
- for (const [index, row] of rows.entries()) {
63
- if (!row || typeof row !== "object" || Array.isArray(row)
64
- || typeof row.id !== "string" || !row.id
65
- || (name !== "Agent" && (typeof row.agentId !== "string" || !row.agentId))) {
66
- failures.push(`${name} row ${index} (${row?.id ?? "missing ID"}): invalid archived row`);
67
- continue;
68
- }
69
- try {
70
- encodeRecordId(row.id);
71
- }
72
- catch {
73
- failures.push(`${name} ${row.id}: invalid archived ID`);
74
- }
75
- }
76
- }
77
- if (failures.length) {
78
- fail();
79
- return;
80
- }
81
98
  const auth = `Basic ${Buffer.from(`${adminUser}:${adminPass}`).toString("base64")}`;
99
+ // Every preflight read and every restore write targets baseUrl and refuses
100
+ // redirects, so a method-specific redirect is named instead of sent to a
101
+ // location the preflight did not check. The read raises ApiHttpError for a
102
+ // non-2xx reply, which is the shape the reused candidate-listing helper
103
+ // turns into its route guidance.
104
+ const preflightCall = (method, path, body) => sendJsonRequest(new URL(`${baseUrl}${path}`), method, body, auth, isLocalBase(baseUrl), { refuseRedirects: true, withholdResponseBodyDebug: true });
82
105
  console.log(`Restoring from: ${backupPath}`);
106
+ console.log(`Archive SHA-256: ${admitted}`);
83
107
  console.log(`Mode: ${mode}${dryRun ? " (dry run)" : ""}`);
84
108
  console.log(` Agents: ${agents.length}`);
85
109
  console.log(` Memories: ${memories.length}`);
@@ -94,9 +118,35 @@ export function register(program) {
94
118
  method,
95
119
  headers: { "Content-Type": "application/json", Authorization: auth },
96
120
  body: body === undefined ? undefined : JSON.stringify(body),
121
+ redirect: "manual",
97
122
  signal: AbortSignal.timeout(10_000),
98
123
  });
99
- return res.status;
124
+ if (res.status >= 300 && res.status < 400) {
125
+ return { status: res.status, error: undefined, redirected: true };
126
+ }
127
+ // The refusal name is read from the body, never the outcome: a body
128
+ // that cannot be read keeps the status this write answered with.
129
+ let error;
130
+ try {
131
+ error = errorName(await res.text());
132
+ }
133
+ catch {
134
+ error = undefined;
135
+ }
136
+ return { status: res.status, error, redirected: false };
137
+ }
138
+ catch {
139
+ return { status: undefined, error: undefined, redirected: false };
140
+ }
141
+ }
142
+ /** A redirect on a restore write, named rather than followed. */
143
+ const redirectFailure = (name, row, method, status) => `${label(name, row)}: ${method} was answered with HTTP ${status} redirect, which restore does not follow; `
144
+ + "no request was sent to the redirected location";
145
+ /** The `error` name in a refusal body, when it carries one. */
146
+ function errorName(text) {
147
+ try {
148
+ const error = JSON.parse(text)?.error;
149
+ return typeof error === "string" ? error : undefined;
100
150
  }
101
151
  catch {
102
152
  return undefined;
@@ -105,22 +155,272 @@ export function register(program) {
105
155
  const label = (name, row) => `${name} ${row.id} (agent ${name === "Agent" ? row.id : row.agentId})`;
106
156
  const diagnostic = (name, row, method, status) => `${label(name, row)}: ${method} failed (HTTP ${status ?? "unavailable"})`;
107
157
  if (mode === "replace") {
158
+ // A replace replay sends every archived Soul row back whole after
159
+ // deleting the archived ids. The server refuses a Soul write that
160
+ // supplies a non-empty `scopeTag` or `tags` array (flair#1540) or whose
161
+ // `value` equals a same-agent Memory content or MemoryCandidate claim
162
+ // (resources/soul-write-policy.ts), so a row either rule would refuse
163
+ // must stop the replay before the deletes, or the refused row may lose
164
+ // its live copy (flair#2931, #2941). Merge mode deletes nothing and is
165
+ // not checked here.
166
+ //
167
+ // The learned-content comparison runs against the state each Soul PUT
168
+ // will meet: the archived Memory ids are deleted first, and a failed
169
+ // Memory DELETE stops the run before any Soul delete, so those rows are
170
+ // gone when the Souls are written. They are written back after the Souls,
171
+ // so a live Memory row counts only when its id is not in the archive.
172
+ // Every live candidate counts: replace never deletes MemoryCandidate rows.
173
+ //
174
+ // A concurrent same-agent write between this preflight and the PUT is not
175
+ // covered.
176
+ const LEARNED_REFUSAL = "soul_value_is_learned_content";
177
+ const writtenSouls = souls;
178
+ const refusals = [];
179
+ const scopeRefused = new Set();
180
+ for (const row of writtenSouls) {
181
+ if (!suppliesSoulScopeFields(row))
182
+ continue;
183
+ scopeRefused.add(String(row.id));
184
+ refusals.push(`Error: Soul ${row.id}: the archived row supplies a non-empty scopeTag or tags array, `
185
+ + "which the Soul scope-field rule refuses; edit that row in the archive, then re-run; no rows were deleted");
186
+ }
187
+ // The copied predicate's filesystem classification reads this CLI
188
+ // process's tmpdir/TMPDIR/TMP/TEMP and working directory, while the
189
+ // server uses its own environment (resources/skill-provenance.ts), so a
190
+ // filesystem-path source can be durable to one and not the other.
191
+ // Non-dry-run replace refuses every such row before any delete; a
192
+ // non-path source keeps the environment-independent copied predicate.
193
+ const filesystemSourceRefused = new Set();
194
+ for (const row of writtenSouls) {
195
+ const id = String(row.id);
196
+ if (scopeRefused.has(id))
197
+ continue;
198
+ if (!skillSourceIsFilesystemPath(row))
199
+ continue;
200
+ filesystemSourceRefused.add(id);
201
+ refusals.push(`Error: Soul ${row.id}: its skill-assignment source is a filesystem path, whose durability `
202
+ + "the server decides from its own environment; restore without --replace, or edit that "
203
+ + "row's source in the archive, then re-run; no rows were deleted");
204
+ }
205
+ // The Soul PUT also refuses a skill-assignment row that the copied
206
+ // predicate refuses. The PUT sees no stored row (`existing` is
207
+ // undefined) only after a successful Soul DELETE; a failed DELETE is
208
+ // recorded and the PUT still runs, so the stored row may still exist.
209
+ const writeRuleRefused = new Set();
210
+ for (const row of writtenSouls) {
211
+ const id = String(row.id);
212
+ if (scopeRefused.has(id) || filesystemSourceRefused.has(id))
213
+ continue;
214
+ const skillDenied = refuseSkillAssignmentWrite(row);
215
+ if (!skillDenied)
216
+ continue;
217
+ writeRuleRefused.add(id);
218
+ let code = "skill-assignment";
219
+ try {
220
+ const body = (await skillDenied.json());
221
+ if (typeof body?.error === "string")
222
+ code = body.error;
223
+ }
224
+ catch {
225
+ /* keep the rule name */
226
+ }
227
+ refusals.push(`Error: Soul ${row.id}: the archived row would be refused by the Soul skill-assignment rule (${code}); `
228
+ + "edit that row in the archive, then re-run; no rows were deleted");
229
+ }
230
+ // Soul id -> value each Soul PUT will send, per owning agent.
231
+ const learnedCandidates = new Map();
232
+ for (const row of writtenSouls) {
233
+ const id = String(row.id);
234
+ if (scopeRefused.has(id) || filesystemSourceRefused.has(id) || writeRuleRefused.has(id))
235
+ continue;
236
+ if (typeof row.value !== "string" || row.value === "")
237
+ continue;
238
+ if (typeof row.agentId !== "string" || row.agentId === "")
239
+ continue;
240
+ let byValue = learnedCandidates.get(row.agentId);
241
+ if (byValue === undefined) {
242
+ byValue = new Map();
243
+ learnedCandidates.set(row.agentId, byValue);
244
+ }
245
+ const ids = byValue.get(row.value) ?? [];
246
+ ids.push(id);
247
+ byValue.set(row.value, ids);
248
+ }
249
+ const learnedRefusal = (soulId, table, row) => {
250
+ const field = table === "Memory" ? "content" : "claim";
251
+ const subject = row?.id === undefined || row.id === null || row.id === ""
252
+ ? `a ${table} row without an id`
253
+ : `${table} ${row.id}`;
254
+ return `Error: Soul ${soulId}: its value equals the ${field} of the same agent's ${subject}, `
255
+ + `which the Soul learned-content rule refuses (${LEARNED_REFUSAL}); `
256
+ + `remove or edit that ${table} row or the archived Soul's value, then re-run; no rows were deleted`;
257
+ };
258
+ // A live Memory row whose id is in the archive is deleted before the
259
+ // Souls are written, so it does not count as a survivor.
260
+ const archivedMemoryIds = new Set(memories.filter((row) => row?.id !== undefined && row.id !== null && row.id !== "").map((row) => String(row.id)));
261
+ try {
262
+ for (const [agentId, byValue] of learnedCandidates) {
263
+ const liveMemories = requireLiveListing(await preflightCall("GET", `/Memory?agentId=${encodeURIComponent(agentId)}`), "Memory", agentId);
264
+ const survivorByContent = new Map();
265
+ for (const memory of liveMemories) {
266
+ if (!memory || typeof memory !== "object" || Array.isArray(memory)) {
267
+ throw new Error(`the Memory listing for agent ${agentId} carries a row that is not an object`);
268
+ }
269
+ if (memory.agentId !== agentId)
270
+ continue;
271
+ if (typeof memory.content !== "string")
272
+ continue;
273
+ const id = memory.id === undefined || memory.id === null || memory.id === "" ? undefined : String(memory.id);
274
+ if (id !== undefined && archivedMemoryIds.has(id))
275
+ continue;
276
+ if (!survivorByContent.has(memory.content))
277
+ survivorByContent.set(memory.content, memory);
278
+ }
279
+ const unmatched = new Map(byValue);
280
+ for (const [value, soulIds] of byValue) {
281
+ const match = survivorByContent.get(value);
282
+ if (match === undefined)
283
+ continue;
284
+ for (const soulId of soulIds)
285
+ refusals.push(learnedRefusal(soulId, "Memory", match));
286
+ unmatched.delete(value);
287
+ }
288
+ if (unmatched.size === 0)
289
+ continue;
290
+ // The admin candidate route lists ids only; each listed row is read
291
+ // until every unmatched value has matched, to compare its claim
292
+ // exactly.
293
+ const candidates = await listAgentCandidates(preflightCall, agentId);
294
+ for (const candidate of candidates) {
295
+ if (unmatched.size === 0)
296
+ break;
297
+ const row = await preflightCall("GET", `/MemoryCandidate/${encodeRecordId(candidate.id)}`);
298
+ if (!row || typeof row !== "object" || Array.isArray(row) || typeof row.claim !== "string") {
299
+ throw new Error(`MemoryCandidate ${candidate.id} could not be read as a row with a claim`);
300
+ }
301
+ if (row.agentId !== agentId)
302
+ continue;
303
+ const soulIds = unmatched.get(row.claim);
304
+ if (soulIds === undefined)
305
+ continue;
306
+ for (const soulId of soulIds)
307
+ refusals.push(learnedRefusal(soulId, "MemoryCandidate", candidate));
308
+ unmatched.delete(row.claim);
309
+ }
310
+ }
311
+ }
312
+ catch (err) {
313
+ // A refusal already collected stays visible even when a later listing
314
+ // read fails: the operator should see each refusal collected so far,
315
+ // not only the error that stopped it (flair#2941).
316
+ for (const refusal of refusals)
317
+ console.error(refusal);
318
+ console.error(`Error: ${err?.message ?? String(err)}`);
319
+ console.error("Error: the replace stopped before any delete: a Soul write rule could not be checked against "
320
+ + "the live rows; check the target's Memory listing and MemoryCandidate listing responses, "
321
+ + "then re-run. No rows were deleted.");
322
+ process.exitCode = 1;
323
+ return;
324
+ }
325
+ if (refusals.length > 0) {
326
+ for (const refusal of refusals)
327
+ console.error(refusal);
328
+ process.exitCode = 1;
329
+ return;
330
+ }
108
331
  console.log("\nDeleting existing data (replace mode)...");
109
- for (const { name, rows } of collections.filter(({ name }) => name !== "Agent")) {
110
- for (const row of rows) {
111
- const status = await adminWrite("DELETE", `/${name}/${encodeRecordId(row.id)}`);
112
- if (status === undefined || (status !== 404 && (status < 200 || status >= 300))) {
113
- failures.push(diagnostic(name, row, "DELETE", status));
332
+ // Memory rows go first: the learned-content check above assumes the
333
+ // archived Memory ids are gone before a Soul write. A Memory DELETE the
334
+ // server refuses leaves that row in place, so stop here rather than
335
+ // delete a Soul whose PUT the surviving row would refuse.
336
+ // Archived Memories whose DELETE succeeded or whose outcome is unknown:
337
+ // if a later DELETE fails, attempt their write-back, verify each successful
338
+ // PUT, and report any PUT or verification failure by id.
339
+ const memoriesToRestore = [];
340
+ for (const row of memories) {
341
+ const { status, redirected } = await adminWrite("DELETE", `/Memory/${encodeRecordId(row.id)}`);
342
+ if (redirected) {
343
+ failures.push(redirectFailure("Memory", row, "DELETE", status));
344
+ }
345
+ else if (status === undefined || (status !== 404 && (status < 200 || status >= 300))) {
346
+ failures.push(diagnostic("Memory", row, "DELETE", status));
347
+ if (status === undefined)
348
+ memoriesToRestore.push(row);
349
+ }
350
+ else if (status >= 200 && status < 300) {
351
+ memoriesToRestore.push(row);
352
+ }
353
+ }
354
+ if (failures.length > 0) {
355
+ console.error("Error: a Memory DELETE failed; no Soul row was deleted.");
356
+ // Attempt the archived Memory write-backs, verify each successful PUT,
357
+ // and report any PUT or verification failure by id.
358
+ for (const row of memoriesToRestore) {
359
+ const { status, redirected } = await adminWrite("PUT", `/Memory/${encodeRecordId(row.id)}`, row);
360
+ if (redirected || status === undefined || status < 200 || status >= 300) {
361
+ failures.push(`${label("Memory", row)}: could not be restored after a later DELETE failed (`
362
+ + `${redirected ? `PUT was answered with HTTP ${status} redirect, which restore does not follow` : `PUT HTTP ${status ?? "unavailable"}`})`);
363
+ continue;
364
+ }
365
+ let problem;
366
+ try {
367
+ const res = await fetch(`${baseUrl}/Memory/${encodeRecordId(row.id)}`, {
368
+ headers: { Authorization: auth },
369
+ redirect: "manual",
370
+ signal: AbortSignal.timeout(10_000),
371
+ });
372
+ if (res.status >= 300 && res.status < 400) {
373
+ problem = `GET verification was answered with HTTP ${res.status} redirect, which restore does not follow`;
374
+ }
375
+ else if (!res.ok) {
376
+ problem = `GET verification failed (HTTP ${res.status})`;
377
+ }
378
+ else {
379
+ const restored = await res.json();
380
+ const mismatched = comparePreservedFields("Memory", row, restored);
381
+ if (!restored || typeof restored !== "object" || Array.isArray(restored)) {
382
+ problem = "GET verification returned a row that is not an object";
383
+ }
384
+ else if (restored.id !== row.id) {
385
+ problem = "GET verification returned a different id";
386
+ }
387
+ else if (mismatched.length > 0) {
388
+ problem = `GET verification failed (field mismatch: ${mismatched.join(", ")})`;
389
+ }
390
+ }
114
391
  }
392
+ catch {
393
+ problem = "GET verification failed";
394
+ }
395
+ if (problem !== undefined) {
396
+ failures.push(`${label("Memory", row)}: could not be restored after a later DELETE failed: ${problem}`);
397
+ }
398
+ }
399
+ fail();
400
+ return;
401
+ }
402
+ for (const row of souls) {
403
+ const { status, redirected } = await adminWrite("DELETE", `/Soul/${encodeRecordId(row.id)}`);
404
+ if (redirected) {
405
+ failures.push(redirectFailure("Soul", row, "DELETE", status));
406
+ }
407
+ else if (status === undefined || (status !== 404 && (status < 200 || status >= 300))) {
408
+ failures.push(diagnostic("Soul", row, "DELETE", status));
115
409
  }
116
410
  }
117
411
  }
118
412
  for (const { name, rows } of collections) {
119
413
  console.log(`Restoring ${name} records...`);
120
414
  for (const row of rows) {
121
- const status = await adminWrite("PUT", `/${name}/${encodeRecordId(row.id)}`, row);
122
- if (status === undefined || status < 200 || status >= 300) {
123
- failures.push(diagnostic(name, row, "PUT", status));
415
+ const { status, error, redirected } = await adminWrite("PUT", `/${name}/${encodeRecordId(row.id)}`, row);
416
+ if (redirected) {
417
+ failures.push(redirectFailure(name, row, "PUT", status));
418
+ }
419
+ else if (status === undefined || status < 200 || status >= 300) {
420
+ // A failed Soul write appends the refusal name the server returned,
421
+ // so a learned-content 403 is named rather than read as an auth
422
+ // failure (flair#2931, #2941).
423
+ failures.push(`${diagnostic(name, row, "PUT", status)}${name === "Soul" && error ? `: ${error}` : ""}`);
124
424
  }
125
425
  }
126
426
  }
@@ -129,12 +429,18 @@ export function register(program) {
129
429
  const path = `/${name}/${encodeRecordId(row.id)}`;
130
430
  let status;
131
431
  let restored;
432
+ let redirect;
132
433
  try {
133
434
  const res = await fetch(`${baseUrl}${path}`, {
134
435
  headers: { Authorization: auth },
436
+ redirect: "manual",
135
437
  signal: AbortSignal.timeout(10_000),
136
438
  });
137
439
  status = res.status;
440
+ if (res.status >= 300 && res.status < 400) {
441
+ redirect = res.status;
442
+ throw new Error();
443
+ }
138
444
  if (!res.ok)
139
445
  throw new Error();
140
446
  restored = await res.json();
@@ -145,7 +451,9 @@ export function register(program) {
145
451
  }
146
452
  }
147
453
  catch {
148
- failures.push(`${diagnostic(name, row, "GET", status)}: verification failed`);
454
+ failures.push(redirect === undefined
455
+ ? `${diagnostic(name, row, "GET", status)}: verification failed`
456
+ : `${label(name, row)}: GET verification was answered with HTTP ${redirect} redirect, which restore does not follow`);
149
457
  continue;
150
458
  }
151
459
  // Report mismatched field names without mismatched content values.
@@ -1,4 +1,5 @@
1
1
  import { buildEd25519Auth, requestTarget, requestUrl, resolveKeyPath } from "../lib/auth-resolve.js";
2
+ import { requireAgentId } from "../lib/key-dir.js";
2
3
  import * as render from "../render.js";
3
4
  import { DURABILITY_CAVEAT } from "../lib/durability-copy.js";
4
5
  let cli;
@@ -113,6 +114,7 @@ export function register(program) {
113
114
  console.error("error: --agent <id> required (or set FLAIR_AGENT_ID)");
114
115
  process.exit(2);
115
116
  }
117
+ requireAgentId(agentId);
116
118
  const baseUrl = resolveBaseUrl(opts);
117
119
  const url = requestUrl(baseUrl, "/SemanticSearch");
118
120
  const headers = { "content-type": "application/json" };
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_ADMIN_USER, defaultAdminPassPath, readAdminPassFileSecure } from "../lib/auth-resolve.js";
2
2
  import { seedUsingFlairSkill } from "../lib/skill-seed.js";
3
3
  import { reconcilePendingSkillSeed, skillSeedPendingPath } from "../lib/skill-seed-pending.js";
4
- import { classifyDaemonState } from "../lib/daemon-liveness.js";
4
+ import { classifyDaemonState, healthIndicatesListener } from "../lib/daemon-liveness.js";
5
5
  import { decideStartOnUnknown, probePortListening } from "../lib/stop-start-recovery.js";
6
6
  import { diagnoseLaunchdPlistPaths, isDetached, renderDetachedWarning, renderManagedStartUnconfirmed } from "../lib/launchd-management.js";
7
7
  import { LaunchdValidationRefusal, loadabilityAllowsAttempt, renderDirectRunNotice, renderStartLaunchdUnavailable, } from "../lib/launchd-domain-preflight.js";
@@ -173,6 +173,85 @@ async function seedAfterStart(dataDir, port) {
173
173
  console.error(`⚠️ Flair started, but the using-flair skill seed is still pending: ${err?.message ?? err}`);
174
174
  }
175
175
  }
176
+ /**
177
+ * Stop Flair when its launchd job was never loaded (flair#3067).
178
+ *
179
+ * A fresh `flair init` writes the plist but starts Flair directly, so the job
180
+ * an unload would target does not exist; the recorded process still runs.
181
+ * Reuses the five-state liveness machine for identity: a VERIFIED pid is
182
+ * signalled, and the stop waits for it with waitForProcessExit(pid,
183
+ * STARTUP_TIMEOUT_MS) (60 s). Refuses, without signalling, when the evidence
184
+ * is absent or not Flair's.
185
+ */
186
+ async function stopDirectlyStartedFlair(port, dataDir, label) {
187
+ const evidence = await gatherDaemonEvidence(port, dataDir);
188
+ const state = classifyDaemonState(evidence, { port, dataDir });
189
+ switch (state.state) {
190
+ case "RUNNING":
191
+ case "WEDGED": {
192
+ const pid = state.pid;
193
+ try {
194
+ process.kill(pid, "SIGTERM");
195
+ }
196
+ catch (err) {
197
+ if (err?.code !== "ESRCH") {
198
+ console.error(`❌ flair stop: failed to signal pid ${pid} for ${dataDir}: ${err?.code ?? err?.message}`);
199
+ process.exit(1);
200
+ }
201
+ }
202
+ await waitForProcessExit(pid, cli.STARTUP_TIMEOUT_MS);
203
+ removeStaleSidecarIfConfirmedDead(dataDir, pid);
204
+ // The recorded pid exiting is not proof that Flair is down. Read the
205
+ // instance, then launchd so a load during the awaited probe is visible;
206
+ // require NOT_RUNNING and not-loaded.
207
+ const after = classifyDaemonState(await gatherDaemonEvidence(port, dataDir), { port, dataDir });
208
+ const managedAfter = observeLaunchdManagement(dataDir, port);
209
+ if (managedAfter.jobLoaded !== "not-loaded" || after.state !== "NOT_RUNNING") {
210
+ const afterDetail = "detail" in after && after.detail ? ` ${after.detail}` : "";
211
+ console.error(`❌ flair stop: pid ${pid} exited, but Flair is not confirmed down for ${dataDir} — ` +
212
+ `the launchd job ${label} now reads ${managedAfter.jobLoaded ?? "unknown"} and the instance reads ${after.state}.${afterDetail}`);
213
+ // Name the step that handles this observation, next to the diagnostic.
214
+ if (managedAfter.jobLoaded === "loaded") {
215
+ console.error(" Run 'flair stop' again to take the unload path.");
216
+ }
217
+ else if (managedAfter.jobLoaded === "not-loaded" && after.state === "RUNNING") {
218
+ // This step prints only when the job reads not-loaded and the
219
+ // instance reads RUNNING: the classifier verified the hdb.pid pid
220
+ // against the identity sidecar (pid and start time), found it alive,
221
+ // and got Flair's /Health. A re-run that reads the same job state and
222
+ // verified pid signals that pid. RUNNING does not establish that the
223
+ // pid owns the port.
224
+ console.error(" Run 'flair stop' again to stop the verified recorded pid (the instance has recorded its identity).");
225
+ }
226
+ console.error(" Inspect it with: flair doctor");
227
+ process.exit(1);
228
+ }
229
+ console.log(`✅ stopped the directly started Flair (pid ${pid}); the launchd job ${label} was not loaded`);
230
+ return;
231
+ }
232
+ case "NOT_RUNNING":
233
+ console.error(`❌ flair stop: the launchd job ${label} is not loaded, and ${join(dataDir, "hdb.pid")} records no live Flair process.`);
234
+ console.error(" Nothing was signalled. Start Flair with: flair start");
235
+ process.exit(1);
236
+ default: {
237
+ // Name the process this refusal is about, from what was actually read:
238
+ // a pidfile pid, else the sidecar's last-known pid, else the port's
239
+ // listener only when a listener answered, else no identification at all.
240
+ const recorded = evidence.pidfile?.kind === "present" ? `pid ${evidence.pidfile.pid}`
241
+ : evidence.lastKnownPid !== undefined ? `pid ${evidence.lastKnownPid}`
242
+ : healthIndicatesListener(evidence.health) ? "the process serving the port"
243
+ : null;
244
+ if (recorded === null) {
245
+ console.error(`❌ flair stop: refusing to stop ${dataDir} — no Flair process could be identified, and the launchd job ${label} is not loaded. ${state.detail}`);
246
+ }
247
+ else {
248
+ console.error(`❌ flair stop: refusing to signal ${recorded} for ${dataDir} — it is not verifiably Flair's, and the launchd job ${label} is not loaded. ${state.detail}`);
249
+ }
250
+ console.error(" Nothing was signalled. Inspect it with: flair doctor");
251
+ process.exit(1);
252
+ }
253
+ }
254
+ }
176
255
  export function register(program) {
177
256
  const LEGACY_LAUNCHD_LABEL = cli.LEGACY_LAUNCHD_LABEL;
178
257
  const STARTUP_TIMEOUT_MS = cli.STARTUP_TIMEOUT_MS;
@@ -188,9 +267,37 @@ export function register(program) {
188
267
  // macOS: try launchd first. resolveLaunchdLabel (flair#693) finds
189
268
  // whichever label this data dir is actually registered under —
190
269
  // the new instance-scoped one, or a pre-flair#693 legacy install.
191
- const { plistPath } = resolveLaunchdLabel(defaultDataDir());
270
+ const { label, plistPath } = resolveLaunchdLabel(defaultDataDir());
192
271
  if (existsSync(plistPath)) {
193
272
  const dataDir = defaultDataDir();
273
+ // flair#3067: a fresh `flair init` writes the plist but starts Flair
274
+ // directly, so the job is not loaded. Unloading it stops nothing, and
275
+ // the wait below would spend the full startup budget on a process the
276
+ // unload never signalled. Ask the same question `flair restart` asks;
277
+ // when the job was never loaded, stop the direct process instead.
278
+ const managed = observeLaunchdManagement(dataDir, port);
279
+ if (managed.jobLoaded === "not-loaded") {
280
+ try {
281
+ await stopDirectlyStartedFlair(port, dataDir, label);
282
+ }
283
+ catch (err) {
284
+ const failure = mapRepairThrow(err);
285
+ console.error(`❌ flair stop: ${failure.detail}`);
286
+ if (failure.kind === "failed") {
287
+ for (const remedy of failure.remedy ?? [])
288
+ console.error(` Fix: ${remedy}`);
289
+ }
290
+ process.exit(1);
291
+ }
292
+ return;
293
+ }
294
+ if (managed.jobLoaded !== "loaded") {
295
+ // A lookup that failed is not an answer. Neither an unload nor a
296
+ // signal is licensed by it.
297
+ console.error(`❌ flair stop: refusing to stop ${dataDir} — could not read whether the launchd job ${label} is loaded, so nothing was signalled.`);
298
+ console.error(" Inspect launchd, then run: flair doctor");
299
+ process.exit(1);
300
+ }
194
301
  let pid = null;
195
302
  try {
196
303
  const n = Number(readFileSync(join(dataDir, "hdb.pid"), "utf-8").trim());
@@ -11,9 +11,6 @@ function api(...args) {
11
11
  function resolveSigningAgentId(opts, command) {
12
12
  return cli.resolveSigningAgentId(opts, command);
13
13
  }
14
- function applyAdminPassFile(opts) {
15
- cli.applyAdminPassFile(opts);
16
- }
17
14
  function addSharedCredentialOptions(cmd) {
18
15
  return cli.addSharedCredentialOptions(cmd);
19
16
  }
@@ -28,7 +25,6 @@ export function register(program) {
28
25
  .option("--url <url>", "Flair base URL (overrides the URL resolved from config; env: FLAIR_URL)")
29
26
  .option("--json", "Emit raw JSON response (also: pipe + FLAIR_OUTPUT=json)")
30
27
  .action(async (opts) => {
31
- applyAdminPassFile(opts);
32
28
  // PUT /Soul/{agentId:key} (upsert by id), matching flair-client's soul.set().
33
29
  // The Soul table resource has no POST handler, so a collection POST /Soul
34
30
  // 405s; the record must be written by its primary key. (#498)
@@ -67,7 +63,6 @@ export function register(program) {
67
63
  .option("--url <url>", "Flair base URL (overrides the URL resolved from config; env: FLAIR_URL)")
68
64
  .option("--json", "Emit raw JSON response (also: pipe + FLAIR_OUTPUT=json)")
69
65
  .action(async (id, opts) => {
70
- applyAdminPassFile(opts);
71
66
  // flair#1183: /Soul reads are verified (any registered agent). Resolve the
72
67
  // signer through the canonical seam so soul get honors the SAME precedence
73
68
  // as every other family; a null result lets api() fall to admin-pass/floor.
@@ -105,7 +100,6 @@ export function register(program) {
105
100
  .option("--url <url>", "Flair base URL (overrides the URL resolved from config; env: FLAIR_URL)")
106
101
  .option("--json", "Emit raw JSON array (also: pipe + FLAIR_OUTPUT=json)")
107
102
  .action(async (opts) => {
108
- applyAdminPassFile(opts);
109
103
  const { agentId, source } = resolveSigningAgentId(opts, "soul list");
110
104
  if (!agentId) {
111
105
  console.error(`${render.icons.error} --agent <id> required (or set FLAIR_AGENT_ID)`);