@tpsdev-ai/flair 0.20.1 → 0.21.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 (49) hide show
  1. package/README.md +29 -4
  2. package/SECURITY.md +28 -18
  3. package/dist/cli.js +465 -32
  4. package/dist/deploy.js +93 -11
  5. package/dist/doctor-client.js +312 -0
  6. package/dist/install/clients.js +18 -0
  7. package/dist/rem/restore.js +1 -1
  8. package/dist/resources/Admin.js +1 -1
  9. package/dist/resources/AdminConnectors.js +1 -1
  10. package/dist/resources/AdminDashboard.js +1 -1
  11. package/dist/resources/AdminIdp.js +1 -1
  12. package/dist/resources/AdminInstance.js +1 -1
  13. package/dist/resources/AdminMemory.js +2 -2
  14. package/dist/resources/AdminPrincipals.js +1 -1
  15. package/dist/resources/Agent.js +14 -0
  16. package/dist/resources/AgentCard.js +1 -1
  17. package/dist/resources/AgentSeed.js +1 -1
  18. package/dist/resources/Federation.js +98 -2
  19. package/dist/resources/IngestEvents.js +1 -1
  20. package/dist/resources/Integration.js +1 -1
  21. package/dist/resources/Memory.js +123 -17
  22. package/dist/resources/MemoryBootstrap.js +46 -36
  23. package/dist/resources/MemoryGrant.js +1 -1
  24. package/dist/resources/OAuth.js +61 -4
  25. package/dist/resources/OrgEventCatchup.js +1 -1
  26. package/dist/resources/Presence.js +55 -3
  27. package/dist/resources/Relationship.js +10 -1
  28. package/dist/resources/SemanticSearch.js +14 -14
  29. package/dist/resources/Soul.js +14 -0
  30. package/dist/resources/WorkspaceLatest.js +1 -1
  31. package/dist/resources/WorkspaceState.js +1 -1
  32. package/dist/resources/agent-auth.js +1 -1
  33. package/dist/resources/agentcard-fields.js +2 -2
  34. package/dist/resources/auth-middleware.js +24 -5
  35. package/dist/resources/bm25-filter.js +1 -1
  36. package/dist/resources/bm25.js +1 -1
  37. package/dist/resources/dedup.js +2 -2
  38. package/dist/resources/ed25519-auth.js +2 -2
  39. package/dist/resources/embeddings-provider.js +1 -1
  40. package/dist/resources/federation-nonce-store.js +195 -0
  41. package/dist/resources/instance-identity.js +53 -0
  42. package/dist/resources/memory-bootstrap-lib.js +1 -1
  43. package/dist/resources/memory-read-scope.js +58 -71
  44. package/dist/resources/memory-visibility.js +37 -0
  45. package/dist/version-check.js +167 -0
  46. package/package.json +2 -2
  47. package/schemas/agent.graphql +7 -0
  48. package/schemas/federation.graphql +12 -0
  49. package/schemas/memory.graphql +16 -0
package/README.md CHANGED
@@ -100,6 +100,8 @@ Flair fixes that with three primitives:
100
100
 
101
101
  Built on [Harper](https://harper.fast). Single process. No sidecars. Zero external API calls for embeddings. **[Supply-chain policy](docs/supply-chain-policy.md)** documents the bake-time + dep-pinning we run to keep this honest.
102
102
 
103
+ See **[DESIGN.md](DESIGN.md)** for the design invariants behind these three primitives — why they're shaped the way they are.
104
+
103
105
  ## How It Works
104
106
 
105
107
  Flair is a native [Harper v5](https://harper.fast) application. Harper handles HTTP, persistence (RocksDB), and application logic in a single process.
@@ -152,7 +154,7 @@ Entity-to-entity triples with temporal bounds. Model structured knowledge — "A
152
154
  Subscribe to memory or soul changes via WebSocket/SSE. Useful for dashboards, cross-agent sync, or audit trails.
153
155
 
154
156
  ### Multi-Agent
155
- One Flair instance serves any number of agents. Each agent has its own keys, memories, and soul. Agents can't read each other's data without explicit access grants.
157
+ One Flair instance serves any number of agents. Each agent has its own keys, memories, and soul. Reads are open within the org: any agent can read any other agent's non-private memory, no grant required — `private` is the one owner-only exception. See [DESIGN.md](DESIGN.md#access-model-open-within-the-org-closed-at-the-federation-edge) for the full model.
156
158
 
157
159
  ### OAuth 2.1 Authorization Server
158
160
  Built-in OAuth 2.1 server with PKCE, dynamic client registration, and a standards-compliant token endpoint. Agents and services can delegate auth to Flair without a separate IdP.
@@ -238,6 +240,29 @@ flair uninstall # Remove the service (keeps data)
238
240
  flair uninstall --purge # Remove everything including data and keys
239
241
  ```
240
242
 
243
+ ### Upgrading
244
+
245
+ `flair status` and `flair doctor` both check your installed version against the latest published release (cached, offline-tolerant — this never blocks or fails either command) and print a nudge when you're behind:
246
+
247
+ ```
248
+ ⚠ flair 0.16.1 is behind — latest is 0.20.1 (4 releases behind). Upgrade: npm i -g @tpsdev-ai/flair@latest
249
+ ```
250
+
251
+ To upgrade:
252
+
253
+ ```bash
254
+ npm install -g @tpsdev-ai/flair@latest
255
+
256
+ # Or check what's outdated across the whole toolchain (flair, flair-mcp, the
257
+ # openclaw-flair plugin) without installing anything:
258
+ flair upgrade --check
259
+
260
+ # Then apply:
261
+ flair upgrade
262
+ ```
263
+
264
+ `flair upgrade` also restarts the running instance for you with `--restart`. If you deployed Flair to a Harper Fabric cluster (rather than running it locally), use `flair upgrade --target <fabric-url>` instead — see `flair upgrade --help`.
265
+
241
266
  ### Advanced / manual setup
242
267
 
243
268
  Prefer to drive each step yourself, or scripting an unattended setup? Run `flair init --no-mcp` to bootstrap the instance + agent without wiring any MCP clients, then drive each step on its own:
@@ -457,10 +482,10 @@ See [SECURITY.md](SECURITY.md) for the full security model, threat analysis, and
457
482
 
458
483
  **Key points:**
459
484
  - Ed25519 cryptographic identity — agents sign every request
460
- - Collection-level data isolationagents can't read each other's memories
485
+ - Reads are open within the org any agent can read any other agent's non-private memory, no grant required; `private` is the one owner-only exception (see [DESIGN.md](DESIGN.md))
461
486
  - Admin password auto-generated on init, stored at `~/.flair/admin-pass` (mode 0600)
462
487
  - Key rotation via `flair agent rotate-key`
463
- - Cross-agent access requires explicit grants
488
+ - Writes are always agent-scoped — an agent can only write its own records
464
489
 
465
490
  ## Development
466
491
 
@@ -479,7 +504,7 @@ Integration tests spin up a real Harper instance on a random port, run the test
479
504
  | Category | Tests | What's covered |
480
505
  |----------|-------|----------------|
481
506
  | **Auth & Identity** | auth-middleware, auth-scoping, key-paths-and-rotation | Ed25519 signature verification, agent isolation, key rotation |
482
- | **Memory** | data-scoping, backup-restore, agent-remove-and-grants | Cross-agent access denied, data durability, grant lifecycle |
507
+ | **Memory** | data-scoping, backup-restore, agent-remove-and-grants | Private-memory exclusion, open within-org read scoping, data durability, grant lifecycle |
483
508
  | **Content Safety** | content-safety | Prompt injection detection, identity hijacking, format injection, exfiltration patterns |
484
509
  | **Search** | temporal-scoring, embeddings | Temporal decay, relevance scoring, embedding generation |
485
510
  | **Rate Limiting** | rate-limiter | Per-agent rate limiting, bucket isolation |
package/SECURITY.md CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Flair uses cryptographic identity (Ed25519) for agent authentication and
6
- collection-level scoping to enforce data isolation between agents.
5
+ Flair uses cryptographic identity (Ed25519) for agent authentication. Within
6
+ an org, memory reads are open agents see each other's non-private memories —
7
+ while writes are isolated per agent and private memories stay strictly
8
+ owner-only. The hard access boundary is the federation edge (cross-instance).
7
9
 
8
10
  ## Authentication
9
11
 
@@ -37,25 +39,29 @@ at Harper startup. **It is never stored on the filesystem by Flair.**
37
39
 
38
40
  ## Data Scoping
39
41
 
40
- ### Memory Isolation
42
+ ### Memory Read/Write Model
41
43
 
42
- Each agent can only read and write its own memories. This is enforced at
43
- the database layer (Harper resource `search()` override), not application
44
- logic:
44
+ Reads are open **within an org**; writes are isolated per agent. Enforced at
45
+ the database layer (Harper resource `search()` override via a single
46
+ centralized read-scope rule), not application logic:
45
47
 
46
- - `GET /Memory/` — returns only the authenticated agent's memories
47
- - `POST /Memory` writes with the authenticated agent's ID
48
- - `POST /MemorySearch` — searches only the authenticated agent's memories
48
+ - `GET /Memory/` — returns the authenticated agent's own memories (any
49
+ visibility) plus every **non-private** memory in the org
50
+ - `POST /MemorySearch` — same read scope: own memories plus all non-private
51
+ - `POST /Memory` — writes are attributed to the authenticated agent; an
52
+ agent cannot write as another (write isolation)
49
53
 
50
- ### Cross-Agent Access
54
+ **Private memories are strictly owner-only** — a memory written with
55
+ `visibility: private` is returned only to its author, never to another agent.
51
56
 
52
- Explicit grants allow one agent to read another's memories:
57
+ ### Cross-Agent Access (within an org)
53
58
 
54
- ```
55
- MemoryGrant { fromAgentId, toAgentId, scope: "read" }
56
- ```
57
-
58
- Grants are created by admin or by the granting agent.
59
+ Within an org, an agent reads every non-private memory directly — no grant
60
+ required. This is deliberate: the goal is relevance (surface what's useful to
61
+ the org) over secrecy. A writer keeps something private by marking it
62
+ `visibility: private`, which keeps it strictly owner-only. The access boundary
63
+ that stays hard is the **federation edge** (cross-instance / cross-org), not
64
+ within-org reads.
59
65
 
60
66
  ### Admin Bypass
61
67
 
@@ -88,8 +94,12 @@ public key in Flair, and backs up the old key as `<agentId>.key.bak`.
88
94
 
89
95
  - **Agent impersonation:** Ed25519 signatures prevent one agent from
90
96
  acting as another without possessing the private key.
91
- - **Cross-agent data leakage:** Collection-level scoping ensures agents
92
- can only query their own data.
97
+ - **Private-memory leakage:** memories marked `visibility: private` are
98
+ strictly owner-only and never returned to another agent. Non-private
99
+ memories are intentionally readable within the org (by design, not
100
+ leakage); the cross-instance boundary is the federation edge.
101
+ - **Write forgery:** writes are attributed to the authenticated agent —
102
+ an agent cannot write memories as another.
93
103
  - **Replay attacks:** 30-second window + nonce deduplication.
94
104
  - **Privilege escalation via SQL:** SQL and GraphQL endpoints blocked
95
105
  for non-admin agents.