@posthog/agent 2.1.67 → 2.1.69

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.
@@ -1175,7 +1175,7 @@ var import_uuid = require("uuid");
1175
1175
  // package.json
1176
1176
  var package_default = {
1177
1177
  name: "@posthog/agent",
1178
- version: "2.1.67",
1178
+ version: "2.1.69",
1179
1179
  repository: "https://github.com/PostHog/twig",
1180
1180
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
1181
1181
  exports: {
@@ -1293,6 +1293,16 @@ var package_default = {
1293
1293
  };
1294
1294
 
1295
1295
  // src/utils/common.ts
1296
+ async function withTimeout(operation, timeoutMs) {
1297
+ const timeoutPromise = new Promise(
1298
+ (resolve4) => setTimeout(() => resolve4({ result: "timeout" }), timeoutMs)
1299
+ );
1300
+ const operationPromise = operation.then((value) => ({
1301
+ result: "success",
1302
+ value
1303
+ }));
1304
+ return Promise.race([operationPromise, timeoutPromise]);
1305
+ }
1296
1306
  var IS_ROOT = typeof process !== "undefined" && (process.geteuid?.() ?? process.getuid?.()) === 0;
1297
1307
  function unreachable(value, logger) {
1298
1308
  let valueAsString;
@@ -3273,6 +3283,7 @@ function clearStatsigCache() {
3273
3283
  }
3274
3284
 
3275
3285
  // src/adapters/claude/claude-agent.ts
3286
+ var SESSION_VALIDATION_TIMEOUT_MS = 1e4;
3276
3287
  var ClaudeAcpAgent = class extends BaseAcpAgent {
3277
3288
  adapterName = "claude";
3278
3289
  toolUseCache;
@@ -3404,6 +3415,13 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
3404
3415
  });
3405
3416
  session.taskRunId = meta?.taskRunId;
3406
3417
  this.registerPersistence(sessionId, meta);
3418
+ const validation = await withTimeout(
3419
+ q.initializationResult(),
3420
+ SESSION_VALIDATION_TIMEOUT_MS
3421
+ );
3422
+ if (validation.result === "timeout") {
3423
+ throw new Error("Session validation timed out");
3424
+ }
3407
3425
  this.deferBackgroundFetches(q, sessionId, mcpServers);
3408
3426
  const configOptions = await this.buildConfigOptions();
3409
3427
  return { configOptions };