@posthog/agent 2.3.305 → 2.3.306

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.
@@ -5805,7 +5805,7 @@ var import_hono = require("hono");
5805
5805
  // package.json
5806
5806
  var package_default = {
5807
5807
  name: "@posthog/agent",
5808
- version: "2.3.305",
5808
+ version: "2.3.306",
5809
5809
  repository: "https://github.com/PostHog/code",
5810
5810
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
5811
5811
  exports: {
@@ -10370,6 +10370,17 @@ var CodexAcpAgent = class extends BaseAcpAgent {
10370
10370
  codexProcess;
10371
10371
  codexConnection;
10372
10372
  sessionState;
10373
+ /**
10374
+ * FIFO serializer for prompt() calls. codex-acp and codex-rs themselves
10375
+ * serialize submissions at the conversation level, but our adapter
10376
+ * accumulates per-turn usage into sessionState.accumulatedUsage via the
10377
+ * codex-client sessionUpdate handler. If two prompts ran concurrently on
10378
+ * the JS side, the second's resetUsage() would wipe out the first's
10379
+ * in-flight counters and both TURN_COMPLETE notifications would report
10380
+ * garbled totals. Serializing on the JS side keeps the accumulator
10381
+ * single-owner.
10382
+ */
10383
+ promptMutex = Promise.resolve();
10373
10384
  constructor(client, options) {
10374
10385
  super(client);
10375
10386
  this.logger = new Logger({ debug: true, prefix: "[CodexAcpAgent]" });
@@ -10556,6 +10567,13 @@ var CodexAcpAgent = class extends BaseAcpAgent {
10556
10567
  return this.listSessions(params);
10557
10568
  }
10558
10569
  async prompt(params) {
10570
+ const previous = this.promptMutex;
10571
+ const next = previous.catch(() => {
10572
+ }).then(() => this.runPrompt(params));
10573
+ this.promptMutex = next;
10574
+ return next;
10575
+ }
10576
+ async runPrompt(params) {
10559
10577
  this.session.cancelled = false;
10560
10578
  this.session.interruptReason = void 0;
10561
10579
  resetUsage(this.sessionState);