@forgezero/agent 0.1.75 → 0.1.77
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/dist/agent-heartbeat.js +1 -1
- package/dist/bootstrap.js +10 -7
- package/dist/community-rehearsal-host.js +10 -4
- package/dist/deployment-connectivity.js +9 -2
- package/dist/fz-agent.js +36 -22
- package/dist/fz.js +15 -12
- package/dist/metal-bootstrap.js +1 -1
- package/dist/operator-bootstrap.js +11 -9
- package/dist/platform-fleet-verification.js +13 -9
- package/dist/process-input.d.ts +11 -0
- package/dist/provision.js +10 -3
- package/dist/software-helper.js +9 -2
- package/dist/stdin.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/agent-heartbeat.js
CHANGED
package/dist/bootstrap.js
CHANGED
|
@@ -1416,7 +1416,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
|
|
|
1416
1416
|
var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
|
|
1417
1417
|
|
|
1418
1418
|
// src/version.ts
|
|
1419
|
-
var VERSION = "0.1.
|
|
1419
|
+
var VERSION = "0.1.77";
|
|
1420
1420
|
|
|
1421
1421
|
// src/software.ts
|
|
1422
1422
|
var PINNED_BUN_VERSION = "1.3.14";
|
|
@@ -1549,6 +1549,12 @@ var defaultHost2 = {
|
|
|
1549
1549
|
now: Date.now
|
|
1550
1550
|
};
|
|
1551
1551
|
|
|
1552
|
+
// src/process-input.ts
|
|
1553
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
1554
|
+
input.write(value);
|
|
1555
|
+
await input.end();
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1552
1558
|
// src/software-helper.ts
|
|
1553
1559
|
var DEFAULT_SOFTWARE_HELPER_SOCKET = "/run/forgezero-software/helper.sock";
|
|
1554
1560
|
var SOFTWARE_HELPER_GROUP = "forgezero-software";
|
|
@@ -2575,10 +2581,8 @@ var fixed = async (argv, stdin) => {
|
|
|
2575
2581
|
stderr: "pipe",
|
|
2576
2582
|
env: { PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C", DEBIAN_FRONTEND: "noninteractive" }
|
|
2577
2583
|
});
|
|
2578
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
2579
|
-
child.stdin
|
|
2580
|
-
child.stdin.end();
|
|
2581
|
-
}
|
|
2584
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
2585
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
2582
2586
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
2583
2587
|
new Response(child.stdout).text(),
|
|
2584
2588
|
new Response(child.stderr).text(),
|
|
@@ -4874,8 +4878,7 @@ function localBootstrapHost() {
|
|
|
4874
4878
|
const execute = async (argv, options = {}) => {
|
|
4875
4879
|
const child = Bun.spawn([...argv], { stdin: options.stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
4876
4880
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
4877
|
-
child.stdin
|
|
4878
|
-
child.stdin.end();
|
|
4881
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
4879
4882
|
}
|
|
4880
4883
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
4881
4884
|
new Response(child.stdout).text(),
|
|
@@ -521,6 +521,14 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
521
521
|
import { lstatSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync as rmSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
522
522
|
import { isIP } from "node:net";
|
|
523
523
|
import { dirname as dirname2 } from "node:path";
|
|
524
|
+
|
|
525
|
+
// src/process-input.ts
|
|
526
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
527
|
+
input.write(value);
|
|
528
|
+
await input.end();
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// src/community-rehearsal-host.ts
|
|
524
532
|
var COMMUNITY_REHEARSAL_VERSION = "3.11.14";
|
|
525
533
|
var COMMUNITY_REHEARSAL_ROOT = "/opt/forgezero-rehearsals/community-cluster-api";
|
|
526
534
|
var COMMUNITY_DATABASE_ROOT = "/var/lib/forgezero-rehearsal-cluster";
|
|
@@ -722,10 +730,8 @@ function planCommunityRehearsalCleanup() {
|
|
|
722
730
|
}
|
|
723
731
|
async function exec(argv, stdin) {
|
|
724
732
|
const child = Bun.spawn([...argv], { stdin: stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
725
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
726
|
-
child.stdin
|
|
727
|
-
child.stdin.end();
|
|
728
|
-
}
|
|
733
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
734
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
729
735
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
730
736
|
new Response(child.stdout).text(),
|
|
731
737
|
new Response(child.stderr).text(),
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname } from "node:path";
|
|
5
|
+
|
|
6
|
+
// src/process-input.ts
|
|
7
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
8
|
+
input.write(value);
|
|
9
|
+
await input.end();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/deployment-connectivity.ts
|
|
5
13
|
var TOKEN = /^[A-Za-z0-9._-]{40,16384}$/;
|
|
6
14
|
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
7
15
|
var HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
@@ -22,8 +30,7 @@ async function sealWithSystemd(name, path, value) {
|
|
|
22
30
|
stderr: "pipe",
|
|
23
31
|
env: { PATH: "/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C" }
|
|
24
32
|
});
|
|
25
|
-
child.stdin
|
|
26
|
-
child.stdin.end();
|
|
33
|
+
await writeAndCloseProcessInput(child.stdin, value);
|
|
27
34
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
28
35
|
new Response(child.stdout).text(),
|
|
29
36
|
new Response(child.stderr).text(),
|
package/dist/fz-agent.js
CHANGED
|
@@ -9186,8 +9186,14 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
9186
9186
|
import { join as join3 } from "path";
|
|
9187
9187
|
import { fileURLToPath } from "url";
|
|
9188
9188
|
|
|
9189
|
+
// src/process-input.ts
|
|
9190
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
9191
|
+
input.write(value);
|
|
9192
|
+
await input.end();
|
|
9193
|
+
}
|
|
9194
|
+
|
|
9189
9195
|
// src/version.ts
|
|
9190
|
-
var VERSION2 = "0.1.
|
|
9196
|
+
var VERSION2 = "0.1.77";
|
|
9191
9197
|
|
|
9192
9198
|
// src/ssh-bootstrap.ts
|
|
9193
9199
|
class SshBootstrapError extends Error {
|
|
@@ -9205,8 +9211,7 @@ var defaultExec = async (argv2, options = {}) => {
|
|
|
9205
9211
|
env: { PATH: process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin", LANG: "C", LC_ALL: "C" }
|
|
9206
9212
|
});
|
|
9207
9213
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
9208
|
-
child.stdin
|
|
9209
|
-
child.stdin.end();
|
|
9214
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
9210
9215
|
}
|
|
9211
9216
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
9212
9217
|
new Response(child.stdout).text(),
|
|
@@ -12854,8 +12859,7 @@ async function sealWithSystemd(name, path2, value) {
|
|
|
12854
12859
|
stderr: "pipe",
|
|
12855
12860
|
env: { PATH: "/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C" }
|
|
12856
12861
|
});
|
|
12857
|
-
child.stdin
|
|
12858
|
-
child.stdin.end();
|
|
12862
|
+
await writeAndCloseProcessInput(child.stdin, value);
|
|
12859
12863
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
12860
12864
|
new Response(child.stdout).text(),
|
|
12861
12865
|
new Response(child.stderr).text(),
|
|
@@ -15383,10 +15387,8 @@ var fixed = async (argv2, stdin) => {
|
|
|
15383
15387
|
stderr: "pipe",
|
|
15384
15388
|
env: { PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C", DEBIAN_FRONTEND: "noninteractive" }
|
|
15385
15389
|
});
|
|
15386
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
15387
|
-
child.stdin
|
|
15388
|
-
child.stdin.end();
|
|
15389
|
-
}
|
|
15390
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
15391
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
15390
15392
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
15391
15393
|
new Response(child.stdout).text(),
|
|
15392
15394
|
new Response(child.stderr).text(),
|
|
@@ -15901,8 +15903,7 @@ function localBootstrapHost() {
|
|
|
15901
15903
|
const execute3 = async (argv2, options = {}) => {
|
|
15902
15904
|
const child = Bun.spawn([...argv2], { stdin: options.stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
15903
15905
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
15904
|
-
child.stdin
|
|
15905
|
-
child.stdin.end();
|
|
15906
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
15906
15907
|
}
|
|
15907
15908
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
15908
15909
|
new Response(child.stdout).text(),
|
|
@@ -16233,10 +16234,8 @@ function planCommunityRehearsalCleanup() {
|
|
|
16233
16234
|
}
|
|
16234
16235
|
async function exec(argv2, stdin) {
|
|
16235
16236
|
const child = Bun.spawn([...argv2], { stdin: stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
16236
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
16237
|
-
child.stdin
|
|
16238
|
-
child.stdin.end();
|
|
16239
|
-
}
|
|
16237
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
16238
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
16240
16239
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
16241
16240
|
new Response(child.stdout).text(),
|
|
16242
16241
|
new Response(child.stderr).text(),
|
|
@@ -16395,6 +16394,25 @@ async function runSupervisedApp(path2) {
|
|
|
16395
16394
|
}
|
|
16396
16395
|
}
|
|
16397
16396
|
|
|
16397
|
+
// src/stdin.ts
|
|
16398
|
+
async function readBoundedStdin(maxBytes) {
|
|
16399
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
16400
|
+
throw new Error("stdin byte limit must be a positive safe integer");
|
|
16401
|
+
}
|
|
16402
|
+
if (process.stdin.isTTY)
|
|
16403
|
+
throw new Error("stdin request pipe is required");
|
|
16404
|
+
const chunks = [];
|
|
16405
|
+
let bytes = 0;
|
|
16406
|
+
for await (const value of process.stdin) {
|
|
16407
|
+
const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
16408
|
+
bytes += chunk.byteLength;
|
|
16409
|
+
if (bytes > maxBytes)
|
|
16410
|
+
throw new Error(`stdin request exceeds ${maxBytes} bytes`);
|
|
16411
|
+
chunks.push(chunk);
|
|
16412
|
+
}
|
|
16413
|
+
return Buffer.concat(chunks, bytes).toString("utf8");
|
|
16414
|
+
}
|
|
16415
|
+
|
|
16398
16416
|
// src/index.ts
|
|
16399
16417
|
function agentCommandArgs(args, command3) {
|
|
16400
16418
|
const index = args.indexOf(command3);
|
|
@@ -16893,7 +16911,7 @@ if (import.meta.main) {
|
|
|
16893
16911
|
if (claimArg !== "-" && !claimArg.startsWith("/")) {
|
|
16894
16912
|
throw new Error("metal-apply claim path must be absolute");
|
|
16895
16913
|
}
|
|
16896
|
-
const raw =
|
|
16914
|
+
const raw = claimArg === "-" ? await readBoundedStdin(32 * 1024) : readFileSync20(claimArg, "utf8");
|
|
16897
16915
|
if (Buffer.byteLength(raw) > 32 * 1024)
|
|
16898
16916
|
throw new Error("metal-apply claim exceeds 32 KiB");
|
|
16899
16917
|
const claim = JSON.parse(raw);
|
|
@@ -16918,9 +16936,7 @@ if (import.meta.main) {
|
|
|
16918
16936
|
if (commandArgs.length !== 1 || commandArgs[0] !== "--request=-") {
|
|
16919
16937
|
throw new Error("community-rehearsal requires exactly --request=-");
|
|
16920
16938
|
}
|
|
16921
|
-
const raw =
|
|
16922
|
-
if (Buffer.byteLength(raw) > 128 * 1024)
|
|
16923
|
-
throw new Error("community rehearsal request exceeds 128 KiB");
|
|
16939
|
+
const raw = await readBoundedStdin(128 * 1024);
|
|
16924
16940
|
const request = parseCommunityRehearsalHostRequest(JSON.parse(raw));
|
|
16925
16941
|
console.log(JSON.stringify(await runCommunityRehearsalHost(request)));
|
|
16926
16942
|
process.exit(0);
|
|
@@ -16929,9 +16945,7 @@ if (import.meta.main) {
|
|
|
16929
16945
|
if (args.length !== 1 || args[0] !== "--request=-") {
|
|
16930
16946
|
throw new Error("metal-admission-proof requires exactly --request=-");
|
|
16931
16947
|
}
|
|
16932
|
-
const raw =
|
|
16933
|
-
if (Buffer.byteLength(raw) > 32 * 1024)
|
|
16934
|
-
throw new Error("metal admission proof request exceeds 32 KiB");
|
|
16948
|
+
const raw = await readBoundedStdin(32 * 1024);
|
|
16935
16949
|
const request = JSON.parse(raw);
|
|
16936
16950
|
if (!/^[A-Za-z0-9_-]{1,64}$/.test(request.jobKey) || !/^[A-Za-z0-9_-]{1,64}$/.test(request.tenantKey) || !/^[A-Za-z0-9_-]{1,64}$/.test(request.projectKey) || !/^[a-z0-9][a-z0-9.-]{1,252}$/.test(request.hostname) || !/^[A-Za-z0-9_-]{32,128}$/.test(request.challenge) || !request.runnerNodeKey || !request.target?.host || !/^SHA256:[A-Za-z0-9+/]{43}$/.test(request.target.hostKeySha256)) {
|
|
16937
16951
|
throw new Error("metal admission proof request is malformed");
|
package/dist/fz.js
CHANGED
|
@@ -4810,9 +4810,17 @@ async function spawnWith(command, env, report = () => {}, options = {}) {
|
|
|
4810
4810
|
}
|
|
4811
4811
|
|
|
4812
4812
|
// src/cli/index.ts
|
|
4813
|
-
init_dist();
|
|
4814
4813
|
import { existsSync as existsSync12, lstatSync as lstatSync10, mkdirSync as mkdirSync13, readFileSync as readFileSync15, writeFileSync as writeFileSync13 } from "fs";
|
|
4815
4814
|
import { basename as basename3, dirname as dirname14, isAbsolute as isAbsolute7, join as join12, resolve as resolve11 } from "path";
|
|
4815
|
+
|
|
4816
|
+
// src/process-input.ts
|
|
4817
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
4818
|
+
input.write(value);
|
|
4819
|
+
await input.end();
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4822
|
+
// src/cli/index.ts
|
|
4823
|
+
init_dist();
|
|
4816
4824
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4817
4825
|
import { hostname } from "os";
|
|
4818
4826
|
|
|
@@ -4829,7 +4837,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
|
|
|
4829
4837
|
var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
|
|
4830
4838
|
|
|
4831
4839
|
// src/version.ts
|
|
4832
|
-
var VERSION2 = "0.1.
|
|
4840
|
+
var VERSION2 = "0.1.77";
|
|
4833
4841
|
|
|
4834
4842
|
// src/software.ts
|
|
4835
4843
|
var PINNED_BUN_VERSION = "1.3.14";
|
|
@@ -6386,10 +6394,8 @@ var fixed = async (argv2, stdin) => {
|
|
|
6386
6394
|
stderr: "pipe",
|
|
6387
6395
|
env: { PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C", DEBIAN_FRONTEND: "noninteractive" }
|
|
6388
6396
|
});
|
|
6389
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
6390
|
-
child.stdin
|
|
6391
|
-
child.stdin.end();
|
|
6392
|
-
}
|
|
6397
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
6398
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
6393
6399
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
6394
6400
|
new Response(child.stdout).text(),
|
|
6395
6401
|
new Response(child.stderr).text(),
|
|
@@ -15077,8 +15083,7 @@ function localBootstrapHost() {
|
|
|
15077
15083
|
const execute = async (argv2, options = {}) => {
|
|
15078
15084
|
const child = Bun.spawn([...argv2], { stdin: options.stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
15079
15085
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
15080
|
-
child.stdin
|
|
15081
|
-
child.stdin.end();
|
|
15086
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
15082
15087
|
}
|
|
15083
15088
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
15084
15089
|
new Response(child.stdout).text(),
|
|
@@ -16818,8 +16823,7 @@ var defaultExec3 = async (argv2, options = {}) => {
|
|
|
16818
16823
|
}
|
|
16819
16824
|
});
|
|
16820
16825
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
16821
|
-
child.stdin
|
|
16822
|
-
child.stdin.end();
|
|
16826
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
16823
16827
|
}
|
|
16824
16828
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
16825
16829
|
new Response(child.stdout).text(),
|
|
@@ -18283,9 +18287,8 @@ async function cmdAgent(options, args) {
|
|
|
18283
18287
|
mkdirSync13(dirname14(enrolTokenCredentialPath), { recursive: true, mode: 448 });
|
|
18284
18288
|
const sealing = Bun.spawn(["systemd-creds", "encrypt", "--name=enrol-token", "-", enrolTokenCredentialPath], { stdin: "pipe", stdout: "ignore", stderr: "pipe" });
|
|
18285
18289
|
if (sealing.stdin && typeof sealing.stdin !== "number") {
|
|
18286
|
-
sealing.stdin
|
|
18290
|
+
await writeAndCloseProcessInput(sealing.stdin, `${token}
|
|
18287
18291
|
`);
|
|
18288
|
-
sealing.stdin.end();
|
|
18289
18292
|
}
|
|
18290
18293
|
const error = await new Response(sealing.stderr).text();
|
|
18291
18294
|
if (await sealing.exited !== 0)
|
package/dist/metal-bootstrap.js
CHANGED
|
@@ -354,7 +354,7 @@ function systemdAgentEgressDirectives(loopbackTcpPorts = []) {
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
// src/version.ts
|
|
357
|
-
var VERSION = "0.1.
|
|
357
|
+
var VERSION = "0.1.77";
|
|
358
358
|
|
|
359
359
|
// src/otel-collector.ts
|
|
360
360
|
var FORGEZERO_OTEL_COLLECTOR_UNIT = "forgezero-otel-collector.service";
|
|
@@ -1416,7 +1416,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
|
|
|
1416
1416
|
var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
|
|
1417
1417
|
|
|
1418
1418
|
// src/version.ts
|
|
1419
|
-
var VERSION = "0.1.
|
|
1419
|
+
var VERSION = "0.1.77";
|
|
1420
1420
|
|
|
1421
1421
|
// src/software.ts
|
|
1422
1422
|
var PINNED_BUN_VERSION = "1.3.14";
|
|
@@ -1549,6 +1549,12 @@ var defaultHost2 = {
|
|
|
1549
1549
|
now: Date.now
|
|
1550
1550
|
};
|
|
1551
1551
|
|
|
1552
|
+
// src/process-input.ts
|
|
1553
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
1554
|
+
input.write(value);
|
|
1555
|
+
await input.end();
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1552
1558
|
// src/software-helper.ts
|
|
1553
1559
|
var DEFAULT_SOFTWARE_HELPER_SOCKET = "/run/forgezero-software/helper.sock";
|
|
1554
1560
|
var SOFTWARE_HELPER_GROUP = "forgezero-software";
|
|
@@ -2575,10 +2581,8 @@ var fixed = async (argv, stdin) => {
|
|
|
2575
2581
|
stderr: "pipe",
|
|
2576
2582
|
env: { PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C", DEBIAN_FRONTEND: "noninteractive" }
|
|
2577
2583
|
});
|
|
2578
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
2579
|
-
child.stdin
|
|
2580
|
-
child.stdin.end();
|
|
2581
|
-
}
|
|
2584
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
2585
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
2582
2586
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
2583
2587
|
new Response(child.stdout).text(),
|
|
2584
2588
|
new Response(child.stderr).text(),
|
|
@@ -4874,8 +4878,7 @@ function localBootstrapHost() {
|
|
|
4874
4878
|
const execute = async (argv, options = {}) => {
|
|
4875
4879
|
const child = Bun.spawn([...argv], { stdin: options.stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
4876
4880
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
4877
|
-
child.stdin
|
|
4878
|
-
child.stdin.end();
|
|
4881
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
4879
4882
|
}
|
|
4880
4883
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
4881
4884
|
new Response(child.stdout).text(),
|
|
@@ -6351,8 +6354,7 @@ var defaultExec3 = async (argv, options = {}) => {
|
|
|
6351
6354
|
}
|
|
6352
6355
|
});
|
|
6353
6356
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
6354
|
-
child.stdin
|
|
6355
|
-
child.stdin.end();
|
|
6357
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
6356
6358
|
}
|
|
6357
6359
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
6358
6360
|
new Response(child.stdout).text(),
|
|
@@ -1628,6 +1628,14 @@ function phasePipeline(definition, phase, profile, executeRelease = false) {
|
|
|
1628
1628
|
import { createHash as createHash3 } from "node:crypto";
|
|
1629
1629
|
import { mkdirSync as mkdirSync4, renameSync as renameSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1630
1630
|
import { dirname as dirname4 } from "node:path";
|
|
1631
|
+
|
|
1632
|
+
// src/process-input.ts
|
|
1633
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
1634
|
+
input.write(value);
|
|
1635
|
+
await input.end();
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
// src/deployment-connectivity.ts
|
|
1631
1639
|
var TOKEN = /^[A-Za-z0-9._-]{40,16384}$/;
|
|
1632
1640
|
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
1633
1641
|
var HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
@@ -1648,8 +1656,7 @@ async function sealWithSystemd(name, path2, value) {
|
|
|
1648
1656
|
stderr: "pipe",
|
|
1649
1657
|
env: { PATH: "/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C" }
|
|
1650
1658
|
});
|
|
1651
|
-
child.stdin
|
|
1652
|
-
child.stdin.end();
|
|
1659
|
+
await writeAndCloseProcessInput(child.stdin, value);
|
|
1653
1660
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
1654
1661
|
new Response(child.stdout).text(),
|
|
1655
1662
|
new Response(child.stderr).text(),
|
|
@@ -2491,7 +2498,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
2491
2498
|
}
|
|
2492
2499
|
|
|
2493
2500
|
// src/version.ts
|
|
2494
|
-
var VERSION3 = "0.1.
|
|
2501
|
+
var VERSION3 = "0.1.77";
|
|
2495
2502
|
|
|
2496
2503
|
// src/egress-policy.ts
|
|
2497
2504
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
@@ -4247,10 +4254,8 @@ var fixed = async (argv2, stdin) => {
|
|
|
4247
4254
|
stderr: "pipe",
|
|
4248
4255
|
env: { PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C", DEBIAN_FRONTEND: "noninteractive" }
|
|
4249
4256
|
});
|
|
4250
|
-
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
4251
|
-
child.stdin
|
|
4252
|
-
child.stdin.end();
|
|
4253
|
-
}
|
|
4257
|
+
if (stdin !== undefined && child.stdin && typeof child.stdin !== "number")
|
|
4258
|
+
await writeAndCloseProcessInput(child.stdin, stdin);
|
|
4254
4259
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
4255
4260
|
new Response(child.stdout).text(),
|
|
4256
4261
|
new Response(child.stderr).text(),
|
|
@@ -4828,8 +4833,7 @@ function localBootstrapHost() {
|
|
|
4828
4833
|
const execute = async (argv2, options = {}) => {
|
|
4829
4834
|
const child = Bun.spawn([...argv2], { stdin: options.stdin === undefined ? "ignore" : "pipe", stdout: "pipe", stderr: "pipe" });
|
|
4830
4835
|
if (options.stdin !== undefined && child.stdin && typeof child.stdin !== "number") {
|
|
4831
|
-
child.stdin
|
|
4832
|
-
child.stdin.end();
|
|
4836
|
+
await writeAndCloseProcessInput(child.stdin, options.stdin);
|
|
4833
4837
|
}
|
|
4834
4838
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
4835
4839
|
new Response(child.stdout).text(),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flush and close a Bun child-process input pipe before awaiting the child.
|
|
3
|
+
*
|
|
4
|
+
* Bun's FileSink.end() is asynchronous. Leaving its promise unobserved can
|
|
5
|
+
* keep the write half open after the payload has arrived, so a remote process
|
|
6
|
+
* that reads until EOF never advances.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeAndCloseProcessInput(input: {
|
|
9
|
+
write(value: string | Uint8Array): unknown;
|
|
10
|
+
end(): unknown;
|
|
11
|
+
}, value: string | Uint8Array): Promise<void>;
|
package/dist/provision.js
CHANGED
|
@@ -1628,6 +1628,14 @@ function phasePipeline(definition, phase, profile, executeRelease = false) {
|
|
|
1628
1628
|
import { createHash as createHash3 } from "node:crypto";
|
|
1629
1629
|
import { mkdirSync as mkdirSync4, renameSync as renameSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1630
1630
|
import { dirname as dirname4 } from "node:path";
|
|
1631
|
+
|
|
1632
|
+
// src/process-input.ts
|
|
1633
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
1634
|
+
input.write(value);
|
|
1635
|
+
await input.end();
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
// src/deployment-connectivity.ts
|
|
1631
1639
|
var TOKEN = /^[A-Za-z0-9._-]{40,16384}$/;
|
|
1632
1640
|
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
1633
1641
|
var HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
@@ -1648,8 +1656,7 @@ async function sealWithSystemd(name, path2, value) {
|
|
|
1648
1656
|
stderr: "pipe",
|
|
1649
1657
|
env: { PATH: "/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C" }
|
|
1650
1658
|
});
|
|
1651
|
-
child.stdin
|
|
1652
|
-
child.stdin.end();
|
|
1659
|
+
await writeAndCloseProcessInput(child.stdin, value);
|
|
1653
1660
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
1654
1661
|
new Response(child.stdout).text(),
|
|
1655
1662
|
new Response(child.stderr).text(),
|
|
@@ -2491,7 +2498,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
2491
2498
|
}
|
|
2492
2499
|
|
|
2493
2500
|
// src/version.ts
|
|
2494
|
-
var VERSION3 = "0.1.
|
|
2501
|
+
var VERSION3 = "0.1.77";
|
|
2495
2502
|
|
|
2496
2503
|
// src/egress-policy.ts
|
|
2497
2504
|
import { realpathSync as realpathSync3 } from "node:fs";
|
package/dist/software-helper.js
CHANGED
|
@@ -950,6 +950,14 @@ function phasePipeline(definition, phase, profile, executeRelease = false) {
|
|
|
950
950
|
import { createHash as createHash2 } from "node:crypto";
|
|
951
951
|
import { mkdirSync as mkdirSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
952
952
|
import { dirname as dirname2 } from "node:path";
|
|
953
|
+
|
|
954
|
+
// src/process-input.ts
|
|
955
|
+
async function writeAndCloseProcessInput(input, value) {
|
|
956
|
+
input.write(value);
|
|
957
|
+
await input.end();
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// src/deployment-connectivity.ts
|
|
953
961
|
var TOKEN = /^[A-Za-z0-9._-]{40,16384}$/;
|
|
954
962
|
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
955
963
|
var HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
@@ -970,8 +978,7 @@ async function sealWithSystemd(name, path2, value) {
|
|
|
970
978
|
stderr: "pipe",
|
|
971
979
|
env: { PATH: "/usr/sbin:/usr/bin:/sbin:/bin", LANG: "C", LC_ALL: "C" }
|
|
972
980
|
});
|
|
973
|
-
child.stdin
|
|
974
|
-
child.stdin.end();
|
|
981
|
+
await writeAndCloseProcessInput(child.stdin, value);
|
|
975
982
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
976
983
|
new Response(child.stdout).text(),
|
|
977
984
|
new Response(child.stderr).text(),
|
package/dist/stdin.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read one bounded request from stdin without using a synchronous `/dev/stdin`
|
|
3
|
+
* read. Bun can busy-loop on a synchronous read when stdin is an SSH pipe;
|
|
4
|
+
* async iteration observes pipe backpressure and EOF correctly.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readBoundedStdin(maxBytes: number): Promise<string>;
|
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.77";
|