@forgezero/agent 0.1.92 → 0.1.94

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.
@@ -917,7 +917,7 @@ async function postSignedNode(options, path, body) {
917
917
  }
918
918
 
919
919
  // src/version.ts
920
- var VERSION3 = "0.1.92";
920
+ var VERSION3 = "0.1.94";
921
921
 
922
922
  // src/agent-heartbeat.ts
923
923
  function readAgentHostMetrics() {
package/dist/bootstrap.js CHANGED
@@ -1420,7 +1420,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
1420
1420
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
1421
1421
 
1422
1422
  // src/version.ts
1423
- var VERSION = "0.1.92";
1423
+ var VERSION = "0.1.94";
1424
1424
 
1425
1425
  // src/software.ts
1426
1426
  var PINNED_BUN_VERSION = "1.3.14";
@@ -3642,7 +3642,8 @@ async function ensureForgeZeroOtelCollector(host, exportEndpoint) {
3642
3642
  host.write(CONFIG, rendered.config, 420);
3643
3643
  host.write(UNIT, rendered.unit, 420);
3644
3644
  await checked2(host, ["/usr/bin/systemctl", "daemon-reload"]);
3645
- await checked2(host, ["/usr/bin/systemctl", "enable", "--now", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3645
+ await checked2(host, ["/usr/bin/systemctl", "enable", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3646
+ await checked2(host, ["/usr/bin/systemctl", "restart", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3646
3647
  let ready = false;
3647
3648
  for (let attempt = 0;attempt < 100; attempt += 1) {
3648
3649
  const probe = await host.exec([
package/dist/fz-agent.js CHANGED
@@ -9496,7 +9496,7 @@ async function writeAndCloseProcessInput(input, value) {
9496
9496
  }
9497
9497
 
9498
9498
  // src/version.ts
9499
- var VERSION2 = "0.1.92";
9499
+ var VERSION2 = "0.1.94";
9500
9500
 
9501
9501
  // src/ssh-bootstrap.ts
9502
9502
  class SshBootstrapError extends Error {
package/dist/fz.js CHANGED
@@ -4810,7 +4810,8 @@ async function spawnWith(command, env, report = () => {}, options = {}) {
4810
4810
  }
4811
4811
 
4812
4812
  // src/cli/index.ts
4813
- import { existsSync as existsSync13, lstatSync as lstatSync10, mkdirSync as mkdirSync13, readFileSync as readFileSync16, writeFileSync as writeFileSync13 } from "fs";
4813
+ import { existsSync as existsSync13, lstatSync as lstatSync10, mkdirSync as mkdirSync13, readFileSync as readFileSync16, renameSync as renameSync10, rmSync as rmSync8, writeFileSync as writeFileSync13 } from "fs";
4814
+ import { randomBytes as randomBytes10 } from "crypto";
4814
4815
  import { basename as basename3, dirname as dirname14, isAbsolute as isAbsolute7, join as join13, resolve as resolve12 } from "path";
4815
4816
 
4816
4817
  // src/process-input.ts
@@ -4840,7 +4841,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
4840
4841
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
4841
4842
 
4842
4843
  // src/version.ts
4843
- var VERSION2 = "0.1.92";
4844
+ var VERSION2 = "0.1.94";
4844
4845
 
4845
4846
  // src/software.ts
4846
4847
  var PINNED_BUN_VERSION = "1.3.14";
@@ -13868,7 +13869,8 @@ async function ensureForgeZeroOtelCollector(host, exportEndpoint) {
13868
13869
  host.write(CONFIG, rendered.config, 420);
13869
13870
  host.write(UNIT, rendered.unit, 420);
13870
13871
  await checked(host, ["/usr/bin/systemctl", "daemon-reload"]);
13871
- await checked(host, ["/usr/bin/systemctl", "enable", "--now", FORGEZERO_OTEL_COLLECTOR_UNIT]);
13872
+ await checked(host, ["/usr/bin/systemctl", "enable", FORGEZERO_OTEL_COLLECTOR_UNIT]);
13873
+ await checked(host, ["/usr/bin/systemctl", "restart", FORGEZERO_OTEL_COLLECTOR_UNIT]);
13872
13874
  let ready = false;
13873
13875
  for (let attempt = 0;attempt < 100; attempt += 1) {
13874
13876
  const probe = await host.exec([
@@ -19440,6 +19442,17 @@ function writeMetalOperatorFiles(directory) {
19440
19442
  });
19441
19443
  return { metalConfig, remoteRequest };
19442
19444
  }
19445
+ function writeDerivedLaunchFile(path, write) {
19446
+ const temporary = `${path}.next.${process.pid}.${randomBytes10(6).toString("hex")}`;
19447
+ try {
19448
+ write(temporary);
19449
+ renameSync10(temporary, path);
19450
+ return path;
19451
+ } catch (cause) {
19452
+ rmSync8(temporary, { force: true });
19453
+ throw cause;
19454
+ }
19455
+ }
19443
19456
  function writePlatformGenesisFleet(directory, preset) {
19444
19457
  const output = genesisOutputDirectory(directory);
19445
19458
  const metalRequestFile = preset?.metalRequestFile ?? bootstrapAnswer("Owner-only metal remote request containing the reviewed genesis guests");
@@ -19462,7 +19475,8 @@ function writePlatformGenesisFleet(directory, preset) {
19462
19475
  cloudflareHandoffFile: cloudflareHostHandoffPath(checkpointPath, guest.name)
19463
19476
  }));
19464
19477
  const realtimeEnabled = preset ? true : bootstrapBoolean("Configure existing Worker realtime fan-out?", "yes");
19465
- const cloudflareConfig = writeBootstrapConfig(join13(output, "cloudflare.json"), createCloudflareBootstrapDiscoveryCommandConfig({
19478
+ const cloudflareConfigPath = join13(output, "cloudflare.json");
19479
+ const cloudflareConfigValue = createCloudflareBootstrapDiscoveryCommandConfig({
19466
19480
  checkpointPath,
19467
19481
  discovery: {
19468
19482
  zoneName: preset?.profile.zoneName ?? bootstrapAnswer("Cloudflare DNS zone name", "forgezero.net"),
@@ -19479,7 +19493,8 @@ function writePlatformGenesisFleet(directory, preset) {
19479
19493
  service: "http://127.0.0.1:3000",
19480
19494
  tunnelName: preset ? guest.name : bootstrapAnswer(`${guest.name} Tunnel name`, guest.name)
19481
19495
  }))
19482
- }));
19496
+ });
19497
+ const cloudflareConfig = preset ? writeDerivedLaunchFile(cloudflareConfigPath, (path) => writeBootstrapConfig(path, cloudflareConfigValue)) : writeBootstrapConfig(cloudflareConfigPath, cloudflareConfigValue);
19483
19498
  const cloudflareAcceptance = join13(output, "cloudflare-acceptance.json");
19484
19499
  const configs = platformGenesisBootstrapConfigs(template, fleet, nodes, metalHostname, region, preset ? {
19485
19500
  source: "bootstrap-bundle",
@@ -19488,13 +19503,17 @@ function writePlatformGenesisFleet(directory, preset) {
19488
19503
  bundleSha256: preset.bundle.manifest.sha256
19489
19504
  } : undefined).map((config) => {
19490
19505
  const path = `${output}/${config.computeReference}-platform.json`;
19491
- writeBootstrapConfig(path, config);
19506
+ if (preset)
19507
+ writeDerivedLaunchFile(path, (temporary) => writeBootstrapConfig(temporary, config));
19508
+ else
19509
+ writeBootstrapConfig(path, config);
19492
19510
  return path;
19493
19511
  });
19494
19512
  const requests = configs.map((platformConfigFile, index) => {
19495
19513
  const guest = fleet[index];
19496
19514
  const host = guestHostKeys.nodes.find(({ name }) => name === guest.name);
19497
- return writeOperatorPlatformBootstrapRequest(join13(output, `${guest.name}-remote.json`), {
19515
+ const path = join13(output, `${guest.name}-remote.json`);
19516
+ const request = {
19498
19517
  kind: "platform-remote",
19499
19518
  platformConfigFile,
19500
19519
  target: {
@@ -19513,9 +19532,12 @@ function writePlatformGenesisFleet(directory, preset) {
19513
19532
  hostKeySha256: metalRequest.target.hostKeySha256
19514
19533
  }
19515
19534
  }
19516
- });
19535
+ };
19536
+ return preset ? writeDerivedLaunchFile(path, (temporary) => writeOperatorPlatformBootstrapRequest(temporary, request)) : writeOperatorPlatformBootstrapRequest(path, request);
19517
19537
  });
19518
- const fleetRequest = writeOperatorPlatformBootstrapFleetRequest(join13(output, "platform-fleet-remote.json"), requests, { configFile: cloudflareConfig, acceptanceFile: cloudflareAcceptance });
19538
+ const fleetPath = join13(output, "platform-fleet-remote.json");
19539
+ const writeFleet = (path) => writeOperatorPlatformBootstrapFleetRequest(path, requests, { configFile: cloudflareConfig, acceptanceFile: cloudflareAcceptance });
19540
+ const fleetRequest = preset ? writeDerivedLaunchFile(fleetPath, writeFleet) : writeFleet(fleetPath);
19519
19541
  return { configs, requests, fleetRequest, cloudflareConfig, cloudflareAcceptance };
19520
19542
  }
19521
19543
  function selectedForgeZeroLaunchEnvironment(value) {
@@ -19777,8 +19799,7 @@ async function cmdBootstrap(options, args) {
19777
19799
  }
19778
19800
  const outputDirectory = options.outputPath ?? join13(homedir2(), ".forgezero-secure", environment, "genesis");
19779
19801
  const environmentInput = options.bootstrapSecretsEnvFile ? readPlatformLaunchEnvironment(options.bootstrapSecretsEnvFile) : undefined;
19780
- const existingFleetPath = join13(outputDirectory, "platform-fleet-remote.json");
19781
- const fleet = existsSync13(existingFleetPath) ? readOperatorPlatformBootstrapFleetRequest(existingFleetPath) : readOperatorPlatformBootstrapFleetRequest((await prepareForgeZeroPlatformLaunch(environment, outputDirectory, options.projectRoot, environmentInput?.owner)).fleetRequest);
19802
+ const fleet = readOperatorPlatformBootstrapFleetRequest((await prepareForgeZeroPlatformLaunch(environment, outputDirectory, options.projectRoot, environmentInput?.owner)).fleetRequest);
19782
19803
  if (planOperatorPlatformFleetBootstrap(fleet, "apply").environment !== environment) {
19783
19804
  throw new Error("existing platform fleet does not match the selected launch profile");
19784
19805
  }
@@ -366,7 +366,7 @@ function systemdAgentEgressDirectives(loopbackTcpPorts = []) {
366
366
  }
367
367
 
368
368
  // src/version.ts
369
- var VERSION = "0.1.92";
369
+ var VERSION = "0.1.94";
370
370
 
371
371
  // src/otel-collector.ts
372
372
  var FORGEZERO_OTEL_COLLECTOR_UNIT = "forgezero-otel-collector.service";
@@ -499,7 +499,8 @@ async function ensureForgeZeroOtelCollector(host, exportEndpoint) {
499
499
  host.write(CONFIG, rendered.config, 420);
500
500
  host.write(UNIT, rendered.unit, 420);
501
501
  await checked2(host, ["/usr/bin/systemctl", "daemon-reload"]);
502
- await checked2(host, ["/usr/bin/systemctl", "enable", "--now", FORGEZERO_OTEL_COLLECTOR_UNIT]);
502
+ await checked2(host, ["/usr/bin/systemctl", "enable", FORGEZERO_OTEL_COLLECTOR_UNIT]);
503
+ await checked2(host, ["/usr/bin/systemctl", "restart", FORGEZERO_OTEL_COLLECTOR_UNIT]);
503
504
  let ready = false;
504
505
  for (let attempt = 0;attempt < 100; attempt += 1) {
505
506
  const probe = await host.exec([
@@ -1420,7 +1420,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
1420
1420
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
1421
1421
 
1422
1422
  // src/version.ts
1423
- var VERSION = "0.1.92";
1423
+ var VERSION = "0.1.94";
1424
1424
 
1425
1425
  // src/software.ts
1426
1426
  var PINNED_BUN_VERSION = "1.3.14";
@@ -3642,7 +3642,8 @@ async function ensureForgeZeroOtelCollector(host, exportEndpoint) {
3642
3642
  host.write(CONFIG, rendered.config, 420);
3643
3643
  host.write(UNIT, rendered.unit, 420);
3644
3644
  await checked2(host, ["/usr/bin/systemctl", "daemon-reload"]);
3645
- await checked2(host, ["/usr/bin/systemctl", "enable", "--now", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3645
+ await checked2(host, ["/usr/bin/systemctl", "enable", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3646
+ await checked2(host, ["/usr/bin/systemctl", "restart", FORGEZERO_OTEL_COLLECTOR_UNIT]);
3646
3647
  let ready = false;
3647
3648
  for (let attempt = 0;attempt < 100; attempt += 1) {
3648
3649
  const probe = await host.exec([
@@ -2908,7 +2908,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
2908
2908
  }
2909
2909
 
2910
2910
  // src/version.ts
2911
- var VERSION3 = "0.1.92";
2911
+ var VERSION3 = "0.1.94";
2912
2912
 
2913
2913
  // src/egress-policy.ts
2914
2914
  import { realpathSync as realpathSync3 } from "node:fs";
package/dist/provision.js CHANGED
@@ -2908,7 +2908,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
2908
2908
  }
2909
2909
 
2910
2910
  // src/version.ts
2911
- var VERSION3 = "0.1.92";
2911
+ var VERSION3 = "0.1.94";
2912
2912
 
2913
2913
  // src/egress-policy.ts
2914
2914
  import { realpathSync as realpathSync3 } from "node:fs";
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.92";
2
+ export declare const VERSION = "0.1.94";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgezero/agent",
3
- "version": "0.1.92",
3
+ "version": "0.1.94",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",