@tpsdev-ai/flair 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/SECURITY.md +18 -10
- package/config.yaml +11 -11
- package/dist/bridges/runtime/execute.js +1 -0
- package/dist/bridges/types.js +1 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +66 -122
- package/dist/commands/agent.js +27 -65
- package/dist/commands/backup-approval.js +218 -0
- package/dist/commands/backup.js +37 -33
- package/dist/commands/bootstrap.js +3 -1
- package/dist/commands/deploy.js +37 -7
- package/dist/commands/doctor.js +119 -0
- package/dist/commands/export.js +3 -4
- package/dist/commands/federation.js +653 -68
- package/dist/commands/grant.js +5 -6
- package/dist/commands/help.js +25 -0
- package/dist/commands/idp.js +14 -19
- package/dist/commands/import.js +131 -19
- package/dist/commands/init.js +7 -7
- package/dist/commands/integrity.js +5 -6
- package/dist/commands/mcp.js +11 -17
- package/dist/commands/memory.js +33 -15
- package/dist/commands/orgevent.js +5 -10
- package/dist/commands/principal.js +13 -25
- package/dist/commands/quality.js +3 -0
- package/dist/commands/rem.js +484 -65
- package/dist/commands/restore.js +352 -44
- package/dist/commands/service.js +84 -2
- package/dist/commands/soul.js +0 -6
- package/dist/commands/status.js +51 -33
- package/dist/commands/test.js +4 -1
- package/dist/commands/upgrade.js +53 -22
- package/dist/commands/workspace.js +7 -8
- package/dist/deploy.js +59 -3
- package/dist/doctor-client.js +7 -2
- package/dist/fabric-upgrade.js +12 -2
- package/dist/federation/presence-send.js +139 -0
- package/dist/federation-verify.js +269 -177
- package/dist/install/clients.js +171 -35
- package/dist/lib/agent-id-rule.js +44 -2
- package/dist/lib/atomic-write.js +1 -1
- package/dist/lib/auth-resolve.js +1028 -52
- package/dist/lib/backup-approval-store.js +612 -0
- package/dist/lib/backup-artifact.js +343 -0
- package/dist/lib/config-critical-section.js +212 -25
- package/dist/lib/connect-phase.js +33 -0
- package/dist/lib/daemon-liveness.js +2 -1
- package/dist/lib/federation-pair-access.js +4 -0
- package/dist/lib/federation-retry-queue.js +283 -0
- package/dist/lib/federation-retry-row.js +101 -0
- package/dist/lib/instruction-event-contract.js +17 -0
- package/dist/lib/instruction-event-doctor.js +102 -0
- package/dist/lib/launchd-management.js +14 -3
- package/dist/lib/mcp-enable.js +14 -15
- package/dist/lib/memory-attributes.js +2 -0
- package/dist/lib/memory-provider-timeout.js +33 -0
- package/dist/lib/mqtt-config.js +132 -0
- package/dist/lib/mqtt-listener-doctor.js +104 -0
- package/dist/lib/open-live-row.js +20 -0
- package/dist/lib/ops-url.js +52 -0
- package/dist/lib/promotion-content-hash.js +20 -0
- package/dist/lib/restore-archive.js +760 -0
- package/dist/lib/restore-verify.js +1 -1
- package/dist/lib/skill-assignment-preflight.js +159 -0
- package/dist/lib/skill-seed.js +91 -8
- package/dist/lib/skill-tombstone-doctor.js +133 -0
- package/dist/lib/soul-scope-fields.js +26 -0
- package/dist/lib/uninstall-purge.js +266 -11
- package/dist/lib/upgrade-prior-liveness.js +2 -1
- package/dist/mcp-client-assertion.js +2 -10
- package/dist/memory-id-checkpoint.js +28 -7
- package/dist/mqtt-off-deploy.js +550 -0
- package/dist/rem/promote-policy.js +3 -3
- package/dist/rem/restore.js +302 -26
- package/dist/rem/runner.js +220 -58
- package/dist/rem/scheduler.js +21 -4
- package/dist/resources/A2AAdapter.js +131 -178
- package/dist/resources/AdminMemory.js +2 -0
- package/dist/resources/AdminMemoryCandidates.js +116 -0
- package/dist/resources/Agent.js +155 -45
- package/dist/resources/AgentCard.js +4 -0
- package/dist/resources/AgentKeyRegister.js +56 -22
- package/dist/resources/AgentReadPosition.js +7 -0
- package/dist/resources/AgentSeed.js +232 -107
- package/dist/resources/AutoPromoteCandidates.js +413 -84
- package/dist/resources/Credential.js +6 -8
- package/dist/resources/Federation.js +219 -57
- package/dist/resources/FederationRetry.js +4 -4
- package/dist/resources/InstructionVersion.js +1 -1
- package/dist/resources/MCPClientMetadata.js +6 -3
- package/dist/resources/Memory.js +1303 -270
- package/dist/resources/MemoryArchive.js +149 -64
- package/dist/resources/MemoryBootstrap.js +12 -22
- package/dist/resources/MemoryCandidate.js +16 -2
- package/dist/resources/MemoryConsolidate.js +2 -2
- package/dist/resources/MemoryFeed.js +360 -147
- package/dist/resources/MemoryMaintenance.js +290 -72
- package/dist/resources/MemoryPurge.js +138 -22
- package/dist/resources/MemoryReflect.js +68 -14
- package/dist/resources/MemoryReindex.js +91 -13
- package/dist/resources/Message.js +11 -2
- package/dist/resources/OAuth.js +156 -39
- package/dist/resources/OAuthClient.js +1 -1
- package/dist/resources/OrgEvent.js +292 -29
- package/dist/resources/OrgEventCatchup.js +7 -0
- package/dist/resources/OrgEventMaintenance.js +48 -10
- package/dist/resources/PairingToken.js +1 -1
- package/dist/resources/Presence.js +31 -11
- package/dist/resources/PromoteMemoryCandidate.js +8 -2
- package/dist/resources/RecordUsage.js +2 -4
- package/dist/resources/Soul.js +2 -0
- package/dist/resources/SoulFeed.js +2 -1
- package/dist/resources/WorkspaceLatest.js +4 -0
- package/dist/resources/XAA.js +36 -10
- package/dist/resources/a2a-stream.js +313 -0
- package/dist/resources/a2a-url.js +4 -5
- package/dist/resources/agent-admin.js +10 -1
- package/dist/resources/agent-auth.js +98 -68
- package/dist/resources/agent-read-position-lib.js +4 -1
- package/dist/resources/agent-status-guard.js +9 -7
- package/dist/resources/auth-middleware.js +166 -42
- package/dist/resources/authority-field-guard.js +9 -11
- package/dist/resources/auto-promote-lib.js +8 -5
- package/dist/resources/basic-auth-header.js +21 -0
- package/dist/resources/bm25-index-service.js +4 -5
- package/dist/resources/dedup-cluster.js +6 -1
- package/dist/resources/embeddings-provider.js +25 -0
- package/dist/resources/federation-classify.js +89 -0
- package/dist/resources/federation-retry-lib.js +6 -81
- package/dist/resources/health.js +43 -4
- package/dist/resources/host-pointer/registry.js +29 -0
- package/dist/resources/host-pointer-adapter.js +1 -0
- package/dist/resources/in-process.js +24 -22
- package/dist/resources/instruction-version-record.js +251 -7
- package/dist/resources/internal-authority.js +13 -0
- package/dist/resources/mcp-handler.js +106 -12
- package/dist/resources/mcp-oauth-flag.js +12 -14
- package/dist/resources/mcp-oauth.js +430 -53
- package/dist/resources/mcp-tools.js +60 -22
- package/dist/resources/memory-declared-attributes.js +1 -0
- package/dist/resources/memory-embed-hash.js +56 -0
- package/dist/resources/memory-host-source.js +5 -2
- package/dist/resources/memory-reflect-lib.js +1 -1
- package/dist/resources/memory-write-lock.js +202 -23
- package/dist/resources/memory-write-response.js +1 -1
- package/dist/resources/memory-write-transaction.js +243 -0
- package/dist/resources/migration-boot.js +17 -12
- package/dist/resources/migrations/boot-progress.js +25 -0
- package/dist/resources/migrations/data-dir.js +16 -3
- package/dist/resources/migrations/dir-safety.js +60 -2
- package/dist/resources/migrations/embedding-stamp.js +315 -49
- package/dist/resources/migrations/graph-heal.js +9 -2
- package/dist/resources/migrations/ledger.js +5 -2
- package/dist/resources/migrations/lock.js +867 -80
- package/dist/resources/migrations/progress.js +71 -10
- package/dist/resources/migrations/runner.js +212 -18
- package/dist/resources/migrations/state.js +36 -1
- package/dist/resources/migrations/status.js +2 -13
- package/dist/resources/migrations/synthetic-test-migration.js +78 -12
- package/dist/resources/migrations/types.js +26 -1
- package/dist/resources/migrations/visibility-backfill.js +111 -70
- package/dist/resources/oauth-discovery.js +0 -5
- package/dist/resources/object-body-guard.js +12 -5
- package/dist/resources/org-event-reserved.js +92 -0
- package/dist/resources/org-event-write-fault.js +19 -0
- package/dist/resources/owner-field-guard.js +1 -1
- package/dist/resources/owner-scoped-write-policy.js +65 -21
- package/dist/resources/owner-scoped-writes.js +37 -6
- package/dist/resources/path-id-rewrite.js +76 -0
- package/dist/resources/presence-internal.js +5 -5
- package/dist/resources/promotion-binding.js +43 -0
- package/dist/resources/promotion-stamp.js +124 -33
- package/dist/resources/protocol-context.js +189 -0
- package/dist/resources/record-type-kit.js +2 -4
- package/dist/resources/request-target.js +28 -1
- package/dist/resources/request-transaction.js +11 -1
- package/dist/resources/seed-reservation.js +1 -2
- package/dist/resources/semantic-retrieval-core.js +7 -6
- package/dist/resources/server-row-validation.js +71 -0
- package/dist/resources/skill-manifest.js +4 -3
- package/dist/resources/skill-version-write.js +384 -27
- package/dist/resources/skill-write-fault.js +6 -3
- package/dist/resources/skill-write-policy.js +2 -1
- package/dist/resources/soul-write-policy.js +26 -7
- package/dist/resources/table-helpers.js +1 -1
- package/dist/resources/table-subscription-policy.js +518 -85
- package/dist/resources/table-subscriptions.js +20 -7
- package/dist/resources/txn-pause-point.js +122 -5
- package/dist/resources/usage-recording.js +54 -46
- package/dist/resources/write-back.js +176 -11
- package/dist/resources/write-journal-context.js +5 -0
- package/dist/resources/write-journal.js +289 -0
- package/dist/src/lib/agent-id-rule.js +44 -2
- package/dist/src/lib/atomic-write.js +1 -1
- package/dist/src/lib/federation-retry-row.js +101 -0
- package/dist/src/lib/instruction-event-contract.js +17 -0
- package/dist/src/lib/memory-attributes.js +2 -0
- package/dist/src/lib/open-live-row.js +20 -0
- package/dist/src/lib/soul-scope-fields.js +26 -0
- package/dist/src/rem/promote-policy.js +3 -3
- package/dist/src/rem/scheduler.js +21 -4
- package/docs/access-control.md +18 -9
- package/docs/api-reference.md +126 -28
- package/docs/auth.md +40 -18
- package/docs/claude-code.md +3 -3
- package/docs/deploying-on-fabric.md +108 -0
- package/docs/deployment.md +17 -0
- package/docs/embedding-in-a-harper-app.md +16 -14
- package/docs/entity-vocabulary.md +3 -6
- package/docs/federation.md +29 -2
- package/docs/integrations.md +11 -11
- package/docs/mcp-clients.md +7 -5
- package/docs/notes/mcp-agent-auth-consumer.md +4 -9
- package/docs/notes/mcp-oauth-model2.md +6 -6
- package/docs/openclaw.md +1 -1
- package/docs/quickstart-fabric.md +2 -2
- package/docs/quickstart.md +3 -3
- package/docs/releasing.md +13 -13
- package/docs/rem.md +24 -3
- package/docs/secrets-and-keys.md +2 -2
- package/docs/standalone-local.md +29 -2
- package/docs/supply-chain-policy.md +28 -20
- package/docs/the-team.md +2 -2
- package/docs/upgrade.md +14 -0
- package/package.json +18 -11
- package/schemas/agent.graphql +3 -3
- package/schemas/federation.graphql +10 -7
- package/schemas/memory.graphql +7 -2
- package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
- package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
- package/dist/resources/soul-adk-guard.js +0 -68
package/dist/commands/deploy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildTargetUrl as buildDeployUrl, deploy as deployToFabric, validateOptions as validateDeployOptions } from "../deploy.js";
|
|
2
2
|
import { renderFleetSweepTable, sweepFleet } from "../fleet-verify.js";
|
|
3
3
|
import { readCheckpointFile, verifyCheckpoint } from "../memory-id-checkpoint.js";
|
|
4
|
+
import { deployUrlRefusal, safeUrl } from "../mqtt-off-deploy.js";
|
|
4
5
|
let cli;
|
|
5
6
|
/** Bind the cli-locals this module depends on. */
|
|
6
7
|
export function bindCli(fns) {
|
|
@@ -19,13 +20,17 @@ function shouldRunFleetVerify(...args) {
|
|
|
19
20
|
function shellSingleQuote(value) {
|
|
20
21
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Print the same next steps after a successful deploy and in the CLI example
|
|
25
|
+
* test. The target is printed through safeUrl (scheme, host, port and path
|
|
26
|
+
* only), then shell-quoted.
|
|
27
|
+
*/
|
|
23
28
|
export function printDeployNextSteps(url) {
|
|
24
29
|
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
25
30
|
console.log(`\nNext steps:`);
|
|
26
31
|
console.log(dim(` 1. Set an admin password in Fabric Studio (Cluster Settings → Admin)`));
|
|
27
32
|
console.log(dim(` 2. Save that password in an owner-only file (chmod 600), then seed your first agent:`));
|
|
28
|
-
console.log(` flair agent add my-agent --target ${shellSingleQuote(url)} --admin-pass-file /path/to/admin-password`);
|
|
33
|
+
console.log(` flair agent add my-agent --target ${shellSingleQuote(safeUrl(url))} --admin-pass-file /path/to/admin-password`);
|
|
29
34
|
}
|
|
30
35
|
export function register(program) {
|
|
31
36
|
// ─── flair deploy ─────────────────────────────────────────────────────────────
|
|
@@ -50,6 +55,7 @@ export function register(program) {
|
|
|
50
55
|
.option("--pkg-version <semver>", "Override version label (default: installed package version)")
|
|
51
56
|
.option("--no-replicated", "Disable cluster-wide replication (default: replicated=true)")
|
|
52
57
|
.option("--no-restart", "Do not restart the component after deploy (default: restart=true)")
|
|
58
|
+
.option("--keep-mqtt-config", "Leave the target's MQTT configuration as it is (default: set every MQTT listener off in the target's configuration before deploying, then, after the deploy's restart, request the shared workers' restart for an isolated application and read the saved configuration back; --no-restart and --no-verify skip those two; the listeners are not probed)")
|
|
53
59
|
.option("--dry-run", "Resolve package, validate args, skip the deploy call")
|
|
54
60
|
.option("--package-root <dir>", "Override package root (mainly for testing)")
|
|
55
61
|
.option("--deployment-timeout <ms>", "Milliseconds harper waits for cluster-wide peer replication (env: FABRIC_DEPLOYMENT_TIMEOUT; default: 600000 — harper's own 120s default is too short for Fabric)")
|
|
@@ -57,7 +63,7 @@ export function register(program) {
|
|
|
57
63
|
.option("--no-verify", "Skip post-deploy served-API verification (default: verify — on by design, so the CLI can't report success on an empty/broken deploy)")
|
|
58
64
|
.option("--verify-timeout <ms>", "Milliseconds to wait for the served API to settle after harper's post-deploy restart before verifying (default: 300000)")
|
|
59
65
|
.option("--verify-resource <name>", "Resource to verify is serving after deploy (repeatable; default: derived from the deployed package's dist/resources)", (val, prev) => [...prev, val], [])
|
|
60
|
-
.option("--ops-target <url>", "Operations API URL override for the Memory checkpoint report (env: FLAIR_OPS_TARGET)")
|
|
66
|
+
.option("--ops-target <url>", "Operations API URL override for the MQTT-off configuration, restart and read-back and the Memory checkpoint report (env: FLAIR_OPS_TARGET)")
|
|
61
67
|
.option("--memory-checkpoint <path>", "After deploy, verify this instance's Memory ids against a `flair memory checkpoint` file and add a Memory id/tier check line to the report")
|
|
62
68
|
.option("--deploy-retries <n>", "Retry the full harper deploy this many times, ONLY when peer replication is positively observed not to converge (default: 0 — retrying re-runs harper's component install and can escalate a transient replication warning into a hard ENOTEMPTY install failure; see flair#878)", "0")
|
|
63
69
|
.option("--ignore-replication-errors", "If peer replication still hasn't converged, treat it as a non-fatal warning and succeed with an origin-only deploy (the peer catches up via federation sync or a later deploy)")
|
|
@@ -69,6 +75,24 @@ export function register(program) {
|
|
|
69
75
|
const red = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
70
76
|
const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
71
77
|
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
78
|
+
// Every URL the deploy takes is checked before anything is printed: it
|
|
79
|
+
// needs an allowed scheme and a host, and a user name, password, query or
|
|
80
|
+
// fragment is refused (src/mqtt-off-deploy.ts). An operations API URL
|
|
81
|
+
// derived from a target that passes keeps its scheme, host and path with
|
|
82
|
+
// the operations port (deploy() checks it again).
|
|
83
|
+
{
|
|
84
|
+
const fabricOrg = opts.fabricOrg ?? process.env.FABRIC_ORG;
|
|
85
|
+
const fabricCluster = opts.fabricCluster ?? process.env.FABRIC_CLUSTER;
|
|
86
|
+
const earlyTarget = opts.target ?? (fabricOrg && fabricCluster ? buildDeployUrl({ fabricOrg, fabricCluster }) : undefined);
|
|
87
|
+
const refusal = deployUrlRefusal([
|
|
88
|
+
[earlyTarget, "deploy target URL (--target)"],
|
|
89
|
+
[opts.opsTarget || process.env.FLAIR_OPS_TARGET, "operations API URL (--ops-target / FLAIR_OPS_TARGET)"],
|
|
90
|
+
]);
|
|
91
|
+
if (refusal) {
|
|
92
|
+
console.error(red(refusal));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
72
96
|
let fabricUser;
|
|
73
97
|
let fabricPassword;
|
|
74
98
|
let credWarnings = [];
|
|
@@ -90,6 +114,7 @@ export function register(program) {
|
|
|
90
114
|
version: opts.pkgVersion,
|
|
91
115
|
replicated: opts.replicated !== false,
|
|
92
116
|
restart: opts.restart !== false,
|
|
117
|
+
keepMqttConfig: opts.keepMqttConfig ?? false,
|
|
93
118
|
dryRun: opts.dryRun ?? false,
|
|
94
119
|
packageRoot: opts.packageRoot,
|
|
95
120
|
deploymentTimeoutMs: Number(opts.deploymentTimeout ?? process.env.FABRIC_DEPLOYMENT_TIMEOUT ?? 600_000),
|
|
@@ -115,13 +140,18 @@ export function register(program) {
|
|
|
115
140
|
for (const w of credWarnings)
|
|
116
141
|
console.error(dim(w));
|
|
117
142
|
const url = buildDeployUrl(deployOpts);
|
|
118
|
-
console.log(`${green("→")} Deploying ${deployOpts.project} to ${url}`);
|
|
143
|
+
console.log(`${green("→")} Deploying ${deployOpts.project} to ${safeUrl(url)}`);
|
|
119
144
|
if (deployOpts.dryRun)
|
|
120
145
|
console.log(dim(" (dry-run: skipping API call)"));
|
|
121
146
|
try {
|
|
122
|
-
const result = await deployToFabric(
|
|
147
|
+
const result = await deployToFabric({
|
|
148
|
+
...deployOpts,
|
|
149
|
+
// The target's operations API, resolved as for every remote command
|
|
150
|
+
// (--ops-target / FLAIR_OPS_TARGET, else derived from the target).
|
|
151
|
+
opsUrl: cli.resolveEffectiveOpsUrl({ target: url, opsTarget: opts.opsTarget }),
|
|
152
|
+
});
|
|
123
153
|
if (result.dryRun) {
|
|
124
|
-
console.log(`${green("✓")} dry-run OK: ${result.project} ${result.version} ready to deploy to ${result.url}`);
|
|
154
|
+
console.log(`${green("✓")} dry-run OK: ${result.project} ${result.version} ready to deploy to ${safeUrl(result.url)}`);
|
|
125
155
|
console.log(dim(` package root: ${result.packageRoot}`));
|
|
126
156
|
return;
|
|
127
157
|
}
|
|
@@ -136,7 +166,7 @@ export function register(program) {
|
|
|
136
166
|
else {
|
|
137
167
|
console.log(`\n${green("✓")} Flair ${result.version} deployed${deployOpts.verify ? " and verified serving" : ""}`);
|
|
138
168
|
}
|
|
139
|
-
console.log(`\n URL: ${result.url}`);
|
|
169
|
+
console.log(`\n URL: ${safeUrl(result.url)}`);
|
|
140
170
|
console.log(` Project: ${result.project}`);
|
|
141
171
|
if (opts.memoryCheckpoint) {
|
|
142
172
|
const read = readCheckpointFile(opts.memoryCheckpoint);
|
package/dist/commands/doctor.js
CHANGED
|
@@ -10,6 +10,9 @@ import { buildEd25519Auth, defaultAdminPassPath, defaultKeysDir, requestTarget,
|
|
|
10
10
|
import { proveLocalHarperListener } from "../lib/local-instance-pair.js";
|
|
11
11
|
import { AGENT_ID_RULE } from "../lib/agent-id-rule.js";
|
|
12
12
|
import { agentHomeEndpoint, readAgentHomeRows, resolveTargetInstanceIdentity } from "../lib/agent-home.js";
|
|
13
|
+
import { describeInstructionEventImpostors, readInstructionEventTables } from "../lib/instruction-event-doctor.js";
|
|
14
|
+
import { describeLiveSkillTombstones, readSkillTombstoneTables } from "../lib/skill-tombstone-doctor.js";
|
|
15
|
+
import { MQTT_CONFIGURATION_NOTE, mqttListenerSection, readInstanceConfiguration } from "../lib/mqtt-listener-doctor.js";
|
|
13
16
|
import { readAgentRoster } from "../lib/agent-roster.js";
|
|
14
17
|
import { flairConfigYamlCandidates, readPortFromYamlFile, resolveFlairConfigYaml } from "../lib/doctor-config-path.js";
|
|
15
18
|
import { collectFederationEnv, describeFederationDriverFinding, federationPeersConfigured, loadYamlDoc } from "../lib/doctor-federation-driver.js";
|
|
@@ -2362,6 +2365,122 @@ export function register(program) {
|
|
|
2362
2365
|
}
|
|
2363
2366
|
}
|
|
2364
2367
|
}
|
|
2368
|
+
// 8d. Instruction events (flair#2139 slice 3a) — name every stored
|
|
2369
|
+
// OrgEvent that carries a reserved kind or the reserved id prefix but
|
|
2370
|
+
// does not satisfy the reader rule. Read-only: nothing is rewritten.
|
|
2371
|
+
console.log(`\n ${render.wrap(render.c.bold, "Instruction events")}`);
|
|
2372
|
+
if (rosterNotRun) {
|
|
2373
|
+
issues++;
|
|
2374
|
+
console.log(` ${render.icons.warn} Instruction events: NOT RUN — ${rosterNotRun.reason}`);
|
|
2375
|
+
console.log(` ${render.wrap(render.c.dim, "Fix:")} ${rosterNotRun.remedy}`);
|
|
2376
|
+
}
|
|
2377
|
+
else if (!rosterAdminPass || rosterOpsPort === null) {
|
|
2378
|
+
console.log(` ${render.icons.info} Instruction-event check skipped (no admin credential or unverified ops endpoint).`);
|
|
2379
|
+
}
|
|
2380
|
+
else {
|
|
2381
|
+
const instructionAuth = `Basic ${Buffer.from(`${resolveAdminUser()}:${rosterAdminPass}`).toString("base64")}`;
|
|
2382
|
+
const tables = await readInstructionEventTables({
|
|
2383
|
+
opsUrl: `http://127.0.0.1:${rosterOpsPort}/`,
|
|
2384
|
+
authHeader: instructionAuth,
|
|
2385
|
+
timeoutMs: 5000,
|
|
2386
|
+
});
|
|
2387
|
+
if (tables === null) {
|
|
2388
|
+
issues++;
|
|
2389
|
+
console.log(` ${render.icons.warn} Could not read the stored OrgEvent and InstructionVersion tables, so the instruction-event check did not run.`);
|
|
2390
|
+
}
|
|
2391
|
+
else {
|
|
2392
|
+
const finding = describeInstructionEventImpostors(tables.events, tables.versions);
|
|
2393
|
+
if (!finding) {
|
|
2394
|
+
console.log(` ${render.icons.ok} No stored OrgEvent with a reserved kind or id fails the instruction-event reader rule.`);
|
|
2395
|
+
}
|
|
2396
|
+
else {
|
|
2397
|
+
issues++;
|
|
2398
|
+
console.log(` ${render.icons.warn} ${finding}`);
|
|
2399
|
+
console.log(` ${render.wrap(render.c.dim, "Fix:")} confirm it is not a genuine instruction event, then delete the row through the operations API.`);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
// 8e. Skill tombstones (flair#2662) — for each skill subject whose
|
|
2404
|
+
// newest InstructionVersion is a `delete` tombstone, report the subject
|
|
2405
|
+
// when its Memory row is still open-live (the skill writer's predicate:
|
|
2406
|
+
// not archived, not expired, no validTo). Read-only: nothing is
|
|
2407
|
+
// rewritten. A table read that fails while this section runs is NOT RUN
|
|
2408
|
+
// and counted; when Harper is not responding, the enclosing gate skips
|
|
2409
|
+
// the section and doctor counts the server problem elsewhere.
|
|
2410
|
+
console.log(`\n ${render.wrap(render.c.bold, "Skill tombstones")}`);
|
|
2411
|
+
if (rosterNotRun) {
|
|
2412
|
+
issues++;
|
|
2413
|
+
console.log(` ${render.icons.warn} Skill tombstones: NOT RUN — ${rosterNotRun.reason}`);
|
|
2414
|
+
console.log(` ${render.wrap(render.c.dim, "Fix:")} ${rosterNotRun.remedy}`);
|
|
2415
|
+
}
|
|
2416
|
+
else if (!rosterAdminPass || rosterOpsPort === null) {
|
|
2417
|
+
issues++;
|
|
2418
|
+
const reason = rosterProbe.credIssue
|
|
2419
|
+
? `the admin credential could not be resolved (${rosterProbe.credIssue})`
|
|
2420
|
+
: rosterAdminPass ? "the ops endpoint was not verified" : "no admin credentials to read the stored tables";
|
|
2421
|
+
console.log(` ${render.icons.warn} Skill tombstones: NOT RUN — ${reason}.`);
|
|
2422
|
+
}
|
|
2423
|
+
else {
|
|
2424
|
+
const tombstoneAuth = `Basic ${Buffer.from(`${resolveAdminUser()}:${rosterAdminPass}`).toString("base64")}`;
|
|
2425
|
+
const tables = await readSkillTombstoneTables({
|
|
2426
|
+
opsUrl: `http://127.0.0.1:${rosterOpsPort}/`,
|
|
2427
|
+
authHeader: tombstoneAuth,
|
|
2428
|
+
timeoutMs: 5000,
|
|
2429
|
+
});
|
|
2430
|
+
if (tables === null) {
|
|
2431
|
+
issues++;
|
|
2432
|
+
console.log(` ${render.icons.warn} Could not read the stored InstructionVersion and Memory tables, so the skill-tombstone check did not run.`);
|
|
2433
|
+
}
|
|
2434
|
+
else {
|
|
2435
|
+
const finding = describeLiveSkillTombstones(tables.versions, tables.memories);
|
|
2436
|
+
if (!finding) {
|
|
2437
|
+
console.log(` ${render.icons.ok} No delete tombstone is the newest version of a skill with an open-live Memory row (not archived, not expired, no validTo).`);
|
|
2438
|
+
}
|
|
2439
|
+
else {
|
|
2440
|
+
issues++;
|
|
2441
|
+
console.log(` ${render.icons.warn} ${finding}`);
|
|
2442
|
+
console.log(` ${render.wrap(render.c.dim, "Report only:")} this check does not modify the store.`);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
// 8f. MQTT listeners — report when the instance's root configuration
|
|
2447
|
+
// starts an MQTT listener (TCP, TLS or the WebSocket path). Flair runs
|
|
2448
|
+
// Harper with MQTT off; the read is the instance's own configuration,
|
|
2449
|
+
// through the same verified ops endpoint and admin credential as the
|
|
2450
|
+
// sections above. Read-only: nothing is changed. A configuration read
|
|
2451
|
+
// that fails, or an answer that is not a recognizable root
|
|
2452
|
+
// configuration (`{}` included), is NOT RUN and counted. It reports the
|
|
2453
|
+
// saved configuration, not the running listeners, and prints that note
|
|
2454
|
+
// on every path below, the two NOT RUN paths included.
|
|
2455
|
+
console.log(`\n ${render.wrap(render.c.bold, "MQTT listeners (configuration)")}`);
|
|
2456
|
+
if (rosterNotRun) {
|
|
2457
|
+
issues++;
|
|
2458
|
+
console.log(` ${render.icons.warn} MQTT listeners: NOT RUN — ${rosterNotRun.reason}`);
|
|
2459
|
+
console.log(` ${render.wrap(render.c.dim, MQTT_CONFIGURATION_NOTE)}`);
|
|
2460
|
+
console.log(` ${render.wrap(render.c.dim, "Fix:")} ${rosterNotRun.remedy}`);
|
|
2461
|
+
}
|
|
2462
|
+
else if (!rosterAdminPass || rosterOpsPort === null) {
|
|
2463
|
+
issues++;
|
|
2464
|
+
const reason = rosterProbe.credIssue
|
|
2465
|
+
? `the admin credential could not be resolved (${rosterProbe.credIssue})`
|
|
2466
|
+
: rosterAdminPass ? "the ops endpoint was not verified" : "no admin credentials to read the instance configuration";
|
|
2467
|
+
console.log(` ${render.icons.warn} MQTT listeners: NOT RUN — ${reason}.`);
|
|
2468
|
+
console.log(` ${render.wrap(render.c.dim, MQTT_CONFIGURATION_NOTE)}`);
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
const configuration = await readInstanceConfiguration({
|
|
2472
|
+
opsUrl: `http://127.0.0.1:${rosterOpsPort}/`,
|
|
2473
|
+
authHeader: `Basic ${Buffer.from(`${resolveAdminUser()}:${rosterAdminPass}`).toString("base64")}`,
|
|
2474
|
+
timeoutMs: 5000,
|
|
2475
|
+
});
|
|
2476
|
+
const section = mqttListenerSection(configuration);
|
|
2477
|
+
if (section.status !== "ok")
|
|
2478
|
+
issues++;
|
|
2479
|
+
console.log(` ${section.status === "ok" ? render.icons.ok : render.icons.warn} ${section.line}`);
|
|
2480
|
+
console.log(` ${render.wrap(render.c.dim, section.note)}`);
|
|
2481
|
+
if (section.fix)
|
|
2482
|
+
console.log(` ${render.wrap(render.c.dim, "Fix:")} ${section.fix}`);
|
|
2483
|
+
}
|
|
2365
2484
|
}
|
|
2366
2485
|
// 9. Migration state (flair#695) — pending/in-progress/blocked + last
|
|
2367
2486
|
// ledger-derived outcome per registered migration, read off the same
|
package/dist/commands/export.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultKeysDir, resolveAdminUser } from "../lib/auth-resolve.js";
|
|
1
|
+
import { defaultKeysDir, resolveAdminUser, addAdminPassOptions } 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
4
|
import { join, resolve } from "node:path";
|
|
@@ -27,14 +27,13 @@ function hasRequiredStringFields(value, fields) {
|
|
|
27
27
|
}
|
|
28
28
|
export function register(program) {
|
|
29
29
|
// ─── flair export ────────────────────────────────────────────────────────────
|
|
30
|
-
program
|
|
30
|
+
addAdminPassOptions(program
|
|
31
31
|
.command("export <agent-id>")
|
|
32
32
|
.description("Export a single agent's identity (soul + memories) to a portable file")
|
|
33
33
|
.option("--output <path>", "Output file path")
|
|
34
34
|
.option("--include-key", "Include private key in export (UNENCRYPTED — keep the output file secure)")
|
|
35
35
|
.option("--port <port>", "Harper HTTP port")
|
|
36
|
-
.option("--url <url>", "Flair base URL (overrides --port)")
|
|
37
|
-
.option("--admin-pass <pass>", "Admin password (or set FLAIR_ADMIN_PASS env)")
|
|
36
|
+
.option("--url <url>", "Flair base URL (overrides --port)"), "Admin password (or set FLAIR_ADMIN_PASS env)")
|
|
38
37
|
.option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
|
|
39
38
|
.option("--keys-dir <dir>", "Keys directory", defaultKeysDir())
|
|
40
39
|
.action(async (agentId, opts) => {
|