@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.
package/dist/index.js CHANGED
@@ -1174,7 +1174,7 @@ import { v7 as uuidv7 } from "uuid";
1174
1174
  // package.json
1175
1175
  var package_default = {
1176
1176
  name: "@posthog/agent",
1177
- version: "2.1.67",
1177
+ version: "2.1.69",
1178
1178
  repository: "https://github.com/PostHog/twig",
1179
1179
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
1180
1180
  exports: {
@@ -1292,6 +1292,16 @@ var package_default = {
1292
1292
  };
1293
1293
 
1294
1294
  // src/utils/common.ts
1295
+ async function withTimeout(operation, timeoutMs) {
1296
+ const timeoutPromise = new Promise(
1297
+ (resolve4) => setTimeout(() => resolve4({ result: "timeout" }), timeoutMs)
1298
+ );
1299
+ const operationPromise = operation.then((value) => ({
1300
+ result: "success",
1301
+ value
1302
+ }));
1303
+ return Promise.race([operationPromise, timeoutPromise]);
1304
+ }
1295
1305
  var IS_ROOT = typeof process !== "undefined" && (process.geteuid?.() ?? process.getuid?.()) === 0;
1296
1306
  function unreachable(value, logger) {
1297
1307
  let valueAsString;
@@ -3316,6 +3326,7 @@ function clearStatsigCache() {
3316
3326
  }
3317
3327
 
3318
3328
  // src/adapters/claude/claude-agent.ts
3329
+ var SESSION_VALIDATION_TIMEOUT_MS = 1e4;
3319
3330
  var ClaudeAcpAgent = class extends BaseAcpAgent {
3320
3331
  adapterName = "claude";
3321
3332
  toolUseCache;
@@ -3447,6 +3458,13 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
3447
3458
  });
3448
3459
  session.taskRunId = meta?.taskRunId;
3449
3460
  this.registerPersistence(sessionId, meta);
3461
+ const validation = await withTimeout(
3462
+ q.initializationResult(),
3463
+ SESSION_VALIDATION_TIMEOUT_MS
3464
+ );
3465
+ if (validation.result === "timeout") {
3466
+ throw new Error("Session validation timed out");
3467
+ }
3450
3468
  this.deferBackgroundFetches(q, sessionId, mcpServers);
3451
3469
  const configOptions = await this.buildConfigOptions();
3452
3470
  return { configOptions };