testdriverai 7.8.0-test.46 → 7.8.0-test.48

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.
@@ -61,8 +61,23 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
61
61
  var self = this;
62
62
 
63
63
  this._ably = new Ably.Realtime({
64
- authCallback: function (tokenParams, callback) {
65
- callback(null, ablyToken);
64
+ authCallback: async function (tokenParams, callback) {
65
+ // On initial connect Ably may supply the token directly; on renewal
66
+ // we must fetch a fresh one from the API (the original token will
67
+ // have expired, causing 40143 token.unrecognized if reused).
68
+ try {
69
+ const response = await axios({
70
+ method: "post",
71
+ url: self.apiRoot + "/api/v7/sandbox/ably-token",
72
+ data: { apiKey: self.apiKey, sandboxId: self._sandboxId },
73
+ headers: { "Content-Type": "application/json" },
74
+ timeout: 15000,
75
+ });
76
+ callback(null, response.data.token);
77
+ } catch (err) {
78
+ logger.warn("[ably] Token renewal failed, falling back to original token: " + (err.message || err));
79
+ callback(null, ablyToken);
80
+ }
66
81
  },
67
82
  clientId: "sdk-" + this._sandboxId,
68
83
  echoMessages: false, // don't receive our own published messages
@@ -310,7 +325,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
310
325
  var reason = stateChange.reason;
311
326
  var reasonMsg = reason ? (reason.message || reason.code || String(reason)) : '';
312
327
 
313
- if (current === 'attached' && stateChange.resumed === false && previous) {
328
+ if (current === 'attached' && stateChange.resumed === false && previous === 'attached') {
314
329
  logger.warn('[ably] Channel DISCONTINUITY detected (resumed=false)' + (reasonMsg ? ' — ' + reasonMsg : ''));
315
330
  emitter.emit(events.sandbox.progress, {
316
331
  step: 'discontinuity',
@@ -540,7 +555,8 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
540
555
  const needsReadyWait = this._sessionChannel && (isE2B || !reply.runner);
541
556
  if (needsReadyWait) {
542
557
  logger.log('Waiting for runner agent to signal readiness...');
543
- var readyTimeout = 120000; // 120s allows for EC2 boot + agent startup
558
+ // E2B (Linux) sandboxes need extra time: S3 upload + npm install can add 60-120s on top of sandbox boot
559
+ var readyTimeout = isE2B ? 300000 : 120000; // 5 min for E2B (S3+npm), 2 min for EC2
544
560
  await new Promise(function (resolve, reject) {
545
561
  var resolved = false;
546
562
  function finish(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.8.0-test.46",
3
+ "version": "7.8.0-test.48",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "sdk.js",
6
6
  "types": "sdk.d.ts",
package/vitest.config.mjs CHANGED
@@ -14,8 +14,8 @@ const setupFiles = [
14
14
 
15
15
  const sharedTestConfig = {
16
16
  retry: 0,
17
- testTimeout: 120000,
18
- hookTimeout: 120000,
17
+ testTimeout: 480000,
18
+ hookTimeout: 480000,
19
19
  maxConcurrency: 100,
20
20
  disableConsoleIntercept: false,
21
21
  silent: false,