@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.
@@ -1183,7 +1183,7 @@ import { v7 as uuidv7 } from "uuid";
1183
1183
  // package.json
1184
1184
  var package_default = {
1185
1185
  name: "@posthog/agent",
1186
- version: "2.1.67",
1186
+ version: "2.1.69",
1187
1187
  repository: "https://github.com/PostHog/twig",
1188
1188
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
1189
1189
  exports: {
@@ -1301,6 +1301,16 @@ var package_default = {
1301
1301
  };
1302
1302
 
1303
1303
  // src/utils/common.ts
1304
+ async function withTimeout(operation, timeoutMs) {
1305
+ const timeoutPromise = new Promise(
1306
+ (resolve4) => setTimeout(() => resolve4({ result: "timeout" }), timeoutMs)
1307
+ );
1308
+ const operationPromise = operation.then((value) => ({
1309
+ result: "success",
1310
+ value
1311
+ }));
1312
+ return Promise.race([operationPromise, timeoutPromise]);
1313
+ }
1304
1314
  var IS_ROOT = typeof process !== "undefined" && (process.geteuid?.() ?? process.getuid?.()) === 0;
1305
1315
  function unreachable(value, logger) {
1306
1316
  let valueAsString;
@@ -3281,6 +3291,7 @@ function clearStatsigCache() {
3281
3291
  }
3282
3292
 
3283
3293
  // src/adapters/claude/claude-agent.ts
3294
+ var SESSION_VALIDATION_TIMEOUT_MS = 1e4;
3284
3295
  var ClaudeAcpAgent = class extends BaseAcpAgent {
3285
3296
  adapterName = "claude";
3286
3297
  toolUseCache;
@@ -3412,6 +3423,13 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
3412
3423
  });
3413
3424
  session.taskRunId = meta?.taskRunId;
3414
3425
  this.registerPersistence(sessionId, meta);
3426
+ const validation = await withTimeout(
3427
+ q.initializationResult(),
3428
+ SESSION_VALIDATION_TIMEOUT_MS
3429
+ );
3430
+ if (validation.result === "timeout") {
3431
+ throw new Error("Session validation timed out");
3432
+ }
3415
3433
  this.deferBackgroundFetches(q, sessionId, mcpServers);
3416
3434
  const configOptions = await this.buildConfigOptions();
3417
3435
  return { configOptions };