@integrity-labs/agt-cli 0.28.728 → 0.28.730

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 (24) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-O24LSFRJ.js → chunk-3V7HETFZ.js} +4 -4
  3. package/dist/{chunk-ZCTFF4PA.js → chunk-KF3IFJVV.js} +2 -2
  4. package/dist/{chunk-IXGIGDJG.js → chunk-WVYNQJRS.js} +17 -1
  5. package/dist/chunk-WVYNQJRS.js.map +1 -0
  6. package/dist/{claude-pair-runtime-42GBPDC7.js → claude-pair-runtime-BHULWRDO.js} +2 -2
  7. package/dist/lib/manager-worker.js +117 -44
  8. package/dist/lib/manager-worker.js.map +1 -1
  9. package/dist/mcp/direct-chat-channel.js +16 -0
  10. package/dist/mcp/index.js +16 -0
  11. package/dist/mcp/origami.js +16 -0
  12. package/dist/mcp/slack-channel.js +16 -0
  13. package/dist/mcp/telegram-channel.js +16 -0
  14. package/dist/{persistent-session-LP7JOGZ5.js → persistent-session-KHGH6UKC.js} +3 -3
  15. package/dist/{responsiveness-probe-TTHNHBBS.js → responsiveness-probe-ASAPVDUQ.js} +3 -3
  16. package/dist/{session-auth-dead-YQHE3WKV.js → session-auth-dead-ABEYQHK3.js} +2 -2
  17. package/package.json +1 -1
  18. package/dist/chunk-IXGIGDJG.js.map +0 -1
  19. /package/dist/{chunk-O24LSFRJ.js.map → chunk-3V7HETFZ.js.map} +0 -0
  20. /package/dist/{chunk-ZCTFF4PA.js.map → chunk-KF3IFJVV.js.map} +0 -0
  21. /package/dist/{claude-pair-runtime-42GBPDC7.js.map → claude-pair-runtime-BHULWRDO.js.map} +0 -0
  22. /package/dist/{persistent-session-LP7JOGZ5.js.map → persistent-session-KHGH6UKC.js.map} +0 -0
  23. /package/dist/{responsiveness-probe-TTHNHBBS.js.map → responsiveness-probe-ASAPVDUQ.js.map} +0 -0
  24. /package/dist/{session-auth-dead-YQHE3WKV.js.map → session-auth-dead-ABEYQHK3.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-LP7JOGZ5.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-KHGH6UKC.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-42GBPDC7.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-BHULWRDO.js.map
@@ -57,7 +57,7 @@ import {
57
57
  safeWriteJsonAtomic,
58
58
  setConfigHash,
59
59
  tripClass
60
- } from "../chunk-O24LSFRJ.js";
60
+ } from "../chunk-3V7HETFZ.js";
61
61
  import {
62
62
  getProjectDir as getProjectDir2,
63
63
  getReadyTasks,
@@ -118,7 +118,7 @@ import {
118
118
  takeZombieDetection,
119
119
  toOpencodeModel,
120
120
  writeEgressAllowlist
121
- } from "../chunk-ZCTFF4PA.js";
121
+ } from "../chunk-KF3IFJVV.js";
122
122
  import {
123
123
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
124
124
  AnchorSessionClient,
@@ -203,7 +203,7 @@ import {
203
203
  subagentActivityAgeSeconds,
204
204
  sumTranscriptUsageInWindow,
205
205
  transcriptActivityAgeSeconds
206
- } from "../chunk-IXGIGDJG.js";
206
+ } from "../chunk-WVYNQJRS.js";
207
207
  import {
208
208
  reapOrphanChannelMcps
209
209
  } from "../chunk-XWVM4KPK.js";
@@ -281,6 +281,49 @@ function createSingleFlight(task, opts = {}) {
281
281
  };
282
282
  }
283
283
 
284
+ // src/lib/poll-rate-limiter.ts
285
+ var DEFAULT_POLL_INTERVAL_MS = 1e4;
286
+ var DEFAULT_POLL_BURST = 3;
287
+ function positiveOr(value, fallback) {
288
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
289
+ }
290
+ function createPollRateLimiter(opts) {
291
+ const intervalMs = positiveOr(opts.intervalMs, 1e4);
292
+ const burst = Math.max(1, positiveOr(opts.burst, DEFAULT_POLL_BURST));
293
+ const now = opts.now ?? (() => performance.now());
294
+ let tokens = burst;
295
+ let lastRefillAt = now();
296
+ let consecutiveThrottled = 0;
297
+ let totalThrottled = 0;
298
+ function refill(at) {
299
+ if (at < lastRefillAt) {
300
+ tokens = 0;
301
+ lastRefillAt = at;
302
+ return;
303
+ }
304
+ const elapsed = at - lastRefillAt;
305
+ lastRefillAt = at;
306
+ tokens = Math.min(burst, tokens + elapsed / intervalMs);
307
+ }
308
+ function tryAcquire() {
309
+ const at = now();
310
+ refill(at);
311
+ if (tokens >= 1) {
312
+ tokens -= 1;
313
+ consecutiveThrottled = 0;
314
+ return { allowed: true, verdict: "allowed", consecutiveThrottled: 0, totalThrottled };
315
+ }
316
+ consecutiveThrottled += 1;
317
+ totalThrottled += 1;
318
+ return { allowed: false, verdict: "throttled", consecutiveThrottled, totalThrottled };
319
+ }
320
+ return {
321
+ tryAcquire,
322
+ totalThrottled: () => totalThrottled,
323
+ tokens: () => tokens
324
+ };
325
+ }
326
+
284
327
  // src/lib/claude-code-upgrade-throttle.ts
285
328
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
286
329
  import { dirname as dirname2, join as join2 } from "path";
@@ -5525,6 +5568,22 @@ function createTickBoardFetcher(fetchBoard) {
5525
5568
  };
5526
5569
  }
5527
5570
 
5571
+ // src/lib/refresh-manifest-flags.ts
5572
+ var REFRESH_MANIFEST_FLAGS = {
5573
+ /** Knowledge as slug + hash instead of inline bodies. */
5574
+ knowledge_manifest: true,
5575
+ /** Global + shared ROOT skills as metadata + hash. */
5576
+ skills_manifest: true,
5577
+ /**
5578
+ * Integration CHILD skills as metadata + hash. Deliberately not folded into
5579
+ * `skills_manifest`: a manager that claimed the family but could not decode
5580
+ * this lane would read it as empty, and an empty integration-skill list is
5581
+ * what the orphan sweep treats as "every integration was uninstalled" — it
5582
+ * deletes the folders off disk. The flag has to name the exact capability.
5583
+ */
5584
+ integration_skills_manifest: true
5585
+ };
5586
+
5528
5587
  // src/lib/channel-hash-cache.ts
5529
5588
  import { existsSync as existsSync8, readFileSync as readFileSync19, writeFileSync as writeFileSync10 } from "fs";
5530
5589
  import { join as join25 } from "path";
@@ -12288,7 +12347,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
12288
12347
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
12289
12348
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
12290
12349
  async function channelInboundActivityAgeSecondsFor(codeName) {
12291
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-TTHNHBBS.js");
12350
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-ASAPVDUQ.js");
12292
12351
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
12293
12352
  if (newest === null) return null;
12294
12353
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -12936,7 +12995,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
12936
12995
  var lastVersionCheckAt = 0;
12937
12996
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12938
12997
  var lastResponsivenessProbeAt = 0;
12939
- var agtCliVersion = true ? "0.28.728" : "dev";
12998
+ var agtCliVersion = true ? "0.28.730" : "dev";
12940
12999
  function resolveBrewPath(execFileSync3) {
12941
13000
  try {
12942
13001
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14463,7 +14522,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
14463
14522
  if (codeNames.length === 0) return;
14464
14523
  void (async () => {
14465
14524
  try {
14466
- const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
14525
+ const { collectDiagnostics } = await import("../persistent-session-KHGH6UKC.js");
14467
14526
  await api.post("/host/heartbeat", {
14468
14527
  host_id: hostId,
14469
14528
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -14478,7 +14537,30 @@ var pollCycleGuard = createSingleFlight(() => pollCycleInner(), {
14478
14537
  log(`[poll-cycle] coalesced an early-poll trigger into the in-flight cycle (total=${total})`);
14479
14538
  }
14480
14539
  });
14540
+ var pollRateLimiter = null;
14541
+ var pollRateLimiterIntervalMs = 0;
14542
+ function getPollRateLimiter() {
14543
+ const intervalMs = config?.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
14544
+ if (!pollRateLimiter || pollRateLimiterIntervalMs !== intervalMs) {
14545
+ pollRateLimiter = createPollRateLimiter({ intervalMs });
14546
+ pollRateLimiterIntervalMs = intervalMs;
14547
+ }
14548
+ return pollRateLimiter;
14549
+ }
14550
+ var lastPollThrottleLogAt = 0;
14551
+ var POLL_THROTTLE_LOG_INTERVAL_MS = 6e4;
14481
14552
  function pollCycle() {
14553
+ const decision = getPollRateLimiter().tryAcquire();
14554
+ if (!decision.allowed) {
14555
+ const at = performance.now();
14556
+ if (decision.consecutiveThrottled === 1 || at - lastPollThrottleLogAt >= POLL_THROTTLE_LOG_INTERVAL_MS) {
14557
+ lastPollThrottleLogAt = at;
14558
+ log(
14559
+ `[poll-rate] throttled a poll pass (consecutive=${decision.consecutiveThrottled}, total=${decision.totalThrottled}, ceiling=1 per ${pollRateLimiterIntervalMs}ms) \u2014 more callers are asking to poll than the configured cadence allows`
14560
+ );
14561
+ }
14562
+ return Promise.resolve({ coalesced: false });
14563
+ }
14482
14564
  return pollCycleGuard.run();
14483
14565
  }
14484
14566
  async function pollCycleInner() {
@@ -14581,7 +14663,7 @@ async function pollCycleInner() {
14581
14663
  }
14582
14664
  try {
14583
14665
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
14584
- const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
14666
+ const { collectDiagnostics } = await import("../persistent-session-KHGH6UKC.js");
14585
14667
  const diagCodeNames = [...agentState.persistentSessionAgents];
14586
14668
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
14587
14669
  let tailscaleHostname;
@@ -14750,7 +14832,7 @@ async function pollCycleInner() {
14750
14832
  collectPanelessActivityProbes,
14751
14833
  getResponsivenessIntervalMs,
14752
14834
  occupancyQualificationClassifications
14753
- } = await import("../responsiveness-probe-TTHNHBBS.js");
14835
+ } = await import("../responsiveness-probe-ASAPVDUQ.js");
14754
14836
  const probeIntervalMs = getResponsivenessIntervalMs();
14755
14837
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
14756
14838
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -14860,7 +14942,7 @@ async function pollCycleInner() {
14860
14942
  collectResponsivenessProbes,
14861
14943
  livePendingInboundOldestAgeSeconds,
14862
14944
  parkPendingInbound
14863
- } = await import("../responsiveness-probe-TTHNHBBS.js");
14945
+ } = await import("../responsiveness-probe-ASAPVDUQ.js");
14864
14946
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
14865
14947
  const wedgeNow = /* @__PURE__ */ new Date();
14866
14948
  const liveAgents = agentState.persistentSessionAgents;
@@ -15016,7 +15098,7 @@ async function pollCycleInner() {
15016
15098
  }
15017
15099
  try {
15018
15100
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
15019
- const { probeSessionAuth } = await import("../session-auth-dead-YQHE3WKV.js");
15101
+ const { probeSessionAuth } = await import("../session-auth-dead-ABEYQHK3.js");
15020
15102
  const observations = [];
15021
15103
  const pendingCacheCommits = [];
15022
15104
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -15774,20 +15856,12 @@ async function processAgent(agent, agentStates, managedToolkits) {
15774
15856
  try {
15775
15857
  refreshData = await api.post("/host/refresh", {
15776
15858
  agent_id: agent.agent_id,
15777
- // ENG-9585: ask for hashes instead of knowledge bodies. An API build that
15778
- // predates the manifest ignores this and answers with `knowledge` as
15779
- // before, which the resolution below handles without a version check.
15780
- knowledge_manifest: true,
15781
- // ENG-9585: the same for the two root-skill lanes. A separate flag
15782
- // because the two shipped in different CLI versions — an API that
15783
- // understands one and not the other must still be able to answer.
15784
- skills_manifest: true,
15785
- // ENG-9585: and the integration lane, a third flag for the same reason
15786
- // one level sharper. A manager that sent `skills_manifest` but could not
15787
- // decode THIS manifest would read the lane as empty and sweep every
15788
- // integration skill folder off disk, so the flag has to name the exact
15789
- // capability rather than the family.
15790
- integration_skills_manifest: true
15859
+ // ENG-9585: ask for hashes instead of bodies on all three lanes. The
15860
+ // rationale for each flag, and for their staying three flags rather than
15861
+ // one, now lives with the constant — so that a new `/host/refresh` caller
15862
+ // inherits it instead of having to rediscover it. The manifest is
15863
+ // normalised back into `refreshData.knowledge` immediately below.
15864
+ ...REFRESH_MANIFEST_FLAGS
15791
15865
  });
15792
15866
  if (refreshData.knowledge_manifest) {
15793
15867
  const resolved = await resolveKnowledgeFromManifest({
@@ -17113,12 +17187,10 @@ async function processAgent(agent, agentStates, managedToolkits) {
17113
17187
  }
17114
17188
  const freshData = await api.post("/host/refresh", {
17115
17189
  agent_id: agent.agent_id,
17116
- knowledge_manifest: true,
17117
17190
  // Only `scheduled_tasks` is read here, so ask for the manifest shape on
17118
17191
  // every lane — nothing in this branch consumes a skill body, and the
17119
17192
  // skill lanes are the largest part of the payload being discarded.
17120
- skills_manifest: true,
17121
- integration_skills_manifest: true
17193
+ ...REFRESH_MANIFEST_FLAGS
17122
17194
  });
17123
17195
  tasks = freshData.scheduled_tasks ?? tasks;
17124
17196
  }
@@ -18879,6 +18951,17 @@ function restartReasonNeedsRender(reason) {
18879
18951
  function restartReasonStampsTiming(reason) {
18880
18952
  return reason === "integration-change";
18881
18953
  }
18954
+ async function fetchSpawnRefreshData(agentId, codeName, lane) {
18955
+ try {
18956
+ return await api.post("/host/refresh", {
18957
+ agent_id: agentId,
18958
+ ...REFRESH_MANIFEST_FLAGS
18959
+ });
18960
+ } catch (err) {
18961
+ log(`[${lane}] refresh failed for '${codeName}', leaving for slow poll: ${err.message}`);
18962
+ return null;
18963
+ }
18964
+ }
18882
18965
  async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18883
18966
  const prev = state8.agents.find((a) => a.agentId === agentId);
18884
18967
  const codeName = prev?.codeName;
@@ -18898,13 +18981,8 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18898
18981
  try {
18899
18982
  log(`[restart-lane] Fast restart for '${codeName}' at ${requestedAt}`);
18900
18983
  const hostId = await getHostId();
18901
- let refreshData;
18902
- try {
18903
- refreshData = await api.post("/host/refresh", { agent_id: agentId });
18904
- } catch (err) {
18905
- log(`[restart-lane] refresh failed for '${codeName}', leaving for slow poll: ${err.message}`);
18906
- return;
18907
- }
18984
+ const refreshData = await fetchSpawnRefreshData(agentId, codeName, "restart-lane");
18985
+ if (!refreshData) return;
18908
18986
  const displayName = refreshData.agent?.display_name ?? codeName;
18909
18987
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
18910
18988
  if (restartTargetsOpencodeServe(framework)) {
@@ -18931,7 +19009,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
18931
19009
  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}`));
18932
19010
  void (async () => {
18933
19011
  try {
18934
- const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
19012
+ const { collectDiagnostics } = await import("../persistent-session-KHGH6UKC.js");
18935
19013
  await api.post("/host/heartbeat", {
18936
19014
  host_id: hostId,
18937
19015
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -18959,13 +19037,8 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
18959
19037
  restartInFlight.add(agentId);
18960
19038
  try {
18961
19039
  if (isSessionHealthy(codeName)) return;
18962
- let refreshData;
18963
- try {
18964
- refreshData = await api.post("/host/refresh", { agent_id: agentId });
18965
- } catch (err) {
18966
- log(`[fast-mcp-respawn] refresh failed for '${codeName}', leaving for slow poll: ${err.message}`);
18967
- return;
18968
- }
19040
+ const refreshData = await fetchSpawnRefreshData(agentId, codeName, "fast-mcp-respawn");
19041
+ if (!refreshData) return;
18969
19042
  const displayName = refreshData.agent?.display_name ?? codeName;
18970
19043
  const result = await ensurePersistentSession(
18971
19044
  { agent_id: agentId, code_name: codeName, display_name: displayName },
@@ -18982,7 +19055,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
18982
19055
  }
18983
19056
  try {
18984
19057
  const hostId = await getHostId();
18985
- const { collectDiagnostics } = await import("../persistent-session-LP7JOGZ5.js");
19058
+ const { collectDiagnostics } = await import("../persistent-session-KHGH6UKC.js");
18986
19059
  await api.post("/host/heartbeat", {
18987
19060
  host_id: hostId,
18988
19061
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -19614,7 +19687,7 @@ async function processClaudePairSessions(agents) {
19614
19687
  killPairSession,
19615
19688
  pairTmuxSession,
19616
19689
  finalizeClaudePairOnboarding
19617
- } = await import("../claude-pair-runtime-42GBPDC7.js");
19690
+ } = await import("../claude-pair-runtime-BHULWRDO.js");
19618
19691
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
19619
19692
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
19620
19693
  const killed = await killPairSession(pairTmuxSession(pairId));