@posthog/agent 2.3.510 → 2.3.513

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/agent.js CHANGED
@@ -63,11 +63,11 @@ var require_tree_sitter = __commonJS({
63
63
  throw toThrow;
64
64
  };
65
65
  var scriptDirectory = "";
66
- function locateFile(path15) {
66
+ function locateFile(path16) {
67
67
  if (Module["locateFile"]) {
68
- return Module["locateFile"](path15, scriptDirectory);
68
+ return Module["locateFile"](path16, scriptDirectory);
69
69
  }
70
- return scriptDirectory + path15;
70
+ return scriptDirectory + path16;
71
71
  }
72
72
  var readAsync, readBinary;
73
73
  if (ENVIRONMENT_IS_NODE) {
@@ -2588,8 +2588,8 @@ var require_tree_sitter = __commonJS({
2588
2588
  } else {
2589
2589
  const url = input;
2590
2590
  if (typeof process !== "undefined" && process.versions && process.versions.node) {
2591
- const fs11 = __require("fs");
2592
- bytes = Promise.resolve(fs11.readFileSync(url));
2591
+ const fs12 = __require("fs");
2592
+ bytes = Promise.resolve(fs12.readFileSync(url));
2593
2593
  } else {
2594
2594
  bytes = fetch(url).then((response) => response.arrayBuffer().then((buffer) => {
2595
2595
  if (response.ok) {
@@ -3400,7 +3400,7 @@ var require_has_flag = __commonJS({
3400
3400
  var require_supports_color = __commonJS({
3401
3401
  "../../node_modules/supports-color/index.js"(exports2, module2) {
3402
3402
  "use strict";
3403
- var os6 = __require("os");
3403
+ var os7 = __require("os");
3404
3404
  var tty = __require("tty");
3405
3405
  var hasFlag = require_has_flag();
3406
3406
  var { env } = process;
@@ -3448,7 +3448,7 @@ var require_supports_color = __commonJS({
3448
3448
  return min;
3449
3449
  }
3450
3450
  if (process.platform === "win32") {
3451
- const osRelease = os6.release().split(".");
3451
+ const osRelease = os7.release().split(".");
3452
3452
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
3453
3453
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
3454
3454
  }
@@ -3696,10 +3696,10 @@ var require_src2 = __commonJS({
3696
3696
  var fs_1 = __require("fs");
3697
3697
  var debug_1 = __importDefault(require_src());
3698
3698
  var log = debug_1.default("@kwsites/file-exists");
3699
- function check(path15, isFile2, isDirectory) {
3700
- log(`checking %s`, path15);
3699
+ function check(path16, isFile2, isDirectory) {
3700
+ log(`checking %s`, path16);
3701
3701
  try {
3702
- const stat2 = fs_1.statSync(path15);
3702
+ const stat2 = fs_1.statSync(path16);
3703
3703
  if (stat2.isFile() && isFile2) {
3704
3704
  log(`[OK] path represents a file`);
3705
3705
  return true;
@@ -3719,8 +3719,8 @@ var require_src2 = __commonJS({
3719
3719
  throw e;
3720
3720
  }
3721
3721
  }
3722
- function exists2(path15, type = exports2.READABLE) {
3723
- return check(path15, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
3722
+ function exists2(path16, type = exports2.READABLE) {
3723
+ return check(path16, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
3724
3724
  }
3725
3725
  exports2.exists = exists2;
3726
3726
  exports2.FILE = 1;
@@ -4014,9 +4014,9 @@ function nodeWritableToWebWritable(nodeStream) {
4014
4014
 
4015
4015
  // src/adapters/claude/claude-agent.ts
4016
4016
  import { randomUUID } from "crypto";
4017
- import * as fs8 from "fs";
4018
- import * as os4 from "os";
4019
- import * as path12 from "path";
4017
+ import * as fs9 from "fs";
4018
+ import * as os5 from "os";
4019
+ import * as path13 from "path";
4020
4020
  import {
4021
4021
  RequestError as RequestError2
4022
4022
  } from "@agentclientprotocol/sdk";
@@ -4030,7 +4030,7 @@ import { v7 as uuidv7 } from "uuid";
4030
4030
  // package.json
4031
4031
  var package_default = {
4032
4032
  name: "@posthog/agent",
4033
- version: "2.3.510",
4033
+ version: "2.3.513",
4034
4034
  repository: "https://github.com/PostHog/code",
4035
4035
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
4036
4036
  exports: {
@@ -8669,8 +8669,8 @@ var ToolContentBuilder = class {
8669
8669
  this.items.push({ type: "content", content: image(data, mimeType, uri) });
8670
8670
  return this;
8671
8671
  }
8672
- diff(path15, oldText, newText) {
8673
- this.items.push({ type: "diff", path: path15, oldText, newText });
8672
+ diff(path16, oldText, newText) {
8673
+ this.items.push({ type: "diff", path: path16, oldText, newText });
8674
8674
  return this;
8675
8675
  }
8676
8676
  build() {
@@ -11045,6 +11045,31 @@ function getAvailableSlashCommands(commands) {
11045
11045
  }
11046
11046
 
11047
11047
  // src/adapters/claude/session/mcp-config.ts
11048
+ import * as fs4 from "fs";
11049
+ import * as os2 from "os";
11050
+ import * as path8 from "path";
11051
+ function loadUserClaudeJsonMcpServers(cwd, logger, homeDir = os2.homedir()) {
11052
+ const claudeJsonPath = path8.join(homeDir, ".claude.json");
11053
+ let raw;
11054
+ try {
11055
+ raw = fs4.readFileSync(claudeJsonPath, "utf8");
11056
+ } catch {
11057
+ return {};
11058
+ }
11059
+ let cfg;
11060
+ try {
11061
+ cfg = JSON.parse(raw);
11062
+ } catch (err2) {
11063
+ logger?.warn("Failed to parse ~/.claude.json", {
11064
+ error: err2 instanceof Error ? err2.message : String(err2)
11065
+ });
11066
+ return {};
11067
+ }
11068
+ const topLevel = cfg.mcpServers && typeof cfg.mcpServers === "object" ? cfg.mcpServers : {};
11069
+ const project = cfg.projects?.[cwd];
11070
+ const projectScoped = project?.mcpServers && typeof project.mcpServers === "object" ? project.mcpServers : {};
11071
+ return { ...topLevel, ...projectScoped };
11072
+ }
11048
11073
  function parseMcpServers(params) {
11049
11074
  const mcpServers = {};
11050
11075
  if (!Array.isArray(params.mcpServers)) {
@@ -11178,9 +11203,9 @@ function resolveModelPreference(preference, options) {
11178
11203
 
11179
11204
  // src/adapters/claude/session/options.ts
11180
11205
  import { spawn } from "child_process";
11181
- import * as fs4 from "fs";
11182
- import * as os2 from "os";
11183
- import * as path8 from "path";
11206
+ import * as fs5 from "fs";
11207
+ import * as os3 from "os";
11208
+ import * as path9 from "path";
11184
11209
 
11185
11210
  // src/adapters/claude/session/instructions.ts
11186
11211
  var BRANCH_NAMING = `
@@ -11231,8 +11256,9 @@ function buildSystemPrompt(customPrompt) {
11231
11256
  }
11232
11257
  return defaultPrompt;
11233
11258
  }
11234
- function buildMcpServers(userServers, acpServers) {
11259
+ function buildMcpServers(userServers, acpServers, projectScopedServers) {
11235
11260
  return {
11261
+ ...projectScopedServers,
11236
11262
  ...userServers || {},
11237
11263
  ...acpServers
11238
11264
  };
@@ -11381,12 +11407,12 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited, logger)
11381
11407
  };
11382
11408
  }
11383
11409
  function ensureLocalSettings(cwd) {
11384
- const claudeDir = path8.join(cwd, ".claude");
11385
- const localSettingsPath = path8.join(claudeDir, "settings.local.json");
11410
+ const claudeDir = path9.join(cwd, ".claude");
11411
+ const localSettingsPath = path9.join(claudeDir, "settings.local.json");
11386
11412
  try {
11387
- if (!fs4.existsSync(localSettingsPath)) {
11388
- fs4.mkdirSync(claudeDir, { recursive: true });
11389
- fs4.writeFileSync(localSettingsPath, "{}\n", { flag: "wx" });
11413
+ if (!fs5.existsSync(localSettingsPath)) {
11414
+ fs5.mkdirSync(claudeDir, { recursive: true });
11415
+ fs5.writeFileSync(localSettingsPath, "{}\n", { flag: "wx" });
11390
11416
  }
11391
11417
  } catch {
11392
11418
  }
@@ -11416,7 +11442,8 @@ function buildSessionOptions(params) {
11416
11442
  },
11417
11443
  mcpServers: buildMcpServers(
11418
11444
  params.userProvidedOptions?.mcpServers,
11419
- params.mcpServers
11445
+ params.mcpServers,
11446
+ loadUserClaudeJsonMcpServers(params.cwd, params.logger)
11420
11447
  ),
11421
11448
  env: buildEnvironment(),
11422
11449
  hooks: buildHooks(
@@ -11461,18 +11488,18 @@ function buildSessionOptions(params) {
11461
11488
  return options;
11462
11489
  }
11463
11490
  function clearStatsigCache() {
11464
- const statsigPath = path8.join(
11465
- process.env.CLAUDE_CONFIG_DIR || path8.join(os2.homedir(), ".claude"),
11491
+ const statsigPath = path9.join(
11492
+ process.env.CLAUDE_CONFIG_DIR || path9.join(os3.homedir(), ".claude"),
11466
11493
  "statsig"
11467
11494
  );
11468
- fs4.rm(statsigPath, { recursive: true, force: true }, () => {
11495
+ fs5.rm(statsigPath, { recursive: true, force: true }, () => {
11469
11496
  });
11470
11497
  }
11471
11498
 
11472
11499
  // src/adapters/claude/session/settings.ts
11473
- import * as fs7 from "fs";
11474
- import * as os3 from "os";
11475
- import * as path11 from "path";
11500
+ import * as fs8 from "fs";
11501
+ import * as os4 from "os";
11502
+ import * as path12 from "path";
11476
11503
  import { minimatch } from "minimatch";
11477
11504
 
11478
11505
  // src/utils/async-mutex.ts
@@ -11505,8 +11532,8 @@ var AsyncMutex = class {
11505
11532
  };
11506
11533
 
11507
11534
  // ../git/dist/queries.js
11508
- import * as fs6 from "fs/promises";
11509
- import * as path10 from "path";
11535
+ import * as fs7 from "fs/promises";
11536
+ import * as path11 from "path";
11510
11537
 
11511
11538
  // ../../node_modules/simple-git/dist/esm/index.js
11512
11539
  var import_file_exists = __toESM(require_dist(), 1);
@@ -11545,8 +11572,8 @@ function pathspec(...paths) {
11545
11572
  cache.set(key, paths);
11546
11573
  return key;
11547
11574
  }
11548
- function isPathSpec(path15) {
11549
- return path15 instanceof String && cache.has(path15);
11575
+ function isPathSpec(path16) {
11576
+ return path16 instanceof String && cache.has(path16);
11550
11577
  }
11551
11578
  function toPaths(pathSpec) {
11552
11579
  return cache.get(pathSpec) || [];
@@ -11635,8 +11662,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
11635
11662
  function forEachLineWithContent(input, callback) {
11636
11663
  return toLinesWithContent(input, true).map((line) => callback(line));
11637
11664
  }
11638
- function folderExists(path15) {
11639
- return (0, import_file_exists.exists)(path15, import_file_exists.FOLDER);
11665
+ function folderExists(path16) {
11666
+ return (0, import_file_exists.exists)(path16, import_file_exists.FOLDER);
11640
11667
  }
11641
11668
  function append(target, item) {
11642
11669
  if (Array.isArray(target)) {
@@ -12040,8 +12067,8 @@ function checkIsRepoRootTask() {
12040
12067
  commands,
12041
12068
  format: "utf-8",
12042
12069
  onError,
12043
- parser(path15) {
12044
- return /^\.(git)?$/.test(path15.trim());
12070
+ parser(path16) {
12071
+ return /^\.(git)?$/.test(path16.trim());
12045
12072
  }
12046
12073
  };
12047
12074
  }
@@ -12475,11 +12502,11 @@ function parseGrep(grep) {
12475
12502
  const paths = /* @__PURE__ */ new Set();
12476
12503
  const results = {};
12477
12504
  forEachLineWithContent(grep, (input) => {
12478
- const [path15, line, preview] = input.split(NULL);
12479
- paths.add(path15);
12480
- (results[path15] = results[path15] || []).push({
12505
+ const [path16, line, preview] = input.split(NULL);
12506
+ paths.add(path16);
12507
+ (results[path16] = results[path16] || []).push({
12481
12508
  line: asNumber(line),
12482
- path: path15,
12509
+ path: path16,
12483
12510
  preview
12484
12511
  });
12485
12512
  });
@@ -13244,14 +13271,14 @@ var init_hash_object = __esm({
13244
13271
  init_task();
13245
13272
  }
13246
13273
  });
13247
- function parseInit(bare, path15, text2) {
13274
+ function parseInit(bare, path16, text2) {
13248
13275
  const response = String(text2).trim();
13249
13276
  let result;
13250
13277
  if (result = initResponseRegex.exec(response)) {
13251
- return new InitSummary(bare, path15, false, result[1]);
13278
+ return new InitSummary(bare, path16, false, result[1]);
13252
13279
  }
13253
13280
  if (result = reInitResponseRegex.exec(response)) {
13254
- return new InitSummary(bare, path15, true, result[1]);
13281
+ return new InitSummary(bare, path16, true, result[1]);
13255
13282
  }
13256
13283
  let gitDir = "";
13257
13284
  const tokens = response.split(" ");
@@ -13262,7 +13289,7 @@ function parseInit(bare, path15, text2) {
13262
13289
  break;
13263
13290
  }
13264
13291
  }
13265
- return new InitSummary(bare, path15, /^re/i.test(response), gitDir);
13292
+ return new InitSummary(bare, path16, /^re/i.test(response), gitDir);
13266
13293
  }
13267
13294
  var InitSummary;
13268
13295
  var initResponseRegex;
@@ -13271,9 +13298,9 @@ var init_InitSummary = __esm({
13271
13298
  "src/lib/responses/InitSummary.ts"() {
13272
13299
  "use strict";
13273
13300
  InitSummary = class {
13274
- constructor(bare, path15, existing, gitDir) {
13301
+ constructor(bare, path16, existing, gitDir) {
13275
13302
  this.bare = bare;
13276
- this.path = path15;
13303
+ this.path = path16;
13277
13304
  this.existing = existing;
13278
13305
  this.gitDir = gitDir;
13279
13306
  }
@@ -13285,7 +13312,7 @@ var init_InitSummary = __esm({
13285
13312
  function hasBareCommand(command) {
13286
13313
  return command.includes(bareCommand);
13287
13314
  }
13288
- function initTask(bare = false, path15, customArgs) {
13315
+ function initTask(bare = false, path16, customArgs) {
13289
13316
  const commands = ["init", ...customArgs];
13290
13317
  if (bare && !hasBareCommand(commands)) {
13291
13318
  commands.splice(1, 0, bareCommand);
@@ -13294,7 +13321,7 @@ function initTask(bare = false, path15, customArgs) {
13294
13321
  commands,
13295
13322
  format: "utf-8",
13296
13323
  parser(text2) {
13297
- return parseInit(commands.includes("--bare"), path15, text2);
13324
+ return parseInit(commands.includes("--bare"), path16, text2);
13298
13325
  }
13299
13326
  };
13300
13327
  }
@@ -14110,12 +14137,12 @@ var init_FileStatusSummary = __esm({
14110
14137
  "use strict";
14111
14138
  fromPathRegex = /^(.+)\0(.+)$/;
14112
14139
  FileStatusSummary = class {
14113
- constructor(path15, index, working_dir) {
14114
- this.path = path15;
14140
+ constructor(path16, index, working_dir) {
14141
+ this.path = path16;
14115
14142
  this.index = index;
14116
14143
  this.working_dir = working_dir;
14117
14144
  if (index === "R" || working_dir === "R") {
14118
- const detail = fromPathRegex.exec(path15) || [null, path15, path15];
14145
+ const detail = fromPathRegex.exec(path16) || [null, path16, path16];
14119
14146
  this.from = detail[2] || "";
14120
14147
  this.path = detail[1] || "";
14121
14148
  }
@@ -14146,14 +14173,14 @@ function splitLine(result, lineStr) {
14146
14173
  default:
14147
14174
  return;
14148
14175
  }
14149
- function data(index, workingDir, path15) {
14176
+ function data(index, workingDir, path16) {
14150
14177
  const raw = `${index}${workingDir}`;
14151
14178
  const handler = parsers6.get(raw);
14152
14179
  if (handler) {
14153
- handler(result, path15);
14180
+ handler(result, path16);
14154
14181
  }
14155
14182
  if (raw !== "##" && raw !== "!!") {
14156
- result.files.push(new FileStatusSummary(path15, index, workingDir));
14183
+ result.files.push(new FileStatusSummary(path16, index, workingDir));
14157
14184
  }
14158
14185
  }
14159
14186
  }
@@ -14466,9 +14493,9 @@ var init_simple_git_api = __esm({
14466
14493
  next
14467
14494
  );
14468
14495
  }
14469
- hashObject(path15, write) {
14496
+ hashObject(path16, write) {
14470
14497
  return this._runTask(
14471
- hashObjectTask(path15, write === true),
14498
+ hashObjectTask(path16, write === true),
14472
14499
  trailingFunctionArgument(arguments)
14473
14500
  );
14474
14501
  }
@@ -14821,8 +14848,8 @@ var init_branch = __esm({
14821
14848
  }
14822
14849
  });
14823
14850
  function toPath(input) {
14824
- const path15 = input.trim().replace(/^["']|["']$/g, "");
14825
- return path15 && normalize(path15);
14851
+ const path16 = input.trim().replace(/^["']|["']$/g, "");
14852
+ return path16 && normalize(path16);
14826
14853
  }
14827
14854
  var parseCheckIgnore;
14828
14855
  var init_CheckIgnore = __esm({
@@ -15136,8 +15163,8 @@ __export(sub_module_exports, {
15136
15163
  subModuleTask: () => subModuleTask,
15137
15164
  updateSubModuleTask: () => updateSubModuleTask
15138
15165
  });
15139
- function addSubModuleTask(repo, path15) {
15140
- return subModuleTask(["add", repo, path15]);
15166
+ function addSubModuleTask(repo, path16) {
15167
+ return subModuleTask(["add", repo, path16]);
15141
15168
  }
15142
15169
  function initSubModuleTask(customArgs) {
15143
15170
  return subModuleTask(["init", ...customArgs]);
@@ -15467,8 +15494,8 @@ var require_git = __commonJS2({
15467
15494
  }
15468
15495
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
15469
15496
  };
15470
- Git2.prototype.submoduleAdd = function(repo, path15, then) {
15471
- return this._runTask(addSubModuleTask2(repo, path15), trailingFunctionArgument2(arguments));
15497
+ Git2.prototype.submoduleAdd = function(repo, path16, then) {
15498
+ return this._runTask(addSubModuleTask2(repo, path16), trailingFunctionArgument2(arguments));
15472
15499
  };
15473
15500
  Git2.prototype.submoduleUpdate = function(args2, then) {
15474
15501
  return this._runTask(
@@ -16069,22 +16096,22 @@ function createGitClient(baseDir, options) {
16069
16096
 
16070
16097
  // ../git/dist/lock-detector.js
16071
16098
  import { execFile } from "child_process";
16072
- import fs5 from "fs/promises";
16073
- import path9 from "path";
16099
+ import fs6 from "fs/promises";
16100
+ import path10 from "path";
16074
16101
  import { promisify } from "util";
16075
16102
  var execFileAsync = promisify(execFile);
16076
16103
  async function getIndexLockPath(repoPath) {
16077
16104
  try {
16078
16105
  const { stdout } = await execFileAsync("git", ["rev-parse", "--git-path", "index.lock"], { cwd: repoPath });
16079
- return path9.resolve(repoPath, stdout.trim());
16106
+ return path10.resolve(repoPath, stdout.trim());
16080
16107
  } catch {
16081
- return path9.join(repoPath, ".git", "index.lock");
16108
+ return path10.join(repoPath, ".git", "index.lock");
16082
16109
  }
16083
16110
  }
16084
16111
  async function getLockInfo(repoPath) {
16085
16112
  const lockPath = await getIndexLockPath(repoPath);
16086
16113
  try {
16087
- const stat2 = await fs5.stat(lockPath);
16114
+ const stat2 = await fs6.stat(lockPath);
16088
16115
  return {
16089
16116
  path: lockPath,
16090
16117
  ageMs: Date.now() - stat2.mtimeMs
@@ -16095,7 +16122,7 @@ async function getLockInfo(repoPath) {
16095
16122
  }
16096
16123
  async function removeLock(repoPath) {
16097
16124
  const lockPath = await getIndexLockPath(repoPath);
16098
- await fs5.rm(lockPath, { force: true });
16125
+ await fs6.rm(lockPath, { force: true });
16099
16126
  }
16100
16127
  async function isLocked(repoPath) {
16101
16128
  return await getLockInfo(repoPath) !== null;
@@ -16344,13 +16371,13 @@ function parseRule(rule) {
16344
16371
  function normalizePath(filePath, cwd) {
16345
16372
  let resolved = filePath;
16346
16373
  if (resolved.startsWith("~/")) {
16347
- resolved = path11.join(os3.homedir(), resolved.slice(2));
16374
+ resolved = path12.join(os4.homedir(), resolved.slice(2));
16348
16375
  } else if (resolved.startsWith("./")) {
16349
- resolved = path11.join(cwd, resolved.slice(2));
16350
- } else if (!path11.isAbsolute(resolved)) {
16351
- resolved = path11.join(cwd, resolved);
16376
+ resolved = path12.join(cwd, resolved.slice(2));
16377
+ } else if (!path12.isAbsolute(resolved)) {
16378
+ resolved = path12.join(cwd, resolved);
16352
16379
  }
16353
- return path11.normalize(resolved).replace(/\\/g, "/");
16380
+ return path12.normalize(resolved).replace(/\\/g, "/");
16354
16381
  }
16355
16382
  function matchesGlob(pattern, filePath, cwd) {
16356
16383
  const normalizedPattern = normalizePath(pattern, cwd);
@@ -16397,11 +16424,11 @@ function formatRule(rule) {
16397
16424
  }
16398
16425
  async function writeFileAtomic(filePath, data) {
16399
16426
  const tmpPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
16400
- await fs7.promises.writeFile(tmpPath, data);
16427
+ await fs8.promises.writeFile(tmpPath, data);
16401
16428
  try {
16402
- await fs7.promises.rename(tmpPath, filePath);
16429
+ await fs8.promises.rename(tmpPath, filePath);
16403
16430
  } catch (error) {
16404
- await fs7.promises.rm(tmpPath, { force: true });
16431
+ await fs8.promises.rm(tmpPath, { force: true });
16405
16432
  throw error;
16406
16433
  }
16407
16434
  }
@@ -16410,7 +16437,7 @@ async function loadSettingsFile(filePath) {
16410
16437
  return {};
16411
16438
  }
16412
16439
  try {
16413
- const content = await fs7.promises.readFile(filePath, "utf-8");
16440
+ const content = await fs8.promises.readFile(filePath, "utf-8");
16414
16441
  return JSON.parse(content);
16415
16442
  } catch (error) {
16416
16443
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -16425,7 +16452,7 @@ async function loadSettingsFile(filePath) {
16425
16452
  }
16426
16453
  async function readSettingsFileForUpdate(filePath) {
16427
16454
  try {
16428
- const content = await fs7.promises.readFile(filePath, "utf-8");
16455
+ const content = await fs8.promises.readFile(filePath, "utf-8");
16429
16456
  return JSON.parse(content);
16430
16457
  } catch (error) {
16431
16458
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -16471,11 +16498,11 @@ var SettingsManager = class {
16471
16498
  return this.initPromise;
16472
16499
  }
16473
16500
  getUserSettingsPath() {
16474
- const configDir = process.env.CLAUDE_CONFIG_DIR || path11.join(os3.homedir(), ".claude");
16475
- return path11.join(configDir, "settings.json");
16501
+ const configDir = process.env.CLAUDE_CONFIG_DIR || path12.join(os4.homedir(), ".claude");
16502
+ return path12.join(configDir, "settings.json");
16476
16503
  }
16477
16504
  getProjectSettingsPath() {
16478
- return path11.join(this.cwd, ".claude", "settings.json");
16505
+ return path12.join(this.cwd, ".claude", "settings.json");
16479
16506
  }
16480
16507
  /**
16481
16508
  * Local settings are anchored to the primary worktree so every worktree of
@@ -16483,7 +16510,7 @@ var SettingsManager = class {
16483
16510
  * avoids re-prompting for the same permission in every worktree.
16484
16511
  */
16485
16512
  getLocalSettingsPath() {
16486
- return path11.join(this.repoRoot, ".claude", "settings.local.json");
16513
+ return path12.join(this.repoRoot, ".claude", "settings.local.json");
16487
16514
  }
16488
16515
  async loadAllSettings() {
16489
16516
  this.repoRoot = await resolveMainRepoPath(this.cwd);
@@ -16610,7 +16637,7 @@ var SettingsManager = class {
16610
16637
  }
16611
16638
  permissions.allow = Array.from(current2);
16612
16639
  const next = { ...existing, permissions };
16613
- await fs7.promises.mkdir(path11.dirname(filePath), { recursive: true });
16640
+ await fs8.promises.mkdir(path12.dirname(filePath), { recursive: true });
16614
16641
  await writeFileAtomic(filePath, `${JSON.stringify(next, null, 2)}
16615
16642
  `);
16616
16643
  this.localSettings = next;
@@ -16643,7 +16670,7 @@ var SettingsManager = class {
16643
16670
  ...existing,
16644
16671
  posthogApprovedExecTools: Array.from(current2)
16645
16672
  };
16646
- await fs7.promises.mkdir(path11.dirname(filePath), { recursive: true });
16673
+ await fs8.promises.mkdir(path12.dirname(filePath), { recursive: true });
16647
16674
  await writeFileAtomic(filePath, `${JSON.stringify(next, null, 2)}
16648
16675
  `);
16649
16676
  this.localSettings = next;
@@ -16749,7 +16776,7 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
16749
16776
  };
16750
16777
  }
16751
16778
  async newSession(params) {
16752
- if (fs8.existsSync(path12.resolve(os4.homedir(), ".claude.json.backup")) && !fs8.existsSync(path12.resolve(os4.homedir(), ".claude.json"))) {
16779
+ if (fs9.existsSync(path13.resolve(os5.homedir(), ".claude.json.backup")) && !fs9.existsSync(path13.resolve(os5.homedir(), ".claude.json"))) {
16753
16780
  throw RequestError2.authRequired();
16754
16781
  }
16755
16782
  const response = await this.createSession(params, {
@@ -17992,9 +18019,9 @@ function resetUsage(state) {
17992
18019
  }
17993
18020
 
17994
18021
  // src/adapters/codex/settings.ts
17995
- import * as fs9 from "fs";
17996
- import * as os5 from "os";
17997
- import * as path13 from "path";
18022
+ import * as fs10 from "fs";
18023
+ import * as os6 from "os";
18024
+ import * as path14 from "path";
17998
18025
  var CodexSettingsManager = class {
17999
18026
  cwd;
18000
18027
  settings = { mcpServerNames: [] };
@@ -18005,12 +18032,12 @@ var CodexSettingsManager = class {
18005
18032
  async initialize() {
18006
18033
  }
18007
18034
  getConfigPath() {
18008
- return path13.join(os5.homedir(), ".codex", "config.toml");
18035
+ return path14.join(os6.homedir(), ".codex", "config.toml");
18009
18036
  }
18010
18037
  loadSettings() {
18011
18038
  const configPath = this.getConfigPath();
18012
18039
  try {
18013
- const content = fs9.readFileSync(configPath, "utf-8");
18040
+ const content = fs10.readFileSync(configPath, "utf-8");
18014
18041
  this.settings = parseCodexToml(content, this.cwd);
18015
18042
  } catch {
18016
18043
  this.settings = { mcpServerNames: [] };
@@ -18988,9 +19015,9 @@ var PostHogAPIClient = class {
18988
19015
  };
18989
19016
 
18990
19017
  // src/session-log-writer.ts
18991
- import fs10 from "fs";
19018
+ import fs11 from "fs";
18992
19019
  import fsp from "fs/promises";
18993
- import path14 from "path";
19020
+ import path15 from "path";
18994
19021
  var SessionLogWriter = class _SessionLogWriter {
18995
19022
  static FLUSH_DEBOUNCE_MS = 500;
18996
19023
  static FLUSH_MAX_INTERVAL_MS = 5e3;
@@ -19026,13 +19053,13 @@ var SessionLogWriter = class _SessionLogWriter {
19026
19053
  this.sessions.set(sessionId, { context, currentTurnMessages: [] });
19027
19054
  this.lastFlushAttemptTime.set(sessionId, Date.now());
19028
19055
  if (this.localCachePath) {
19029
- const sessionDir = path14.join(
19056
+ const sessionDir = path15.join(
19030
19057
  this.localCachePath,
19031
19058
  "sessions",
19032
19059
  context.runId
19033
19060
  );
19034
19061
  try {
19035
- fs10.mkdirSync(sessionDir, { recursive: true });
19062
+ fs11.mkdirSync(sessionDir, { recursive: true });
19036
19063
  } catch (error) {
19037
19064
  this.logger.warn("Failed to create local cache directory", {
19038
19065
  sessionDir,
@@ -19284,14 +19311,14 @@ var SessionLogWriter = class _SessionLogWriter {
19284
19311
  if (!this.localCachePath) return;
19285
19312
  const session = this.sessions.get(sessionId);
19286
19313
  if (!session) return;
19287
- const logPath = path14.join(
19314
+ const logPath = path15.join(
19288
19315
  this.localCachePath,
19289
19316
  "sessions",
19290
19317
  session.context.runId,
19291
19318
  "logs.ndjson"
19292
19319
  );
19293
19320
  try {
19294
- fs10.appendFileSync(logPath, `${JSON.stringify(entry)}
19321
+ fs11.appendFileSync(logPath, `${JSON.stringify(entry)}
19295
19322
  `);
19296
19323
  } catch (error) {
19297
19324
  this.logger.warn("Failed to write to local cache", {
@@ -19303,13 +19330,13 @@ var SessionLogWriter = class _SessionLogWriter {
19303
19330
  }
19304
19331
  }
19305
19332
  static async cleanupOldSessions(localCachePath) {
19306
- const sessionsDir = path14.join(localCachePath, "sessions");
19333
+ const sessionsDir = path15.join(localCachePath, "sessions");
19307
19334
  let deleted = 0;
19308
19335
  try {
19309
19336
  const entries = await fsp.readdir(sessionsDir);
19310
19337
  const now = Date.now();
19311
19338
  for (const entry of entries) {
19312
- const entryPath = path14.join(sessionsDir, entry);
19339
+ const entryPath = path15.join(sessionsDir, entry);
19313
19340
  try {
19314
19341
  const stats = await fsp.stat(entryPath);
19315
19342
  if (stats.isDirectory() && now - stats.birthtimeMs > _SessionLogWriter.SESSIONS_MAX_AGE_MS) {