@integrity-labs/agt-cli 0.27.61 → 0.27.63

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.
@@ -9,7 +9,7 @@ import {
9
9
  parseDeliveryTarget,
10
10
  registerFramework,
11
11
  wrapScheduledTaskPrompt
12
- } from "./chunk-2SCU5NZO.js";
12
+ } from "./chunk-HNN7QEIO.js";
13
13
 
14
14
  // ../../packages/core/dist/integrations/registry.js
15
15
  var INTEGRATION_REGISTRY = [
@@ -7163,4 +7163,4 @@ export {
7163
7163
  managerInstallSystemUnitCommand,
7164
7164
  managerUninstallSystemUnitCommand
7165
7165
  };
7166
- //# sourceMappingURL=chunk-I4RL6YLR.js.map
7166
+ //# sourceMappingURL=chunk-MRJBRLKK.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  claudeModelAlias,
3
3
  isClaudeFastMode
4
- } from "./chunk-2SCU5NZO.js";
4
+ } from "./chunk-HNN7QEIO.js";
5
5
  import {
6
6
  reapOrphanChannelMcps
7
7
  } from "./chunk-XWVM4KPK.js";
@@ -1125,4 +1125,4 @@ export {
1125
1125
  stopAllSessionsAndWait,
1126
1126
  getProjectDir
1127
1127
  };
1128
- //# sourceMappingURL=chunk-6YBJCRTJ.js.map
1128
+ //# sourceMappingURL=chunk-TFSMU64N.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-GQEXSB2H.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-JYRPS6CA.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-PEYWY24A.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-NYALA3JX.js.map
@@ -15,7 +15,7 @@ import {
15
15
  provisionOrientHook,
16
16
  provisionStopHook,
17
17
  requireHost
18
- } from "../chunk-I4RL6YLR.js";
18
+ } from "../chunk-MRJBRLKK.js";
19
19
  import {
20
20
  getProjectDir as getProjectDir2,
21
21
  getReadyTasks,
@@ -47,7 +47,7 @@ import {
47
47
  stopAllSessionsAndWait,
48
48
  stopPersistentSession,
49
49
  takeZombieDetection
50
- } from "../chunk-6YBJCRTJ.js";
50
+ } from "../chunk-TFSMU64N.js";
51
51
  import {
52
52
  KANBAN_CHECK_COMMAND,
53
53
  appendDmFooter,
@@ -70,7 +70,7 @@ import {
70
70
  resolveConnectivityProbe,
71
71
  resolveDmTarget,
72
72
  wrapScheduledTaskPrompt
73
- } from "../chunk-2SCU5NZO.js";
73
+ } from "../chunk-HNN7QEIO.js";
74
74
  import {
75
75
  parsePsRows,
76
76
  reapOrphanChannelMcps
@@ -3744,7 +3744,7 @@ var cachedMaintenanceWindow = null;
3744
3744
  var lastVersionCheckAt = 0;
3745
3745
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
3746
3746
  var lastResponsivenessProbeAt = 0;
3747
- var agtCliVersion = true ? "0.27.61" : "dev";
3747
+ var agtCliVersion = true ? "0.27.63" : "dev";
3748
3748
  function resolveBrewPath(execFileSync4) {
3749
3749
  try {
3750
3750
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -4858,7 +4858,7 @@ async function pollCycle() {
4858
4858
  }
4859
4859
  try {
4860
4860
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
4861
- const { collectDiagnostics } = await import("../persistent-session-GQEXSB2H.js");
4861
+ const { collectDiagnostics } = await import("../persistent-session-JYRPS6CA.js");
4862
4862
  const diagCodeNames = [...agentState.persistentSessionAgents];
4863
4863
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
4864
4864
  let tailscaleHostname;
@@ -4931,7 +4931,7 @@ async function pollCycle() {
4931
4931
  const {
4932
4932
  collectResponsivenessProbes,
4933
4933
  getResponsivenessIntervalMs
4934
- } = await import("../responsiveness-probe-53GUGQSY.js");
4934
+ } = await import("../responsiveness-probe-JOKNYH3B.js");
4935
4935
  const probeIntervalMs = getResponsivenessIntervalMs();
4936
4936
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
4937
4937
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -9076,7 +9076,7 @@ async function processClaudePairSessions(agents) {
9076
9076
  killPairSession,
9077
9077
  pairTmuxSession,
9078
9078
  finalizeClaudePairOnboarding
9079
- } = await import("../claude-pair-runtime-PEYWY24A.js");
9079
+ } = await import("../claude-pair-runtime-NYALA3JX.js");
9080
9080
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
9081
9081
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
9082
9082
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -15568,6 +15568,18 @@ var ORPHAN_SWEEP_INTERVAL_MS = 30 * 60 * 1e3;
15568
15568
  function orphanSweepIntervalMs() {
15569
15569
  return Math.max(6e4, Math.min(ORPHAN_SWEEP_INTERVAL_MS, channelOrphanMarkerMs()));
15570
15570
  }
15571
+ var MAX_MARKER_REPLAYS = 3;
15572
+ function channelReplayEnabled() {
15573
+ const v = process.env.AGT_CHANNEL_REPLAY_ENABLED;
15574
+ return v === "1" || v === "true";
15575
+ }
15576
+ function shouldReplayMarker(i) {
15577
+ if (!i.enabled) return false;
15578
+ if (!i.hasPayload) return false;
15579
+ if (!i.sessionAlive) return false;
15580
+ if (i.markerAgeMs < (i.minAgeMs ?? REPLY_WEDGED_THRESHOLD_MS)) return false;
15581
+ return i.replayCount < (i.maxReplays ?? MAX_MARKER_REPLAYS);
15582
+ }
15571
15583
 
15572
15584
  // src/session-probe-runtime.ts
15573
15585
  import { execFileSync } from "child_process";
@@ -16030,7 +16042,7 @@ function pendingInboundPath(chatId, messageId) {
16030
16042
  if (!PENDING_INBOUND_DIR) return null;
16031
16043
  return join4(PENDING_INBOUND_DIR, safeMarkerName(chatId, messageId));
16032
16044
  }
16033
- function writePendingInboundMarker(chatId, messageId, chatType, undeliverable = false) {
16045
+ function writePendingInboundMarker(chatId, messageId, chatType, undeliverable = false, payload) {
16034
16046
  const path = pendingInboundPath(chatId, messageId);
16035
16047
  if (!path || !PENDING_INBOUND_DIR) return;
16036
16048
  const marker = {
@@ -16039,7 +16051,10 @@ function writePendingInboundMarker(chatId, messageId, chatType, undeliverable =
16039
16051
  chat_type: chatType,
16040
16052
  received_at: (/* @__PURE__ */ new Date()).toISOString(),
16041
16053
  // Only persist the flag when set — keeps healthy-path markers byte-identical.
16042
- ...undeliverable ? { undeliverable: true } : {}
16054
+ ...undeliverable ? { undeliverable: true } : {},
16055
+ // ENG-5969: carry the replay payload only when provided (the durable-replay
16056
+ // path). Absent ⇒ the marker can't be replayed (older / ack-only callers).
16057
+ ...payload ? { payload } : {}
16043
16058
  };
16044
16059
  try {
16045
16060
  mkdirSync3(PENDING_INBOUND_DIR, { recursive: true, mode: 448 });
@@ -16240,8 +16255,8 @@ function startRecoveryOutboxWatcher() {
16240
16255
  }
16241
16256
  startRecoveryOutboxWatcher();
16242
16257
  var STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
16243
- function trackPendingMessage(chatId, messageId, chatType, undeliverable = false) {
16244
- writePendingInboundMarker(chatId, messageId, chatType, undeliverable);
16258
+ function trackPendingMessage(chatId, messageId, chatType, undeliverable = false, payload) {
16259
+ writePendingInboundMarker(chatId, messageId, chatType, undeliverable, payload);
16245
16260
  }
16246
16261
  function sweepTelegramStaleMarkers(thresholdMs) {
16247
16262
  if (!PENDING_INBOUND_DIR) return;
@@ -16885,6 +16900,73 @@ async function ackCallbackQuery(callbackQueryId, text) {
16885
16900
  }
16886
16901
  }
16887
16902
  await mcp.connect(new StdioServerTransport());
16903
+ var REPLAY_SCAN_INTERVAL_MS = 6e4;
16904
+ async function replayPendingTelegramMarkers() {
16905
+ if (!channelReplayEnabled()) return;
16906
+ if (!PENDING_INBOUND_DIR || !existsSync2(PENDING_INBOUND_DIR)) return;
16907
+ const probe = process.env.TMUX && AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? probeAgentSessionCached(AGENT_CODE_NAME) : { tmux: "unknown", claude: "unknown" };
16908
+ const sessionAlive = probe.tmux === "alive" && probe.claude === "alive";
16909
+ if (!sessionAlive) return;
16910
+ let filenames;
16911
+ try {
16912
+ filenames = readdirSync2(PENDING_INBOUND_DIR);
16913
+ } catch {
16914
+ return;
16915
+ }
16916
+ const now = Date.now();
16917
+ const entries = [];
16918
+ for (const name of filenames) {
16919
+ if (!name.endsWith(".json") || name.endsWith(".tmp")) continue;
16920
+ const fullPath = join4(PENDING_INBOUND_DIR, name);
16921
+ let marker;
16922
+ try {
16923
+ marker = JSON.parse(readFileSync3(fullPath, "utf-8"));
16924
+ } catch {
16925
+ continue;
16926
+ }
16927
+ const t = Date.parse(marker.received_at ?? "");
16928
+ const ageMs = Number.isFinite(t) ? now - t : 0;
16929
+ entries.push({ path: fullPath, marker, ageMs });
16930
+ }
16931
+ entries.sort((a, b) => b.ageMs - a.ageMs);
16932
+ for (const { path, marker, ageMs } of entries) {
16933
+ if (!shouldReplayMarker({
16934
+ enabled: true,
16935
+ hasPayload: Boolean(marker.payload),
16936
+ sessionAlive,
16937
+ markerAgeMs: ageMs,
16938
+ replayCount: marker.replay_count ?? 0
16939
+ })) {
16940
+ continue;
16941
+ }
16942
+ try {
16943
+ await mcp.notification({
16944
+ method: "notifications/claude/channel",
16945
+ params: marker.payload
16946
+ });
16947
+ } catch (err) {
16948
+ process.stderr.write(
16949
+ `telegram-channel(${AGENT_CODE_NAME}): replay push failed: ${err.message}
16950
+ `
16951
+ );
16952
+ continue;
16953
+ }
16954
+ try {
16955
+ if (existsSync2(path)) {
16956
+ const updated = {
16957
+ ...marker,
16958
+ replay_count: (marker.replay_count ?? 0) + 1
16959
+ };
16960
+ writeFileSync3(path, JSON.stringify(updated), { mode: 384 });
16961
+ }
16962
+ } catch {
16963
+ }
16964
+ }
16965
+ }
16966
+ var replayTimer = setInterval(() => {
16967
+ void replayPendingTelegramMarkers();
16968
+ }, REPLAY_SCAN_INTERVAL_MS);
16969
+ replayTimer.unref?.();
16888
16970
  var LONG_POLL_SECONDS = 50;
16889
16971
  var POLL_HTTP_TIMEOUT_MS = (LONG_POLL_SECONDS + 10) * 1e3;
16890
16972
  var TELEGRAM_DOWNLOAD_TIMEOUT_MS = 15e3;
@@ -17181,7 +17263,6 @@ async function pollLoop() {
17181
17263
  } else if (ackDecision === "undeliverable") {
17182
17264
  void notifyUndeliverable(chatId, messageId);
17183
17265
  }
17184
- trackPendingMessage(chatId, messageId, msg.chat.type, ackDecision === "undeliverable");
17185
17266
  const fileMeta = [];
17186
17267
  for (const attachment of classifiedAttachments) {
17187
17268
  if (attachment.kind === "image") {
@@ -17209,30 +17290,38 @@ async function pollLoop() {
17209
17290
  }
17210
17291
  const downloadedImages = fileMeta.filter((f) => f.kind === "image" && typeof f.path === "string");
17211
17292
  const imagePath = downloadedImages.length === 1 ? downloadedImages[0].path : void 0;
17293
+ const channelPayload = {
17294
+ content,
17295
+ meta: {
17296
+ source: "telegram",
17297
+ chat_id: chatId,
17298
+ chat_type: msg.chat.type,
17299
+ message_id: messageId,
17300
+ user: userId,
17301
+ user_name: userName,
17302
+ ts: String(msg.date),
17303
+ ...fileMeta.length > 0 ? { files: JSON.stringify(fileMeta) } : {},
17304
+ ...imagePath ? { image_path: imagePath } : {},
17305
+ // ENG-4902: peer-agent ingress carries distinct framing so the
17306
+ // runtime (MVP #5) can apply the peer-agent system preamble
17307
+ // and store the turn under a peer_agent memory role.
17308
+ ...peerAgentMeta ? {
17309
+ source_role: "agent",
17310
+ peer_code_name: peerAgentMeta.code_name,
17311
+ peer_agent_id: peerAgentMeta.agent_id
17312
+ } : {}
17313
+ }
17314
+ };
17315
+ trackPendingMessage(
17316
+ chatId,
17317
+ messageId,
17318
+ msg.chat.type,
17319
+ ackDecision === "undeliverable",
17320
+ channelPayload
17321
+ );
17212
17322
  await mcp.notification({
17213
17323
  method: "notifications/claude/channel",
17214
- params: {
17215
- content,
17216
- meta: {
17217
- source: "telegram",
17218
- chat_id: chatId,
17219
- chat_type: msg.chat.type,
17220
- message_id: messageId,
17221
- user: userId,
17222
- user_name: userName,
17223
- ts: String(msg.date),
17224
- ...fileMeta.length > 0 ? { files: JSON.stringify(fileMeta) } : {},
17225
- ...imagePath ? { image_path: imagePath } : {},
17226
- // ENG-4902: peer-agent ingress carries distinct framing so the
17227
- // runtime (MVP #5) can apply the peer-agent system preamble
17228
- // and store the turn under a peer_agent memory role.
17229
- ...peerAgentMeta ? {
17230
- source_role: "agent",
17231
- peer_code_name: peerAgentMeta.code_name,
17232
- peer_agent_id: peerAgentMeta.agent_id
17233
- } : {}
17234
- }
17235
- }
17324
+ params: channelPayload
17236
17325
  });
17237
17326
  conversationIngestClient?.ingest({
17238
17327
  channel: "telegram",
@@ -21,8 +21,8 @@ import {
21
21
  stopPersistentSession,
22
22
  takeZombieDetection,
23
23
  writePersistentClaudeWrapper
24
- } from "./chunk-6YBJCRTJ.js";
25
- import "./chunk-2SCU5NZO.js";
24
+ } from "./chunk-TFSMU64N.js";
25
+ import "./chunk-HNN7QEIO.js";
26
26
  import "./chunk-XWVM4KPK.js";
27
27
  export {
28
28
  SEND_KEYS_ENTER_DELAY_MS,
@@ -48,4 +48,4 @@ export {
48
48
  takeZombieDetection,
49
49
  writePersistentClaudeWrapper
50
50
  };
51
- //# sourceMappingURL=persistent-session-GQEXSB2H.js.map
51
+ //# sourceMappingURL=persistent-session-JYRPS6CA.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-6YBJCRTJ.js";
4
- import "./chunk-2SCU5NZO.js";
3
+ } from "./chunk-TFSMU64N.js";
4
+ import "./chunk-HNN7QEIO.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -30,4 +30,4 @@ export {
30
30
  collectResponsivenessProbes,
31
31
  getResponsivenessIntervalMs
32
32
  };
33
- //# sourceMappingURL=responsiveness-probe-53GUGQSY.js.map
33
+ //# sourceMappingURL=responsiveness-probe-JOKNYH3B.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.27.61",
3
+ "version": "0.27.63",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {