@tpsdev-ai/flair 0.57.0 → 0.59.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 +7 -6
- package/SECURITY.md +4 -1
- package/config.yaml +3 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +1726 -376
- package/dist/commands/agent.js +160 -2
- package/dist/commands/doctor.js +177 -27
- package/dist/commands/federation.js +2 -1
- package/dist/commands/hook.js +10 -2
- package/dist/commands/init.js +150 -44
- package/dist/commands/mcp.js +53 -22
- package/dist/commands/memory.js +24 -2
- package/dist/commands/quality.js +26 -18
- package/dist/commands/service.js +137 -22
- package/dist/commands/status.js +114 -3
- package/dist/commands/upgrade.js +204 -84
- package/dist/doctor-client.js +50 -4
- package/dist/federation/scheduler.js +253 -4
- package/dist/install/clients.js +89 -23
- package/dist/install/global-bin-path.js +26 -6
- package/dist/lib/atomic-write.js +256 -0
- package/dist/lib/daemon-liveness.js +103 -0
- package/dist/lib/doctor-run.js +72 -0
- package/dist/lib/embed-gpu-doctor.js +49 -26
- package/dist/lib/federation-memory-attributes.js +15 -0
- package/dist/lib/flair-agent-role.js +116 -0
- package/dist/lib/init-admin-pass.js +4 -2
- package/dist/lib/init-listener-environ.js +38 -0
- package/dist/lib/init-occupied-listener.js +165 -0
- package/dist/lib/launchd-domain-preflight.js +448 -0
- package/dist/lib/launchd-management.js +179 -8
- package/dist/lib/launchd-repair.js +95 -0
- package/dist/lib/mcp-enable.js +667 -72
- package/dist/lib/memory-attributes.js +77 -0
- package/dist/lib/node-alias-path.js +95 -0
- package/dist/lib/npm-registry.js +119 -6
- package/dist/lib/owned-pins.js +20 -6
- package/dist/lib/process-start-time.js +32 -0
- package/dist/lib/service-repoint-apply.js +267 -0
- package/dist/lib/service-repoint.js +575 -0
- package/dist/lib/toml-string-array.js +104 -0
- package/dist/lib/tree-divergence.js +716 -0
- package/dist/lib/upgrade-plain-tree.js +18 -8
- package/dist/lib/upgrade-prior-liveness.js +69 -0
- package/dist/lib/upgrade-rollback.js +116 -0
- package/dist/rem/runner.js +11 -0
- package/dist/resources/Agent.js +54 -21
- package/dist/resources/AgentSeed.js +44 -1
- package/dist/resources/Federation.js +84 -54
- package/dist/resources/Memory.js +567 -72
- package/dist/resources/MemoryArchive.js +9 -0
- package/dist/resources/MemoryBootstrap.js +125 -29
- package/dist/resources/MemoryFeed.js +204 -3
- package/dist/resources/MemoryHostSource.js +90 -0
- package/dist/resources/MemoryMaintenance.js +121 -32
- package/dist/resources/MemoryReflect.js +4 -1
- package/dist/resources/MemoryReindex.js +7 -4
- package/dist/resources/MemoryUsage.js +53 -3
- package/dist/resources/OrgSkillAssignment.js +209 -0
- package/dist/resources/Presence.js +18 -10
- package/dist/resources/RecordUsage.js +30 -40
- package/dist/resources/Relationship.js +167 -78
- package/dist/resources/SemanticSearch.js +19 -6
- package/dist/resources/Soul.js +31 -19
- package/dist/resources/XAA.js +47 -14
- package/dist/resources/agent-auth.js +16 -10
- package/dist/resources/agent-status-guard.js +63 -0
- package/dist/resources/auth-middleware.js +137 -49
- package/dist/resources/auto-promote-lib.js +4 -4
- package/dist/resources/bm25-index-service.js +246 -32
- package/dist/resources/bm25-status.js +132 -0
- package/dist/resources/ed25519-auth.js +11 -54
- package/dist/resources/embed-gpu.js +262 -47
- package/dist/resources/embeddings-boot.js +52 -17
- package/dist/resources/federation-classify.js +34 -0
- package/dist/resources/federation-crypto.js +65 -19
- package/dist/resources/flair-agent-role-boot.js +26 -0
- package/dist/resources/health.js +67 -16
- package/dist/resources/host-pointer/registry.js +35 -0
- package/dist/resources/host-pointer-adapter.js +15 -0
- package/dist/resources/host-source-visibility.js +167 -0
- package/dist/resources/host-source.js +151 -0
- package/dist/resources/instance-identity.js +3 -2
- package/dist/resources/key-lock.js +31 -0
- package/dist/resources/mcp-handler.js +147 -51
- package/dist/resources/mcp-oauth.js +3 -6
- package/dist/resources/mcp-tools.js +47 -25
- package/dist/resources/memory-consolidate-lib.js +3 -1
- package/dist/resources/memory-declared-attributes.js +103 -0
- package/dist/resources/memory-feed-lib.js +5 -1
- package/dist/resources/memory-host-source.js +163 -0
- package/dist/resources/migrations/synthetic-test-migration.js +4 -1
- package/dist/resources/migrations/visibility-backfill.js +4 -1
- package/dist/resources/multi-worker-guard.js +121 -0
- package/dist/resources/oauth-discovery.js +1 -0
- package/dist/resources/oauth-wellknown.js +8 -4
- package/dist/resources/originator-instance.js +235 -0
- package/dist/resources/promotion-stamp.js +2 -0
- package/dist/resources/provenance.js +111 -11
- package/dist/resources/record-owner-guard.js +19 -0
- package/dist/resources/record-type-kit.js +9 -12
- package/dist/resources/record-types.js +22 -6
- package/dist/resources/relay-ops.js +28 -3
- package/dist/resources/replay-store.js +336 -0
- package/dist/resources/request-transaction.js +78 -0
- package/dist/resources/search-readiness.js +19 -21
- package/dist/resources/semantic-retrieval-core.js +5 -1
- package/dist/resources/skill-manifest.js +181 -0
- package/dist/resources/skill-provenance.js +15 -10
- package/dist/resources/table-patch-policy.js +109 -0
- package/dist/resources/table-patches.js +17 -0
- package/dist/resources/table-post-policy.js +138 -0
- package/dist/resources/table-posts.js +22 -0
- package/dist/resources/table-subscription-policy.js +135 -0
- package/dist/resources/table-subscriptions.js +19 -0
- package/dist/resources/tool-descriptors/index.js +15 -15
- package/dist/resources/trust-block.js +10 -3
- package/dist/resources/usage-recording.js +169 -41
- package/dist/src/lib/flair-agent-role.js +116 -0
- package/dist/src/lib/memory-attributes.js +77 -0
- package/docs/access-control.md +667 -0
- package/docs/api-reference.md +85 -17
- package/docs/auth.md +4 -0
- package/docs/claude-code.md +132 -0
- package/docs/deepseek-harness.md +1 -1
- package/docs/deployment.md +1 -1
- package/docs/federation.md +1 -1
- package/docs/integrations.md +6 -6
- package/docs/mcp-clients.md +16 -24
- package/docs/notes/mcp-oauth-model2.md +15 -1
- package/docs/quickstart.md +5 -0
- package/docs/releasing.md +152 -20
- package/docs/supply-chain-policy.md +10 -5
- package/docs/troubleshooting.md +11 -0
- package/docs/upgrade.md +187 -61
- package/package.json +10 -5
- package/schemas/agent.graphql +9 -6
- package/schemas/federation.graphql +2 -11
- package/schemas/memory.graphql +137 -17
- package/schemas/oauth.graphql +8 -4
- package/schemas/replay.graphql +18 -0
- package/templates/launchd/start-flair-with-admin-pass.sh +95 -0
- package/dist/resources/federation-nonce-store.js +0 -195
|
@@ -43,7 +43,36 @@
|
|
|
43
43
|
* so the executor only writes when the planner says it is proven.
|
|
44
44
|
*/
|
|
45
45
|
import { resolve } from "node:path";
|
|
46
|
+
import { verifyLaunchdManagement } from "./launchd-management.js";
|
|
47
|
+
import { healthIndicatesListener } from "./daemon-liveness.js";
|
|
46
48
|
import { preserveHttpPortValue, preserveSecurePort } from "./http-bind.js";
|
|
49
|
+
import { renderDomainUnavailableMessage, } from "./launchd-domain-preflight.js";
|
|
50
|
+
// ─── launchd preflight gate (flair#2040) ──────────────────────────────────
|
|
51
|
+
/**
|
|
52
|
+
* The `doctor --fix` refusal when this instance's launchd job cannot be loaded
|
|
53
|
+
* from this session — a PURE gate the executor runs BEFORE it stops, unloads or
|
|
54
|
+
* writes anything (flair#2040).
|
|
55
|
+
*
|
|
56
|
+
* Returns null when the preflight allows an attempt (`available`, or
|
|
57
|
+
* `not-applicable` off macOS), so the executor proceeds. Returns a `refused`
|
|
58
|
+
* result — doctor reports an ISSUE, never "fixed", and exits non-zero — when
|
|
59
|
+
* the GUI domain is `unavailable` or `unknown` (fail closed: a probe we could
|
|
60
|
+
* not interpret must not license stopping a healthy instance), or when the
|
|
61
|
+
* job's label is `disabled` in that domain (launchd would refuse the load).
|
|
62
|
+
*
|
|
63
|
+
* The refusal carries actor + state + remedy in its `detail` (a refusal is a
|
|
64
|
+
* verdict, not a failure, so there is no structured remedy), and says that
|
|
65
|
+
* nothing was touched.
|
|
66
|
+
*/
|
|
67
|
+
export function domainPreflightRefusal(loadability, uid) {
|
|
68
|
+
if (loadability.state === "available" || loadability.state === "not-applicable")
|
|
69
|
+
return null;
|
|
70
|
+
return {
|
|
71
|
+
kind: "refused",
|
|
72
|
+
reason: loadability.state === "disabled" ? "launchd-job-disabled" : "launchd-domain-unavailable",
|
|
73
|
+
detail: renderDomainUnavailableMessage(loadability, uid),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
47
76
|
/**
|
|
48
77
|
* Classify the plist at `plistPath` against `dataDir`.
|
|
49
78
|
*
|
|
@@ -104,6 +133,19 @@ export function planLaunchdRepair(input) {
|
|
|
104
133
|
if (observation.state === "managed") {
|
|
105
134
|
return { kind: "no-op", reason: "already-managed", detail: observation.detail };
|
|
106
135
|
}
|
|
136
|
+
// flair#2040: launchd runs the job, but the process serving this instance
|
|
137
|
+
// could not be identified. Regenerating would boot out a job that may be the
|
|
138
|
+
// one serving; adopting has no direct process to stop. Unknown evidence
|
|
139
|
+
// licenses neither: refuse, touching nothing.
|
|
140
|
+
if (observation.state === "unverified") {
|
|
141
|
+
return {
|
|
142
|
+
kind: "refuse",
|
|
143
|
+
reason: "unverifiable",
|
|
144
|
+
detail: `cannot repair launchd management: ${observation.detail}. Nothing was touched. ` +
|
|
145
|
+
"Restart Flair ('flair restart') so it rewrites its hdb.pid, or make lsof available, then re-run 'flair doctor'.",
|
|
146
|
+
plistPath,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
107
149
|
// Config authority (flair#914): no readable harper-config.yaml means no safe
|
|
108
150
|
// ROOTPATH/ports, so the repair cannot proceed without inventing them.
|
|
109
151
|
if (!configReadable) {
|
|
@@ -427,3 +469,56 @@ export async function decideAdoptStopWithWait(state, opts) {
|
|
|
427
469
|
}
|
|
428
470
|
return { health: poll.value, decision, timedOut: poll.timedOut, waitedMs: poll.waitedMs, observations: poll.observations };
|
|
429
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Still starting: launchd runs the job (it reported a pid) and nothing answers
|
|
474
|
+
* HTTP on the port yet (`refused`, or a probe that could not tell:
|
|
475
|
+
* `unreachable`) — whatever the management state says, because a pid file can
|
|
476
|
+
* name launchd's pid before the port is bound. Every other observation is
|
|
477
|
+
* final: launchd reports no pid (detached), or something answers the port
|
|
478
|
+
* (then the strict verifier and the health result decide, at once).
|
|
479
|
+
*/
|
|
480
|
+
export function launchdJobStillStarting(o) {
|
|
481
|
+
return typeof o.management.launchdPid === "number" && !healthIndicatesListener(o.health);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Poll `observe` while the job is still starting (launchdJobStillStarting), up
|
|
485
|
+
* to `deadlineMs`, and return the final observation. It decides nothing: the
|
|
486
|
+
* caller judges what this returns with judgeLaunchdJobServing (health `ok` and
|
|
487
|
+
* the strict verifier UNCHANGED), so a job that never serves still fails — at
|
|
488
|
+
* the deadline, with the wait named.
|
|
489
|
+
*/
|
|
490
|
+
export async function awaitLaunchdJobServing(opts) {
|
|
491
|
+
const poll = await pollUntil({
|
|
492
|
+
observe: opts.observe,
|
|
493
|
+
until: (o) => !launchdJobStillStarting(o),
|
|
494
|
+
deadlineMs: opts.deadlineMs,
|
|
495
|
+
intervalMs: opts.intervalMs,
|
|
496
|
+
now: opts.now,
|
|
497
|
+
sleep: opts.sleep,
|
|
498
|
+
});
|
|
499
|
+
const detail = poll.timedOut
|
|
500
|
+
? `${poll.value.management.detail} (waited ${poll.waitedMs}ms for the launchd job to start serving; its port still did not answer: ${poll.value.health.kind})`
|
|
501
|
+
: poll.value.management.detail;
|
|
502
|
+
return { observation: poll.value, detail, timedOut: poll.timedOut, waitedMs: poll.waitedMs, observations: poll.observations };
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* The success test for the job just loaded (flair#2040): Flair's /Health
|
|
506
|
+
* answers `ok` on the instance's port AND the strict verifier passes on the
|
|
507
|
+
* same observation (launchd's pid is the identified serving pid). A matching
|
|
508
|
+
* pid with a port that does not serve Flair is NOT repaired — a pid file can be
|
|
509
|
+
* written before the port is bound, and one that never binds is not serving.
|
|
510
|
+
*/
|
|
511
|
+
export function judgeLaunchdJobServing(w) {
|
|
512
|
+
const verdict = verifyLaunchdManagement(w.observation.management);
|
|
513
|
+
if (!verdict.verified)
|
|
514
|
+
return { verified: false, detail: w.detail };
|
|
515
|
+
if (w.observation.health.kind !== "ok") {
|
|
516
|
+
const waited = w.timedOut ? ` after waiting ${w.waitedMs}ms for it to start serving` : "";
|
|
517
|
+
return {
|
|
518
|
+
verified: false,
|
|
519
|
+
detail: `${verdict.detail}, but Flair's /Health on its port did not answer ok${waited} ` +
|
|
520
|
+
`(last health probe: ${w.observation.health.kind}), so the job is NOT serving this instance`,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
return verdict;
|
|
524
|
+
}
|