@adaptic/lumic-utils 1.0.15 → 1.0.17

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.
@@ -7795,12 +7795,19 @@ function sanitizeObject(obj, sensitiveFields = ['apiKey', 'token', 'secret', 'pa
7795
7795
  // llm-anthropic.ts
7796
7796
  /**
7797
7797
  * Determines if an Anthropic API error should be retried.
7798
- * Retries on rate limits (429) and overloaded (529) errors.
7798
+ * Retries on:
7799
+ * - 429 rate limit
7800
+ * - 500 internal server error (transient)
7801
+ * - 503 service unavailable (transient)
7802
+ * - 529 overloaded
7803
+ * - Messages containing "rate limit" or "overloaded"
7799
7804
  */
7800
7805
  const isRetryableAnthropicError = (error) => {
7801
7806
  if (error instanceof Error) {
7802
7807
  const message = error.message;
7803
7808
  if (message.includes('429') ||
7809
+ message.includes('500') ||
7810
+ message.includes('503') ||
7804
7811
  message.includes('529') ||
7805
7812
  message.includes('rate limit') ||
7806
7813
  message.includes('overloaded')) {
@@ -7846,10 +7853,38 @@ function translateContextToAnthropic(context) {
7846
7853
  continue;
7847
7854
  }
7848
7855
  if (msg.role === 'assistant') {
7849
- const content = typeof msg.content === 'string'
7850
- ? msg.content
7851
- : JSON.stringify(msg.content);
7852
- messages.push({ role: 'assistant', content });
7856
+ const assistantMsg = msg;
7857
+ // If the assistant message has tool_calls, translate to Anthropic tool_use blocks
7858
+ if (assistantMsg.tool_calls && assistantMsg.tool_calls.length > 0) {
7859
+ const contentBlocks = [];
7860
+ // Include text content if present
7861
+ if (typeof assistantMsg.content === 'string' && assistantMsg.content.trim()) {
7862
+ contentBlocks.push({ type: 'text', text: assistantMsg.content });
7863
+ }
7864
+ // Translate each tool_call to a tool_use block
7865
+ for (const tc of assistantMsg.tool_calls) {
7866
+ let input = {};
7867
+ try {
7868
+ input = JSON.parse(tc.function.arguments);
7869
+ }
7870
+ catch {
7871
+ input = { raw: tc.function.arguments };
7872
+ }
7873
+ contentBlocks.push({
7874
+ type: 'tool_use',
7875
+ id: tc.id,
7876
+ name: tc.function.name,
7877
+ input,
7878
+ });
7879
+ }
7880
+ messages.push({ role: 'assistant', content: contentBlocks });
7881
+ }
7882
+ else {
7883
+ const content = typeof assistantMsg.content === 'string'
7884
+ ? assistantMsg.content
7885
+ : JSON.stringify(assistantMsg.content);
7886
+ messages.push({ role: 'assistant', content });
7887
+ }
7853
7888
  continue;
7854
7889
  }
7855
7890
  if (msg.role === 'tool') {
@@ -22655,11 +22690,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
22655
22690
  async function loadApolloModules() {
22656
22691
  if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
22657
22692
  // Server-side (or Lambda): load the CommonJS‑based implementation.
22658
- return (await import('./apollo-client.server-D9uTrgax.js'));
22693
+ return (await import('./apollo-client.server-CBdqNKB_.js'));
22659
22694
  }
22660
22695
  else {
22661
22696
  // Client-side: load the ESM‑based implementation.
22662
- return (await import('./apollo-client.client-DLlWTxt5.js'));
22697
+ return (await import('./apollo-client.client-D-B7RKys.js'));
22663
22698
  }
22664
22699
  }
22665
22700
  /**
@@ -81183,4 +81218,4 @@ const lumic = {
81183
81218
  };
81184
81219
 
81185
81220
  export { GraphQLInterfaceType as $, print as A, getNamedType as B, isInputType as C, isRequiredArgument as D, isNamedType as E, GraphQLError as F, GraphQLNonNull as G, isOutputType as H, isRequiredInputField as I, isCompositeType as J, Kind as K, getNullableType as L, getEnterLeaveForKind as M, isNode as N, OperationTypeNode as O, didYouMean as P, naturalCompare as Q, suggestionList as R, specifiedScalarTypes as S, keyMap as T, isType as U, isNullableType as V, visit as W, visitInParallel as X, keyValMap as Y, assertObjectType as Z, GraphQLScalarType as _, isListType as a, validateGoogleSheetsRange as a$, GraphQLUnionType as a0, GraphQLInputObjectType as a1, assertNullableType as a2, assertInterfaceType as a3, mapValue as a4, isSpecifiedScalarType as a5, isPrintableAsBlockString as a6, printBlockString as a7, BREAK as a8, GRAPHQL_MAX_INT as a9, printSourceLocation as aA, resolveObjMapThunk as aB, resolveReadonlyArrayThunk as aC, valueFromASTUntyped as aD, version$4 as aE, versionInfo as aF, getAugmentedNamespace as aG, isDigit$1 as aH, isNameStart as aI, dedentBlockStringLines as aJ, isNameContinue as aK, setLumicLogger as aL, getLumicLogger as aM, sanitizeForLog as aN, sanitizeError as aO, sanitizeAWSAuth as aP, sanitizeObject as aQ, getSecrets as aR, resetSecrets as aS, requireSecret as aT, withRetry as aU, CircuitBreaker as aV, CircuitBreakerState as aW, CircuitBreakerOpenError as aX, DEFAULT_CIRCUIT_BREAKER_CONFIG as aY, validateSlackChannel as aZ, validateS3Key as a_, GRAPHQL_MIN_INT as aa, GraphQLFloat as ab, GraphQLInt as ac, Location as ad, Token as ae, assertAbstractType as af, assertCompositeType as ag, assertEnumType as ah, assertEnumValueName as ai, assertInputObjectType as aj, assertInputType as ak, assertLeafType as al, assertListType as am, assertNamedType as an, assertNonNullType as ao, assertOutputType as ap, assertScalarType as aq, assertType as ar, assertUnionType as as, assertWrappingType as at, formatError as au, getLocation as av, getVisitFn as aw, isWrappingType as ax, printError as ay, printLocation as az, isAbstractType as b, PDFError as b$, LLMCostTracker as b0, getLLMCostTracker as b1, setLLMCostTracker as b2, resetLLMCostTracker as b3, setMetricsCollector as b4, getMetricsCollector as b5, resetMetricsCollector as b6, withMetrics as b7, generateCorrelationId as b8, getCorrelationId as b9, openAIChatCompletionSchema as bA, openAIImageResponseSchema as bB, validateOpenAIChatCompletion as bC, safeValidateOpenAIChatCompletion as bD, perplexityResponseSchema as bE, validatePerplexityResponse as bF, safeValidatePerplexityResponse as bG, googleSheetsValueRangeSchema as bH, validateGoogleSheetsResponse as bI, safeValidateGoogleSheetsResponse as bJ, s3ListObjectsSchema as bK, s3GetObjectSchema as bL, lambdaInvokeResponseSchema as bM, validateS3ListObjects as bN, safeValidateS3ListObjects as bO, validateLambdaResponse as bP, safeValidateLambdaResponse as bQ, createValidator as bR, createSafeValidator as bS, LumicError as bT, SlackError as bU, LLMError as bV, AWSLambdaError as bW, AWSS3Error as bX, GoogleSheetsError as bY, PerplexityError as bZ, JsonParseError as b_, getCorrelationContext as ba, withCorrelationId as bb, getCorrelationHeaders as bc, TokenBucketRateLimiter as bd, RATE_LIMIT_PROFILES as be, getRateLimiter as bf, resetAllRateLimiters as bg, withRateLimit as bh, checkIntegrationHealth as bi, SUPPORTED_MODELS as bj, isValidModel as bk, getModelCapabilities as bl, getModelProvider as bm, MODEL_ALIASES as bn, OPENAI_COMPATIBLE_PROVIDERS as bo, PROVIDER_DEFAULT_MODELS as bp, LLM_DEFAULT_PROVIDER as bq, LLM_MINI_PROVIDER as br, LLM_NORMAL_PROVIDER as bs, LLM_ADVANCED_PROVIDER as bt, LLM_PROVIDER as bu, LLM_MODEL_MINI as bv, LLM_MODEL_NORMAL as bw, LLM_MODEL_ADVANCED as bx, makeAnthropicCall as by, makeOpenAICompatibleCall as bz, isInterfaceType as c, ZipError as c0, SLACK_TIMEOUT_MS as c1, PERPLEXITY_TIMEOUT_MS as c2, GOOGLE_SHEETS_TIMEOUT_MS as c3, LLM_TIMEOUT_MS as c4, AWS_LAMBDA_TIMEOUT_MS as c5, AWS_S3_TIMEOUT_MS as c6, OPENWEATHER_TIMEOUT_MS as c7, GENERIC_FETCH_TIMEOUT_MS as c8, isObjectType as d, assertName as e, devAssert as f, isObjectLike as g, defineArguments as h, isNonNullType as i, argsToArgsConfig as j, GraphQLBoolean as k, lumic as l, GraphQLString as m, instanceOf as n, inspect as o, isInputObjectType as p, isLeafType as q, isEnumType as r, GraphQLID as s, toObjMap as t, invariant as u, GraphQLObjectType as v, GraphQLEnumType as w, GraphQLList as x, isScalarType as y, isUnionType as z };
81186
- //# sourceMappingURL=index-CwQjKm5M.js.map
81221
+ //# sourceMappingURL=index-CMRl9Q54.js.map