@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.
- package/dist/agent.js +19 -1
- package/dist/agent.js.map +1 -1
- package/dist/posthog-api.js +1 -1
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +19 -1
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +19 -1
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +1 -1
- package/src/adapters/codex/codex-agent.test.ts +86 -0
- package/src/adapters/codex/codex-agent.ts +18 -0
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.
|
|
248
|
+
version: "2.3.306",
|
|
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: {
|
|
@@ -4706,6 +4706,17 @@ var CodexAcpAgent = class extends BaseAcpAgent {
|
|
|
4706
4706
|
codexProcess;
|
|
4707
4707
|
codexConnection;
|
|
4708
4708
|
sessionState;
|
|
4709
|
+
/**
|
|
4710
|
+
* FIFO serializer for prompt() calls. codex-acp and codex-rs themselves
|
|
4711
|
+
* serialize submissions at the conversation level, but our adapter
|
|
4712
|
+
* accumulates per-turn usage into sessionState.accumulatedUsage via the
|
|
4713
|
+
* codex-client sessionUpdate handler. If two prompts ran concurrently on
|
|
4714
|
+
* the JS side, the second's resetUsage() would wipe out the first's
|
|
4715
|
+
* in-flight counters and both TURN_COMPLETE notifications would report
|
|
4716
|
+
* garbled totals. Serializing on the JS side keeps the accumulator
|
|
4717
|
+
* single-owner.
|
|
4718
|
+
*/
|
|
4719
|
+
promptMutex = Promise.resolve();
|
|
4709
4720
|
constructor(client, options) {
|
|
4710
4721
|
super(client);
|
|
4711
4722
|
this.logger = new Logger({ debug: true, prefix: "[CodexAcpAgent]" });
|
|
@@ -4892,6 +4903,13 @@ var CodexAcpAgent = class extends BaseAcpAgent {
|
|
|
4892
4903
|
return this.listSessions(params);
|
|
4893
4904
|
}
|
|
4894
4905
|
async prompt(params) {
|
|
4906
|
+
const previous = this.promptMutex;
|
|
4907
|
+
const next = previous.catch(() => {
|
|
4908
|
+
}).then(() => this.runPrompt(params));
|
|
4909
|
+
this.promptMutex = next;
|
|
4910
|
+
return next;
|
|
4911
|
+
}
|
|
4912
|
+
async runPrompt(params) {
|
|
4895
4913
|
this.session.cancelled = false;
|
|
4896
4914
|
this.session.interruptReason = void 0;
|
|
4897
4915
|
resetUsage(this.sessionState);
|