@tpsdev-ai/flair 0.59.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/SECURITY.md +49 -5
- package/config.yaml +23 -12
- package/dist/bridges/builtins/mem0.js +63 -28
- package/dist/bridges/runtime/execute.js +1 -0
- package/dist/bridges/runtime/import-runner.js +12 -0
- package/dist/bridges/runtime/load-plugin.js +42 -13
- package/dist/bridges/runtime/yaml-loader.js +4 -2
- package/dist/bridges/types.js +1 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +1054 -367
- package/dist/commands/agent.js +233 -90
- package/dist/commands/attention.js +4 -3
- package/dist/commands/backup-approval.js +218 -0
- package/dist/commands/backup.js +211 -39
- package/dist/commands/bootstrap.js +3 -1
- package/dist/commands/bridge.js +172 -119
- package/dist/commands/deploy.js +71 -8
- package/dist/commands/doctor.js +711 -146
- package/dist/commands/export.js +57 -23
- package/dist/commands/federation.js +787 -82
- package/dist/commands/grant.js +5 -6
- package/dist/commands/help.js +25 -0
- package/dist/commands/hook.js +155 -2
- package/dist/commands/idp.js +27 -19
- package/dist/commands/import.js +136 -20
- package/dist/commands/init.js +469 -200
- package/dist/commands/integrity.js +387 -0
- package/dist/commands/keys.js +247 -58
- package/dist/commands/mcp.js +108 -52
- package/dist/commands/memory.js +203 -35
- package/dist/commands/migrate-harness-memory.js +3 -2
- package/dist/commands/orgevent.js +51 -47
- package/dist/commands/presence.js +4 -3
- package/dist/commands/principal.js +428 -62
- package/dist/commands/quality.js +13 -1
- package/dist/commands/reembed.js +141 -17
- package/dist/commands/relationship.js +2 -1
- package/dist/commands/rem.js +537 -80
- package/dist/commands/restore.js +413 -65
- package/dist/commands/search.js +6 -4
- package/dist/commands/service.js +235 -40
- package/dist/commands/soul.js +4 -9
- package/dist/commands/status.js +94 -38
- package/dist/commands/test.js +7 -3
- package/dist/commands/upgrade.js +77 -23
- package/dist/commands/workspace.js +13 -11
- package/dist/component-env.js +31 -41
- package/dist/deploy.js +136 -4
- package/dist/doctor-client.js +534 -92
- package/dist/engine-version-contract.js +1 -0
- package/dist/engine-version.js +23 -3
- package/dist/fabric-upgrade.js +12 -2
- package/dist/federation/presence-send.js +139 -0
- package/dist/federation-verify.js +273 -180
- package/dist/hook-install.js +670 -6
- package/dist/install/clients.js +171 -35
- package/dist/keystore.js +72 -0
- package/dist/lib/action-recall-runtime.js +328 -0
- package/dist/lib/agent-home-fields.js +132 -0
- package/dist/lib/agent-home.js +427 -0
- package/dist/lib/agent-id-rule.js +88 -0
- package/dist/lib/agent-roster.js +33 -0
- package/dist/lib/atomic-write.js +1 -1
- package/dist/lib/auth-resolve.js +1069 -60
- package/dist/lib/backup-approval-store.js +612 -0
- package/dist/lib/backup-artifact.js +343 -0
- package/dist/lib/capture-runtime.js +124 -0
- package/dist/lib/config-critical-section.js +212 -25
- package/dist/lib/connect-phase.js +33 -0
- package/dist/lib/credential-status-rule.js +78 -0
- package/dist/lib/daemon-liveness.js +43 -11
- package/dist/lib/doctor-run.js +75 -37
- package/dist/lib/durability-copy.js +10 -0
- package/dist/lib/embedding-space-doctor.js +75 -0
- 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/flair-agent-role.js +4 -0
- package/dist/lib/hub-url.js +12 -0
- package/dist/lib/init-admin-pass.js +88 -12
- package/dist/lib/init-listener-environ.js +1 -2
- package/dist/lib/init-occupied-listener.js +15 -111
- package/dist/lib/init-spawn-attribution.js +73 -0
- package/dist/lib/init-tcp-probe.js +33 -0
- package/dist/lib/instance-identity-row.js +20 -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 +38 -3
- package/dist/lib/listener-table.js +268 -0
- package/dist/lib/local-delete-instance.js +27 -0
- package/dist/lib/local-instance-pair.js +256 -0
- package/dist/lib/mcp-enable.js +1182 -341
- package/dist/lib/mcp-oauth-env-core.js +133 -0
- package/dist/lib/mcp-oauth-env.js +125 -0
- package/dist/lib/mcp-spec.js +17 -1
- package/dist/lib/memory-attributes.js +4 -0
- package/dist/lib/memory-id-policy.js +46 -0
- package/dist/lib/memory-integrity.js +309 -0
- package/dist/lib/memory-provider-timeout.js +33 -0
- package/dist/lib/memory-purge-response.js +20 -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-table-count.js +25 -0
- package/dist/lib/ops-url.js +52 -0
- package/dist/lib/owned-pins.js +67 -10
- package/dist/lib/peer-status.js +27 -0
- package/dist/lib/principal-status.js +29 -0
- package/dist/lib/process-start-time.js +76 -12
- package/dist/lib/promotion-content-hash.js +20 -0
- package/dist/lib/proto-safe-record.js +42 -0
- package/dist/lib/record-id-path.js +25 -0
- package/dist/lib/reembed-server-support.js +66 -0
- package/dist/lib/restore-archive.js +760 -0
- package/dist/lib/restore-verify.js +104 -0
- package/dist/lib/scheduler-platform.js +10 -6
- package/dist/lib/secret-keys.js +25 -0
- package/dist/lib/secrets-push.js +50 -22
- package/dist/lib/skill-assignment-preflight.js +159 -0
- package/dist/lib/skill-seed-pending.js +24 -0
- package/dist/lib/skill-seed.js +448 -0
- package/dist/lib/skill-tombstone-doctor.js +133 -0
- package/dist/lib/soul-scope-fields.js +26 -0
- package/dist/lib/stop-start-recovery.js +54 -0
- package/dist/lib/uninstall-purge.js +266 -11
- package/dist/lib/upgrade-prior-liveness.js +2 -1
- package/dist/lib/using-flair-skill.js +87 -0
- package/dist/mcp-client-assertion.js +114 -14
- package/dist/memory-id-checkpoint.js +347 -0
- package/dist/memory-node-compare.js +207 -0
- package/dist/mqtt-off-deploy.js +550 -0
- package/dist/packages/flair-mcp/src/secret-redaction.js +113 -0
- package/dist/rem/promote-policy.js +3 -3
- package/dist/rem/restore.js +303 -26
- package/dist/rem/runner.js +317 -96
- 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 +463 -33
- package/dist/resources/AgentCard.js +4 -0
- package/dist/resources/AgentKeyRegister.js +248 -0
- package/dist/resources/AgentKeyRegistration.js +28 -0
- package/dist/resources/AgentReadPosition.js +7 -0
- package/dist/resources/AgentSeed.js +238 -107
- package/dist/resources/AutoPromoteCandidates.js +413 -78
- package/dist/resources/Credential.js +183 -10
- package/dist/resources/Federation.js +915 -145
- package/dist/resources/FederationRetry.js +140 -0
- package/dist/resources/InstructionVersion.js +220 -0
- package/dist/resources/Integration.js +300 -25
- package/dist/resources/MCPClientMetadata.js +6 -3
- package/dist/resources/Memory.js +3300 -758
- package/dist/resources/MemoryArchive.js +171 -53
- package/dist/resources/MemoryBootstrap.js +122 -61
- package/dist/resources/MemoryCandidate.js +37 -3
- package/dist/resources/MemoryConsolidate.js +2 -2
- package/dist/resources/MemoryDedupStats.js +30 -1
- package/dist/resources/MemoryFeed.js +545 -50
- package/dist/resources/MemoryGrant.js +21 -1
- package/dist/resources/MemoryMaintenance.js +368 -46
- package/dist/resources/MemoryPurge.js +348 -0
- package/dist/resources/MemoryReflect.js +71 -12
- package/dist/resources/MemoryReindex.js +111 -17
- package/dist/resources/Message.js +16 -5
- package/dist/resources/OAuth.js +342 -48
- package/dist/resources/OAuthClient.js +1 -1
- package/dist/resources/OrgEvent.js +405 -19
- 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 +166 -51
- package/dist/resources/PromoteMemoryCandidate.js +24 -7
- package/dist/resources/RecordUsage.js +2 -4
- package/dist/resources/Relationship.js +23 -0
- package/dist/resources/SemanticSearch.js +63 -32
- package/dist/resources/Soul.js +191 -76
- package/dist/resources/SoulFeed.js +2 -1
- package/dist/resources/TeamDirectory.js +35 -0
- package/dist/resources/WorkspaceLatest.js +4 -0
- package/dist/resources/WorkspaceState.js +21 -1
- package/dist/resources/XAA.js +207 -63
- 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 +138 -83
- 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 +534 -171
- 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/ed25519-auth.js +1 -1
- package/dist/resources/embedding-space-guard.js +366 -72
- package/dist/resources/embeddings-provider.js +25 -0
- package/dist/resources/engine-version-stamp-boot.js +53 -0
- package/dist/resources/federation-classify.js +161 -0
- package/dist/resources/federation-crypto.js +5 -5
- package/dist/resources/federation-retry-lib.js +60 -0
- package/dist/resources/grant-visibility.js +135 -0
- package/dist/resources/harper-routing.js +83 -0
- package/dist/resources/health.js +163 -22
- package/dist/resources/host-pointer/registry.js +29 -0
- package/dist/resources/host-pointer-adapter.js +1 -0
- package/dist/resources/host-source-citation.js +49 -0
- package/dist/resources/host-source-visibility.js +7 -6
- package/dist/resources/in-process.js +24 -22
- package/dist/resources/instance-create-lock.js +17 -0
- package/dist/resources/instance-identity.js +23 -0
- package/dist/resources/instruction-version-record.js +587 -0
- package/dist/resources/internal-authority.js +13 -0
- package/dist/resources/key-lock.js +3 -3
- package/dist/resources/mcp-handler.js +141 -19
- package/dist/resources/mcp-oauth-env-guard.js +36 -0
- package/dist/resources/mcp-oauth-flag.js +12 -14
- package/dist/resources/mcp-oauth.js +450 -56
- package/dist/resources/mcp-tool-arguments.js +4 -6
- package/dist/resources/mcp-tools.js +187 -40
- package/dist/resources/memory-bootstrap-lib.js +5 -15
- package/dist/resources/memory-declared-attributes.js +4 -1
- package/dist/resources/memory-deletion-history.js +55 -0
- package/dist/resources/memory-durability.js +54 -0
- package/dist/resources/memory-embed-hash.js +144 -0
- package/dist/resources/memory-embedding-value.js +8 -0
- package/dist/resources/memory-host-source.js +32 -7
- package/dist/resources/memory-id-guard.js +75 -0
- package/dist/resources/memory-redaction.js +236 -0
- package/dist/resources/memory-reflect-lib.js +1 -1
- package/dist/resources/memory-supplied-vector.js +72 -0
- package/dist/resources/memory-write-lock.js +489 -0
- package/dist/resources/memory-write-response.js +139 -0
- 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 +90 -19
- package/dist/resources/migrations/dir-safety.js +61 -3
- package/dist/resources/migrations/embedding-stamp.js +462 -82
- package/dist/resources/migrations/export.js +1 -0
- package/dist/resources/migrations/graph-heal.js +27 -27
- package/dist/resources/migrations/ledger.js +5 -2
- package/dist/resources/migrations/lock.js +870 -77
- package/dist/resources/migrations/progress.js +71 -10
- package/dist/resources/migrations/runner.js +212 -18
- package/dist/resources/migrations/snapshot.js +1 -0
- package/dist/resources/migrations/source-fields.js +5 -5
- package/dist/resources/migrations/state.js +36 -1
- package/dist/resources/migrations/status.js +2 -13
- package/dist/resources/migrations/synthetic-test-migration.js +81 -12
- package/dist/resources/migrations/types.js +26 -1
- package/dist/resources/migrations/visibility-backfill.js +113 -72
- package/dist/resources/oauth-discovery.js +0 -5
- package/dist/resources/object-body-guard.js +40 -0
- package/dist/resources/org-event-created-at.js +133 -0
- package/dist/resources/org-event-reserved.js +92 -0
- package/dist/resources/org-event-write-fault.js +19 -0
- package/dist/resources/originator-instance.js +39 -7
- package/dist/resources/owner-delete-recheck.js +78 -0
- package/dist/resources/owner-field-guard.js +39 -5
- package/dist/resources/owner-scoped-write-policy.js +256 -0
- package/dist/resources/owner-scoped-writes.js +89 -0
- package/dist/resources/path-id-rewrite.js +76 -0
- package/dist/resources/presence-internal.js +5 -5
- package/dist/resources/presence-receipt.js +236 -0
- package/dist/resources/promotion-binding.js +43 -0
- package/dist/resources/promotion-stamp.js +143 -17
- package/dist/resources/protocol-context.js +189 -0
- package/dist/resources/record-owner-guard.js +74 -26
- package/dist/resources/record-type-kit.js +2 -4
- package/dist/resources/record-types.js +1 -1
- package/dist/resources/relay-ops.js +78 -6
- package/dist/resources/replay-store.js +96 -19
- package/dist/resources/request-target.js +163 -0
- package/dist/resources/request-transaction.js +46 -1
- package/dist/resources/search-readiness.js +4 -1
- package/dist/resources/seed-ids.js +9 -0
- package/dist/resources/seed-reservation.js +116 -0
- package/dist/resources/semantic-retrieval-core.js +27 -15
- package/dist/resources/server-row-validation.js +71 -0
- package/dist/resources/skill-manifest.js +24 -14
- package/dist/resources/skill-subject.js +53 -0
- package/dist/resources/skill-version-write.js +789 -0
- package/dist/resources/skill-write-fault.js +20 -0
- package/dist/resources/skill-write-policy.js +68 -0
- package/dist/resources/skill-write.js +67 -7
- package/dist/resources/soul-write-policy.js +26 -7
- package/dist/resources/table-helpers.js +10 -7
- package/dist/resources/table-subscription-policy.js +518 -85
- package/dist/resources/table-subscriptions.js +20 -7
- package/dist/resources/team-directory.js +248 -0
- package/dist/resources/tool-descriptors/index.js +69 -8
- package/dist/resources/txn-pause-point.js +235 -0
- package/dist/resources/usage-recording.js +186 -70
- package/dist/resources/write-back.js +383 -0
- package/dist/resources/write-journal-context.js +5 -0
- package/dist/resources/write-journal.js +289 -0
- package/dist/src/engine-version-contract.js +1 -0
- package/dist/src/keystore.js +72 -0
- package/dist/src/lib/agent-home-fields.js +132 -0
- package/dist/src/lib/agent-id-rule.js +88 -0
- package/dist/src/lib/agent-key-register.js +80 -0
- package/dist/src/lib/atomic-write.js +256 -0
- package/dist/src/lib/credential-status-rule.js +78 -0
- package/dist/src/lib/expired-by-agent.js +37 -0
- package/dist/src/lib/federation-retry-row.js +101 -0
- package/dist/src/lib/flair-agent-role.js +4 -0
- package/dist/src/lib/idp-mapping-rule.js +81 -0
- package/dist/src/lib/instance-identity-row.js +20 -0
- package/dist/src/lib/instruction-event-contract.js +17 -0
- package/dist/src/lib/mcp-oauth-env-core.js +133 -0
- package/dist/src/lib/memory-attributes.js +4 -0
- package/dist/src/lib/memory-id-policy.js +46 -0
- package/dist/src/lib/open-live-row.js +20 -0
- package/dist/src/lib/principal-status.js +29 -0
- package/dist/src/lib/proto-safe-record.js +42 -0
- package/dist/src/lib/reembed-server-support.js +66 -0
- package/dist/src/lib/scheduler-platform.js +10 -6
- package/dist/src/lib/soul-scope-fields.js +26 -0
- package/dist/src/lib/systemd-agent-id.js +38 -0
- package/dist/src/rem/promote-policy.js +3 -3
- package/dist/src/rem/scheduler.js +21 -4
- package/docs/access-control.md +164 -54
- package/docs/api-reference.md +165 -32
- package/docs/auth.md +46 -30
- package/docs/bridges.md +11 -0
- package/docs/claude-code.md +37 -7
- package/docs/deploying-on-fabric.md +178 -0
- package/docs/deployment.md +19 -0
- package/docs/embedding-in-a-harper-app.md +17 -15
- package/docs/entity-vocabulary.md +3 -6
- package/docs/federation.md +61 -3
- package/docs/hosted-on-fabric.md +43 -36
- package/docs/integrations.md +14 -14
- package/docs/mcp-clients.md +12 -7
- package/docs/n8n.md +17 -11
- package/docs/notes/mcp-agent-auth-consumer.md +16 -13
- package/docs/notes/mcp-oauth-model2.md +40 -11
- package/docs/openclaw.md +1 -1
- package/docs/quickstart-fabric.md +4 -4
- package/docs/quickstart.md +12 -4
- package/docs/releasing.md +25 -19
- package/docs/rem.md +32 -3
- package/docs/secrets-and-keys.md +21 -4
- package/docs/standalone-local.md +30 -2
- package/docs/supply-chain-policy.md +34 -16
- package/docs/the-team.md +2 -2
- package/docs/upgrade.md +46 -6
- package/package.json +24 -12
- package/schemas/agent-key-registration.graphql +22 -0
- package/schemas/agent.graphql +6 -3
- package/schemas/federation.graphql +41 -1
- package/schemas/memory.graphql +91 -7
- package/schemas/oauth.graphql +19 -0
- package/schemas/schema.graphql +2 -0
- 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/docs/api-reference.md
CHANGED
|
@@ -6,7 +6,7 @@ adopter does not have to read `resources/` or `schemas/` to see what is
|
|
|
6
6
|
callable.
|
|
7
7
|
|
|
8
8
|
- **Auth model:** [docs/auth.md](auth.md), [SECURITY.md](../SECURITY.md)
|
|
9
|
-
- **Access invariant:** [DESIGN.md](
|
|
9
|
+
- **Access invariant:** [DESIGN.md](https://github.com/tpsdev-ai/flair/blob/main/DESIGN.md) — open within the org, closed
|
|
10
10
|
at the federation edge
|
|
11
11
|
- **Federation pairing and sync:** [docs/federation.md](federation.md)
|
|
12
12
|
- **Source of truth for tables:** [`schemas/*.graphql`](../schemas/)
|
|
@@ -56,8 +56,9 @@ the schema section so the catalog is complete.
|
|
|
56
56
|
| **Federation body-sig** | Ed25519 over the request body + timestamp/nonce; pairing uses a one-time token | `/FederationPair`, `/FederationSync`. Harper role gate is open; the handler is the auth boundary. |
|
|
57
57
|
| **OAuth bearer** | Access token from Flair's AS or `@harperfast/oauth` | `/mcp` only, and only when `FLAIR_MCP_OAUTH=true` plus a public issuer. Off by default (path 404s). |
|
|
58
58
|
|
|
59
|
-
Anonymous HTTP is denied on every agent-facing table (and on `GET /Presence`, which needs a verified reader unless the instance enables the public-roster opt-in).
|
|
60
|
-
|
|
59
|
+
Anonymous HTTP is denied on every agent-facing table (and on `GET /Presence`, which needs a verified reader unless the instance enables the public-roster opt-in). By-id refusal
|
|
60
|
+
status is resource-specific: Memory returns **404** for missing or unreadable rows, while Credential
|
|
61
|
+
refuses a non-admin's by-id read of another principal's credential.
|
|
61
62
|
|
|
62
63
|
**PATCH updates existing rows.** On every table, a PATCH from a caller that is
|
|
63
64
|
not an administrator or a trusted internal call does not create or modify its
|
|
@@ -74,7 +75,55 @@ or an admin agent) and trusted internal callers only. A verified non-admin
|
|
|
74
75
|
agent is refused with **403** (WebSocket close code 3003), and a caller without
|
|
75
76
|
a valid credential with **401** (close code 3000). Verified agents receive
|
|
76
77
|
changes to the memories they can read through `/FeedMemories`, and soul changes
|
|
77
|
-
through `/FeedSouls`; neither is a table.
|
|
78
|
+
through `/FeedSouls`; neither is a table. Harper's native MCP
|
|
79
|
+
`resources/subscribe`, available only when an operator configures Harper's MCP
|
|
80
|
+
component, refuses every table subscription, administrators included: flair
|
|
81
|
+
does not yet verify the Harper user of an MCP session as a flair caller. For
|
|
82
|
+
the same reason, that component's application tools (`get_`, `search_`,
|
|
83
|
+
`create_`, `update_`, `delete_`) are resolved, wherever flair resolves a
|
|
84
|
+
caller, as a caller without a valid credential, administrators included.
|
|
85
|
+
|
|
86
|
+
Flair's local installs run Harper with MQTT off. For a component deployment,
|
|
87
|
+
`flair deploy` and `flair upgrade --target` by default set MQTT off in the
|
|
88
|
+
target's configuration, request the shared worker threads' restart that
|
|
89
|
+
applies it for an isolated application, and read the saved configuration back
|
|
90
|
+
after the deploy's restart (`--keep-mqtt-config` skips all of it;
|
|
91
|
+
`--no-restart` and `--no-verify` skip the restart request and the read-back);
|
|
92
|
+
they do not probe the listeners
|
|
93
|
+
([deploying-on-fabric.md](deploying-on-fabric.md#mqtt-configuration)). When an
|
|
94
|
+
operator turns MQTT on, an exported table's path is also an MQTT topic (`<Table>/#`,
|
|
95
|
+
`<Table>/<id>`) — except a path that a resource other than the table serves
|
|
96
|
+
(`AgentReadPosition`, `OAuthToken`), which follows that resource's own rules.
|
|
97
|
+
On a table topic, these MQTT actions are served to administrators and trusted
|
|
98
|
+
internal callers only: SUBSCRIBE; PUBLISH; a retained PUBLISH (which writes
|
|
99
|
+
the row, or with an empty payload deletes it); and a session's last-will when
|
|
100
|
+
Harper publishes it. UNSUBSCRIBE is not guarded: it only ends a subscription
|
|
101
|
+
the session already holds. CONNECT is Harper's own authentication.
|
|
102
|
+
|
|
103
|
+
Over MQTT 5, a refused SUBSCRIBE gets SUBACK reason code `0x87` (not
|
|
104
|
+
authorized) for a verified non-admin agent and for a caller without a login
|
|
105
|
+
whose session Harper admits (Harper may instead refuse that
|
|
106
|
+
caller at CONNECT). A refused PUBLISH is answered only when it asks for an
|
|
107
|
+
acknowledgment: at QoS 1 (PUBACK) or QoS 2 (PUBREC) it gets the same codes, and
|
|
108
|
+
a verified non-admin agent's also carries the refusal as a reason string unless
|
|
109
|
+
the client turned problem information off or the string would exceed its
|
|
110
|
+
maximum packet size. A refused QoS 0 PUBLISH gets no answer. Over MQTT 3.1.1, a
|
|
111
|
+
refused SUBSCRIBE gets SUBACK `0x80`, and a PUBACK carries no reason code, so a
|
|
112
|
+
PUBACK alone cannot tell a refused PUBLISH from an accepted one. A refused
|
|
113
|
+
publish reaches no subscriber, and a refused retained publish leaves the row as
|
|
114
|
+
it was.
|
|
115
|
+
|
|
116
|
+
A session's last-will message is decided when Harper publishes it: when the
|
|
117
|
+
session drops without DISCONNECT, as that session's own publish; and when
|
|
118
|
+
Harper replays the eligible wills it still holds as its first worker starts,
|
|
119
|
+
as a caller without a valid credential, so a replayed will on a table topic is
|
|
120
|
+
refused, an administrator's included. Harper drops an expired scoped-token
|
|
121
|
+
will before this check, on replay and when a session drops. Over MQTT on
|
|
122
|
+
WebSocket the credential is
|
|
123
|
+
the one on the WebSocket upgrade request, as for SSE and WebSocket. An MQTT
|
|
124
|
+
connection on Harper's TCP or TLS listener carries no HTTP request, so flair
|
|
125
|
+
resolves the caller of each of its actions as one without a valid credential,
|
|
126
|
+
whatever it sent in CONNECT.
|
|
78
127
|
|
|
79
128
|
Every Ed25519-signed request and federation body carries a nonce, recorded
|
|
80
129
|
once per instance in the `ReplayNonce` table before the request takes effect.
|
|
@@ -89,18 +138,18 @@ From `RECORD_TYPES` in `resources/record-types.ts`:
|
|
|
89
138
|
|
|
90
139
|
| Scope | Meaning | Tables |
|
|
91
140
|
|-------|---------|--------|
|
|
92
|
-
| **open-within-org** |
|
|
141
|
+
| **open-within-org** | Base scope: own rows at any visibility plus other agents' non-private rows; non-admin Memory by-id and collection reads of retained closed skills additionally require readable current authority. | Memory |
|
|
93
142
|
| **owner-only** | Only the owning agent (plus admin / internal) | Relationship, WorkspaceState, Asset, MemoryCandidate |
|
|
94
143
|
| **none** | Any verified agent reads every row; no visibility field | Soul, OrgEvent, OrgSkillAssignment |
|
|
95
144
|
|
|
96
|
-
|
|
97
|
-
own resource:
|
|
145
|
+
The following resources implement their read scopes outside `RECORD_TYPES`.
|
|
98
146
|
|
|
99
147
|
| Scope | Meaning | Table | Enforced in |
|
|
100
148
|
|-------|---------|-------|-------------|
|
|
101
149
|
| **party** | Sender or recipient only | Message | `resources/Message.ts` |
|
|
102
150
|
| **own-ledger** | Non-admin reads: only the contributing agent's rows, about memories it can read. Admin / internal reads: unfiltered | MemoryUsage | `resources/MemoryUsage.ts` |
|
|
103
151
|
| **owner-or-grantee** | Either party on the grant | MemoryGrant | `resources/MemoryGrant.ts` |
|
|
152
|
+
| **owner-only** | Non-admin reads match `principalId` to the caller; administrator/internal reads are unfiltered | Credential | `resources/Credential.ts` |
|
|
104
153
|
|
|
105
154
|
Writes stamp `agentId` (or `authorId` / `from`) from the authenticated
|
|
106
155
|
principal. A body that names a different owner is rejected or overwritten
|
|
@@ -126,7 +175,27 @@ is `GET /Name/<id>` unless noted.
|
|
|
126
175
|
| GET | `/HealthDetail` | Ed25519 | Rich stats (counts, agents, migration). `bm25.summary` is this worker's lexical index: `building N/M docs`, `ready · N docs`, or `disabled — reason`. |
|
|
127
176
|
| GET | `/AgentCard/<agentId>` | Public | A2A agent-card; field-allowlisted. |
|
|
128
177
|
| GET | `/a2a`, `/A2AAdapter` | Public | A2A discovery. |
|
|
129
|
-
| POST | `/a2a`, `/A2AAdapter` | Ed25519 | JSON-RPC actions (writes OrgEvents, reads tasks). GET-only is public; POST is not. |
|
|
178
|
+
| POST | `/a2a`, `/A2AAdapter` | Ed25519 | JSON-RPC actions (writes OrgEvents, streams an agent's OrgEvents, reads tasks). GET-only is public; POST is not. Methods: [A2A JSON-RPC](#a2a-json-rpc-post-a2a). |
|
|
179
|
+
|
|
180
|
+
#### A2A JSON-RPC (`POST /a2a`)
|
|
181
|
+
|
|
182
|
+
`POST /a2a` takes a JSON-RPC 2.0 request and requires a `TPS-Ed25519`
|
|
183
|
+
signature or admin Basic auth. A request with neither is answered with error
|
|
184
|
+
`-32001` `Unauthorized`.
|
|
185
|
+
|
|
186
|
+
**Caller match (`message/send` and `message/stream` only).** For these two
|
|
187
|
+
methods `params.agentId` must be the caller's own agent id when the caller is
|
|
188
|
+
not an admin; any other id is answered with error `-32001` `Forbidden`, whose
|
|
189
|
+
`data.detail` names the method (`caller <a> cannot send as <b>`, `caller <a>
|
|
190
|
+
cannot stream as <b>`). An admin caller may name another agent. `tasks/list`
|
|
191
|
+
does not apply this rule: its `params.agentId` is only an assignee filter.
|
|
192
|
+
|
|
193
|
+
| Method | What it does |
|
|
194
|
+
|--------|--------------|
|
|
195
|
+
| `message/send` | Writes an `a2a.message` OrgEvent authored by `params.agentId`, targeted at `params.toAgentId`, or at `params.agentId` when that is omitted. |
|
|
196
|
+
| `message/stream` | Answers with a `text/event-stream` of OrgEvents for `params.agentId`: the events targeted at that agent or carrying no targets, not expired, created after the stream's opening position, in catch-up position order. The opening position follows every event created in or before the millisecond the stream opened (whatever its id); the stream's opening comment and first read wait until that millisecond has passed. The events are read in process through `OrgEventCatchup` with the requesting caller's own identity. The stream keeps its own cursor, passed to each catch-up read: it never moves the agent's durable catch-up watermark (which a default `GET /OrgEventCatchup/<agentId>` starts from), and the watermark does not decide what the stream delivers. A missing `params.agentId` is error `-32602`. Each event arrives as an `org.event` frame whose `data` is a JSON-RPC result `{ type: "event", event }`. A `task.status` frame follows when the status helper finds a status for the event: from its `detail`, its `status` or `kind`, or words in its `summary` (the helper may infer `failed` from `error` in the summary). The stream ends when the client disconnects, after 5 minutes, at an event for the task named in `params.taskId` whose status is terminal (`completed`, `failed`, `canceled`; later events in that read are not sent), or with one `error` frame (a JSON-RPC error) when a read is refused or fails while the stream is open. A read that settles after the stream has ended sends nothing. A POST whose body is a JSON-RPC request reaches this handler with or without `Accept: text/event-stream`. |
|
|
197
|
+
| `tasks/get` | One task by `params.taskId`, with its OrgEvent history. |
|
|
198
|
+
| `tasks/list` | The instance's Beads task board on the Flair host, from one source: the `.yaml`/`.yml` files in `~/ops/.beads/issues/` when at least one exists, otherwise `~/ops/.beads/issues.jsonl`. The two sources are not combined. An authenticated caller can request the unfiltered board; the board is shared within one instance and not scoped per caller. Optional filters: `params.agentId` matches the issue's assignee (case-insensitive) and `params.status` the mapped A2A status (`working`, `completed`, `input-required`, `canceled`). Tasks are ordered newest `updatedAt` first. An anonymous request is refused (`-32001`). |
|
|
130
199
|
|
|
131
200
|
### Identity — Agent, Presence, Soul
|
|
132
201
|
|
|
@@ -134,8 +203,10 @@ is `GET /Name/<id>` unless noted.
|
|
|
134
203
|
|--------|------|------|--------------|
|
|
135
204
|
| GET | `/Agent`, `/Agent/<id>` | Ed25519 | Any verified agent may read principals (discovery). |
|
|
136
205
|
| POST | `/Agent` | Admin Basic | Create principal. Also `POST /AgentSeed` (operator/internal only — not an admin-agent key). |
|
|
137
|
-
| PUT
|
|
206
|
+
| PUT | `/Agent/<id>` | Ed25519 admin / Admin Basic | An administrator operation. An administrator (an Ed25519 agent whose record has `role: "admin"` or whose id `FLAIR_ADMIN_AGENTS` names, or Admin Basic) may PUT any existing record. For a request that reaches `Agent.put()`, the target id is checked first: an id outside the agent-id rule is refused 400 before the handler's authorization and existence checks. Authentication, routing and Harper's resource admission (for a missing target, `allowCreate()`, administrators only) can refuse earlier. For a valid id, a PUT from any other verified agent is refused 403: `agent_put_admin_only` when the record exists, Harper's create check (`allowCreate()`, administrators only) when it does not; such an agent updates its own record with PATCH. An unauthenticated request is refused. The PUT is a full replacement of an existing record. The server sets these fields whatever the body says: the id is the URL's; `createdAt`, `publicKey`, `originatorInstanceId` and the receiver federation fields (`_originatorInstanceId`, `_syncedFrom`, `_syncedAt`) are kept from the stored record; `updatedAt` is set by the handler; `role` and `admin` are reconciled (an admin role or `admin: true` sets both, otherwise `admin` is false). Every other field comes from the body, so an ordinary field the body omits (`status` and `role` included) is not kept, and an absent `status` reads as active. An administrator's PUT to a valid id with no record is refused 404 `agent_put_requires_existing` (a body `id` that disagrees with the URL's is refused instead). |
|
|
207
|
+
| PATCH | `/Agent/<id>` | Ed25519 / Admin Basic | Merges the body into the stored record. A verified agent that is not an administrator may PATCH only its own record, may not write `status`, and may not change the record's admin status (403); the admin-status decision compares the `role` of the row it reads with the role that row would have once the body is merged and reconciled. An administrator may PATCH any record. An unauthenticated request is refused. |
|
|
138
208
|
| DELETE | `/Agent/<id>` | Admin Basic | Deprovision. |
|
|
209
|
+
| POST | `/AgentKeyRegister` | Basic admin / Ed25519 agent with the admin annotation | Register an agent key. Under Flair's per-agent registration lock, reads a fresh local, non-deactivated row with `publicKey: "pending"` and, at the confirmation read, requires the committed row to equal the fresh-read snapshot and still be `pending` before commit. The lock serializes registrations for that agent within one Harper process; raw operations-API writes and other processes do not take it. The post-commit read-back detects surviving differences in compared fields or identity and reports the registered key only when the committed row still has the registered key's identity and the staged `publicKey` and `updatedAt`, and the `AgentKeyRegistration` row this attempt wrote under its `registrationId` is present; otherwise it refuses 503 `registration_unavailable` with outcome `unconfirmed`. A change restored before the confirmation read is not observed; a commit-time pending check is a follow-up. Unsupported schemes that reach the handler receive 401 before Flair's `resolveAgentAuth`, body validation and table reads. Harper handles some Authorization values upstream: a Bearer refresh token receives Harper's 404 before any resource runs. Refuses 409 `agent_key_not_pending` (a non-`pending` row points to key rotation), 403 `agent_not_local` / `agent_inactive`, 404 `agent_not_found`, 400 `registration_request_invalid`, 409 `registration_conflict`, 503 `registration_unavailable`. Writes an `AgentKeyRegistration` audit row and an `agent_key_registered` OrgEvent. The audit `keyFingerprint` and the event `detail` carry the key fingerprint, not the key; the audit `agentId` and the event `refId` carry the target agent's id, which the event `summary` names in text. |
|
|
139
210
|
| GET | `/Presence` | Verified reader | Roster. Requires a valid `TPS-Ed25519` agent signature or the admin credential; an anonymous request gets 401. An instance may opt in to a public roster with `PRESENCE_PUBLIC_ROSTER=true`, in which case an unverified reader gets the allowlisted roster with `currentTask`, `flairVersion`, and `harperVersion` as null. Thresholds: [Presence for API consumers](#presence-for-api-consumers). |
|
|
140
211
|
| POST | `/Presence` | Ed25519 | Heartbeat. Agent writes only its own row (403 cross-agent). Stamps `flairVersion` / `harperVersion` on the row. |
|
|
141
212
|
| PUT / DELETE | `/Presence/<id>` | Ed25519 | Own row only. Collection PUT is not a public bypass. |
|
|
@@ -143,33 +214,43 @@ is `GET /Name/<id>` unless noted.
|
|
|
143
214
|
| POST / PUT / PATCH / DELETE | `/Soul` | **Operator / internal** | Not Ed25519. Learned Memory text cannot be copied in as Soul. See [docs/auth.md](auth.md#soul-authorship). |
|
|
144
215
|
| POST | `/FeedSouls` | Ed25519 | Soul change feed (verified). |
|
|
145
216
|
|
|
146
|
-
`Credential` (
|
|
147
|
-
|
|
148
|
-
|
|
217
|
+
`Credential` (extra credentials for a principal) requires authenticated HTTP
|
|
218
|
+
access: non-admin by-id reads and writes are limited to the caller's
|
|
219
|
+
`principalId`, while administrators and trusted internal callers may access
|
|
220
|
+
other principals' credentials. Through this resource only an administrator or the server creates a
|
|
221
|
+
`kind: "idp"` credential, changes its kind or identity fields, or reactivates
|
|
222
|
+
it, and its owner may relabel, revoke or delete it (see
|
|
223
|
+
[Who writes a mapping](access-control.md#who-writes-a-mapping)). `Credential`
|
|
224
|
+
and `Integration` (legacy 0.x platform rows; verified, prefer Credential) sit on
|
|
225
|
+
the same identity plane. `AgentKeyRegistration`
|
|
226
|
+
(agent-key-registration.graphql) is the admin-read-only audit log of committed
|
|
227
|
+
registrations; its key field is the fingerprint, not the key.
|
|
149
228
|
|
|
150
229
|
### Memory, search, bootstrap
|
|
151
230
|
|
|
152
231
|
| Method | Path | Auth | Read / write |
|
|
153
232
|
|--------|------|------|--------------|
|
|
154
|
-
| GET | `/Memory`, `/Memory/<id>` | Ed25519 |
|
|
233
|
+
| GET | `/Memory`, `/Memory/<id>` | Ed25519 | Open-within-org base scope, with the additional current-authority check for non-admin reads of retained closed skills; denied by-id reads return 404 and denied collection rows are omitted. |
|
|
155
234
|
| POST / PUT / PATCH | `/Memory` | Ed25519 | Own `agentId` only. Auto-embed on write. Visibility defaults from durability (`permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private`). Identified client older than 0.18.0 → **426** `stale_flair_client` (missing version is served). |
|
|
235
|
+
| PATCH | `/Memory/<id>`, body `{"embedding": null, "embeddingModel": null}` | Ed25519 | Owner or admin. Re-embeds the stored row, writing `embedding`, `embeddingModel` and `updatedAt`, and answers `{ id, updatedAt }` (what `flair reembed` sends; it reads `embeddingModel` from the stored row afterwards). |
|
|
156
236
|
| DELETE | `/Memory/<id>` | Ed25519 | Owner or admin. `permanent` owner-delete is allowed. |
|
|
157
|
-
| POST | `/SemanticSearch` | Ed25519 | Hybrid semantic + lexical. Same read-scope as Memory. Default scoring is `raw`. |
|
|
237
|
+
| POST | `/SemanticSearch` | Ed25519 | Hybrid semantic + lexical. Same read-scope as Memory. Default scoring is `raw`. Results carry `provenance` (like the by-id and list reads); `includeTrust` and `abstain` stay opt-in. |
|
|
158
238
|
| POST | `/BootstrapMemories` | Ed25519 | Cold-start context (soul + predicted memories + optional org events). |
|
|
159
239
|
| POST | `/RecordUsage` | Ed25519 | Cross-agent usage signal (`Memory.usageCount`). No ownership requirement; counts only memories in the caller's read scope (`resolveReadScope`: own at any visibility, others' non-private), admin callers included even though admin Memory reads are unfiltered; an out-of-scope id is handled like a missing one. No existence oracle in the response. Prefer this over writing `/MemoryUsage` directly. |
|
|
160
240
|
| GET | `/MemoryUsage` | Ed25519 | Non-admin reads: own ledger rows only, about memories the caller can currently read; any other row reads as not found. Admin and internal reads are unchanged. PUT/DELETE are admin/internal — agents must not delete their row to re-count. |
|
|
161
|
-
| GET / write | `/MemoryGrant` | Ed25519 |
|
|
241
|
+
| GET / write | `/MemoryGrant` | Ed25519 | Non-admin reads: owner or grantee. Write/delete: owner only (you share your own memories). A `write` grant lets the grantee write a successor of the owner's memory or skill (`supersedes`). A write grant does not include changing a record's visibility; visibility is set by the owner or an admin. For that grant-authorized write, the successor carries the predecessor's visibility, and a write naming a different one is refused with 403 `grant_cannot_change_visibility` unless an earlier validation refuses it first (an ordinary, non-skill ephemeral write naming `shared` gets 400 `invalid_visibility_for_durability`; an ephemeral skill write gets 400 `skill_durability`, and a `session` skill write gets 400 `invalid_durability` on Memory POST/PUT (durability validation runs first) and 400 `skill_durability` on FeedMemories). After staging the close, the writer re-reads the predecessor's committed row; a visibility that no longer reads the same refuses the write with 409 `predecessor_visibility_changed`, and a change committed after that final re-read is not seen. An ordinary successor and its close share the write's transaction. An ordinary close refusal aborts the whole write: a storage Response returns the fixed 500 `write_response_withheld`; grant revocation returns 409 `granted_close_revoked`; a predecessor change that keeps visibility the same returns 409 `stored_row_changed`. No refusal writes anything. An ordinary successor is the grantee's own row, so the grantee may later change its visibility as its owner; a skill successor keeps its lineage owner. |
|
|
162
242
|
| GET / write | `/Asset` | Ed25519 | Owner-only blobs linked by `memoryId`. No MCP and no federation in this slice. |
|
|
163
243
|
| GET / write | `/MemoryCandidate` | Ed25519 | Owner-only REM drafts. Never auto-promoted except the narrow ADK path. |
|
|
164
244
|
| POST | `/PromoteMemoryCandidate` | Ed25519 | Promote/reject with required rationale. |
|
|
165
|
-
| POST | `/AutoPromoteCandidates` | Ed25519 |
|
|
245
|
+
| POST | `/AutoPromoteCandidates` | Ed25519 | Auto-promote of eligible per-user ADK and continuity candidates. Answers `promoted` (memory ids), `skipped` (`{ id, reason }`), `incomplete` (`{ memoryId, candidateId, error }`: memory written and stamped, candidate update threw, candidate read back `pending`), `unconfirmed` (the same throw where the read-back did not confirm the promotion on this memory, plus `readBack` with what it found), `count` (`promoted` only) and `considered`. A later sweep can adopt the recorded memory of a candidate still pending, without a second memory, only when the memory's identity is present on the candidate and the memory still passes the sweep's checks. See [docs/rem.md](rem.md#auto-promote-adk-only). |
|
|
166
246
|
| POST | `/FeedMemories` | Ed25519 | Ingest path; `agentId` stamped from the caller (`stamp-strict`). |
|
|
167
|
-
| POST | `/MemoryArchive` | Ed25519 | Basement / restore (`
|
|
168
|
-
| POST | `/MemoryMaintenance` | Ed25519 or admin | Hygiene: expire ephemeral, archive old standard.
|
|
247
|
+
| POST | `/MemoryArchive` | Ed25519 | Basement / restore. Accepts `{ id, action: "basement" \| "restore" }`; a successful ordinary-memory operation returns HTTP 200 with Memory.put()'s write receipt, including `id`, `written`, `deduplicated` and any returned visibility or redaction fields. Read the memory to inspect its archive state. Read/write refusals retain their HTTP status and body; a persisted-row change detected by the archive's re-read returns `409 memory_changed`. |
|
|
248
|
+
| POST | `/MemoryMaintenance` | Ed25519 or admin | Hygiene: expire ephemeral, archive old standard. An agent's own run is scoped to the caller; an admin run with no `agentId` is fleet-wide, and one that names an `agentId` is scoped to that agent. Fleet-wide maintenance expires and archives eligible rows of every agent. A supplied admin `agentId` that is not a conforming string (the agent-id rule `^[a-zA-Z0-9_-]{1,64}$` included) is refused 400 with the rule and a `remedy`: run that agent's own authenticated non-admin maintenance, which reaches its rows, when the stored id can authenticate (the signed TPS-Ed25519 header cannot carry a colon or whitespace); for an id the header cannot represent, run fleet-wide, which reaches that agent's rows and expires or archives every other agent's eligible rows. |
|
|
169
249
|
| POST | `/MemoryReindex` | Admin / verified per handler | Embedding / HNSW rebuild. |
|
|
170
250
|
| POST | `/MemoryConsolidate` | Ed25519 | Dedup / consolidate. |
|
|
171
251
|
| POST | `/MemoryReflect` | Ed25519 | REM distill → MemoryCandidate. |
|
|
172
252
|
| POST | `/MemoryDedupStats` | Admin Basic | Dedup diagnostics. Fleet-wide sweep; `allowCreate` is `allowAdmin`. |
|
|
253
|
+
| POST | `/MemoryPurge` | **Operator / internal** | Not Ed25519, admin-agent keys included. Physical removal of Memory rows by id; a skill-tagged row expands to its whole skill lineage. `removedIds` lists the rows a read after the commit finds gone; a target not stored before the delete fails the call (404). A target still stored after the commit keeps its pointer row. Unconfirmed history cleanup returns 500 `memory_purge_history_cleanup_unconfirmed` before pointer-cleanup failure (500 `memory_purge_pointer_cleanup_failed`) or a still-stored target (409 `memory_purge_unconfirmed`). Does not change `DELETE /Memory/<id>`. An accepted DELETE of a non-reserved skill closes its head; the reserved `using-flair` seed is physically deleted. |
|
|
173
254
|
| POST | `/SkillScan` | Ed25519 | Skill-tag scan on Memory writes. |
|
|
174
255
|
| GET | `/OrgSkillAssignment`, `/OrgSkillAssignment/<id>` | Ed25519 | Any verified agent. Org-scope skill assignments; see the `skills` paragraph in [docs/mcp-clients.md](mcp-clients.md). Not federated. |
|
|
175
256
|
| POST / PUT / PATCH / DELETE | `/OrgSkillAssignment/` (POST), `/OrgSkillAssignment/<id>` (PUT / PATCH / DELETE) | **Operator / internal** | Not Ed25519, admin-agent keys included. Each accepted write appends an `OrgSkillAssignmentHistory` row. |
|
|
@@ -177,6 +258,21 @@ the same identity plane.
|
|
|
177
258
|
Skill-tagged Memory rows embed from `trigger` (the recall signal), not
|
|
178
259
|
`content`. MCP tools: `skill_store`, `skill_search`, `skill_get`.
|
|
179
260
|
|
|
261
|
+
For non-admin Memory by-id and collection reads, a retained closed skill payload must pass both its
|
|
262
|
+
stored owner/visibility check and its subject's current-authority check: a
|
|
263
|
+
readable live skill referenced by a matching create/update head, or a readable
|
|
264
|
+
delete head with `memoryId: null`. Missing, invalid or unreadable authority
|
|
265
|
+
denies the payload even to its owner: by-id reads return 404 and collection
|
|
266
|
+
reads omit it. Administrator and trusted internal reads are not subject to this additional
|
|
267
|
+
check.
|
|
268
|
+
|
|
269
|
+
Superseding a skill closes its predecessor with `validTo`; deleting a
|
|
270
|
+
non-reserved skill closes its live head and appends a delete version while
|
|
271
|
+
retaining the Memory row. Skill writes through Memory POST/PUT and
|
|
272
|
+
`FeedMemories` that supply a non-null `archived` value other than `false` or a
|
|
273
|
+
nonempty `validTo` are refused with `400 skill_state_requires_delete`, so basementing a
|
|
274
|
+
skill is refused.
|
|
275
|
+
|
|
180
276
|
#### Client version gate (HTTP 426 `stale_flair_client`)
|
|
181
277
|
|
|
182
278
|
`POST` / `PUT` / `PATCH` `/Memory` refuse an **identified**
|
|
@@ -217,12 +313,22 @@ The remedy is `flair upgrade` (the adapter), not a server upgrade alone.
|
|
|
217
313
|
| GET / POST / PUT | `/Relationship` | Ed25519 / Admin Basic | Owner-only for non-admin agents; administrators can read across owners. POST creates; a create that is otherwise admitted, valid and within the rate limit is 409 when its id already exists. PUT upserts. For a verified non-admin agent both stamp the owner from the caller (a body naming another agent is 403); an administrator keeps the owner it supplies. A write that passes validation gets provenance built server-side. |
|
|
218
314
|
| GET / POST / PUT | `/WorkspaceState` | Ed25519 | Owner-only. POST stamps `agentId`; PUT rejects a mismatch. |
|
|
219
315
|
| GET | `/WorkspaceLatest` | Ed25519 | Latest workspace row for the caller. |
|
|
220
|
-
| GET / POST / PUT | `/OrgEvent` | Ed25519 | Any verified agent reads every event.
|
|
316
|
+
| GET / POST / PUT / PATCH | `/OrgEvent` | Ed25519 / Admin Basic | Any verified agent reads every event. `authorId` for a non-admin agent: POST sets it from the caller, whatever the body says; PUT requires the body to name the caller (403 otherwise, including when it is absent); PATCH leaves the stored value unless the body names one, and refuses a change (403). An administrator (an admin agent key or credentialed Basic admin) may supply `authorId` on any verb; POST defaults it to the administrator's own id. The server assigns an OrgEvent's `createdAt` on create. After the earlier checks, a `createdAt` check reads the stored row under each event's id. A stored row's `createdAt` is authoritative whatever its value (an empty string included): an update that omits it keeps it, and one that names a different value is refused with 409 `created_at_immutable`. An event that reaches the check and is not an object, or whose id is not a non-empty string or a non-empty array of strings, is refused with 400 `invalid_event_id` before any write, as is an administrator's PATCH to the collection (for a non-admin's collection PUT, PATCH or DELETE, if reached, the table guard returns the 403 collection refusal; existing DELETE middleware may refuse earlier). Before validation, an addressed POST binds a missing or `null` body id to the addressed id, and a string or number body id when its text matches the address; any other id type is left unchanged by this step. At the root collection, POST generates an id when the body's id is missing, `null` or empty. At POST id validation, at the root collection or an addressed path whose body id was not bound, a remaining id that is not a non-empty string or a non-empty array of strings receives 400 `invalid_event_id`. |
|
|
221
317
|
| GET / POST | `/OrgEventCatchup` | Ed25519 | Catch-up feed for the caller. `since` is optional (defaults to the per-agent watermark). GET pages; POST acks `{ position }` (advance-on-ack). |
|
|
222
318
|
| GET / POST | `/AgentReadPosition` | Ed25519 | Owner-only watermark (`stream`, default `org-event`). Foundation for light-comms catch-up. |
|
|
223
319
|
| POST | `/OrgEventMaintenance` | Ed25519 / admin | Expire / sweep org events. |
|
|
224
320
|
| POST | `/AttentionQuery` | Ed25519 | Cross-table “what touches entity E”. Entity strings: [docs/entity-vocabulary.md](entity-vocabulary.md). |
|
|
225
321
|
|
|
322
|
+
#### Instruction-change events (Soul and skill)
|
|
323
|
+
|
|
324
|
+
Each version appended by Flair's Soul and skill application writers also creates an OrgEvent: kind `soul.changed` or `skill.changed`, id `instruction-change:<version id>`, `refId` the version id, `authorId` `flair:internal`, `createdAt` copied from the version, and `detail` built from these fields only: `subjectType`, `subjectId`, `key` (the Soul key; null for skills), `changeKind`, `actorKind`, `actorId`, `sourceClass`, `valueHash`, `previousVersionHash`, `recordHash`. A private skill's event omits the three hashes, including on the tombstone, whose stored visibility is the closed head's last state. `authorId` is `flair:internal`; `detail.actorKind` disambiguates the actor.
|
|
325
|
+
|
|
326
|
+
Instruction events are readable by any verified agent. Three things a reader should not infer:
|
|
327
|
+
|
|
328
|
+
- The stream begins with the release that ships this event; versions appended earlier have no event, and `InstructionVersion` remains the complete history. A missing event before the cutover does not mean nothing changed.
|
|
329
|
+
- An event does not grant read access to its version record, which keeps stored-and-current authority.
|
|
330
|
+
- Hashes emitted while a skill was shared stay readable in the append-only stream after the skill is tightened to private.
|
|
331
|
+
|
|
226
332
|
### Federation
|
|
227
333
|
|
|
228
334
|
| Method | Path | Auth | Notes |
|
|
@@ -256,7 +362,7 @@ operator audit trail.
|
|
|
256
362
|
| GET | `/.well-known/oauth-authorization-server`, `/OAuthMetadata` | Public | RFC 8414. CORS `*`. |
|
|
257
363
|
| GET | `/.well-known/oauth-protected-resource`, `…/mcp` | Public | RFC 9728. |
|
|
258
364
|
| POST | `/OAuthRegister` | `X-Flair-Initial-Access-Token` | DCR. **Off** unless `FLAIR_OAUTH_DCR_TOKEN` is set (32–508 chars). Rate-limited. |
|
|
259
|
-
| GET / POST | `/OAuthAuthorize` | Public (user consent) | Authorization code + PKCE. |
|
|
365
|
+
| GET / POST | `/OAuthAuthorize` | Public (user consent) | Authorization code + PKCE (`S256` required). |
|
|
260
366
|
| POST | `/OAuthToken` | Public (client + code/assertion) | Token + `jwt-bearer` (XAA). |
|
|
261
367
|
| POST | `/OAuthRevoke` | Public (token) | Revocation. |
|
|
262
368
|
| GET / POST | `/mcp` | OAuth bearer | Curated tools. **Unmounted** until `FLAIR_MCP_OAUTH=true` and an issuer. |
|
|
@@ -264,14 +370,19 @@ operator audit trail.
|
|
|
264
370
|
| GET / write | `/IdpConfig` | Admin Basic | XAA IdP registration (`flair idp add`). |
|
|
265
371
|
| GET | `/MCPClientMetadata` | Public / handler-gated | CIMD documents for allowed hosts. |
|
|
266
372
|
|
|
267
|
-
`OAuthAuthCode`, `OAuthToken`, and `
|
|
268
|
-
`@export`). They hold codes, hashed tokens,
|
|
373
|
+
`OAuthAuthCode`, `OAuthToken`, `IdJagReplay`, and `OAuthSingleUse` are internal
|
|
374
|
+
tables (no `@export`). They hold codes, hashed tokens, used `jti` values, and
|
|
375
|
+
the hashed keys of codes presented for redemption and refresh tokens presented
|
|
376
|
+
for rotation. A single-use row records that a redemption was claimed. The
|
|
377
|
+
handler attempts the later `used` or revocation write before issuing tokens.
|
|
378
|
+
If that write fails, no token pair is issued; the claim remains, so the code
|
|
379
|
+
or token cannot be redeemed again.
|
|
269
380
|
|
|
270
381
|
OAuth rate limits and env vars: [docs/auth.md](auth.md#rate-limiting).
|
|
271
382
|
|
|
272
383
|
### Admin UI
|
|
273
384
|
|
|
274
|
-
|
|
385
|
+
Reads of the `/Admin*` routes below are admin-only: **Admin Basic**, or a `TPS-Ed25519` signature from an admin agent.
|
|
275
386
|
|
|
276
387
|
| Path | Purpose |
|
|
277
388
|
|------|---------|
|
|
@@ -280,6 +391,7 @@ All `/Admin*` routes require **Admin Basic**.
|
|
|
280
391
|
| `/AdminConnectors` | OAuth clients and sessions |
|
|
281
392
|
| `/AdminIdp` | IdP configuration |
|
|
282
393
|
| `/AdminMemory` | Browse / search memory as operator |
|
|
394
|
+
| `/AdminMemoryCandidates/{agentId}` | JSON: one agent's MemoryCandidate ids in id order (`limit`, default 200, max 500; `after=<id>` for the ids after that one), used by `flair rem restore` |
|
|
283
395
|
| `/AdminInstance` | Federation status, peers, instance |
|
|
284
396
|
|
|
285
397
|
---
|
|
@@ -296,8 +408,8 @@ comes from the token `sub`, never from tool arguments.
|
|
|
296
408
|
| `memory_update` | Memory read-modify-write (in-place or `supersedes` version) |
|
|
297
409
|
| `memory_get` | `GET /Memory/<id>` |
|
|
298
410
|
| `memory_delete` | `DELETE /Memory/<id>` |
|
|
299
|
-
| `memory_basement` | `
|
|
300
|
-
| `memory_restore` | `
|
|
411
|
+
| `memory_basement` | Memory read-modify-write setting `archived: true` |
|
|
412
|
+
| `memory_restore` | Memory read-modify-write setting `archived: false` and removing `archivedAt` and `archivedBy` |
|
|
301
413
|
| `skill_store` / `skill_search` / `skill_get` | Skill-tagged Memory |
|
|
302
414
|
| `bootstrap` | `POST /BootstrapMemories` |
|
|
303
415
|
| `soul_get` | `GET /Soul` |
|
|
@@ -334,7 +446,7 @@ client-writable even if a client sends them. Full comments live in
|
|
|
334
446
|
|
|
335
447
|
`GET /Presence` requires a **verified reader** by default. A verified reader is a request carrying a valid `TPS-Ed25519` agent signature from an agent registered on this instance, or the admin credential. An anonymous — or otherwise unverified — request gets **401**, not a redacted roster. The roster is org-visible data (who is working, on what class of activity, and how recently) and is not published by default.
|
|
336
448
|
|
|
337
|
-
An instance that runs a public status page opts back in with the presence config key `PRESENCE_PUBLIC_ROSTER=true` (the same env-var channel as the thresholds below); it is **off by default** and is documented as *publishes your roster to the internet*. With it on
|
|
449
|
+
An instance that runs a public status page opts back in with the presence config key `PRESENCE_PUBLIC_ROSTER=true` (the same env-var channel as the thresholds below); it is **off by default** and is documented as *publishes your roster to the internet*. With it on, an anonymous caller gets the field-allowlisted roster (id, display name, role, runtime, activity fields, `presenceStatus`, `lastHeartbeatAt`), and three fields are redacted to `null` for an HTTP caller unless the request carries a valid `TPS-Ed25519` agent signature: `currentTask`, `flairVersion`, and `harperVersion`. Over HTTP, anonymous callers, unsigned loopback and Basic admin are unverified readers of the content gate. A trusted in-process read delegated on behalf of a registered agent can also receive the three fields without a signature. The nulls are intentional. Public `/Health` exposes the server version and build identity. A null `flairVersion` on an unverified read does not mean the peer lacks a version, and it does not mean the peer cannot accept a directed handoff.
|
|
338
450
|
|
|
339
451
|
A verified reader still sees `null` for a version the row never stored. Heartbeats stamp the running server's versions; a row written before that stamp, and not heartbeated since, has no value to return. `harperVersion` is also null when this process could not resolve Harper's package version. That null means unknown, not redacted.
|
|
340
452
|
|
|
@@ -374,7 +486,7 @@ A peer can therefore show `presenceStatus: "offline"`, `activity: "idle"`, `last
|
|
|
374
486
|
| `expiresAt` | String | Ephemeral TTL |
|
|
375
487
|
| `retrievalCount` / `lastRetrieved` | | Search-hit counters (weak signal). Incremented on `MemoryHitStat` and overlaid on Memory reads — search no longer rewrites the Memory row. |
|
|
376
488
|
| `usageCount` | Int | Verified-use signal; only `RecordUsage` / citations increment |
|
|
377
|
-
| `promotionStatus` / `promotedAt` / `promotedBy` | | REM promotion |
|
|
489
|
+
| `promotionStatus` / `promotedAt` / `promotedBy` / `promotionContentHash` | | REM promotion; the hash binds the verdict to the stored text |
|
|
378
490
|
| `archived` / `archivedAt` / `archivedBy` | | Basement |
|
|
379
491
|
| `parentId` / `derivedFrom` / `sessionId` / `lastReflected` | | Learning pipeline |
|
|
380
492
|
| `supersedes` | String | Version chain |
|
|
@@ -388,6 +500,14 @@ A peer can therefore show `presenceStatus: "offline"`, `activity: "idle"`, `last
|
|
|
388
500
|
|
|
389
501
|
> The host pointer (`hostSource`) is **not** a Memory attribute — it lives in its own `MemoryHostSource` table (below). There is no `hostSource` / `hostSourceVisibility` field on `Memory`.
|
|
390
502
|
|
|
503
|
+
#### Durability tiers (#2217)
|
|
504
|
+
|
|
505
|
+
- permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
|
|
506
|
+
- persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
|
|
507
|
+
- standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
|
|
508
|
+
- ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
|
|
509
|
+
- No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
|
|
510
|
+
|
|
391
511
|
#### Memory host pointer (`MemoryHostSource`, #1940 A1'-A5)
|
|
392
512
|
|
|
393
513
|
The pointer is a host-object pointer — versioned JSON `{ v: 1, host, kind, id, url? }` — that records which host object the writer claims as the memory’s source. **Supported writes store host pointers only in `MemoryHostSource`. For non-admin `Memory.get`, `Memory.search`, and `SemanticSearch` results, the gated projection removes inline pointer fields and renders a pointer only from a bound `MemoryHostSource` row.**
|
|
@@ -412,13 +532,13 @@ The **binding** (A1-iv item 1): The named application create paths stamp a local
|
|
|
412
532
|
- **A4** — the server stamps `receivedAt` inside `provenance`; it is server-stamped and never client-writable. `createdAt` stays the writer's claimed time, so `asOf`/valid-time queries use the writer's claim.
|
|
413
533
|
- **A5** — the pointer is NOT inside `provenance`; `provenance` stays never-client-writable.
|
|
414
534
|
|
|
415
|
-
**Read** — the pointer reaches a reader ONLY through a gated join into Memory results (search, by-ID, semantic search; semantic results carry the joined pointer to a permitted reader — test `(s5)`), which has three outcomes: the pointer, `"withheld"`, or nothing. A pointer is visible only to the record's author unless the write opted it into the record's scope, and it is never wider than its record: the effective visibility is the narrower of the record's write-time visibility (`scopeAtWrite`) and its current visibility (`narrower(scopeAtWrite, record.visibility)`). The join takes the narrower of the stored pointer scope and the Memory row's current visibility, so a later widening of the record does not widen the pointer. A reader who may read the record but not the pointer:
|
|
535
|
+
**Read** — the pointer reaches a reader ONLY through a gated join into Memory results (search, by-ID, semantic search, bootstrap; semantic results carry the joined pointer to a permitted reader — test `(s5)`), which has three outcomes: the pointer, `"withheld"`, or nothing. A pointer is visible only to the record's author unless the write opted it into the record's scope, and it is never wider than its record: the effective visibility is the narrower of the record's write-time visibility (`scopeAtWrite`) and its current visibility (`narrower(scopeAtWrite, record.visibility)`). The join takes the narrower of the stored pointer scope and the Memory row's current visibility, so a later widening of the record does not widen the pointer. A reader who may read the record but not the pointer: on a non-admin read, a bound pointer outside the reader's pointer scope renders as `"withheld"` on the structured reads (get / search / semantic search) and as the prose marker `[via withheld]` in bootstrap; an unbound or archived pointer renders nothing. Wherever a URL is rendered, only scheme, host and path appear; query and fragment are stripped. Redaction is applied on the server, in the read projection — no client or MCP layer can un-redact. `Memory.get()`, `Memory.search()`, `SemanticSearch` and bootstrap render pointers through the pointer helper; for a non-admin agent caller, bootstrap cites a visible pointer in PROSE as `[via <host>/<kind> <id8> (unverified)]`, where the first 8 id characters are display-only and the full URL never appears. Each reader fetches pointers in ONE batched query per result set, never one per row.
|
|
416
536
|
|
|
417
537
|
**Direct access** — Direct resource reads permit admin agents and trusted in-process callers; non-admin agents cannot read this table directly. The author reads their own pointer only through the gated join. The table has **NO REST write verbs**: `POST`/`PUT`/`PATCH`/`DELETE` to the resource are refused for EVERY caller, non-admin and admin alike, with nothing written (`r4-http`), so no REST caller can plant a pointer. A superuser Harper operation against the table (an admin `export`, `backup`, `reseed`, or a hygiene/forensics read of orphaned or author-only pointers) is the named operator path and is not gated by the resource (`r4-http` proves only the resource refusal). This admin exception names `MemoryHostSource` explicitly.
|
|
418
538
|
|
|
419
|
-
**Federation** — `MemoryHostSource` is excluded from the sync's table set by mechanism (it is absent from the federation table policy), and an inbound row carrying a pointer field is refused. The outbound reader projects declared Memory attributes. The inbound merge removes undeclared attributes except the named bookkeeping fields (`f1-out`, `f1-in`). `Memory.delete` and maintenance expiry or age-based archival delete the pointer with their Memory operation. `MemoryArchive` basement/restore retains the pointer row; the join suppresses it while the Memory is archived. `Memory.delete`
|
|
539
|
+
**Federation** — `MemoryHostSource` is excluded from the sync's table set by mechanism (it is absent from the federation table policy), and an inbound row carrying a pointer field is refused. The outbound reader projects declared Memory attributes. The inbound merge removes undeclared attributes except the named bookkeeping fields (`f1-out`, `f1-in`). `Memory.delete` and maintenance expiry or age-based archival delete the pointer with their Memory operation. `MemoryArchive` basement/restore retains the pointer row; the join suppresses it while the Memory is archived. Ordinary `Memory.delete` uses an owned transaction; maintenance uses an owned transaction per item. An orphan sweep re-checks inside the transaction before deleting; a cleanup failure makes the maintenance run report a failure, not "complete". The orphan sweep runs only when the run is not a dry run, and follows the run's scope: a non-admin run, and an admin run that names an agent, considers only pointer rows whose stamped `authorId` is that agent, and a pointer with an empty author is outside such a run; fleet-wide admin maintenance considers every pointer row, so it also removes an empty-author orphan pointer. A pointer whose Memory row is live at the sweep's reads is kept. Harper has no compare-and-delete, so the sweep re-reads the Memory row and the pointer and stages the delete in one owned transaction, whose time Harper takes at its first read; inside that transaction's callback it also reads both rows' committed state through fresh contexts (the confirmation reads) before staging the delete: a pointer replaced before the confirmation read is skipped, and a replacement whose transaction takes its time after that first read is applied after the delete and stays stored. A write whose transaction took its time before that first read and commits after the confirmation read is not covered (per-id serialization is tracked in #2478). A pointer counts as removed only when a read after the commit finds no row for its memoryId. Orphaned pointers are absent from ordinary Memory joins but remain directly readable by administrators.
|
|
420
540
|
|
|
421
|
-
|
|
541
|
+
hostSource is the writer's unverified claim about an external source, stored with the writer's authenticated agent id; Flair does not verify it. The Ed25519 request signature covers method and URL, not the body.
|
|
422
542
|
|
|
423
543
|
### Soul
|
|
424
544
|
|
|
@@ -430,7 +550,7 @@ A `hostSource`, like a client-supplied `createdAt`, is a writer claim attributed
|
|
|
430
550
|
| `priority` | String | `critical` \| `high` \| `standard` \| `low` |
|
|
431
551
|
| `metadata` | String | JSON (skill governance, etc.) |
|
|
432
552
|
| `provenance` | String | Operator/internal author + `sourceClass` |
|
|
433
|
-
| `durability` | String |
|
|
553
|
+
| `durability` | String | POST defaults to `permanent`; PUT supplies no default |
|
|
434
554
|
| `createdAt` / `updatedAt` | String | |
|
|
435
555
|
| `originatorInstanceId` | String | Server-stamped write-time instance id; not client-writable through a resource write |
|
|
436
556
|
|
|
@@ -465,6 +585,7 @@ ed25519 / idp) and **Integration** (legacy platform connection).
|
|
|
465
585
|
| **Instance** | yes | One row per Flair instance (`id`, `publicKey`, `role` hub/spoke, `fabricEndpoint`, `status`) |
|
|
466
586
|
| **PairingToken** | yes | One-time token (`expiresAt`, `consumedBy`) |
|
|
467
587
|
| **Peer** | yes | Pinned peer (`publicKey`, `endpoint`, `status`, `lastSyncAt` / `lastMergeAt`, `lastSyncCursor`, `relayOnly`) |
|
|
588
|
+
| **FederationRetry** | yes | Sender-owned federation retry bookkeeping, shaped for one row per (peer, table, record) refused for a reason a later re-offer could clear (`state`, `attempts`, `firstRefusedAt`, `lastReason`, `resolution`, `bound`). No production sender path creates rows yet; admin-written rows are readable. `@sealed`: a write naming an undeclared field is refused. Admin-only on every operation; excluded from federation policy and the receive mapping. |
|
|
468
589
|
| **ReplayNonce** | no | `schemas/replay.graphql`. Anti-replay record shared by agent auth (`a:<agentId>:<nonce>`) and federation body signatures (`f:<nonce>`). Local to the instance (`replicate: false`); rows expire after 120 s |
|
|
469
590
|
| **SyncLog** | no | Per-sync audit (`peerId`, `direction`, counts, `skippedReasons`, `status`) |
|
|
470
591
|
|
|
@@ -480,15 +601,27 @@ ed25519 / idp) and **Integration** (legacy platform connection).
|
|
|
480
601
|
| **Asset** | memory.graphql | yes | Blob (`contentType`, `data`) owned by `agentId`, linked by `memoryId` |
|
|
481
602
|
| **OrgSkillAssignment** | memory.graphql | yes | Org-scope skill assignment (`skillName`, `skillRef`, `priority`, server-stamped `writer` / `sourceClass`) |
|
|
482
603
|
| **OrgSkillAssignmentHistory** | memory.graphql | no | One row per accepted OrgSkillAssignment resource write (`assignmentId`, `op`, `actor`, `sourceClass`, `previousHash`) |
|
|
604
|
+
| **MemoryDeletionHistory** | memory.graphql | no | History of confirmed physical deletions of permanent/persistent Memory rows through `Memory.delete` (including CLI hygiene and agent remove), appended in the delete transaction. Non-durable deletes, including maintenance expiry, append no history (`memoryId`, `memoryInstanceToken`, `durability`, `actor`, `sourceClass`, `at`); read by `flair integrity check` for history-backed attributions. `replicate: true` is declared explicitly to state the database default (a table replicates unless it opts out) |
|
|
605
|
+
| **InstructionVersion** | memory.graphql | yes (read only) | History for single-row Soul resource writes and skill writes through Memory post/put/delete and FeedMemories (excluding `_reindex` and reserved-seed deletes). InstructionVersion resource REST clients cannot write or delete version records; the server appends them, and when a request's close fails it attempts to remove the version that request appended only while that version is still the head, reporting a compensation failure when the removal cannot be confirmed. Soul collection deletes and InstructionVersion REST writes are refused. The administrator operations API (`upsert` / `delete` under admin auth) is the separate raw-table exception described below. The operator's reserved seed row keeps its fixed id and is versioned in place. Skill writers share a subject-type lock, select rows where `archived !== true`, `validTo` is not a nonempty string, and `expiresAt` is absent or a valid future timestamp, and refuse stale create/update targets or predecessors and ambiguous heads. Reads authorize `soul` subjects under Soul's verified-agent rule. Ordinary skill readers require readable stored visibility and current authority: matching subjects, a live skill Memory row owned by the head's owner, or a delete head with null `memoryId`; authority references require nonempty owners and explicit private/shared visibility. Admin/internal keep unfiltered skill reads; unknown subject types deny. `Memory.skillSubjectId` is nullable and server-owned. |
|
|
483
606
|
| **WorkspaceState** | workspace.graphql | yes | Current work (`ref`, `provider`, `phase`, `entities`) |
|
|
484
607
|
| **OrgEvent** | event.graphql | yes | Org-visible event (`authorId`, `kind`, `summary`, `entities`) |
|
|
485
608
|
| **AgentReadPosition** | agent.graphql | no | Per-agent watermark (`agentId`, `stream`, `position`). HTTP via `/AgentReadPosition`, not raw-table REST. |
|
|
609
|
+
| **AgentKeyRegistration** | agent-key-registration.graphql | yes (admin read only) | Audit log of committed `POST /AgentKeyRegister` calls (`actorId`, `operator`, `agentId`, `instanceId`, `keyFingerprint`, `createdAt`). The Flair resource route refuses every write; the registration operation is its only application writer. The operations API is a separate raw-table trust root. `replicate: true` is declared explicitly to state the database default (a table replicates unless it opts out). |
|
|
486
610
|
| **Message** | message.graphql | yes | Signed envelope (`from`, `to`, `threadId`, `seq`, `state`, `signature`) |
|
|
487
611
|
| **OAuthClient** | oauth.graphql | yes | Registered OAuth clients |
|
|
488
612
|
| **OAuthAuthCode** | oauth.graphql | no | Single-use codes + PKCE |
|
|
489
613
|
| **OAuthToken** | oauth.graphql | no | Hashed access/refresh tokens |
|
|
490
614
|
| **IdpConfig** | oauth.graphql | yes | XAA IdP (`issuer`, `jwksUri`, `requiredDomain`) |
|
|
491
615
|
| **IdJagReplay** | oauth.graphql | no | Used ID-JAG `jti` values |
|
|
616
|
+
| **OAuthSingleUse** | oauth.graphql | no | A claim to redeem an authorization code or rotate a refresh token, keyed by its SHA-256 |
|
|
617
|
+
|
|
618
|
+
`flair integrity check` reports missing checkpointed durable Memory IDs or replacements with changed or missing previously nonempty tokens without matching new deletion history. A row created and lost entirely between scans is not observed. The scan reads deletion history at or after the checkpoint's watermark minus a margin; an absent or unknown watermark reads the whole table.
|
|
619
|
+
|
|
620
|
+
`flair integrity prune-history` prunes deletion history older than the oldest named checkpoint watermark minus a margin. It is a dry run unless `--apply` is given, prunes at most `--max` rows in a run, and refuses — naming the reason — when a checkpoint is missing or a watermark is unreadable. Pruning against only some of the checkpoints that read an instance can remove history an unnamed checkpoint still needs, which causes false alerts there.
|
|
621
|
+
|
|
622
|
+
`InstructionVersion` rows are appended by Flair's in-process write path. The administrator operations API (`upsert` / `delete` under admin auth) can also write version rows, and that path is not audited by this table — a documented, deferred exception.
|
|
623
|
+
|
|
624
|
+
Raw operations-API Memory deletes create no deletion history. A scan alerts when a checkpointed durable incarnation is missing or replaced without new matching history.
|
|
492
625
|
|
|
493
626
|
---
|
|
494
627
|
|
|
@@ -499,4 +632,4 @@ ed25519 / idp) and **Integration** (legacy platform connection).
|
|
|
499
632
|
- [docs/rem.md](rem.md) — MemoryCandidate promote/reject
|
|
500
633
|
- [docs/entity-vocabulary.md](entity-vocabulary.md) — `entities` grammar
|
|
501
634
|
- [docs/embedding-in-a-harper-app.md](embedding-in-a-harper-app.md) — in-process API
|
|
502
|
-
- [`packages/flair-client/README.md`](
|
|
635
|
+
- [`packages/flair-client/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/flair-client/README.md) — typed HTTP client
|
package/docs/auth.md
CHANGED
|
@@ -12,19 +12,13 @@ Different surfaces authenticate differently. The model in one place:
|
|
|
12
12
|
| **CLI / SDK clients** (`flair`, `flair-client`) | Ed25519 agent keys; administrator Basic on supported paths | Ordinary signed agents: own writes; own and org-wide non-private reads | Administrator agent roles and Basic credentials have broader authority. |
|
|
13
13
|
| **MCP server** (`@tpsdev-ai/flair-mcp`) | Ed25519 agent key; configured administrator Basic fallback | Ordinary signed agents: own writes; own and org-wide non-private reads | The key is auto-resolved from `~/.flair/keys/<agent>.key`; Basic is used when no key resolves and administrator credentials are configured. |
|
|
14
14
|
| **OpenClaw / pi / Hermes plugins** | Ed25519 agent keys; Pi can use configured administrator Basic fallback | Ordinary signed agents: own writes; own and org-wide non-private reads | OpenClaw identity comes from host context; Pi requires `FLAIR_AGENT_ID`; Hermes defaults to `hermes`. |
|
|
15
|
-
| **`n8n-nodes-flair`** | **
|
|
15
|
+
| **`n8n-nodes-flair`** | **Ed25519 with Agent Private Key selected**; deprecated administrator Basic | Ordinary signed agents: own writes; own and org-wide non-private reads | The deprecated **Admin Password** authenticates as the Harper administrator (whole instance, including `private`) when Agent Private Key is empty. |
|
|
16
16
|
|
|
17
|
-
**The default, secure path is Ed25519 per-agent** (see below): each agent holds its own key and signs every request. For ordinary signed agents, this enforces write ownership: they can write only their own records
|
|
17
|
+
**The default, secure path is Ed25519 per-agent** (see below): each agent holds its own key and signs every request. For ordinary signed agents, this enforces write ownership: they can write only their own records. 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 credentials and administrator agent roles have broader authority, including access to private records. The hard access boundary is the **federation edge** (a separate Flair instance / org), not reads within an instance. See [SECURITY.md](../SECURITY.md) for the full model. Use Ed25519 per-agent everywhere you can regardless — it's still what makes writes and identity trustworthy.
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### n8n: agent-key signing, with the admin password deprecated
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- The n8n instance is single-tenant and operator-controlled.
|
|
24
|
-
- Workflow inputs are trusted (your own CRM, your own webhook source).
|
|
25
|
-
- Write-forgery and full read access (including `private` memories) are acceptable for the use case.
|
|
26
|
-
|
|
27
|
-
If any of those don't hold, use Flair's CLI / SDK clients (which support per-agent Ed25519 today) and wait for the n8n credential to gain Ed25519 per-agent auth (planned). Full guidance in [docs/n8n.md](n8n.md#security).
|
|
21
|
+
With **Agent Private Key** selected, `n8n-nodes-flair` signs as the credential's Agent ID. Ordinary agents write their own memories and read their own plus other agents' non-private memories. The deprecated **Admin Password** path uses Harper administrator Basic authentication only with an empty Agent Private Key, and warns on each node execution. See [n8n setup](n8n.md#3-create-the-credential).
|
|
28
22
|
|
|
29
23
|
## Ed25519 Agent Auth (Default)
|
|
30
24
|
|
|
@@ -139,13 +133,31 @@ rather than registration.
|
|
|
139
133
|
|
|
140
134
|
### Authorization Code Flow with PKCE
|
|
141
135
|
|
|
142
|
-
Standard OAuth 2.1 authorization code flow
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
136
|
+
Standard OAuth 2.1 authorization code flow. The authorization endpoints and the
|
|
137
|
+
authorization-code exchange require PKCE with the `S256` method only; the
|
|
138
|
+
metadata's `code_challenge_methods_supported` lists `["S256"]` as the supported method:
|
|
139
|
+
|
|
140
|
+
1. Client generates a PKCE `code_verifier` and its `S256` `code_challenge`
|
|
141
|
+
(`BASE64URL(SHA256(code_verifier))`, RFC 7636)
|
|
142
|
+
2. Client redirects user to `GET /OAuthAuthorize?response_type=code&client_id=...&redirect_uri=...&code_challenge=...&code_challenge_method=S256`
|
|
143
|
+
3. User approves or denies on the consent page
|
|
144
|
+
4. Flair redirects back with an authorization code on approve, or with `error=access_denied` on deny
|
|
145
|
+
5. Client exchanges code and `code_verifier` for access token at `POST /OAuthToken`
|
|
146
|
+
|
|
147
|
+
After the earlier request, scope and client checks pass, `GET /OAuthAuthorize`
|
|
148
|
+
(the consent page) and its Approve (`POST /OAuthAuthorize`) answer
|
|
149
|
+
`400 invalid_request` when `code_challenge` is missing, empty or not exactly 43
|
|
150
|
+
base64url characters (43 is the length of an unpadded
|
|
151
|
+
`BASE64URL(SHA256(verifier))`), or when `code_challenge_method` is anything other than
|
|
152
|
+
`S256`. The consent page is not rendered and no authorization code is stored. A
|
|
153
|
+
Deny needs no PKCE fields: after redirect-URI validation passes, it redirects with `access_denied` and issues nothing (an invalid `redirect_uri` is refused with `400 invalid_redirect_uri` first).
|
|
154
|
+
|
|
155
|
+
The authorization-code exchange at `POST /OAuthToken` redeems a code only with a
|
|
156
|
+
`code_verifier` whose S256 hash equals the challenge stored with the code. A code
|
|
157
|
+
stored without an S256 challenge is `400 invalid_grant`. For an otherwise valid,
|
|
158
|
+
unused code carrying an S256 challenge, a missing verifier is
|
|
159
|
+
`400 invalid_request` and a verifier that does not match is `400 invalid_grant`.
|
|
160
|
+
A PKCE refusal does not redeem the code.
|
|
149
161
|
|
|
150
162
|
### Endpoints
|
|
151
163
|
|
|
@@ -295,6 +307,8 @@ flair principal add <principal-id> --admin
|
|
|
295
307
|
|
|
296
308
|
`add` upserts the Agent row. If `~/.flair/keys/<principal-id>.key` already exists, that key is reused and is not regenerated. The upsert writes the record this command builds, including `role: admin` and `admin: true` when `--admin` is set. With `--admin` and no `--trust`, the trust tier written is `endorsed`.
|
|
297
309
|
|
|
310
|
+
For a request signed with an agent key, the admin decision uses the Agent row the signature is verified against: the caller is an admin when that row has `role: admin`, or when its id is listed in the instance's `FLAIR_ADMIN_AGENTS` (comma-separated). The decision is made on every request and nothing is kept between requests, so a role change, a removed row, or a new row under the same id applies to the next request on every worker thread.
|
|
311
|
+
|
|
298
312
|
### CLI Reference
|
|
299
313
|
|
|
300
314
|
| Command | Description |
|
|
@@ -314,7 +328,7 @@ The web admin at `/AdminDashboard` provides a UI for managing:
|
|
|
314
328
|
- **Memory:** browse and search stored memories
|
|
315
329
|
- **Instance:** federation status, peer connections
|
|
316
330
|
|
|
317
|
-
Access
|
|
331
|
+
Access goes through the `allowAdmin` gate. It admits an admin agent, and admits the `internal` verdict only for a call whose context carries the marker that `internalContext()` sets and no request headers; a call that reaches the gate with no context is refused.
|
|
318
332
|
|
|
319
333
|
## Soul authorship
|
|
320
334
|
|
|
@@ -324,9 +338,9 @@ Ed25519 keys, including admin-agent keys, and MCP/OAuth delegation cannot create
|
|
|
324
338
|
update, patch or delete Soul. A missing context does not grant Soul authority.
|
|
325
339
|
This distinguishes credential classes; an administrator password is still a
|
|
326
340
|
privileged secret, not proof that a human typed the request. Keep it out of
|
|
327
|
-
agent-runtime environments. The n8n adapter
|
|
328
|
-
|
|
329
|
-
|
|
341
|
+
agent-runtime environments. The n8n adapter uses agent signing when Agent Private
|
|
342
|
+
Key is selected; its deprecated Admin Password path uses administrator Basic
|
|
343
|
+
authentication. Existing verified Soul reads are unchanged.
|
|
330
344
|
|
|
331
345
|
For an explicit operator edit:
|
|
332
346
|
|
|
@@ -351,18 +365,20 @@ Federation remains an authenticated instance-to-instance replication path and
|
|
|
351
365
|
preserves the originating record; it does not reclassify a runtime request as
|
|
352
366
|
an operator edit. Raw Harper OPS access remains administrator infrastructure.
|
|
353
367
|
|
|
354
|
-
|
|
355
|
-
|
|
368
|
+
A learned-text refusal reports `soul_value_is_learned_content` for a non-empty
|
|
369
|
+
exact value match with stored Memory or MemoryCandidate text for the target
|
|
370
|
+
agent, including legacy or untagged records.
|
|
356
371
|
The owner-scoped lookup prevents another agent from blocking edits by copying
|
|
357
372
|
known Soul text into its own memories. Learned artifacts are not an operator-authored Soul source;
|
|
358
373
|
claimed or missing provenance does not exempt them. Lookup failure aborts the
|
|
359
374
|
write. This is an exact-match backstop, not semantic detection of paraphrases.
|
|
360
375
|
Existing Soul records remain readable without a migration.
|
|
361
376
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
377
|
+
Authorized Soul resource POST/PUT with a non-empty `scopeTag` or non-empty
|
|
378
|
+
`tags` array in the request body, and authorized PATCH with those fields in
|
|
379
|
+
the merged row after its stored-row checks, receive
|
|
380
|
+
`soul_scope_fields_not_writable`. Runtime denial
|
|
381
|
+
does not depend on connector names — Soul writes are deny-by-default, and Flair
|
|
382
|
+
stamps `sourceClass` from verified Basic credentials or a deliberate internal
|
|
383
|
+
context, never a body field.
|
|
384
|
+
Do not grow a per-connector blacklist in Soul.
|