@forgezero/agent 0.1.149 → 0.1.151
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 +39 -24
- package/dist/agent-update-helper.js +38 -23
- package/dist/bootstrap.js +1 -1
- package/dist/fz-agent.js +39 -24
- package/dist/fz.js +1 -1
- package/dist/metal-bootstrap.js +1 -1
- package/dist/operator-bootstrap.js +1 -1
- package/dist/platform-fleet-verification.js +39 -24
- package/dist/provision.js +39 -24
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/agent-heartbeat.js
CHANGED
|
@@ -495,11 +495,9 @@ var stagedFromJournal = (journal, root) => ({
|
|
|
495
495
|
});
|
|
496
496
|
var restartAgent = async (target, run) => {
|
|
497
497
|
const helpers = target === "compute" ? COMPUTE_HELPER_UNITS : ["forgezero-metal-helper.service"];
|
|
498
|
-
for (const unit of helpers)
|
|
499
|
-
await run({ command: "/usr/bin/systemctl", args: ["try-restart", unit] });
|
|
500
498
|
const service = target === "compute" ? "forgezero-agent.service" : "forgezero-metal-agent.service";
|
|
501
|
-
if (!await runOk(run, "/usr/bin/systemctl", ["restart", service])) {
|
|
502
|
-
throw new Error(`systemd could not restart ${service}`);
|
|
499
|
+
if (!await runOk(run, "/usr/bin/systemctl", ["restart", ...helpers, service])) {
|
|
500
|
+
throw new Error(`systemd could not restart ${[...helpers, service].join(", ")}`);
|
|
503
501
|
}
|
|
504
502
|
};
|
|
505
503
|
var candidateUnit = (target) => target === "compute" ? "forgezero-agent-candidate.service" : "forgezero-metal-agent-candidate.service";
|
|
@@ -532,34 +530,51 @@ var socketPaths = (publicSocket = process.env.FZ_AGENT_PUBLIC_SOCKET ?? DEFAULT_
|
|
|
532
530
|
var targetProbe = (target, run) => target === "compute" ? () => probeAgentSocket() : async () => await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-agent.service"]) && await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-helper.service"]);
|
|
533
531
|
function probeAgentSocket(socketPath = DEFAULT_SOCKET, timeoutMs = 5000) {
|
|
534
532
|
return new Promise((resolve3) => {
|
|
535
|
-
const socket = connect2(socketPath);
|
|
536
533
|
let settled = false;
|
|
537
|
-
let
|
|
534
|
+
let socket;
|
|
535
|
+
const deadline = Date.now() + timeoutMs;
|
|
538
536
|
const finish = (value) => {
|
|
539
537
|
if (settled)
|
|
540
538
|
return;
|
|
541
539
|
settled = true;
|
|
542
|
-
|
|
543
|
-
socket.destroy();
|
|
540
|
+
socket?.destroy();
|
|
544
541
|
resolve3(value);
|
|
545
542
|
};
|
|
546
|
-
const
|
|
547
|
-
|
|
543
|
+
const attempt = () => {
|
|
544
|
+
if (settled || Date.now() >= deadline)
|
|
545
|
+
return finish(false);
|
|
546
|
+
if (!existsSync3(socketPath)) {
|
|
547
|
+
const remaining = deadline - Date.now();
|
|
548
|
+
return setTimeout(attempt, Math.min(100, remaining));
|
|
549
|
+
}
|
|
550
|
+
let buffer = "";
|
|
551
|
+
const candidate = connect2(socketPath);
|
|
552
|
+
socket = candidate;
|
|
553
|
+
candidate.on("connect", () => candidate.write(`{"op":"identity"}
|
|
548
554
|
`));
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
555
|
+
candidate.on("data", (chunk) => {
|
|
556
|
+
buffer += chunk.toString("utf8");
|
|
557
|
+
const newline = buffer.indexOf(`
|
|
552
558
|
`);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
if (newline < 0)
|
|
560
|
+
return;
|
|
561
|
+
try {
|
|
562
|
+
const response = JSON.parse(buffer.slice(0, newline));
|
|
563
|
+
finish(response.ok === false && response.error?.code === "APP_OPERATION_REFUSED");
|
|
564
|
+
} catch {
|
|
565
|
+
finish(false);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
candidate.once("error", () => {
|
|
569
|
+
candidate.destroy();
|
|
570
|
+
const remaining = deadline - Date.now();
|
|
571
|
+
if (remaining <= 0)
|
|
572
|
+
finish(false);
|
|
573
|
+
else
|
|
574
|
+
setTimeout(attempt, Math.min(100, remaining));
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
attempt();
|
|
563
578
|
});
|
|
564
579
|
}
|
|
565
580
|
async function activateAgentRelease(staged, options = {}) {
|
|
@@ -933,7 +948,7 @@ async function postSignedNode(options, path, body) {
|
|
|
933
948
|
}
|
|
934
949
|
|
|
935
950
|
// src/version.ts
|
|
936
|
-
var VERSION3 = "0.1.
|
|
951
|
+
var VERSION3 = "0.1.151";
|
|
937
952
|
|
|
938
953
|
// src/agent-heartbeat.ts
|
|
939
954
|
function readAgentHostMetrics() {
|
|
@@ -495,11 +495,9 @@ var stagedFromJournal = (journal, root) => ({
|
|
|
495
495
|
});
|
|
496
496
|
var restartAgent = async (target, run) => {
|
|
497
497
|
const helpers = target === "compute" ? COMPUTE_HELPER_UNITS : ["forgezero-metal-helper.service"];
|
|
498
|
-
for (const unit of helpers)
|
|
499
|
-
await run({ command: "/usr/bin/systemctl", args: ["try-restart", unit] });
|
|
500
498
|
const service = target === "compute" ? "forgezero-agent.service" : "forgezero-metal-agent.service";
|
|
501
|
-
if (!await runOk(run, "/usr/bin/systemctl", ["restart", service])) {
|
|
502
|
-
throw new Error(`systemd could not restart ${service}`);
|
|
499
|
+
if (!await runOk(run, "/usr/bin/systemctl", ["restart", ...helpers, service])) {
|
|
500
|
+
throw new Error(`systemd could not restart ${[...helpers, service].join(", ")}`);
|
|
503
501
|
}
|
|
504
502
|
};
|
|
505
503
|
var candidateUnit = (target) => target === "compute" ? "forgezero-agent-candidate.service" : "forgezero-metal-agent-candidate.service";
|
|
@@ -532,34 +530,51 @@ var socketPaths = (publicSocket = process.env.FZ_AGENT_PUBLIC_SOCKET ?? DEFAULT_
|
|
|
532
530
|
var targetProbe = (target, run) => target === "compute" ? () => probeAgentSocket() : async () => await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-agent.service"]) && await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-helper.service"]);
|
|
533
531
|
function probeAgentSocket(socketPath = DEFAULT_SOCKET, timeoutMs = 5000) {
|
|
534
532
|
return new Promise((resolve3) => {
|
|
535
|
-
const socket = connect2(socketPath);
|
|
536
533
|
let settled = false;
|
|
537
|
-
let
|
|
534
|
+
let socket;
|
|
535
|
+
const deadline = Date.now() + timeoutMs;
|
|
538
536
|
const finish = (value) => {
|
|
539
537
|
if (settled)
|
|
540
538
|
return;
|
|
541
539
|
settled = true;
|
|
542
|
-
|
|
543
|
-
socket.destroy();
|
|
540
|
+
socket?.destroy();
|
|
544
541
|
resolve3(value);
|
|
545
542
|
};
|
|
546
|
-
const
|
|
547
|
-
|
|
543
|
+
const attempt = () => {
|
|
544
|
+
if (settled || Date.now() >= deadline)
|
|
545
|
+
return finish(false);
|
|
546
|
+
if (!existsSync3(socketPath)) {
|
|
547
|
+
const remaining = deadline - Date.now();
|
|
548
|
+
return setTimeout(attempt, Math.min(100, remaining));
|
|
549
|
+
}
|
|
550
|
+
let buffer = "";
|
|
551
|
+
const candidate = connect2(socketPath);
|
|
552
|
+
socket = candidate;
|
|
553
|
+
candidate.on("connect", () => candidate.write(`{"op":"identity"}
|
|
548
554
|
`));
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
555
|
+
candidate.on("data", (chunk) => {
|
|
556
|
+
buffer += chunk.toString("utf8");
|
|
557
|
+
const newline = buffer.indexOf(`
|
|
552
558
|
`);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
if (newline < 0)
|
|
560
|
+
return;
|
|
561
|
+
try {
|
|
562
|
+
const response = JSON.parse(buffer.slice(0, newline));
|
|
563
|
+
finish(response.ok === false && response.error?.code === "APP_OPERATION_REFUSED");
|
|
564
|
+
} catch {
|
|
565
|
+
finish(false);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
candidate.once("error", () => {
|
|
569
|
+
candidate.destroy();
|
|
570
|
+
const remaining = deadline - Date.now();
|
|
571
|
+
if (remaining <= 0)
|
|
572
|
+
finish(false);
|
|
573
|
+
else
|
|
574
|
+
setTimeout(attempt, Math.min(100, remaining));
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
attempt();
|
|
563
578
|
});
|
|
564
579
|
}
|
|
565
580
|
async function activateAgentRelease(staged, options = {}) {
|
package/dist/bootstrap.js
CHANGED
package/dist/fz-agent.js
CHANGED
|
@@ -11632,7 +11632,7 @@ async function writeAndCloseProcessInput(input, value) {
|
|
|
11632
11632
|
}
|
|
11633
11633
|
|
|
11634
11634
|
// src/version.ts
|
|
11635
|
-
var VERSION2 = "0.1.
|
|
11635
|
+
var VERSION2 = "0.1.151";
|
|
11636
11636
|
|
|
11637
11637
|
// src/ssh-bootstrap.ts
|
|
11638
11638
|
function deriveMetalAdmissionProvisioning(lscpu) {
|
|
@@ -14654,11 +14654,9 @@ var stagedFromJournal = (journal, root) => ({
|
|
|
14654
14654
|
});
|
|
14655
14655
|
var restartAgent = async (target2, run2) => {
|
|
14656
14656
|
const helpers = target2 === "compute" ? COMPUTE_HELPER_UNITS : ["forgezero-metal-helper.service"];
|
|
14657
|
-
for (const unit of helpers)
|
|
14658
|
-
await run2({ command: "/usr/bin/systemctl", args: ["try-restart", unit] });
|
|
14659
14657
|
const service = target2 === "compute" ? "forgezero-agent.service" : "forgezero-metal-agent.service";
|
|
14660
|
-
if (!await runOk(run2, "/usr/bin/systemctl", ["restart", service])) {
|
|
14661
|
-
throw new Error(`systemd could not restart ${service}`);
|
|
14658
|
+
if (!await runOk(run2, "/usr/bin/systemctl", ["restart", ...helpers, service])) {
|
|
14659
|
+
throw new Error(`systemd could not restart ${[...helpers, service].join(", ")}`);
|
|
14662
14660
|
}
|
|
14663
14661
|
};
|
|
14664
14662
|
var candidateUnit = (target2) => target2 === "compute" ? "forgezero-agent-candidate.service" : "forgezero-metal-agent-candidate.service";
|
|
@@ -14691,34 +14689,51 @@ var socketPaths = (publicSocket = process.env.FZ_AGENT_PUBLIC_SOCKET ?? DEFAULT_
|
|
|
14691
14689
|
var targetProbe = (target2, run2) => target2 === "compute" ? () => probeAgentSocket() : async () => await runOk(run2, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-agent.service"]) && await runOk(run2, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-helper.service"]);
|
|
14692
14690
|
function probeAgentSocket(socketPath = DEFAULT_SOCKET, timeoutMs = 5000) {
|
|
14693
14691
|
return new Promise((resolve4) => {
|
|
14694
|
-
const socket = connect6(socketPath);
|
|
14695
14692
|
let settled = false;
|
|
14696
|
-
let
|
|
14693
|
+
let socket;
|
|
14694
|
+
const deadline = Date.now() + timeoutMs;
|
|
14697
14695
|
const finish = (value) => {
|
|
14698
14696
|
if (settled)
|
|
14699
14697
|
return;
|
|
14700
14698
|
settled = true;
|
|
14701
|
-
|
|
14702
|
-
socket.destroy();
|
|
14699
|
+
socket?.destroy();
|
|
14703
14700
|
resolve4(value);
|
|
14704
14701
|
};
|
|
14705
|
-
const
|
|
14706
|
-
|
|
14702
|
+
const attempt = () => {
|
|
14703
|
+
if (settled || Date.now() >= deadline)
|
|
14704
|
+
return finish(false);
|
|
14705
|
+
if (!existsSync14(socketPath)) {
|
|
14706
|
+
const remaining = deadline - Date.now();
|
|
14707
|
+
return setTimeout(attempt, Math.min(100, remaining));
|
|
14708
|
+
}
|
|
14709
|
+
let buffer = "";
|
|
14710
|
+
const candidate = connect6(socketPath);
|
|
14711
|
+
socket = candidate;
|
|
14712
|
+
candidate.on("connect", () => candidate.write(`{"op":"identity"}
|
|
14707
14713
|
`));
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14714
|
+
candidate.on("data", (chunk) => {
|
|
14715
|
+
buffer += chunk.toString("utf8");
|
|
14716
|
+
const newline = buffer.indexOf(`
|
|
14711
14717
|
`);
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14718
|
+
if (newline < 0)
|
|
14719
|
+
return;
|
|
14720
|
+
try {
|
|
14721
|
+
const response = JSON.parse(buffer.slice(0, newline));
|
|
14722
|
+
finish(response.ok === false && response.error?.code === "APP_OPERATION_REFUSED");
|
|
14723
|
+
} catch {
|
|
14724
|
+
finish(false);
|
|
14725
|
+
}
|
|
14726
|
+
});
|
|
14727
|
+
candidate.once("error", () => {
|
|
14728
|
+
candidate.destroy();
|
|
14729
|
+
const remaining = deadline - Date.now();
|
|
14730
|
+
if (remaining <= 0)
|
|
14731
|
+
finish(false);
|
|
14732
|
+
else
|
|
14733
|
+
setTimeout(attempt, Math.min(100, remaining));
|
|
14734
|
+
});
|
|
14735
|
+
};
|
|
14736
|
+
attempt();
|
|
14722
14737
|
});
|
|
14723
14738
|
}
|
|
14724
14739
|
async function activateAgentRelease(staged, options = {}) {
|
package/dist/fz.js
CHANGED
|
@@ -8058,7 +8058,7 @@ var UPDATE_RETRY_BASE_MS = 5 * 60000;
|
|
|
8058
8058
|
var UPDATE_RETRY_MAX_MS = 24 * 60 * 60000;
|
|
8059
8059
|
|
|
8060
8060
|
// src/version.ts
|
|
8061
|
-
var VERSION2 = "0.1.
|
|
8061
|
+
var VERSION2 = "0.1.151";
|
|
8062
8062
|
|
|
8063
8063
|
// src/software.ts
|
|
8064
8064
|
var PINNED_BUN_VERSION = "1.3.14";
|
package/dist/metal-bootstrap.js
CHANGED
|
@@ -366,7 +366,7 @@ function systemdAgentEgressDirectives(loopbackTcpPorts = []) {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
// src/version.ts
|
|
369
|
-
var VERSION = "0.1.
|
|
369
|
+
var VERSION = "0.1.151";
|
|
370
370
|
|
|
371
371
|
// src/otel-collector.ts
|
|
372
372
|
var FORGEZERO_OTEL_COLLECTOR_UNIT = "forgezero-otel-collector.service";
|
|
@@ -495,11 +495,9 @@ var stagedFromJournal = (journal, root) => ({
|
|
|
495
495
|
});
|
|
496
496
|
var restartAgent = async (target, run) => {
|
|
497
497
|
const helpers = target === "compute" ? COMPUTE_HELPER_UNITS : ["forgezero-metal-helper.service"];
|
|
498
|
-
for (const unit of helpers)
|
|
499
|
-
await run({ command: "/usr/bin/systemctl", args: ["try-restart", unit] });
|
|
500
498
|
const service = target === "compute" ? "forgezero-agent.service" : "forgezero-metal-agent.service";
|
|
501
|
-
if (!await runOk(run, "/usr/bin/systemctl", ["restart", service])) {
|
|
502
|
-
throw new Error(`systemd could not restart ${service}`);
|
|
499
|
+
if (!await runOk(run, "/usr/bin/systemctl", ["restart", ...helpers, service])) {
|
|
500
|
+
throw new Error(`systemd could not restart ${[...helpers, service].join(", ")}`);
|
|
503
501
|
}
|
|
504
502
|
};
|
|
505
503
|
var candidateUnit = (target) => target === "compute" ? "forgezero-agent-candidate.service" : "forgezero-metal-agent-candidate.service";
|
|
@@ -532,34 +530,51 @@ var socketPaths = (publicSocket = process.env.FZ_AGENT_PUBLIC_SOCKET ?? DEFAULT_
|
|
|
532
530
|
var targetProbe = (target, run) => target === "compute" ? () => probeAgentSocket() : async () => await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-agent.service"]) && await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-helper.service"]);
|
|
533
531
|
function probeAgentSocket(socketPath = DEFAULT_SOCKET, timeoutMs = 5000) {
|
|
534
532
|
return new Promise((resolve3) => {
|
|
535
|
-
const socket = connect2(socketPath);
|
|
536
533
|
let settled = false;
|
|
537
|
-
let
|
|
534
|
+
let socket;
|
|
535
|
+
const deadline = Date.now() + timeoutMs;
|
|
538
536
|
const finish = (value) => {
|
|
539
537
|
if (settled)
|
|
540
538
|
return;
|
|
541
539
|
settled = true;
|
|
542
|
-
|
|
543
|
-
socket.destroy();
|
|
540
|
+
socket?.destroy();
|
|
544
541
|
resolve3(value);
|
|
545
542
|
};
|
|
546
|
-
const
|
|
547
|
-
|
|
543
|
+
const attempt = () => {
|
|
544
|
+
if (settled || Date.now() >= deadline)
|
|
545
|
+
return finish(false);
|
|
546
|
+
if (!existsSync3(socketPath)) {
|
|
547
|
+
const remaining = deadline - Date.now();
|
|
548
|
+
return setTimeout(attempt, Math.min(100, remaining));
|
|
549
|
+
}
|
|
550
|
+
let buffer = "";
|
|
551
|
+
const candidate = connect2(socketPath);
|
|
552
|
+
socket = candidate;
|
|
553
|
+
candidate.on("connect", () => candidate.write(`{"op":"identity"}
|
|
548
554
|
`));
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
555
|
+
candidate.on("data", (chunk) => {
|
|
556
|
+
buffer += chunk.toString("utf8");
|
|
557
|
+
const newline = buffer.indexOf(`
|
|
552
558
|
`);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
if (newline < 0)
|
|
560
|
+
return;
|
|
561
|
+
try {
|
|
562
|
+
const response = JSON.parse(buffer.slice(0, newline));
|
|
563
|
+
finish(response.ok === false && response.error?.code === "APP_OPERATION_REFUSED");
|
|
564
|
+
} catch {
|
|
565
|
+
finish(false);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
candidate.once("error", () => {
|
|
569
|
+
candidate.destroy();
|
|
570
|
+
const remaining = deadline - Date.now();
|
|
571
|
+
if (remaining <= 0)
|
|
572
|
+
finish(false);
|
|
573
|
+
else
|
|
574
|
+
setTimeout(attempt, Math.min(100, remaining));
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
attempt();
|
|
563
578
|
});
|
|
564
579
|
}
|
|
565
580
|
async function activateAgentRelease(staged, options = {}) {
|
|
@@ -3066,7 +3081,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
3066
3081
|
}
|
|
3067
3082
|
|
|
3068
3083
|
// src/version.ts
|
|
3069
|
-
var VERSION3 = "0.1.
|
|
3084
|
+
var VERSION3 = "0.1.151";
|
|
3070
3085
|
|
|
3071
3086
|
// src/egress-policy.ts
|
|
3072
3087
|
import { realpathSync as realpathSync3 } from "node:fs";
|
package/dist/provision.js
CHANGED
|
@@ -495,11 +495,9 @@ var stagedFromJournal = (journal, root) => ({
|
|
|
495
495
|
});
|
|
496
496
|
var restartAgent = async (target, run) => {
|
|
497
497
|
const helpers = target === "compute" ? COMPUTE_HELPER_UNITS : ["forgezero-metal-helper.service"];
|
|
498
|
-
for (const unit of helpers)
|
|
499
|
-
await run({ command: "/usr/bin/systemctl", args: ["try-restart", unit] });
|
|
500
498
|
const service = target === "compute" ? "forgezero-agent.service" : "forgezero-metal-agent.service";
|
|
501
|
-
if (!await runOk(run, "/usr/bin/systemctl", ["restart", service])) {
|
|
502
|
-
throw new Error(`systemd could not restart ${service}`);
|
|
499
|
+
if (!await runOk(run, "/usr/bin/systemctl", ["restart", ...helpers, service])) {
|
|
500
|
+
throw new Error(`systemd could not restart ${[...helpers, service].join(", ")}`);
|
|
503
501
|
}
|
|
504
502
|
};
|
|
505
503
|
var candidateUnit = (target) => target === "compute" ? "forgezero-agent-candidate.service" : "forgezero-metal-agent-candidate.service";
|
|
@@ -532,34 +530,51 @@ var socketPaths = (publicSocket = process.env.FZ_AGENT_PUBLIC_SOCKET ?? DEFAULT_
|
|
|
532
530
|
var targetProbe = (target, run) => target === "compute" ? () => probeAgentSocket() : async () => await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-agent.service"]) && await runOk(run, "/usr/bin/systemctl", ["is-active", "--quiet", "forgezero-metal-helper.service"]);
|
|
533
531
|
function probeAgentSocket(socketPath = DEFAULT_SOCKET, timeoutMs = 5000) {
|
|
534
532
|
return new Promise((resolve3) => {
|
|
535
|
-
const socket = connect2(socketPath);
|
|
536
533
|
let settled = false;
|
|
537
|
-
let
|
|
534
|
+
let socket;
|
|
535
|
+
const deadline = Date.now() + timeoutMs;
|
|
538
536
|
const finish = (value) => {
|
|
539
537
|
if (settled)
|
|
540
538
|
return;
|
|
541
539
|
settled = true;
|
|
542
|
-
|
|
543
|
-
socket.destroy();
|
|
540
|
+
socket?.destroy();
|
|
544
541
|
resolve3(value);
|
|
545
542
|
};
|
|
546
|
-
const
|
|
547
|
-
|
|
543
|
+
const attempt = () => {
|
|
544
|
+
if (settled || Date.now() >= deadline)
|
|
545
|
+
return finish(false);
|
|
546
|
+
if (!existsSync3(socketPath)) {
|
|
547
|
+
const remaining = deadline - Date.now();
|
|
548
|
+
return setTimeout(attempt, Math.min(100, remaining));
|
|
549
|
+
}
|
|
550
|
+
let buffer = "";
|
|
551
|
+
const candidate = connect2(socketPath);
|
|
552
|
+
socket = candidate;
|
|
553
|
+
candidate.on("connect", () => candidate.write(`{"op":"identity"}
|
|
548
554
|
`));
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
555
|
+
candidate.on("data", (chunk) => {
|
|
556
|
+
buffer += chunk.toString("utf8");
|
|
557
|
+
const newline = buffer.indexOf(`
|
|
552
558
|
`);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
if (newline < 0)
|
|
560
|
+
return;
|
|
561
|
+
try {
|
|
562
|
+
const response = JSON.parse(buffer.slice(0, newline));
|
|
563
|
+
finish(response.ok === false && response.error?.code === "APP_OPERATION_REFUSED");
|
|
564
|
+
} catch {
|
|
565
|
+
finish(false);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
candidate.once("error", () => {
|
|
569
|
+
candidate.destroy();
|
|
570
|
+
const remaining = deadline - Date.now();
|
|
571
|
+
if (remaining <= 0)
|
|
572
|
+
finish(false);
|
|
573
|
+
else
|
|
574
|
+
setTimeout(attempt, Math.min(100, remaining));
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
attempt();
|
|
563
578
|
});
|
|
564
579
|
}
|
|
565
580
|
async function activateAgentRelease(staged, options = {}) {
|
|
@@ -3066,7 +3081,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
3066
3081
|
}
|
|
3067
3082
|
|
|
3068
3083
|
// src/version.ts
|
|
3069
|
-
var VERSION3 = "0.1.
|
|
3084
|
+
var VERSION3 = "0.1.151";
|
|
3070
3085
|
|
|
3071
3086
|
// src/egress-policy.ts
|
|
3072
3087
|
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.
|
|
2
|
+
export declare const VERSION = "0.1.151";
|