@forgezero/agent 0.1.46 → 0.1.48

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.
@@ -749,7 +749,7 @@ async function postSignedNode(options, path, body) {
749
749
  }
750
750
 
751
751
  // src/version.ts
752
- var VERSION3 = "0.1.46";
752
+ var VERSION3 = "0.1.48";
753
753
 
754
754
  // src/agent-heartbeat.ts
755
755
  var unquote = (value) => value.replace(/^['"]|['"]$/g, "");
package/dist/bootstrap.js CHANGED
@@ -1207,7 +1207,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
1207
1207
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
1208
1208
 
1209
1209
  // src/version.ts
1210
- var VERSION = "0.1.46";
1210
+ var VERSION = "0.1.48";
1211
1211
 
1212
1212
  // src/software.ts
1213
1213
  var PINNED_BUN_VERSION = "1.3.14";
package/dist/fz-agent.js CHANGED
@@ -7000,7 +7000,7 @@ function assertSupportedGuestImage(imageKey) {
7000
7000
  }
7001
7001
 
7002
7002
  // src/version.ts
7003
- var VERSION = "0.1.46";
7003
+ var VERSION = "0.1.48";
7004
7004
 
7005
7005
  // src/ssh-bootstrap.ts
7006
7006
  class SshBootstrapError extends Error {
package/dist/fz.js CHANGED
@@ -4830,7 +4830,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
4830
4830
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
4831
4831
 
4832
4832
  // src/version.ts
4833
- var VERSION2 = "0.1.46";
4833
+ var VERSION2 = "0.1.48";
4834
4834
 
4835
4835
  // src/software.ts
4836
4836
  var PINNED_BUN_VERSION = "1.3.14";
@@ -13634,6 +13634,23 @@ var SUPPORTED_BUN_RELEASE_SHA256 = "951ee2aee855f08595aeec6225226a298d3fea83a3dc
13634
13634
 
13635
13635
  class MetalBootstrapError extends Error {
13636
13636
  }
13637
+ function normalizeMetalPublicIdentity(value) {
13638
+ let parsed;
13639
+ try {
13640
+ parsed = JSON.parse(value);
13641
+ } catch {
13642
+ throw new MetalBootstrapError("metal public identity proof was invalid");
13643
+ }
13644
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
13645
+ throw new MetalBootstrapError("metal public identity proof was invalid");
13646
+ }
13647
+ const identity = parsed;
13648
+ const keys = identity.publicKeys;
13649
+ if (Object.keys(identity).some((key) => !["nodeKey", "publicKeys"].includes(key)) || typeof identity.nodeKey !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(identity.nodeKey) || !keys || Object.keys(keys).some((key) => !["ed25519", "mlDsa"].includes(key)) || keys.ed25519 !== identity.nodeKey || typeof keys.mlDsa !== "string" || !/^[A-Za-z0-9_-]{1,8192}$/.test(keys.mlDsa)) {
13650
+ throw new MetalBootstrapError("metal public identity proof was invalid");
13651
+ }
13652
+ return JSON.stringify(parsed);
13653
+ }
13637
13654
  var defaultExec2 = async (argv2, stdin) => {
13638
13655
  const child = Bun.spawn([...argv2], {
13639
13656
  stdin: stdin === undefined ? undefined : new Blob([stdin]),
@@ -14129,6 +14146,14 @@ async function applyMetalBootstrap(config, options) {
14129
14146
  "forgezero-metal-agent-egress.service",
14130
14147
  "forgezero-metal-agent.service"
14131
14148
  ]);
14149
+ await runChecked(exec, [
14150
+ "/usr/bin/systemctl",
14151
+ "restart",
14152
+ "forgezero-agent-update-helper.service",
14153
+ "forgezero-metal-helper.service",
14154
+ "forgezero-metal-agent-egress.service",
14155
+ "forgezero-metal-agent.service"
14156
+ ]);
14132
14157
  for (let attempt = 0;attempt < 100 && (!socketReady(HELPER_SOCKET) || !socketReady(UPDATE_SOCKET)); attempt += 1) {
14133
14158
  await Bun.sleep(100);
14134
14159
  }
@@ -14147,9 +14172,7 @@ async function applyMetalBootstrap(config, options) {
14147
14172
  AGENT_PATH,
14148
14173
  "identity"
14149
14174
  ]);
14150
- const publicIdentity = identity.stdout.trim();
14151
- if (!publicIdentity || /[\r\n]/.test(publicIdentity))
14152
- throw new MetalBootstrapError("metal public identity proof was invalid");
14175
+ const publicIdentity = normalizeMetalPublicIdentity(identity.stdout.trim());
14153
14176
  const state = {
14154
14177
  initializedAt: new Date().toISOString(),
14155
14178
  role: "metal",
@@ -42,6 +42,7 @@ export interface MetalBootstrapApplyOptions {
42
42
  }
43
43
  export declare class MetalBootstrapError extends Error {
44
44
  }
45
+ export declare function normalizeMetalPublicIdentity(value: string): string;
45
46
  export declare function validateMetalBootstrapConfig(config: MetalBootstrapConfig): MetalBootstrapConfig;
46
47
  /** Reject symlinks and group/world access before parsing coordinates or entropy. */
47
48
  export declare function validateOwnerOnlyPath(path: string, requireRootOwner: boolean): void;
@@ -292,7 +292,7 @@ function systemdAgentEgressDirectives(loopbackTcpPorts = []) {
292
292
  }
293
293
 
294
294
  // src/version.ts
295
- var VERSION = "0.1.46";
295
+ var VERSION = "0.1.48";
296
296
 
297
297
  // src/otel-collector.ts
298
298
  var FORGEZERO_OTEL_COLLECTOR_UNIT = "forgezero-otel-collector.service";
@@ -466,6 +466,23 @@ var SUPPORTED_BUN_RELEASE_SHA256 = "951ee2aee855f08595aeec6225226a298d3fea83a3dc
466
466
 
467
467
  class MetalBootstrapError extends Error {
468
468
  }
469
+ function normalizeMetalPublicIdentity(value) {
470
+ let parsed;
471
+ try {
472
+ parsed = JSON.parse(value);
473
+ } catch {
474
+ throw new MetalBootstrapError("metal public identity proof was invalid");
475
+ }
476
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
477
+ throw new MetalBootstrapError("metal public identity proof was invalid");
478
+ }
479
+ const identity = parsed;
480
+ const keys = identity.publicKeys;
481
+ if (Object.keys(identity).some((key) => !["nodeKey", "publicKeys"].includes(key)) || typeof identity.nodeKey !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(identity.nodeKey) || !keys || Object.keys(keys).some((key) => !["ed25519", "mlDsa"].includes(key)) || keys.ed25519 !== identity.nodeKey || typeof keys.mlDsa !== "string" || !/^[A-Za-z0-9_-]{1,8192}$/.test(keys.mlDsa)) {
482
+ throw new MetalBootstrapError("metal public identity proof was invalid");
483
+ }
484
+ return JSON.stringify(parsed);
485
+ }
469
486
  var defaultExec2 = async (argv, stdin) => {
470
487
  const child = Bun.spawn([...argv], {
471
488
  stdin: stdin === undefined ? undefined : new Blob([stdin]),
@@ -961,6 +978,14 @@ async function applyMetalBootstrap(config, options) {
961
978
  "forgezero-metal-agent-egress.service",
962
979
  "forgezero-metal-agent.service"
963
980
  ]);
981
+ await runChecked(exec, [
982
+ "/usr/bin/systemctl",
983
+ "restart",
984
+ "forgezero-agent-update-helper.service",
985
+ "forgezero-metal-helper.service",
986
+ "forgezero-metal-agent-egress.service",
987
+ "forgezero-metal-agent.service"
988
+ ]);
964
989
  for (let attempt = 0;attempt < 100 && (!socketReady(HELPER_SOCKET) || !socketReady(UPDATE_SOCKET)); attempt += 1) {
965
990
  await Bun.sleep(100);
966
991
  }
@@ -979,9 +1004,7 @@ async function applyMetalBootstrap(config, options) {
979
1004
  AGENT_PATH,
980
1005
  "identity"
981
1006
  ]);
982
- const publicIdentity = identity.stdout.trim();
983
- if (!publicIdentity || /[\r\n]/.test(publicIdentity))
984
- throw new MetalBootstrapError("metal public identity proof was invalid");
1007
+ const publicIdentity = normalizeMetalPublicIdentity(identity.stdout.trim());
985
1008
  const state = {
986
1009
  initializedAt: new Date().toISOString(),
987
1010
  role: "metal",
@@ -1102,6 +1125,7 @@ export {
1102
1125
  renderMetalUnits,
1103
1126
  readMetalBootstrapConfig,
1104
1127
  planMetalBootstrap,
1128
+ normalizeMetalPublicIdentity,
1105
1129
  metalBootstrapStatus,
1106
1130
  applyMetalBootstrap,
1107
1131
  MetalBootstrapError,
@@ -1207,7 +1207,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
1207
1207
  var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
1208
1208
 
1209
1209
  // src/version.ts
1210
- var VERSION = "0.1.46";
1210
+ var VERSION = "0.1.48";
1211
1211
 
1212
1212
  // src/software.ts
1213
1213
  var PINNED_BUN_VERSION = "1.3.14";
@@ -4538,6 +4538,23 @@ var SUPPORTED_BUN_RELEASE_SHA256 = "951ee2aee855f08595aeec6225226a298d3fea83a3dc
4538
4538
 
4539
4539
  class MetalBootstrapError extends Error {
4540
4540
  }
4541
+ function normalizeMetalPublicIdentity(value) {
4542
+ let parsed;
4543
+ try {
4544
+ parsed = JSON.parse(value);
4545
+ } catch {
4546
+ throw new MetalBootstrapError("metal public identity proof was invalid");
4547
+ }
4548
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
4549
+ throw new MetalBootstrapError("metal public identity proof was invalid");
4550
+ }
4551
+ const identity = parsed;
4552
+ const keys = identity.publicKeys;
4553
+ if (Object.keys(identity).some((key) => !["nodeKey", "publicKeys"].includes(key)) || typeof identity.nodeKey !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(identity.nodeKey) || !keys || Object.keys(keys).some((key) => !["ed25519", "mlDsa"].includes(key)) || keys.ed25519 !== identity.nodeKey || typeof keys.mlDsa !== "string" || !/^[A-Za-z0-9_-]{1,8192}$/.test(keys.mlDsa)) {
4554
+ throw new MetalBootstrapError("metal public identity proof was invalid");
4555
+ }
4556
+ return JSON.stringify(parsed);
4557
+ }
4541
4558
  var defaultExec2 = async (argv, stdin) => {
4542
4559
  const child = Bun.spawn([...argv], {
4543
4560
  stdin: stdin === undefined ? undefined : new Blob([stdin]),
@@ -5033,6 +5050,14 @@ async function applyMetalBootstrap(config, options) {
5033
5050
  "forgezero-metal-agent-egress.service",
5034
5051
  "forgezero-metal-agent.service"
5035
5052
  ]);
5053
+ await runChecked(exec, [
5054
+ "/usr/bin/systemctl",
5055
+ "restart",
5056
+ "forgezero-agent-update-helper.service",
5057
+ "forgezero-metal-helper.service",
5058
+ "forgezero-metal-agent-egress.service",
5059
+ "forgezero-metal-agent.service"
5060
+ ]);
5036
5061
  for (let attempt = 0;attempt < 100 && (!socketReady(HELPER_SOCKET) || !socketReady(UPDATE_SOCKET)); attempt += 1) {
5037
5062
  await Bun.sleep(100);
5038
5063
  }
@@ -5051,9 +5076,7 @@ async function applyMetalBootstrap(config, options) {
5051
5076
  AGENT_PATH,
5052
5077
  "identity"
5053
5078
  ]);
5054
- const publicIdentity = identity.stdout.trim();
5055
- if (!publicIdentity || /[\r\n]/.test(publicIdentity))
5056
- throw new MetalBootstrapError("metal public identity proof was invalid");
5079
+ const publicIdentity = normalizeMetalPublicIdentity(identity.stdout.trim());
5057
5080
  const state = {
5058
5081
  initializedAt: new Date().toISOString(),
5059
5082
  role: "metal",
@@ -1697,7 +1697,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
1697
1697
  }
1698
1698
 
1699
1699
  // src/version.ts
1700
- var VERSION3 = "0.1.46";
1700
+ var VERSION3 = "0.1.48";
1701
1701
 
1702
1702
  // src/egress-policy.ts
1703
1703
  import { realpathSync as realpathSync2 } from "node:fs";
package/dist/provision.js CHANGED
@@ -1697,7 +1697,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
1697
1697
  }
1698
1698
 
1699
1699
  // src/version.ts
1700
- var VERSION3 = "0.1.46";
1700
+ var VERSION3 = "0.1.48";
1701
1701
 
1702
1702
  // src/egress-policy.ts
1703
1703
  import { realpathSync as realpathSync2 } 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.46";
2
+ export declare const VERSION = "0.1.48";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgezero/agent",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",