@tpsdev-ai/flair 0.28.0 → 0.30.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 (102) hide show
  1. package/README.md +1 -1
  2. package/dist/bridges/builtins/index.js +1 -1
  3. package/dist/bridges/discover.js +1 -1
  4. package/dist/bridges/runtime/load-plugin.js +1 -1
  5. package/dist/bridges/scaffold.js +3 -3
  6. package/dist/bridges/types.js +1 -1
  7. package/dist/cli-shim.cjs +1 -1
  8. package/dist/cli.js +357 -130
  9. package/dist/deploy.js +29 -19
  10. package/dist/fabric-upgrade.js +61 -23
  11. package/dist/fleet-verify.js +3 -3
  12. package/dist/lib/mcp-enable.js +2 -2
  13. package/dist/rem/runner.js +2 -2
  14. package/dist/rem/scheduler.js +226 -17
  15. package/dist/resources/A2AAdapter.js +1 -1
  16. package/dist/resources/Admin.js +1 -1
  17. package/dist/resources/AdminConnectors.js +1 -1
  18. package/dist/resources/AdminDashboard.js +1 -1
  19. package/dist/resources/AdminIdp.js +1 -1
  20. package/dist/resources/AdminInstance.js +1 -1
  21. package/dist/resources/AdminMemory.js +1 -1
  22. package/dist/resources/AdminPrincipals.js +1 -1
  23. package/dist/resources/Agent.js +1 -1
  24. package/dist/resources/AgentCard.js +1 -1
  25. package/dist/resources/AgentSeed.js +1 -1
  26. package/dist/resources/AttentionQuery.js +1 -1
  27. package/dist/resources/Credential.js +1 -1
  28. package/dist/resources/Federation.js +1 -1
  29. package/dist/resources/Instance.js +1 -1
  30. package/dist/resources/Integration.js +1 -1
  31. package/dist/resources/MCPClientMetadata.js +1 -1
  32. package/dist/resources/Memory.js +1 -1
  33. package/dist/resources/MemoryBootstrap.js +1 -1
  34. package/dist/resources/MemoryCandidate.js +168 -0
  35. package/dist/resources/MemoryConsolidate.js +1 -1
  36. package/dist/resources/MemoryDedupStats.js +1 -1
  37. package/dist/resources/MemoryFeed.js +1 -1
  38. package/dist/resources/MemoryGrant.js +1 -1
  39. package/dist/resources/MemoryMaintenance.js +1 -1
  40. package/dist/resources/MemoryReflect.js +3 -3
  41. package/dist/resources/MemoryReindex.js +1 -1
  42. package/dist/resources/MemoryUsage.js +1 -1
  43. package/dist/resources/OAuth.js +1 -1
  44. package/dist/resources/OAuthClient.js +1 -1
  45. package/dist/resources/OrgEvent.js +1 -1
  46. package/dist/resources/OrgEventCatchup.js +1 -1
  47. package/dist/resources/OrgEventMaintenance.js +1 -1
  48. package/dist/resources/PairingToken.js +1 -1
  49. package/dist/resources/Peer.js +1 -1
  50. package/dist/resources/Presence.js +3 -3
  51. package/dist/resources/RecordUsage.js +16 -2
  52. package/dist/resources/Relationship.js +1 -1
  53. package/dist/resources/SemanticSearch.js +1 -1
  54. package/dist/resources/SkillScan.js +1 -1
  55. package/dist/resources/Soul.js +1 -1
  56. package/dist/resources/SoulFeed.js +1 -1
  57. package/dist/resources/WorkspaceLatest.js +1 -1
  58. package/dist/resources/WorkspaceState.js +1 -1
  59. package/dist/resources/XAA.js +1 -1
  60. package/dist/resources/a2a-url.js +1 -1
  61. package/dist/resources/agent-auth.js +1 -1
  62. package/dist/resources/agentcard-fields.js +1 -1
  63. package/dist/resources/auth-middleware.js +1 -1
  64. package/dist/resources/embeddings-boot.js +4 -4
  65. package/dist/resources/embeddings-provider.js +13 -43
  66. package/dist/resources/federation-cleanup.js +5 -5
  67. package/dist/resources/federation-nonce-store.js +5 -5
  68. package/dist/resources/health.js +29 -6
  69. package/dist/resources/instance-identity.js +1 -1
  70. package/dist/resources/mcp-client-metadata-fields.js +1 -1
  71. package/dist/resources/mcp-handler.js +1 -1
  72. package/dist/resources/mcp-oauth.js +2 -2
  73. package/dist/resources/mcp-tools.js +9 -1
  74. package/dist/resources/memory-read-scope.js +1 -1
  75. package/dist/resources/memory-reflect-lib.js +4 -4
  76. package/dist/resources/memory-visibility.js +3 -3
  77. package/dist/resources/migration-boot.js +1 -1
  78. package/dist/resources/migrations/embedding-stamp.js +3 -3
  79. package/dist/resources/migrations/graph-heal.js +2 -2
  80. package/dist/resources/migrations/ledger.js +1 -1
  81. package/dist/resources/migrations/registry.js +14 -5
  82. package/dist/resources/migrations/runner.js +64 -11
  83. package/dist/resources/migrations/synthetic-test-migration.js +1 -1
  84. package/dist/resources/migrations/visibility-backfill.js +232 -0
  85. package/dist/resources/models-dir.js +55 -0
  86. package/dist/resources/record-types.js +30 -2
  87. package/dist/resources/rerank-provider.js +24 -4
  88. package/dist/resources/semantic-retrieval-core.js +1 -1
  89. package/dist/resources/usage-recording.js +73 -7
  90. package/dist/resources/version.js +33 -0
  91. package/dist/src/rem/scheduler.js +449 -0
  92. package/docs/assets/flair-cross-orchestrator.cast +1 -1
  93. package/docs/bridges.md +3 -3
  94. package/docs/deployment.md +1 -0
  95. package/docs/mcp-clients.md +3 -1
  96. package/docs/n8n.md +1 -2
  97. package/docs/notes/rem-ux.md +1 -1
  98. package/docs/rem.md +2 -0
  99. package/docs/supply-chain-policy.md +4 -4
  100. package/docs/upgrade.md +2 -2
  101. package/package.json +4 -4
  102. package/schemas/memory.graphql +27 -12
@@ -44,13 +44,17 @@ type Memory @table(database: "flair") {
44
44
  usageCount: Int # flair#683: verified-USE signal, distinct from retrievalCount (a
45
45
  # search HIT). Additive/nullable — absent reads as 0, existing rows
46
46
  # unaffected. NEVER auto-incremented on search/retrieval; the ONLY
47
- # writer is the dedicated usage-feedback endpoint (resources/
48
- # MemoryUsage.ts), which does a targeted patchRecord increment on
49
- # this field alone (never through Memory.put() see that
50
- # resource's module doc for why: usage-feedback writes to ANOTHER
51
- # agent's memory, and Memory's ownership check would 403 every
52
- # legit call). Drives usageBoost in resources/scoring.ts, which
53
- # replaces retrievalBoost in compositeScore (retrievalCount was the
47
+ # writer is resources/usage-recording.ts's recordUsageContribution()
48
+ # the shared ledger core behind BOTH usage surfaces: POST
49
+ # /RecordUsage (resources/RecordUsage.ts) and citation-on-write
50
+ # (resources/Memory.ts post()/put() recordCitations(), which also
51
+ # validates each cited id against the writer's read scope,
52
+ # flair#775). It does a targeted get-then-put increment on this
53
+ # field alone (never through Memory.put() see RecordUsage.ts's
54
+ # module doc for why: usage feedback writes to ANOTHER agent's
55
+ # memory, and Memory's ownership check would 403 every legit
56
+ # call). Drives usageBoost in resources/scoring.ts, which replaces
57
+ # retrievalBoost in compositeScore (retrievalCount was the
54
58
  # contaminated "retrieval counted as usage" signal root-caused in
55
59
  # flair#623).
56
60
  promotionStatus: String # null | "pending" | "approved" | "rejected"
@@ -155,9 +159,12 @@ type MemoryGrant @table(database: "flair") @export {
155
159
  # contributed to this memory's usageCount" is a single point-lookup, not a
156
160
  # query. This is what makes the anti-gaming dedup rule ("each (agent, memory)
157
161
  # pair contributes at most 1 to usageCount" — Sherlock) enforceable: the
158
- # dedicated endpoint (resources/MemoryUsage.ts) only bumps Memory.usageCount
159
- # when a NEW row is created here; a repeat call from the same agent for the
160
- # same memory is a no-op against a row that already exists.
162
+ # shared ledger core (resources/usage-recording.ts's recordUsageContribution(),
163
+ # reached via POST /RecordUsage and via citation-on-write's recordCitations())
164
+ # only bumps Memory.usageCount when a NEW row is created here; a repeat call
165
+ # from the same agent for the same memory is a no-op against a row that
166
+ # already exists. resources/MemoryUsage.ts guards this table's own HTTP
167
+ # surface (it is not the writer).
161
168
  #
162
169
  # `attribution` is OPAQUE — never parsed, never fed to an LLM, never rendered
163
170
  # — a free-text "what used this" hint the caller supplies, sanitized
@@ -172,7 +179,7 @@ type MemoryUsage @table(database: "flair") {
172
179
  }
173
180
 
174
181
  # MemoryCandidate — staged distillations from the FLAIR-NIGHTLY-REM cycle.
175
- # Per specs/FLAIR-NIGHTLY-REM.md § 7. Slice 1 of ops-2qq adds the schema +
182
+ # Per docs/rem.md. Slice 1 of ops-2qq adds the schema +
176
183
  # `flair rem candidates` listing command. Future slices wire the nightly
177
184
  # cycle that populates this table and the promote/reject endpoints.
178
185
  #
@@ -181,7 +188,15 @@ type MemoryUsage @table(database: "flair") {
181
188
  # that requires both --rationale and --to (soul|memory). Rejected candidates
182
189
  # retain their decision history so recurring false-positives become visible
183
190
  # via the `supersedes` chain.
184
- type MemoryCandidate @table(database: "flair") {
191
+ #
192
+ # flair#849: this type shipped WITHOUT @export, so it had no REST surface at
193
+ # all — `flair rem candidates`/`promote`/`reject` 404'd on every call, a
194
+ # clean-room dogfood blocker. @export alone would have reopened the exact P0
195
+ # leak the memory-soul-read-gate family fix closed for every other
196
+ # agent-facing table (anonymous read/write of every row); see
197
+ # resources/MemoryCandidate.ts for the paired identity-gated, owner-scoped
198
+ # resource class that makes @export here safe.
199
+ type MemoryCandidate @table(database: "flair") @export {
185
200
  id: ID @primaryKey
186
201
  agentId: String! @indexed
187
202
  claim: String! # distilled lesson text