@integrity-labs/agt-cli 0.28.441 → 0.28.443

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.
@@ -29,7 +29,7 @@ import {
29
29
  resolveConnectivityProbe,
30
30
  worseConnectivityOutcome,
31
31
  wrapScheduledTaskPrompt
32
- } from "./chunk-NQP2W2RD.js";
32
+ } from "./chunk-IQX7TMYZ.js";
33
33
  import {
34
34
  parsePsRows
35
35
  } from "./chunk-XWVM4KPK.js";
@@ -4901,7 +4901,7 @@ function requireHost() {
4901
4901
  }
4902
4902
 
4903
4903
  // src/lib/api-client.ts
4904
- var agtCliVersion = true ? "0.28.441" : "dev";
4904
+ var agtCliVersion = true ? "0.28.443" : "dev";
4905
4905
  var lastConfigHash = null;
4906
4906
  function setConfigHash(hash) {
4907
4907
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7402,4 +7402,4 @@ export {
7402
7402
  managerInstallSystemUnitCommand,
7403
7403
  managerUninstallSystemUnitCommand
7404
7404
  };
7405
- //# sourceMappingURL=chunk-6KTN6GTT.js.map
7405
+ //# sourceMappingURL=chunk-X2LHWP6E.js.map
@@ -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-PWLMLDVX.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-6SCIPYQI.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-YU6KOA6R.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-J3BEIXWL.js.map
@@ -42,7 +42,7 @@ import {
42
42
  resolveEffectivePinRaw,
43
43
  safeWriteJsonAtomic,
44
44
  setConfigHash
45
- } from "../chunk-6KTN6GTT.js";
45
+ } from "../chunk-X2LHWP6E.js";
46
46
  import {
47
47
  getProjectDir as getProjectDir2,
48
48
  getReadyTasks,
@@ -66,6 +66,7 @@ import {
66
66
  SCHEDULED_TURN_MARKER_FILENAME,
67
67
  SUPPRESS_SENTINEL,
68
68
  StreamEncoder,
69
+ UNKNOWN_RATE_LIMIT,
69
70
  USAGE_LIMIT_MARKER_FILENAME,
70
71
  appendDmFooter,
71
72
  attributeTranscriptUsageByRun,
@@ -75,6 +76,7 @@ import {
75
76
  checkChannelInputs,
76
77
  classifyActor,
77
78
  classifyOutput,
79
+ classifyTranscriptRateLimit,
78
80
  coerceOnboardingState,
79
81
  creditWatchdogGiveUpCount,
80
82
  describeOnboardingChannel,
@@ -124,6 +126,7 @@ import {
124
126
  parseUsageBanner,
125
127
  parseUsageLimitMarker,
126
128
  peekCurrentSession,
129
+ pickNewerClassification,
127
130
  prepareForRespawn,
128
131
  readChannelServerEnv,
129
132
  readDirectChatSessionState,
@@ -157,7 +160,7 @@ import {
157
160
  toOpencodeModel,
158
161
  transcriptActivityAgeSeconds,
159
162
  writeEgressAllowlist
160
- } from "../chunk-NQP2W2RD.js";
163
+ } from "../chunk-IQX7TMYZ.js";
161
164
  import {
162
165
  reapOrphanChannelMcps
163
166
  } from "../chunk-XWVM4KPK.js";
@@ -2102,38 +2105,7 @@ function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
2102
2105
  import { readFileSync as readFileSync8, readdirSync, statSync } from "fs";
2103
2106
  import { join as join7 } from "path";
2104
2107
  var RATE_LIMIT_WINDOW_MS = 6 * 60 * 60 * 1e3;
2105
- function classifyLine(line, startMs, endMs) {
2106
- const trimmed = line.trim();
2107
- if (!trimmed) return null;
2108
- let obj;
2109
- try {
2110
- obj = JSON.parse(trimmed);
2111
- } catch {
2112
- return null;
2113
- }
2114
- if (typeof obj !== "object" || obj === null) return null;
2115
- const record = obj;
2116
- if (record.type !== "assistant") return null;
2117
- const ts = record.timestamp;
2118
- if (typeof ts !== "string" || !ts) return null;
2119
- const tsMs = new Date(ts).getTime();
2120
- if (!Number.isFinite(tsMs) || tsMs < startMs || tsMs > endMs) return null;
2121
- if (record.error === "rate_limit" || record.apiErrorStatus === 429) {
2122
- return { tsMs, verdict: "capped" };
2123
- }
2124
- if (record.isApiErrorMessage === true) return null;
2125
- const message = record.message;
2126
- if (typeof message !== "object" || message === null) return null;
2127
- const msg = message;
2128
- if (msg.model === "<synthetic>") return null;
2129
- const usage = msg.usage;
2130
- if (typeof usage !== "object" || usage === null) return null;
2131
- const u = usage;
2132
- const spent = Number(u.input_tokens ?? 0) + Number(u.output_tokens ?? 0) + Number(u.cache_creation_input_tokens ?? 0) + Number(u.cache_read_input_tokens ?? 0);
2133
- if (!Number.isFinite(spent) || spent <= 0) return null;
2134
- return { tsMs, verdict: "serving" };
2135
- }
2136
- function probeRateLimitState(args) {
2108
+ function probeRateLimit(args) {
2137
2109
  const now = args.now ?? /* @__PURE__ */ new Date();
2138
2110
  const endMs = now.getTime();
2139
2111
  const startMs = endMs - (args.windowMs ?? RATE_LIMIT_WINDOW_MS);
@@ -2142,9 +2114,9 @@ function probeRateLimitState(args) {
2142
2114
  try {
2143
2115
  entries = readdirSync(dir);
2144
2116
  } catch {
2145
- return "unknown";
2117
+ return UNKNOWN_RATE_LIMIT;
2146
2118
  }
2147
- let newest = null;
2119
+ let newest = UNKNOWN_RATE_LIMIT;
2148
2120
  for (const name of entries) {
2149
2121
  if (!name.endsWith(".jsonl")) continue;
2150
2122
  const path = join7(dir, name);
@@ -2160,12 +2132,15 @@ function probeRateLimitState(args) {
2160
2132
  } catch {
2161
2133
  continue;
2162
2134
  }
2163
- for (const line of content.split("\n")) {
2164
- const c = classifyLine(line, startMs, endMs);
2165
- if (c && (newest === null || c.tsMs >= newest.tsMs)) newest = c;
2166
- }
2135
+ newest = pickNewerClassification(
2136
+ newest,
2137
+ classifyTranscriptRateLimit(content, startMs, endMs, now)
2138
+ );
2167
2139
  }
2168
- return newest?.verdict ?? "unknown";
2140
+ return newest;
2141
+ }
2142
+ function probeRateLimitState(args) {
2143
+ return probeRateLimit(args).verdict;
2169
2144
  }
2170
2145
 
2171
2146
  // src/lib/usage-banner-monitor.ts
@@ -9812,7 +9787,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9812
9787
  var lastVersionCheckAt = 0;
9813
9788
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9814
9789
  var lastResponsivenessProbeAt = 0;
9815
- var agtCliVersion = true ? "0.28.441" : "dev";
9790
+ var agtCliVersion = true ? "0.28.443" : "dev";
9816
9791
  function resolveBrewPath(execFileSync2) {
9817
9792
  try {
9818
9793
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -10970,7 +10945,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10970
10945
  if (codeNames.length === 0) return;
10971
10946
  void (async () => {
10972
10947
  try {
10973
- const { collectDiagnostics } = await import("../persistent-session-PWLMLDVX.js");
10948
+ const { collectDiagnostics } = await import("../persistent-session-6SCIPYQI.js");
10974
10949
  await api.post("/host/heartbeat", {
10975
10950
  host_id: hostId,
10976
10951
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor)
@@ -11077,7 +11052,7 @@ async function pollCycle() {
11077
11052
  }
11078
11053
  try {
11079
11054
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
11080
- const { collectDiagnostics } = await import("../persistent-session-PWLMLDVX.js");
11055
+ const { collectDiagnostics } = await import("../persistent-session-6SCIPYQI.js");
11081
11056
  const diagCodeNames = [...agentState.persistentSessionAgents];
11082
11057
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor) : void 0;
11083
11058
  let tailscaleHostname;
@@ -11191,7 +11166,7 @@ async function pollCycle() {
11191
11166
  collectResponsivenessProbes,
11192
11167
  collectPanelessActivityProbes,
11193
11168
  getResponsivenessIntervalMs
11194
- } = await import("../responsiveness-probe-ZKUDFRIU.js");
11169
+ } = await import("../responsiveness-probe-WHDWK62P.js");
11195
11170
  const probeIntervalMs = getResponsivenessIntervalMs();
11196
11171
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
11197
11172
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -11255,7 +11230,7 @@ async function pollCycle() {
11255
11230
  collectResponsivenessProbes,
11256
11231
  livePendingInboundOldestAgeSeconds,
11257
11232
  parkPendingInbound
11258
- } = await import("../responsiveness-probe-ZKUDFRIU.js");
11233
+ } = await import("../responsiveness-probe-WHDWK62P.js");
11259
11234
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
11260
11235
  const wedgeNow = /* @__PURE__ */ new Date();
11261
11236
  const liveAgents = agentState.persistentSessionAgents;
@@ -14325,6 +14300,17 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash16("sha256")
14325
14300
  // host. An agent with no per-agent override inherits the host-wide value;
14326
14301
  // the launcher still lets an operator AGT_NOTIFY_DISPATCH env override win.
14327
14302
  notifyDispatchMode: hostFlagStore().getStringForAgent("notify-dispatch", agent.agent_id),
14303
+ // ENG-8201: materialize usage-limit-reactive-notice into the spawn env
14304
+ // (AGT_USAGE_LIMIT_REACTIVE_MODE) so the channel MCPs report a usage cap
14305
+ // reactively instead of refusing to dispatch on a prediction. Resolved
14306
+ // PER-AGENT so the rollout can start with one agent rather than a whole
14307
+ // host, and materialized (not just left to the flags-cache) because an
14308
+ // isolated agent's container never mounts that cache — without this the
14309
+ // flip reaches nothing running under Docker isolation.
14310
+ usageLimitReactiveMode: hostFlagStore().getStringForAgent(
14311
+ "usage-limit-reactive-notice",
14312
+ agent.agent_id
14313
+ ),
14328
14314
  egressAllowlist,
14329
14315
  log
14330
14316
  });
@@ -14609,7 +14595,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
14609
14595
  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}`));
14610
14596
  void (async () => {
14611
14597
  try {
14612
- const { collectDiagnostics } = await import("../persistent-session-PWLMLDVX.js");
14598
+ const { collectDiagnostics } = await import("../persistent-session-6SCIPYQI.js");
14613
14599
  await api.post("/host/heartbeat", {
14614
14600
  host_id: hostId,
14615
14601
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
@@ -14659,7 +14645,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
14659
14645
  }
14660
14646
  try {
14661
14647
  const hostId = await getHostId();
14662
- const { collectDiagnostics } = await import("../persistent-session-PWLMLDVX.js");
14648
+ const { collectDiagnostics } = await import("../persistent-session-6SCIPYQI.js");
14663
14649
  await api.post("/host/heartbeat", {
14664
14650
  host_id: hostId,
14665
14651
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor)
@@ -15112,7 +15098,7 @@ async function processClaudePairSessions(agents) {
15112
15098
  killPairSession,
15113
15099
  pairTmuxSession,
15114
15100
  finalizeClaudePairOnboarding
15115
- } = await import("../claude-pair-runtime-YU6KOA6R.js");
15101
+ } = await import("../claude-pair-runtime-J3BEIXWL.js");
15116
15102
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
15117
15103
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
15118
15104
  const killed = await killPairSession(pairTmuxSession(pairId));