@alan-ai-hq/agent-manager-darwin-arm64 0.1.150 → 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/alan-agent.cjs +71 -23
- package/package.json +1 -1
package/alan-agent.cjs
CHANGED
|
@@ -42827,9 +42827,9 @@ var require_streamx = __commonJS({
|
|
|
42827
42827
|
}
|
|
42828
42828
|
});
|
|
42829
42829
|
|
|
42830
|
-
//
|
|
42830
|
+
// ../../node_modules/tar-stream/headers.js
|
|
42831
42831
|
var require_headers = __commonJS({
|
|
42832
|
-
"
|
|
42832
|
+
"../../node_modules/tar-stream/headers.js"(exports2) {
|
|
42833
42833
|
"use strict";
|
|
42834
42834
|
var b4a = require_b4a();
|
|
42835
42835
|
var ZEROS = "0000000000000000000";
|
|
@@ -43090,9 +43090,9 @@ var require_headers = __commonJS({
|
|
|
43090
43090
|
}
|
|
43091
43091
|
});
|
|
43092
43092
|
|
|
43093
|
-
//
|
|
43093
|
+
// ../../node_modules/tar-stream/extract.js
|
|
43094
43094
|
var require_extract = __commonJS({
|
|
43095
|
-
"
|
|
43095
|
+
"../../node_modules/tar-stream/extract.js"(exports2, module2) {
|
|
43096
43096
|
"use strict";
|
|
43097
43097
|
var { Writable, Readable: Readable2, getStreamError } = require_streamx();
|
|
43098
43098
|
var FIFO = require_fast_fifo();
|
|
@@ -43435,9 +43435,9 @@ var require_extract = __commonJS({
|
|
|
43435
43435
|
}
|
|
43436
43436
|
});
|
|
43437
43437
|
|
|
43438
|
-
//
|
|
43438
|
+
// ../../node_modules/tar-stream/constants.js
|
|
43439
43439
|
var require_constants = __commonJS({
|
|
43440
|
-
"
|
|
43440
|
+
"../../node_modules/tar-stream/constants.js"(exports2, module2) {
|
|
43441
43441
|
"use strict";
|
|
43442
43442
|
var constants5 = {
|
|
43443
43443
|
// just for envs without fs
|
|
@@ -43456,9 +43456,9 @@ var require_constants = __commonJS({
|
|
|
43456
43456
|
}
|
|
43457
43457
|
});
|
|
43458
43458
|
|
|
43459
|
-
//
|
|
43459
|
+
// ../../node_modules/tar-stream/pack.js
|
|
43460
43460
|
var require_pack = __commonJS({
|
|
43461
|
-
"
|
|
43461
|
+
"../../node_modules/tar-stream/pack.js"(exports2, module2) {
|
|
43462
43462
|
"use strict";
|
|
43463
43463
|
var { Readable: Readable2, Writable, getStreamError } = require_streamx();
|
|
43464
43464
|
var b4a = require_b4a();
|
|
@@ -43691,9 +43691,9 @@ var require_pack = __commonJS({
|
|
|
43691
43691
|
}
|
|
43692
43692
|
});
|
|
43693
43693
|
|
|
43694
|
-
//
|
|
43694
|
+
// ../../node_modules/tar-stream/index.js
|
|
43695
43695
|
var require_tar_stream = __commonJS({
|
|
43696
|
-
"
|
|
43696
|
+
"../../node_modules/tar-stream/index.js"(exports2) {
|
|
43697
43697
|
"use strict";
|
|
43698
43698
|
exports2.extract = require_extract();
|
|
43699
43699
|
exports2.pack = require_pack();
|
|
@@ -55368,7 +55368,7 @@ var require_websocket_server = __commonJS({
|
|
|
55368
55368
|
// package.json
|
|
55369
55369
|
var package_default = {
|
|
55370
55370
|
name: "@alan-ai-hq/agent-manager",
|
|
55371
|
-
version: "0.1.
|
|
55371
|
+
version: "0.1.151",
|
|
55372
55372
|
private: true,
|
|
55373
55373
|
type: "module",
|
|
55374
55374
|
description: "Alan machine runtime (alan-agent): identity, link, reconciler, session holders, run log, uploader, local API",
|
|
@@ -59981,6 +59981,10 @@ function createServiceManager(host, profile) {
|
|
|
59981
59981
|
// src/platform/sleep.ts
|
|
59982
59982
|
var import_node_child_process7 = require("child_process");
|
|
59983
59983
|
var WAKE_THRESHOLD_MS = 3e4;
|
|
59984
|
+
var WINDOWS_WAKE_THRESHOLD_MS = 12e4;
|
|
59985
|
+
function wakeThresholdMs(platform3) {
|
|
59986
|
+
return platform3 === "win32" ? WINDOWS_WAKE_THRESHOLD_MS : WAKE_THRESHOLD_MS;
|
|
59987
|
+
}
|
|
59984
59988
|
function createWakeDetector(clock, thresholdMs = WAKE_THRESHOLD_MS, platform3 = process.platform) {
|
|
59985
59989
|
const last = { wall: clock.now(), drift: clock.now() - clock.monotonic() };
|
|
59986
59990
|
return {
|
|
@@ -59994,7 +59998,7 @@ function createWakeDetector(clock, thresholdMs = WAKE_THRESHOLD_MS, platform3 =
|
|
|
59994
59998
|
}
|
|
59995
59999
|
};
|
|
59996
60000
|
}
|
|
59997
|
-
function wakeJob(clock, onWake,
|
|
60001
|
+
function wakeJob(clock, onWake, platform3 = process.platform, thresholdMs = wakeThresholdMs(platform3)) {
|
|
59998
60002
|
const detector = createWakeDetector(clock, thresholdMs, platform3);
|
|
59999
60003
|
return {
|
|
60000
60004
|
name: "wake.detect",
|
|
@@ -78213,6 +78217,7 @@ var REDIAL_BASE_MS = 1e3;
|
|
|
78213
78217
|
var REDIAL_MAX_MS = 1e4;
|
|
78214
78218
|
var MAX_CREDENTIAL_FAILURES = 3;
|
|
78215
78219
|
var DISABLED_RETRY_MS = 5 * 6e4;
|
|
78220
|
+
var WAKE_PROBE_MS = 5e3;
|
|
78216
78221
|
function redialDelayMs(attempt2) {
|
|
78217
78222
|
return Math.min(REDIAL_BASE_MS * 2 ** attempt2, REDIAL_MAX_MS) * (0.5 + 0.5 * Math.random());
|
|
78218
78223
|
}
|
|
@@ -78243,6 +78248,8 @@ function connectLink(options) {
|
|
|
78243
78248
|
const counts = {};
|
|
78244
78249
|
const retry = { pending: new AbortController(), attempt: 0, credentialFailures: 0 };
|
|
78245
78250
|
const probe = { running: false };
|
|
78251
|
+
const wake = { recovering: null };
|
|
78252
|
+
const closing = new AbortController();
|
|
78246
78253
|
const socket = lookup(
|
|
78247
78254
|
new URL(LINK_NAMESPACE, wsUrl).toString(),
|
|
78248
78255
|
{
|
|
@@ -78413,20 +78420,59 @@ function connectLink(options) {
|
|
|
78413
78420
|
return false;
|
|
78414
78421
|
}
|
|
78415
78422
|
};
|
|
78423
|
+
const redial2 = () => {
|
|
78424
|
+
retry.attempt = 0;
|
|
78425
|
+
retry.credentialFailures = 0;
|
|
78426
|
+
cancelRedial();
|
|
78427
|
+
setState({ kind: "connecting", lastFailure: null });
|
|
78428
|
+
log.info("link.redial", { connected: socket.connected });
|
|
78429
|
+
if (socket.connected) {
|
|
78430
|
+
socket.io.engine.close();
|
|
78431
|
+
return;
|
|
78432
|
+
}
|
|
78433
|
+
socket.disconnect();
|
|
78434
|
+
socket.connect();
|
|
78435
|
+
};
|
|
78436
|
+
const hearsServer = (timeoutMs) => new Promise((resolve14) => {
|
|
78437
|
+
const waiting = new AbortController();
|
|
78438
|
+
const settle = (alive) => {
|
|
78439
|
+
waiting.abort();
|
|
78440
|
+
socket.io.off("ping", onPing);
|
|
78441
|
+
socket.off("disconnect", onDrop);
|
|
78442
|
+
resolve14(alive);
|
|
78443
|
+
};
|
|
78444
|
+
const onPing = () => settle(true);
|
|
78445
|
+
const onDrop = () => settle(false);
|
|
78446
|
+
socket.io.on("ping", onPing);
|
|
78447
|
+
socket.on("disconnect", onDrop);
|
|
78448
|
+
clock.sleep(timeoutMs, AbortSignal.any([waiting.signal, closing.signal])).then(
|
|
78449
|
+
() => settle(false),
|
|
78450
|
+
() => settle(false)
|
|
78451
|
+
);
|
|
78452
|
+
});
|
|
78453
|
+
const recover = async () => {
|
|
78454
|
+
if (current.kind !== "stopped" && socket.connected) {
|
|
78455
|
+
const alive = await hearsServer(options.wakeProbeMs ?? WAKE_PROBE_MS);
|
|
78456
|
+
if (closing.signal.aborted) return "closed";
|
|
78457
|
+
log.info("link.wake_probe", { alive });
|
|
78458
|
+
if (alive) return "alive";
|
|
78459
|
+
}
|
|
78460
|
+
redial2();
|
|
78461
|
+
return "redialed";
|
|
78462
|
+
};
|
|
78416
78463
|
return {
|
|
78417
78464
|
state: () => current,
|
|
78418
78465
|
failureCounts: () => ({ ...counts }),
|
|
78419
|
-
redial:
|
|
78420
|
-
|
|
78421
|
-
|
|
78422
|
-
|
|
78423
|
-
|
|
78424
|
-
|
|
78425
|
-
socket.disconnect();
|
|
78426
|
-
socket.connect();
|
|
78466
|
+
redial: redial2,
|
|
78467
|
+
recoverAfterWake: () => {
|
|
78468
|
+
wake.recovering ??= recover().finally(() => {
|
|
78469
|
+
wake.recovering = null;
|
|
78470
|
+
});
|
|
78471
|
+
return wake.recovering;
|
|
78427
78472
|
},
|
|
78428
78473
|
pushCapabilities,
|
|
78429
78474
|
[Symbol.asyncDispose]: async () => {
|
|
78475
|
+
closing.abort();
|
|
78430
78476
|
cancelRedial();
|
|
78431
78477
|
socket.removeAllListeners();
|
|
78432
78478
|
socket.disconnect();
|
|
@@ -79575,8 +79621,9 @@ async function startMachinePlane(deps) {
|
|
|
79575
79621
|
jobs: [
|
|
79576
79622
|
wakeJob(clock, (sleptMs) => {
|
|
79577
79623
|
log.info("runtime.woke", { sleptMs });
|
|
79578
|
-
link.
|
|
79579
|
-
|
|
79624
|
+
link.recoverAfterWake().then((recovery) => {
|
|
79625
|
+
if (recovery === "alive") refreshDesired();
|
|
79626
|
+
}).catch((error61) => log.warn("runtime.wake_recovery_failed", { error: error61 }));
|
|
79580
79627
|
})
|
|
79581
79628
|
],
|
|
79582
79629
|
clock,
|
|
@@ -80337,7 +80384,8 @@ keeps running and waits for setup.
|
|
|
80337
80384
|
|
|
80338
80385
|
While a turn runs it holds an idle-sleep assertion (macOS caffeinate -i, Linux
|
|
80339
80386
|
systemd-inhibit --what=idle), never the display and never a sleep you ask for. After
|
|
80340
|
-
the computer wakes it
|
|
80387
|
+
the computer wakes it checks its link to Alan, redials if the link has gone quiet, and
|
|
80388
|
+
re-reads its work.
|
|
80341
80389
|
|
|
80342
80390
|
Exit codes: 0 stopped; 75 restart requested;
|
|
80343
80391
|
73 another runtime holds the lock; 78 invalid configuration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alan-ai-hq/agent-manager-darwin-arm64",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.151",
|
|
4
4
|
"description": "Alan machine runtime (alan-agent) for one platform: the official Node.js binary, the runtime bundle and its launcher. Installed by @alan-ai-hq/agent-manager.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://tryalan.ai",
|