@posthog/agent 2.3.213 → 2.3.233

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
@@ -245,7 +245,7 @@ import { v7 as uuidv7 } from "uuid";
245
245
  // package.json
246
246
  var package_default = {
247
247
  name: "@posthog/agent",
248
- version: "2.3.213",
248
+ version: "2.3.233",
249
249
  repository: "https://github.com/PostHog/code",
250
250
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
251
251
  exports: {
@@ -4342,28 +4342,23 @@ import * as os5 from "os";
4342
4342
  import * as path7 from "path";
4343
4343
  var CodexSettingsManager = class {
4344
4344
  cwd;
4345
- settings = {};
4346
- initialized = false;
4345
+ settings = { mcpServerNames: [] };
4347
4346
  constructor(cwd) {
4348
4347
  this.cwd = cwd;
4348
+ this.loadSettings();
4349
4349
  }
4350
4350
  async initialize() {
4351
- if (this.initialized) {
4352
- return;
4353
- }
4354
- await this.loadSettings();
4355
- this.initialized = true;
4356
4351
  }
4357
4352
  getConfigPath() {
4358
4353
  return path7.join(os5.homedir(), ".codex", "config.toml");
4359
4354
  }
4360
- async loadSettings() {
4355
+ loadSettings() {
4361
4356
  const configPath = this.getConfigPath();
4362
4357
  try {
4363
- const content = await fs5.promises.readFile(configPath, "utf-8");
4358
+ const content = fs5.readFileSync(configPath, "utf-8");
4364
4359
  this.settings = parseCodexToml(content, this.cwd);
4365
4360
  } catch {
4366
- this.settings = {};
4361
+ this.settings = { mcpServerNames: [] };
4367
4362
  }
4368
4363
  }
4369
4364
  getSettings() {
@@ -4373,20 +4368,16 @@ var CodexSettingsManager = class {
4373
4368
  return this.cwd;
4374
4369
  }
4375
4370
  async setCwd(cwd) {
4376
- if (this.cwd === cwd) {
4377
- return;
4378
- }
4379
- this.dispose();
4371
+ if (this.cwd === cwd) return;
4380
4372
  this.cwd = cwd;
4381
- this.initialized = false;
4382
- await this.initialize();
4373
+ this.loadSettings();
4383
4374
  }
4384
4375
  dispose() {
4385
- this.initialized = false;
4386
4376
  }
4387
4377
  };
4388
4378
  function parseCodexToml(content, cwd) {
4389
- const settings = {};
4379
+ const settings = { mcpServerNames: [] };
4380
+ const mcpServerNames = /* @__PURE__ */ new Set();
4390
4381
  let currentSection = "";
4391
4382
  for (const line of content.split("\n")) {
4392
4383
  const trimmed = line.trim();
@@ -4394,6 +4385,9 @@ function parseCodexToml(content, cwd) {
4394
4385
  const sectionMatch = trimmed.match(/^\[(.+)\]$/);
4395
4386
  if (sectionMatch) {
4396
4387
  currentSection = sectionMatch[1] ?? "";
4388
+ if (currentSection.startsWith("mcp_servers.")) {
4389
+ mcpServerNames.add(currentSection.slice("mcp_servers.".length));
4390
+ }
4397
4391
  continue;
4398
4392
  }
4399
4393
  const kvMatch = trimmed.match(/^(\w+)\s*=\s*(.+)$/);
@@ -4412,6 +4406,7 @@ function parseCodexToml(content, cwd) {
4412
4406
  if (key === "trust_level") settings.trustLevel = value;
4413
4407
  }
4414
4408
  }
4409
+ settings.mcpServerNames = Array.from(mcpServerNames);
4415
4410
  return settings;
4416
4411
  }
4417
4412
 
@@ -4422,6 +4417,9 @@ import { delimiter, dirname } from "path";
4422
4417
  function buildConfigArgs(options) {
4423
4418
  const args = [];
4424
4419
  args.push("-c", `features.remote_models=false`);
4420
+ for (const name of options.settings?.mcpServerNames ?? []) {
4421
+ args.push("-c", `mcp_servers.${name}.enabled=false`);
4422
+ }
4425
4423
  if (options.apiBaseUrl) {
4426
4424
  args.push("-c", `model_provider="posthog"`);
4427
4425
  args.push("-c", `model_providers.posthog.name="PostHog Gateway"`);
@@ -4536,16 +4534,17 @@ var CodexAcpAgent = class extends BaseAcpAgent {
4536
4534
  constructor(client, options) {
4537
4535
  super(client);
4538
4536
  this.logger = new Logger({ debug: true, prefix: "[CodexAcpAgent]" });
4537
+ const cwd = options.codexProcessOptions.cwd ?? process.cwd();
4538
+ const settingsManager = new CodexSettingsManager(cwd);
4539
4539
  this.codexProcess = spawnCodexProcess({
4540
4540
  ...options.codexProcessOptions,
4541
+ settings: settingsManager.getSettings(),
4541
4542
  logger: this.logger,
4542
4543
  processCallbacks: options.processCallbacks
4543
4544
  });
4544
4545
  const codexReadable = nodeReadableToWebReadable(this.codexProcess.stdout);
4545
4546
  const codexWritable = nodeWritableToWebWritable(this.codexProcess.stdin);
4546
4547
  const codexStream = ndJsonStream(codexWritable, codexReadable);
4547
- const cwd = options.codexProcessOptions.cwd ?? process.cwd();
4548
- const settingsManager = new CodexSettingsManager(cwd);
4549
4548
  const abortController = new AbortController();
4550
4549
  this.session = {
4551
4550
  abortController,