@tpsdev-ai/flair 0.55.2 → 0.57.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 +18 -19
- package/dist/bridges/builtins/markdown.js +2 -2
- package/dist/bridges/discover.js +2 -2
- package/dist/bridges/runtime/allow-list.js +2 -2
- package/dist/build-info.json +3 -3
- package/dist/cli.js +125 -26
- package/dist/commands/agent.js +22 -15
- package/dist/commands/attention.js +2 -2
- package/dist/commands/backup.js +2 -2
- package/dist/commands/bridge.js +40 -3
- package/dist/commands/doctor.js +91 -28
- package/dist/commands/export.js +2 -2
- package/dist/commands/federation.js +441 -68
- package/dist/commands/hook.js +4 -4
- package/dist/commands/init.js +59 -12
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/migrate-harness-memory.js +8 -8
- package/dist/commands/rem.js +2 -2
- package/dist/commands/service.js +25 -1
- package/dist/commands/session.js +2 -2
- package/dist/commands/uninstall.js +2 -2
- package/dist/commands/upgrade.js +3 -3
- package/dist/doctor-client.js +5 -23
- package/dist/engine-version.js +2 -2
- package/dist/federation/scheduler.js +5 -5
- package/dist/install/clients.js +5 -10
- package/dist/keystore.js +10 -2
- package/dist/lib/auth-resolve.js +51 -5
- package/dist/lib/doctor-config-path.js +2 -2
- package/dist/lib/flair-paths.js +29 -0
- package/dist/lib/home.js +60 -0
- package/dist/lib/instance-identity-row.js +580 -0
- package/dist/lib/launchd-repair.js +6 -0
- package/dist/lib/mcp-enable.js +4 -4
- package/dist/lib/owned-pins.js +1 -13
- package/dist/lib/redact-token-id.js +197 -0
- package/dist/lib/socket-path-limit.js +120 -0
- package/dist/lib/uninstall-purge.js +2 -18
- package/dist/lib/upgrade-plain-tree.js +2 -2
- package/dist/mcp-client-assertion.js +3 -3
- package/dist/rem/runner.js +3 -3
- package/dist/rem/scheduler.js +5 -5
- package/dist/rem/snapshot.js +2 -2
- package/dist/resources/AgentSeed.js +4 -1
- package/dist/resources/Asset.js +3 -11
- package/dist/resources/Credential.js +4 -10
- package/dist/resources/Federation.js +232 -78
- package/dist/resources/Integration.js +8 -32
- package/dist/resources/Memory.js +58 -16
- package/dist/resources/MemoryBootstrap.js +19 -12
- package/dist/resources/MemoryCandidate.js +3 -11
- package/dist/resources/MemoryDedupStats.js +1 -1
- package/dist/resources/MemoryFeed.js +10 -2
- package/dist/resources/MemoryGrant.js +19 -40
- package/dist/resources/MemoryUsage.js +7 -20
- package/dist/resources/OAuth.js +62 -11
- package/dist/resources/Presence.js +135 -47
- package/dist/resources/Relationship.js +3 -11
- package/dist/resources/SemanticSearch.js +25 -13
- package/dist/resources/admin-layout.js +7 -2
- package/dist/resources/auth-middleware.js +32 -5
- package/dist/resources/bm25.js +13 -14
- package/dist/resources/federation-cleanup.js +289 -51
- package/dist/resources/health.js +48 -8
- package/dist/resources/in-process-api.js +2 -1
- package/dist/resources/instance-create-lock.js +363 -0
- package/dist/resources/instance-identity-rows.js +43 -0
- package/dist/resources/instance-identity.js +94 -10
- package/dist/resources/mcp-handler.js +9 -1
- package/dist/resources/mcp-tool-arguments.js +83 -0
- package/dist/resources/mcp-tools.js +4 -5
- package/dist/resources/memory-reflect-lib.js +17 -1
- package/dist/resources/memory-visibility.js +10 -7
- package/dist/resources/rate-limit.js +6 -4
- package/dist/resources/record-type-kit.js +47 -23
- package/dist/resources/search-readiness.js +7 -1
- package/dist/resources/semantic-retrieval-core.js +98 -3
- package/dist/resources/table-helpers.js +33 -0
- package/dist/resources/tool-descriptors/index.js +2 -2
- package/dist/src/keystore.js +10 -2
- package/dist/src/lib/home.js +60 -0
- package/dist/src/lib/instance-identity-row.js +580 -0
- package/dist/src/lib/redact-token-id.js +197 -0
- package/dist/src/rem/scheduler.js +5 -5
- package/dist/version-check.js +2 -2
- package/dist/version-handshake.js +2 -2
- package/docs/api-reference.md +32 -7
- package/docs/auth.md +19 -7
- package/docs/claude-code.md +5 -6
- package/docs/deploying-on-fabric.md +8 -4
- package/docs/deployment.md +26 -37
- package/docs/embedding-in-a-harper-app.md +4 -2
- package/docs/entity-vocabulary.md +5 -5
- package/docs/federation.md +48 -21
- package/docs/hosted-on-fabric.md +7 -4
- package/docs/integrations.md +24 -15
- package/docs/mcp-clients.md +44 -23
- package/docs/n8n.md +8 -8
- package/docs/notes/mcp-oauth-model2.md +12 -17
- package/docs/openclaw.md +29 -28
- package/docs/spoke-bringup.md +44 -22
- package/docs/standalone-local.md +12 -16
- package/docs/supply-chain-policy.md +21 -8
- package/docs/system-requirements.md +1 -1
- package/docs/upgrade.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* redact-token-id.ts — the ONE pairing-token-id redactor (flair#1902).
|
|
3
|
+
*
|
|
4
|
+
* A pairing-token id IS the credential a spoke redeems, so only its 8-character
|
|
5
|
+
* prefix may ever reach a log line. Three sites grew their own copy of this rule
|
|
6
|
+
* in one day (the cleanup sweep's per-token lines, its table-level lines, and the
|
|
7
|
+
* rollback reporter), so the class is fixed here rather than at each site: one
|
|
8
|
+
* deep redactor every line that can carry a token id passes through.
|
|
9
|
+
*
|
|
10
|
+
* This is HYGIENE, not a security boundary — an operator holds admin credentials
|
|
11
|
+
* and can read the table directly. But a token id printed in full in a log is a
|
|
12
|
+
* credential handed to whoever reads the log, and the same gap reappearing at a
|
|
13
|
+
* new site is the failure this module exists to end.
|
|
14
|
+
*
|
|
15
|
+
* What "deep" means: a string (a message OR a string field at any depth, an array
|
|
16
|
+
* element, or an object KEY) has each secret replaced; numbers, booleans and null
|
|
17
|
+
* pass through untouched; a PLAIN object is rebuilt with redacted keys and values.
|
|
18
|
+
* Object keys are redacted too — a `{ "<token-id>": ... }` map is exactly as much
|
|
19
|
+
* a leak as one in a value. A NON-plain object — a Date, Error, Map, Set or class
|
|
20
|
+
* instance — passes through unchanged: rebuilding it through `Object.entries`
|
|
21
|
+
* would lose its message or entries, and its String form is what a caller should
|
|
22
|
+
* log. A cyclic value terminates: a container already on the path is returned
|
|
23
|
+
* as-is rather than recursed into (a log helper must never crash the sweep).
|
|
24
|
+
*
|
|
25
|
+
* Two properties the naive `split(secret).join(prefix)` gets wrong, and this
|
|
26
|
+
* module gets right:
|
|
27
|
+
*
|
|
28
|
+
* - LENGTH GUARD: a secret shorter than MIN_SECRET_LENGTH characters is
|
|
29
|
+
* replaced by "[redacted]" in full. Cutting an 11-character id to its
|
|
30
|
+
* 8-character prefix leaves most of the id visible, which is not a redaction.
|
|
31
|
+
* Empty secrets are ignored (never a replacement of "" that would splice the
|
|
32
|
+
* replacement between every character).
|
|
33
|
+
* - ONE PASS, LONGEST FIRST: the secrets are matched in a SINGLE pass over the
|
|
34
|
+
* original text, longest secret first. Sequential replaces let a short secret
|
|
35
|
+
* that is a prefix of a longer one match first and strand the longer id's
|
|
36
|
+
* suffix — and let a later secret match inside text a previous replacement
|
|
37
|
+
* just inserted. A single left-to-right scan avoids both, and it deliberately
|
|
38
|
+
* does NOT build a RegExp: a pattern assembled from the secrets would run on
|
|
39
|
+
* caller-supplied text, and a ReDoS there is a worse failure than the leak.
|
|
40
|
+
*
|
|
41
|
+
* `createTokenRedactor(secrets)` compiles the matcher once; the sweep reuses one
|
|
42
|
+
* per tick rather than rebuilding the replacement rules (or copying the id list)
|
|
43
|
+
* for every line it logs.
|
|
44
|
+
*/
|
|
45
|
+
/** How many leading characters of a long secret are kept. */
|
|
46
|
+
export const TOKEN_ID_PREFIX_LENGTH = 8;
|
|
47
|
+
/**
|
|
48
|
+
* Below this length, a secret is replaced in full: its "prefix" would be most of
|
|
49
|
+
* it. Pairing-token ids are 32 characters (`randomBytes(24).toString("base64url")`),
|
|
50
|
+
* so this bound is an untested assumption made explicit, not a live path — the
|
|
51
|
+
* guard exists so a short id can never be printed whole by a prefix rule.
|
|
52
|
+
*/
|
|
53
|
+
export const MIN_SECRET_LENGTH = 12;
|
|
54
|
+
/** What a secret too short to prefix-cut becomes. */
|
|
55
|
+
export const FULLY_REDACTED = "[redacted]";
|
|
56
|
+
/** The replacement text for one secret. */
|
|
57
|
+
function replacementFor(secret) {
|
|
58
|
+
return secret.length < MIN_SECRET_LENGTH
|
|
59
|
+
? FULLY_REDACTED
|
|
60
|
+
: `${secret.slice(0, TOKEN_ID_PREFIX_LENGTH)}…`;
|
|
61
|
+
}
|
|
62
|
+
/** Non-empty, de-duplicated secrets paired with their replacement, longest first. */
|
|
63
|
+
function secretReplacements(secrets) {
|
|
64
|
+
const seen = new Set();
|
|
65
|
+
const out = [];
|
|
66
|
+
for (const secret of secrets) {
|
|
67
|
+
if (typeof secret !== "string" || secret.length === 0)
|
|
68
|
+
continue;
|
|
69
|
+
if (seen.has(secret))
|
|
70
|
+
continue;
|
|
71
|
+
seen.add(secret);
|
|
72
|
+
out.push([secret, replacementFor(secret)]);
|
|
73
|
+
}
|
|
74
|
+
// Longest-first: the scan takes the LONGEST secret that starts at a position,
|
|
75
|
+
// so where two secrets overlap the longer one wins and no suffix of it is left
|
|
76
|
+
// stranded by a shorter secret matching first.
|
|
77
|
+
out.sort((a, b) => b[0].length - a[0].length);
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Compile `secrets` into a redactor. Build it ONCE for a batch of lines and reuse
|
|
82
|
+
* it — the sweep logs many lines per tick, and recompiling per line is the
|
|
83
|
+
* quadratic cost this avoids.
|
|
84
|
+
*
|
|
85
|
+
* The scan walks the ORIGINAL text once: at each position it takes the longest
|
|
86
|
+
* secret that starts there (the list is longest-first), emits that secret's
|
|
87
|
+
* replacement, and advances past it; otherwise it copies one character. Text a
|
|
88
|
+
* replacement inserts is never re-scanned, and no RegExp is built from the
|
|
89
|
+
* secrets (so a token id can never become a pattern).
|
|
90
|
+
*/
|
|
91
|
+
export function createTokenRedactor(secrets) {
|
|
92
|
+
const replacements = secretReplacements(secrets);
|
|
93
|
+
const redactMessage = (message) => {
|
|
94
|
+
if (replacements.length === 0 || message.length === 0)
|
|
95
|
+
return message;
|
|
96
|
+
let out = "";
|
|
97
|
+
let i = 0;
|
|
98
|
+
while (i < message.length) {
|
|
99
|
+
let matched;
|
|
100
|
+
for (const pair of replacements) {
|
|
101
|
+
if (message.startsWith(pair[0], i)) {
|
|
102
|
+
matched = pair;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (matched) {
|
|
107
|
+
out += matched[1];
|
|
108
|
+
i += matched[0].length;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
out += message[i];
|
|
112
|
+
i += 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
redactMessage,
|
|
119
|
+
redactValue: (value) => (replacements.length === 0 ? value : walk(value, redactMessage)),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function walk(value, redact) {
|
|
123
|
+
return walkDeep(value, redact, new Map());
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A plain object: its prototype is `Object.prototype` or null. A Date, Error,
|
|
127
|
+
* Map, Set or class instance is NOT a plain object, so it is not rebuilt — it
|
|
128
|
+
* passes through UNREDACTED, and its String form is what a caller should log
|
|
129
|
+
* (every call site stringifies an error before it reaches the redactor).
|
|
130
|
+
*/
|
|
131
|
+
function isPlainObject(value) {
|
|
132
|
+
const proto = Object.getPrototypeOf(value);
|
|
133
|
+
return proto === Object.prototype || proto === null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Rebuild `value` with every string redacted. `copies` maps each container
|
|
137
|
+
* already rebuilt to its REDACTED copy, and the copy is registered before its
|
|
138
|
+
* children are walked: a sub-object reached twice (an alias) is the same
|
|
139
|
+
* redacted copy both times, and a cyclic value terminates by pointing at its own
|
|
140
|
+
* redacted copy. Returning the original for a repeated reference would hand back
|
|
141
|
+
* the unredacted container — the leak flair#1905's review found.
|
|
142
|
+
*/
|
|
143
|
+
function walkDeep(value, redact, copies) {
|
|
144
|
+
if (typeof value === "string")
|
|
145
|
+
return redact(value);
|
|
146
|
+
if (Array.isArray(value)) {
|
|
147
|
+
const known = copies.get(value);
|
|
148
|
+
if (known !== undefined)
|
|
149
|
+
return known;
|
|
150
|
+
const out = [];
|
|
151
|
+
copies.set(value, out);
|
|
152
|
+
for (const v of value)
|
|
153
|
+
out.push(walkDeep(v, redact, copies));
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
if (value && typeof value === "object") {
|
|
157
|
+
if (!isPlainObject(value))
|
|
158
|
+
return value;
|
|
159
|
+
const known = copies.get(value);
|
|
160
|
+
if (known !== undefined)
|
|
161
|
+
return known;
|
|
162
|
+
const out = {};
|
|
163
|
+
copies.set(value, out);
|
|
164
|
+
for (const [key, v] of Object.entries(value)) {
|
|
165
|
+
// Define each rebuilt key as an OWN property. A bracket assignment
|
|
166
|
+
// (`out[redact(key)] = …`) for the key `__proto__` would set the COPY's
|
|
167
|
+
// prototype instead of defining a key, dropping it and giving the copy an
|
|
168
|
+
// attacker-chosen prototype — reachable whenever the input came from
|
|
169
|
+
// JSON.parse or Object.defineProperty (flair#1907).
|
|
170
|
+
Object.defineProperty(out, redact(key), {
|
|
171
|
+
value: walkDeep(v, redact, copies),
|
|
172
|
+
enumerable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
configurable: true,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
// Numbers, booleans, null, undefined, functions, symbols: untouched.
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A string with every secret replaced by its prefix (or `[redacted]` when the
|
|
184
|
+
* secret is too short to cut). The string-only convenience over the same
|
|
185
|
+
* implementation the deep redactor uses.
|
|
186
|
+
*/
|
|
187
|
+
export function redactTokenMessage(message, secrets) {
|
|
188
|
+
return createTokenRedactor(secrets).redactMessage(message);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* `value` with every secret replaced in every string at any depth — a message, a
|
|
192
|
+
* string field, an array element, and an object KEY — rebuilt so keys and values
|
|
193
|
+
* are both redacted. Non-string scalars pass through untouched.
|
|
194
|
+
*/
|
|
195
|
+
export function redactTokenIds(value, secrets) {
|
|
196
|
+
return createTokenRedactor(secrets).redactValue(value);
|
|
197
|
+
}
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { existsSync, mkdirSync, chmodSync, rmSync } from "node:fs";
|
|
17
17
|
import { resolve, dirname } from "node:path";
|
|
18
|
-
import { homedir } from "node:os";
|
|
19
18
|
import { spawn } from "node:child_process";
|
|
20
19
|
import { fileURLToPath } from "node:url";
|
|
21
20
|
import { escapeXml } from "../lib/xml-escape.js";
|
|
22
21
|
import { detectPlatform as detectPlatformFor, spawnReport, readTemplate as readTemplateFrom, renderTemplateWith, writeFileWithDir, interpretActiveResult, describeLoadFailure as describeLoadFailureFor, describeExitCode, resolveNodeBin, resolveFlairBin, formatFlairBinWarning, verifyFirstRun, probeUserLingerEnabled, STATUS_CHECK_TIMEOUT_MS, } from "../lib/scheduler-platform.js";
|
|
22
|
+
import { resolveHome } from "../lib/home.js";
|
|
23
23
|
// Re-exported so this module's public surface is unchanged by the extraction
|
|
24
24
|
// into src/lib/scheduler-platform.ts (a second scheduler — `flair federation
|
|
25
25
|
// sync enable` — needs the identical launchctl/systemctl interpretation, and
|
|
26
26
|
// flair#850's lesson must have exactly one implementation).
|
|
27
27
|
export { interpretActiveResult };
|
|
28
|
-
export const SHIM_PATH_DEFAULT = resolve(
|
|
28
|
+
export const SHIM_PATH_DEFAULT = resolve(resolveHome(), ".flair", "bin", "flair-rem-nightly");
|
|
29
29
|
// Unit names, exported (flair#1278) so `flair doctor`'s scheduled-drivers
|
|
30
30
|
// section addresses the same job this module installs — same single-source
|
|
31
31
|
// rule as the federation scheduler's LAUNCHD_LABEL/SYSTEMD_*_UNIT constants.
|
|
32
32
|
export const LAUNCHD_LABEL = "dev.flair.rem.nightly";
|
|
33
33
|
export const SYSTEMD_TIMER_UNIT = "flair-rem-nightly.timer";
|
|
34
34
|
export const SYSTEMD_SERVICE_UNIT = "flair-rem-nightly.service";
|
|
35
|
-
export const LAUNCHD_PLIST_PATH = resolve(
|
|
36
|
-
export const SYSTEMD_USER_DIR = resolve(
|
|
35
|
+
export const LAUNCHD_PLIST_PATH = resolve(resolveHome(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
|
|
36
|
+
export const SYSTEMD_USER_DIR = resolve(resolveHome(), ".config", "systemd", "user");
|
|
37
37
|
export const SYSTEMD_TIMER_PATH = resolve(SYSTEMD_USER_DIR, SYSTEMD_TIMER_UNIT);
|
|
38
38
|
export const SYSTEMD_SERVICE_PATH = resolve(SYSTEMD_USER_DIR, SYSTEMD_SERVICE_UNIT);
|
|
39
39
|
function detectPlatform(override) {
|
|
@@ -102,7 +102,7 @@ function buildSubstitutions(opts, shimPath, flairBin, nodeBin) {
|
|
|
102
102
|
FLAIR_BIN: flairBin,
|
|
103
103
|
NODE_BIN: nodeBin,
|
|
104
104
|
SHIM_PATH: shimPath,
|
|
105
|
-
HOME: opts.homeOverride ??
|
|
105
|
+
HOME: opts.homeOverride ?? resolveHome(),
|
|
106
106
|
AGENT_ID: opts.agentId,
|
|
107
107
|
FLAIR_URL: opts.flairUrl,
|
|
108
108
|
HOUR: String(opts.hour),
|
package/dist/version-check.js
CHANGED
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
* current fact.
|
|
30
30
|
*/
|
|
31
31
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
32
|
-
import { homedir } from "node:os";
|
|
33
32
|
import { dirname, join } from "node:path";
|
|
34
33
|
import { parseSemverCore } from "./fabric-upgrade.js";
|
|
35
34
|
import { fetchLatestVersion } from "./lib/npm-registry.js";
|
|
35
|
+
import { resolveHome } from "./lib/home.js";
|
|
36
36
|
export const FLAIR_PKG_NAME = "@tpsdev-ai/flair";
|
|
37
|
-
export const DEFAULT_CACHE_PATH = join(
|
|
37
|
+
export const DEFAULT_CACHE_PATH = join(resolveHome(), ".flair", ".version-check-cache.json");
|
|
38
38
|
/** How long a cached "latest" answer is trusted before we re-hit the registry. */
|
|
39
39
|
export const DEFAULT_TTL_MS = 12 * 60 * 60 * 1000; // 12h
|
|
40
40
|
/** Registry fetch timeout — this runs on every status/doctor call, so it must stay short. */
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
import { dirname, join } from "node:path";
|
|
20
|
-
import {
|
|
20
|
+
import { resolveHome } from "./lib/home.js";
|
|
21
21
|
export const DEFAULT_HANDSHAKE_TTL_MS = 60_000;
|
|
22
22
|
export const DEFAULT_HANDSHAKE_TIMEOUT_MS = 1500; // within the spec's 1-2s budget
|
|
23
|
-
export const DEFAULT_HANDSHAKE_CACHE_DIR = join(
|
|
23
|
+
export const DEFAULT_HANDSHAKE_CACHE_DIR = join(resolveHome(), ".flair", ".version-handshake-cache");
|
|
24
24
|
export function defaultHandshakeDeps() {
|
|
25
25
|
return {
|
|
26
26
|
fetchImpl: fetch,
|
package/docs/api-reference.md
CHANGED
|
@@ -44,14 +44,14 @@ the schema section so the catalog is complete.
|
|
|
44
44
|
|
|
45
45
|
| Class | Credential | Typical grant |
|
|
46
46
|
|-------|------------|---------------|
|
|
47
|
-
| **Public** | none | Discovery, health, OAuth well-known
|
|
47
|
+
| **Public** | none | Discovery, health, OAuth well-known. `GET /Presence` is public only when the instance opts in to a public roster (`PRESENCE_PUBLIC_ROSTER=true`) — by default it needs a verified reader. See [Presence for API consumers](#presence-for-api-consumers). |
|
|
48
48
|
| **Ed25519 agent** | `TPS-Ed25519` header | Default agent path. Writes as self only. Reads follow the resource's read-scope (below). |
|
|
49
49
|
| **Admin Basic** | Harper `HDB_ADMIN_PASSWORD` / `FLAIR_ADMIN_PASSWORD` | Whole-instance operator. Bypasses agent scoping, including `private` memory. Used by the web admin and `n8n-nodes-flair`. |
|
|
50
50
|
| **Operator / internal** | Admin Basic, or a deliberate `internalContext()` call inside the process | Soul mutations and `AgentSeed`. Agent Ed25519 keys — including admin-agent keys — cannot author Soul. |
|
|
51
51
|
| **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. |
|
|
52
52
|
| **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). |
|
|
53
53
|
|
|
54
|
-
Anonymous HTTP is denied on every agent-facing table. A by-id miss and a
|
|
54
|
+
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). A by-id miss and a
|
|
55
55
|
by-id deny both return **404**, never 403, so ids are not an existence oracle.
|
|
56
56
|
|
|
57
57
|
### Read-scope vocabulary
|
|
@@ -107,8 +107,8 @@ is `GET /Name/<id>` unless noted.
|
|
|
107
107
|
| POST | `/Agent` | Admin Basic | Create principal. Also `POST /AgentSeed` (operator/internal only — not an admin-agent key). |
|
|
108
108
|
| PUT / PATCH | `/Agent/<id>` | Ed25519 | An agent updates **only its own** record. |
|
|
109
109
|
| DELETE | `/Agent/<id>` | Admin Basic | Deprovision. |
|
|
110
|
-
| GET | `/Presence` |
|
|
111
|
-
| POST | `/Presence` | Ed25519 | Heartbeat. Agent writes only its own row (403 cross-agent). Stamps `flairVersion` / `harperVersion
|
|
110
|
+
| 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). |
|
|
111
|
+
| POST | `/Presence` | Ed25519 | Heartbeat. Agent writes only its own row (403 cross-agent). Stamps `flairVersion` / `harperVersion` on the row. |
|
|
112
112
|
| PUT / DELETE | `/Presence/<id>` | Ed25519 | Own row only. Collection PUT is not a public bypass. |
|
|
113
113
|
| GET | `/Soul`, `/Soul/<id>` | Ed25519 | Any verified agent; unscoped (identity/discovery). |
|
|
114
114
|
| 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). |
|
|
@@ -197,7 +197,7 @@ The remedy is `flair upgrade` (the adapter), not a server upgrade alone.
|
|
|
197
197
|
| Method | Path | Auth | Notes |
|
|
198
198
|
|--------|------|------|-------|
|
|
199
199
|
| GET | `/FederationInstance` | Admin Basic | Local instance identity (CLI / admin). Peers do not call this during pair. |
|
|
200
|
-
| POST | `/FederationPair` | Pairing token + body-sig | Public at the Harper role gate. Handler validates token, signature, anti-replay. Response includes `instance {id, publicKey}` when this hub has an Instance row; `instance` is null if it does not (flair#839). The spoke CLI must not store an empty hub key (flair#822). Fabric uses the bootstrap-user triple from `flair federation token`. |
|
|
200
|
+
| POST | `/FederationPair` | Pairing token + body-sig | Public at the Harper role gate. Handler validates token, signature, anti-replay. Response includes `instance {id, publicKey}` when this hub has an Instance row; `instance` is null if it does not (flair#839). With several rows it answers `409 multiple_instance_rows` before the token is consumed, naming no row (the hub's log names them; flair#1883). The spoke CLI must not store an empty hub key (flair#822). Fabric uses the bootstrap-user triple from `flair federation token`. |
|
|
201
201
|
| POST | `/FederationSync` | Peer body-sig | Public at the role gate. Merge Memory / Soul / Agent / Relationship (and classifier-ready Message). Originator + per-record signature checks. |
|
|
202
202
|
| GET | `/FederationPeers` | Admin Basic | Known peers. |
|
|
203
203
|
| GET / write | `/Instance` | Read: Ed25519. Write: admin | Instance row (`flair_…` id, role hub/spoke). |
|
|
@@ -295,8 +295,33 @@ client-writable even if a client sends them. Full comments live in
|
|
|
295
295
|
| `currentTask` | String | Free text; verified-agent read only |
|
|
296
296
|
| `activity` | String | `coding` \| `reviewing` \| `planning` \| `debugging` \| `idle` |
|
|
297
297
|
| `activityUpdatedAt` | BigInt | When activity/task were asserted |
|
|
298
|
-
| `flairVersion` | String | Serving `@tpsdev-ai/flair` version |
|
|
299
|
-
| `harperVersion` | String | Serving Harper version |
|
|
298
|
+
| `flairVersion` | String | Serving `@tpsdev-ai/flair` version. Null when redacted or never stamped — see below. |
|
|
299
|
+
| `harperVersion` | String | Serving Harper version. Same redaction. Also null when the server could not resolve Harper's version. |
|
|
300
|
+
|
|
301
|
+
### Presence for API consumers
|
|
302
|
+
|
|
303
|
+
`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.
|
|
304
|
+
|
|
305
|
+
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 the behaviour is exactly as it was before: an anonymous caller gets the field-allowlisted roster (id, display name, role, runtime, activity fields, `presenceStatus`, `lastHeartbeatAt`), and three fields are redacted to `null` unless the request carries a valid `TPS-Ed25519` agent signature: `currentTask`, `flairVersion`, and `harperVersion`. Anonymous callers, unsigned loopback, Basic admin, and in-process calls without that signature are unverified readers of the content gate. The nulls are intentional. Version strings are withheld so a public roster cannot fingerprint the instance (the same split as public `/Health` versus Ed25519 `/HealthDetail`). 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.
|
|
306
|
+
|
|
307
|
+
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.
|
|
308
|
+
|
|
309
|
+
`presenceStatus` is liveness of `lastHeartbeatAt`. The idle threshold defaults to 90 seconds and the offline threshold defaults to 10 minutes. A tuned instance overrides those numbers with `PRESENCE_IDLE_THRESHOLD_MS` and `PRESENCE_OFFLINE_THRESHOLD_MS` (milliseconds). Read the live values from those variables; the 90s and 10m figures below are only what an unset process uses. An unset, empty, zero, or non-numeric value falls back to that default:
|
|
310
|
+
|
|
311
|
+
| Age of `lastHeartbeatAt` | `presenceStatus` |
|
|
312
|
+
|---|---|
|
|
313
|
+
| Missing, or not a finite number | `offline` |
|
|
314
|
+
| Negative (stamp ahead of the server clock) | `active` |
|
|
315
|
+
| Younger than the idle threshold (`PRESENCE_IDLE_THRESHOLD_MS`, default 90s) | `active` |
|
|
316
|
+
| Younger than the offline threshold (`PRESENCE_OFFLINE_THRESHOLD_MS`, default 10 min) | `idle` |
|
|
317
|
+
| At or beyond the offline threshold, when the idle threshold is at or below it | `offline` |
|
|
318
|
+
| At or beyond the idle threshold, when the idle threshold is above the offline threshold (the idle status never occurs then) | `offline` |
|
|
319
|
+
|
|
320
|
+
The rows are checked in that order and the first match wins. `derivePresenceStatus` (`resources/Presence.ts`) returns `active` while the age is strictly below `PRESENCE_IDLE_THRESHOLD_MS`, even when that age is already at or past `PRESENCE_OFFLINE_THRESHOLD_MS`. The ordering these rows describe is an idle threshold strictly below the offline threshold. An age equal to the offline threshold is `offline` only when the idle threshold is at or below the offline threshold; when the idle threshold is above it, the `active` row matches first and the status is `active`.
|
|
321
|
+
|
|
322
|
+
`activityFresh` uses a different stamp: `activityUpdatedAt` when that is a finite number, otherwise `lastHeartbeatAt`. It is true while that stamp is younger than the **offline** threshold (`PRESENCE_OFFLINE_THRESHOLD_MS`, default 10 minutes), including when the stamp is in the future. While it is true, `activity` is the stored label (`coding`, `reviewing`, `planning`, `debugging`, or `idle`). When it is false, `activity` is reported as `idle`, `lastActivity` keeps the stored label, and `currentTask` is null even for a verified reader. `activityAgeMs` is how old that stamp is.
|
|
323
|
+
|
|
324
|
+
A peer can therefore show `presenceStatus: "offline"`, `activity: "idle"`, `lastActivity: "coding"`, and `activityFresh: false` at once: the heartbeat is past the offline threshold, and the live activity label has lapsed. Gate "is this agent doing this now" on `activityFresh` (and `activityAgeMs`). Read `presenceStatus` for heartbeat liveness. Read `lastActivity` as what they were doing, not what they are doing.
|
|
300
325
|
|
|
301
326
|
### Memory (`schemas/memory.graphql`)
|
|
302
327
|
|
package/docs/auth.md
CHANGED
|
@@ -9,12 +9,12 @@ Different surfaces authenticate differently. The model in one place:
|
|
|
9
9
|
|
|
10
10
|
| Surface | Auth | Scope | Notes |
|
|
11
11
|
|---------|------|-------|-------|
|
|
12
|
-
| **CLI / SDK clients** (`flair`, `flair-client`) |
|
|
13
|
-
| **MCP server** (`@tpsdev-ai/flair-mcp`) |
|
|
14
|
-
| **OpenClaw / pi / Hermes plugins** |
|
|
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
|
+
| **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
|
+
| **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
15
|
| **`n8n-nodes-flair`** | **Harper admin-password Basic auth** | ⚠️ **Whole instance, read + write, including `private`** | The admin credential bypasses agent scoping entirely — every workflow gets read/write on the *entire* memory store, including other agents' `private`-marked memories, not just the org-wide non-private pool an Ed25519 identity would see. |
|
|
16
16
|
|
|
17
|
-
**The default, secure path is Ed25519 per-agent** (see below): each agent holds its own key and signs every request.
|
|
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 and read their own plus other agents' non-private records. 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
|
### Known limitation — n8n uses admin-password Basic auth
|
|
20
20
|
|
|
@@ -49,7 +49,7 @@ never an existence signal. The adapter write-up is
|
|
|
49
49
|
|
|
50
50
|
Flair has no `mode`/`shape` config setting — the shape you get is emergent from *how you provision principals*, not something you declare:
|
|
51
51
|
|
|
52
|
-
- **Personal
|
|
52
|
+
- **Personal.** `flair init --agent <id>` creates (or reuses) ONE agent identity and wires that same `FLAIR_AGENT_ID` into every MCP client it configures (Claude Code, Codex, Gemini, Cursor). One human driving several AI clients ends up with one canonical principal and one Ed25519 keypair — all clients share ownership of the same memory. This is intentional, not a limitation: all clients see each other's private rows (one human's memory, one view). Writes with fresh IDs create separate records even when the server reports a dedup match; writes that reuse an existing ID update that record. Usage counting treats the shared principal as one contributor.
|
|
53
53
|
- **Org (multiple real agents).** `flair agent add <id>` mints a distinct principal — its own keypair, its own ownership boundary — for each real agent that should be a separate identity. Wire each principal's own `FLAIR_AGENT_ID` into its own client(s).
|
|
54
54
|
|
|
55
55
|
Nothing in flair validates which shape you're in; a personal install that later grows into an org just runs `flair agent add` for the new distinct identities it needs.
|
|
@@ -273,12 +273,24 @@ flair idp add \
|
|
|
273
273
|
|
|
274
274
|
### JIT Provisioning
|
|
275
275
|
|
|
276
|
-
First-time IdP users are automatically created as `unverified` principals.
|
|
276
|
+
First-time IdP users are automatically created as `unverified` principals.
|
|
277
|
+
|
|
278
|
+
Trust tier and admin are different fields. `flair principal promote` changes only `defaultTrustTier`. It takes the principal id and a tier:
|
|
277
279
|
|
|
278
280
|
```bash
|
|
279
|
-
flair principal promote <principal-id>
|
|
281
|
+
flair principal promote <principal-id> <tier>
|
|
280
282
|
```
|
|
281
283
|
|
|
284
|
+
`<tier>` is one of `endorsed`, `corroborated`, or `unverified`. There is no `verified` tier and no `admin` tier. The command writes `defaultTrustTier` and does not write `role` or `admin`, so it cannot grant admin.
|
|
285
|
+
|
|
286
|
+
Admin authority is `role: admin` on the Agent record. `admin: true` is the mirror the server keeps in step with that role; setting the mirror alone does not grant admin. The CLI that writes both is:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
flair principal add <principal-id> --admin
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
`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`.
|
|
293
|
+
|
|
282
294
|
### CLI Reference
|
|
283
295
|
|
|
284
296
|
| Command | Description |
|
package/docs/claude-code.md
CHANGED
|
@@ -82,7 +82,7 @@ Copy this into your project's `CLAUDE.md` (or `.claude/settings.md`, `AGENTS.md`
|
|
|
82
82
|
|
|
83
83
|
---
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
This is a prompt-driven CLI setup: Claude must choose to run these commands. For MCP tools and automatic startup recall, run `flair init --agent my-project --client claude-code`, restart Claude Code, and verify the hook with `flair hook status --harness claude-code`; these prompt instructions do not guarantee automatic capture.
|
|
86
86
|
|
|
87
87
|
## Multiple Projects
|
|
88
88
|
|
|
@@ -94,19 +94,18 @@ flair agent add project-beta
|
|
|
94
94
|
flair agent add infra-ops
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
Each project's `CLAUDE.md` uses its own agent ID.
|
|
97
|
+
Each project's `CLAUDE.md` uses its own agent ID. Writes carry an `agentId` field (tags are optional); reads use owner plus visibility.
|
|
98
98
|
|
|
99
99
|
## Subagents
|
|
100
100
|
|
|
101
101
|
Claude Code subagents (spawned via `/run` or background tasks) can share the parent's memory:
|
|
102
102
|
|
|
103
103
|
### Subagents
|
|
104
|
-
Subagents share memory with the parent session
|
|
105
|
-
FLAIR_AGENT_ID=my-project
|
|
104
|
+
Subagents share memory with the parent session when they use the same agent ID (to share, set `FLAIR_AGENT_ID=my-project`). A subagent with its own agent ID owns what it writes, but this is not isolation: only its private records are hidden from other agents, and it can still read other agents' non-private records. Writes without an explicit visibility default by durability: persistent and permanent are shared, standard and ephemeral are private.
|
|
106
105
|
|
|
107
106
|
When spawning subagents, pass the agent ID so they can access shared context.
|
|
108
107
|
|
|
109
|
-
Or give subagents their own identity
|
|
108
|
+
Or give subagents their own identity, so each owns what it writes (ownership, not isolation):
|
|
110
109
|
|
|
111
110
|
```bash
|
|
112
111
|
flair agent add my-project-review # code review subagent
|
|
@@ -206,4 +205,4 @@ const context = await flair.bootstrap({ maxTokens: 4000 })
|
|
|
206
205
|
- **Use durability wisely.** Most things are `standard`. Only promote to `persistent` for things that should survive months.
|
|
207
206
|
- **Search is semantic.** "deployment issues" finds memories about "CI pipeline failures" — you don't need exact keywords.
|
|
208
207
|
- **Temporal queries work.** "What happened today" and "what did we ship recently" are understood.
|
|
209
|
-
- **Dedup is
|
|
208
|
+
- **Dedup is a report, not a write guard.** A successful create is stored even when it matches an earlier memory. For eligible creates, the server checks the top active candidate from the same agent using writer-overridable cosine and Jaccard thresholds, and returns `deduplicated` and `matchedId` on a match.
|
|
@@ -164,17 +164,21 @@ No shell on the hub, so mint the token remotely rather than over `ssh`:
|
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
166
|
# On any machine — note --ops-target, this hits the ops API
|
|
167
|
-
|
|
167
|
+
(umask 077; set -C; flair federation token --admin-pass-file /path/to/hub-admin-pass \
|
|
168
168
|
--target https://<cluster>.<org>.harperfabric.com \
|
|
169
|
-
--ops-target <ops-url> > ./pair-triple.json
|
|
169
|
+
--ops-target <ops-url> > ./pair-triple.json)
|
|
170
170
|
|
|
171
171
|
# On the spoke
|
|
172
172
|
flair federation pair https://<cluster>.<org>.harperfabric.com \
|
|
173
|
+
--admin-pass-file ~/.flair/admin-pass \
|
|
173
174
|
--token-from ./pair-triple.json
|
|
174
175
|
```
|
|
175
176
|
|
|
176
|
-
`federation token`
|
|
177
|
-
|
|
177
|
+
`federation token` and `federation pair` both take `--admin-pass-file`, reading the
|
|
178
|
+
password in-process (mode 0600 enforced) so it stays out of shell history and the process
|
|
179
|
+
list; `--admin-pass` still works but lands in both, and `FLAIR_ADMIN_PASS` suits CI. The triple holds a
|
|
180
|
+
one-time credential — delete it after pairing (60-min TTL, `--ttl`). `set -C` refuses to
|
|
181
|
+
overwrite an existing `pair-triple.json`, so remove an old one first.
|
|
178
182
|
|
|
179
183
|
### Federation is push-only
|
|
180
184
|
|
package/docs/deployment.md
CHANGED
|
@@ -136,43 +136,33 @@ Then set `FLAIR_URL=http://localhost:19926` on the client.
|
|
|
136
136
|
|
|
137
137
|
### Direct network access
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
On `flair start`, `flair restart`, and `flair upgrade` the HTTP bind host is resolved in this order. The first one set wins. None of those commands take an `--http-bind` flag:
|
|
140
140
|
|
|
141
|
-
1. `
|
|
142
|
-
2.
|
|
143
|
-
3.
|
|
141
|
+
1. `FLAIR_HTTP_BIND` in the Flair process environment
|
|
142
|
+
2. a **top-level** `httpBind:` key in `~/.flair/config.yaml`
|
|
143
|
+
3. `127.0.0.1`
|
|
144
144
|
|
|
145
|
-
`
|
|
146
|
-
loopback are accepted** — `127.0.0.1` itself, or a wildcard (`0.0.0.0` / `::`).
|
|
147
|
-
Every credentialed self-call Flair makes hardcodes `127.0.0.1`, so a bind that
|
|
148
|
-
excludes it is refused: it would leave those calls pointing at a dead port
|
|
149
|
-
while every bind check still passed.
|
|
145
|
+
`flair init --http-bind <host>` is how that `httpBind` key gets written. During `init` the flag wins over `FLAIR_HTTP_BIND`, and the host that won is persisted. On Linux the CLI starts Harper directly and resolves the bind on every start, so a later start follows the list above and an env var in the service's environment overrides the file. On macOS the resolved bind is stored in the launchd job instead of being re-read on the launchd reload path: any restart that goes through it — `flair restart` included, and a restart launchd starts itself (a reboot, a crash, KeepAlive) — reuses that stored value and does not re-read `FLAIR_HTTP_BIND` or `config.yaml`; only `flair init` writes it.
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
**Only hosts that include IPv4 loopback are accepted** — `127.0.0.1` itself, or a wildcard (`0.0.0.0` / `::`). Every credentialed self-call Flair makes hardcodes `127.0.0.1`. A bind that excludes that address is refused: those calls would point at a dead port while every bind check still passed. A specific LAN address is not accepted. Loopback is the default so a single-host install does not expose the HTTP surface, including unauthenticated `/Health`, on every interface.
|
|
148
|
+
|
|
149
|
+
To widen deliberately, record a wildcard so the choice survives restart and upgrade:
|
|
153
150
|
|
|
154
151
|
```bash
|
|
155
152
|
flair init --http-bind 0.0.0.0
|
|
156
153
|
```
|
|
157
154
|
|
|
158
155
|
```yaml
|
|
159
|
-
# ~/.flair/config.yaml — top-level
|
|
156
|
+
# ~/.flair/config.yaml — top-level key. There is no nested `http:` block.
|
|
160
157
|
httpBind: 0.0.0.0
|
|
161
158
|
```
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
> the bind with a nested `http.host:` key. **Flair never read that key**, and
|
|
165
|
-
> from 0.55.0 it is ignored outright: an install that was only ever wide
|
|
166
|
-
> because the old default bound every interface will narrow to `127.0.0.1` on
|
|
167
|
-
> the next `flair restart` or `flair upgrade`. The block below is kept so this
|
|
168
|
-
> section stays findable from a snippet you may already have — **do not copy
|
|
169
|
-
> it**; use `httpBind:` (or `--http-bind` / `FLAIR_HTTP_BIND`) instead.
|
|
160
|
+
A nested `http.host` (or `http.port`) is not read. An install that was only wide because an older default bound every interface narrows to `127.0.0.1` on the next `flair restart` or `flair upgrade` unless `FLAIR_HTTP_BIND` or `httpBind` names a wildcard.
|
|
170
161
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
host: 0.0.0.0 # listen on all interfaces
|
|
162
|
+
**Confirm the bind.** `flair status` prints the URL the CLI dials. That URL stays on loopback even when the listener is widened, so it is not the bind. After a Flair-managed start, Harper records the listener it was given as `http.port` in the instance data directory (default `~/.flair/data/harper-config.yaml`, legacy name `harperdb-config.yaml`). The value is host-qualified, for example `127.0.0.1:19926`, `0.0.0.0:19926`, or `[::]:19926`. The live socket shows the same address:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
lsof -nP -iTCP:19926 -sTCP:LISTEN
|
|
176
166
|
```
|
|
177
167
|
|
|
178
168
|
**Security:** Flair uses Ed25519 authentication. Agents must present a valid signature to read or write. However, the `/Health` endpoint is unauthenticated. For internet-facing deployments, put Flair behind a reverse proxy with TLS.
|
|
@@ -185,26 +175,25 @@ All configuration lives in `~/.flair/`:
|
|
|
185
175
|
|
|
186
176
|
```
|
|
187
177
|
~/.flair/
|
|
188
|
-
├── config.yaml # port,
|
|
189
|
-
├── data/ # Harper database
|
|
178
|
+
├── config.yaml # port, opsPort, opsBind, httpBind
|
|
179
|
+
├── data/ # Harper database (harper-config.yaml lives here)
|
|
190
180
|
├── keys/ # Ed25519 keypairs per agent
|
|
191
181
|
└── backups/ # flair backup output
|
|
192
182
|
```
|
|
193
183
|
|
|
194
184
|
### Key config options (`~/.flair/config.yaml`)
|
|
195
185
|
|
|
196
|
-
|
|
197
|
-
# Top-level keys — Flair's config has no nested `http:` block, and no
|
|
198
|
-
# `http.host`.
|
|
199
|
-
port: 19926 # API port (ops port = this - 1)
|
|
200
|
-
httpBind: 127.0.0.1 # HTTP bind host (see "Direct network access" above)
|
|
186
|
+
Flair reads four top-level keys from this file: `port`, `opsPort`, `opsBind`, and `httpBind`. `flair init` rewrites the file with those keys and drops anything else, including a `clustering:` or `logging:` block and any embedding-model key. Embedding threads, GPU layers, and the model directory are environment variables in the table below, not keys in this file.
|
|
201
187
|
|
|
202
|
-
clustering
|
|
203
|
-
nodeName: flair
|
|
188
|
+
`clustering` and `logging` are not read from `~/.flair/config.yaml` or from `<dataDir>/harper-config.yaml` by anything in this repository, so they are not given a home here. Harper itself does read its own clustering and logging settings — from its `harperdb-config.yaml` — so configure those there, not here. Harper's generative `models:` block, when REM needs one, does belong in `<dataDir>/harper-config.yaml`. See [rem.md](rem.md).
|
|
204
189
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
190
|
+
```yaml
|
|
191
|
+
# ~/.flair/config.yaml — only these keys are read. A later `flair init`
|
|
192
|
+
# rewrites the file and drops every other key.
|
|
193
|
+
port: 19926
|
|
194
|
+
opsPort: 19925 # Harper operations API port
|
|
195
|
+
opsBind: 127.0.0.1 # operations API bind host
|
|
196
|
+
httpBind: 127.0.0.1 # HTTP bind host (see "Direct network access" above)
|
|
208
197
|
```
|
|
209
198
|
|
|
210
199
|
### Environment variables
|
|
@@ -217,7 +206,7 @@ Set these in the Flair process environment (`~/Library/LaunchAgents/ai.tpsdev.fl
|
|
|
217
206
|
| `HDB_ADMIN_PASSWORD` | Bootstrap password for the embedded Harper. After first start, the persisted user record is the source of truth; rotate via the Harper ops API, not by changing this env var. | Set at install time. See [secrets-and-keys.md](secrets-and-keys.md) for rotation. |
|
|
218
207
|
| `FLAIR_KEY_PASSPHRASE` | Passphrase used to derive the AES-256-GCM key that wraps federation private-key seeds at rest. Auto-generated to `~/.flair/keys/.passphrase` if unset. | Set explicitly for production federation deployments so the passphrase isn't auto-generated and lost on disk wipe. |
|
|
219
208
|
| `HTTP_PORT` | Override the Harper HTTP port. Useful for sandboxes; production deployments should configure the port in `config.yaml` instead. | Rare. |
|
|
220
|
-
| `FLAIR_HTTP_BIND` | Bind address for the Harper **HTTP API**.
|
|
209
|
+
| `FLAIR_HTTP_BIND` | Bind address for the Harper **HTTP API**. On start, restart, and upgrade the order is this variable, then the top-level `httpBind` key in `~/.flair/config.yaml`, then `127.0.0.1`. `flair init --http-bind` writes that key (the flag wins over this variable during init). Only `127.0.0.1` or a wildcard (`0.0.0.0` / `::`) is accepted — the listener must include IPv4 loopback for Flair's own `127.0.0.1` self-calls. See [Direct network access](#direct-network-access). | Only for deployments that need the HTTP API reachable off-host — set it to `0.0.0.0`, or record it once with `flair init --http-bind 0.0.0.0`. Single-host installs want the loopback default. |
|
|
221
210
|
| `FLAIR_OPS_BIND` | Bind address for the Harper **ops API**. Resolution order: `flair init --ops-bind` > this variable > the `opsBind` key `flair init` persists in `~/.flair/config.yaml` > `127.0.0.1`. Every Flair-managed Harper start re-asserts the resolved value, so the persisted key is what makes a choice survive `flair restart` / `flair upgrade`. | Only for deployments that genuinely need remote ops admin (multi-host / Fabric) — set it to `0.0.0.0`, or record it once with `flair init --ops-bind 0.0.0.0`. Single-host installs want the loopback default. |
|
|
222
211
|
|
|
223
212
|
### Performance-related environment variables
|
|
@@ -272,12 +272,14 @@ flair memory search "deploy schedule" --agent mybot
|
|
|
272
272
|
Federation, which has no in-process equivalent:
|
|
273
273
|
|
|
274
274
|
```bash
|
|
275
|
-
flair federation token --admin-pass
|
|
276
|
-
flair federation pair <hub-url> --token-from ./triple.json
|
|
275
|
+
(umask 077; set -C; flair federation token --admin-pass-file ~/.flair/admin-pass > triple.json)
|
|
276
|
+
flair federation pair <hub-url> --admin-pass-file ~/.flair/admin-pass --token-from ./triple.json
|
|
277
277
|
flair federation sync enable --interval 300
|
|
278
278
|
flair federation status
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
+
`set -C` makes the redirect refuse an existing `triple.json` (and `umask 077` only modes a file it creates); remove an old one first (`rm triple.json`). `--admin-pass-file` reads the password in-process (mode 0600 enforced), so it stays out of shell history and the process list; `--admin-pass` is also accepted but lands in both, and `FLAIR_ADMIN_PASS` suits CI.
|
|
282
|
+
|
|
281
283
|
`sync enable` landed **after 0.30.0**; on an older install, schedule the one-shot yourself.
|
|
282
284
|
|
|
283
285
|
A `SyncLog` row reads `direction: "pull"` — the receiver's label for a push it accepted. `"push"` is never written. Not a pull path.
|