@integrity-labs/agt-cli 0.28.433 → 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.
@@ -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";
@@ -50,103 +50,6 @@ function sanitizeMcpJson(mcpConfigPath, apiHost) {
50
50
  }
51
51
  }
52
52
 
53
- // src/lib/claude-tools.ts
54
- var BASE_TOOLS = ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "Agent", "Skill", "ToolSearch"];
55
- function buildAllowedTools(mcpServerNames) {
56
- const mcpPatterns = mcpServerNames.map((name) => `mcp__${name.replace(/-/g, "_")}__*`);
57
- return [...mcpPatterns, ...BASE_TOOLS].join(",");
58
- }
59
-
60
- // src/lib/mcp-env-probe.ts
61
- import { existsSync, readFileSync as readFileSync2 } from "fs";
62
- var LATE_BOUND_VARS = /* @__PURE__ */ new Set([
63
- "AGT_RUN_ID",
64
- "AGT_TOKEN",
65
- "ANCHOR_BROWSER_SESSION_ID"
66
- ]);
67
- var TEMPLATE_VAR_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
68
- function collectVarsFromValue(value, into) {
69
- if (typeof value === "string") {
70
- for (const m of value.matchAll(TEMPLATE_VAR_RE)) into.add(m[1]);
71
- } else if (Array.isArray(value)) {
72
- for (const v of value) collectVarsFromValue(v, into);
73
- }
74
- }
75
- function findMissingSubstitutionVars(mcpConfig, env2) {
76
- const findings = [];
77
- if (typeof mcpConfig !== "object" || mcpConfig === null) return findings;
78
- const servers = mcpConfig.mcpServers;
79
- if (typeof servers !== "object" || servers === null) return findings;
80
- for (const [server, raw] of Object.entries(servers)) {
81
- if (typeof raw !== "object" || raw === null) continue;
82
- const entry = raw;
83
- const vars = /* @__PURE__ */ new Set();
84
- collectVarsFromValue(entry["command"], vars);
85
- collectVarsFromValue(entry["args"], vars);
86
- collectVarsFromValue(entry["url"], vars);
87
- for (const block of [entry["env"], entry["headers"]]) {
88
- if (typeof block !== "object" || block === null) continue;
89
- for (const v of Object.values(block)) collectVarsFromValue(v, vars);
90
- }
91
- for (const varName of vars) {
92
- if (LATE_BOUND_VARS.has(varName)) continue;
93
- const value = env2[varName];
94
- if (value === void 0) {
95
- findings.push({ varName, server, state: "unset" });
96
- } else if (value.trim() === "") {
97
- findings.push({ varName, server, state: "empty" });
98
- }
99
- }
100
- }
101
- return findings;
102
- }
103
- function formatMissingVar(f) {
104
- return `[mcp-env-substitution] missing var=${f.varName} server=${f.server} state=${f.state}`;
105
- }
106
- function expandTemplateVars(value, env2) {
107
- const unresolved = /* @__PURE__ */ new Set();
108
- const expanded = value.replace(TEMPLATE_VAR_RE, (literal, name) => {
109
- if (LATE_BOUND_VARS.has(name)) {
110
- unresolved.add(name);
111
- return literal;
112
- }
113
- const resolved = env2[name];
114
- if (resolved !== void 0 && resolved.trim() !== "") return resolved;
115
- unresolved.add(name);
116
- return literal;
117
- });
118
- return { value: expanded, unresolved: [...unresolved] };
119
- }
120
- function parseEnvIntegrations(content) {
121
- const out = {};
122
- for (const line2 of content.split("\n")) {
123
- if (!line2 || line2.startsWith("#") || !line2.includes("=")) continue;
124
- const eqIdx = line2.indexOf("=");
125
- const key = line2.slice(0, eqIdx);
126
- let value = line2.slice(eqIdx + 1);
127
- if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
128
- value = value.slice(1, -1).replaceAll("'\\''", "'");
129
- }
130
- out[key] = value;
131
- }
132
- return out;
133
- }
134
- function probeMcpEnvSubstitution(args) {
135
- try {
136
- const config = JSON.parse(readFileSync2(args.mcpConfigPath, "utf-8"));
137
- let env2 = args.baseEnv;
138
- if (args.envIntegrationsPath && existsSync(args.envIntegrationsPath)) {
139
- env2 = {
140
- ...args.baseEnv,
141
- ...parseEnvIntegrations(readFileSync2(args.envIntegrationsPath, "utf-8"))
142
- };
143
- }
144
- return findMissingSubstitutionVars(config, env2);
145
- } catch {
146
- return [];
147
- }
148
- }
149
-
150
53
  // ../../packages/core/dist/types/agent.js
151
54
  var DEFAULT_FRAMEWORK = "claude-code";
152
55
  var FRAMEWORK_DEPRECATION = {
@@ -4075,6 +3978,22 @@ ${frontmatter.environment === "prod" ? "- Production environment: exercise extra
4075
3978
  return body;
4076
3979
  }
4077
3980
 
3981
+ // ../../packages/core/dist/provisioning/mcp-tool-patterns.js
3982
+ function sanitizeMcpName(name) {
3983
+ return name.replace(/-/g, "_");
3984
+ }
3985
+ function mcpWildcardsForServer(serverKey) {
3986
+ const raw = `mcp__${serverKey}__*`;
3987
+ const sanitized = `mcp__${sanitizeMcpName(serverKey)}__*`;
3988
+ return sanitized === raw ? [raw] : [raw, sanitized];
3989
+ }
3990
+ function mcpWildcardsForServers(serverKeys) {
3991
+ return Array.from(new Set(serverKeys.flatMap((k) => mcpWildcardsForServer(k))));
3992
+ }
3993
+ function requiredMcpWildcard(serverKey) {
3994
+ return `mcp__${serverKey}__*`;
3995
+ }
3996
+
4078
3997
  // ../../packages/core/dist/integrations/context-validator.js
4079
3998
  import Ajv20202 from "ajv/dist/2020.js";
4080
3999
  import addFormats2 from "ajv-formats";
@@ -9919,6 +9838,102 @@ function computeFlagsSchemaVersion() {
9919
9838
  }
9920
9839
  var FLAGS_SCHEMA_VERSION = computeFlagsSchemaVersion();
9921
9840
 
9841
+ // src/lib/claude-tools.ts
9842
+ var BASE_TOOLS = ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "Agent", "Skill", "ToolSearch"];
9843
+ function buildAllowedTools(mcpServerNames) {
9844
+ return [...mcpWildcardsForServers(mcpServerNames), ...BASE_TOOLS].join(",");
9845
+ }
9846
+
9847
+ // src/lib/mcp-env-probe.ts
9848
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
9849
+ var LATE_BOUND_VARS = /* @__PURE__ */ new Set([
9850
+ "AGT_RUN_ID",
9851
+ "AGT_TOKEN",
9852
+ "ANCHOR_BROWSER_SESSION_ID"
9853
+ ]);
9854
+ var TEMPLATE_VAR_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
9855
+ function collectVarsFromValue(value, into) {
9856
+ if (typeof value === "string") {
9857
+ for (const m of value.matchAll(TEMPLATE_VAR_RE)) into.add(m[1]);
9858
+ } else if (Array.isArray(value)) {
9859
+ for (const v of value) collectVarsFromValue(v, into);
9860
+ }
9861
+ }
9862
+ function findMissingSubstitutionVars(mcpConfig, env2) {
9863
+ const findings = [];
9864
+ if (typeof mcpConfig !== "object" || mcpConfig === null) return findings;
9865
+ const servers = mcpConfig.mcpServers;
9866
+ if (typeof servers !== "object" || servers === null) return findings;
9867
+ for (const [server, raw] of Object.entries(servers)) {
9868
+ if (typeof raw !== "object" || raw === null) continue;
9869
+ const entry = raw;
9870
+ const vars = /* @__PURE__ */ new Set();
9871
+ collectVarsFromValue(entry["command"], vars);
9872
+ collectVarsFromValue(entry["args"], vars);
9873
+ collectVarsFromValue(entry["url"], vars);
9874
+ for (const block of [entry["env"], entry["headers"]]) {
9875
+ if (typeof block !== "object" || block === null) continue;
9876
+ for (const v of Object.values(block)) collectVarsFromValue(v, vars);
9877
+ }
9878
+ for (const varName of vars) {
9879
+ if (LATE_BOUND_VARS.has(varName)) continue;
9880
+ const value = env2[varName];
9881
+ if (value === void 0) {
9882
+ findings.push({ varName, server, state: "unset" });
9883
+ } else if (value.trim() === "") {
9884
+ findings.push({ varName, server, state: "empty" });
9885
+ }
9886
+ }
9887
+ }
9888
+ return findings;
9889
+ }
9890
+ function formatMissingVar(f) {
9891
+ return `[mcp-env-substitution] missing var=${f.varName} server=${f.server} state=${f.state}`;
9892
+ }
9893
+ function expandTemplateVars(value, env2) {
9894
+ const unresolved = /* @__PURE__ */ new Set();
9895
+ const expanded = value.replace(TEMPLATE_VAR_RE, (literal, name) => {
9896
+ if (LATE_BOUND_VARS.has(name)) {
9897
+ unresolved.add(name);
9898
+ return literal;
9899
+ }
9900
+ const resolved = env2[name];
9901
+ if (resolved !== void 0 && resolved.trim() !== "") return resolved;
9902
+ unresolved.add(name);
9903
+ return literal;
9904
+ });
9905
+ return { value: expanded, unresolved: [...unresolved] };
9906
+ }
9907
+ function parseEnvIntegrations(content) {
9908
+ const out = {};
9909
+ for (const line2 of content.split("\n")) {
9910
+ if (!line2 || line2.startsWith("#") || !line2.includes("=")) continue;
9911
+ const eqIdx = line2.indexOf("=");
9912
+ const key = line2.slice(0, eqIdx);
9913
+ let value = line2.slice(eqIdx + 1);
9914
+ if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
9915
+ value = value.slice(1, -1).replaceAll("'\\''", "'");
9916
+ }
9917
+ out[key] = value;
9918
+ }
9919
+ return out;
9920
+ }
9921
+ function probeMcpEnvSubstitution(args) {
9922
+ try {
9923
+ const config = JSON.parse(readFileSync2(args.mcpConfigPath, "utf-8"));
9924
+ let env2 = args.baseEnv;
9925
+ if (args.envIntegrationsPath && existsSync(args.envIntegrationsPath)) {
9926
+ env2 = {
9927
+ ...args.baseEnv,
9928
+ ...parseEnvIntegrations(readFileSync2(args.envIntegrationsPath, "utf-8"))
9929
+ };
9930
+ }
9931
+ return findMissingSubstitutionVars(config, env2);
9932
+ } catch {
9933
+ return [];
9934
+ }
9935
+ }
9936
+
9922
9937
  // src/lib/opencode-session.ts
9923
9938
  import { spawn, execSync } from "child_process";
9924
9939
  import { createServer } from "net";
@@ -11802,8 +11817,8 @@ function stopTranscriptRefresher(codeName) {
11802
11817
  transcriptTimers.delete(codeName);
11803
11818
  }
11804
11819
  }
11805
- function readProvisionedOpencodeModel(agentDir2) {
11806
- return readOpencodeModelString(join3(agentDir2, "provision", "opencode.json"));
11820
+ function readProvisionedOpencodeModel(agentDir3) {
11821
+ return readOpencodeModelString(join3(agentDir3, "provision", "opencode.json"));
11807
11822
  }
11808
11823
  function readOpencodeModelString(configPath2) {
11809
11824
  try {
@@ -12741,13 +12756,39 @@ function creditWatchdogGiveUpCount(codeName, count) {
12741
12756
  giveUpCounts.set(codeName, (giveUpCounts.get(codeName) ?? 0) + count);
12742
12757
  }
12743
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
+
12744
12785
  // src/lib/persistent-session.ts
12745
12786
  var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
12746
12787
  function syncClaudeCredsToRoot() {
12747
12788
  if (platform() !== "linux") return true;
12748
12789
  if (typeof process.getuid !== "function" || process.getuid() !== 0) return true;
12749
12790
  for (const filename of [".credentials.json", "credentials.json"]) {
12750
- if (existsSync6(join5("/root/.claude", filename))) return true;
12791
+ if (existsSync6(join6("/root/.claude", filename))) return true;
12751
12792
  }
12752
12793
  let sourcePath = null;
12753
12794
  try {
@@ -12755,7 +12796,7 @@ function syncClaudeCredsToRoot() {
12755
12796
  outer: for (const entry of entries) {
12756
12797
  if (!entry.isDirectory()) continue;
12757
12798
  for (const filename of [".credentials.json", "credentials.json"]) {
12758
- const candidate = join5("/home", entry.name, ".claude", filename);
12799
+ const candidate = join6("/home", entry.name, ".claude", filename);
12759
12800
  if (existsSync6(candidate)) {
12760
12801
  sourcePath = candidate;
12761
12802
  break outer;
@@ -12767,9 +12808,9 @@ function syncClaudeCredsToRoot() {
12767
12808
  if (!sourcePath) return false;
12768
12809
  const targetDir = "/root/.claude";
12769
12810
  const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
12770
- const targetPath = join5(targetDir, sourceFilename);
12811
+ const targetPath = join6(targetDir, sourceFilename);
12771
12812
  try {
12772
- if (!existsSync6(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
12813
+ if (!existsSync6(targetDir)) mkdirSync6(targetDir, { recursive: true, mode: 448 });
12773
12814
  copyFileSync(sourcePath, targetPath);
12774
12815
  chmodSync3(targetPath, 384);
12775
12816
  return true;
@@ -12846,13 +12887,13 @@ function buildEgressAllowlist(toolsFrontmatter) {
12846
12887
  return [...domains].sort();
12847
12888
  }
12848
12889
  function egressAllowlistHostPath(codeName, homeDir) {
12849
- const home = homeDir ?? (process.env.HOME?.trim() || homedir5());
12850
- return join5(home, ".augmented", "_egress", `${codeName}.txt`);
12890
+ const home = homeDir ?? (process.env.HOME?.trim() || homedir6());
12891
+ return join6(home, ".augmented", "_egress", `${codeName}.txt`);
12851
12892
  }
12852
12893
  function writeEgressAllowlist(codeName, domains, homeDir) {
12853
12894
  const p2 = egressAllowlistHostPath(codeName, homeDir);
12854
- mkdirSync5(dirname3(p2), { recursive: true });
12855
- writeFileSync5(p2, domains.join("\n") + "\n", { mode: 420 });
12895
+ mkdirSync6(dirname3(p2), { recursive: true });
12896
+ writeFileSync6(p2, domains.join("\n") + "\n", { mode: 420 });
12856
12897
  return p2;
12857
12898
  }
12858
12899
  var EGRESS_DOCKER_TIMEOUT_MS = 1e4;
@@ -12888,13 +12929,13 @@ function restartEgressSidecar(codeName) {
12888
12929
  function buildDockerRunCommand(args) {
12889
12930
  const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
12890
12931
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
12891
- const agentDir2 = join5(homeDir, ".augmented", codeName);
12892
- const agentIdDir = join5(homeDir, ".augmented", agentId);
12893
- const mcpDir = join5(homeDir, ".augmented", "_mcp");
12894
- const claudeHome = join5(homeDir, ".claude");
12895
- 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");
12896
12937
  const mounts = [
12897
- `-v ${q(`${agentDir2}:${agentDir2}`)}`,
12938
+ `-v ${q(`${agentDir3}:${agentDir3}`)}`,
12898
12939
  `-v ${q(`${agentIdDir}:${agentIdDir}`)}`,
12899
12940
  `-v ${q(`${mcpDir}:${mcpDir}:ro`)}`,
12900
12941
  `-v ${q(`${claudeHome}:${claudeHome}`)}`,
@@ -12905,7 +12946,7 @@ function buildDockerRunCommand(args) {
12905
12946
  const cpus = process.env.AGT_ISOLATION_CPUS || "1.0";
12906
12947
  const pids = process.env.AGT_ISOLATION_PIDS || "512";
12907
12948
  const envArgs = [`-e ${q(`HOME=${homeDir}`)}`];
12908
- envArgs.push(`-e ${q(`npm_config_cache=${join5(agentDir2, ".npm-cache")}`)}`);
12949
+ envArgs.push(`-e ${q(`npm_config_cache=${join6(agentDir3, ".npm-cache")}`)}`);
12909
12950
  if (passApiKey) envArgs.push("-e ANTHROPIC_API_KEY");
12910
12951
  if (passOpenRouter) {
12911
12952
  envArgs.push("-e ANTHROPIC_BASE_URL");
@@ -12972,8 +13013,8 @@ function buildDockerRunCommand(args) {
12972
13013
  }
12973
13014
  function writePersistentClaudeWrapper(args) {
12974
13015
  const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
12975
- const envIntegrationsPath = join5(projectDir, ".env.integrations");
12976
- const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
13016
+ const envIntegrationsPath = join6(projectDir, ".env.integrations");
13017
+ const wrapperPath = join6(projectDir, ".claude", "persistent-claude.sh");
12977
13018
  const wrapperLines = [
12978
13019
  "#!/usr/bin/env bash",
12979
13020
  "set -e",
@@ -12992,8 +13033,8 @@ function writePersistentClaudeWrapper(args) {
12992
13033
  wrapperLines.push(
12993
13034
  `exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
12994
13035
  );
12995
- mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
12996
- writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
13036
+ mkdirSync6(join6(projectDir, ".claude"), { recursive: true });
13037
+ writeFileSync6(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
12997
13038
  chmodSync3(wrapperPath, 448);
12998
13039
  return wrapperPath;
12999
13040
  }
@@ -13008,15 +13049,15 @@ function collectMcpServerNames(mcpConfigPath) {
13008
13049
  }
13009
13050
  }
13010
13051
  var sessions2 = /* @__PURE__ */ new Map();
13011
- var PANE_LOG_DIR = join5(homedir5(), ".augmented");
13052
+ var PANE_LOG_DIR = join6(homedir6(), ".augmented");
13012
13053
  var PANE_TAIL_LINES = 20;
13013
13054
  function paneLogPath(codeName) {
13014
- return join5(PANE_LOG_DIR, codeName, "pane.log");
13055
+ return join6(PANE_LOG_DIR, codeName, "pane.log");
13015
13056
  }
13016
13057
  function setupPaneLog2(tmuxSession, codeName, log2) {
13017
13058
  const logPath = paneLogPath(codeName);
13018
13059
  try {
13019
- mkdirSync5(dirname3(logPath), { recursive: true });
13060
+ mkdirSync6(dirname3(logPath), { recursive: true });
13020
13061
  appendFileSync2(
13021
13062
  logPath,
13022
13063
  `
@@ -13107,7 +13148,7 @@ function resolveSessionSpawnDecision(args) {
13107
13148
  };
13108
13149
  }
13109
13150
  function directChatSessionStatePath(agentId) {
13110
- return join5(homedir5(), ".augmented", agentId, "direct-chat-session.json");
13151
+ return join6(homedir6(), ".augmented", agentId, "direct-chat-session.json");
13111
13152
  }
13112
13153
  function readDirectChatSessionState(agentId) {
13113
13154
  try {
@@ -13122,8 +13163,8 @@ function readDirectChatSessionState(agentId) {
13122
13163
  }
13123
13164
  function writeDirectChatSessionState(agentId, state) {
13124
13165
  const p2 = directChatSessionStatePath(agentId);
13125
- mkdirSync5(dirname3(p2), { recursive: true });
13126
- writeFileSync5(p2, JSON.stringify(state));
13166
+ mkdirSync6(dirname3(p2), { recursive: true });
13167
+ writeFileSync6(p2, JSON.stringify(state));
13127
13168
  }
13128
13169
  function startPersistentSession(config) {
13129
13170
  const existing = sessions2.get(config.codeName);
@@ -13179,12 +13220,12 @@ function spawnSession(config, session) {
13179
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.`);
13180
13221
  }
13181
13222
  } else {
13182
- const claudeDir = join5(homedir5(), ".claude");
13223
+ const claudeDir = join6(homedir6(), ".claude");
13183
13224
  for (const filename of [".credentials.json", "credentials.json"]) {
13184
- const p2 = join5(claudeDir, filename);
13225
+ const p2 = join6(claudeDir, filename);
13185
13226
  if (existsSync6(p2)) {
13186
13227
  try {
13187
- rmSync3(p2, { force: true });
13228
+ rmSync4(p2, { force: true });
13188
13229
  log2(`[persistent-session] Removed ${p2} (api_key mode active \u2014 preventing OAuth fallback)`);
13189
13230
  } catch {
13190
13231
  }
@@ -13276,7 +13317,7 @@ function spawnSession(config, session) {
13276
13317
  if (config.notifyDispatchMode && config.notifyDispatchMode !== "off" && !process.env["AGT_NOTIFY_DISPATCH"]) {
13277
13318
  tmuxSessionEnvArgs.push("-e", `AGT_NOTIFY_DISPATCH=${config.notifyDispatchMode}`);
13278
13319
  }
13279
- const sessionHomeDir = process.env.HOME?.trim() || homedir5();
13320
+ const sessionHomeDir = process.env.HOME?.trim() || homedir6();
13280
13321
  let egress;
13281
13322
  if (egressMode(codeName) === "allowlist") {
13282
13323
  const allowlist = config.egressAllowlist ?? buildEgressAllowlist(null);
@@ -13315,7 +13356,7 @@ function spawnSession(config, session) {
13315
13356
  // Treat empty-string as missing too — `HOME=""` makes ~ resolve
13316
13357
  // to cwd, which is the same broken outcome as no HOME, just
13317
13358
  // better hidden.
13318
- HOME: process.env.HOME?.trim() || homedir5(),
13359
+ HOME: process.env.HOME?.trim() || homedir6(),
13319
13360
  USER: process.env.USER?.trim() || userInfo2().username
13320
13361
  };
13321
13362
  if (config.runId) {
@@ -13339,7 +13380,7 @@ function spawnSession(config, session) {
13339
13380
  } : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
13340
13381
  for (const f of probeMcpEnvSubstitution({
13341
13382
  mcpConfigPath,
13342
- envIntegrationsPath: join5(projectDir, ".env.integrations"),
13383
+ envIntegrationsPath: join6(projectDir, ".env.integrations"),
13343
13384
  baseEnv: probeBaseEnv
13344
13385
  })) {
13345
13386
  log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
@@ -13368,6 +13409,7 @@ function spawnSession(config, session) {
13368
13409
  }
13369
13410
  log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
13370
13411
  setupPaneLog2(tmuxSession, codeName, log2);
13412
+ clearUsageLimitMarker(codeName, log2);
13371
13413
  session.currentSessionId = sessionId;
13372
13414
  acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
13373
13415
  });
@@ -13897,7 +13939,7 @@ async function stopAllSessionsAndWait(log2, opts) {
13897
13939
  await new Promise((resolve) => setTimeout(resolve, Math.min(opts.timeoutMs, 2e3)));
13898
13940
  }
13899
13941
  function getProjectDir(codeName) {
13900
- return join5(homedir5(), ".augmented", codeName, "project");
13942
+ return join6(homedir6(), ".augmented", codeName, "project");
13901
13943
  }
13902
13944
 
13903
13945
  export {
@@ -13909,6 +13951,8 @@ export {
13909
13951
  DEFAULT_FRAMEWORK,
13910
13952
  registerFramework,
13911
13953
  getFramework,
13954
+ mcpWildcardsForServers,
13955
+ requiredMcpWildcard,
13912
13956
  MAX_AVATAR_ENV_URL_BYTES,
13913
13957
  resolveAvatarEnvUrl,
13914
13958
  CLAUDE_MD_MAX_CHARS,
@@ -13982,8 +14026,6 @@ export {
13982
14026
  sumTranscriptUsageInWindow,
13983
14027
  isEmptyTotals,
13984
14028
  attributeTranscriptUsageByRun,
13985
- USAGE_LIMIT_MARKER_FILENAME,
13986
- serializeUsageLimitMarker,
13987
14029
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
13988
14030
  serializeAccountEnforcementMarker,
13989
14031
  KANBAN_CHECK_COMMAND,
@@ -14026,6 +14068,8 @@ export {
14026
14068
  checkChannelInputs,
14027
14069
  takeWatchdogGiveUpCount,
14028
14070
  creditWatchdogGiveUpCount,
14071
+ writeUsageLimitMarker,
14072
+ clearUsageLimitMarker,
14029
14073
  resolveOAuthCredAction,
14030
14074
  resolveClaudeBinary,
14031
14075
  isolationMode,
@@ -14064,4 +14108,4 @@ export {
14064
14108
  stopAllSessionsAndWait,
14065
14109
  getProjectDir
14066
14110
  };
14067
- //# sourceMappingURL=chunk-NUKNLJNJ.js.map
14111
+ //# sourceMappingURL=chunk-ZLFZXMNL.js.map