@tpsdev-ai/flair 0.62.0 → 0.63.1
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 +14 -13
- package/SECURITY.md +73 -43
- package/config.yaml +11 -11
- package/dist/bridges/runtime/execute.js +1 -0
- package/dist/bridges/runtime/import-runner.js +4 -0
- package/dist/bridges/types.js +1 -0
- package/dist/build-info.json +3 -3
- package/dist/cli.js +309 -205
- package/dist/commands/agent.js +325 -137
- package/dist/commands/attention.js +2 -0
- package/dist/commands/backup-approval.js +218 -0
- package/dist/commands/backup.js +37 -33
- package/dist/commands/bootstrap.js +5 -1
- package/dist/commands/bridge.js +10 -0
- package/dist/commands/deploy.js +37 -7
- package/dist/commands/doctor.js +206 -42
- package/dist/commands/export.js +144 -15
- 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 +167 -34
- package/dist/commands/init.js +380 -164
- package/dist/commands/integrity.js +5 -6
- package/dist/commands/keys.js +12 -8
- package/dist/commands/mcp.js +157 -79
- package/dist/commands/memory.js +38 -17
- package/dist/commands/migrate-harness-memory.js +9 -3
- package/dist/commands/orgevent.js +5 -10
- package/dist/commands/principal.js +32 -39
- package/dist/commands/quality.js +26 -3
- package/dist/commands/reembed.js +468 -111
- package/dist/commands/rem.js +484 -65
- package/dist/commands/restore.js +352 -44
- package/dist/commands/search.js +2 -0
- package/dist/commands/service.js +109 -2
- package/dist/commands/soul.js +0 -6
- package/dist/commands/status.js +165 -124
- 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 +9 -25
- package/dist/fabric-upgrade.js +12 -2
- package/dist/federation/presence-send.js +139 -0
- package/dist/federation/scheduler.js +148 -12
- package/dist/federation-verify.js +269 -177
- package/dist/install/clients.js +171 -35
- package/dist/keystore.js +77 -10
- package/dist/lib/agent-id-rule.js +44 -2
- package/dist/lib/agent-key-file.js +509 -0
- package/dist/lib/agent-rotation-lock.js +249 -0
- package/dist/lib/atomic-write.js +3 -3
- package/dist/lib/auth-resolve.js +1040 -64
- 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/key-dir.js +203 -0
- package/dist/lib/launchd-management.js +21 -6
- package/dist/lib/local-instance-pair.js +8 -1
- 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/node-alias-path.js +50 -2
- 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/remote-admin-pass.js +157 -0
- package/dist/lib/restore-archive.js +760 -0
- package/dist/lib/restore-verify.js +1 -1
- package/dist/lib/scheduler-platform.js +13 -0
- package/dist/lib/service-repoint.js +13 -4
- package/dist/lib/skill-assignment-preflight.js +159 -0
- package/dist/lib/skill-seed.js +125 -10
- package/dist/lib/skill-tombstone-doctor.js +133 -0
- package/dist/lib/soul-scope-fields.js +26 -0
- package/dist/lib/terminal-text.js +32 -0
- package/dist/lib/uninstall-purge.js +266 -11
- package/dist/lib/upgrade-prior-liveness.js +2 -1
- package/dist/mcp-client-assertion.js +7 -14
- 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 +1348 -271
- 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 +75 -19
- package/dist/resources/host-pointer/registry.js +29 -0
- package/dist/resources/host-pointer-adapter.js +1 -0
- package/dist/resources/in-process-api.js +74 -11
- 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-client-metadata-fields.js +4 -0
- package/dist/resources/mcp-handler.js +146 -13
- package/dist/resources/mcp-oauth-flag.js +12 -14
- package/dist/resources/mcp-oauth.js +446 -53
- package/dist/resources/mcp-tool-scopes.js +69 -0
- package/dist/resources/mcp-tools.js +70 -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 +400 -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/keystore.js +77 -10
- package/dist/src/lib/agent-id-rule.js +44 -2
- package/dist/src/lib/atomic-write.js +3 -3
- package/dist/src/lib/federation-retry-row.js +101 -0
- package/dist/src/lib/instruction-event-contract.js +17 -0
- package/dist/src/lib/key-dir.js +203 -0
- package/dist/src/lib/memory-attributes.js +2 -0
- package/dist/src/lib/open-live-row.js +20 -0
- package/dist/src/lib/scheduler-platform.js +13 -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 +39 -21
- package/docs/api-reference.md +161 -52
- package/docs/auth.md +69 -38
- package/docs/claude-code.md +3 -3
- package/docs/deploying-on-fabric.md +118 -2
- package/docs/deployment.md +17 -0
- package/docs/embedding-in-a-harper-app.md +23 -21
- package/docs/entity-vocabulary.md +7 -11
- package/docs/federation.md +29 -2
- package/docs/hosted-on-fabric.md +1 -1
- 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 +9 -14
- 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 +29 -5
- 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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import nacl from "tweetnacl";
|
|
2
|
-
import {
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
3
|
import * as render from "../render.js";
|
|
4
|
-
import { defaultKeysDir, resolveLocalAdminPass, resolveAdminUser, } from "../lib/auth-resolve.js";
|
|
4
|
+
import { defaultKeysDir, resolveLocalAdminPass, resolveAdminUser, addAdminPassOptions, } from "../lib/auth-resolve.js";
|
|
5
|
+
import { ensureAgentKeysDir, readOrCreateAgentKey } from "../lib/agent-key-file.js";
|
|
5
6
|
import { resolveOpsUrl } from "../lib/mcp-enable.js";
|
|
6
7
|
import { writeConfirmed } from "../lib/instance-identity-row.js";
|
|
7
8
|
import { agentHomeEndpoint, planAgentHomeWrite, readStoredAgentHome, resolveTargetInstanceId, AGENT_HOME_IMMUTABLE_ERROR, AGENT_PRINCIPAL_WRITE_BACK_FIELD, AGENT_PRINCIPAL_WRITE_BACK_NO_ROW_ERROR } from "../lib/agent-home.js";
|
|
@@ -180,8 +181,7 @@ async function setPrincipalStatus(id, status, opts) {
|
|
|
180
181
|
}
|
|
181
182
|
/** Both state verbs accept the same target and admin credentials. */
|
|
182
183
|
function registerPrincipalStatusCommand(command, status) {
|
|
183
|
-
command
|
|
184
|
-
.option("--admin-pass <pass>", "Admin password; required explicitly for a remote --instance")
|
|
184
|
+
addAdminPassOptions(command, "Admin password; required explicitly for a remote --instance")
|
|
185
185
|
.option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
|
|
186
186
|
.option("--ops-port <port>", "Harper operations API port (local target)")
|
|
187
187
|
.option("--instance <url>", "Remote Flair instance (else FLAIR_URL); its ops API is derived as in mcp enable")
|
|
@@ -210,7 +210,7 @@ export function agentRecordIsAdmin(record) {
|
|
|
210
210
|
/** Register the `flair principal` command group (flair#1632). */
|
|
211
211
|
export function register(program) {
|
|
212
212
|
const principal = program.command("principal").description("Manage principals (humans and agents)");
|
|
213
|
-
principal
|
|
213
|
+
addAdminPassOptions(principal
|
|
214
214
|
.command("add <id>")
|
|
215
215
|
.description("Create a new principal")
|
|
216
216
|
.option("--kind <kind>", "Principal kind: human or agent", "agent")
|
|
@@ -218,8 +218,7 @@ export function register(program) {
|
|
|
218
218
|
.option("--admin", "Grant admin privileges")
|
|
219
219
|
.option("--trust <tier>", "Default trust tier: endorsed, corroborated, or unverified")
|
|
220
220
|
.option("--runtime <runtime>", "Runtime: openclaw, claude-code, headless, external")
|
|
221
|
-
.option("--port <port>", "Harper HTTP port")
|
|
222
|
-
.option("--admin-pass <pass>", "Admin password for registration")
|
|
221
|
+
.option("--port <port>", "Harper HTTP port"), "Admin password for registration")
|
|
223
222
|
.option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
|
|
224
223
|
.option("--keys-dir <dir>", "Directory for Ed25519 keys")
|
|
225
224
|
.option("--ops-port <port>", "Harper operations API port")
|
|
@@ -258,9 +257,6 @@ export function register(program) {
|
|
|
258
257
|
const isAdmin = opts.admin ?? false;
|
|
259
258
|
const trustTier = opts.trust ?? (isAdmin ? "endorsed" : "unverified");
|
|
260
259
|
const runtime = opts.runtime;
|
|
261
|
-
// #590 — same local-only fallback as `agent add`: FLAIR_ADMIN_PASS env, then
|
|
262
|
-
// the secure ~/.flair/admin-pass file (mode 0600). `principal add` has no
|
|
263
|
-
// --target/--ops-target (always localhost), so the fallback always applies.
|
|
264
260
|
let adminPass;
|
|
265
261
|
try {
|
|
266
262
|
adminPass = resolveLocalAdminPass(opts.adminPass);
|
|
@@ -275,24 +271,28 @@ export function register(program) {
|
|
|
275
271
|
process.exit(1);
|
|
276
272
|
}
|
|
277
273
|
// Generate Ed25519 keypair (agents always get one; humans get one for instance-attestation)
|
|
278
|
-
mkdirSync(keysDir, { recursive: true });
|
|
279
274
|
const privPath = privKeyPath(id, keysDir);
|
|
280
275
|
const pubPath = pubKeyPath(id, keysDir);
|
|
281
276
|
let pubKeyB64url;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
277
|
+
try {
|
|
278
|
+
ensureAgentKeysDir(keysDir);
|
|
279
|
+
const keyFile = readOrCreateAgentKey(privPath, () => {
|
|
280
|
+
const kp = nacl.sign.keyPair();
|
|
281
|
+
return Buffer.from(kp.secretKey.slice(0, 32));
|
|
282
|
+
});
|
|
283
|
+
const kp = nacl.sign.keyPair.fromSeed(new Uint8Array(keyFile.bytes));
|
|
286
284
|
pubKeyB64url = b64url(kp.publicKey);
|
|
285
|
+
if (keyFile.created) {
|
|
286
|
+
writeFileSync(pubPath, Buffer.from(kp.publicKey));
|
|
287
|
+
console.log(`Keypair written: ${privPath}`);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
console.log(`Reusing existing key: ${privPath}`);
|
|
291
|
+
}
|
|
287
292
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
writeFileSync(privPath, Buffer.from(seed));
|
|
292
|
-
chmodSync(privPath, 0o600);
|
|
293
|
-
writeFileSync(pubPath, Buffer.from(kp.publicKey));
|
|
294
|
-
pubKeyB64url = b64url(kp.publicKey);
|
|
295
|
-
console.log(`Keypair written: ${privPath}`);
|
|
293
|
+
catch (err) {
|
|
294
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
295
|
+
process.exit(1);
|
|
296
296
|
}
|
|
297
297
|
// Insert via operations API with Principal fields
|
|
298
298
|
const auth = `Basic ${Buffer.from(`${adminUser}:${adminPass}`).toString("base64")}`;
|
|
@@ -413,11 +413,10 @@ export function register(program) {
|
|
|
413
413
|
console.log(` Public key: ${pubKeyB64url}`);
|
|
414
414
|
console.log(` Private key: ${privPath}`);
|
|
415
415
|
});
|
|
416
|
-
principal
|
|
416
|
+
addAdminPassOptions(principal
|
|
417
417
|
.command("list")
|
|
418
418
|
.description("List all principals")
|
|
419
|
-
.option("--kind <kind>", "Filter by kind: human or agent")
|
|
420
|
-
.option("--admin-pass <pass>", "Admin password (or set FLAIR_ADMIN_PASS)")
|
|
419
|
+
.option("--kind <kind>", "Filter by kind: human or agent"), "Admin password (or set FLAIR_ADMIN_PASS)")
|
|
421
420
|
.option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
|
|
422
421
|
.option("--port <port>", "Harper HTTP port")
|
|
423
422
|
.option("--ops-port <port>", "Harper operations API port")
|
|
@@ -554,10 +553,7 @@ export function register(program) {
|
|
|
554
553
|
});
|
|
555
554
|
registerPrincipalStatusCommand(principal.command("disable <id>").description("Deactivate a principal (revokes access, preserves data)"), "deactivated");
|
|
556
555
|
registerPrincipalStatusCommand(principal.command("enable <id>").description("Reactivate a principal"), "active");
|
|
557
|
-
principal
|
|
558
|
-
.command("promote <id> <tier>")
|
|
559
|
-
.description("Change a principal's trust tier (endorsed, corroborated, unverified)")
|
|
560
|
-
.option("--admin-pass <pass>", "Admin password")
|
|
556
|
+
addAdminPassOptions(principal.command("promote <id> <tier>").description("Change a principal's trust tier (endorsed, corroborated, unverified)"), "Admin password")
|
|
561
557
|
.option("--admin-user <name>", "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)")
|
|
562
558
|
.option("--ops-port <port>", "Harper operations API port")
|
|
563
559
|
.action(async (id, tier, opts) => {
|
|
@@ -625,15 +621,14 @@ export function register(program) {
|
|
|
625
621
|
const MAPPING_ADMIN_PASS_HELP = "Admin password for the TARGET instance (required — FLAIR_ADMIN_PASS and ~/.flair/admin-pass are this " +
|
|
626
622
|
"machine's local credentials and are never sent to a remote instance)";
|
|
627
623
|
const MAPPING_ADMIN_USER_HELP = "Admin username for Basic auth (env: FLAIR_ADMIN_USER; default: admin)";
|
|
628
|
-
principal
|
|
624
|
+
addAdminPassOptions(principal
|
|
629
625
|
.command("link <principal>")
|
|
630
626
|
.description("Map one IdP login to an existing principal on an already-enabled instance — the identity-mapping step " +
|
|
631
627
|
"`flair mcp enable` runs, and nothing else. " + MAPPING_TARGET_HELP)
|
|
632
628
|
.option("--idp-subject <login>", "The login the identity provider reports for this person (GitHub: the username)")
|
|
633
629
|
.option("--idp-provider <name>", "Upstream IdP provider", "github")
|
|
634
630
|
.option(MAPPING_INSTANCE_OPTION, MAPPING_INSTANCE_HELP)
|
|
635
|
-
.option("--replace", "Move a subject that is already mapped to a different principal")
|
|
636
|
-
.option("--admin-pass <pass>", MAPPING_ADMIN_PASS_HELP)
|
|
631
|
+
.option("--replace", "Move a subject that is already mapped to a different principal"), MAPPING_ADMIN_PASS_HELP)
|
|
637
632
|
.option("--admin-user <name>", MAPPING_ADMIN_USER_HELP)
|
|
638
633
|
.action(async (principalId, opts) => {
|
|
639
634
|
if (!opts.idpSubject) {
|
|
@@ -659,13 +654,12 @@ export function register(program) {
|
|
|
659
654
|
process.exit(1);
|
|
660
655
|
}
|
|
661
656
|
});
|
|
662
|
-
principal
|
|
657
|
+
addAdminPassOptions(principal
|
|
663
658
|
.command("unlink <principal>")
|
|
664
659
|
.description("Revoke one IdP login's mapping; success requires confirmed updates and no resolvable subject mapping on readback. " + MAPPING_TARGET_HELP)
|
|
665
660
|
.option("--idp-subject <login>", "The login the identity provider reports for this person (GitHub: the username)")
|
|
666
661
|
.option("--idp-provider <name>", "Upstream IdP provider the mapping carries", "github")
|
|
667
|
-
.option(MAPPING_INSTANCE_OPTION, MAPPING_INSTANCE_HELP)
|
|
668
|
-
.option("--admin-pass <pass>", MAPPING_ADMIN_PASS_HELP)
|
|
662
|
+
.option(MAPPING_INSTANCE_OPTION, MAPPING_INSTANCE_HELP), MAPPING_ADMIN_PASS_HELP)
|
|
669
663
|
.option("--admin-user <name>", MAPPING_ADMIN_USER_HELP)
|
|
670
664
|
.action(async (principalId, opts) => {
|
|
671
665
|
if (!opts.idpSubject) {
|
|
@@ -690,11 +684,10 @@ export function register(program) {
|
|
|
690
684
|
process.exit(1);
|
|
691
685
|
}
|
|
692
686
|
});
|
|
693
|
-
principal
|
|
687
|
+
addAdminPassOptions(principal
|
|
694
688
|
.command("links <principal>")
|
|
695
689
|
.description("List a principal's current IdP mappings on an already-enabled instance. " + MAPPING_TARGET_HELP)
|
|
696
|
-
.option(MAPPING_INSTANCE_OPTION, MAPPING_INSTANCE_HELP)
|
|
697
|
-
.option("--admin-pass <pass>", MAPPING_ADMIN_PASS_HELP)
|
|
690
|
+
.option(MAPPING_INSTANCE_OPTION, MAPPING_INSTANCE_HELP), MAPPING_ADMIN_PASS_HELP)
|
|
698
691
|
.option("--admin-user <name>", MAPPING_ADMIN_USER_HELP)
|
|
699
692
|
.action(async (principalId, opts) => {
|
|
700
693
|
const target = mappingTarget(opts, "flair principal links");
|
package/dist/commands/quality.js
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* (no require(), #1653). Compiled strictly via tsconfig.check.src.json.
|
|
8
8
|
*/
|
|
9
9
|
import { encodeRecordId } from "../lib/record-id-path.js";
|
|
10
|
+
import { ApiRequestOutcomeUnknown } from "../lib/auth-resolve.js";
|
|
10
11
|
import * as render from "../render.js";
|
|
11
12
|
import { EMBEDDING_STAMP_ID, describeStampOutstanding, resolveCurrentModelId } from "../stamp-outstanding.js";
|
|
13
|
+
import { randomUUID } from "node:crypto";
|
|
12
14
|
let cli;
|
|
13
15
|
/** Bind the cli-locals this module depends on. */
|
|
14
16
|
export function bindCli(fns) {
|
|
@@ -387,9 +389,19 @@ export function computeQualityReport(healthy, healthData, opts = {}) {
|
|
|
387
389
|
// empty perAgent array (nothing to prove otherwise, and both scopes render
|
|
388
390
|
// identically empty either way).
|
|
389
391
|
const haveUsageCount = perAgentAll.every((r) => typeof r.usageCount === "number");
|
|
392
|
+
// Rows whose memoryCount or writes24h is absent or not a number carry no
|
|
393
|
+
// usable counts. A rate or a quiet verdict computed from either count would
|
|
394
|
+
// be a claim about data nobody read, so neither is reported.
|
|
395
|
+
const haveMemoryStats = perAgentAll.every((r) => typeof r.memoryCount === "number" && typeof r.writes24h === "number");
|
|
390
396
|
// ── Signal density (write volume, + citation rate when the server supports it) ──
|
|
391
397
|
let signalDensity = null;
|
|
392
|
-
if (havePerAgent &&
|
|
398
|
+
if (havePerAgent && !haveMemoryStats) {
|
|
399
|
+
gaps.push({
|
|
400
|
+
metric: "signalDensity",
|
|
401
|
+
reason: "per-agent memory fields unavailable",
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
else if (havePerAgent && haveUsageCount) {
|
|
393
405
|
signalDensity = {
|
|
394
406
|
scope: "write-and-citation",
|
|
395
407
|
perAgent: scopedAgents.map((r) => {
|
|
@@ -414,7 +426,13 @@ export function computeQualityReport(healthy, healthData, opts = {}) {
|
|
|
414
426
|
}
|
|
415
427
|
// ── Quiet agents (ops fact — not a trust signal) ──
|
|
416
428
|
let quietAgents = null;
|
|
417
|
-
if (havePerAgent) {
|
|
429
|
+
if (havePerAgent && !haveMemoryStats) {
|
|
430
|
+
gaps.push({
|
|
431
|
+
metric: "quietAgents",
|
|
432
|
+
reason: "per-agent memory fields unavailable",
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
else if (havePerAgent) {
|
|
418
436
|
const rows = scopedAgents.map((r) => {
|
|
419
437
|
const daysSinceLastWrite = r.lastWriteAt ? Math.floor((now - new Date(r.lastWriteAt).getTime()) / 86_400_000) : null;
|
|
420
438
|
const quiet = daysSinceLastWrite === null ? true : daysSinceLastWrite >= QUALITY_QUIET_THRESHOLD_DAYS;
|
|
@@ -809,7 +827,10 @@ export async function fetchPreviousQualitySnapshot(agentId, baseUrl, subject, op
|
|
|
809
827
|
* Throws on a write failure — the CLI action below is responsible for
|
|
810
828
|
* surfacing that as a clear error, same as every other write path here. */
|
|
811
829
|
async function storeQualitySnapshot(agentId, agentIdSource, baseUrl, subject, snapshot) {
|
|
812
|
-
|
|
830
|
+
// flair#3115: the PUT is an upsert, so a millisecond suffix made two --emit
|
|
831
|
+
// runs in the same millisecond overwrite one row; the uuid suffix keeps the
|
|
832
|
+
// two writes apart.
|
|
833
|
+
const memId = `${agentId}-quality-snapshot-${randomUUID()}`;
|
|
813
834
|
const body = {
|
|
814
835
|
id: memId,
|
|
815
836
|
agentId,
|
|
@@ -1011,6 +1032,8 @@ export function register(program) {
|
|
|
1011
1032
|
emitResult.snapshotId = await storeQualitySnapshot(agentId, source, baseUrl, subject, current);
|
|
1012
1033
|
}
|
|
1013
1034
|
catch (err) {
|
|
1035
|
+
if (err instanceof ApiRequestOutcomeUnknown)
|
|
1036
|
+
throw err;
|
|
1014
1037
|
emitResult.errors.push(`snapshot store failed: ${err?.message ?? String(err)}`);
|
|
1015
1038
|
}
|
|
1016
1039
|
}
|