@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.
package/dist/index.js CHANGED
@@ -1174,7 +1174,7 @@ import { v7 as uuidv7 } from "uuid";
1174
1174
  // package.json
1175
1175
  var package_default = {
1176
1176
  name: "@posthog/agent",
1177
- version: "2.1.15",
1177
+ version: "2.1.17",
1178
1178
  repository: "https://github.com/PostHog/twig",
1179
1179
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
1180
1180
  exports: {
@@ -3210,7 +3210,19 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited) {
3210
3210
  };
3211
3211
  };
3212
3212
  }
3213
+ function ensureLocalSettings(cwd) {
3214
+ const claudeDir = path2.join(cwd, ".claude");
3215
+ const localSettingsPath = path2.join(claudeDir, "settings.local.json");
3216
+ try {
3217
+ if (!fs.existsSync(localSettingsPath)) {
3218
+ fs.mkdirSync(claudeDir, { recursive: true });
3219
+ fs.writeFileSync(localSettingsPath, "{}\n", { flag: "wx" });
3220
+ }
3221
+ } catch {
3222
+ }
3223
+ }
3213
3224
  function buildSessionOptions(params) {
3225
+ ensureLocalSettings(params.cwd);
3214
3226
  const options = {
3215
3227
  ...params.userProvidedOptions,
3216
3228
  systemPrompt: params.systemPrompt ?? buildSystemPrompt(),
@@ -3714,6 +3726,10 @@ function spawnCodexProcess(options) {
3714
3726
  env.POSTHOG_GATEWAY_API_KEY = options.apiKey;
3715
3727
  }
3716
3728
  const { command, args } = findCodexBinary(options);
3729
+ if (options.binaryPath && existsSync3(options.binaryPath)) {
3730
+ const binDir = options.binaryPath.replace(/\/[^/]+$/, "");
3731
+ env.PATH = `${binDir}:${env.PATH ?? ""}`;
3732
+ }
3717
3733
  logger.info("Spawning codex-acp process", {
3718
3734
  command,
3719
3735
  args,