@elizaos/core 1.0.0-beta.56 → 1.0.0-beta.58

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.
package/dist/index.js CHANGED
@@ -30083,9 +30083,6 @@ function stringToUuid(target) {
30083
30083
  }
30084
30084
  return `${_uint8ArrayToHex(hashBuffer.slice(0, 4))}-${_uint8ArrayToHex(hashBuffer.slice(4, 6))}-${_uint8ToHex(hashBuffer[6] & 15)}${_uint8ToHex(hashBuffer[7])}-${_uint8ToHex(hashBuffer[8] & 63 | 128)}${_uint8ToHex(hashBuffer[9])}-${_uint8ArrayToHex(hashBuffer.slice(10, 16))}`;
30085
30085
  }
30086
- function getProviderBaseURL(runtime, provider, defaultBaseURL) {
30087
- return defaultBaseURL;
30088
- }
30089
30086
 
30090
30087
  // src/entities.ts
30091
30088
  var entityResolutionTemplate = `# Task: Resolve Entity Name
@@ -31933,7 +31930,7 @@ var AgentRuntime = class {
31933
31930
  // Add map for send handlers
31934
31931
  // Event emitter methods
31935
31932
  eventHandlers = /* @__PURE__ */ new Map();
31936
- runtimeLogger;
31933
+ logger;
31937
31934
  knowledgeProcessingSemaphore = new Semaphore(10);
31938
31935
  settings;
31939
31936
  servicesInitQueue = /* @__PURE__ */ new Set();
@@ -31944,13 +31941,13 @@ var AgentRuntime = class {
31944
31941
  this.agentId = opts.character?.id ?? opts?.agentId ?? stringToUuid(opts.character?.name ?? uuidv4() + opts.character?.username);
31945
31942
  this.character = opts.character;
31946
31943
  const logLevel = process.env.LOG_LEVEL || "info";
31947
- this.runtimeLogger = logger_default.child({
31944
+ this.logger = logger_default.child({
31948
31945
  agentName: this.character?.name,
31949
31946
  agentId: this.agentId,
31950
31947
  level: logLevel === "debug" ? "debug" : "error"
31951
31948
  // Show only errors unless debug mode is enabled
31952
31949
  });
31953
- this.runtimeLogger.debug(`[AgentRuntime] Process working directory: ${process.cwd()}`);
31950
+ this.logger.debug(`[AgentRuntime] Process working directory: ${process.cwd()}`);
31954
31951
  this.#conversationLength = opts.conversationLength ?? this.#conversationLength;
31955
31952
  if (opts.adapter) {
31956
31953
  this.registerDatabaseAdapter(opts.adapter);
@@ -31966,9 +31963,9 @@ var AgentRuntime = class {
31966
31963
  enabled: true
31967
31964
  });
31968
31965
  this.tracer = this.instrumentationService.getTracer("agent-runtime");
31969
- this.runtimeLogger.debug(`Instrumentation service initialized for agent ${this.agentId}`);
31966
+ this.logger.debug(`Instrumentation service initialized for agent ${this.agentId}`);
31970
31967
  } catch (error2) {
31971
- this.runtimeLogger.warn(`Failed to initialize instrumentation: ${error2.message}`);
31968
+ this.logger.warn(`Failed to initialize instrumentation: ${error2.message}`);
31972
31969
  this.instrumentationService = {
31973
31970
  getTracer: () => null,
31974
31971
  start: async () => {
@@ -31987,7 +31984,7 @@ var AgentRuntime = class {
31987
31984
  this.tracer = null;
31988
31985
  }
31989
31986
  }
31990
- this.runtimeLogger.debug(`Success: Agent ID: ${this.agentId}`);
31987
+ this.logger.debug(`Success: Agent ID: ${this.agentId}`);
31991
31988
  }
31992
31989
  /**
31993
31990
  * Starts a span for the given operation and executes the provided function with the span.
@@ -32094,20 +32091,20 @@ var AgentRuntime = class {
32094
32091
  });
32095
32092
  if (!plugin) {
32096
32093
  span.setStatus({ code: SpanStatusCode.ERROR, message: "Plugin is undefined" });
32097
- this.runtimeLogger.error("*** registerPlugin plugin is undefined");
32094
+ this.logger.error("*** registerPlugin plugin is undefined");
32098
32095
  throw new Error("*** registerPlugin plugin is undefined");
32099
32096
  }
32100
32097
  if (!this.plugins.some((p2) => p2.name === plugin.name)) {
32101
32098
  this.plugins.push(plugin);
32102
32099
  span.addEvent("plugin_added_to_array");
32103
- this.runtimeLogger.debug(`Success: Plugin ${plugin.name} registered successfully`);
32100
+ this.logger.debug(`Success: Plugin ${plugin.name} registered successfully`);
32104
32101
  }
32105
32102
  if (plugin.init) {
32106
32103
  try {
32107
32104
  span.addEvent("initializing_plugin");
32108
32105
  await plugin.init(plugin.config || {}, this);
32109
32106
  span.addEvent("plugin_initialized");
32110
- this.runtimeLogger.debug(`Success: Plugin ${plugin.name} initialized successfully`);
32107
+ this.logger.debug(`Success: Plugin ${plugin.name} initialized successfully`);
32111
32108
  } catch (error2) {
32112
32109
  const errorMessage = error2 instanceof Error ? error2.message : String(error2);
32113
32110
  span.setAttributes({
@@ -32129,7 +32126,7 @@ var AgentRuntime = class {
32129
32126
  }
32130
32127
  if (plugin.adapter) {
32131
32128
  span.addEvent("registering_adapter");
32132
- this.runtimeLogger.debug(`Registering database adapter for plugin ${plugin.name}`);
32129
+ this.logger.debug(`Registering database adapter for plugin ${plugin.name}`);
32133
32130
  this.registerDatabaseAdapter(plugin.adapter);
32134
32131
  }
32135
32132
  if (plugin.actions) {
@@ -32197,10 +32194,10 @@ var AgentRuntime = class {
32197
32194
  "agent.id": this.agentId,
32198
32195
  "agent.name": this.character?.name || "unknown"
32199
32196
  });
32200
- this.runtimeLogger.debug(`runtime::stop - character ${this.character.name}`);
32197
+ this.logger.debug(`runtime::stop - character ${this.character.name}`);
32201
32198
  span.addEvent("stopping_services");
32202
32199
  for (const [serviceName, service] of this.services) {
32203
- this.runtimeLogger.debug(`runtime::stop - requesting service stop for ${serviceName}`);
32200
+ this.logger.debug(`runtime::stop - requesting service stop for ${serviceName}`);
32204
32201
  span.addEvent(`stopping_service_${serviceName}`);
32205
32202
  await service.stop();
32206
32203
  }
@@ -32216,7 +32213,7 @@ var AgentRuntime = class {
32216
32213
  });
32217
32214
  if (this.isInitialized) {
32218
32215
  span.addEvent("agent_already_initialized");
32219
- this.runtimeLogger.warn("Agent already initialized");
32216
+ this.logger.warn("Agent already initialized");
32220
32217
  return;
32221
32218
  }
32222
32219
  span.addEvent("initialization_started");
@@ -32233,7 +32230,7 @@ var AgentRuntime = class {
32233
32230
  registered_plugins: Array.from(registeredPluginNames).join(",")
32234
32231
  });
32235
32232
  if (!this.adapter) {
32236
- this.runtimeLogger.error(
32233
+ this.logger.error(
32237
32234
  "Database adapter not initialized. Make sure @elizaos/plugin-sql is included in your plugins."
32238
32235
  );
32239
32236
  throw new Error(
@@ -32268,7 +32265,7 @@ var AgentRuntime = class {
32268
32265
  }
32269
32266
  agentEntity = await this.adapter.getEntityById(this.agentId);
32270
32267
  if (!agentEntity) throw new Error(`Agent entity not found for ${this.agentId}`);
32271
- this.runtimeLogger.debug(
32268
+ this.logger.debug(
32272
32269
  `Success: Agent entity created successfully for ${this.character.name}`
32273
32270
  );
32274
32271
  span.addEvent("agent_entity_created");
@@ -32279,7 +32276,7 @@ var AgentRuntime = class {
32279
32276
  const errorMsg = error2 instanceof Error ? error2.message : String(error2);
32280
32277
  span.recordException(error2);
32281
32278
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
32282
- this.runtimeLogger.error(`Failed to create agent entity: ${errorMsg}`);
32279
+ this.logger.error(`Failed to create agent entity: ${errorMsg}`);
32283
32280
  throw error2;
32284
32281
  }
32285
32282
  try {
@@ -32290,7 +32287,7 @@ var AgentRuntime = class {
32290
32287
  const errorMsg = error2 instanceof Error ? error2.message : String(error2);
32291
32288
  span.recordException(error2);
32292
32289
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
32293
- this.runtimeLogger.error(`Failed to initialize: ${errorMsg}`);
32290
+ this.logger.error(`Failed to initialize: ${errorMsg}`);
32294
32291
  throw error2;
32295
32292
  }
32296
32293
  try {
@@ -32315,9 +32312,7 @@ var AgentRuntime = class {
32315
32312
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
32316
32313
  throw new Error(errorMsg);
32317
32314
  }
32318
- this.runtimeLogger.debug(
32319
- `Agent ${this.character.name} linked to its own room successfully`
32320
- );
32315
+ this.logger.debug(`Agent ${this.character.name} linked to its own room successfully`);
32321
32316
  span.addEvent("agent_added_as_participant");
32322
32317
  } else {
32323
32318
  span.addEvent("agent_already_participant");
@@ -32326,13 +32321,13 @@ var AgentRuntime = class {
32326
32321
  const errorMsg = error2 instanceof Error ? error2.message : String(error2);
32327
32322
  span.recordException(error2);
32328
32323
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
32329
- this.runtimeLogger.error(`Failed to add agent as participant: ${errorMsg}`);
32324
+ this.logger.error(`Failed to add agent as participant: ${errorMsg}`);
32330
32325
  throw error2;
32331
32326
  }
32332
32327
  const embeddingModel = this.getModel(ModelType.TEXT_EMBEDDING);
32333
32328
  if (!embeddingModel) {
32334
32329
  span.addEvent("embedding_model_missing");
32335
- this.runtimeLogger.warn(
32330
+ this.logger.warn(
32336
32331
  `[AgentRuntime][${this.character.name}] No TEXT_EMBEDDING model registered. Skipping embedding dimension setup.`
32337
32332
  );
32338
32333
  } else {
@@ -32368,7 +32363,7 @@ var AgentRuntime = class {
32368
32363
  return this.adapter.getConnection();
32369
32364
  }
32370
32365
  async handleProcessingError(error2, context2) {
32371
- this.runtimeLogger.error(`Error ${context2}:`, error2?.message || error2 || "Unknown error");
32366
+ this.logger.error(`Error ${context2}:`, error2?.message || error2 || "Unknown error");
32372
32367
  throw error2;
32373
32368
  }
32374
32369
  async checkExistingKnowledge(knowledgeId) {
@@ -32384,7 +32379,7 @@ var AgentRuntime = class {
32384
32379
  code: SpanStatusCode.ERROR,
32385
32380
  message: "Invalid message for knowledge query"
32386
32381
  });
32387
- this.runtimeLogger.warn("Invalid message for knowledge query:", {
32382
+ this.logger.warn("Invalid message for knowledge query:", {
32388
32383
  message,
32389
32384
  content: message?.content,
32390
32385
  text: message?.content?.text
@@ -32397,7 +32392,7 @@ var AgentRuntime = class {
32397
32392
  code: SpanStatusCode.ERROR,
32398
32393
  message: "Empty text for knowledge query"
32399
32394
  });
32400
- this.runtimeLogger.warn("Empty text for knowledge query");
32395
+ this.logger.warn("Empty text for knowledge query");
32401
32396
  return [];
32402
32397
  }
32403
32398
  span.setAttributes({
@@ -32527,7 +32522,7 @@ var AgentRuntime = class {
32527
32522
  "error.fragment": i2,
32528
32523
  "error.message": errorMsg
32529
32524
  });
32530
- this.runtimeLogger.error(`Error processing fragment ${i2}: ${errorMsg}`);
32525
+ this.logger.error(`Error processing fragment ${i2}: ${errorMsg}`);
32531
32526
  }
32532
32527
  }
32533
32528
  span.setAttributes({
@@ -32545,7 +32540,7 @@ var AgentRuntime = class {
32545
32540
  if (await this.checkExistingKnowledge(knowledgeId)) {
32546
32541
  return;
32547
32542
  }
32548
- this.runtimeLogger.debug(
32543
+ this.logger.debug(
32549
32544
  "Processing knowledge for ",
32550
32545
  this.character.name,
32551
32546
  " - ",
@@ -32626,12 +32621,12 @@ var AgentRuntime = class {
32626
32621
  }
32627
32622
  registerDatabaseAdapter(adapter) {
32628
32623
  if (this.adapter) {
32629
- this.runtimeLogger.warn(
32624
+ this.logger.warn(
32630
32625
  "Database adapter already registered. Additional adapters will be ignored. This may lead to unexpected behavior."
32631
32626
  );
32632
32627
  } else {
32633
32628
  this.adapter = adapter;
32634
- this.runtimeLogger.debug("Success: Database adapter registered successfully.");
32629
+ this.logger.debug("Success: Database adapter registered successfully.");
32635
32630
  }
32636
32631
  }
32637
32632
  /**
@@ -32640,23 +32635,23 @@ var AgentRuntime = class {
32640
32635
  */
32641
32636
  registerProvider(provider) {
32642
32637
  this.providers.push(provider);
32643
- this.runtimeLogger.debug(`Success: Provider ${provider.name} registered successfully.`);
32638
+ this.logger.debug(`Success: Provider ${provider.name} registered successfully.`);
32644
32639
  }
32645
32640
  /**
32646
32641
  * Register an action for the agent to perform.
32647
32642
  * @param action The action to register.
32648
32643
  */
32649
32644
  registerAction(action) {
32650
- this.runtimeLogger.debug(
32645
+ this.logger.debug(
32651
32646
  `${this.character.name}(${this.agentId}) - Registering action: ${action.name}`
32652
32647
  );
32653
32648
  if (this.actions.find((a2) => a2.name === action.name)) {
32654
- this.runtimeLogger.warn(
32649
+ this.logger.warn(
32655
32650
  `${this.character.name}(${this.agentId}) - Action ${action.name} already exists. Skipping registration.`
32656
32651
  );
32657
32652
  } else {
32658
32653
  this.actions.push(action);
32659
- this.runtimeLogger.debug(
32654
+ this.logger.debug(
32660
32655
  `${this.character.name}(${this.agentId}) - Action ${action.name} registered successfully.`
32661
32656
  );
32662
32657
  }
@@ -32695,7 +32690,7 @@ var AgentRuntime = class {
32695
32690
  };
32696
32691
  if (!response.content?.actions || response.content.actions.length === 0) {
32697
32692
  span.addEvent("no_actions_in_response");
32698
- this.runtimeLogger.warn("No action found in the response content.");
32693
+ this.logger.warn("No action found in the response content.");
32699
32694
  continue;
32700
32695
  }
32701
32696
  const actions = response.content.actions;
@@ -32703,13 +32698,11 @@ var AgentRuntime = class {
32703
32698
  "actions.count": actions.length,
32704
32699
  "actions.names": JSON.stringify(actions)
32705
32700
  });
32706
- this.runtimeLogger.debug(
32707
- `Found actions: ${this.actions.map((a2) => normalizeAction(a2.name))}`
32708
- );
32701
+ this.logger.debug(`Found actions: ${this.actions.map((a2) => normalizeAction(a2.name))}`);
32709
32702
  for (const responseAction of actions) {
32710
32703
  span.addEvent(`processing_action_${responseAction}`);
32711
32704
  state = await this.composeState(message, ["RECENT_MESSAGES"]);
32712
- this.runtimeLogger.debug(`Success: Calling action: ${responseAction}`);
32705
+ this.logger.debug(`Success: Calling action: ${responseAction}`);
32713
32706
  const normalizedResponseAction = normalizeAction(responseAction);
32714
32707
  let action = this.actions.find(
32715
32708
  (a2) => normalizeAction(a2.name).includes(normalizedResponseAction) || // the || is kind of a fuzzy match
@@ -32718,10 +32711,10 @@ var AgentRuntime = class {
32718
32711
  );
32719
32712
  if (action) {
32720
32713
  span.addEvent(`found_exact_action_${action.name}`);
32721
- this.runtimeLogger.debug(`Success: Found action: ${action?.name}`);
32714
+ this.logger.debug(`Success: Found action: ${action?.name}`);
32722
32715
  } else {
32723
32716
  span.addEvent("looking_for_similar_action");
32724
- this.runtimeLogger.debug("Attempting to find action in similes.");
32717
+ this.logger.debug("Attempting to find action in similes.");
32725
32718
  for (const _action of this.actions) {
32726
32719
  const simileAction = _action.similes?.find(
32727
32720
  (simile) => simile.toLowerCase().replace("_", "").includes(normalizedResponseAction) || normalizedResponseAction.includes(simile.toLowerCase().replace("_", ""))
@@ -32729,7 +32722,7 @@ var AgentRuntime = class {
32729
32722
  if (simileAction) {
32730
32723
  action = _action;
32731
32724
  span.addEvent(`found_similar_action_${action.name}`);
32732
- this.runtimeLogger.debug(`Success: Action found in similes: ${action.name}`);
32725
+ this.logger.debug(`Success: Action found in similes: ${action.name}`);
32733
32726
  break;
32734
32727
  }
32735
32728
  }
@@ -32740,7 +32733,7 @@ var AgentRuntime = class {
32740
32733
  span.setAttributes({
32741
32734
  "error.action": responseAction
32742
32735
  });
32743
- this.runtimeLogger.error(errorMsg);
32736
+ this.logger.error(errorMsg);
32744
32737
  const actionMemory = {
32745
32738
  id: uuidv4(),
32746
32739
  entityId: message.entityId,
@@ -32759,12 +32752,12 @@ var AgentRuntime = class {
32759
32752
  span.setAttributes({
32760
32753
  "error.action": action.name
32761
32754
  });
32762
- this.runtimeLogger.error(`Action ${action.name} has no handler.`);
32755
+ this.logger.error(`Action ${action.name} has no handler.`);
32763
32756
  continue;
32764
32757
  }
32765
32758
  try {
32766
32759
  span.addEvent(`executing_action_${action.name}`);
32767
- this.runtimeLogger.debug(`Executing handler for action: ${action.name}`);
32760
+ this.logger.debug(`Executing handler for action: ${action.name}`);
32768
32761
  await this.startSpan(`Action.${action.name}`, async (actionSpan) => {
32769
32762
  actionSpan.setAttributes({
32770
32763
  "action.name": action.name,
@@ -32813,7 +32806,7 @@ var AgentRuntime = class {
32813
32806
  }
32814
32807
  });
32815
32808
  span.addEvent(`action_executed_successfully_${action.name}`);
32816
- this.runtimeLogger.debug(`Success: Action ${action.name} executed successfully.`);
32809
+ this.logger.debug(`Success: Action ${action.name} executed successfully.`);
32817
32810
  this.adapter.log({
32818
32811
  entityId: message.entityId,
32819
32812
  roomId: message.roomId,
@@ -32837,7 +32830,7 @@ var AgentRuntime = class {
32837
32830
  "error.action": action.name,
32838
32831
  "error.message": errorMessage
32839
32832
  });
32840
- this.runtimeLogger.error(error2);
32833
+ this.logger.error(error2);
32841
32834
  const actionMemory = {
32842
32835
  id: uuidv4(),
32843
32836
  content: {
@@ -32959,7 +32952,7 @@ var AgentRuntime = class {
32959
32952
  agentId: this.agentId
32960
32953
  });
32961
32954
  if (success) {
32962
- this.runtimeLogger.debug(
32955
+ this.logger.debug(
32963
32956
  `Created new entity ${entityId} for user ${name || userName || "unknown"}`
32964
32957
  );
32965
32958
  } else {
@@ -32967,7 +32960,7 @@ var AgentRuntime = class {
32967
32960
  }
32968
32961
  } catch (error2) {
32969
32962
  if (error2.message?.includes("duplicate key") || error2.code === "23505") {
32970
- this.runtimeLogger.debug(
32963
+ this.logger.debug(
32971
32964
  `Entity ${entityId} exists in database but not for this agent. This is normal in multi-agent setups.`
32972
32965
  );
32973
32966
  } else {
@@ -33013,17 +33006,15 @@ var AgentRuntime = class {
33013
33006
  if (!added) {
33014
33007
  throw new Error(`Failed to add participant ${entityId} to room ${roomId}`);
33015
33008
  }
33016
- this.runtimeLogger.debug(`Added participant ${entityId} to room ${roomId} directly`);
33009
+ this.logger.debug(`Added participant ${entityId} to room ${roomId} directly`);
33017
33010
  } else {
33018
33011
  throw error2;
33019
33012
  }
33020
33013
  }
33021
33014
  await this.ensureParticipantInRoom(this.agentId, roomId);
33022
- this.runtimeLogger.debug(
33023
- `Success: Successfully connected entity ${entityId} in room ${roomId}`
33024
- );
33015
+ this.logger.debug(`Success: Successfully connected entity ${entityId} in room ${roomId}`);
33025
33016
  } catch (error2) {
33026
- this.runtimeLogger.error(
33017
+ this.logger.error(
33027
33018
  `Failed to ensure connection: ${error2 instanceof Error ? error2.message : String(error2)}`
33028
33019
  );
33029
33020
  throw error2;
@@ -33035,7 +33026,7 @@ var AgentRuntime = class {
33035
33026
  async ensureParticipantInRoom(entityId, roomId) {
33036
33027
  const entity = await this.adapter.getEntityById(entityId);
33037
33028
  if (!entity && entityId !== this.agentId) {
33038
- this.runtimeLogger.warn(
33029
+ this.logger.warn(
33039
33030
  `Entity ${entityId} not directly accessible to agent ${this.agentId}. Will attempt to add as participant anyway.`
33040
33031
  );
33041
33032
  } else if (!entity) {
@@ -33048,11 +33039,9 @@ var AgentRuntime = class {
33048
33039
  throw new Error(`Failed to add participant ${entityId} to room ${roomId}`);
33049
33040
  }
33050
33041
  if (entityId === this.agentId) {
33051
- this.runtimeLogger.debug(
33052
- `Agent ${this.character.name} linked to room ${roomId} successfully.`
33053
- );
33042
+ this.logger.debug(`Agent ${this.character.name} linked to room ${roomId} successfully.`);
33054
33043
  } else {
33055
- this.runtimeLogger.debug(`User ${entityId} linked to room ${roomId} successfully.`);
33044
+ this.logger.debug(`User ${entityId} linked to room ${roomId} successfully.`);
33056
33045
  }
33057
33046
  }
33058
33047
  }
@@ -33074,7 +33063,7 @@ var AgentRuntime = class {
33074
33063
  async ensureWorldExists({ id, name, serverId, metadata }) {
33075
33064
  const world = await this.getWorld(id);
33076
33065
  if (!world) {
33077
- this.runtimeLogger.debug("Creating world:", {
33066
+ this.logger.debug("Creating world:", {
33078
33067
  id,
33079
33068
  name,
33080
33069
  serverId,
@@ -33087,7 +33076,7 @@ var AgentRuntime = class {
33087
33076
  serverId: serverId || "default",
33088
33077
  metadata
33089
33078
  });
33090
- this.runtimeLogger.debug(`World ${id} created successfully.`);
33079
+ this.logger.debug(`World ${id} created successfully.`);
33091
33080
  }
33092
33081
  }
33093
33082
  /**
@@ -33112,7 +33101,7 @@ var AgentRuntime = class {
33112
33101
  worldId,
33113
33102
  metadata
33114
33103
  });
33115
- this.runtimeLogger.debug(`Room ${id} created successfully.`);
33104
+ this.logger.debug(`Room ${id} created successfully.`);
33116
33105
  }
33117
33106
  }
33118
33107
  /**
@@ -33182,7 +33171,7 @@ var AgentRuntime = class {
33182
33171
  "result.values_keys": result.values ? JSON.stringify(Object.keys(result.values)) : "[]"
33183
33172
  });
33184
33173
  providerSpan.addEvent("provider_fetch_complete");
33185
- this.runtimeLogger.debug(`${provider.name} Provider took ${duration}ms to respond`);
33174
+ this.logger.debug(`${provider.name} Provider took ${duration}ms to respond`);
33186
33175
  return {
33187
33176
  ...result,
33188
33177
  providerName: provider.name
@@ -33279,7 +33268,7 @@ var AgentRuntime = class {
33279
33268
  getService(service) {
33280
33269
  const serviceInstance = this.services.get(service);
33281
33270
  if (!serviceInstance) {
33282
- this.runtimeLogger.debug(`Service ${service} not found`);
33271
+ this.logger.debug(`Service ${service} not found`);
33283
33272
  return null;
33284
33273
  }
33285
33274
  return serviceInstance;
@@ -33295,13 +33284,13 @@ var AgentRuntime = class {
33295
33284
  span.addEvent("service_missing_type");
33296
33285
  return;
33297
33286
  }
33298
- this.runtimeLogger.debug(
33287
+ this.logger.debug(
33299
33288
  `${this.character.name}(${this.agentId}) - Registering service:`,
33300
33289
  serviceType
33301
33290
  );
33302
33291
  if (this.services.has(serviceType)) {
33303
33292
  span.addEvent("service_already_registered");
33304
- this.runtimeLogger.warn(
33293
+ this.logger.warn(
33305
33294
  `${this.character.name}(${this.agentId}) - Service ${serviceType} is already registered. Skipping registration.`
33306
33295
  );
33307
33296
  return;
@@ -33314,7 +33303,7 @@ var AgentRuntime = class {
33314
33303
  service.registerSendHandlers(this, serviceInstance);
33315
33304
  }
33316
33305
  span.addEvent("service_registered");
33317
- this.runtimeLogger.debug(
33306
+ this.logger.debug(
33318
33307
  `${this.character.name}(${this.agentId}) - Service ${serviceType} registered successfully`
33319
33308
  );
33320
33309
  } catch (error2) {
@@ -33324,7 +33313,7 @@ var AgentRuntime = class {
33324
33313
  code: SpanStatusCode.ERROR,
33325
33314
  message: errorMessage
33326
33315
  });
33327
- this.runtimeLogger.error(
33316
+ this.logger.error(
33328
33317
  `${this.character.name}(${this.agentId}) - Failed to register service ${serviceType}: ${errorMessage}`
33329
33318
  );
33330
33319
  throw error2;
@@ -33359,17 +33348,17 @@ var AgentRuntime = class {
33359
33348
  if (provider) {
33360
33349
  const modelWithProvider = models.find((m2) => m2.provider === provider);
33361
33350
  if (modelWithProvider) {
33362
- this.runtimeLogger.debug(
33351
+ this.logger.debug(
33363
33352
  `[AgentRuntime][${this.character.name}] Using model ${modelKey} from provider ${provider}`
33364
33353
  );
33365
33354
  return modelWithProvider.handler;
33366
33355
  } else {
33367
- this.runtimeLogger.warn(
33356
+ this.logger.warn(
33368
33357
  `[AgentRuntime][${this.character.name}] No model found for provider ${provider}`
33369
33358
  );
33370
33359
  }
33371
33360
  }
33372
- this.runtimeLogger.debug(
33361
+ this.logger.debug(
33373
33362
  `[AgentRuntime][${this.character.name}] Using model ${modelKey} from provider ${models[0].provider}`
33374
33363
  );
33375
33364
  return models[0].handler;
@@ -33405,7 +33394,7 @@ var AgentRuntime = class {
33405
33394
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
33406
33395
  throw new Error(errorMsg);
33407
33396
  }
33408
- this.runtimeLogger.debug(
33397
+ this.logger.debug(
33409
33398
  `[useModel] ${modelKey} input:`,
33410
33399
  JSON.stringify(params, safeReplacer(), 2).replace(/\\n/g, "\n")
33411
33400
  );
@@ -33433,10 +33422,10 @@ var AgentRuntime = class {
33433
33422
  "llm.usage.total_tokens": response?.usage?.total_tokens
33434
33423
  });
33435
33424
  span.addEvent("model_response", { response: JSON.stringify(response, safeReplacer()) });
33436
- this.runtimeLogger.debug(
33425
+ this.logger.debug(
33437
33426
  `[useModel] ${modelKey} completed in ${Number(elapsedTime.toFixed(2)).toLocaleString()}ms`
33438
33427
  );
33439
- this.runtimeLogger.debug(
33428
+ this.logger.debug(
33440
33429
  `[useModel] ${modelKey} output:`,
33441
33430
  Array.isArray(response) ? `${JSON.stringify(response.slice(0, 5))}...${JSON.stringify(response.slice(-5))} (${response.length} items)` : JSON.stringify(response)
33442
33431
  );
@@ -33514,7 +33503,7 @@ var AgentRuntime = class {
33514
33503
  });
33515
33504
  rootSpan.setStatus({ code: SpanStatusCode.OK });
33516
33505
  } catch (error2) {
33517
- this.runtimeLogger.error(
33506
+ this.logger.error(
33518
33507
  `Error during instrumented handler execution for event ${eventName}:`,
33519
33508
  error2
33520
33509
  );
@@ -33528,18 +33517,13 @@ var AgentRuntime = class {
33528
33517
  try {
33529
33518
  await Promise.all(eventHandlers.map((handler) => handler(params)));
33530
33519
  } catch (error2) {
33531
- this.runtimeLogger.error(
33532
- `Error during emitEvent for ${eventName} (handler execution):`,
33533
- error2
33534
- );
33520
+ this.logger.error(`Error during emitEvent for ${eventName} (handler execution):`, error2);
33535
33521
  }
33536
33522
  }
33537
33523
  }
33538
33524
  }
33539
33525
  async ensureEmbeddingDimension() {
33540
- this.runtimeLogger.debug(
33541
- `[AgentRuntime][${this.character.name}] Starting ensureEmbeddingDimension`
33542
- );
33526
+ this.logger.debug(`[AgentRuntime][${this.character.name}] Starting ensureEmbeddingDimension`);
33543
33527
  if (!this.adapter) {
33544
33528
  throw new Error(
33545
33529
  `[AgentRuntime][${this.character.name}] Database adapter not initialized before ensureEmbeddingDimension`
@@ -33552,22 +33536,20 @@ var AgentRuntime = class {
33552
33536
  `[AgentRuntime][${this.character.name}] No TEXT_EMBEDDING model registered`
33553
33537
  );
33554
33538
  }
33555
- this.runtimeLogger.debug(
33556
- `[AgentRuntime][${this.character.name}] Getting embedding dimensions`
33557
- );
33539
+ this.logger.debug(`[AgentRuntime][${this.character.name}] Getting embedding dimensions`);
33558
33540
  const embedding = await this.useModel(ModelType.TEXT_EMBEDDING, null);
33559
33541
  if (!embedding || !embedding.length) {
33560
33542
  throw new Error(`[AgentRuntime][${this.character.name}] Invalid embedding received`);
33561
33543
  }
33562
- this.runtimeLogger.debug(
33544
+ this.logger.debug(
33563
33545
  `[AgentRuntime][${this.character.name}] Setting embedding dimension: ${embedding.length}`
33564
33546
  );
33565
33547
  await this.adapter.ensureEmbeddingDimension(embedding.length);
33566
- this.runtimeLogger.debug(
33548
+ this.logger.debug(
33567
33549
  `[AgentRuntime][${this.character.name}] Successfully set embedding dimension`
33568
33550
  );
33569
33551
  } catch (error2) {
33570
- this.runtimeLogger.debug(
33552
+ this.logger.debug(
33571
33553
  `[AgentRuntime][${this.character.name}] Error in ensureEmbeddingDimension:`,
33572
33554
  error2
33573
33555
  );
@@ -33576,7 +33558,7 @@ var AgentRuntime = class {
33576
33558
  }
33577
33559
  registerTaskWorker(taskHandler) {
33578
33560
  if (this.taskWorkers.has(taskHandler.name)) {
33579
- this.runtimeLogger.warn(
33561
+ this.logger.warn(
33580
33562
  `Task definition ${taskHandler.name} already registered. Will be overwritten.`
33581
33563
  );
33582
33564
  }
@@ -33862,9 +33844,9 @@ var AgentRuntime = class {
33862
33844
  message: controlMessage,
33863
33845
  source: "agent"
33864
33846
  });
33865
- this.runtimeLogger.debug(`Sent control message: ${action} to room ${roomId}`);
33847
+ this.logger.debug(`Sent control message: ${action} to room ${roomId}`);
33866
33848
  } catch (error2) {
33867
- this.runtimeLogger.error(`Error sending control message: ${error2}`);
33849
+ this.logger.error(`Error sending control message: ${error2}`);
33868
33850
  }
33869
33851
  }
33870
33852
  /**
@@ -33874,12 +33856,10 @@ var AgentRuntime = class {
33874
33856
  */
33875
33857
  registerSendHandler(source, handler) {
33876
33858
  if (this.sendHandlers.has(source)) {
33877
- this.runtimeLogger.warn(
33878
- `Send handler for source '${source}' already registered. Overwriting.`
33879
- );
33859
+ this.logger.warn(`Send handler for source '${source}' already registered. Overwriting.`);
33880
33860
  }
33881
33861
  this.sendHandlers.set(source, handler);
33882
- this.runtimeLogger.info(`Registered send handler for source: ${source}`);
33862
+ this.logger.info(`Registered send handler for source: ${source}`);
33883
33863
  }
33884
33864
  /**
33885
33865
  * Sends a message to a target using the registered handler for the target's source.
@@ -33901,7 +33881,7 @@ var AgentRuntime = class {
33901
33881
  if (!handler) {
33902
33882
  const errorMsg = `No send handler registered for source: ${target.source}`;
33903
33883
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
33904
- this.runtimeLogger.error(errorMsg);
33884
+ this.logger.error(errorMsg);
33905
33885
  throw new Error(errorMsg);
33906
33886
  }
33907
33887
  try {
@@ -33913,10 +33893,7 @@ var AgentRuntime = class {
33913
33893
  const errorMsg = error2 instanceof Error ? error2.message : String(error2);
33914
33894
  span.recordException(error2);
33915
33895
  span.setStatus({ code: SpanStatusCode.ERROR, message: errorMsg });
33916
- this.runtimeLogger.error(
33917
- `Error executing send handler for source ${target.source}:`,
33918
- error2
33919
- );
33896
+ this.logger.error(`Error executing send handler for source ${target.source}:`, error2);
33920
33897
  throw error2;
33921
33898
  }
33922
33899
  });
@@ -34184,7 +34161,6 @@ export {
34184
34161
  formatTimestamp,
34185
34162
  getEntityDetails,
34186
34163
  getMemoryText,
34187
- getProviderBaseURL,
34188
34164
  getSalt,
34189
34165
  getTypedService,
34190
34166
  getUserServerRole,
package/dist/runtime.d.ts CHANGED
@@ -45,7 +45,7 @@ export declare class AgentRuntime implements IAgentRuntime {
45
45
  private taskWorkers;
46
46
  private sendHandlers;
47
47
  private eventHandlers;
48
- private runtimeLogger;
48
+ logger: any;
49
49
  private knowledgeProcessingSemaphore;
50
50
  private settings;
51
51
  private servicesInitQueue;
package/dist/utils.d.ts CHANGED
@@ -229,12 +229,3 @@ export declare function validateUuid(value: unknown): UUID | null;
229
229
  * @throws {TypeError} Throws an error if the input target is not a string.
230
230
  */
231
231
  export declare function stringToUuid(target: string | number): UUID;
232
- /**
233
- * Gets the base URL for a provider API.
234
- *
235
- * @param {IAgentRuntime} runtime - The agent runtime instance
236
- * @param {string} provider - The provider name (e.g., 'redpill', 'openai')
237
- * @param {string} defaultBaseURL - The default base URL to use for the provider
238
- * @returns {string} The base URL for the provider API
239
- */
240
- export declare function getProviderBaseURL(runtime: IAgentRuntime, provider: string, defaultBaseURL: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "1.0.0-beta.56",
3
+ "version": "1.0.0-beta.58",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "37797e23f8811bd8580b6253f61e0ae3d3af6748"
89
+ "gitHead": "061fd8c58edc469db1087a197390cc273192caac"
90
90
  }