@amaster.ai/employee-runtime-connector 0.1.1-beta.10 → 0.1.1-beta.11
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.
|
@@ -9394,7 +9394,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9394
9394
|
}
|
|
9395
9395
|
|
|
9396
9396
|
// src/amaster-runtime-daemon.mjs
|
|
9397
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9397
|
+
var CONNECTOR_VERSION = "0.1.1-beta.11";
|
|
9398
9398
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9399
9399
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9400
9400
|
var SOURCE_ACQUISITION_PROFILE_VERSION = "source_acquisition_v1";
|
|
@@ -10065,8 +10065,10 @@ function buildHeartbeatPayload(config, options = {}) {
|
|
|
10065
10065
|
const desktopPlatformCredential = desktopPlatformCredentialStatus(config);
|
|
10066
10066
|
const headedBrowserAuth = browserCapabilityStatus(config, "headed_browser_auth");
|
|
10067
10067
|
const sourceAcquisition = sourceAcquisitionRuntimeReadiness(config);
|
|
10068
|
+
const status = options.status === "offline" ? "offline" : "online";
|
|
10069
|
+
const daemonStatus = status === "offline" ? "stopping" : "running";
|
|
10068
10070
|
return {
|
|
10069
|
-
status
|
|
10071
|
+
status,
|
|
10070
10072
|
workspaceBindings: config.workspaceBindings,
|
|
10071
10073
|
networkDomains: config.networkDomains,
|
|
10072
10074
|
executors: config.executors,
|
|
@@ -10078,8 +10080,9 @@ function buildHeartbeatPayload(config, options = {}) {
|
|
|
10078
10080
|
arch: process.arch,
|
|
10079
10081
|
...trustedPiRuntimeProvenancePayload(config),
|
|
10080
10082
|
runtimeStatus: {
|
|
10081
|
-
daemon:
|
|
10083
|
+
daemon: daemonStatus,
|
|
10082
10084
|
pid: process.pid,
|
|
10085
|
+
...status === "offline" ? { offlineReason: readString(options.offlineReason) ?? "daemon_shutdown" } : {},
|
|
10083
10086
|
...heartbeatMode === "diagnostic" ? { heartbeatMode: "diagnostic" } : {},
|
|
10084
10087
|
...diagnosticSource ? { diagnosticSource } : {},
|
|
10085
10088
|
...orphanCheck === "startup" ? { orphanCheck: "startup" } : {},
|
|
@@ -10349,7 +10352,11 @@ async function register(config, options = {}) {
|
|
|
10349
10352
|
async function heartbeat(config, options = {}) {
|
|
10350
10353
|
const connectorId = requireConnectorId(config);
|
|
10351
10354
|
const mode = heartbeatLogMode(options.logMode) || heartbeatLogMode(process.env.AMASTER_HEARTBEAT_LOG_MODE) || "compact";
|
|
10352
|
-
const payload = buildHeartbeatPayload(config, {
|
|
10355
|
+
const payload = buildHeartbeatPayload(config, {
|
|
10356
|
+
orphanCheck: options.orphanCheck,
|
|
10357
|
+
status: options.status,
|
|
10358
|
+
offlineReason: options.offlineReason
|
|
10359
|
+
});
|
|
10353
10360
|
writeLocalRuntimeStatus(config, payload.runtimeStatus);
|
|
10354
10361
|
const body = await postJson(
|
|
10355
10362
|
config,
|
|
@@ -10361,6 +10368,38 @@ async function heartbeat(config, options = {}) {
|
|
|
10361
10368
|
`);
|
|
10362
10369
|
return body;
|
|
10363
10370
|
}
|
|
10371
|
+
async function reportOfflineHeartbeat(config, reason) {
|
|
10372
|
+
if (!readString(config.connectorId)) {
|
|
10373
|
+
return;
|
|
10374
|
+
}
|
|
10375
|
+
await heartbeat(config, {
|
|
10376
|
+
logMode: "compact",
|
|
10377
|
+
status: "offline",
|
|
10378
|
+
offlineReason: reason
|
|
10379
|
+
});
|
|
10380
|
+
}
|
|
10381
|
+
var shutdownHeartbeatInFlight = false;
|
|
10382
|
+
function installShutdownHeartbeatHandlers() {
|
|
10383
|
+
const shutdown = (signal) => {
|
|
10384
|
+
if (shutdownHeartbeatInFlight) return;
|
|
10385
|
+
shutdownHeartbeatInFlight = true;
|
|
10386
|
+
const exitCode = signal === "SIGINT" ? 130 : 0;
|
|
10387
|
+
const timeout = setTimeout(() => process.exit(exitCode), 3e3);
|
|
10388
|
+
timeout.unref?.();
|
|
10389
|
+
const latestConfig = buildConfig(process.env, {});
|
|
10390
|
+
reportOfflineHeartbeat(latestConfig, signal.toLowerCase()).catch((err) => {
|
|
10391
|
+
const message = err instanceof Error ? err.stack || err.message : String(err);
|
|
10392
|
+
process.stderr.write(`AMaster daemon offline heartbeat failed during ${signal}; exiting anyway:
|
|
10393
|
+
${message}
|
|
10394
|
+
`);
|
|
10395
|
+
}).finally(() => {
|
|
10396
|
+
clearTimeout(timeout);
|
|
10397
|
+
process.exit(exitCode);
|
|
10398
|
+
});
|
|
10399
|
+
};
|
|
10400
|
+
process.once("SIGTERM", () => shutdown("SIGTERM"));
|
|
10401
|
+
process.once("SIGINT", () => shutdown("SIGINT"));
|
|
10402
|
+
}
|
|
10364
10403
|
function activeRunHeartbeatIntervalMs(config) {
|
|
10365
10404
|
const configured = Number(config.pollIntervalSeconds);
|
|
10366
10405
|
const baseMs = Number.isFinite(configured) && configured > 0 ? configured * 1e3 : 1e4;
|
|
@@ -14871,7 +14910,11 @@ async function main() {
|
|
|
14871
14910
|
`);
|
|
14872
14911
|
break;
|
|
14873
14912
|
case "render-heartbeat-payload":
|
|
14874
|
-
process.stdout.write(`${JSON.stringify(buildHeartbeatPayload(config, {
|
|
14913
|
+
process.stdout.write(`${JSON.stringify(buildHeartbeatPayload(config, {
|
|
14914
|
+
orphanCheck: flags.orphanCheck ?? flags.orphan_check ?? flags["orphan-check"],
|
|
14915
|
+
status: flags.status,
|
|
14916
|
+
offlineReason: flags.offlineReason ?? flags.offline_reason ?? flags["offline-reason"]
|
|
14917
|
+
}), null, 2)}
|
|
14875
14918
|
`);
|
|
14876
14919
|
break;
|
|
14877
14920
|
case "print-smoke":
|
|
@@ -14881,7 +14924,11 @@ async function main() {
|
|
|
14881
14924
|
await register(config);
|
|
14882
14925
|
break;
|
|
14883
14926
|
case "heartbeat":
|
|
14884
|
-
await heartbeat(config, {
|
|
14927
|
+
await heartbeat(config, {
|
|
14928
|
+
logMode: "full",
|
|
14929
|
+
status: flags.status,
|
|
14930
|
+
offlineReason: flags.offlineReason ?? flags.offline_reason ?? flags["offline-reason"]
|
|
14931
|
+
});
|
|
14885
14932
|
break;
|
|
14886
14933
|
case "poll":
|
|
14887
14934
|
await poll(config);
|
|
@@ -14903,6 +14950,7 @@ async function main() {
|
|
|
14903
14950
|
break;
|
|
14904
14951
|
case "start":
|
|
14905
14952
|
case "run":
|
|
14953
|
+
installShutdownHeartbeatHandlers();
|
|
14906
14954
|
await runLoop(config);
|
|
14907
14955
|
break;
|
|
14908
14956
|
case "help":
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
6
6
|
import { homedir, hostname } from "node:os";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
|
-
const CONNECTOR_VERSION = "0.1.1-beta.
|
|
9
|
+
const CONNECTOR_VERSION = "0.1.1-beta.11";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|