@tpsdev-ai/flair 0.59.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 (359) hide show
  1. package/README.md +10 -10
  2. package/SECURITY.md +49 -5
  3. package/config.yaml +23 -12
  4. package/dist/bridges/builtins/mem0.js +63 -28
  5. package/dist/bridges/runtime/execute.js +1 -0
  6. package/dist/bridges/runtime/import-runner.js +12 -0
  7. package/dist/bridges/runtime/load-plugin.js +42 -13
  8. package/dist/bridges/runtime/yaml-loader.js +4 -2
  9. package/dist/bridges/types.js +1 -0
  10. package/dist/build-info.json +3 -3
  11. package/dist/cli.js +1054 -367
  12. package/dist/commands/agent.js +233 -90
  13. package/dist/commands/attention.js +4 -3
  14. package/dist/commands/backup-approval.js +218 -0
  15. package/dist/commands/backup.js +211 -39
  16. package/dist/commands/bootstrap.js +3 -1
  17. package/dist/commands/bridge.js +172 -119
  18. package/dist/commands/deploy.js +71 -8
  19. package/dist/commands/doctor.js +711 -146
  20. package/dist/commands/export.js +57 -23
  21. package/dist/commands/federation.js +787 -82
  22. package/dist/commands/grant.js +5 -6
  23. package/dist/commands/help.js +25 -0
  24. package/dist/commands/hook.js +155 -2
  25. package/dist/commands/idp.js +27 -19
  26. package/dist/commands/import.js +136 -20
  27. package/dist/commands/init.js +469 -200
  28. package/dist/commands/integrity.js +387 -0
  29. package/dist/commands/keys.js +247 -58
  30. package/dist/commands/mcp.js +108 -52
  31. package/dist/commands/memory.js +203 -35
  32. package/dist/commands/migrate-harness-memory.js +3 -2
  33. package/dist/commands/orgevent.js +51 -47
  34. package/dist/commands/presence.js +4 -3
  35. package/dist/commands/principal.js +428 -62
  36. package/dist/commands/quality.js +13 -1
  37. package/dist/commands/reembed.js +141 -17
  38. package/dist/commands/relationship.js +2 -1
  39. package/dist/commands/rem.js +537 -80
  40. package/dist/commands/restore.js +413 -65
  41. package/dist/commands/search.js +6 -4
  42. package/dist/commands/service.js +235 -40
  43. package/dist/commands/soul.js +4 -9
  44. package/dist/commands/status.js +94 -38
  45. package/dist/commands/test.js +7 -3
  46. package/dist/commands/upgrade.js +77 -23
  47. package/dist/commands/workspace.js +13 -11
  48. package/dist/component-env.js +31 -41
  49. package/dist/deploy.js +136 -4
  50. package/dist/doctor-client.js +534 -92
  51. package/dist/engine-version-contract.js +1 -0
  52. package/dist/engine-version.js +23 -3
  53. package/dist/fabric-upgrade.js +12 -2
  54. package/dist/federation/presence-send.js +139 -0
  55. package/dist/federation-verify.js +273 -180
  56. package/dist/hook-install.js +670 -6
  57. package/dist/install/clients.js +171 -35
  58. package/dist/keystore.js +72 -0
  59. package/dist/lib/action-recall-runtime.js +328 -0
  60. package/dist/lib/agent-home-fields.js +132 -0
  61. package/dist/lib/agent-home.js +427 -0
  62. package/dist/lib/agent-id-rule.js +88 -0
  63. package/dist/lib/agent-roster.js +33 -0
  64. package/dist/lib/atomic-write.js +1 -1
  65. package/dist/lib/auth-resolve.js +1069 -60
  66. package/dist/lib/backup-approval-store.js +612 -0
  67. package/dist/lib/backup-artifact.js +343 -0
  68. package/dist/lib/capture-runtime.js +124 -0
  69. package/dist/lib/config-critical-section.js +212 -25
  70. package/dist/lib/connect-phase.js +33 -0
  71. package/dist/lib/credential-status-rule.js +78 -0
  72. package/dist/lib/daemon-liveness.js +43 -11
  73. package/dist/lib/doctor-run.js +75 -37
  74. package/dist/lib/durability-copy.js +10 -0
  75. package/dist/lib/embedding-space-doctor.js +75 -0
  76. package/dist/lib/federation-pair-access.js +4 -0
  77. package/dist/lib/federation-retry-queue.js +283 -0
  78. package/dist/lib/federation-retry-row.js +101 -0
  79. package/dist/lib/flair-agent-role.js +4 -0
  80. package/dist/lib/hub-url.js +12 -0
  81. package/dist/lib/init-admin-pass.js +88 -12
  82. package/dist/lib/init-listener-environ.js +1 -2
  83. package/dist/lib/init-occupied-listener.js +15 -111
  84. package/dist/lib/init-spawn-attribution.js +73 -0
  85. package/dist/lib/init-tcp-probe.js +33 -0
  86. package/dist/lib/instance-identity-row.js +20 -0
  87. package/dist/lib/instruction-event-contract.js +17 -0
  88. package/dist/lib/instruction-event-doctor.js +102 -0
  89. package/dist/lib/launchd-management.js +38 -3
  90. package/dist/lib/listener-table.js +268 -0
  91. package/dist/lib/local-delete-instance.js +27 -0
  92. package/dist/lib/local-instance-pair.js +256 -0
  93. package/dist/lib/mcp-enable.js +1182 -341
  94. package/dist/lib/mcp-oauth-env-core.js +133 -0
  95. package/dist/lib/mcp-oauth-env.js +125 -0
  96. package/dist/lib/mcp-spec.js +17 -1
  97. package/dist/lib/memory-attributes.js +4 -0
  98. package/dist/lib/memory-id-policy.js +46 -0
  99. package/dist/lib/memory-integrity.js +309 -0
  100. package/dist/lib/memory-provider-timeout.js +33 -0
  101. package/dist/lib/memory-purge-response.js +20 -0
  102. package/dist/lib/mqtt-config.js +132 -0
  103. package/dist/lib/mqtt-listener-doctor.js +104 -0
  104. package/dist/lib/open-live-row.js +20 -0
  105. package/dist/lib/ops-table-count.js +25 -0
  106. package/dist/lib/ops-url.js +52 -0
  107. package/dist/lib/owned-pins.js +67 -10
  108. package/dist/lib/peer-status.js +27 -0
  109. package/dist/lib/principal-status.js +29 -0
  110. package/dist/lib/process-start-time.js +76 -12
  111. package/dist/lib/promotion-content-hash.js +20 -0
  112. package/dist/lib/proto-safe-record.js +42 -0
  113. package/dist/lib/record-id-path.js +25 -0
  114. package/dist/lib/reembed-server-support.js +66 -0
  115. package/dist/lib/restore-archive.js +760 -0
  116. package/dist/lib/restore-verify.js +104 -0
  117. package/dist/lib/scheduler-platform.js +10 -6
  118. package/dist/lib/secret-keys.js +25 -0
  119. package/dist/lib/secrets-push.js +50 -22
  120. package/dist/lib/skill-assignment-preflight.js +159 -0
  121. package/dist/lib/skill-seed-pending.js +24 -0
  122. package/dist/lib/skill-seed.js +448 -0
  123. package/dist/lib/skill-tombstone-doctor.js +133 -0
  124. package/dist/lib/soul-scope-fields.js +26 -0
  125. package/dist/lib/stop-start-recovery.js +54 -0
  126. package/dist/lib/uninstall-purge.js +266 -11
  127. package/dist/lib/upgrade-prior-liveness.js +2 -1
  128. package/dist/lib/using-flair-skill.js +87 -0
  129. package/dist/mcp-client-assertion.js +114 -14
  130. package/dist/memory-id-checkpoint.js +347 -0
  131. package/dist/memory-node-compare.js +207 -0
  132. package/dist/mqtt-off-deploy.js +550 -0
  133. package/dist/packages/flair-mcp/src/secret-redaction.js +113 -0
  134. package/dist/rem/promote-policy.js +3 -3
  135. package/dist/rem/restore.js +303 -26
  136. package/dist/rem/runner.js +317 -96
  137. package/dist/rem/scheduler.js +21 -4
  138. package/dist/resources/A2AAdapter.js +131 -178
  139. package/dist/resources/AdminMemory.js +2 -0
  140. package/dist/resources/AdminMemoryCandidates.js +116 -0
  141. package/dist/resources/Agent.js +463 -33
  142. package/dist/resources/AgentCard.js +4 -0
  143. package/dist/resources/AgentKeyRegister.js +248 -0
  144. package/dist/resources/AgentKeyRegistration.js +28 -0
  145. package/dist/resources/AgentReadPosition.js +7 -0
  146. package/dist/resources/AgentSeed.js +238 -107
  147. package/dist/resources/AutoPromoteCandidates.js +413 -78
  148. package/dist/resources/Credential.js +183 -10
  149. package/dist/resources/Federation.js +915 -145
  150. package/dist/resources/FederationRetry.js +140 -0
  151. package/dist/resources/InstructionVersion.js +220 -0
  152. package/dist/resources/Integration.js +300 -25
  153. package/dist/resources/MCPClientMetadata.js +6 -3
  154. package/dist/resources/Memory.js +3300 -758
  155. package/dist/resources/MemoryArchive.js +171 -53
  156. package/dist/resources/MemoryBootstrap.js +122 -61
  157. package/dist/resources/MemoryCandidate.js +37 -3
  158. package/dist/resources/MemoryConsolidate.js +2 -2
  159. package/dist/resources/MemoryDedupStats.js +30 -1
  160. package/dist/resources/MemoryFeed.js +545 -50
  161. package/dist/resources/MemoryGrant.js +21 -1
  162. package/dist/resources/MemoryMaintenance.js +368 -46
  163. package/dist/resources/MemoryPurge.js +348 -0
  164. package/dist/resources/MemoryReflect.js +71 -12
  165. package/dist/resources/MemoryReindex.js +111 -17
  166. package/dist/resources/Message.js +16 -5
  167. package/dist/resources/OAuth.js +342 -48
  168. package/dist/resources/OAuthClient.js +1 -1
  169. package/dist/resources/OrgEvent.js +405 -19
  170. package/dist/resources/OrgEventCatchup.js +7 -0
  171. package/dist/resources/OrgEventMaintenance.js +48 -10
  172. package/dist/resources/PairingToken.js +1 -1
  173. package/dist/resources/Presence.js +166 -51
  174. package/dist/resources/PromoteMemoryCandidate.js +24 -7
  175. package/dist/resources/RecordUsage.js +2 -4
  176. package/dist/resources/Relationship.js +23 -0
  177. package/dist/resources/SemanticSearch.js +63 -32
  178. package/dist/resources/Soul.js +191 -76
  179. package/dist/resources/SoulFeed.js +2 -1
  180. package/dist/resources/TeamDirectory.js +35 -0
  181. package/dist/resources/WorkspaceLatest.js +4 -0
  182. package/dist/resources/WorkspaceState.js +21 -1
  183. package/dist/resources/XAA.js +207 -63
  184. package/dist/resources/a2a-stream.js +313 -0
  185. package/dist/resources/a2a-url.js +4 -5
  186. package/dist/resources/agent-admin.js +10 -1
  187. package/dist/resources/agent-auth.js +138 -83
  188. package/dist/resources/agent-read-position-lib.js +4 -1
  189. package/dist/resources/agent-status-guard.js +9 -7
  190. package/dist/resources/auth-middleware.js +534 -171
  191. package/dist/resources/authority-field-guard.js +9 -11
  192. package/dist/resources/auto-promote-lib.js +8 -5
  193. package/dist/resources/basic-auth-header.js +21 -0
  194. package/dist/resources/bm25-index-service.js +4 -5
  195. package/dist/resources/dedup-cluster.js +6 -1
  196. package/dist/resources/ed25519-auth.js +1 -1
  197. package/dist/resources/embedding-space-guard.js +366 -72
  198. package/dist/resources/embeddings-provider.js +25 -0
  199. package/dist/resources/engine-version-stamp-boot.js +53 -0
  200. package/dist/resources/federation-classify.js +161 -0
  201. package/dist/resources/federation-crypto.js +5 -5
  202. package/dist/resources/federation-retry-lib.js +60 -0
  203. package/dist/resources/grant-visibility.js +135 -0
  204. package/dist/resources/harper-routing.js +83 -0
  205. package/dist/resources/health.js +163 -22
  206. package/dist/resources/host-pointer/registry.js +29 -0
  207. package/dist/resources/host-pointer-adapter.js +1 -0
  208. package/dist/resources/host-source-citation.js +49 -0
  209. package/dist/resources/host-source-visibility.js +7 -6
  210. package/dist/resources/in-process.js +24 -22
  211. package/dist/resources/instance-create-lock.js +17 -0
  212. package/dist/resources/instance-identity.js +23 -0
  213. package/dist/resources/instruction-version-record.js +587 -0
  214. package/dist/resources/internal-authority.js +13 -0
  215. package/dist/resources/key-lock.js +3 -3
  216. package/dist/resources/mcp-handler.js +141 -19
  217. package/dist/resources/mcp-oauth-env-guard.js +36 -0
  218. package/dist/resources/mcp-oauth-flag.js +12 -14
  219. package/dist/resources/mcp-oauth.js +450 -56
  220. package/dist/resources/mcp-tool-arguments.js +4 -6
  221. package/dist/resources/mcp-tools.js +187 -40
  222. package/dist/resources/memory-bootstrap-lib.js +5 -15
  223. package/dist/resources/memory-declared-attributes.js +4 -1
  224. package/dist/resources/memory-deletion-history.js +55 -0
  225. package/dist/resources/memory-durability.js +54 -0
  226. package/dist/resources/memory-embed-hash.js +144 -0
  227. package/dist/resources/memory-embedding-value.js +8 -0
  228. package/dist/resources/memory-host-source.js +32 -7
  229. package/dist/resources/memory-id-guard.js +75 -0
  230. package/dist/resources/memory-redaction.js +236 -0
  231. package/dist/resources/memory-reflect-lib.js +1 -1
  232. package/dist/resources/memory-supplied-vector.js +72 -0
  233. package/dist/resources/memory-write-lock.js +489 -0
  234. package/dist/resources/memory-write-response.js +139 -0
  235. package/dist/resources/memory-write-transaction.js +243 -0
  236. package/dist/resources/migration-boot.js +17 -12
  237. package/dist/resources/migrations/boot-progress.js +25 -0
  238. package/dist/resources/migrations/data-dir.js +90 -19
  239. package/dist/resources/migrations/dir-safety.js +61 -3
  240. package/dist/resources/migrations/embedding-stamp.js +462 -82
  241. package/dist/resources/migrations/export.js +1 -0
  242. package/dist/resources/migrations/graph-heal.js +27 -27
  243. package/dist/resources/migrations/ledger.js +5 -2
  244. package/dist/resources/migrations/lock.js +870 -77
  245. package/dist/resources/migrations/progress.js +71 -10
  246. package/dist/resources/migrations/runner.js +212 -18
  247. package/dist/resources/migrations/snapshot.js +1 -0
  248. package/dist/resources/migrations/source-fields.js +5 -5
  249. package/dist/resources/migrations/state.js +36 -1
  250. package/dist/resources/migrations/status.js +2 -13
  251. package/dist/resources/migrations/synthetic-test-migration.js +81 -12
  252. package/dist/resources/migrations/types.js +26 -1
  253. package/dist/resources/migrations/visibility-backfill.js +113 -72
  254. package/dist/resources/oauth-discovery.js +0 -5
  255. package/dist/resources/object-body-guard.js +40 -0
  256. package/dist/resources/org-event-created-at.js +133 -0
  257. package/dist/resources/org-event-reserved.js +92 -0
  258. package/dist/resources/org-event-write-fault.js +19 -0
  259. package/dist/resources/originator-instance.js +39 -7
  260. package/dist/resources/owner-delete-recheck.js +78 -0
  261. package/dist/resources/owner-field-guard.js +39 -5
  262. package/dist/resources/owner-scoped-write-policy.js +256 -0
  263. package/dist/resources/owner-scoped-writes.js +89 -0
  264. package/dist/resources/path-id-rewrite.js +76 -0
  265. package/dist/resources/presence-internal.js +5 -5
  266. package/dist/resources/presence-receipt.js +236 -0
  267. package/dist/resources/promotion-binding.js +43 -0
  268. package/dist/resources/promotion-stamp.js +143 -17
  269. package/dist/resources/protocol-context.js +189 -0
  270. package/dist/resources/record-owner-guard.js +74 -26
  271. package/dist/resources/record-type-kit.js +2 -4
  272. package/dist/resources/record-types.js +1 -1
  273. package/dist/resources/relay-ops.js +78 -6
  274. package/dist/resources/replay-store.js +96 -19
  275. package/dist/resources/request-target.js +163 -0
  276. package/dist/resources/request-transaction.js +46 -1
  277. package/dist/resources/search-readiness.js +4 -1
  278. package/dist/resources/seed-ids.js +9 -0
  279. package/dist/resources/seed-reservation.js +116 -0
  280. package/dist/resources/semantic-retrieval-core.js +27 -15
  281. package/dist/resources/server-row-validation.js +71 -0
  282. package/dist/resources/skill-manifest.js +24 -14
  283. package/dist/resources/skill-subject.js +53 -0
  284. package/dist/resources/skill-version-write.js +789 -0
  285. package/dist/resources/skill-write-fault.js +20 -0
  286. package/dist/resources/skill-write-policy.js +68 -0
  287. package/dist/resources/skill-write.js +67 -7
  288. package/dist/resources/soul-write-policy.js +26 -7
  289. package/dist/resources/table-helpers.js +10 -7
  290. package/dist/resources/table-subscription-policy.js +518 -85
  291. package/dist/resources/table-subscriptions.js +20 -7
  292. package/dist/resources/team-directory.js +248 -0
  293. package/dist/resources/tool-descriptors/index.js +69 -8
  294. package/dist/resources/txn-pause-point.js +235 -0
  295. package/dist/resources/usage-recording.js +186 -70
  296. package/dist/resources/write-back.js +383 -0
  297. package/dist/resources/write-journal-context.js +5 -0
  298. package/dist/resources/write-journal.js +289 -0
  299. package/dist/src/engine-version-contract.js +1 -0
  300. package/dist/src/keystore.js +72 -0
  301. package/dist/src/lib/agent-home-fields.js +132 -0
  302. package/dist/src/lib/agent-id-rule.js +88 -0
  303. package/dist/src/lib/agent-key-register.js +80 -0
  304. package/dist/src/lib/atomic-write.js +256 -0
  305. package/dist/src/lib/credential-status-rule.js +78 -0
  306. package/dist/src/lib/expired-by-agent.js +37 -0
  307. package/dist/src/lib/federation-retry-row.js +101 -0
  308. package/dist/src/lib/flair-agent-role.js +4 -0
  309. package/dist/src/lib/idp-mapping-rule.js +81 -0
  310. package/dist/src/lib/instance-identity-row.js +20 -0
  311. package/dist/src/lib/instruction-event-contract.js +17 -0
  312. package/dist/src/lib/mcp-oauth-env-core.js +133 -0
  313. package/dist/src/lib/memory-attributes.js +4 -0
  314. package/dist/src/lib/memory-id-policy.js +46 -0
  315. package/dist/src/lib/open-live-row.js +20 -0
  316. package/dist/src/lib/principal-status.js +29 -0
  317. package/dist/src/lib/proto-safe-record.js +42 -0
  318. package/dist/src/lib/reembed-server-support.js +66 -0
  319. package/dist/src/lib/scheduler-platform.js +10 -6
  320. package/dist/src/lib/soul-scope-fields.js +26 -0
  321. package/dist/src/lib/systemd-agent-id.js +38 -0
  322. package/dist/src/rem/promote-policy.js +3 -3
  323. package/dist/src/rem/scheduler.js +21 -4
  324. package/docs/access-control.md +164 -54
  325. package/docs/api-reference.md +165 -32
  326. package/docs/auth.md +46 -30
  327. package/docs/bridges.md +11 -0
  328. package/docs/claude-code.md +37 -7
  329. package/docs/deploying-on-fabric.md +178 -0
  330. package/docs/deployment.md +19 -0
  331. package/docs/embedding-in-a-harper-app.md +17 -15
  332. package/docs/entity-vocabulary.md +3 -6
  333. package/docs/federation.md +61 -3
  334. package/docs/hosted-on-fabric.md +43 -36
  335. package/docs/integrations.md +14 -14
  336. package/docs/mcp-clients.md +12 -7
  337. package/docs/n8n.md +17 -11
  338. package/docs/notes/mcp-agent-auth-consumer.md +16 -13
  339. package/docs/notes/mcp-oauth-model2.md +40 -11
  340. package/docs/openclaw.md +1 -1
  341. package/docs/quickstart-fabric.md +4 -4
  342. package/docs/quickstart.md +12 -4
  343. package/docs/releasing.md +25 -19
  344. package/docs/rem.md +32 -3
  345. package/docs/secrets-and-keys.md +21 -4
  346. package/docs/standalone-local.md +30 -2
  347. package/docs/supply-chain-policy.md +34 -16
  348. package/docs/the-team.md +2 -2
  349. package/docs/upgrade.md +46 -6
  350. package/package.json +24 -12
  351. package/schemas/agent-key-registration.graphql +22 -0
  352. package/schemas/agent.graphql +6 -3
  353. package/schemas/federation.graphql +41 -1
  354. package/schemas/memory.graphql +91 -7
  355. package/schemas/oauth.graphql +19 -0
  356. package/schemas/schema.graphql +2 -0
  357. package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
  358. package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
  359. package/dist/resources/soul-adk-guard.js +0 -68
package/docs/upgrade.md CHANGED
@@ -111,6 +111,22 @@ flair upgrade --tree /opt/flair --flair-version 0.50.0
111
111
  without touching the tree. A git checkout or a path that *is* the npm-global
112
112
  install is refused rather than overwritten.
113
113
 
114
+ ### A symlinked data directory is refused at boot
115
+
116
+ The migration probe refuses a symlinked data directory or `.migrations` child.
117
+ When no candidate is usable, the boot log and `/HealthDetail` report the failure;
118
+ `flair doctor` does so with a verified agent and a reachable instance. Full paths
119
+ appear in the operator log, admin `/HealthDetail` responses and admin `flair doctor` output.
120
+
121
+ > **Heads-up:** for a link to a directory, only after verifying that the target is
122
+ > dedicated to this Flair instance and safe to relocate, stop Flair, remove the
123
+ > link, move its target to the configured path and start Flair. If ownership is
124
+ > uncertain, leave the target in place: for a linked **data directory**, set
125
+ > `FLAIR_MIGRATION_DATA_DIR` to the real directory path instead of the link and
126
+ > restart; for a linked `.migrations` child, configure a different data directory
127
+ > with an unlinked `.migrations` child. For a dangling link or a link to a file,
128
+ > replace the link with a writable directory.
129
+
114
130
  ### After a Node bump: the CLI and the instance in different install trees
115
131
 
116
132
  A service unit bakes the node binary and install tree of the runtime it was
@@ -400,6 +416,20 @@ stayed split for days after 0.30.0 was the incident this closes.
400
416
 
401
417
  ### Post-deploy fleet verify
402
418
 
419
+ By default, both `flair deploy` and `flair upgrade --target` set every MQTT
420
+ listener off in the target's configuration before deploying, then, after the
421
+ deploy's restart, request the shared worker threads' restart that applies it
422
+ when Flair is an isolated application (a fresh isolated deploy restarts only
423
+ Flair's own worker; otherwise the deploy's own restart covers the shared
424
+ workers) and read the saved configuration back, failing when it does not read
425
+ off (`--ops-target` / `FLAIR_OPS_TARGET` name the operations API for both;
426
+ `--no-restart` and `--no-verify` skip the restart request and the read-back).
427
+ They report what they set and requested; they do not probe the listeners,
428
+ and workers that have not restarted may still serve their previous listener
429
+ configuration. Pass `--keep-mqtt-config` to skip all of it and leave an MQTT
430
+ configuration you turned on deliberately
431
+ ([deploying-on-fabric.md](deploying-on-fabric.md#mqtt-configuration)).
432
+
403
433
  As of flair#636, both `flair deploy` and `flair upgrade --target` automatically run a
404
434
  fleet convergence sweep after a successful deploy — Harper's own "Successfully
405
435
  deployed" (and the served-API verify above) only confirm the *origin* node; nothing
@@ -685,10 +715,10 @@ the destructive replace unless you pass `--yes`); the equivalent by hand is `fla
685
715
  stop && rm -rf ~/.flair/data && mkdir -p ~/.flair/data && tar -xzf
686
716
  <snapshot> -C ~/.flair/data && flair start`, in case you'd rather not use the command.
687
717
 
688
- If you don't have a snapshot (upgraded without `--snapshot`, or on a version from
689
- before flair#637 shipped it), there is no tested way back short of restoring from a
690
- `flair backup` JSON export on the older version — do not assume an untested downgrade
691
- boot will work.
718
+ The only full rollback is restoring the pre-upgrade physical data-directory snapshot.
719
+ `flair backup`/`restore` logically exports/imports only Agent, Memory and Soul rows
720
+ through a running server into a fresh compatible instance; it does not restore the
721
+ physical store or other tables.
692
722
 
693
723
  ### Does the previous version actually boot against newer data? (tested, not assumed)
694
724
 
@@ -696,8 +726,11 @@ This used to be aspirational — nobody had actually checked. `test/compat/downg
696
726
  now checks it for real, nightly, alongside the mixed-version federation suite (both run
697
727
  from `.github/workflows/federation-compat.yml`'s `bun test test/compat/`): it boots the
698
728
  current build, writes a memory and a presence row, stops it *without* wiping the data
699
- directory, then boots the last **npm-published** `@tpsdev-ai/flair` against that exact
700
- same directory and confirms it comes up healthy and can read both rows back.
729
+ directory, then starts a pinned earlier Flair release that uses the previous storage engine (`@tpsdev-ai/flair` 0.59.0) against that
730
+ same directory through its own CLI in npm's nested layout. The test requires the two Harper engines to
731
+ differ, and confirms the older CLI's backwards-engine guard refuses the store *before*
732
+ Harper is spawned, naming the engine change, with regular-file paths and contents in the
733
+ data directory unchanged.
701
734
 
702
735
  **The guarantee is now restated (flair#1050):** there is never a silent bad outcome.
703
736
  Either the old binary boots and serves the corpus correctly, **or** it refuses to start
@@ -721,6 +754,13 @@ recovery as the 5.1 → 5.2 break: `flair snapshot restore <path>`. The
721
754
  the flair#1050 invariant (it boots Harper via `startHarper`, so the CLI stamp
722
755
  phrasing is not on that path).
723
756
 
757
+ **Engine-version break: Harper 5.2 → 5.3.** This release attempts to write an `engine-version.txt` stamp into
758
+ `ROOTPATH` (or `~/.flair/data` when unset) at boot; the write is best effort. With a readable, nonempty stamp and a known installed Harper version, an older guarded Flair refuses before Harper opens the store if the stamp is newer or the versions cannot be compared. A failed write can leave a stale stamp.
759
+ The only full rollback is restoring the pre-upgrade physical data-directory snapshot
760
+ (`flair snapshot restore <path>`). `flair backup`/`restore` logically exports/imports
761
+ only Agent, Memory and Soul rows through a running server into a fresh compatible
762
+ instance; it does not restore the physical store or other tables.
763
+
724
764
  **As observed when this suite was added (2026-07-08):** the npm-published baseline
725
765
  (0.21.0) boots cleanly against data written by a HEAD build roughly 14 commits ahead of
726
766
  it (several security-hardening and CLI-behavior changes, no Flair schema migration, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/flair",
3
- "version": "0.59.0",
3
+ "version": "0.63.0",
4
4
  "packageManager": "bun@1.3.10",
5
5
  "description": "Identity, memory, and soul for AI agents. Cryptographic identity (Ed25519), semantic memory with local embeddings, and persistent personality — all in a single process.",
6
6
  "type": "module",
@@ -63,10 +63,10 @@
63
63
  "node": "^22.18.0 || >=24.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@harperfast/oauth": "2.5.0",
66
+ "@harperfast/oauth": "2.9.0",
67
67
  "@types/js-yaml": "4.0.9",
68
68
  "commander": "14.0.3",
69
- "harper": "5.2.8",
69
+ "harper": "5.3.6",
70
70
  "harper-fabric-embeddings": "^0.5.0",
71
71
  "jose": "6.2.2",
72
72
  "js-yaml": "^4.3.2",
@@ -76,10 +76,11 @@
76
76
  },
77
77
  "overrides": {
78
78
  "react-native-fs": "npm:empty-npm-package@1.0.0",
79
+ "@harperfast/fulltext": "npm:empty-npm-package@1.0.0",
79
80
  "brace-expansion": "^5.0.12",
80
- "undici": "~8.10.2",
81
- "fast-uri": "^4.1.5",
82
- "hono": "^4.13.5",
81
+ "undici": "8.12.2",
82
+ "fast-uri": "4.2.3",
83
+ "hono": "4.13.16",
83
84
  "js-yaml": "^4.3.2",
84
85
  "adm-zip": "^0.6.1",
85
86
  "@opentelemetry/core": "^2.8.0",
@@ -88,14 +89,25 @@
88
89
  "@tootallnate/once": "^2.0.1",
89
90
  "form-data": "^4.0.6",
90
91
  "mysql2": "^3.22.0",
91
- "mariadb": "~3.4.7",
92
- "qs": "^6.16.0",
93
- "fastify": "^5.12.5",
92
+ "mariadb": "3.5.4",
93
+ "qs": "6.16.1",
94
+ "fastify": "^5.12.7",
94
95
  "lodash": "^4.18.0",
95
- "ip-address": "^10.5.1",
96
- "joi": "^17.13.7",
96
+ "ip-address": "^10.7.4",
97
+ "zod": "4.6.7",
98
+ "body-parser": "2.4.0",
99
+ "joi": "17.13.9",
97
100
  "moment": "^2.31.0",
98
- "@grpc/grpc-js": "^1.14.5"
101
+ "@grpc/grpc-js": "^1.14.5",
102
+ "http-cache-semantics": "^4.3.0",
103
+ "proxy-addr": "^2.0.8",
104
+ "@modelcontextprotocol/sdk": "1.32.0",
105
+ "handlebars": "4.7.10",
106
+ "simple-git": "4.0.2",
107
+ "@simple-git/argv-parser": "2.0.1",
108
+ "node-forge": "1.4.3",
109
+ "systeminformation": "5.33.16",
110
+ "@hono/node-server": "2.1.6"
99
111
  },
100
112
  "devDependencies": {
101
113
  "@playwright/test": "1.59.1",
@@ -0,0 +1,22 @@
1
+ # AgentKeyRegistration — the private audit record for one committed key
2
+ # registration (POST /AgentKeyRegister, resources/AgentKeyRegister.ts).
3
+ #
4
+ # One row per committed registration. It carries NO secret: the actor, the
5
+ # operator, the target agent's id, this instance's id, the key's FINGERPRINT in
6
+ # place of the key, and the time. Because it holds no secret it is `replicate: true` —
7
+ # a deliberate choice, in contrast to the token-enrollment table the design
8
+ # thread records for a later slice, which must be `replicate: false`.
9
+ #
10
+ # On the Flair resource route (resources/AgentKeyRegistration.ts) reads are
11
+ # admin-only and every write is refused; the registration operation is its only
12
+ # application writer, through the raw table handle. The Harper operations API is
13
+ # a separate raw-table trust root that this does not govern.
14
+ type AgentKeyRegistration @table(database: "flair", replicate: true) {
15
+ id: ID @primaryKey # server-generated registrationId
16
+ actorId: String! @indexed # the admin that registered the key: an admin agent id (TPS-Ed25519) or a Harper username (Basic)
17
+ operator: String # the Harper username on the request, if any (an audit label only)
18
+ agentId: String! @indexed # the agent row whose key was registered
19
+ instanceId: String @indexed # the local instance id that performed the registration
20
+ keyFingerprint: String! # sha256 (hex) of the registered key's canonical base64url string, stored in place of the key
21
+ createdAt: String!
22
+ }
@@ -23,11 +23,11 @@ type Agent @table(database: "flair") @export {
23
23
  createdAt: String!
24
24
  updatedAt: String
25
25
  originatorInstanceId: String @indexed # federation-edge-hardening slice 1 — write-time instance identity,
26
- # stamped server-side in resources/Agent.ts's post()/put() via
26
+ # stamped server-side in resources/Agent.ts's post() via
27
27
  # resources/originator-instance.ts from resources/instance-identity.ts's
28
28
  # localInstanceId(). On CREATE the local id is stamped (a request-body value is
29
- # ignored); on UPDATE the STORED value stands (a body value neither replaces nor
30
- # clears it). Nullable (existing rows read null = clean upgrade); preserved
29
+ # ignored); on UPDATE (put(), which only updates an existing row, and patch())
30
+ # the STORED value stands (a body value neither replaces nor clears it). Nullable (existing rows read null = clean upgrade); preserved
31
31
  # (never re-stamped) as the record flows through federation sync merges. See
32
32
  # schemas/memory.graphql's Memory.originatorInstanceId for the full contract —
33
33
  # same field, same idiom, this is one of the 4 synced tables
@@ -76,6 +76,9 @@ type Integration @table(database: "flair") @export {
76
76
  email: String
77
77
  encryptedCredential: String
78
78
  metadata: String
79
+ # Null or absent means unpublished. Integration resource publication writes
80
+ # stamp an ISO time for a tps-mail binding.
81
+ directoryPublishedAt: String
79
82
  createdAt: String!
80
83
  updatedAt: String
81
84
  }
@@ -33,12 +33,52 @@ type Peer @table(database: "flair") @export {
33
33
  lastSyncAt: String # last contact with this peer (liveness signal)
34
34
  lastMergeAt: String # last sync where merged > 0 (data-progress signal)
35
35
  lastSyncCursor: String # Lamport clock or ISO timestamp for incremental sync
36
+ presenceLastSyncAt: String # sender-side per-table Presence watermark (flair#2578).
36
37
  relayOnly: Boolean # true for spoke-to-spoke peers announced by hub
37
38
  pairedAt: String
38
39
  createdAt: String! @indexed
39
40
  updatedAt: String
40
41
  }
41
42
 
43
+ # Sender-owned federation retry bookkeeping (flair#2455). The table is shaped
44
+ # for one row per (peer, table, record) the receiver refused for a reason a
45
+ # later re-offer could clear, plus locally observed unconfirmed sends. The
46
+ # generic-Memory sender (`runFederationSyncOnce`) creates a pending row on a
47
+ # retryable refusal or a first indeterminate outcome, and updates it on later
48
+ # attempts, outcomes and source changes; rows an admin writes are readable now.
49
+ # Local bookkeeping, EXCLUDED from
50
+ # federation policy and the receive mapping, so no inbound sync record can write
51
+ # it (a pushed record naming it that passes the receiver's payload-id check
52
+ # skips as `unknown_table`). Admin-only on every
53
+ # operation; see resources/FederationRetry.ts.
54
+ #
55
+ # ENFORCED: @sealed makes Harper refuse a write that names a field not declared
56
+ # below. CONVENTIONS, not enforced by this schema: `id` is retryEntryKey(peerId,
57
+ # table, recordId) (resources/federation-retry-lib.ts), and the commented
58
+ # values of state, lastReason, resolution and bound. The reader and the
59
+ # transition check these (retryRowProblem) and treat a row that breaks one as
60
+ # malformed.
61
+ type FederationRetry @table(database: "flair") @sealed @export {
62
+ id: ID @primaryKey # by convention retryEntryKey(peerId, table, recordId)
63
+ peerId: String! @indexed # the peer that refused (or never answered)
64
+ table: String! # the source table name
65
+ recordId: String! # the source row id
66
+ state: String! @indexed # "pending" | "terminal"
67
+ firstRefusedAt: String! @indexed # the obligation's first recorded time (a refusal or an indeterminate outcome); the sender enforces no age bound yet
68
+ attempts: Int! @indexed # incremented and persisted once per sender-level offer of a row that already has a valid pending row, before the send (a first ordinary offer has none); adaptive batch splitting can send the row more than once under one reservation; the sender enforces no attempt bound yet
69
+ episodeId: String # RESERVED: the sender does not generate it; a terminal update copies an existing value from the row it transitions — intended as the obligation's generation, for rejecting stale completions
70
+ recordFingerprint: String # content fingerprint, for exhausted-row suppression
71
+ lastReason: String # the closed SkipReason, or a local reason
72
+ lastAttemptSyncId: String # the sync that last reserved an attempt
73
+ lastAttemptAt: String
74
+ completedAt: String # when the row became terminal
75
+ resolution: String # which terminal outcome ended it
76
+ bound: String # RESERVED: the sender does not set a non-null value; a terminal update writes null — "attempts" | "age" | "both" for retry_exhausted; null otherwise
77
+ createdAt: String!
78
+ updatedAt: String
79
+ }
80
+
81
+
42
82
  # Federation body-signature nonces are recorded in `ReplayNonce`
43
83
  # (schemas/replay.graphql), shared with agent auth (flair#2061).
44
84
 
@@ -49,7 +89,7 @@ type SyncLog @table(database: "flair") {
49
89
  direction: String! @indexed # "push" | "pull"
50
90
  recordCount: Int # how many records merged in this batch
51
91
  skippedCount: Int # how many records skipped (sum of skippedReasons)
52
- skippedReasons: String # JSON: { unknown_table: N, non_originator: N, future_timestamp: N, no_op_same_hash: N, merge_error: N, unknown_originator_key: N, invalid_signature: N, missing_signature: N, principal_mismatch: N }
92
+ skippedReasons: String # JSON counts by SkipReason, for example { unknown_table: N, non_originator: N, merge_error: N }; the full vocabulary is SKIP_REASON_CLASS in resources/federation-classify.ts
53
93
  status: String @indexed # "success" | "partial" | "failed"
54
94
  error: String # human-readable summary if partial/failed (includes per-record error messages, capped)
55
95
  durationMs: Int # how long the sync took
@@ -33,12 +33,38 @@ type Memory @table(database: "flair") {
33
33
  # write) but never DECLARED in this schema, so it was storable but not
34
34
  # queryable — Harper's Table.search({conditions}) rejects a condition on
35
35
  # an undeclared attribute ("X is not a defined attribute"), which the
36
- # zero-touch migration runner's bounded detect()/countPending()/run()
37
- # queries (resources/migrations/embedding-stamp.ts: `embeddingModel
38
- # not_equal <current>`) need in order to stay O(1)-bounded rather than a
39
- # full-corpus scan on every boot. Purely additive — existing rows already
36
+ # zero-touch migration runner's `embeddingModel not_equals <current>` query
37
+ # (resources/migrations/embedding-stamp.ts) needs. Since flair#2465 only
38
+ # detect() runs that query (first, before a scan); countPending() and run()
39
+ # scan the whole table directly. Purely additive — existing rows already
40
40
  # carry this value on disk; declaring it queryable changes nothing about
41
41
  # what's written or how embeddings/prefixes behave (#689's gate untouched).
42
+ embeddedContentHash: String @indexed # flair#2465: a stored text hash —
43
+ # `computeContentHash(agentId, skillEmbedText(row))`, the function that
44
+ # defines `contentHash`, applied to the field the row embeds from
45
+ # (`trigger` for a skill-tagged row with a non-empty trigger, else
46
+ # `content`). NEWLY COMPUTED over the text embedded when the server
47
+ # computes a vector on a guarded path (Memory POST/PUT/PATCH embed,
48
+ # re-embed PATCH, stamp migration fallback, auto-embed backfill) for a row
49
+ # with a non-empty owner; null for an empty owner. RETAINED, not
50
+ # recomputed, by a PUT/PATCH that carries a vector or stores one accepted
51
+ # from the caller and by a skill successor that carries the stored
52
+ # vector: a preserved value that may describe an earlier server-computed
53
+ # vector. A POST or PUT create that stores a vector accepted from the
54
+ # caller stores null; when redaction changes the text, the supplied
55
+ # vector is discarded and the redacted text is embedded afresh, with a
56
+ # new hash when that yields a vector.
57
+ # An admin PATCH create drops a submitted value and can leave the field
58
+ # absent; a `_reindex` PUT keeps the stored value and refuses a differing
59
+ # one; a value received through federation is an unverified peer
60
+ # assertion. The stamp migration treats a row as current when
61
+ # `embeddingModel` is current-space AND this value is absent or equals the
62
+ # EXPECTED hash of the row's current text; it re-queues a row whose value
63
+ # differs (a live per-row scan). Nullable/additive: an absent value
64
+ # bypasses only the hash comparison, as a matching one passes it; either
65
+ # way the row still needs a current-space model. Distinct from
66
+ # `contentHash`, which the feed stamps over `content` and an ordinary
67
+ # Memory write does not maintain.
42
68
  tags: [String] @indexed
43
69
  durability: String @indexed
44
70
  source: String
@@ -72,17 +98,18 @@ type Memory @table(database: "flair") {
72
98
  # /RecordUsage (resources/RecordUsage.ts) and citation-on-write
73
99
  # (resources/Memory.ts post()/put() → recordCitations(), which also
74
100
  # validates each cited id against the writer's read scope,
75
- # flair#775). It does a targeted get-then-put increment on this
76
- # field alone (never through Memory.put() — see RecordUsage.ts's
101
+ # flair#775). It increments through the raw table (see RecordUsage.ts's
77
102
  # module doc for why: usage feedback writes to ANOTHER agent's
78
103
  # memory, and Memory's ownership check would 403 every legit
79
104
  # call). Drives usageBoost in resources/scoring.ts, which replaces
80
105
  # retrievalBoost in compositeScore (retrievalCount was the
81
106
  # contaminated "retrieval counted as usage" signal root-caused in
82
107
  # flair#623).
108
+ writeBackWriteId: String
83
109
  promotionStatus: String # null | "pending" | "approved" | "rejected"
84
110
  promotedAt: String
85
111
  promotedBy: String # authenticated agentId who approved
112
+ promotionContentHash: String # server-only SHA-256 of the stored, post-redaction content at stamping time (flair#2478)
86
113
  archived: Boolean @indexed
87
114
  archivedAt: String
88
115
  archivedBy: String # authenticated agentId who archived
@@ -140,6 +167,7 @@ type Memory @table(database: "flair") {
140
167
  # that producer is a follow-up); additive/nullable, existing rows carry no
141
168
  # entities, readers tolerate absent (same pattern as Presence.activityUpdatedAt).
142
169
  # See docs/entity-vocabulary.md.
170
+ skillSubjectId: String @indexed # Nullable, server-owned skill subject.
143
171
  }
144
172
 
145
173
  # Explicit entity-to-entity relationships with temporal validity.
@@ -284,7 +312,9 @@ type MemoryHitStat @table(database: "flair") {
284
312
  # undeclared attributes except the named bookkeeping fields (f1-out/f1-in).
285
313
  #
286
314
  # Cascade (A1' item 6 / A1'' item 2): `Memory.delete` and maintenance expiry or
287
- # age-based archival delete the pointer with their Memory operation. `MemoryArchive`
315
+ # age-based archival delete the pointer with their Memory operation. POST
316
+ # /MemoryPurge deletes a pointer only after a read after its row delete's commit
317
+ # finds the row gone, so a row still stored keeps its pointer. `MemoryArchive`
288
318
  # basement/restore retains the pointer row; the join suppresses it while the Memory
289
319
  # is archived. `Memory.delete` joins a request transaction when present; maintenance
290
320
  # uses an owned transaction per item (c3). An orphan sweep re-checks inside the
@@ -363,6 +393,10 @@ type MemoryCandidate @table(database: "flair") @export {
363
393
  visibilityRationale: String # flair#1257 slice 3: the team-relevance justification paired with
364
394
  # visibilityRuling — the auditable "why shared" recorded on the candidate.
365
395
  # Nullable/additive, same clean-upgrade contract as scopeTag above.
396
+ promotedRowId: String # flair#2645: id of the Memory row the auto-promote sweep wrote for this
397
+ # candidate. Server-written; a later sweep reuses only the row this names.
398
+ promotedRowInstanceToken: String # flair#2645: that row's server-stamped incarnation token, recorded with the
399
+ # id. Nullable/additive — candidates written before this read null.
366
400
  }
367
401
 
368
402
  # Asset — binary blobs (screenshots, images) stored out-of-record via Harper's
@@ -402,6 +436,30 @@ type OrgSkillAssignment @table(database: "flair") {
402
436
  sourceClass: String! # operator | internal
403
437
  }
404
438
 
439
+ # Deletion history for physical deletions of permanent/persistent Memory rows,
440
+ # appended in the delete's transaction by Memory.delete and by POST /MemoryPurge
441
+ # (the path CLI hygiene and agent remove use). For a row still stored after the
442
+ # commit, MemoryPurge attempts history cleanup and checks for absence after its
443
+ # commit; unconfirmed cleanup returns 500 memory_purge_history_cleanup_unconfirmed.
444
+ # Non-durable deletes, including maintenance expiry, append no history.
445
+ # No @export and no resource class: there is no direct route.
446
+ #
447
+ # `replicate: true` is declared explicitly to state the current setting:
448
+ # a table in a replicated database replicates unless it opts out with
449
+ # `replicate: false`, so an undeclared table already replicates. Declaring it
450
+ # changes nothing about what replicates (measured on the installed Harper: a
451
+ # `describe_table` of an undeclared table reports no `replicate` key, and the
452
+ # replication decision is `Table.replicate !== false`).
453
+ type MemoryDeletionHistory @table(database: "flair", replicate: true) {
454
+ id: ID @primaryKey # unique per deletion record (a memory id can be deleted and re-created)
455
+ memoryId: String! @indexed
456
+ memoryInstanceToken: String
457
+ durability: String # the deleted row's durability at deletion, when known
458
+ actor: String # the deleting principal; null when no actor is supplied
459
+ sourceClass: String! # agent | admin | internal
460
+ at: String! @indexed # ISO timestamp of the delete
461
+ }
462
+
405
463
  # OrgSkillAssignmentHistory — one row per accepted write through
406
464
  # resources/OrgSkillAssignment.ts, appended in the write's transaction.
407
465
  # No @export and no resource class: there is no direct /OrgSkillAssignmentHistory route.
@@ -414,3 +472,29 @@ type OrgSkillAssignmentHistory @table(database: "flair") {
414
472
  previousHash: String # sha256 of the stored row before the write; null on create
415
473
  at: String!
416
474
  }
475
+
476
+ # InstructionVersion — single-row Soul and skill write history; Soul collection deletes are refused.
477
+ # REST mutation verbs are refused; reads authorize soul and skill subjects.
478
+ # The administrator operations API is an unaudited exception.
479
+ type InstructionVersion @table(database: "flair") @export {
480
+ id: ID @primaryKey # encodes subjectType + subjectId + version
481
+ subjectType: String! @indexed # soul | skill
482
+ subjectId: String! @indexed # Soul: agentId:key or colon-prefixed JSON pair
483
+ agentId: String! @indexed # owner
484
+ key: String # Soul key
485
+ version: BigInt! # positive per-subject sequence
486
+ kind: String! # create | update | delete
487
+ rowId: ID! # affected physical row
488
+ valueHash: String # sha256 of the value bytes; null on delete
489
+ previousVersionHash: String # preceding record digest; null on the first record
490
+ recordHash: String! # record digest over every other field
491
+ soulSnapshot: String # serialized Soul state including its value
492
+ memoryId: ID # skill-version Memory reference
493
+ visibility: String # retained skill read-scope metadata
494
+ actorKind: String! # operator | agent | internal | instance
495
+ actorId: String # verified identity; null for unattributed internal calls
496
+ sourceClass: String! # operator | internal | agent | federation | seed
497
+ createdAt: String! # server ISO timestamp
498
+ guarded: Boolean! # whether expectedVersion was compared
499
+ expectedVersion: ID # the compared head; null on an unguarded write
500
+ }
@@ -59,6 +59,25 @@ type IdJagReplay @table(database: "flair", expiration: 90000) {
59
59
  seenAt: Long! # ms-epoch when recorded
60
60
  }
61
61
 
62
+ # One row per claim to redeem an OAuth authorization code or rotate a refresh token,
63
+ # written once per instance under a per-key lock by resources/replay-store.ts
64
+ # (claimOAuthSingleUse).
65
+ # c:<sha256(code)> a code presented for redemption
66
+ # r:<sha256(token)> a refresh token presented for rotation
67
+ # A single-use row records that a redemption was claimed. If the later `used`
68
+ # or revocation write fails, no token pair is issued; the claim remains, so
69
+ # the code or token cannot be redeemed again.
70
+ # expiration: 691200 — seconds before Harper's scan may remove a row. It MUST equal
71
+ # OAUTH_SINGLE_USE_RETENTION_S in resources/OAuth.ts, which says why it
72
+ # outlives the longest a code or refresh token can be presented;
73
+ # test/unit-isolated/oauth-single-use-2145.test.ts pins both.
74
+ # Internal bookkeeping only: no @export, never served. The key is a hash, so a
75
+ # row holds no redeemable secret.
76
+ type OAuthSingleUse @table(database: "flair", expiration: 691200) {
77
+ id: ID @primaryKey # `c:<sha256(code)>` or `r:<sha256(refresh token)>`
78
+ seenAt: Long! # ms-epoch when recorded
79
+ }
80
+
62
81
  # Access + refresh tokens.
63
82
  type OAuthToken @table(database: "flair") {
64
83
  id: ID @primaryKey # token ID (internal reference)
@@ -9,4 +9,6 @@ type Presence @table(database: "flair") @export {
9
9
  activityUpdatedAt: BigInt # unix ms — when activity/currentTask were last ASSERTED (natural-presence); nullable/additive, absent on records written before this feature (readers fall back to lastHeartbeatAt)
10
10
  flairVersion: String # @tpsdev-ai/flair version serving this heartbeat (flair#639); absent on pre-#639 records
11
11
  harperVersion: String # @harperfast/harper version serving this heartbeat (flair#639); absent on pre-#639 records
12
+ originatorInstanceId: String # local creates stamp this instance's id read fresh from the Instance table (null otherwise); updates preserve the stored value. Receipt stores the batch-verified sender. Nullable/additive.
13
+ receivedAt: BigInt # unix ms — when THIS instance received a replicated row. Stamped only by the federation receive path; a local write (POST/PUT/PATCH) never sets it. Nullable/additive.
12
14
  }
@@ -12,5 +12,11 @@
12
12
  # NODE_BIN is an ABSOLUTE path resolved at enable time — the shim performs
13
13
  # zero PATH lookups at run time. Do not replace it with a bare `node`: that
14
14
  # would hand binary selection to whatever PATH the service manager carries.
15
+ #
16
+ # ADMIN_PASS_FILE is the ABSOLUTE path of the owner-only admin-password file,
17
+ # also resolved at enable time. The shim passes that path as ONE single-quoted
18
+ # argument. The CLI reads the password from that file when the cycle runs; the
19
+ # value is never written into this script, passed in argv, or exported into
20
+ # the environment.
15
21
  set -e
16
- exec "{{NODE_BIN}}" "{{FLAIR_BIN}}" rem nightly run-once
22
+ exec {{NODE_BIN}} {{FLAIR_BIN}} rem nightly run-once --admin-pass-file {{ADMIN_PASS_FILE}}