@forgezero/agent 0.1.38 → 0.1.39
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 +37 -4
- package/dist/agent-heartbeat.d.ts +13 -0
- package/dist/agent-heartbeat.js +9 -1
- package/dist/bootstrap.d.ts +36 -4
- package/dist/bootstrap.js +516 -59
- package/dist/cli/cloudflare-bootstrap.d.ts +5 -1
- package/dist/cloudflare-bootstrap.d.ts +31 -2
- package/dist/cloudflare-bootstrap.js +168 -27
- package/dist/deployment-pull.d.ts +2 -0
- package/dist/fz-agent.js +6217 -20
- package/dist/fz.js +10766 -241
- package/dist/metal-bootstrap.d.ts +1 -0
- package/dist/metal-bootstrap.js +5 -3
- package/dist/platform-bootstrap-runtime.d.ts +0 -28
- package/dist/platform-bootstrap-runtime.js +1 -71
- package/dist/provision.js +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MetalCommandResult, type MetalProvisionProfile } from './metal-provision';
|
|
2
2
|
declare const PROFILE_PATH = "/etc/forgezero/metal.json";
|
|
3
|
+
export declare const METAL_BOOTSTRAP_STATE_PATH = "/etc/forgezero/metal.initialized.json";
|
|
3
4
|
export interface MetalBootstrapConfig {
|
|
4
5
|
kind: 'metal';
|
|
5
6
|
metalHostname: string;
|
package/dist/metal-bootstrap.js
CHANGED
|
@@ -293,11 +293,12 @@ function systemdAgentEgressDirectives(loopbackTcpPorts = []) {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
// src/version.ts
|
|
296
|
-
var VERSION = "0.1.
|
|
296
|
+
var VERSION = "0.1.39";
|
|
297
297
|
|
|
298
298
|
// src/metal-bootstrap.ts
|
|
299
299
|
var PROFILE_PATH = "/etc/forgezero/metal.json";
|
|
300
|
-
var
|
|
300
|
+
var METAL_BOOTSTRAP_STATE_PATH = "/etc/forgezero/metal.initialized.json";
|
|
301
|
+
var STATE_PATH = METAL_BOOTSTRAP_STATE_PATH;
|
|
301
302
|
var SEED_CREDENTIAL_PATH = "/etc/forgezero/creds/metal-agent-seed.cred";
|
|
302
303
|
var UNIT_DIRECTORY = "/etc/systemd/system";
|
|
303
304
|
var AGENT_PATH = "/usr/local/bin/fz-agent";
|
|
@@ -938,5 +939,6 @@ export {
|
|
|
938
939
|
planMetalBootstrap,
|
|
939
940
|
metalBootstrapStatus,
|
|
940
941
|
applyMetalBootstrap,
|
|
941
|
-
MetalBootstrapError
|
|
942
|
+
MetalBootstrapError,
|
|
943
|
+
METAL_BOOTSTRAP_STATE_PATH
|
|
942
944
|
};
|
|
@@ -131,31 +131,3 @@ export interface LocalOtlpProofPlan {
|
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
export declare function planLocalOtlpProof(endpoint: string, collectorUnit: string): LocalOtlpProofPlan;
|
|
134
|
-
export type BringupStage = 'runtime-ready' | 'invite-prepared' | 'deploy-requested' | 'deploy-healthy' | 'invite-presented' | 'complete' | 'failed';
|
|
135
|
-
export interface PlatformBringupState {
|
|
136
|
-
requiresFirstInvite: boolean;
|
|
137
|
-
stage: BringupStage;
|
|
138
|
-
inviteTokenFilePresent: boolean;
|
|
139
|
-
lastError?: string;
|
|
140
|
-
}
|
|
141
|
-
export type PlatformBringupEvent = {
|
|
142
|
-
type: 'invite-prepared';
|
|
143
|
-
tokenFilePresent: boolean;
|
|
144
|
-
} | {
|
|
145
|
-
type: 'deploy-requested';
|
|
146
|
-
} | {
|
|
147
|
-
type: 'deploy-healthy';
|
|
148
|
-
} | {
|
|
149
|
-
type: 'invite-presented';
|
|
150
|
-
} | {
|
|
151
|
-
type: 'complete';
|
|
152
|
-
} | {
|
|
153
|
-
type: 'failed';
|
|
154
|
-
error: string;
|
|
155
|
-
};
|
|
156
|
-
export declare function initialPlatformBringupState(requiresFirstInvite: boolean): PlatformBringupState;
|
|
157
|
-
/** Strict persisted sequencing: genesis invite before deploy, presentation only after health. */
|
|
158
|
-
export declare function advancePlatformBringup(state: PlatformBringupState, event: PlatformBringupEvent): PlatformBringupState;
|
|
159
|
-
export type PlatformBringupAction = 'prepare-invite' | 'request-deploy' | 'await-deploy-health' | 'present-invite' | 'mark-complete' | 'none';
|
|
160
|
-
export declare function nextPlatformBringupAction(state: PlatformBringupState): PlatformBringupAction;
|
|
161
|
-
export declare function repairPlatformBringup(state: PlatformBringupState): PlatformBringupState;
|
|
@@ -380,83 +380,13 @@ function planLocalOtlpProof(endpoint, collectorUnit) {
|
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
}
|
|
383
|
-
function initialPlatformBringupState(requiresFirstInvite) {
|
|
384
|
-
return { requiresFirstInvite, stage: "runtime-ready", inviteTokenFilePresent: false };
|
|
385
|
-
}
|
|
386
|
-
function advancePlatformBringup(state, event) {
|
|
387
|
-
if (state.stage === "failed")
|
|
388
|
-
throw new Error("A failed bring-up must be explicitly repaired before resuming.");
|
|
389
|
-
if (event.type === "failed")
|
|
390
|
-
return { ...state, stage: "failed", lastError: safeAtom("error", event.error) };
|
|
391
|
-
if (event.type === state.stage)
|
|
392
|
-
return state;
|
|
393
|
-
if (event.type === "invite-prepared") {
|
|
394
|
-
if (!state.requiresFirstInvite || state.stage !== "runtime-ready" || !event.tokenFilePresent) {
|
|
395
|
-
throw new Error("The first invite must be durably present before it is recorded.");
|
|
396
|
-
}
|
|
397
|
-
return { ...state, stage: "invite-prepared", inviteTokenFilePresent: true };
|
|
398
|
-
}
|
|
399
|
-
if (event.type === "deploy-requested") {
|
|
400
|
-
const expected = state.requiresFirstInvite ? "invite-prepared" : "runtime-ready";
|
|
401
|
-
if (state.stage !== expected || state.requiresFirstInvite && !state.inviteTokenFilePresent) {
|
|
402
|
-
throw new Error("Deployment cannot start before required invite preparation.");
|
|
403
|
-
}
|
|
404
|
-
return { ...state, stage: "deploy-requested" };
|
|
405
|
-
}
|
|
406
|
-
if (event.type === "deploy-healthy") {
|
|
407
|
-
if (state.stage !== "deploy-requested")
|
|
408
|
-
throw new Error("Deployment health requires a requested deployment.");
|
|
409
|
-
return { ...state, stage: "deploy-healthy" };
|
|
410
|
-
}
|
|
411
|
-
if (event.type === "invite-presented") {
|
|
412
|
-
if (!state.requiresFirstInvite || state.stage !== "deploy-healthy" || !state.inviteTokenFilePresent) {
|
|
413
|
-
throw new Error("Invite presentation requires a healthy deployment and the original token file.");
|
|
414
|
-
}
|
|
415
|
-
return { ...state, stage: "invite-presented" };
|
|
416
|
-
}
|
|
417
|
-
if (event.type === "complete") {
|
|
418
|
-
const expected = state.requiresFirstInvite ? "invite-presented" : "deploy-healthy";
|
|
419
|
-
if (state.stage !== expected)
|
|
420
|
-
throw new Error("Bring-up cannot complete before its ordered ceremony.");
|
|
421
|
-
return { ...state, stage: "complete" };
|
|
422
|
-
}
|
|
423
|
-
throw new Error("Unsupported bring-up transition.");
|
|
424
|
-
}
|
|
425
|
-
function nextPlatformBringupAction(state) {
|
|
426
|
-
if (state.stage === "failed" || state.stage === "complete")
|
|
427
|
-
return "none";
|
|
428
|
-
if (state.stage === "runtime-ready")
|
|
429
|
-
return state.requiresFirstInvite ? "prepare-invite" : "request-deploy";
|
|
430
|
-
if (state.stage === "invite-prepared") {
|
|
431
|
-
if (!state.inviteTokenFilePresent)
|
|
432
|
-
throw new Error("Recorded invite is missing; refusing implicit rotation.");
|
|
433
|
-
return "request-deploy";
|
|
434
|
-
}
|
|
435
|
-
if (state.stage === "deploy-requested")
|
|
436
|
-
return "await-deploy-health";
|
|
437
|
-
if (state.stage === "deploy-healthy")
|
|
438
|
-
return state.requiresFirstInvite ? "present-invite" : "mark-complete";
|
|
439
|
-
return "mark-complete";
|
|
440
|
-
}
|
|
441
|
-
function repairPlatformBringup(state) {
|
|
442
|
-
if (state.stage !== "failed")
|
|
443
|
-
return state;
|
|
444
|
-
if (state.requiresFirstInvite && !state.inviteTokenFilePresent) {
|
|
445
|
-
throw new Error("Missing issued invite cannot be repaired by implicit rotation.");
|
|
446
|
-
}
|
|
447
|
-
return { ...state, stage: state.inviteTokenFilePresent ? "invite-prepared" : "runtime-ready", lastError: undefined };
|
|
448
|
-
}
|
|
449
383
|
export {
|
|
450
384
|
validatePlatformSharedEnvironment,
|
|
451
|
-
repairPlatformBringup,
|
|
452
385
|
renderPlatformSharedEnvironment,
|
|
453
386
|
renderPlatformNginx,
|
|
454
387
|
renderPlatformApiUnits,
|
|
455
388
|
renderPlatformActivationFiles,
|
|
456
389
|
platformApiCredentialSpecs,
|
|
457
390
|
planPlatformActivation,
|
|
458
|
-
planLocalOtlpProof
|
|
459
|
-
nextPlatformBringupAction,
|
|
460
|
-
initialPlatformBringupState,
|
|
461
|
-
advancePlatformBringup
|
|
391
|
+
planLocalOtlpProof
|
|
462
392
|
};
|
package/dist/provision.js
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** One package version shared by both public binaries. Pinned to package.json by tests. */
|
|
2
|
-
export declare const VERSION = "0.1.
|
|
2
|
+
export declare const VERSION = "0.1.39";
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgezero/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"check": "tsc --noEmit",
|
|
7
7
|
"prebuild": "rm -rf dist",
|
|
8
|
-
"build": "bun build src/index.ts --outfile dist/fz-agent.js --target bun --format esm
|
|
8
|
+
"build": "bun build src/index.ts --outfile dist/fz-agent.js --target bun --format esm && bun build src/cli/index.ts --outfile dist/fz.js --target bun --format esm && bun build src/compute.ts src/provision.ts src/subscribe.ts src/pipeline.ts src/definition.ts src/deploy-file.ts src/ssh-server.ts src/ssh-listen.ts src/provisioning-pull.ts src/migration-pull.ts src/guest-enrolment.ts src/node-vault.ts src/metal-provision.ts src/metal-helper-socket.ts src/lifecycle-helper.ts src/deployment-runner.ts src/agent-update.ts src/agent-update-helper.ts src/agent-heartbeat.ts src/software.ts src/software-helper.ts src/ubuntu.ts src/capacity-calibration.ts src/platform-bootstrap-runtime.ts --root src --outdir dist --target browser --format esm --packages external && bun build src/project-context.ts src/bootstrap.ts src/metal-bootstrap.ts src/cloudflare-bootstrap.ts src/cloudflare-edge.ts --root src --outdir dist --target bun --format esm --packages external && tsc --emitDeclarationOnly --declaration --noEmit false --outDir dist",
|
|
9
9
|
"prepublishOnly": "bun run check && bun run build"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "^5.6.0",
|
|
13
13
|
"@types/bun": "latest",
|
|
14
14
|
"@types/node": "^22.0.0",
|
|
15
|
+
"@forgezero/access": "0.1.1",
|
|
15
16
|
"@noble/curves": "^2.2.0",
|
|
16
17
|
"@noble/post-quantum": "^0.6.1"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@forgezero/access": "0.1.1",
|
|
20
20
|
"@forgezero/runtime": "0.1.5",
|
|
21
21
|
"@forgezero/vault": "0.1.8",
|
|
22
22
|
"@noble/curves": "2.2.0",
|