@integrity-labs/agt-cli 0.28.439 → 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-CM7DWCO4.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-MOASN7XT.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.439" : "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.439" : "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-MOASN7XT.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.439" : "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-CM7DWCO4.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 readFileSync7, 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";
@@ -8465,6 +8465,27 @@ function serializeUsageLimitMarker(limitedUntil) {
8465
8465
  };
8466
8466
  return JSON.stringify(marker);
8467
8467
  }
8468
+ function parseUsageLimitMarker(raw) {
8469
+ let parsed;
8470
+ try {
8471
+ parsed = JSON.parse(raw);
8472
+ } catch {
8473
+ return null;
8474
+ }
8475
+ if (typeof parsed !== "object" || parsed === null || parsed.version !== USAGE_LIMIT_MARKER_VERSION) {
8476
+ return null;
8477
+ }
8478
+ const until = parsed.limited_until;
8479
+ if (typeof until !== "string" || !Number.isFinite(Date.parse(until)))
8480
+ return null;
8481
+ return { version: USAGE_LIMIT_MARKER_VERSION, limited_until: until };
8482
+ }
8483
+ function resolveUsageLimitUntil(marker, now) {
8484
+ if (!marker)
8485
+ return null;
8486
+ const until = new Date(marker.limited_until);
8487
+ return until.getTime() > now.getTime() ? until : null;
8488
+ }
8468
8489
 
8469
8490
  // ../../packages/core/dist/account-enforcement/marker.js
8470
8491
  var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
@@ -11838,8 +11859,8 @@ function stopTranscriptRefresher(codeName) {
11838
11859
  transcriptTimers.delete(codeName);
11839
11860
  }
11840
11861
  }
11841
- function readProvisionedOpencodeModel(agentDir3) {
11842
- return readOpencodeModelString(join3(agentDir3, "provision", "opencode.json"));
11862
+ function readProvisionedOpencodeModel(agentDir2) {
11863
+ return readOpencodeModelString(join3(agentDir2, "provision", "opencode.json"));
11843
11864
  }
11844
11865
  function readOpencodeModelString(configPath2) {
11845
11866
  try {
@@ -12777,39 +12798,13 @@ function creditWatchdogGiveUpCount(codeName, count) {
12777
12798
  giveUpCounts.set(codeName, (giveUpCounts.get(codeName) ?? 0) + count);
12778
12799
  }
12779
12800
 
12780
- // src/lib/usage-limit-marker-file.ts
12781
- import { mkdirSync as mkdirSync5, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
12782
- import { homedir as homedir5 } from "os";
12783
- import { join as join5 } from "path";
12784
- function agentDir2(codeName) {
12785
- return join5(homedir5(), ".augmented", codeName);
12786
- }
12787
- function usageLimitMarkerPath(codeName) {
12788
- return join5(agentDir2(codeName), USAGE_LIMIT_MARKER_FILENAME);
12789
- }
12790
- function writeUsageLimitMarker(codeName, limitedUntil, log2) {
12791
- try {
12792
- mkdirSync5(agentDir2(codeName), { recursive: true });
12793
- writeFileSync5(usageLimitMarkerPath(codeName), serializeUsageLimitMarker(limitedUntil), "utf-8");
12794
- } catch (err) {
12795
- log2(`[usage-banner] usage-limit marker sync failed for '${codeName}': ${err.message}`);
12796
- }
12797
- }
12798
- function clearUsageLimitMarker(codeName, log2) {
12799
- try {
12800
- rmSync3(usageLimitMarkerPath(codeName), { force: true });
12801
- } catch (err) {
12802
- log2(`[usage-banner] usage-limit marker clear failed for '${codeName}': ${err.message}`);
12803
- }
12804
- }
12805
-
12806
12801
  // src/lib/persistent-session.ts
12807
12802
  var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
12808
12803
  function syncClaudeCredsToRoot() {
12809
12804
  if (platform() !== "linux") return true;
12810
12805
  if (typeof process.getuid !== "function" || process.getuid() !== 0) return true;
12811
12806
  for (const filename of [".credentials.json", "credentials.json"]) {
12812
- if (existsSync6(join6("/root/.claude", filename))) return true;
12807
+ if (existsSync6(join5("/root/.claude", filename))) return true;
12813
12808
  }
12814
12809
  let sourcePath = null;
12815
12810
  try {
@@ -12817,7 +12812,7 @@ function syncClaudeCredsToRoot() {
12817
12812
  outer: for (const entry of entries) {
12818
12813
  if (!entry.isDirectory()) continue;
12819
12814
  for (const filename of [".credentials.json", "credentials.json"]) {
12820
- const candidate = join6("/home", entry.name, ".claude", filename);
12815
+ const candidate = join5("/home", entry.name, ".claude", filename);
12821
12816
  if (existsSync6(candidate)) {
12822
12817
  sourcePath = candidate;
12823
12818
  break outer;
@@ -12829,9 +12824,9 @@ function syncClaudeCredsToRoot() {
12829
12824
  if (!sourcePath) return false;
12830
12825
  const targetDir = "/root/.claude";
12831
12826
  const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
12832
- const targetPath = join6(targetDir, sourceFilename);
12827
+ const targetPath = join5(targetDir, sourceFilename);
12833
12828
  try {
12834
- if (!existsSync6(targetDir)) mkdirSync6(targetDir, { recursive: true, mode: 448 });
12829
+ if (!existsSync6(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
12835
12830
  copyFileSync(sourcePath, targetPath);
12836
12831
  chmodSync3(targetPath, 384);
12837
12832
  return true;
@@ -12908,13 +12903,13 @@ function buildEgressAllowlist(toolsFrontmatter) {
12908
12903
  return [...domains].sort();
12909
12904
  }
12910
12905
  function egressAllowlistHostPath(codeName, homeDir) {
12911
- const home = homeDir ?? (process.env.HOME?.trim() || homedir6());
12912
- return join6(home, ".augmented", "_egress", `${codeName}.txt`);
12906
+ const home = homeDir ?? (process.env.HOME?.trim() || homedir5());
12907
+ return join5(home, ".augmented", "_egress", `${codeName}.txt`);
12913
12908
  }
12914
12909
  function writeEgressAllowlist(codeName, domains, homeDir) {
12915
12910
  const p2 = egressAllowlistHostPath(codeName, homeDir);
12916
- mkdirSync6(dirname3(p2), { recursive: true });
12917
- writeFileSync6(p2, domains.join("\n") + "\n", { mode: 420 });
12911
+ mkdirSync5(dirname3(p2), { recursive: true });
12912
+ writeFileSync5(p2, domains.join("\n") + "\n", { mode: 420 });
12918
12913
  return p2;
12919
12914
  }
12920
12915
  var EGRESS_DOCKER_TIMEOUT_MS = 1e4;
@@ -12950,13 +12945,13 @@ function restartEgressSidecar(codeName) {
12950
12945
  function buildDockerRunCommand(args) {
12951
12946
  const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
12952
12947
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
12953
- const agentDir3 = join6(homeDir, ".augmented", codeName);
12954
- const agentIdDir = join6(homeDir, ".augmented", agentId);
12955
- const mcpDir = join6(homeDir, ".augmented", "_mcp");
12956
- const claudeHome = join6(homeDir, ".claude");
12957
- 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");
12958
12953
  const mounts = [
12959
- `-v ${q(`${agentDir3}:${agentDir3}`)}`,
12954
+ `-v ${q(`${agentDir2}:${agentDir2}`)}`,
12960
12955
  `-v ${q(`${agentIdDir}:${agentIdDir}`)}`,
12961
12956
  `-v ${q(`${mcpDir}:${mcpDir}:ro`)}`,
12962
12957
  `-v ${q(`${claudeHome}:${claudeHome}`)}`,
@@ -12967,7 +12962,7 @@ function buildDockerRunCommand(args) {
12967
12962
  const cpus = process.env.AGT_ISOLATION_CPUS || "1.0";
12968
12963
  const pids = process.env.AGT_ISOLATION_PIDS || "512";
12969
12964
  const envArgs = [`-e ${q(`HOME=${homeDir}`)}`];
12970
- envArgs.push(`-e ${q(`npm_config_cache=${join6(agentDir3, ".npm-cache")}`)}`);
12965
+ envArgs.push(`-e ${q(`npm_config_cache=${join5(agentDir2, ".npm-cache")}`)}`);
12971
12966
  if (passApiKey) envArgs.push("-e ANTHROPIC_API_KEY");
12972
12967
  if (passOpenRouter) {
12973
12968
  envArgs.push("-e ANTHROPIC_BASE_URL");
@@ -13034,8 +13029,8 @@ function buildDockerRunCommand(args) {
13034
13029
  }
13035
13030
  function writePersistentClaudeWrapper(args) {
13036
13031
  const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
13037
- const envIntegrationsPath = join6(projectDir, ".env.integrations");
13038
- const wrapperPath = join6(projectDir, ".claude", "persistent-claude.sh");
13032
+ const envIntegrationsPath = join5(projectDir, ".env.integrations");
13033
+ const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
13039
13034
  const wrapperLines = [
13040
13035
  "#!/usr/bin/env bash",
13041
13036
  "set -e",
@@ -13054,8 +13049,8 @@ function writePersistentClaudeWrapper(args) {
13054
13049
  wrapperLines.push(
13055
13050
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
13056
13051
  );
13057
- mkdirSync6(join6(projectDir, ".claude"), { recursive: true });
13058
- writeFileSync6(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13052
+ mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
13053
+ writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13059
13054
  chmodSync3(wrapperPath, 448);
13060
13055
  return wrapperPath;
13061
13056
  }
@@ -13070,15 +13065,15 @@ function collectMcpServerNames(mcpConfigPath) {
13070
13065
  }
13071
13066
  }
13072
13067
  var sessions2 = /* @__PURE__ */ new Map();
13073
- var PANE_LOG_DIR = join6(homedir6(), ".augmented");
13068
+ var PANE_LOG_DIR = join5(homedir5(), ".augmented");
13074
13069
  var PANE_TAIL_LINES = 20;
13075
13070
  function paneLogPath(codeName) {
13076
- return join6(PANE_LOG_DIR, codeName, "pane.log");
13071
+ return join5(PANE_LOG_DIR, codeName, "pane.log");
13077
13072
  }
13078
13073
  function setupPaneLog2(tmuxSession, codeName, log2) {
13079
13074
  const logPath = paneLogPath(codeName);
13080
13075
  try {
13081
- mkdirSync6(dirname3(logPath), { recursive: true });
13076
+ mkdirSync5(dirname3(logPath), { recursive: true });
13082
13077
  appendFileSync2(
13083
13078
  logPath,
13084
13079
  `
@@ -13169,7 +13164,7 @@ function resolveSessionSpawnDecision(args) {
13169
13164
  };
13170
13165
  }
13171
13166
  function directChatSessionStatePath(agentId) {
13172
- return join6(homedir6(), ".augmented", agentId, "direct-chat-session.json");
13167
+ return join5(homedir5(), ".augmented", agentId, "direct-chat-session.json");
13173
13168
  }
13174
13169
  function readDirectChatSessionState(agentId) {
13175
13170
  try {
@@ -13184,8 +13179,8 @@ function readDirectChatSessionState(agentId) {
13184
13179
  }
13185
13180
  function writeDirectChatSessionState(agentId, state) {
13186
13181
  const p2 = directChatSessionStatePath(agentId);
13187
- mkdirSync6(dirname3(p2), { recursive: true });
13188
- writeFileSync6(p2, JSON.stringify(state));
13182
+ mkdirSync5(dirname3(p2), { recursive: true });
13183
+ writeFileSync5(p2, JSON.stringify(state));
13189
13184
  }
13190
13185
  function startPersistentSession(config) {
13191
13186
  const existing = sessions2.get(config.codeName);
@@ -13241,12 +13236,12 @@ function spawnSession(config, session) {
13241
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.`);
13242
13237
  }
13243
13238
  } else {
13244
- const claudeDir = join6(homedir6(), ".claude");
13239
+ const claudeDir = join5(homedir5(), ".claude");
13245
13240
  for (const filename of [".credentials.json", "credentials.json"]) {
13246
- const p2 = join6(claudeDir, filename);
13241
+ const p2 = join5(claudeDir, filename);
13247
13242
  if (existsSync6(p2)) {
13248
13243
  try {
13249
- rmSync4(p2, { force: true });
13244
+ rmSync3(p2, { force: true });
13250
13245
  log2(`[persistent-session] Removed ${p2} (api_key mode active \u2014 preventing OAuth fallback)`);
13251
13246
  } catch {
13252
13247
  }
@@ -13338,7 +13333,7 @@ function spawnSession(config, session) {
13338
13333
  if (config.notifyDispatchMode && config.notifyDispatchMode !== "off" && !process.env["AGT_NOTIFY_DISPATCH"]) {
13339
13334
  tmuxSessionEnvArgs.push("-e", `AGT_NOTIFY_DISPATCH=${config.notifyDispatchMode}`);
13340
13335
  }
13341
- const sessionHomeDir = process.env.HOME?.trim() || homedir6();
13336
+ const sessionHomeDir = process.env.HOME?.trim() || homedir5();
13342
13337
  let egress;
13343
13338
  if (egressMode(codeName) === "allowlist") {
13344
13339
  const allowlist = config.egressAllowlist ?? buildEgressAllowlist(null);
@@ -13377,7 +13372,7 @@ function spawnSession(config, session) {
13377
13372
  // Treat empty-string as missing too — `HOME=""` makes ~ resolve
13378
13373
  // to cwd, which is the same broken outcome as no HOME, just
13379
13374
  // better hidden.
13380
- HOME: process.env.HOME?.trim() || homedir6(),
13375
+ HOME: process.env.HOME?.trim() || homedir5(),
13381
13376
  USER: process.env.USER?.trim() || userInfo2().username
13382
13377
  };
13383
13378
  if (config.runId) {
@@ -13401,7 +13396,7 @@ function spawnSession(config, session) {
13401
13396
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
13402
13397
  for (const f of probeMcpEnvSubstitution({
13403
13398
  mcpConfigPath,
13404
- envIntegrationsPath: join6(projectDir, ".env.integrations"),
13399
+ envIntegrationsPath: join5(projectDir, ".env.integrations"),
13405
13400
  baseEnv: probeBaseEnv
13406
13401
  })) {
13407
13402
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -13430,7 +13425,6 @@ function spawnSession(config, session) {
13430
13425
  }
13431
13426
  log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
13432
13427
  setupPaneLog2(tmuxSession, codeName, log2);
13433
- clearUsageLimitMarker(codeName, log2);
13434
13428
  session.currentSessionId = sessionId;
13435
13429
  acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
13436
13430
  });
@@ -13960,7 +13954,7 @@ async function stopAllSessionsAndWait(log2, opts) {
13960
13954
  await new Promise((resolve) => setTimeout(resolve, Math.min(opts.timeoutMs, 2e3)));
13961
13955
  }
13962
13956
  function getProjectDir(codeName) {
13963
- return join6(homedir6(), ".augmented", codeName, "project");
13957
+ return join5(homedir5(), ".augmented", codeName, "project");
13964
13958
  }
13965
13959
 
13966
13960
  export {
@@ -14047,6 +14041,10 @@ export {
14047
14041
  sumTranscriptUsageInWindow,
14048
14042
  isEmptyTotals,
14049
14043
  attributeTranscriptUsageByRun,
14044
+ USAGE_LIMIT_MARKER_FILENAME,
14045
+ serializeUsageLimitMarker,
14046
+ parseUsageLimitMarker,
14047
+ resolveUsageLimitUntil,
14050
14048
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
14051
14049
  serializeAccountEnforcementMarker,
14052
14050
  KANBAN_CHECK_COMMAND,
@@ -14089,8 +14087,6 @@ export {
14089
14087
  checkChannelInputs,
14090
14088
  takeWatchdogGiveUpCount,
14091
14089
  creditWatchdogGiveUpCount,
14092
- writeUsageLimitMarker,
14093
- clearUsageLimitMarker,
14094
14090
  resolveOAuthCredAction,
14095
14091
  resolveClaudeBinary,
14096
14092
  isolationMode,
@@ -14129,4 +14125,4 @@ export {
14129
14125
  stopAllSessionsAndWait,
14130
14126
  getProjectDir
14131
14127
  };
14132
- //# sourceMappingURL=chunk-MOASN7XT.js.map
14128
+ //# sourceMappingURL=chunk-NQP2W2RD.js.map