@integrity-labs/agt-cli 0.28.1012 → 0.28.1014

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 (26) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-O3DODZVZ.js → chunk-7QXIJNLA.js} +8 -6
  3. package/dist/chunk-7QXIJNLA.js.map +1 -0
  4. package/dist/{chunk-LV72A4BE.js → chunk-MLCGPEN6.js} +22 -3
  5. package/dist/chunk-MLCGPEN6.js.map +1 -0
  6. package/dist/{chunk-K73BIWKA.js → chunk-QBQLG2PY.js} +2 -2
  7. package/dist/chunk-QBQLG2PY.js.map +1 -0
  8. package/dist/{claude-pair-runtime-NPXBXUSE.js → claude-pair-runtime-4F73QFXF.js} +2 -2
  9. package/dist/lib/manager-worker.js +95 -19
  10. package/dist/lib/manager-worker.js.map +1 -1
  11. package/dist/mcp/direct-chat-channel.js +12 -1
  12. package/dist/mcp/index.js +12 -1
  13. package/dist/mcp/origami.js +12 -1
  14. package/dist/mcp/slack-channel.js +12 -1
  15. package/dist/mcp/telegram-channel.js +12 -1
  16. package/dist/{persistent-session-KPASTJIV.js → persistent-session-IEGA6OSO.js} +3 -3
  17. package/dist/{responsiveness-probe-RSVGRS63.js → responsiveness-probe-KWFVG5EI.js} +3 -3
  18. package/dist/{session-auth-dead-YV2X4AGF.js → session-auth-dead-P6KOHDYJ.js} +2 -2
  19. package/package.json +1 -1
  20. package/dist/chunk-K73BIWKA.js.map +0 -1
  21. package/dist/chunk-LV72A4BE.js.map +0 -1
  22. package/dist/chunk-O3DODZVZ.js.map +0 -1
  23. /package/dist/{claude-pair-runtime-NPXBXUSE.js.map → claude-pair-runtime-4F73QFXF.js.map} +0 -0
  24. /package/dist/{persistent-session-KPASTJIV.js.map → persistent-session-IEGA6OSO.js.map} +0 -0
  25. /package/dist/{responsiveness-probe-RSVGRS63.js.map → responsiveness-probe-KWFVG5EI.js.map} +0 -0
  26. /package/dist/{session-auth-dead-YV2X4AGF.js.map → session-auth-dead-P6KOHDYJ.js.map} +0 -0
@@ -266,7 +266,7 @@ async function spawnPairSession(session) {
266
266
  return { ok: true };
267
267
  } catch {
268
268
  }
269
- const { resolveClaudeBinary } = await import("./persistent-session-KPASTJIV.js");
269
+ const { resolveClaudeBinary } = await import("./persistent-session-IEGA6OSO.js");
270
270
  const claudeBin = resolveClaudeBinary();
271
271
  const pairEnv = {
272
272
  ...process.env,
@@ -734,4 +734,4 @@ export {
734
734
  startClaudePair,
735
735
  submitClaudePairCode
736
736
  };
737
- //# sourceMappingURL=claude-pair-runtime-NPXBXUSE.js.map
737
+ //# sourceMappingURL=claude-pair-runtime-4F73QFXF.js.map
@@ -64,7 +64,7 @@ import {
64
64
  safeWriteJsonAtomic,
65
65
  setConfigHash,
66
66
  tripClass
67
- } from "../chunk-O3DODZVZ.js";
67
+ } from "../chunk-7QXIJNLA.js";
68
68
  import {
69
69
  getProjectDir as getProjectDir2,
70
70
  getReadyTasks,
@@ -145,11 +145,13 @@ import {
145
145
  takeZombieDetection,
146
146
  toOpencodeModel,
147
147
  writeEgressAllowlist
148
- } from "../chunk-K73BIWKA.js";
148
+ } from "../chunk-QBQLG2PY.js";
149
149
  import {
150
150
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
151
151
  AnchorSessionClient,
152
+ CLAUDE_MD_BUDGET_CHARS,
152
153
  CLAUDE_MD_CONTEXT_ALARM_CHARS,
154
+ CLAUDE_MD_MANAGER_APPEND_HEADROOM_CHARS,
153
155
  CONVERSATION_FAILURE_CATEGORIES,
154
156
  DEFAULT_FRAMEWORK,
155
157
  DEFAULT_NEIGHBOURHOOD_MS,
@@ -166,6 +168,8 @@ import {
166
168
  KANBAN_NUDGE_ACTIONABLE_STATUSES,
167
169
  MAX_AVATAR_ENV_URL_BYTES,
168
170
  SCHEDULED_TURN_MARKER_FILENAME,
171
+ SKILLS_INDEX_SECTION_END,
172
+ SKILLS_INDEX_SECTION_START,
169
173
  SUPPRESS_SENTINEL,
170
174
  StreamEncoder,
171
175
  UNKNOWN_RATE_LIMIT,
@@ -244,7 +248,7 @@ import {
244
248
  subagentActivityAgeSeconds,
245
249
  sumTranscriptUsageInWindow,
246
250
  transcriptActivityAgeSeconds
247
- } from "../chunk-LV72A4BE.js";
251
+ } from "../chunk-MLCGPEN6.js";
248
252
  import "../chunk-DHWNVVX4.js";
249
253
  import {
250
254
  reapOrphanChannelMcps
@@ -1347,23 +1351,29 @@ function isQuarantineFile(value) {
1347
1351
  // src/lib/claude-md-size.ts
1348
1352
  import { readFileSync as readFileSync5 } from "fs";
1349
1353
  import { join as join5 } from "path";
1350
- function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_CONTEXT_ALARM_CHARS) {
1354
+ function measureClaudeMd(configDir, codeName, ceiling = CLAUDE_MD_CONTEXT_ALARM_CHARS, graftHeadroomChars = CLAUDE_MD_MANAGER_APPEND_HEADROOM_CHARS) {
1351
1355
  let chars;
1352
1356
  let bytes;
1357
+ let text;
1353
1358
  try {
1354
1359
  const buf = readFileSync5(join5(configDir, codeName, "project", "CLAUDE.md"));
1355
- chars = buf.toString("utf8").length;
1360
+ text = buf.toString("utf8");
1361
+ chars = text.length;
1356
1362
  bytes = buf.length;
1357
1363
  } catch {
1358
1364
  return null;
1359
1365
  }
1360
1366
  const skillDescriptionChars = measureCoreKnowledgeDescription(configDir, codeName);
1361
1367
  const residentChars = chars + skillDescriptionChars;
1368
+ const graftChars = measureManagedGraft(text, readProvisionClaudeMd(configDir, codeName));
1362
1369
  return {
1363
1370
  chars,
1364
1371
  bytes,
1365
1372
  skillDescriptionChars,
1366
1373
  residentChars,
1374
+ graftChars,
1375
+ graftHeadroom: graftHeadroomChars,
1376
+ graftOverHeadroom: graftChars > graftHeadroomChars,
1367
1377
  ceiling,
1368
1378
  overCeiling: residentChars > ceiling
1369
1379
  };
@@ -1390,7 +1400,40 @@ function measureCoreKnowledgeDescription(configDir, codeName) {
1390
1400
  }
1391
1401
  return 0;
1392
1402
  }
1403
+ function measureManagedGraft(text, generated) {
1404
+ const blocks = [
1405
+ // The skills index is unconditionally the manager's: `refreshSkillsIndexInClaudeMd`
1406
+ // is its only writer, and the deploy step strips it before comparing and
1407
+ // re-grafts it precisely BECAUSE the generator never produces it.
1408
+ [SKILLS_INDEX_SECTION_START, SKILLS_INDEX_SECTION_END, false],
1409
+ // The integrations section has TWO possible authors, and this is the trap.
1410
+ // `generateClaudeMd` emits it — sentinels and all — into the generated body
1411
+ // when `renderIntegrationsSection` is on, and the manager writes it
1412
+ // otherwise. Counting it blindly would bill generated content to the
1413
+ // manager and could manufacture a breach out of a body CI already measured.
1414
+ // So it counts only when the GENERATED artifact does not contain it.
1415
+ [INTEGRATIONS_SECTION_START, INTEGRATIONS_SECTION_END, true]
1416
+ ];
1417
+ let total = 0;
1418
+ for (const [start, end, checkGenerated] of blocks) {
1419
+ const from = text.indexOf(start);
1420
+ if (from === -1) continue;
1421
+ const to = text.indexOf(end, from + start.length);
1422
+ if (to === -1) continue;
1423
+ if (checkGenerated && (generated === null || generated.includes(start))) continue;
1424
+ total += to + end.length - from;
1425
+ }
1426
+ return total;
1427
+ }
1428
+ function readProvisionClaudeMd(configDir, codeName) {
1429
+ try {
1430
+ return readFileSync5(join5(configDir, codeName, "provision", "CLAUDE.md"), "utf8");
1431
+ } catch {
1432
+ return null;
1433
+ }
1434
+ }
1393
1435
  var lastOverCeiling = /* @__PURE__ */ new Map();
1436
+ var lastGraftOverHeadroom = /* @__PURE__ */ new Map();
1394
1437
  function logClaudeMdCeilingTransition(codeName, report, log2) {
1395
1438
  if (!report) return null;
1396
1439
  const previous = lastOverCeiling.get(codeName);
@@ -1404,6 +1447,19 @@ function logClaudeMdCeilingTransition(codeName, report, log2) {
1404
1447
  log2(line);
1405
1448
  return line;
1406
1449
  }
1450
+ function logClaudeMdGraftTransition(codeName, report, log2) {
1451
+ if (!report) return null;
1452
+ const previous = lastGraftOverHeadroom.get(codeName);
1453
+ if (previous === void 0 && !report.graftOverHeadroom) {
1454
+ lastGraftOverHeadroom.set(codeName, false);
1455
+ return null;
1456
+ }
1457
+ if (previous === report.graftOverHeadroom) return null;
1458
+ lastGraftOverHeadroom.set(codeName, report.graftOverHeadroom);
1459
+ const line = report.graftOverHeadroom ? `[claude-md] '${codeName}' manager-appended blocks are ${report.graftChars} chars, OVER the ${report.graftHeadroom} the generator reserved by ${report.graftChars - report.graftHeadroom}. The generated body is sized on the assumption that the append fits in that reservation, so the deployed file is larger than CI can see. The append is DB-driven and per-agent (skills index, integrations section) \u2014 shrink it by installing fewer skills or turning the skills index off, not by raising the reservation (ENG-10904)` : `[claude-md] '${codeName}' manager-appended blocks back within the reserved ${report.graftHeadroom} chars (${report.graftChars})`;
1460
+ log2(line);
1461
+ return line;
1462
+ }
1407
1463
 
1408
1464
  // ../../packages/core/dist/integrations/forwarded-tools-report.js
1409
1465
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
@@ -5680,6 +5736,7 @@ ${trimmedOverrides}
5680
5736
  }
5681
5737
 
5682
5738
  // src/lib/integration-skill-layout.ts
5739
+ var UMBRELLA_DESCRIPTION_MAX_CHARS = Math.round(CLAUDE_MD_BUDGET_CHARS * 0.01);
5683
5740
  function extractDescription(content) {
5684
5741
  const match = content.match(/^---\s*([\s\S]*?)---/);
5685
5742
  if (!match) return null;
@@ -5737,7 +5794,7 @@ function buildIntegrationBundle(skills) {
5737
5794
  }
5738
5795
  }
5739
5796
  const integrationName = slugToTitle(integrationSlug);
5740
- const umbrellaDescription = entries.map((e) => e.description ?? `Use for ${e.skillName}.`).join(" ");
5797
+ const umbrellaDescription = buildUmbrellaDescription(integrationName, entries);
5741
5798
  const scopeList = entries.map((e) => {
5742
5799
  const label = e.skillName || slugToTitle(e.scopeSlug);
5743
5800
  const desc = e.description ? ` \u2014 ${e.description}` : "";
@@ -5775,6 +5832,24 @@ function buildIntegrationBundle(skills) {
5775
5832
  scopePaths: entries.map((e) => e.scopePath)
5776
5833
  };
5777
5834
  }
5835
+ function buildUmbrellaDescription(integrationName, entries) {
5836
+ const labels = entries.map((e) => e.skillName?.trim() || slugToTitle(e.scopeSlug));
5837
+ const prefix = `Use for ${integrationName}.`;
5838
+ const suffix = "Read the matching file under scopes/ for tool names and usage.";
5839
+ const compose = (count) => {
5840
+ const omitted = labels.length - count;
5841
+ const listed = labels.slice(0, count).join("; ");
5842
+ const scopes = omitted > 0 ? `${listed}; +${omitted} more` : listed;
5843
+ return `${prefix} Scopes: ${scopes}. ${suffix}`;
5844
+ };
5845
+ let shown = labels.length;
5846
+ while (shown > 1 && compose(shown).length > UMBRELLA_DESCRIPTION_MAX_CHARS) {
5847
+ shown -= 1;
5848
+ }
5849
+ const line = compose(shown);
5850
+ if (line.length <= UMBRELLA_DESCRIPTION_MAX_CHARS) return line;
5851
+ return `${line.slice(0, Math.max(0, UMBRELLA_DESCRIPTION_MAX_CHARS - 1))}\u2026`;
5852
+ }
5778
5853
  function slugToTitle(slug) {
5779
5854
  return slug.split(/[-_]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
5780
5855
  }
@@ -13567,7 +13642,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
13567
13642
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
13568
13643
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
13569
13644
  async function channelInboundActivityAgeSecondsFor(codeName) {
13570
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-RSVGRS63.js");
13645
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-KWFVG5EI.js");
13571
13646
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
13572
13647
  if (newest === null) return null;
13573
13648
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -14310,7 +14385,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
14310
14385
  var lastVersionCheckAt = 0;
14311
14386
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
14312
14387
  var lastResponsivenessProbeAt = 0;
14313
- var agtCliVersion = true ? "0.28.1012" : "dev";
14388
+ var agtCliVersion = true ? "0.28.1014" : "dev";
14314
14389
  function resolveBrewPath(execFileSync3) {
14315
14390
  try {
14316
14391
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -15747,6 +15822,7 @@ function claudeMdSizeFor(codeName) {
15747
15822
  if (!config?.configDir) return null;
15748
15823
  const report = measureClaudeMd(config.configDir, codeName);
15749
15824
  logClaudeMdCeilingTransition(codeName, report, log);
15825
+ logClaudeMdGraftTransition(codeName, report, log);
15750
15826
  return report;
15751
15827
  }
15752
15828
  function forwardedToolsFor(codeName) {
@@ -15811,8 +15887,8 @@ function send(msg) {
15811
15887
  log(`Error: ${msg.message}`);
15812
15888
  }
15813
15889
  }
15814
- var SKILLS_INDEX_START = "<!-- AGT:SKILLS_INDEX_START -->";
15815
- var SKILLS_INDEX_END = "<!-- AGT:SKILLS_INDEX_END -->";
15890
+ var SKILLS_INDEX_START = SKILLS_INDEX_SECTION_START;
15891
+ var SKILLS_INDEX_END = SKILLS_INDEX_SECTION_END;
15816
15892
  function sanitizeSkillsIndexText(value) {
15817
15893
  return value.replaceAll(SKILLS_INDEX_START, "").replaceAll(SKILLS_INDEX_END, "").replace(/<!--[\s\S]*?-->/g, "").replace(/\r?\n+/g, " ").trim();
15818
15894
  }
@@ -15944,7 +16020,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
15944
16020
  if (codeNames.length === 0) return;
15945
16021
  void (async () => {
15946
16022
  try {
15947
- const { collectDiagnostics } = await import("../persistent-session-KPASTJIV.js");
16023
+ const { collectDiagnostics } = await import("../persistent-session-IEGA6OSO.js");
15948
16024
  await api.post("/host/heartbeat", {
15949
16025
  host_id: hostId,
15950
16026
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -16086,7 +16162,7 @@ async function pollCycleInner() {
16086
16162
  }
16087
16163
  try {
16088
16164
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
16089
- const { collectDiagnostics } = await import("../persistent-session-KPASTJIV.js");
16165
+ const { collectDiagnostics } = await import("../persistent-session-IEGA6OSO.js");
16090
16166
  const diagCodeNames = [...agentState.persistentSessionAgents];
16091
16167
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor) : void 0;
16092
16168
  let tailscaleHostname;
@@ -16262,7 +16338,7 @@ async function pollCycleInner() {
16262
16338
  collectPanelessActivityProbes,
16263
16339
  getResponsivenessIntervalMs,
16264
16340
  occupancyQualificationClassifications
16265
- } = await import("../responsiveness-probe-RSVGRS63.js");
16341
+ } = await import("../responsiveness-probe-KWFVG5EI.js");
16266
16342
  const probeIntervalMs = getResponsivenessIntervalMs();
16267
16343
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
16268
16344
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -16379,7 +16455,7 @@ async function pollCycleInner() {
16379
16455
  collectResponsivenessProbes,
16380
16456
  livePendingInboundOldestAgeSeconds,
16381
16457
  parkPendingInbound
16382
- } = await import("../responsiveness-probe-RSVGRS63.js");
16458
+ } = await import("../responsiveness-probe-KWFVG5EI.js");
16383
16459
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
16384
16460
  const wedgeNow = /* @__PURE__ */ new Date();
16385
16461
  const liveAgents = agentState.persistentSessionAgents;
@@ -16535,7 +16611,7 @@ async function pollCycleInner() {
16535
16611
  }
16536
16612
  try {
16537
16613
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
16538
- const { probeSessionAuth } = await import("../session-auth-dead-YV2X4AGF.js");
16614
+ const { probeSessionAuth } = await import("../session-auth-dead-P6KOHDYJ.js");
16539
16615
  const observations = [];
16540
16616
  const pendingCacheCommits = [];
16541
16617
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -20915,7 +20991,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
20915
20991
  try {
20916
20992
  const freshId = rotateSessionForWedge(codeName);
20917
20993
  consecutiveWedgeCycles.delete(codeName);
20918
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-RSVGRS63.js");
20994
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-KWFVG5EI.js");
20919
20995
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
20920
20996
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
20921
20997
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -20958,7 +21034,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
20958
21034
  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}`));
20959
21035
  void (async () => {
20960
21036
  try {
20961
- const { collectDiagnostics } = await import("../persistent-session-KPASTJIV.js");
21037
+ const { collectDiagnostics } = await import("../persistent-session-IEGA6OSO.js");
20962
21038
  await api.post("/host/heartbeat", {
20963
21039
  host_id: hostId,
20964
21040
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -21009,7 +21085,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
21009
21085
  }
21010
21086
  try {
21011
21087
  const hostId = await getHostId();
21012
- const { collectDiagnostics } = await import("../persistent-session-KPASTJIV.js");
21088
+ const { collectDiagnostics } = await import("../persistent-session-IEGA6OSO.js");
21013
21089
  await api.post("/host/heartbeat", {
21014
21090
  host_id: hostId,
21015
21091
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -21680,7 +21756,7 @@ async function processClaudePairSessions(agents) {
21680
21756
  // cannot take it for itself — by the time it runs, the write it is looking
21681
21757
  // for may already have happened.
21682
21758
  snapshotPairConfig
21683
- } = await import("../claude-pair-runtime-NPXBXUSE.js");
21759
+ } = await import("../claude-pair-runtime-4F73QFXF.js");
21684
21760
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
21685
21761
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
21686
21762
  const killed = await killPairSession(pairTmuxSession(pairId));