@integrity-labs/agt-cli 0.28.637 → 0.28.638
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/bin/agt.js +5 -5
- package/dist/{chunk-3JBA6RYG.js → chunk-LCKKFDCR.js} +109 -35
- package/dist/chunk-LCKKFDCR.js.map +1 -0
- package/dist/{chunk-JT2JQUK3.js → chunk-MAZUBHNT.js} +1 -1
- package/dist/chunk-MAZUBHNT.js.map +1 -0
- package/dist/{chunk-W4GVD3KK.js → chunk-MRQ2GRTN.js} +2 -2
- package/dist/{claude-pair-runtime-CE72HQE7.js → claude-pair-runtime-EZUIIJYB.js} +2 -2
- package/dist/lib/manager-worker.js +14 -39
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-SZLOBXBQ.js → persistent-session-NMGMDXTO.js} +3 -3
- package/dist/{responsiveness-probe-MDPLVVKC.js → responsiveness-probe-ZUFKGLDN.js} +3 -3
- package/dist/{session-auth-dead-ZLENJLLO.js → session-auth-dead-TDWEX7R5.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3JBA6RYG.js.map +0 -1
- package/dist/chunk-JT2JQUK3.js.map +0 -1
- /package/dist/{chunk-W4GVD3KK.js.map → chunk-MRQ2GRTN.js.map} +0 -0
- /package/dist/{claude-pair-runtime-CE72HQE7.js.map → claude-pair-runtime-EZUIIJYB.js.map} +0 -0
- /package/dist/{persistent-session-SZLOBXBQ.js.map → persistent-session-NMGMDXTO.js.map} +0 -0
- /package/dist/{responsiveness-probe-MDPLVVKC.js.map → responsiveness-probe-ZUFKGLDN.js.map} +0 -0
- /package/dist/{session-auth-dead-ZLENJLLO.js.map → session-auth-dead-TDWEX7R5.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -40,10 +40,10 @@ import {
|
|
|
40
40
|
success,
|
|
41
41
|
table,
|
|
42
42
|
warn
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-LCKKFDCR.js";
|
|
44
44
|
import {
|
|
45
45
|
readDirectChatSessionState
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-MRQ2GRTN.js";
|
|
47
47
|
import {
|
|
48
48
|
AnchorSessionClient,
|
|
49
49
|
CHANNEL_REGISTRY,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
requiredMcpWildcard,
|
|
74
74
|
resolveChannels,
|
|
75
75
|
serializeManifestForSlackCli
|
|
76
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-MAZUBHNT.js";
|
|
77
77
|
import "../chunk-XWVM4KPK.js";
|
|
78
78
|
|
|
79
79
|
// src/bin/agt.ts
|
|
@@ -4909,7 +4909,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4909
4909
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4910
4910
|
import chalk18 from "chalk";
|
|
4911
4911
|
import ora16 from "ora";
|
|
4912
|
-
var cliVersion = true ? "0.28.
|
|
4912
|
+
var cliVersion = true ? "0.28.638" : "dev";
|
|
4913
4913
|
async function fetchLatestVersion() {
|
|
4914
4914
|
const host2 = getHost();
|
|
4915
4915
|
if (!host2) return null;
|
|
@@ -6089,7 +6089,7 @@ function handleError(err) {
|
|
|
6089
6089
|
}
|
|
6090
6090
|
|
|
6091
6091
|
// src/bin/agt.ts
|
|
6092
|
-
var cliVersion2 = true ? "0.28.
|
|
6092
|
+
var cliVersion2 = true ? "0.28.638" : "dev";
|
|
6093
6093
|
var program = new Command();
|
|
6094
6094
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
6095
6095
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
buildRemoteMcpEntry,
|
|
7
7
|
expandTemplateVars,
|
|
8
8
|
isolationMode,
|
|
9
|
+
log,
|
|
9
10
|
parseEnvIntegrations
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MRQ2GRTN.js";
|
|
11
12
|
import {
|
|
12
13
|
BIND_FAILURE_QUARANTINE_THRESHOLD,
|
|
13
14
|
INTEGRATIONS_SECTION_END,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
resolveConnectivityProbe,
|
|
55
56
|
worseConnectivityOutcome,
|
|
56
57
|
wrapScheduledTaskPrompt
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-MAZUBHNT.js";
|
|
58
59
|
import {
|
|
59
60
|
parsePsRows
|
|
60
61
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -1537,7 +1538,7 @@ function getAgentDir(codeName) {
|
|
|
1537
1538
|
return resolveRealAgentPath(join2(getHomeDir(), ".augmented", codeName));
|
|
1538
1539
|
}
|
|
1539
1540
|
var migratedCodeNames = /* @__PURE__ */ new Set();
|
|
1540
|
-
function migrateLegacyClaudecodeDir(codeName,
|
|
1541
|
+
function migrateLegacyClaudecodeDir(codeName, log2) {
|
|
1541
1542
|
assertValidCodeName(codeName);
|
|
1542
1543
|
if (migratedCodeNames.has(codeName))
|
|
1543
1544
|
return;
|
|
@@ -1548,7 +1549,7 @@ function migrateLegacyClaudecodeDir(codeName, log) {
|
|
|
1548
1549
|
}
|
|
1549
1550
|
const newRoot = getAgentDir(codeName);
|
|
1550
1551
|
const emit = (msg) => {
|
|
1551
|
-
|
|
1552
|
+
log2?.(msg);
|
|
1552
1553
|
};
|
|
1553
1554
|
try {
|
|
1554
1555
|
const walkAndMigrate = (srcDir, destDir) => {
|
|
@@ -6072,7 +6073,7 @@ function exchangeFailureKind(err) {
|
|
|
6072
6073
|
}
|
|
6073
6074
|
|
|
6074
6075
|
// src/lib/api-client.ts
|
|
6075
|
-
var agtCliVersion = true ? "0.28.
|
|
6076
|
+
var agtCliVersion = true ? "0.28.638" : "dev";
|
|
6076
6077
|
var lastConfigHash = null;
|
|
6077
6078
|
function setConfigHash(hash) {
|
|
6078
6079
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -6886,7 +6887,7 @@ function findMcpChildrenForAgent(args) {
|
|
|
6886
6887
|
return matched;
|
|
6887
6888
|
}
|
|
6888
6889
|
function reapStaleMcpChildren(args) {
|
|
6889
|
-
const { log, codeName, serverKeys, mcpJson, graceMs = 5e3, isolated = false } = args;
|
|
6890
|
+
const { log: log2, codeName, serverKeys, mcpJson, graceMs = 5e3, isolated = false } = args;
|
|
6890
6891
|
if (serverKeys.length === 0) return [];
|
|
6891
6892
|
const runPs = args.runPs ?? (isolated ? () => execFileSync("docker", ["exec", `agt-${codeName}`, "ps", "-eo", "pid,ppid,args"], {
|
|
6892
6893
|
encoding: "utf-8",
|
|
@@ -6929,7 +6930,7 @@ function reapStaleMcpChildren(args) {
|
|
|
6929
6930
|
try {
|
|
6930
6931
|
psOutput = runPs();
|
|
6931
6932
|
} catch (err) {
|
|
6932
|
-
|
|
6933
|
+
log2(`[stale-mcp-reaper] ps invocation failed for '${codeName}': ${err.message} \u2014 skipping reap`);
|
|
6933
6934
|
return [];
|
|
6934
6935
|
}
|
|
6935
6936
|
const rows = parsePsRows(psOutput);
|
|
@@ -6941,7 +6942,7 @@ function reapStaleMcpChildren(args) {
|
|
|
6941
6942
|
const pkgMatch = argv.match(/(@[a-z0-9_-]+\/[a-z0-9_-]+|[a-z0-9_-]+-mcp-server|[a-z0-9_-]+-mcp\b)/i);
|
|
6942
6943
|
return pkgMatch ? `${pkgMatch[1]} (pid ${pid})` : `pid ${pid}`;
|
|
6943
6944
|
};
|
|
6944
|
-
|
|
6945
|
+
log2(
|
|
6945
6946
|
`[stale-mcp-reaper] '${codeName}': rotating ${targets.length} stale MCP child(ren) for [${serverKeys.join(", ")}]: ${targets.map(describe).join(", ")}`
|
|
6946
6947
|
);
|
|
6947
6948
|
for (const pid of targets) {
|
|
@@ -6963,7 +6964,7 @@ function reapStaleMcpChildren(args) {
|
|
|
6963
6964
|
try {
|
|
6964
6965
|
freshPsOutput = runPs();
|
|
6965
6966
|
} catch (err) {
|
|
6966
|
-
|
|
6967
|
+
log2(`[stale-mcp-reaper] '${codeName}': fresh ps for SIGKILL re-verify failed: ${err.message} \u2014 skipping SIGKILL pass`);
|
|
6967
6968
|
return;
|
|
6968
6969
|
}
|
|
6969
6970
|
const stillOwned = new Set(
|
|
@@ -6977,14 +6978,14 @@ function reapStaleMcpChildren(args) {
|
|
|
6977
6978
|
);
|
|
6978
6979
|
const stragglers = targets.filter((pid) => isAlive(pid) && stillOwned.has(pid));
|
|
6979
6980
|
if (stragglers.length === 0) return;
|
|
6980
|
-
|
|
6981
|
+
log2(
|
|
6981
6982
|
`[stale-mcp-reaper] '${codeName}': ${stragglers.length} child(ren) survived SIGTERM; sending SIGKILL: ${stragglers.map(describe).join(", ")}`
|
|
6982
6983
|
);
|
|
6983
6984
|
for (const pid of stragglers) {
|
|
6984
6985
|
killProcess(pid, "SIGKILL");
|
|
6985
6986
|
}
|
|
6986
6987
|
} catch (err) {
|
|
6987
|
-
|
|
6988
|
+
log2(`[stale-mcp-reaper] '${codeName}': error in SIGKILL pass: ${err.message}`);
|
|
6988
6989
|
}
|
|
6989
6990
|
}, graceMs).unref();
|
|
6990
6991
|
return targets;
|
|
@@ -7053,7 +7054,7 @@ function findMissingMcpServers(args) {
|
|
|
7053
7054
|
}
|
|
7054
7055
|
function reapMissingMcpSessions(args) {
|
|
7055
7056
|
const {
|
|
7056
|
-
log,
|
|
7057
|
+
log: log2,
|
|
7057
7058
|
codeName,
|
|
7058
7059
|
mcpJson,
|
|
7059
7060
|
sessionStartedAt,
|
|
@@ -7109,7 +7110,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7109
7110
|
try {
|
|
7110
7111
|
psOutput = runPs();
|
|
7111
7112
|
} catch (err) {
|
|
7112
|
-
|
|
7113
|
+
log2(`[mcp-presence-reaper] ps invocation failed for '${codeName}': ${err.message} \u2014 skipping`);
|
|
7113
7114
|
return { missing: [], restarted: false, reason: "healthy" };
|
|
7114
7115
|
}
|
|
7115
7116
|
const rows = parsePsRows(psOutput);
|
|
@@ -7125,7 +7126,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7125
7126
|
try {
|
|
7126
7127
|
onRotationRespawnOutcome(codeName, key, outcome);
|
|
7127
7128
|
} catch (err) {
|
|
7128
|
-
|
|
7129
|
+
log2(
|
|
7129
7130
|
`[mcp-presence-reaper] onRotationRespawnOutcome callback threw for '${codeName}:${key}' (suppressed; reaper continues): ${err.message}`
|
|
7130
7131
|
);
|
|
7131
7132
|
}
|
|
@@ -7152,7 +7153,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7152
7153
|
escalated: false
|
|
7153
7154
|
};
|
|
7154
7155
|
if (priorStall && priorStall !== stall) {
|
|
7155
|
-
|
|
7156
|
+
log2(
|
|
7156
7157
|
`[mcp-presence-reaper] '${codeName}:${key}' discarding stall state from a previous rotation (rotation=${priorStall.rotationRecordedAt}, probes=${priorStall.probeAttempts}, escalated=${priorStall.escalated}) \u2014 this is a NEW rotation (rotation=${rotationRecordedAt}) and gets a full prompt-probe budget (ENG-8225)`
|
|
7157
7158
|
);
|
|
7158
7159
|
}
|
|
@@ -7170,14 +7171,14 @@ function reapMissingMcpSessions(args) {
|
|
|
7170
7171
|
stall.escalated = true;
|
|
7171
7172
|
rotationProbeExhausted.push(key);
|
|
7172
7173
|
recordRotationOutcome(key, "never-respawned");
|
|
7173
|
-
|
|
7174
|
+
log2(
|
|
7174
7175
|
`[mcp-presence-reaper] '${codeName}:${key}' rotation outcome=never-respawned \u2014 child SIGTERM'd by stale-mcp-reaper never returned after ${stall.probeAttempts} prompt bind-probe(s); escalating (integration marked unhealthy + reaper_action alert) and releasing to the normal restart path (ENG-8225)`
|
|
7175
7176
|
);
|
|
7176
7177
|
if (onRotationRespawnGaveUp) {
|
|
7177
7178
|
try {
|
|
7178
7179
|
onRotationRespawnGaveUp(codeName, key, { attempts: stall.probeAttempts });
|
|
7179
7180
|
} catch (err) {
|
|
7180
|
-
|
|
7181
|
+
log2(
|
|
7181
7182
|
`[mcp-presence-reaper] onRotationRespawnGaveUp callback threw for '${codeName}:${key}' (suppressed; reaper continues): ${err.message}`
|
|
7182
7183
|
);
|
|
7183
7184
|
}
|
|
@@ -7194,7 +7195,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7194
7195
|
maxAttempts: maxRotationPromptProbes
|
|
7195
7196
|
});
|
|
7196
7197
|
} catch (err) {
|
|
7197
|
-
|
|
7198
|
+
log2(
|
|
7198
7199
|
`[mcp-presence-reaper] onRotationRespawnStalled callback threw for '${codeName}:${key}' (suppressed; falling back to the pre-ENG-8225 restart path): ${err.message}`
|
|
7199
7200
|
);
|
|
7200
7201
|
armed = false;
|
|
@@ -7207,17 +7208,17 @@ function reapMissingMcpSessions(args) {
|
|
|
7207
7208
|
stall.probeAttempts = attempt;
|
|
7208
7209
|
stall.lastProbeAt = now();
|
|
7209
7210
|
rotationProbeArmed.push(key);
|
|
7210
|
-
|
|
7211
|
+
log2(
|
|
7211
7212
|
`[mcp-presence-reaper] '${codeName}:${key}' rotation grace expired (${rotationGraceMs}ms) with no live child and no tool call to respawn it \u2014 armed prompt bind-probe ${attempt}/${maxRotationPromptProbes} (ENG-7429) instead of restarting the session (ENG-8225)`
|
|
7212
7213
|
);
|
|
7213
7214
|
}
|
|
7214
7215
|
if (rotationGraced.length > 0) {
|
|
7215
|
-
|
|
7216
|
+
log2(
|
|
7216
7217
|
`[mcp-presence-reaper] '${codeName}': skipping [${rotationGraced.join(", ")}] within rotation grace window (${rotationGraceMs}ms) \u2014 child(ren) just SIGTERM'd by stale-mcp-reaper, awaiting respawn on next tool call (ENG-5344)`
|
|
7217
7218
|
);
|
|
7218
7219
|
}
|
|
7219
7220
|
if (rotationProbeWaiting.length > 0) {
|
|
7220
|
-
|
|
7221
|
+
log2(
|
|
7221
7222
|
`[mcp-presence-reaper] '${codeName}': skipping [${rotationProbeWaiting.join(", ")}] \u2014 prompt bind-probe already armed for the stalled rotation, waiting out the ${rotationPromptProbeIntervalMs}ms re-arm interval (ENG-8225)`
|
|
7222
7223
|
);
|
|
7223
7224
|
}
|
|
@@ -7240,7 +7241,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7240
7241
|
key,
|
|
7241
7242
|
viaProbe ? "respawned-after-prompt-probe" : "respawned-on-tool-call"
|
|
7242
7243
|
);
|
|
7243
|
-
|
|
7244
|
+
log2(
|
|
7244
7245
|
viaProbe ? `[mcp-presence-reaper] '${codeName}:${key}' rotation outcome=respawned-after-prompt-probe \u2014 child is live again after ${stall?.probeAttempts} prompt bind-probe(s)${stall?.escalated ? " (recovered AFTER escalation \u2014 the earlier never-respawned verdict stands for that window)" : ""}, no session restart needed (ENG-8225)` : `[mcp-presence-reaper] '${codeName}:${key}' rotation outcome=respawned-on-tool-call \u2014 child returned on the agent's own next tool call, ENG-5344's assumption held (ENG-8225)`
|
|
7245
7246
|
);
|
|
7246
7247
|
clearStaleRotation(codeName, [key]);
|
|
@@ -7308,7 +7309,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7308
7309
|
genuinelyDead.push(key);
|
|
7309
7310
|
if (currentGenerationExternallyStarted && !state.deadChannelLogged) {
|
|
7310
7311
|
state.deadChannelLogged = true;
|
|
7311
|
-
|
|
7312
|
+
log2(
|
|
7312
7313
|
`[mcp-presence-reaper] '${codeName}:${key}' continuously missing ${Math.round((nowMs - state.continuouslyMissingSince) / 6e4)}m (> ${Math.round(deadChannelMs / 6e4)}m) \u2014 genuinely dead, overriding storm-awareness so it can reach give-up/quarantine instead of churning (ENG-8062)`
|
|
7313
7314
|
);
|
|
7314
7315
|
}
|
|
@@ -7334,7 +7335,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7334
7335
|
state.gaveUp = true;
|
|
7335
7336
|
if (!state.gaveUpLogged) {
|
|
7336
7337
|
const cause = overAttemptsCap ? `${MAX_PRESENCE_RESTART_ATTEMPTS} consecutive failed restarts \u2014 declared but never recovers (likely orphaned config; see ENG-5279)` : `${restartsInWindow} restarts within ${Math.round(BACKOFF_WINDOW_MS / 6e4)}m \u2014 persistently flapping (crash-loop; ENG-6480)`;
|
|
7337
|
-
|
|
7338
|
+
log2(
|
|
7338
7339
|
`[mcp-presence-reaper] giving up on '${codeName}:${key}' after ${cause}`
|
|
7339
7340
|
);
|
|
7340
7341
|
state.gaveUpLogged = true;
|
|
@@ -7342,7 +7343,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7342
7343
|
try {
|
|
7343
7344
|
onGiveUp(codeName, key);
|
|
7344
7345
|
} catch (err) {
|
|
7345
|
-
|
|
7346
|
+
log2(
|
|
7346
7347
|
`[mcp-presence-reaper] onGiveUp callback threw for '${codeName}:${key}' (suppressed; reaper continues): ${err.message}`
|
|
7347
7348
|
);
|
|
7348
7349
|
}
|
|
@@ -7354,21 +7355,21 @@ function reapMissingMcpSessions(args) {
|
|
|
7354
7355
|
state.quarantineLogged = true;
|
|
7355
7356
|
if (quarantineMode === "enforce") {
|
|
7356
7357
|
quarantined.push(key);
|
|
7357
|
-
|
|
7358
|
+
log2(
|
|
7358
7359
|
`[mcp-presence-reaper] QUARANTINE '${codeName}:${key}' \u2014 optional channel dead past restart budget + ${quarantineDwellMs}ms dwell; dropping from provisioned set so the dead channel stops restarting the whole session (ENG-5932)`
|
|
7359
7360
|
);
|
|
7360
7361
|
if (onQuarantine) {
|
|
7361
7362
|
try {
|
|
7362
7363
|
onQuarantine(codeName, key);
|
|
7363
7364
|
} catch (err) {
|
|
7364
|
-
|
|
7365
|
+
log2(
|
|
7365
7366
|
`[mcp-presence-reaper] onQuarantine callback threw for '${codeName}:${key}' (suppressed; reaper continues): ${err.message}`
|
|
7366
7367
|
);
|
|
7367
7368
|
}
|
|
7368
7369
|
}
|
|
7369
7370
|
} else {
|
|
7370
7371
|
wouldQuarantine.push(key);
|
|
7371
|
-
|
|
7372
|
+
log2(
|
|
7372
7373
|
`[mcp-presence-reaper] SHADOW would-quarantine '${codeName}:${key}' \u2014 optional channel dead past restart budget + ${quarantineDwellMs}ms dwell; no action taken (ENG-5932 shadow mode)`
|
|
7373
7374
|
);
|
|
7374
7375
|
}
|
|
@@ -7390,7 +7391,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7390
7391
|
if (active.length === 0) {
|
|
7391
7392
|
const reason = backingOff.length > 0 ? "backoff" : "all-keys-over-cap";
|
|
7392
7393
|
if (backingOff.length > 0) {
|
|
7393
|
-
|
|
7394
|
+
log2(
|
|
7394
7395
|
`[mcp-presence-reaper] '${codeName}': holding off restart for [${backingOff.join(", ")}] \u2014 escalating backoff interval not yet elapsed (ENG-6480)${givenUp.length > 0 ? ` (given up: [${givenUp.join(", ")}])` : ""}`
|
|
7395
7396
|
);
|
|
7396
7397
|
}
|
|
@@ -7411,7 +7412,7 @@ function reapMissingMcpSessions(args) {
|
|
|
7411
7412
|
};
|
|
7412
7413
|
}
|
|
7413
7414
|
const givenUpSuffix = givenUp.length > 0 ? ` (skipping over-cap: [${givenUp.join(", ")}])` : "";
|
|
7414
|
-
|
|
7415
|
+
log2(
|
|
7415
7416
|
`[mcp-presence-reaper] '${codeName}': declared MCP(s) [${active.join(", ")}] have no live children \u2014 restarting session${givenUpSuffix}`
|
|
7416
7417
|
);
|
|
7417
7418
|
if (onRestart) {
|
|
@@ -7419,13 +7420,13 @@ function reapMissingMcpSessions(args) {
|
|
|
7419
7420
|
const maybePromise = onRestart(codeName, { activeKeys: active, givenUpKeys: givenUp });
|
|
7420
7421
|
if (maybePromise && typeof maybePromise.then === "function") {
|
|
7421
7422
|
void maybePromise.then(void 0, (err) => {
|
|
7422
|
-
|
|
7423
|
+
log2(
|
|
7423
7424
|
`[mcp-presence-reaper] onRestart callback rejected for '${codeName}' (suppressed; restart proceeds): ${err.message}`
|
|
7424
7425
|
);
|
|
7425
7426
|
});
|
|
7426
7427
|
}
|
|
7427
7428
|
} catch (err) {
|
|
7428
|
-
|
|
7429
|
+
log2(
|
|
7429
7430
|
`[mcp-presence-reaper] onRestart callback threw for '${codeName}' (suppressed; restart proceeds): ${err.message}`
|
|
7430
7431
|
);
|
|
7431
7432
|
}
|
|
@@ -8861,6 +8862,63 @@ function provision(input, frameworkId = "claude-code") {
|
|
|
8861
8862
|
};
|
|
8862
8863
|
}
|
|
8863
8864
|
|
|
8865
|
+
// src/lib/startup-telemetry.ts
|
|
8866
|
+
var SLOW_STARTUP_WARN_MS = 6e4;
|
|
8867
|
+
function shouldWarnSlowStartup(elapsedMs, opts = {}) {
|
|
8868
|
+
if (!Number.isFinite(elapsedMs) || elapsedMs < 0) return false;
|
|
8869
|
+
const threshold = opts.thresholdMs ?? SLOW_STARTUP_WARN_MS;
|
|
8870
|
+
if (!Number.isFinite(threshold) || threshold < 0) return false;
|
|
8871
|
+
return elapsedMs >= threshold;
|
|
8872
|
+
}
|
|
8873
|
+
function formatStartupElapsed(elapsedMs) {
|
|
8874
|
+
if (!Number.isFinite(elapsedMs) || elapsedMs < 0) return "unknown";
|
|
8875
|
+
const seconds = elapsedMs / 1e3;
|
|
8876
|
+
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
8877
|
+
return `${seconds.toFixed(1)}s (${(seconds / 60).toFixed(1)} min)`;
|
|
8878
|
+
}
|
|
8879
|
+
function describeStartupCompletion(elapsedMs, opts = {}) {
|
|
8880
|
+
const elapsed = formatStartupElapsed(elapsedMs);
|
|
8881
|
+
if (!shouldWarnSlowStartup(elapsedMs, opts)) {
|
|
8882
|
+
return { warn: false, message: `[startup] ready in ${elapsed}` };
|
|
8883
|
+
}
|
|
8884
|
+
const threshold = opts.thresholdMs ?? SLOW_STARTUP_WARN_MS;
|
|
8885
|
+
return {
|
|
8886
|
+
warn: true,
|
|
8887
|
+
message: `[startup] SLOW BOOT \u2014 ready in ${elapsed}, over the ${formatStartupElapsed(threshold)} threshold. MCP bundles are deployed during startup, so agents spawning in this window can come up with no MCP tools (ENG-9129). Check for a build/install running on the host.`
|
|
8888
|
+
};
|
|
8889
|
+
}
|
|
8890
|
+
var SLOW_MODULE_LOAD_WARN_MS = 1e4;
|
|
8891
|
+
function describeWorkerModuleLoad(elapsedMs, opts = {}) {
|
|
8892
|
+
const elapsed = formatStartupElapsed(elapsedMs);
|
|
8893
|
+
const threshold = opts.thresholdMs ?? SLOW_MODULE_LOAD_WARN_MS;
|
|
8894
|
+
if (!shouldWarnSlowStartup(elapsedMs, { thresholdMs: threshold })) {
|
|
8895
|
+
return { warn: false, message: `[startup] worker module loaded in ${elapsed}` };
|
|
8896
|
+
}
|
|
8897
|
+
return {
|
|
8898
|
+
warn: true,
|
|
8899
|
+
message: `[startup] SLOW MODULE LOAD \u2014 worker module took ${elapsed} to import, over the ${formatStartupElapsed(threshold)} threshold. The manager had already written its pidfile and reported itself started, so it looked healthy for this whole window while doing nothing \u2014 and MCP bundles are deployed after this point, so agents spawning meanwhile come up with no MCP tools (ENG-9129). Check for a build, install or filesystem rebuild running on the host.`
|
|
8900
|
+
};
|
|
8901
|
+
}
|
|
8902
|
+
function describeRejection(err) {
|
|
8903
|
+
if (err instanceof Error) return err.stack ?? err.message;
|
|
8904
|
+
if (typeof err === "object" && err !== null) {
|
|
8905
|
+
try {
|
|
8906
|
+
const json = JSON.stringify(err);
|
|
8907
|
+
if (json && json !== "{}") return json;
|
|
8908
|
+
} catch {
|
|
8909
|
+
}
|
|
8910
|
+
}
|
|
8911
|
+
try {
|
|
8912
|
+
return String(err);
|
|
8913
|
+
} catch {
|
|
8914
|
+
return `<unprintable ${typeof err} rejection>`;
|
|
8915
|
+
}
|
|
8916
|
+
}
|
|
8917
|
+
function describeWorkerModuleFailure(err) {
|
|
8918
|
+
const detail = describeRejection(err);
|
|
8919
|
+
return `[startup] FATAL \u2014 the manager worker module failed to load, so this process will never poll. The pidfile it already wrote would otherwise make it look like a healthy manager forever (ENG-9129). Exiting so the supervisor can react. Cause: ${detail}`;
|
|
8920
|
+
}
|
|
8921
|
+
|
|
8864
8922
|
// src/lib/self-update-pin.ts
|
|
8865
8923
|
function isValidPinVersion(v) {
|
|
8866
8924
|
return PIN_VERSION_RE.test(v);
|
|
@@ -8946,15 +9004,23 @@ function findOtherManagerPids(pgrepImpl = defaultPgrep, selfPid = process.pid) {
|
|
|
8946
9004
|
let out;
|
|
8947
9005
|
try {
|
|
8948
9006
|
out = pgrepImpl();
|
|
8949
|
-
} catch {
|
|
9007
|
+
} catch (err) {
|
|
9008
|
+
const signal = err?.signal;
|
|
9009
|
+
if (signal) {
|
|
9010
|
+
log(
|
|
9011
|
+
`[startup] duplicate-manager scan timed out after ${PGREP_SCAN_TIMEOUT_MS}ms (killed by ${signal}) \u2014 proceeding without it, since the pidfile check is the primary guard. A process-table read this slow means the host is heavily loaded, which is also when a boot is most likely to stall (ENG-9129).`
|
|
9012
|
+
);
|
|
9013
|
+
}
|
|
8950
9014
|
return [];
|
|
8951
9015
|
}
|
|
8952
9016
|
return out.split("\n").map((line) => parseInt(line.trim(), 10)).filter((pid) => !isNaN(pid) && pid !== selfPid);
|
|
8953
9017
|
}
|
|
9018
|
+
var PGREP_SCAN_TIMEOUT_MS = 1e4;
|
|
8954
9019
|
function defaultPgrep() {
|
|
8955
9020
|
return execFileSync3("pgrep", ["-f", "agt manager start"], {
|
|
8956
9021
|
encoding: "utf-8",
|
|
8957
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
9022
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
9023
|
+
timeout: PGREP_SCAN_TIMEOUT_MS
|
|
8958
9024
|
});
|
|
8959
9025
|
}
|
|
8960
9026
|
function readStateFile(configDir) {
|
|
@@ -9030,11 +9096,18 @@ function startWatchdog(opts) {
|
|
|
9030
9096
|
);
|
|
9031
9097
|
}
|
|
9032
9098
|
writePidFile(configDir, process.pid);
|
|
9099
|
+
const moduleLoadStartedAt = process.uptime() * 1e3;
|
|
9100
|
+
log("[startup] loading worker module \u2014 nothing polls, logs or deploys MCP bundles until this resolves");
|
|
9033
9101
|
void import("./lib/manager-worker.js").then(({ startManager }) => {
|
|
9102
|
+
const { message } = describeWorkerModuleLoad(process.uptime() * 1e3 - moduleLoadStartedAt);
|
|
9103
|
+
log(message);
|
|
9034
9104
|
startManager({
|
|
9035
9105
|
intervalMs: opts.intervalMs,
|
|
9036
9106
|
configDir
|
|
9037
9107
|
});
|
|
9108
|
+
}).catch((err) => {
|
|
9109
|
+
log(describeWorkerModuleFailure(err));
|
|
9110
|
+
process.exit(1);
|
|
9038
9111
|
});
|
|
9039
9112
|
process.on("exit", () => {
|
|
9040
9113
|
removePidFile(configDir);
|
|
@@ -9723,6 +9796,7 @@ export {
|
|
|
9723
9796
|
buildConnectivityProbeDeps,
|
|
9724
9797
|
gatherSessionToolBindProbe,
|
|
9725
9798
|
provision,
|
|
9799
|
+
describeStartupCompletion,
|
|
9726
9800
|
executeConnectivityProbe,
|
|
9727
9801
|
isValidPinVersion,
|
|
9728
9802
|
resolveEffectivePinRaw,
|
|
@@ -9740,4 +9814,4 @@ export {
|
|
|
9740
9814
|
managerInstallSystemUnitCommand,
|
|
9741
9815
|
managerUninstallSystemUnitCommand
|
|
9742
9816
|
};
|
|
9743
|
-
//# sourceMappingURL=chunk-
|
|
9817
|
+
//# sourceMappingURL=chunk-LCKKFDCR.js.map
|