@posthog/agent 2.3.216 → 2.3.256

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.
@@ -5683,7 +5683,7 @@ var import_hono = require("hono");
5683
5683
  // package.json
5684
5684
  var package_default = {
5685
5685
  name: "@posthog/agent",
5686
- version: "2.3.216",
5686
+ version: "2.3.256",
5687
5687
  repository: "https://github.com/PostHog/code",
5688
5688
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
5689
5689
  exports: {
@@ -9985,28 +9985,23 @@ var os5 = __toESM(require("os"), 1);
9985
9985
  var path9 = __toESM(require("path"), 1);
9986
9986
  var CodexSettingsManager = class {
9987
9987
  cwd;
9988
- settings = {};
9989
- initialized = false;
9988
+ settings = { mcpServerNames: [] };
9990
9989
  constructor(cwd) {
9991
9990
  this.cwd = cwd;
9991
+ this.loadSettings();
9992
9992
  }
9993
9993
  async initialize() {
9994
- if (this.initialized) {
9995
- return;
9996
- }
9997
- await this.loadSettings();
9998
- this.initialized = true;
9999
9994
  }
10000
9995
  getConfigPath() {
10001
9996
  return path9.join(os5.homedir(), ".codex", "config.toml");
10002
9997
  }
10003
- async loadSettings() {
9998
+ loadSettings() {
10004
9999
  const configPath = this.getConfigPath();
10005
10000
  try {
10006
- const content = await fs7.promises.readFile(configPath, "utf-8");
10001
+ const content = fs7.readFileSync(configPath, "utf-8");
10007
10002
  this.settings = parseCodexToml(content, this.cwd);
10008
10003
  } catch {
10009
- this.settings = {};
10004
+ this.settings = { mcpServerNames: [] };
10010
10005
  }
10011
10006
  }
10012
10007
  getSettings() {
@@ -10016,20 +10011,16 @@ var CodexSettingsManager = class {
10016
10011
  return this.cwd;
10017
10012
  }
10018
10013
  async setCwd(cwd) {
10019
- if (this.cwd === cwd) {
10020
- return;
10021
- }
10022
- this.dispose();
10014
+ if (this.cwd === cwd) return;
10023
10015
  this.cwd = cwd;
10024
- this.initialized = false;
10025
- await this.initialize();
10016
+ this.loadSettings();
10026
10017
  }
10027
10018
  dispose() {
10028
- this.initialized = false;
10029
10019
  }
10030
10020
  };
10031
10021
  function parseCodexToml(content, cwd) {
10032
- const settings = {};
10022
+ const settings = { mcpServerNames: [] };
10023
+ const mcpServerNames = /* @__PURE__ */ new Set();
10033
10024
  let currentSection = "";
10034
10025
  for (const line of content.split("\n")) {
10035
10026
  const trimmed2 = line.trim();
@@ -10037,6 +10028,9 @@ function parseCodexToml(content, cwd) {
10037
10028
  const sectionMatch = trimmed2.match(/^\[(.+)\]$/);
10038
10029
  if (sectionMatch) {
10039
10030
  currentSection = sectionMatch[1] ?? "";
10031
+ if (currentSection.startsWith("mcp_servers.")) {
10032
+ mcpServerNames.add(currentSection.slice("mcp_servers.".length));
10033
+ }
10040
10034
  continue;
10041
10035
  }
10042
10036
  const kvMatch = trimmed2.match(/^(\w+)\s*=\s*(.+)$/);
@@ -10055,6 +10049,7 @@ function parseCodexToml(content, cwd) {
10055
10049
  if (key === "trust_level") settings.trustLevel = value;
10056
10050
  }
10057
10051
  }
10052
+ settings.mcpServerNames = Array.from(mcpServerNames);
10058
10053
  return settings;
10059
10054
  }
10060
10055
 
@@ -10065,6 +10060,9 @@ var import_node_path4 = require("path");
10065
10060
  function buildConfigArgs(options) {
10066
10061
  const args = [];
10067
10062
  args.push("-c", `features.remote_models=false`);
10063
+ for (const name of options.settings?.mcpServerNames ?? []) {
10064
+ args.push("-c", `mcp_servers.${name}.enabled=false`);
10065
+ }
10068
10066
  if (options.apiBaseUrl) {
10069
10067
  args.push("-c", `model_provider="posthog"`);
10070
10068
  args.push("-c", `model_providers.posthog.name="PostHog Gateway"`);
@@ -10179,16 +10177,17 @@ var CodexAcpAgent = class extends BaseAcpAgent {
10179
10177
  constructor(client, options) {
10180
10178
  super(client);
10181
10179
  this.logger = new Logger({ debug: true, prefix: "[CodexAcpAgent]" });
10180
+ const cwd = options.codexProcessOptions.cwd ?? process.cwd();
10181
+ const settingsManager = new CodexSettingsManager(cwd);
10182
10182
  this.codexProcess = spawnCodexProcess({
10183
10183
  ...options.codexProcessOptions,
10184
+ settings: settingsManager.getSettings(),
10184
10185
  logger: this.logger,
10185
10186
  processCallbacks: options.processCallbacks
10186
10187
  });
10187
10188
  const codexReadable = nodeReadableToWebReadable(this.codexProcess.stdout);
10188
10189
  const codexWritable = nodeWritableToWebWritable(this.codexProcess.stdin);
10189
10190
  const codexStream = (0, import_sdk3.ndJsonStream)(codexWritable, codexReadable);
10190
- const cwd = options.codexProcessOptions.cwd ?? process.cwd();
10191
- const settingsManager = new CodexSettingsManager(cwd);
10192
10191
  const abortController = new AbortController();
10193
10192
  this.session = {
10194
10193
  abortController,