@atlasharness/atlascode 0.1.47 → 0.1.48

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 (2) hide show
  1. package/dist/cli.js +391 -276
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -77967,7 +77967,7 @@ function createMcpConnectionManager() {
77967
77967
  connections.set(name, conn);
77968
77968
  return conn;
77969
77969
  }
77970
- async function connectStdio(name, config) {
77970
+ async function connectStdio(name, config, opts) {
77971
77971
  const finalCommand = process.env.ATLAS_SHELL_PREFIX || config.command;
77972
77972
  const finalArgs = process.env.ATLAS_SHELL_PREFIX ? [[config.command, ...config.args ?? []].join(" ")] : config.args ?? [];
77973
77973
  const env = { ...process.env, ...config.env ?? {} };
@@ -78031,9 +78031,10 @@ function createMcpConnectionManager() {
78031
78031
  },
78032
78032
  clientInfo: { name: "atlascode", version: "0.0.1" }
78033
78033
  });
78034
+ const budgetMs = opts?.connectionTimeoutMs ?? getConnectionTimeoutMs();
78034
78035
  let timeoutId;
78035
78036
  const timeoutPromise = new Promise((_, reject) => {
78036
- timeoutId = setTimeout(() => reject(new Error(`MCP server "${name}" connection timed out after ${getConnectionTimeoutMs()}ms`)), getConnectionTimeoutMs());
78037
+ timeoutId = setTimeout(() => reject(new Error(`MCP server "${name}" connection timed out after ${budgetMs}ms`)), budgetMs);
78037
78038
  });
78038
78039
  initPromise.then(() => clearTimeout(timeoutId), () => clearTimeout(timeoutId));
78039
78040
  try {
@@ -78072,7 +78073,7 @@ function createMcpConnectionManager() {
78072
78073
  return fail(name, config, message);
78073
78074
  }
78074
78075
  }
78075
- async function connect(name, config) {
78076
+ async function connect(name, config, opts) {
78076
78077
  const existing = connections.get(name);
78077
78078
  if (existing?.type === "connected")
78078
78079
  return existing;
@@ -78082,7 +78083,7 @@ function createMcpConnectionManager() {
78082
78083
  if (t === "sse" || t === "http" || t === "ws") {
78083
78084
  return fail(name, config, `${t}: ${FORWARD_SEAM_MESSAGE}`);
78084
78085
  }
78085
- return await connectStdio(name, config);
78086
+ return await connectStdio(name, config, opts);
78086
78087
  } finally {
78087
78088
  pending.delete(name);
78088
78089
  }
@@ -85125,7 +85126,8 @@ var init_hooksWiring = __esm(() => {
85125
85126
 
85126
85127
  // src/cli/print.ts
85127
85128
  import { randomUUID as randomUUID21 } from "crypto";
85128
- import { join as join37 } from "path";
85129
+ import { readFile as readFile12 } from "node:fs/promises";
85130
+ import { join as join37, resolve as resolve14 } from "path";
85129
85131
  function bridgeMcpToolClientLocal(client) {
85130
85132
  return {
85131
85133
  async callTool(toolName, args, _signal) {
@@ -85182,6 +85184,60 @@ function syncMcpClientRegistryLocal(manager) {
85182
85184
  }
85183
85185
  setMcpClientRegistry({ clients });
85184
85186
  }
85187
+ function isMcpConnectionNonBlocking() {
85188
+ const v = (process.env.MCP_CONNECTION_NONBLOCKING ?? "").trim().toLowerCase();
85189
+ return v === "1" || v === "true" || v === "yes" || v === "on";
85190
+ }
85191
+ async function parseMcpConfigItemsLocal(items) {
85192
+ const out = {};
85193
+ for (const item of items) {
85194
+ const trimmed = item.trim();
85195
+ if (!trimmed)
85196
+ continue;
85197
+ let object = null;
85198
+ try {
85199
+ object = JSON.parse(trimmed);
85200
+ } catch {
85201
+ try {
85202
+ const raw = await readFile12(resolve14(trimmed), "utf8");
85203
+ object = JSON.parse(raw);
85204
+ } catch {
85205
+ object = null;
85206
+ }
85207
+ }
85208
+ const record = object?.mcpServers;
85209
+ if (record && typeof record === "object") {
85210
+ for (const [name, serverConfig] of Object.entries(record)) {
85211
+ out[name] = serverConfig;
85212
+ }
85213
+ }
85214
+ }
85215
+ return out;
85216
+ }
85217
+ async function connectMcpStartup(args) {
85218
+ const { manager, discoveryInput, mcpConfig, strictMcpConfig } = args;
85219
+ const baseConfigs = await buildMcpServerConfigs(discoveryInput);
85220
+ const dynamicConfigs = mcpConfig?.length ? await buildMcpServerConfigs({
85221
+ settingsServers: await parseMcpConfigItemsLocal(mcpConfig),
85222
+ projectMcpJsonPath: null
85223
+ }) : {};
85224
+ const dynamicNames = new Set(Object.keys(dynamicConfigs));
85225
+ const allConfigs = strictMcpConfig ? dynamicConfigs : { ...baseConfigs, ...dynamicConfigs };
85226
+ const connectAll = () => Promise.allSettled(Object.entries(allConfigs).map(([name, config]) => manager.connect(name, config, dynamicNames.has(name) ? { connectionTimeoutMs: 5000 } : undefined)));
85227
+ const nonBlocking = isMcpConnectionNonBlocking();
85228
+ if (nonBlocking) {
85229
+ connectAll();
85230
+ logForDebugging2(`[headless] mcp: non-blocking (MCP_CONNECTION_NONBLOCKING), ${String(Object.keys(allConfigs).length)} server(s) connecting in background`);
85231
+ } else {
85232
+ const mcpResults = await connectAll();
85233
+ const mcpOk = mcpResults.filter((r) => r.status === "fulfilled").length;
85234
+ logForDebugging2(mcpConnectLine(mcpOk, mcpResults.length - mcpOk));
85235
+ }
85236
+ const mcpConnections = await buildMcpEngineConnectionsLocal(manager);
85237
+ const mcpTools = createMcpTools(mcpConnections);
85238
+ syncMcpClientRegistryLocal(manager);
85239
+ return { mcpConnections, mcpTools, nonBlocking };
85240
+ }
85185
85241
  function validateUuidLocal(value) {
85186
85242
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
85187
85243
  }
@@ -85332,13 +85388,12 @@ async function runHeadless(inputPrompt, options) {
85332
85388
  settingsServers: settings.settings.mcpServers,
85333
85389
  projectMcpJsonPath: join37(process.cwd(), ".mcp.json")
85334
85390
  };
85335
- const mcpConfigs = await buildMcpServerConfigs(discoveryInput);
85336
- const mcpResults = await Promise.allSettled(Object.entries(mcpConfigs).map(([name, config]) => mcpManager.connect(name, config)));
85337
- const mcpOk = mcpResults.filter((r) => r.status === "fulfilled").length;
85338
- logForDebugging2(mcpConnectLine(mcpOk, mcpResults.length - mcpOk));
85339
- const mcpConnections = await buildMcpEngineConnectionsLocal(mcpManager);
85340
- const mcpTools = createMcpTools(mcpConnections);
85341
- syncMcpClientRegistryLocal(mcpManager);
85391
+ const { mcpTools } = await connectMcpStartup({
85392
+ manager: mcpManager,
85393
+ discoveryInput,
85394
+ mcpConfig: options.mcpConfig,
85395
+ strictMcpConfig: options.strictMcpConfig
85396
+ });
85342
85397
  const hasPromptRoute = options.permissionPromptToolName === "stdio";
85343
85398
  const role = options.model ? modelToRole(options.model) : "premium";
85344
85399
  const roleModel = getRoleModel(role);
@@ -86627,7 +86682,7 @@ var init_autoMode2 = __esm(() => {
86627
86682
 
86628
86683
  // src/cli/parse.ts
86629
86684
  import { existsSync as existsSync8, readFileSync as readFileSync11, realpathSync as realpathSync6 } from "fs";
86630
- import { dirname as dirname21, join as join40, resolve as resolve14 } from "path";
86685
+ import { dirname as dirname21, join as join40, resolve as resolve15 } from "path";
86631
86686
  function resolveCliVersion(startDir) {
86632
86687
  let dir;
86633
86688
  try {
@@ -86670,11 +86725,11 @@ function readPromptFileInline(inline, file, label) {
86670
86725
  process.exit(1);
86671
86726
  }
86672
86727
  try {
86673
- return readFileSync11(resolve14(file), "utf8");
86728
+ return readFileSync11(resolve15(file), "utf8");
86674
86729
  } catch (error) {
86675
86730
  const code = error.code;
86676
86731
  if (code === "ENOENT") {
86677
- process.stderr.write(`Error: ${label} file not found: ${resolve14(file)}
86732
+ process.stderr.write(`Error: ${label} file not found: ${resolve15(file)}
86678
86733
  `);
86679
86734
  } else {
86680
86735
  process.stderr.write(`Error reading ${label} file: ${error.message}
@@ -86739,7 +86794,9 @@ function buildHeadlessOptions(options) {
86739
86794
  appendSystemPrompt: readPromptFileInline(options.appendSystemPrompt, options.appendSystemPromptFile, "Append system prompt"),
86740
86795
  fallbackModel: options.fallbackModel,
86741
86796
  thinkingConfig: buildHeadlessThinkingConfig(options.thinking, options.maxThinkingTokens),
86742
- effort: options.effort
86797
+ effort: options.effort,
86798
+ mcpConfig: options.mcpConfig,
86799
+ strictMcpConfig: options.strictMcpConfig === true ? true : undefined
86743
86800
  };
86744
86801
  }
86745
86802
  async function mainActionSeam(prompt, options) {
@@ -98076,11 +98133,11 @@ var init_execFileNoThrow2 = __esm(() => {
98076
98133
  });
98077
98134
 
98078
98135
  // src/tui/utils/git/gitConfigParser.ts
98079
- import { readFile as readFile14 } from "fs/promises";
98136
+ import { readFile as readFile15 } from "fs/promises";
98080
98137
  import { join as join46 } from "path";
98081
98138
  async function parseGitConfigValue2(gitDir, section, subsection, key) {
98082
98139
  try {
98083
- const config = await readFile14(join46(gitDir, "config"), "utf-8");
98140
+ const config = await readFile15(join46(gitDir, "config"), "utf-8");
98084
98141
  return parseConfigString2(config, section, subsection, key);
98085
98142
  } catch {
98086
98143
  return null;
@@ -98246,13 +98303,13 @@ var init_gitConfigParser = () => {};
98246
98303
 
98247
98304
  // src/tui/utils/git/gitFilesystem.ts
98248
98305
  import { unwatchFile, watchFile } from "fs";
98249
- import { readdir as readdir7, readFile as readFile15, stat as stat13 } from "fs/promises";
98250
- import { join as join47, resolve as resolve15 } from "path";
98306
+ import { readdir as readdir7, readFile as readFile16, stat as stat13 } from "fs/promises";
98307
+ import { join as join47, resolve as resolve16 } from "path";
98251
98308
  function clearResolveGitDirCache() {
98252
98309
  resolveGitDirCache2.clear();
98253
98310
  }
98254
98311
  async function resolveGitDir2(startPath) {
98255
- const cwd = resolve15(startPath ?? getCwd());
98312
+ const cwd = resolve16(startPath ?? getCwd());
98256
98313
  const cached = resolveGitDirCache2.get(cwd);
98257
98314
  if (cached !== undefined) {
98258
98315
  return cached;
@@ -98266,10 +98323,10 @@ async function resolveGitDir2(startPath) {
98266
98323
  try {
98267
98324
  const st = await stat13(gitPath);
98268
98325
  if (st.isFile()) {
98269
- const content = (await readFile15(gitPath, "utf-8")).trim();
98326
+ const content = (await readFile16(gitPath, "utf-8")).trim();
98270
98327
  if (content.startsWith("gitdir:")) {
98271
98328
  const rawDir = content.slice("gitdir:".length).trim();
98272
- const resolved = resolve15(root, rawDir);
98329
+ const resolved = resolve16(root, rawDir);
98273
98330
  resolveGitDirCache2.set(cwd, resolved);
98274
98331
  return resolved;
98275
98332
  }
@@ -98301,7 +98358,7 @@ function isValidGitSha2(s) {
98301
98358
  }
98302
98359
  async function readGitHead2(gitDir) {
98303
98360
  try {
98304
- const content = (await readFile15(join47(gitDir, "HEAD"), "utf-8")).trim();
98361
+ const content = (await readFile16(join47(gitDir, "HEAD"), "utf-8")).trim();
98305
98362
  if (content.startsWith("ref:")) {
98306
98363
  const ref = content.slice("ref:".length).trim();
98307
98364
  if (ref.startsWith("refs/heads/")) {
@@ -98338,7 +98395,7 @@ async function resolveRef2(gitDir, ref) {
98338
98395
  }
98339
98396
  async function resolveRefInDir2(dir, ref) {
98340
98397
  try {
98341
- const content = (await readFile15(join47(dir, ref), "utf-8")).trim();
98398
+ const content = (await readFile16(join47(dir, ref), "utf-8")).trim();
98342
98399
  if (content.startsWith("ref:")) {
98343
98400
  const target = content.slice("ref:".length).trim();
98344
98401
  if (!isSafeRefName2(target)) {
@@ -98352,7 +98409,7 @@ async function resolveRefInDir2(dir, ref) {
98352
98409
  return content;
98353
98410
  } catch {}
98354
98411
  try {
98355
- const packed = await readFile15(join47(dir, "packed-refs"), "utf-8");
98412
+ const packed = await readFile16(join47(dir, "packed-refs"), "utf-8");
98356
98413
  for (const line of packed.split(`
98357
98414
  `)) {
98358
98415
  if (line.startsWith("#") || line.startsWith("^")) {
@@ -98372,15 +98429,15 @@ async function resolveRefInDir2(dir, ref) {
98372
98429
  }
98373
98430
  async function getCommonDir2(gitDir) {
98374
98431
  try {
98375
- const content = (await readFile15(join47(gitDir, "commondir"), "utf-8")).trim();
98376
- return resolve15(gitDir, content);
98432
+ const content = (await readFile16(join47(gitDir, "commondir"), "utf-8")).trim();
98433
+ return resolve16(gitDir, content);
98377
98434
  } catch {
98378
98435
  return null;
98379
98436
  }
98380
98437
  }
98381
98438
  async function readRawSymref2(gitDir, refPath, branchPrefix) {
98382
98439
  try {
98383
- const content = (await readFile15(join47(gitDir, refPath), "utf-8")).trim();
98440
+ const content = (await readFile16(join47(gitDir, refPath), "utf-8")).trim();
98384
98441
  if (content.startsWith("ref:")) {
98385
98442
  const target = content.slice("ref:".length).trim();
98386
98443
  if (target.startsWith(branchPrefix)) {
@@ -98589,11 +98646,11 @@ async function getHeadForDir(cwd) {
98589
98646
  async function readWorktreeHeadSha2(worktreePath) {
98590
98647
  let gitDir;
98591
98648
  try {
98592
- const ptr = (await readFile15(join47(worktreePath, ".git"), "utf-8")).trim();
98649
+ const ptr = (await readFile16(join47(worktreePath, ".git"), "utf-8")).trim();
98593
98650
  if (!ptr.startsWith("gitdir:")) {
98594
98651
  return null;
98595
98652
  }
98596
- gitDir = resolve15(worktreePath, ptr.slice("gitdir:".length).trim());
98653
+ gitDir = resolve16(worktreePath, ptr.slice("gitdir:".length).trim());
98597
98654
  } catch {
98598
98655
  return null;
98599
98656
  }
@@ -99446,7 +99503,7 @@ var init_gitAvailability = __esm(() => {
99446
99503
 
99447
99504
  // src/tui/utils/git.ts
99448
99505
  import { readFileSync as readFileSync14, realpathSync as realpathSync7, statSync as statSync7 } from "fs";
99449
- import { basename as basename9, dirname as dirname25, join as join49, resolve as resolve16, sep as sep7 } from "path";
99506
+ import { basename as basename9, dirname as dirname25, join as join49, resolve as resolve17, sep as sep7 } from "path";
99450
99507
  function createFindGitRoot() {
99451
99508
  function wrapper(startPath) {
99452
99509
  const result = findGitRootImpl2(startPath);
@@ -99582,7 +99639,7 @@ var init_git2 = __esm(() => {
99582
99639
  logForDiagnosticsNoPII("info", "find_git_root_started");
99583
99640
  if (typeof startPath !== "string")
99584
99641
  startPath = String(startPath || "/tmp");
99585
- let current = resolve16(startPath);
99642
+ let current = resolve17(startPath);
99586
99643
  const root = current.substring(0, current.indexOf(sep7) + 1) || sep7;
99587
99644
  let statCount = 0;
99588
99645
  while (current !== root) {
@@ -99632,9 +99689,9 @@ var init_git2 = __esm(() => {
99632
99689
  if (!gitContent.startsWith("gitdir:")) {
99633
99690
  return gitRoot;
99634
99691
  }
99635
- const worktreeGitDir = resolve16(gitRoot, gitContent.slice("gitdir:".length).trim());
99636
- const commonDir = resolve16(worktreeGitDir, readFileSync14(join49(worktreeGitDir, "commondir"), "utf-8").trim());
99637
- if (resolve16(dirname25(worktreeGitDir)) !== join49(commonDir, "worktrees")) {
99692
+ const worktreeGitDir = resolve17(gitRoot, gitContent.slice("gitdir:".length).trim());
99693
+ const commonDir = resolve17(worktreeGitDir, readFileSync14(join49(worktreeGitDir, "commondir"), "utf-8").trim());
99694
+ if (resolve17(dirname25(worktreeGitDir)) !== join49(commonDir, "worktrees")) {
99638
99695
  return gitRoot;
99639
99696
  }
99640
99697
  const backlink = realpathSync7(readFileSync14(join49(worktreeGitDir, "gitdir"), "utf-8").trim());
@@ -99666,7 +99723,7 @@ var init_git2 = __esm(() => {
99666
99723
  });
99667
99724
 
99668
99725
  // src/tui/utils/platform.ts
99669
- import { readdir as readdir8, readFile as readFile16 } from "fs/promises";
99726
+ import { readdir as readdir8, readFile as readFile17 } from "fs/promises";
99670
99727
  import { release as osRelease } from "os";
99671
99728
  var SUPPORTED_PLATFORMS2, getPlatform3, getWslVersion, getLinuxDistroInfo;
99672
99729
  var init_platform3 = __esm(() => {
@@ -99728,7 +99785,7 @@ var init_platform3 = __esm(() => {
99728
99785
  linuxKernel: osRelease()
99729
99786
  };
99730
99787
  try {
99731
- const content = await readFile16("/etc/os-release", "utf8");
99788
+ const content = await readFile17("/etc/os-release", "utf8");
99732
99789
  for (const line of content.split(`
99733
99790
  `)) {
99734
99791
  const match = line.match(/^(ID|VERSION_ID)=(.*)$/);
@@ -100176,7 +100233,7 @@ var init_sessionStoragePortable = __esm(() => {
100176
100233
 
100177
100234
  // src/tui/utils/path.ts
100178
100235
  import { homedir as homedir17 } from "os";
100179
- import { dirname as dirname27, isAbsolute as isAbsolute11, join as join51, normalize as normalize3, relative as relative5, resolve as resolve18 } from "path";
100236
+ import { dirname as dirname27, isAbsolute as isAbsolute11, join as join51, normalize as normalize3, relative as relative5, resolve as resolve19 } from "path";
100180
100237
  function expandPath2(path, baseDir) {
100181
100238
  const actualBaseDir = baseDir ?? getCwd() ?? getFsImplementation2().cwd();
100182
100239
  if (typeof path !== "string") {
@@ -100209,7 +100266,7 @@ function expandPath2(path, baseDir) {
100209
100266
  if (isAbsolute11(processedPath)) {
100210
100267
  return normalize3(processedPath).normalize("NFC");
100211
100268
  }
100212
- return resolve18(actualBaseDir, processedPath).normalize("NFC");
100269
+ return resolve19(actualBaseDir, processedPath).normalize("NFC");
100213
100270
  }
100214
100271
  function toRelativePath2(absolutePath) {
100215
100272
  const relativePath = relative5(getCwd(), absolutePath);
@@ -119178,7 +119235,7 @@ function stripBOM2(content) {
119178
119235
  var UTF8_BOM = "\uFEFF";
119179
119236
 
119180
119237
  // src/tui/utils/json.ts
119181
- import { open as open6, readFile as readFile17, stat as stat15 } from "fs/promises";
119238
+ import { open as open6, readFile as readFile18, stat as stat15 } from "fs/promises";
119182
119239
  function parseJSONUncached(json, shouldLogError) {
119183
119240
  try {
119184
119241
  return { ok: true, value: JSON.parse(stripBOM2(json)) };
@@ -119280,7 +119337,7 @@ async function readJSONLFile(filePath) {
119280
119337
  try {
119281
119338
  const { size } = await stat15(filePath);
119282
119339
  if (size <= MAX_JSONL_READ_BYTES) {
119283
- return parseJSONL2(await readFile17(filePath));
119340
+ return parseJSONL2(await readFile18(filePath));
119284
119341
  }
119285
119342
  const fd = __using(__stack, await open6(filePath, "r"), 1);
119286
119343
  const buf = Buffer.allocUnsafe(MAX_JSONL_READ_BYTES);
@@ -120942,7 +120999,7 @@ __export(exports_teamMemPaths, {
120942
120999
  isTeamMemPath: () => isTeamMemPath,
120943
121000
  isTeamMemoryEnabled: () => isTeamMemoryEnabled
120944
121001
  });
120945
- import { dirname as dirname28, join as join55, resolve as resolve19, sep as sep10 } from "path";
121002
+ import { dirname as dirname28, join as join55, resolve as resolve20, sep as sep10 } from "path";
120946
121003
  function isTeamMemoryEnabled() {
120947
121004
  if (!isAutoMemoryEnabled2()) {
120948
121005
  return false;
@@ -120956,7 +121013,7 @@ function getTeamMemEntrypoint() {
120956
121013
  return join55(getAutoMemPath2(), "team", "MEMORY.md");
120957
121014
  }
120958
121015
  function isTeamMemPath(filePath) {
120959
- const resolvedPath = resolve19(filePath);
121016
+ const resolvedPath = resolve20(filePath);
120960
121017
  const teamDir = getTeamMemPath();
120961
121018
  return resolvedPath.startsWith(teamDir);
120962
121019
  }
@@ -120972,7 +121029,7 @@ var init_teamMemPaths = __esm(() => {
120972
121029
  // src/tui/utils/config.ts
120973
121030
  import { randomBytes as randomBytes5 } from "crypto";
120974
121031
  import { unwatchFile as unwatchFile2, watchFile as watchFile2 } from "fs";
120975
- import { basename as basename10, dirname as dirname29, join as join56, resolve as resolve20 } from "path";
121032
+ import { basename as basename10, dirname as dirname29, join as join56, resolve as resolve21 } from "path";
120976
121033
  function createDefaultGlobalConfig() {
120977
121034
  return {
120978
121035
  numStartups: 0,
@@ -121031,7 +121088,7 @@ function computeTrustDialogAccepted() {
121031
121088
  if (pathConfig?.hasTrustDialogAccepted) {
121032
121089
  return true;
121033
121090
  }
121034
- const parentPath = normalizePathForConfigKey(resolve20(currentPath, ".."));
121091
+ const parentPath = normalizePathForConfigKey(resolve21(currentPath, ".."));
121035
121092
  if (parentPath === currentPath) {
121036
121093
  break;
121037
121094
  }
@@ -121656,7 +121713,7 @@ var init_config6 = __esm(() => {
121656
121713
  if (gitRoot) {
121657
121714
  return normalizePathForConfigKey(gitRoot);
121658
121715
  }
121659
- return normalizePathForConfigKey(resolve20(originalCwd));
121716
+ return normalizePathForConfigKey(resolve21(originalCwd));
121660
121717
  });
121661
121718
  });
121662
121719
 
@@ -121904,7 +121961,7 @@ import {
121904
121961
  join as join57,
121905
121962
  normalize as normalize5,
121906
121963
  relative as relative6,
121907
- resolve as resolve21,
121964
+ resolve as resolve22,
121908
121965
  sep as sep11
121909
121966
  } from "path";
121910
121967
  async function pathExists2(path) {
@@ -122064,7 +122121,7 @@ function writeFileSyncAndFlush_DEPRECATED2(filePath, content, options = { encodi
122064
122121
  let targetPath = filePath;
122065
122122
  try {
122066
122123
  const linkTarget = fs.readlinkSync(filePath);
122067
- targetPath = isAbsolute13(linkTarget) ? linkTarget : resolve21(dirname30(filePath), linkTarget);
122124
+ targetPath = isAbsolute13(linkTarget) ? linkTarget : resolve22(dirname30(filePath), linkTarget);
122068
122125
  logForDebugging3(`Writing through symlink: ${filePath} -> ${targetPath}`);
122069
122126
  } catch {}
122070
122127
  const tempPath = `${targetPath}.tmp.${process.pid}.${Date.now()}`;
@@ -122198,7 +122255,7 @@ var init_file = __esm(() => {
122198
122255
  });
122199
122256
 
122200
122257
  // src/tui/utils/git/gitignore.ts
122201
- import { appendFile as appendFile2, mkdir as mkdir14, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
122258
+ import { appendFile as appendFile2, mkdir as mkdir14, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
122202
122259
  import { homedir as homedir21 } from "os";
122203
122260
  import { dirname as dirname31, join as join58 } from "path";
122204
122261
  async function isPathGitignored2(filePath, cwd) {
@@ -122225,7 +122282,7 @@ async function addFileGlobRuleToGitignore(filename, cwd = getCwd()) {
122225
122282
  const configGitDir = dirname31(globalGitignorePath);
122226
122283
  await mkdir14(configGitDir, { recursive: true });
122227
122284
  try {
122228
- const content = await readFile18(globalGitignorePath, { encoding: "utf-8" });
122285
+ const content = await readFile19(globalGitignorePath, { encoding: "utf-8" });
122229
122286
  if (content.includes(gitignoreEntry)) {
122230
122287
  return;
122231
122288
  }
@@ -123454,7 +123511,7 @@ var init_settingsCache2 = __esm(() => {
123454
123511
  });
123455
123512
 
123456
123513
  // src/tui/utils/settings/settings.ts
123457
- import { dirname as dirname32, join as join60, resolve as resolve22 } from "path";
123514
+ import { dirname as dirname32, join as join60, resolve as resolve23 } from "path";
123458
123515
  function getManagedSettingsFilePath2() {
123459
123516
  return join60(getManagedFilePath(), "managed-settings.json");
123460
123517
  }
@@ -123542,15 +123599,15 @@ function parseSettingsFileUncached2(path) {
123542
123599
  function getSettingsRootPathForSource2(source) {
123543
123600
  switch (source) {
123544
123601
  case "userSettings":
123545
- return resolve22(getAtlasConfigHomeDir3());
123602
+ return resolve23(getAtlasConfigHomeDir3());
123546
123603
  case "policySettings":
123547
123604
  case "projectSettings":
123548
123605
  case "localSettings": {
123549
- return resolve22(getOriginalCwd());
123606
+ return resolve23(getOriginalCwd());
123550
123607
  }
123551
123608
  case "flagSettings": {
123552
123609
  const path = getFlagSettingsPath();
123553
- return path ? dirname32(resolve22(path)) : resolve22(getOriginalCwd());
123610
+ return path ? dirname32(resolve23(path)) : resolve23(getOriginalCwd());
123554
123611
  }
123555
123612
  }
123556
123613
  }
@@ -123831,7 +123888,7 @@ function loadSettingsFromDisk2() {
123831
123888
  }
123832
123889
  const filePath = getSettingsFilePathForSource2(source);
123833
123890
  if (filePath) {
123834
- const resolvedPath = resolve22(filePath);
123891
+ const resolvedPath = resolve23(filePath);
123835
123892
  if (!seenFiles.has(resolvedPath)) {
123836
123893
  seenFiles.add(resolvedPath);
123837
123894
  const { settings, errors } = parseSettingsFile2(filePath);
@@ -161992,14 +162049,14 @@ var init_MessageResponse = __esm(() => {
161992
162049
 
161993
162050
  // src/tui/commands/add-dir/validation.ts
161994
162051
  import { stat as stat17 } from "fs/promises";
161995
- import { dirname as dirname36, resolve as resolve24 } from "path";
162052
+ import { dirname as dirname36, resolve as resolve25 } from "path";
161996
162053
  async function validateDirectoryForWorkspace(directoryPath, permissionContext) {
161997
162054
  if (!directoryPath) {
161998
162055
  return {
161999
162056
  resultType: "emptyPath"
162000
162057
  };
162001
162058
  }
162002
- const absolutePath = resolve24(expandPath2(directoryPath));
162059
+ const absolutePath = resolve25(expandPath2(directoryPath));
162003
162060
  try {
162004
162061
  const stats = await stat17(absolutePath);
162005
162062
  if (!stats.isDirectory()) {
@@ -164454,9 +164511,9 @@ var init_pluginOnlyPolicy = __esm(() => {
164454
164511
 
164455
164512
  // src/tui/utils/markdownConfigLoader.ts
164456
164513
  import { statSync as statSync9 } from "fs";
164457
- import { lstat as lstat4, readdir as readdir12, readFile as readFile19, realpath as realpath7, stat as stat22 } from "fs/promises";
164514
+ import { lstat as lstat4, readdir as readdir12, readFile as readFile20, realpath as realpath7, stat as stat22 } from "fs/promises";
164458
164515
  import { homedir as homedir23 } from "os";
164459
- import { dirname as dirname40, join as join67, resolve as resolve27, sep as sep14 } from "path";
164516
+ import { dirname as dirname40, join as join67, resolve as resolve28, sep as sep14 } from "path";
164460
164517
  function extractDescriptionFromMarkdown2(content, defaultDescription = "Custom item") {
164461
164518
  const lines = content.split(`
164462
164519
  `);
@@ -164538,9 +164595,9 @@ function resolveStopBoundary2(cwd) {
164538
164595
  return cwdGitRoot;
164539
164596
  }
164540
164597
  function getProjectDirsUpToHome2(subdir, cwd) {
164541
- const home = resolve27(homedir23()).normalize("NFC");
164598
+ const home = resolve28(homedir23()).normalize("NFC");
164542
164599
  const gitRoot = resolveStopBoundary2(cwd);
164543
- let current = resolve27(cwd);
164600
+ let current = resolve28(cwd);
164544
164601
  const dirs = [];
164545
164602
  while (true) {
164546
164603
  if (normalizePathForComparison2(current) === normalizePathForComparison2(home)) {
@@ -164638,7 +164695,7 @@ async function loadMarkdownFiles2(dir) {
164638
164695
  }
164639
164696
  const results = await Promise.all(files.map(async (filePath) => {
164640
164697
  try {
164641
- const rawContent = await readFile19(filePath, { encoding: "utf-8" });
164698
+ const rawContent = await readFile20(filePath, { encoding: "utf-8" });
164642
164699
  const { frontmatter, content } = parseFrontmatter2(rawContent, filePath);
164643
164700
  return {
164644
164701
  filePath,
@@ -167727,7 +167784,7 @@ var init_readOnlyCommandValidation2 = __esm(() => {
167727
167784
 
167728
167785
  // src/tui/utils/permissions/pathValidation.ts
167729
167786
  import { homedir as homedir24 } from "os";
167730
- import { dirname as dirname41, isAbsolute as isAbsolute16, resolve as resolve28 } from "path";
167787
+ import { dirname as dirname41, isAbsolute as isAbsolute16, resolve as resolve29 } from "path";
167731
167788
  function expandTilde2(path) {
167732
167789
  if (path === "~" || path.startsWith("~/") || process.platform === "win32" && path.startsWith("~\\")) {
167733
167790
  return homedir24() + path.slice(1);
@@ -169029,7 +169086,7 @@ var init_agentColorManager = __esm(() => {
169029
169086
  });
169030
169087
 
169031
169088
  // src/tui/tools/AgentTool/agentMemorySnapshot.ts
169032
- import { mkdir as mkdir16, readdir as readdir14, readFile as readFile20, unlink as unlink7, writeFile as writeFile11 } from "fs/promises";
169089
+ import { mkdir as mkdir16, readdir as readdir14, readFile as readFile21, unlink as unlink7, writeFile as writeFile11 } from "fs/promises";
169033
169090
  import { join as join72 } from "path";
169034
169091
  function getSnapshotDirForAgent(agentType) {
169035
169092
  return join72(getCwd(), getConfigDirName2(), SNAPSHOT_BASE, agentType);
@@ -169042,7 +169099,7 @@ function getSyncedJsonPath(agentType, scope) {
169042
169099
  }
169043
169100
  async function readJsonFile(path, schema) {
169044
169101
  try {
169045
- const content = await readFile20(path, { encoding: "utf-8" });
169102
+ const content = await readFile21(path, { encoding: "utf-8" });
169046
169103
  const result = schema.safeParse(jsonParse2(content));
169047
169104
  return result.success ? result.data : null;
169048
169105
  } catch {
@@ -169058,7 +169115,7 @@ async function copySnapshotToLocal(agentType, scope) {
169058
169115
  for (const dirent of files) {
169059
169116
  if (!dirent.isFile() || dirent.name === SNAPSHOT_JSON)
169060
169117
  continue;
169061
- const content = await readFile20(join72(snapshotMemDir, dirent.name), {
169118
+ const content = await readFile21(join72(snapshotMemDir, dirent.name), {
169062
169119
  encoding: "utf-8"
169063
169120
  });
169064
169121
  await writeFile11(join72(localMemDir, dirent.name), content);
@@ -177743,7 +177800,7 @@ import {
177743
177800
  copyFile as copyFile2,
177744
177801
  mkdir as mkdir17,
177745
177802
  readdir as readdir15,
177746
- readFile as readFile21,
177803
+ readFile as readFile22,
177747
177804
  stat as stat24,
177748
177805
  symlink as symlink4,
177749
177806
  utimes as utimes2
@@ -177886,7 +177943,7 @@ async function getOrCreateWorktree2(repoRoot, slug, options) {
177886
177943
  async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
177887
177944
  let includeContent;
177888
177945
  try {
177889
- includeContent = await readFile21(join73(repoRoot, ".worktreeinclude"), "utf-8");
177946
+ includeContent = await readFile22(join73(repoRoot, ".worktreeinclude"), "utf-8");
177890
177947
  } catch {
177891
177948
  return [];
177892
177949
  }
@@ -186956,7 +187013,7 @@ var init_validate2 = __esm(() => {
186956
187013
 
186957
187014
  // src/tui/keybindings/loadUserBindings.ts
186958
187015
  import { readFileSync as readFileSync18 } from "fs";
186959
- import { readFile as readFile22, stat as stat26 } from "fs/promises";
187016
+ import { readFile as readFile23, stat as stat26 } from "fs/promises";
186960
187017
  import { dirname as dirname43, join as join75 } from "path";
186961
187018
  function isKeybindingCustomizationEnabled() {
186962
187019
  return getFeatureValue_CACHED_MAY_BE_STALE("atlas_keybinding_customization_release", false);
@@ -186989,7 +187046,7 @@ async function loadKeybindings() {
186989
187046
  }
186990
187047
  const userPath = getKeybindingsPath();
186991
187048
  try {
186992
- const content = await readFile22(userPath, "utf-8");
187049
+ const content = await readFile23(userPath, "utf-8");
186993
187050
  const parsed = jsonParse2(content);
186994
187051
  let userBlocks;
186995
187052
  if (typeof parsed === "object" && parsed !== null && "bindings" in parsed) {
@@ -197541,7 +197598,7 @@ var init_IdeOnboardingDialog = __esm(() => {
197541
197598
 
197542
197599
  // src/tui/utils/ide.ts
197543
197600
  import { createConnection } from "net";
197544
- import { basename as basename19, join as join84, sep as pathSeparator, resolve as resolve29 } from "path";
197601
+ import { basename as basename19, join as join84, sep as pathSeparator, resolve as resolve30 } from "path";
197545
197602
  function isProcessRunning3(pid) {
197546
197603
  try {
197547
197604
  process.kill(pid, 0);
@@ -197683,7 +197740,7 @@ async function getIdeLockfilesPaths() {
197683
197740
  if (windowsHome) {
197684
197741
  const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
197685
197742
  const wslPath = converter.toLocalPath(windowsHome);
197686
- paths.push(resolve29(wslPath, getConfigDirName2(), "ide"));
197743
+ paths.push(resolve30(wslPath, getConfigDirName2(), "ide"));
197687
197744
  }
197688
197745
  try {
197689
197746
  const usersDir = "/mnt/c/Users";
@@ -197825,14 +197882,14 @@ async function detectIDEs(includeInvalid) {
197825
197882
  if (!checkWSLDistroMatch(idePath, process.env.WSL_DISTRO_NAME)) {
197826
197883
  return false;
197827
197884
  }
197828
- const resolvedOriginal = resolve29(localPath).normalize("NFC");
197885
+ const resolvedOriginal = resolve30(localPath).normalize("NFC");
197829
197886
  if (cwd === resolvedOriginal || cwd.startsWith(resolvedOriginal + pathSeparator)) {
197830
197887
  return true;
197831
197888
  }
197832
197889
  const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
197833
197890
  localPath = converter.toLocalPath(idePath);
197834
197891
  }
197835
- const resolvedPath = resolve29(localPath).normalize("NFC");
197892
+ const resolvedPath = resolve30(localPath).normalize("NFC");
197836
197893
  if (getPlatform3() === "windows") {
197837
197894
  const normalizedCwd = cwd.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
197838
197895
  const normalizedResolvedPath = resolvedPath.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
@@ -203461,7 +203518,7 @@ var init_ComputerUseApproval = __esm(() => {
203461
203518
  });
203462
203519
 
203463
203520
  // src/tui/utils/computerUse/computerUseLock.ts
203464
- import { mkdir as mkdir21, readFile as readFile23, unlink as unlink9, writeFile as writeFile14 } from "fs/promises";
203521
+ import { mkdir as mkdir21, readFile as readFile24, unlink as unlink9, writeFile as writeFile14 } from "fs/promises";
203465
203522
  import { join as join87 } from "path";
203466
203523
  function isComputerUseLock(value) {
203467
203524
  if (typeof value !== "object" || value === null)
@@ -203473,7 +203530,7 @@ function getLockPath2() {
203473
203530
  }
203474
203531
  async function readLock2() {
203475
203532
  try {
203476
- const raw = await readFile23(getLockPath2(), "utf8");
203533
+ const raw = await readFile24(getLockPath2(), "utf8");
203477
203534
  const parsed = jsonParse2(raw);
203478
203535
  return isComputerUseLock(parsed) ? parsed : undefined;
203479
203536
  } catch {
@@ -207570,7 +207627,7 @@ function createLinkedTransportPair() {
207570
207627
  }
207571
207628
 
207572
207629
  // src/tui/services/mcp/client.ts
207573
- import { mkdir as mkdir22, readFile as readFile24, unlink as unlink10, writeFile as writeFile15 } from "fs/promises";
207630
+ import { mkdir as mkdir22, readFile as readFile25, unlink as unlink10, writeFile as writeFile15 } from "fs/promises";
207574
207631
  import { dirname as dirname45, join as join88 } from "path";
207575
207632
  function isMcpSessionExpiredError(error) {
207576
207633
  const httpStatus = "code" in error ? error.code : undefined;
@@ -207587,7 +207644,7 @@ function getMcpAuthCachePath() {
207587
207644
  }
207588
207645
  function getMcpAuthCache() {
207589
207646
  if (!authCachePromise) {
207590
- authCachePromise = readFile24(getMcpAuthCachePath(), "utf-8").then((data) => jsonParse2(data)).catch(() => ({}));
207647
+ authCachePromise = readFile25(getMcpAuthCachePath(), "utf-8").then((data) => jsonParse2(data)).catch(() => ({}));
207591
207648
  }
207592
207649
  return authCachePromise;
207593
207650
  }
@@ -209632,13 +209689,13 @@ var init_LSPDiagnosticRegistry = __esm(() => {
209632
209689
  });
209633
209690
 
209634
209691
  // src/tui/utils/plugins/lspPluginIntegration.ts
209635
- import { readFile as readFile25 } from "fs/promises";
209636
- import { join as join89, relative as relative10, resolve as resolve30 } from "path";
209692
+ import { readFile as readFile26 } from "fs/promises";
209693
+ import { join as join89, relative as relative10, resolve as resolve31 } from "path";
209637
209694
  function validatePathWithinPlugin(pluginPath, relativePath) {
209638
- const resolvedPluginPath = resolve30(pluginPath);
209639
- const resolvedFilePath = resolve30(pluginPath, relativePath);
209695
+ const resolvedPluginPath = resolve31(pluginPath);
209696
+ const resolvedFilePath = resolve31(pluginPath, relativePath);
209640
209697
  const rel = relative10(resolvedPluginPath, resolvedFilePath);
209641
- if (rel.startsWith("..") || resolve30(rel) === rel) {
209698
+ if (rel.startsWith("..") || resolve31(rel) === rel) {
209642
209699
  return null;
209643
209700
  }
209644
209701
  return resolvedFilePath;
@@ -209647,7 +209704,7 @@ async function loadPluginLspServers(plugin, errors = []) {
209647
209704
  const servers = {};
209648
209705
  const lspJsonPath = join89(plugin.path, ".lsp.json");
209649
209706
  try {
209650
- const content = await readFile25(lspJsonPath, "utf-8");
209707
+ const content = await readFile26(lspJsonPath, "utf-8");
209651
209708
  const parsed = jsonParse2(content);
209652
209709
  const result = record(string2(), LspServerConfigSchema()).safeParse(parsed);
209653
209710
  if (result.success) {
@@ -209704,7 +209761,7 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
209704
209761
  continue;
209705
209762
  }
209706
209763
  try {
209707
- const content = await readFile25(validatedPath, "utf-8");
209764
+ const content = await readFile26(validatedPath, "utf-8");
209708
209765
  const parsed = jsonParse2(content);
209709
209766
  const result = record(string2(), LspServerConfigSchema()).safeParse(parsed);
209710
209767
  if (result.success) {
@@ -214750,7 +214807,7 @@ import {
214750
214807
  copyFile as copyFile3,
214751
214808
  link as link2,
214752
214809
  mkdir as mkdir23,
214753
- readFile as readFile26,
214810
+ readFile as readFile27,
214754
214811
  stat as stat29,
214755
214812
  unlink as unlink11
214756
214813
  } from "fs/promises";
@@ -215067,8 +215124,8 @@ async function checkOriginFileChanged(originalFile, backupFileName, originalStat
215067
215124
  return compareStatsAndContent(originalStats, backupStats, async () => {
215068
215125
  try {
215069
215126
  const [originalContent, backupContent] = await Promise.all([
215070
- readFile26(originalFile, "utf-8"),
215071
- readFile26(backupPath, "utf-8")
215127
+ readFile27(originalFile, "utf-8"),
215128
+ readFile27(backupPath, "utf-8")
215072
215129
  ]);
215073
215130
  return originalContent !== backupContent;
215074
215131
  } catch {
@@ -215329,7 +215386,7 @@ async function notifyVscodeSnapshotFilesUpdated(oldState, newState) {
215329
215386
  }
215330
215387
  async function readFileAsyncOrNull(path) {
215331
215388
  try {
215332
- return await readFile26(path, "utf-8");
215389
+ return await readFile27(path, "utf-8");
215333
215390
  } catch {
215334
215391
  return null;
215335
215392
  }
@@ -215439,7 +215496,7 @@ var init_detectRepository = __esm(() => {
215439
215496
  });
215440
215497
 
215441
215498
  // src/tui/utils/gitDiff.ts
215442
- import { access, readFile as readFile27 } from "fs/promises";
215499
+ import { access, readFile as readFile28 } from "fs/promises";
215443
215500
  import { dirname as dirname47, join as join91, relative as relative12, sep as sep17 } from "path";
215444
215501
  async function fetchGitDiff() {
215445
215502
  const isGit = await getIsGit();
@@ -215690,7 +215747,7 @@ async function generateSyntheticDiff(gitPath, absoluteFilePath) {
215690
215747
  if (!isFileWithinReadSizeLimit2(absoluteFilePath, MAX_DIFF_SIZE_BYTES)) {
215691
215748
  return null;
215692
215749
  }
215693
- const content = await readFile27(absoluteFilePath, "utf-8");
215750
+ const content = await readFile28(absoluteFilePath, "utf-8");
215694
215751
  const lines = content.split(`
215695
215752
  `);
215696
215753
  if (lines.length > 0 && lines.at(-1) === "") {
@@ -251272,7 +251329,7 @@ var init_readEditContext = __esm(() => {
251272
251329
  });
251273
251330
 
251274
251331
  // src/tui/tools/FileWriteTool/UI.tsx
251275
- import { isAbsolute as isAbsolute20, relative as relative14, resolve as resolve32 } from "path";
251332
+ import { isAbsolute as isAbsolute20, relative as relative14, resolve as resolve33 } from "path";
251276
251333
  function countLines(content) {
251277
251334
  const parts = content.split(EOL);
251278
251335
  return content.endsWith(EOL) ? parts.length - 1 : parts.length;
@@ -251596,7 +251653,7 @@ function WriteRejectionBody(t0) {
251596
251653
  }
251597
251654
  async function loadRejectionDiff(filePath, content) {
251598
251655
  try {
251599
- const fullFilePath = isAbsolute20(filePath) ? filePath : resolve32(getCwd(), filePath);
251656
+ const fullFilePath = isAbsolute20(filePath) ? filePath : resolve33(getCwd(), filePath);
251600
251657
  const handle = await openForScan(fullFilePath);
251601
251658
  if (handle === null)
251602
251659
  return {
@@ -253665,7 +253722,7 @@ var init_teammate2 = __esm(() => {
253665
253722
  });
253666
253723
 
253667
253724
  // src/tui/utils/tasks.ts
253668
- import { mkdir as mkdir24, readdir as readdir16, readFile as readFile28, unlink as unlink12, writeFile as writeFile16 } from "fs/promises";
253725
+ import { mkdir as mkdir24, readdir as readdir16, readFile as readFile29, unlink as unlink12, writeFile as writeFile16 } from "fs/promises";
253669
253726
  import { join as join94 } from "path";
253670
253727
  function setLeaderTeamName2(teamName) {
253671
253728
  if (leaderTeamName2 === teamName)
@@ -253690,7 +253747,7 @@ function getHighWaterMarkPath2(taskListId) {
253690
253747
  async function readHighWaterMark2(taskListId) {
253691
253748
  const path = getHighWaterMarkPath2(taskListId);
253692
253749
  try {
253693
- const content = (await readFile28(path, "utf-8")).trim();
253750
+ const content = (await readFile29(path, "utf-8")).trim();
253694
253751
  const value = parseInt(content, 10);
253695
253752
  return isNaN(value) ? 0 : value;
253696
253753
  } catch {
@@ -253814,7 +253871,7 @@ async function createTask2(taskListId, taskData) {
253814
253871
  async function getTask2(taskListId, taskId) {
253815
253872
  const path = getTaskPath2(taskListId, taskId);
253816
253873
  try {
253817
- const content = await readFile28(path, "utf-8");
253874
+ const content = await readFile29(path, "utf-8");
253818
253875
  const data = jsonParse2(content);
253819
253876
  const parsed = TaskSchema2().safeParse(data);
253820
253877
  if (!parsed.success) {
@@ -256411,7 +256468,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
256411
256468
  });
256412
256469
 
256413
256470
  // src/tui/utils/sessionEnvironment.ts
256414
- import { mkdir as mkdir25, readdir as readdir17, readFile as readFile29, writeFile as writeFile17 } from "fs/promises";
256471
+ import { mkdir as mkdir25, readdir as readdir17, readFile as readFile30, writeFile as writeFile17 } from "fs/promises";
256415
256472
  import { join as join95 } from "path";
256416
256473
  async function getSessionEnvDirPath() {
256417
256474
  const sessionEnvDir = join95(getAtlasConfigHomeDir3(), "session-env", getSessionId());
@@ -256450,7 +256507,7 @@ async function getSessionEnvironmentScript() {
256450
256507
  const envFile = process.env.ATLAS_SESSION_ENV_FILE;
256451
256508
  if (envFile) {
256452
256509
  try {
256453
- const envScript = (await readFile29(envFile, "utf8")).trim();
256510
+ const envScript = (await readFile30(envFile, "utf8")).trim();
256454
256511
  if (envScript) {
256455
256512
  scripts.push(envScript);
256456
256513
  logForDebugging3(`Session environment loaded from ATLAS_SESSION_ENV_FILE: ${envFile} (${envScript.length} chars)`);
@@ -256469,7 +256526,7 @@ async function getSessionEnvironmentScript() {
256469
256526
  for (const file of hookFiles) {
256470
256527
  const filePath = join95(sessionEnvDir, file);
256471
256528
  try {
256472
- const content = (await readFile29(filePath, "utf8")).trim();
256529
+ const content = (await readFile30(filePath, "utf8")).trim();
256473
256530
  if (content) {
256474
256531
  scripts.push(content);
256475
256532
  }
@@ -257510,7 +257567,7 @@ var init_powershellProvider = __esm(() => {
257510
257567
  import { execFileSync as execFileSync4, spawn as spawn9 } from "child_process";
257511
257568
  import { constants as fsConstants5, readFileSync as readFileSync19, unlinkSync as unlinkSync3 } from "fs";
257512
257569
  import { mkdir as mkdir27, open as open12, realpath as realpath9 } from "fs/promises";
257513
- import { isAbsolute as isAbsolute25, resolve as resolve33 } from "path";
257570
+ import { isAbsolute as isAbsolute25, resolve as resolve34 } from "path";
257514
257571
  import { join as posixJoin3 } from "path/posix";
257515
257572
  import { accessSync as accessSync2 } from "fs";
257516
257573
  function isExecutable2(shellPath) {
@@ -257699,7 +257756,7 @@ async function exec3(command, abortSignal, shellType, options) {
257699
257756
  }
257700
257757
  }
257701
257758
  function setCwd2(path, relativeTo) {
257702
- const resolved = isAbsolute25(path) ? path : resolve33(relativeTo || getFsImplementation2().cwd(), path);
257759
+ const resolved = isAbsolute25(path) ? path : resolve34(relativeTo || getFsImplementation2().cwd(), path);
257703
257760
  let physicalPath;
257704
257761
  try {
257705
257762
  physicalPath = getFsImplementation2().realpathSync(resolved);
@@ -257754,7 +257811,7 @@ var init_Shell2 = __esm(() => {
257754
257811
  });
257755
257812
 
257756
257813
  // src/tui/tools/BashTool/utils.ts
257757
- import { readFile as readFile30, stat as stat33 } from "fs/promises";
257814
+ import { readFile as readFile31, stat as stat33 } from "fs/promises";
257758
257815
  function stripEmptyLines2(content) {
257759
257816
  const lines = content.split(`
257760
257817
  `);
@@ -257806,7 +257863,7 @@ async function resizeShellImageOutput2(stdout, outputFilePath, outputFileSize) {
257806
257863
  const size = outputFileSize ?? (await stat33(outputFilePath)).size;
257807
257864
  if (size > MAX_IMAGE_FILE_SIZE2)
257808
257865
  return null;
257809
- source = await readFile30(outputFilePath, "utf8");
257866
+ source = await readFile31(outputFilePath, "utf8");
257810
257867
  }
257811
257868
  const parsed = parseDataUri2(source);
257812
257869
  if (!parsed)
@@ -258300,7 +258357,7 @@ var init_UI8 = __esm(() => {
258300
258357
  });
258301
258358
 
258302
258359
  // src/tui/tools/NotebookEditTool/NotebookEditTool.ts
258303
- import { extname as extname13, isAbsolute as isAbsolute26, resolve as resolve34 } from "path";
258360
+ import { extname as extname13, isAbsolute as isAbsolute26, resolve as resolve35 } from "path";
258304
258361
  var inputSchema12, outputSchema10, NotebookEditTool2;
258305
258362
  var init_NotebookEditTool = __esm(() => {
258306
258363
  init_shared();
@@ -258414,7 +258471,7 @@ var init_NotebookEditTool = __esm(() => {
258414
258471
  renderToolUseErrorMessage: renderToolUseErrorMessage5,
258415
258472
  renderToolResultMessage: renderToolResultMessage8,
258416
258473
  async validateInput({ notebook_path, cell_type, cell_id, edit_mode = "replace" }, toolUseContext) {
258417
- const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve34(getCwd(), notebook_path);
258474
+ const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve35(getCwd(), notebook_path);
258418
258475
  if (fullPath.startsWith("\\\\") || fullPath.startsWith("//")) {
258419
258476
  return { result: true };
258420
258477
  }
@@ -258513,7 +258570,7 @@ var init_NotebookEditTool = __esm(() => {
258513
258570
  cell_type,
258514
258571
  edit_mode: originalEditMode
258515
258572
  }, { readFileState, updateFileHistoryState }, _, parentMessage) {
258516
- const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve34(getCwd(), notebook_path);
258573
+ const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve35(getCwd(), notebook_path);
258517
258574
  if (fileHistoryEnabled()) {
258518
258575
  await fileHistoryTrackEdit(updateFileHistoryState, fullPath, parentMessage.uuid);
258519
258576
  }
@@ -260430,7 +260487,7 @@ var init_fileStateCache = __esm(() => {
260430
260487
  });
260431
260488
 
260432
260489
  // src/tui/utils/hooks/hooksSettings.ts
260433
- import { resolve as resolve35 } from "path";
260490
+ import { resolve as resolve36 } from "path";
260434
260491
  function isHookEqual(a, b) {
260435
260492
  if (a.type !== b.type)
260436
260493
  return false;
@@ -260481,7 +260538,7 @@ function getAllHooks(appState) {
260481
260538
  for (const source of sources) {
260482
260539
  const filePath = getSettingsFilePathForSource2(source);
260483
260540
  if (filePath) {
260484
- const resolvedPath = resolve35(filePath);
260541
+ const resolvedPath = resolve36(filePath);
260485
260542
  if (seenFiles.has(resolvedPath)) {
260486
260543
  continue;
260487
260544
  }
@@ -264607,7 +264664,7 @@ __export(exports_teammateMailbox, {
264607
264664
  sendShutdownRequestToMailbox: () => sendShutdownRequestToMailbox2,
264608
264665
  writeToMailbox: () => writeToMailbox2
264609
264666
  });
264610
- import { mkdir as mkdir28, readFile as readFile31, writeFile as writeFile18 } from "fs/promises";
264667
+ import { mkdir as mkdir28, readFile as readFile32, writeFile as writeFile18 } from "fs/promises";
264611
264668
  import { join as join100 } from "path";
264612
264669
  function getInboxPath2(agentName, teamName) {
264613
264670
  const team = teamName || getTeamName2() || "default";
@@ -264629,7 +264686,7 @@ async function readMailbox2(agentName, teamName) {
264629
264686
  const inboxPath = getInboxPath2(agentName, teamName);
264630
264687
  logForDebugging3(`[TeammateMailbox] readMailbox: path=${inboxPath}`);
264631
264688
  try {
264632
- const content = await readFile31(inboxPath, "utf-8");
264689
+ const content = await readFile32(inboxPath, "utf-8");
264633
264690
  const messages = jsonParse2(content);
264634
264691
  logForDebugging3(`[TeammateMailbox] readMailbox: read ${messages.length} message(s)`);
264635
264692
  return messages;
@@ -292919,7 +292976,7 @@ var init_listSessionsImpl = __esm(() => {
292919
292976
  });
292920
292977
 
292921
292978
  // src/tui/services/autoDream/consolidationLock.ts
292922
- import { mkdir as mkdir30, readFile as readFile32, stat as stat35, unlink as unlink14, utimes as utimes3, writeFile as writeFile20 } from "fs/promises";
292979
+ import { mkdir as mkdir30, readFile as readFile33, stat as stat35, unlink as unlink14, utimes as utimes3, writeFile as writeFile20 } from "fs/promises";
292923
292980
  import { join as join103 } from "path";
292924
292981
  function lockPath() {
292925
292982
  return join103(getAutoMemPath2(), LOCK_FILE);
@@ -292937,7 +292994,7 @@ async function tryAcquireConsolidationLock() {
292937
292994
  let mtimeMs;
292938
292995
  let holderPid;
292939
292996
  try {
292940
- const [s, raw] = await Promise.all([stat35(path), readFile32(path, "utf8")]);
292997
+ const [s, raw] = await Promise.all([stat35(path), readFile33(path, "utf8")]);
292941
292998
  mtimeMs = s.mtimeMs;
292942
292999
  const parsed = parseInt(raw.trim(), 10);
292943
293000
  holderPid = Number.isFinite(parsed) ? parsed : undefined;
@@ -292952,7 +293009,7 @@ async function tryAcquireConsolidationLock() {
292952
293009
  await writeFile20(path, String(process.pid));
292953
293010
  let verify;
292954
293011
  try {
292955
- verify = await readFile32(path, "utf8");
293012
+ verify = await readFile33(path, "utf8");
292956
293013
  } catch {
292957
293014
  return null;
292958
293015
  }
@@ -298374,7 +298431,7 @@ __export(exports_voice2, {
298374
298431
  stopRecording: () => stopRecording
298375
298432
  });
298376
298433
  import { spawn as spawn10, spawnSync as spawnSync3 } from "child_process";
298377
- import { readFile as readFile33 } from "fs/promises";
298434
+ import { readFile as readFile34 } from "fs/promises";
298378
298435
  function loadAudioNapi() {
298379
298436
  audioNapiPromise ??= (async () => {
298380
298437
  const t0 = Date.now();
@@ -298429,7 +298486,7 @@ function _resetArecordProbeForTesting() {
298429
298486
  arecordProbe = null;
298430
298487
  }
298431
298488
  function linuxHasAlsaCards() {
298432
- linuxAlsaCardsMemo ??= readFile33("/proc/asound/cards", "utf8").then((cards) => {
298489
+ linuxAlsaCardsMemo ??= readFile34("/proc/asound/cards", "utf8").then((cards) => {
298433
298490
  const c = cards.trim();
298434
298491
  return c !== "" && !c.includes("no soundcards");
298435
298492
  }, () => false);
@@ -308451,7 +308508,7 @@ var init_registry3 = __esm(() => {
308451
308508
 
308452
308509
  // src/tui/utils/swarm/teamHelpers.ts
308453
308510
  import { mkdirSync as mkdirSync7, readFileSync as readFileSync21, writeFileSync as writeFileSync6 } from "fs";
308454
- import { mkdir as mkdir32, readFile as readFile34, rm as rm3, writeFile as writeFile23 } from "fs/promises";
308511
+ import { mkdir as mkdir32, readFile as readFile35, rm as rm3, writeFile as writeFile23 } from "fs/promises";
308455
308512
  import { join as join105 } from "path";
308456
308513
  function sanitizeName3(name) {
308457
308514
  return name.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
@@ -308475,7 +308532,7 @@ function readTeamFile2(teamName) {
308475
308532
  }
308476
308533
  async function readTeamFileAsync2(teamName) {
308477
308534
  try {
308478
- const content = await readFile34(getTeamFilePath2(teamName), "utf-8");
308535
+ const content = await readFile35(getTeamFilePath2(teamName), "utf-8");
308479
308536
  return jsonParse2(content);
308480
308537
  } catch (e) {
308481
308538
  if (getErrnoCode2(e) === "ENOENT")
@@ -308625,7 +308682,7 @@ async function destroyWorktree2(worktreePath) {
308625
308682
  const gitFilePath = join105(worktreePath, ".git");
308626
308683
  let mainRepoPath = null;
308627
308684
  try {
308628
- const gitFileContent = (await readFile34(gitFilePath, "utf-8")).trim();
308685
+ const gitFileContent = (await readFile35(gitFilePath, "utf-8")).trim();
308629
308686
  const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
308630
308687
  if (match && match[1]) {
308631
308688
  const worktreeGitDir = match[1];
@@ -310871,7 +310928,7 @@ var exports_SpecParser = {};
310871
310928
  __export(exports_SpecParser, {
310872
310929
  SpecParser: () => SpecParser2
310873
310930
  });
310874
- import { readFile as readFile35 } from "fs/promises";
310931
+ import { readFile as readFile36 } from "fs/promises";
310875
310932
  var inputSchema42, outputSchema34, SpecParser2;
310876
310933
  var init_SpecParser = __esm(() => {
310877
310934
  init_v4();
@@ -310914,7 +310971,7 @@ var init_SpecParser = __esm(() => {
310914
310971
  let raw = inp.spec_source;
310915
310972
  let parsedFromFile = false;
310916
310973
  try {
310917
- const fileContent = await readFile35(inp.spec_source, "utf-8");
310974
+ const fileContent = await readFile36(inp.spec_source, "utf-8");
310918
310975
  raw = fileContent;
310919
310976
  parsedFromFile = true;
310920
310977
  } catch {}
@@ -314057,7 +314114,7 @@ var init_parser7 = __esm(() => {
314057
314114
  });
314058
314115
 
314059
314116
  // src/tui/tools/PowerShellTool/gitSafety.ts
314060
- import { basename as basename29, posix as posix7, resolve as resolve36, sep as sep23 } from "path";
314117
+ import { basename as basename29, posix as posix7, resolve as resolve37, sep as sep23 } from "path";
314061
314118
  function resolveCwdReentry(normalized) {
314062
314119
  if (!normalized.startsWith("../"))
314063
314120
  return normalized;
@@ -314105,7 +314162,7 @@ function normalizeGitPathArg(arg) {
314105
314162
  }
314106
314163
  function resolveEscapingPathToCwdRelative(n) {
314107
314164
  const cwd = getCwd();
314108
- const abs = resolve36(cwd, n);
314165
+ const abs = resolve37(cwd, n);
314109
314166
  const cwdWithSep = cwd.endsWith(sep23) ? cwd : cwd + sep23;
314110
314167
  const absLower = abs.toLowerCase();
314111
314168
  const cwdLower = cwd.toLowerCase();
@@ -315345,7 +315402,7 @@ var init_modeValidation3 = __esm(() => {
315345
315402
 
315346
315403
  // src/tui/tools/PowerShellTool/pathValidation.ts
315347
315404
  import { homedir as homedir29 } from "os";
315348
- import { isAbsolute as isAbsolute27, resolve as resolve37 } from "path";
315405
+ import { isAbsolute as isAbsolute27, resolve as resolve38 } from "path";
315349
315406
  function matchesParam(paramLower, paramList) {
315350
315407
  for (const p of paramList) {
315351
315408
  if (p === paramLower || paramLower.length > 1 && p.startsWith(paramLower)) {
@@ -315453,7 +315510,7 @@ function checkDenyRuleForGuessedPath(strippedPath, cwd, toolPermissionContext, o
315453
315510
  if (!strippedPath || strippedPath.includes("\x00"))
315454
315511
  return null;
315455
315512
  const tildeExpanded = expandTilde3(strippedPath);
315456
- const abs = isAbsolute27(tildeExpanded) ? tildeExpanded : resolve37(cwd, tildeExpanded);
315513
+ const abs = isAbsolute27(tildeExpanded) ? tildeExpanded : resolve38(cwd, tildeExpanded);
315457
315514
  const { resolvedPath } = safeResolvePath3(getFsImplementation2(), abs);
315458
315515
  const permissionType = operationType === "read" ? "read" : "edit";
315459
315516
  const denyRule = matchingRuleForInput2(resolvedPath, toolPermissionContext, permissionType, "deny");
@@ -315543,7 +315600,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
315543
315600
  };
315544
315601
  }
315545
315602
  if (containsPathTraversal2(normalizedPath)) {
315546
- const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve37(cwd, normalizedPath);
315603
+ const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve38(cwd, normalizedPath);
315547
315604
  const { resolvedPath, isCanonical } = safeResolvePath3(getFsImplementation2(), absolutePath);
315548
315605
  const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
315549
315606
  return {
@@ -315553,7 +315610,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
315553
315610
  };
315554
315611
  }
315555
315612
  const basePath = getGlobBaseDirectory2(normalizedPath);
315556
- const absoluteBasePath = isAbsolute27(basePath) ? basePath : resolve37(cwd, basePath);
315613
+ const absoluteBasePath = isAbsolute27(basePath) ? basePath : resolve38(cwd, basePath);
315557
315614
  const { resolvedPath } = safeResolvePath3(getFsImplementation2(), absoluteBasePath);
315558
315615
  const permissionType = operationType === "read" ? "read" : "edit";
315559
315616
  const denyRule = matchingRuleForInput2(resolvedPath, toolPermissionContext, permissionType, "deny");
@@ -315573,7 +315630,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
315573
315630
  }
315574
315631
  };
315575
315632
  }
315576
- const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve37(cwd, normalizedPath);
315633
+ const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve38(cwd, normalizedPath);
315577
315634
  const { resolvedPath, isCanonical } = safeResolvePath3(getFsImplementation2(), absolutePath);
315578
315635
  const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
315579
315636
  return {
@@ -317487,7 +317544,7 @@ var init_powershellSecurity = __esm(() => {
317487
317544
  });
317488
317545
 
317489
317546
  // src/tui/tools/PowerShellTool/powershellPermissions.ts
317490
- import { resolve as resolve38 } from "path";
317547
+ import { resolve as resolve39 } from "path";
317491
317548
  async function extractCommandName(command) {
317492
317549
  const trimmed = command.trim();
317493
317550
  if (!trimmed) {
@@ -318100,7 +318157,7 @@ async function powershellToolHasPermission(input, context) {
318100
318157
  const canonical = resolveToCanonical(element.name);
318101
318158
  if (canonical === "set-location" && element.args.length > 0) {
318102
318159
  const target = element.args.find((a) => a.length === 0 || !PS_TOKENIZER_DASH_CHARS.has(a[0]));
318103
- if (target && resolve38(getCwd(), target) === getCwd()) {
318160
+ if (target && resolve39(getCwd(), target) === getCwd()) {
318104
318161
  return false;
318105
318162
  }
318106
318163
  }
@@ -324633,7 +324690,7 @@ var init_toolSearch = __esm(() => {
324633
324690
 
324634
324691
  // src/tui/services/vcr.ts
324635
324692
  import { createHash as createHash8, randomUUID as randomUUID33 } from "crypto";
324636
- import { mkdir as mkdir34, readFile as readFile36, writeFile as writeFile24 } from "fs/promises";
324693
+ import { mkdir as mkdir34, readFile as readFile37, writeFile as writeFile24 } from "fs/promises";
324637
324694
  import { dirname as dirname57, join as join109 } from "path";
324638
324695
  function shouldUseVCR() {
324639
324696
  if (false) {}
@@ -324649,7 +324706,7 @@ async function withFixture(input, fixtureName, f) {
324649
324706
  const hash = createHash8("sha1").update(jsonStringify5(input)).digest("hex").slice(0, 12);
324650
324707
  const filename = join109(process.env.ATLAS_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
324651
324708
  try {
324652
- const cached = jsonParse2(await readFile36(filename, { encoding: "utf8" }));
324709
+ const cached = jsonParse2(await readFile37(filename, { encoding: "utf8" }));
324653
324710
  return cached;
324654
324711
  } catch (e) {
324655
324712
  const code = getErrnoCode2(e);
@@ -324871,7 +324928,7 @@ var init_tokenEstimation = __esm(() => {
324871
324928
 
324872
324929
  // src/tui/utils/pdf.ts
324873
324930
  import { randomUUID as randomUUID34 } from "crypto";
324874
- import { mkdir as mkdir35, readdir as readdir19, readFile as readFile37 } from "fs/promises";
324931
+ import { mkdir as mkdir35, readdir as readdir19, readFile as readFile38 } from "fs/promises";
324875
324932
  import { join as join110 } from "path";
324876
324933
  async function readPDF2(filePath) {
324877
324934
  try {
@@ -324893,7 +324950,7 @@ async function readPDF2(filePath) {
324893
324950
  }
324894
324951
  };
324895
324952
  }
324896
- const fileBuffer = await readFile37(filePath);
324953
+ const fileBuffer = await readFile38(filePath);
324897
324954
  const header = fileBuffer.subarray(0, 5).toString("ascii");
324898
324955
  if (!header.startsWith("%PDF-")) {
324899
324956
  return {
@@ -325068,7 +325125,7 @@ var init_pdf2 = __esm(() => {
325068
325125
 
325069
325126
  // src/tui/utils/readFileInRange.ts
325070
325127
  import { createReadStream as createReadStream3, fstat as fstat2 } from "fs";
325071
- import { stat as fsStat3, readFile as readFile38 } from "fs/promises";
325128
+ import { stat as fsStat3, readFile as readFile39 } from "fs/promises";
325072
325129
  async function readFileInRange2(filePath, offset = 0, maxLines, maxBytes, signal, options) {
325073
325130
  signal?.throwIfAborted();
325074
325131
  const truncateOnByteLimit = options?.truncateOnByteLimit ?? false;
@@ -325080,7 +325137,7 @@ async function readFileInRange2(filePath, offset = 0, maxLines, maxBytes, signal
325080
325137
  if (!truncateOnByteLimit && maxBytes !== undefined && stats.size > maxBytes) {
325081
325138
  throw new FileTooLargeError2(stats.size, maxBytes);
325082
325139
  }
325083
- const text = await readFile38(filePath, { encoding: "utf8", signal });
325140
+ const text = await readFile39(filePath, { encoding: "utf8", signal });
325084
325141
  return readFileInRangeFast2(text, stats.mtimeMs, offset, maxLines, truncateOnByteLimit ? maxBytes : undefined);
325085
325142
  }
325086
325143
  return readFileInRangeStreaming2(filePath, offset, maxLines, maxBytes, truncateOnByteLimit, signal);
@@ -326494,7 +326551,7 @@ var init_findRelevantMemories = __esm(() => {
326494
326551
 
326495
326552
  // src/tui/utils/attachments.ts
326496
326553
  import { readdir as readdir21, stat as stat37 } from "fs/promises";
326497
- import { dirname as dirname58, parse as parse12, relative as relative21, resolve as resolve39 } from "path";
326554
+ import { dirname as dirname58, parse as parse12, relative as relative21, resolve as resolve40 } from "path";
326498
326555
  import { randomUUID as randomUUID35 } from "crypto";
326499
326556
  async function getAttachments(input, toolUseContext, ideSelection, queuedCommands, messages, querySource, options) {
326500
326557
  if (isEnvTruthy2(process.env.ATLAS_DISABLE_ATTACHMENTS) || isEnvTruthy2(process.env.ATLAS_SIMPLE)) {
@@ -326915,7 +326972,7 @@ async function getSelectedLinesFromIDE(ideSelection, toolUseContext) {
326915
326972
  ];
326916
326973
  }
326917
326974
  function getDirectoriesToProcess(targetPath, originalCwd) {
326918
- const targetDir = dirname58(resolve39(targetPath));
326975
+ const targetDir = dirname58(resolve40(targetPath));
326919
326976
  const nestedDirs = [];
326920
326977
  let currentDir = targetDir;
326921
326978
  while (currentDir !== originalCwd && currentDir !== parse12(currentDir).root) {
@@ -327214,7 +327271,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
327214
327271
  const candidates = entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
327215
327272
  const checked = await Promise.all(candidates.map(async (name) => {
327216
327273
  try {
327217
- await stat37(resolve39(skillDir, name, "SKILL.md"));
327274
+ await stat37(resolve40(skillDir, name, "SKILL.md"));
327218
327275
  return name;
327219
327276
  } catch {
327220
327277
  return null;
@@ -328628,7 +328685,7 @@ import {
328628
328685
  chmod as chmod4,
328629
328686
  lstat as lstat5,
328630
328687
  readdir as readdir22,
328631
- readFile as readFile39,
328688
+ readFile as readFile40,
328632
328689
  rename as rename3,
328633
328690
  rm as rm5,
328634
328691
  stat as stat38,
@@ -328731,7 +328788,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
328731
328788
  await collectFilesForZip(baseDir, relPath, files, visited);
328732
328789
  } else if (fileStat.isFile()) {
328733
328790
  try {
328734
- const content = await readFile39(fullPath);
328791
+ const content = await readFile40(fullPath);
328735
328792
  files[relPath] = [
328736
328793
  new Uint8Array(content),
328737
328794
  { os: 3, attrs: (fileStat.mode & 65535) << 16 }
@@ -329265,11 +329322,11 @@ var init_marketplaceHelpers = __esm(() => {
329265
329322
  });
329266
329323
 
329267
329324
  // src/tui/utils/plugins/officialMarketplaceGcs.ts
329268
- import { chmod as chmod5, mkdir as mkdir36, readFile as readFile40, rename as rename4, rm as rm7, writeFile as writeFile27 } from "fs/promises";
329269
- import { dirname as dirname61, join as join116, resolve as resolve40, sep as sep24 } from "path";
329325
+ import { chmod as chmod5, mkdir as mkdir36, readFile as readFile41, rename as rename4, rm as rm7, writeFile as writeFile27 } from "fs/promises";
329326
+ import { dirname as dirname61, join as join116, resolve as resolve41, sep as sep24 } from "path";
329270
329327
  async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
329271
- const cacheDir = resolve40(marketplacesCacheDir);
329272
- const resolvedLoc = resolve40(installLocation);
329328
+ const cacheDir = resolve41(marketplacesCacheDir);
329329
+ const resolvedLoc = resolve41(installLocation);
329273
329330
  if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep24)) {
329274
329331
  logForDebugging3(`fetchOfficialMarketplaceFromGcs: refusing path outside cache dir: ${installLocation}`, { level: "error" });
329275
329332
  return null;
@@ -329290,7 +329347,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
329290
329347
  throw new Error("latest pointer returned empty body");
329291
329348
  }
329292
329349
  const sentinelPath = join116(installLocation, ".gcs-sha");
329293
- const currentSha = await readFile40(sentinelPath, "utf8").then((s) => s.trim(), () => null);
329350
+ const currentSha = await readFile41(sentinelPath, "utf8").then((s) => s.trim(), () => null);
329294
329351
  if (currentSha === sha) {
329295
329352
  outcome = "noop";
329296
329353
  return sha;
@@ -329403,7 +329460,7 @@ var init_ascendMarketplace = __esm(() => {
329403
329460
  });
329404
329461
 
329405
329462
  // src/tui/utils/plugins/orphanScanner.ts
329406
- import { join as join117, resolve as resolve41, sep as sep25 } from "path";
329463
+ import { join as join117, resolve as resolve42, sep as sep25 } from "path";
329407
329464
  function normalizeRepoRef(ref) {
329408
329465
  let u = ref.trim();
329409
329466
  const ssh = u.match(/^git@([^:]+):(.+)$/);
@@ -329447,7 +329504,7 @@ async function readOrphanManifestName(dirPath) {
329447
329504
  }
329448
329505
  async function scanOrphanedMarketplaces() {
329449
329506
  const fs = getFsImplementation2();
329450
- const cacheDir = resolve41(getMarketplacesCacheDir());
329507
+ const cacheDir = resolve42(getMarketplacesCacheDir());
329451
329508
  let entries;
329452
329509
  try {
329453
329510
  entries = await fs.readdir(cacheDir);
@@ -329455,8 +329512,8 @@ async function scanOrphanedMarketplaces() {
329455
329512
  return [];
329456
329513
  }
329457
329514
  const config = await loadKnownMarketplacesConfigSafe();
329458
- const registered = new Set(Object.values(config).map((e) => resolve41(e.installLocation)));
329459
- const seedDirs = getPluginSeedDirs().map((d) => resolve41(d));
329515
+ const registered = new Set(Object.values(config).map((e) => resolve42(e.installLocation)));
329516
+ const seedDirs = getPluginSeedDirs().map((d) => resolve42(d));
329460
329517
  const orphans = [];
329461
329518
  for (const entry of entries) {
329462
329519
  if (!entry.isDirectory())
@@ -329494,7 +329551,7 @@ var init_orphanScanner = __esm(() => {
329494
329551
 
329495
329552
  // src/tui/utils/plugins/marketplaceManager.ts
329496
329553
  import { writeFile as writeFile28 } from "fs/promises";
329497
- import { basename as basename35, dirname as dirname62, isAbsolute as isAbsolute31, join as join118, resolve as resolve42, sep as sep26 } from "path";
329554
+ import { basename as basename35, dirname as dirname62, isAbsolute as isAbsolute31, join as join118, resolve as resolve43, sep as sep26 } from "path";
329498
329555
  function getKnownMarketplacesFile() {
329499
329556
  return join118(getPluginsDirectory(), "known_marketplaces.json");
329500
329557
  }
@@ -330280,14 +330337,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
330280
330337
  break;
330281
330338
  }
330282
330339
  case "file": {
330283
- const absPath = resolve42(source.path);
330340
+ const absPath = resolve43(source.path);
330284
330341
  marketplacePath = absPath;
330285
330342
  temporaryCachePath = dirname62(dirname62(absPath));
330286
330343
  cleanupNeeded = false;
330287
330344
  break;
330288
330345
  }
330289
330346
  case "directory": {
330290
- const absPath = resolve42(source.path);
330347
+ const absPath = resolve43(source.path);
330291
330348
  marketplacePath = findManifestInDir(absPath, "marketplace.json");
330292
330349
  temporaryCachePath = absPath;
330293
330350
  cleanupNeeded = false;
@@ -330319,8 +330376,8 @@ async function loadAndCacheMarketplace(source, onProgress) {
330319
330376
  throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage2(e)}`);
330320
330377
  }
330321
330378
  const finalCachePath = join118(cacheDir, marketplace.name);
330322
- const resolvedFinal = resolve42(finalCachePath);
330323
- const resolvedCacheDir = resolve42(cacheDir);
330379
+ const resolvedFinal = resolve43(finalCachePath);
330380
+ const resolvedCacheDir = resolve43(cacheDir);
330324
330381
  if (!resolvedFinal.startsWith(resolvedCacheDir + sep26)) {
330325
330382
  throw new Error(`Marketplace name '${marketplace.name}' resolves to a path outside the cache directory`);
330326
330383
  }
@@ -330369,7 +330426,7 @@ async function captureResolvedSha(source, cachePath) {
330369
330426
  async function addMarketplaceSource(source, onProgress) {
330370
330427
  let resolvedSource = source;
330371
330428
  if (isLocalMarketplaceSource(source) && !isAbsolute31(source.path)) {
330372
- resolvedSource = { ...source, path: resolve42(source.path) };
330429
+ resolvedSource = { ...source, path: resolve43(source.path) };
330373
330430
  }
330374
330431
  if (!isSourceAllowedByPolicy(resolvedSource)) {
330375
330432
  if (isSourceInBlocklist(resolvedSource)) {
@@ -330418,9 +330475,9 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
330418
330475
  }
330419
330476
  logForDebugging3(`Marketplace '${marketplace.name}' exists with different source — overwriting`);
330420
330477
  if (!isLocalMarketplaceSource(oldEntry.source)) {
330421
- const cacheDir = resolve42(getMarketplacesCacheDir());
330422
- const resolvedOld = resolve42(oldEntry.installLocation);
330423
- const resolvedNew = resolve42(cachePath);
330478
+ const cacheDir = resolve43(getMarketplacesCacheDir());
330479
+ const resolvedOld = resolve43(oldEntry.installLocation);
330480
+ const resolvedNew = resolve43(cachePath);
330424
330481
  if (resolvedOld === resolvedNew) {} else if (resolvedOld === cacheDir || resolvedOld.startsWith(cacheDir + sep26)) {
330425
330482
  const fs = getFsImplementation2();
330426
330483
  await fs.rm(oldEntry.installLocation, { recursive: true, force: true });
@@ -330442,7 +330499,7 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
330442
330499
  }
330443
330500
  async function adoptOrphanMarketplace(dirName, overrideName) {
330444
330501
  const fs = getFsImplementation2();
330445
- const cacheDir = resolve42(getMarketplacesCacheDir());
330502
+ const cacheDir = resolve43(getMarketplacesCacheDir());
330446
330503
  const dirPath = join118(cacheDir, dirName);
330447
330504
  if (!fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
330448
330505
  throw new Error(`No marketplace directory named '${dirName}' in ${cacheDir}. ` + `Run \`plugin marketplace list\` to see unregistered directories.`);
@@ -330472,7 +330529,7 @@ async function adoptOrphanMarketplace(dirName, overrideName) {
330472
330529
  await updateKnownMarketplacesConfig((existing) => {
330473
330530
  const prior = existing[name];
330474
330531
  if (prior) {
330475
- if (resolve42(prior.installLocation) === resolve42(dirPath)) {
330532
+ if (resolve43(prior.installLocation) === resolve43(dirPath)) {
330476
330533
  return;
330477
330534
  }
330478
330535
  throw new Error(`Marketplace name '${name}' is already registered at ` + `${prior.installLocation}. Remove it first ` + `(\`plugin marketplace remove ${name}\`) or adopt under a different name.`);
@@ -330703,8 +330760,8 @@ async function refreshMarketplace(name, onProgress, options) {
330703
330760
  throw new Error(`Marketplace '${name}' is seed-managed (${seedDir}) and its content is ` + `controlled by the seed image. To update: ask your admin to update the seed.`);
330704
330761
  }
330705
330762
  if (!isLocalMarketplaceSource(source)) {
330706
- const cacheDir = resolve42(getMarketplacesCacheDir());
330707
- const resolvedLoc = resolve42(installLocation);
330763
+ const cacheDir = resolve43(getMarketplacesCacheDir());
330764
+ const resolvedLoc = resolve43(installLocation);
330708
330765
  if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep26)) {
330709
330766
  throw new Error(`Marketplace '${name}' has a corrupted installLocation ` + `(${installLocation}) — expected a path inside ${cacheDir}. ` + `This can happen after cross-platform path writes or manual edits ` + `to known_marketplaces.json. ` + `Run: claude plugin marketplace remove "${name}" and re-add it.`);
330710
330767
  }
@@ -331454,7 +331511,7 @@ var init_mtimeAwareMemoize = () => {};
331454
331511
 
331455
331512
  // src/tui/utils/plugins/installCounts.ts
331456
331513
  import { randomBytes as randomBytes15 } from "crypto";
331457
- import { readFile as readFile41, rename as rename5, unlink as unlink16, writeFile as writeFile29 } from "fs/promises";
331514
+ import { readFile as readFile42, rename as rename5, unlink as unlink16, writeFile as writeFile29 } from "fs/promises";
331458
331515
  import { join as join120 } from "path";
331459
331516
  function normalizeStatsBase(raw) {
331460
331517
  if (!raw)
@@ -331495,7 +331552,7 @@ function getInstallCountsCachePath() {
331495
331552
  async function loadInstallCountsCache() {
331496
331553
  const cachePath = getInstallCountsCachePath();
331497
331554
  try {
331498
- const content = await readFile41(cachePath, { encoding: "utf-8" });
331555
+ const content = await readFile42(cachePath, { encoding: "utf-8" });
331499
331556
  const parsed = jsonParse2(content);
331500
331557
  if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("entries" in parsed)) {
331501
331558
  logForDebugging3("Install counts cache has invalid structure");
@@ -331708,14 +331765,14 @@ var init_pluginVersioning = __esm(() => {
331708
331765
  // src/tui/utils/plugins/pluginInstallationHelpers.ts
331709
331766
  import { randomBytes as randomBytes16 } from "crypto";
331710
331767
  import { rename as rename6, rm as rm8 } from "fs/promises";
331711
- import { dirname as dirname64, join as join121, resolve as resolve43, sep as sep27 } from "path";
331768
+ import { dirname as dirname64, join as join121, resolve as resolve44, sep as sep27 } from "path";
331712
331769
  function getCurrentTimestamp() {
331713
331770
  return new Date().toISOString();
331714
331771
  }
331715
331772
  function validatePathWithinBase(basePath, relativePath) {
331716
- const resolvedPath = resolve43(basePath, relativePath);
331717
- const normalizedBase = resolve43(basePath) + sep27;
331718
- if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve43(basePath)) {
331773
+ const resolvedPath = resolve44(basePath, relativePath);
331774
+ const normalizedBase = resolve44(basePath) + sep27;
331775
+ if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve44(basePath)) {
331719
331776
  throw new Error(`Path traversal detected: "${relativePath}" would escape the base directory`);
331720
331777
  }
331721
331778
  return resolvedPath;
@@ -331947,7 +332004,7 @@ var init_pluginInstallationHelpers = __esm(() => {
331947
332004
  import {
331948
332005
  copyFile as copyFile6,
331949
332006
  readdir as readdir24,
331950
- readFile as readFile42,
332007
+ readFile as readFile43,
331951
332008
  readlink,
331952
332009
  realpath as realpath11,
331953
332010
  rename as rename7,
@@ -331956,7 +332013,7 @@ import {
331956
332013
  stat as stat40,
331957
332014
  symlink as symlink5
331958
332015
  } from "fs/promises";
331959
- import { basename as basename36, dirname as dirname65, join as join122, relative as relative22, resolve as resolve44, sep as sep28 } from "path";
332016
+ import { basename as basename36, dirname as dirname65, join as join122, relative as relative22, resolve as resolve45, sep as sep28 } from "path";
331960
332017
  function getPluginCachePath() {
331961
332018
  return join122(getPluginsDirectory(), "cache");
331962
332019
  }
@@ -332347,7 +332404,7 @@ async function cachePlugin(source, options) {
332347
332404
  let manifest;
332348
332405
  if (await pathExists2(manifestPath)) {
332349
332406
  try {
332350
- const content = await readFile42(manifestPath, { encoding: "utf-8" });
332407
+ const content = await readFile43(manifestPath, { encoding: "utf-8" });
332351
332408
  const parsed = jsonParse2(content);
332352
332409
  const result = PluginManifestSchema().safeParse(parsed);
332353
332410
  if (result.success) {
@@ -332371,7 +332428,7 @@ async function cachePlugin(source, options) {
332371
332428
  }
332372
332429
  } else if (await pathExists2(legacyManifestPath)) {
332373
332430
  try {
332374
- const content = await readFile42(legacyManifestPath, {
332431
+ const content = await readFile43(legacyManifestPath, {
332375
332432
  encoding: "utf-8"
332376
332433
  });
332377
332434
  const parsed = jsonParse2(content);
@@ -332421,7 +332478,7 @@ async function loadPluginManifest(manifestPath, pluginName, source) {
332421
332478
  };
332422
332479
  }
332423
332480
  try {
332424
- const content = await readFile42(manifestPath, { encoding: "utf-8" });
332481
+ const content = await readFile43(manifestPath, { encoding: "utf-8" });
332425
332482
  const parsedJson = jsonParse2(content);
332426
332483
  const result = PluginManifestSchema().safeParse(parsedJson);
332427
332484
  if (result.success) {
@@ -332447,7 +332504,7 @@ async function loadPluginHooks2(hooksConfigPath, pluginName) {
332447
332504
  if (!await pathExists2(hooksConfigPath)) {
332448
332505
  throw new Error(`Hooks file not found at ${hooksConfigPath} for plugin ${pluginName}. If the manifest declares hooks, the file must exist.`);
332449
332506
  }
332450
- const content = await readFile42(hooksConfigPath, { encoding: "utf-8" });
332507
+ const content = await readFile43(hooksConfigPath, { encoding: "utf-8" });
332451
332508
  const rawHooksConfig = jsonParse2(content);
332452
332509
  const validatedPluginHooks = PluginHooksSchema().parse(rawHooksConfig);
332453
332510
  return validatedPluginHooks.hooks;
@@ -332750,7 +332807,7 @@ function parsePluginSettings(raw) {
332750
332807
  async function loadPluginSettings(pluginPath, manifest) {
332751
332808
  const settingsJsonPath = join122(pluginPath, "settings.json");
332752
332809
  try {
332753
- const content = await readFile42(settingsJsonPath, { encoding: "utf-8" });
332810
+ const content = await readFile43(settingsJsonPath, { encoding: "utf-8" });
332754
332811
  const parsed = jsonParse2(content);
332755
332812
  if (isRecord(parsed)) {
332756
332813
  const filtered = parsePluginSettings(parsed);
@@ -333310,7 +333367,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
333310
333367
  const errors = [];
333311
333368
  for (const [index, pluginPath] of sessionPluginPaths.entries()) {
333312
333369
  try {
333313
- const resolvedPath = resolve44(pluginPath);
333370
+ const resolvedPath = resolve45(pluginPath);
333314
333371
  if (!await pathExists2(resolvedPath)) {
333315
333372
  logForDebugging3(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
333316
333373
  errors.push({
@@ -337863,6 +337920,57 @@ Latest blocked action: ${classifierReason}`
337863
337920
  }
337864
337921
  };
337865
337922
  }
337923
+ async function checkRuleBasedPermissions(tool, input, context) {
337924
+ const appState = context.getAppState();
337925
+ const denyRule = getDenyRuleForTool2(appState.toolPermissionContext, tool);
337926
+ if (denyRule) {
337927
+ return {
337928
+ behavior: "deny",
337929
+ decisionReason: {
337930
+ type: "rule",
337931
+ rule: denyRule
337932
+ },
337933
+ message: `Permission to use ${tool.name} has been denied.`
337934
+ };
337935
+ }
337936
+ const askRule = getAskRuleForTool2(appState.toolPermissionContext, tool);
337937
+ if (askRule) {
337938
+ const canSandboxAutoAllow = tool.name === BASH_TOOL_NAME2 && getSandboxManager().isSandboxingEnabled() && getSandboxManager().isAutoAllowBashIfSandboxedEnabled() && shouldUseSandbox2(input);
337939
+ if (!canSandboxAutoAllow) {
337940
+ return {
337941
+ behavior: "ask",
337942
+ decisionReason: {
337943
+ type: "rule",
337944
+ rule: askRule
337945
+ },
337946
+ message: createPermissionRequestMessage4(tool.name)
337947
+ };
337948
+ }
337949
+ }
337950
+ let toolPermissionResult = {
337951
+ behavior: "passthrough",
337952
+ message: createPermissionRequestMessage4(tool.name)
337953
+ };
337954
+ try {
337955
+ const parsedInput = tool.inputSchema.parse(input);
337956
+ toolPermissionResult = await tool.checkPermissions(parsedInput, context);
337957
+ } catch (e) {
337958
+ if (e instanceof AbortError2 || e instanceof APIUserAbortError3) {
337959
+ throw e;
337960
+ }
337961
+ logError3(e);
337962
+ }
337963
+ if (toolPermissionResult?.behavior === "deny") {
337964
+ return toolPermissionResult;
337965
+ }
337966
+ if (toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "rule" && toolPermissionResult.decisionReason.rule.ruleBehavior === "ask") {
337967
+ return toolPermissionResult;
337968
+ }
337969
+ if (toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
337970
+ return toolPermissionResult;
337971
+ }
337972
+ return null;
337973
+ }
337866
337974
  async function hasPermissionsToUseToolInner(tool, input, context) {
337867
337975
  if (context.abortController.signal.aborted) {
337868
337976
  throw new AbortError2;
@@ -338313,7 +338421,7 @@ __export(exports_permissionSetup, {
338313
338421
  verifyAutoModeGateAccess: () => verifyAutoModeGateAccess
338314
338422
  });
338315
338423
  import { relative as relative23 } from "path";
338316
- import { resolve as resolve45 } from "path";
338424
+ import { resolve as resolve46 } from "path";
338317
338425
  function isDangerousBashPermission(toolName, ruleContent) {
338318
338426
  if (toolName !== BASH_TOOL_NAME2) {
338319
338427
  return false;
@@ -338585,7 +338693,7 @@ function isSymlinkTo2({
338585
338693
  originalCwd
338586
338694
  }) {
338587
338695
  const { resolvedPath: resolvedProcessPwd, isSymlink: isProcessPwdSymlink } = safeResolvePath3(getFsImplementation2(), processPwd);
338588
- return isProcessPwdSymlink ? resolvedProcessPwd === resolve45(originalCwd) : false;
338696
+ return isProcessPwdSymlink ? resolvedProcessPwd === resolve46(originalCwd) : false;
338589
338697
  }
338590
338698
  function initialPermissionModeFromCLI2({
338591
338699
  permissionModeCli,
@@ -339644,7 +339752,7 @@ __export(exports_terminalSetup, {
339644
339752
  shouldOfferTerminalSetup: () => shouldOfferTerminalSetup
339645
339753
  });
339646
339754
  import { randomBytes as randomBytes18 } from "crypto";
339647
- import { copyFile as copyFile7, mkdir as mkdir37, readFile as readFile43, writeFile as writeFile30 } from "fs/promises";
339755
+ import { copyFile as copyFile7, mkdir as mkdir37, readFile as readFile44, writeFile as writeFile30 } from "fs/promises";
339648
339756
  import { homedir as homedir31, platform as platform3 } from "os";
339649
339757
  import { dirname as dirname66, join as join124 } from "path";
339650
339758
  import { pathToFileURL as pathToFileURL8 } from "url";
@@ -339790,7 +339898,7 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
339790
339898
  let keybindings = [];
339791
339899
  let fileExists = false;
339792
339900
  try {
339793
- content = await readFile43(keybindingsPath, {
339901
+ content = await readFile44(keybindingsPath, {
339794
339902
  encoding: "utf-8"
339795
339903
  });
339796
339904
  fileExists = true;
@@ -339937,7 +340045,7 @@ chars = "\\u001B\\r"`;
339937
340045
  let configExists = false;
339938
340046
  for (const path of configPaths) {
339939
340047
  try {
339940
- configContent = await readFile43(path, {
340048
+ configContent = await readFile44(path, {
339941
340049
  encoding: "utf-8"
339942
340050
  });
339943
340051
  configPath = path;
@@ -339999,7 +340107,7 @@ async function installBindingsForZed(theme) {
339999
340107
  let keymapContent = "[]";
340000
340108
  let fileExists = false;
340001
340109
  try {
340002
- keymapContent = await readFile43(keymapPath, {
340110
+ keymapContent = await readFile44(keymapPath, {
340003
340111
  encoding: "utf-8"
340004
340112
  });
340005
340113
  fileExists = true;
@@ -340071,7 +340179,7 @@ var init_terminalSetup = __esm(() => {
340071
340179
 
340072
340180
  // src/tui/utils/pasteStore.ts
340073
340181
  import { createHash as createHash10 } from "crypto";
340074
- import { mkdir as mkdir38, readdir as readdir25, readFile as readFile44, stat as stat42, unlink as unlink17, writeFile as writeFile31 } from "fs/promises";
340182
+ import { mkdir as mkdir38, readdir as readdir25, readFile as readFile45, stat as stat42, unlink as unlink17, writeFile as writeFile31 } from "fs/promises";
340075
340183
  import { join as join125 } from "path";
340076
340184
  function getPasteStoreDir() {
340077
340185
  return join125(getAtlasConfigHomeDir3(), PASTE_STORE_DIR);
@@ -340096,7 +340204,7 @@ async function storePastedText(hash, content) {
340096
340204
  async function retrievePastedText(hash) {
340097
340205
  try {
340098
340206
  const pastePath = getPastePath(hash);
340099
- return await readFile44(pastePath, { encoding: "utf8" });
340207
+ return await readFile45(pastePath, { encoding: "utf8" });
340100
340208
  } catch (error) {
340101
340209
  if (!isENOENT2(error)) {
340102
340210
  logForDebugging3(`Failed to retrieve paste ${hash}: ${error}`);
@@ -344165,7 +344273,7 @@ var init_btw2 = __esm(() => {
344165
344273
  });
344166
344274
 
344167
344275
  // src/tui/components/Feedback.tsx
344168
- import { readFile as readFile45, stat as stat43 } from "fs/promises";
344276
+ import { readFile as readFile46, stat as stat43 } from "fs/promises";
344169
344277
  function redactSensitiveInfo(text) {
344170
344278
  let redacted = text;
344171
344279
  redacted = redacted.replace(/"(sk-ant[^\s"']{24,})"/g, '"[REDACTED_API_KEY]"');
@@ -344204,7 +344312,7 @@ async function loadRawTranscriptJsonl() {
344204
344312
  });
344205
344313
  return null;
344206
344314
  }
344207
- return await readFile45(transcriptPath, "utf-8");
344315
+ return await readFile46(transcriptPath, "utf-8");
344208
344316
  } catch {
344209
344317
  return null;
344210
344318
  }
@@ -348134,7 +348242,7 @@ var init_localInstaller = __esm(() => {
348134
348242
  });
348135
348243
 
348136
348244
  // src/tui/utils/shellConfig.ts
348137
- import { open as open14, readFile as readFile46, stat as stat44 } from "fs/promises";
348245
+ import { open as open14, readFile as readFile47, stat as stat44 } from "fs/promises";
348138
348246
  import { homedir as osHomedir } from "os";
348139
348247
  import { join as join132 } from "path";
348140
348248
  function getShellConfigPaths(options) {
@@ -348169,7 +348277,7 @@ function filterAtlasAliases(lines) {
348169
348277
  }
348170
348278
  async function readFileLines(filePath) {
348171
348279
  try {
348172
- const content = await readFile46(filePath, { encoding: "utf8" });
348280
+ const content = await readFile47(filePath, { encoding: "utf8" });
348173
348281
  return content.split(`
348174
348282
  `);
348175
348283
  } catch (e) {
@@ -348512,7 +348620,7 @@ var init_autoUpdater = __esm(() => {
348512
348620
  });
348513
348621
 
348514
348622
  // src/tui/utils/nativeInstaller/packageManagers.ts
348515
- import { readFile as readFile47 } from "fs/promises";
348623
+ import { readFile as readFile48 } from "fs/promises";
348516
348624
  function isDistroFamily(osRelease, families) {
348517
348625
  return families.includes(osRelease.id) || osRelease.idLike.some((like) => families.includes(like));
348518
348626
  }
@@ -348570,7 +348678,7 @@ var init_packageManagers = __esm(() => {
348570
348678
  init_platform3();
348571
348679
  getOsRelease = memoize_default(async () => {
348572
348680
  try {
348573
- const content = await readFile47("/etc/os-release", "utf8");
348681
+ const content = await readFile48("/etc/os-release", "utf8");
348574
348682
  const idMatch = content.match(/^ID=["']?(\S+?)["']?\s*$/m);
348575
348683
  const idLikeMatch = content.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);
348576
348684
  return {
@@ -348691,7 +348799,7 @@ var init_packageManagers = __esm(() => {
348691
348799
  });
348692
348800
 
348693
348801
  // src/tui/utils/doctorDiagnostic.ts
348694
- import { readFile as readFile48, realpath as realpath12 } from "fs/promises";
348802
+ import { readFile as readFile49, realpath as realpath12 } from "fs/promises";
348695
348803
  import { homedir as homedir33 } from "os";
348696
348804
  import { delimiter as delimiter2, join as join134, posix as posix8, win32 as win322 } from "path";
348697
348805
  function getNormalizedPaths() {
@@ -348847,7 +348955,7 @@ async function detectMultipleInstallations() {
348847
348955
  async function detectConfigurationIssues(type) {
348848
348956
  const warnings = [];
348849
348957
  try {
348850
- const raw = await readFile48(join134(getManagedFilePath(), "managed-settings.json"), "utf-8");
348958
+ const raw = await readFile49(join134(getManagedFilePath(), "managed-settings.json"), "utf-8");
348851
348959
  const parsed = jsonParse2(raw);
348852
348960
  const field = parsed && typeof parsed === "object" ? parsed.strictPluginOnlyCustomization : undefined;
348853
348961
  if (field !== undefined && typeof field !== "boolean") {
@@ -349360,7 +349468,7 @@ import {
349360
349468
  writeFile as writeFile36
349361
349469
  } from "fs/promises";
349362
349470
  import { homedir as homedir34 } from "os";
349363
- import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as join137, resolve as resolve46 } from "path";
349471
+ import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as join137, resolve as resolve47 } from "path";
349364
349472
  function getPlatform4() {
349365
349473
  const os = env5.platform;
349366
349474
  const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
@@ -349708,8 +349816,8 @@ async function updateSymlink(symlinkPath, targetPath) {
349708
349816
  if (symlinkExists) {
349709
349817
  try {
349710
349818
  const currentTarget = await readlink2(symlinkPath);
349711
- const resolvedCurrentTarget = resolve46(dirname69(symlinkPath), currentTarget);
349712
- const resolvedTargetPath = resolve46(targetPath);
349819
+ const resolvedCurrentTarget = resolve47(dirname69(symlinkPath), currentTarget);
349820
+ const resolvedTargetPath = resolve47(targetPath);
349713
349821
  if (resolvedCurrentTarget === resolvedTargetPath) {
349714
349822
  return false;
349715
349823
  }
@@ -349749,7 +349857,7 @@ async function checkInstall(force = false) {
349749
349857
  const dirs = getBaseDirectories();
349750
349858
  const messages = [];
349751
349859
  const localBinDir = dirname69(dirs.executable);
349752
- const resolvedLocalBinPath = resolve46(localBinDir);
349860
+ const resolvedLocalBinPath = resolve47(localBinDir);
349753
349861
  const platform = getPlatform4();
349754
349862
  const isWindows = platform.startsWith("win32");
349755
349863
  try {
@@ -349772,7 +349880,7 @@ async function checkInstall(force = false) {
349772
349880
  } else {
349773
349881
  try {
349774
349882
  const target = await readlink2(dirs.executable);
349775
- const absoluteTarget = resolve46(dirname69(dirs.executable), target);
349883
+ const absoluteTarget = resolve47(dirname69(dirs.executable), target);
349776
349884
  if (!await isPossibleClaudeBinary(absoluteTarget)) {
349777
349885
  messages.push({
349778
349886
  message: `AtlasCode symlink points to missing or invalid binary: ${target}`,
@@ -349800,7 +349908,7 @@ async function checkInstall(force = false) {
349800
349908
  }
349801
349909
  const isInCurrentPath = (process.env.PATH || "").split(delimiter3).some((entry) => {
349802
349910
  try {
349803
- const resolvedEntry = resolve46(entry);
349911
+ const resolvedEntry = resolve47(entry);
349804
349912
  if (isWindows) {
349805
349913
  return resolvedEntry.toLowerCase() === resolvedLocalBinPath.toLowerCase();
349806
349914
  }
@@ -349879,7 +349987,7 @@ async function installLatestImpl(channelOrVersion, forceReinstall = false) {
349879
349987
  async function getVersionFromSymlink(symlinkPath) {
349880
349988
  try {
349881
349989
  const target = await readlink2(symlinkPath);
349882
- const absoluteTarget = resolve46(dirname69(symlinkPath), target);
349990
+ const absoluteTarget = resolve47(dirname69(symlinkPath), target);
349883
349991
  if (await isPossibleClaudeBinary(absoluteTarget)) {
349884
349992
  return absoluteTarget;
349885
349993
  }
@@ -349895,7 +350003,7 @@ async function lockCurrentVersion() {
349895
350003
  if (!process.execPath.includes(dirs.versions)) {
349896
350004
  return;
349897
350005
  }
349898
- const versionPath = resolve46(process.execPath);
350006
+ const versionPath = resolve47(process.execPath);
349899
350007
  try {
349900
350008
  const lockfilePath = getLockFilePathFromVersionPath(dirs, versionPath);
349901
350009
  await mkdir40(dirs.locks, { recursive: true });
@@ -350041,7 +350149,7 @@ async function cleanupOldVersions() {
350041
350149
  versionFiles.push({
350042
350150
  name: entry,
350043
350151
  path: entryPath,
350044
- resolvedPath: resolve46(entryPath),
350152
+ resolvedPath: resolve47(entryPath),
350045
350153
  mtime: stats.mtime
350046
350154
  });
350047
350155
  } catch {}
@@ -350056,7 +350164,7 @@ async function cleanupOldVersions() {
350056
350164
  const currentBinaryPath = process.execPath;
350057
350165
  const protectedVersions = new Set;
350058
350166
  if (currentBinaryPath && currentBinaryPath.includes(dirs.versions)) {
350059
- protectedVersions.add(resolve46(currentBinaryPath));
350167
+ protectedVersions.add(resolve47(currentBinaryPath));
350060
350168
  }
350061
350169
  const currentSymlinkVersion = await getVersionFromSymlink(dirs.executable);
350062
350170
  if (currentSymlinkVersion) {
@@ -356526,7 +356634,7 @@ var init_useTurnDiffs = __esm(() => {
356526
356634
  });
356527
356635
 
356528
356636
  // src/tui/components/diff/DiffDetailView.tsx
356529
- import { resolve as resolve47 } from "path";
356637
+ import { resolve as resolve48 } from "path";
356530
356638
  function DiffDetailView(t0) {
356531
356639
  const $ = import_compiler_runtime130.c(53);
356532
356640
  const {
@@ -356559,7 +356667,7 @@ function DiffDetailView(t0) {
356559
356667
  let content;
356560
356668
  let t2;
356561
356669
  if ($[1] !== filePath) {
356562
- const fullPath = resolve47(getCwd(), filePath);
356670
+ const fullPath = resolve48(getCwd(), filePath);
356563
356671
  content = readFileSafe2(fullPath);
356564
356672
  t2 = content?.split(`
356565
356673
  `)[0] ?? null;
@@ -369989,7 +370097,7 @@ var init_mcp7 = __esm(() => {
369989
370097
  });
369990
370098
 
369991
370099
  // src/tui/utils/releaseNotes.ts
369992
- import { mkdir as mkdir44, readFile as readFile49, writeFile as writeFile39 } from "fs/promises";
370100
+ import { mkdir as mkdir44, readFile as readFile50, writeFile as writeFile39 } from "fs/promises";
369993
370101
  import { dirname as dirname71, join as join140 } from "path";
369994
370102
  function getChangelogCachePath() {
369995
370103
  return join140(getAtlasConfigHomeDir3(), "cache", "changelog.md");
@@ -370039,7 +370147,7 @@ async function getStoredChangelog() {
370039
370147
  }
370040
370148
  const cachePath = getChangelogCachePath();
370041
370149
  try {
370042
- const content = await readFile49(cachePath, "utf-8");
370150
+ const content = await readFile50(cachePath, "utf-8");
370043
370151
  changelogMemoryCache = content;
370044
370152
  return content;
370045
370153
  } catch {
@@ -387995,7 +388103,7 @@ __export(exports_thinkback, {
387995
388103
  call: () => call34,
387996
388104
  playAnimation: () => playAnimation
387997
388105
  });
387998
- import { readFile as readFile50 } from "fs/promises";
388106
+ import { readFile as readFile51 } from "fs/promises";
387999
388107
  import { join as join143 } from "path";
388000
388108
  function getMarketplaceName() {
388001
388109
  return OFFICIAL_MARKETPLACE_NAME;
@@ -388024,7 +388132,7 @@ async function playAnimation(skillDir) {
388024
388132
  const dataPath = join143(skillDir, "year_in_review.js");
388025
388133
  const playerPath = join143(skillDir, "player.js");
388026
388134
  try {
388027
- await readFile50(dataPath);
388135
+ await readFile51(dataPath);
388028
388136
  } catch (e) {
388029
388137
  if (isENOENT2(e)) {
388030
388138
  return {
@@ -388039,7 +388147,7 @@ async function playAnimation(skillDir) {
388039
388147
  };
388040
388148
  }
388041
388149
  try {
388042
- await readFile50(playerPath);
388150
+ await readFile51(playerPath);
388043
388151
  } catch (e) {
388044
388152
  if (isENOENT2(e)) {
388045
388153
  return {
@@ -393118,7 +393226,7 @@ __export(exports_branch, {
393118
393226
  getUniqueForkName: () => getUniqueForkName
393119
393227
  });
393120
393228
  import { randomUUID as randomUUID39 } from "crypto";
393121
- import { mkdir as mkdir45, readFile as readFile51, writeFile as writeFile40 } from "fs/promises";
393229
+ import { mkdir as mkdir45, readFile as readFile52, writeFile as writeFile40 } from "fs/promises";
393122
393230
  function deriveFirstPrompt(firstUserMessage) {
393123
393231
  const content = firstUserMessage?.message?.content;
393124
393232
  if (!content)
@@ -393137,7 +393245,7 @@ async function createFork(customTitle, target) {
393137
393245
  await mkdir45(projectDir, { recursive: true, mode: 448 });
393138
393246
  let transcriptContent;
393139
393247
  try {
393140
- transcriptContent = await readFile51(currentTranscriptPath);
393248
+ transcriptContent = await readFile52(currentTranscriptPath);
393141
393249
  } catch {
393142
393250
  throw new Error("No conversation to branch");
393143
393251
  }
@@ -399430,7 +399538,7 @@ var init_refresh = __esm(() => {
399430
399538
 
399431
399539
  // src/tui/utils/plugins/parseMarketplaceInput.ts
399432
399540
  import { homedir as homedir37 } from "os";
399433
- import { resolve as resolve48 } from "path";
399541
+ import { resolve as resolve49 } from "path";
399434
399542
  function matchKnownGitHost(hostname) {
399435
399543
  const host = hostname.toLowerCase();
399436
399544
  for (const known of KNOWN_GIT_HOSTS) {
@@ -399482,7 +399590,7 @@ async function parseMarketplaceInput(input) {
399482
399590
  const isWindows = process.platform === "win32";
399483
399591
  const isWindowsPath = isWindows && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
399484
399592
  if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
399485
- const resolvedPath = resolve48(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir37()) : trimmed);
399593
+ const resolvedPath = resolve49(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir37()) : trimmed);
399486
399594
  let stats;
399487
399595
  try {
399488
399596
  stats = await fs.stat(resolvedPath);
@@ -402447,7 +402555,7 @@ var init_DiscoverPlugins = __esm(() => {
402447
402555
  });
402448
402556
 
402449
402557
  // src/tui/utils/plugins/skillSearch.ts
402450
- import { readdir as readdir27, readFile as readFile52, stat as stat46 } from "fs/promises";
402558
+ import { readdir as readdir27, readFile as readFile53, stat as stat46 } from "fs/promises";
402451
402559
  import { join as join146 } from "path";
402452
402560
  async function searchSkillsAcrossMarketplaces(query) {
402453
402561
  const config = await loadKnownMarketplacesConfig();
@@ -402493,7 +402601,7 @@ async function searchSkillsAcrossMarketplaces(query) {
402493
402601
  seen.add(skillFile);
402494
402602
  let content;
402495
402603
  try {
402496
- content = await readFile52(skillFile, { encoding: "utf-8" });
402604
+ content = await readFile53(skillFile, { encoding: "utf-8" });
402497
402605
  } catch {
402498
402606
  continue;
402499
402607
  }
@@ -403987,7 +404095,7 @@ var init_ManageMarketplaces = __esm(() => {
403987
404095
 
403988
404096
  // src/tui/utils/plugins/pluginFlagging.ts
403989
404097
  import { randomBytes as randomBytes19 } from "crypto";
403990
- import { readFile as readFile53, rename as rename10, unlink as unlink20, writeFile as writeFile41 } from "fs/promises";
404098
+ import { readFile as readFile54, rename as rename10, unlink as unlink20, writeFile as writeFile41 } from "fs/promises";
403991
404099
  import { join as join147 } from "path";
403992
404100
  function getFlaggedPluginsPath() {
403993
404101
  return join147(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
@@ -404014,7 +404122,7 @@ function parsePluginsData(content) {
404014
404122
  }
404015
404123
  async function readFromDisk() {
404016
404124
  try {
404017
- const content = await readFile53(getFlaggedPluginsPath(), {
404125
+ const content = await readFile54(getFlaggedPluginsPath(), {
404018
404126
  encoding: "utf-8"
404019
404127
  });
404020
404128
  return parsePluginsData(content);
@@ -407329,7 +407437,7 @@ function parsePluginArgs(args) {
407329
407437
  }
407330
407438
 
407331
407439
  // src/tui/utils/plugins/validatePlugin.ts
407332
- import { readdir as readdir29, readFile as readFile55, stat as stat48 } from "fs/promises";
407440
+ import { readdir as readdir29, readFile as readFile56, stat as stat48 } from "fs/promises";
407333
407441
  import * as path24 from "path";
407334
407442
  function detectManifestType(filePath) {
407335
407443
  const fileName = path24.basename(filePath);
@@ -407369,7 +407477,7 @@ async function validatePluginManifest(filePath) {
407369
407477
  const absolutePath = path24.resolve(filePath);
407370
407478
  let content;
407371
407479
  try {
407372
- content = await readFile55(absolutePath, { encoding: "utf-8" });
407480
+ content = await readFile56(absolutePath, { encoding: "utf-8" });
407373
407481
  } catch (error) {
407374
407482
  const code = getErrnoCode2(error);
407375
407483
  let message;
@@ -407493,7 +407601,7 @@ async function validateMarketplaceManifest(filePath) {
407493
407601
  const absolutePath = path24.resolve(filePath);
407494
407602
  let content;
407495
407603
  try {
407496
- content = await readFile55(absolutePath, { encoding: "utf-8" });
407604
+ content = await readFile56(absolutePath, { encoding: "utf-8" });
407497
407605
  } catch (error) {
407498
407606
  const code = getErrnoCode2(error);
407499
407607
  let message;
@@ -407579,7 +407687,7 @@ async function validateMarketplaceManifest(filePath) {
407579
407687
  const pluginJsonPath = findManifestInDir(path24.join(marketplaceRoot, entry.source), "plugin.json");
407580
407688
  let manifestVersion;
407581
407689
  try {
407582
- const raw = await readFile55(pluginJsonPath, { encoding: "utf-8" });
407690
+ const raw = await readFile56(pluginJsonPath, { encoding: "utf-8" });
407583
407691
  const parsed = jsonParse2(raw);
407584
407692
  if (typeof parsed.version === "string") {
407585
407693
  manifestVersion = parsed.version;
@@ -407627,7 +407735,7 @@ async function validateMarketplaceManifest(filePath) {
407627
407735
  for (const skillFile of skillFiles) {
407628
407736
  let content;
407629
407737
  try {
407630
- content = await readFile55(skillFile, { encoding: "utf-8" });
407738
+ content = await readFile56(skillFile, { encoding: "utf-8" });
407631
407739
  } catch (e) {
407632
407740
  if (isENOENT2(e))
407633
407741
  continue;
@@ -407754,7 +407862,7 @@ function validateComponentFile(filePath, content, fileType) {
407754
407862
  async function validateHooksJson(filePath) {
407755
407863
  let content;
407756
407864
  try {
407757
- content = await readFile55(filePath, { encoding: "utf-8" });
407865
+ content = await readFile56(filePath, { encoding: "utf-8" });
407758
407866
  } catch (e) {
407759
407867
  const code = getErrnoCode2(e);
407760
407868
  if (code === "ENOENT") {
@@ -407847,7 +407955,7 @@ async function validatePluginContents(pluginDir) {
407847
407955
  for (const filePath of files) {
407848
407956
  let content;
407849
407957
  try {
407850
- content = await readFile55(filePath, { encoding: "utf-8" });
407958
+ content = await readFile56(filePath, { encoding: "utf-8" });
407851
407959
  } catch (e) {
407852
407960
  if (isENOENT2(e))
407853
407961
  continue;
@@ -407916,7 +408024,7 @@ async function validateManifest(filePath) {
407916
408024
  return validateMarketplaceManifest(filePath);
407917
408025
  case "unknown": {
407918
408026
  try {
407919
- const content = await readFile55(absolutePath, { encoding: "utf-8" });
408027
+ const content = await readFile56(absolutePath, { encoding: "utf-8" });
407920
408028
  const parsed = jsonParse2(content);
407921
408029
  if (Array.isArray(parsed.plugins)) {
407922
408030
  return validateMarketplaceManifest(filePath);
@@ -409508,7 +409616,7 @@ var init_rewind = __esm(() => {
409508
409616
 
409509
409617
  // src/tui/utils/heapDumpService.ts
409510
409618
  import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync8 } from "fs";
409511
- import { readdir as readdir30, readFile as readFile56, writeFile as writeFile42 } from "fs/promises";
409619
+ import { readdir as readdir30, readFile as readFile57, writeFile as writeFile42 } from "fs/promises";
409512
409620
  import { join as join150 } from "path";
409513
409621
  import { pipeline as pipeline2 } from "stream/promises";
409514
409622
  import {
@@ -409533,7 +409641,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
409533
409641
  } catch {}
409534
409642
  let smapsRollup;
409535
409643
  try {
409536
- smapsRollup = await readFile56("/proc/self/smaps_rollup", "utf8");
409644
+ smapsRollup = await readFile57("/proc/self/smaps_rollup", "utf8");
409537
409645
  } catch {}
409538
409646
  const nativeMemory = usage.rss - usage.heapUsed;
409539
409647
  const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
@@ -411340,7 +411448,7 @@ var init_ExitFlow = __esm(() => {
411340
411448
  });
411341
411449
 
411342
411450
  // src/tui/utils/concurrentSessions.ts
411343
- import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as readFile57, unlink as unlink21, writeFile as writeFile43 } from "fs/promises";
411451
+ import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as readFile58, unlink as unlink21, writeFile as writeFile43 } from "fs/promises";
411344
411452
  import { join as join152 } from "path";
411345
411453
  function getSessionsDir() {
411346
411454
  return join152(getAtlasConfigHomeDir3(), "sessions");
@@ -411396,7 +411504,7 @@ async function registerSession2() {
411396
411504
  async function updatePidFile(patch) {
411397
411505
  const pidFile = join152(getSessionsDir(), `${process.pid}.json`);
411398
411506
  try {
411399
- const data = jsonParse2(await readFile57(pidFile, "utf8"));
411507
+ const data = jsonParse2(await readFile58(pidFile, "utf8"));
411400
411508
  await writeFile43(pidFile, jsonStringify5({ ...data, ...patch }));
411401
411509
  } catch (e) {
411402
411510
  logForDebugging3(`[concurrentSessions] updatePidFile failed: ${errorMessage2(e)}`);
@@ -416519,7 +416627,7 @@ __export(exports_insights, {
416519
416627
  import {
416520
416628
  mkdir as mkdir50,
416521
416629
  readdir as readdir32,
416522
- readFile as readFile58,
416630
+ readFile as readFile59,
416523
416631
  unlink as unlink23,
416524
416632
  writeFile as writeFile45
416525
416633
  } from "fs/promises";
@@ -416880,7 +416988,7 @@ async function formatTranscriptWithSummarization(log) {
416880
416988
  async function loadCachedFacets(sessionId) {
416881
416989
  const facetPath = join158(getFacetsDir(), `${sessionId}.json`);
416882
416990
  try {
416883
- const content = await readFile58(facetPath, { encoding: "utf-8" });
416991
+ const content = await readFile59(facetPath, { encoding: "utf-8" });
416884
416992
  const parsed = jsonParse2(content);
416885
416993
  if (!isValidSessionFacets(parsed)) {
416886
416994
  try {
@@ -416906,7 +417014,7 @@ async function saveFacets(facets) {
416906
417014
  async function loadCachedSessionMeta(sessionId) {
416907
417015
  const metaPath = join158(getSessionMetaDir(), `${sessionId}.json`);
416908
417016
  try {
416909
- const content = await readFile58(metaPath, { encoding: "utf-8" });
417017
+ const content = await readFile59(metaPath, { encoding: "utf-8" });
416910
417018
  return jsonParse2(content);
416911
417019
  } catch {
416912
417020
  return null;
@@ -418953,7 +419061,7 @@ import {
418953
419061
  open as fsOpen3,
418954
419062
  mkdir as mkdir51,
418955
419063
  readdir as readdir33,
418956
- readFile as readFile59,
419064
+ readFile as readFile60,
418957
419065
  stat as stat49,
418958
419066
  unlink as unlink24,
418959
419067
  writeFile as writeFile46
@@ -419009,7 +419117,7 @@ async function writeAgentMetadata(agentId, metadata) {
419009
419117
  async function readAgentMetadata(agentId) {
419010
419118
  const path = getAgentMetadataPath(agentId);
419011
419119
  try {
419012
- const raw = await readFile59(path, "utf-8");
419120
+ const raw = await readFile60(path, "utf-8");
419013
419121
  return JSON.parse(raw);
419014
419122
  } catch (e) {
419015
419123
  if (isFsInaccessible2(e))
@@ -419334,7 +419442,7 @@ class Project2 {
419334
419442
  logForDebugging3(`Skipping tombstone removal: session file too large (${formatFileSize3(fileSize)})`, { level: "warn" });
419335
419443
  return;
419336
419444
  }
419337
- const content = await readFile59(this.sessionFile, { encoding: "utf-8" });
419445
+ const content = await readFile60(this.sessionFile, { encoding: "utf-8" });
419338
419446
  const lines = content.split(`
419339
419447
  `).filter((line) => {
419340
419448
  if (!line.trim())
@@ -420588,7 +420696,7 @@ async function loadTranscriptFile2(filePath, opts) {
420588
420696
  }
420589
420697
  }
420590
420698
  }
420591
- buf ??= await readFile59(filePath);
420699
+ buf ??= await readFile60(filePath);
420592
420700
  if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy2(process.env.ATLAS_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD2) {
420593
420701
  buf = walkChainBeforeParse2(buf);
420594
420702
  }
@@ -421512,7 +421620,7 @@ var init_sessionStorage = __esm(() => {
421512
421620
  // src/tui/utils/plans.ts
421513
421621
  import { randomUUID as randomUUID40 } from "crypto";
421514
421622
  import { copyFile as copyFile9, writeFile as writeFile47 } from "fs/promises";
421515
- import { join as join160, resolve as resolve50, sep as sep34 } from "path";
421623
+ import { join as join160, resolve as resolve51, sep as sep34 } from "path";
421516
421624
  function getPlanSlug2(sessionId) {
421517
421625
  const id = sessionId ?? getSessionId();
421518
421626
  const cache = getPlanSlugCache();
@@ -421722,7 +421830,7 @@ var init_plans = __esm(() => {
421722
421830
  let plansPath;
421723
421831
  if (settingsDir) {
421724
421832
  const cwd = getCwd();
421725
- const resolved = resolve50(cwd, settingsDir);
421833
+ const resolved = resolve51(cwd, settingsDir);
421726
421834
  if (!resolved.startsWith(cwd + sep34) && resolved !== cwd) {
421727
421835
  logError3(new Error(`plansDirectory must be within project root: ${settingsDir}`));
421728
421836
  plansPath = join160(getAtlasConfigHomeDir3(), "plans");
@@ -429594,7 +429702,7 @@ var init_compact4 = __esm(() => {
429594
429702
  });
429595
429703
 
429596
429704
  // src/tui/services/SessionMemory/prompts.ts
429597
- import { readFile as readFile60 } from "fs/promises";
429705
+ import { readFile as readFile61 } from "fs/promises";
429598
429706
  import { join as join163 } from "path";
429599
429707
  function getDefaultUpdatePrompt() {
429600
429708
  return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
@@ -429638,7 +429746,7 @@ REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edit
429638
429746
  async function loadSessionMemoryTemplate() {
429639
429747
  const templatePath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "template.md");
429640
429748
  try {
429641
- return await readFile60(templatePath, { encoding: "utf-8" });
429749
+ return await readFile61(templatePath, { encoding: "utf-8" });
429642
429750
  } catch (e) {
429643
429751
  const code = getErrnoCode2(e);
429644
429752
  if (code === "ENOENT") {
@@ -429651,7 +429759,7 @@ async function loadSessionMemoryTemplate() {
429651
429759
  async function loadSessionMemoryPrompt() {
429652
429760
  const promptPath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "prompt.md");
429653
429761
  try {
429654
- return await readFile60(promptPath, { encoding: "utf-8" });
429762
+ return await readFile61(promptPath, { encoding: "utf-8" });
429655
429763
  } catch (e) {
429656
429764
  const code = getErrnoCode2(e);
429657
429765
  if (code === "ENOENT") {
@@ -431702,6 +431810,7 @@ var init_managedEnvConstants = __esm(() => {
431702
431810
  "MAX_THINKING_TOKENS",
431703
431811
  "MCP_TIMEOUT",
431704
431812
  "MCP_TOOL_TIMEOUT",
431813
+ "MCP_CONNECTION_NONBLOCKING",
431705
431814
  "OTEL_EXPORTER_OTLP_HEADERS",
431706
431815
  "OTEL_EXPORTER_OTLP_LOGS_HEADERS",
431707
431816
  "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL",
@@ -464756,7 +464865,7 @@ var init_coordinatorHandler = __esm(() => {
464756
464865
  });
464757
464866
 
464758
464867
  // src/tui/utils/permissions/sessionPermissionRules.ts
464759
- import { mkdir as mkdir53, readFile as readFile61, rename as rename11, writeFile as writeFile48 } from "fs/promises";
464868
+ import { mkdir as mkdir53, readFile as readFile62, rename as rename11, writeFile as writeFile48 } from "fs/promises";
464760
464869
  import { dirname as dirname80, join as join170 } from "path";
464761
464870
  function sessionRulesPath(sessionId, projectDir) {
464762
464871
  return join170(projectDir, `${sessionId}${SESSION_RULES_FILE_SUFFIX}`);
@@ -464797,7 +464906,7 @@ function isSessionAddRules(u) {
464797
464906
  }
464798
464907
  async function readSessionPermissionRules(sessionId, projectDir) {
464799
464908
  try {
464800
- const raw = await readFile61(sessionRulesPath(sessionId, projectDir), "utf8");
464909
+ const raw = await readFile62(sessionRulesPath(sessionId, projectDir), "utf8");
464801
464910
  return parseSessionRulesJson(raw);
464802
464911
  } catch (e) {
464803
464912
  logForDebugging3(`readSessionPermissionRules: no/corrupt sidecar for ${sessionId}: ${e}`);
@@ -465091,6 +465200,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
465091
465200
  });
465092
465201
  },
465093
465202
  async handleHookAllow(finalInput, permissionUpdates, permissionPromptStartTimeMs) {
465203
+ const denyCheck = await checkRuleBasedPermissions(tool, finalInput, toolUseContext);
465204
+ if (denyCheck && denyCheck.behavior === "deny") {
465205
+ this.logDecision({ decision: "reject", source: { type: "hook" } }, { input: finalInput, permissionPromptStartTimeMs });
465206
+ return this.buildDeny(denyCheck.message, denyCheck.decisionReason);
465207
+ }
465094
465208
  const acceptedPermanentUpdates = await this.persistPermissions(permissionUpdates);
465095
465209
  this.logDecision({
465096
465210
  decision: "accept",
@@ -465133,6 +465247,7 @@ var init_PermissionContext = __esm(() => {
465133
465247
  init_debug();
465134
465248
  init_log5();
465135
465249
  init_sessionPermissionRules();
465250
+ init_permissions6();
465136
465251
  init_hooks7();
465137
465252
  init_messages3();
465138
465253
  init_PermissionUpdate();
@@ -469199,11 +469314,11 @@ var init_builtinMarketplaceSnapshots = __esm(() => {
469199
469314
  // src/tui/utils/plugins/marketplaceSnapshotFallback.ts
469200
469315
  import {
469201
469316
  mkdir as mkdir54,
469202
- readFile as readFile62,
469317
+ readFile as readFile63,
469203
469318
  rm as rm11,
469204
469319
  writeFile as writeFile49
469205
469320
  } from "fs/promises";
469206
- import { join as join173, resolve as resolve53, sep as sep41 } from "path";
469321
+ import { join as join173, resolve as resolve54, sep as sep41 } from "path";
469207
469322
  function getBuiltinSnapshotRoot() {
469208
469323
  return join173(getMarketplacesCacheDir(), "builtin-snapshots");
469209
469324
  }
@@ -469215,7 +469330,7 @@ function isBuiltinSnapshotEntry(entry) {
469215
469330
  return false;
469216
469331
  if (entry.source.source !== "directory")
469217
469332
  return false;
469218
- const root = resolve53(getBuiltinSnapshotRoot()) + sep41;
469333
+ const root = resolve54(getBuiltinSnapshotRoot()) + sep41;
469219
469334
  return entry.installLocation.startsWith(root);
469220
469335
  }
469221
469336
  async function installBuiltinSnapshotFallback(marketplaceName) {
@@ -469261,7 +469376,7 @@ async function materializeSnapshot(snapshotDir, manifest) {
469261
469376
  await mkdir54(join173(snapshotDir, manifestDirName), { recursive: true });
469262
469377
  const content = jsonStringify5(manifest, null, 2);
469263
469378
  await writeFile49(manifestPath, content, { encoding: "utf-8" });
469264
- const roundTrip = JSON.parse(await readFile62(manifestPath, "utf-8"));
469379
+ const roundTrip = JSON.parse(await readFile63(manifestPath, "utf-8"));
469265
469380
  PluginMarketplaceSchema().parse(roundTrip);
469266
469381
  }
469267
469382
  var init_marketplaceSnapshotFallback = __esm(() => {
@@ -471736,7 +471851,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
471736
471851
  });
471737
471852
 
471738
471853
  // src/tui/utils/plugins/reconciler.ts
471739
- import { isAbsolute as isAbsolute34, resolve as resolve54 } from "path";
471854
+ import { isAbsolute as isAbsolute34, resolve as resolve55 } from "path";
471740
471855
  function diffMarketplaces(declared, materialized, opts) {
471741
471856
  const missing = [];
471742
471857
  const sourceChanged = [];
@@ -471849,7 +471964,7 @@ function normalizeSource(source, projectRoot) {
471849
471964
  const canonicalRoot = findCanonicalGitRoot2(base);
471850
471965
  return {
471851
471966
  ...source,
471852
- path: resolve54(canonicalRoot ?? base, source.path)
471967
+ path: resolve55(canonicalRoot ?? base, source.path)
471853
471968
  };
471854
471969
  }
471855
471970
  return source;
@@ -474841,7 +474956,7 @@ var init_cronJitterConfig2 = __esm(() => {
474841
474956
  });
474842
474957
 
474843
474958
  // src/tui/utils/cronTasksLock.ts
474844
- import { mkdir as mkdir55, readFile as readFile63, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
474959
+ import { mkdir as mkdir55, readFile as readFile64, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
474845
474960
  import { dirname as dirname83, join as join176 } from "path";
474846
474961
  function getLockPath3(dir) {
474847
474962
  return join176(dir ?? getProjectRoot(), LOCK_FILE_REL2);
@@ -474849,7 +474964,7 @@ function getLockPath3(dir) {
474849
474964
  async function readLock3(dir) {
474850
474965
  let raw;
474851
474966
  try {
474852
- raw = await readFile63(getLockPath3(dir), "utf8");
474967
+ raw = await readFile64(getLockPath3(dir), "utf8");
474853
474968
  } catch {
474854
474969
  return;
474855
474970
  }
@@ -486991,7 +487106,7 @@ var init_mcp8 = __esm(() => {
486991
487106
  });
486992
487107
 
486993
487108
  // src/tui/utils/atlasDesktop.ts
486994
- import { readdir as readdir34, readFile as readFile64, stat as stat55 } from "fs/promises";
487109
+ import { readdir as readdir34, readFile as readFile65, stat as stat55 } from "fs/promises";
486995
487110
  import { homedir as homedir47 } from "os";
486996
487111
  import { join as join183 } from "path";
486997
487112
  async function getDesktopConfigPath() {
@@ -487039,7 +487154,7 @@ async function readDesktopMcpServers() {
487039
487154
  const configPath = await getDesktopConfigPath();
487040
487155
  let configContent;
487041
487156
  try {
487042
- configContent = await readFile64(configPath, { encoding: "utf8" });
487157
+ configContent = await readFile65(configPath, { encoding: "utf8" });
487043
487158
  } catch (e) {
487044
487159
  const code = getErrnoCode2(e);
487045
487160
  if (code === "ENOENT") {
@@ -487474,12 +487589,12 @@ var init_auth6 = __esm(() => {
487474
487589
  });
487475
487590
 
487476
487591
  // src/tui/utils/plugins/marketplacePublish.ts
487477
- import { cp, mkdir as mkdir56, readFile as readFile65, rm as rm12, writeFile as writeFile53 } from "fs/promises";
487592
+ import { cp, mkdir as mkdir56, readFile as readFile66, rm as rm12, writeFile as writeFile53 } from "fs/promises";
487478
487593
  import {
487479
487594
  dirname as dirname87,
487480
487595
  join as join184,
487481
487596
  relative as relative38,
487482
- resolve as resolve55,
487597
+ resolve as resolve56,
487483
487598
  sep as sep43
487484
487599
  } from "path";
487485
487600
  function git(marketplaceDir, args, timeoutMs = 2 * 60 * 1000) {
@@ -487492,8 +487607,8 @@ function gitFailureMessage(res) {
487492
487607
  return (res.stderr || res.error || `exit code ${res.code}`).trim();
487493
487608
  }
487494
487609
  async function publishPluginToMarketplace(opts) {
487495
- const pluginDir = resolve55(opts.pluginDir);
487496
- const marketplaceDir = resolve55(opts.marketplaceDir);
487610
+ const pluginDir = resolve56(opts.pluginDir);
487611
+ const marketplaceDir = resolve56(opts.marketplaceDir);
487497
487612
  const notes = [];
487498
487613
  if (pluginDir === marketplaceDir || pluginDir.startsWith(marketplaceDir + sep43)) {
487499
487614
  throw new Error(`Cannot publish "${pluginDir}": the plugin directory must not live inside the target marketplace (${marketplaceDir})`);
@@ -487501,7 +487616,7 @@ async function publishPluginToMarketplace(opts) {
487501
487616
  const pluginManifestPath = findManifestInDir(pluginDir, "plugin.json");
487502
487617
  let pluginManifestRaw;
487503
487618
  try {
487504
- pluginManifestRaw = await readFile65(pluginManifestPath, {
487619
+ pluginManifestRaw = await readFile66(pluginManifestPath, {
487505
487620
  encoding: "utf-8"
487506
487621
  });
487507
487622
  } catch {
@@ -487526,7 +487641,7 @@ async function publishPluginToMarketplace(opts) {
487526
487641
  const marketplaceManifestPath = findManifestInDir(marketplaceDir, "marketplace.json");
487527
487642
  let marketplaceRaw;
487528
487643
  try {
487529
- marketplaceRaw = await readFile65(marketplaceManifestPath, {
487644
+ marketplaceRaw = await readFile66(marketplaceManifestPath, {
487530
487645
  encoding: "utf-8"
487531
487646
  });
487532
487647
  } catch {
@@ -487624,9 +487739,9 @@ var init_marketplacePublish = __esm(() => {
487624
487739
  import { userInfo as userInfo2 } from "os";
487625
487740
  import { existsSync as existsSync15 } from "fs";
487626
487741
  import { mkdir as mkdir57, writeFile as writeFile54 } from "fs/promises";
487627
- import { dirname as dirname88, join as join185, resolve as resolve56 } from "path";
487742
+ import { dirname as dirname88, join as join185, resolve as resolve57 } from "path";
487628
487743
  async function scaffoldMarketplace(opts) {
487629
- const targetDir = resolve56(opts.targetDir);
487744
+ const targetDir = resolve57(opts.targetDir);
487630
487745
  const name = opts.name.trim();
487631
487746
  const manifestDirName = getPluginManifestDirs()[0];
487632
487747
  const marketplaceManifestPath = join185(targetDir, manifestDirName, "marketplace.json");
@@ -487712,7 +487827,7 @@ var init_marketplaceScaffold = __esm(() => {
487712
487827
  });
487713
487828
 
487714
487829
  // src/tui/cli/handlers/plugins.ts
487715
- import { basename as basename65, dirname as dirname89, resolve as resolve57 } from "path";
487830
+ import { basename as basename65, dirname as dirname89, resolve as resolve58 } from "path";
487716
487831
  function handleMarketplaceError(error, action) {
487717
487832
  logError3(error);
487718
487833
  cliError2(`${figures_default.cross} Failed to ${action}: ${errorMessage2(error)}`);
@@ -488064,7 +488179,7 @@ async function marketplaceUpdateHandler(name, options) {
488064
488179
  async function marketplaceScaffoldHandler(options) {
488065
488180
  if (options.cowork)
488066
488181
  setUseCoworkPlugins(true);
488067
- const targetDir = resolve57(options.target ?? process.cwd());
488182
+ const targetDir = resolve58(options.target ?? process.cwd());
488068
488183
  try {
488069
488184
  const result = await scaffoldMarketplace({
488070
488185
  name: options.name,
@@ -488089,8 +488204,8 @@ async function marketplacePublishHandler(options) {
488089
488204
  setUseCoworkPlugins(true);
488090
488205
  try {
488091
488206
  const result = await publishPluginToMarketplace({
488092
- pluginDir: resolve57(options.plugin),
488093
- marketplaceDir: resolve57(options.marketplace),
488207
+ pluginDir: resolve58(options.plugin),
488208
+ marketplaceDir: resolve58(options.marketplace),
488094
488209
  version: options.version,
488095
488210
  push: options.push
488096
488211
  });
@@ -489306,7 +489421,7 @@ var init_update2 = __esm(() => {
489306
489421
 
489307
489422
  // src/tui/main.tsx
489308
489423
  import { readFileSync as readFileSync25 } from "fs";
489309
- import { resolve as resolve58 } from "path";
489424
+ import { resolve as resolve59 } from "path";
489310
489425
  function logManagedSettings() {
489311
489426
  try {
489312
489427
  const policySettings = getSettingsForSource2("policySettings");
@@ -489873,12 +489988,12 @@ ${getTmuxInstallInstructions3()}
489873
489988
  process.exit(1);
489874
489989
  }
489875
489990
  try {
489876
- const filePath = resolve58(options.systemPromptFile);
489991
+ const filePath = resolve59(options.systemPromptFile);
489877
489992
  systemPrompt = readFileSync25(filePath, "utf8");
489878
489993
  } catch (error) {
489879
489994
  const code = getErrnoCode2(error);
489880
489995
  if (code === "ENOENT") {
489881
- process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve58(options.systemPromptFile)}
489996
+ process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve59(options.systemPromptFile)}
489882
489997
  `));
489883
489998
  process.exit(1);
489884
489999
  }
@@ -489895,12 +490010,12 @@ ${getTmuxInstallInstructions3()}
489895
490010
  process.exit(1);
489896
490011
  }
489897
490012
  try {
489898
- const filePath = resolve58(options.appendSystemPromptFile);
490013
+ const filePath = resolve59(options.appendSystemPromptFile);
489899
490014
  appendSystemPrompt = readFileSync25(filePath, "utf8");
489900
490015
  } catch (error) {
489901
490016
  const code = getErrnoCode2(error);
489902
490017
  if (code === "ENOENT") {
489903
- process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve58(options.appendSystemPromptFile)}
490018
+ process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve59(options.appendSystemPromptFile)}
489904
490019
  `));
489905
490020
  process.exit(1);
489906
490021
  }
@@ -489950,7 +490065,7 @@ ${addendum}` : addendum;
489950
490065
  errors = result.errors;
489951
490066
  }
489952
490067
  } else {
489953
- const configPath = resolve58(configItem);
490068
+ const configPath = resolve59(configItem);
489954
490069
  const result = parseMcpConfigFromFilePath({
489955
490070
  filePath: configPath,
489956
490071
  expandVars: true,
@@ -491596,7 +491711,7 @@ function createInMemorySandboxDeps() {
491596
491711
  // src/atlascode/adapters/sessionMemoryPortAdapter.ts
491597
491712
  init_engine();
491598
491713
  init_shared();
491599
- import { mkdir as mkdir12, readFile as readFile12, writeFile as writeFile8 } from "fs/promises";
491714
+ import { mkdir as mkdir12, readFile as readFile13, writeFile as writeFile8 } from "fs/promises";
491600
491715
  import { dirname as dirname22, join as join41 } from "path";
491601
491716
  function sessionMemoryPath() {
491602
491717
  const env = getSessionEnv();
@@ -491606,7 +491721,7 @@ function createSessionMemoryPort() {
491606
491721
  return {
491607
491722
  async load() {
491608
491723
  try {
491609
- return await readFile12(sessionMemoryPath(), "utf-8");
491724
+ return await readFile13(sessionMemoryPath(), "utf-8");
491610
491725
  } catch (e) {
491611
491726
  if (isFsInaccessible(e))
491612
491727
  return null;
@@ -492225,7 +492340,7 @@ function getAscendExecutor() {
492225
492340
  return _instance;
492226
492341
  }
492227
492342
  // src/ascend/tools/SpecParser.ts
492228
- import { readFile as readFile13 } from "node:fs/promises";
492343
+ import { readFile as readFile14 } from "node:fs/promises";
492229
492344
 
492230
492345
  // src/ascend/tools/constants.ts
492231
492346
  var SPEC_PARSER_TOOL_NAME = "AscendSpecParser";
@@ -492293,7 +492408,7 @@ var SpecParser = {
492293
492408
  let raw = inp.spec_source;
492294
492409
  let parsedFromFile = false;
492295
492410
  try {
492296
- const fileContent = await readFile13(inp.spec_source, "utf-8");
492411
+ const fileContent = await readFile14(inp.spec_source, "utf-8");
492297
492412
  raw = fileContent;
492298
492413
  parsedFromFile = true;
492299
492414
  } catch {}