@tpsdev-ai/flair 0.62.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.
- package/README.md +6 -6
- package/SECURITY.md +18 -10
- package/config.yaml +11 -11
- package/dist/bridges/runtime/execute.js +1 -0
- package/dist/bridges/types.js +1 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +66 -122
- package/dist/commands/agent.js +27 -65
- package/dist/commands/backup-approval.js +218 -0
- package/dist/commands/backup.js +37 -33
- package/dist/commands/bootstrap.js +3 -1
- package/dist/commands/deploy.js +37 -7
- package/dist/commands/doctor.js +119 -0
- package/dist/commands/export.js +3 -4
- 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 +131 -19
- package/dist/commands/init.js +7 -7
- package/dist/commands/integrity.js +5 -6
- package/dist/commands/mcp.js +11 -17
- package/dist/commands/memory.js +33 -15
- package/dist/commands/orgevent.js +5 -10
- package/dist/commands/principal.js +13 -25
- package/dist/commands/quality.js +3 -0
- package/dist/commands/rem.js +484 -65
- package/dist/commands/restore.js +352 -44
- package/dist/commands/service.js +84 -2
- package/dist/commands/soul.js +0 -6
- package/dist/commands/status.js +51 -33
- 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 +7 -2
- package/dist/fabric-upgrade.js +12 -2
- package/dist/federation/presence-send.js +139 -0
- package/dist/federation-verify.js +269 -177
- package/dist/install/clients.js +171 -35
- package/dist/lib/agent-id-rule.js +44 -2
- package/dist/lib/atomic-write.js +1 -1
- package/dist/lib/auth-resolve.js +1028 -52
- 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/launchd-management.js +14 -3
- 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/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/restore-archive.js +760 -0
- package/dist/lib/restore-verify.js +1 -1
- package/dist/lib/skill-assignment-preflight.js +159 -0
- package/dist/lib/skill-seed.js +91 -8
- package/dist/lib/skill-tombstone-doctor.js +133 -0
- package/dist/lib/soul-scope-fields.js +26 -0
- package/dist/lib/uninstall-purge.js +266 -11
- package/dist/lib/upgrade-prior-liveness.js +2 -1
- package/dist/mcp-client-assertion.js +2 -10
- 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 +1303 -270
- 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 +43 -4
- package/dist/resources/host-pointer/registry.js +29 -0
- package/dist/resources/host-pointer-adapter.js +1 -0
- 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-handler.js +106 -12
- package/dist/resources/mcp-oauth-flag.js +12 -14
- package/dist/resources/mcp-oauth.js +430 -53
- package/dist/resources/mcp-tools.js +60 -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 +384 -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/lib/agent-id-rule.js +44 -2
- package/dist/src/lib/atomic-write.js +1 -1
- package/dist/src/lib/federation-retry-row.js +101 -0
- package/dist/src/lib/instruction-event-contract.js +17 -0
- package/dist/src/lib/memory-attributes.js +2 -0
- package/dist/src/lib/open-live-row.js +20 -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 +18 -9
- package/docs/api-reference.md +126 -28
- package/docs/auth.md +40 -18
- package/docs/claude-code.md +3 -3
- package/docs/deploying-on-fabric.md +108 -0
- package/docs/deployment.md +17 -0
- package/docs/embedding-in-a-harper-app.md +16 -14
- package/docs/entity-vocabulary.md +3 -6
- package/docs/federation.md +29 -2
- 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 +2 -2
- 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 +14 -0
- 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
|
@@ -305,6 +305,114 @@ without this re-flip will appear healthy (`/Health` green) while its MCP tools a
|
|
|
305
305
|
dark to every connected client. If you rely on MCP, add the re-flip to your upgrade
|
|
306
306
|
runbook.
|
|
307
307
|
|
|
308
|
+
### MQTT configuration
|
|
309
|
+
|
|
310
|
+
Flair does not use MQTT. Its local starts run Harper with every MQTT listener
|
|
311
|
+
off: the TCP and TLS listeners (`mqtt.network.port`,
|
|
312
|
+
`mqtt.network.securePort`) and MQTT over WebSocket on the HTTP port
|
|
313
|
+
(`mqtt.webSocket`), set on every start. A component deployment does not go
|
|
314
|
+
through those starts, and a component's `config.yaml` cannot set it (`mqtt`
|
|
315
|
+
belongs to the instance's root configuration). So, by default, `flair deploy`
|
|
316
|
+
and `flair upgrade --target` set those listeners off in the target's
|
|
317
|
+
configuration through its operations API and request the worker restart that
|
|
318
|
+
applies it; they do not confirm the listeners' live state. `--keep-mqtt-config`,
|
|
319
|
+
`--no-restart` and `--no-verify` change these steps (below).
|
|
320
|
+
|
|
321
|
+
**Before deploying**, they send:
|
|
322
|
+
|
|
323
|
+
```json
|
|
324
|
+
{ "operation": "set_configuration", "mqtt_network_port": null, "mqtt_network_securePort": null, "mqtt_webSocket": false, "replicated": true }
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
`replicated` follows the deploy (`--no-replicated` sends it to the origin
|
|
328
|
+
only; an instance without replication is set on its own). If the target
|
|
329
|
+
refuses it, or its answer names a cluster node that did not take it, nothing
|
|
330
|
+
is deployed, and the error names the node and the request to send to it.
|
|
331
|
+
|
|
332
|
+
**After the deploy's restart**, they read the target's configuration back
|
|
333
|
+
through its operations API. An answer that is not a recognizable root
|
|
334
|
+
configuration (it must carry Harper's `http` and `operationsApi` sections and
|
|
335
|
+
its `rootPath`) is reported as not confirmed, never as off, and the saved
|
|
336
|
+
`mqtt` section must read off (`mqtt.network.port` and `mqtt.network.securePort`
|
|
337
|
+
null, `mqtt.webSocket` false); a mismatch is named by field and category, such
|
|
338
|
+
as `mqtt.webSocket is not false`. Either failure fails the command after the
|
|
339
|
+
deploy, with the request to send.
|
|
340
|
+
|
|
341
|
+
Harper applies the setting when the shared HTTP worker threads, which start
|
|
342
|
+
the MQTT listeners, restart. The deploy's own restart covers them, except for a
|
|
343
|
+
fresh isolated deploy: when the root configuration marks Flair `isolated: true`
|
|
344
|
+
and Harper does not find it already active, Harper restarts only Flair's own
|
|
345
|
+
worker (for an application it finds already active, it restarts every
|
|
346
|
+
worker). For an isolated Flair they therefore also request the shared worker
|
|
347
|
+
threads' restart through the operations API (`restart_service`, `"service":
|
|
348
|
+
"http_workers"`, `"scope": ""`, replicated with the deploy; a standalone
|
|
349
|
+
instance, which refuses the replicated request, gets it on its own) and follow
|
|
350
|
+
Harper's job. The command fails when the restart request fails or is answered
|
|
351
|
+
without a job id, and on these job outcomes: a job read that does not succeed
|
|
352
|
+
(refused before its body is parsed), a job that does not complete, a completion
|
|
353
|
+
message that is not exactly Harper's for that job, a replicated result without
|
|
354
|
+
its node list, or a node the result lists without Harper's completed-job
|
|
355
|
+
message (each named, with the request to send to it). Nodes are judged as the
|
|
356
|
+
job's result lists them: that list is not compared with the nodes the
|
|
357
|
+
configuration answer named. A completed job is not proof that a node's workers
|
|
358
|
+
restarted: Harper sends a node's restart-complete from a `finally` and does
|
|
359
|
+
not carry the worker replacement's outcome.
|
|
360
|
+
|
|
361
|
+
**What they report.** Exactly this, and nothing more:
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
MQTT listeners configured off on <the target and the nodes the replicated answer named>; shared workers restart requested (job <id>: <each node's outcome>, or: with the deploy's own restart); the saved configuration on <the target's operations host> reads off. Listeners stop when each node's workers restart; flair does not probe them. To confirm on a node, connect an MQTT client to its MQTT ports or WebSocket path.
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Flair does not connect to the MQTT listeners. To confirm that a node stopped
|
|
368
|
+
serving MQTT after its workers restarted, connect an MQTT client to that node's
|
|
369
|
+
MQTT ports (1883 and 8883 by default) or to its MQTT-over-WebSocket path on the
|
|
370
|
+
HTTP port.
|
|
371
|
+
|
|
372
|
+
With `--no-verify` (both commands) the post-restart step is skipped (the saved
|
|
373
|
+
configuration is not read back, and no restart is requested for an isolated
|
|
374
|
+
application), and with `--no-restart` the setting takes effect at the next
|
|
375
|
+
restart; both print the restart request to send. With `--keep-mqtt-config`
|
|
376
|
+
neither step runs.
|
|
377
|
+
|
|
378
|
+
**URLs.** The operations API URL is resolved as for every remote command:
|
|
379
|
+
`--ops-target` / `FLAIR_OPS_TARGET`, else derived from the target. The target
|
|
380
|
+
and the operations API URL must be http or https URLs with a host, and nothing
|
|
381
|
+
but scheme, host, port and path: any other scheme (such as `file:` or
|
|
382
|
+
`javascript:`), a URL without a host, a user name, password, query or fragment
|
|
383
|
+
is refused before either command prints or sends anything. The operations API
|
|
384
|
+
calls follow no redirect. Every URL the MQTT-off steps print, and the target
|
|
385
|
+
URL in the commands' own deploy lines (`flair deploy`'s next-steps example
|
|
386
|
+
included), shows scheme, host, port and path only; that includes the
|
|
387
|
+
operations API URL they name for a cluster node, which they build only from a
|
|
388
|
+
node name that is a valid host name or IP address.
|
|
389
|
+
|
|
390
|
+
**Output.** The errors and progress lines of these MQTT-off steps quote a
|
|
391
|
+
remote answer's HTTP status code, a restart job's id (when it is a plain
|
|
392
|
+
token) and state, and cluster node names as its answers give them (when they
|
|
393
|
+
are valid host names or IP addresses); never its body, a job's message, a
|
|
394
|
+
configuration value or a transport error's text. This covers only these
|
|
395
|
+
steps: the Harper deploy between them runs Harper's CLI, whose output is
|
|
396
|
+
streamed as it comes.
|
|
397
|
+
|
|
398
|
+
`flair doctor` (local instances; it takes no `--target`) reports an instance
|
|
399
|
+
whose saved configuration starts an MQTT listener, and names the call that
|
|
400
|
+
sets the listeners off in the configuration. It reads the configuration, not
|
|
401
|
+
the running listeners: worker threads that have not restarted since the
|
|
402
|
+
configuration changed may still serve their previous listener configuration,
|
|
403
|
+
and doctor says so on every path, including when it cannot read the
|
|
404
|
+
configuration. It follows no redirect: a redirected configuration read is NOT
|
|
405
|
+
RUN.
|
|
406
|
+
|
|
407
|
+
**Turning MQTT on deliberately.** Send `set_configuration` with the listeners
|
|
408
|
+
you want (for example `"mqtt_webSocket": true`), then restart the worker threads
|
|
409
|
+
(`restart_service` with `"service": "http_workers"`). Pass `--keep-mqtt-config`
|
|
410
|
+
to later `flair deploy` / `flair upgrade --target` runs so they leave the
|
|
411
|
+
instance's MQTT configuration as it is. Table subscriptions, publishes and
|
|
412
|
+
retained publishes over MQTT then follow the same policy as SSE and WebSocket
|
|
413
|
+
subscriptions: administrators and trusted internal callers only
|
|
414
|
+
([api-reference.md](api-reference.md)).
|
|
415
|
+
|
|
308
416
|
### npm cache on the node
|
|
309
417
|
|
|
310
418
|
`flair deploy` and `flair upgrade --target` pass Harper an `install_command` that runs
|
package/docs/deployment.md
CHANGED
|
@@ -46,6 +46,23 @@ flair init --port 8000
|
|
|
46
46
|
|
|
47
47
|
Or edit `~/.flair/config.yaml` and restart.
|
|
48
48
|
|
|
49
|
+
### MQTT
|
|
50
|
+
|
|
51
|
+
Flair runs Harper with MQTT off in local installs: no TCP or TLS MQTT listener
|
|
52
|
+
and no MQTT over WebSocket. Every local start re-asserts it, and `flair doctor`
|
|
53
|
+
reports an instance whose saved configuration starts an MQTT listener (it reads
|
|
54
|
+
the configuration, not the running listeners). For a component deployed with
|
|
55
|
+
`flair deploy` or `flair upgrade --target` — which by default set MQTT off in
|
|
56
|
+
the target's configuration, request the shared worker threads' restart that
|
|
57
|
+
applies it for an isolated application, and read the saved configuration back
|
|
58
|
+
after the deploy's restart, without probing the listeners (`--keep-mqtt-config`
|
|
59
|
+
skips all of it, `--no-restart` and `--no-verify` skip the restart request and
|
|
60
|
+
the read-back) — see
|
|
61
|
+
[deploying-on-fabric.md](deploying-on-fabric.md#mqtt-configuration), including how an
|
|
62
|
+
operator turns MQTT on deliberately; table subscriptions, publishes and
|
|
63
|
+
retained publishes over MQTT then follow the same policy as SSE and WebSocket
|
|
64
|
+
subscriptions.
|
|
65
|
+
|
|
49
66
|
---
|
|
50
67
|
|
|
51
68
|
## Linux
|
|
@@ -135,7 +135,7 @@ Verified against a real instance: that lands `kind: "agent"`, `status: "active"`
|
|
|
135
135
|
|
|
136
136
|
> **Prefer this to `databases.flair.Agent.put()`.** The raw table applies **no** defaults, so a hand-written literal has to reproduce every field above and then stay in step with Flair as the Principal model grows. Records written that way are missing `kind`/`status`/`defaultTrustTier` and read as under-specified Principals in the admin surfaces.
|
|
137
137
|
|
|
138
|
-
> **Admin is one meaning with one answer.** `role === "admin"` is the authority; the `admin` boolean is a mirror of it that the server maintains. Write **either** through the `Agent` resource and both are set — you no longer have to know which one is real, and a record cannot be stored saying one thing in one field and the opposite in the other.
|
|
138
|
+
> **Admin is one meaning with one answer.** On the Agent record, `role === "admin"` is the authority; the `admin` boolean is a mirror of it that the server maintains. An id listed in the instance's `FLAIR_ADMIN_AGENTS` is also an administrator, whatever its record's role. Write **either** through the `Agent` resource and both are set — you no longer have to know which one is real, and a record cannot be stored saying one thing in one field and the opposite in the other. The signed-request admin lookup does not use the `admin` mirror.
|
|
139
139
|
>
|
|
140
140
|
> A record written straight to the table (`databases.flair.Agent.put()`, an ops-API insert, a federation merge) skips that reconciliation and can still carry a mismatch. `flair principal show` and the admin dashboard flag such a record rather than silently picking a side; re-issuing the grant repairs it.
|
|
141
141
|
|
|
@@ -154,7 +154,7 @@ Flair accepts the public key as 64-char hex, or base64 of the raw 32 bytes.
|
|
|
154
154
|
|
|
155
155
|
Both verified end to end: an agent registered this way, with a key its app minted, then authenticated over HTTP with a real `TPS-Ed25519` signature — and a request signed with the *wrong* key was rejected.
|
|
156
156
|
|
|
157
|
-
> **
|
|
157
|
+
> **Setting the key, and who may call `AgentSeed`.** `Agent.put()` on the *resource* is an administrator operation (a trusted in-process call is admitted; over HTTP an agent that is not an administrator is refused and updates its own record with PATCH). It updates an existing record and keeps its stored `publicKey` (a `publicKey` in the body is ignored), and an admitted PUT to an id with no record is refused with `404 agent_put_requires_existing`, so set the key when you **create** the record; to rotate one later, write `databases.flair.Agent.put({ ...existing, publicKey })` on the raw table (`flair agent rotate-key` does the equivalent through the admin operations API, an `update` of the record's `publicKey` — there is no dedicated endpoint today). `AgentSeed` writes the agent's Soul, so its `post()` admits only a Soul-write source (`authorizeSoulWrite` in `resources/soul-write-policy.ts`): over HTTP, operator Basic (a verified Harper administrator's `Basic` credential; an admin agent's `TPS-Ed25519` key is refused `403 soul_write_requires_operator`), and in-process, a deliberate trusted internal call made with `internalContext()` on the resource `collectionResource()` binds. `collectionResource()` called without a context throws `InProcessContextError` before `post()` runs, and an explicit context that lacks the internal marker is refused `403 soul_write_requires_operator`. An unauthenticated request is refused.
|
|
158
158
|
|
|
159
159
|
---
|
|
160
160
|
|
|
@@ -178,7 +178,9 @@ Flair uses the raw table where it *wants* to bypass its own rules — the federa
|
|
|
178
178
|
| `{ request: { tpsAnonymous: true } }` | `anonymous` | Denied everywhere |
|
|
179
179
|
| `{ request: { tpsAgent: "mybot" } }` | `agent` | Scoped to that agent — **use this** |
|
|
180
180
|
| `{ request: { tpsAgent: "mybot", tpsAgentIsAdmin: true } }` | admin | Unfiltered reads, cross-agent writes |
|
|
181
|
-
| **Nothing
|
|
181
|
+
| **Nothing** (with no ambient Harper context), or an in-process `{ request: {} }` | `internal` | Unfiltered `Memory` reads. An `allowAdmin` check admits it only when the context carries the marker that `internalContext()` sets and no request headers, and refuses it otherwise. See the warning below. |
|
|
182
|
+
|
|
183
|
+
A context with an anonymous marker or request headers can resolve differently.
|
|
182
184
|
|
|
183
185
|
Build these with `agentContext(id)`, `adminContext(id)` and `internalContext()` rather than by hand — see [below](#the-api-is-built-so-omission-cannot-happen-quietly) for why the hand-written form is a trap.
|
|
184
186
|
|
|
@@ -198,7 +200,7 @@ There are exactly two ways to lose the model, from opposite ends. Both are pinne
|
|
|
198
200
|
|
|
199
201
|
| | |
|
|
200
202
|
|---|---|
|
|
201
|
-
| **By omission** | No
|
|
203
|
+
| **By omission** | No context argument and no ambient Harper context, or an in-process `{ request: {} }` ⇒ `internal` ⇒ unfiltered `Memory` reads. Without the marker that `internalContext()` sets, an `allowAdmin` check refuses it when Harper consults the gate. |
|
|
202
204
|
| **By assertion** | An attacker-influenced `agentId` is honoured verbatim. |
|
|
203
205
|
|
|
204
206
|
### The API is built so omission cannot happen quietly
|
|
@@ -207,19 +209,19 @@ There are exactly two ways to lose the model, from opposite ends. Both are pinne
|
|
|
207
209
|
|
|
208
210
|
```
|
|
209
211
|
resolveAgentAuth({ request: { tpsAgent: undefined } }) -> { kind: "internal" }
|
|
210
|
-
allowAdmin({ request: { tpsAgent: undefined } }) ->
|
|
212
|
+
allowAdmin({ request: { tpsAgent: undefined } }) -> false
|
|
211
213
|
```
|
|
212
214
|
|
|
213
|
-
That would turn
|
|
215
|
+
That would turn `agentContext(session.agentId)`, where the field came back undefined, into unfiltered `Memory` reads across every agent. The admin-only gate refuses it: `allowAdmin` admits the `internal` verdict only for a call that carries `internalContext()`'s marker and no request headers. So the helpers refuse rather than default:
|
|
214
216
|
|
|
215
217
|
| | |
|
|
216
218
|
|---|---|
|
|
217
219
|
| `agentContext(id)` | **Throws** `InProcessContextError` on a missing, empty or blank id. Takes **no options**, so no object spread into it can escalate. |
|
|
218
|
-
| `adminContext(id)` |
|
|
219
|
-
| `internalContext()` |
|
|
220
|
+
| `adminContext(id)` | Builds `{ request: { tpsAgent: id, tpsAgentIsAdmin: true } }`. Same id guard. |
|
|
221
|
+
| `internalContext()` | Builds `{ request: {}, __flairInternal: true }`, which resolves to `internal` and carries the marker that `allowAdmin` checks. |
|
|
220
222
|
| `collectionResource(Cls, context)` | Context is **required**; omitting it throws rather than granting `internal`. |
|
|
221
223
|
|
|
222
|
-
|
|
224
|
+
Elevated calls have named helpers, and `git grep "adminContext\|internalContext"` finds textual references to those helper names in tracked files. These are runtime guards, not type annotations.
|
|
223
225
|
|
|
224
226
|
### Individual identities, not one app identity
|
|
225
227
|
|
|
@@ -346,11 +348,11 @@ export async function remember(agentId, content, opts = {}) {
|
|
|
346
348
|
>
|
|
347
349
|
> `collectionResource(Cls, context)` is a two-line wrapper over the supported call — `Cls.getResource({}, context, { isCollection: true })` — and exists so this is written once. **Reads do not need it:** `Cls.get(id, context)` and `Cls.search(query, context)` thread the context themselves.
|
|
348
350
|
>
|
|
349
|
-
> They do still need the **context**.
|
|
351
|
+
> They do still need the **context**. Pass the context to every call, read and write; the warning below covers what omitting it does.
|
|
350
352
|
|
|
351
|
-
> ### ⚠️ A
|
|
353
|
+
> ### ⚠️ A `Memory` read with no context can run unfiltered
|
|
352
354
|
>
|
|
353
|
-
> A resource
|
|
355
|
+
> A resource given no context, when no ambient Harper context is present, resolves to Flair's trusted `internal` verdict. A `Memory` read then runs **unfiltered** across every agent, and the omission raises no error. An `allowAdmin` check refuses the same verdict when Harper consults the gate.
|
|
354
356
|
>
|
|
355
357
|
> Measured, not inferred: a context-less `Memory.search()` returns every agent's `private` records, and so does a context-less `SemanticSearch`.
|
|
356
358
|
>
|
|
@@ -383,7 +385,7 @@ export async function registerAgent(id, { publicKey = "pending", admin = false }
|
|
|
383
385
|
|
|
384
386
|
### What we measured, so you do not have to
|
|
385
387
|
|
|
386
|
-
Run end to end on **Harper 5.1.22**, from a second component loaded into the same instance — the exact shape above. `test/integration/in-process-agents.test.ts` in the Flair repo is that run, and `test/fixtures/inproc-app` is the component it drives.
|
|
388
|
+
Run end to end on **Harper 5.1.22**, from a second component loaded into the same instance — the exact shape above. `test/integration-heavy/in-process-agents.test.ts` in the Flair repo is that run, and `test/fixtures/inproc-app` is the component it drives.
|
|
387
389
|
|
|
388
390
|
| Claim | Result |
|
|
389
391
|
|---|---|
|
|
@@ -402,4 +404,4 @@ Handlers return a `Response` for `401`/`403`/`400` rather than throwing — chec
|
|
|
402
404
|
|
|
403
405
|
## See also
|
|
404
406
|
|
|
405
|
-
[Integrations](integrations.md) · [Deployment](deployment.md) · [Federation](federation.md) · [Auth](auth.md) · [Architecture](
|
|
407
|
+
[Integrations](integrations.md) · [Deployment](deployment.md) · [Federation](federation.md) · [Auth](auth.md) · [Architecture](https://github.com/tpsdev-ai/flair/blob/main/DESIGN.md)
|
|
@@ -14,10 +14,9 @@ and the new `entities` fields on `WorkspaceState`/`OrgEvent`/`Memory`), plus the
|
|
|
14
14
|
query and bootstrap collision surfacing (both shipped in later slices) and any future MCP
|
|
15
15
|
scope field — retrofitting a divergent vocabulary later is expensive.
|
|
16
16
|
|
|
17
|
-
> This doc covers the vocabulary and validator
|
|
18
|
-
> plane (flair#675). The attention query (
|
|
19
|
-
>
|
|
20
|
-
> for the full design.
|
|
17
|
+
> This doc covers the vocabulary and validator, the foundation slice of the attention
|
|
18
|
+
> plane (flair#675). The attention query (flair#677) and bootstrap collision surfacing
|
|
19
|
+
> (flair#681) build on it.
|
|
21
20
|
|
|
22
21
|
## The form
|
|
23
22
|
|
|
@@ -120,5 +119,3 @@ vocabulary; wiring that validation is a follow-up, not part of this foundation s
|
|
|
120
119
|
- Automatic entity extraction/tagging on write (producers set `entities` themselves today,
|
|
121
120
|
where they choose to; there's no NLP-derived auto-population yet).
|
|
122
121
|
- Validating `Relationship.subject`/`object` against this vocabulary.
|
|
123
|
-
|
|
124
|
-
These are tracked as follow-ups in `FLAIR-ATTENTION-PLANE.md`.
|
package/docs/federation.md
CHANGED
|
@@ -118,7 +118,7 @@ lands in shell history and the process list.
|
|
|
118
118
|
|
|
119
119
|
### What a push sends
|
|
120
120
|
|
|
121
|
-
Each sync
|
|
121
|
+
Each sync considers rows changed since the cursor from four tables: `Memory`, `Soul`, `Agent`, and `Relationship`. With `FLAIR_FEDERATION_PRESENCE_SEND` enabled (default off), `Presence` is scanned after those tables. Only Presence rows whose `originatorInstanceId` is this instance are eligible. Selection uses the later of `lastHeartbeatAt` and `activityUpdatedAt` against a separate watermark, clamped to scan time, with a 30 s overlap. A hub requires `FLAIR_FEDERATION_PRESENCE_RECEIVE` (default off) to store pushed Presence.
|
|
122
122
|
|
|
123
123
|
**Memory rows with `visibility` exactly `"private"` are left behind.** Durability is not the filter. `"shared"` and any other present value are included. Soul, Agent, and Relationship have no `visibility` field, so this rule does not apply to them.
|
|
124
124
|
|
|
@@ -237,7 +237,13 @@ If neither the env var nor the passphrase file can be accessed, federation ident
|
|
|
237
237
|
|
|
238
238
|
New peers must present a valid, unexpired, unused pairing token. This prevents unauthorized instances from joining the federation. Tokens are generated by the hub admin and are single-use on one node.
|
|
239
239
|
|
|
240
|
-
An otherwise valid re-pair of a non-revoked peer (same instance ID, signed with the peer's pinned public key) requires no token; a supplied token must pass validation before the transactional Peer re-read
|
|
240
|
+
An otherwise valid re-pair of a non-revoked peer (same instance ID, signed with the peer's pinned public key) requires no token; a supplied token must pass validation before the transactional Peer re-read. Before writing, the re-pair rechecks the pinned key and revoke status inside its owned transaction: a different key is refused (409); otherwise a revoked peer is refused (403 `peer_revoked`), with no peer row written and no token consumed. A peer row absent at that re-read is paired as a first-time pair with a valid token; without a token the request is refused (401). On the token path, the re-read covers changes committed before the transaction's first read (its token read), not changes committed after it. Both first-pair routes (initially absent Peer or deleted Peer on a token re-pair) stage their peer row in the owned transaction that consumes its token, then confirm its absence in committed state before that transaction commits. If that confirm read finds a row for the instance in committed state although the earlier read returned none, the pair is refused (409 `peer_row_appeared`): the request writes no peer row and the token stays unconsumed. After the commit, each route confirms its write from a fresh committed read, and a request whose confirmation fails is never reported as `paired`:
|
|
241
|
+
|
|
242
|
+
- **First-time pair** (an initially absent Peer, or a token re-pair whose Peer was deleted): the committed Peer row must show this attempt's marker and every staged field at its staged value, and the committed `PairingToken` row must match the staged marker, `consumedBy`, and `consumedAt`. A mismatch is refused 409 `peer_pair_unconfirmed`; a failed read is refused 503 `peer_read_back_unconfirmed`.
|
|
243
|
+
- **Token re-pair of an existing Peer:** the same comparison, except that its staged Peer row is a copy of the re-read row, so Harper's `__createdtime__` and `__updatedtime__` are left out. A mismatch or a failed read is refused 409 `peer_pair_unconfirmed`.
|
|
244
|
+
- **Re-pair without a token:** the committed Peer row must show this attempt's marker and its staged fields, again without Harper's timestamps. A mismatch or a failed read answers 503 `write_outcome_unknown` with outcome `unconfirmed`; no token was spent, so the request may be sent again.
|
|
245
|
+
|
|
246
|
+
On both re-pair routes, `pairAttemptWriteId` is written by a pairing attempt as the id of its write. A field-level competing update that leaves this field alone merges around it, so a refused attempt's id can remain on the committed row next to the competing update's fields. The post-commit comparison uses it as the id of the staged write; it is not a confirmation of the attempt.
|
|
241
247
|
|
|
242
248
|
### Originator enforcement
|
|
243
249
|
|
|
@@ -308,6 +314,27 @@ so B's copy would then hold a different key from A's. A B row that is absent
|
|
|
308
314
|
can receive A's registered-key row: the pending-key guard applies only to a row B
|
|
309
315
|
already holds with `publicKey: "pending"`.
|
|
310
316
|
|
|
317
|
+
### An agent's key, home and admin fields in a sync
|
|
318
|
+
|
|
319
|
+
An existing Agent row's `publicKey` and home (`originatorInstanceId`) change
|
|
320
|
+
through a sync only when the batch's signing sender is the row's stored home. A
|
|
321
|
+
record from another peer that would change either is skipped whole as
|
|
322
|
+
`agent_identity_not_from_home`. A missing, null or empty stored home counts as
|
|
323
|
+
no home: such a row takes no key change from a peer and cannot acquire a
|
|
324
|
+
non-empty home through a sync.
|
|
325
|
+
|
|
326
|
+
A sync does not set or change `role: "admin"` or `admin: true`: a new row is
|
|
327
|
+
stored without them, and an existing row keeps its stored admin state (whether
|
|
328
|
+
`role` is `"admin"` and whether `admin` is `true`) when the record's would change
|
|
329
|
+
it. A `role` label follows the merge when the stored and incoming roles are both
|
|
330
|
+
non-admin. A record that would
|
|
331
|
+
create a row whose id the receiving instance's `FLAIR_ADMIN_AGENTS` names is
|
|
332
|
+
skipped as `agent_admin_id_not_federated`.
|
|
333
|
+
|
|
334
|
+
Earlier checks, including the status and pending-key rules, keep their own
|
|
335
|
+
reasons. The receiving instance's administrator can write these fields, or
|
|
336
|
+
create the row, through its operations API.
|
|
337
|
+
|
|
311
338
|
## Troubleshooting
|
|
312
339
|
|
|
313
340
|
### Listen port drift
|
package/docs/integrations.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Flair integrations
|
|
2
2
|
|
|
3
|
-
Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent, while
|
|
3
|
+
Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers.
|
|
4
4
|
|
|
5
|
-
> **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity
|
|
5
|
+
> **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. Administrator agent roles have broader authority. n8n signs with Agent Private Key selected; its deprecated Admin Password path uses administrator Basic only with an empty key. stdio MCP, Pi, LangGraph, and the wake runner can use administrator Basic auth when no signing key resolves. Administrator Basic auth can read private records and write under any agent ID. Choose an integration with its authentication and recall behavior in mind.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -22,9 +22,9 @@ Where Flair already runs. Each integration can reach one shared Flair memory sto
|
|
|
22
22
|
| **OpenClaw** | [`openclaw-flair`](#openclaw) | Ed25519 | Native plugin (context-engine slot left intact) |
|
|
23
23
|
| **n8n** | [`n8n-nodes-flair`](#n8n) | Ed25519 with Agent Private Key selected; deprecated administrator Basic | Three nodes (chat memory, search, store) |
|
|
24
24
|
| **Hermes Agent** | [`hermes-flair`](#hermes-agent) | Ed25519 | Python `MemoryProvider` |
|
|
25
|
-
| **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension
|
|
26
|
-
| **Google ADK** (Python) | [`adk-flair`](
|
|
27
|
-
| **Google ADK** (JS/TS) | [`@tpsdev-ai/adk-flair`](
|
|
25
|
+
| **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension; with `--agent <id>` and wiring enabled, `flair init` attempts Pi wiring for `--client pi`, for detected Pi under `--client all`, or for detected Pi when `--client` is omitted; `--client none` and `--no-mcp` skip it. |
|
|
26
|
+
| **Google ADK** (Python) | [`adk-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair/README.md) | Ed25519 | `BaseMemoryService`; see [hosted auth](#hosted-flair-auth--your-agent-got-a-404) if you just got a 404 |
|
|
27
|
+
| **Google ADK** (JS/TS) | [`@tpsdev-ai/adk-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair-js/README.md) | Ed25519 | Same identity model as the Python package |
|
|
28
28
|
|
|
29
29
|
Don't see your harness? If it speaks **MCP** — Flair already works with `flair-mcp`. For a custom memory protocol such as LangGraph's `BaseStore` or CrewAI's `RAGStorage`, an adapter must translate that protocol's operations to Flair; [open an issue](https://github.com/tpsdev-ai/flair/issues) or [send a PR](https://github.com/tpsdev-ai/flair).
|
|
30
30
|
|
|
@@ -76,8 +76,8 @@ A verified agent that is not allowed the row gets 404, never 403. Anonymous by-i
|
|
|
76
76
|
|
|
77
77
|
| Adapter | URL | Agent id | Keyfile | Hosted extras |
|
|
78
78
|
|---|---|---|---|---|
|
|
79
|
-
| **adk-flair** (Python) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](
|
|
80
|
-
| **adk-flair-js** (JS/TS) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | For a non-localhost URL, set `FLAIR_ALLOW_REMOTE_URL=1`; request timeout comes from constructor `timeoutMs` (default 2000 ms), not `FLAIR_HTTP_TIMEOUT` — [adk-flair-js README](
|
|
79
|
+
| **adk-flair** (Python) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair/README.md#hosted-flair) |
|
|
80
|
+
| **adk-flair-js** (JS/TS) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | For a non-localhost URL, set `FLAIR_ALLOW_REMOTE_URL=1`; request timeout comes from constructor `timeoutMs` (default 2000 ms), not `FLAIR_HTTP_TIMEOUT` — [adk-flair-js README](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair-js/README.md) |
|
|
81
81
|
| **flair-mcp** / Cursor plugin | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` (optional; auto-resolved) | Key must be on the **npx host** |
|
|
82
82
|
| **Hermes** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Hermes `key_path` | Same Ed25519 model |
|
|
83
83
|
| **Pi** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Pi client `keyPath` | Same Ed25519 model |
|
|
@@ -173,7 +173,7 @@ const store = new FlairStore({ agentId: "my-langgraph-agent" });
|
|
|
173
173
|
const agent = createReactAgent({ llm, tools, store });
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Non-empty search queries call Flair's `/SemanticSearch` endpoint. The server selects hybrid (BM25 plus vector), vector-only, or BM25-only retrieval; embedding availability affects whether the vector leg can run. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](
|
|
176
|
+
Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Non-empty search queries call Flair's `/SemanticSearch` endpoint. The server selects hybrid (BM25 plus vector), vector-only, or BM25-only retrieval; embedding availability affects whether the vector leg can run. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/langgraph-flair/README.md).
|
|
177
177
|
|
|
178
178
|
This package contains the TypeScript adapter; it does not include a Python implementation.
|
|
179
179
|
|
|
@@ -187,7 +187,7 @@ This package contains the TypeScript adapter; it does not include a Python imple
|
|
|
187
187
|
openclaw plugins install @tpsdev-ai/openclaw-flair
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern. The host's own workspace files load each agent's `SOUL.md` / `AGENTS.md`; Flair does not manage or anchor these.
|
|
190
|
+
Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern. The host's own workspace files load each agent's `SOUL.md` / `AGENTS.md`; Flair does not manage or anchor these. <!-- docs-freshness-allow: names files in the host's workspace -->
|
|
191
191
|
|
|
192
192
|
---
|
|
193
193
|
|
|
@@ -227,7 +227,7 @@ Auth: TPS-Ed25519 (the same model the rest of Flair uses) — writes are isolate
|
|
|
227
227
|
|
|
228
228
|
## Pi agent
|
|
229
229
|
|
|
230
|
-
[`@tpsdev-ai/pi-flair`](https://www.npmjs.com/package/@tpsdev-ai/pi-flair) is the **native pi extension** for the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent)
|
|
230
|
+
[`@tpsdev-ai/pi-flair`](https://www.npmjs.com/package/@tpsdev-ai/pi-flair) is the **native pi extension** for the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent). Memory + identity (`memory_search`, `memory_store`, `bootstrap`) for the pi runtime.
|
|
231
231
|
|
|
232
232
|
To provision an agent and wire Pi, use the init command below; if the agent is already provisioned, install the extension with Pi's installer.
|
|
233
233
|
|
|
@@ -256,7 +256,7 @@ export FLAIR_AGENT_ID=my-agent # per host/purpose
|
|
|
256
256
|
pi
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
Full details (tools, env reference, auto-recall/auto-capture flags, security notes): [`packages/pi-flair/README.md`](
|
|
259
|
+
Full details (tools, env reference, auto-recall/auto-capture flags, security notes): [`packages/pi-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/pi-flair/README.md).
|
|
260
260
|
|
|
261
261
|
---
|
|
262
262
|
|
package/docs/mcp-clients.md
CHANGED
|
@@ -261,7 +261,7 @@ reports that pending-approval state as configured but delivery not verified.
|
|
|
261
261
|
Some clients have no session-start hook Flair can write. Wiring the MCP
|
|
262
262
|
server is necessary but not sufficient — the model still has to choose to
|
|
263
263
|
call `bootstrap`. Add a short instruction block to the file that client
|
|
264
|
-
already loads (`AGENTS.md`, `GEMINI.md`, or the equivalent):
|
|
264
|
+
already loads (`AGENTS.md`, `GEMINI.md`, or the equivalent): <!-- docs-freshness-allow: names files in the reader's project -->
|
|
265
265
|
|
|
266
266
|
```markdown
|
|
267
267
|
## Flair memory
|
|
@@ -299,7 +299,7 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
|
|
|
299
299
|
| `memory_store` | Save a memory (type, durability, tags, visibility), under the configured agent ID, subject to server authorization. Optional `usedMemoryIds` cites memories that informed the write |
|
|
300
300
|
| `skill_store` | Write a skill-tagged memory. `trigger` is the recall text; `content` is the procedure. Durability is forced to persistent, and SkillScan rejects a dangerous payload before embed |
|
|
301
301
|
| `skill_search` | Rank skills by their trigger against a task. Returns a catalog (id, name, trigger, description, tags, agentId), not the procedure |
|
|
302
|
-
| `skill_get` | Fetch one skill's full procedure by id. Non-admin callers
|
|
302
|
+
| `skill_get` | Fetch one skill's full procedure by id. Non-admin callers use Memory's owner/visibility scope and, for retained closed skills, its current-authority check; administrators are not subject to those restrictions |
|
|
303
303
|
| `memory_update` | Update a memory by id. Overwrites in place, or pass `preserveHistory` to write a superseding version. Optional `usedMemoryIds` |
|
|
304
304
|
| `memory_get` | Fetch a specific memory by ID |
|
|
305
305
|
| `memory_delete` | Delete a memory by ID. Non-admin callers can delete only their own memories; administrators can also delete other agents' memories |
|
|
@@ -313,7 +313,9 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
|
|
|
313
313
|
| `team_directory` | List active agents with published tps-mail contacts. Filter by `id` or `name`; page with `cursor`/`limit` |
|
|
314
314
|
| `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
On the embedded `/mcp` handler, `soul_set` is listed only for a caller the soul write policy's source-authorization step admits (`Soul.post` applies its content guards after that step). That route authenticates callers with OAuth bearer tokens: a token subject mapped to an Agent acts as an agent principal, and the policy refuses an agent principal, so an agent's `tools/list` does not include `soul_set`. Listing resolves the caller the way a call does, except that it never JIT-provisions. An agent's soul is changed by the operator, on the agent's behalf (`flair soul set`).
|
|
317
|
+
|
|
318
|
+
For ordinary signed agents, Flair enforces write ownership server-side: they can write only under their authenticated agent ID. Administrator credentials and administrator agent roles have broader authority. Reads are more open by design: reads use the open-within-org base scope without a grant, with an additional current-authority check for non-admin by-id and collection reads of retained closed skills (see [SECURITY.md](../SECURITY.md)).
|
|
317
319
|
|
|
318
320
|
Which memories are non-private is decided at write time, and the default is not "shared". `memory_store` defaults `durability` to `standard`, and the server derives visibility from durability — `permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private` — so **a bare `memory_store` call creates a private memory: ordinary agents other than its owner cannot read it; administrators retain access.** Pass `visibility: "shared"` (or `"private"`, to be explicit) to say what you mean; the tool reports the visibility the write actually landed on so an agent can confirm it rather than assume.
|
|
319
321
|
|
|
@@ -349,7 +351,7 @@ The MCP server has no client-side flags beyond these env vars; everything else (
|
|
|
349
351
|
|
|
350
352
|
## What about pi?
|
|
351
353
|
|
|
352
|
-
|
|
354
|
+
Flair ships a **native pi extension**: [`@tpsdev-ai/pi-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/pi-flair/README.md). Same backend. With an ordinary signed identity, writes are owned by that agent. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. Zero MCP in the path.
|
|
353
355
|
|
|
354
356
|
Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`), not an `mcpServers` block:
|
|
355
357
|
|
|
@@ -367,7 +369,7 @@ One difference from the MCP clients above: pi settings carry no per-package `env
|
|
|
367
369
|
|
|
368
370
|
## What about Hermes (Nous Research)?
|
|
369
371
|
|
|
370
|
-
Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend. With an ordinary signed identity, writes are owned by that agent
|
|
372
|
+
Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend. With an ordinary signed identity, writes are owned by that agent. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. Different plug shape.
|
|
371
373
|
|
|
372
374
|
Future MCP-capable agent CLIs (and there are more landing every month) will work out of the box with the MCP server above — no per-framework adapter required from us.
|
|
373
375
|
|
|
@@ -84,8 +84,7 @@ cache (e.g. after an unexpected 401).
|
|
|
84
84
|
CLI: `flair mcp token --agent-id <id>` now performs the real mint by
|
|
85
85
|
default; `--dry-run` restores the old sign-and-print behavior.
|
|
86
86
|
`--client-id`/`--token-endpoint`/`--resource` default to this instance's own
|
|
87
|
-
oauth surface (derived from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL
|
|
88
|
-
matching `resources/mcp-oauth-flag.ts`) but are fully overridable — an
|
|
87
|
+
oauth surface (derived from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL`) but are fully overridable — an
|
|
89
88
|
agent can authenticate to a **different** Harper MCP server; identity is
|
|
90
89
|
portable.
|
|
91
90
|
|
|
@@ -93,9 +92,7 @@ portable.
|
|
|
93
92
|
|
|
94
93
|
`buildTokenRequestForm` carries an optional `resource` field, pass-through
|
|
95
94
|
only (it never invents a value). The CLI supplies the default:
|
|
96
|
-
`${FLAIR_MCP_ISSUER}/mcp
|
|
97
|
-
`resources/mcp-oauth-flag.ts`'s `mcpResource()` uses for this instance's own
|
|
98
|
-
`/mcp` audience binding — exact-match, fail-closed on the AS side. The
|
|
95
|
+
`${FLAIR_MCP_ISSUER}/mcp` (falling back to `FLAIR_PUBLIC_URL`). The
|
|
99
96
|
`resource` is part of the token-cache key: a token minted for one resource
|
|
100
97
|
never serves another.
|
|
101
98
|
|
|
@@ -104,7 +101,7 @@ never serves another.
|
|
|
104
101
|
Each agent's Client ID Metadata Document is **served**, not just generated:
|
|
105
102
|
`GET /MCPClientMetadata/{agentId}` (public, unauthenticated — mirrors
|
|
106
103
|
`AgentCard.ts`'s A2A-card posture). `client_id` = that URL itself (derived
|
|
107
|
-
from `
|
|
104
|
+
from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL`); `jwks` = the agent's existing
|
|
108
105
|
`Agent.publicKey` re-expressed as a JWK OKP.
|
|
109
106
|
|
|
110
107
|
Why served rather than exported for external hosting: Flair already
|
|
@@ -216,9 +213,7 @@ in-process proof, not measured; everything else above is measured.
|
|
|
216
213
|
Whoever owns the AS-side `@harperfast/oauth` config for a given Harper
|
|
217
214
|
instance MUST add this Flair instance's `MCPClientMetadata` host to
|
|
218
215
|
`clientIdMetadataDocuments.allowedHosts`. That host is derived from
|
|
219
|
-
`FLAIR_MCP_ISSUER` (or `FLAIR_PUBLIC_URL` as fallback)
|
|
220
|
-
`mcpIssuer()` in `resources/mcp-oauth-flag.ts` and `defaultMcpClientId()` in
|
|
221
|
-
`src/mcp-client-assertion.ts` both read. If the allowlist isn't updated,
|
|
216
|
+
`FLAIR_MCP_ISSUER` (or `FLAIR_PUBLIC_URL` as fallback). If the allowlist isn't updated,
|
|
222
217
|
`/mcp` client_credentials auth for this agent fails closed (by design; the
|
|
223
218
|
e2e proves the "Unknown client" rejection live). This is an operational
|
|
224
219
|
step, not a code change; flag it explicitly when coordinating a rollout.
|
|
@@ -157,12 +157,12 @@ registered identities.
|
|
|
157
157
|
credentials.
|
|
158
158
|
|
|
159
159
|
2. **Set the env:**
|
|
160
|
-
- `FLAIR_MCP_OAUTH=true` —
|
|
161
|
-
component
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- `FLAIR_MCP_ISSUER=https://your-public-origin` (
|
|
160
|
+
- `FLAIR_MCP_OAUTH=true` — the recommended value, which both readers accept
|
|
161
|
+
(the component trims it and ignores case, but `1`, `yes` and `on` leave it
|
|
162
|
+
disabled); the authorization
|
|
163
|
+
server also needs the issuer and provider credentials. An instance enabled
|
|
164
|
+
before 0.46 may still have `FLAIR_MCP_OAUTH=1`.
|
|
165
|
+
- `FLAIR_MCP_ISSUER=https://your-public-origin` — a bare HTTP(S) origin.
|
|
166
166
|
- `OAUTH_GITHUB_CLIENT_ID`, `OAUTH_GITHUB_CLIENT_SECRET` and
|
|
167
167
|
`OAUTH_GITHUB_REDIRECT_URI=https://your-public-origin/oauth` — staged by
|
|
168
168
|
`flair mcp enable` using `--issuer` (default: `--instance`).
|
package/docs/openclaw.md
CHANGED
|
@@ -83,7 +83,7 @@ Without `hooks.allowPromptInjection` the plugin contributes no context and logs
|
|
|
83
83
|
|
|
84
84
|
## Multi-Agent
|
|
85
85
|
|
|
86
|
-
Each OpenClaw agent writes with its `agentId` as a field (tags are optional); reads use owner plus visibility.
|
|
86
|
+
Each OpenClaw agent writes with its `agentId` as a field (tags are optional); reads use owner plus visibility. The base memory scope includes the reader's own records and other agents' non-private records; non-admin by-id and collection reads additionally check current authority for retained closed skills, and grants do not expand the read scope.
|
|
87
87
|
|
|
88
88
|
```bash
|
|
89
89
|
flair agent add research-agent
|
|
@@ -89,7 +89,7 @@ In Cursor: **Plugins → Configure**
|
|
|
89
89
|
| `FLAIR_URL` | `https://<cluster>.<org>.harperfabric.com` |
|
|
90
90
|
| `FLAIR_AGENT_ID` | `mybot` (the id you just added) |
|
|
91
91
|
|
|
92
|
-
Those are the two plugin schema fields. Local Cursor's `npx` can use the key from step 3 at `~/.flair/keys/mybot.key`. A cloud agent's `npx` runs on a different machine — that VM needs the key (or host-env admin credentials). See [`packages/cursor-flair/README.md`](
|
|
92
|
+
Those are the two plugin schema fields. Local Cursor's `npx` can use the key from step 3 at `~/.flair/keys/mybot.key`. A cloud agent's `npx` runs on a different machine — that VM needs the key (or host-env admin credentials). See [`packages/cursor-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/cursor-flair/README.md).
|
|
93
93
|
|
|
94
94
|
## 5. Wire a Grok Bot agent
|
|
95
95
|
|
|
@@ -121,7 +121,7 @@ Same connector, different panel. This is the field-verified sequence — includi
|
|
|
121
121
|
|
|
122
122
|
5. The next tool call picks up the key — a miss is not cached. A 401 names the agent and the paths that were looked in. If those are not where `flair agent add` wrote the file, the MCP process's home differs from the shell; set `FLAIR_KEY_PATH` to the absolute path of the `.key` file.
|
|
123
123
|
|
|
124
|
-
6. Verify: ask the agent to "load my Flair bootstrap". You should get soul + memories **including shared org context** — findings written by teammate agents. A shared-visibility write from this agent
|
|
124
|
+
6. Verify: ask the agent to "load my Flair bootstrap". You should get soul + memories **including shared org context** — findings written by teammate agents. A shared-visibility write from this agent passes every org agent's base visibility check; non-admin Memory by-id and collection reads of retained closed skills also apply the current-authority check.
|
|
125
125
|
|
|
126
126
|
**Account-wide connectors are shared.** A connector added at the Grok Bot account level is one identity used by every agent on that account. For per-agent identity, give each agent its own MCP entry with its own `FLAIR_AGENT_ID` — and register each id (steps 2–5).
|
|
127
127
|
|
package/docs/quickstart.md
CHANGED
|
@@ -154,7 +154,7 @@ flair memory add --agent local --visibility shared \
|
|
|
154
154
|
|
|
155
155
|
`--visibility` takes exactly `private` or `shared` — a value it doesn't recognise is an error, not a guess — and overrides the durability rule in both directions. The `visibility` field in the response is the value the memory actually landed on, so read it rather than assuming.
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
A shared memory passes every agent's base visibility check without a grant; retained closed skills additionally require readable current authority on non-admin by-id and collection reads. That is the shipped model: reads open within one instance, closed at the federation edge. Full picture in [SECURITY.md](../SECURITY.md).
|
|
158
158
|
|
|
159
159
|
## 5. Find it back by meaning
|
|
160
160
|
|
|
@@ -177,7 +177,7 @@ Add `--explain` to see the ranking inputs per hit — the raw score, the composi
|
|
|
177
177
|
|
|
178
178
|
## 6. Give your agent context on boot
|
|
179
179
|
|
|
180
|
-
With MCP wired
|
|
180
|
+
With MCP wired, the recommended session-start tool is `bootstrap`. In Claude Code that appears as `mcp__flair__bootstrap` (Claude Code's namespaced name for the server's `bootstrap` tool). Add this to your `CLAUDE.md`: <!-- docs-freshness-allow: names a file in the reader's project -->
|
|
181
181
|
|
|
182
182
|
```
|
|
183
183
|
At the start of every session, run mcp__flair__bootstrap before responding.
|
|
@@ -202,7 +202,7 @@ Soul entries and relevant memories, in one block sized to a token budget. Paste
|
|
|
202
202
|
| You want to... | Go to |
|
|
203
203
|
|----------------|-------|
|
|
204
204
|
| Add more agents to the same instance | `flair agent add <id>` |
|
|
205
|
-
| Share a memory with your other agents | `flair memory add --visibility shared` — a bare write lands `private`, see [step 4](#who-can-read-it); a shared
|
|
205
|
+
| Share a memory with your other agents | `flair memory add --visibility shared` — a bare write lands `private`, see [step 4](#who-can-read-it); a shared memory passes the instance-wide base visibility check without a grant; non-admin Memory by-id and collection reads of retained closed skills also apply the current-authority check ([auth.md](auth.md)) |
|
|
206
206
|
| Import memories from agentic-stack / Mem0 / etc. | [bridges.md](bridges.md) |
|
|
207
207
|
| Sync memories across machines | [federation.md](federation.md) |
|
|
208
208
|
| Integrate with OpenClaw, Claude Code, Cursor | [README.md#integration](../README.md#integration) |
|