@jaypie/llm 1.2.22 → 1.2.24

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.
@@ -1,2 +1 @@
1
1
  export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger").default;
2
- export declare const log: import("@jaypie/logger/dist/esm/JaypieLogger").default;
@@ -98,7 +98,7 @@ export declare const DEFAULT: {
98
98
  };
99
99
  export declare const ALL: {
100
100
  readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-4.20-0309-reasoning"];
101
- readonly COMBINED: readonly ["claude-sonnet-4-6", "claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", "gemini-3.1-pro-preview", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-3.1-flash-lite-preview", "gpt-5.4", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "grok-4.20-0309-reasoning", "grok-4.20-0309-reasoning", "grok-4.20-0309-non-reasoning", "grok-4-1-fast-non-reasoning"];
101
+ readonly COMBINED: readonly ("claude-sonnet-4-6" | "claude-opus-4-6" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gemini-3-flash-preview" | "gemini-3.1-flash-lite-preview" | "gpt-5.4" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-4.20-0309-reasoning" | "grok-4.20-0309-non-reasoning" | "grok-4-1-fast-non-reasoning")[];
102
102
  readonly LARGE: readonly ["claude-opus-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-4.20-0309-reasoning"];
103
103
  readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3-flash-preview", "gpt-5.4-mini", "grok-4.20-0309-non-reasoning"];
104
104
  readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite-preview", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConfigurationError, BadGatewayError, TooManyRequestsError, NotImplementedError } from '@jaypie/errors';
2
- import log$3, { log as log$2 } from '@jaypie/logger';
2
+ import log$2, { log as log$1 } from '@jaypie/logger';
3
3
  import { z } from 'zod/v4';
4
4
  import { placeholders, JAYPIE, resolveValue, sleep } from '@jaypie/kit';
5
5
  import RandomLib from 'random';
@@ -149,22 +149,24 @@ const ALL = {
149
149
  PROVIDER.XAI.MODEL.DEFAULT,
150
150
  ],
151
151
  COMBINED: [
152
- PROVIDER.ANTHROPIC.MODEL.DEFAULT,
153
- PROVIDER.ANTHROPIC.MODEL.LARGE,
154
- PROVIDER.ANTHROPIC.MODEL.SMALL,
155
- PROVIDER.ANTHROPIC.MODEL.TINY,
156
- PROVIDER.GEMINI.MODEL.DEFAULT,
157
- PROVIDER.GEMINI.MODEL.LARGE,
158
- PROVIDER.GEMINI.MODEL.SMALL,
159
- PROVIDER.GEMINI.MODEL.TINY,
160
- PROVIDER.OPENAI.MODEL.DEFAULT,
161
- PROVIDER.OPENAI.MODEL.LARGE,
162
- PROVIDER.OPENAI.MODEL.SMALL,
163
- PROVIDER.OPENAI.MODEL.TINY,
164
- PROVIDER.XAI.MODEL.DEFAULT,
165
- PROVIDER.XAI.MODEL.LARGE,
166
- PROVIDER.XAI.MODEL.SMALL,
167
- PROVIDER.XAI.MODEL.TINY,
152
+ ...new Set([
153
+ PROVIDER.ANTHROPIC.MODEL.DEFAULT,
154
+ PROVIDER.ANTHROPIC.MODEL.LARGE,
155
+ PROVIDER.ANTHROPIC.MODEL.SMALL,
156
+ PROVIDER.ANTHROPIC.MODEL.TINY,
157
+ PROVIDER.GEMINI.MODEL.DEFAULT,
158
+ PROVIDER.GEMINI.MODEL.LARGE,
159
+ PROVIDER.GEMINI.MODEL.SMALL,
160
+ PROVIDER.GEMINI.MODEL.TINY,
161
+ PROVIDER.OPENAI.MODEL.DEFAULT,
162
+ PROVIDER.OPENAI.MODEL.LARGE,
163
+ PROVIDER.OPENAI.MODEL.SMALL,
164
+ PROVIDER.OPENAI.MODEL.TINY,
165
+ PROVIDER.XAI.MODEL.DEFAULT,
166
+ PROVIDER.XAI.MODEL.LARGE,
167
+ PROVIDER.XAI.MODEL.SMALL,
168
+ PROVIDER.XAI.MODEL.TINY,
169
+ ]),
168
170
  ],
169
171
  LARGE: [
170
172
  PROVIDER.ANTHROPIC.MODEL.LARGE,
@@ -550,8 +552,7 @@ function formatOperateInput(input, options) {
550
552
  return [input];
551
553
  }
552
554
 
553
- const getLogger$5 = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
554
- const log$1 = getLogger$5();
555
+ const getLogger$5 = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
555
556
 
556
557
  // Turn policy constants
557
558
  const MAX_TURNS_ABSOLUTE_LIMIT = 72;
@@ -2658,16 +2659,16 @@ function convertContentToOpenRouter(content) {
2658
2659
  }
2659
2660
  // Image content - warn and discard
2660
2661
  if (item.type === LlmMessageType.InputImage) {
2661
- log$2.warn("OpenRouter does not support image uploads; image discarded");
2662
+ log$1.warn("OpenRouter does not support image uploads; image discarded");
2662
2663
  continue;
2663
2664
  }
2664
2665
  // File/Document content - warn and discard
2665
2666
  if (item.type === LlmMessageType.InputFile) {
2666
- log$2.warn({ filename: item.filename }, "OpenRouter does not support file uploads; file discarded");
2667
+ log$1.warn({ filename: item.filename }, "OpenRouter does not support file uploads; file discarded");
2667
2668
  continue;
2668
2669
  }
2669
2670
  // Unknown type - warn and skip
2670
- log$2.warn({ item }, "Unknown content type for OpenRouter; discarded");
2671
+ log$1.warn({ item }, "Unknown content type for OpenRouter; discarded");
2671
2672
  }
2672
2673
  // If no text parts remain, return empty string to avoid empty array
2673
2674
  if (parts.length === 0) {
@@ -3245,7 +3246,7 @@ class XaiAdapter extends OpenAiAdapter {
3245
3246
  const xaiAdapter = new XaiAdapter();
3246
3247
 
3247
3248
  const DEFAULT_TOOL_TYPE = "function";
3248
- const log = log$2.lib({ lib: JAYPIE.LIB.LLM });
3249
+ const log = log$1.lib({ lib: JAYPIE.LIB.LLM });
3249
3250
  function logToolMessage(message, context) {
3250
3251
  log.trace.var({ [context.name]: message });
3251
3252
  }
@@ -4051,6 +4052,7 @@ class RetryExecutor {
4051
4052
  * @throws BadGatewayError if all retries are exhausted or error is not retryable
4052
4053
  */
4053
4054
  async execute(operation, options) {
4055
+ const log = getLogger$5();
4054
4056
  let attempt = 0;
4055
4057
  // Persistent guard against stale socket errors (TypeError: terminated).
4056
4058
  // Installed after the first abort and kept alive through subsequent attempts
@@ -4062,7 +4064,7 @@ class RetryExecutor {
4062
4064
  return;
4063
4065
  staleGuard = (reason) => {
4064
4066
  if (isTransientNetworkError(reason)) {
4065
- log$1.trace("Suppressed stale socket error during retry");
4067
+ log.trace("Suppressed stale socket error during retry");
4066
4068
  }
4067
4069
  };
4068
4070
  process.on("unhandledRejection", staleGuard);
@@ -4079,7 +4081,7 @@ class RetryExecutor {
4079
4081
  try {
4080
4082
  const result = await operation(controller.signal);
4081
4083
  if (attempt > 0) {
4082
- log$1.debug(`API call succeeded after ${attempt} retries`);
4084
+ log.debug(`API call succeeded after ${attempt} retries`);
4083
4085
  }
4084
4086
  return result;
4085
4087
  }
@@ -4092,8 +4094,8 @@ class RetryExecutor {
4092
4094
  installGuard();
4093
4095
  // Check if we've exhausted retries
4094
4096
  if (!this.policy.shouldRetry(attempt)) {
4095
- log$1.error(`API call failed after ${this.policy.maxRetries} retries`);
4096
- log$1.var({ error });
4097
+ log.error(`API call failed after ${this.policy.maxRetries} retries`);
4098
+ log.var({ error });
4097
4099
  await this.hookRunner.runOnUnrecoverableError(options.hooks, {
4098
4100
  input: options.context.input,
4099
4101
  options: options.context.options,
@@ -4105,8 +4107,8 @@ class RetryExecutor {
4105
4107
  }
4106
4108
  // Check if error is not retryable
4107
4109
  if (!this.errorClassifier.isRetryable(error)) {
4108
- log$1.error("API call failed with non-retryable error");
4109
- log$1.var({ error });
4110
+ log.error("API call failed with non-retryable error");
4111
+ log.var({ error });
4110
4112
  await this.hookRunner.runOnUnrecoverableError(options.hooks, {
4111
4113
  input: options.context.input,
4112
4114
  options: options.context.options,
@@ -4118,11 +4120,11 @@ class RetryExecutor {
4118
4120
  }
4119
4121
  // Warn if this is an unknown error type
4120
4122
  if (!this.errorClassifier.isKnownError(error)) {
4121
- log$1.warn("API returned unknown error type, will retry");
4122
- log$1.var({ error });
4123
+ log.warn("API returned unknown error type, will retry");
4124
+ log.var({ error });
4123
4125
  }
4124
4126
  const delay = this.policy.getDelayForAttempt(attempt);
4125
- log$1.warn(`API call failed. Retrying in ${delay}ms...`);
4127
+ log.warn(`API call failed. Retrying in ${delay}ms...`);
4126
4128
  await this.hookRunner.runOnRetryableError(options.hooks, {
4127
4129
  input: options.context.input,
4128
4130
  options: options.context.options,
@@ -4188,10 +4190,11 @@ class OperateLoop {
4188
4190
  * Execute the operate loop for multi-turn conversations with tool calling.
4189
4191
  */
4190
4192
  async execute(input, options = {}) {
4193
+ const log = getLogger$5();
4191
4194
  // Log what was passed to operate
4192
- log$1.trace("[operate] Starting operate loop");
4193
- log$1.var({ "operate.input": input });
4194
- log$1.var({ "operate.options": options });
4195
+ log.trace("[operate] Starting operate loop");
4196
+ log.var({ "operate.input": input });
4197
+ log.var({ "operate.options": options });
4195
4198
  // Initialize state
4196
4199
  const state = await this.initializeState(input, options);
4197
4200
  const context = this.createContext(options);
@@ -4300,6 +4303,7 @@ class OperateLoop {
4300
4303
  };
4301
4304
  }
4302
4305
  async executeOneTurn(request, state, context, options) {
4306
+ const log = getLogger$5();
4303
4307
  // Create error classifier from adapter
4304
4308
  const errorClassifier = createErrorClassifier(this.adapter);
4305
4309
  // Create retry executor for this turn
@@ -4311,8 +4315,8 @@ class OperateLoop {
4311
4315
  // Build provider-specific request
4312
4316
  const providerRequest = this.adapter.buildRequest(request);
4313
4317
  // Log what was passed to the model
4314
- log$1.trace("[operate] Calling model");
4315
- log$1.var({ "operate.request": providerRequest });
4318
+ log.trace("[operate] Calling model");
4319
+ log.var({ "operate.request": providerRequest });
4316
4320
  // Execute beforeEachModelRequest hook
4317
4321
  await this.hookRunnerInstance.runBeforeModelRequest(context.hooks, {
4318
4322
  input: state.currentInput,
@@ -4329,8 +4333,8 @@ class OperateLoop {
4329
4333
  hooks: context.hooks,
4330
4334
  });
4331
4335
  // Log what was returned from the model
4332
- log$1.trace("[operate] Model response received");
4333
- log$1.var({ "operate.response": response });
4336
+ log.trace("[operate] Model response received");
4337
+ log.var({ "operate.response": response });
4334
4338
  // Parse response
4335
4339
  const parsed = this.adapter.parseResponse(response, options);
4336
4340
  // Track usage
@@ -4378,7 +4382,7 @@ class OperateLoop {
4378
4382
  toolName: toolCall.name,
4379
4383
  });
4380
4384
  // Call the tool
4381
- log$1.trace(`[operate] Calling tool - ${toolCall.name}`);
4385
+ log.trace(`[operate] Calling tool - ${toolCall.name}`);
4382
4386
  const result = await state.toolkit.call({
4383
4387
  arguments: toolCall.arguments,
4384
4388
  name: toolCall.name,
@@ -4436,13 +4440,13 @@ class OperateLoop {
4436
4440
  };
4437
4441
  const toolResultFormatted = this.adapter.formatToolResult(toolCall, errorResult);
4438
4442
  state.responseBuilder.appendToHistory(toolResultFormatted);
4439
- log$1.error(`Error executing function call ${toolCall.name}`);
4440
- log$1.var({ error });
4443
+ log.error(`Error executing function call ${toolCall.name}`);
4444
+ log.var({ error });
4441
4445
  // Track consecutive errors and stop if threshold reached
4442
4446
  state.consecutiveToolErrors++;
4443
4447
  if (state.consecutiveToolErrors >= MAX_CONSECUTIVE_TOOL_ERRORS) {
4444
4448
  const detail = `Stopped after ${MAX_CONSECUTIVE_TOOL_ERRORS} consecutive tool errors`;
4445
- log$1.warn(detail);
4449
+ log.warn(detail);
4446
4450
  state.responseBuilder.setError({
4447
4451
  detail,
4448
4452
  status: 502,
@@ -4457,7 +4461,7 @@ class OperateLoop {
4457
4461
  if (state.currentTurn >= state.maxTurns) {
4458
4462
  const error = new TooManyRequestsError();
4459
4463
  const detail = `Model requested function call but exceeded ${state.maxTurns} turns`;
4460
- log$1.warn(detail);
4464
+ log.warn(detail);
4461
4465
  state.responseBuilder.setError({
4462
4466
  detail,
4463
4467
  status: error.status,
@@ -4611,6 +4615,7 @@ class StreamLoop {
4611
4615
  * Yields stream chunks as they become available.
4612
4616
  */
4613
4617
  async *execute(input, options = {}) {
4618
+ const log = getLogger$5();
4614
4619
  // Verify adapter supports streaming
4615
4620
  if (!this.adapter.executeStreamRequest) {
4616
4621
  throw new BadGatewayError(`Provider ${this.adapter.name} does not support streaming`);
@@ -4635,7 +4640,7 @@ class StreamLoop {
4635
4640
  if (state.currentTurn >= state.maxTurns) {
4636
4641
  const error = new TooManyRequestsError();
4637
4642
  const detail = `Model requested function call but exceeded ${state.maxTurns} turns`;
4638
- log$1.warn(detail);
4643
+ log.warn(detail);
4639
4644
  yield {
4640
4645
  type: LlmStreamChunkType.Error,
4641
4646
  error: {
@@ -4728,6 +4733,7 @@ class StreamLoop {
4728
4733
  };
4729
4734
  }
4730
4735
  async *executeOneStreamingTurn(request, state, context, options) {
4736
+ const log = getLogger$5();
4731
4737
  // Build provider-specific request
4732
4738
  const providerRequest = this.adapter.buildRequest(request);
4733
4739
  // Execute beforeEachModelRequest hook
@@ -4749,7 +4755,7 @@ class StreamLoop {
4749
4755
  return;
4750
4756
  staleGuard = (reason) => {
4751
4757
  if (isTransientNetworkError(reason)) {
4752
- log$1.trace("Suppressed stale socket error during retry");
4758
+ log.trace("Suppressed stale socket error during retry");
4753
4759
  }
4754
4760
  };
4755
4761
  process.on("unhandledRejection", staleGuard);
@@ -4795,7 +4801,7 @@ class StreamLoop {
4795
4801
  }
4796
4802
  // Stream completed successfully
4797
4803
  if (attempt > 0) {
4798
- log$1.debug(`Stream request succeeded after ${attempt} retries`);
4804
+ log.debug(`Stream request succeeded after ${attempt} retries`);
4799
4805
  }
4800
4806
  break;
4801
4807
  }
@@ -4807,8 +4813,8 @@ class StreamLoop {
4807
4813
  // If chunks were already yielded, we can't transparently retry
4808
4814
  if (chunksYielded) {
4809
4815
  const errorMessage = error instanceof Error ? error.message : String(error);
4810
- log$1.error("Stream failed after partial data was delivered");
4811
- log$1.var({ error });
4816
+ log.error("Stream failed after partial data was delivered");
4817
+ log.var({ error });
4812
4818
  yield {
4813
4819
  type: LlmStreamChunkType.Error,
4814
4820
  error: {
@@ -4822,14 +4828,14 @@ class StreamLoop {
4822
4828
  // Check if we've exhausted retries or error is not retryable
4823
4829
  if (!this.retryPolicy.shouldRetry(attempt) ||
4824
4830
  !this.adapter.isRetryableError(error)) {
4825
- log$1.error(`Stream request failed after ${this.retryPolicy.maxRetries} retries`);
4826
- log$1.var({ error });
4831
+ log.error(`Stream request failed after ${this.retryPolicy.maxRetries} retries`);
4832
+ log.var({ error });
4827
4833
  const errorMessage = error instanceof Error ? error.message : String(error);
4828
4834
  throw new BadGatewayError(errorMessage);
4829
4835
  }
4830
4836
  const delay = this.retryPolicy.getDelayForAttempt(attempt);
4831
- log$1.warn(`Stream request failed. Retrying in ${delay}ms...`);
4832
- log$1.var({ error });
4837
+ log.warn(`Stream request failed. Retrying in ${delay}ms...`);
4838
+ log.var({ error });
4833
4839
  await sleep(delay);
4834
4840
  attempt++;
4835
4841
  }
@@ -4873,6 +4879,7 @@ class StreamLoop {
4873
4879
  return { shouldContinue: false };
4874
4880
  }
4875
4881
  async *processToolCalls(toolCalls, state, context, _options) {
4882
+ const log = getLogger$5();
4876
4883
  for (const toolCall of toolCalls) {
4877
4884
  try {
4878
4885
  // Execute beforeEachTool hook
@@ -4881,7 +4888,7 @@ class StreamLoop {
4881
4888
  toolName: toolCall.name,
4882
4889
  });
4883
4890
  // Call the tool
4884
- log$1.trace(`[stream] Calling tool - ${toolCall.name}`);
4891
+ log.trace(`[stream] Calling tool - ${toolCall.name}`);
4885
4892
  const result = await state.toolkit.call({
4886
4893
  arguments: toolCall.arguments,
4887
4894
  name: toolCall.name,
@@ -4944,13 +4951,13 @@ class StreamLoop {
4944
4951
  call_id: toolCall.callId,
4945
4952
  name: toolCall.name,
4946
4953
  });
4947
- log$1.error(`Error executing function call ${toolCall.name}`);
4948
- log$1.var({ error });
4954
+ log.error(`Error executing function call ${toolCall.name}`);
4955
+ log.var({ error });
4949
4956
  // Track consecutive errors and stop if threshold reached
4950
4957
  state.consecutiveToolErrors++;
4951
4958
  if (state.consecutiveToolErrors >= MAX_CONSECUTIVE_TOOL_ERRORS) {
4952
4959
  const stopDetail = `Stopped after ${MAX_CONSECUTIVE_TOOL_ERRORS} consecutive tool errors`;
4953
- log$1.warn(stopDetail);
4960
+ log.warn(stopDetail);
4954
4961
  yield {
4955
4962
  type: LlmStreamChunkType.Error,
4956
4963
  error: {
@@ -5031,7 +5038,7 @@ async function loadSdk$2() {
5031
5038
  }
5032
5039
  }
5033
5040
  // Logger
5034
- const getLogger$4 = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
5041
+ const getLogger$4 = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
5035
5042
  // Client initialization
5036
5043
  async function initializeClient$4({ apiKey, } = {}) {
5037
5044
  const logger = getLogger$4();
@@ -5070,7 +5077,7 @@ function prepareMessages$3(message, { data, placeholders } = {}) {
5070
5077
  }
5071
5078
  // Basic text completion
5072
5079
  async function createTextCompletion$1(client, messages, model, systemMessage) {
5073
- log$2.trace("Using text output (unstructured)");
5080
+ log$1.trace("Using text output (unstructured)");
5074
5081
  const params = {
5075
5082
  model,
5076
5083
  messages,
@@ -5079,17 +5086,17 @@ async function createTextCompletion$1(client, messages, model, systemMessage) {
5079
5086
  // Add system instruction if provided
5080
5087
  if (systemMessage) {
5081
5088
  params.system = systemMessage;
5082
- log$2.trace(`System message: ${systemMessage.length} characters`);
5089
+ log$1.trace(`System message: ${systemMessage.length} characters`);
5083
5090
  }
5084
5091
  const response = await client.messages.create(params);
5085
5092
  const firstContent = response.content[0];
5086
5093
  const text = firstContent && "text" in firstContent ? firstContent.text : "";
5087
- log$2.trace(`Assistant reply: ${text.length} characters`);
5094
+ log$1.trace(`Assistant reply: ${text.length} characters`);
5088
5095
  return text;
5089
5096
  }
5090
5097
  // Structured output completion
5091
5098
  async function createStructuredCompletion$1(client, messages, model, responseSchema, systemMessage) {
5092
- log$2.trace("Using structured output");
5099
+ log$1.trace("Using structured output");
5093
5100
  // Get the JSON schema for the response
5094
5101
  const schema = responseSchema instanceof z.ZodType
5095
5102
  ? responseSchema
@@ -5122,7 +5129,7 @@ async function createStructuredCompletion$1(client, messages, model, responseSch
5122
5129
  if (!schema.parse(result)) {
5123
5130
  throw new Error(`JSON response from Anthropic does not match schema: ${responseText}`);
5124
5131
  }
5125
- log$2.trace("Received structured response", { result });
5132
+ log$1.trace("Received structured response", { result });
5126
5133
  return result;
5127
5134
  }
5128
5135
  catch {
@@ -5133,7 +5140,7 @@ async function createStructuredCompletion$1(client, messages, model, responseSch
5133
5140
  throw new Error("Failed to parse structured response from Anthropic");
5134
5141
  }
5135
5142
  catch (error) {
5136
- log$2.error("Error creating structured completion", { error });
5143
+ log$1.error("Error creating structured completion", { error });
5137
5144
  throw error;
5138
5145
  }
5139
5146
  }
@@ -5247,7 +5254,7 @@ async function loadSdk$1() {
5247
5254
  }
5248
5255
  }
5249
5256
  // Logger
5250
- const getLogger$3 = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
5257
+ const getLogger$3 = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
5251
5258
  // Client initialization
5252
5259
  async function initializeClient$3({ apiKey, } = {}) {
5253
5260
  const logger = getLogger$3();
@@ -5398,7 +5405,7 @@ class GeminiProvider {
5398
5405
  }
5399
5406
 
5400
5407
  // Logger
5401
- const getLogger$2 = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
5408
+ const getLogger$2 = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
5402
5409
  // Client initialization
5403
5410
  async function initializeClient$2({ apiKey, } = {}) {
5404
5411
  const logger = getLogger$2();
@@ -5582,7 +5589,7 @@ async function loadSdk() {
5582
5589
  }
5583
5590
  }
5584
5591
  // Logger
5585
- const getLogger$1 = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
5592
+ const getLogger$1 = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
5586
5593
  // Client initialization
5587
5594
  async function initializeClient$1({ apiKey, } = {}) {
5588
5595
  const logger = getLogger$1();
@@ -5731,7 +5738,7 @@ class OpenRouterProvider {
5731
5738
  }
5732
5739
 
5733
5740
  // Logger
5734
- const getLogger = () => log$2.lib({ lib: JAYPIE.LIB.LLM });
5741
+ const getLogger = () => log$1.lib({ lib: JAYPIE.LIB.LLM });
5735
5742
  // Client initialization
5736
5743
  async function initializeClient({ apiKey, } = {}) {
5737
5744
  const logger = getLogger();
@@ -5838,7 +5845,7 @@ class Llm {
5838
5845
  let finalModel = model;
5839
5846
  // Legacy: accept "gemini" but warn
5840
5847
  if (providerName === "gemini") {
5841
- log$3.warn(`Provider "gemini" is deprecated, use "${PROVIDER.GEMINI.NAME}" instead`);
5848
+ log$2.warn(`Provider "gemini" is deprecated, use "${PROVIDER.GEMINI.NAME}" instead`);
5842
5849
  }
5843
5850
  if (model) {
5844
5851
  const modelDetermined = determineModelProvider(model);
@@ -5950,7 +5957,7 @@ class Llm {
5950
5957
  }
5951
5958
  catch (error) {
5952
5959
  lastError = error;
5953
- log$3.warn(`Provider ${this._provider} failed`, {
5960
+ log$2.warn(`Provider ${this._provider} failed`, {
5954
5961
  error: lastError.message,
5955
5962
  fallbacksRemaining: fallbackChain.length,
5956
5963
  });
@@ -5970,7 +5977,7 @@ class Llm {
5970
5977
  }
5971
5978
  catch (error) {
5972
5979
  lastError = error;
5973
- log$3.warn(`Fallback provider ${fallbackConfig.provider} failed`, {
5980
+ log$2.warn(`Fallback provider ${fallbackConfig.provider} failed`, {
5974
5981
  error: lastError.message,
5975
5982
  fallbacksRemaining: fallbackChain.length - attempts + 1,
5976
5983
  });
@@ -6139,16 +6146,17 @@ const roll = {
6139
6146
  },
6140
6147
  type: "function",
6141
6148
  call: ({ number = 1, sides = 6 } = {}) => {
6149
+ const log = getLogger$5();
6142
6150
  const rng = random$1();
6143
6151
  const rolls = [];
6144
6152
  let total = 0;
6145
6153
  const parsedNumber = tryParseNumber(number, {
6146
6154
  defaultValue: 1,
6147
- warnFunction: log$1.warn,
6155
+ warnFunction: log.warn,
6148
6156
  });
6149
6157
  const parsedSides = tryParseNumber(sides, {
6150
6158
  defaultValue: 6,
6151
- warnFunction: log$1.warn,
6159
+ warnFunction: log.warn,
6152
6160
  });
6153
6161
  for (let i = 0; i < parsedNumber; i++) {
6154
6162
  const rollValue = rng({ min: 1, max: parsedSides, integer: true });