@integrity-labs/agt-cli 0.28.1010 → 0.28.1012

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,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-V6HO4MUI.js";
43
+ } from "../chunk-O3DODZVZ.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-HSYBLAWA.js";
48
+ } from "../chunk-K73BIWKA.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -79,7 +79,7 @@ import {
79
79
  serializeManifestForSlackCli,
80
80
  sessionFileExists,
81
81
  sessionTranscriptDir
82
- } from "../chunk-OPDT2OE5.js";
82
+ } from "../chunk-LV72A4BE.js";
83
83
  import "../chunk-DHWNVVX4.js";
84
84
  import "../chunk-XWVM4KPK.js";
85
85
  import "../chunk-EL5MWGGH.js";
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1010" : "dev";
5477
+ var cliVersion = true ? "0.28.1012" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1010" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1012" : "dev";
6738
6738
  var program = new Command();
6739
6739
  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");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -23,7 +23,7 @@ import {
23
23
  rotateDailySession,
24
24
  sessionFileExists,
25
25
  todayLocalIso
26
- } from "./chunk-OPDT2OE5.js";
26
+ } from "./chunk-LV72A4BE.js";
27
27
  import {
28
28
  classifyUnanswerablePane,
29
29
  findUsageLimitResetHint,
@@ -83,6 +83,18 @@ function invalidDuration(name, ms) {
83
83
  if (Number.isFinite(ms) && ms >= MIN_DURATION_MS) return null;
84
84
  return `[bounded-exec] refusing to run: ${name}=${String(ms)} is not a usable deadline (needs a finite value >= ${MIN_DURATION_MS}ms). A zero or sub-millisecond duration DISABLES the deadline or the SIGKILL escalation, which would leave this call unbounded while reporting that it was bounded (ENG-9781).`;
85
85
  }
86
+ function boundedArgv(file, args, timeoutMs, killAfterMs, available) {
87
+ return available ? {
88
+ execFile: "timeout",
89
+ execArgs: [
90
+ "--signal=TERM",
91
+ `--kill-after=${toTimeoutArg(killAfterMs)}`,
92
+ toTimeoutArg(timeoutMs),
93
+ file,
94
+ ...args
95
+ ]
96
+ } : { execFile: file, execArgs: [...args] };
97
+ }
86
98
  function hardBoundedExecFile(file, args, opts) {
87
99
  const exec = opts.exec ?? execFileSync;
88
100
  const killAfterMs = opts.killAfterMs ?? DEFAULT_KILL_AFTER_MS;
@@ -103,14 +115,7 @@ function hardBoundedExecFile(file, args, opts) {
103
115
  );
104
116
  }
105
117
  const nodeTimeoutMs = available ? opts.timeoutMs + killAfterMs + 5e3 : opts.timeoutMs;
106
- const execFile2 = available ? "timeout" : file;
107
- const execArgs = available ? [
108
- "--signal=TERM",
109
- `--kill-after=${toTimeoutArg(killAfterMs)}`,
110
- toTimeoutArg(opts.timeoutMs),
111
- file,
112
- ...args
113
- ] : [...args];
118
+ const { execFile: execFile2, execArgs } = boundedArgv(file, args, opts.timeoutMs, killAfterMs, available);
114
119
  const now = opts.now ?? (() => performance.now());
115
120
  const startedAt = now();
116
121
  try {
@@ -3409,7 +3414,20 @@ function parseModelPolicyModels(raw) {
3409
3414
  if (typeof role !== "string" || !ROLES.includes(role)) return [];
3410
3415
  if (typeof slot !== "string" || slot.trim() === "") return [];
3411
3416
  if (typeof modelId !== "string" || modelId.trim() === "") return [];
3412
- out.push({ role, slot: slot.trim(), modelId: modelId.trim() });
3417
+ const windowRaw = entry["context_window"];
3418
+ let contextWindow = null;
3419
+ if (windowRaw !== void 0 && windowRaw !== null) {
3420
+ if (typeof windowRaw !== "number" || !Number.isSafeInteger(windowRaw) || windowRaw <= 0) {
3421
+ return [];
3422
+ }
3423
+ contextWindow = windowRaw;
3424
+ }
3425
+ out.push({
3426
+ role,
3427
+ slot: slot.trim(),
3428
+ modelId: modelId.trim(),
3429
+ contextWindow
3430
+ });
3413
3431
  }
3414
3432
  return out;
3415
3433
  }
@@ -3558,6 +3576,17 @@ function modelEnvForRole(policy, role) {
3558
3576
  }
3559
3577
  return out;
3560
3578
  }
3579
+ var CLAUDE_CODE_CONTEXT_WINDOW_ENV = "CLAUDE_CODE_MAX_CONTEXT_TOKENS";
3580
+ function contextWindowEnvForRole(policy, role) {
3581
+ if (!policy) return {};
3582
+ for (const m of policy.models) {
3583
+ if (m.role !== role) continue;
3584
+ if (CLAUDE_CODE_SLOT_ENV.get(m.slot) !== "ANTHROPIC_MODEL") continue;
3585
+ if (m.contextWindow === null) continue;
3586
+ return { [CLAUDE_CODE_CONTEXT_WINDOW_ENV]: String(m.contextWindow) };
3587
+ }
3588
+ return {};
3589
+ }
3561
3590
  function resolveModelPolicySpawnEnv(input) {
3562
3591
  const { policy, openRouterMode, gatewayToken, codeName } = input;
3563
3592
  const active = activeBinding(policy);
@@ -3579,7 +3608,10 @@ function resolveModelPolicySpawnEnv(input) {
3579
3608
  notice: `[model-policy] '${codeName}' has policy '${policy.name}' but is in OpenRouter mode \u2014 OpenRouter wins, policy not applied (ENG-9483: unifying the two actuators is a separate migration)`
3580
3609
  };
3581
3610
  }
3582
- const modelEnv = modelEnvForRole(policy, active.role);
3611
+ const modelEnv = {
3612
+ ...modelEnvForRole(policy, active.role),
3613
+ ...contextWindowEnvForRole(policy, active.role)
3614
+ };
3583
3615
  const projectSettings = projectSettingsForRole(policy, active.role);
3584
3616
  const modelNote = Object.keys(modelEnv).length > 0 ? ` models=${Object.entries(modelEnv).map(([k, v]) => `${k}=${v}`).join(" ")}` : "";
3585
3617
  const advisorNote = Object.keys(projectSettings).length > 0 ? ` project-settings=${Object.entries(projectSettings).map(([k, v]) => `${k}=${v}`).join(" ")}` : "";
@@ -4104,6 +4136,7 @@ function buildDockerRunCommand(args) {
4104
4136
  if (passModelPolicyModel) {
4105
4137
  envArgs.push("-e ANTHROPIC_MODEL");
4106
4138
  envArgs.push("-e ANTHROPIC_SMALL_FAST_MODEL");
4139
+ envArgs.push("-e CLAUDE_CODE_MAX_CONTEXT_TOKENS");
4107
4140
  }
4108
4141
  if (runId) envArgs.push(`-e ${q(`AGT_RUN_ID=${runId}`)}`);
4109
4142
  envArgs.push("-e AGT_API_KEY");
@@ -5563,12 +5596,13 @@ function resetRestartCount(codeName) {
5563
5596
  const session = sessions2.get(codeName);
5564
5597
  if (session) session.restartCount = 0;
5565
5598
  }
5566
- function collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeFor, pidPressureFor, forwardedToolsFor) {
5599
+ function collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeFor, pidPressureFor, forwardedToolsFor, runtimeVersionFor) {
5567
5600
  return codeNames.map((codeName) => {
5568
5601
  const quarantinedChannels = quarantineEntriesFor?.(codeName) ?? [];
5569
5602
  const spawnOutcome = spawnOutcomeFor?.(codeName);
5570
5603
  const pidPressure = pidPressureFor?.(codeName) ?? null;
5571
5604
  const forwardedTools = forwardedToolsFor?.(codeName) ?? null;
5605
+ const runtimeVersion = runtimeVersionFor?.(codeName);
5572
5606
  const oc = getOpencodeSessionState(codeName);
5573
5607
  if (oc) {
5574
5608
  const serveAlive = isOpencodeSessionHealthy(codeName);
@@ -5609,6 +5643,9 @@ function collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, sp
5609
5643
  // null would blind exactly the agents nobody is watching. If the file is
5610
5644
  // absent the accessor already returns null.
5611
5645
  forwardedTools,
5646
+ // ENG-10857: carried on BOTH return paths, for the reason stated just above.
5647
+ // An opencode agent in a container runs a baked binary too.
5648
+ ...runtimeVersion ? { runtimeVersion } : {},
5612
5649
  ...turn ? {
5613
5650
  turnHealth: {
5614
5651
  lastOutcome: turn.lastOutcome,
@@ -5688,7 +5725,10 @@ function collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, sp
5688
5725
  pidPressure,
5689
5726
  // ENG-9477: both return paths carry it. A field on only one of them is the
5690
5727
  // divergence class this file already learned from twice (ENG-7188, ENG-8876).
5691
- forwardedTools
5728
+ forwardedTools,
5729
+ // ENG-10857: carried on BOTH return paths, for the reason stated just above.
5730
+ // An opencode agent in a container runs a baked binary too.
5731
+ ...runtimeVersion ? { runtimeVersion } : {}
5692
5732
  };
5693
5733
  });
5694
5734
  }
@@ -5733,6 +5773,9 @@ export {
5733
5773
  toOpencodeModel,
5734
5774
  mergeOpencodeConfigArtifact,
5735
5775
  readChannelServerEnv,
5776
+ DEFAULT_KILL_AFTER_MS,
5777
+ hasTimeoutBinary,
5778
+ boundedArgv,
5736
5779
  hardBoundedExecFile,
5737
5780
  hardBoundedCapture,
5738
5781
  LATE_BOUND_VARS,
@@ -5841,4 +5884,4 @@ export {
5841
5884
  stopAllSessionsAndWait,
5842
5885
  getProjectDir
5843
5886
  };
5844
- //# sourceMappingURL=chunk-HSYBLAWA.js.map
5887
+ //# sourceMappingURL=chunk-K73BIWKA.js.map