@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
package/dist/commands/doctor.js
CHANGED
|
@@ -12,14 +12,15 @@ import { DOCTOR_CHECK_IDS, catalogIssueDelta, mcpRepinIcon, renderCatalogDoctorL
|
|
|
12
12
|
import { describeEmbedGpuDoctorFinding } from "../lib/embed-gpu-doctor.js";
|
|
13
13
|
import { adminPassDesyncFinding, detectPersistedAdminUser } from "../lib/init-admin-pass.js";
|
|
14
14
|
import { opsApiBindFinding } from "../lib/ops-api-bind.js";
|
|
15
|
+
import { instanceIdentityLines, probeInstanceIdentity, } from "../lib/instance-identity-row.js";
|
|
15
16
|
import { flairCliVersion, unpinnedSpecWarning } from "../lib/mcp-spec.js";
|
|
16
17
|
import { mcpClientPinFindings, refreshOwnedPins, repinSessionStartHookGuarded, sessionStartHookPinFindings } from "../lib/owned-pins.js";
|
|
17
18
|
import * as render from "../render.js";
|
|
18
19
|
import { checkVersion, formatVersionNudge, probeInstanceVersion, FLAIR_PKG_NAME } from "../version-check.js";
|
|
19
20
|
import { resolveRegistryNotice } from "../lib/npm-registry.js";
|
|
20
21
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
21
|
-
import { homedir } from "node:os";
|
|
22
22
|
import { dirname, join } from "node:path";
|
|
23
|
+
import { resolveHome } from "../lib/home.js";
|
|
23
24
|
let cli;
|
|
24
25
|
/** Bind the cli-locals this module depends on. */
|
|
25
26
|
export function bindCli(fns) {
|
|
@@ -500,7 +501,7 @@ export function register(program) {
|
|
|
500
501
|
// component dirs whose real config is ~/agents/flair/config.yaml.
|
|
501
502
|
const configLookup = {
|
|
502
503
|
cwd: process.cwd(),
|
|
503
|
-
homeDir:
|
|
504
|
+
homeDir: resolveHome(),
|
|
504
505
|
componentDir: flairPackageDir(),
|
|
505
506
|
};
|
|
506
507
|
const cfgPath = resolveFlairConfigYaml(configLookup);
|
|
@@ -733,6 +734,57 @@ export function register(program) {
|
|
|
733
734
|
break;
|
|
734
735
|
}
|
|
735
736
|
}
|
|
737
|
+
// 4c. Instance identity (flair#1883). A hub's identity is ONE
|
|
738
|
+
// `flair.Instance` row, and the pairing-cleanup sweep reads its role from
|
|
739
|
+
// that row. More than one row means there is no canonical identity — the
|
|
740
|
+
// state a hub lands in when `GET /FederationInstance` find-or-creates a
|
|
741
|
+
// spoke row and `flair init --remote` inserted a second one (which is why
|
|
742
|
+
// the sweep could find no hub role and never clean up). A
|
|
743
|
+
// `flair_pair_initiator` role on an instance whose identity row is not a
|
|
744
|
+
// hub is the same debris seen from the other side. Both are read from the
|
|
745
|
+
// instance itself, so they need the ops API — same admin credential as the
|
|
746
|
+
// audit check above. A read that does not happen is UNVERIFIED: never a
|
|
747
|
+
// pass, and never a fabricated finding. The two reads are separate, so the
|
|
748
|
+
// states are separate too (flair#1883 round 2): rows read but list_roles
|
|
749
|
+
// unreadable leaves the pairing-role check UNVERIFIED while the row facts
|
|
750
|
+
// are still reported — a green line would claim a check that did not run.
|
|
751
|
+
if (harperResponding) {
|
|
752
|
+
let identityAdminPass;
|
|
753
|
+
let identityCredIssue = null;
|
|
754
|
+
try {
|
|
755
|
+
identityAdminPass = resolveLocalAdminPass(undefined);
|
|
756
|
+
}
|
|
757
|
+
catch (err) {
|
|
758
|
+
identityCredIssue = err instanceof Error ? err.message : String(err);
|
|
759
|
+
}
|
|
760
|
+
if (identityCredIssue) {
|
|
761
|
+
console.log(` ${render.icons.warn} Instance identity: UNVERIFIED (could not probe — ${identityCredIssue})`);
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
const probe = await probeInstanceIdentity({
|
|
765
|
+
opsUrl: `http://127.0.0.1:${resolveOpsPort(opts)}`,
|
|
766
|
+
credentials: { user: resolveAdminUser(undefined), pass: identityAdminPass ?? "" },
|
|
767
|
+
});
|
|
768
|
+
if (probe.rows === null) {
|
|
769
|
+
console.log(` ${render.icons.warn} Instance identity: UNVERIFIED (could not read the Instance table via the ops API)`);
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
// The lines — and therefore the pairing-role state — are built in
|
|
773
|
+
// `instanceIdentityLines`, so "an unread pairing-role check is never
|
|
774
|
+
// silent" is a property of the lines and not of this call site: a row
|
|
775
|
+
// finding and the pairing-role UNVERIFIED status print as two lines
|
|
776
|
+
// from one call (flair#1883 round 5).
|
|
777
|
+
for (const line of instanceIdentityLines({ rows: probe.rows, roleNames: probe.roleNames })) {
|
|
778
|
+
const icon = line.level === "ok" ? render.icons.ok : line.level === "warn" ? render.icons.warn : render.icons.error;
|
|
779
|
+
console.log(` ${icon} ${line.level === "fail" ? line.text : render.wrap(render.c.dim, line.text)}`);
|
|
780
|
+
if (line.fix)
|
|
781
|
+
console.log(` ${render.wrap(render.c.dim, line.fix)}`);
|
|
782
|
+
if (line.level === "fail")
|
|
783
|
+
issues++;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
736
788
|
// 5. Stale PID file (skip if already reported in port check)
|
|
737
789
|
const dataDir = defaultDataDir();
|
|
738
790
|
const pidFile = join(dataDir, "hdb.pid");
|
|
@@ -769,7 +821,7 @@ export function register(program) {
|
|
|
769
821
|
}
|
|
770
822
|
else {
|
|
771
823
|
// Check ~/harper/ (common alternative)
|
|
772
|
-
const altDir = join(
|
|
824
|
+
const altDir = join(resolveHome(), "harper");
|
|
773
825
|
if (existsSync(altDir)) {
|
|
774
826
|
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
827
|
}
|
|
@@ -815,7 +867,7 @@ export function register(program) {
|
|
|
815
867
|
// drift (catalog "detached" fail + repair "regenerate"/"adopt"/"refuse").
|
|
816
868
|
const doctorCatalogIds = DOCTOR_CHECK_IDS.filter((id) => id !== "launchd-management");
|
|
817
869
|
const doctorCtx = {
|
|
818
|
-
homeDir:
|
|
870
|
+
homeDir: resolveHome(),
|
|
819
871
|
cwd: process.cwd(),
|
|
820
872
|
detectedClientIds: detectedClients.map((c) => c.id),
|
|
821
873
|
keysDir,
|
|
@@ -831,8 +883,8 @@ export function register(program) {
|
|
|
831
883
|
// PATH. Without this the whole section was skipped outright ("No MCP client
|
|
832
884
|
// detected") and a HOLD on that wired hook was silently missed. Presence-only
|
|
833
885
|
// here (probe:false); the arms below run the bounded execution probe.
|
|
834
|
-
const anyWiredSessionStartHook = inspectSessionStartHook(
|
|
835
|
-
inspectSessionStartHook(
|
|
886
|
+
const anyWiredSessionStartHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "claude-code"), probe: false }).present ||
|
|
887
|
+
inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "codex"), probe: false }).present;
|
|
836
888
|
if (detectedClients.length === 0 && !anyWiredSessionStartHook) {
|
|
837
889
|
console.log(` ${render.icons.info} No MCP client detected — skipping client-integration checks`);
|
|
838
890
|
}
|
|
@@ -858,7 +910,7 @@ export function register(program) {
|
|
|
858
910
|
// more. Doctor now diagnoses only MCP clients the user wired (below).
|
|
859
911
|
if (client.kind !== "mcp")
|
|
860
912
|
continue;
|
|
861
|
-
const block = readClientMcpBlock(client.id,
|
|
913
|
+
const block = readClientMcpBlock(client.id, resolveHome());
|
|
862
914
|
if (client.id === "claude-code" && block.agentId)
|
|
863
915
|
claudeCodeAgentId = block.agentId;
|
|
864
916
|
if (client.id === "codex" && block.agentId)
|
|
@@ -976,7 +1028,7 @@ export function register(program) {
|
|
|
976
1028
|
// and FLAIR_URL. ahead/unknown are HELD (already a pass/warn), so only
|
|
977
1029
|
// `behind` is written; the catalog delta below counts the fix.
|
|
978
1030
|
if (autoFix) {
|
|
979
|
-
const behindMcp = mcpClientPinFindings(
|
|
1031
|
+
const behindMcp = mcpClientPinFindings(resolveHome(), flairCliVersion())
|
|
980
1032
|
.filter((f) => f.direction === "behind")
|
|
981
1033
|
// flair#1834 A1: key off STRUCTURAL presence (entryExists), not
|
|
982
1034
|
// `present` (= agent id set). A behind entry without an identity is
|
|
@@ -1021,7 +1073,7 @@ export function register(program) {
|
|
|
1021
1073
|
const id = f.reading.target.id;
|
|
1022
1074
|
return { kind: "mcp-client", id };
|
|
1023
1075
|
});
|
|
1024
|
-
const results = refreshOwnedPins({ homeDir:
|
|
1076
|
+
const results = refreshOwnedPins({ homeDir: resolveHome(), targets: overrides });
|
|
1025
1077
|
for (const r of results) {
|
|
1026
1078
|
if (r.target.kind !== "mcp-client")
|
|
1027
1079
|
continue;
|
|
@@ -1039,8 +1091,8 @@ export function register(program) {
|
|
|
1039
1091
|
// positive this fix removes. Read the block fresh so a `--fix` that just
|
|
1040
1092
|
// wired the client during the loop above is reflected here.
|
|
1041
1093
|
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",
|
|
1094
|
+
const claudeCodeConfigured = claudeCodeDetected && readClientMcpBlock("claude-code", resolveHome()).present;
|
|
1095
|
+
const codexConfigured = detectedClients.some((c) => c.id === "codex") && readClientMcpBlock("codex", resolveHome()).present;
|
|
1044
1096
|
// Claude-Code-specific: CLAUDE.md + SessionStart hook + continuity.
|
|
1045
1097
|
// Codex has a SessionStart hook too (checked below); CLAUDE.md and
|
|
1046
1098
|
// continuity stay Claude Code only.
|
|
@@ -1051,12 +1103,12 @@ export function register(program) {
|
|
|
1051
1103
|
// opt-in that renders "not enabled" as info and never a failure, so it
|
|
1052
1104
|
// stays gated on mere detection (flair#1324/#1257).
|
|
1053
1105
|
if (claudeCodeConfigured) {
|
|
1054
|
-
const claudeMd = checkClaudeMdBootstrap(process.cwd(),
|
|
1106
|
+
const claudeMd = checkClaudeMdBootstrap(process.cwd(), resolveHome());
|
|
1055
1107
|
if (claudeMd.present) {
|
|
1056
1108
|
console.log(` ${render.icons.ok} CLAUDE.md: bootstrap instruction present (${render.wrap(render.c.dim, claudeMd.path)})`);
|
|
1057
1109
|
}
|
|
1058
1110
|
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(
|
|
1111
|
+
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
1112
|
if (autoFix) {
|
|
1061
1113
|
if (dryRun) {
|
|
1062
1114
|
console.log(` ${render.wrap(render.c.dim, "Would append bootstrap instruction to")} ${join(process.cwd(), "CLAUDE.md")}`);
|
|
@@ -1086,7 +1138,7 @@ export function register(program) {
|
|
|
1086
1138
|
// Claude Code hook whenever one is PRESENT on disk; a
|
|
1087
1139
|
// `claudeCodeConfigured` box with NO hook still falls through to the
|
|
1088
1140
|
// "not found / add" report below.
|
|
1089
|
-
const claudeHook = inspectSessionStartHook(
|
|
1141
|
+
const claudeHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "claude-code") });
|
|
1090
1142
|
if (claudeCodeConfigured || claudeHook.present) {
|
|
1091
1143
|
const hook = claudeHook;
|
|
1092
1144
|
// flair#1007: presence was never the problem — the failing entry was
|
|
@@ -1100,7 +1152,7 @@ export function register(program) {
|
|
|
1100
1152
|
// flair#1485: pin ≠ installed CLI version is a failure, never a
|
|
1101
1153
|
// ✓ "still runs". Check freshness first so a stale pin cannot
|
|
1102
1154
|
// hide behind the execution probe. Catalog owns the issue count.
|
|
1103
|
-
const claudeStale = sessionStartHookPinFindings(
|
|
1155
|
+
const claudeStale = sessionStartHookPinFindings(resolveHome()).find((f) => f.reading.target.id === "claude-code");
|
|
1104
1156
|
if (claudeStale && claudeStale.direction === "unknown") {
|
|
1105
1157
|
// flair#1778: a pin we cannot compare is its OWN finding — a warn,
|
|
1106
1158
|
// never the stale "old adapter" error, and NOT re-pinned (the
|
|
@@ -1120,7 +1172,7 @@ export function register(program) {
|
|
|
1120
1172
|
console.log(` ${render.wrap(render.c.dim, "Would re-pin the SessionStart hook in")} ${hook.path}`);
|
|
1121
1173
|
}
|
|
1122
1174
|
else {
|
|
1123
|
-
const repin = repinSessionStartHookGuarded(
|
|
1175
|
+
const repin = repinSessionStartHookGuarded(resolveHome(), "claude-code");
|
|
1124
1176
|
// flair#1834 A1 round 3 + PR-H: the SAME icon rule as the MCP
|
|
1125
1177
|
// re-pin line — a hold (or a failed write) renders ⚠, never a
|
|
1126
1178
|
// false ✓ for an attempted-but-held fix.
|
|
@@ -1187,7 +1239,7 @@ export function register(program) {
|
|
|
1187
1239
|
console.log(` Skipped.`);
|
|
1188
1240
|
}
|
|
1189
1241
|
else {
|
|
1190
|
-
const upgrade = upgradeSessionStartHookCommand(
|
|
1242
|
+
const upgrade = upgradeSessionStartHookCommand(resolveHome());
|
|
1191
1243
|
console.log(` ${upgrade.ok ? render.icons.ok : render.icons.warn} ${upgrade.message}`);
|
|
1192
1244
|
}
|
|
1193
1245
|
}
|
|
@@ -1214,7 +1266,7 @@ export function register(program) {
|
|
|
1214
1266
|
}
|
|
1215
1267
|
else {
|
|
1216
1268
|
const fixAgentId = claudeCodeAgentId || opts.agent || process.env.FLAIR_AGENT_ID;
|
|
1217
|
-
const fixRes = fixSessionStartHook(
|
|
1269
|
+
const fixRes = fixSessionStartHook(resolveHome(), fixAgentId);
|
|
1218
1270
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1219
1271
|
}
|
|
1220
1272
|
}
|
|
@@ -1239,7 +1291,7 @@ export function register(program) {
|
|
|
1239
1291
|
// --continuity` only). A partial or stale pair IS evidence of a prior
|
|
1240
1292
|
// opt-in, so repairing it to the complete current form remains a
|
|
1241
1293
|
// legitimate --fix.
|
|
1242
|
-
const continuity = checkContinuityCaptureHooks(
|
|
1294
|
+
const continuity = checkContinuityCaptureHooks(resolveHome());
|
|
1243
1295
|
if (continuity.state === "installed") {
|
|
1244
1296
|
console.log(` ${render.icons.ok} Continuity capture hooks: PostToolUse + Stop wired in ${render.wrap(render.c.dim, continuity.path)}`);
|
|
1245
1297
|
}
|
|
@@ -1267,7 +1319,7 @@ export function register(program) {
|
|
|
1267
1319
|
// different instance.
|
|
1268
1320
|
const existingCommand = continuity.postToolUse.command || continuity.stop.command || "";
|
|
1269
1321
|
const existingUrl = existingCommand.match(/FLAIR_URL=(\S+)/)?.[1];
|
|
1270
|
-
const fixRes = fixContinuityCaptureHooks(
|
|
1322
|
+
const fixRes = fixContinuityCaptureHooks(resolveHome(), fixAgentId, existingUrl);
|
|
1271
1323
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1272
1324
|
if (fixRes.ok && fixRes.changed)
|
|
1273
1325
|
fixed++;
|
|
@@ -1292,11 +1344,11 @@ export function register(program) {
|
|
|
1292
1344
|
// was not installed — exactly the quiet skip PR-H exists to prevent (a
|
|
1293
1345
|
// HOLD must be printed). A `codexConfigured` box with NO hook still falls
|
|
1294
1346
|
// through to the "not found / add" report below.
|
|
1295
|
-
const codexHook = inspectSessionStartHook(
|
|
1347
|
+
const codexHook = inspectSessionStartHook(resolveHome(), { settingsPath: hookSettingsPath(resolveHome(), "codex") });
|
|
1296
1348
|
if (codexConfigured || codexHook.present) {
|
|
1297
1349
|
const hook = codexHook;
|
|
1298
1350
|
if (hook.present) {
|
|
1299
|
-
const codexStale = sessionStartHookPinFindings(
|
|
1351
|
+
const codexStale = sessionStartHookPinFindings(resolveHome()).find((f) => f.reading.target.id === "codex");
|
|
1300
1352
|
if (codexStale && codexStale.direction === "unknown") {
|
|
1301
1353
|
// flair#1778: same direction rule as Claude Code above.
|
|
1302
1354
|
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 +1364,7 @@ export function register(program) {
|
|
|
1312
1364
|
console.log(` ${render.wrap(render.c.dim, "Would re-pin the SessionStart hook in")} ${hook.path}`);
|
|
1313
1365
|
}
|
|
1314
1366
|
else {
|
|
1315
|
-
const repin = repinSessionStartHookGuarded(
|
|
1367
|
+
const repin = repinSessionStartHookGuarded(resolveHome(), "codex");
|
|
1316
1368
|
// flair#1834 A1 round 3 + PR-H: the SAME icon rule as the MCP
|
|
1317
1369
|
// re-pin line — a hold (or a failed write) renders ⚠, never a
|
|
1318
1370
|
// false ✓ for an attempted-but-held fix.
|
|
@@ -1359,7 +1411,7 @@ export function register(program) {
|
|
|
1359
1411
|
console.log(` Skipped.`);
|
|
1360
1412
|
}
|
|
1361
1413
|
else {
|
|
1362
|
-
const upgrade = upgradeSessionStartHookCommand(
|
|
1414
|
+
const upgrade = upgradeSessionStartHookCommand(resolveHome(), hook.path);
|
|
1363
1415
|
console.log(` ${upgrade.ok ? render.icons.ok : render.icons.warn} ${upgrade.message}`);
|
|
1364
1416
|
}
|
|
1365
1417
|
}
|
|
@@ -1385,8 +1437,8 @@ export function register(program) {
|
|
|
1385
1437
|
console.log(` Skipped.`);
|
|
1386
1438
|
}
|
|
1387
1439
|
else {
|
|
1388
|
-
const fixAgentId = resolveHookAgentId({ agent: opts.agent },
|
|
1389
|
-
const fixRes = fixSessionStartHook(
|
|
1440
|
+
const fixAgentId = resolveHookAgentId({ agent: opts.agent }, resolveHome(), "codex");
|
|
1441
|
+
const fixRes = fixSessionStartHook(resolveHome(), fixAgentId, hook.path);
|
|
1390
1442
|
console.log(` ${fixRes.ok ? render.icons.ok : render.icons.warn} ${fixRes.message}`);
|
|
1391
1443
|
}
|
|
1392
1444
|
}
|
|
@@ -1590,6 +1642,17 @@ export function register(program) {
|
|
|
1590
1642
|
try {
|
|
1591
1643
|
const presRes = await fetch(`${baseUrl}/Presence`, { headers, signal: AbortSignal.timeout(5000) });
|
|
1592
1644
|
if (!presRes.ok) {
|
|
1645
|
+
// flair#1880: GET /Presence requires a verified reader by default, so
|
|
1646
|
+
// a keyless (unsigned) read now gets 401. Say so plainly instead of a
|
|
1647
|
+
// bare HTTP code — there is no agent to sign as here, so the fix is
|
|
1648
|
+
// either to pass one (--agent) or to opt the instance into a public
|
|
1649
|
+
// roster. Never silent: the flip must not blind our own tooling.
|
|
1650
|
+
if (presRes.status === 401 && !canSign) {
|
|
1651
|
+
console.log(`${indent}${render.icons.info} Presence roster requires a verified reader (HTTP 401). ` +
|
|
1652
|
+
`Pass --agent <id> (with a matching key in ~/.flair/keys) to read it, or set ` +
|
|
1653
|
+
`PRESENCE_PUBLIC_ROSTER=true on the instance to publish a public roster.`);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1593
1656
|
console.log(`${indent}${render.icons.warn} Could not fetch presence roster (HTTP ${presRes.status})`);
|
|
1594
1657
|
return;
|
|
1595
1658
|
}
|
|
@@ -1809,7 +1872,7 @@ export function register(program) {
|
|
|
1809
1872
|
statusCommand: "flair federation sync status",
|
|
1810
1873
|
darwinTarget: `${guiDomain}/${fedSched.LAUNCHD_LABEL}`,
|
|
1811
1874
|
linuxServiceUnit: fedSched.SYSTEMD_SERVICE_UNIT,
|
|
1812
|
-
stderrLogPath: join(
|
|
1875
|
+
stderrLogPath: join(resolveHome(), ".flair", "logs", "federation-sync.stderr.log"),
|
|
1813
1876
|
},
|
|
1814
1877
|
{
|
|
1815
1878
|
kind: "rem",
|
|
@@ -1819,7 +1882,7 @@ export function register(program) {
|
|
|
1819
1882
|
statusCommand: "flair rem nightly status",
|
|
1820
1883
|
darwinTarget: `${guiDomain}/${remSched.LAUNCHD_LABEL}`,
|
|
1821
1884
|
linuxServiceUnit: remSched.SYSTEMD_SERVICE_UNIT,
|
|
1822
|
-
stderrLogPath: join(
|
|
1885
|
+
stderrLogPath: join(resolveHome(), ".flair", "logs", "rem-nightly.stderr.log"),
|
|
1823
1886
|
},
|
|
1824
1887
|
];
|
|
1825
1888
|
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 });
|