@posthog/agent 2.3.93 → 2.3.104

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.
@@ -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.3.93",
907
+ version: "2.3.104",
908
908
  repository: "https://github.com/PostHog/code",
909
909
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
910
910
  exports: {
@@ -11331,6 +11331,7 @@ var SessionLogWriter = class _SessionLogWriter {
11331
11331
  lastFlushAttemptTime = /* @__PURE__ */ new Map();
11332
11332
  retryCounts = /* @__PURE__ */ new Map();
11333
11333
  sessions = /* @__PURE__ */ new Map();
11334
+ flushQueues = /* @__PURE__ */ new Map();
11334
11335
  logger;
11335
11336
  localCachePath;
11336
11337
  constructor(options = {}) {
@@ -11424,6 +11425,18 @@ var SessionLogWriter = class _SessionLogWriter {
11424
11425
  }
11425
11426
  }
11426
11427
  async flush(sessionId) {
11428
+ const prev = this.flushQueues.get(sessionId) ?? Promise.resolve();
11429
+ const next = prev.catch(() => {
11430
+ }).then(() => this._doFlush(sessionId));
11431
+ this.flushQueues.set(sessionId, next);
11432
+ next.finally(() => {
11433
+ if (this.flushQueues.get(sessionId) === next) {
11434
+ this.flushQueues.delete(sessionId);
11435
+ }
11436
+ });
11437
+ return next;
11438
+ }
11439
+ async _doFlush(sessionId) {
11427
11440
  const session = this.sessions.get(sessionId);
11428
11441
  if (!session) {
11429
11442
  this.logger.warn("flush: no session found", { sessionId });