@integrity-labs/agt-cli 0.28.40 → 0.28.42

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.
@@ -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-CFELQZI7.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-PNY26VBX.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-LOL5YGXP.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-YPTMIWJF.js.map
@@ -7,9 +7,13 @@ import {
7
7
  SUPERVISOR_RESTART_EXIT_CODE,
8
8
  api,
9
9
  atomicWriteFileSync,
10
+ buildConnectivityProbeDeps,
11
+ buildProbeEnv,
10
12
  defaultFlagsCachePath,
13
+ deriveMcpServerKey,
11
14
  estimateActiveTasksTokens,
12
15
  exchangeApiKey,
16
+ executeConnectivityProbe,
13
17
  extractCommandNotFound,
14
18
  getApiKey,
15
19
  getHostId,
@@ -23,7 +27,7 @@ import {
23
27
  requireHost,
24
28
  safeWriteJsonAtomic,
25
29
  setConfigHash
26
- } from "../chunk-DA776TZO.js";
30
+ } from "../chunk-3QK6QLQW.js";
27
31
  import {
28
32
  getProjectDir as getProjectDir2,
29
33
  getReadyTasks,
@@ -35,8 +39,6 @@ import {
35
39
  buildAllowedTools,
36
40
  checkChannelInputs,
37
41
  creditWatchdogGiveUpCount,
38
- expandTemplateVars,
39
- formatMissingVar,
40
42
  getLastFailureContext,
41
43
  getProjectDir,
42
44
  getSessionState,
@@ -47,10 +49,8 @@ import {
47
49
  isSessionHealthy,
48
50
  isStaleForToday,
49
51
  paneLogPath,
50
- parseEnvIntegrations,
51
52
  peekCurrentSession,
52
53
  prepareForRespawn,
53
- probeMcpEnvSubstitution,
54
54
  readPaneLogTail,
55
55
  resetRestartCount,
56
56
  resolveClaudeBinary,
@@ -65,7 +65,7 @@ import {
65
65
  takeWatchdogGiveUpCount,
66
66
  takeZombieDetection,
67
67
  transcriptActivityAgeSeconds
68
- } from "../chunk-57MHPANB.js";
68
+ } from "../chunk-2BRF2FDJ.js";
69
69
  import {
70
70
  FLAGS_SCHEMA_VERSION,
71
71
  FLAG_REGISTRY,
@@ -79,6 +79,7 @@ import {
79
79
  classifyOutput,
80
80
  extractFrontmatter,
81
81
  formatActorId,
82
+ formatMissingVar,
82
83
  formatRunMarker,
83
84
  getFramework,
84
85
  isEmptyTotals,
@@ -86,20 +87,16 @@ import {
86
87
  isResolveError,
87
88
  isSelfCompletion,
88
89
  parseDeliveryTarget,
90
+ parseEnvIntegrations,
89
91
  parseTranscriptUsage,
90
92
  parseUsageBanner,
91
- probeComposioAccount,
92
- probeComposioMcpToolCall,
93
- probeHttpProvider,
94
- probeMcpHttp,
93
+ probeMcpEnvSubstitution,
95
94
  resolveAvatarEnvUrl,
96
95
  resolveChannels,
97
- resolveConnectivityProbe,
98
96
  resolveDmTarget,
99
97
  sumTranscriptUsageInWindow,
100
- worseConnectivityOutcome,
101
98
  wrapScheduledTaskPrompt
102
- } from "../chunk-X5E2Q3W2.js";
99
+ } from "../chunk-SJUD2BWU.js";
103
100
  import {
104
101
  parsePsRows,
105
102
  reapOrphanChannelMcps
@@ -1210,73 +1207,6 @@ function shouldRespawnForModelChange(input) {
1210
1207
  return previousModel !== primaryModel;
1211
1208
  }
1212
1209
 
1213
- // src/lib/connectivity-probe-executor.ts
1214
- async function executeConnectivityProbe(target, deps = {}) {
1215
- const descriptor = resolveConnectivityProbe({
1216
- definitionId: target.definitionId,
1217
- sourceType: target.sourceType,
1218
- authType: target.authType,
1219
- // ENG-6242: carry the toolkit's connectivity_test override so a managed
1220
- // descriptor surfaces `probeTool`/`probeArgs` (the prescribed read-only tool)
1221
- // — without this the hourly probe auto-picked a different tool than the Test
1222
- // path, the false-RED that flagged every managed Linear install "unreachable".
1223
- connectivityTest: target.connectivityTest ?? null
1224
- });
1225
- if (!descriptor.readOnly) {
1226
- throw new Error(`Refusing non-read-only probe for ${target.definitionId}`);
1227
- }
1228
- switch (descriptor.kind) {
1229
- case "http_provider":
1230
- return probeHttpProvider(target.definitionId, target.credentials, deps.fetchImpl ?? fetch);
1231
- case "composio_account":
1232
- if (!deps.composioProbe) return null;
1233
- return deps.composioProbe(target.definitionId, target.credentials);
1234
- case "managed_composite": {
1235
- const outcomes = [];
1236
- if (deps.mcpProbe) {
1237
- outcomes.push(
1238
- await deps.mcpProbe({
1239
- serverKey: target.mcpServerKey ?? target.definitionId,
1240
- definitionId: target.definitionId
1241
- })
1242
- );
1243
- }
1244
- if (deps.composioProbe) {
1245
- outcomes.push(await deps.composioProbe(target.definitionId, target.credentials));
1246
- }
1247
- if (deps.composioToolCallProbe) {
1248
- const toolCall = await deps.composioToolCallProbe({
1249
- serverKey: target.mcpServerKey ?? target.definitionId,
1250
- definitionId: target.definitionId,
1251
- // ENG-6242: thread the prescribed tool through to the live tool-call
1252
- // leg. resolveConnectivityProbe only sets these for managed toolkits
1253
- // with a stored override; the probe re-validates read-only and falls
1254
- // back to auto-pick on drift, so a missing/invalid override is safe.
1255
- toolName: descriptor.probeTool ?? null,
1256
- toolArgs: descriptor.probeArgs ?? null
1257
- });
1258
- if (toolCall) outcomes.push(toolCall);
1259
- }
1260
- if (outcomes.length === 0) return null;
1261
- return outcomes.reduce((acc, o) => worseConnectivityOutcome(acc, o));
1262
- }
1263
- case "mcp_tools_list":
1264
- if (!deps.mcpProbe) return null;
1265
- return deps.mcpProbe({
1266
- serverKey: target.mcpServerKey ?? target.definitionId,
1267
- definitionId: target.definitionId
1268
- });
1269
- case "cli_command":
1270
- if (!deps.runCli) return null;
1271
- return deps.runCli(target.cliBinary ?? target.definitionId, descriptor.cliArgs ?? ["--version"]);
1272
- case "builtin":
1273
- return { status: "ok", message: `${target.definitionId}: built-in` };
1274
- case "unsupported":
1275
- default:
1276
- return null;
1277
- }
1278
- }
1279
-
1280
1210
  // src/lib/connectivity-probe-runner.ts
1281
1211
  var DEFAULT_INTERVAL_MS = 60 * 60 * 1e3;
1282
1212
  var DEFAULT_MAX_PER_RUN = 25;
@@ -1389,37 +1319,6 @@ var DependencyRecoveryLedger = class {
1389
1319
  }
1390
1320
  };
1391
1321
 
1392
- // src/lib/cli-probe.ts
1393
- import { execFile } from "child_process";
1394
- var DEFAULT_TIMEOUT_MS = 8e3;
1395
- function runCliProbe(binary, args, opts = {}) {
1396
- const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1397
- return new Promise((resolve) => {
1398
- execFile(
1399
- binary,
1400
- args,
1401
- { timeout: timeoutMs, env: opts.env ?? process.env, windowsHide: true },
1402
- (err, stdout) => {
1403
- if (!err) {
1404
- const firstLine = String(stdout).split(/\r?\n/, 1)[0]?.trim();
1405
- resolve({ status: "ok", message: firstLine ? `${binary}: ${firstLine}` : `${binary}: ok` });
1406
- return;
1407
- }
1408
- const e = err;
1409
- if (e.code === "ENOENT") {
1410
- resolve({ status: "down", message: `${binary} not found on PATH (not installed)` });
1411
- return;
1412
- }
1413
- if (e.killed || e.signal === "SIGTERM") {
1414
- resolve({ status: "transient_error", message: `${binary} probe timed out after ${timeoutMs / 1e3}s` });
1415
- return;
1416
- }
1417
- resolve({ status: "down", message: `${binary} exited non-zero: ${e.message}` });
1418
- }
1419
- );
1420
- });
1421
- }
1422
-
1423
1322
  // src/lib/self-update-coalesce.ts
1424
1323
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
1425
1324
  import { dirname as dirname2 } from "path";
@@ -3132,9 +3031,9 @@ var GatewayClientPool = class extends EventEmitter {
3132
3031
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
3133
3032
  import { homedir as homedir4, platform } from "os";
3134
3033
  import { join as join9 } from "path";
3135
- import { execFile as execFile2 } from "child_process";
3034
+ import { execFile } from "child_process";
3136
3035
  import { promisify } from "util";
3137
- var execFileAsync = promisify(execFile2);
3036
+ var execFileAsync = promisify(execFile);
3138
3037
  var EXPIRING_SOON_MS = 48 * 60 * 60 * 1e3;
3139
3038
  async function detectClaudeAuth() {
3140
3039
  if (process.env["ANTHROPIC_API_KEY"] || process.env["ANTHROPIC_AUTH_TOKEN"]) {
@@ -6490,116 +6389,10 @@ function projectMcpKeys(_codeName, projectDir) {
6490
6389
  return null;
6491
6390
  }
6492
6391
  }
6493
- function readMcpHttpServerConfig(projectDir, serverKey, env) {
6494
- try {
6495
- const raw = readFileSync14(join16(projectDir, ".mcp.json"), "utf-8");
6496
- const servers = JSON.parse(raw).mcpServers ?? {};
6497
- const entry = servers[serverKey];
6498
- if (entry && typeof entry.url === "string" && (entry.type === "http" || entry.type === void 0)) {
6499
- const unresolved = /* @__PURE__ */ new Set();
6500
- const sub = (value) => {
6501
- if (!env) return value;
6502
- const r = expandTemplateVars(value, env);
6503
- for (const name of r.unresolved) unresolved.add(name);
6504
- return r.value;
6505
- };
6506
- const url = sub(entry.url);
6507
- let headers;
6508
- if (entry.headers) {
6509
- headers = {};
6510
- for (const [k, v] of Object.entries(entry.headers)) headers[k] = sub(v);
6511
- }
6512
- return { url, ...headers ? { headers } : {}, unresolved: [...unresolved] };
6513
- }
6514
- return null;
6515
- } catch {
6516
- return null;
6517
- }
6518
- }
6519
- function deriveMcpServerKey(input) {
6520
- const kind = resolveConnectivityProbe({
6521
- definitionId: input.definitionId,
6522
- sourceType: input.sourceType,
6523
- authType: input.authType,
6524
- connectivityTest: input.connectivityTest ?? null
6525
- }).kind;
6526
- if (kind !== "mcp_tools_list" && kind !== "managed_composite") return void 0;
6527
- return input.definitionId.replace(/[^a-z0-9]/gi, "_").toLowerCase();
6528
- }
6529
6392
  async function runAgentConnectivityProbes(agent, integrations, projectDir) {
6530
6393
  if (integrations.length === 0) return;
6531
- const probeEnv = { ...process.env };
6532
- try {
6533
- const envIntPath = join16(projectDir, ".env.integrations");
6534
- if (existsSync9(envIntPath)) {
6535
- Object.assign(probeEnv, parseEnvIntegrations(readFileSync14(envIntPath, "utf-8")));
6536
- }
6537
- } catch {
6538
- }
6539
- const probeDeps = {
6540
- fetchImpl: fetch,
6541
- runCli: (binary, args) => runCliProbe(binary, args, { env: probeEnv }),
6542
- mcpProbe: async (target) => {
6543
- const cfg = readMcpHttpServerConfig(projectDir, target.serverKey, probeEnv);
6544
- if (!cfg) {
6545
- return { status: "transient_error", message: `MCP server '${target.serverKey}' not resolvable from .mcp.json` };
6546
- }
6547
- if (cfg.unresolved.length > 0) {
6548
- return {
6549
- status: "transient_error",
6550
- message: `MCP '${target.serverKey}' auth unresolved: ${cfg.unresolved.join(", ")}`
6551
- };
6552
- }
6553
- return probeMcpHttp(cfg);
6554
- },
6555
- // ENG-6139: connected-account binding check for managed (Composio) toolkits.
6556
- // The MCP handshake reads green on a dead/mis-bound account, so the managed
6557
- // probe also verifies the account is ACTIVE + bound to the entity the agent
6558
- // queries with. Inputs come from the agent's OWN wired MCP server: the
6559
- // `x-api-key` header and the `user_id` query param (the agent already
6560
- // authenticates with these), plus the recorded connected_account_id.
6561
- composioProbe: async (definitionId, credentials) => {
6562
- const serverKey = definitionId.replace(/[^a-z0-9]/gi, "_").toLowerCase();
6563
- const cfg = readMcpHttpServerConfig(projectDir, serverKey, probeEnv);
6564
- if (!cfg) {
6565
- return { status: "transient_error", message: `MCP server '${serverKey}' not resolvable from .mcp.json` };
6566
- }
6567
- if (cfg.unresolved.length > 0) {
6568
- return {
6569
- status: "transient_error",
6570
- message: `MCP '${serverKey}' auth unresolved: ${cfg.unresolved.join(", ")}`
6571
- };
6572
- }
6573
- const apiKey = cfg.headers?.["x-api-key"] ?? cfg.headers?.["X-API-Key"] ?? "";
6574
- let expectedUserId = "";
6575
- let serverId;
6576
- try {
6577
- const u = new URL(cfg.url);
6578
- expectedUserId = u.searchParams.get("user_id") ?? "";
6579
- const m = u.pathname.match(/\/v3\/mcp\/([^/]+)\/mcp/);
6580
- serverId = m?.[1] ? decodeURIComponent(m[1]) : void 0;
6581
- } catch {
6582
- expectedUserId = "";
6583
- }
6584
- const connectedAccountId = typeof credentials?.["connected_account_id"] === "string" ? credentials["connected_account_id"] : "";
6585
- return probeComposioAccount({ connectedAccountId, apiKey, expectedUserId, serverId });
6586
- },
6587
- // ENG-6157 (Phase 2): the live tool-call leg. Uses the agent's OWN wired MCP
6588
- // URL + headers (the exact path tool calls take), so a broken auth_config
6589
- // linkage surfaces as a real `No connected account found` instead of a
6590
- // green handshake. Skips (`null`) when no safe read-only tool is callable.
6591
- composioToolCallProbe: async (target) => {
6592
- const cfg = readMcpHttpServerConfig(projectDir, target.serverKey, probeEnv);
6593
- if (!cfg) return null;
6594
- if (cfg.unresolved.length > 0) return null;
6595
- return probeComposioMcpToolCall({
6596
- url: cfg.url,
6597
- headers: cfg.headers,
6598
- toolName: target.toolName,
6599
- toolArgs: target.toolArgs
6600
- });
6601
- }
6602
- };
6394
+ const probeEnv = buildProbeEnv(projectDir);
6395
+ const probeDeps = buildConnectivityProbeDeps(projectDir, probeEnv);
6603
6396
  const intervalSec = Number(process.env.AGT_CONNECTIVITY_PROBE_INTERVAL_SECONDS) || 3600;
6604
6397
  const result = await runConnectivityProbes(
6605
6398
  integrations.map((i) => {
@@ -6833,7 +6626,7 @@ var cachedMaintenanceWindow = null;
6833
6626
  var lastVersionCheckAt = 0;
6834
6627
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6835
6628
  var lastResponsivenessProbeAt = 0;
6836
- var agtCliVersion = true ? "0.28.40" : "dev";
6629
+ var agtCliVersion = true ? "0.28.42" : "dev";
6837
6630
  function resolveBrewPath(execFileSync4) {
6838
6631
  try {
6839
6632
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -7942,7 +7735,7 @@ async function pollCycle() {
7942
7735
  }
7943
7736
  try {
7944
7737
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
7945
- const { collectDiagnostics } = await import("../persistent-session-CFELQZI7.js");
7738
+ const { collectDiagnostics } = await import("../persistent-session-PNY26VBX.js");
7946
7739
  const diagCodeNames = [...agentState.persistentSessionAgents];
7947
7740
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
7948
7741
  let tailscaleHostname;
@@ -8043,7 +7836,7 @@ async function pollCycle() {
8043
7836
  const {
8044
7837
  collectResponsivenessProbes,
8045
7838
  getResponsivenessIntervalMs
8046
- } = await import("../responsiveness-probe-YOT3EKKN.js");
7839
+ } = await import("../responsiveness-probe-4YMZ6LXO.js");
8047
7840
  const probeIntervalMs = getResponsivenessIntervalMs();
8048
7841
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
8049
7842
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -8075,7 +7868,7 @@ async function pollCycle() {
8075
7868
  collectResponsivenessProbes,
8076
7869
  livePendingInboundOldestAgeSeconds,
8077
7870
  parkPendingInbound
8078
- } = await import("../responsiveness-probe-YOT3EKKN.js");
7871
+ } = await import("../responsiveness-probe-4YMZ6LXO.js");
8079
7872
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
8080
7873
  const wedgeNow = /* @__PURE__ */ new Date();
8081
7874
  const liveAgents = agentState.persistentSessionAgents;
@@ -11479,7 +11272,7 @@ async function processClaudePairSessions(agents) {
11479
11272
  killPairSession,
11480
11273
  pairTmuxSession,
11481
11274
  finalizeClaudePairOnboarding
11482
- } = await import("../claude-pair-runtime-LOL5YGXP.js");
11275
+ } = await import("../claude-pair-runtime-YPTMIWJF.js");
11483
11276
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
11484
11277
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
11485
11278
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -12366,7 +12159,6 @@ export {
12366
12159
  claudeCodeUpgradeMarkerPath,
12367
12160
  claudeCodeUpgradeThrottled,
12368
12161
  claudeManagedSettingsPath,
12369
- deriveMcpServerKey,
12370
12162
  ensureClaudeManagedSettings,
12371
12163
  extractCharterSlackPeers,
12372
12164
  extractCharterTelegramPeers,