@posthog/agent 2.3.527 → 2.3.547
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 +3 -2
- 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 +3 -2
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +3 -2
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/adapters/claude/permissions/permission-handlers.test.ts +1 -0
- package/src/adapters/claude/permissions/permission-handlers.ts +1 -0
- package/src/server/agent-server.test.ts +23 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/agent",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.547",
|
|
4
4
|
"repository": "https://github.com/PostHog/code",
|
|
5
5
|
"description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
6
6
|
"exports": {
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"typescript": "^5.5.0",
|
|
108
108
|
"vitest": "^2.1.8",
|
|
109
109
|
"@posthog/shared": "1.0.0",
|
|
110
|
-
"@posthog/
|
|
111
|
-
"@posthog/
|
|
110
|
+
"@posthog/git": "1.0.0",
|
|
111
|
+
"@posthog/enricher": "1.0.0"
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@agentclientprotocol/sdk": "0.19.0",
|
|
@@ -237,6 +237,7 @@ describe("canUseTool MCP approval enforcement", () => {
|
|
|
237
237
|
expect.objectContaining({
|
|
238
238
|
toolCall: expect.objectContaining({
|
|
239
239
|
title: "The agent wants to run `notebooks-destroy` on PostHog",
|
|
240
|
+
_meta: { claudeCode: { toolName: "mcp__posthog__exec" } },
|
|
240
241
|
}),
|
|
241
242
|
}),
|
|
242
243
|
);
|
|
@@ -279,16 +279,27 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
279
279
|
const keepaliveCallback: { current: (() => void) | null } = {
|
|
280
280
|
current: null,
|
|
281
281
|
};
|
|
282
|
+
// Pass through to real setInterval for non-keepalive timers; otherwise
|
|
283
|
+
// unrelated internals (undici, http server, MSW) lose their periodic
|
|
284
|
+
// callbacks and can hang the test.
|
|
285
|
+
const realSetInterval = globalThis.setInterval;
|
|
282
286
|
const setIntervalSpy = vi
|
|
283
287
|
.spyOn(globalThis, "setInterval")
|
|
284
|
-
.mockImplementation(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
.mockImplementation(((
|
|
289
|
+
callback: (_: undefined) => void,
|
|
290
|
+
timeout?: number,
|
|
291
|
+
...args: unknown[]
|
|
292
|
+
) => {
|
|
293
|
+
if (timeout === SSE_KEEPALIVE_INTERVAL_MS) {
|
|
294
|
+
keepaliveCallback.current = () => callback(undefined);
|
|
289
295
|
return setTimeout(() => undefined, 60_000);
|
|
290
|
-
}
|
|
291
|
-
|
|
296
|
+
}
|
|
297
|
+
return (realSetInterval as (...rest: unknown[]) => unknown)(
|
|
298
|
+
callback,
|
|
299
|
+
timeout,
|
|
300
|
+
...args,
|
|
301
|
+
);
|
|
302
|
+
}) as unknown as typeof setInterval);
|
|
292
303
|
|
|
293
304
|
let reader: ReadableStreamDefaultReader<Uint8Array> | null = null;
|
|
294
305
|
try {
|
|
@@ -307,8 +318,9 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
307
318
|
throw new Error("Expected SSE response body reader");
|
|
308
319
|
}
|
|
309
320
|
|
|
310
|
-
await vi.waitFor(
|
|
311
|
-
expect(keepaliveCallback.current).not.toBeNull(),
|
|
321
|
+
await vi.waitFor(
|
|
322
|
+
() => expect(keepaliveCallback.current).not.toBeNull(),
|
|
323
|
+
{ timeout: 10_000, interval: 50 },
|
|
312
324
|
);
|
|
313
325
|
const emitKeepalive = keepaliveCallback.current;
|
|
314
326
|
if (!emitKeepalive) {
|
|
@@ -318,7 +330,7 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
318
330
|
|
|
319
331
|
const decoder = new TextDecoder();
|
|
320
332
|
let streamText = "";
|
|
321
|
-
for (let attempts = 0; attempts <
|
|
333
|
+
for (let attempts = 0; attempts < 10; attempts++) {
|
|
322
334
|
const { done, value } = await reader.read();
|
|
323
335
|
if (done) break;
|
|
324
336
|
streamText += decoder.decode(value, { stream: true });
|
|
@@ -331,7 +343,7 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
331
343
|
await reader?.cancel();
|
|
332
344
|
setIntervalSpy.mockRestore();
|
|
333
345
|
}
|
|
334
|
-
},
|
|
346
|
+
}, 30000);
|
|
335
347
|
});
|
|
336
348
|
|
|
337
349
|
describe("POST /command", () => {
|