@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
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { resolveAdminUser } from "../lib/auth-resolve.js";
|
|
3
|
+
import { backupDigestPath, readBackupArtifact } from "../lib/backup-artifact.js";
|
|
4
|
+
import { approveArchive, ApprovalStoreError, defaultApprovalStoreRoot, listApprovals, readImportFile, revokeApproval, } from "../lib/backup-approval-store.js";
|
|
5
|
+
import { parseRestoreArchive } from "../lib/restore-archive.js";
|
|
6
|
+
import * as render from "../render.js";
|
|
7
|
+
let cli;
|
|
8
|
+
/** Bind the cli-locals this module depends on. */
|
|
9
|
+
export function bindCli(fns) {
|
|
10
|
+
cli = fns;
|
|
11
|
+
}
|
|
12
|
+
const NOTHING_APPROVED = "nothing was approved";
|
|
13
|
+
const NOTHING_REVOKED = "nothing was revoked";
|
|
14
|
+
/** A refusal: print it and set a non-zero exit code. */
|
|
15
|
+
class Refusal extends Error {
|
|
16
|
+
}
|
|
17
|
+
/** A short, secret-free label for a failed fetch. */
|
|
18
|
+
function fetchFailure(error) {
|
|
19
|
+
const cause = error?.cause?.code;
|
|
20
|
+
const code = error?.code;
|
|
21
|
+
if (typeof cause === "string")
|
|
22
|
+
return cause;
|
|
23
|
+
if (typeof code === "string")
|
|
24
|
+
return code;
|
|
25
|
+
return error instanceof Error ? error.name : "connection failed";
|
|
26
|
+
}
|
|
27
|
+
function errnoCode(error) {
|
|
28
|
+
const code = error?.code;
|
|
29
|
+
return typeof code === "string" ? code : "error";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Verify the operator credentials against this host's operations API and
|
|
33
|
+
* return the operator name to record. Throws a Refusal naming what did not
|
|
34
|
+
* hold; never prints the password.
|
|
35
|
+
*/
|
|
36
|
+
async function verifyOperator(opts, action, nothing = NOTHING_APPROVED) {
|
|
37
|
+
const adminPass = opts.adminPass ?? process.env.FLAIR_ADMIN_PASS ?? "";
|
|
38
|
+
const adminUser = resolveAdminUser(opts.adminUser);
|
|
39
|
+
if (!adminPass) {
|
|
40
|
+
throw new Refusal(`${action} needs operator credentials: pass --admin-pass-file (preferred), --admin-pass, or set FLAIR_ADMIN_PASS; ${nothing}`);
|
|
41
|
+
}
|
|
42
|
+
// The repo's ops-port ladder (src/cli.ts resolveOpsPort): --ops-port, then
|
|
43
|
+
// FLAIR_OPS_PORT, then the local config's opsPort, then the resolved HTTP
|
|
44
|
+
// port minus one. Always loopback: the credentials are checked on this host.
|
|
45
|
+
const opsUrl = `http://127.0.0.1:${cli.resolveOpsPort(opts)}`;
|
|
46
|
+
let res;
|
|
47
|
+
try {
|
|
48
|
+
res = await fetch(`${opsUrl}/`, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: { "Content-Type": "application/json", Authorization: `Basic ${Buffer.from(`${adminUser}:${adminPass}`).toString("base64")}` },
|
|
51
|
+
body: JSON.stringify({ operation: "user_info" }),
|
|
52
|
+
signal: AbortSignal.timeout(10_000),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw new Refusal(`could not reach this host's operations API at ${opsUrl} to verify the operator credentials ` +
|
|
57
|
+
`(${fetchFailure(error)}); check that Flair is running on this host and name its operations port with ` +
|
|
58
|
+
`--ops-port (or FLAIR_OPS_PORT); ${nothing}`);
|
|
59
|
+
}
|
|
60
|
+
if (res.status === 401 || res.status === 403) {
|
|
61
|
+
throw new Refusal(`the operator credentials were refused by this host's operations API (HTTP ${res.status}); ${nothing}`);
|
|
62
|
+
}
|
|
63
|
+
if (!res.ok)
|
|
64
|
+
throw new Refusal(`this host's operations API answered HTTP ${res.status} to user_info; ${nothing}`);
|
|
65
|
+
const info = (await res.json().catch(() => null));
|
|
66
|
+
if (info?.role?.permission?.super_user !== true) {
|
|
67
|
+
throw new Refusal(`the credentials for ${adminUser} are not a super_user on this host, so they are not operator credentials; ${nothing}`);
|
|
68
|
+
}
|
|
69
|
+
return typeof info.username === "string" && info.username.length > 0 ? info.username : adminUser;
|
|
70
|
+
}
|
|
71
|
+
/** Read an import file, turning a refusal or read error into a Refusal. */
|
|
72
|
+
function importFile(path, describe) {
|
|
73
|
+
try {
|
|
74
|
+
return readImportFile(path, describe);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error instanceof ApprovalStoreError)
|
|
78
|
+
throw new Refusal(`${error.message}; ${NOTHING_APPROVED}`);
|
|
79
|
+
throw new Refusal(`cannot read ${describe} ${path} (${errnoCode(error)}); ${NOTHING_APPROVED}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function printRecord(heading, record) {
|
|
83
|
+
console.log(`${render.icons.ok} ${render.wrap(render.c.green, heading)}`);
|
|
84
|
+
console.log(render.kv("SHA-256", record.sha256));
|
|
85
|
+
console.log(render.kv("Admission", record.admission));
|
|
86
|
+
console.log(render.kv("Approved", `${record.approvedAt} by ${record.approvedBy}`));
|
|
87
|
+
if (record.revokedAt !== null)
|
|
88
|
+
console.log(render.kv("Revoked", `${record.revokedAt} by ${record.revokedBy}`));
|
|
89
|
+
console.log(render.kv("Store", defaultApprovalStoreRoot()));
|
|
90
|
+
}
|
|
91
|
+
/** Run an action; a Refusal or store error prints one error line and exits non-zero. */
|
|
92
|
+
async function run(action, nothing = NOTHING_APPROVED) {
|
|
93
|
+
try {
|
|
94
|
+
await action();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error instanceof Refusal)
|
|
98
|
+
console.error(`Error: ${error.message}`);
|
|
99
|
+
else if (error instanceof ApprovalStoreError)
|
|
100
|
+
console.error(`Error: ${error.message}; ${nothing}`);
|
|
101
|
+
else
|
|
102
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function register(program) {
|
|
107
|
+
const group = program
|
|
108
|
+
.command("backup-approval")
|
|
109
|
+
.description("Approve backup archives for restore on this host (a local store no REST route can reach)");
|
|
110
|
+
cli.addSharedCredentialOptions(group
|
|
111
|
+
.command("approve <archive>")
|
|
112
|
+
.description("Verify an archive against its .sha256 sidecar, store its exact bytes and record your approval")
|
|
113
|
+
.option("--port <port>", "Harper HTTP port of this host's Flair")
|
|
114
|
+
.option("--ops-port <port>", "Harper operations API port of this host's Flair, which verifies the credentials (default: FLAIR_OPS_PORT, local config, or HTTP port minus one)")).action((archivePath, opts) => run(async () => {
|
|
115
|
+
const archiveBytes = importFile(archivePath, "archive");
|
|
116
|
+
const digestPath = backupDigestPath(archivePath);
|
|
117
|
+
let sidecarBytes;
|
|
118
|
+
try {
|
|
119
|
+
sidecarBytes = readImportFile(digestPath, "archive digest sidecar");
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (!(error instanceof ApprovalStoreError) && errnoCode(error) === "ENOENT") {
|
|
123
|
+
throw new Refusal(`archive digest sidecar ${digestPath} not found; ${NOTHING_APPROVED}. Put the .sha256 file written with this ` +
|
|
124
|
+
`archive beside it, or, for an archive written before flair backup published digests, use ` +
|
|
125
|
+
`flair backup-approval legacy-admit ${archivePath}`);
|
|
126
|
+
}
|
|
127
|
+
if (error instanceof ApprovalStoreError)
|
|
128
|
+
throw new Refusal(`${error.message}; ${NOTHING_APPROVED}`);
|
|
129
|
+
throw new Refusal(`cannot read archive digest sidecar ${digestPath} (${errnoCode(error)}); ${NOTHING_APPROVED}`);
|
|
130
|
+
}
|
|
131
|
+
// The same verification restore runs, over the two buffers just read.
|
|
132
|
+
const served = new Map([[archivePath, archiveBytes], [digestPath, sidecarBytes]]);
|
|
133
|
+
const verified = readBackupArtifact(archivePath, {
|
|
134
|
+
stopped: NOTHING_APPROVED,
|
|
135
|
+
readFile: (path) => {
|
|
136
|
+
const bytes = served.get(path);
|
|
137
|
+
if (bytes === undefined)
|
|
138
|
+
throw Object.assign(new Error("unexpected read"), { code: "EINVAL" });
|
|
139
|
+
return bytes;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
if (verified.ok === false)
|
|
143
|
+
throw new Refusal(verified.reason);
|
|
144
|
+
const operator = await verifyOperator(opts, "approval");
|
|
145
|
+
const record = approveArchive({
|
|
146
|
+
bytes: archiveBytes, sha256: verified.sha256, admission: "sidecar", operator, archiveName: basename(archivePath),
|
|
147
|
+
});
|
|
148
|
+
printRecord(`Approved ${archivePath} on this host`, record);
|
|
149
|
+
}));
|
|
150
|
+
cli.addSharedCredentialOptions(group
|
|
151
|
+
.command("legacy-admit <archive>")
|
|
152
|
+
.description("Approve an archive that has no .sha256 sidecar: prints its SHA-256; repeat it with --confirm-digest to approve")
|
|
153
|
+
.option("--confirm-digest <sha256>", "The archive's SHA-256, as printed by a first run, confirming you approve exactly these bytes")
|
|
154
|
+
.option("--port <port>", "Harper HTTP port of this host's Flair")
|
|
155
|
+
.option("--ops-port <port>", "Harper operations API port of this host's Flair, which verifies the credentials (default: FLAIR_OPS_PORT, local config, or HTTP port minus one)")).action((archivePath, opts) => run(async () => {
|
|
156
|
+
const bytes = importFile(archivePath, "archive");
|
|
157
|
+
const digestPath = backupDigestPath(archivePath);
|
|
158
|
+
let sidecarPresent = false;
|
|
159
|
+
try {
|
|
160
|
+
readImportFile(digestPath, "archive digest sidecar");
|
|
161
|
+
sidecarPresent = true;
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (error instanceof ApprovalStoreError || errnoCode(error) !== "ENOENT")
|
|
165
|
+
sidecarPresent = true;
|
|
166
|
+
}
|
|
167
|
+
if (sidecarPresent) {
|
|
168
|
+
throw new Refusal(`${archivePath} has a digest sidecar at ${digestPath}, so it is not a legacy archive; ${NOTHING_APPROVED}. ` +
|
|
169
|
+
`Use flair backup-approval approve ${archivePath}`);
|
|
170
|
+
}
|
|
171
|
+
const parsed = parseRestoreArchive(bytes);
|
|
172
|
+
if (parsed.ok === false) {
|
|
173
|
+
const location = parsed.location === "" ? "/" : parsed.location;
|
|
174
|
+
throw new Refusal(`${archivePath} is not a restorable archive: ${parsed.reason} (${parsed.code} at ${location}); ${NOTHING_APPROVED}`);
|
|
175
|
+
}
|
|
176
|
+
console.log(render.kv("Archive", archivePath));
|
|
177
|
+
console.log(render.kv("SHA-256", parsed.sha256));
|
|
178
|
+
console.log(render.kv("Size", `${bytes.length} bytes`));
|
|
179
|
+
console.log("An archive without a sidecar carries no record of the digest it was written with. Approving it authorizes " +
|
|
180
|
+
"these exact bytes on this host until revoked; it does not show where they came from or that they are " +
|
|
181
|
+
"unchanged since the backup.");
|
|
182
|
+
const confirmed = opts.confirmDigest;
|
|
183
|
+
if (confirmed === undefined) {
|
|
184
|
+
throw new Refusal(`legacy admission needs you to confirm the digest above; ${NOTHING_APPROVED}. Compare it with a record you ` +
|
|
185
|
+
`trust, then run flair backup-approval legacy-admit ${archivePath} --confirm-digest ${parsed.sha256}`);
|
|
186
|
+
}
|
|
187
|
+
if (confirmed !== parsed.sha256) {
|
|
188
|
+
throw new Refusal(`--confirm-digest does not match the archive's SHA-256 ${parsed.sha256}; ${NOTHING_APPROVED}`);
|
|
189
|
+
}
|
|
190
|
+
const operator = await verifyOperator(opts, "legacy admission");
|
|
191
|
+
const record = approveArchive({ bytes, sha256: parsed.sha256, admission: "legacy", operator, archiveName: basename(archivePath) });
|
|
192
|
+
printRecord(`Approved ${archivePath} on this host (legacy admission)`, record);
|
|
193
|
+
}));
|
|
194
|
+
group
|
|
195
|
+
.command("list")
|
|
196
|
+
.description("List the archive approvals on this host and check each stored copy")
|
|
197
|
+
.action(() => run(async () => {
|
|
198
|
+
const listed = listApprovals();
|
|
199
|
+
if (listed.length === 0) {
|
|
200
|
+
console.log(`No archive approvals on this host (${defaultApprovalStoreRoot()}).`);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
for (const { record, stored } of listed) {
|
|
204
|
+
const status = record.revokedAt === null ? "approved" : `revoked ${record.revokedAt} by ${record.revokedBy}`;
|
|
205
|
+
console.log(`${record.sha256} ${status} ${record.admission} approved ${record.approvedAt} by ${record.approvedBy} ` +
|
|
206
|
+
`${record.archiveName} stored copy ${stored}`);
|
|
207
|
+
}
|
|
208
|
+
}, "nothing was listed"));
|
|
209
|
+
cli.addSharedCredentialOptions(group
|
|
210
|
+
.command("revoke <sha256>")
|
|
211
|
+
.description("Revoke the approval of an archive digest on this host")
|
|
212
|
+
.option("--port <port>", "Harper HTTP port of this host's Flair")
|
|
213
|
+
.option("--ops-port <port>", "Harper operations API port of this host's Flair, which verifies the credentials (default: FLAIR_OPS_PORT, local config, or HTTP port minus one)")).action((sha256, opts) => run(async () => {
|
|
214
|
+
const operator = await verifyOperator(opts, "revocation", NOTHING_REVOKED);
|
|
215
|
+
const record = revokeApproval(sha256, operator);
|
|
216
|
+
printRecord(`Revoked the approval of ${sha256} on this host`, record);
|
|
217
|
+
}, NOTHING_REVOKED));
|
|
218
|
+
}
|
package/dist/commands/backup.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { readExactTableCount } from "../lib/ops-table-count.js";
|
|
2
2
|
import { resolveAdminUser } from "../lib/auth-resolve.js";
|
|
3
3
|
import { flairBackupOutputPath } from "../lib/flair-paths.js";
|
|
4
|
+
import { publishBackupArtifact } from "../lib/backup-artifact.js";
|
|
4
5
|
import * as render from "../render.js";
|
|
5
|
-
import { mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
6
|
let cli;
|
|
8
7
|
/** Bind the cli-locals this module depends on. */
|
|
9
8
|
export function bindCli(fns) {
|
|
@@ -12,9 +11,6 @@ export function bindCli(fns) {
|
|
|
12
11
|
function addSharedCredentialOptions(...args) {
|
|
13
12
|
return cli.addSharedCredentialOptions(...args);
|
|
14
13
|
}
|
|
15
|
-
function applyAdminPassFile(...args) {
|
|
16
|
-
return cli.applyAdminPassFile(...args);
|
|
17
|
-
}
|
|
18
14
|
function resolveHttpPort(...args) {
|
|
19
15
|
return cli.resolveHttpPort(...args);
|
|
20
16
|
}
|
|
@@ -37,7 +33,6 @@ export function register(program) {
|
|
|
37
33
|
.option("--ops-timeout-ms <ms>", "Operations request timeout, 1–600000 ms (env: FLAIR_BACKUP_OPS_TIMEOUT_MS; default: 10000)")
|
|
38
34
|
.option("--url <url>", "Flair base URL (overrides --port)")).action(async (opts) => {
|
|
39
35
|
const baseUrl = opts.url ?? `http://127.0.0.1:${resolveHttpPort(opts)}`;
|
|
40
|
-
applyAdminPassFile(opts);
|
|
41
36
|
// Env is a second-class fallback after the explicit flags (same order
|
|
42
37
|
// backup used before the shared helper). FLAIR_ADMIN_PASS is still
|
|
43
38
|
// accepted so existing scripts keep working.
|
|
@@ -240,44 +235,53 @@ export function register(program) {
|
|
|
240
235
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
241
236
|
const defaultOutput = flairBackupOutputPath(timestamp);
|
|
242
237
|
const outputPath = opts.output ?? defaultOutput;
|
|
243
|
-
|
|
238
|
+
const serialized = JSON.stringify(backup, null, 2) + "\n";
|
|
239
|
+
// flair#2664: the archive is published together with `<output>.sha256`,
|
|
240
|
+
// the SHA-256 of exactly these bytes as read back from disk. The previous
|
|
241
|
+
// sidecar is removed before the archive changes and the new one is written
|
|
242
|
+
// after it is in place, so a crash of this backup never leaves the sidecar
|
|
243
|
+
// it wrote beside other bytes. Concurrent backups to one output path are
|
|
244
|
+
// not serialized; a mismatched pair they leave is refused at restore
|
|
245
|
+
// (src/lib/backup-artifact.ts).
|
|
246
|
+
let sha256;
|
|
247
|
+
let digestPath;
|
|
248
|
+
let stagingLeft;
|
|
244
249
|
try {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
({ sha256, digestPath, stagingLeft } = publishBackupArtifact({
|
|
251
|
+
outputPath,
|
|
252
|
+
serialized,
|
|
253
|
+
verify(written) {
|
|
254
|
+
const archive = JSON.parse(written);
|
|
255
|
+
for (const table of ["agents", "memories", "souls"]) {
|
|
256
|
+
if (!Array.isArray(archive[table]) || archive[table].length !== backup[table].length) {
|
|
257
|
+
throw new Error(`${table}: archive count does not match fetched count ${backup[table].length}`);
|
|
258
|
+
}
|
|
259
|
+
for (const [index, row] of backup[table].entries()) {
|
|
260
|
+
if (archive[table][index]?.id !== row.id) {
|
|
261
|
+
throw new Error(`${table} row ${row.id}: archive id does not match fetched id`);
|
|
262
|
+
}
|
|
263
|
+
if (JSON.stringify(archive[table][index]) !== JSON.stringify(row)) {
|
|
264
|
+
throw new Error(`${table} row ${row.id}: archive contents do not match fetched row`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
259
267
|
}
|
|
260
|
-
if (
|
|
261
|
-
throw new Error(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
if (written !== serialized)
|
|
266
|
-
throw new Error("archive contents do not match fetched data");
|
|
267
|
-
renameSync(tmp, outputPath);
|
|
268
|
+
if (written !== serialized)
|
|
269
|
+
throw new Error("archive contents do not match fetched data");
|
|
270
|
+
},
|
|
271
|
+
}));
|
|
268
272
|
}
|
|
269
273
|
catch (error) {
|
|
270
274
|
throw new Error(`Backup archive ${outputPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
271
275
|
}
|
|
272
|
-
finally {
|
|
273
|
-
if (stagingDir)
|
|
274
|
-
rmSync(stagingDir, { recursive: true, force: true });
|
|
275
|
-
}
|
|
276
276
|
log(`\n${render.icons.ok} ${render.wrap(render.c.green, "Backup complete")}`);
|
|
277
277
|
log("Collections are read separately and can reflect different moments.");
|
|
278
278
|
log(render.kv("Agents", render.wrap(render.c.bold, String(agents.length))));
|
|
279
279
|
log(render.kv("Memories", render.wrap(render.c.bold, String(memories.length))));
|
|
280
280
|
log(render.kv("Souls", render.wrap(render.c.bold, String(souls.length))));
|
|
281
281
|
log(render.kv("Output", render.wrap(render.c.dim, outputPath)));
|
|
282
|
+
log(render.kv("SHA-256", render.wrap(render.c.dim, `${sha256} (${digestPath})`)));
|
|
283
|
+
if (stagingLeft) {
|
|
284
|
+
console.error(`Warning: the staging directory ${stagingLeft.path} could not be removed (${stagingLeft.reason}); remove it by hand.`);
|
|
285
|
+
}
|
|
282
286
|
});
|
|
283
287
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { authedRequest } from "../lib/auth-resolve.js";
|
|
1
|
+
import { ApiRequestOutcomeUnknown, authedRequest } from "../lib/auth-resolve.js";
|
|
2
|
+
import { requireAgentId } from "../lib/key-dir.js";
|
|
2
3
|
import * as render from "../render.js";
|
|
3
4
|
let cli;
|
|
4
5
|
/** Bind the cli-locals this module depends on. */
|
|
@@ -43,6 +44,7 @@ export function register(program) {
|
|
|
43
44
|
console.error(`${render.icons.error} --agent <id> required (or set FLAIR_AGENT_ID)`);
|
|
44
45
|
process.exit(2);
|
|
45
46
|
}
|
|
47
|
+
requireAgentId(agentId);
|
|
46
48
|
const baseUrl = resolveBaseUrl(opts);
|
|
47
49
|
const mode = render.resolveOutputMode(opts);
|
|
48
50
|
try {
|
|
@@ -84,6 +86,8 @@ export function register(program) {
|
|
|
84
86
|
console.error(`${tokenIcon} budget ${tokensUsed}/${maxTokens} tokens (${tokenPct.toFixed(0)}%) ${render.icons.bullet} ${render.icons.ok} ${included} included ${render.icons.bullet} ${truncIcon} ${truncated} truncated`);
|
|
85
87
|
}
|
|
86
88
|
catch (err) {
|
|
89
|
+
if (err instanceof ApiRequestOutcomeUnknown)
|
|
90
|
+
throw err;
|
|
87
91
|
console.error(`${render.icons.error} Bootstrap failed: ${err.message}`);
|
|
88
92
|
process.exit(1);
|
|
89
93
|
}
|
package/dist/commands/bridge.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as render from "../render.js";
|
|
2
2
|
import { resolveKeyPath, buildEd25519Auth, readSecretFileSecure, requestTarget, requestUrl } from "../lib/auth-resolve.js";
|
|
3
|
+
import { AgentKeyPathRefusal, requireAgentId } from "../lib/key-dir.js";
|
|
3
4
|
import { encodeRecordId } from "../lib/record-id-path.js";
|
|
4
5
|
import { protoSafeRecord } from "../lib/proto-safe-record.js";
|
|
5
6
|
let cli;
|
|
@@ -215,6 +216,10 @@ export function register(program) {
|
|
|
215
216
|
.option("--api-key-file <path>", "For API bridges with an apiKey option, read the key from a file that has no group/world permissions (chmod 600 recommended); or, if the bridge declares an environment variable, set that instead (e.g. MEM0_API_KEY).")
|
|
216
217
|
.action(async (name, srcArg, opts) => {
|
|
217
218
|
const agentId = opts.agent ?? process.env.FLAIR_AGENT_ID;
|
|
219
|
+
if (opts.agent !== undefined)
|
|
220
|
+
requireAgentId(opts.agent);
|
|
221
|
+
else if (agentId)
|
|
222
|
+
requireAgentId(agentId);
|
|
218
223
|
const cwd = opts.cwd ?? srcArg ?? process.cwd();
|
|
219
224
|
const { discover } = await import("../bridges/discover.js");
|
|
220
225
|
const { builtinDiscoveryRecords } = await import("../bridges/builtins/index.js");
|
|
@@ -382,6 +387,10 @@ export function register(program) {
|
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
389
|
catch (err) {
|
|
390
|
+
// The shared agent-ID refusal prints its own message, as it does when
|
|
391
|
+
// the flag or environment id is checked above.
|
|
392
|
+
if (err instanceof AgentKeyPathRefusal)
|
|
393
|
+
throw err;
|
|
385
394
|
if (err instanceof BridgeRuntimeError) {
|
|
386
395
|
printBridgeError(err, bridgeApiKey);
|
|
387
396
|
process.exit(1);
|
|
@@ -408,6 +417,7 @@ export function register(program) {
|
|
|
408
417
|
console.error("error: --agent <id> required (or set FLAIR_AGENT_ID)");
|
|
409
418
|
process.exit(1);
|
|
410
419
|
}
|
|
420
|
+
requireAgentId(agentId);
|
|
411
421
|
const cwd = opts.cwd ?? dst;
|
|
412
422
|
const { discover } = await import("../bridges/discover.js");
|
|
413
423
|
const { builtinDiscoveryRecords } = await import("../bridges/builtins/index.js");
|
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);
|