@integrity-labs/agt-cli 0.28.1267 → 0.28.1269

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 (33) hide show
  1. package/dist/{api-client-NGXHG4YA.js → api-client-54VZB3MY.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-UA2UPXYC.js → chunk-BM4Q7VW6.js} +86 -4
  4. package/dist/chunk-BM4Q7VW6.js.map +1 -0
  5. package/dist/{chunk-DCI6M6TF.js → chunk-ES3U3RIS.js} +3 -3
  6. package/dist/{chunk-BMO6GCK2.js → chunk-GLIROXKE.js} +2 -2
  7. package/dist/{chunk-W2GHPRPZ.js → chunk-LTQTHV7E.js} +1 -1
  8. package/dist/chunk-LTQTHV7E.js.map +1 -0
  9. package/dist/{chunk-X2FBQPNR.js → chunk-RNA2BFCX.js} +2 -2
  10. package/dist/{chunk-SR72T5SB.js → chunk-YB4W3NF3.js} +5 -5
  11. package/dist/{claude-code-updater-XISTQTZX.js → claude-code-updater-OHXLB7WR.js} +3 -3
  12. package/dist/{claude-pair-runtime-ASGVKZ5N.js → claude-pair-runtime-XTRWHN5Q.js} +3 -3
  13. package/dist/lib/manager-worker.js +461 -192
  14. package/dist/lib/manager-worker.js.map +1 -1
  15. package/dist/mcp/direct-chat-channel.js +178 -127
  16. package/dist/mcp/slack-channel.js +6 -1
  17. package/dist/mcp/telegram-channel.js +6 -1
  18. package/dist/{persistent-session-FMY2FZEL.js → persistent-session-MX6UHWLR.js} +18 -4
  19. package/dist/{responsiveness-probe-26TFNDWB.js → responsiveness-probe-GXI34QDS.js} +4 -4
  20. package/dist/{session-auth-dead-U62KZ342.js → session-auth-dead-UM6LYQ2W.js} +3 -3
  21. package/package.json +1 -1
  22. package/dist/chunk-UA2UPXYC.js.map +0 -1
  23. package/dist/chunk-W2GHPRPZ.js.map +0 -1
  24. /package/dist/{api-client-NGXHG4YA.js.map → api-client-54VZB3MY.js.map} +0 -0
  25. /package/dist/{chunk-DCI6M6TF.js.map → chunk-ES3U3RIS.js.map} +0 -0
  26. /package/dist/{chunk-BMO6GCK2.js.map → chunk-GLIROXKE.js.map} +0 -0
  27. /package/dist/{chunk-X2FBQPNR.js.map → chunk-RNA2BFCX.js.map} +0 -0
  28. /package/dist/{chunk-SR72T5SB.js.map → chunk-YB4W3NF3.js.map} +0 -0
  29. /package/dist/{claude-code-updater-XISTQTZX.js.map → claude-code-updater-OHXLB7WR.js.map} +0 -0
  30. /package/dist/{claude-pair-runtime-ASGVKZ5N.js.map → claude-pair-runtime-XTRWHN5Q.js.map} +0 -0
  31. /package/dist/{persistent-session-FMY2FZEL.js.map → persistent-session-MX6UHWLR.js.map} +0 -0
  32. /package/dist/{responsiveness-probe-26TFNDWB.js.map → responsiveness-probe-GXI34QDS.js.map} +0 -0
  33. /package/dist/{session-auth-dead-U62KZ342.js.map → session-auth-dead-UM6LYQ2W.js.map} +0 -0
@@ -15,8 +15,8 @@ import {
15
15
  mintRotatedHostKey,
16
16
  probeHostKey,
17
17
  setConfigHash
18
- } from "./chunk-DCI6M6TF.js";
19
- import "./chunk-W2GHPRPZ.js";
18
+ } from "./chunk-ES3U3RIS.js";
19
+ import "./chunk-LTQTHV7E.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
22
22
  ApiError,
@@ -36,4 +36,4 @@ export {
36
36
  probeHostKey,
37
37
  setConfigHash
38
38
  };
39
- //# sourceMappingURL=api-client-NGXHG4YA.js.map
39
+ //# sourceMappingURL=api-client-54VZB3MY.js.map
package/dist/bin/agt.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  success,
32
32
  table,
33
33
  warn
34
- } from "../chunk-SR72T5SB.js";
34
+ } from "../chunk-YB4W3NF3.js";
35
35
  import {
36
36
  ApiError,
37
37
  PROD_AGT_HOST,
@@ -42,17 +42,17 @@ import {
42
42
  getHost,
43
43
  getHostId,
44
44
  setActiveTeam
45
- } from "../chunk-DCI6M6TF.js";
45
+ } from "../chunk-ES3U3RIS.js";
46
46
  import {
47
47
  getProjectDir,
48
48
  isSessionResumeDisabled,
49
49
  readDirectChatSessionState
50
- } from "../chunk-UA2UPXYC.js";
50
+ } from "../chunk-BM4Q7VW6.js";
51
51
  import {
52
52
  markDailySessionSpawn,
53
53
  sessionFileExists,
54
54
  sessionTranscriptDir
55
- } from "../chunk-X2FBQPNR.js";
55
+ } from "../chunk-RNA2BFCX.js";
56
56
  import "../chunk-XL2HPM67.js";
57
57
  import "../chunk-6HBXEJHO.js";
58
58
  import "../chunk-XWVM4KPK.js";
@@ -85,7 +85,7 @@ import {
85
85
  requiredMcpWildcard,
86
86
  resolveChannels,
87
87
  serializeManifestForSlackCli
88
- } from "../chunk-W2GHPRPZ.js";
88
+ } from "../chunk-LTQTHV7E.js";
89
89
  import "../chunk-AIUIMEUS.js";
90
90
  import "../chunk-DGUM43GV.js";
91
91
 
@@ -5207,7 +5207,7 @@ import { execFileSync, execSync } from "child_process";
5207
5207
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
5208
5208
  import chalk17 from "chalk";
5209
5209
  import ora15 from "ora";
5210
- var cliVersion = true ? "0.28.1267" : "dev";
5210
+ var cliVersion = true ? "0.28.1269" : "dev";
5211
5211
  async function fetchLatestVersion() {
5212
5212
  const host2 = getHost();
5213
5213
  if (!host2) return null;
@@ -6467,7 +6467,7 @@ function handleError(err) {
6467
6467
  }
6468
6468
 
6469
6469
  // src/bin/agt.ts
6470
- var cliVersion2 = true ? "0.28.1267" : "dev";
6470
+ var cliVersion2 = true ? "0.28.1269" : "dev";
6471
6471
  var program = new Command();
6472
6472
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6473
6473
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4,7 +4,7 @@ import {
4
4
  rotateDailySession,
5
5
  sessionFileExists,
6
6
  todayLocalIso
7
- } from "./chunk-X2FBQPNR.js";
7
+ } from "./chunk-RNA2BFCX.js";
8
8
  import {
9
9
  classifyUnanswerablePane,
10
10
  customApiKeyDialogKeys,
@@ -54,7 +54,7 @@ import {
54
54
  remoteMcpConnectionEnvInfix,
55
55
  remoteMcpConnectionLabel,
56
56
  remoteMcpConnectionScopedEnvVar
57
- } from "./chunk-W2GHPRPZ.js";
57
+ } from "./chunk-LTQTHV7E.js";
58
58
  import {
59
59
  CLAUDE_CONFIG_DIR_ENV,
60
60
  approveApiKeyInClaudeConfig,
@@ -2997,10 +2997,11 @@ function tmuxSessionTarget2(session) {
2997
2997
  n = n.slice(0, -1);
2998
2998
  return `=${n}`;
2999
2999
  }
3000
+ var TMUX_SESSION_ABSENT = /can't find session|no server running|error connecting to .* \(No such file or directory\)/i;
3000
3001
  function probeTmuxSession(tmuxSession) {
3001
3002
  try {
3002
3003
  execFileSync2("tmux", ["has-session", "-t", tmuxSessionTarget2(tmuxSession)], {
3003
- stdio: "ignore",
3004
+ stdio: ["ignore", "ignore", "pipe"],
3004
3005
  timeout: 3e3
3005
3006
  });
3006
3007
  return "alive";
@@ -3009,6 +3010,12 @@ function probeTmuxSession(tmuxSession) {
3009
3010
  const timedOut = e?.code === "ETIMEDOUT" || e?.error?.code === "ETIMEDOUT";
3010
3011
  if (e?.code === "ENOENT" || e?.error?.code === "ENOENT" || timedOut)
3011
3012
  return "unknown";
3013
+ const status = e.status;
3014
+ if (typeof status !== "number")
3015
+ return "unknown";
3016
+ const stderr = String(e.stderr ?? "").trim();
3017
+ if (stderr && !TMUX_SESSION_ABSENT.test(stderr))
3018
+ return "unknown";
3012
3019
  return "dead";
3013
3020
  }
3014
3021
  }
@@ -6010,6 +6017,74 @@ function isClaudeProcessAliveInTmux(tmuxSession) {
6010
6017
  }
6011
6018
  return probeClaudeProcessInTmux(tmuxSession) === "alive";
6012
6019
  }
6020
+ function dockerPgrepVerdict(stdout) {
6021
+ const m = /pgrep_rc=(\d+)\s*$/.exec(stdout.trim());
6022
+ if (!m) return "unknown";
6023
+ if (m[1] === "0") return "alive";
6024
+ if (m[1] === "1") return "dead";
6025
+ return "unknown";
6026
+ }
6027
+ function dockerContainerStateVerdict(r) {
6028
+ if (r.kind === "ok") return r.stdout.trim() === "false" ? "dead" : "unknown";
6029
+ if (r.kind === "failed" && /No such (object|container)/i.test(r.message)) return "dead";
6030
+ return "unknown";
6031
+ }
6032
+ function parseEtimeSeconds(etime) {
6033
+ const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/.exec(etime.trim());
6034
+ if (!m) return null;
6035
+ const [, d, h, mm, ss] = m;
6036
+ return (Number(d ?? 0) * 24 + Number(h ?? 0)) * 3600 + Number(mm) * 60 + Number(ss);
6037
+ }
6038
+ function olderSessionProcessFromPs(psOut, tmuxSession, olderThanSeconds) {
6039
+ const needle = new RegExp(`(^|\\s)--name ${escapePgrepRegex(tmuxSession)}(\\s|$)`);
6040
+ let unreadable = false;
6041
+ for (const line2 of psOut.split("\n")) {
6042
+ const m = /^\s*(\d+)\s+(\S+)\s+(.*)$/.exec(line2);
6043
+ if (!m || !needle.test(m[3])) continue;
6044
+ const age = parseEtimeSeconds(m[2]);
6045
+ if (age === null) unreadable = true;
6046
+ else if (age > olderThanSeconds) return "alive";
6047
+ }
6048
+ return unreadable ? "unknown" : "dead";
6049
+ }
6050
+ function probeSessionProcess(codeName) {
6051
+ if (effectiveIsolationMode(codeName) === "docker") {
6052
+ const r = hardBoundedExecFile(
6053
+ "docker",
6054
+ // "[c]laude" (CodeRabbit on #7630): the probe's own `sh -c` command line
6055
+ // contains the pattern text, and procps pgrep does not skip ancestors, so
6056
+ // a plain "claude" matches this shell and reads alive in an empty
6057
+ // container. The bracket class still matches a real claude command line.
6058
+ ["exec", `agt-${codeName}`, "sh", "-c", 'pgrep -f "[c]laude" >/dev/null 2>&1; echo "pgrep_rc=$?"'],
6059
+ { timeoutMs: 8e3 }
6060
+ );
6061
+ const verdict = dockerPgrepVerdict(r.kind === "ok" ? r.stdout : "");
6062
+ if (verdict !== "unknown") return verdict;
6063
+ return dockerContainerStateVerdict(
6064
+ hardBoundedExecFile("docker", ["inspect", "-f", "{{.State.Running}}", `agt-${codeName}`], { timeoutMs: 8e3 })
6065
+ );
6066
+ }
6067
+ return probeClaudeProcessInTmux(`agt-${codeName}`);
6068
+ }
6069
+ function probeSessionProcessOlderThan(codeName, olderThanSeconds) {
6070
+ if (effectiveIsolationMode(codeName) === "docker") return "unknown";
6071
+ try {
6072
+ const out = execFileSync3("ps", ["-A", "-ww", "-o", "pid=,etime=,command="], { encoding: "utf-8", timeout: 3e3, maxBuffer: 16 * 1024 * 1024 });
6073
+ return olderSessionProcessFromPs(out, `agt-${codeName}`, olderThanSeconds);
6074
+ } catch {
6075
+ return "unknown";
6076
+ }
6077
+ }
6078
+ function killStragglerProcess(codeName, signal = "TERM") {
6079
+ if (effectiveIsolationMode(codeName) === "docker") return false;
6080
+ const pattern = `(^|[[:space:]])--name ${escapePgrepRegex(`agt-${codeName}`)}([[:space:]]|$)`;
6081
+ try {
6082
+ execFileSync3("pkill", [`-${signal}`, "-f", "--", pattern], { stdio: "ignore", timeout: 3e3 });
6083
+ return true;
6084
+ } catch {
6085
+ return false;
6086
+ }
6087
+ }
6013
6088
  function takeZombieDetection(codeName) {
6014
6089
  const record = pendingZombieDetections.get(codeName);
6015
6090
  if (record) pendingZombieDetections.delete(codeName);
@@ -6406,6 +6481,13 @@ export {
6406
6481
  injectMessageWithStatus,
6407
6482
  stopPersistentSession,
6408
6483
  getSessionState,
6484
+ dockerPgrepVerdict,
6485
+ dockerContainerStateVerdict,
6486
+ parseEtimeSeconds,
6487
+ olderSessionProcessFromPs,
6488
+ probeSessionProcess,
6489
+ probeSessionProcessOlderThan,
6490
+ killStragglerProcess,
6409
6491
  takeZombieDetection,
6410
6492
  isSessionHealthy,
6411
6493
  resetRestartCount,
@@ -6414,4 +6496,4 @@ export {
6414
6496
  stopAllSessionsAndWait,
6415
6497
  getProjectDir
6416
6498
  };
6417
- //# sourceMappingURL=chunk-UA2UPXYC.js.map
6499
+ //# sourceMappingURL=chunk-BM4Q7VW6.js.map