@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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reembed-server-support.ts — the server-support check `flair reembed` runs
|
|
3
|
+
* before its first write (flair#2337).
|
|
4
|
+
*
|
|
5
|
+
* flair#2298 made the CLI re-embed a row by sending `PATCH /Memory/<id>` with
|
|
6
|
+
* `{"embedding": null, "embeddingModel": null}`; the server recognises that
|
|
7
|
+
* body and re-embeds the stored row. A server built before #2298 does not. A
|
|
8
|
+
* CLI newer than its server is a supported state (`flair upgrade
|
|
9
|
+
* --no-restart`, a bare npm install, an unrestarted service), so the CLI reads
|
|
10
|
+
* the server's advertised capabilities from `GET /Health` before any write and
|
|
11
|
+
* refuses when the token is absent or the response cannot be parsed.
|
|
12
|
+
*
|
|
13
|
+
* The parser and message builders are pure; the fetch adapter lives in
|
|
14
|
+
* src/commands/reembed.ts.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* This build advertises this /Health capability for the re-embed PATCH.
|
|
18
|
+
* The shared constant aligns this build's CLI and server literals.
|
|
19
|
+
* A missing token is intentionally refused even if an intermediate server
|
|
20
|
+
* supports the PATCH.
|
|
21
|
+
*/
|
|
22
|
+
export const MEMORY_REEMBED_PATCH_CAPABILITY = "memory-reembed-patch";
|
|
23
|
+
/**
|
|
24
|
+
* The capability names a /Health body advertises.
|
|
25
|
+
*
|
|
26
|
+
* - an array of strings — the advertised capabilities (empty when the field
|
|
27
|
+
* is absent: an older server, or a build from before #2337 added it);
|
|
28
|
+
* - `null` — the field is present but not a string array. The client cannot
|
|
29
|
+
* interpret this shape, so the caller must treat the read as unverified
|
|
30
|
+
* rather than as "no capabilities".
|
|
31
|
+
*/
|
|
32
|
+
export function parseHealthCapabilities(body) {
|
|
33
|
+
if (typeof body !== "object" || body === null || Array.isArray(body))
|
|
34
|
+
return null;
|
|
35
|
+
const caps = body.capabilities;
|
|
36
|
+
if (caps === undefined)
|
|
37
|
+
return [];
|
|
38
|
+
if (!Array.isArray(caps) || caps.some((c) => typeof c !== "string"))
|
|
39
|
+
return null;
|
|
40
|
+
return caps;
|
|
41
|
+
}
|
|
42
|
+
/** The server version a /Health body reports, or null when it carries none. */
|
|
43
|
+
export function healthVersion(body) {
|
|
44
|
+
if (typeof body !== "object" || body === null)
|
|
45
|
+
return null;
|
|
46
|
+
const v = body.version;
|
|
47
|
+
return typeof v === "string" && v.length > 0 ? v : null;
|
|
48
|
+
}
|
|
49
|
+
/** The remedy both refusal messages end with. */
|
|
50
|
+
export const REEMBED_SUPPORT_REMEDY = "Restart or upgrade the server, then re-run `flair reembed`.";
|
|
51
|
+
/** The refusal for a server that answered but does not advertise the capability. */
|
|
52
|
+
export function reembedUnsupportedMessage(version) {
|
|
53
|
+
return [
|
|
54
|
+
"❌ flair reembed stopped before its first write: the server does not advertise the re-embed PATCH.",
|
|
55
|
+
` Found: server version ${version ?? "unknown"}, with no "${MEMORY_REEMBED_PATCH_CAPABILITY}" capability.`,
|
|
56
|
+
` ${REEMBED_SUPPORT_REMEDY}`,
|
|
57
|
+
].join("\n");
|
|
58
|
+
}
|
|
59
|
+
/** The refusal for a failed or unparseable /Health read. */
|
|
60
|
+
export function reembedUnverifiedMessage(detail) {
|
|
61
|
+
return [
|
|
62
|
+
"❌ flair reembed stopped before its first write: could not confirm the server supports the re-embed PATCH.",
|
|
63
|
+
` Found: ${detail}.`,
|
|
64
|
+
` ${REEMBED_SUPPORT_REMEDY}`,
|
|
65
|
+
].join("\n");
|
|
66
|
+
}
|
|
@@ -214,9 +214,11 @@ export function resolveNodeBin(explicit) {
|
|
|
214
214
|
if (!process.versions.bun && process.execPath && isAbsolute(process.execPath)) {
|
|
215
215
|
return process.execPath;
|
|
216
216
|
}
|
|
217
|
-
const r =
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
const r = spawnSync("/bin/sh", ["-s"], {
|
|
218
|
+
input: "command -v node\n", encoding: "utf8", timeout: STATUS_CHECK_TIMEOUT_MS,
|
|
219
|
+
});
|
|
220
|
+
const found = r.stdout?.trim().split("\n")[0]?.trim() ?? "";
|
|
221
|
+
if (r.status === 0 && found && isAbsolute(found) && existsSync(found))
|
|
220
222
|
return found;
|
|
221
223
|
throw new Error("unable to resolve an absolute path to a node binary (not running under node, and `command -v node` " +
|
|
222
224
|
"found nothing). The scheduler shim runs `<node> <flair-script>` with the node path baked in at " +
|
|
@@ -280,9 +282,11 @@ export function formatFlairBinWarning(baked, publicBin, enableCommand) {
|
|
|
280
282
|
return lines;
|
|
281
283
|
}
|
|
282
284
|
function lookupPublicFlairBin() {
|
|
283
|
-
const r =
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
const r = spawnSync("/bin/sh", ["-s"], {
|
|
286
|
+
input: "command -v flair\n", encoding: "utf8", timeout: STATUS_CHECK_TIMEOUT_MS,
|
|
287
|
+
});
|
|
288
|
+
const found = r.stdout?.trim().split("\n")[0]?.trim() ?? "";
|
|
289
|
+
if (r.status === 0 && found && isAbsolute(found) && existsSync(found))
|
|
286
290
|
return found;
|
|
287
291
|
return null;
|
|
288
292
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soul is scoped to an `agentId` and has no dedicated or enforced per-user
|
|
3
|
+
* scope field (schemas/memory.graphql).
|
|
4
|
+
* A write that would store a non-empty `scopeTag` or a non-empty `tags` array
|
|
5
|
+
* is refused by name when earlier guards permit the request, whatever the tag's
|
|
6
|
+
* prefix: POST and PUT check the request body, PATCH the merged row
|
|
7
|
+
* (flair#1540).
|
|
8
|
+
*
|
|
9
|
+
* The predicate runs in the server's write policy. The refusal name is
|
|
10
|
+
* imported by `flair import` and `flair restore`, which report a row refused
|
|
11
|
+
* with it; `flair rem restore` reports its generic HTTP error and imports
|
|
12
|
+
* neither.
|
|
13
|
+
*/
|
|
14
|
+
/** The named refusal for a Soul write that would store a non-empty `scopeTag` or a non-empty `tags` array. */
|
|
15
|
+
export const SOUL_SCOPE_FIELDS_REFUSAL = "soul_scope_fields_not_writable";
|
|
16
|
+
/**
|
|
17
|
+
* Whether a row would carry a non-empty `scopeTag` or a non-empty `tags`
|
|
18
|
+
* array. POST and PUT pass the request body; PATCH passes the merged row.
|
|
19
|
+
*/
|
|
20
|
+
export function suppliesSoulScopeFields(content) {
|
|
21
|
+
const scopeTag = content?.scopeTag;
|
|
22
|
+
if (scopeTag !== undefined && scopeTag !== null && scopeTag !== "")
|
|
23
|
+
return true;
|
|
24
|
+
const tags = content?.tags;
|
|
25
|
+
return Array.isArray(tags) && tags.length > 0;
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function systemdAgentId(unit) {
|
|
2
|
+
let agent = null;
|
|
3
|
+
let section = null;
|
|
4
|
+
for (const raw of unit.split(/\r?\n/)) {
|
|
5
|
+
const line = raw.trim();
|
|
6
|
+
if (!line || /^[#;]/.test(line))
|
|
7
|
+
continue;
|
|
8
|
+
if (line.startsWith("[")) {
|
|
9
|
+
section = line.slice(1, -1);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (section !== "Service")
|
|
13
|
+
continue;
|
|
14
|
+
if (line.endsWith("\\"))
|
|
15
|
+
return null;
|
|
16
|
+
const assignment = line.match(/^Environment\s*=\s*(.*)$/);
|
|
17
|
+
if (!assignment)
|
|
18
|
+
continue;
|
|
19
|
+
const value = assignment[1];
|
|
20
|
+
if (!value) {
|
|
21
|
+
agent = null;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const words = value.match(/"[^"\\]*"|'[^'\\]*'|[^\s"'\\]+/g);
|
|
25
|
+
if (!words || words.join(" ") !== value.replace(/\s+/g, " "))
|
|
26
|
+
return null;
|
|
27
|
+
for (const word of words) {
|
|
28
|
+
const token = /^["']/.test(word) ? word.slice(1, -1) : word;
|
|
29
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*=/.test(token))
|
|
30
|
+
return null;
|
|
31
|
+
if (token.startsWith("FLAIR_AGENT_ID=")) {
|
|
32
|
+
const id = token.slice("FLAIR_AGENT_ID=".length);
|
|
33
|
+
agent = /^[A-Za-z0-9._-]+$/.test(id) ? id : null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return agent;
|
|
38
|
+
}
|
|
@@ -207,9 +207,9 @@ export function validateHumanReviewerId(reviewerId) {
|
|
|
207
207
|
// lives server-side in resources/auto-promote-lib.ts (decideAutoPromote — the
|
|
208
208
|
// UNATTENDED path), which IMPORTS these from here. The direction is deliberate
|
|
209
209
|
// and established in this repo: a server file may import a PURE helper from src/
|
|
210
|
-
// (resources/PromoteMemoryCandidate.ts
|
|
211
|
-
//
|
|
212
|
-
//
|
|
210
|
+
// (resources/PromoteMemoryCandidate.ts already imports this very module); it is
|
|
211
|
+
// a CLI file importing FROM resources/ that does not survive npm packaging.
|
|
212
|
+
// Defining it here lets the CLI side
|
|
213
213
|
// (src/commands/rem.ts, `flair rem candidates`) and the server gate share ONE
|
|
214
214
|
// implementation rather than a hand-kept pair.
|
|
215
215
|
//
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* invokes `flair rem nightly run-once`, the runner module does the work.
|
|
15
15
|
*/
|
|
16
16
|
import { existsSync, mkdirSync, chmodSync, rmSync } from "node:fs";
|
|
17
|
-
import { resolve, dirname } from "node:path";
|
|
17
|
+
import { resolve, dirname, join } from "node:path";
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
20
|
import { escapeXml } from "../lib/xml-escape.js";
|
|
@@ -93,16 +93,26 @@ function validateSchedule(hour, minute) {
|
|
|
93
93
|
throw new Error(`minute must be an integer 0-59, got ${minute}`);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Quote a value as ONE POSIX shell word. Embedded single quotes are closed,
|
|
98
|
+
* escaped, and reopened, so the shell reads the value literally and never
|
|
99
|
+
* interprets `$()`, backticks, or quotes inside it.
|
|
100
|
+
*/
|
|
101
|
+
export function quoteShimArg(value) {
|
|
102
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
103
|
+
}
|
|
96
104
|
function buildSubstitutions(opts, shimPath, flairBin, nodeBin) {
|
|
97
105
|
validateSchedule(opts.hour, opts.minute);
|
|
98
106
|
if (!/^[a-zA-Z0-9_-]+$/.test(opts.agentId)) {
|
|
99
107
|
throw new Error(`invalid agent id: ${opts.agentId}`);
|
|
100
108
|
}
|
|
109
|
+
const home = opts.homeOverride ?? resolveHome();
|
|
101
110
|
return {
|
|
102
111
|
FLAIR_BIN: flairBin,
|
|
103
112
|
NODE_BIN: nodeBin,
|
|
104
113
|
SHIM_PATH: shimPath,
|
|
105
|
-
|
|
114
|
+
ADMIN_PASS_FILE: resolve(opts.adminPassFile ?? join(home, ".flair", "admin-pass")),
|
|
115
|
+
HOME: home,
|
|
106
116
|
AGENT_ID: opts.agentId,
|
|
107
117
|
FLAIR_URL: opts.flairUrl,
|
|
108
118
|
HOUR: String(opts.hour),
|
|
@@ -369,8 +379,15 @@ export function enableScheduler(opts) {
|
|
|
369
379
|
`\`flair rem nightly enable\`.`);
|
|
370
380
|
}
|
|
371
381
|
const stderrLogPath = resolve(logsDir, "rem-nightly.stderr.log");
|
|
372
|
-
// 1. Deploy the shim (always — both platforms invoke it).
|
|
373
|
-
|
|
382
|
+
// 1. Deploy the shim (always — both platforms invoke it). Every path passed
|
|
383
|
+
// to the command is one POSIX single-quoted argument; none is double-quoted,
|
|
384
|
+
// so shell syntax inside a path stays literal.
|
|
385
|
+
const shimContents = renderTemplate(readTemplate(templateRoot, "bin/flair-rem-nightly.sh.tmpl"), {
|
|
386
|
+
...subs,
|
|
387
|
+
NODE_BIN: quoteShimArg(subs.NODE_BIN),
|
|
388
|
+
FLAIR_BIN: quoteShimArg(subs.FLAIR_BIN),
|
|
389
|
+
ADMIN_PASS_FILE: quoteShimArg(subs.ADMIN_PASS_FILE),
|
|
390
|
+
});
|
|
374
391
|
writeFileWithDir(shimPath, shimContents, 0o700);
|
|
375
392
|
chmodSync(shimPath, 0o700);
|
|
376
393
|
// 2. Write the scheduler entry.
|
package/docs/access-control.md
CHANGED
|
@@ -27,12 +27,12 @@ server, which has them sign in at the identity provider configured under
|
|
|
27
27
|
configures GitHub. The access token the app receives carries the login as its
|
|
28
28
|
subject; for GitHub, that is the account's username.
|
|
29
29
|
|
|
30
|
-
`/mcp` answers `initialize
|
|
31
|
-
|
|
30
|
+
`/mcp` answers `initialize` and `ping` for any valid token, and refuses a
|
|
31
|
+
`tools/call` for an unknown tool name, before it looks at the mapping.
|
|
32
32
|
On a `tools/call` for a known tool, Flair looks for a `Credential` of kind `idp`
|
|
33
33
|
whose `idpSubject` is that login, that names a principal, and whose status is
|
|
34
|
-
|
|
35
|
-
or admin identity:
|
|
34
|
+
exactly `active`, and acts as that principal. There is no fallback to an
|
|
35
|
+
anonymous or admin identity:
|
|
36
36
|
|
|
37
37
|
- **No mapping:** the call is refused. `/mcp` answers HTTP 200 with a JSON-RPC
|
|
38
38
|
error:
|
|
@@ -41,6 +41,10 @@ or admin identity:
|
|
|
41
41
|
{"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"forbidden: token subject is not a provisioned flair agent"}}
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
- **The login's credentials are not `active` or name no principal:** refused
|
|
45
|
+
with code `-32001`. The message names one of those credentials and its stored
|
|
46
|
+
status (`revoked`, any other value, or no status), and says an operator must
|
|
47
|
+
re-link it.
|
|
44
48
|
- **Mapped to a principal that does not exist:** refused with code `-32001` and
|
|
45
49
|
a message naming the principal.
|
|
46
50
|
- **Mapped to a deactivated principal:** refused; see
|
|
@@ -48,6 +52,10 @@ or admin identity:
|
|
|
48
52
|
- **The credential or the principal could not be read:** refused with code
|
|
49
53
|
`-32000` and a message starting `unavailable:`.
|
|
50
54
|
|
|
55
|
+
A `tools/list` reads the mapping the same way and answers each case above
|
|
56
|
+
except **No mapping** with the same error; with no mapping it returns a tool
|
|
57
|
+
list.
|
|
58
|
+
|
|
51
59
|
### Map a person to a principal
|
|
52
60
|
|
|
53
61
|
`flair mcp enable` writes the mapping in its `identity-mapping` step:
|
|
@@ -90,10 +98,41 @@ read-back described under [One mapping per login](#one-mapping-per-login)
|
|
|
90
98
|
passed. The command stops before restarting the instance, reports the
|
|
91
99
|
`secrets-provisioning` step as not applied, and exits non-zero.
|
|
92
100
|
|
|
101
|
+
### Link or unlink one login
|
|
102
|
+
|
|
103
|
+
`flair principal link` does only the mapping step, on an instance that is
|
|
104
|
+
already enabled:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
flair principal link alice --instance https://flair.example.com \
|
|
108
|
+
--idp-subject alice --admin-pass "$TARGET_ADMIN_PASS"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The principal must already exist: a missing one is refused by name. A subject
|
|
112
|
+
already mapped to that principal is reported with nothing written; a subject
|
|
113
|
+
mapped to a different principal is refused unless `--replace` moves it, which
|
|
114
|
+
prints the prior principal and any superseded credential. More than one active
|
|
115
|
+
principal mapped to the subject is refused before writing.
|
|
116
|
+
`--instance` (else `FLAIR_URL`) must be HTTPS: these commands
|
|
117
|
+
send the target's admin credential to its operations API, which on a hosted
|
|
118
|
+
instance is the instance host at port 9925. <!-- docs-freshness-allow: hosted operations API port, not the data port -->
|
|
119
|
+
An unparseable URL, `localhost`, a `.local` name, or a loopback, unspecified,
|
|
120
|
+
RFC1918, link-local or IPv6 unique-local address literal is refused before any
|
|
121
|
+
request, and a REMOTE target gets no `--admin-pass` fallback (the rule
|
|
122
|
+
`flair mcp enable` applies).
|
|
123
|
+
|
|
124
|
+
`flair principal unlink <principal> --idp-subject <login>` defaults to provider
|
|
125
|
+
`github`; pass `--idp-provider <name>` for a different provider. Unlink reports
|
|
126
|
+
success only after confirmed updates and no resolvable subject mapping on
|
|
127
|
+
readback. With `FLAIR_MCP_JIT_PROVISION` on, a known tool call after an
|
|
128
|
+
unmapped login may provision a new principal.
|
|
129
|
+
`flair principal links <principal>` lists a principal's current mappings, and
|
|
130
|
+
both take the same `--instance` and `--admin-pass`.
|
|
131
|
+
|
|
93
132
|
### One mapping per login
|
|
94
133
|
|
|
95
|
-
`flair mcp enable` and the resolver both
|
|
96
|
-
its status is `
|
|
134
|
+
`flair mcp enable` and the resolver both treat a login's `idp` credential as a
|
|
135
|
+
mapping only when its status is exactly `active` and it names a principal.
|
|
97
136
|
`flair mcp enable` keeps one such credential per login, whatever the provider
|
|
98
137
|
name:
|
|
99
138
|
|
|
@@ -102,14 +141,38 @@ name:
|
|
|
102
141
|
says `re-pointed`. Calls from that login then act as the principal the
|
|
103
142
|
credential names. Memories are not moved or merged; each principal keeps its
|
|
104
143
|
own.
|
|
105
|
-
- If the login has a credential
|
|
106
|
-
|
|
107
|
-
prints its id after `SUPERSEDED:`.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
144
|
+
- If the login has a credential under a different provider name whose status
|
|
145
|
+
is `active` and that names a principal, the run revokes it (the row stays,
|
|
146
|
+
with status `revoked`) and prints its id after `SUPERSEDED:`. A credential
|
|
147
|
+
whose status is anything else is not changed.
|
|
148
|
+
- After writing, it requires exactly one resolvable (principal-bearing) active
|
|
149
|
+
credential matching the written id and principal.
|
|
150
|
+
Principal-less legacy rows are skipped and may remain active.
|
|
151
|
+
|
|
152
|
+
### Who writes a mapping
|
|
153
|
+
|
|
154
|
+
Through the `Credential` resource, only an administrator or Flair itself
|
|
155
|
+
creates an `idp` credential, changes its kind or identity fields, or
|
|
156
|
+
reactivates it. Flair writes mappings through `flair mcp enable`,
|
|
157
|
+
`flair principal link` and `unlink`, and just-in-time provisioning (below, and
|
|
158
|
+
the XAA grant's); an administrator can also write one through the `Credential`
|
|
159
|
+
resource.
|
|
160
|
+
|
|
161
|
+
On POST, PUT and PATCH, the checks that run first decide before this rule:
|
|
162
|
+
authentication, the owner checks, and the request checks (the rate limit and
|
|
163
|
+
kind validation on POST and PUT, the single-record body on PATCH). For a
|
|
164
|
+
non-admin agent, the owner checks keep their own 403: on PATCH and PUT the
|
|
165
|
+
owner-field guard refuses a change to the credential's principal, PUT refuses
|
|
166
|
+
a body that names another principal, and PATCH, PUT and DELETE refuse a write
|
|
167
|
+
to another principal's credential. On POST, a non-admin agent's credential is
|
|
168
|
+
stamped with its own principal; a `principalId` in the body is not used. An
|
|
169
|
+
administrator may write another principal's credential. A non-admin agent's
|
|
170
|
+
write that passes those checks gets HTTP 403
|
|
171
|
+
with the error `idp_mapping_admin_only` when it would create an `idp`
|
|
172
|
+
credential, change a credential's kind to or from `idp`, change an `idp`
|
|
173
|
+
credential's provider or subject, or change its status to anything other than
|
|
174
|
+
`revoked` (so it cannot reactivate one). A non-admin agent may relabel its own
|
|
175
|
+
`idp` credential, set its status to `revoked`, and delete it.
|
|
113
176
|
|
|
114
177
|
### Just-in-time provisioning
|
|
115
178
|
|
|
@@ -165,17 +228,20 @@ instead (see below).
|
|
|
165
228
|
`client_id` before it sends the person to the identity provider; the person
|
|
166
229
|
continues from there.
|
|
167
230
|
- **Public clients with PKCE.** The document of an app that signs people in
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
231
|
+
may declare its token endpoint auth method. With the shipped `config.yaml` it
|
|
232
|
+
must be `token_endpoint_auth_method: none`, or the field left out; any other
|
|
233
|
+
value is refused with `invalid_client`. Every authorization request must
|
|
234
|
+
carry a PKCE `code_challenge` with method `S256`. With MCP enabled and a
|
|
235
|
+
provider configured, the shipped server advertises `none`,
|
|
236
|
+
`client_secret_basic` and `client_secret_post` as token endpoint auth methods (the last two apply only to registered clients)
|
|
237
|
+
and does not advertise `private_key_jwt`. Setting
|
|
174
238
|
`mcp.clientCredentials.enabled: true`, which turns on the headless grant,
|
|
175
239
|
changes the metadata: it then also lists `private_key_jwt`, the
|
|
176
|
-
`client_credentials` grant type and `EdDSA` as the
|
|
177
|
-
|
|
178
|
-
|
|
240
|
+
`client_credentials` grant type and `RS256`, `ES256` and `EdDSA` as the
|
|
241
|
+
assertion signing algorithms. Setting
|
|
242
|
+
`mcp.clientIdMetadataDocuments.privateKeyJwt.enabled: true` also lists
|
|
243
|
+
`private_key_jwt` and those three algorithms. With either setting, a document
|
|
244
|
+
may declare `private_key_jwt` (with usable keys) instead of `none`.
|
|
179
245
|
|
|
180
246
|
### Changing the list
|
|
181
247
|
|
|
@@ -216,19 +282,31 @@ an upgrade replaces that file, run the command again or edit the file.
|
|
|
216
282
|
|
|
217
283
|
### ChatGPT
|
|
218
284
|
|
|
219
|
-
ChatGPT's
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
285
|
+
With MCP enabled and a provider configured, admitting ChatGPT's CIMD client
|
|
286
|
+
requires `chatgpt.com` in `mcp.clientIdMetadataDocuments.allowedHosts` and
|
|
287
|
+
`mcp.clientIdMetadataDocuments.privateKeyJwt.enabled: true`. ChatGPT's assertion
|
|
288
|
+
uses the token-endpoint URL as its audience, so the pinned `@harperfast/oauth`
|
|
289
|
+
2.9.0 also requires this exception in the deployed `config.yaml`:
|
|
290
|
+
|
|
291
|
+
```yaml
|
|
292
|
+
'@harperfast/oauth':
|
|
293
|
+
mcp:
|
|
294
|
+
clientIdMetadataDocuments:
|
|
295
|
+
allowedHosts:
|
|
296
|
+
- claude.ai
|
|
297
|
+
- claude.com
|
|
298
|
+
- chatgpt.com
|
|
299
|
+
privateKeyJwt:
|
|
300
|
+
enabled: true
|
|
301
|
+
tokenEndpointAudience:
|
|
302
|
+
clientIds:
|
|
303
|
+
- https://chatgpt.com/oauth/client.json
|
|
304
|
+
expiresAt: '2026-11-01T00:00:00Z'
|
|
305
|
+
```
|
|
228
306
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
307
|
+
Use the exact client ID and an operator-chosen future ISO 8601 `expiresAt`;
|
|
308
|
+
the exception stops accepting the token-endpoint audience at that expiry.
|
|
309
|
+
Restart Flair after editing the configuration.
|
|
232
310
|
|
|
233
311
|
## 3. What they can touch
|
|
234
312
|
|
|
@@ -269,24 +347,57 @@ A connection acts as its principal:
|
|
|
269
347
|
|
|
270
348
|
### Revoking access
|
|
271
349
|
|
|
272
|
-
Deactivate
|
|
273
|
-
`--admin-pass
|
|
350
|
+
Deactivate or reactivate a local principal with `FLAIR_ADMIN_PASS` set or
|
|
351
|
+
`--admin-pass` (and neither `--instance` nor `FLAIR_URL` set):
|
|
274
352
|
|
|
275
353
|
```bash
|
|
276
354
|
flair principal disable alice
|
|
355
|
+
flair principal enable alice
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
For a principal on a remote instance, pass the instance URL and its admin
|
|
359
|
+
password explicitly. These commands share two precedence and credential rules
|
|
360
|
+
with `flair mcp enable`: an explicit `--instance` wins over `FLAIR_URL`, and a
|
|
361
|
+
remote operation requires an explicit `--admin-pass`. The principal commands accept
|
|
362
|
+
explicit loopback targets; `flair mcp enable` accepts loopback or unspecified targets
|
|
363
|
+
for the local restart but refuses local issuers.
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
flair principal disable alice \
|
|
367
|
+
--instance https://flair.example.com \
|
|
368
|
+
--admin-pass "$TARGET_ADMIN_PASS"
|
|
369
|
+
flair principal enable alice \
|
|
370
|
+
--instance https://flair.example.com \
|
|
371
|
+
--admin-pass "$TARGET_ADMIN_PASS"
|
|
277
372
|
```
|
|
278
373
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
`
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
374
|
+
Set `TARGET_ADMIN_PASS` to that instance's admin password before running the
|
|
375
|
+
remote example. A success line appears only after the command reads `alice`,
|
|
376
|
+
the operations API names it in the update result, and a read-back shows the
|
|
377
|
+
requested status; the line reports that read-back status.
|
|
378
|
+
|
|
379
|
+
- On the local path it sends an `update` to the operations API at `127.0.0.1`
|
|
380
|
+
on the machine it runs on. The port precedence is a valid explicit
|
|
381
|
+
`--ops-port`, then `FLAIR_OPS_PORT`, then `opsPort` in the local Flair config,
|
|
382
|
+
then one less than the resolved HTTP port. An invalid explicit `--ops-port`
|
|
383
|
+
is refused with a remedy; it never falls through to a lower-precedence port.
|
|
384
|
+
- With `--instance` (or `FLAIR_URL`) it sends the same `update` to the ops API
|
|
385
|
+
derived from that served instance URL, using the `flair mcp enable` hosted
|
|
386
|
+
operations port convention. A remote target requires an explicit
|
|
387
|
+
`--admin-pass`: `FLAIR_ADMIN_PASS` and `~/.flair/admin-pass` are
|
|
388
|
+
this machine's local credentials and are never sent to another instance.
|
|
389
|
+
`FLAIR_TARGET` and `FLAIR_OPS_TARGET` do not select a principal target.
|
|
390
|
+
Redirects, unconfirmed results, and requests that fail or time out are
|
|
391
|
+
refused with a non-zero exit. Diagnostics omit URL userinfo, query values,
|
|
392
|
+
and unexpected response values; an unparseable target is printed only as
|
|
393
|
+
`<unparseable URL>`.
|
|
394
|
+
- Disable sets the principal's `status` to `deactivated`; enable sets it to
|
|
395
|
+
`active`. Both update its `updatedAt` and nothing else: the principal's
|
|
396
|
+
memories and its login mapping stay. Harper can accept an update for an id
|
|
397
|
+
that has no record, so the command reads the principal first and refuses
|
|
398
|
+
`no principal <id>` before any update when no row exists; a read that fails
|
|
399
|
+
or returns an unreadable body is refused as unverified rather than as
|
|
400
|
+
missing.
|
|
290
401
|
- Flair reads the principal's status on every `tools/call` for a known tool, and
|
|
291
402
|
refuses those calls for a deactivated principal, including calls that carry a
|
|
292
403
|
token issued before the change:
|
|
@@ -299,8 +410,8 @@ When the operations API accepts the update, it prints
|
|
|
299
410
|
401 `{"error":"principal_deactivated"}`.
|
|
300
411
|
- Disabling does not revoke OAuth tokens: they stay valid until they expire,
|
|
301
412
|
and their tool calls are refused. Setting the status back to `active`
|
|
302
|
-
restores access for tokens that are still valid.
|
|
303
|
-
|
|
413
|
+
restores access for tokens that are still valid. `flair principal enable`
|
|
414
|
+
sets the status to `active`.
|
|
304
415
|
|
|
305
416
|
To close `/mcp` for everyone, unset `FLAIR_MCP_OAUTH` in the instance's
|
|
306
417
|
environment (or set it to `0`) and restart the instance; `flair mcp disable`
|
|
@@ -339,7 +450,9 @@ instance's admin password.
|
|
|
339
450
|
|
|
340
451
|
Create a GitHub OAuth app whose callback URL is
|
|
341
452
|
`https://flair.example.com/oauth/github/callback` (the command prints this URL
|
|
342
|
-
too).
|
|
453
|
+
too). The command stages `OAUTH_GITHUB_CLIENT_ID`, `OAUTH_GITHUB_CLIENT_SECRET`
|
|
454
|
+
and `OAUTH_GITHUB_REDIRECT_URI=<public-origin>/oauth` using `--issuer`
|
|
455
|
+
(default: `--instance`). Then run:
|
|
343
456
|
|
|
344
457
|
```bash
|
|
345
458
|
flair mcp enable \
|
|
@@ -352,8 +465,6 @@ flair mcp enable \
|
|
|
352
465
|
When it finishes, it prints each step it ran, marked ✓ or ✗. The steps that
|
|
353
466
|
act:
|
|
354
467
|
|
|
355
|
-
- `signing-key` creates `~/.flair/mcp-signing-key.pem` (or the
|
|
356
|
-
`--signing-key-file` path), or reuses the file if it exists.
|
|
357
468
|
- `idp-credentials` checks that the OAuth app's client id and secret are
|
|
358
469
|
present; in a terminal, the command prompts for them before the steps run.
|
|
359
470
|
- `secrets-provisioning` always stages the secrets the instance needs in a local
|
|
@@ -441,7 +552,6 @@ shares her connector's memories.
|
|
|
441
552
|
|
|
442
553
|
**How to choose:** use one principal when both apps should see the same private
|
|
443
554
|
memories. Keep two when you want to revoke or audit them separately.
|
|
444
|
-
ChatGPT's CIMD client cannot be the second app yet; see [ChatGPT](#chatgpt).
|
|
445
555
|
|
|
446
556
|
**Check:** `bootstrap` in each app returns the `agentId` you chose.
|
|
447
557
|
**Revoke:** `flair principal disable` for the principal you want to stop.
|