@posthog/agent 2.1.125 → 2.1.131
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 +1 -35
- 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 +1 -35
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +1 -35
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +1 -1
- package/src/session-log-writer.ts +1 -36
package/dist/agent.js
CHANGED
|
@@ -276,7 +276,7 @@ import { v7 as uuidv7 } from "uuid";
|
|
|
276
276
|
// package.json
|
|
277
277
|
var package_default = {
|
|
278
278
|
name: "@posthog/agent",
|
|
279
|
-
version: "2.1.
|
|
279
|
+
version: "2.1.131",
|
|
280
280
|
repository: "https://github.com/PostHog/twig",
|
|
281
281
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
282
282
|
exports: {
|
|
@@ -3588,7 +3588,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
3588
3588
|
lastFlushAttemptTime = /* @__PURE__ */ new Map();
|
|
3589
3589
|
retryCounts = /* @__PURE__ */ new Map();
|
|
3590
3590
|
sessions = /* @__PURE__ */ new Map();
|
|
3591
|
-
messageCounts = /* @__PURE__ */ new Map();
|
|
3592
3591
|
logger;
|
|
3593
3592
|
localCachePath;
|
|
3594
3593
|
constructor(options = {}) {
|
|
@@ -3598,19 +3597,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
3598
3597
|
}
|
|
3599
3598
|
async flushAll() {
|
|
3600
3599
|
const sessionIds = [...this.sessions.keys()];
|
|
3601
|
-
const pendingCounts = sessionIds.map((id) => {
|
|
3602
|
-
const session = this.sessions.get(id);
|
|
3603
|
-
return {
|
|
3604
|
-
taskId: session?.context.taskId,
|
|
3605
|
-
runId: session?.context.runId,
|
|
3606
|
-
pending: this.pendingEntries.get(id)?.length ?? 0,
|
|
3607
|
-
messages: this.messageCounts.get(id) ?? 0
|
|
3608
|
-
};
|
|
3609
|
-
});
|
|
3610
|
-
this.logger.info("flushAll called", {
|
|
3611
|
-
sessions: sessionIds.length,
|
|
3612
|
-
pending: pendingCounts
|
|
3613
|
-
});
|
|
3614
3600
|
const flushPromises = [];
|
|
3615
3601
|
for (const sessionId of sessionIds) {
|
|
3616
3602
|
flushPromises.push(this.flush(sessionId));
|
|
@@ -3654,15 +3640,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
3654
3640
|
});
|
|
3655
3641
|
return;
|
|
3656
3642
|
}
|
|
3657
|
-
const count = (this.messageCounts.get(sessionId) ?? 0) + 1;
|
|
3658
|
-
this.messageCounts.set(sessionId, count);
|
|
3659
|
-
if (count % 10 === 1) {
|
|
3660
|
-
this.logger.info("Messages received", {
|
|
3661
|
-
count,
|
|
3662
|
-
taskId: session.context.taskId,
|
|
3663
|
-
runId: session.context.runId
|
|
3664
|
-
});
|
|
3665
|
-
}
|
|
3666
3643
|
try {
|
|
3667
3644
|
const message = JSON.parse(line);
|
|
3668
3645
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -3711,12 +3688,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
3711
3688
|
this.emitCoalescedMessage(sessionId, session);
|
|
3712
3689
|
const pending = this.pendingEntries.get(sessionId);
|
|
3713
3690
|
if (!this.posthogAPI || !pending?.length) {
|
|
3714
|
-
this.logger.info("flush: nothing to persist", {
|
|
3715
|
-
taskId: session.context.taskId,
|
|
3716
|
-
runId: session.context.runId,
|
|
3717
|
-
hasPosthogAPI: !!this.posthogAPI,
|
|
3718
|
-
pendingCount: pending?.length ?? 0
|
|
3719
|
-
});
|
|
3720
3691
|
return;
|
|
3721
3692
|
}
|
|
3722
3693
|
this.pendingEntries.delete(sessionId);
|
|
@@ -3733,11 +3704,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
3733
3704
|
pending
|
|
3734
3705
|
);
|
|
3735
3706
|
this.retryCounts.set(sessionId, 0);
|
|
3736
|
-
this.logger.info("Flushed session logs", {
|
|
3737
|
-
taskId: session.context.taskId,
|
|
3738
|
-
runId: session.context.runId,
|
|
3739
|
-
entryCount: pending.length
|
|
3740
|
-
});
|
|
3741
3707
|
} catch (error) {
|
|
3742
3708
|
const retryCount = (this.retryCounts.get(sessionId) ?? 0) + 1;
|
|
3743
3709
|
this.retryCounts.set(sessionId, retryCount);
|