@alan-ai-hq/agent-manager-darwin-arm64 0.1.168 → 0.1.169
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 +50 -17
- package/package.json +1 -1
package/alan-agent.cjs
CHANGED
|
@@ -58209,7 +58209,7 @@ var import_node_worker_threads2 = require("worker_threads");
|
|
|
58209
58209
|
// package.json
|
|
58210
58210
|
var package_default = {
|
|
58211
58211
|
name: "@alan-ai-hq/agent-manager",
|
|
58212
|
-
version: "0.1.
|
|
58212
|
+
version: "0.1.169",
|
|
58213
58213
|
private: true,
|
|
58214
58214
|
type: "module",
|
|
58215
58215
|
description: "Alan machine runtime (alan-agent): identity, link, reconciler, session holders, run log, uploader, local API",
|
|
@@ -58779,6 +58779,7 @@ function createHttpTransport() {
|
|
|
58779
58779
|
init_runtime_v2();
|
|
58780
58780
|
init_zod();
|
|
58781
58781
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
58782
|
+
var PROBE_TIMEOUT_MS = 5e3;
|
|
58782
58783
|
var errorBodySchema = external_exports.object({ error: external_exports.string() });
|
|
58783
58784
|
var PROBE_RENEWAL_TOKEN = "alan_runtime_renew_probe_not_a_token";
|
|
58784
58785
|
function isTransportFailure(error62) {
|
|
@@ -58859,8 +58860,14 @@ function createEnrollmentClient({
|
|
|
58859
58860
|
},
|
|
58860
58861
|
servesMachineRoutes: async (signal) => {
|
|
58861
58862
|
const body = { renewalToken: PROBE_RENEWAL_TOKEN };
|
|
58862
|
-
const
|
|
58863
|
-
|
|
58863
|
+
const bounded = AbortSignal.any([signal, AbortSignal.timeout(PROBE_TIMEOUT_MS)]);
|
|
58864
|
+
try {
|
|
58865
|
+
const response = await post(MACHINE_PATHS.renew, body, bounded);
|
|
58866
|
+
return response.status === 401 && errorCode(response) === "invalid_renewal_token";
|
|
58867
|
+
} catch (error62) {
|
|
58868
|
+
if (signal.aborted || !isTransportFailure(error62)) throw error62;
|
|
58869
|
+
return false;
|
|
58870
|
+
}
|
|
58864
58871
|
},
|
|
58865
58872
|
renew: async (renewalToken, signal) => {
|
|
58866
58873
|
const body = { renewalToken };
|
|
@@ -60365,7 +60372,7 @@ var import_node_child_process3 = require("child_process");
|
|
|
60365
60372
|
var import_promises8 = require("fs/promises");
|
|
60366
60373
|
var import_node_util3 = require("util");
|
|
60367
60374
|
var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
|
|
60368
|
-
var
|
|
60375
|
+
var PROBE_TIMEOUT_MS2 = 2e3;
|
|
60369
60376
|
async function readProcessRss(pid) {
|
|
60370
60377
|
if (process.platform === "linux") {
|
|
60371
60378
|
const status = await (0, import_promises8.readFile)(`/proc/${pid}/status`, "utf8").catch(() => null);
|
|
@@ -60382,7 +60389,7 @@ async function readProcessRss(pid) {
|
|
|
60382
60389
|
"-Command",
|
|
60383
60390
|
`(Get-Process -Id ${pid} -ErrorAction Stop).WorkingSet64`
|
|
60384
60391
|
],
|
|
60385
|
-
{ timeout:
|
|
60392
|
+
{ timeout: PROBE_TIMEOUT_MS2, windowsHide: true }
|
|
60386
60393
|
);
|
|
60387
60394
|
const bytes = Number(stdout.trim());
|
|
60388
60395
|
return stdout.trim() && Number.isFinite(bytes) && bytes > 0 ? bytes : null;
|
|
@@ -60392,7 +60399,7 @@ async function readProcessRss(pid) {
|
|
|
60392
60399
|
}
|
|
60393
60400
|
try {
|
|
60394
60401
|
const { stdout } = await execFileAsync3("ps", ["-o", "rss=", "-p", String(pid)], {
|
|
60395
|
-
timeout:
|
|
60402
|
+
timeout: PROBE_TIMEOUT_MS2
|
|
60396
60403
|
});
|
|
60397
60404
|
const kilobytes = Number(stdout.trim());
|
|
60398
60405
|
return stdout.trim().length > 0 && Number.isFinite(kilobytes) ? kilobytes * 1024 : null;
|
|
@@ -60410,7 +60417,7 @@ async function processMemoryRows() {
|
|
|
60410
60417
|
"-Command",
|
|
60411
60418
|
"Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,WorkingSetSize | ConvertTo-Json -Compress"
|
|
60412
60419
|
],
|
|
60413
|
-
{ timeout:
|
|
60420
|
+
{ timeout: PROBE_TIMEOUT_MS2, maxBuffer: 8 * 1024 * 1024, windowsHide: true }
|
|
60414
60421
|
);
|
|
60415
60422
|
const parsed = JSON.parse(stdout2);
|
|
60416
60423
|
if (!Array.isArray(parsed)) return [];
|
|
@@ -60427,7 +60434,7 @@ async function processMemoryRows() {
|
|
|
60427
60434
|
});
|
|
60428
60435
|
}
|
|
60429
60436
|
const { stdout } = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid=,rss="], {
|
|
60430
|
-
timeout:
|
|
60437
|
+
timeout: PROBE_TIMEOUT_MS2,
|
|
60431
60438
|
maxBuffer: 8 * 1024 * 1024
|
|
60432
60439
|
});
|
|
60433
60440
|
return stdout.trim().split("\n").flatMap((line) => {
|
|
@@ -74767,6 +74774,9 @@ async function installedServiceSpec(ctx) {
|
|
|
74767
74774
|
}
|
|
74768
74775
|
return spec;
|
|
74769
74776
|
}
|
|
74777
|
+
function sameOrigin(requested, configured) {
|
|
74778
|
+
return URL.canParse(requested) && new URL(requested).origin === new URL(configured).origin;
|
|
74779
|
+
}
|
|
74770
74780
|
function flagValue(argv, name) {
|
|
74771
74781
|
const index = argv.indexOf(name);
|
|
74772
74782
|
if (index !== -1) {
|
|
@@ -75323,6 +75333,10 @@ async function scrubLegacyInstall(install2) {
|
|
|
75323
75333
|
await (0, import_promises76.rm)(install2.configPath, { force: true });
|
|
75324
75334
|
await (0, import_promises76.rm)(install2.ownerLeasePath, { force: true });
|
|
75325
75335
|
}
|
|
75336
|
+
async function retireLegacyInstall(install2) {
|
|
75337
|
+
await (0, import_promises76.rename)(install2.configPath, `${install2.configPath}.retired-v1`);
|
|
75338
|
+
await (0, import_promises76.rm)(install2.ownerLeasePath, { force: true });
|
|
75339
|
+
}
|
|
75326
75340
|
async function exchangeCredential(deps) {
|
|
75327
75341
|
const { config: config2 } = deps.install;
|
|
75328
75342
|
if (deps.setup !== void 0) {
|
|
@@ -75507,7 +75521,7 @@ async function runStatus(argv, ctx = cliContext()) {
|
|
|
75507
75521
|
}
|
|
75508
75522
|
|
|
75509
75523
|
// src/cli/commands/doctor.ts
|
|
75510
|
-
var
|
|
75524
|
+
var PROBE_TIMEOUT_MS3 = 1e4;
|
|
75511
75525
|
var LOCAL_TIMEOUT_MS = 3e3;
|
|
75512
75526
|
var DISK_WARN_BYTES = 1024 ** 3;
|
|
75513
75527
|
var DISK_FAIL_BYTES = 100 * 1024 ** 2;
|
|
@@ -75599,7 +75613,7 @@ async function credentialCheck(ctx) {
|
|
|
75599
75613
|
async function serverCheck(facts) {
|
|
75600
75614
|
const api = createApiClient({ apiUrl: facts.apiUrl, accessToken: () => facts.accessToken });
|
|
75601
75615
|
try {
|
|
75602
|
-
const desired = await api.fetchDesired(AbortSignal.timeout(
|
|
75616
|
+
const desired = await api.fetchDesired(AbortSignal.timeout(PROBE_TIMEOUT_MS3));
|
|
75603
75617
|
return check2("server", "ok", `${facts.apiUrl} accepts this machine's credential`, {
|
|
75604
75618
|
machineId: facts.machineId,
|
|
75605
75619
|
desiredRuns: desired.runs.length
|
|
@@ -75625,7 +75639,7 @@ function isStale(machine, now) {
|
|
|
75625
75639
|
async function machinesCheck(facts) {
|
|
75626
75640
|
const api = createApiClient({ apiUrl: facts.apiUrl, accessToken: () => facts.accessToken });
|
|
75627
75641
|
try {
|
|
75628
|
-
const machines = await api.listSiblings(AbortSignal.timeout(
|
|
75642
|
+
const machines = await api.listSiblings(AbortSignal.timeout(PROBE_TIMEOUT_MS3));
|
|
75629
75643
|
if (machines === null) {
|
|
75630
75644
|
return check2("machines", "skipped", `${facts.apiUrl} does not list machines`);
|
|
75631
75645
|
}
|
|
@@ -75655,7 +75669,7 @@ async function releaseCheck(ctx, facts) {
|
|
|
75655
75669
|
const apiUrl = facts?.apiUrl ?? ctx.config.apiUrl;
|
|
75656
75670
|
const api = createApiClient({ apiUrl, accessToken: () => facts?.accessToken ?? "" });
|
|
75657
75671
|
try {
|
|
75658
|
-
const release2 = await api.currentRelease(AbortSignal.timeout(
|
|
75672
|
+
const release2 = await api.currentRelease(AbortSignal.timeout(PROBE_TIMEOUT_MS3));
|
|
75659
75673
|
const layout = installLayout(ctx.config.installDir, ctx.config.profile);
|
|
75660
75674
|
const plan2 = planUpdate({
|
|
75661
75675
|
current: package_default.version,
|
|
@@ -76349,10 +76363,32 @@ var import_node_path80 = require("path");
|
|
|
76349
76363
|
init_zod();
|
|
76350
76364
|
|
|
76351
76365
|
// src/cli/legacy.ts
|
|
76366
|
+
async function staleLegacyReason(ctx, install2) {
|
|
76367
|
+
if (!sameOrigin(install2.config.apiUrl, ctx.config.apiUrl)) return "other_server";
|
|
76368
|
+
const registered = await readMachineFile(ctx.paths) !== null || (await readInstallation(ctx.paths))?.machineId !== void 0;
|
|
76369
|
+
return registered ? "already_on_v2" : null;
|
|
76370
|
+
}
|
|
76352
76371
|
async function adoptLegacyInstall(ctx, deps, adoption) {
|
|
76353
76372
|
if (!ctx.config.adoptsLegacyInstall) return null;
|
|
76354
76373
|
const install2 = await findLegacyInstall(ctx.config.home, ctx.config.profile);
|
|
76355
76374
|
if (install2 === null) return null;
|
|
76375
|
+
const stale = await staleLegacyReason(ctx, install2);
|
|
76376
|
+
if (stale !== null) {
|
|
76377
|
+
if (adoption.dryRun === true) {
|
|
76378
|
+
return {
|
|
76379
|
+
kind: "planned",
|
|
76380
|
+
steps: ["remove the v1 service", `move ${install2.configPath} aside (${stale})`]
|
|
76381
|
+
};
|
|
76382
|
+
}
|
|
76383
|
+
const removal = await removeLegacyService(ctx.host, ctx.config.profile);
|
|
76384
|
+
await retireLegacyInstall(install2);
|
|
76385
|
+
deps.log.info("legacy.retired", {
|
|
76386
|
+
reason: stale,
|
|
76387
|
+
apiUrl: install2.config.apiUrl,
|
|
76388
|
+
serviceFound: removal.found
|
|
76389
|
+
});
|
|
76390
|
+
return { kind: "retired", reason: stale };
|
|
76391
|
+
}
|
|
76356
76392
|
return migrateFromV1({
|
|
76357
76393
|
install: install2,
|
|
76358
76394
|
removeService: () => removeLegacyService(ctx.host, ctx.config.profile),
|
|
@@ -81648,7 +81684,7 @@ function refusalFailure(refusal2) {
|
|
|
81648
81684
|
var import_promises82 = require("dns/promises");
|
|
81649
81685
|
var import_node_net5 = require("net");
|
|
81650
81686
|
var import_node_tls2 = require("tls");
|
|
81651
|
-
var
|
|
81687
|
+
var PROBE_TIMEOUT_MS4 = 5e3;
|
|
81652
81688
|
function openSocket(url3) {
|
|
81653
81689
|
const secure = url3.protocol === "https:" || url3.protocol === "wss:";
|
|
81654
81690
|
const host = url3.hostname;
|
|
@@ -81669,7 +81705,7 @@ async function connectOnce(url3, clock) {
|
|
|
81669
81705
|
socket.once(ready, () => resolve14(null));
|
|
81670
81706
|
socket.once("error", (error62) => resolve14(classifyTransportFailure(error62)));
|
|
81671
81707
|
}),
|
|
81672
|
-
clock.sleep(
|
|
81708
|
+
clock.sleep(PROBE_TIMEOUT_MS4, timer.signal).then(
|
|
81673
81709
|
() => "connection_timeout",
|
|
81674
81710
|
() => null
|
|
81675
81711
|
)
|
|
@@ -83581,9 +83617,6 @@ async function startMachinePlane(deps) {
|
|
|
83581
83617
|
// src/cli/commands/machine-slot.ts
|
|
83582
83618
|
var NOT_SET_UP_LINK = { state: "stopped" };
|
|
83583
83619
|
var FINAL_UPLOAD_WAIT_MS = 2e4;
|
|
83584
|
-
function sameOrigin(requested, configured) {
|
|
83585
|
-
return URL.canParse(requested) && new URL(requested).origin === new URL(configured).origin;
|
|
83586
|
-
}
|
|
83587
83620
|
function faultMessage(error62) {
|
|
83588
83621
|
return error62 instanceof Error ? error62.message : String(error62);
|
|
83589
83622
|
}
|
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.169",
|
|
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",
|