@integrity-labs/agt-cli 0.28.1191 → 0.28.1193

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 (31) hide show
  1. package/dist/bin/agt.js +6 -6
  2. package/dist/{chunk-7T4CZ2NS.js → chunk-DXLSLT5G.js} +2 -2
  3. package/dist/{chunk-L5BWZX3Z.js → chunk-NJ2AUTIO.js} +3 -3
  4. package/dist/{chunk-VS3QXUDM.js → chunk-UQYIFOWE.js} +2 -2
  5. package/dist/{chunk-GRU6GNLP.js → chunk-UUO7QTLC.js} +76 -15
  6. package/dist/chunk-UUO7QTLC.js.map +1 -0
  7. package/dist/{chunk-5RDPFXWO.js → chunk-ZTA7AGKM.js} +7 -5
  8. package/dist/chunk-ZTA7AGKM.js.map +1 -0
  9. package/dist/{claude-code-updater-JPVLPWVR.js → claude-code-updater-EOJQHUZ2.js} +3 -3
  10. package/dist/{claude-pair-runtime-JXXYGKWS.js → claude-pair-runtime-WKTA3HNF.js} +3 -3
  11. package/dist/lib/manager-worker.js +71 -23
  12. package/dist/lib/manager-worker.js.map +1 -1
  13. package/dist/mcp/direct-chat-channel.js +6 -2
  14. package/dist/mcp/index.js +54 -1
  15. package/dist/mcp/origami.js +3 -0
  16. package/dist/mcp/slack-channel.js +6 -2
  17. package/dist/mcp/telegram-channel.js +112 -15
  18. package/dist/{persistent-session-NSA3UYRF.js → persistent-session-5MGJGJIB.js} +4 -4
  19. package/dist/{responsiveness-probe-MWH3BKAL.js → responsiveness-probe-J4CBYZS3.js} +4 -4
  20. package/dist/{session-auth-dead-RYU7ZB56.js → session-auth-dead-7CSZHNBK.js} +3 -3
  21. package/package.json +1 -1
  22. package/dist/chunk-5RDPFXWO.js.map +0 -1
  23. package/dist/chunk-GRU6GNLP.js.map +0 -1
  24. /package/dist/{chunk-7T4CZ2NS.js.map → chunk-DXLSLT5G.js.map} +0 -0
  25. /package/dist/{chunk-L5BWZX3Z.js.map → chunk-NJ2AUTIO.js.map} +0 -0
  26. /package/dist/{chunk-VS3QXUDM.js.map → chunk-UQYIFOWE.js.map} +0 -0
  27. /package/dist/{claude-code-updater-JPVLPWVR.js.map → claude-code-updater-EOJQHUZ2.js.map} +0 -0
  28. /package/dist/{claude-pair-runtime-JXXYGKWS.js.map → claude-pair-runtime-WKTA3HNF.js.map} +0 -0
  29. /package/dist/{persistent-session-NSA3UYRF.js.map → persistent-session-5MGJGJIB.js.map} +0 -0
  30. /package/dist/{responsiveness-probe-MWH3BKAL.js.map → responsiveness-probe-J4CBYZS3.js.map} +0 -0
  31. /package/dist/{session-auth-dead-RYU7ZB56.js.map → session-auth-dead-7CSZHNBK.js.map} +0 -0
@@ -38270,6 +38270,9 @@ var BY_ID = new Map(GUARDRAIL_ENFORCERS.map((e) => [e.id, e]));
38270
38270
  var MAX_AGENT_RULES = 8;
38271
38271
  var MAX_AGENT_RULE_CHARS = 200;
38272
38272
  var MAX_AGENT_RULES_CHARS = MAX_AGENT_RULES * (MAX_AGENT_RULE_CHARS + 4);
38273
+ var MAX_ORG_RULES = 10;
38274
+ var MAX_TEAM_RULES = 10;
38275
+ var MAX_INHERITED_RULES_CHARS = (MAX_ORG_RULES + MAX_TEAM_RULES) * (MAX_AGENT_RULE_CHARS + 4);
38273
38276
 
38274
38277
  // ../core/dist/provisioning/frameworks/claudecode/identity.js
38275
38278
  var CLAUDE_MD_CHARS_PER_TOKEN = 3.57;
@@ -47670,6 +47673,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
47670
47673
  let oldest = null;
47671
47674
  for (const name of names) {
47672
47675
  if (!name.endsWith(".json")) continue;
47676
+ if (opts?.exclude?.(name)) continue;
47673
47677
  let receivedAt;
47674
47678
  try {
47675
47679
  const raw = JSON.parse(readFileSync9(join10(dir, name), "utf-8"));
@@ -47688,8 +47692,8 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
47688
47692
  }
47689
47693
  return oldest;
47690
47694
  }
47691
- function hasInFlightInbound(dir, now = Date.now()) {
47692
- return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true }) != null;
47695
+ function hasInFlightInbound(dir, now = Date.now(), opts) {
47696
+ return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true, exclude: opts?.exclude }) != null;
47693
47697
  }
47694
47698
  function channelOrphanMarkerMs() {
47695
47699
  const raw = parseInt(process.env.AGT_CHANNEL_ORPHAN_MARKER_MS ?? "", 10);
package/dist/mcp/index.js CHANGED
@@ -24287,6 +24287,9 @@ var BY_ID = new Map(GUARDRAIL_ENFORCERS.map((e) => [e.id, e]));
24287
24287
  var MAX_AGENT_RULES = 8;
24288
24288
  var MAX_AGENT_RULE_CHARS = 200;
24289
24289
  var MAX_AGENT_RULES_CHARS = MAX_AGENT_RULES * (MAX_AGENT_RULE_CHARS + 4);
24290
+ var MAX_ORG_RULES = 10;
24291
+ var MAX_TEAM_RULES = 10;
24292
+ var MAX_INHERITED_RULES_CHARS = (MAX_ORG_RULES + MAX_TEAM_RULES) * (MAX_AGENT_RULE_CHARS + 4);
24290
24293
  var AGENT_RULE_NO_END_DATE_NOTE = ' Rules have no end date: this one applies on every turn until someone removes it. If it is only meant to hold for a while, say so IN the rule ("until the migration ships") so the reason to drop it is visible later \u2014 rule_list shows how old each rule is.';
24291
24294
  function describeAgentRuleList(rules, max, maxChars, now = Date.now()) {
24292
24295
  if (rules.length === 0) {
@@ -24304,6 +24307,47 @@ function describeAgentRuleList(rules, max, maxChars, now = Date.now()) {
24304
24307
  ${lines}
24305
24308
  ${note}`;
24306
24309
  }
24310
+ function describeInheritedAgentRules(inherited, now = Date.now()) {
24311
+ if (inherited === void 0)
24312
+ return "";
24313
+ const unreadable = (which) => `
24314
+ Could not read the rules you inherit from your ${which}, so this list may be incomplete. Do not tell anyone these are all the rules you follow.`;
24315
+ if (inherited === null || inherited.organization === null && inherited.team === null) {
24316
+ return unreadable("organisation and team");
24317
+ }
24318
+ const failed = inherited.organization === null ? unreadable("organisation") : inherited.team === null ? unreadable("team") : "";
24319
+ const block = (label, rules) => {
24320
+ if (rules === null)
24321
+ return "";
24322
+ const kept = rules.filter((r) => r.text.trim().length > 0);
24323
+ if (kept.length === 0)
24324
+ return "";
24325
+ const lines = kept.map((r) => {
24326
+ const days = agentRuleAgeInDays(r.createdAt, now);
24327
+ if (days === null)
24328
+ return `- ${r.text.trim()}`;
24329
+ return `- ${r.text.trim()} (${days === 0 ? "added today" : `added ${days} day${days === 1 ? "" : "s"} ago`})`;
24330
+ }).join("\n");
24331
+ return `${label}:
24332
+ ${lines}`;
24333
+ };
24334
+ const blocks = [block("From your organisation", inherited.organization), block("From your team", inherited.team)].filter(Boolean);
24335
+ if (blocks.length === 0)
24336
+ return failed;
24337
+ return failed + // Obi Wan 6e8bc3da77e9 on #7341: no console screen for these exists until
24338
+ // ENG-11472 part 2, and the agent relays this text to people, so it names
24339
+ // who manages them, not a page that is not there yet.
24340
+ `
24341
+ Also in force, inherited and read-only. You cannot add, replace or remove these: they are set for your whole organisation or team, so a change has to come from one of its admins. If one conflicts with your own rule, yours wins.
24342
+ ${blocks.join("\n")}`;
24343
+ }
24344
+ function describeRuleListReply(ownList, ownRules, inherited, now = Date.now()) {
24345
+ const inheritedText = describeInheritedAgentRules(inherited, now);
24346
+ const ownEmpty = !ownRules.some((r) => r.text.trim().length > 0);
24347
+ const own = ownEmpty && inheritedText !== "" ? ownList.replace(OWN_EMPTY_HEADLINE, "None of your own yet.") : ownList;
24348
+ return own + inheritedText;
24349
+ }
24350
+ var OWN_EMPTY_HEADLINE = /^No standing rules yet\./;
24307
24351
  function agentRuleAgeInDays(createdAt, now = Date.now()) {
24308
24352
  if (!createdAt)
24309
24353
  return null;
@@ -52223,7 +52267,16 @@ server.tool(
52223
52267
  return { content: [{ type: "text", text: "Could not read your standing rules." }], isError: true };
52224
52268
  }
52225
52269
  return {
52226
- content: [{ type: "text", text: describeAgentRuleList(data.rules, data.max, data.max_chars) }]
52270
+ content: [
52271
+ {
52272
+ type: "text",
52273
+ text: describeRuleListReply(
52274
+ describeAgentRuleList(data.rules, data.max, data.max_chars),
52275
+ data.rules,
52276
+ data.inherited
52277
+ )
52278
+ }
52279
+ ]
52227
52280
  };
52228
52281
  }
52229
52282
  );
@@ -38442,6 +38442,9 @@ var BY_ID = new Map(GUARDRAIL_ENFORCERS.map((e) => [e.id, e]));
38442
38442
  var MAX_AGENT_RULES = 8;
38443
38443
  var MAX_AGENT_RULE_CHARS = 200;
38444
38444
  var MAX_AGENT_RULES_CHARS = MAX_AGENT_RULES * (MAX_AGENT_RULE_CHARS + 4);
38445
+ var MAX_ORG_RULES = 10;
38446
+ var MAX_TEAM_RULES = 10;
38447
+ var MAX_INHERITED_RULES_CHARS = (MAX_ORG_RULES + MAX_TEAM_RULES) * (MAX_AGENT_RULE_CHARS + 4);
38445
38448
 
38446
38449
  // ../core/dist/provisioning/frameworks/claudecode/identity.js
38447
38450
  var CLAUDE_MD_CHARS_PER_TOKEN = 3.57;
@@ -32851,6 +32851,9 @@ var BY_ID = new Map(GUARDRAIL_ENFORCERS.map((e) => [e.id, e]));
32851
32851
  var MAX_AGENT_RULES = 8;
32852
32852
  var MAX_AGENT_RULE_CHARS = 200;
32853
32853
  var MAX_AGENT_RULES_CHARS = MAX_AGENT_RULES * (MAX_AGENT_RULE_CHARS + 4);
32854
+ var MAX_ORG_RULES = 10;
32855
+ var MAX_TEAM_RULES = 10;
32856
+ var MAX_INHERITED_RULES_CHARS = (MAX_ORG_RULES + MAX_TEAM_RULES) * (MAX_AGENT_RULE_CHARS + 4);
32854
32857
 
32855
32858
  // ../core/dist/provisioning/frameworks/claudecode/identity.js
32856
32859
  var CLAUDE_MD_CHARS_PER_TOKEN = 3.57;
@@ -41677,6 +41680,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
41677
41680
  let oldest = null;
41678
41681
  for (const name of names) {
41679
41682
  if (!name.endsWith(".json")) continue;
41683
+ if (opts?.exclude?.(name)) continue;
41680
41684
  let receivedAt;
41681
41685
  try {
41682
41686
  const raw = JSON.parse(readFileSync3(join3(dir, name), "utf-8"));
@@ -41695,8 +41699,8 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
41695
41699
  }
41696
41700
  return oldest;
41697
41701
  }
41698
- function hasInFlightInbound(dir, now = Date.now()) {
41699
- return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true }) != null;
41702
+ function hasInFlightInbound(dir, now = Date.now(), opts) {
41703
+ return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true, exclude: opts?.exclude }) != null;
41700
41704
  }
41701
41705
  function isPendingMarkerStale(receivedAt, nowMs, thresholdMs) {
41702
41706
  if (!receivedAt) return true;
@@ -33068,6 +33068,9 @@ var BY_ID = new Map(GUARDRAIL_ENFORCERS.map((e) => [e.id, e]));
33068
33068
  var MAX_AGENT_RULES = 8;
33069
33069
  var MAX_AGENT_RULE_CHARS = 200;
33070
33070
  var MAX_AGENT_RULES_CHARS = MAX_AGENT_RULES * (MAX_AGENT_RULE_CHARS + 4);
33071
+ var MAX_ORG_RULES = 10;
33072
+ var MAX_TEAM_RULES = 10;
33073
+ var MAX_INHERITED_RULES_CHARS = (MAX_ORG_RULES + MAX_TEAM_RULES) * (MAX_AGENT_RULE_CHARS + 4);
33071
33074
 
33072
33075
  // ../core/dist/provisioning/frameworks/claudecode/identity.js
33073
33076
  var CLAUDE_MD_CHARS_PER_TOKEN = 3.57;
@@ -43769,13 +43772,63 @@ function markerArrivalMs(fullPath) {
43769
43772
  return Number.POSITIVE_INFINITY;
43770
43773
  }
43771
43774
  }
43772
- function clearAllTelegramPendingMarkersForChat(pendingDir, chatId, clearMarkerFile, cutoffMs = Number.POSITIVE_INFINITY) {
43773
- return applyToChatMarkers(pendingDir, chatId, clearMarkerFile, cutoffMs);
43775
+ function clearAllTelegramPendingMarkersForChat(pendingDir, chatId, clearMarkerFile, cutoffMs = Number.POSITIVE_INFINITY, reachedSession) {
43776
+ return applyToChatMarkers(pendingDir, chatId, clearMarkerFile, cutoffMs, reachedSession);
43774
43777
  }
43775
- function markSeenAllTelegramPendingMarkersForChat(pendingDir, chatId, markSeen, cutoffMs = Number.POSITIVE_INFINITY) {
43776
- return applyToChatMarkers(pendingDir, chatId, markSeen, cutoffMs);
43778
+ function markSeenAllTelegramPendingMarkersForChat(pendingDir, chatId, markSeen, cutoffMs = Number.POSITIVE_INFINITY, reachedSession) {
43779
+ return applyToChatMarkers(pendingDir, chatId, markSeen, cutoffMs, reachedSession);
43777
43780
  }
43778
- function applyToChatMarkers(pendingDir, chatId, op, cutoffMs) {
43781
+ function markerDrainable(i) {
43782
+ return i.pushedThisSession || !i.replayEnabled || !i.hasPayload;
43783
+ }
43784
+ function readFailureMeansNoPayload(err) {
43785
+ return err instanceof SyntaxError || err?.code === "ENOENT";
43786
+ }
43787
+ function markerMayDrain(i) {
43788
+ let hasPayload = false;
43789
+ try {
43790
+ if (i.dir) {
43791
+ const read = i.read ?? ((path) => readFileSync11(path, "utf-8"));
43792
+ hasPayload = Boolean(JSON.parse(read(join13(i.dir, i.filename))).payload);
43793
+ }
43794
+ } catch (err) {
43795
+ hasPayload = !readFailureMeansNoPayload(err);
43796
+ }
43797
+ return markerDrainable({ pushedThisSession: i.pushedThisSession, replayEnabled: i.replayEnabled, hasPayload });
43798
+ }
43799
+ function createSessionMarkerTracker() {
43800
+ const pushed = /* @__PURE__ */ new Set();
43801
+ const held = /* @__PURE__ */ new Set();
43802
+ return {
43803
+ /** The marker's push went to this session. Also ends any hold. */
43804
+ notePushed(filename) {
43805
+ pushed.add(filename);
43806
+ held.delete(filename);
43807
+ },
43808
+ /** The marker's file is gone. Its name won't come back, so stop tracking it. */
43809
+ release(filename) {
43810
+ pushed.delete(filename);
43811
+ held.delete(filename);
43812
+ },
43813
+ wasPushed(filename) {
43814
+ return pushed.has(filename);
43815
+ },
43816
+ /** {@link markerMayDrain}, recording a hold when the answer is no. */
43817
+ mayDrain(i) {
43818
+ const may = markerMayDrain({ ...i, pushedThisSession: pushed.has(i.filename) });
43819
+ if (may) held.delete(i.filename);
43820
+ else held.add(i.filename);
43821
+ return may;
43822
+ },
43823
+ isHeld(filename) {
43824
+ return held.has(filename);
43825
+ }
43826
+ };
43827
+ }
43828
+ function replayCountForSession(i) {
43829
+ return i.pushedThisSession ? i.replayCount : 0;
43830
+ }
43831
+ function applyToChatMarkers(pendingDir, chatId, op, cutoffMs, reachedSession) {
43779
43832
  const prefix = `${chatId.replace(/[^A-Za-z0-9_-]/g, "_")}__`;
43780
43833
  const bounded = Number.isFinite(cutoffMs);
43781
43834
  let filenames;
@@ -43788,6 +43841,7 @@ function applyToChatMarkers(pendingDir, chatId, op, cutoffMs) {
43788
43841
  for (const filename of filenames) {
43789
43842
  if (!filename.startsWith(prefix)) continue;
43790
43843
  if (!filename.endsWith(".json")) continue;
43844
+ if (reachedSession && !reachedSession(filename)) continue;
43791
43845
  const fullPath = join13(pendingDir, filename);
43792
43846
  if (bounded && markerArrivalMs(fullPath) > cutoffMs) continue;
43793
43847
  op(fullPath);
@@ -44581,6 +44635,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
44581
44635
  let oldest = null;
44582
44636
  for (const name of names) {
44583
44637
  if (!name.endsWith(".json")) continue;
44638
+ if (opts?.exclude?.(name)) continue;
44584
44639
  let receivedAt;
44585
44640
  try {
44586
44641
  const raw = JSON.parse(readFileSync14(join17(dir, name), "utf-8"));
@@ -44599,8 +44654,8 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
44599
44654
  }
44600
44655
  return oldest;
44601
44656
  }
44602
- function hasInFlightInbound(dir, now = Date.now()) {
44603
- return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true }) != null;
44657
+ function hasInFlightInbound(dir, now = Date.now(), opts) {
44658
+ return oldestPendingMarkerAgeMs(dir, now, { includeSeen: true, exclude: opts?.exclude }) != null;
44604
44659
  }
44605
44660
  function isPendingMarkerStale(receivedAt, nowMs, thresholdMs) {
44606
44661
  if (!receivedAt) return true;
@@ -46339,6 +46394,17 @@ async function notifyDmUsersOnChannelAddRestart() {
46339
46394
  );
46340
46395
  }
46341
46396
  }
46397
+ var sessionMarkers = createSessionMarkerTracker();
46398
+ function noteMarkerAnsweredByRecovery(markerFilename) {
46399
+ if (markerFilename) sessionMarkers.notePushed(markerFilename);
46400
+ }
46401
+ function markerReachedThisSession(markerFilename) {
46402
+ return sessionMarkers.mayDrain({
46403
+ dir: PENDING_INBOUND_DIR,
46404
+ filename: markerFilename,
46405
+ replayEnabled: channelReplayEnabled()
46406
+ });
46407
+ }
46342
46408
  function safeMarkerName(chatId, messageId) {
46343
46409
  const safe = (s) => s.replace(/[^A-Za-z0-9_-]/g, "_");
46344
46410
  return `${safe(chatId)}__${safe(messageId)}.json`;
@@ -46407,6 +46473,7 @@ function clearTelegramMarkerFileWithHeal(fullPath) {
46407
46473
  }
46408
46474
  try {
46409
46475
  if (existsSync9(fullPath)) unlinkSync8(fullPath);
46476
+ sessionMarkers.release(basename(fullPath));
46410
46477
  } catch {
46411
46478
  }
46412
46479
  }
@@ -46421,6 +46488,7 @@ function clearTelegramMarkerFileSilently(fullPath) {
46421
46488
  }
46422
46489
  try {
46423
46490
  if (existsSync9(fullPath)) unlinkSync8(fullPath);
46491
+ sessionMarkers.release(basename(fullPath));
46424
46492
  } catch {
46425
46493
  }
46426
46494
  }
@@ -46561,6 +46629,7 @@ async function processRecoveryOutboxFile(filename) {
46561
46629
  }) + "\n"
46562
46630
  );
46563
46631
  if (decision.action === "suppress") {
46632
+ noteMarkerAnsweredByRecovery(payload.marker_name);
46564
46633
  clearPendingMessage(payload.chat_id, recoveryDrainCutoffMs);
46565
46634
  removeRecoveryLedgerEntry(RECOVERY_LEDGER_DIR, payload.marker_name);
46566
46635
  try {
@@ -46585,6 +46654,7 @@ async function processRecoveryOutboxFile(filename) {
46585
46654
  `telegram-channel(${AGENT_CODE_NAME}): ghost-reply recovery sent (chat=${redactId(payload.chat_id)} msg=${redactId(payload.message_id ?? "")})
46586
46655
  `
46587
46656
  );
46657
+ noteMarkerAnsweredByRecovery(payload.marker_name);
46588
46658
  clearPendingMessage(payload.chat_id, recoveryDrainCutoffMs);
46589
46659
  } else {
46590
46660
  process.stderr.write(
@@ -46842,6 +46912,7 @@ function sweepTelegramStaleMarkers(thresholdMs) {
46842
46912
  );
46843
46913
  try {
46844
46914
  unlinkSync8(fullPath);
46915
+ sessionMarkers.release(filename);
46845
46916
  } catch {
46846
46917
  }
46847
46918
  cleared++;
@@ -46867,6 +46938,7 @@ function sweepTelegramStaleMarkers(thresholdMs) {
46867
46938
  }
46868
46939
  try {
46869
46940
  unlinkSync8(fullPath);
46941
+ sessionMarkers.release(filename);
46870
46942
  } catch {
46871
46943
  }
46872
46944
  cleared++;
@@ -47237,7 +47309,8 @@ function clearPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
47237
47309
  PENDING_INBOUND_DIR,
47238
47310
  chatId,
47239
47311
  clearTelegramMarkerFileWithHeal,
47240
- cutoffMs
47312
+ cutoffMs,
47313
+ markerReachedThisSession
47241
47314
  );
47242
47315
  }
47243
47316
  function consumePendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
@@ -47246,7 +47319,8 @@ function consumePendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
47246
47319
  PENDING_INBOUND_DIR,
47247
47320
  chatId,
47248
47321
  clearTelegramMarkerFileSilently,
47249
- cutoffMs
47322
+ cutoffMs,
47323
+ markerReachedThisSession
47250
47324
  );
47251
47325
  }
47252
47326
  function markSeenPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
@@ -47255,7 +47329,8 @@ function markSeenPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
47255
47329
  PENDING_INBOUND_DIR,
47256
47330
  chatId,
47257
47331
  markTelegramMarkerSeenWithHeal,
47258
- cutoffMs
47332
+ cutoffMs,
47333
+ markerReachedThisSession
47259
47334
  );
47260
47335
  }
47261
47336
  function markPromisedPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
@@ -47266,7 +47341,8 @@ function markPromisedPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY)
47266
47341
  PENDING_INBOUND_DIR,
47267
47342
  chatId,
47268
47343
  markTelegramMarkerPromisedWithHeal,
47269
- cutoffMs
47344
+ cutoffMs,
47345
+ markerReachedThisSession
47270
47346
  );
47271
47347
  if (telegramPromiseStampOutcome.attempted > telegramPromiseStampOutcome.stamped) {
47272
47348
  process.stderr.write(
@@ -48274,6 +48350,18 @@ async function ackCallbackQuery(callbackQueryId, text, opts = {}) {
48274
48350
  );
48275
48351
  }
48276
48352
  }
48353
+ var resolveMcpInitialized = () => {
48354
+ };
48355
+ var mcpInitialized = new Promise((resolve3) => {
48356
+ resolveMcpInitialized = resolve3;
48357
+ });
48358
+ mcp.oninitialized = () => {
48359
+ resolveMcpInitialized();
48360
+ };
48361
+ var MCP_INITIALIZED_WAIT_MS = 3e4;
48362
+ function waitForMcpInitialized() {
48363
+ return Promise.race([mcpInitialized, sleep4(MCP_INITIALIZED_WAIT_MS)]);
48364
+ }
48277
48365
  await mcp.connect(new StdioServerTransport());
48278
48366
  var REPLAY_SCAN_INTERVAL_MS = 6e4;
48279
48367
  async function replayPendingTelegramMarkers() {
@@ -48322,7 +48410,10 @@ async function replayPendingTelegramMarkers() {
48322
48410
  hasPayload: Boolean(marker.payload),
48323
48411
  sessionState,
48324
48412
  markerAgeMs: ageMs,
48325
- replayCount: marker.replay_count ?? 0,
48413
+ replayCount: replayCountForSession({
48414
+ pushedThisSession: sessionMarkers.wasPushed(basename(path)),
48415
+ replayCount: marker.replay_count ?? 0
48416
+ }),
48326
48417
  paneFreshAgeMs,
48327
48418
  // ENG-7736: bound the pane-fresh defer (clamped under the orphan
48328
48419
  // window) so a perpetually-fresh pane can't hold off replay until GC.
@@ -48341,6 +48432,7 @@ async function replayPendingTelegramMarkers() {
48341
48432
  method: "notifications/claude/channel",
48342
48433
  params: replayParams
48343
48434
  });
48435
+ sessionMarkers.notePushed(basename(path));
48344
48436
  seedTelegramProgressHeartbeat();
48345
48437
  if (replayPayload.meta?.["source_role"] !== "agent") {
48346
48438
  peerPresence.noteInbound(marker.chat_id, "human", now);
@@ -48983,11 +49075,15 @@ async function pollLoop() {
48983
49075
  tmux: ackProbe.tmux,
48984
49076
  claude: ackProbe.claude,
48985
49077
  withinStartupGrace: process.uptime() * 1e3 < ACK_STARTUP_GRACE_MS,
48986
- oldestPendingAgeMs: oldestPendingMarkerAgeMs(PENDING_INBOUND_DIR),
49078
+ oldestPendingAgeMs: oldestPendingMarkerAgeMs(PENDING_INBOUND_DIR, Date.now(), {
49079
+ exclude: sessionMarkers.isHeld
49080
+ }),
48987
49081
  paneLogFreshAgeMs
48988
49082
  };
48989
49083
  const ackDecision = decideAckReaction(ackInputs);
48990
- const arrivedWhileBusy = hasInFlightInbound(PENDING_INBOUND_DIR);
49084
+ const arrivedWhileBusy = hasInFlightInbound(PENDING_INBOUND_DIR, Date.now(), {
49085
+ exclude: sessionMarkers.isHeld
49086
+ });
48991
49087
  if (ackDecision === "undeliverable") {
48992
49088
  const cause = classifyUndeliverableCause(ackInputs) ?? "unknown";
48993
49089
  recordChannelDeflection(AGENT_DIR, "telegram", cause);
@@ -49076,6 +49172,7 @@ async function pollLoop() {
49076
49172
  method: "notifications/claude/channel",
49077
49173
  params: channelPayload
49078
49174
  });
49175
+ sessionMarkers.notePushed(safeMarkerName(chatId, messageId));
49079
49176
  if (shouldArmWatch({
49080
49177
  isBot: isFromBot || !!peerAgentMeta,
49081
49178
  // Every Telegram inbound that reaches here owes a reply — there is no
@@ -49222,7 +49319,7 @@ void (async () => {
49222
49319
  })();
49223
49320
  void notifyRestartCompleteOnBoot();
49224
49321
  void notifyDmUsersOnChannelAddRestart();
49225
- pollLoop().catch((err) => {
49322
+ waitForMcpInitialized().then(pollLoop).catch((err) => {
49226
49323
  process.stderr.write(
49227
49324
  `telegram-channel(${AGENT_CODE_NAME}): poll loop died: ${err.message}
49228
49325
  `
@@ -68,12 +68,12 @@ import {
68
68
  writeDirectChatSessionState,
69
69
  writeEgressAllowlist,
70
70
  writePersistentClaudeWrapper
71
- } from "./chunk-L5BWZX3Z.js";
72
- import "./chunk-7T4CZ2NS.js";
71
+ } from "./chunk-NJ2AUTIO.js";
72
+ import "./chunk-DXLSLT5G.js";
73
73
  import "./chunk-OO36JBFI.js";
74
74
  import "./chunk-6HBXEJHO.js";
75
75
  import "./chunk-XWVM4KPK.js";
76
- import "./chunk-GRU6GNLP.js";
76
+ import "./chunk-UUO7QTLC.js";
77
77
  import "./chunk-AIUIMEUS.js";
78
78
  import "./chunk-DGUM43GV.js";
79
79
  export {
@@ -147,4 +147,4 @@ export {
147
147
  writeEgressAllowlist,
148
148
  writePersistentClaudeWrapper
149
149
  };
150
- //# sourceMappingURL=persistent-session-NSA3UYRF.js.map
150
+ //# sourceMappingURL=persistent-session-5MGJGJIB.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-L5BWZX3Z.js";
4
- import "./chunk-7T4CZ2NS.js";
3
+ } from "./chunk-NJ2AUTIO.js";
4
+ import "./chunk-DXLSLT5G.js";
5
5
  import "./chunk-OO36JBFI.js";
6
6
  import "./chunk-6HBXEJHO.js";
7
7
  import "./chunk-XWVM4KPK.js";
8
- import "./chunk-GRU6GNLP.js";
8
+ import "./chunk-UUO7QTLC.js";
9
9
  import "./chunk-AIUIMEUS.js";
10
10
  import "./chunk-DGUM43GV.js";
11
11
 
@@ -804,4 +804,4 @@ export {
804
804
  readAndResetSlackReplyBindingClassifications,
805
805
  readAndResetSlackReplyTargetClassifications
806
806
  };
807
- //# sourceMappingURL=responsiveness-probe-MWH3BKAL.js.map
807
+ //# sourceMappingURL=responsiveness-probe-J4CBYZS3.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sessionTranscriptDir
3
- } from "./chunk-7T4CZ2NS.js";
4
- import "./chunk-GRU6GNLP.js";
3
+ } from "./chunk-DXLSLT5G.js";
4
+ import "./chunk-UUO7QTLC.js";
5
5
  import "./chunk-DGUM43GV.js";
6
6
 
7
7
  // src/lib/session-auth-dead.ts
@@ -205,4 +205,4 @@ export {
205
205
  decideSessionAuthState,
206
206
  probeSessionAuth
207
207
  };
208
- //# sourceMappingURL=session-auth-dead-RYU7ZB56.js.map
208
+ //# sourceMappingURL=session-auth-dead-7CSZHNBK.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.1191",
3
+ "version": "0.28.1193",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {