@posthog/agent 2.1.15 → 2.1.17

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.
@@ -1183,7 +1183,7 @@ import { v7 as uuidv7 } from "uuid";
1183
1183
  // package.json
1184
1184
  var package_default = {
1185
1185
  name: "@posthog/agent",
1186
- version: "2.1.15",
1186
+ version: "2.1.17",
1187
1187
  repository: "https://github.com/PostHog/twig",
1188
1188
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
1189
1189
  exports: {
@@ -3184,7 +3184,19 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited) {
3184
3184
  };
3185
3185
  };
3186
3186
  }
3187
+ function ensureLocalSettings(cwd) {
3188
+ const claudeDir = path2.join(cwd, ".claude");
3189
+ const localSettingsPath = path2.join(claudeDir, "settings.local.json");
3190
+ try {
3191
+ if (!fs.existsSync(localSettingsPath)) {
3192
+ fs.mkdirSync(claudeDir, { recursive: true });
3193
+ fs.writeFileSync(localSettingsPath, "{}\n", { flag: "wx" });
3194
+ }
3195
+ } catch {
3196
+ }
3197
+ }
3187
3198
  function buildSessionOptions(params) {
3199
+ ensureLocalSettings(params.cwd);
3188
3200
  const options = {
3189
3201
  ...params.userProvidedOptions,
3190
3202
  systemPrompt: params.systemPrompt ?? buildSystemPrompt(),
@@ -3688,6 +3700,10 @@ function spawnCodexProcess(options) {
3688
3700
  env.POSTHOG_GATEWAY_API_KEY = options.apiKey;
3689
3701
  }
3690
3702
  const { command, args } = findCodexBinary(options);
3703
+ if (options.binaryPath && existsSync3(options.binaryPath)) {
3704
+ const binDir = options.binaryPath.replace(/\/[^/]+$/, "");
3705
+ env.PATH = `${binDir}:${env.PATH ?? ""}`;
3706
+ }
3691
3707
  logger.info("Spawning codex-acp process", {
3692
3708
  command,
3693
3709
  args,