@adaptic/lumic-utils 1.0.23 → 1.0.25

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.
Files changed (24) hide show
  1. package/dist/{apollo-client.client-FeVPHV0i.js → apollo-client.client-D6jG5B1n.js} +3 -3
  2. package/dist/{apollo-client.client-FeVPHV0i.js.map → apollo-client.client-D6jG5B1n.js.map} +1 -1
  3. package/dist/{apollo-client.client-DrSy1wz-.js → apollo-client.client-DLW-p46Y.js} +4 -4
  4. package/dist/{apollo-client.client-DrSy1wz-.js.map → apollo-client.client-DLW-p46Y.js.map} +1 -1
  5. package/dist/{apollo-client.server-CJ6iRLa2.js → apollo-client.server-CXLiLmSz.js} +3 -3
  6. package/dist/{apollo-client.server-CJ6iRLa2.js.map → apollo-client.server-CXLiLmSz.js.map} +1 -1
  7. package/dist/{apollo-client.server-BEGHAF48.js → apollo-client.server-Cx30LaNh.js} +3 -3
  8. package/dist/{apollo-client.server-BEGHAF48.js.map → apollo-client.server-Cx30LaNh.js.map} +1 -1
  9. package/dist/{index-CWoI2dXN.js → index-Bvc61lYS.js} +76 -18
  10. package/dist/{index-WGzi__C5.js.map → index-Bvc61lYS.js.map} +1 -1
  11. package/dist/{index-WGzi__C5.js → index-ChygDqeG.js} +76 -18
  12. package/dist/{index-CWoI2dXN.js.map → index-ChygDqeG.js.map} +1 -1
  13. package/dist/{index-Dz0wKyTF.js → index-CqnZ-XiI.js} +2 -2
  14. package/dist/{index-Dz0wKyTF.js.map → index-CqnZ-XiI.js.map} +1 -1
  15. package/dist/{index-vRskhk1H.js → index-D2TPDKw0.js} +2 -2
  16. package/dist/{index-vRskhk1H.js.map → index-D2TPDKw0.js.map} +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/test.cjs +1 -1
  20. package/dist/test.mjs +1 -1
  21. package/dist/types/functions/llm-openai.d.ts +5 -0
  22. package/dist/types/types/openai-types.d.ts +25 -0
  23. package/dist/types/utils/retry.d.ts +8 -0
  24. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-WGzi__C5.js');
3
+ var index = require('./index-ChygDqeG.js');
4
4
  require('openai');
5
5
  require('zod');
6
6
  require('@aws-sdk/client-s3');
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { bW as AWSLambdaError, bX as AWSS3Error, c5 as AWS_LAMBDA_TIMEOUT_MS, c6 as AWS_S3_TIMEOUT_MS, aV as CircuitBreaker, aX as CircuitBreakerOpenError, aW as CircuitBreakerState, aY as DEFAULT_CIRCUIT_BREAKER_CONFIG, c8 as GENERIC_FETCH_TIMEOUT_MS, c3 as GOOGLE_SHEETS_TIMEOUT_MS, bY as GoogleSheetsError, b_ as JsonParseError, b0 as LLMCostTracker, bV as LLMError, bt as LLM_ADVANCED_PROVIDER, bq as LLM_DEFAULT_PROVIDER, br as LLM_MINI_PROVIDER, bx as LLM_MODEL_ADVANCED, bv as LLM_MODEL_MINI, bw as LLM_MODEL_NORMAL, bs as LLM_NORMAL_PROVIDER, bu as LLM_PROVIDER, c4 as LLM_TIMEOUT_MS, bT as LumicError, bn as MODEL_ALIASES, bo as OPENAI_COMPATIBLE_PROVIDERS, c7 as OPENWEATHER_TIMEOUT_MS, b$ as PDFError, c2 as PERPLEXITY_TIMEOUT_MS, bp as PROVIDER_DEFAULT_MODELS, bZ as PerplexityError, be as RATE_LIMIT_PROFILES, c1 as SLACK_TIMEOUT_MS, bj as SUPPORTED_MODELS, bU as SlackError, bd as TokenBucketRateLimiter, c0 as ZipError, bi as checkIntegrationHealth, bS as createSafeValidator, bR as createValidator, b8 as generateCorrelationId, ba as getCorrelationContext, bc as getCorrelationHeaders, b9 as getCorrelationId, b1 as getLLMCostTracker, aM as getLumicLogger, b5 as getMetricsCollector, bl as getModelCapabilities, bm as getModelProvider, bf as getRateLimiter, aR as getSecrets, bH as googleSheetsValueRangeSchema, bk as isValidModel, bM as lambdaInvokeResponseSchema, l as lumic, by as makeAnthropicCall, bz as makeOpenAICompatibleCall, bA as openAIChatCompletionSchema, bB as openAIImageResponseSchema, bE as perplexityResponseSchema, aT as requireSecret, bg as resetAllRateLimiters, b3 as resetLLMCostTracker, b6 as resetMetricsCollector, aS as resetSecrets, bL as s3GetObjectSchema, bK as s3ListObjectsSchema, bJ as safeValidateGoogleSheetsResponse, bQ as safeValidateLambdaResponse, bD as safeValidateOpenAIChatCompletion, bG as safeValidatePerplexityResponse, bO as safeValidateS3ListObjects, aP as sanitizeAWSAuth, aO as sanitizeError, aN as sanitizeForLog, aQ as sanitizeObject, b2 as setLLMCostTracker, aL as setLumicLogger, b4 as setMetricsCollector, a$ as validateGoogleSheetsRange, bI as validateGoogleSheetsResponse, bP as validateLambdaResponse, bC as validateOpenAIChatCompletion, bF as validatePerplexityResponse, a_ as validateS3Key, bN as validateS3ListObjects, aZ as validateSlackChannel, bb as withCorrelationId, b7 as withMetrics, bh as withRateLimit, aU as withRetry } from './index-CWoI2dXN.js';
1
+ export { bW as AWSLambdaError, bX as AWSS3Error, c5 as AWS_LAMBDA_TIMEOUT_MS, c6 as AWS_S3_TIMEOUT_MS, aV as CircuitBreaker, aX as CircuitBreakerOpenError, aW as CircuitBreakerState, aY as DEFAULT_CIRCUIT_BREAKER_CONFIG, c8 as GENERIC_FETCH_TIMEOUT_MS, c3 as GOOGLE_SHEETS_TIMEOUT_MS, bY as GoogleSheetsError, b_ as JsonParseError, b0 as LLMCostTracker, bV as LLMError, bt as LLM_ADVANCED_PROVIDER, bq as LLM_DEFAULT_PROVIDER, br as LLM_MINI_PROVIDER, bx as LLM_MODEL_ADVANCED, bv as LLM_MODEL_MINI, bw as LLM_MODEL_NORMAL, bs as LLM_NORMAL_PROVIDER, bu as LLM_PROVIDER, c4 as LLM_TIMEOUT_MS, bT as LumicError, bn as MODEL_ALIASES, bo as OPENAI_COMPATIBLE_PROVIDERS, c7 as OPENWEATHER_TIMEOUT_MS, b$ as PDFError, c2 as PERPLEXITY_TIMEOUT_MS, bp as PROVIDER_DEFAULT_MODELS, bZ as PerplexityError, be as RATE_LIMIT_PROFILES, c1 as SLACK_TIMEOUT_MS, bj as SUPPORTED_MODELS, bU as SlackError, bd as TokenBucketRateLimiter, c0 as ZipError, bi as checkIntegrationHealth, bS as createSafeValidator, bR as createValidator, b8 as generateCorrelationId, ba as getCorrelationContext, bc as getCorrelationHeaders, b9 as getCorrelationId, b1 as getLLMCostTracker, aM as getLumicLogger, b5 as getMetricsCollector, bl as getModelCapabilities, bm as getModelProvider, bf as getRateLimiter, aR as getSecrets, bH as googleSheetsValueRangeSchema, bk as isValidModel, bM as lambdaInvokeResponseSchema, l as lumic, by as makeAnthropicCall, bz as makeOpenAICompatibleCall, bA as openAIChatCompletionSchema, bB as openAIImageResponseSchema, bE as perplexityResponseSchema, aT as requireSecret, bg as resetAllRateLimiters, b3 as resetLLMCostTracker, b6 as resetMetricsCollector, aS as resetSecrets, bL as s3GetObjectSchema, bK as s3ListObjectsSchema, bJ as safeValidateGoogleSheetsResponse, bQ as safeValidateLambdaResponse, bD as safeValidateOpenAIChatCompletion, bG as safeValidatePerplexityResponse, bO as safeValidateS3ListObjects, aP as sanitizeAWSAuth, aO as sanitizeError, aN as sanitizeForLog, aQ as sanitizeObject, b2 as setLLMCostTracker, aL as setLumicLogger, b4 as setMetricsCollector, a$ as validateGoogleSheetsRange, bI as validateGoogleSheetsResponse, bP as validateLambdaResponse, bC as validateOpenAIChatCompletion, bF as validatePerplexityResponse, a_ as validateS3Key, bN as validateS3ListObjects, aZ as validateSlackChannel, bb as withCorrelationId, b7 as withMetrics, bh as withRateLimit, aU as withRetry } from './index-Bvc61lYS.js';
2
2
  import 'openai';
3
3
  import 'zod';
4
4
  import '@aws-sdk/client-s3';
package/dist/test.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-WGzi__C5.js');
3
+ var index = require('./index-ChygDqeG.js');
4
4
  require('openai');
5
5
  require('zod');
6
6
  require('@aws-sdk/client-s3');
package/dist/test.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as lumic } from './index-CWoI2dXN.js';
1
+ import { l as lumic } from './index-Bvc61lYS.js';
2
2
  import 'openai';
3
3
  import 'zod';
4
4
  import '@aws-sdk/client-s3';
@@ -53,4 +53,9 @@ export declare const makeResponsesAPICall: <T = unknown>(input: string | Respons
53
53
  apiKey?: string;
54
54
  model?: string;
55
55
  timeout?: number;
56
+ /**
57
+ * Optional AbortSignal for cooperative cancellation. See
58
+ * {@link LLMOptions.signal} for full semantics.
59
+ */
60
+ signal?: AbortSignal;
56
61
  }) => Promise<LLMResponse<T>>;
@@ -522,6 +522,31 @@ export interface LLMOptions {
522
522
  * Request timeout in milliseconds. Overrides the default LLM_TIMEOUT_MS (120000ms).
523
523
  */
524
524
  timeout?: number;
525
+ /**
526
+ * Optional AbortSignal for cooperative cancellation of an in-flight LLM
527
+ * call. When the signal aborts, the underlying SDK HTTP request is
528
+ * interrupted, the call rejects, and the response body (which can be
529
+ * tens of KB and is held in the closure of the resolving promise
530
+ * chain) is released immediately rather than at the timeout boundary.
531
+ *
532
+ * This is the correct primitive for caller-driven cancel-and-restart
533
+ * patterns (e.g. an upstream session is superseded by a fresher signal
534
+ * snapshot) where the engine-side timeout race would otherwise leave
535
+ * an orphaned HTTP request pinning context memory for up to
536
+ * `timeout` ms.
537
+ *
538
+ * Plumbed through:
539
+ * - OpenAI provider: openai.chat.completions.create(queryOptions, { signal })
540
+ * - Anthropic provider: anthropic.messages.create({ ... }, { signal })
541
+ * - OpenAI-compatible providers (Deepseek/Kimi/Qwen/xAI/Gemini):
542
+ * same shape as OpenAI provider
543
+ *
544
+ * Adding this to a provider's request options does NOT cancel any
545
+ * retry attempts already in flight inside `withRetry` — the signal is
546
+ * checked on each attempt boundary, and `withRetry` itself aborts the
547
+ * loop when the signal fires.
548
+ */
549
+ signal?: AbortSignal;
525
550
  }
526
551
  /**
527
552
  * Represents the response from the LLM.
@@ -9,6 +9,14 @@ export interface RetryConfig {
9
9
  retryableErrors?: (error: unknown) => boolean;
10
10
  /** Optional circuit breaker to check before each attempt */
11
11
  circuitBreaker?: CircuitBreaker;
12
+ /**
13
+ * Optional AbortSignal for cooperative cancellation. When the signal
14
+ * aborts, in-flight inter-attempt sleep is interrupted and the next
15
+ * attempt is skipped (the underlying `fn` is also expected to honour
16
+ * the signal — that wiring is provider-specific and happens in the
17
+ * caller, not here).
18
+ */
19
+ signal?: AbortSignal;
12
20
  }
13
21
  /**
14
22
  * Default retry configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/lumic-utils",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "NPM repo set of utility functions usable across the entire organisation.",
5
5
  "always-build-npm": false,
6
6
  "type": "module",