@declaw/sdk 1.2.0 → 1.2.1

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
@@ -123,6 +123,8 @@ var CommandExitError = class extends SandboxError {
123
123
 
124
124
  // src/api/client.ts
125
125
  var _dispatcherPromise;
126
+ var _resolvedDispatcher;
127
+ var _dispatcherResolved = false;
126
128
  function getDispatcher() {
127
129
  if (_dispatcherPromise) return _dispatcherPromise;
128
130
  _dispatcherPromise = (async () => {
@@ -147,7 +149,14 @@ function getDispatcher() {
147
149
  maxConcurrentStreams,
148
150
  keepAliveTimeout: 3e4,
149
151
  keepAliveMaxTimeout: 6e4,
150
- pipelining: 1,
152
+ // NOTE: do NOT set `pipelining` here. undici applies it to H2 sessions
153
+ // too, where `pipelining: 1` caps each connection to ONE in-flight
154
+ // stream — silently defeating the H2 multiplexing that allowH2 enables.
155
+ // Omitted, H2 sessions default to unlimited concurrent streams (capped
156
+ // by maxConcurrentStreams) and H1.1 fallback defaults to 1 (safe, no
157
+ // head-of-line risk on non-idempotent POSTs). This is the single
158
+ // biggest burst-latency lever: with pipelining:1 a 100-concurrent burst
159
+ // queued ~36 requests behind the `connections` cap.
151
160
  allowH2: true,
152
161
  connect: { keepAlive: true, keepAliveInitialDelay: 5e3 }
153
162
  });
@@ -155,8 +164,13 @@ function getDispatcher() {
155
164
  return void 0;
156
165
  }
157
166
  })();
167
+ void _dispatcherPromise.then((d) => {
168
+ _resolvedDispatcher = d;
169
+ _dispatcherResolved = true;
170
+ });
158
171
  return _dispatcherPromise;
159
172
  }
173
+ void getDispatcher();
160
174
  var STATUS_ERROR_MAP = {
161
175
  400: InvalidArgumentError,
162
176
  401: AuthenticationError,
@@ -176,7 +190,7 @@ var ApiClient = class {
176
190
  constructor(config, opts) {
177
191
  this.config = config ?? new ConnectionConfig();
178
192
  this.maxRetries = opts?.maxRetries ?? 3;
179
- this.retryDelay = opts?.retryDelay ?? 0.5;
193
+ this.retryDelay = opts?.retryDelay ?? 0.1;
180
194
  this.abortController = new AbortController();
181
195
  }
182
196
  /** Send a GET request and return parsed JSON. */
@@ -270,7 +284,7 @@ var ApiClient = class {
270
284
  signals.push(AbortSignal.timeout(timeoutMs));
271
285
  }
272
286
  const signal = signals.length === 1 ? signals[0] : AbortSignal.any(signals);
273
- const dispatcher = await getDispatcher();
287
+ const dispatcher = _dispatcherResolved ? _resolvedDispatcher : await getDispatcher();
274
288
  const fetchOpts = {
275
289
  method,
276
290
  headers,