@posthog/agent 2.1.124 → 2.1.125

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.
@@ -237,8 +237,8 @@ var require_common = __commonJS({
237
237
  }
238
238
  return debug2;
239
239
  }
240
- function extend(namespace, delimiter) {
241
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
240
+ function extend(namespace, delimiter2) {
241
+ const newDebug = createDebug(this.namespace + (typeof delimiter2 === "undefined" ? ":" : delimiter2) + namespace);
242
242
  newDebug.log = this.log;
243
243
  return newDebug;
244
244
  }
@@ -904,7 +904,7 @@ var import_hono = require("hono");
904
904
  // package.json
905
905
  var package_default = {
906
906
  name: "@posthog/agent",
907
- version: "2.1.124",
907
+ version: "2.1.125",
908
908
  repository: "https://github.com/PostHog/twig",
909
909
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
910
910
  exports: {
@@ -989,8 +989,8 @@ var package_default = {
989
989
  },
990
990
  dependencies: {
991
991
  "@agentclientprotocol/sdk": "^0.14.0",
992
- "@anthropic-ai/claude-agent-sdk": "0.2.59",
993
- "@anthropic-ai/sdk": "^0.71.0",
992
+ "@anthropic-ai/claude-agent-sdk": "0.2.63",
993
+ "@anthropic-ai/sdk": "^0.78.0",
994
994
  "@hono/node-server": "^1.19.9",
995
995
  "@opentelemetry/api-logs": "^0.208.0",
996
996
  "@opentelemetry/exporter-logs-otlp-http": "^0.208.0",
@@ -2328,6 +2328,8 @@ function processContentChunk(chunk, role, ctx) {
2328
2328
  case "citations_delta":
2329
2329
  case "signature_delta":
2330
2330
  case "container_upload":
2331
+ case "compaction":
2332
+ case "compaction_delta":
2331
2333
  return null;
2332
2334
  default:
2333
2335
  unreachable(chunk, ctx.logger);
@@ -3815,6 +3817,7 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
3815
3817
  // src/adapters/codex/spawn.ts
3816
3818
  var import_node_child_process2 = require("child_process");
3817
3819
  var import_node_fs = require("fs");
3820
+ var import_node_path = require("path");
3818
3821
  function buildConfigArgs(options) {
3819
3822
  const args = [];
3820
3823
  args.push("-c", `features.remote_models=false`);
@@ -3855,8 +3858,8 @@ function spawnCodexProcess(options) {
3855
3858
  }
3856
3859
  const { command, args } = findCodexBinary(options);
3857
3860
  if (options.binaryPath && (0, import_node_fs.existsSync)(options.binaryPath)) {
3858
- const binDir = options.binaryPath.replace(/\/[^/]+$/, "");
3859
- env.PATH = `${binDir}:${env.PATH ?? ""}`;
3861
+ const binDir = (0, import_node_path.dirname)(options.binaryPath);
3862
+ env.PATH = `${binDir}${import_node_path.delimiter}${env.PATH ?? ""}`;
3860
3863
  }
3861
3864
  logger.info("Spawning codex-acp process", {
3862
3865
  command,
@@ -3873,7 +3876,7 @@ function spawnCodexProcess(options) {
3873
3876
  detached: process.platform !== "win32"
3874
3877
  });
3875
3878
  child.stderr?.on("data", (data) => {
3876
- logger.debug("codex-acp stderr:", data.toString());
3879
+ logger.error("codex-acp stderr:", data.toString());
3877
3880
  });
3878
3881
  child.on("error", (err) => {
3879
3882
  logger.error("codex-acp process error:", err);
@@ -4436,7 +4439,7 @@ var PostHogAPIClient = class {
4436
4439
 
4437
4440
  // src/session-log-writer.ts
4438
4441
  var import_node_fs2 = __toESM(require("fs"), 1);
4439
- var import_node_path = __toESM(require("path"), 1);
4442
+ var import_node_path2 = __toESM(require("path"), 1);
4440
4443
  var SessionLogWriter = class _SessionLogWriter {
4441
4444
  static FLUSH_DEBOUNCE_MS = 500;
4442
4445
  static FLUSH_MAX_INTERVAL_MS = 5e3;
@@ -4488,7 +4491,7 @@ var SessionLogWriter = class _SessionLogWriter {
4488
4491
  this.sessions.set(sessionId, { context });
4489
4492
  this.lastFlushAttemptTime.set(sessionId, Date.now());
4490
4493
  if (this.localCachePath) {
4491
- const sessionDir = import_node_path.default.join(
4494
+ const sessionDir = import_node_path2.default.join(
4492
4495
  this.localCachePath,
4493
4496
  "sessions",
4494
4497
  context.runId
@@ -4711,7 +4714,7 @@ var SessionLogWriter = class _SessionLogWriter {
4711
4714
  if (!this.localCachePath) return;
4712
4715
  const session = this.sessions.get(sessionId);
4713
4716
  if (!session) return;
4714
- const logPath = import_node_path.default.join(
4717
+ const logPath = import_node_path2.default.join(
4715
4718
  this.localCachePath,
4716
4719
  "sessions",
4717
4720
  session.context.runId,
@@ -4741,7 +4744,7 @@ var import_file_exists = __toESM(require_dist(), 1);
4741
4744
  var import_debug = __toESM(require_src(), 1);
4742
4745
  var import_child_process = require("child_process");
4743
4746
  var import_promise_deferred = __toESM(require_dist2(), 1);
4744
- var import_node_path2 = require("path");
4747
+ var import_node_path3 = require("path");
4745
4748
  var import_promise_deferred2 = __toESM(require_dist2(), 1);
4746
4749
  var import_node_events = require("events");
4747
4750
  var __defProp2 = Object.defineProperty;
@@ -8049,7 +8052,7 @@ var init_branch = __esm({
8049
8052
  });
8050
8053
  function toPath(input) {
8051
8054
  const path8 = input.trim().replace(/^["']|["']$/g, "");
8052
- return path8 && (0, import_node_path2.normalize)(path8);
8055
+ return path8 && (0, import_node_path3.normalize)(path8);
8053
8056
  }
8054
8057
  var parseCheckIgnore;
8055
8058
  var init_CheckIgnore = __esm({
@@ -9297,15 +9300,15 @@ function createGitClient(baseDir, options) {
9297
9300
  // ../git/dist/lock-detector.js
9298
9301
  var import_node_child_process3 = require("child_process");
9299
9302
  var import_promises = __toESM(require("fs/promises"), 1);
9300
- var import_node_path3 = __toESM(require("path"), 1);
9303
+ var import_node_path4 = __toESM(require("path"), 1);
9301
9304
  var import_node_util = require("util");
9302
9305
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process3.execFile);
9303
9306
  async function getIndexLockPath(repoPath) {
9304
9307
  try {
9305
9308
  const { stdout } = await execFileAsync("git", ["rev-parse", "--git-path", "index.lock"], { cwd: repoPath });
9306
- return import_node_path3.default.resolve(repoPath, stdout.trim());
9309
+ return import_node_path4.default.resolve(repoPath, stdout.trim());
9307
9310
  } catch {
9308
- return import_node_path3.default.join(repoPath, ".git", "index.lock");
9311
+ return import_node_path4.default.join(repoPath, ".git", "index.lock");
9309
9312
  }
9310
9313
  }
9311
9314
  async function getLockInfo(repoPath) {
@@ -9489,7 +9492,7 @@ async function getHeadSha(baseDir, options) {
9489
9492
 
9490
9493
  // src/sagas/apply-snapshot-saga.ts
9491
9494
  var import_promises2 = require("fs/promises");
9492
- var import_node_path4 = require("path");
9495
+ var import_node_path5 = require("path");
9493
9496
 
9494
9497
  // ../shared/dist/index.js
9495
9498
  var consoleLogger = {
@@ -9901,7 +9904,7 @@ var ApplySnapshotSaga = class extends Saga {
9901
9904
  archivePath = null;
9902
9905
  async execute(input) {
9903
9906
  const { snapshot, repositoryPath, apiClient, taskId, runId } = input;
9904
- const tmpDir = (0, import_node_path4.join)(repositoryPath, ".posthog", "tmp");
9907
+ const tmpDir = (0, import_node_path5.join)(repositoryPath, ".posthog", "tmp");
9905
9908
  if (!snapshot.archiveUrl) {
9906
9909
  throw new Error("Cannot apply snapshot: no archive URL");
9907
9910
  }
@@ -9912,7 +9915,7 @@ var ApplySnapshotSaga = class extends Saga {
9912
9915
  rollback: async () => {
9913
9916
  }
9914
9917
  });
9915
- const archivePath = (0, import_node_path4.join)(tmpDir, `${snapshot.treeHash}.tar.gz`);
9918
+ const archivePath = (0, import_node_path5.join)(tmpDir, `${snapshot.treeHash}.tar.gz`);
9916
9919
  this.archivePath = archivePath;
9917
9920
  await this.step({
9918
9921
  name: "download_archive",
@@ -9961,7 +9964,7 @@ var ApplySnapshotSaga = class extends Saga {
9961
9964
  // src/sagas/capture-tree-saga.ts
9962
9965
  var import_node_fs4 = require("fs");
9963
9966
  var import_promises3 = require("fs/promises");
9964
- var import_node_path5 = require("path");
9967
+ var import_node_path6 = require("path");
9965
9968
  var CaptureTreeSaga2 = class extends Saga {
9966
9969
  async execute(input) {
9967
9970
  const {
@@ -9972,14 +9975,14 @@ var CaptureTreeSaga2 = class extends Saga {
9972
9975
  taskId,
9973
9976
  runId
9974
9977
  } = input;
9975
- const tmpDir = (0, import_node_path5.join)(repositoryPath, ".posthog", "tmp");
9976
- if ((0, import_node_fs4.existsSync)((0, import_node_path5.join)(repositoryPath, ".gitmodules"))) {
9978
+ const tmpDir = (0, import_node_path6.join)(repositoryPath, ".posthog", "tmp");
9979
+ if ((0, import_node_fs4.existsSync)((0, import_node_path6.join)(repositoryPath, ".gitmodules"))) {
9977
9980
  this.log.warn(
9978
9981
  "Repository has submodules - snapshot may not capture submodule state"
9979
9982
  );
9980
9983
  }
9981
9984
  const shouldArchive = !!apiClient;
9982
- const archivePath = shouldArchive ? (0, import_node_path5.join)(tmpDir, `tree-${Date.now()}.tar.gz`) : void 0;
9985
+ const archivePath = shouldArchive ? (0, import_node_path6.join)(tmpDir, `tree-${Date.now()}.tar.gz`) : void 0;
9983
9986
  const gitCaptureSaga = new CaptureTreeSaga(this.log);
9984
9987
  const captureResult = await gitCaptureSaga.run({
9985
9988
  baseDir: repositoryPath,