@integrity-labs/agt-cli 0.28.440 → 0.28.441

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.
package/dist/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-V3G7G4QM.js";
43
+ } from "../chunk-6KTN6GTT.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-R6GVWACQ.js";
74
+ } from "../chunk-NQP2W2RD.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.440" : "dev";
4833
+ var cliVersion = true ? "0.28.441" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.440" : "dev";
6005
+ var cliVersion2 = true ? "0.28.441" : "dev";
6006
6006
  var program = new Command();
6007
6007
  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");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -29,7 +29,7 @@ import {
29
29
  resolveConnectivityProbe,
30
30
  worseConnectivityOutcome,
31
31
  wrapScheduledTaskPrompt
32
- } from "./chunk-R6GVWACQ.js";
32
+ } from "./chunk-NQP2W2RD.js";
33
33
  import {
34
34
  parsePsRows
35
35
  } from "./chunk-XWVM4KPK.js";
@@ -4901,7 +4901,7 @@ function requireHost() {
4901
4901
  }
4902
4902
 
4903
4903
  // src/lib/api-client.ts
4904
- var agtCliVersion = true ? "0.28.440" : "dev";
4904
+ var agtCliVersion = true ? "0.28.441" : "dev";
4905
4905
  var lastConfigHash = null;
4906
4906
  function setConfigHash(hash) {
4907
4907
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7402,4 +7402,4 @@ export {
7402
7402
  managerInstallSystemUnitCommand,
7403
7403
  managerUninstallSystemUnitCommand
7404
7404
  };
7405
- //# sourceMappingURL=chunk-V3G7G4QM.js.map
7405
+ //# sourceMappingURL=chunk-6KTN6GTT.js.map
@@ -4,9 +4,9 @@ import {
4
4
 
5
5
  // src/lib/persistent-session.ts
6
6
  import { spawn as spawn2, execSync as execSync2, execFileSync as execFileSync3 } from "child_process";
7
- import { join as join6, dirname as dirname3 } from "path";
8
- import { homedir as homedir6, platform, userInfo as userInfo2 } from "os";
9
- import { existsSync as existsSync6, readFileSync as readFileSync8, readdirSync as readdirSync3, writeFileSync as writeFileSync6, appendFileSync as appendFileSync2, mkdirSync as mkdirSync6, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync4 } from "fs";
7
+ import { join as join5, dirname as dirname3 } from "path";
8
+ import { homedir as homedir5, platform, userInfo as userInfo2 } from "os";
9
+ import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync3, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2, mkdirSync as mkdirSync5, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync3 } from "fs";
10
10
 
11
11
  // src/lib/mcp-sanitize.ts
12
12
  import { readFileSync, writeFileSync } from "fs";
@@ -11859,8 +11859,8 @@ function stopTranscriptRefresher(codeName) {
11859
11859
  transcriptTimers.delete(codeName);
11860
11860
  }
11861
11861
  }
11862
- function readProvisionedOpencodeModel(agentDir3) {
11863
- return readOpencodeModelString(join3(agentDir3, "provision", "opencode.json"));
11862
+ function readProvisionedOpencodeModel(agentDir2) {
11863
+ return readOpencodeModelString(join3(agentDir2, "provision", "opencode.json"));
11864
11864
  }
11865
11865
  function readOpencodeModelString(configPath2) {
11866
11866
  try {
@@ -12798,58 +12798,13 @@ function creditWatchdogGiveUpCount(codeName, count) {
12798
12798
  giveUpCounts.set(codeName, (giveUpCounts.get(codeName) ?? 0) + count);
12799
12799
  }
12800
12800
 
12801
- // src/lib/usage-limit-marker-file.ts
12802
- import { mkdirSync as mkdirSync5, readFileSync as readFileSync7, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
12803
- import { homedir as homedir5 } from "os";
12804
- import { join as join5 } from "path";
12805
- function agentDir2(codeName) {
12806
- return join5(homedir5(), ".augmented", codeName);
12807
- }
12808
- function usageLimitMarkerPath(codeName) {
12809
- return join5(agentDir2(codeName), USAGE_LIMIT_MARKER_FILENAME);
12810
- }
12811
- function writeUsageLimitMarker(codeName, limitedUntil, log2) {
12812
- try {
12813
- mkdirSync5(agentDir2(codeName), { recursive: true });
12814
- writeFileSync5(usageLimitMarkerPath(codeName), serializeUsageLimitMarker(limitedUntil), "utf-8");
12815
- } catch (err) {
12816
- log2(`[usage-banner] usage-limit marker sync failed for '${codeName}': ${err.message}`);
12817
- }
12818
- }
12819
- function clearUsageLimitMarker(codeName, log2) {
12820
- try {
12821
- rmSync3(usageLimitMarkerPath(codeName), { force: true });
12822
- } catch (err) {
12823
- log2(`[usage-banner] usage-limit marker clear failed for '${codeName}': ${err.message}`);
12824
- }
12825
- }
12826
- function readUsageLimitUntil(opts) {
12827
- const path = opts.filePath ?? (opts.codeName ? usageLimitMarkerPath(opts.codeName) : null);
12828
- if (!path) return null;
12829
- let raw;
12830
- try {
12831
- raw = readFileSync7(path, "utf-8");
12832
- } catch {
12833
- return null;
12834
- }
12835
- return resolveUsageLimitUntil(parseUsageLimitMarker(raw), opts.now ?? /* @__PURE__ */ new Date());
12836
- }
12837
- var loggedUsageCapDeferral = /* @__PURE__ */ new Map();
12838
- function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
12839
- const key = `${site}:${codeName}`;
12840
- const at = limitedUntil.getTime();
12841
- if (loggedUsageCapDeferral.get(key) === at) return false;
12842
- loggedUsageCapDeferral.set(key, at);
12843
- return true;
12844
- }
12845
-
12846
12801
  // src/lib/persistent-session.ts
12847
12802
  var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
12848
12803
  function syncClaudeCredsToRoot() {
12849
12804
  if (platform() !== "linux") return true;
12850
12805
  if (typeof process.getuid !== "function" || process.getuid() !== 0) return true;
12851
12806
  for (const filename of [".credentials.json", "credentials.json"]) {
12852
- if (existsSync6(join6("/root/.claude", filename))) return true;
12807
+ if (existsSync6(join5("/root/.claude", filename))) return true;
12853
12808
  }
12854
12809
  let sourcePath = null;
12855
12810
  try {
@@ -12857,7 +12812,7 @@ function syncClaudeCredsToRoot() {
12857
12812
  outer: for (const entry of entries) {
12858
12813
  if (!entry.isDirectory()) continue;
12859
12814
  for (const filename of [".credentials.json", "credentials.json"]) {
12860
- const candidate = join6("/home", entry.name, ".claude", filename);
12815
+ const candidate = join5("/home", entry.name, ".claude", filename);
12861
12816
  if (existsSync6(candidate)) {
12862
12817
  sourcePath = candidate;
12863
12818
  break outer;
@@ -12869,9 +12824,9 @@ function syncClaudeCredsToRoot() {
12869
12824
  if (!sourcePath) return false;
12870
12825
  const targetDir = "/root/.claude";
12871
12826
  const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
12872
- const targetPath = join6(targetDir, sourceFilename);
12827
+ const targetPath = join5(targetDir, sourceFilename);
12873
12828
  try {
12874
- if (!existsSync6(targetDir)) mkdirSync6(targetDir, { recursive: true, mode: 448 });
12829
+ if (!existsSync6(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
12875
12830
  copyFileSync(sourcePath, targetPath);
12876
12831
  chmodSync3(targetPath, 384);
12877
12832
  return true;
@@ -12948,13 +12903,13 @@ function buildEgressAllowlist(toolsFrontmatter) {
12948
12903
  return [...domains].sort();
12949
12904
  }
12950
12905
  function egressAllowlistHostPath(codeName, homeDir) {
12951
- const home = homeDir ?? (process.env.HOME?.trim() || homedir6());
12952
- return join6(home, ".augmented", "_egress", `${codeName}.txt`);
12906
+ const home = homeDir ?? (process.env.HOME?.trim() || homedir5());
12907
+ return join5(home, ".augmented", "_egress", `${codeName}.txt`);
12953
12908
  }
12954
12909
  function writeEgressAllowlist(codeName, domains, homeDir) {
12955
12910
  const p2 = egressAllowlistHostPath(codeName, homeDir);
12956
- mkdirSync6(dirname3(p2), { recursive: true });
12957
- writeFileSync6(p2, domains.join("\n") + "\n", { mode: 420 });
12911
+ mkdirSync5(dirname3(p2), { recursive: true });
12912
+ writeFileSync5(p2, domains.join("\n") + "\n", { mode: 420 });
12958
12913
  return p2;
12959
12914
  }
12960
12915
  var EGRESS_DOCKER_TIMEOUT_MS = 1e4;
@@ -12990,13 +12945,13 @@ function restartEgressSidecar(codeName) {
12990
12945
  function buildDockerRunCommand(args) {
12991
12946
  const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
12992
12947
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
12993
- const agentDir3 = join6(homeDir, ".augmented", codeName);
12994
- const agentIdDir = join6(homeDir, ".augmented", agentId);
12995
- const mcpDir = join6(homeDir, ".augmented", "_mcp");
12996
- const claudeHome = join6(homeDir, ".claude");
12997
- const claudeJson = join6(homeDir, ".claude.json");
12948
+ const agentDir2 = join5(homeDir, ".augmented", codeName);
12949
+ const agentIdDir = join5(homeDir, ".augmented", agentId);
12950
+ const mcpDir = join5(homeDir, ".augmented", "_mcp");
12951
+ const claudeHome = join5(homeDir, ".claude");
12952
+ const claudeJson = join5(homeDir, ".claude.json");
12998
12953
  const mounts = [
12999
- `-v ${q(`${agentDir3}:${agentDir3}`)}`,
12954
+ `-v ${q(`${agentDir2}:${agentDir2}`)}`,
13000
12955
  `-v ${q(`${agentIdDir}:${agentIdDir}`)}`,
13001
12956
  `-v ${q(`${mcpDir}:${mcpDir}:ro`)}`,
13002
12957
  `-v ${q(`${claudeHome}:${claudeHome}`)}`,
@@ -13007,7 +12962,7 @@ function buildDockerRunCommand(args) {
13007
12962
  const cpus = process.env.AGT_ISOLATION_CPUS || "1.0";
13008
12963
  const pids = process.env.AGT_ISOLATION_PIDS || "512";
13009
12964
  const envArgs = [`-e ${q(`HOME=${homeDir}`)}`];
13010
- envArgs.push(`-e ${q(`npm_config_cache=${join6(agentDir3, ".npm-cache")}`)}`);
12965
+ envArgs.push(`-e ${q(`npm_config_cache=${join5(agentDir2, ".npm-cache")}`)}`);
13011
12966
  if (passApiKey) envArgs.push("-e ANTHROPIC_API_KEY");
13012
12967
  if (passOpenRouter) {
13013
12968
  envArgs.push("-e ANTHROPIC_BASE_URL");
@@ -13074,8 +13029,8 @@ function buildDockerRunCommand(args) {
13074
13029
  }
13075
13030
  function writePersistentClaudeWrapper(args) {
13076
13031
  const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
13077
- const envIntegrationsPath = join6(projectDir, ".env.integrations");
13078
- const wrapperPath = join6(projectDir, ".claude", "persistent-claude.sh");
13032
+ const envIntegrationsPath = join5(projectDir, ".env.integrations");
13033
+ const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
13079
13034
  const wrapperLines = [
13080
13035
  "#!/usr/bin/env bash",
13081
13036
  "set -e",
@@ -13094,15 +13049,15 @@ function writePersistentClaudeWrapper(args) {
13094
13049
  wrapperLines.push(
13095
13050
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
13096
13051
  );
13097
- mkdirSync6(join6(projectDir, ".claude"), { recursive: true });
13098
- writeFileSync6(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13052
+ mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
13053
+ writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13099
13054
  chmodSync3(wrapperPath, 448);
13100
13055
  return wrapperPath;
13101
13056
  }
13102
13057
  function collectMcpServerNames(mcpConfigPath) {
13103
13058
  if (!existsSync6(mcpConfigPath)) return [];
13104
13059
  try {
13105
- const data = JSON.parse(readFileSync8(mcpConfigPath, "utf-8"));
13060
+ const data = JSON.parse(readFileSync7(mcpConfigPath, "utf-8"));
13106
13061
  const servers = data.mcpServers;
13107
13062
  return servers ? Object.keys(servers) : [];
13108
13063
  } catch {
@@ -13110,15 +13065,15 @@ function collectMcpServerNames(mcpConfigPath) {
13110
13065
  }
13111
13066
  }
13112
13067
  var sessions2 = /* @__PURE__ */ new Map();
13113
- var PANE_LOG_DIR = join6(homedir6(), ".augmented");
13068
+ var PANE_LOG_DIR = join5(homedir5(), ".augmented");
13114
13069
  var PANE_TAIL_LINES = 20;
13115
13070
  function paneLogPath(codeName) {
13116
- return join6(PANE_LOG_DIR, codeName, "pane.log");
13071
+ return join5(PANE_LOG_DIR, codeName, "pane.log");
13117
13072
  }
13118
13073
  function setupPaneLog2(tmuxSession, codeName, log2) {
13119
13074
  const logPath = paneLogPath(codeName);
13120
13075
  try {
13121
- mkdirSync6(dirname3(logPath), { recursive: true });
13076
+ mkdirSync5(dirname3(logPath), { recursive: true });
13122
13077
  appendFileSync2(
13123
13078
  logPath,
13124
13079
  `
@@ -13138,7 +13093,7 @@ function readPaneLogTail(codeName, lines = PANE_TAIL_LINES) {
13138
13093
  const logPath = paneLogPath(codeName);
13139
13094
  if (!existsSync6(logPath)) return null;
13140
13095
  try {
13141
- const raw = readFileSync8(logPath, "utf-8");
13096
+ const raw = readFileSync7(logPath, "utf-8");
13142
13097
  if (!raw) return null;
13143
13098
  const stripped = raw.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
13144
13099
  const all = stripped.split("\n").filter((l) => l.length > 0);
@@ -13209,11 +13164,11 @@ function resolveSessionSpawnDecision(args) {
13209
13164
  };
13210
13165
  }
13211
13166
  function directChatSessionStatePath(agentId) {
13212
- return join6(homedir6(), ".augmented", agentId, "direct-chat-session.json");
13167
+ return join5(homedir5(), ".augmented", agentId, "direct-chat-session.json");
13213
13168
  }
13214
13169
  function readDirectChatSessionState(agentId) {
13215
13170
  try {
13216
- const parsed = JSON.parse(readFileSync8(directChatSessionStatePath(agentId), "utf-8"));
13171
+ const parsed = JSON.parse(readFileSync7(directChatSessionStatePath(agentId), "utf-8"));
13217
13172
  if (!parsed || typeof parsed !== "object") return null;
13218
13173
  const state = parsed;
13219
13174
  state.mcpServerKeys = Array.isArray(state.mcpServerKeys) ? state.mcpServerKeys.filter((k) => typeof k === "string") : void 0;
@@ -13224,8 +13179,8 @@ function readDirectChatSessionState(agentId) {
13224
13179
  }
13225
13180
  function writeDirectChatSessionState(agentId, state) {
13226
13181
  const p2 = directChatSessionStatePath(agentId);
13227
- mkdirSync6(dirname3(p2), { recursive: true });
13228
- writeFileSync6(p2, JSON.stringify(state));
13182
+ mkdirSync5(dirname3(p2), { recursive: true });
13183
+ writeFileSync5(p2, JSON.stringify(state));
13229
13184
  }
13230
13185
  function startPersistentSession(config) {
13231
13186
  const existing = sessions2.get(config.codeName);
@@ -13281,12 +13236,12 @@ function spawnSession(config, session) {
13281
13236
  log2(`[persistent-session] No Claude Code credentials found under /root/.claude or /home/*. Pair via browser from the host page, or run 'claude /login' on the host.`);
13282
13237
  }
13283
13238
  } else {
13284
- const claudeDir = join6(homedir6(), ".claude");
13239
+ const claudeDir = join5(homedir5(), ".claude");
13285
13240
  for (const filename of [".credentials.json", "credentials.json"]) {
13286
- const p2 = join6(claudeDir, filename);
13241
+ const p2 = join5(claudeDir, filename);
13287
13242
  if (existsSync6(p2)) {
13288
13243
  try {
13289
- rmSync4(p2, { force: true });
13244
+ rmSync3(p2, { force: true });
13290
13245
  log2(`[persistent-session] Removed ${p2} (api_key mode active \u2014 preventing OAuth fallback)`);
13291
13246
  } catch {
13292
13247
  }
@@ -13378,7 +13333,7 @@ function spawnSession(config, session) {
13378
13333
  if (config.notifyDispatchMode && config.notifyDispatchMode !== "off" && !process.env["AGT_NOTIFY_DISPATCH"]) {
13379
13334
  tmuxSessionEnvArgs.push("-e", `AGT_NOTIFY_DISPATCH=${config.notifyDispatchMode}`);
13380
13335
  }
13381
- const sessionHomeDir = process.env.HOME?.trim() || homedir6();
13336
+ const sessionHomeDir = process.env.HOME?.trim() || homedir5();
13382
13337
  let egress;
13383
13338
  if (egressMode(codeName) === "allowlist") {
13384
13339
  const allowlist = config.egressAllowlist ?? buildEgressAllowlist(null);
@@ -13417,7 +13372,7 @@ function spawnSession(config, session) {
13417
13372
  // Treat empty-string as missing too — `HOME=""` makes ~ resolve
13418
13373
  // to cwd, which is the same broken outcome as no HOME, just
13419
13374
  // better hidden.
13420
- HOME: process.env.HOME?.trim() || homedir6(),
13375
+ HOME: process.env.HOME?.trim() || homedir5(),
13421
13376
  USER: process.env.USER?.trim() || userInfo2().username
13422
13377
  };
13423
13378
  if (config.runId) {
@@ -13441,7 +13396,7 @@ function spawnSession(config, session) {
13441
13396
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
13442
13397
  for (const f of probeMcpEnvSubstitution({
13443
13398
  mcpConfigPath,
13444
- envIntegrationsPath: join6(projectDir, ".env.integrations"),
13399
+ envIntegrationsPath: join5(projectDir, ".env.integrations"),
13445
13400
  baseEnv: probeBaseEnv
13446
13401
  })) {
13447
13402
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -13470,7 +13425,6 @@ function spawnSession(config, session) {
13470
13425
  }
13471
13426
  log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
13472
13427
  setupPaneLog2(tmuxSession, codeName, log2);
13473
- clearUsageLimitMarker(codeName, log2);
13474
13428
  session.currentSessionId = sessionId;
13475
13429
  acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
13476
13430
  });
@@ -14000,7 +13954,7 @@ async function stopAllSessionsAndWait(log2, opts) {
14000
13954
  await new Promise((resolve) => setTimeout(resolve, Math.min(opts.timeoutMs, 2e3)));
14001
13955
  }
14002
13956
  function getProjectDir(codeName) {
14003
- return join6(homedir6(), ".augmented", codeName, "project");
13957
+ return join5(homedir5(), ".augmented", codeName, "project");
14004
13958
  }
14005
13959
 
14006
13960
  export {
@@ -14087,6 +14041,10 @@ export {
14087
14041
  sumTranscriptUsageInWindow,
14088
14042
  isEmptyTotals,
14089
14043
  attributeTranscriptUsageByRun,
14044
+ USAGE_LIMIT_MARKER_FILENAME,
14045
+ serializeUsageLimitMarker,
14046
+ parseUsageLimitMarker,
14047
+ resolveUsageLimitUntil,
14090
14048
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
14091
14049
  serializeAccountEnforcementMarker,
14092
14050
  KANBAN_CHECK_COMMAND,
@@ -14129,10 +14087,6 @@ export {
14129
14087
  checkChannelInputs,
14130
14088
  takeWatchdogGiveUpCount,
14131
14089
  creditWatchdogGiveUpCount,
14132
- writeUsageLimitMarker,
14133
- clearUsageLimitMarker,
14134
- readUsageLimitUntil,
14135
- shouldLogUsageCapDeferral,
14136
14090
  resolveOAuthCredAction,
14137
14091
  resolveClaudeBinary,
14138
14092
  isolationMode,
@@ -14171,4 +14125,4 @@ export {
14171
14125
  stopAllSessionsAndWait,
14172
14126
  getProjectDir
14173
14127
  };
14174
- //# sourceMappingURL=chunk-R6GVWACQ.js.map
14128
+ //# sourceMappingURL=chunk-NQP2W2RD.js.map