@adaptic/lumic-utils 1.0.29 → 1.0.31

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 (22) hide show
  1. package/dist/{apollo-client.client-C1dwHT2X.js → apollo-client.client-CNrz3Xod.js} +3 -3
  2. package/dist/{apollo-client.client-C1dwHT2X.js.map → apollo-client.client-CNrz3Xod.js.map} +1 -1
  3. package/dist/{apollo-client.client-BQLzKbg9.js → apollo-client.client-DsFSBlst.js} +4 -4
  4. package/dist/{apollo-client.client-BQLzKbg9.js.map → apollo-client.client-DsFSBlst.js.map} +1 -1
  5. package/dist/{apollo-client.server-DoI6FK_-.js → apollo-client.server-DMz8cEcx.js} +3 -3
  6. package/dist/{apollo-client.server-DoI6FK_-.js.map → apollo-client.server-DMz8cEcx.js.map} +1 -1
  7. package/dist/{apollo-client.server-Crk0lXFR.js → apollo-client.server-YkSyk6OJ.js} +3 -3
  8. package/dist/{apollo-client.server-Crk0lXFR.js.map → apollo-client.server-YkSyk6OJ.js.map} +1 -1
  9. package/dist/{index-CV8HlDp8.js → index-BZ9x9UfI.js} +37 -27
  10. package/dist/{index-CV8HlDp8.js.map → index-BZ9x9UfI.js.map} +1 -1
  11. package/dist/{index-DA066GXe.js → index-CGlW9JSL.js} +2 -2
  12. package/dist/{index-DA066GXe.js.map → index-CGlW9JSL.js.map} +1 -1
  13. package/dist/{index-CtY-7qjs.js → index-DlAW691N.js} +37 -27
  14. package/dist/{index-CtY-7qjs.js.map → index-DlAW691N.js.map} +1 -1
  15. package/dist/{index-IAFN9E4Q.js → index-VsQMFi2M.js} +2 -2
  16. package/dist/{index-IAFN9E4Q.js.map → index-VsQMFi2M.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/types/openai-types.d.ts +7 -5
  22. package/package.json +3 -3
@@ -2688,10 +2688,11 @@ function requiresResponsesApiForTools(model) {
2688
2688
  }
2689
2689
  /**
2690
2690
  * OpenAI's `reasoning_effort` ladder, ordered from least to most effort. This is
2691
- * the full 2026 ladder (developers.openai.com); NOTE there is no `'max'` level.
2691
+ * the full 2026 ladder (developers.openai.com), including `'max'` — the OpenAI
2692
+ * SDK v6 `Shared.ReasoningEffort` type accepts this entire set on the wire.
2692
2693
  * Mirrors the widened {@link LLMOptions.reasoning_effort} union.
2693
2694
  */
2694
- const REASONING_EFFORT_LADDER = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh'];
2695
+ const REASONING_EFFORT_LADDER = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
2695
2696
  /**
2696
2697
  * Per-model `reasoning_effort` support window for OpenAI reasoning models,
2697
2698
  * expressed on {@link REASONING_EFFORT_LADDER}. `min`/`max` are the lowest and
@@ -2718,27 +2719,19 @@ const MODEL_REASONING_EFFORT_SUPPORT = {
2718
2719
  // o1-mini is intentionally omitted — it rejects reasoning_effort outright.
2719
2720
  };
2720
2721
  /**
2721
- * Folds a full-ladder effort level onto the nearest value the installed OpenAI
2722
- * SDK can send ({@link SdkReasoningEffort}). Levels below `low` map to `low`,
2723
- * levels above `high` map to `high`. Exhaustive over the ladder so the compiler
2724
- * flags any future ladder addition. Widen this mapping when the SDK's
2725
- * `ReasoningEffort` type gains `none`/`minimal`/`xhigh`.
2722
+ * Identity pass-through from a full-ladder effort level to an SDK-sendable value.
2723
+ * Under OpenAI SDK v6 the wire type ({@link SdkReasoningEffort}) spans the entire
2724
+ * ladder, so every level is sendable as-is; the per-model
2725
+ * {@link MODEL_REASONING_EFFORT_SUPPORT} window (applied in
2726
+ * {@link clampReasoningEffort}) is what keeps a request within a model's range.
2727
+ * Retained as a named seam so a future SDK narrowing has one obvious place to
2728
+ * re-introduce folding.
2726
2729
  *
2727
2730
  * @param level A level on {@link REASONING_EFFORT_LADDER}.
2728
- * @returns The nearest SDK-sendable effort.
2731
+ * @returns The same level, typed as SDK-sendable.
2729
2732
  */
2730
2733
  function toSdkReasoningEffort(level) {
2731
- switch (level) {
2732
- case 'none':
2733
- case 'minimal':
2734
- case 'low':
2735
- return 'low';
2736
- case 'medium':
2737
- return 'medium';
2738
- case 'high':
2739
- case 'xhigh':
2740
- return 'high';
2741
- }
2734
+ return level;
2742
2735
  }
2743
2736
  /**
2744
2737
  * Clamps a requested {@link LLMOptions.reasoning_effort} to a value the target
@@ -2985,7 +2978,10 @@ async function createCompletion(content, responseFormat, options = DEFAULT_OPTIO
2985
2978
  const response = {
2986
2979
  id: completion.id,
2987
2980
  content: completion.choices[0]?.message?.content || '',
2988
- tool_calls: completion.choices[0]?.message?.tool_calls,
2981
+ // OpenAI SDK v6 widened tool calls into a function/custom union; the engine
2982
+ // only emits + parses function calls, so narrow to the function variant to
2983
+ // preserve the byte-identical `{ id, type, function }` shape.
2984
+ tool_calls: completion.choices[0]?.message?.tool_calls?.filter((tc) => tc.type === 'function'),
2989
2985
  usage: {
2990
2986
  prompt_tokens: completion.usage?.prompt_tokens ?? 0,
2991
2987
  completion_tokens: completion.usage?.completion_tokens ?? 0,
@@ -8920,7 +8916,12 @@ const isRetryableAnthropicError = (error) => {
8920
8916
  * Anthropic: { name, description, input_schema }
8921
8917
  */
8922
8918
  function translateToolsToAnthropic(tools) {
8923
- return tools.map((tool) => ({
8919
+ // OpenAI SDK v6 widened `ChatCompletionTool` into a function/custom union.
8920
+ // lumic-utils only supports function tools, so narrow to the function variant
8921
+ // before reading `.function`. Custom tools (which lumic never emits) are skipped.
8922
+ return tools
8923
+ .filter((tool) => tool.type === 'function')
8924
+ .map((tool) => ({
8924
8925
  name: tool.function.name,
8925
8926
  description: tool.function.description || '',
8926
8927
  input_schema: (tool.function.parameters || { type: 'object', properties: {} }),
@@ -9314,8 +9315,11 @@ async function makeOpenAICompatibleCall(content, responseFormat = 'text', option
9314
9315
  const completionTokens = completion.usage?.completion_tokens || 0;
9315
9316
  // Track cost
9316
9317
  getLLMCostTracker().trackUsage(providerConfig.name, model, promptTokens, completionTokens);
9317
- // Handle tool calls
9318
- const toolCalls = completion.choices[0]?.message?.tool_calls;
9318
+ // Handle tool calls. OpenAI SDK v6 widened tool calls into a function/custom
9319
+ // union; these OpenAI-compatible providers only return function calls, so
9320
+ // narrow to the function variant to preserve the byte-identical
9321
+ // `function.{name,arguments}` shape the engine parses.
9322
+ const toolCalls = completion.choices[0]?.message?.tool_calls?.filter((tc) => tc.type === 'function');
9319
9323
  if (toolCalls && toolCalls.length > 0) {
9320
9324
  const toolCallResponse = {
9321
9325
  tool_calls: toolCalls.map((tc) => ({
@@ -9864,7 +9868,13 @@ const makeDeepseekCall = async (content, responseFormat = 'json', options = {})
9864
9868
  // Handle tool calls similarly to OpenAI
9865
9869
  if (completion.tool_calls && completion.tool_calls.length > 0) {
9866
9870
  const toolCallResponse = {
9867
- tool_calls: completion.tool_calls.map((tc) => ({
9871
+ // OpenAI SDK v6 widened tool calls into a function/custom union. DeepSeek
9872
+ // (called via the OpenAI-compatible surface) only returns function calls,
9873
+ // so narrow to the function variant to preserve the byte-identical
9874
+ // `function.{name,arguments}` shape.
9875
+ tool_calls: completion.tool_calls
9876
+ .filter((tc) => tc.type === 'function')
9877
+ .map((tc) => ({
9868
9878
  id: tc.id,
9869
9879
  name: tc.function.name,
9870
9880
  arguments: JSON.parse(tc.function.arguments),
@@ -23818,11 +23828,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
23818
23828
  async function loadApolloModules() {
23819
23829
  if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
23820
23830
  // Server-side (or Lambda): load the CommonJS‑based implementation.
23821
- return (await Promise.resolve().then(function () { return require('./apollo-client.server-DoI6FK_-.js'); }));
23831
+ return (await Promise.resolve().then(function () { return require('./apollo-client.server-DMz8cEcx.js'); }));
23822
23832
  }
23823
23833
  else {
23824
23834
  // Client-side: load the ESM‑based implementation.
23825
- return (await Promise.resolve().then(function () { return require('./apollo-client.client-C1dwHT2X.js'); }));
23835
+ return (await Promise.resolve().then(function () { return require('./apollo-client.client-CNrz3Xod.js'); }));
23826
23836
  }
23827
23837
  }
23828
23838
  /**
@@ -82617,4 +82627,4 @@ exports.withCorrelationId = withCorrelationId;
82617
82627
  exports.withMetrics = withMetrics;
82618
82628
  exports.withRateLimit = withRateLimit;
82619
82629
  exports.withRetry = withRetry;
82620
- //# sourceMappingURL=index-CtY-7qjs.js.map
82630
+ //# sourceMappingURL=index-DlAW691N.js.map