@cadraos/sdk 0.3.14 → 0.3.15

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.d.cts CHANGED
@@ -65,7 +65,8 @@ interface RequestOptions {
65
65
  /**
66
66
  * Per-request timeout in milliseconds. Overrides the client-wide
67
67
  * `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
68
- * may take up to 60 s while every other call keeps the 30 s default).
68
+ * waits for the server's route ceiling while every other call keeps the
69
+ * 30 s default).
69
70
  */
70
71
  timeoutMs?: number;
71
72
  }
@@ -77,6 +78,8 @@ declare class HttpClient {
77
78
  private tokenRefreshAttempts;
78
79
  private readonly maxTokenRefreshAttempts;
79
80
  constructor(config: HttpClientConfig);
81
+ /** The client-wide request timeout (ms) this client was configured with. */
82
+ get timeoutMs(): number;
80
83
  /**
81
84
  * Get authorization header value
82
85
  */
@@ -3421,8 +3424,15 @@ declare class RemoteRunnersAPI extends BaseResourceAPI {
3421
3424
  * ```
3422
3425
  */
3423
3426
 
3424
- /** Paid runs get their own 60 s budget (server `maxDuration = 60`, D6). */
3425
- declare const AI_FUNCTION_RUN_TIMEOUT_MS = 60000;
3427
+ /**
3428
+ * How long the client waits for a paid run. It tracks cadra-web
3429
+ * `AI_FUNCTION_ROUTE_MAX_MS` (300 s, the Vercel `maxDuration` of the run
3430
+ * routes) plus 10 s, so the server always answers first — with the result or
3431
+ * with its own `failed_timeout` — and the client never abandons a run the
3432
+ * server is still finishing. A larger client-wide `timeout` wins.
3433
+ * (Was 60 s, from the old p93 D6 route budget.)
3434
+ */
3435
+ declare const AI_FUNCTION_RUN_TIMEOUT_MS = 310000;
3426
3436
  /** Descriptors used by the client-side check are cached per client for 60 s (D27c). */
3427
3437
  declare const AI_FUNCTION_DESCRIPTOR_TTL_MS = 60000;
3428
3438
  /**
package/dist/index.d.ts CHANGED
@@ -65,7 +65,8 @@ interface RequestOptions {
65
65
  /**
66
66
  * Per-request timeout in milliseconds. Overrides the client-wide
67
67
  * `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
68
- * may take up to 60 s while every other call keeps the 30 s default).
68
+ * waits for the server's route ceiling while every other call keeps the
69
+ * 30 s default).
69
70
  */
70
71
  timeoutMs?: number;
71
72
  }
@@ -77,6 +78,8 @@ declare class HttpClient {
77
78
  private tokenRefreshAttempts;
78
79
  private readonly maxTokenRefreshAttempts;
79
80
  constructor(config: HttpClientConfig);
81
+ /** The client-wide request timeout (ms) this client was configured with. */
82
+ get timeoutMs(): number;
80
83
  /**
81
84
  * Get authorization header value
82
85
  */
@@ -3421,8 +3424,15 @@ declare class RemoteRunnersAPI extends BaseResourceAPI {
3421
3424
  * ```
3422
3425
  */
3423
3426
 
3424
- /** Paid runs get their own 60 s budget (server `maxDuration = 60`, D6). */
3425
- declare const AI_FUNCTION_RUN_TIMEOUT_MS = 60000;
3427
+ /**
3428
+ * How long the client waits for a paid run. It tracks cadra-web
3429
+ * `AI_FUNCTION_ROUTE_MAX_MS` (300 s, the Vercel `maxDuration` of the run
3430
+ * routes) plus 10 s, so the server always answers first — with the result or
3431
+ * with its own `failed_timeout` — and the client never abandons a run the
3432
+ * server is still finishing. A larger client-wide `timeout` wins.
3433
+ * (Was 60 s, from the old p93 D6 route budget.)
3434
+ */
3435
+ declare const AI_FUNCTION_RUN_TIMEOUT_MS = 310000;
3426
3436
  /** Descriptors used by the client-side check are cached per client for 60 s (D27c). */
3427
3437
  declare const AI_FUNCTION_DESCRIPTOR_TTL_MS = 60000;
3428
3438
  /**
package/dist/index.js CHANGED
@@ -287,6 +287,10 @@ var HttpClient = class {
287
287
  constructor(config) {
288
288
  this.config = config;
289
289
  }
290
+ /** The client-wide request timeout (ms) this client was configured with. */
291
+ get timeoutMs() {
292
+ return this.config.timeout;
293
+ }
290
294
  /**
291
295
  * Get authorization header value
292
296
  */
@@ -3413,7 +3417,7 @@ var RemoteRunnersAPI = class extends BaseResourceAPI {
3413
3417
  };
3414
3418
 
3415
3419
  // src/resources/ai-functions.ts
3416
- var AI_FUNCTION_RUN_TIMEOUT_MS = 6e4;
3420
+ var AI_FUNCTION_RUN_TIMEOUT_MS = 31e4;
3417
3421
  var AI_FUNCTION_DESCRIPTOR_TTL_MS = 6e4;
3418
3422
  function checkAiFunctionParameters(parameters, variables) {
3419
3423
  const issues = [];
@@ -3526,7 +3530,7 @@ var AiFunctionsAPI = class extends BaseResourceAPI {
3526
3530
  try {
3527
3531
  return await this.httpPost("/run", body, {
3528
3532
  skipRetry: true,
3529
- timeoutMs: AI_FUNCTION_RUN_TIMEOUT_MS
3533
+ timeoutMs: Math.max(AI_FUNCTION_RUN_TIMEOUT_MS, this.http.timeoutMs ?? 0)
3530
3534
  });
3531
3535
  } catch (error) {
3532
3536
  throw this.mapRunError(error, functionKey);