@integrity-labs/agt-cli 0.27.132 → 0.27.133
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
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
success,
|
|
29
29
|
table,
|
|
30
30
|
warn
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-I2GFFKMO.js";
|
|
32
32
|
import {
|
|
33
33
|
CHANNEL_REGISTRY,
|
|
34
34
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4934,7 +4934,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4934
4934
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4935
4935
|
import chalk18 from "chalk";
|
|
4936
4936
|
import ora16 from "ora";
|
|
4937
|
-
var cliVersion = true ? "0.27.
|
|
4937
|
+
var cliVersion = true ? "0.27.133" : "dev";
|
|
4938
4938
|
async function fetchLatestVersion() {
|
|
4939
4939
|
const host2 = getHost();
|
|
4940
4940
|
if (!host2) return null;
|
|
@@ -5857,7 +5857,7 @@ function handleError(err) {
|
|
|
5857
5857
|
}
|
|
5858
5858
|
|
|
5859
5859
|
// src/bin/agt.ts
|
|
5860
|
-
var cliVersion2 = true ? "0.27.
|
|
5860
|
+
var cliVersion2 = true ? "0.27.133" : "dev";
|
|
5861
5861
|
var program = new Command();
|
|
5862
5862
|
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");
|
|
5863
5863
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
provisionStopHook,
|
|
18
18
|
requireHost,
|
|
19
19
|
safeWriteJsonAtomic
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-I2GFFKMO.js";
|
|
21
21
|
import {
|
|
22
22
|
getProjectDir as getProjectDir2,
|
|
23
23
|
getReadyTasks,
|
|
@@ -142,6 +142,9 @@ function decidePostRestartVerification(pending, sessionStartedAt, sessionHealthy
|
|
|
142
142
|
const attempt = pending.attempts + 1;
|
|
143
143
|
return { kind: "unverified", attempt, final: attempt >= maxAttempts };
|
|
144
144
|
}
|
|
145
|
+
function shouldRemediateUnverifiedRestart(outcome, ctx) {
|
|
146
|
+
return ctx.enabled && !ctx.breakerTripped && outcome.kind === "unverified" && outcome.final;
|
|
147
|
+
}
|
|
145
148
|
|
|
146
149
|
// src/lib/integration-hash.ts
|
|
147
150
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -4273,11 +4276,17 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
|
|
|
4273
4276
|
return;
|
|
4274
4277
|
}
|
|
4275
4278
|
deferLogThrottle.delete(codeName);
|
|
4279
|
+
if (breakerReason === "bind-remediation" && restartBreaker.isTripped(codeName)) {
|
|
4280
|
+
log(
|
|
4281
|
+
`[bind-remediation] '${codeName}' breaker tripped before the re-respawn fired \u2014 aborting to avoid stopping a session the breaker won't let respawn (ENG-6203)`
|
|
4282
|
+
);
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4276
4285
|
stopPersistentSession(codeName, log);
|
|
4277
4286
|
runningMcpHashes.delete(codeName);
|
|
4278
4287
|
recordRestartForBreaker(codeName, breakerReason);
|
|
4279
4288
|
log(`[hot-reload] Session stopped for '${codeName}' \u2014 will respawn with ${reason}`);
|
|
4280
|
-
if (breakerReason === "hot-reload-mcp") {
|
|
4289
|
+
if (breakerReason === "hot-reload-mcp" || breakerReason === "bind-remediation") {
|
|
4281
4290
|
const prior = pendingRestartVerifications.get(codeName);
|
|
4282
4291
|
pendingRestartVerifications.set(codeName, {
|
|
4283
4292
|
firedAt: Date.now(),
|
|
@@ -4297,6 +4306,11 @@ function cancelPendingSessionRestart(codeName) {
|
|
|
4297
4306
|
deferLogThrottle.delete(codeName);
|
|
4298
4307
|
log(`[hot-reload] Cancelled pending restart timer for '${codeName}' (another teardown path is handling it)`);
|
|
4299
4308
|
}
|
|
4309
|
+
function bindRemediationEnabled() {
|
|
4310
|
+
const v = (process.env["AGT_BIND_REMEDIATION_ENABLED"] ?? "").trim().toLowerCase();
|
|
4311
|
+
return v === "true" || v === "1";
|
|
4312
|
+
}
|
|
4313
|
+
var BIND_REMEDIATION_JITTER_MS = 3e4;
|
|
4300
4314
|
function verifyPendingRestarts(now) {
|
|
4301
4315
|
if (pendingRestartVerifications.size === 0) return;
|
|
4302
4316
|
for (const [codeName, pending] of pendingRestartVerifications) {
|
|
@@ -4318,6 +4332,21 @@ function verifyPendingRestarts(now) {
|
|
|
4318
4332
|
log(
|
|
4319
4333
|
`[restart-verify] ERROR '${codeName}' did NOT respawn healthy after ${outcome.attempt} attempts following an MCP change \u2014 the live session may be stuck on its pre-restart tools. Check session health / manager.log; a manual session restart may be required (ENG-6174)`
|
|
4320
4334
|
);
|
|
4335
|
+
if (shouldRemediateUnverifiedRestart(outcome, {
|
|
4336
|
+
enabled: bindRemediationEnabled(),
|
|
4337
|
+
breakerTripped: restartBreaker.isTripped(codeName)
|
|
4338
|
+
})) {
|
|
4339
|
+
const jitterMs = Math.floor(Math.random() * BIND_REMEDIATION_JITTER_MS);
|
|
4340
|
+
log(
|
|
4341
|
+
`[bind-remediation] '${codeName}' restart never bound MCP tools \u2014 forcing one gated re-respawn in ${Math.round(jitterMs / 1e3)}s (breaker-capped, ENG-6203)`
|
|
4342
|
+
);
|
|
4343
|
+
scheduleSessionRestart(
|
|
4344
|
+
codeName,
|
|
4345
|
+
jitterMs,
|
|
4346
|
+
"bind-remediation: prior restart left MCP tools unbound",
|
|
4347
|
+
"bind-remediation"
|
|
4348
|
+
);
|
|
4349
|
+
}
|
|
4321
4350
|
} else {
|
|
4322
4351
|
pendingRestartVerifications.set(codeName, { firedAt: now, attempts: outcome.attempt });
|
|
4323
4352
|
log(
|
|
@@ -4661,7 +4690,7 @@ var cachedMaintenanceWindow = null;
|
|
|
4661
4690
|
var lastVersionCheckAt = 0;
|
|
4662
4691
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
4663
4692
|
var lastResponsivenessProbeAt = 0;
|
|
4664
|
-
var agtCliVersion = true ? "0.27.
|
|
4693
|
+
var agtCliVersion = true ? "0.27.133" : "dev";
|
|
4665
4694
|
function resolveBrewPath(execFileSync4) {
|
|
4666
4695
|
try {
|
|
4667
4696
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|