@integrity-labs/agt-cli 0.28.376 → 0.28.378

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-YEGKJ6D2.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-UR2QF76O.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-2BAVARZU.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-FYILNSJ5.js.map
@@ -43,7 +43,7 @@ import {
43
43
  resolveEffectivePinRaw,
44
44
  safeWriteJsonAtomic,
45
45
  setConfigHash
46
- } from "../chunk-KHAXB7KJ.js";
46
+ } from "../chunk-JB5PEPQU.js";
47
47
  import {
48
48
  getProjectDir as getProjectDir2,
49
49
  getReadyTasks,
@@ -145,7 +145,7 @@ import {
145
145
  toOpencodeModel,
146
146
  transcriptActivityAgeSeconds,
147
147
  writeEgressAllowlist
148
- } from "../chunk-EZ5DJZ6Q.js";
148
+ } from "../chunk-Q64467SG.js";
149
149
  import {
150
150
  reapOrphanChannelMcps
151
151
  } from "../chunk-XWVM4KPK.js";
@@ -9100,7 +9100,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9100
9100
  var lastVersionCheckAt = 0;
9101
9101
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9102
9102
  var lastResponsivenessProbeAt = 0;
9103
- var agtCliVersion = true ? "0.28.376" : "dev";
9103
+ var agtCliVersion = true ? "0.28.378" : "dev";
9104
9104
  function resolveBrewPath(execFileSync2) {
9105
9105
  try {
9106
9106
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9232,6 +9232,116 @@ async function ensureToolkitCli(toolkitSlug) {
9232
9232
  recordToolkitFailure(toolkitSlug, `installer=${resolvedInstaller} completed but ${binary} still not on PATH`);
9233
9233
  }
9234
9234
  }
9235
+ var isolationImageEnsured = /* @__PURE__ */ new Set();
9236
+ var isolationImageRetryAfter = /* @__PURE__ */ new Map();
9237
+ var isolationImageFailureCount = /* @__PURE__ */ new Map();
9238
+ var isolationImageInFlight = /* @__PURE__ */ new Set();
9239
+ var ISOLATION_IMAGE_RETRY_MS = 5 * 6e4;
9240
+ var ISOLATION_IMAGE_MAX_FAILURES = 3;
9241
+ function isolationImageErrDetail(err) {
9242
+ const e = err;
9243
+ const stderr = e?.stderr ? e.stderr.toString().trim() : "";
9244
+ return (stderr || e?.message || String(err)).slice(0, 300);
9245
+ }
9246
+ function recordIsolationImageFailure(imageUri, reason) {
9247
+ const count = (isolationImageFailureCount.get(imageUri) ?? 0) + 1;
9248
+ isolationImageFailureCount.set(imageUri, count);
9249
+ if (count >= ISOLATION_IMAGE_MAX_FAILURES) {
9250
+ log(`[isolation-image] ${reason} (giving up after ${count} attempts - existing local image stays in use; restart the manager to retry)`);
9251
+ isolationImageEnsured.add(imageUri);
9252
+ isolationImageRetryAfter.delete(imageUri);
9253
+ } else {
9254
+ log(`[isolation-image] ${reason} (attempt ${count}/${ISOLATION_IMAGE_MAX_FAILURES}, retrying in ${ISOLATION_IMAGE_RETRY_MS / 6e4}m)`);
9255
+ isolationImageRetryAfter.set(imageUri, Date.now() + ISOLATION_IMAGE_RETRY_MS);
9256
+ }
9257
+ }
9258
+ async function ensureIsolationImage(imageUri) {
9259
+ if (process.env.AGT_ISOLATION_IMAGE) return;
9260
+ if (!imageUri || isolationImageEnsured.has(imageUri)) return;
9261
+ if (isolationImageInFlight.has(imageUri)) return;
9262
+ const retryAfter = isolationImageRetryAfter.get(imageUri) ?? 0;
9263
+ if (retryAfter > Date.now()) return;
9264
+ const registry = imageUri.split("/")[0] ?? "";
9265
+ const isPublic = registry === "public.ecr.aws";
9266
+ const privRegion = registry.match(/\.dkr\.ecr\.([a-z0-9-]+)\.amazonaws\.com$/)?.[1];
9267
+ if (!isPublic && !privRegion) {
9268
+ log(`[isolation-image] '${imageUri}' is not a recognised ECR image URI - skipping managed pull`);
9269
+ isolationImageEnsured.add(imageUri);
9270
+ return;
9271
+ }
9272
+ isolationImageInFlight.add(imageUri);
9273
+ try {
9274
+ const { execFileSync: execFileSync2 } = await import("child_process");
9275
+ try {
9276
+ execFileSync2("which", ["docker"], { timeout: 5e3, stdio: "pipe" });
9277
+ } catch {
9278
+ recordIsolationImageFailure(imageUri, `'docker' not found on host - required to pull the isolation image (install it, then the manager retries)`);
9279
+ return;
9280
+ }
9281
+ const hasAws = (() => {
9282
+ try {
9283
+ execFileSync2("which", ["aws"], { timeout: 5e3, stdio: "pipe" });
9284
+ return true;
9285
+ } catch {
9286
+ return false;
9287
+ }
9288
+ })();
9289
+ if (isPublic) {
9290
+ if (hasAws) {
9291
+ try {
9292
+ const password = execFileSync2("aws", ["ecr-public", "get-login-password", "--region", "us-east-1"], {
9293
+ timeout: 3e4,
9294
+ stdio: ["ignore", "pipe", "pipe"]
9295
+ }).toString().trim();
9296
+ execFileSync2("docker", ["login", "--username", "AWS", "--password-stdin", "public.ecr.aws"], {
9297
+ input: password,
9298
+ timeout: 3e4,
9299
+ stdio: ["pipe", "pipe", "pipe"]
9300
+ });
9301
+ } catch (err) {
9302
+ log(`[isolation-image] ecr-public login failed, falling back to anonymous pull: ${isolationImageErrDetail(err)}`);
9303
+ }
9304
+ }
9305
+ } else if (privRegion) {
9306
+ if (!hasAws) {
9307
+ recordIsolationImageFailure(imageUri, `'aws' CLI not found - required to authenticate a private ECR pull of ${registry} (install it, then the manager retries)`);
9308
+ return;
9309
+ }
9310
+ try {
9311
+ const password = execFileSync2("aws", ["ecr", "get-login-password", "--region", privRegion], {
9312
+ timeout: 3e4,
9313
+ stdio: ["ignore", "pipe", "pipe"]
9314
+ }).toString().trim();
9315
+ execFileSync2("docker", ["login", "--username", "AWS", "--password-stdin", registry], {
9316
+ input: password,
9317
+ timeout: 3e4,
9318
+ stdio: ["pipe", "pipe", "pipe"]
9319
+ });
9320
+ } catch (err) {
9321
+ recordIsolationImageFailure(imageUri, `ecr login for ${registry} failed: ${isolationImageErrDetail(err)}`);
9322
+ return;
9323
+ }
9324
+ }
9325
+ log(`[isolation-image] pulling ${imageUri}\u2026`);
9326
+ const pull = await runAsync("docker", ["pull", imageUri], { timeout: 6e5 });
9327
+ if (pull.code !== 0) {
9328
+ recordIsolationImageFailure(imageUri, `docker pull failed (exit ${pull.code}): ${(pull.stderr || pull.stdout).slice(0, 300)}`);
9329
+ return;
9330
+ }
9331
+ const localTag = "agt-runtime:latest";
9332
+ const tag = await runAsync("docker", ["tag", imageUri, localTag], { timeout: 3e4 });
9333
+ if (tag.code !== 0) {
9334
+ recordIsolationImageFailure(imageUri, `docker tag \u2192 ${localTag} failed (exit ${tag.code}): ${tag.stderr.slice(0, 200)}`);
9335
+ return;
9336
+ }
9337
+ log(`[isolation-image] ${localTag} now points at ${imageUri}`);
9338
+ isolationImageEnsured.add(imageUri);
9339
+ isolationImageRetryAfter.delete(imageUri);
9340
+ isolationImageFailureCount.delete(imageUri);
9341
+ } finally {
9342
+ isolationImageInFlight.delete(imageUri);
9343
+ }
9344
+ }
9235
9345
  function runAsync(cmd, args, opts) {
9236
9346
  return new Promise((resolve, reject) => {
9237
9347
  import("child_process").then(({ spawn }) => {
@@ -10119,7 +10229,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10119
10229
  if (codeNames.length === 0) return;
10120
10230
  void (async () => {
10121
10231
  try {
10122
- const { collectDiagnostics } = await import("../persistent-session-YEGKJ6D2.js");
10232
+ const { collectDiagnostics } = await import("../persistent-session-UR2QF76O.js");
10123
10233
  await api.post("/host/heartbeat", {
10124
10234
  host_id: hostId,
10125
10235
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -10218,7 +10328,7 @@ async function pollCycle() {
10218
10328
  }
10219
10329
  try {
10220
10330
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10221
- const { collectDiagnostics } = await import("../persistent-session-YEGKJ6D2.js");
10331
+ const { collectDiagnostics } = await import("../persistent-session-UR2QF76O.js");
10222
10332
  const diagCodeNames = [...agentState.persistentSessionAgents];
10223
10333
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
10224
10334
  let tailscaleHostname;
@@ -10373,7 +10483,7 @@ async function pollCycle() {
10373
10483
  const {
10374
10484
  collectResponsivenessProbes,
10375
10485
  getResponsivenessIntervalMs
10376
- } = await import("../responsiveness-probe-N2JSVMRN.js");
10486
+ } = await import("../responsiveness-probe-QXVQKH7F.js");
10377
10487
  const probeIntervalMs = getResponsivenessIntervalMs();
10378
10488
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10379
10489
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10405,7 +10515,7 @@ async function pollCycle() {
10405
10515
  collectResponsivenessProbes,
10406
10516
  livePendingInboundOldestAgeSeconds,
10407
10517
  parkPendingInbound
10408
- } = await import("../responsiveness-probe-N2JSVMRN.js");
10518
+ } = await import("../responsiveness-probe-QXVQKH7F.js");
10409
10519
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10410
10520
  const wedgeNow = /* @__PURE__ */ new Date();
10411
10521
  const liveAgents = agentState.persistentSessionAgents;
@@ -12443,6 +12553,12 @@ async function processAgent(agent, agentStates) {
12443
12553
  await ensureToolkitCli(toolkitSlug);
12444
12554
  }
12445
12555
  }
12556
+ const desiredRuntimeImage = refreshAny.desired_runtime_image;
12557
+ if (desiredRuntimeImage && isolationMode(agent.code_name) !== "none") {
12558
+ void ensureIsolationImage(desiredRuntimeImage).catch((err) => {
12559
+ log(`[isolation-image] unexpected managed-pull failure: ${isolationImageErrDetail(err)}`);
12560
+ });
12561
+ }
12446
12562
  const agentFw2 = agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK;
12447
12563
  if (agentFw2 === "claude-code" && installedIntegrationSkills.length > 0 && isSessionHealthy(agent.code_name)) {
12448
12564
  const names = installedIntegrationSkills.join(", ");
@@ -13583,7 +13699,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
13583
13699
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
13584
13700
  void (async () => {
13585
13701
  try {
13586
- const { collectDiagnostics } = await import("../persistent-session-YEGKJ6D2.js");
13702
+ const { collectDiagnostics } = await import("../persistent-session-UR2QF76O.js");
13587
13703
  await api.post("/host/heartbeat", {
13588
13704
  host_id: hostId,
13589
13705
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13633,7 +13749,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
13633
13749
  }
13634
13750
  try {
13635
13751
  const hostId = await getHostId();
13636
- const { collectDiagnostics } = await import("../persistent-session-YEGKJ6D2.js");
13752
+ const { collectDiagnostics } = await import("../persistent-session-UR2QF76O.js");
13637
13753
  await api.post("/host/heartbeat", {
13638
13754
  host_id: hostId,
13639
13755
  agent_diagnostics: collectDiagnostics([codeName])
@@ -14086,7 +14202,7 @@ async function processClaudePairSessions(agents) {
14086
14202
  killPairSession,
14087
14203
  pairTmuxSession,
14088
14204
  finalizeClaudePairOnboarding
14089
- } = await import("../claude-pair-runtime-2BAVARZU.js");
14205
+ } = await import("../claude-pair-runtime-FYILNSJ5.js");
14090
14206
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14091
14207
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14092
14208
  const killed = await killPairSession(pairTmuxSession(pairId));