@tpsdev-ai/flair 0.55.2 → 0.56.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 +3 -3
- 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 +10 -12
- package/dist/commands/attention.js +2 -2
- package/dist/commands/backup.js +2 -2
- package/dist/commands/doctor.js +39 -28
- package/dist/commands/export.js +2 -2
- package/dist/commands/federation.js +185 -38
- package/dist/commands/hook.js +4 -4
- package/dist/commands/init.js +30 -8
- 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 +5 -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/launchd-repair.js +6 -0
- package/dist/lib/mcp-enable.js +4 -4
- package/dist/lib/owned-pins.js +1 -13
- 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/OAuth.js +62 -11
- package/dist/resources/Presence.js +135 -47
- package/dist/resources/admin-layout.js +7 -2
- package/dist/resources/memory-reflect-lib.js +17 -1
- package/dist/src/keystore.js +10 -2
- package/dist/src/lib/home.js +60 -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 +31 -6
- package/docs/auth.md +14 -2
- package/docs/deploying-on-fabric.md +5 -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 +39 -19
- package/docs/hosted-on-fabric.md +7 -5
- package/docs/mcp-clients.md +29 -12
- package/docs/spoke-bringup.md +41 -22
- package/docs/standalone-local.md +12 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,10 +61,10 @@ Full walkthrough with expected output at every step: **[docs/quickstart.md](docs
|
|
|
61
61
|
|
|
62
62
|
> **Known install-size issue.** `npm install -g @tpsdev-ai/flair` currently pulls roughly 130 MB of React Native tooling that a Node install never uses — an optional dependency of Harper's SQL engine. It is inert and Flair runs normally. The durable fix is upstream ([harperfast/harper#1937](https://github.com/harperfast/harper/issues/1937)). Do **not** install with `--omit=optional` to avoid it: that also drops Harper's platform RocksDB binding, and Flair will not start.
|
|
63
63
|
|
|
64
|
-
Two
|
|
64
|
+
Two MCP paths, on purpose. A client on this machine and a remote connector are different trust situations, and each has its own mechanism. The write-up that joins them is [docs/mcp-clients.md — Two MCP paths](docs/mcp-clients.md#two-mcp-paths).
|
|
65
65
|
|
|
66
|
-
- **
|
|
67
|
-
- **
|
|
66
|
+
- **Local client: the `npx` stdio adapter.** `@tpsdev-ai/flair-mcp` is a separate package and is not installed globally. `flair init` writes `npx -y @tpsdev-ai/flair-mcp@<version>` into each client's config, pinned to the CLI's own version. The adapter signs requests with the agent's Ed25519 key and sends them to `FLAIR_URL`. Loopback HTTP is the right scheme on this machine (the default is `http://127.0.0.1:19926`). A remote `FLAIR_URL` should use HTTPS. This is the path for Claude Code, Cursor, Codex, Gemini, and every other local MCP client.
|
|
67
|
+
- **Remote client: native `/mcp`.** A JSON-RPC endpoint inside the server, OAuth bearer, exposing 12 curated tools. It is **off by default**: until `FLAIR_MCP_OAUTH=true` and the issuer is a public HTTPS origin (`FLAIR_MCP_ISSUER`, else `FLAIR_PUBLIC_URL`), no `/mcp` route is registered and the path returns 404. `true` is the value that turns on both Flair's route and the OAuth component; `1`, `yes`, and `on` leave the component off and every call 401s. OAuth client-metadata is fetched over HTTPS and refuses a private, loopback, or link-local host, and `flair mcp enable` refuses a local origin (localhost, loopback, RFC1918, IPv4 link-local, `.local`). A loopback install cannot be that origin, so native `/mcp` is remote-only by design.
|
|
68
68
|
|
|
69
69
|
`@tpsdev-ai/flair-client` is likewise its own package: add it to a project when you want to call Flair from your own code ([JavaScript / TypeScript](#javascript--typescript)).
|
|
70
70
|
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { promises as fsp } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
|
-
import { homedir } from "node:os";
|
|
13
12
|
import { parseRecords } from "../runtime/formats.js";
|
|
14
13
|
import { BridgeRuntimeError } from "../types.js";
|
|
14
|
+
import { resolveHome } from "../../lib/home.js";
|
|
15
15
|
export async function* importFromDirectory(opts, ctx) {
|
|
16
16
|
// Resolve source directory
|
|
17
|
-
const sourceDir = typeof opts.source === "string" ? opts.source : join(
|
|
17
|
+
const sourceDir = typeof opts.source === "string" ? opts.source : join(resolveHome(), "notes");
|
|
18
18
|
ctx.log.info(`scanning markdown directory`, { path: sourceDir });
|
|
19
19
|
// Scan directory for .md files
|
|
20
20
|
let files;
|
package/dist/bridges/discover.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* executing any code plugin. Runtime execution is slice 2.
|
|
12
12
|
*/
|
|
13
13
|
import { promises as fsp } from "node:fs";
|
|
14
|
-
import { homedir } from "node:os";
|
|
15
14
|
import { join, dirname, basename } from "node:path";
|
|
15
|
+
import { resolveHome } from "../lib/home.js";
|
|
16
16
|
async function exists(path) {
|
|
17
17
|
try {
|
|
18
18
|
await fsp.stat(path);
|
|
@@ -163,7 +163,7 @@ async function scanModuleRoot(base) {
|
|
|
163
163
|
*/
|
|
164
164
|
export async function discover(opts = {}) {
|
|
165
165
|
const cwd = opts.cwd ?? process.cwd();
|
|
166
|
-
const home = opts.home ??
|
|
166
|
+
const home = opts.home ?? resolveHome();
|
|
167
167
|
const moduleRoots = opts.moduleRoots ?? [
|
|
168
168
|
join(cwd, "node_modules"),
|
|
169
169
|
join(home, ".flair", "node_modules"),
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
import { promises as fsp } from "node:fs";
|
|
38
38
|
import { existsSync } from "node:fs";
|
|
39
39
|
import { join, dirname } from "node:path";
|
|
40
|
-
import { homedir } from "node:os";
|
|
41
40
|
import { createHash } from "node:crypto";
|
|
41
|
+
import { resolveHome } from "../../lib/home.js";
|
|
42
42
|
function resolvePath(opts) {
|
|
43
|
-
return opts?.path ?? join(
|
|
43
|
+
return opts?.path ?? join(resolveHome(), ".flair", "bridges-allowed.json");
|
|
44
44
|
}
|
|
45
45
|
function hasEntryFields(e) {
|
|
46
46
|
return (typeof e?.name === "string" &&
|
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"commit": "
|
|
4
|
-
"builtAt": "2026-09-
|
|
2
|
+
"version": "0.56.0",
|
|
3
|
+
"commit": "3749af5f4c91a16945c8b13ac226414b6c55d9aa",
|
|
4
|
+
"builtAt": "2026-09-26T14:50:49.766Z",
|
|
5
5
|
"builder": "tsc"
|
|
6
6
|
}
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { load as parseYaml } from "js-yaml";
|
|
4
4
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, openSync, closeSync, chmodSync, renameSync, cpSync, rmSync, mkdtempSync, readdirSync, statSync, lstatSync, realpathSync, unlinkSync, chownSync, constants as fsConstants, } from "node:fs";
|
|
5
|
-
import {
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
6
|
import { join, resolve, dirname, basename } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { spawn, execFileSync, spawnSync, execSync } from "node:child_process";
|
|
@@ -20,6 +20,7 @@ import { fleetSweepShouldAbort, } from "./fleet-verify.js";
|
|
|
20
20
|
import { detectClients } from "./install/clients.js";
|
|
21
21
|
import { flairCliVersion, mcpServerSpec } from "./lib/mcp-spec.js";
|
|
22
22
|
import { harperPortValue } from "./lib/harper-port-value.js";
|
|
23
|
+
import { flairConfigPath, flairDataDir } from "./lib/flair-paths.js";
|
|
23
24
|
import { httpBind, httpCorsAccessList, preserveHttpPortValue, preserveSecurePort, qualifySecureBindValue, DEFAULT_HTTP_BIND_HOST, } from "./lib/http-bind.js";
|
|
24
25
|
import { isNodeKeyId, partitionKeyIds, } from "./doctor-client.js";
|
|
25
26
|
import { cliBootPathWarning, } from "./install/global-bin-path.js";
|
|
@@ -75,6 +76,7 @@ import { bindCli as bindServiceCli, register as registerService, } from "./comma
|
|
|
75
76
|
import { bindCli as bindDoctorCli, register as registerDoctor, } from "./commands/doctor.js";
|
|
76
77
|
import { bindCli as bindQualityCli, register as registerQuality, } from "./commands/quality.js";
|
|
77
78
|
import { bindCli as bindGrantCli, register as registerGrant, } from "./commands/grant.js";
|
|
79
|
+
import { resolveHome } from "./lib/home.js";
|
|
78
80
|
// Federation crypto helpers + private-visibility filter live with the
|
|
79
81
|
// federation command group (src/commands/federation.ts, flair#1620). Inlined
|
|
80
82
|
// there for the same packaging reason: src/ must not import resources/.
|
|
@@ -141,7 +143,7 @@ const DEFAULT_OPS_BIND_HOST = "127.0.0.1";
|
|
|
141
143
|
// (flair#747) — imported above, re-exported at the bottom of this file so
|
|
142
144
|
// the public CLI module surface is unchanged.
|
|
143
145
|
function defaultDataDir() {
|
|
144
|
-
return
|
|
146
|
+
return flairDataDir();
|
|
145
147
|
}
|
|
146
148
|
// ─── launchd label (flair#693) ─────────────────────────────────────────────
|
|
147
149
|
// A bare "ai.tpsdev.flair" label is global to the current macOS user's
|
|
@@ -162,7 +164,7 @@ function defaultDataDir() {
|
|
|
162
164
|
// label so it is never orphaned.
|
|
163
165
|
const LEGACY_LAUNCHD_LABEL = "ai.tpsdev.flair";
|
|
164
166
|
function defaultLaunchAgentsDir() {
|
|
165
|
-
return join(
|
|
167
|
+
return join(resolveHome(), "Library", "LaunchAgents");
|
|
166
168
|
}
|
|
167
169
|
/** Instance-scoped launchd label for `dataDir`: ai.tpsdev.flair.<8-hex-char sha256 of the resolved data dir>. */
|
|
168
170
|
function launchdLabel(dataDir) {
|
|
@@ -422,11 +424,7 @@ function ensureLaunchdServiceLoaded(dataDir, runLaunchctl, launchAgentsDir = def
|
|
|
422
424
|
}
|
|
423
425
|
function configPath() {
|
|
424
426
|
// Check both .yaml and .yml extensions
|
|
425
|
-
|
|
426
|
-
const ymlPath = join(homedir(), ".flair", "config.yml");
|
|
427
|
-
if (existsSync(ymlPath) && !existsSync(yamlPath))
|
|
428
|
-
return ymlPath;
|
|
429
|
-
return yamlPath;
|
|
427
|
+
return flairConfigPath();
|
|
430
428
|
}
|
|
431
429
|
/**
|
|
432
430
|
* `~/.flair/config.yaml`'s `port:` — the PER-USER file, which describes the
|
|
@@ -3106,7 +3104,7 @@ export function probeOpenclawPluginVersion(extensionName) {
|
|
|
3106
3104
|
try {
|
|
3107
3105
|
// process.env.HOME first so tests can override; homedir() as fallback —
|
|
3108
3106
|
// homedir() doesn't honor runtime HOME changes (caches at module load).
|
|
3109
|
-
const home =
|
|
3107
|
+
const home = resolveHome();
|
|
3110
3108
|
const pkgJsonPath = resolve(home, ".openclaw", "extensions", extensionName, "package.json");
|
|
3111
3109
|
if (!existsSync(pkgJsonPath))
|
|
3112
3110
|
return null;
|
|
@@ -4230,7 +4228,7 @@ async function confirmYes(question) {
|
|
|
4230
4228
|
* applies a new artifact that the old init could not have written.
|
|
4231
4229
|
*/
|
|
4232
4230
|
async function doctorRunAfterUpgrade(args) {
|
|
4233
|
-
const homeDir =
|
|
4231
|
+
const homeDir = resolveHome();
|
|
4234
4232
|
const keysDir = defaultKeysDir();
|
|
4235
4233
|
const detectedClientIds = detectClients().filter((c) => c.detected).map((c) => c.id);
|
|
4236
4234
|
// ── Version-keyed upgrade migrations (flair#1439) ─────────────────────────
|
|
@@ -4432,7 +4430,7 @@ export function buildRepairPlist(dataDir, config) {
|
|
|
4432
4430
|
passFile: {
|
|
4433
4431
|
launcher: launchdLauncherPath(),
|
|
4434
4432
|
adminPassFile: defaultAdminPassPath(),
|
|
4435
|
-
home:
|
|
4433
|
+
home: resolveHome(),
|
|
4436
4434
|
path: process.env.PATH ?? "/usr/bin:/bin:/usr/sbin:/sbin",
|
|
4437
4435
|
},
|
|
4438
4436
|
});
|
|
@@ -4624,7 +4622,7 @@ export async function writeInitLaunchdPlist(opts, deps = {}) {
|
|
|
4624
4622
|
passFile: {
|
|
4625
4623
|
launcher: launchdLauncherPath(),
|
|
4626
4624
|
adminPassFile: adminPassPath,
|
|
4627
|
-
home:
|
|
4625
|
+
home: resolveHome(),
|
|
4628
4626
|
path: process.env.PATH ?? "/usr/bin:/bin:/usr/sbin:/sbin",
|
|
4629
4627
|
},
|
|
4630
4628
|
});
|
|
@@ -41,8 +41,8 @@ export function register(program) {
|
|
|
41
41
|
// malformed.
|
|
42
42
|
/** Render one attention-result row for its source group — human-readable mode only. */
|
|
43
43
|
program
|
|
44
|
-
.command("attention <
|
|
45
|
-
.description("What's touching entity
|
|
44
|
+
.command("attention <type:value>")
|
|
45
|
+
.description("What's touching this entity in the last N days? Argument is a vocabulary string (type:value from a closed set, e.g. repo:owner/name). Grouped view across memory/relationship/workspace/presence/orgevent (POST /AttentionQuery)")
|
|
46
46
|
.option("--days <n>", "Window size in days (default 7)")
|
|
47
47
|
.option("--agent <id>", "Agent ID (or set FLAIR_AGENT_ID env)")
|
|
48
48
|
.option("--key <path>", "Ed25519 private key path")
|
package/dist/commands/backup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveAdminUser } from "../lib/auth-resolve.js";
|
|
2
|
+
import { flairBackupOutputPath } from "../lib/flair-paths.js";
|
|
2
3
|
import * as render from "../render.js";
|
|
3
4
|
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
let cli;
|
|
7
7
|
/** Bind the cli-locals this module depends on. */
|
|
@@ -100,7 +100,7 @@ export function register(program) {
|
|
|
100
100
|
};
|
|
101
101
|
// Determine output path
|
|
102
102
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
103
|
-
const defaultOutput =
|
|
103
|
+
const defaultOutput = flairBackupOutputPath(timestamp);
|
|
104
104
|
const outputPath = opts.output ?? defaultOutput;
|
|
105
105
|
mkdirSync(join(outputPath, ".."), { recursive: true });
|
|
106
106
|
const tmp = outputPath + ".tmp";
|
package/dist/commands/doctor.js
CHANGED
|
@@ -18,8 +18,8 @@ import * as render from "../render.js";
|
|
|
18
18
|
import { checkVersion, formatVersionNudge, probeInstanceVersion, FLAIR_PKG_NAME } from "../version-check.js";
|
|
19
19
|
import { resolveRegistryNotice } from "../lib/npm-registry.js";
|
|
20
20
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
21
|
-
import { homedir } from "node:os";
|
|
22
21
|
import { dirname, join } from "node:path";
|
|
22
|
+
import { resolveHome } from "../lib/home.js";
|
|
23
23
|
let cli;
|
|
24
24
|
/** Bind the cli-locals this module depends on. */
|
|
25
25
|
export function bindCli(fns) {
|
|
@@ -500,7 +500,7 @@ export function register(program) {
|
|
|
500
500
|
// component dirs whose real config is ~/agents/flair/config.yaml.
|
|
501
501
|
const configLookup = {
|
|
502
502
|
cwd: process.cwd(),
|
|
503
|
-
homeDir:
|
|
503
|
+
homeDir: resolveHome(),
|
|
504
504
|
componentDir: flairPackageDir(),
|
|
505
505
|
};
|
|
506
506
|
const cfgPath = resolveFlairConfigYaml(configLookup);
|
|
@@ -769,7 +769,7 @@ export function register(program) {
|
|
|
769
769
|
}
|
|
770
770
|
else {
|
|
771
771
|
// Check ~/harper/ (common alternative)
|
|
772
|
-
const altDir = join(
|
|
772
|
+
const altDir = join(resolveHome(), "harper");
|
|
773
773
|
if (existsSync(altDir)) {
|
|
774
774
|
console.log(` ${render.icons.warn} Data at ${render.wrap(render.c.dim, "~/harper/")} (not ${render.wrap(render.c.dim, "~/.flair/data")}) — old install location`);
|
|
775
775
|
}
|
|
@@ -815,7 +815,7 @@ export function register(program) {
|
|
|
815
815
|
// drift (catalog "detached" fail + repair "regenerate"/"adopt"/"refuse").
|
|
816
816
|
const doctorCatalogIds = DOCTOR_CHECK_IDS.filter((id) => id !== "launchd-management");
|
|
817
817
|
const doctorCtx = {
|
|
818
|
-
homeDir:
|
|
818
|
+
homeDir: resolveHome(),
|
|
819
819
|
cwd: process.cwd(),
|
|
820
820
|
detectedClientIds: detectedClients.map((c) => c.id),
|
|
821
821
|
keysDir,
|
|
@@ -831,8 +831,8 @@ export function register(program) {
|
|
|
831
831
|
// PATH. Without this the whole section was skipped outright ("No MCP client
|
|
832
832
|
// detected") and a HOLD on that wired hook was silently missed. Presence-only
|
|
833
833
|
// here (probe:false); the arms below run the bounded execution probe.
|
|
834
|
-
const anyWiredSessionStartHook = inspectSessionStartHook(
|
|
835
|
-
inspectSessionStartHook(
|
|
834
|
+
const anyWiredSessionStartHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "claude-code"), probe: false }).present ||
|
|
835
|
+
inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "codex"), probe: false }).present;
|
|
836
836
|
if (detectedClients.length === 0 && !anyWiredSessionStartHook) {
|
|
837
837
|
console.log(` ${render.icons.info} No MCP client detected — skipping client-integration checks`);
|
|
838
838
|
}
|
|
@@ -858,7 +858,7 @@ export function register(program) {
|
|
|
858
858
|
// more. Doctor now diagnoses only MCP clients the user wired (below).
|
|
859
859
|
if (client.kind !== "mcp")
|
|
860
860
|
continue;
|
|
861
|
-
const block = readClientMcpBlock(client.id,
|
|
861
|
+
const block = readClientMcpBlock(client.id, resolveHome());
|
|
862
862
|
if (client.id === "claude-code" && block.agentId)
|
|
863
863
|
claudeCodeAgentId = block.agentId;
|
|
864
864
|
if (client.id === "codex" && block.agentId)
|
|
@@ -976,7 +976,7 @@ export function register(program) {
|
|
|
976
976
|
// and FLAIR_URL. ahead/unknown are HELD (already a pass/warn), so only
|
|
977
977
|
// `behind` is written; the catalog delta below counts the fix.
|
|
978
978
|
if (autoFix) {
|
|
979
|
-
const behindMcp = mcpClientPinFindings(
|
|
979
|
+
const behindMcp = mcpClientPinFindings(resolveHome(), flairCliVersion())
|
|
980
980
|
.filter((f) => f.direction === "behind")
|
|
981
981
|
// flair#1834 A1: key off STRUCTURAL presence (entryExists), not
|
|
982
982
|
// `present` (= agent id set). A behind entry without an identity is
|
|
@@ -1021,7 +1021,7 @@ export function register(program) {
|
|
|
1021
1021
|
const id = f.reading.target.id;
|
|
1022
1022
|
return { kind: "mcp-client", id };
|
|
1023
1023
|
});
|
|
1024
|
-
const results = refreshOwnedPins({ homeDir:
|
|
1024
|
+
const results = refreshOwnedPins({ homeDir: resolveHome(), targets: overrides });
|
|
1025
1025
|
for (const r of results) {
|
|
1026
1026
|
if (r.target.kind !== "mcp-client")
|
|
1027
1027
|
continue;
|
|
@@ -1039,8 +1039,8 @@ export function register(program) {
|
|
|
1039
1039
|
// positive this fix removes. Read the block fresh so a `--fix` that just
|
|
1040
1040
|
// wired the client during the loop above is reflected here.
|
|
1041
1041
|
const claudeCodeDetected = detectedClients.some((c) => c.id === "claude-code");
|
|
1042
|
-
const claudeCodeConfigured = claudeCodeDetected && readClientMcpBlock("claude-code",
|
|
1043
|
-
const codexConfigured = detectedClients.some((c) => c.id === "codex") && readClientMcpBlock("codex",
|
|
1042
|
+
const claudeCodeConfigured = claudeCodeDetected && readClientMcpBlock("claude-code", resolveHome()).present;
|
|
1043
|
+
const codexConfigured = detectedClients.some((c) => c.id === "codex") && readClientMcpBlock("codex", resolveHome()).present;
|
|
1044
1044
|
// Claude-Code-specific: CLAUDE.md + SessionStart hook + continuity.
|
|
1045
1045
|
// Codex has a SessionStart hook too (checked below); CLAUDE.md and
|
|
1046
1046
|
// continuity stay Claude Code only.
|
|
@@ -1051,12 +1051,12 @@ export function register(program) {
|
|
|
1051
1051
|
// opt-in that renders "not enabled" as info and never a failure, so it
|
|
1052
1052
|
// stays gated on mere detection (flair#1324/#1257).
|
|
1053
1053
|
if (claudeCodeConfigured) {
|
|
1054
|
-
const claudeMd = checkClaudeMdBootstrap(process.cwd(),
|
|
1054
|
+
const claudeMd = checkClaudeMdBootstrap(process.cwd(), resolveHome());
|
|
1055
1055
|
if (claudeMd.present) {
|
|
1056
1056
|
console.log(` ${render.icons.ok} CLAUDE.md: bootstrap instruction present (${render.wrap(render.c.dim, claudeMd.path)})`);
|
|
1057
1057
|
}
|
|
1058
1058
|
else {
|
|
1059
|
-
console.log(` ${render.icons.error} CLAUDE.md: bootstrap instruction not found (checked ${render.wrap(render.c.dim, join(process.cwd(), "CLAUDE.md"))} and ${render.wrap(render.c.dim, join(
|
|
1059
|
+
console.log(` ${render.icons.error} CLAUDE.md: bootstrap instruction not found (checked ${render.wrap(render.c.dim, join(process.cwd(), "CLAUDE.md"))} and ${render.wrap(render.c.dim, join(resolveHome(), ".claude", "CLAUDE.md"))})`);
|
|
1060
1060
|
if (autoFix) {
|
|
1061
1061
|
if (dryRun) {
|
|
1062
1062
|
console.log(` ${render.wrap(render.c.dim, "Would append bootstrap instruction to")} ${join(process.cwd(), "CLAUDE.md")}`);
|
|
@@ -1086,7 +1086,7 @@ export function register(program) {
|
|
|
1086
1086
|
// Claude Code hook whenever one is PRESENT on disk; a
|
|
1087
1087
|
// `claudeCodeConfigured` box with NO hook still falls through to the
|
|
1088
1088
|
// "not found / add" report below.
|
|
1089
|
-
const claudeHook = inspectSessionStartHook(
|
|
1089
|
+
const claudeHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "claude-code") });
|
|
1090
1090
|
if (claudeCodeConfigured || claudeHook.present) {
|
|
1091
1091
|
const hook = claudeHook;
|
|
1092
1092
|
// flair#1007: presence was never the problem — the failing entry was
|
|
@@ -1100,7 +1100,7 @@ export function register(program) {
|
|
|
1100
1100
|
// flair#1485: pin ≠ installed CLI version is a failure, never a
|
|
1101
1101
|
// ✓ "still runs". Check freshness first so a stale pin cannot
|
|
1102
1102
|
// hide behind the execution probe. Catalog owns the issue count.
|
|
1103
|
-
const claudeStale = sessionStartHookPinFindings(
|
|
1103
|
+
const claudeStale = sessionStartHookPinFindings(resolveHome()).find((f) => f.reading.target.id === "claude-code");
|
|
1104
1104
|
if (claudeStale && claudeStale.direction === "unknown") {
|
|
1105
1105
|
// flair#1778: a pin we cannot compare is its OWN finding — a warn,
|
|
1106
1106
|
// never the stale "old adapter" error, and NOT re-pinned (the
|
|
@@ -1120,7 +1120,7 @@ export function register(program) {
|
|
|
1120
1120
|
console.log(` ${render.wrap(render.c.dim, "Would re-pin the SessionStart hook in")} ${hook.path}`);
|
|
1121
1121
|
}
|
|
1122
1122
|
else {
|
|
1123
|
-
const repin = repinSessionStartHookGuarded(
|
|
1123
|
+
const repin = repinSessionStartHookGuarded(resolveHome(), "claude-code");
|
|
1124
1124
|
// flair#1834 A1 round 3 + PR-H: the SAME icon rule as the MCP
|
|
1125
1125
|
// re-pin line — a hold (or a failed write) renders ⚠, never a
|
|
1126
1126
|
// false ✓ for an attempted-but-held fix.
|
|
@@ -1187,7 +1187,7 @@ export function register(program) {
|
|
|
1187
1187
|
console.log(` Skipped.`);
|
|
1188
1188
|
}
|
|
1189
1189
|
else {
|
|
1190
|
-
const upgrade = upgradeSessionStartHookCommand(
|
|
1190
|
+
const upgrade = upgradeSessionStartHookCommand(resolveHome());
|
|
1191
1191
|
console.log(` ${upgrade.ok ? render.icons.ok : render.icons.warn} ${upgrade.message}`);
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
@@ -1214,7 +1214,7 @@ export function register(program) {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
else {
|
|
1216
1216
|
const fixAgentId = claudeCodeAgentId || opts.agent || process.env.FLAIR_AGENT_ID;
|
|
1217
|
-
const fixRes = fixSessionStartHook(
|
|
1217
|
+
const fixRes = fixSessionStartHook(resolveHome(), fixAgentId);
|
|
1218
1218
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
@@ -1239,7 +1239,7 @@ export function register(program) {
|
|
|
1239
1239
|
// --continuity` only). A partial or stale pair IS evidence of a prior
|
|
1240
1240
|
// opt-in, so repairing it to the complete current form remains a
|
|
1241
1241
|
// legitimate --fix.
|
|
1242
|
-
const continuity = checkContinuityCaptureHooks(
|
|
1242
|
+
const continuity = checkContinuityCaptureHooks(resolveHome());
|
|
1243
1243
|
if (continuity.state === "installed") {
|
|
1244
1244
|
console.log(` ${render.icons.ok} Continuity capture hooks: PostToolUse + Stop wired in ${render.wrap(render.c.dim, continuity.path)}`);
|
|
1245
1245
|
}
|
|
@@ -1267,7 +1267,7 @@ export function register(program) {
|
|
|
1267
1267
|
// different instance.
|
|
1268
1268
|
const existingCommand = continuity.postToolUse.command || continuity.stop.command || "";
|
|
1269
1269
|
const existingUrl = existingCommand.match(/FLAIR_URL=(\S+)/)?.[1];
|
|
1270
|
-
const fixRes = fixContinuityCaptureHooks(
|
|
1270
|
+
const fixRes = fixContinuityCaptureHooks(resolveHome(), fixAgentId, existingUrl);
|
|
1271
1271
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1272
1272
|
if (fixRes.ok && fixRes.changed)
|
|
1273
1273
|
fixed++;
|
|
@@ -1292,11 +1292,11 @@ export function register(program) {
|
|
|
1292
1292
|
// was not installed — exactly the quiet skip PR-H exists to prevent (a
|
|
1293
1293
|
// HOLD must be printed). A `codexConfigured` box with NO hook still falls
|
|
1294
1294
|
// through to the "not found / add" report below.
|
|
1295
|
-
const codexHook = inspectSessionStartHook(
|
|
1295
|
+
const codexHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "codex") });
|
|
1296
1296
|
if (codexConfigured || codexHook.present) {
|
|
1297
1297
|
const hook = codexHook;
|
|
1298
1298
|
if (hook.present) {
|
|
1299
|
-
const codexStale = sessionStartHookPinFindings(
|
|
1299
|
+
const codexStale = sessionStartHookPinFindings(resolveHome()).find((f) => f.reading.target.id === "codex");
|
|
1300
1300
|
if (codexStale && codexStale.direction === "unknown") {
|
|
1301
1301
|
// flair#1778: same direction rule as Claude Code above.
|
|
1302
1302
|
console.log(` ${render.icons.warn} SessionStart hook (codex): pin is not a version I can compare: ${codexStale.reading.pin} — not re-pinned; re-run flair init or edit the hook if this is unintended`);
|
|
@@ -1312,7 +1312,7 @@ export function register(program) {
|
|
|
1312
1312
|
console.log(` ${render.wrap(render.c.dim, "Would re-pin the SessionStart hook in")} ${hook.path}`);
|
|
1313
1313
|
}
|
|
1314
1314
|
else {
|
|
1315
|
-
const repin = repinSessionStartHookGuarded(
|
|
1315
|
+
const repin = repinSessionStartHookGuarded(resolveHome(), "codex");
|
|
1316
1316
|
// flair#1834 A1 round 3 + PR-H: the SAME icon rule as the MCP
|
|
1317
1317
|
// re-pin line — a hold (or a failed write) renders ⚠, never a
|
|
1318
1318
|
// false ✓ for an attempted-but-held fix.
|
|
@@ -1359,7 +1359,7 @@ export function register(program) {
|
|
|
1359
1359
|
console.log(` Skipped.`);
|
|
1360
1360
|
}
|
|
1361
1361
|
else {
|
|
1362
|
-
const upgrade = upgradeSessionStartHookCommand(
|
|
1362
|
+
const upgrade = upgradeSessionStartHookCommand(resolveHome(), hook.path);
|
|
1363
1363
|
console.log(` ${upgrade.ok ? render.icons.ok : render.icons.warn} ${upgrade.message}`);
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
@@ -1385,8 +1385,8 @@ export function register(program) {
|
|
|
1385
1385
|
console.log(` Skipped.`);
|
|
1386
1386
|
}
|
|
1387
1387
|
else {
|
|
1388
|
-
const fixAgentId = resolveHookAgentId({ agent: opts.agent },
|
|
1389
|
-
const fixRes = fixSessionStartHook(
|
|
1388
|
+
const fixAgentId = resolveHookAgentId({ agent: opts.agent }, resolveHome(), "codex");
|
|
1389
|
+
const fixRes = fixSessionStartHook(resolveHome(), fixAgentId, hook.path);
|
|
1390
1390
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
@@ -1590,6 +1590,17 @@ export function register(program) {
|
|
|
1590
1590
|
try {
|
|
1591
1591
|
const presRes = await fetch(`${baseUrl}/Presence`, { headers, signal: AbortSignal.timeout(5000) });
|
|
1592
1592
|
if (!presRes.ok) {
|
|
1593
|
+
// flair#1880: GET /Presence requires a verified reader by default, so
|
|
1594
|
+
// a keyless (unsigned) read now gets 401. Say so plainly instead of a
|
|
1595
|
+
// bare HTTP code — there is no agent to sign as here, so the fix is
|
|
1596
|
+
// either to pass one (--agent) or to opt the instance into a public
|
|
1597
|
+
// roster. Never silent: the flip must not blind our own tooling.
|
|
1598
|
+
if (presRes.status === 401 && !canSign) {
|
|
1599
|
+
console.log(`${indent}${render.icons.info} Presence roster requires a verified reader (HTTP 401). ` +
|
|
1600
|
+
`Pass --agent <id> (with a matching key in ~/.flair/keys) to read it, or set ` +
|
|
1601
|
+
`PRESENCE_PUBLIC_ROSTER=true on the instance to publish a public roster.`);
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1593
1604
|
console.log(`${indent}${render.icons.warn} Could not fetch presence roster (HTTP ${presRes.status})`);
|
|
1594
1605
|
return;
|
|
1595
1606
|
}
|
|
@@ -1809,7 +1820,7 @@ export function register(program) {
|
|
|
1809
1820
|
statusCommand: "flair federation sync status",
|
|
1810
1821
|
darwinTarget: `${guiDomain}/${fedSched.LAUNCHD_LABEL}`,
|
|
1811
1822
|
linuxServiceUnit: fedSched.SYSTEMD_SERVICE_UNIT,
|
|
1812
|
-
stderrLogPath: join(
|
|
1823
|
+
stderrLogPath: join(resolveHome(), ".flair", "logs", "federation-sync.stderr.log"),
|
|
1813
1824
|
},
|
|
1814
1825
|
{
|
|
1815
1826
|
kind: "rem",
|
|
@@ -1819,7 +1830,7 @@ export function register(program) {
|
|
|
1819
1830
|
statusCommand: "flair rem nightly status",
|
|
1820
1831
|
darwinTarget: `${guiDomain}/${remSched.LAUNCHD_LABEL}`,
|
|
1821
1832
|
linuxServiceUnit: remSched.SYSTEMD_SERVICE_UNIT,
|
|
1822
|
-
stderrLogPath: join(
|
|
1833
|
+
stderrLogPath: join(resolveHome(), ".flair", "logs", "rem-nightly.stderr.log"),
|
|
1823
1834
|
},
|
|
1824
1835
|
];
|
|
1825
1836
|
for (const d of drivers) {
|
package/dist/commands/export.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defaultKeysDir, resolveAdminUser } from "../lib/auth-resolve.js";
|
|
2
2
|
import * as render from "../render.js";
|
|
3
3
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
4
|
import { join, resolve } from "node:path";
|
|
5
|
+
import { resolveHome } from "../lib/home.js";
|
|
6
6
|
let cli;
|
|
7
7
|
/** Bind the cli-locals this module depends on. */
|
|
8
8
|
export function bindCli(fns) {
|
|
@@ -88,7 +88,7 @@ export function register(program) {
|
|
|
88
88
|
grants,
|
|
89
89
|
...(privateKey ? { privateKey } : {}),
|
|
90
90
|
};
|
|
91
|
-
const rawOutputPath = opts.output ?? join(
|
|
91
|
+
const rawOutputPath = opts.output ?? join(resolveHome(), ".flair", "exports", `${agentId}-${Date.now()}.json`);
|
|
92
92
|
// Canonicalize to prevent path traversal (e.g. ../../etc/passwd)
|
|
93
93
|
const outputPath = resolve(rawOutputPath);
|
|
94
94
|
mkdirSync(join(outputPath, ".."), { recursive: true });
|