@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/server/bin.cjs
CHANGED
|
@@ -904,7 +904,7 @@ var import_hono = require("hono");
|
|
|
904
904
|
// package.json
|
|
905
905
|
var package_default = {
|
|
906
906
|
name: "@posthog/agent",
|
|
907
|
-
version: "2.1.
|
|
907
|
+
version: "2.1.131",
|
|
908
908
|
repository: "https://github.com/PostHog/twig",
|
|
909
909
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
910
910
|
exports: {
|
|
@@ -4451,7 +4451,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
4451
4451
|
lastFlushAttemptTime = /* @__PURE__ */ new Map();
|
|
4452
4452
|
retryCounts = /* @__PURE__ */ new Map();
|
|
4453
4453
|
sessions = /* @__PURE__ */ new Map();
|
|
4454
|
-
messageCounts = /* @__PURE__ */ new Map();
|
|
4455
4454
|
logger;
|
|
4456
4455
|
localCachePath;
|
|
4457
4456
|
constructor(options = {}) {
|
|
@@ -4461,19 +4460,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
4461
4460
|
}
|
|
4462
4461
|
async flushAll() {
|
|
4463
4462
|
const sessionIds = [...this.sessions.keys()];
|
|
4464
|
-
const pendingCounts = sessionIds.map((id) => {
|
|
4465
|
-
const session = this.sessions.get(id);
|
|
4466
|
-
return {
|
|
4467
|
-
taskId: session?.context.taskId,
|
|
4468
|
-
runId: session?.context.runId,
|
|
4469
|
-
pending: this.pendingEntries.get(id)?.length ?? 0,
|
|
4470
|
-
messages: this.messageCounts.get(id) ?? 0
|
|
4471
|
-
};
|
|
4472
|
-
});
|
|
4473
|
-
this.logger.info("flushAll called", {
|
|
4474
|
-
sessions: sessionIds.length,
|
|
4475
|
-
pending: pendingCounts
|
|
4476
|
-
});
|
|
4477
4463
|
const flushPromises = [];
|
|
4478
4464
|
for (const sessionId of sessionIds) {
|
|
4479
4465
|
flushPromises.push(this.flush(sessionId));
|
|
@@ -4517,15 +4503,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
4517
4503
|
});
|
|
4518
4504
|
return;
|
|
4519
4505
|
}
|
|
4520
|
-
const count = (this.messageCounts.get(sessionId) ?? 0) + 1;
|
|
4521
|
-
this.messageCounts.set(sessionId, count);
|
|
4522
|
-
if (count % 10 === 1) {
|
|
4523
|
-
this.logger.info("Messages received", {
|
|
4524
|
-
count,
|
|
4525
|
-
taskId: session.context.taskId,
|
|
4526
|
-
runId: session.context.runId
|
|
4527
|
-
});
|
|
4528
|
-
}
|
|
4529
4506
|
try {
|
|
4530
4507
|
const message = JSON.parse(line);
|
|
4531
4508
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -4574,12 +4551,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
4574
4551
|
this.emitCoalescedMessage(sessionId, session);
|
|
4575
4552
|
const pending = this.pendingEntries.get(sessionId);
|
|
4576
4553
|
if (!this.posthogAPI || !pending?.length) {
|
|
4577
|
-
this.logger.info("flush: nothing to persist", {
|
|
4578
|
-
taskId: session.context.taskId,
|
|
4579
|
-
runId: session.context.runId,
|
|
4580
|
-
hasPosthogAPI: !!this.posthogAPI,
|
|
4581
|
-
pendingCount: pending?.length ?? 0
|
|
4582
|
-
});
|
|
4583
4554
|
return;
|
|
4584
4555
|
}
|
|
4585
4556
|
this.pendingEntries.delete(sessionId);
|
|
@@ -4596,11 +4567,6 @@ var SessionLogWriter = class _SessionLogWriter {
|
|
|
4596
4567
|
pending
|
|
4597
4568
|
);
|
|
4598
4569
|
this.retryCounts.set(sessionId, 0);
|
|
4599
|
-
this.logger.info("Flushed session logs", {
|
|
4600
|
-
taskId: session.context.taskId,
|
|
4601
|
-
runId: session.context.runId,
|
|
4602
|
-
entryCount: pending.length
|
|
4603
|
-
});
|
|
4604
4570
|
} catch (error) {
|
|
4605
4571
|
const retryCount = (this.retryCounts.get(sessionId) ?? 0) + 1;
|
|
4606
4572
|
this.retryCounts.set(sessionId, retryCount);
|