@posthog/agent 2.3.62 → 2.3.67

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.
@@ -809,10 +809,10 @@ var require_src2 = __commonJS({
809
809
  var fs_1 = __require("fs");
810
810
  var debug_1 = __importDefault(require_src());
811
811
  var log = debug_1.default("@kwsites/file-exists");
812
- function check(path11, isFile, isDirectory) {
813
- log(`checking %s`, path11);
812
+ function check(path12, isFile, isDirectory) {
813
+ log(`checking %s`, path12);
814
814
  try {
815
- const stat = fs_1.statSync(path11);
815
+ const stat = fs_1.statSync(path12);
816
816
  if (stat.isFile() && isFile) {
817
817
  log(`[OK] path represents a file`);
818
818
  return true;
@@ -832,8 +832,8 @@ var require_src2 = __commonJS({
832
832
  throw e;
833
833
  }
834
834
  }
835
- function exists2(path11, type = exports.READABLE) {
836
- return check(path11, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
835
+ function exists2(path12, type = exports.READABLE) {
836
+ return check(path12, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
837
837
  }
838
838
  exports.exists = exists2;
839
839
  exports.FILE = 1;
@@ -908,7 +908,7 @@ import { Hono } from "hono";
908
908
  // package.json
909
909
  var package_default = {
910
910
  name: "@posthog/agent",
911
- version: "2.3.62",
911
+ version: "2.3.67",
912
912
  repository: "https://github.com/PostHog/code",
913
913
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
914
914
  exports: {
@@ -972,13 +972,13 @@ var package_default = {
972
972
  author: "PostHog",
973
973
  license: "SEE LICENSE IN LICENSE",
974
974
  scripts: {
975
- build: "rm -rf dist && tsup",
975
+ build: "node ../../scripts/rimraf.mjs dist && tsup",
976
976
  dev: "tsup --watch",
977
977
  test: "vitest run",
978
978
  "test:watch": "vitest",
979
979
  typecheck: "pnpm exec tsc --noEmit",
980
980
  prepublishOnly: "pnpm run build",
981
- clean: "rm -rf dist .turbo"
981
+ clean: "node ../../scripts/rimraf.mjs dist .turbo"
982
982
  },
983
983
  engines: {
984
984
  node: ">=20.0.0"
@@ -1294,7 +1294,7 @@ function nodeWritableToWebWritable(nodeStream) {
1294
1294
  import { randomUUID } from "crypto";
1295
1295
  import * as fs4 from "fs";
1296
1296
  import * as os4 from "os";
1297
- import * as path5 from "path";
1297
+ import * as path6 from "path";
1298
1298
  import {
1299
1299
  RequestError as RequestError2
1300
1300
  } from "@agentclientprotocol/sdk";
@@ -1465,6 +1465,7 @@ var BaseAcpAgent = class {
1465
1465
  };
1466
1466
 
1467
1467
  // src/adapters/claude/conversion/acp-to-sdk.ts
1468
+ import * as path from "path";
1468
1469
  function sdkText(value) {
1469
1470
  return { type: "text", text: value };
1470
1471
  }
@@ -1472,12 +1473,11 @@ function formatUriAsLink(uri) {
1472
1473
  try {
1473
1474
  if (uri.startsWith("file://")) {
1474
1475
  const filePath = uri.slice(7);
1475
- const name = filePath.split("/").pop() || filePath;
1476
+ const name = path.basename(filePath) || filePath;
1476
1477
  return `[@${name}](${uri})`;
1477
1478
  }
1478
1479
  if (uri.startsWith("zed://")) {
1479
- const parts = uri.split("/");
1480
- const name = parts[parts.length - 1] || uri;
1480
+ const name = path.basename(uri) || uri;
1481
1481
  return `[@${name}](${uri})`;
1482
1482
  }
1483
1483
  return uri;
@@ -1582,8 +1582,8 @@ var ToolContentBuilder = class {
1582
1582
  this.items.push({ type: "content", content: image(data, mimeType, uri) });
1583
1583
  return this;
1584
1584
  }
1585
- diff(path11, oldText, newText) {
1586
- this.items.push({ type: "diff", path: path11, oldText, newText });
1585
+ diff(path12, oldText, newText) {
1586
+ this.items.push({ type: "diff", path: path12, oldText, newText });
1587
1587
  return this;
1588
1588
  }
1589
1589
  build() {
@@ -1669,7 +1669,7 @@ var createPreToolUseHook = (settingsManager, logger) => async (input, _toolUseID
1669
1669
 
1670
1670
  // src/adapters/claude/conversion/tool-use-to-acp.ts
1671
1671
  import fs from "fs";
1672
- import path from "path";
1672
+ import path2 from "path";
1673
1673
 
1674
1674
  // src/adapters/claude/mcp/tool-metadata.ts
1675
1675
  var mcpToolMetadataCache = /* @__PURE__ */ new Map();
@@ -1755,10 +1755,10 @@ function stripSystemReminders(value) {
1755
1755
  }
1756
1756
  function toDisplayPath(filePath, cwd) {
1757
1757
  if (!cwd) return filePath;
1758
- const resolvedCwd = path.resolve(cwd);
1759
- const resolvedFile = path.resolve(filePath);
1760
- if (resolvedFile.startsWith(resolvedCwd + path.sep) || resolvedFile === resolvedCwd) {
1761
- return path.relative(resolvedCwd, resolvedFile);
1758
+ const resolvedCwd = path2.resolve(cwd);
1759
+ const resolvedFile = path2.resolve(filePath);
1760
+ if (resolvedFile.startsWith(resolvedCwd + path2.sep) || resolvedFile === resolvedCwd) {
1761
+ return path2.relative(resolvedCwd, resolvedFile);
1762
1762
  }
1763
1763
  return filePath;
1764
1764
  }
@@ -2867,18 +2867,18 @@ async function handleUserAssistantMessage(message, context) {
2867
2867
 
2868
2868
  // src/adapters/claude/plan/utils.ts
2869
2869
  import * as os from "os";
2870
- import * as path2 from "path";
2870
+ import * as path3 from "path";
2871
2871
  function getClaudeConfigDir() {
2872
- return process.env.CLAUDE_CONFIG_DIR || path2.join(os.homedir(), ".claude");
2872
+ return process.env.CLAUDE_CONFIG_DIR || path3.join(os.homedir(), ".claude");
2873
2873
  }
2874
2874
  function getClaudePlansDir() {
2875
- return path2.join(getClaudeConfigDir(), "plans");
2875
+ return path3.join(getClaudeConfigDir(), "plans");
2876
2876
  }
2877
2877
  function isClaudePlanFilePath(filePath) {
2878
2878
  if (!filePath) return false;
2879
- const resolved = path2.resolve(filePath);
2880
- const plansDir = path2.resolve(getClaudePlansDir());
2881
- return resolved === plansDir || resolved.startsWith(plansDir + path2.sep);
2879
+ const resolved = path3.resolve(filePath);
2880
+ const plansDir = path3.resolve(getClaudePlansDir());
2881
+ return resolved === plansDir || resolved.startsWith(plansDir + path3.sep);
2882
2882
  }
2883
2883
  function isPlanReady(plan) {
2884
2884
  if (!plan) return false;
@@ -3518,7 +3518,7 @@ function getEffortOptions(modelId) {
3518
3518
  import { spawn } from "child_process";
3519
3519
  import * as fs2 from "fs";
3520
3520
  import * as os2 from "os";
3521
- import * as path3 from "path";
3521
+ import * as path4 from "path";
3522
3522
 
3523
3523
  // src/adapters/claude/session/instructions.ts
3524
3524
  var BRANCH_NAMING = `
@@ -3664,8 +3664,8 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited, logger)
3664
3664
  };
3665
3665
  }
3666
3666
  function ensureLocalSettings(cwd) {
3667
- const claudeDir = path3.join(cwd, ".claude");
3668
- const localSettingsPath = path3.join(claudeDir, "settings.local.json");
3667
+ const claudeDir = path4.join(cwd, ".claude");
3668
+ const localSettingsPath = path4.join(claudeDir, "settings.local.json");
3669
3669
  try {
3670
3670
  if (!fs2.existsSync(localSettingsPath)) {
3671
3671
  fs2.mkdirSync(claudeDir, { recursive: true });
@@ -3736,8 +3736,8 @@ function buildSessionOptions(params) {
3736
3736
  return options;
3737
3737
  }
3738
3738
  function clearStatsigCache() {
3739
- const statsigPath = path3.join(
3740
- process.env.CLAUDE_CONFIG_DIR || path3.join(os2.homedir(), ".claude"),
3739
+ const statsigPath = path4.join(
3740
+ process.env.CLAUDE_CONFIG_DIR || path4.join(os2.homedir(), ".claude"),
3741
3741
  "statsig"
3742
3742
  );
3743
3743
  fs2.rm(statsigPath, { recursive: true, force: true }, () => {
@@ -3747,7 +3747,7 @@ function clearStatsigCache() {
3747
3747
  // src/adapters/claude/session/settings.ts
3748
3748
  import * as fs3 from "fs";
3749
3749
  import * as os3 from "os";
3750
- import * as path4 from "path";
3750
+ import * as path5 from "path";
3751
3751
  import { minimatch } from "minimatch";
3752
3752
  var ACP_TOOL_NAME_PREFIX = "mcp__acp__";
3753
3753
  var acpToolNames = {
@@ -3787,13 +3787,13 @@ function parseRule(rule) {
3787
3787
  function normalizePath(filePath, cwd) {
3788
3788
  let resolved = filePath;
3789
3789
  if (resolved.startsWith("~/")) {
3790
- resolved = path4.join(os3.homedir(), resolved.slice(2));
3790
+ resolved = path5.join(os3.homedir(), resolved.slice(2));
3791
3791
  } else if (resolved.startsWith("./")) {
3792
- resolved = path4.join(cwd, resolved.slice(2));
3793
- } else if (!path4.isAbsolute(resolved)) {
3794
- resolved = path4.join(cwd, resolved);
3792
+ resolved = path5.join(cwd, resolved.slice(2));
3793
+ } else if (!path5.isAbsolute(resolved)) {
3794
+ resolved = path5.join(cwd, resolved);
3795
3795
  }
3796
- return path4.normalize(resolved).replace(/\\/g, "/");
3796
+ return path5.normalize(resolved).replace(/\\/g, "/");
3797
3797
  }
3798
3798
  function matchesGlob(pattern, filePath, cwd) {
3799
3799
  const normalizedPattern = normalizePath(pattern, cwd);
@@ -3877,14 +3877,14 @@ var SettingsManager = class {
3877
3877
  this.initialized = true;
3878
3878
  }
3879
3879
  getUserSettingsPath() {
3880
- const configDir = process.env.CLAUDE_CONFIG_DIR || path4.join(os3.homedir(), ".claude");
3881
- return path4.join(configDir, "settings.json");
3880
+ const configDir = process.env.CLAUDE_CONFIG_DIR || path5.join(os3.homedir(), ".claude");
3881
+ return path5.join(configDir, "settings.json");
3882
3882
  }
3883
3883
  getProjectSettingsPath() {
3884
- return path4.join(this.cwd, ".claude", "settings.json");
3884
+ return path5.join(this.cwd, ".claude", "settings.json");
3885
3885
  }
3886
3886
  getLocalSettingsPath() {
3887
- return path4.join(this.cwd, ".claude", "settings.local.json");
3887
+ return path5.join(this.cwd, ".claude", "settings.local.json");
3888
3888
  }
3889
3889
  async loadAllSettings() {
3890
3890
  const [userSettings, projectSettings, localSettings, enterpriseSettings] = await Promise.all([
@@ -4049,7 +4049,7 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
4049
4049
  };
4050
4050
  }
4051
4051
  async newSession(params) {
4052
- if (fs4.existsSync(path5.resolve(os4.homedir(), ".claude.json.backup")) && !fs4.existsSync(path5.resolve(os4.homedir(), ".claude.json"))) {
4052
+ if (fs4.existsSync(path6.resolve(os4.homedir(), ".claude.json.backup")) && !fs4.existsSync(path6.resolve(os4.homedir(), ".claude.json"))) {
4053
4053
  throw RequestError2.authRequired();
4054
4054
  }
4055
4055
  const response = await this.createSession(params, {
@@ -5171,7 +5171,7 @@ function createCodexConnection(config) {
5171
5171
  import { randomUUID as randomUUID2 } from "crypto";
5172
5172
  import * as fs5 from "fs/promises";
5173
5173
  import * as os5 from "os";
5174
- import * as path6 from "path";
5174
+ import * as path7 from "path";
5175
5175
  var CHARS_PER_TOKEN = 4;
5176
5176
  var DEFAULT_MAX_TOKENS = 15e4;
5177
5177
  function estimateTurnTokens(turn) {
@@ -5518,7 +5518,7 @@ var Saga = class {
5518
5518
 
5519
5519
  // ../git/dist/queries.js
5520
5520
  import * as fs7 from "fs/promises";
5521
- import * as path8 from "path";
5521
+ import * as path9 from "path";
5522
5522
 
5523
5523
  // ../../node_modules/simple-git/dist/esm/index.js
5524
5524
  var import_file_exists = __toESM(require_dist(), 1);
@@ -5557,8 +5557,8 @@ function pathspec(...paths) {
5557
5557
  cache.set(key, paths);
5558
5558
  return key;
5559
5559
  }
5560
- function isPathSpec(path11) {
5561
- return path11 instanceof String && cache.has(path11);
5560
+ function isPathSpec(path12) {
5561
+ return path12 instanceof String && cache.has(path12);
5562
5562
  }
5563
5563
  function toPaths(pathSpec) {
5564
5564
  return cache.get(pathSpec) || [];
@@ -5647,8 +5647,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
5647
5647
  function forEachLineWithContent(input, callback) {
5648
5648
  return toLinesWithContent(input, true).map((line) => callback(line));
5649
5649
  }
5650
- function folderExists(path11) {
5651
- return (0, import_file_exists.exists)(path11, import_file_exists.FOLDER);
5650
+ function folderExists(path12) {
5651
+ return (0, import_file_exists.exists)(path12, import_file_exists.FOLDER);
5652
5652
  }
5653
5653
  function append(target, item) {
5654
5654
  if (Array.isArray(target)) {
@@ -6052,8 +6052,8 @@ function checkIsRepoRootTask() {
6052
6052
  commands,
6053
6053
  format: "utf-8",
6054
6054
  onError,
6055
- parser(path11) {
6056
- return /^\.(git)?$/.test(path11.trim());
6055
+ parser(path12) {
6056
+ return /^\.(git)?$/.test(path12.trim());
6057
6057
  }
6058
6058
  };
6059
6059
  }
@@ -6487,11 +6487,11 @@ function parseGrep(grep) {
6487
6487
  const paths = /* @__PURE__ */ new Set();
6488
6488
  const results = {};
6489
6489
  forEachLineWithContent(grep, (input) => {
6490
- const [path11, line, preview] = input.split(NULL);
6491
- paths.add(path11);
6492
- (results[path11] = results[path11] || []).push({
6490
+ const [path12, line, preview] = input.split(NULL);
6491
+ paths.add(path12);
6492
+ (results[path12] = results[path12] || []).push({
6493
6493
  line: asNumber(line),
6494
- path: path11,
6494
+ path: path12,
6495
6495
  preview
6496
6496
  });
6497
6497
  });
@@ -7256,14 +7256,14 @@ var init_hash_object = __esm({
7256
7256
  init_task();
7257
7257
  }
7258
7258
  });
7259
- function parseInit(bare, path11, text2) {
7259
+ function parseInit(bare, path12, text2) {
7260
7260
  const response = String(text2).trim();
7261
7261
  let result;
7262
7262
  if (result = initResponseRegex.exec(response)) {
7263
- return new InitSummary(bare, path11, false, result[1]);
7263
+ return new InitSummary(bare, path12, false, result[1]);
7264
7264
  }
7265
7265
  if (result = reInitResponseRegex.exec(response)) {
7266
- return new InitSummary(bare, path11, true, result[1]);
7266
+ return new InitSummary(bare, path12, true, result[1]);
7267
7267
  }
7268
7268
  let gitDir = "";
7269
7269
  const tokens = response.split(" ");
@@ -7274,7 +7274,7 @@ function parseInit(bare, path11, text2) {
7274
7274
  break;
7275
7275
  }
7276
7276
  }
7277
- return new InitSummary(bare, path11, /^re/i.test(response), gitDir);
7277
+ return new InitSummary(bare, path12, /^re/i.test(response), gitDir);
7278
7278
  }
7279
7279
  var InitSummary;
7280
7280
  var initResponseRegex;
@@ -7283,9 +7283,9 @@ var init_InitSummary = __esm({
7283
7283
  "src/lib/responses/InitSummary.ts"() {
7284
7284
  "use strict";
7285
7285
  InitSummary = class {
7286
- constructor(bare, path11, existing, gitDir) {
7286
+ constructor(bare, path12, existing, gitDir) {
7287
7287
  this.bare = bare;
7288
- this.path = path11;
7288
+ this.path = path12;
7289
7289
  this.existing = existing;
7290
7290
  this.gitDir = gitDir;
7291
7291
  }
@@ -7297,7 +7297,7 @@ var init_InitSummary = __esm({
7297
7297
  function hasBareCommand(command) {
7298
7298
  return command.includes(bareCommand);
7299
7299
  }
7300
- function initTask(bare = false, path11, customArgs) {
7300
+ function initTask(bare = false, path12, customArgs) {
7301
7301
  const commands = ["init", ...customArgs];
7302
7302
  if (bare && !hasBareCommand(commands)) {
7303
7303
  commands.splice(1, 0, bareCommand);
@@ -7306,7 +7306,7 @@ function initTask(bare = false, path11, customArgs) {
7306
7306
  commands,
7307
7307
  format: "utf-8",
7308
7308
  parser(text2) {
7309
- return parseInit(commands.includes("--bare"), path11, text2);
7309
+ return parseInit(commands.includes("--bare"), path12, text2);
7310
7310
  }
7311
7311
  };
7312
7312
  }
@@ -8122,12 +8122,12 @@ var init_FileStatusSummary = __esm({
8122
8122
  "use strict";
8123
8123
  fromPathRegex = /^(.+)\0(.+)$/;
8124
8124
  FileStatusSummary = class {
8125
- constructor(path11, index, working_dir) {
8126
- this.path = path11;
8125
+ constructor(path12, index, working_dir) {
8126
+ this.path = path12;
8127
8127
  this.index = index;
8128
8128
  this.working_dir = working_dir;
8129
8129
  if (index === "R" || working_dir === "R") {
8130
- const detail = fromPathRegex.exec(path11) || [null, path11, path11];
8130
+ const detail = fromPathRegex.exec(path12) || [null, path12, path12];
8131
8131
  this.from = detail[2] || "";
8132
8132
  this.path = detail[1] || "";
8133
8133
  }
@@ -8158,14 +8158,14 @@ function splitLine(result, lineStr) {
8158
8158
  default:
8159
8159
  return;
8160
8160
  }
8161
- function data(index, workingDir, path11) {
8161
+ function data(index, workingDir, path12) {
8162
8162
  const raw = `${index}${workingDir}`;
8163
8163
  const handler = parsers6.get(raw);
8164
8164
  if (handler) {
8165
- handler(result, path11);
8165
+ handler(result, path12);
8166
8166
  }
8167
8167
  if (raw !== "##" && raw !== "!!") {
8168
- result.files.push(new FileStatusSummary(path11, index, workingDir));
8168
+ result.files.push(new FileStatusSummary(path12, index, workingDir));
8169
8169
  }
8170
8170
  }
8171
8171
  }
@@ -8478,9 +8478,9 @@ var init_simple_git_api = __esm({
8478
8478
  next
8479
8479
  );
8480
8480
  }
8481
- hashObject(path11, write) {
8481
+ hashObject(path12, write) {
8482
8482
  return this._runTask(
8483
- hashObjectTask(path11, write === true),
8483
+ hashObjectTask(path12, write === true),
8484
8484
  trailingFunctionArgument(arguments)
8485
8485
  );
8486
8486
  }
@@ -8833,8 +8833,8 @@ var init_branch = __esm({
8833
8833
  }
8834
8834
  });
8835
8835
  function toPath(input) {
8836
- const path11 = input.trim().replace(/^["']|["']$/g, "");
8837
- return path11 && normalize2(path11);
8836
+ const path12 = input.trim().replace(/^["']|["']$/g, "");
8837
+ return path12 && normalize2(path12);
8838
8838
  }
8839
8839
  var parseCheckIgnore;
8840
8840
  var init_CheckIgnore = __esm({
@@ -9148,8 +9148,8 @@ __export(sub_module_exports, {
9148
9148
  subModuleTask: () => subModuleTask,
9149
9149
  updateSubModuleTask: () => updateSubModuleTask
9150
9150
  });
9151
- function addSubModuleTask(repo, path11) {
9152
- return subModuleTask(["add", repo, path11]);
9151
+ function addSubModuleTask(repo, path12) {
9152
+ return subModuleTask(["add", repo, path12]);
9153
9153
  }
9154
9154
  function initSubModuleTask(customArgs) {
9155
9155
  return subModuleTask(["init", ...customArgs]);
@@ -9479,8 +9479,8 @@ var require_git = __commonJS2({
9479
9479
  }
9480
9480
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
9481
9481
  };
9482
- Git2.prototype.submoduleAdd = function(repo, path11, then) {
9483
- return this._runTask(addSubModuleTask2(repo, path11), trailingFunctionArgument2(arguments));
9482
+ Git2.prototype.submoduleAdd = function(repo, path12, then) {
9483
+ return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
9484
9484
  };
9485
9485
  Git2.prototype.submoduleUpdate = function(args, then) {
9486
9486
  return this._runTask(
@@ -10082,15 +10082,15 @@ function createGitClient(baseDir, options) {
10082
10082
  // ../git/dist/lock-detector.js
10083
10083
  import { execFile } from "child_process";
10084
10084
  import fs6 from "fs/promises";
10085
- import path7 from "path";
10085
+ import path8 from "path";
10086
10086
  import { promisify } from "util";
10087
10087
  var execFileAsync = promisify(execFile);
10088
10088
  async function getIndexLockPath(repoPath) {
10089
10089
  try {
10090
10090
  const { stdout } = await execFileAsync("git", ["rev-parse", "--git-path", "index.lock"], { cwd: repoPath });
10091
- return path7.resolve(repoPath, stdout.trim());
10091
+ return path8.resolve(repoPath, stdout.trim());
10092
10092
  } catch {
10093
- return path7.join(repoPath, ".git", "index.lock");
10093
+ return path8.join(repoPath, ".git", "index.lock");
10094
10094
  }
10095
10095
  }
10096
10096
  async function getLockInfo(repoPath) {
@@ -10279,7 +10279,7 @@ import { join as join7 } from "path";
10279
10279
  // ../git/dist/sagas/tree.js
10280
10280
  import { existsSync as existsSync4 } from "fs";
10281
10281
  import * as fs8 from "fs/promises";
10282
- import * as path9 from "path";
10282
+ import * as path10 from "path";
10283
10283
  import * as tar from "tar";
10284
10284
 
10285
10285
  // ../git/dist/git-saga.js
@@ -10306,14 +10306,14 @@ var CaptureTreeSaga = class extends GitSaga {
10306
10306
  tempIndexPath = null;
10307
10307
  async executeGitOperations(input) {
10308
10308
  const { baseDir, lastTreeHash, archivePath, signal } = input;
10309
- const tmpDir = path9.join(baseDir, ".git", "posthog-code-tmp");
10309
+ const tmpDir = path10.join(baseDir, ".git", "posthog-code-tmp");
10310
10310
  await this.step({
10311
10311
  name: "create_tmp_dir",
10312
10312
  execute: () => fs8.mkdir(tmpDir, { recursive: true }),
10313
10313
  rollback: async () => {
10314
10314
  }
10315
10315
  });
10316
- this.tempIndexPath = path9.join(tmpDir, `index-${Date.now()}`);
10316
+ this.tempIndexPath = path10.join(tmpDir, `index-${Date.now()}`);
10317
10317
  const tempIndexGit = this.git.env({
10318
10318
  ...process.env,
10319
10319
  GIT_INDEX_FILE: this.tempIndexPath
@@ -10368,14 +10368,14 @@ var CaptureTreeSaga = class extends GitSaga {
10368
10368
  if (filesToArchive.length === 0) {
10369
10369
  return void 0;
10370
10370
  }
10371
- const existingFiles = filesToArchive.filter((f) => existsSync4(path9.join(baseDir, f)));
10371
+ const existingFiles = filesToArchive.filter((f) => existsSync4(path10.join(baseDir, f)));
10372
10372
  if (existingFiles.length === 0) {
10373
10373
  return void 0;
10374
10374
  }
10375
10375
  await this.step({
10376
10376
  name: "create_archive",
10377
10377
  execute: async () => {
10378
- const archiveDir = path9.dirname(archivePath);
10378
+ const archiveDir = path10.dirname(archivePath);
10379
10379
  await fs8.mkdir(archiveDir, { recursive: true });
10380
10380
  await tar.create({
10381
10381
  gzip: true,
@@ -10484,7 +10484,7 @@ var ApplyTreeSaga = class extends GitSaga {
10484
10484
  const filesToExtract = changes.filter((c) => c.status !== "D").map((c) => c.path);
10485
10485
  await this.readOnlyStep("backup_existing_files", async () => {
10486
10486
  for (const filePath of filesToExtract) {
10487
- const fullPath = path9.join(baseDir, filePath);
10487
+ const fullPath = path10.join(baseDir, filePath);
10488
10488
  try {
10489
10489
  const content = await fs8.readFile(fullPath);
10490
10490
  this.fileBackups.set(filePath, content);
@@ -10503,10 +10503,10 @@ var ApplyTreeSaga = class extends GitSaga {
10503
10503
  },
10504
10504
  rollback: async () => {
10505
10505
  for (const filePath of this.extractedFiles) {
10506
- const fullPath = path9.join(baseDir, filePath);
10506
+ const fullPath = path10.join(baseDir, filePath);
10507
10507
  const backup = this.fileBackups.get(filePath);
10508
10508
  if (backup) {
10509
- const dir = path9.dirname(fullPath);
10509
+ const dir = path10.dirname(fullPath);
10510
10510
  await fs8.mkdir(dir, { recursive: true }).catch(() => {
10511
10511
  });
10512
10512
  await fs8.writeFile(fullPath, backup).catch(() => {
@@ -10520,7 +10520,7 @@ var ApplyTreeSaga = class extends GitSaga {
10520
10520
  });
10521
10521
  }
10522
10522
  for (const change of changes.filter((c) => c.status === "D")) {
10523
- const fullPath = path9.join(baseDir, change.path);
10523
+ const fullPath = path10.join(baseDir, change.path);
10524
10524
  const backupContent = await this.readOnlyStep(`backup_${change.path}`, async () => {
10525
10525
  try {
10526
10526
  return await fs8.readFile(fullPath);
@@ -10536,7 +10536,7 @@ var ApplyTreeSaga = class extends GitSaga {
10536
10536
  },
10537
10537
  rollback: async () => {
10538
10538
  if (backupContent) {
10539
- const dir = path9.dirname(fullPath);
10539
+ const dir = path10.dirname(fullPath);
10540
10540
  await fs8.mkdir(dir, { recursive: true }).catch(() => {
10541
10541
  });
10542
10542
  await fs8.writeFile(fullPath, backupContent).catch(() => {
@@ -11102,7 +11102,7 @@ async function resumeFromLog(config) {
11102
11102
  // src/session-log-writer.ts
11103
11103
  import fs9 from "fs";
11104
11104
  import fsp from "fs/promises";
11105
- import path10 from "path";
11105
+ import path11 from "path";
11106
11106
  var SessionLogWriter = class _SessionLogWriter {
11107
11107
  static FLUSH_DEBOUNCE_MS = 500;
11108
11108
  static FLUSH_MAX_INTERVAL_MS = 5e3;
@@ -11141,7 +11141,7 @@ var SessionLogWriter = class _SessionLogWriter {
11141
11141
  this.sessions.set(sessionId, { context, currentTurnMessages: [] });
11142
11142
  this.lastFlushAttemptTime.set(sessionId, Date.now());
11143
11143
  if (this.localCachePath) {
11144
- const sessionDir = path10.join(
11144
+ const sessionDir = path11.join(
11145
11145
  this.localCachePath,
11146
11146
  "sessions",
11147
11147
  context.runId
@@ -11363,7 +11363,7 @@ var SessionLogWriter = class _SessionLogWriter {
11363
11363
  if (!this.localCachePath) return;
11364
11364
  const session = this.sessions.get(sessionId);
11365
11365
  if (!session) return;
11366
- const logPath = path10.join(
11366
+ const logPath = path11.join(
11367
11367
  this.localCachePath,
11368
11368
  "sessions",
11369
11369
  session.context.runId,
@@ -11382,13 +11382,13 @@ var SessionLogWriter = class _SessionLogWriter {
11382
11382
  }
11383
11383
  }
11384
11384
  static async cleanupOldSessions(localCachePath) {
11385
- const sessionsDir = path10.join(localCachePath, "sessions");
11385
+ const sessionsDir = path11.join(localCachePath, "sessions");
11386
11386
  let deleted = 0;
11387
11387
  try {
11388
11388
  const entries = await fsp.readdir(sessionsDir);
11389
11389
  const now = Date.now();
11390
11390
  for (const entry of entries) {
11391
- const entryPath = path10.join(sessionsDir, entry);
11391
+ const entryPath = path11.join(sessionsDir, entry);
11392
11392
  try {
11393
11393
  const stats = await fsp.stat(entryPath);
11394
11394
  if (stats.isDirectory() && now - stats.birthtimeMs > _SessionLogWriter.SESSIONS_MAX_AGE_MS) {