@integrity-labs/agt-cli 0.28.376 → 0.28.377

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
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-KHAXB7KJ.js";
43
+ } from "../chunk-IPWFCWG4.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.376" : "dev";
4832
+ var cliVersion = true ? "0.28.377" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.376" : "dev";
6004
+ var cliVersion2 = true ? "0.28.377" : "dev";
6005
6005
  var program = new Command();
6006
6006
  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");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6183,7 +6183,7 @@ function requireHost() {
6183
6183
  }
6184
6184
 
6185
6185
  // src/lib/api-client.ts
6186
- var agtCliVersion = true ? "0.28.376" : "dev";
6186
+ var agtCliVersion = true ? "0.28.377" : "dev";
6187
6187
  var lastConfigHash = null;
6188
6188
  function setConfigHash(hash) {
6189
6189
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8629,4 +8629,4 @@ export {
8629
8629
  managerInstallSystemUnitCommand,
8630
8630
  managerUninstallSystemUnitCommand
8631
8631
  };
8632
- //# sourceMappingURL=chunk-KHAXB7KJ.js.map
8632
+ //# sourceMappingURL=chunk-IPWFCWG4.js.map
@@ -43,7 +43,7 @@ import {
43
43
  resolveEffectivePinRaw,
44
44
  safeWriteJsonAtomic,
45
45
  setConfigHash
46
- } from "../chunk-KHAXB7KJ.js";
46
+ } from "../chunk-IPWFCWG4.js";
47
47
  import {
48
48
  getProjectDir as getProjectDir2,
49
49
  getReadyTasks,
@@ -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.377" : "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 }) => {
@@ -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(", ");