agenter 0.0.3 → 0.0.4
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/agenter.js +7 -5
- package/package.json +1 -1
package/dist/agenter.js
CHANGED
|
@@ -349088,7 +349088,9 @@ var buildProductProcessCommand = (target, descriptor, productArgv, env2 = proces
|
|
|
349088
349088
|
init_daemon_runtime_descriptor();
|
|
349089
349089
|
var INTERNAL_DAEMON_FOREGROUND_ENV = "AGENTER_INTERNAL_DAEMON_FOREGROUND";
|
|
349090
349090
|
var BUNDLED_ASSETS_ROOT_ENV3 = "AGENTER_BUNDLED_ASSETS_ROOT";
|
|
349091
|
-
var
|
|
349091
|
+
var HEALTH_REQUEST_TIMEOUT_MS = 5000;
|
|
349092
|
+
var MANAGED_DAEMON_START_TIMEOUT_MS = 60000;
|
|
349093
|
+
var MANAGED_DAEMON_START_HEALTH_REQUEST_TIMEOUT_MS = 1000;
|
|
349092
349094
|
var packageJson = createRequire5(import.meta.url)("../package.json");
|
|
349093
349095
|
var waitForSignal = async (cleanup) => {
|
|
349094
349096
|
await new Promise((resolve58) => {
|
|
@@ -349127,13 +349129,13 @@ var resolveBundledAssetPath2 = (...segments) => {
|
|
|
349127
349129
|
const path7 = join64(root3, ...segments);
|
|
349128
349130
|
return existsSync38(path7) ? path7 : undefined;
|
|
349129
349131
|
};
|
|
349130
|
-
var isHttpHealthAlive = async (urlString) => {
|
|
349132
|
+
var isHttpHealthAlive = async (urlString, timeoutMs = HEALTH_REQUEST_TIMEOUT_MS) => {
|
|
349131
349133
|
const url2 = new URL(urlString);
|
|
349132
349134
|
const request = url2.protocol === "https:" ? httpsRequest : httpRequest2;
|
|
349133
349135
|
return await new Promise((resolve58) => {
|
|
349134
349136
|
const req = request(url2, {
|
|
349135
349137
|
method: "GET",
|
|
349136
|
-
timeout:
|
|
349138
|
+
timeout: timeoutMs
|
|
349137
349139
|
}, (response) => {
|
|
349138
349140
|
response.resume();
|
|
349139
349141
|
resolve58(response.statusCode !== undefined && response.statusCode >= 200 && response.statusCode < 300);
|
|
@@ -349146,7 +349148,7 @@ var isHttpHealthAlive = async (urlString) => {
|
|
|
349146
349148
|
req.end();
|
|
349147
349149
|
});
|
|
349148
349150
|
};
|
|
349149
|
-
var isDaemonAlive = async (args) => await isHttpHealthAlive(healthUrl(args));
|
|
349151
|
+
var isDaemonAlive = async (args, timeoutMs) => await isHttpHealthAlive(healthUrl(args), timeoutMs);
|
|
349150
349152
|
var isReusableDaemonDescriptorHealthy = async (descriptor) => await isHttpHealthAlive(`${descriptor.endpoint.replace(/\/$/u, "")}/health`);
|
|
349151
349153
|
var waitFor = async (predicate, timeoutMs, intervalMs = 100) => {
|
|
349152
349154
|
const startedAt = Date.now();
|
|
@@ -349231,7 +349233,7 @@ var spawnManagedDaemonProcess = (args) => {
|
|
|
349231
349233
|
var waitForManagedDaemonHealthy = async (authority, pid, timeoutMs = MANAGED_DAEMON_START_TIMEOUT_MS) => {
|
|
349232
349234
|
const startedAt = Date.now();
|
|
349233
349235
|
while (Date.now() - startedAt < timeoutMs) {
|
|
349234
|
-
if (await isDaemonAlive(authority)) {
|
|
349236
|
+
if (await isDaemonAlive(authority, MANAGED_DAEMON_START_HEALTH_REQUEST_TIMEOUT_MS)) {
|
|
349235
349237
|
return "healthy";
|
|
349236
349238
|
}
|
|
349237
349239
|
if (!isProcessAlive(pid)) {
|