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