@integrity-labs/agt-cli 0.28.1118 → 0.28.1120

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-XIMMVBIH.js → chunk-J7GZNCX2.js} +40 -1
  3. package/dist/chunk-J7GZNCX2.js.map +1 -0
  4. package/dist/{chunk-PT2HBINO.js → chunk-MTBIR6TN.js} +2 -2
  5. package/dist/{chunk-X4VF6E5N.js → chunk-VWXOXCGU.js} +4 -4
  6. package/dist/{claude-pair-runtime-R2BGQCXS.js → claude-pair-runtime-DKS7V6MT.js} +2 -2
  7. package/dist/lib/manager-worker.js +78 -30
  8. package/dist/lib/manager-worker.js.map +1 -1
  9. package/dist/mcp/direct-chat-channel.js +39 -0
  10. package/dist/mcp/index.js +39 -0
  11. package/dist/mcp/origami.js +39 -0
  12. package/dist/mcp/slack-channel.js +39 -0
  13. package/dist/mcp/telegram-channel.js +39 -0
  14. package/dist/{persistent-session-HSBVLK46.js → persistent-session-JSLQLE6F.js} +3 -3
  15. package/dist/{responsiveness-probe-KGN6IQLH.js → responsiveness-probe-2C7X7RIM.js} +3 -3
  16. package/dist/{session-auth-dead-P44BJ3W6.js → session-auth-dead-QYQXJNZP.js} +2 -2
  17. package/package.json +1 -1
  18. package/dist/chunk-XIMMVBIH.js.map +0 -1
  19. /package/dist/{chunk-PT2HBINO.js.map → chunk-MTBIR6TN.js.map} +0 -0
  20. /package/dist/{chunk-X4VF6E5N.js.map → chunk-VWXOXCGU.js.map} +0 -0
  21. /package/dist/{claude-pair-runtime-R2BGQCXS.js.map → claude-pair-runtime-DKS7V6MT.js.map} +0 -0
  22. /package/dist/{persistent-session-HSBVLK46.js.map → persistent-session-JSLQLE6F.js.map} +0 -0
  23. /package/dist/{responsiveness-probe-KGN6IQLH.js.map → responsiveness-probe-2C7X7RIM.js.map} +0 -0
  24. /package/dist/{session-auth-dead-P44BJ3W6.js.map → session-auth-dead-QYQXJNZP.js.map} +0 -0
@@ -24,7 +24,7 @@ import {
24
24
  rotateDailySession,
25
25
  sessionFileExists,
26
26
  todayLocalIso
27
- } from "./chunk-XIMMVBIH.js";
27
+ } from "./chunk-J7GZNCX2.js";
28
28
  import {
29
29
  classifyUnanswerablePane,
30
30
  findUsageLimitResetHint,
@@ -6113,4 +6113,4 @@ export {
6113
6113
  stopAllSessionsAndWait,
6114
6114
  getProjectDir
6115
6115
  };
6116
- //# sourceMappingURL=chunk-PT2HBINO.js.map
6116
+ //# sourceMappingURL=chunk-MTBIR6TN.js.map
@@ -16,7 +16,7 @@ import {
16
16
  parseEnvFileEntries,
17
17
  parseEnvIntegrations,
18
18
  shellQuote
19
- } from "./chunk-PT2HBINO.js";
19
+ } from "./chunk-MTBIR6TN.js";
20
20
  import {
21
21
  BIND_FAILURE_QUARANTINE_THRESHOLD,
22
22
  INTEGRATIONS_SECTION_END,
@@ -79,7 +79,7 @@ import {
79
79
  sessionTranscriptDir,
80
80
  worseConnectivityOutcome,
81
81
  wrapScheduledTaskPrompt
82
- } from "./chunk-XIMMVBIH.js";
82
+ } from "./chunk-J7GZNCX2.js";
83
83
  import {
84
84
  classifyUnanswerablePane,
85
85
  isConsumerTermsDialogVisible,
@@ -7518,7 +7518,7 @@ function exchangeFailureKind(err) {
7518
7518
  }
7519
7519
 
7520
7520
  // src/lib/api-client.ts
7521
- var agtCliVersion = true ? "0.28.1118" : "dev";
7521
+ var agtCliVersion = true ? "0.28.1120" : "dev";
7522
7522
  var lastConfigHash = null;
7523
7523
  function setConfigHash(hash) {
7524
7524
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -12664,4 +12664,4 @@ export {
12664
12664
  managerInstallSystemUnitCommand,
12665
12665
  managerUninstallSystemUnitCommand
12666
12666
  };
12667
- //# sourceMappingURL=chunk-X4VF6E5N.js.map
12667
+ //# sourceMappingURL=chunk-VWXOXCGU.js.map
@@ -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-HSBVLK46.js");
269
+ const { resolveClaudeBinary } = await import("./persistent-session-JSLQLE6F.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-R2BGQCXS.js.map
737
+ //# sourceMappingURL=claude-pair-runtime-DKS7V6MT.js.map
@@ -68,7 +68,7 @@ import {
68
68
  safeWriteJsonAtomic,
69
69
  setConfigHash,
70
70
  tripClass
71
- } from "../chunk-X4VF6E5N.js";
71
+ } from "../chunk-VWXOXCGU.js";
72
72
  import {
73
73
  getProjectDir as getProjectDir2,
74
74
  getReadyTasks,
@@ -155,7 +155,7 @@ import {
155
155
  webFetchBaselineValue,
156
156
  webFetchRestartNeeded,
157
157
  writeEgressAllowlist
158
- } from "../chunk-PT2HBINO.js";
158
+ } from "../chunk-MTBIR6TN.js";
159
159
  import {
160
160
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
161
161
  AnchorSessionClient,
@@ -265,7 +265,7 @@ import {
265
265
  subagentActivityAgeSeconds,
266
266
  sumTranscriptUsageInWindow,
267
267
  transcriptActivityAgeSeconds
268
- } from "../chunk-XIMMVBIH.js";
268
+ } from "../chunk-J7GZNCX2.js";
269
269
  import {
270
270
  classifyUnanswerablePane,
271
271
  paneRemedy
@@ -394,6 +394,46 @@ function isTelegramPolicyRestrictive(env) {
394
394
  return telegramPolicyEnvBasis(env).length > 0;
395
395
  }
396
396
 
397
+ // src/lib/toolkit-cli-slugs.ts
398
+ function collectToolkitCliSlugs(bundleToolkits, heldDefinitionIds, hasCliTool) {
399
+ const out = /* @__PURE__ */ new Set();
400
+ for (const { toolkits } of bundleToolkits) {
401
+ for (const t of toolkits) {
402
+ if (typeof t === "string" && t.length > 0) out.add(t);
403
+ }
404
+ }
405
+ for (const id of heldDefinitionIds) {
406
+ if (typeof id === "string" && id.length > 0 && hasCliTool(id)) out.add(id);
407
+ }
408
+ return [...out];
409
+ }
410
+ async function installToolkitClis(opts) {
411
+ if (opts.framework !== "claude-code") return { awaited: [], background: [] };
412
+ const heldIds = opts.heldIntegrations.map((i) => {
413
+ const id = i?.definition_id;
414
+ return typeof id === "string" ? id : "";
415
+ });
416
+ const awaited = collectToolkitCliSlugs(opts.bundleToolkits, [], () => false);
417
+ const bundleSet = new Set(awaited);
418
+ const background = collectToolkitCliSlugs([], heldIds, opts.hasCliTool).filter((s) => !bundleSet.has(s));
419
+ for (const slug of awaited) {
420
+ await opts.ensure(slug);
421
+ }
422
+ for (const slug of background) {
423
+ void Promise.resolve().then(() => opts.ensure(slug)).catch((err) => opts.onBackgroundError?.(slug, err));
424
+ }
425
+ return { awaited, background };
426
+ }
427
+ function singleFlight(inFlight, key, fn) {
428
+ const existing = inFlight.get(key);
429
+ if (existing) return existing;
430
+ const run = Promise.resolve().then(fn).finally(() => {
431
+ if (inFlight.get(key) === run) inFlight.delete(key);
432
+ });
433
+ inFlight.set(key, run);
434
+ return run;
435
+ }
436
+
397
437
  // src/lib/single-flight.ts
398
438
  function createSingleFlight(task, opts = {}) {
399
439
  let running2 = false;
@@ -14143,7 +14183,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
14143
14183
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
14144
14184
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
14145
14185
  async function channelInboundActivityAgeSecondsFor(codeName) {
14146
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-KGN6IQLH.js");
14186
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-2C7X7RIM.js");
14147
14187
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
14148
14188
  if (newest === null) return null;
14149
14189
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -14901,7 +14941,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
14901
14941
  var lastVersionCheckAt = 0;
14902
14942
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
14903
14943
  var lastResponsivenessProbeAt = 0;
14904
- var agtCliVersion = true ? "0.28.1118" : "dev";
14944
+ var agtCliVersion = true ? "0.28.1120" : "dev";
14905
14945
  function resolveBrewPath(execFileSync3) {
14906
14946
  try {
14907
14947
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14935,6 +14975,7 @@ function claudeBinaryInstalled(execFileSync3) {
14935
14975
  var toolkitCliEnsured = /* @__PURE__ */ new Set();
14936
14976
  var toolkitCliRetryAfter = /* @__PURE__ */ new Map();
14937
14977
  var toolkitCliFailureCount = /* @__PURE__ */ new Map();
14978
+ var toolkitCliInFlight = /* @__PURE__ */ new Map();
14938
14979
  var TOOLKIT_INSTALL_RETRY_MS = 5 * 6e4;
14939
14980
  var TOOLKIT_INSTALL_MAX_FAILURES = 3;
14940
14981
  function recordToolkitFailure(toolkitSlug, reason) {
@@ -14951,8 +14992,13 @@ function recordToolkitFailure(toolkitSlug, reason) {
14951
14992
  }
14952
14993
  async function ensureToolkitCli(toolkitSlug) {
14953
14994
  if (toolkitCliEnsured.has(toolkitSlug)) return;
14995
+ const running2 = toolkitCliInFlight.get(toolkitSlug);
14996
+ if (running2) return running2;
14954
14997
  const retryAfter = toolkitCliRetryAfter.get(toolkitSlug) ?? 0;
14955
14998
  if (retryAfter > Date.now()) return;
14999
+ return singleFlight(toolkitCliInFlight, toolkitSlug, () => ensureToolkitCliInner(toolkitSlug));
15000
+ }
15001
+ async function ensureToolkitCliInner(toolkitSlug) {
14956
15002
  const integration = getIntegration(toolkitSlug);
14957
15003
  if (!integration?.cli_tool) {
14958
15004
  toolkitCliEnsured.add(toolkitSlug);
@@ -14960,7 +15006,10 @@ async function ensureToolkitCli(toolkitSlug) {
14960
15006
  }
14961
15007
  const { binary, installer, package: pkg, script } = integration.cli_tool;
14962
15008
  const resolvedInstaller = installer ?? "manual";
14963
- const { execFileSync: execFileSync3, execSync } = await import("child_process");
15009
+ const { execFileSync: execFileSync3, execFile: execFile2, exec } = await import("child_process");
15010
+ const { promisify: promisify3 } = await import("util");
15011
+ const execFileAsync3 = promisify3(execFile2);
15012
+ const execAsync = promisify3(exec);
14964
15013
  try {
14965
15014
  execFileSync3("which", [binary], { timeout: 5e3, stdio: "pipe" });
14966
15015
  toolkitCliEnsured.add(toolkitSlug);
@@ -14983,7 +15032,7 @@ async function ensureToolkitCli(toolkitSlug) {
14983
15032
  return;
14984
15033
  }
14985
15034
  log(`[toolkit-install] ${toolkitSlug}: installing via npm (${pkg})\u2026`);
14986
- execFileSync3("npm", ["install", "-g", pkg], { timeout: 18e4, stdio: "pipe" });
15035
+ await execFileAsync3("npm", ["install", "-g", pkg], { timeout: 18e4 });
14987
15036
  } else if (resolvedInstaller === "brew") {
14988
15037
  if (!pkg) {
14989
15038
  log(`[toolkit-install] ${toolkitSlug}: installer=brew but no package declared`);
@@ -15000,9 +15049,9 @@ async function ensureToolkitCli(toolkitSlug) {
15000
15049
  const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
15001
15050
  log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
15002
15051
  if (isRoot) {
15003
- execFileSync3("sudo", ["-u", "ec2-user", "-H", brewPath, "install", pkg], { timeout: 18e4, stdio: "pipe", cwd: "/tmp" });
15052
+ await execFileAsync3("sudo", ["-u", "ec2-user", "-H", brewPath, "install", pkg], { timeout: 18e4, cwd: "/tmp" });
15004
15053
  } else {
15005
- execFileSync3(brewPath, ["install", pkg], { timeout: 18e4, stdio: "pipe" });
15054
+ await execFileAsync3(brewPath, ["install", pkg], { timeout: 18e4 });
15006
15055
  }
15007
15056
  } else if (resolvedInstaller === "script") {
15008
15057
  if (!script) {
@@ -15011,7 +15060,7 @@ async function ensureToolkitCli(toolkitSlug) {
15011
15060
  return;
15012
15061
  }
15013
15062
  log(`[toolkit-install] ${toolkitSlug}: running declared install script\u2026`);
15014
- execSync(script, { timeout: 18e4, stdio: "pipe" });
15063
+ await execAsync(script, { timeout: 18e4 });
15015
15064
  }
15016
15065
  } catch (err) {
15017
15066
  const e = err;
@@ -16518,7 +16567,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
16518
16567
  if (codeNames.length === 0) return;
16519
16568
  void (async () => {
16520
16569
  try {
16521
- const { collectDiagnostics } = await import("../persistent-session-HSBVLK46.js");
16570
+ const { collectDiagnostics } = await import("../persistent-session-JSLQLE6F.js");
16522
16571
  await api.post("/host/heartbeat", {
16523
16572
  host_id: hostId,
16524
16573
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -16660,7 +16709,7 @@ async function pollCycleInner() {
16660
16709
  }
16661
16710
  try {
16662
16711
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
16663
- const { collectDiagnostics } = await import("../persistent-session-HSBVLK46.js");
16712
+ const { collectDiagnostics } = await import("../persistent-session-JSLQLE6F.js");
16664
16713
  const diagCodeNames = [...agentState.persistentSessionAgents];
16665
16714
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor) : void 0;
16666
16715
  let tailscaleHostname;
@@ -16868,7 +16917,7 @@ async function pollCycleInner() {
16868
16917
  collectPanelessActivityProbes,
16869
16918
  getResponsivenessIntervalMs,
16870
16919
  occupancyQualificationClassifications
16871
- } = await import("../responsiveness-probe-KGN6IQLH.js");
16920
+ } = await import("../responsiveness-probe-2C7X7RIM.js");
16872
16921
  const probeIntervalMs = getResponsivenessIntervalMs();
16873
16922
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
16874
16923
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -16985,7 +17034,7 @@ async function pollCycleInner() {
16985
17034
  collectResponsivenessProbes,
16986
17035
  livePendingInboundOldestAgeSeconds,
16987
17036
  parkPendingInbound
16988
- } = await import("../responsiveness-probe-KGN6IQLH.js");
17037
+ } = await import("../responsiveness-probe-2C7X7RIM.js");
16989
17038
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
16990
17039
  const wedgeNow = /* @__PURE__ */ new Date();
16991
17040
  const liveAgents = agentState.persistentSessionAgents;
@@ -17271,7 +17320,7 @@ async function pollCycleInner() {
17271
17320
  }
17272
17321
  }
17273
17322
  );
17274
- const { parkPendingInbound } = await import("../responsiveness-probe-KGN6IQLH.js");
17323
+ const { parkPendingInbound } = await import("../responsiveness-probe-2C7X7RIM.js");
17275
17324
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
17276
17325
  paneFatalStreak.delete(codeName);
17277
17326
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -17302,7 +17351,7 @@ async function pollCycleInner() {
17302
17351
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
17303
17352
  bindSourceEscalations
17304
17353
  } = await import("../transcript-mount-health-OHE6IVJV.js");
17305
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-HSBVLK46.js");
17354
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-JSLQLE6F.js");
17306
17355
  const mountConfig = resolveTranscriptMountConfig();
17307
17356
  const liveAgents = agentState.persistentSessionAgents;
17308
17357
  for (const tracked of [
@@ -17467,7 +17516,7 @@ async function pollCycleInner() {
17467
17516
  }
17468
17517
  try {
17469
17518
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
17470
- const { probeSessionAuth } = await import("../session-auth-dead-P44BJ3W6.js");
17519
+ const { probeSessionAuth } = await import("../session-auth-dead-QYQXJNZP.js");
17471
17520
  const observations = [];
17472
17521
  const pendingCacheCommits = [];
17473
17522
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -20255,15 +20304,14 @@ async function processAgent(agent, agentStates, managedToolkits) {
20255
20304
  }
20256
20305
  const agentFwForToolkits = agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK;
20257
20306
  const toolkitsList = refreshAny.integration_toolkits ?? refreshAny.plugin_toolkits ?? [];
20258
- if (agentFwForToolkits === "claude-code" && toolkitsList.length) {
20259
- const toolkitUnion = /* @__PURE__ */ new Set();
20260
- for (const { toolkits } of toolkitsList) {
20261
- for (const t of toolkits) toolkitUnion.add(t);
20262
- }
20263
- for (const toolkitSlug of toolkitUnion) {
20264
- await ensureToolkitCli(toolkitSlug);
20265
- }
20266
- }
20307
+ await installToolkitClis({
20308
+ framework: agentFwForToolkits,
20309
+ bundleToolkits: toolkitsList,
20310
+ heldIntegrations: lastIntegrationsPayload.get(agent.agent_id) ?? [],
20311
+ hasCliTool: (id) => Boolean(getIntegration(id)?.cli_tool),
20312
+ ensure: ensureToolkitCli,
20313
+ onBackgroundError: (slug, err) => log(`[toolkit-install] ${slug}: background install threw: ${err?.message ?? String(err)}`)
20314
+ });
20267
20315
  const desiredRuntimeImage = refreshAny.desired_runtime_image;
20268
20316
  if (desiredRuntimeImage && isolationMode(agent.code_name) !== "none") {
20269
20317
  void ensureIsolationImage(desiredRuntimeImage).catch((err) => {
@@ -22055,7 +22103,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
22055
22103
  try {
22056
22104
  const freshId = rotateSessionForWedge(codeName);
22057
22105
  consecutiveWedgeCycles.delete(codeName);
22058
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-KGN6IQLH.js");
22106
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-2C7X7RIM.js");
22059
22107
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
22060
22108
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
22061
22109
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -22098,7 +22146,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
22098
22146
  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}`));
22099
22147
  void (async () => {
22100
22148
  try {
22101
- const { collectDiagnostics } = await import("../persistent-session-HSBVLK46.js");
22149
+ const { collectDiagnostics } = await import("../persistent-session-JSLQLE6F.js");
22102
22150
  await api.post("/host/heartbeat", {
22103
22151
  host_id: hostId,
22104
22152
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -22149,7 +22197,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
22149
22197
  }
22150
22198
  try {
22151
22199
  const hostId = await getHostId();
22152
- const { collectDiagnostics } = await import("../persistent-session-HSBVLK46.js");
22200
+ const { collectDiagnostics } = await import("../persistent-session-JSLQLE6F.js");
22153
22201
  await api.post("/host/heartbeat", {
22154
22202
  host_id: hostId,
22155
22203
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
@@ -22822,7 +22870,7 @@ async function processClaudePairSessions(agents) {
22822
22870
  // cannot take it for itself — by the time it runs, the write it is looking
22823
22871
  // for may already have happened.
22824
22872
  snapshotPairConfig
22825
- } = await import("../claude-pair-runtime-R2BGQCXS.js");
22873
+ } = await import("../claude-pair-runtime-DKS7V6MT.js");
22826
22874
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
22827
22875
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
22828
22876
  const killed = await killPairSession(pairTmuxSession(pairId));