@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.
- package/README.md +14 -13
- package/SECURITY.md +73 -43
- package/config.yaml +11 -11
- package/dist/bridges/runtime/execute.js +1 -0
- package/dist/bridges/runtime/import-runner.js +4 -0
- package/dist/bridges/types.js +1 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +309 -205
- package/dist/commands/agent.js +325 -137
- package/dist/commands/attention.js +2 -0
- package/dist/commands/backup-approval.js +218 -0
- package/dist/commands/backup.js +37 -33
- package/dist/commands/bootstrap.js +5 -1
- package/dist/commands/bridge.js +10 -0
- package/dist/commands/deploy.js +37 -7
- package/dist/commands/doctor.js +206 -42
- package/dist/commands/export.js +144 -15
- package/dist/commands/federation.js +653 -68
- package/dist/commands/grant.js +5 -6
- package/dist/commands/help.js +25 -0
- package/dist/commands/idp.js +14 -19
- package/dist/commands/import.js +167 -34
- package/dist/commands/init.js +380 -164
- package/dist/commands/integrity.js +5 -6
- package/dist/commands/keys.js +12 -8
- package/dist/commands/mcp.js +157 -79
- package/dist/commands/memory.js +38 -17
- package/dist/commands/migrate-harness-memory.js +9 -3
- package/dist/commands/orgevent.js +5 -10
- package/dist/commands/principal.js +32 -39
- package/dist/commands/quality.js +26 -3
- package/dist/commands/reembed.js +468 -111
- package/dist/commands/rem.js +484 -65
- package/dist/commands/restore.js +352 -44
- package/dist/commands/search.js +2 -0
- package/dist/commands/service.js +109 -2
- package/dist/commands/soul.js +0 -6
- package/dist/commands/status.js +165 -124
- package/dist/commands/test.js +4 -1
- package/dist/commands/upgrade.js +53 -22
- package/dist/commands/workspace.js +7 -8
- package/dist/deploy.js +59 -3
- package/dist/doctor-client.js +9 -25
- package/dist/fabric-upgrade.js +12 -2
- package/dist/federation/presence-send.js +139 -0
- package/dist/federation/scheduler.js +148 -12
- package/dist/federation-verify.js +269 -177
- package/dist/install/clients.js +171 -35
- package/dist/keystore.js +77 -10
- package/dist/lib/agent-id-rule.js +44 -2
- package/dist/lib/agent-key-file.js +509 -0
- package/dist/lib/agent-rotation-lock.js +249 -0
- package/dist/lib/atomic-write.js +3 -3
- package/dist/lib/auth-resolve.js +1040 -64
- package/dist/lib/backup-approval-store.js +612 -0
- package/dist/lib/backup-artifact.js +343 -0
- package/dist/lib/config-critical-section.js +212 -25
- package/dist/lib/connect-phase.js +33 -0
- package/dist/lib/daemon-liveness.js +2 -1
- package/dist/lib/federation-pair-access.js +4 -0
- package/dist/lib/federation-retry-queue.js +283 -0
- package/dist/lib/federation-retry-row.js +101 -0
- package/dist/lib/instruction-event-contract.js +17 -0
- package/dist/lib/instruction-event-doctor.js +102 -0
- package/dist/lib/key-dir.js +203 -0
- package/dist/lib/launchd-management.js +21 -6
- package/dist/lib/local-instance-pair.js +8 -1
- package/dist/lib/mcp-enable.js +14 -15
- package/dist/lib/memory-attributes.js +2 -0
- package/dist/lib/memory-provider-timeout.js +33 -0
- package/dist/lib/mqtt-config.js +132 -0
- package/dist/lib/mqtt-listener-doctor.js +104 -0
- package/dist/lib/node-alias-path.js +50 -2
- package/dist/lib/open-live-row.js +20 -0
- package/dist/lib/ops-url.js +52 -0
- package/dist/lib/promotion-content-hash.js +20 -0
- package/dist/lib/remote-admin-pass.js +157 -0
- package/dist/lib/restore-archive.js +760 -0
- package/dist/lib/restore-verify.js +1 -1
- package/dist/lib/scheduler-platform.js +13 -0
- package/dist/lib/service-repoint.js +13 -4
- package/dist/lib/skill-assignment-preflight.js +159 -0
- package/dist/lib/skill-seed.js +125 -10
- package/dist/lib/skill-tombstone-doctor.js +133 -0
- package/dist/lib/soul-scope-fields.js +26 -0
- package/dist/lib/terminal-text.js +32 -0
- package/dist/lib/uninstall-purge.js +266 -11
- package/dist/lib/upgrade-prior-liveness.js +2 -1
- package/dist/mcp-client-assertion.js +7 -14
- package/dist/memory-id-checkpoint.js +28 -7
- package/dist/mqtt-off-deploy.js +550 -0
- package/dist/rem/promote-policy.js +3 -3
- package/dist/rem/restore.js +302 -26
- package/dist/rem/runner.js +220 -58
- package/dist/rem/scheduler.js +21 -4
- package/dist/resources/A2AAdapter.js +131 -178
- package/dist/resources/AdminMemory.js +2 -0
- package/dist/resources/AdminMemoryCandidates.js +116 -0
- package/dist/resources/Agent.js +155 -45
- package/dist/resources/AgentCard.js +4 -0
- package/dist/resources/AgentKeyRegister.js +56 -22
- package/dist/resources/AgentReadPosition.js +7 -0
- package/dist/resources/AgentSeed.js +232 -107
- package/dist/resources/AutoPromoteCandidates.js +413 -84
- package/dist/resources/Credential.js +6 -8
- package/dist/resources/Federation.js +219 -57
- package/dist/resources/FederationRetry.js +4 -4
- package/dist/resources/InstructionVersion.js +1 -1
- package/dist/resources/MCPClientMetadata.js +6 -3
- package/dist/resources/Memory.js +1348 -271
- package/dist/resources/MemoryArchive.js +149 -64
- package/dist/resources/MemoryBootstrap.js +12 -22
- package/dist/resources/MemoryCandidate.js +16 -2
- package/dist/resources/MemoryConsolidate.js +2 -2
- package/dist/resources/MemoryFeed.js +360 -147
- package/dist/resources/MemoryMaintenance.js +290 -72
- package/dist/resources/MemoryPurge.js +138 -22
- package/dist/resources/MemoryReflect.js +68 -14
- package/dist/resources/MemoryReindex.js +91 -13
- package/dist/resources/Message.js +11 -2
- package/dist/resources/OAuth.js +156 -39
- package/dist/resources/OAuthClient.js +1 -1
- package/dist/resources/OrgEvent.js +292 -29
- package/dist/resources/OrgEventCatchup.js +7 -0
- package/dist/resources/OrgEventMaintenance.js +48 -10
- package/dist/resources/PairingToken.js +1 -1
- package/dist/resources/Presence.js +31 -11
- package/dist/resources/PromoteMemoryCandidate.js +8 -2
- package/dist/resources/RecordUsage.js +2 -4
- package/dist/resources/Soul.js +2 -0
- package/dist/resources/SoulFeed.js +2 -1
- package/dist/resources/WorkspaceLatest.js +4 -0
- package/dist/resources/XAA.js +36 -10
- package/dist/resources/a2a-stream.js +313 -0
- package/dist/resources/a2a-url.js +4 -5
- package/dist/resources/agent-admin.js +10 -1
- package/dist/resources/agent-auth.js +98 -68
- package/dist/resources/agent-read-position-lib.js +4 -1
- package/dist/resources/agent-status-guard.js +9 -7
- package/dist/resources/auth-middleware.js +166 -42
- package/dist/resources/authority-field-guard.js +9 -11
- package/dist/resources/auto-promote-lib.js +8 -5
- package/dist/resources/basic-auth-header.js +21 -0
- package/dist/resources/bm25-index-service.js +4 -5
- package/dist/resources/dedup-cluster.js +6 -1
- package/dist/resources/embeddings-provider.js +25 -0
- package/dist/resources/federation-classify.js +89 -0
- package/dist/resources/federation-retry-lib.js +6 -81
- package/dist/resources/health.js +75 -19
- package/dist/resources/host-pointer/registry.js +29 -0
- package/dist/resources/host-pointer-adapter.js +1 -0
- package/dist/resources/in-process-api.js +74 -11
- package/dist/resources/in-process.js +24 -22
- package/dist/resources/instruction-version-record.js +251 -7
- package/dist/resources/internal-authority.js +13 -0
- package/dist/resources/mcp-client-metadata-fields.js +4 -0
- package/dist/resources/mcp-handler.js +146 -13
- package/dist/resources/mcp-oauth-flag.js +12 -14
- package/dist/resources/mcp-oauth.js +446 -53
- package/dist/resources/mcp-tool-scopes.js +69 -0
- package/dist/resources/mcp-tools.js +70 -22
- package/dist/resources/memory-declared-attributes.js +1 -0
- package/dist/resources/memory-embed-hash.js +56 -0
- package/dist/resources/memory-host-source.js +5 -2
- package/dist/resources/memory-reflect-lib.js +1 -1
- package/dist/resources/memory-write-lock.js +202 -23
- package/dist/resources/memory-write-response.js +1 -1
- package/dist/resources/memory-write-transaction.js +243 -0
- package/dist/resources/migration-boot.js +17 -12
- package/dist/resources/migrations/boot-progress.js +25 -0
- package/dist/resources/migrations/data-dir.js +16 -3
- package/dist/resources/migrations/dir-safety.js +60 -2
- package/dist/resources/migrations/embedding-stamp.js +315 -49
- package/dist/resources/migrations/graph-heal.js +9 -2
- package/dist/resources/migrations/ledger.js +5 -2
- package/dist/resources/migrations/lock.js +867 -80
- package/dist/resources/migrations/progress.js +71 -10
- package/dist/resources/migrations/runner.js +212 -18
- package/dist/resources/migrations/state.js +36 -1
- package/dist/resources/migrations/status.js +2 -13
- package/dist/resources/migrations/synthetic-test-migration.js +78 -12
- package/dist/resources/migrations/types.js +26 -1
- package/dist/resources/migrations/visibility-backfill.js +111 -70
- package/dist/resources/oauth-discovery.js +0 -5
- package/dist/resources/object-body-guard.js +12 -5
- package/dist/resources/org-event-reserved.js +92 -0
- package/dist/resources/org-event-write-fault.js +19 -0
- package/dist/resources/owner-field-guard.js +1 -1
- package/dist/resources/owner-scoped-write-policy.js +65 -21
- package/dist/resources/owner-scoped-writes.js +37 -6
- package/dist/resources/path-id-rewrite.js +76 -0
- package/dist/resources/presence-internal.js +5 -5
- package/dist/resources/promotion-binding.js +43 -0
- package/dist/resources/promotion-stamp.js +124 -33
- package/dist/resources/protocol-context.js +189 -0
- package/dist/resources/record-type-kit.js +2 -4
- package/dist/resources/request-target.js +28 -1
- package/dist/resources/request-transaction.js +11 -1
- package/dist/resources/seed-reservation.js +1 -2
- package/dist/resources/semantic-retrieval-core.js +7 -6
- package/dist/resources/server-row-validation.js +71 -0
- package/dist/resources/skill-manifest.js +4 -3
- package/dist/resources/skill-version-write.js +400 -27
- package/dist/resources/skill-write-fault.js +6 -3
- package/dist/resources/skill-write-policy.js +2 -1
- package/dist/resources/soul-write-policy.js +26 -7
- package/dist/resources/table-helpers.js +1 -1
- package/dist/resources/table-subscription-policy.js +518 -85
- package/dist/resources/table-subscriptions.js +20 -7
- package/dist/resources/txn-pause-point.js +122 -5
- package/dist/resources/usage-recording.js +54 -46
- package/dist/resources/write-back.js +176 -11
- package/dist/resources/write-journal-context.js +5 -0
- package/dist/resources/write-journal.js +289 -0
- package/dist/src/keystore.js +77 -10
- package/dist/src/lib/agent-id-rule.js +44 -2
- package/dist/src/lib/atomic-write.js +3 -3
- package/dist/src/lib/federation-retry-row.js +101 -0
- package/dist/src/lib/instruction-event-contract.js +17 -0
- package/dist/src/lib/key-dir.js +203 -0
- package/dist/src/lib/memory-attributes.js +2 -0
- package/dist/src/lib/open-live-row.js +20 -0
- package/dist/src/lib/scheduler-platform.js +13 -0
- package/dist/src/lib/soul-scope-fields.js +26 -0
- package/dist/src/rem/promote-policy.js +3 -3
- package/dist/src/rem/scheduler.js +21 -4
- package/docs/access-control.md +39 -21
- package/docs/api-reference.md +161 -52
- package/docs/auth.md +69 -38
- package/docs/claude-code.md +3 -3
- package/docs/deploying-on-fabric.md +118 -2
- package/docs/deployment.md +17 -0
- package/docs/embedding-in-a-harper-app.md +23 -21
- package/docs/entity-vocabulary.md +7 -11
- package/docs/federation.md +29 -2
- package/docs/hosted-on-fabric.md +1 -1
- package/docs/integrations.md +11 -11
- package/docs/mcp-clients.md +7 -5
- package/docs/notes/mcp-agent-auth-consumer.md +4 -9
- package/docs/notes/mcp-oauth-model2.md +6 -6
- package/docs/openclaw.md +1 -1
- package/docs/quickstart-fabric.md +2 -2
- package/docs/quickstart.md +3 -3
- package/docs/releasing.md +13 -13
- package/docs/rem.md +24 -3
- package/docs/secrets-and-keys.md +9 -14
- package/docs/standalone-local.md +29 -2
- package/docs/supply-chain-policy.md +28 -20
- package/docs/the-team.md +2 -2
- package/docs/upgrade.md +29 -5
- package/package.json +18 -11
- package/schemas/agent.graphql +3 -3
- package/schemas/federation.graphql +10 -7
- package/schemas/memory.graphql +7 -2
- package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
- package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
- package/dist/resources/soul-adk-guard.js +0 -68
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ Embeddings are generated in-process by [nomic-embed-text](https://huggingface.co
|
|
|
166
166
|
|
|
167
167
|
Requests are signed as `agentId:timestamp:nonce:METHOD:/path` and verified against the agent's registered public key, with a 30-second replay window and nonce deduplication.
|
|
168
168
|
|
|
169
|
-
See **[DESIGN.md](DESIGN.md)** for the invariants behind the three primitives — why they're shaped the way they are.
|
|
169
|
+
See **[DESIGN.md](https://github.com/tpsdev-ai/flair/blob/main/DESIGN.md)** for the invariants behind the three primitives — why they're shaped the way they are.
|
|
170
170
|
|
|
171
171
|
## Features
|
|
172
172
|
|
|
@@ -187,7 +187,7 @@ See **[DESIGN.md](DESIGN.md)** for the invariants behind the three primitives
|
|
|
187
187
|
| **OAuth 2.1 server** | PKCE, dynamic client registration, standards-compliant token endpoint. Delegate auth to Flair without a separate IdP. [docs/auth.md](docs/auth.md) |
|
|
188
188
|
| **XAA** | Bind agent identities to Google Workspace, Azure AD or Okta accounts. |
|
|
189
189
|
| **Web admin** | Server-rendered UI for principals, connectors, IdPs and instance config. No separate dashboard service. |
|
|
190
|
-
| **Benchmarks** | [`flair-bench`](packages/flair-bench/README.md) scores candidate embedding models against the same recall corpus Flair's CI gates on. Runs standalone — no Flair install, no server. |
|
|
190
|
+
| **Benchmarks** | [`flair-bench`](https://github.com/tpsdev-ai/flair/blob/main/packages/flair-bench/README.md) scores candidate embedding models against the same recall corpus Flair's CI gates on. Runs standalone — no Flair install, no server. |
|
|
191
191
|
|
|
192
192
|
Trust-graded recall reaches the authenticated HTTP API and the built-in `/mcp` tools today — the latter being off by default, see [One install, one binary](#one-install-one-binary). CLI, `@tpsdev-ai/flair-client` and `flair-mcp` exposure is a follow-up. REM needs a configured generative backend (Ollama, OpenAI, Anthropic, …) — without one, `flair rem rapid` fails with `Reflection error: No generative backend configured`.
|
|
193
193
|
|
|
@@ -227,7 +227,7 @@ Flair works with any agent runtime. Pick the path that fits yours — **[full ca
|
|
|
227
227
|
}
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
Then add to your `CLAUDE.md`:
|
|
230
|
+
Then add to your `CLAUDE.md`: <!-- docs-freshness-allow: names a file in the reader's project -->
|
|
231
231
|
|
|
232
232
|
At the start of every session, run mcp__flair__bootstrap before responding.
|
|
233
233
|
|
|
@@ -243,7 +243,7 @@ Per-CLI config snippets (Gemini CLI's `~/.gemini/settings.json`, Codex CLI's `~/
|
|
|
243
243
|
openclaw plugins install @tpsdev-ai/openclaw-flair
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
Auto-detects the agent identity, provides `memory_store` / `memory_search` / `memory_get`, and provides bootstrap context from `before_prompt_build` (requires host opt-in). See the [plugin README](packages/openclaw-flair/README.md).
|
|
246
|
+
Auto-detects the agent identity, provides `memory_store` / `memory_search` / `memory_get`, and provides bootstrap context from `before_prompt_build` (requires host opt-in). See the [plugin README](https://github.com/tpsdev-ai/flair/blob/main/packages/openclaw-flair/README.md).
|
|
247
247
|
|
|
248
248
|
### n8n
|
|
249
249
|
|
|
@@ -289,7 +289,7 @@ const ctx = await flair.bootstrap({ maxTokens: 4000 })
|
|
|
289
289
|
await flair.soul.get('role')
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
No Harper, no embeddings — just HTTP and auth. Full API in the [client README](packages/flair-client/README.md).
|
|
292
|
+
No Harper, no embeddings — just HTTP and auth. Full API in the [client README](https://github.com/tpsdev-ai/flair/blob/main/packages/flair-client/README.md).
|
|
293
293
|
|
|
294
294
|
### HTTP API (any language)
|
|
295
295
|
|
|
@@ -311,20 +311,21 @@ Sign `agentId:timestamp:nonce:METHOD:/path` with the agent's private key. Protoc
|
|
|
311
311
|
|
|
312
312
|
The second front door, and the one to take if your code already runs on Harper.
|
|
313
313
|
|
|
314
|
-
Flair *is* a Harper component. Deploy it into the instance your application already runs in and call its
|
|
314
|
+
Flair *is* a Harper component. Deploy it into the instance your application already runs in and call its facade directly — `await agent.memory.write(...)` is a **method call**, not a network call. No second service to operate, no HTTP round trip, and no key to distribute: a caller in the same process is already inside the trust boundary and names the agent it is acting as, per call.
|
|
315
315
|
|
|
316
316
|
Adding it takes nothing away. The HTTP surface keeps serving MCP clients and remote agents exactly as before.
|
|
317
317
|
|
|
318
318
|
```javascript
|
|
319
319
|
import { server } from "harper";
|
|
320
|
-
import {
|
|
320
|
+
import { Flair } from "@tpsdev-ai/flair";
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const Memory = server.resources.get("Memory").Resource;
|
|
322
|
+
const flair = new Flair(server);
|
|
323
|
+
const agent = flair.as("mybot");
|
|
325
324
|
|
|
326
|
-
|
|
327
|
-
await
|
|
325
|
+
await agent.memory.write("deploy runs at 0200 UTC", { durability: "standard" });
|
|
326
|
+
const hits = await agent.recall("deploy schedule", { limit: 5 }); // an array of hits
|
|
327
|
+
const record = await agent.memory.get(hits[0].id); // the stored row, or null
|
|
328
|
+
const recent = await agent.memory.search({ limit: 10 }); // an array of at most 10 rows
|
|
328
329
|
```
|
|
329
330
|
|
|
330
331
|
`databases.flair.Memory` is the **table** (raw storage); the exported `Memory` class is the **resource**, where auth, read-scoping, visibility and embedding live. `new Memory(...)` is not a substitute for `collectionResource` — a create needs a collection-bound instance only Harper can produce. Both helpers refuse a missing agent id rather than defaulting it, because a resource invoked with no context resolves to Flair's trusted `internal` verdict and runs unfiltered across every agent.
|
|
@@ -415,7 +416,7 @@ bun run build # compile TypeScript → dist/
|
|
|
415
416
|
bun test # unit + integration tests
|
|
416
417
|
```
|
|
417
418
|
|
|
418
|
-
Integration tests spin up a real Harper instance on a random port and tear it down afterwards — no mocks for the database layer.
|
|
419
|
+
Integration tests spin up a real Harper instance on a random port and tear it down afterwards — no mocks for the database layer. CI for pull requests to main and pushes to main runs unit and integration tests, type checks, dependency audit, Semgrep and CodeQL SAST. See [CONTRIBUTING.md](https://github.com/tpsdev-ai/flair/blob/main/CONTRIBUTING.md).
|
|
419
420
|
|
|
420
421
|
## Status
|
|
421
422
|
|
package/SECURITY.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Flair uses cryptographic identity (Ed25519) for agent authentication. Within
|
|
6
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
|
|
8
|
-
owner
|
|
7
|
+
while writes are isolated per agent and private memories restrict non-admin
|
|
8
|
+
reads to their owner. The hard access boundary is the federation edge (cross-instance).
|
|
9
9
|
|
|
10
10
|
## Authentication
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ Every request includes an `Authorization` header:
|
|
|
17
17
|
TPS-Ed25519 <agentId>:<timestamp>:<nonce>:<signature>
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The signature covers `agentId:timestamp:nonce:METHOD:/path` using the
|
|
20
|
+
The signature covers `agentId:timestamp:nonce:METHOD:/path?query` using the
|
|
21
21
|
agent's Ed25519 private key. The server verifies against the agent's
|
|
22
22
|
registered public key.
|
|
23
23
|
|
|
@@ -49,11 +49,14 @@ requests to it require admin Basic auth: Flair ships with
|
|
|
49
49
|
`authorizeLocal: false`, so an unauthenticated loopback request is
|
|
50
50
|
rejected (`401`) instead of being auto-elevated to super_user. The same
|
|
51
51
|
API is also reachable over a Unix **domain socket**
|
|
52
|
-
(`~/.flair/data/operations-server
|
|
52
|
+
(`~/.flair/data/operations-server`), which Harper
|
|
53
53
|
treats as an inherent local-admin channel — a request over the socket is
|
|
54
54
|
authorized as super_user **without** credentials. This is by design (the
|
|
55
|
-
admin-password rotation flow relies on it)
|
|
56
|
-
|
|
55
|
+
admin-password rotation flow relies on it). CLI `init`, `start`, `restart` and
|
|
56
|
+
launchd repair attempt parent/socket modes `0700`/`0600` (or `0750`/`0660` with
|
|
57
|
+
`FLAIR_SOCKET_GROUP`, changing the socket's group); unattended macOS launchd
|
|
58
|
+
spawns use `Umask 077` (`0700` socket, since Darwin does not retain `0600` on
|
|
59
|
+
Unix sockets) without reapplying the CLI posture.
|
|
57
60
|
|
|
58
61
|
## Data Scoping
|
|
59
62
|
|
|
@@ -63,21 +66,19 @@ Reads are open **within an org**; writes are isolated per agent. Enforced at
|
|
|
63
66
|
the database layer (Harper resource `search()` override via a single
|
|
64
67
|
centralized read-scope rule), not application logic:
|
|
65
68
|
|
|
66
|
-
- `GET /Memory/` —
|
|
67
|
-
|
|
68
|
-
- `POST /
|
|
69
|
+
- `GET /Memory/` — applies the owner/visibility base scope and omits retained
|
|
70
|
+
closed skill payloads that fail the non-admin reader's current-authority check
|
|
71
|
+
- `POST /SemanticSearch` — applies the owner/visibility read scope
|
|
69
72
|
- `POST /Memory` — writes are attributed to the authenticated agent; an
|
|
70
73
|
agent cannot write as another (write isolation)
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
`visibility: private` is returned only to its author, never to another agent.
|
|
75
|
+
Non-admin memory reads restrict `visibility: private` to its author.
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
create names the value the record actually landed on.
|
|
77
|
+
On `POST /Memory` and `PUT /Memory` creates, omitted visibility defaults by
|
|
78
|
+
durability: `permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private`.
|
|
79
|
+
Durability defaults to `standard`. Explicit visibility overrides this default;
|
|
80
|
+
ephemeral memories require `private`, and grant-authorized `supersedes` writes
|
|
81
|
+
keep the predecessor's visibility, including when visibility is omitted.
|
|
81
82
|
|
|
82
83
|
### Record Ownership on Writes
|
|
83
84
|
|
|
@@ -92,11 +93,14 @@ OrgEvent, WorkspaceState, Presence):
|
|
|
92
93
|
non-empty path segments, no `.` in the decoded id), for which Harper resolves
|
|
93
94
|
the same record id. Other addressed forms are left to the guard, which uses
|
|
94
95
|
Harper's resolved id.
|
|
95
|
-
- If reached, the guard checks
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
- If reached, the guard checks the body `id` on POST/PUT/PATCH first, then
|
|
97
|
+
stored ownership (the same owner refusal), using Harper's resolved record id.
|
|
98
|
+
An absent, null or matching body `id` passes the body-id check; a differing
|
|
99
|
+
string or number `id` gets `403 write_id_not_addressed`, and a present,
|
|
100
|
+
non-null `id` of any other type that is not the addressed key gets
|
|
101
|
+
`400 id_target_mismatch`. Each
|
|
102
|
+
object element of an array body is checked the same way. OrgEvent and Memory
|
|
103
|
+
bind an addressed POST's missing body `id` to the addressed id.
|
|
100
104
|
- For a collection PUT, PATCH or DELETE, if reached, the table guard returns
|
|
101
105
|
`403 forbidden: a non-admin write to <Table> must address one record by its id`;
|
|
102
106
|
existing DELETE middleware may refuse earlier.
|
|
@@ -115,12 +119,17 @@ its own ownership rule.
|
|
|
115
119
|
The guard exempts administrator and in-process calls. OrgEvent POST id
|
|
116
120
|
selection also applies to administrator and in-process calls.
|
|
117
121
|
|
|
122
|
+
Credential records are owner-scoped by `principalId`: non-admin callers read and
|
|
123
|
+
modify only their own records, and administrators and trusted internal callers
|
|
124
|
+
are unscoped. Anonymous HTTP access is refused.
|
|
125
|
+
|
|
118
126
|
### Cross-Agent Access (within an org)
|
|
119
127
|
|
|
120
|
-
Within an org,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
Within an org, non-private memories pass the base read-scope check without a
|
|
129
|
+
grant; non-admin by-id and collection reads of retained closed skills
|
|
130
|
+
additionally require readable current authority. This is deliberate: the goal
|
|
131
|
+
is relevance (surface what's useful to the org) over secrecy. A writer keeps something private by marking it
|
|
132
|
+
`visibility: private`, which restricts non-admin reads to its author. The access boundary
|
|
124
133
|
that stays hard is the **federation edge** (cross-instance / cross-org), not
|
|
125
134
|
within-org reads.
|
|
126
135
|
|
|
@@ -134,9 +143,32 @@ are restricted to admin-only.
|
|
|
134
143
|
|
|
135
144
|
### Key Storage
|
|
136
145
|
|
|
137
|
-
Private keys
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
Private keys at `~/.flair/keys/<agentId>.key` are created owner-only
|
|
147
|
+
(`0600`) from the first byte on POSIX by `flair agent add`, `flair init` (local
|
|
148
|
+
and remote agent provisioning), `flair principal add`, `flair import` and
|
|
149
|
+
`flair agent rotate-key` (which stages the replacement before it updates Flair
|
|
150
|
+
and renames it over the current key once Flair holds its public key). On
|
|
151
|
+
POSIX the keys directory is requested with mode `0700` (the umask may make it
|
|
152
|
+
narrower), and an owned directory with group or world bits is tightened to
|
|
153
|
+
`0700`; on the create and reuse paths an existing key with group or world
|
|
154
|
+
bits is refused with `chmod 600 <path>`, while rotation reports it. A successful
|
|
155
|
+
rotation replaces the file; a failed update leaves it. `flair doctor` warns
|
|
156
|
+
about an existing agent key file with group or world bits, and `flair status`
|
|
157
|
+
warns about it for a local target; both name the path, its mode and
|
|
158
|
+
`chmod 600 <path>`, and neither changes the file. The check covers the standard
|
|
159
|
+
`resolveKeyPath` locations: `$FLAIR_KEY_DIR/<agentId>.key` when that variable is
|
|
160
|
+
set, `~/.flair/keys/<agentId>.key`, and the legacy
|
|
161
|
+
`~/.tps/secrets/flair/<agentId>-priv.key`; explicit key paths (such as `--key`)
|
|
162
|
+
are outside this scan. A symlinked agent key is
|
|
163
|
+
reported as not checked. On Windows mode bits
|
|
164
|
+
do not establish owner-only.
|
|
165
|
+
|
|
166
|
+
`flair export --include-key` publishes its output through a `0600` temp file
|
|
167
|
+
renamed over the target, so an existing output file's wider mode does not apply
|
|
168
|
+
to the new contents. The keystore seed file is replaced the same way.
|
|
169
|
+
A generated passphrase is published at `0600` if its path is absent. When used
|
|
170
|
+
(`FLAIR_KEY_PASSPHRASE` unset), an existing generated passphrase file with group
|
|
171
|
+
or world bits is refused unchanged before reading, with `chmod 600 <path>`. On Windows the mode bits do not apply.
|
|
140
172
|
|
|
141
173
|
### Key Generation
|
|
142
174
|
|
|
@@ -146,8 +178,11 @@ runtime.
|
|
|
146
178
|
|
|
147
179
|
### Key Rotation
|
|
148
180
|
|
|
149
|
-
`flair agent rotate-key <id>` generates a new key pair,
|
|
150
|
-
|
|
181
|
+
`flair agent rotate-key <id>` generates a new key pair, stages the new private
|
|
182
|
+
key owner-only (`0600`) from creation on POSIX, updates the public key in
|
|
183
|
+
Flair, reads the row back to confirm the stored key, then renames the staged
|
|
184
|
+
key over the current one. The old key is backed up as a new
|
|
185
|
+
`<agentId>.key.bak.<UTC timestamp>`; an existing backup is left untouched.
|
|
151
186
|
|
|
152
187
|
## Threat Model
|
|
153
188
|
|
|
@@ -155,8 +190,8 @@ public key in Flair, and backs up the old key as `<agentId>.key.bak`.
|
|
|
155
190
|
|
|
156
191
|
- **Agent impersonation:** Ed25519 signatures prevent one agent from
|
|
157
192
|
acting as another without possessing the private key.
|
|
158
|
-
- **Private-memory leakage:**
|
|
159
|
-
|
|
193
|
+
- **Private-memory leakage:** non-admin reads of `visibility: private` memories
|
|
194
|
+
are restricted to their author. Non-private
|
|
160
195
|
memories are intentionally readable within the org (by design, not
|
|
161
196
|
leakage); the cross-instance boundary is the federation edge.
|
|
162
197
|
- **Write forgery:** writes are attributed to the authenticated agent —
|
|
@@ -164,8 +199,6 @@ public key in Flair, and backs up the old key as `<agentId>.key.bak`.
|
|
|
164
199
|
- **Replay attacks:** 30-second window + nonce deduplication.
|
|
165
200
|
- **Privilege escalation via SQL:** SQL and GraphQL endpoints blocked
|
|
166
201
|
for non-admin agents.
|
|
167
|
-
- **Admin token theft from filesystem:** Admin credentials are only in
|
|
168
|
-
process environment, never on disk.
|
|
169
202
|
|
|
170
203
|
### Threats NOT Mitigated (Runtime Responsibility)
|
|
171
204
|
|
|
@@ -176,13 +209,10 @@ public key in Flair, and backs up the old key as `<agentId>.key.bak`.
|
|
|
176
209
|
process could extract them.
|
|
177
210
|
- **Network sniffing:** Flair uses HTTP by default. Use HTTPS in
|
|
178
211
|
production or restrict to localhost.
|
|
179
|
-
- **
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
rotation flow uses this path). Owner-write permissions keep it
|
|
184
|
-
unreachable by other OS users, co-tenants, and the network; isolate
|
|
185
|
-
untrusted workloads to separate OS users.
|
|
212
|
+
- **Local ops-API socket access:** the operations-API domain socket
|
|
213
|
+
(`operations-server`) grants local admin access, restricted by the
|
|
214
|
+
directory and socket modes above. Isolate untrusted workloads to separate
|
|
215
|
+
OS users outside any configured `FLAIR_SOCKET_GROUP`.
|
|
186
216
|
|
|
187
217
|
## Recommendations
|
|
188
218
|
|
|
@@ -191,4 +221,4 @@ public key in Flair, and backs up the old key as `<agentId>.key.bak`.
|
|
|
191
221
|
3. **Rotate keys** periodically with `flair agent rotate-key`
|
|
192
222
|
4. **Back up** with `flair backup` — backup files contain memory content
|
|
193
223
|
and should be treated as sensitive
|
|
194
|
-
5. **Monitor** with `flair status`
|
|
224
|
+
5. **Monitor** with `flair status`
|
package/config.yaml
CHANGED
|
@@ -30,20 +30,20 @@ authentication:
|
|
|
30
30
|
# (flair#1152). Requires @harperfast/oauth >= 2.5.0 (resolved-version
|
|
31
31
|
# assertion + behavioral gate: test/integration/mcp-oauth-boot-safety.test.ts).
|
|
32
32
|
#
|
|
33
|
-
# ASYMMETRY (load-bearing, measured on oauth 2.
|
|
34
|
-
# this flag accept DIFFERENT vocabularies. The component's
|
|
35
|
-
# coerceConfigBoolean
|
|
36
|
-
#
|
|
37
|
-
#
|
|
33
|
+
# ASYMMETRY (load-bearing, measured on @harperfast/oauth 2.9.0): the two
|
|
34
|
+
# readers of this flag accept DIFFERENT vocabularies. The component's
|
|
35
|
+
# coerceConfigBoolean trims and lowercases, mapping "true"/"false" to a
|
|
36
|
+
# boolean, and normalizeBooleanField deletes strings it cannot coerce
|
|
37
|
+
# (unresolved placeholder, "1", "yes", garbage), so its disabled default
|
|
38
|
+
# applies (dist/lib/config.js). flair's mcpOAuthEnabled() accepts
|
|
39
|
+
# 1/true/yes/on.
|
|
38
40
|
#
|
|
39
|
-
# Failure modes (oauth 2.
|
|
41
|
+
# Failure modes (oauth 2.9.0):
|
|
40
42
|
# unset -> placeholder deleted -> both sides OFF, clean boot
|
|
41
|
-
# true ->
|
|
42
|
-
# (`flair mcp enable` stages exactly this)
|
|
43
|
+
# true -> both flag readers accept this value
|
|
43
44
|
# false -> both sides OFF
|
|
44
|
-
# 1 / yes / on -> flair
|
|
45
|
-
#
|
|
46
|
-
# no AS is advertised. Use "true" instead.
|
|
45
|
+
# 1 / yes / on -> flair's reader is ON, the component deletes the
|
|
46
|
+
# value (AS stays OFF); /mcp is not mounted.
|
|
47
47
|
# garbage (maybe) -> deleted -> component OFF; flair strict -> OFF.
|
|
48
48
|
# Inert: no /mcp handler, no data path (flair's own
|
|
49
49
|
# discovery documents still serve, by design).
|
|
@@ -17,6 +17,7 @@ import { randomUUID } from "node:crypto";
|
|
|
17
17
|
import { BridgeRuntimeError } from "../types.js";
|
|
18
18
|
import { importFromYaml } from "./execute.js";
|
|
19
19
|
import { endsWithContentSelectorSuffix } from "../../lib/memory-id-policy.js";
|
|
20
|
+
import { requireAgentId } from "../../lib/key-dir.js";
|
|
20
21
|
const VALID_DURABILITY = new Set(["ephemeral", "standard", "persistent", "permanent"]);
|
|
21
22
|
/**
|
|
22
23
|
* Drive a YAML descriptor's `import` block all the way through to PUTs
|
|
@@ -48,6 +49,9 @@ export async function runImport(opts) {
|
|
|
48
49
|
hint: `record ${total} has no agentId and no --agent default was provided. Pass --agent <id> on the import command, or have the descriptor map an agentId column.`,
|
|
49
50
|
});
|
|
50
51
|
}
|
|
52
|
+
// Refuse an invalid agent id before the caller resolves a key path or reads
|
|
53
|
+
// a key for this record.
|
|
54
|
+
requireAgentId(resolvedAgent);
|
|
51
55
|
const durability = (m.durability && VALID_DURABILITY.has(m.durability))
|
|
52
56
|
? m.durability
|
|
53
57
|
: "standard";
|
package/dist/bridges/types.js
CHANGED
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"commit": "
|
|
4
|
-
"builtAt": "2026-
|
|
2
|
+
"version": "0.63.1",
|
|
3
|
+
"commit": "d2469c5dec55a9fc31b1a9b8644eb086c86cd40c",
|
|
4
|
+
"builtAt": "2026-11-29T07:21:07.327Z",
|
|
5
5
|
"builder": "tsc"
|
|
6
6
|
}
|