@integrity-labs/agt-cli 0.28.698 → 0.28.700

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.
Files changed (25) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-SWU4NBD2.js → chunk-GE2FIKUX.js} +2 -2
  3. package/dist/{chunk-SBHIDSET.js → chunk-MZWFZIN2.js} +66 -12
  4. package/dist/chunk-MZWFZIN2.js.map +1 -0
  5. package/dist/{chunk-EXCMPARK.js → chunk-QRQE2MVT.js} +5 -41
  6. package/dist/chunk-QRQE2MVT.js.map +1 -0
  7. package/dist/{claude-pair-runtime-5CLVPPM4.js → claude-pair-runtime-NVLSNWWS.js} +2 -2
  8. package/dist/lib/manager-worker.js +73 -21
  9. package/dist/lib/manager-worker.js.map +1 -1
  10. package/dist/mcp/direct-chat-channel.js +1 -0
  11. package/dist/mcp/index.js +2 -1
  12. package/dist/mcp/origami.js +1 -0
  13. package/dist/mcp/slack-channel.js +1 -0
  14. package/dist/mcp/telegram-channel.js +1 -0
  15. package/dist/{persistent-session-YM5ELNFF.js → persistent-session-7XILEFLF.js} +3 -3
  16. package/dist/{responsiveness-probe-7FWQQZDJ.js → responsiveness-probe-ZU33A2GB.js} +3 -3
  17. package/dist/{session-auth-dead-GRR6Y5ZP.js → session-auth-dead-ODQB4UPP.js} +2 -2
  18. package/package.json +1 -1
  19. package/dist/chunk-EXCMPARK.js.map +0 -1
  20. package/dist/chunk-SBHIDSET.js.map +0 -1
  21. /package/dist/{chunk-SWU4NBD2.js.map → chunk-GE2FIKUX.js.map} +0 -0
  22. /package/dist/{claude-pair-runtime-5CLVPPM4.js.map → claude-pair-runtime-NVLSNWWS.js.map} +0 -0
  23. /package/dist/{persistent-session-YM5ELNFF.js.map → persistent-session-7XILEFLF.js.map} +0 -0
  24. /package/dist/{responsiveness-probe-7FWQQZDJ.js.map → responsiveness-probe-ZU33A2GB.js.map} +0 -0
  25. /package/dist/{session-auth-dead-GRR6Y5ZP.js.map → session-auth-dead-ODQB4UPP.js.map} +0 -0
@@ -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-YM5ELNFF.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-7XILEFLF.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-5CLVPPM4.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-NVLSNWWS.js.map
@@ -54,7 +54,7 @@ import {
54
54
  safeWriteJsonAtomic,
55
55
  setConfigHash,
56
56
  tripClass
57
- } from "../chunk-SBHIDSET.js";
57
+ } from "../chunk-MZWFZIN2.js";
58
58
  import {
59
59
  getProjectDir as getProjectDir2,
60
60
  getReadyTasks,
@@ -112,7 +112,7 @@ import {
112
112
  takeZombieDetection,
113
113
  toOpencodeModel,
114
114
  writeEgressAllowlist
115
- } from "../chunk-SWU4NBD2.js";
115
+ } from "../chunk-GE2FIKUX.js";
116
116
  import {
117
117
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
118
118
  AnchorSessionClient,
@@ -124,6 +124,7 @@ import {
124
124
  FLAG_REGISTRY,
125
125
  FORCED_UPDATE_HARD_DEADLINE_MS,
126
126
  FORCED_UPDATE_RELAX_AFTER_MS,
127
+ HOST_USAGE_POLL_INTERVAL_MS,
127
128
  INTEGRATIONS_SECTION_END,
128
129
  INTEGRATIONS_SECTION_START,
129
130
  KANBAN_CHECK_COMMAND,
@@ -196,7 +197,7 @@ import {
196
197
  subagentActivityAgeSeconds,
197
198
  sumTranscriptUsageInWindow,
198
199
  transcriptActivityAgeSeconds
199
- } from "../chunk-EXCMPARK.js";
200
+ } from "../chunk-QRQE2MVT.js";
200
201
  import {
201
202
  reapOrphanChannelMcps
202
203
  } from "../chunk-XWVM4KPK.js";
@@ -1021,13 +1022,47 @@ function isQuarantineFile(value) {
1021
1022
  import { readFileSync as readFileSync4 } from "fs";
1022
1023
  import { join as join4 } from "path";
1023
1024
  function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_CONTEXT_ALARM_CHARS) {
1025
+ let chars;
1026
+ let bytes;
1024
1027
  try {
1025
1028
  const buf = readFileSync4(join4(configDir, codeName, "project", "CLAUDE.md"));
1026
- const chars = buf.toString("utf8").length;
1027
- return { chars, bytes: buf.length, ceiling, overCeiling: chars > ceiling };
1029
+ chars = buf.toString("utf8").length;
1030
+ bytes = buf.length;
1028
1031
  } catch {
1029
1032
  return null;
1030
1033
  }
1034
+ const skillDescriptionChars = measureCoreKnowledgeDescription(configDir, codeName);
1035
+ const residentChars = chars + skillDescriptionChars;
1036
+ return {
1037
+ chars,
1038
+ bytes,
1039
+ skillDescriptionChars,
1040
+ residentChars,
1041
+ ceiling,
1042
+ overCeiling: residentChars > ceiling
1043
+ };
1044
+ }
1045
+ function measureCoreKnowledgeDescription(configDir, codeName) {
1046
+ let text;
1047
+ try {
1048
+ text = readFileSync4(
1049
+ join4(configDir, codeName, "project", ".claude", "skills", "core-knowledge", "SKILL.md"),
1050
+ "utf8"
1051
+ );
1052
+ } catch {
1053
+ return 0;
1054
+ }
1055
+ const lines = text.split("\n");
1056
+ if (lines[0]?.trim() !== "---") return 0;
1057
+ let descriptionChars;
1058
+ for (let i = 1; i < lines.length; i++) {
1059
+ const line = lines[i] ?? "";
1060
+ if (line.trim() === "---") return descriptionChars ?? 0;
1061
+ if (descriptionChars === void 0 && line.startsWith("description:")) {
1062
+ descriptionChars = line.length;
1063
+ }
1064
+ }
1065
+ return 0;
1031
1066
  }
1032
1067
  var lastOverCeiling = /* @__PURE__ */ new Map();
1033
1068
  function logClaudeMdCeilingTransition(codeName, report, log2) {
@@ -1039,7 +1074,7 @@ function logClaudeMdCeilingTransition(codeName, report, log2) {
1039
1074
  }
1040
1075
  if (previous === report.overCeiling) return null;
1041
1076
  lastOverCeiling.set(codeName, report.overCeiling);
1042
- const line = report.overCeiling ? `[claude-md] '${codeName}' project/CLAUDE.md is ${report.chars} chars, OVER the ${report.ceiling} threshold by ${report.chars - report.ceiling} \u2014 nothing is truncated, but the whole file is re-sent every request, so this is context permanently spent (ENG-8163 / ENG-9459)` : `[claude-md] '${codeName}' project/CLAUDE.md back under the threshold (${report.chars}/${report.ceiling} chars)`;
1077
+ const line = report.overCeiling ? `[claude-md] '${codeName}' resident identity is ${report.residentChars} chars (CLAUDE.md ${report.chars} + core-knowledge skill description ${report.skillDescriptionChars}), OVER the ${report.ceiling} threshold by ${report.residentChars - report.ceiling} \u2014 nothing is truncated, but both are re-sent every request, so this is context permanently spent (ENG-8163 / ENG-9459 / ENG-9466)` : `[claude-md] '${codeName}' resident identity back under the threshold (${report.residentChars}/${report.ceiling} chars)`;
1043
1078
  log2(line);
1044
1079
  return line;
1045
1080
  }
@@ -2508,7 +2543,6 @@ async function maybeReportUsageBanner(args) {
2508
2543
  }
2509
2544
 
2510
2545
  // src/lib/host-usage-poller.ts
2511
- var HOST_USAGE_POLL_INTERVAL_MS = 15 * 60 * 1e3;
2512
2546
  var HOST_USAGE_POLL_TIMEOUT_MS = 6e4;
2513
2547
  var USAGE_COMMAND_ARGS = ["-p", "/usage", "--output-format", "json"];
2514
2548
  var state2 = {
@@ -2528,6 +2562,22 @@ function extractUsageText(stdout) {
2528
2562
  return null;
2529
2563
  }
2530
2564
  }
2565
+ function readStoredInstant(raw) {
2566
+ if (raw === null) return null;
2567
+ if (typeof raw !== "string" || raw === "") return void 0;
2568
+ const parsed = new Date(raw);
2569
+ return Number.isNaN(parsed.getTime()) ? void 0 : parsed;
2570
+ }
2571
+ function storedResetInstants(response) {
2572
+ if (!response || typeof response !== "object" || Array.isArray(response)) return {};
2573
+ const body = response;
2574
+ const out = {};
2575
+ const week = readStoredInstant(body["week_resets_at"]);
2576
+ if (week !== void 0) out.week = week;
2577
+ const session = readStoredInstant(body["session_resets_at"]);
2578
+ if (session !== void 0) out.session = session;
2579
+ return out;
2580
+ }
2531
2581
  async function maybePollHostUsage(deps) {
2532
2582
  const { api: api2, runUsageCommand, authMode, cliVersion, log: log2 } = deps;
2533
2583
  const now = deps.now ?? /* @__PURE__ */ new Date();
@@ -2562,7 +2612,7 @@ async function maybePollHostUsage(deps) {
2562
2612
  state2.lastSessionResetsAt,
2563
2613
  reading.sessionResetsAt
2564
2614
  );
2565
- await api2.post("/host/usage-readings", {
2615
+ const response = await api2.post("/host/usage-readings", {
2566
2616
  state: reading.state,
2567
2617
  week_pct: reading.weekPct,
2568
2618
  week_resets_at: weekResetsAt ? weekResetsAt.toISOString() : null,
@@ -2573,11 +2623,13 @@ async function maybePollHostUsage(deps) {
2573
2623
  source: reading.source,
2574
2624
  unknown_reason: reading.unknownReason
2575
2625
  });
2576
- state2.lastWeekResetsAt = weekResetsAt;
2577
- state2.lastSessionResetsAt = sessionResetsAt;
2626
+ const stored = storedResetInstants(response);
2627
+ state2.lastWeekResetsAt = stored.week !== void 0 ? stored.week : weekResetsAt;
2628
+ state2.lastSessionResetsAt = stored.session !== void 0 ? stored.session : sessionResetsAt;
2578
2629
  if (reading.state === "ok") {
2630
+ const anchoredWeek = state2.lastWeekResetsAt;
2579
2631
  log2(
2580
- `[host-usage] week ${reading.weekPct}%` + (weekResetsAt ? ` (resets ${weekResetsAt.toISOString()})` : "") + `, session ${reading.sessionPct}%`
2632
+ `[host-usage] week ${reading.weekPct}%` + (anchoredWeek ? ` (resets ${anchoredWeek.toISOString()})` : "") + `, session ${reading.sessionPct}%`
2581
2633
  );
2582
2634
  } else if (reading.state === "unknown") {
2583
2635
  log2(`[host-usage] reading unknown: ${reading.unknownReason}`);
@@ -11840,7 +11892,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
11840
11892
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
11841
11893
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
11842
11894
  async function channelInboundActivityAgeSecondsFor(codeName) {
11843
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-7FWQQZDJ.js");
11895
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-ZU33A2GB.js");
11844
11896
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
11845
11897
  if (newest === null) return null;
11846
11898
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -12488,7 +12540,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12488
12540
  var lastVersionCheckAt = 0;
12489
12541
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12490
12542
  var lastResponsivenessProbeAt = 0;
12491
- var agtCliVersion = true ? "0.28.698" : "dev";
12543
+ var agtCliVersion = true ? "0.28.700" : "dev";
12492
12544
  function resolveBrewPath(execFileSync3) {
12493
12545
  try {
12494
12546
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -13989,7 +14041,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
13989
14041
  if (codeNames.length === 0) return;
13990
14042
  void (async () => {
13991
14043
  try {
13992
- const { collectDiagnostics } = await import("../persistent-session-YM5ELNFF.js");
14044
+ const { collectDiagnostics } = await import("../persistent-session-7XILEFLF.js");
13993
14045
  await api.post("/host/heartbeat", {
13994
14046
  host_id: hostId,
13995
14047
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -14107,7 +14159,7 @@ async function pollCycleInner() {
14107
14159
  }
14108
14160
  try {
14109
14161
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
14110
- const { collectDiagnostics } = await import("../persistent-session-YM5ELNFF.js");
14162
+ const { collectDiagnostics } = await import("../persistent-session-7XILEFLF.js");
14111
14163
  const diagCodeNames = [...agentState.persistentSessionAgents];
14112
14164
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor) : void 0;
14113
14165
  let tailscaleHostname;
@@ -14259,7 +14311,7 @@ async function pollCycleInner() {
14259
14311
  collectPanelessActivityProbes,
14260
14312
  getResponsivenessIntervalMs,
14261
14313
  occupancyQualificationClassifications
14262
- } = await import("../responsiveness-probe-7FWQQZDJ.js");
14314
+ } = await import("../responsiveness-probe-ZU33A2GB.js");
14263
14315
  const probeIntervalMs = getResponsivenessIntervalMs();
14264
14316
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
14265
14317
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -14369,7 +14421,7 @@ async function pollCycleInner() {
14369
14421
  collectResponsivenessProbes,
14370
14422
  livePendingInboundOldestAgeSeconds,
14371
14423
  parkPendingInbound
14372
- } = await import("../responsiveness-probe-7FWQQZDJ.js");
14424
+ } = await import("../responsiveness-probe-ZU33A2GB.js");
14373
14425
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
14374
14426
  const wedgeNow = /* @__PURE__ */ new Date();
14375
14427
  const liveAgents = agentState.persistentSessionAgents;
@@ -14525,7 +14577,7 @@ async function pollCycleInner() {
14525
14577
  }
14526
14578
  try {
14527
14579
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
14528
- const { probeSessionAuth } = await import("../session-auth-dead-GRR6Y5ZP.js");
14580
+ const { probeSessionAuth } = await import("../session-auth-dead-ODQB4UPP.js");
14529
14581
  const observations = [];
14530
14582
  const pendingCacheCommits = [];
14531
14583
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -18285,7 +18337,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18285
18337
  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}`));
18286
18338
  void (async () => {
18287
18339
  try {
18288
- const { collectDiagnostics } = await import("../persistent-session-YM5ELNFF.js");
18340
+ const { collectDiagnostics } = await import("../persistent-session-7XILEFLF.js");
18289
18341
  await api.post("/host/heartbeat", {
18290
18342
  host_id: hostId,
18291
18343
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -18336,7 +18388,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
18336
18388
  }
18337
18389
  try {
18338
18390
  const hostId = await getHostId();
18339
- const { collectDiagnostics } = await import("../persistent-session-YM5ELNFF.js");
18391
+ const { collectDiagnostics } = await import("../persistent-session-7XILEFLF.js");
18340
18392
  await api.post("/host/heartbeat", {
18341
18393
  host_id: hostId,
18342
18394
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor)
@@ -18968,7 +19020,7 @@ async function processClaudePairSessions(agents) {
18968
19020
  killPairSession,
18969
19021
  pairTmuxSession,
18970
19022
  finalizeClaudePairOnboarding
18971
- } = await import("../claude-pair-runtime-5CLVPPM4.js");
19023
+ } = await import("../claude-pair-runtime-NVLSNWWS.js");
18972
19024
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
18973
19025
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
18974
19026
  const killed = await killPairSession(pairTmuxSession(pairId));