@probelabs/probe 0.6.0-rc223 → 0.6.0-rc224

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.
@@ -3776,6 +3776,19 @@ async function delegate({
3776
3776
  if (!task || typeof task !== "string") {
3777
3777
  throw new Error("Task parameter is required and must be a string");
3778
3778
  }
3779
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, "timeout");
3780
+ if (!hasExplicitTimeout) {
3781
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || "", 10);
3782
+ const envTimeoutSeconds = parseInt(
3783
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || "",
3784
+ 10
3785
+ );
3786
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
3787
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1e3));
3788
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
3789
+ timeout = Math.max(1, envTimeoutSeconds);
3790
+ }
3791
+ }
3779
3792
  const manager = delegationManager || defaultDelegationManager;
3780
3793
  const sessionId = randomUUID();
3781
3794
  const startTime = Date.now();
package/build/delegate.js CHANGED
@@ -385,6 +385,23 @@ export async function delegate({
385
385
  throw new Error('Task parameter is required and must be a string');
386
386
  }
387
387
 
388
+ // Support runtime timeout override via environment variables when timeout not explicitly passed
389
+ // This allows operators to configure delegation timeouts without code changes
390
+ // Priority: DELEGATION_TIMEOUT_MS (milliseconds) > DELEGATION_TIMEOUT_SECONDS > DELEGATION_TIMEOUT (seconds)
391
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, 'timeout');
392
+ if (!hasExplicitTimeout) {
393
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || '', 10);
394
+ const envTimeoutSeconds = parseInt(
395
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || '',
396
+ 10
397
+ );
398
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
399
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1000));
400
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
401
+ timeout = Math.max(1, envTimeoutSeconds);
402
+ }
403
+ }
404
+
388
405
  // Use provided manager or fall back to default singleton
389
406
  const manager = delegationManager || defaultDelegationManager;
390
407
 
@@ -33164,6 +33164,19 @@ async function delegate({
33164
33164
  if (!task || typeof task !== "string") {
33165
33165
  throw new Error("Task parameter is required and must be a string");
33166
33166
  }
33167
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, "timeout");
33168
+ if (!hasExplicitTimeout) {
33169
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || "", 10);
33170
+ const envTimeoutSeconds = parseInt(
33171
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || "",
33172
+ 10
33173
+ );
33174
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
33175
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1e3));
33176
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
33177
+ timeout = Math.max(1, envTimeoutSeconds);
33178
+ }
33179
+ }
33167
33180
  const manager = delegationManager || defaultDelegationManager;
33168
33181
  const sessionId = (0, import_crypto2.randomUUID)();
33169
33182
  const startTime = Date.now();
package/cjs/index.cjs CHANGED
@@ -99260,6 +99260,19 @@ async function delegate({
99260
99260
  if (!task || typeof task !== "string") {
99261
99261
  throw new Error("Task parameter is required and must be a string");
99262
99262
  }
99263
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, "timeout");
99264
+ if (!hasExplicitTimeout) {
99265
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || "", 10);
99266
+ const envTimeoutSeconds = parseInt(
99267
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || "",
99268
+ 10
99269
+ );
99270
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
99271
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1e3));
99272
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
99273
+ timeout = Math.max(1, envTimeoutSeconds);
99274
+ }
99275
+ }
99263
99276
  const manager = delegationManager || defaultDelegationManager;
99264
99277
  const sessionId = (0, import_crypto9.randomUUID)();
99265
99278
  const startTime = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc223",
3
+ "version": "0.6.0-rc224",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
package/src/delegate.js CHANGED
@@ -385,6 +385,23 @@ export async function delegate({
385
385
  throw new Error('Task parameter is required and must be a string');
386
386
  }
387
387
 
388
+ // Support runtime timeout override via environment variables when timeout not explicitly passed
389
+ // This allows operators to configure delegation timeouts without code changes
390
+ // Priority: DELEGATION_TIMEOUT_MS (milliseconds) > DELEGATION_TIMEOUT_SECONDS > DELEGATION_TIMEOUT (seconds)
391
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, 'timeout');
392
+ if (!hasExplicitTimeout) {
393
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || '', 10);
394
+ const envTimeoutSeconds = parseInt(
395
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || '',
396
+ 10
397
+ );
398
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
399
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1000));
400
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
401
+ timeout = Math.max(1, envTimeoutSeconds);
402
+ }
403
+ }
404
+
388
405
  // Use provided manager or fall back to default singleton
389
406
  const manager = delegationManager || defaultDelegationManager;
390
407