@integrity-labs/agt-cli 0.28.434 → 0.28.435

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-CDF3NQLR.js";
43
+ } from "../chunk-VIOLJEBT.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-TTEKDLQ7.js";
74
+ } from "../chunk-ZLFZXMNL.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.434" : "dev";
4833
+ var cliVersion = true ? "0.28.435" : "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.434" : "dev";
6005
+ var cliVersion2 = true ? "0.28.435" : "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-TTEKDLQ7.js";
32
+ } from "./chunk-ZLFZXMNL.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.434" : "dev";
4904
+ var agtCliVersion = true ? "0.28.435" : "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-CDF3NQLR.js.map
7405
+ //# sourceMappingURL=chunk-VIOLJEBT.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 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";
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 readFileSync7, readdirSync as readdirSync3, writeFileSync as writeFileSync6, appendFileSync as appendFileSync2, mkdirSync as mkdirSync6, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync4 } from "fs";
10
10
 
11
11
  // src/lib/mcp-sanitize.ts
12
12
  import { readFileSync, writeFileSync } from "fs";
@@ -11817,8 +11817,8 @@ function stopTranscriptRefresher(codeName) {
11817
11817
  transcriptTimers.delete(codeName);
11818
11818
  }
11819
11819
  }
11820
- function readProvisionedOpencodeModel(agentDir2) {
11821
- return readOpencodeModelString(join3(agentDir2, "provision", "opencode.json"));
11820
+ function readProvisionedOpencodeModel(agentDir3) {
11821
+ return readOpencodeModelString(join3(agentDir3, "provision", "opencode.json"));
11822
11822
  }
11823
11823
  function readOpencodeModelString(configPath2) {
11824
11824
  try {
@@ -12756,13 +12756,39 @@ function creditWatchdogGiveUpCount(codeName, count) {
12756
12756
  giveUpCounts.set(codeName, (giveUpCounts.get(codeName) ?? 0) + count);
12757
12757
  }
12758
12758
 
12759
+ // src/lib/usage-limit-marker-file.ts
12760
+ import { mkdirSync as mkdirSync5, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
12761
+ import { homedir as homedir5 } from "os";
12762
+ import { join as join5 } from "path";
12763
+ function agentDir2(codeName) {
12764
+ return join5(homedir5(), ".augmented", codeName);
12765
+ }
12766
+ function usageLimitMarkerPath(codeName) {
12767
+ return join5(agentDir2(codeName), USAGE_LIMIT_MARKER_FILENAME);
12768
+ }
12769
+ function writeUsageLimitMarker(codeName, limitedUntil, log2) {
12770
+ try {
12771
+ mkdirSync5(agentDir2(codeName), { recursive: true });
12772
+ writeFileSync5(usageLimitMarkerPath(codeName), serializeUsageLimitMarker(limitedUntil), "utf-8");
12773
+ } catch (err) {
12774
+ log2(`[usage-banner] usage-limit marker sync failed for '${codeName}': ${err.message}`);
12775
+ }
12776
+ }
12777
+ function clearUsageLimitMarker(codeName, log2) {
12778
+ try {
12779
+ rmSync3(usageLimitMarkerPath(codeName), { force: true });
12780
+ } catch (err) {
12781
+ log2(`[usage-banner] usage-limit marker clear failed for '${codeName}': ${err.message}`);
12782
+ }
12783
+ }
12784
+
12759
12785
  // src/lib/persistent-session.ts
12760
12786
  var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
12761
12787
  function syncClaudeCredsToRoot() {
12762
12788
  if (platform() !== "linux") return true;
12763
12789
  if (typeof process.getuid !== "function" || process.getuid() !== 0) return true;
12764
12790
  for (const filename of [".credentials.json", "credentials.json"]) {
12765
- if (existsSync6(join5("/root/.claude", filename))) return true;
12791
+ if (existsSync6(join6("/root/.claude", filename))) return true;
12766
12792
  }
12767
12793
  let sourcePath = null;
12768
12794
  try {
@@ -12770,7 +12796,7 @@ function syncClaudeCredsToRoot() {
12770
12796
  outer: for (const entry of entries) {
12771
12797
  if (!entry.isDirectory()) continue;
12772
12798
  for (const filename of [".credentials.json", "credentials.json"]) {
12773
- const candidate = join5("/home", entry.name, ".claude", filename);
12799
+ const candidate = join6("/home", entry.name, ".claude", filename);
12774
12800
  if (existsSync6(candidate)) {
12775
12801
  sourcePath = candidate;
12776
12802
  break outer;
@@ -12782,9 +12808,9 @@ function syncClaudeCredsToRoot() {
12782
12808
  if (!sourcePath) return false;
12783
12809
  const targetDir = "/root/.claude";
12784
12810
  const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
12785
- const targetPath = join5(targetDir, sourceFilename);
12811
+ const targetPath = join6(targetDir, sourceFilename);
12786
12812
  try {
12787
- if (!existsSync6(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
12813
+ if (!existsSync6(targetDir)) mkdirSync6(targetDir, { recursive: true, mode: 448 });
12788
12814
  copyFileSync(sourcePath, targetPath);
12789
12815
  chmodSync3(targetPath, 384);
12790
12816
  return true;
@@ -12861,13 +12887,13 @@ function buildEgressAllowlist(toolsFrontmatter) {
12861
12887
  return [...domains].sort();
12862
12888
  }
12863
12889
  function egressAllowlistHostPath(codeName, homeDir) {
12864
- const home = homeDir ?? (process.env.HOME?.trim() || homedir5());
12865
- return join5(home, ".augmented", "_egress", `${codeName}.txt`);
12890
+ const home = homeDir ?? (process.env.HOME?.trim() || homedir6());
12891
+ return join6(home, ".augmented", "_egress", `${codeName}.txt`);
12866
12892
  }
12867
12893
  function writeEgressAllowlist(codeName, domains, homeDir) {
12868
12894
  const p2 = egressAllowlistHostPath(codeName, homeDir);
12869
- mkdirSync5(dirname3(p2), { recursive: true });
12870
- writeFileSync5(p2, domains.join("\n") + "\n", { mode: 420 });
12895
+ mkdirSync6(dirname3(p2), { recursive: true });
12896
+ writeFileSync6(p2, domains.join("\n") + "\n", { mode: 420 });
12871
12897
  return p2;
12872
12898
  }
12873
12899
  var EGRESS_DOCKER_TIMEOUT_MS = 1e4;
@@ -12903,13 +12929,13 @@ function restartEgressSidecar(codeName) {
12903
12929
  function buildDockerRunCommand(args) {
12904
12930
  const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
12905
12931
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
12906
- const agentDir2 = join5(homeDir, ".augmented", codeName);
12907
- const agentIdDir = join5(homeDir, ".augmented", agentId);
12908
- const mcpDir = join5(homeDir, ".augmented", "_mcp");
12909
- const claudeHome = join5(homeDir, ".claude");
12910
- const claudeJson = join5(homeDir, ".claude.json");
12932
+ const agentDir3 = join6(homeDir, ".augmented", codeName);
12933
+ const agentIdDir = join6(homeDir, ".augmented", agentId);
12934
+ const mcpDir = join6(homeDir, ".augmented", "_mcp");
12935
+ const claudeHome = join6(homeDir, ".claude");
12936
+ const claudeJson = join6(homeDir, ".claude.json");
12911
12937
  const mounts = [
12912
- `-v ${q(`${agentDir2}:${agentDir2}`)}`,
12938
+ `-v ${q(`${agentDir3}:${agentDir3}`)}`,
12913
12939
  `-v ${q(`${agentIdDir}:${agentIdDir}`)}`,
12914
12940
  `-v ${q(`${mcpDir}:${mcpDir}:ro`)}`,
12915
12941
  `-v ${q(`${claudeHome}:${claudeHome}`)}`,
@@ -12920,7 +12946,7 @@ function buildDockerRunCommand(args) {
12920
12946
  const cpus = process.env.AGT_ISOLATION_CPUS || "1.0";
12921
12947
  const pids = process.env.AGT_ISOLATION_PIDS || "512";
12922
12948
  const envArgs = [`-e ${q(`HOME=${homeDir}`)}`];
12923
- envArgs.push(`-e ${q(`npm_config_cache=${join5(agentDir2, ".npm-cache")}`)}`);
12949
+ envArgs.push(`-e ${q(`npm_config_cache=${join6(agentDir3, ".npm-cache")}`)}`);
12924
12950
  if (passApiKey) envArgs.push("-e ANTHROPIC_API_KEY");
12925
12951
  if (passOpenRouter) {
12926
12952
  envArgs.push("-e ANTHROPIC_BASE_URL");
@@ -12987,8 +13013,8 @@ function buildDockerRunCommand(args) {
12987
13013
  }
12988
13014
  function writePersistentClaudeWrapper(args) {
12989
13015
  const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
12990
- const envIntegrationsPath = join5(projectDir, ".env.integrations");
12991
- const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
13016
+ const envIntegrationsPath = join6(projectDir, ".env.integrations");
13017
+ const wrapperPath = join6(projectDir, ".claude", "persistent-claude.sh");
12992
13018
  const wrapperLines = [
12993
13019
  "#!/usr/bin/env bash",
12994
13020
  "set -e",
@@ -13007,8 +13033,8 @@ function writePersistentClaudeWrapper(args) {
13007
13033
  wrapperLines.push(
13008
13034
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
13009
13035
  );
13010
- mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
13011
- writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13036
+ mkdirSync6(join6(projectDir, ".claude"), { recursive: true });
13037
+ writeFileSync6(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13012
13038
  chmodSync3(wrapperPath, 448);
13013
13039
  return wrapperPath;
13014
13040
  }
@@ -13023,15 +13049,15 @@ function collectMcpServerNames(mcpConfigPath) {
13023
13049
  }
13024
13050
  }
13025
13051
  var sessions2 = /* @__PURE__ */ new Map();
13026
- var PANE_LOG_DIR = join5(homedir5(), ".augmented");
13052
+ var PANE_LOG_DIR = join6(homedir6(), ".augmented");
13027
13053
  var PANE_TAIL_LINES = 20;
13028
13054
  function paneLogPath(codeName) {
13029
- return join5(PANE_LOG_DIR, codeName, "pane.log");
13055
+ return join6(PANE_LOG_DIR, codeName, "pane.log");
13030
13056
  }
13031
13057
  function setupPaneLog2(tmuxSession, codeName, log2) {
13032
13058
  const logPath = paneLogPath(codeName);
13033
13059
  try {
13034
- mkdirSync5(dirname3(logPath), { recursive: true });
13060
+ mkdirSync6(dirname3(logPath), { recursive: true });
13035
13061
  appendFileSync2(
13036
13062
  logPath,
13037
13063
  `
@@ -13122,7 +13148,7 @@ function resolveSessionSpawnDecision(args) {
13122
13148
  };
13123
13149
  }
13124
13150
  function directChatSessionStatePath(agentId) {
13125
- return join5(homedir5(), ".augmented", agentId, "direct-chat-session.json");
13151
+ return join6(homedir6(), ".augmented", agentId, "direct-chat-session.json");
13126
13152
  }
13127
13153
  function readDirectChatSessionState(agentId) {
13128
13154
  try {
@@ -13137,8 +13163,8 @@ function readDirectChatSessionState(agentId) {
13137
13163
  }
13138
13164
  function writeDirectChatSessionState(agentId, state) {
13139
13165
  const p2 = directChatSessionStatePath(agentId);
13140
- mkdirSync5(dirname3(p2), { recursive: true });
13141
- writeFileSync5(p2, JSON.stringify(state));
13166
+ mkdirSync6(dirname3(p2), { recursive: true });
13167
+ writeFileSync6(p2, JSON.stringify(state));
13142
13168
  }
13143
13169
  function startPersistentSession(config) {
13144
13170
  const existing = sessions2.get(config.codeName);
@@ -13194,12 +13220,12 @@ function spawnSession(config, session) {
13194
13220
  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.`);
13195
13221
  }
13196
13222
  } else {
13197
- const claudeDir = join5(homedir5(), ".claude");
13223
+ const claudeDir = join6(homedir6(), ".claude");
13198
13224
  for (const filename of [".credentials.json", "credentials.json"]) {
13199
- const p2 = join5(claudeDir, filename);
13225
+ const p2 = join6(claudeDir, filename);
13200
13226
  if (existsSync6(p2)) {
13201
13227
  try {
13202
- rmSync3(p2, { force: true });
13228
+ rmSync4(p2, { force: true });
13203
13229
  log2(`[persistent-session] Removed ${p2} (api_key mode active \u2014 preventing OAuth fallback)`);
13204
13230
  } catch {
13205
13231
  }
@@ -13291,7 +13317,7 @@ function spawnSession(config, session) {
13291
13317
  if (config.notifyDispatchMode && config.notifyDispatchMode !== "off" && !process.env["AGT_NOTIFY_DISPATCH"]) {
13292
13318
  tmuxSessionEnvArgs.push("-e", `AGT_NOTIFY_DISPATCH=${config.notifyDispatchMode}`);
13293
13319
  }
13294
- const sessionHomeDir = process.env.HOME?.trim() || homedir5();
13320
+ const sessionHomeDir = process.env.HOME?.trim() || homedir6();
13295
13321
  let egress;
13296
13322
  if (egressMode(codeName) === "allowlist") {
13297
13323
  const allowlist = config.egressAllowlist ?? buildEgressAllowlist(null);
@@ -13330,7 +13356,7 @@ function spawnSession(config, session) {
13330
13356
  // Treat empty-string as missing too — `HOME=""` makes ~ resolve
13331
13357
  // to cwd, which is the same broken outcome as no HOME, just
13332
13358
  // better hidden.
13333
- HOME: process.env.HOME?.trim() || homedir5(),
13359
+ HOME: process.env.HOME?.trim() || homedir6(),
13334
13360
  USER: process.env.USER?.trim() || userInfo2().username
13335
13361
  };
13336
13362
  if (config.runId) {
@@ -13354,7 +13380,7 @@ function spawnSession(config, session) {
13354
13380
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
13355
13381
  for (const f of probeMcpEnvSubstitution({
13356
13382
  mcpConfigPath,
13357
- envIntegrationsPath: join5(projectDir, ".env.integrations"),
13383
+ envIntegrationsPath: join6(projectDir, ".env.integrations"),
13358
13384
  baseEnv: probeBaseEnv
13359
13385
  })) {
13360
13386
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -13383,6 +13409,7 @@ function spawnSession(config, session) {
13383
13409
  }
13384
13410
  log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
13385
13411
  setupPaneLog2(tmuxSession, codeName, log2);
13412
+ clearUsageLimitMarker(codeName, log2);
13386
13413
  session.currentSessionId = sessionId;
13387
13414
  acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
13388
13415
  });
@@ -13912,7 +13939,7 @@ async function stopAllSessionsAndWait(log2, opts) {
13912
13939
  await new Promise((resolve) => setTimeout(resolve, Math.min(opts.timeoutMs, 2e3)));
13913
13940
  }
13914
13941
  function getProjectDir(codeName) {
13915
- return join5(homedir5(), ".augmented", codeName, "project");
13942
+ return join6(homedir6(), ".augmented", codeName, "project");
13916
13943
  }
13917
13944
 
13918
13945
  export {
@@ -13999,8 +14026,6 @@ export {
13999
14026
  sumTranscriptUsageInWindow,
14000
14027
  isEmptyTotals,
14001
14028
  attributeTranscriptUsageByRun,
14002
- USAGE_LIMIT_MARKER_FILENAME,
14003
- serializeUsageLimitMarker,
14004
14029
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
14005
14030
  serializeAccountEnforcementMarker,
14006
14031
  KANBAN_CHECK_COMMAND,
@@ -14043,6 +14068,8 @@ export {
14043
14068
  checkChannelInputs,
14044
14069
  takeWatchdogGiveUpCount,
14045
14070
  creditWatchdogGiveUpCount,
14071
+ writeUsageLimitMarker,
14072
+ clearUsageLimitMarker,
14046
14073
  resolveOAuthCredAction,
14047
14074
  resolveClaudeBinary,
14048
14075
  isolationMode,
@@ -14081,4 +14108,4 @@ export {
14081
14108
  stopAllSessionsAndWait,
14082
14109
  getProjectDir
14083
14110
  };
14084
- //# sourceMappingURL=chunk-TTEKDLQ7.js.map
14111
+ //# sourceMappingURL=chunk-ZLFZXMNL.js.map