@elizaos/plugin-bootstrap 1.6.5-alpha.8 → 1.6.5-beta.0

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 (3) hide show
  1. package/dist/index.js +702 -229
  2. package/dist/index.js.map +24 -24
  3. package/package.json +13 -11
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  createUniqueUuid as createUniqueUuid3,
87
87
  EventType as EventType2,
88
88
  imageDescriptionTemplate,
89
- logger as logger22,
89
+ logger as logger16,
90
90
  messageHandlerTemplate,
91
91
  ModelType as ModelType15,
92
92
  parseKeyValueXml as parseKeyValueXml9,
@@ -195,9 +195,10 @@ var generateImageAction = {
195
195
  });
196
196
  if (!imageResponse || imageResponse.length === 0 || !imageResponse[0]?.url) {
197
197
  logger.error({
198
- imageResponse,
198
+ src: "plugin:bootstrap:action:image_generation",
199
+ agentId: runtime.agentId,
199
200
  imagePrompt
200
- }, "generateImageAction: Image generation failed - no valid response received");
201
+ }, "Image generation failed - no valid response received");
201
202
  return {
202
203
  text: "Image generation failed",
203
204
  values: {
@@ -214,7 +215,7 @@ var generateImageAction = {
214
215
  };
215
216
  }
216
217
  const imageUrl = imageResponse[0].url;
217
- logger.info(`[GENERATE_IMAGE] Received image URL: ${imageUrl}`);
218
+ logger.info({ src: "plugin:bootstrap:action:image_generation", agentId: runtime.agentId, imageUrl }, "Received image URL");
218
219
  const getFileExtension = (url) => {
219
220
  try {
220
221
  const urlPath = new URL(url).pathname;
@@ -261,9 +262,10 @@ var generateImageAction = {
261
262
  } catch (error) {
262
263
  const err = error;
263
264
  logger.error({
264
- message: err.message,
265
- stack: err.stack
266
- }, "generateImageAction: Exception during image generation");
265
+ src: "plugin:bootstrap:action:image_generation",
266
+ agentId: runtime.agentId,
267
+ error: err.message
268
+ }, "Exception during image generation");
267
269
  return {
268
270
  text: "Image generation failed",
269
271
  values: {
@@ -387,14 +389,14 @@ var choiceAction = {
387
389
  description: "Selects an option for a pending task that has multiple options",
388
390
  validate: async (runtime, message, state) => {
389
391
  if (!state) {
390
- logger2.error("State is required for validating the action");
392
+ logger2.error({ src: "plugin:bootstrap:action:choice", agentId: runtime.agentId }, "State is required for validating the action");
391
393
  throw new Error("State is required for validating the action");
392
394
  }
393
395
  const room = state.data.room ?? await runtime.getRoom(message.roomId);
394
- if (!room || !room.serverId) {
396
+ if (!room || !room.messageServerId) {
395
397
  return false;
396
398
  }
397
- const userRole = await getUserServerRole(runtime, message.entityId, room.serverId);
399
+ const userRole = await getUserServerRole(runtime, message.entityId, room.messageServerId);
398
400
  if (userRole !== "OWNER" && userRole !== "ADMIN") {
399
401
  return false;
400
402
  }
@@ -404,13 +406,17 @@ var choiceAction = {
404
406
  tags: ["AWAITING_CHOICE"]
405
407
  });
406
408
  const room2 = state.data.room ?? await runtime.getRoom(message.roomId);
407
- const userRole2 = await getUserServerRole(runtime, message.entityId, room2.serverId);
409
+ const userRole2 = await getUserServerRole(runtime, message.entityId, room2.messageServerId);
408
410
  if (userRole2 !== "OWNER" && userRole2 !== "ADMIN") {
409
411
  return false;
410
412
  }
411
413
  return pendingTasks && pendingTasks.length > 0 && pendingTasks.some((task) => task.metadata?.options);
412
414
  } catch (error) {
413
- logger2.error({ error }, "Error validating choice action");
415
+ logger2.error({
416
+ src: "plugin:bootstrap:action:choice",
417
+ agentId: runtime.agentId,
418
+ error: error instanceof Error ? error.message : String(error)
419
+ }, "Error validating choice action");
414
420
  return false;
415
421
  }
416
422
  },
@@ -593,7 +599,11 @@ ${task.options?.map((opt) => `- ${opt.name}: ${opt.description}`).join(`
593
599
  success: true
594
600
  };
595
601
  } catch (error) {
596
- logger2.error({ error }, "Error executing task with option");
602
+ logger2.error({
603
+ src: "plugin:bootstrap:action:choice",
604
+ agentId: runtime.agentId,
605
+ error: error instanceof Error ? error.message : String(error)
606
+ }, "Error executing task with option");
597
607
  await callback?.({
598
608
  text: "There was an error processing your selection.",
599
609
  actions: ["SELECT_OPTION_ERROR"],
@@ -718,7 +728,7 @@ var followRoomAction = {
718
728
  },
719
729
  handler: async (runtime, message, state, _options, _callback, _responses) => {
720
730
  if (!state) {
721
- logger3.error("State is required for followRoomAction");
731
+ logger3.error({ src: "plugin:bootstrap:action:follow_room", agentId: runtime.agentId }, "State is required for followRoomAction");
722
732
  return {
723
733
  text: "State is required for follow room action",
724
734
  values: {
@@ -776,7 +786,7 @@ var followRoomAction = {
776
786
  }, "messages");
777
787
  return false;
778
788
  }
779
- logger3.warn(`Unclear boolean response: ${response}, defaulting to false`);
789
+ logger3.warn({ src: "plugin:bootstrap:action:follow_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
780
790
  return false;
781
791
  }
782
792
  const shouldFollow = await _shouldFollow(state);
@@ -811,7 +821,11 @@ var followRoomAction = {
811
821
  success: true
812
822
  };
813
823
  } catch (error) {
814
- logger3.error({ error }, "Error following room");
824
+ logger3.error({
825
+ src: "plugin:bootstrap:action:follow_room",
826
+ agentId: runtime.agentId,
827
+ error: error instanceof Error ? error.message : String(error)
828
+ }, "Error following room");
815
829
  return {
816
830
  text: "Failed to follow room",
817
831
  values: {
@@ -1372,7 +1386,7 @@ var muteRoomAction = {
1372
1386
  },
1373
1387
  handler: async (runtime, message, state, _options, _callback, _responses) => {
1374
1388
  if (!state) {
1375
- logger4.error("State is required for muting a room");
1389
+ logger4.error({ src: "plugin:bootstrap:action:mute_room", agentId: runtime.agentId }, "State is required for muting a room");
1376
1390
  return {
1377
1391
  text: "State is required for mute room action",
1378
1392
  values: {
@@ -1429,7 +1443,7 @@ var muteRoomAction = {
1429
1443
  }
1430
1444
  }, "messages");
1431
1445
  }
1432
- logger4.warn(`Unclear boolean response: ${response}, defaulting to false`);
1446
+ logger4.warn({ src: "plugin:bootstrap:action:mute_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
1433
1447
  return false;
1434
1448
  }
1435
1449
  const shouldMute = await _shouldMute(state);
@@ -1464,7 +1478,11 @@ var muteRoomAction = {
1464
1478
  success: true
1465
1479
  };
1466
1480
  } catch (error) {
1467
- logger4.error({ error }, "Error muting room");
1481
+ logger4.error({
1482
+ src: "plugin:bootstrap:action:mute_room",
1483
+ agentId: runtime.agentId,
1484
+ error: error instanceof Error ? error.message : String(error)
1485
+ }, "Error muting room");
1468
1486
  return {
1469
1487
  text: "Failed to mute room",
1470
1488
  values: {
@@ -1794,7 +1812,11 @@ var replyAction = {
1794
1812
  const actionContext = _options?.actionContext;
1795
1813
  const previousResults = actionContext?.previousResults || [];
1796
1814
  if (previousResults.length > 0) {
1797
- logger5.debug(`[REPLY] Found ${previousResults.length} previous action results`);
1815
+ logger5.debug({
1816
+ src: "plugin:bootstrap:action:reply",
1817
+ agentId: runtime.agentId,
1818
+ count: previousResults.length
1819
+ }, "Found previous action results");
1798
1820
  }
1799
1821
  const allProviders = responses?.flatMap((res) => res.content?.providers ?? []) ?? [];
1800
1822
  state = await runtime.composeState(message, [
@@ -1835,7 +1857,11 @@ var replyAction = {
1835
1857
  success: true
1836
1858
  };
1837
1859
  } catch (error) {
1838
- logger5.error(`[REPLY] Error generating response: ${error}`);
1860
+ logger5.error({
1861
+ src: "plugin:bootstrap:action:reply",
1862
+ agentId: runtime.agentId,
1863
+ error: error instanceof Error ? error.message : String(error)
1864
+ }, "Error generating response");
1839
1865
  return {
1840
1866
  text: "Error generating reply",
1841
1867
  values: {
@@ -1948,7 +1974,7 @@ var updateRoleAction = {
1948
1974
  },
1949
1975
  handler: async (runtime, message, state, _options, callback) => {
1950
1976
  if (!state) {
1951
- logger6.error("State is required for role assignment");
1977
+ logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId }, "State is required for role assignment");
1952
1978
  return {
1953
1979
  text: "State is required for role assignment",
1954
1980
  values: {
@@ -1971,7 +1997,7 @@ var updateRoleAction = {
1971
1997
  world = await runtime.getWorld(worldId);
1972
1998
  }
1973
1999
  if (!world) {
1974
- logger6.error("World not found");
2000
+ logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId }, "World not found");
1975
2001
  await callback?.({
1976
2002
  text: "I couldn't find the world. This action only works in a world."
1977
2003
  });
@@ -2067,7 +2093,11 @@ IMPORTANT: Your response must ONLY contain the <response></response> XML block a
2067
2093
  for (const assignment of assignments) {
2068
2094
  let targetEntity = entities.find((e) => e.id === assignment.entityId);
2069
2095
  if (!targetEntity) {
2070
- logger6.error("Could not find an ID to assign to");
2096
+ logger6.error({
2097
+ src: "plugin:bootstrap:action:update_role",
2098
+ agentId: runtime.agentId,
2099
+ entityId: assignment.entityId
2100
+ }, "Could not find an ID to assign to");
2071
2101
  failedUpdates.push({
2072
2102
  entityId: assignment.entityId,
2073
2103
  reason: "Entity not found"
@@ -2103,9 +2133,13 @@ IMPORTANT: Your response must ONLY contain the <response></response> XML block a
2103
2133
  if (worldUpdated) {
2104
2134
  try {
2105
2135
  await runtime.updateWorld(world);
2106
- logger6.info(`Updated roles in world metadata for server ${serverId}`);
2136
+ logger6.info({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId, serverId }, "Updated roles in world metadata");
2107
2137
  } catch (error) {
2108
- logger6.error({ error }, "Failed to save world updates");
2138
+ logger6.error({
2139
+ src: "plugin:bootstrap:action:update_role",
2140
+ agentId: runtime.agentId,
2141
+ error: error instanceof Error ? error.message : String(error)
2142
+ }, "Failed to save world updates");
2109
2143
  return {
2110
2144
  text: "Failed to save role updates",
2111
2145
  values: {
@@ -2259,7 +2293,7 @@ var sendMessageAction = {
2259
2293
  handler: async (runtime, message, state, _options, callback, responses) => {
2260
2294
  try {
2261
2295
  if (!state) {
2262
- logger7.error("State is required for sendMessage action");
2296
+ logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "State is required for sendMessage action");
2263
2297
  return {
2264
2298
  text: "State is required for sendMessage action",
2265
2299
  values: {
@@ -2275,7 +2309,7 @@ var sendMessageAction = {
2275
2309
  };
2276
2310
  }
2277
2311
  if (!callback) {
2278
- logger7.error("Callback is required for sendMessage action");
2312
+ logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "Callback is required for sendMessage action");
2279
2313
  return {
2280
2314
  text: "Callback is required for sendMessage action",
2281
2315
  values: {
@@ -2291,7 +2325,7 @@ var sendMessageAction = {
2291
2325
  };
2292
2326
  }
2293
2327
  if (!responses) {
2294
- logger7.error("Responses are required for sendMessage action");
2328
+ logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "Responses are required for sendMessage action");
2295
2329
  return {
2296
2330
  text: "Responses are required for sendMessage action",
2297
2331
  values: {
@@ -2442,7 +2476,11 @@ var sendMessageAction = {
2442
2476
  success: true
2443
2477
  };
2444
2478
  } catch (error) {
2445
- logger7.error("Failed to send direct message:", error instanceof Error ? error.message : String(error));
2479
+ logger7.error({
2480
+ src: "plugin:bootstrap:action:send_message",
2481
+ agentId: runtime.agentId,
2482
+ error: error instanceof Error ? error.message : String(error)
2483
+ }, "Failed to send direct message");
2446
2484
  await callback({
2447
2485
  text: "I encountered an error trying to send the message. Please try again.",
2448
2486
  actions: ["SEND_MESSAGE_ERROR"],
@@ -2548,7 +2586,11 @@ var sendMessageAction = {
2548
2586
  success: true
2549
2587
  };
2550
2588
  } catch (error) {
2551
- logger7.error("Failed to send room message:", error instanceof Error ? error.message : String(error));
2589
+ logger7.error({
2590
+ src: "plugin:bootstrap:action:send_message",
2591
+ agentId: runtime.agentId,
2592
+ error: error instanceof Error ? error.message : String(error)
2593
+ }, "Failed to send room message");
2552
2594
  await callback({
2553
2595
  text: "I encountered an error trying to send the message to the room. Please try again.",
2554
2596
  actions: ["SEND_MESSAGE_ERROR"],
@@ -2588,7 +2630,11 @@ var sendMessageAction = {
2588
2630
  success: false
2589
2631
  };
2590
2632
  } catch (error) {
2591
- logger7.error(`Error in sendMessage handler: ${error}`);
2633
+ logger7.error({
2634
+ src: "plugin:bootstrap:action:send_message",
2635
+ agentId: runtime.agentId,
2636
+ error: error instanceof Error ? error.message : String(error)
2637
+ }, "Error in sendMessage handler");
2592
2638
  await callback?.({
2593
2639
  text: "There was an error processing your message request.",
2594
2640
  actions: ["SEND_MESSAGE_ERROR"],
@@ -2877,7 +2923,11 @@ async function getWorldSettings(runtime, serverId) {
2877
2923
  }
2878
2924
  return world.metadata.settings;
2879
2925
  } catch (error) {
2880
- logger8.error(`Error getting settings state: ${error}`);
2926
+ logger8.error({
2927
+ src: "plugin:bootstrap:action:settings",
2928
+ agentId: runtime.agentId,
2929
+ error: error instanceof Error ? error.message : String(error)
2930
+ }, "Error getting settings state");
2881
2931
  return null;
2882
2932
  }
2883
2933
  }
@@ -2886,7 +2936,7 @@ async function updateWorldSettings(runtime, serverId, worldSettings) {
2886
2936
  const worldId = createUniqueUuid(runtime, serverId);
2887
2937
  const world = await runtime.getWorld(worldId);
2888
2938
  if (!world) {
2889
- logger8.error(`No world found for server ${serverId}`);
2939
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "No world found for server");
2890
2940
  return false;
2891
2941
  }
2892
2942
  if (!world.metadata) {
@@ -2896,7 +2946,11 @@ async function updateWorldSettings(runtime, serverId, worldSettings) {
2896
2946
  await runtime.updateWorld(world);
2897
2947
  return true;
2898
2948
  } catch (error) {
2899
- logger8.error(`Error updating settings state: ${error}`);
2949
+ logger8.error({
2950
+ src: "plugin:bootstrap:action:settings",
2951
+ agentId: runtime.agentId,
2952
+ error: error instanceof Error ? error.message : String(error)
2953
+ }, "Error updating settings state");
2900
2954
  return false;
2901
2955
  }
2902
2956
  }
@@ -3037,7 +3091,11 @@ async function processSettingUpdates(runtime, serverId, worldSettings, updates)
3037
3091
  }
3038
3092
  return { updatedAny, messages };
3039
3093
  } catch (error) {
3040
- logger8.error({ error }, "Error processing setting updates:");
3094
+ logger8.error({
3095
+ src: "plugin:bootstrap:action:settings",
3096
+ agentId: runtime.agentId,
3097
+ error: error instanceof Error ? error.message : String(error)
3098
+ }, "Error processing setting updates");
3041
3099
  return {
3042
3100
  updatedAny: false,
3043
3101
  messages: ["Error occurred while updating settings"]
@@ -3076,7 +3134,11 @@ async function handleOnboardingComplete(runtime, worldSettings, _state, callback
3076
3134
  success: true
3077
3135
  };
3078
3136
  } catch (error) {
3079
- logger8.error(`Error handling settings completion: ${error}`);
3137
+ logger8.error({
3138
+ src: "plugin:bootstrap:action:settings",
3139
+ agentId: runtime.agentId,
3140
+ error: error instanceof Error ? error.message : String(error)
3141
+ }, "Error handling settings completion");
3080
3142
  await callback({
3081
3143
  text: "Great! All required settings have been configured. Your server is now fully set up and ready to use.",
3082
3144
  actions: ["ONBOARDING_COMPLETE"],
@@ -3140,7 +3202,11 @@ async function generateSuccessResponse(runtime, worldSettings, state, messages,
3140
3202
  success: true
3141
3203
  };
3142
3204
  } catch (error) {
3143
- logger8.error(`Error generating success response: ${error}`);
3205
+ logger8.error({
3206
+ src: "plugin:bootstrap:action:settings",
3207
+ agentId: runtime.agentId,
3208
+ error: error instanceof Error ? error.message : String(error)
3209
+ }, "Error generating success response");
3144
3210
  await callback({
3145
3211
  text: "Settings updated successfully. Please continue with the remaining configuration.",
3146
3212
  actions: ["SETTING_UPDATED"],
@@ -3201,7 +3267,11 @@ async function generateFailureResponse(runtime, worldSettings, state, callback)
3201
3267
  success: false
3202
3268
  };
3203
3269
  } catch (error) {
3204
- logger8.error(`Error generating failure response: ${error}`);
3270
+ logger8.error({
3271
+ src: "plugin:bootstrap:action:settings",
3272
+ agentId: runtime.agentId,
3273
+ error: error instanceof Error ? error.message : String(error)
3274
+ }, "Error generating failure response");
3205
3275
  await callback({
3206
3276
  text: "I couldn't understand your settings update. Please try again with a clearer format.",
3207
3277
  actions: ["SETTING_UPDATE_FAILED"],
@@ -3251,7 +3321,11 @@ async function generateErrorResponse(runtime, state, callback) {
3251
3321
  success: false
3252
3322
  };
3253
3323
  } catch (error) {
3254
- logger8.error(`Error generating error response: ${error}`);
3324
+ logger8.error({
3325
+ src: "plugin:bootstrap:action:settings",
3326
+ agentId: runtime.agentId,
3327
+ error: error instanceof Error ? error.message : String(error)
3328
+ }, "Error generating error response");
3255
3329
  await callback({
3256
3330
  text: "I'm sorry, but I encountered an error while processing your request. Please try again or contact support if the issue persists.",
3257
3331
  actions: ["SETTING_UPDATE_ERROR"],
@@ -3281,10 +3355,18 @@ var updateSettingsAction = {
3281
3355
  validate: async (runtime, message, _state) => {
3282
3356
  try {
3283
3357
  if (message.content.channelType !== ChannelType2.DM) {
3284
- logger8.debug(`Skipping settings in non-DM channel (type: ${message.content.channelType})`);
3358
+ logger8.debug({
3359
+ src: "plugin:bootstrap:action:settings",
3360
+ agentId: runtime.agentId,
3361
+ channelType: message.content.channelType
3362
+ }, "Skipping settings in non-DM channel");
3285
3363
  return false;
3286
3364
  }
3287
- logger8.debug(`Looking for server where user ${message.entityId} is owner`);
3365
+ logger8.debug({
3366
+ src: "plugin:bootstrap:action:settings",
3367
+ agentId: runtime.agentId,
3368
+ entityId: message.entityId
3369
+ }, "Looking for server where user is owner");
3288
3370
  const worlds = await findWorldsForOwner(runtime, message.entityId);
3289
3371
  if (!worlds) {
3290
3372
  return false;
@@ -3292,20 +3374,32 @@ var updateSettingsAction = {
3292
3374
  const world = worlds.find((world2) => world2.metadata?.settings);
3293
3375
  const worldSettings = world?.metadata?.settings;
3294
3376
  if (!worldSettings) {
3295
- logger8.error(`No settings state found for server ${world?.serverId}`);
3377
+ logger8.error({
3378
+ src: "plugin:bootstrap:action:settings",
3379
+ agentId: runtime.agentId,
3380
+ serverId: world?.messageServerId
3381
+ }, "No settings state found for server");
3296
3382
  return false;
3297
3383
  }
3298
- logger8.debug(`Found valid settings state for server ${world.serverId}`);
3384
+ logger8.debug({
3385
+ src: "plugin:bootstrap:action:settings",
3386
+ agentId: runtime.agentId,
3387
+ serverId: world.messageServerId
3388
+ }, "Found valid settings state for server");
3299
3389
  return true;
3300
3390
  } catch (error) {
3301
- logger8.error(`Error validating settings action: ${error}`);
3391
+ logger8.error({
3392
+ src: "plugin:bootstrap:action:settings",
3393
+ agentId: runtime.agentId,
3394
+ error: error instanceof Error ? error.message : String(error)
3395
+ }, "Error validating settings action");
3302
3396
  return false;
3303
3397
  }
3304
3398
  },
3305
3399
  handler: async (runtime, message, state, _options, callback) => {
3306
3400
  try {
3307
3401
  if (!state) {
3308
- logger8.error("State is required for settings handler");
3402
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "State is required for settings handler");
3309
3403
  if (callback) {
3310
3404
  await generateErrorResponse(runtime, state, callback);
3311
3405
  }
@@ -3324,7 +3418,7 @@ var updateSettingsAction = {
3324
3418
  };
3325
3419
  }
3326
3420
  if (!message) {
3327
- logger8.error("Message is required for settings handler");
3421
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Message is required for settings handler");
3328
3422
  await generateErrorResponse(runtime, state, callback);
3329
3423
  return {
3330
3424
  text: "Message is required for settings handler",
@@ -3341,7 +3435,7 @@ var updateSettingsAction = {
3341
3435
  };
3342
3436
  }
3343
3437
  if (!callback) {
3344
- logger8.error("Callback is required for settings handler");
3438
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Callback is required for settings handler");
3345
3439
  return {
3346
3440
  text: "Callback is required for settings handler",
3347
3441
  values: {
@@ -3356,11 +3450,19 @@ var updateSettingsAction = {
3356
3450
  error: new Error("Callback is required for settings handler")
3357
3451
  };
3358
3452
  }
3359
- logger8.info(`Handler looking for server for user ${message.entityId}`);
3453
+ logger8.info({
3454
+ src: "plugin:bootstrap:action:settings",
3455
+ agentId: runtime.agentId,
3456
+ entityId: message.entityId
3457
+ }, "Handler looking for server for user");
3360
3458
  const worlds = await findWorldsForOwner(runtime, message.entityId);
3361
3459
  const serverOwnership = worlds?.find((world) => world.metadata?.settings);
3362
3460
  if (!serverOwnership) {
3363
- logger8.error(`No server found for user ${message.entityId} in handler`);
3461
+ logger8.error({
3462
+ src: "plugin:bootstrap:action:settings",
3463
+ agentId: runtime.agentId,
3464
+ entityId: message.entityId
3465
+ }, "No server found for user in handler");
3364
3466
  await generateErrorResponse(runtime, state, callback);
3365
3467
  return {
3366
3468
  text: "No server found for user",
@@ -3376,10 +3478,14 @@ var updateSettingsAction = {
3376
3478
  success: false
3377
3479
  };
3378
3480
  }
3379
- const serverId = serverOwnership?.serverId;
3380
- logger8.info(`Using server ID: ${serverId}`);
3481
+ const serverId = serverOwnership?.messageServerId;
3482
+ logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "Using server ID");
3381
3483
  if (!serverId) {
3382
- logger8.error(`No server ID found for user ${message.entityId} in handler`);
3484
+ logger8.error({
3485
+ src: "plugin:bootstrap:action:settings",
3486
+ agentId: runtime.agentId,
3487
+ entityId: message.entityId
3488
+ }, "No server ID found for user in handler");
3383
3489
  await generateErrorResponse(runtime, state, callback);
3384
3490
  return {
3385
3491
  text: "No server ID found",
@@ -3397,7 +3503,7 @@ var updateSettingsAction = {
3397
3503
  }
3398
3504
  const worldSettings = await getWorldSettings(runtime, serverId);
3399
3505
  if (!worldSettings) {
3400
- logger8.error(`No settings state found for server ${serverId} in handler`);
3506
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "No settings state found for server in handler");
3401
3507
  await generateErrorResponse(runtime, state, callback);
3402
3508
  return {
3403
3509
  text: "No settings state found",
@@ -3413,15 +3519,27 @@ var updateSettingsAction = {
3413
3519
  success: false
3414
3520
  };
3415
3521
  }
3416
- logger8.info(`Extracting settings from message: ${message.content.text}`);
3522
+ logger8.info({
3523
+ src: "plugin:bootstrap:action:settings",
3524
+ agentId: runtime.agentId,
3525
+ text: message.content.text
3526
+ }, "Extracting settings from message");
3417
3527
  const extractedSettings = await extractSettingValues(runtime, message, state, worldSettings);
3418
- logger8.info(`Extracted ${extractedSettings.length} settings`);
3528
+ logger8.info({
3529
+ src: "plugin:bootstrap:action:settings",
3530
+ agentId: runtime.agentId,
3531
+ count: extractedSettings.length
3532
+ }, "Extracted settings");
3419
3533
  const updateResults = await processSettingUpdates(runtime, serverId, worldSettings, extractedSettings);
3420
3534
  if (updateResults.updatedAny) {
3421
- logger8.info(`Successfully updated settings: ${updateResults.messages.join(", ")}`);
3535
+ logger8.info({
3536
+ src: "plugin:bootstrap:action:settings",
3537
+ agentId: runtime.agentId,
3538
+ messages: updateResults.messages
3539
+ }, "Successfully updated settings");
3422
3540
  const updatedWorldSettings = await getWorldSettings(runtime, serverId);
3423
3541
  if (!updatedWorldSettings) {
3424
- logger8.error("Failed to retrieve updated settings state");
3542
+ logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Failed to retrieve updated settings state");
3425
3543
  await generateErrorResponse(runtime, state, callback);
3426
3544
  return {
3427
3545
  text: "Failed to retrieve updated settings state",
@@ -3461,7 +3579,7 @@ var updateSettingsAction = {
3461
3579
  success: true
3462
3580
  };
3463
3581
  } else {
3464
- logger8.info("No settings were updated");
3582
+ logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "No settings were updated");
3465
3583
  await generateFailureResponse(runtime, worldSettings, state, callback);
3466
3584
  const { requiredUnconfigured } = categorizeSettings(worldSettings);
3467
3585
  return {
@@ -3482,7 +3600,11 @@ var updateSettingsAction = {
3482
3600
  };
3483
3601
  }
3484
3602
  } catch (error) {
3485
- logger8.error(`Error in settings handler: ${error}`);
3603
+ logger8.error({
3604
+ src: "plugin:bootstrap:action:settings",
3605
+ agentId: runtime.agentId,
3606
+ error: error instanceof Error ? error.message : String(error)
3607
+ }, "Error in settings handler");
3486
3608
  if (state && callback) {
3487
3609
  await generateErrorResponse(runtime, state, callback);
3488
3610
  }
@@ -4125,7 +4247,7 @@ var unmuteRoomAction = {
4125
4247
  }, "messages");
4126
4248
  return false;
4127
4249
  }
4128
- logger9.warn(`Unclear boolean response: ${response}, defaulting to false`);
4250
+ logger9.warn({ src: "plugin:bootstrap:action:unmute_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
4129
4251
  return false;
4130
4252
  }
4131
4253
  if (!state) {
@@ -4149,7 +4271,11 @@ var unmuteRoomAction = {
4149
4271
  await runtime.setParticipantUserState(message.roomId, runtime.agentId, null);
4150
4272
  const room = await runtime.getRoom(message.roomId);
4151
4273
  if (!room) {
4152
- logger9.warn(`Room not found: ${message.roomId}`);
4274
+ logger9.warn({
4275
+ src: "plugin:bootstrap:action:unmute_room",
4276
+ agentId: runtime.agentId,
4277
+ roomId: message.roomId
4278
+ }, "Room not found");
4153
4279
  return {
4154
4280
  text: `Room not found: ${message.roomId}`,
4155
4281
  values: {
@@ -4192,7 +4318,11 @@ var unmuteRoomAction = {
4192
4318
  success: true
4193
4319
  };
4194
4320
  } catch (error) {
4195
- logger9.error({ error }, "Error unmuting room:");
4321
+ logger9.error({
4322
+ src: "plugin:bootstrap:action:unmute_room",
4323
+ agentId: runtime.agentId,
4324
+ error: error instanceof Error ? error.message : String(error)
4325
+ }, "Error unmuting room");
4196
4326
  return {
4197
4327
  text: "Failed to unmute room",
4198
4328
  values: {
@@ -4386,7 +4516,7 @@ var updateEntityAction = {
4386
4516
  handler: async (runtime, message, state, _options, callback, responses) => {
4387
4517
  try {
4388
4518
  if (!state) {
4389
- logger10.error("State is required for the updateEntity action");
4519
+ logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "State is required for the updateEntity action");
4390
4520
  return {
4391
4521
  text: "State is required for updateEntity action",
4392
4522
  values: {
@@ -4402,7 +4532,7 @@ var updateEntityAction = {
4402
4532
  };
4403
4533
  }
4404
4534
  if (!callback) {
4405
- logger10.error("Callback is required for the updateEntity action");
4535
+ logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Callback is required for the updateEntity action");
4406
4536
  return {
4407
4537
  text: "Callback is required for updateEntity action",
4408
4538
  values: {
@@ -4418,7 +4548,7 @@ var updateEntityAction = {
4418
4548
  };
4419
4549
  }
4420
4550
  if (!responses) {
4421
- logger10.error("Responses are required for the updateEntity action");
4551
+ logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Responses are required for the updateEntity action");
4422
4552
  return {
4423
4553
  text: "Responses are required for updateEntity action",
4424
4554
  values: {
@@ -4434,7 +4564,7 @@ var updateEntityAction = {
4434
4564
  };
4435
4565
  }
4436
4566
  if (!message) {
4437
- logger10.error("Message is required for the updateEntity action");
4567
+ logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Message is required for the updateEntity action");
4438
4568
  return {
4439
4569
  text: "Message is required for updateEntity action",
4440
4570
  values: {
@@ -4492,7 +4622,11 @@ var updateEntityAction = {
4492
4622
  throw new Error("Invalid response format - missing source or data");
4493
4623
  }
4494
4624
  } catch (error) {
4495
- logger10.error("Failed to parse component data:", error instanceof Error ? error.message : String(error));
4625
+ logger10.error({
4626
+ src: "plugin:bootstrap:action:update_entity",
4627
+ agentId: runtime.agentId,
4628
+ error: error instanceof Error ? error.message : String(error)
4629
+ }, "Failed to parse component data");
4496
4630
  await callback({
4497
4631
  text: "I couldn't properly understand the component information. Please try again with more specific information.",
4498
4632
  actions: ["UPDATE_ENTITY_ERROR"],
@@ -4592,7 +4726,11 @@ var updateEntityAction = {
4592
4726
  };
4593
4727
  }
4594
4728
  } catch (error) {
4595
- logger10.error(`Error in updateEntity handler: ${error}`);
4729
+ logger10.error({
4730
+ src: "plugin:bootstrap:action:update_entity",
4731
+ agentId: runtime.agentId,
4732
+ error: error instanceof Error ? error.message : String(error)
4733
+ }, "Error in updateEntity handler");
4596
4734
  await callback?.({
4597
4735
  text: "There was an error processing the entity information.",
4598
4736
  actions: ["UPDATE_ENTITY_ERROR"],
@@ -4663,7 +4801,7 @@ var updateEntityAction = {
4663
4801
  };
4664
4802
  // src/evaluators/reflection.ts
4665
4803
  import { z } from "zod";
4666
- import { asUUID, getEntityDetails, logger as logger11, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
4804
+ import { asUUID, getEntityDetails, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
4667
4805
  import { composePrompt as composePrompt4 } from "@elizaos/core";
4668
4806
  import {
4669
4807
  ModelType as ModelType12
@@ -4764,7 +4902,7 @@ function resolveEntity(entityId, entities) {
4764
4902
  async function handler(runtime, message, state) {
4765
4903
  const { agentId, roomId } = message;
4766
4904
  if (!agentId || !roomId) {
4767
- logger11.warn({ message }, "Missing agentId or roomId in message");
4905
+ runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId, message }, "Missing agentId or roomId in message");
4768
4906
  return;
4769
4907
  }
4770
4908
  const [existingRelationships, entities, knownFacts] = await Promise.all([
@@ -4795,20 +4933,20 @@ async function handler(runtime, message, state) {
4795
4933
  prompt
4796
4934
  });
4797
4935
  if (!response) {
4798
- logger11.warn({ prompt }, "Getting reflection failed - empty response");
4936
+ runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - empty response");
4799
4937
  return;
4800
4938
  }
4801
4939
  const reflection = parseKeyValueXml8(response);
4802
4940
  if (!reflection) {
4803
- logger11.warn({ response }, "Getting reflection failed - failed to parse XML");
4941
+ runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - failed to parse XML");
4804
4942
  return;
4805
4943
  }
4806
4944
  if (!reflection.facts) {
4807
- logger11.warn({ reflection }, "Getting reflection failed - invalid facts structure");
4945
+ runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - invalid facts structure");
4808
4946
  return;
4809
4947
  }
4810
4948
  if (!reflection.relationships) {
4811
- logger11.warn({ reflection }, "Getting reflection failed - invalid relationships structure");
4949
+ runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - invalid relationships structure");
4812
4950
  return;
4813
4951
  }
4814
4952
  let factsArray = [];
@@ -4875,7 +5013,11 @@ async function handler(runtime, message, state) {
4875
5013
  }
4876
5014
  await runtime.setCache(`${message.roomId}-reflection-last-processed`, message?.id || "");
4877
5015
  } catch (error) {
4878
- logger11.error({ error }, "Error in reflection handler:");
5016
+ runtime.logger.error({
5017
+ src: "plugin:bootstrap:evaluator:reflection",
5018
+ agentId: runtime.agentId,
5019
+ error: error instanceof Error ? error.message : String(error)
5020
+ }, "Error in reflection handler");
4879
5021
  return;
4880
5022
  }
4881
5023
  }
@@ -5113,7 +5255,7 @@ var actionsProvider = {
5113
5255
  // src/providers/actionState.ts
5114
5256
  import {
5115
5257
  addHeader as addHeader2,
5116
- logger as logger12
5258
+ logger as logger11
5117
5259
  } from "@elizaos/core";
5118
5260
  var actionStateProvider = {
5119
5261
  name: "ACTION_STATE",
@@ -5202,7 +5344,11 @@ ${values}`;
5202
5344
  });
5203
5345
  recentActionMemories = recentMessages.filter((msg) => msg.content?.type === "action_result" && msg.metadata?.type === "action_result");
5204
5346
  } catch (error) {
5205
- logger12?.error({ error }, "Failed to retrieve action memories:");
5347
+ logger11?.error({
5348
+ src: "plugin:bootstrap:provider:action_state",
5349
+ agentId: runtime.agentId,
5350
+ error: error instanceof Error ? error.message : String(error)
5351
+ }, "Failed to retrieve action memories");
5206
5352
  }
5207
5353
  let actionMemoriesText = "";
5208
5354
  if (recentActionMemories.length > 0) {
@@ -5409,7 +5555,6 @@ var attachmentsProvider = {
5409
5555
  }
5410
5556
  };
5411
5557
  // src/providers/capabilities.ts
5412
- import { logger as logger13 } from "@elizaos/core";
5413
5558
  var capabilitiesProvider = {
5414
5559
  name: "CAPABILITIES",
5415
5560
  get: async (runtime, _message) => {
@@ -5445,7 +5590,11 @@ var capabilitiesProvider = {
5445
5590
  ${formattedCapabilities}`
5446
5591
  };
5447
5592
  } catch (error) {
5448
- logger13.error({ error }, "Error in capabilities provider:");
5593
+ runtime.logger.error({
5594
+ src: "plugin:bootstrap:provider:capabilities",
5595
+ agentId: runtime.agentId,
5596
+ error: error instanceof Error ? error.message : String(error)
5597
+ }, "Error in capabilities provider");
5449
5598
  return {
5450
5599
  text: "Error retrieving capabilities from services."
5451
5600
  };
@@ -5552,7 +5701,6 @@ var characterProvider = {
5552
5701
  }
5553
5702
  };
5554
5703
  // src/providers/choice.ts
5555
- import { logger as logger14 } from "@elizaos/core";
5556
5704
  var choiceProvider = {
5557
5705
  name: "CHOICE",
5558
5706
  get: async (runtime, message, _state) => {
@@ -5627,7 +5775,11 @@ var choiceProvider = {
5627
5775
  text: output
5628
5776
  };
5629
5777
  } catch (error) {
5630
- logger14.error({ error }, "Error in options provider:");
5778
+ runtime.logger.error({
5779
+ src: "plugin:bootstrap:provider:choice",
5780
+ agentId: runtime.agentId,
5781
+ error: error instanceof Error ? error.message : String(error)
5782
+ }, "Error in options provider");
5631
5783
  return {
5632
5784
  data: {
5633
5785
  tasks: []
@@ -5746,7 +5898,6 @@ var evaluatorsProvider = {
5746
5898
  };
5747
5899
  // src/providers/facts.ts
5748
5900
  import { ModelType as ModelType13 } from "@elizaos/core";
5749
- import { logger as logger15 } from "@elizaos/core";
5750
5901
  function formatFacts2(facts) {
5751
5902
  return facts.reverse().map((fact) => fact.content.text).join(`
5752
5903
  `);
@@ -5811,7 +5962,11 @@ var factsProvider = {
5811
5962
  text
5812
5963
  };
5813
5964
  } catch (error) {
5814
- logger15.error({ error }, "Error in factsProvider:");
5965
+ runtime.logger.error({
5966
+ src: "plugin:bootstrap:provider:facts",
5967
+ agentId: runtime.agentId,
5968
+ error: error instanceof Error ? error.message : String(error)
5969
+ }, "Error in factsProvider");
5815
5970
  return {
5816
5971
  values: {
5817
5972
  facts: ""
@@ -5873,7 +6028,7 @@ import {
5873
6028
  formatMessages,
5874
6029
  formatPosts,
5875
6030
  getEntityDetails as getEntityDetails3,
5876
- logger as logger16
6031
+ logger as logger12
5877
6032
  } from "@elizaos/core";
5878
6033
  var getRecentInteractions = async (runtime, sourceEntityId, targetEntityId, excludeRoomId) => {
5879
6034
  const rooms = await runtime.getRoomsForParticipants([sourceEntityId, targetEntityId]);
@@ -6077,7 +6232,11 @@ ${runText}`;
6077
6232
  text
6078
6233
  };
6079
6234
  } catch (error) {
6080
- logger16.error({ error }, "Error in recentMessagesProvider:");
6235
+ logger12.error({
6236
+ src: "plugin:bootstrap:provider:recent_messages",
6237
+ agentId: runtime.agentId,
6238
+ error: error instanceof Error ? error.message : String(error)
6239
+ }, "Error in recentMessagesProvider");
6081
6240
  return {
6082
6241
  data: {
6083
6242
  recentMessages: [],
@@ -6177,7 +6336,7 @@ ${formattedRelationships}`
6177
6336
  import {
6178
6337
  ChannelType as ChannelType6,
6179
6338
  createUniqueUuid as createUniqueUuid2,
6180
- logger as logger17
6339
+ logger as logger13
6181
6340
  } from "@elizaos/core";
6182
6341
  var roleProvider = {
6183
6342
  name: "ROLES",
@@ -6198,15 +6357,15 @@ var roleProvider = {
6198
6357
  text: "No access to role information in DMs, the role provider is only available in group scenarios."
6199
6358
  };
6200
6359
  }
6201
- const serverId = room.serverId;
6360
+ const serverId = room.messageServerId;
6202
6361
  if (!serverId) {
6203
6362
  throw new Error("No server ID found");
6204
6363
  }
6205
- logger17.info(`Using server ID: ${serverId}`);
6364
+ logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "Using server ID");
6206
6365
  const worldId = createUniqueUuid2(runtime, serverId);
6207
6366
  const world = await runtime.getWorld(worldId);
6208
6367
  if (!world || !world.metadata?.ownership?.ownerId) {
6209
- logger17.info(`No ownership data found for server ${serverId}, initializing empty role hierarchy`);
6368
+ logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No ownership data found for server, initializing empty role hierarchy");
6210
6369
  return {
6211
6370
  data: {
6212
6371
  roles: []
@@ -6219,7 +6378,7 @@ var roleProvider = {
6219
6378
  }
6220
6379
  const roles = world.metadata.roles || {};
6221
6380
  if (Object.keys(roles).length === 0) {
6222
- logger17.info(`No roles found for server ${serverId}`);
6381
+ logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No roles found for server");
6223
6382
  return {
6224
6383
  data: {
6225
6384
  roles: []
@@ -6230,7 +6389,11 @@ var roleProvider = {
6230
6389
  text: "No role information available for this server."
6231
6390
  };
6232
6391
  }
6233
- logger17.info(`Found ${Object.keys(roles).length} roles`);
6392
+ logger13.info({
6393
+ src: "plugin:bootstrap:provider:roles",
6394
+ agentId: runtime.agentId,
6395
+ roleCount: Object.keys(roles).length
6396
+ }, "Found roles");
6234
6397
  const owners = [];
6235
6398
  const admins = [];
6236
6399
  const members = [];
@@ -6244,7 +6407,7 @@ var roleProvider = {
6244
6407
  continue;
6245
6408
  }
6246
6409
  if (!name || !username || !names2) {
6247
- logger17.warn(`User ${entityId} has no name or username, skipping`);
6410
+ logger13.warn({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, entityId }, "User has no name or username, skipping");
6248
6411
  continue;
6249
6412
  }
6250
6413
  switch (userRole) {
@@ -6317,7 +6480,7 @@ import {
6317
6480
  ChannelType as ChannelType7,
6318
6481
  findWorldsForOwner as findWorldsForOwner2,
6319
6482
  getWorldSettings as getWorldSettings2,
6320
- logger as logger18
6483
+ logger as logger14
6321
6484
  } from "@elizaos/core";
6322
6485
  var formatSettingValue = (setting, isOnboarding) => {
6323
6486
  if (setting.value === null)
@@ -6395,7 +6558,11 @@ ${requiredUnconfigured > 0 ? `IMPORTANT!: ${requiredUnconfigured} required setti
6395
6558
 
6396
6559
  `)}`;
6397
6560
  } catch (error) {
6398
- logger18.error(`Error generating status message: ${error}`);
6561
+ logger14.error({
6562
+ src: "plugin:bootstrap:provider:settings",
6563
+ agentId: runtime.agentId,
6564
+ error: error instanceof Error ? error.message : String(error)
6565
+ }, "Error generating status message");
6399
6566
  return "Error generating configuration status.";
6400
6567
  }
6401
6568
  }
@@ -6408,11 +6575,15 @@ var settingsProvider = {
6408
6575
  runtime.getRoom(message.roomId),
6409
6576
  findWorldsForOwner2(runtime, message.entityId)
6410
6577
  ]).catch((error) => {
6411
- logger18.error(`Error fetching initial data: ${error}`);
6578
+ logger14.error({
6579
+ src: "plugin:bootstrap:provider:settings",
6580
+ agentId: runtime.agentId,
6581
+ error: error instanceof Error ? error.message : String(error)
6582
+ }, "Error fetching initial data");
6412
6583
  throw new Error("Failed to retrieve room or user world information");
6413
6584
  });
6414
6585
  if (!room) {
6415
- logger18.error("No room found for settings provider");
6586
+ logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No room found for settings provider");
6416
6587
  return {
6417
6588
  data: {
6418
6589
  settings: []
@@ -6424,7 +6595,7 @@ var settingsProvider = {
6424
6595
  };
6425
6596
  }
6426
6597
  if (!room.worldId) {
6427
- logger18.debug("No world found for settings provider -- settings provider will be skipped");
6598
+ logger14.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for settings provider -- settings provider will be skipped");
6428
6599
  return {
6429
6600
  data: {
6430
6601
  settings: []
@@ -6449,39 +6620,66 @@ var settingsProvider = {
6449
6620
  }
6450
6621
  world.metadata.settings = {};
6451
6622
  await runtime.updateWorld(world);
6452
- logger18.info(`Initialized settings for user's world ${world.id}`);
6623
+ logger14.info({
6624
+ src: "plugin:bootstrap:provider:settings",
6625
+ agentId: runtime.agentId,
6626
+ worldId: world.id
6627
+ }, "Initialized settings for user world");
6453
6628
  }
6454
6629
  if (!world) {
6455
- logger18.error("No world found for user during onboarding");
6630
+ logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for user during onboarding");
6456
6631
  throw new Error("No server ownership found for onboarding");
6457
6632
  }
6458
- serverId = world.serverId;
6459
- try {
6460
- worldSettings = await getWorldSettings2(runtime, serverId);
6461
- } catch (error) {
6462
- logger18.error(`Error fetching world settings: ${error}`);
6463
- throw new Error(`Failed to retrieve settings for server ${serverId}`);
6633
+ serverId = world.messageServerId;
6634
+ if (serverId) {
6635
+ try {
6636
+ worldSettings = await getWorldSettings2(runtime, serverId);
6637
+ } catch (error) {
6638
+ logger14.error({
6639
+ src: "plugin:bootstrap:provider:settings",
6640
+ agentId: runtime.agentId,
6641
+ serverId,
6642
+ error: error instanceof Error ? error.message : String(error)
6643
+ }, "Error fetching world settings");
6644
+ throw new Error(`Failed to retrieve settings for server ${serverId}`);
6645
+ }
6464
6646
  }
6465
6647
  } else {
6466
6648
  try {
6467
6649
  world = await runtime.getWorld(room.worldId);
6468
6650
  if (!world) {
6469
- logger18.error(`No world found for room ${room.worldId}`);
6651
+ logger14.error({
6652
+ src: "plugin:bootstrap:provider:settings",
6653
+ agentId: runtime.agentId,
6654
+ worldId: room.worldId
6655
+ }, "No world found for room");
6470
6656
  throw new Error(`No world found for room ${room.worldId}`);
6471
6657
  }
6472
- serverId = world.serverId;
6658
+ serverId = world.messageServerId;
6473
6659
  if (serverId) {
6474
6660
  worldSettings = await getWorldSettings2(runtime, serverId);
6475
6661
  } else {
6476
- logger18.error(`No server ID found for world ${room.worldId}`);
6662
+ logger14.error({
6663
+ src: "plugin:bootstrap:provider:settings",
6664
+ agentId: runtime.agentId,
6665
+ worldId: room.worldId
6666
+ }, "No server ID found for world");
6477
6667
  }
6478
6668
  } catch (error) {
6479
- logger18.error(`Error processing world data: ${error}`);
6669
+ logger14.error({
6670
+ src: "plugin:bootstrap:provider:settings",
6671
+ agentId: runtime.agentId,
6672
+ error: error instanceof Error ? error.message : String(error)
6673
+ }, "Error processing world data");
6480
6674
  throw new Error("Failed to process world information");
6481
6675
  }
6482
6676
  }
6483
6677
  if (!serverId) {
6484
- logger18.info(`No server ownership found for user ${message.entityId} after recovery attempt`);
6678
+ logger14.info({
6679
+ src: "plugin:bootstrap:provider:settings",
6680
+ agentId: runtime.agentId,
6681
+ entityId: message.entityId
6682
+ }, "No server ownership found for user after recovery attempt");
6485
6683
  return isOnboarding ? {
6486
6684
  data: {
6487
6685
  settings: []
@@ -6501,7 +6699,7 @@ var settingsProvider = {
6501
6699
  };
6502
6700
  }
6503
6701
  if (!worldSettings) {
6504
- logger18.info(`No settings state found for server ${serverId}`);
6702
+ logger14.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId }, "No settings state found for server");
6505
6703
  return isOnboarding ? {
6506
6704
  data: {
6507
6705
  settings: []
@@ -6531,7 +6729,11 @@ var settingsProvider = {
6531
6729
  text: output
6532
6730
  };
6533
6731
  } catch (error) {
6534
- logger18.error(`Critical error in settings provider: ${error}`);
6732
+ logger14.error({
6733
+ src: "plugin:bootstrap:provider:settings",
6734
+ agentId: runtime.agentId,
6735
+ error: error instanceof Error ? error.message : String(error)
6736
+ }, "Critical error in settings provider");
6535
6737
  return {
6536
6738
  data: {
6537
6739
  settings: []
@@ -6568,7 +6770,7 @@ var timeProvider = {
6568
6770
  };
6569
6771
  // src/providers/world.ts
6570
6772
  import {
6571
- logger as logger19,
6773
+ logger as logger15,
6572
6774
  addHeader as addHeader10,
6573
6775
  ChannelType as ChannelType8
6574
6776
  } from "@elizaos/core";
@@ -6578,10 +6780,18 @@ var worldProvider = {
6578
6780
  dynamic: true,
6579
6781
  get: async (runtime, message) => {
6580
6782
  try {
6581
- logger19.debug({ roomId: message.roomId }, "[\uD83C\uDF10] World provider activated for roomId:");
6783
+ logger15.debug({
6784
+ src: "plugin:bootstrap:provider:world",
6785
+ agentId: runtime.agentId,
6786
+ roomId: message.roomId
6787
+ }, "World provider activated");
6582
6788
  const currentRoom = await runtime.getRoom(message.roomId);
6583
6789
  if (!currentRoom) {
6584
- logger19.warn(`World provider: Room not found for roomId ${message.roomId}`);
6790
+ logger15.warn({
6791
+ src: "plugin:bootstrap:provider:world",
6792
+ agentId: runtime.agentId,
6793
+ roomId: message.roomId
6794
+ }, "Room not found");
6585
6795
  return {
6586
6796
  data: {
6587
6797
  world: {
@@ -6591,10 +6801,19 @@ var worldProvider = {
6591
6801
  text: "Unable to retrieve world information - room not found"
6592
6802
  };
6593
6803
  }
6594
- logger19.debug(`[\uD83C\uDF10] World provider: Found room "${currentRoom.name}" (${currentRoom.type})`);
6804
+ logger15.debug({
6805
+ src: "plugin:bootstrap:provider:world",
6806
+ agentId: runtime.agentId,
6807
+ roomName: currentRoom.name,
6808
+ roomType: currentRoom.type
6809
+ }, "Found room");
6595
6810
  const worldId = currentRoom.worldId;
6596
6811
  if (!worldId) {
6597
- logger19.warn(`World provider: World ID not found for roomId ${message.roomId}`);
6812
+ logger15.warn({
6813
+ src: "plugin:bootstrap:provider:world",
6814
+ agentId: runtime.agentId,
6815
+ roomId: message.roomId
6816
+ }, "World ID not found");
6598
6817
  return {
6599
6818
  data: {
6600
6819
  world: {
@@ -6606,7 +6825,7 @@ var worldProvider = {
6606
6825
  }
6607
6826
  const world = await runtime.getWorld(worldId);
6608
6827
  if (!world) {
6609
- logger19.warn(`World provider: World not found for worldId ${worldId}`);
6828
+ logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, worldId }, "World not found");
6610
6829
  return {
6611
6830
  data: {
6612
6831
  world: {
@@ -6616,11 +6835,26 @@ var worldProvider = {
6616
6835
  text: "Unable to retrieve world information - world not found"
6617
6836
  };
6618
6837
  }
6619
- logger19.debug(`[\uD83C\uDF10] World provider: Found world "${world.name}" (ID: ${world.id})`);
6838
+ logger15.debug({
6839
+ src: "plugin:bootstrap:provider:world",
6840
+ agentId: runtime.agentId,
6841
+ worldName: world.name,
6842
+ worldId: world.id
6843
+ }, "Found world");
6620
6844
  const worldRooms = await runtime.getRooms(worldId);
6621
- logger19.debug(`[\uD83C\uDF10] World provider: Found ${worldRooms.length} rooms in world "${world.name}"`);
6845
+ logger15.debug({
6846
+ src: "plugin:bootstrap:provider:world",
6847
+ agentId: runtime.agentId,
6848
+ roomCount: worldRooms.length,
6849
+ worldName: world.name
6850
+ }, "Found rooms in world");
6622
6851
  const participants = await runtime.getParticipantsForRoom(message.roomId);
6623
- logger19.debug(`[\uD83C\uDF10] World provider: Found ${participants.length} participants in room "${currentRoom.name}"`);
6852
+ logger15.debug({
6853
+ src: "plugin:bootstrap:provider:world",
6854
+ agentId: runtime.agentId,
6855
+ participantCount: participants.length,
6856
+ roomName: currentRoom.name
6857
+ }, "Found participants in room");
6624
6858
  const channelsByType = {
6625
6859
  text: [],
6626
6860
  voice: [],
@@ -6631,7 +6865,7 @@ var worldProvider = {
6631
6865
  };
6632
6866
  for (const room of worldRooms) {
6633
6867
  if (!room?.id || !room.name) {
6634
- logger19.warn(`World provider: Room ID or name is missing for room ${room.id}`);
6868
+ logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: room?.id }, "Room ID or name is missing");
6635
6869
  continue;
6636
6870
  }
6637
6871
  const roomInfo = {
@@ -6674,7 +6908,7 @@ var worldProvider = {
6674
6908
  world: {
6675
6909
  id: world.id,
6676
6910
  name: world.name,
6677
- serverId: world.serverId,
6911
+ serverId: world.messageServerId,
6678
6912
  metadata: world.metadata || {},
6679
6913
  currentRoom: {
6680
6914
  id: currentRoom.id,
@@ -6701,14 +6935,18 @@ var worldProvider = {
6701
6935
  worldInfo: worldInfoText
6702
6936
  };
6703
6937
  const formattedText = addHeader10("# World Information", worldInfoText);
6704
- logger19.debug("[\uD83C\uDF10] World provider completed successfully");
6938
+ logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId }, "World provider completed successfully");
6705
6939
  return {
6706
6940
  data,
6707
6941
  values,
6708
6942
  text: formattedText
6709
6943
  };
6710
6944
  } catch (error) {
6711
- logger19.error(`Error in world provider: ${error instanceof Error ? error.message : String(error)}`);
6945
+ logger15.error({
6946
+ src: "plugin:bootstrap:provider:world",
6947
+ agentId: runtime.agentId,
6948
+ error: error instanceof Error ? error.message : String(error)
6949
+ }, "Error in world provider");
6712
6950
  return {
6713
6951
  data: {
6714
6952
  world: {
@@ -6723,7 +6961,6 @@ var worldProvider = {
6723
6961
  };
6724
6962
  // src/services/task.ts
6725
6963
  import {
6726
- logger as logger20,
6727
6964
  Service,
6728
6965
  ServiceType
6729
6966
  } from "@elizaos/core";
@@ -6742,21 +6979,21 @@ class TaskService extends Service {
6742
6979
  this.runtime.registerTaskWorker({
6743
6980
  name: "REPEATING_TEST_TASK",
6744
6981
  validate: async (_runtime, _message, _state) => {
6745
- logger20.debug("[Bootstrap] Validating repeating test task");
6982
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Validating repeating test task");
6746
6983
  return true;
6747
6984
  },
6748
6985
  execute: async (_runtime, _options) => {
6749
- logger20.debug("[Bootstrap] Executing repeating test task");
6986
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Executing repeating test task");
6750
6987
  }
6751
6988
  });
6752
6989
  this.runtime.registerTaskWorker({
6753
6990
  name: "ONETIME_TEST_TASK",
6754
6991
  validate: async (_runtime, _message, _state) => {
6755
- logger20.debug("[Bootstrap] Validating one-time test task");
6992
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Validating one-time test task");
6756
6993
  return true;
6757
6994
  },
6758
6995
  execute: async (_runtime, _options) => {
6759
- logger20.debug("[Bootstrap] Executing one-time test task");
6996
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Executing one-time test task");
6760
6997
  }
6761
6998
  });
6762
6999
  const tasks = await this.runtime.getTasksByName("REPEATING_TEST_TASK");
@@ -6788,7 +7025,11 @@ class TaskService extends Service {
6788
7025
  try {
6789
7026
  await this.checkTasks();
6790
7027
  } catch (error) {
6791
- logger20.error({ error }, "[Bootstrap] Error checking tasks:");
7028
+ this.runtime.logger.error({
7029
+ src: "plugin:bootstrap:service:task",
7030
+ agentId: this.runtime.agentId,
7031
+ error: error instanceof Error ? error.message : String(error)
7032
+ }, "Error in task timer");
6792
7033
  }
6793
7034
  }, this.TICK_INTERVAL);
6794
7035
  }
@@ -6809,7 +7050,12 @@ class TaskService extends Service {
6809
7050
  continue;
6810
7051
  }
6811
7052
  } catch (error) {
6812
- logger20.error({ error, taskName: task.name }, `[Bootstrap] Error validating task ${task.name}:`);
7053
+ this.runtime.logger.error({
7054
+ src: "plugin:bootstrap:service:task",
7055
+ agentId: this.runtime.agentId,
7056
+ taskName: task.name,
7057
+ error: error instanceof Error ? error.message : String(error)
7058
+ }, "Error validating task");
6813
7059
  continue;
6814
7060
  }
6815
7061
  }
@@ -6849,29 +7095,46 @@ class TaskService extends Service {
6849
7095
  }
6850
7096
  if (task.metadata?.updatedAt === task.metadata?.createdAt) {
6851
7097
  if (task.tags?.includes("immediate")) {
6852
- logger20.debug("[Bootstrap] Immediately running task", task.name);
7098
+ this.runtime.logger.debug({
7099
+ src: "plugin:bootstrap:service:task",
7100
+ agentId: this.runtime.agentId,
7101
+ taskName: task.name
7102
+ }, "Immediately running task");
6853
7103
  await this.executeTask(task);
6854
7104
  continue;
6855
7105
  }
6856
7106
  }
6857
7107
  if (now - taskStartTime >= updateIntervalMs) {
6858
- logger20.debug(`[Bootstrap] Executing task ${task.name} - interval of ${updateIntervalMs}ms has elapsed`);
7108
+ this.runtime.logger.debug({
7109
+ src: "plugin:bootstrap:service:task",
7110
+ agentId: this.runtime.agentId,
7111
+ taskName: task.name,
7112
+ intervalMs: updateIntervalMs
7113
+ }, "Executing task - interval elapsed");
6859
7114
  await this.executeTask(task);
6860
7115
  }
6861
7116
  }
6862
7117
  } catch (error) {
6863
- logger20.error({ error }, "[Bootstrap] Error checking tasks:");
7118
+ this.runtime.logger.error({
7119
+ src: "plugin:bootstrap:service:task",
7120
+ agentId: this.runtime.agentId,
7121
+ error: error instanceof Error ? error.message : String(error)
7122
+ }, "Error checking tasks");
6864
7123
  }
6865
7124
  }
6866
7125
  async executeTask(task) {
6867
7126
  try {
6868
7127
  if (!task || !task.id) {
6869
- logger20.debug(`[Bootstrap] Task not found`);
7128
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Task not found");
6870
7129
  return;
6871
7130
  }
6872
7131
  const worker = this.runtime.getTaskWorker(task.name);
6873
7132
  if (!worker) {
6874
- logger20.debug(`[Bootstrap] No worker found for task type: ${task.name}`);
7133
+ this.runtime.logger.debug({
7134
+ src: "plugin:bootstrap:service:task",
7135
+ agentId: this.runtime.agentId,
7136
+ taskName: task.name
7137
+ }, "No worker found for task type");
6875
7138
  return;
6876
7139
  }
6877
7140
  if (task.tags?.includes("repeat")) {
@@ -6881,16 +7144,36 @@ class TaskService extends Service {
6881
7144
  updatedAt: Date.now()
6882
7145
  }
6883
7146
  });
6884
- logger20.debug(`[Bootstrap] Updated repeating task ${task.name} (${task.id}) with new timestamp`);
6885
- }
6886
- logger20.debug(`[Bootstrap] Executing task ${task.name} (${task.id})`);
7147
+ this.runtime.logger.debug({
7148
+ src: "plugin:bootstrap:service:task",
7149
+ agentId: this.runtime.agentId,
7150
+ taskName: task.name,
7151
+ taskId: task.id
7152
+ }, "Updated repeating task with new timestamp");
7153
+ }
7154
+ this.runtime.logger.debug({
7155
+ src: "plugin:bootstrap:service:task",
7156
+ agentId: this.runtime.agentId,
7157
+ taskName: task.name,
7158
+ taskId: task.id
7159
+ }, "Executing task");
6887
7160
  await worker.execute(this.runtime, task.metadata || {}, task);
6888
7161
  if (!task.tags?.includes("repeat")) {
6889
7162
  await this.runtime.deleteTask(task.id);
6890
- logger20.debug(`[Bootstrap] Deleted non-repeating task ${task.name} (${task.id}) after execution`);
7163
+ this.runtime.logger.debug({
7164
+ src: "plugin:bootstrap:service:task",
7165
+ agentId: this.runtime.agentId,
7166
+ taskName: task.name,
7167
+ taskId: task.id
7168
+ }, "Deleted non-repeating task after execution");
6891
7169
  }
6892
7170
  } catch (error) {
6893
- logger20.error({ error, taskId: task.id }, `[Bootstrap] Error executing task ${task.id}:`);
7171
+ this.runtime.logger.error({
7172
+ src: "plugin:bootstrap:service:task",
7173
+ agentId: this.runtime.agentId,
7174
+ taskId: task.id,
7175
+ error: error instanceof Error ? error.message : String(error)
7176
+ }, "Error executing task");
6894
7177
  }
6895
7178
  }
6896
7179
  static async stop(runtime) {
@@ -6911,8 +7194,7 @@ class TaskService extends Service {
6911
7194
  import {
6912
7195
  Service as Service2,
6913
7196
  EventType,
6914
- ModelType as ModelType14,
6915
- logger as logger21
7197
+ ModelType as ModelType14
6916
7198
  } from "@elizaos/core";
6917
7199
 
6918
7200
  class EmbeddingGenerationService extends Service2 {
@@ -6926,10 +7208,10 @@ class EmbeddingGenerationService extends Service2 {
6926
7208
  processingIntervalMs = 100;
6927
7209
  isDisabled = false;
6928
7210
  static async start(runtime) {
6929
- logger21.info("[EmbeddingService] Starting embedding generation service");
7211
+ runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: runtime.agentId }, "Starting embedding generation service");
6930
7212
  const embeddingModel = runtime.getModel(ModelType14.TEXT_EMBEDDING);
6931
7213
  if (!embeddingModel) {
6932
- logger21.warn("[EmbeddingService] No TEXT_EMBEDDING model registered. Embedding service will not be initialized.");
7214
+ runtime.logger.warn({ src: "plugin:bootstrap:service:embedding", agentId: runtime.agentId }, "No TEXT_EMBEDDING model registered - service will not be initialized");
6933
7215
  const noOpService = new EmbeddingGenerationService(runtime);
6934
7216
  noOpService.isDisabled = true;
6935
7217
  return noOpService;
@@ -6940,25 +7222,34 @@ class EmbeddingGenerationService extends Service2 {
6940
7222
  }
6941
7223
  async initialize() {
6942
7224
  if (this.isDisabled) {
6943
- logger21.debug("[EmbeddingService] Service is disabled, skipping initialization");
7225
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, skipping initialization");
6944
7226
  return;
6945
7227
  }
6946
- logger21.info("[EmbeddingService] Initializing embedding generation service");
7228
+ this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Initializing embedding generation service");
6947
7229
  this.runtime.registerEvent(EventType.EMBEDDING_GENERATION_REQUESTED, this.handleEmbeddingRequest.bind(this));
6948
7230
  this.startProcessing();
6949
7231
  }
6950
7232
  async handleEmbeddingRequest(payload) {
6951
7233
  if (this.isDisabled) {
6952
- logger21.debug("[EmbeddingService] Service is disabled, skipping embedding request");
7234
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, skipping embedding request");
6953
7235
  return;
6954
7236
  }
6955
7237
  const { memory, priority = "normal", retryCount = 0, maxRetries = 3, runId } = payload;
6956
7238
  if (memory.embedding) {
6957
- logger21.debug("[EmbeddingService] Memory already has embeddings, skipping");
7239
+ this.runtime.logger.debug({
7240
+ src: "plugin:bootstrap:service:embedding",
7241
+ agentId: this.runtime.agentId,
7242
+ memoryId: memory.id
7243
+ }, "Memory already has embeddings, skipping");
6958
7244
  return;
6959
7245
  }
6960
7246
  if (this.queue.length >= this.maxQueueSize) {
6961
- logger21.warn(`[EmbeddingService] Queue is full (${this.queue.length}/${this.maxQueueSize}), making room`);
7247
+ this.runtime.logger.warn({
7248
+ src: "plugin:bootstrap:service:embedding",
7249
+ agentId: this.runtime.agentId,
7250
+ queueSize: this.queue.length,
7251
+ maxSize: this.maxQueueSize
7252
+ }, "Queue is full, making room");
6962
7253
  this.makeRoomInQueue();
6963
7254
  }
6964
7255
  const queueItem = {
@@ -6970,7 +7261,11 @@ class EmbeddingGenerationService extends Service2 {
6970
7261
  runId
6971
7262
  };
6972
7263
  this.insertItemByPriority(queueItem);
6973
- logger21.debug(`[EmbeddingService] Added memory to queue. Queue size: ${this.queue.length}`);
7264
+ this.runtime.logger.debug({
7265
+ src: "plugin:bootstrap:service:embedding",
7266
+ agentId: this.runtime.agentId,
7267
+ queueSize: this.queue.length
7268
+ }, "Added memory to queue");
6974
7269
  }
6975
7270
  makeRoomInQueue() {
6976
7271
  const tenPercent = Math.floor(this.maxQueueSize * 0.1);
@@ -6987,7 +7282,12 @@ class EmbeddingGenerationService extends Service2 {
6987
7282
  const newQueue = this.queue.filter((_, index) => !indicesToRemove.has(index));
6988
7283
  const removedCount = this.queue.length - newQueue.length;
6989
7284
  this.queue = newQueue;
6990
- logger21.info(`[EmbeddingService] Removed ${removedCount} items from queue. New size: ${this.queue.length}`);
7285
+ this.runtime.logger.info({
7286
+ src: "plugin:bootstrap:service:embedding",
7287
+ agentId: this.runtime.agentId,
7288
+ removedCount,
7289
+ newSize: this.queue.length
7290
+ }, "Removed items from queue");
6991
7291
  }
6992
7292
  insertItemByPriority(queueItem) {
6993
7293
  if (queueItem.priority === "high") {
@@ -7021,7 +7321,7 @@ class EmbeddingGenerationService extends Service2 {
7021
7321
  }
7022
7322
  startProcessing() {
7023
7323
  if (this.isDisabled) {
7024
- logger21.debug("[EmbeddingService] Service is disabled, not starting processing loop");
7324
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, not starting processing loop");
7025
7325
  return;
7026
7326
  }
7027
7327
  if (this.processingInterval) {
@@ -7032,7 +7332,7 @@ class EmbeddingGenerationService extends Service2 {
7032
7332
  await this.processQueue();
7033
7333
  }
7034
7334
  }, this.processingIntervalMs);
7035
- logger21.info("[EmbeddingService] Started processing loop");
7335
+ this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Started processing loop");
7036
7336
  }
7037
7337
  async processQueue() {
7038
7338
  if (this.isProcessing || this.queue.length === 0) {
@@ -7041,16 +7341,31 @@ class EmbeddingGenerationService extends Service2 {
7041
7341
  this.isProcessing = true;
7042
7342
  try {
7043
7343
  const batch = this.queue.splice(0, Math.min(this.batchSize, this.queue.length));
7044
- logger21.debug(`[EmbeddingService] Processing batch of ${batch.length} items. Remaining in queue: ${this.queue.length}`);
7344
+ this.runtime.logger.debug({
7345
+ src: "plugin:bootstrap:service:embedding",
7346
+ agentId: this.runtime.agentId,
7347
+ batchSize: batch.length,
7348
+ remaining: this.queue.length
7349
+ }, "Processing batch");
7045
7350
  const promises = batch.map(async (item) => {
7046
7351
  try {
7047
7352
  await this.generateEmbedding(item);
7048
7353
  } catch (error) {
7049
- logger21.error({ error, memoryId: item.memory.id }, "[EmbeddingService] Error processing item:");
7354
+ this.runtime.logger.error({
7355
+ src: "plugin:bootstrap:service:embedding",
7356
+ agentId: this.runtime.agentId,
7357
+ memoryId: item.memory.id,
7358
+ error: error instanceof Error ? error.message : String(error)
7359
+ }, "Error processing item");
7050
7360
  if (item.retryCount < item.maxRetries) {
7051
7361
  item.retryCount++;
7052
7362
  this.insertItemByPriority(item);
7053
- logger21.debug(`[EmbeddingService] Re-queued item for retry (${item.retryCount}/${item.maxRetries})`);
7363
+ this.runtime.logger.debug({
7364
+ src: "plugin:bootstrap:service:embedding",
7365
+ agentId: this.runtime.agentId,
7366
+ retryCount: item.retryCount,
7367
+ maxRetries: item.maxRetries
7368
+ }, "Re-queued item for retry");
7054
7369
  } else {
7055
7370
  await this.runtime.log({
7056
7371
  entityId: this.runtime.agentId,
@@ -7081,7 +7396,11 @@ class EmbeddingGenerationService extends Service2 {
7081
7396
  async generateEmbedding(item) {
7082
7397
  const { memory } = item;
7083
7398
  if (!memory.content?.text) {
7084
- logger21.warn({ memoryId: memory.id }, "[EmbeddingService] Memory has no text content");
7399
+ this.runtime.logger.warn({
7400
+ src: "plugin:bootstrap:service:embedding",
7401
+ agentId: this.runtime.agentId,
7402
+ memoryId: memory.id
7403
+ }, "Memory has no text content");
7085
7404
  return;
7086
7405
  }
7087
7406
  try {
@@ -7090,7 +7409,12 @@ class EmbeddingGenerationService extends Service2 {
7090
7409
  text: memory.content.text
7091
7410
  });
7092
7411
  const duration = Date.now() - startTime;
7093
- logger21.debug(`[EmbeddingService] Generated embedding in ${duration}ms for memory ${memory.id}`);
7412
+ this.runtime.logger.debug({
7413
+ src: "plugin:bootstrap:service:embedding",
7414
+ agentId: this.runtime.agentId,
7415
+ memoryId: memory.id,
7416
+ durationMs: duration
7417
+ }, "Generated embedding");
7094
7418
  if (memory.id) {
7095
7419
  await this.runtime.updateMemory({
7096
7420
  id: memory.id,
@@ -7115,14 +7439,19 @@ class EmbeddingGenerationService extends Service2 {
7115
7439
  });
7116
7440
  }
7117
7441
  } catch (error) {
7118
- logger21.error({ error, memoryId: memory.id }, "[EmbeddingService] Failed to generate embedding:");
7442
+ this.runtime.logger.error({
7443
+ src: "plugin:bootstrap:service:embedding",
7444
+ agentId: this.runtime.agentId,
7445
+ memoryId: memory.id,
7446
+ error: error instanceof Error ? error.message : String(error)
7447
+ }, "Failed to generate embedding");
7119
7448
  throw error;
7120
7449
  }
7121
7450
  }
7122
7451
  async stop() {
7123
- logger21.info("[EmbeddingService] Stopping embedding generation service");
7452
+ this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Stopping embedding generation service");
7124
7453
  if (this.isDisabled) {
7125
- logger21.debug("[EmbeddingService] Service is disabled, nothing to stop");
7454
+ this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, nothing to stop");
7126
7455
  return;
7127
7456
  }
7128
7457
  if (this.processingInterval) {
@@ -7131,16 +7460,28 @@ class EmbeddingGenerationService extends Service2 {
7131
7460
  }
7132
7461
  const highPriorityItems = this.queue.filter((item) => item.priority === "high");
7133
7462
  if (highPriorityItems.length > 0) {
7134
- logger21.info(`[EmbeddingService] Processing ${highPriorityItems.length} high priority items before shutdown`);
7463
+ this.runtime.logger.info({
7464
+ src: "plugin:bootstrap:service:embedding",
7465
+ agentId: this.runtime.agentId,
7466
+ count: highPriorityItems.length
7467
+ }, "Processing high priority items before shutdown");
7135
7468
  for (const item of highPriorityItems) {
7136
7469
  try {
7137
7470
  await this.generateEmbedding(item);
7138
7471
  } catch (error) {
7139
- logger21.error({ error }, "[EmbeddingService] Error during shutdown processing:");
7472
+ this.runtime.logger.error({
7473
+ src: "plugin:bootstrap:service:embedding",
7474
+ agentId: this.runtime.agentId,
7475
+ error: error instanceof Error ? error.message : String(error)
7476
+ }, "Error during shutdown processing");
7140
7477
  }
7141
7478
  }
7142
7479
  }
7143
- logger21.info(`[EmbeddingService] Stopped. ${this.queue.length} items remaining in queue`);
7480
+ this.runtime.logger.info({
7481
+ src: "plugin:bootstrap:service:embedding",
7482
+ agentId: this.runtime.agentId,
7483
+ remainingItems: this.queue.length
7484
+ }, "Stopped");
7144
7485
  }
7145
7486
  getQueueSize() {
7146
7487
  return this.queue.length;
@@ -7160,7 +7501,11 @@ class EmbeddingGenerationService extends Service2 {
7160
7501
  clearQueue() {
7161
7502
  const size = this.queue.length;
7162
7503
  this.queue = [];
7163
- logger21.info(`[EmbeddingService] Cleared ${size} items from queue`);
7504
+ this.runtime.logger.info({
7505
+ src: "plugin:bootstrap:service:embedding",
7506
+ agentId: this.runtime.agentId,
7507
+ clearedCount: size
7508
+ }, "Cleared queue");
7164
7509
  }
7165
7510
  }
7166
7511
 
@@ -7183,7 +7528,7 @@ async function processAttachments(attachments, runtime) {
7183
7528
  if (!attachments || attachments.length === 0) {
7184
7529
  return [];
7185
7530
  }
7186
- runtime.logger.debug(`[Bootstrap] Processing ${attachments.length} attachment(s)`);
7531
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, count: attachments.length }, "Processing attachments");
7187
7532
  const processedAttachments = [];
7188
7533
  for (const attachment of attachments) {
7189
7534
  try {
@@ -7191,7 +7536,7 @@ async function processAttachments(attachments, runtime) {
7191
7536
  const isRemote = /^(http|https):\/\//.test(attachment.url);
7192
7537
  const url = isRemote ? attachment.url : getLocalServerUrl(attachment.url);
7193
7538
  if (attachment.contentType === ContentType2.IMAGE && !attachment.description) {
7194
- runtime.logger.debug(`[Bootstrap] Generating description for image: ${attachment.url}`);
7539
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url }, "Generating description for image");
7195
7540
  let imageUrl = url;
7196
7541
  if (!isRemote) {
7197
7542
  const res = await fetch(url);
@@ -7213,7 +7558,11 @@ async function processAttachments(attachments, runtime) {
7213
7558
  processedAttachment.description = parsedXml.description || "";
7214
7559
  processedAttachment.title = parsedXml.title || "Image";
7215
7560
  processedAttachment.text = parsedXml.text || parsedXml.description || "";
7216
- runtime.logger.debug(`[Bootstrap] Generated description: ${processedAttachment.description?.substring(0, 100)}...`);
7561
+ runtime.logger.debug({
7562
+ src: "plugin:bootstrap",
7563
+ agentId: runtime.agentId,
7564
+ descriptionPreview: processedAttachment.description?.substring(0, 100)
7565
+ }, "Generated description");
7217
7566
  } else {
7218
7567
  const responseStr = response;
7219
7568
  const titleMatch = responseStr.match(/<title>([^<]+)<\/title>/);
@@ -7223,21 +7572,33 @@ async function processAttachments(attachments, runtime) {
7223
7572
  processedAttachment.title = titleMatch?.[1] || "Image";
7224
7573
  processedAttachment.description = descMatch?.[1] || "";
7225
7574
  processedAttachment.text = textMatch?.[1] || descMatch?.[1] || "";
7226
- runtime.logger.debug(`[Bootstrap] Used fallback XML parsing - description: ${processedAttachment.description?.substring(0, 100)}...`);
7575
+ runtime.logger.debug({
7576
+ src: "plugin:bootstrap",
7577
+ agentId: runtime.agentId,
7578
+ descriptionPreview: processedAttachment.description?.substring(0, 100)
7579
+ }, "Used fallback XML parsing");
7227
7580
  } else {
7228
- runtime.logger.warn(`[Bootstrap] Failed to parse XML response for image description`);
7581
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Failed to parse XML response for image description");
7229
7582
  }
7230
7583
  }
7231
7584
  } else if (response && typeof response === "object" && "description" in response) {
7232
7585
  processedAttachment.description = response.description;
7233
7586
  processedAttachment.title = response.title || "Image";
7234
7587
  processedAttachment.text = response.description;
7235
- runtime.logger.debug(`[Bootstrap] Generated description: ${processedAttachment.description?.substring(0, 100)}...`);
7588
+ runtime.logger.debug({
7589
+ src: "plugin:bootstrap",
7590
+ agentId: runtime.agentId,
7591
+ descriptionPreview: processedAttachment.description?.substring(0, 100)
7592
+ }, "Generated description");
7236
7593
  } else {
7237
- runtime.logger.warn(`[Bootstrap] Unexpected response format for image description`);
7594
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Unexpected response format for image description");
7238
7595
  }
7239
7596
  } catch (error) {
7240
- runtime.logger.error({ error }, `[Bootstrap] Error generating image description:`);
7597
+ runtime.logger.error({
7598
+ src: "plugin:bootstrap",
7599
+ agentId: runtime.agentId,
7600
+ error: error instanceof Error ? error.message : String(error)
7601
+ }, "Error generating image description");
7241
7602
  }
7242
7603
  } else if (attachment.contentType === ContentType2.DOCUMENT && !attachment.text) {
7243
7604
  const res = await fetch(url);
@@ -7246,18 +7607,27 @@ async function processAttachments(attachments, runtime) {
7246
7607
  const contentType = res.headers.get("content-type") || "";
7247
7608
  const isPlainText = contentType.startsWith("text/plain");
7248
7609
  if (isPlainText) {
7249
- runtime.logger.debug(`[Bootstrap] Processing plain text document: ${attachment.url}`);
7610
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url }, "Processing plain text document");
7250
7611
  const textContent = await res.text();
7251
7612
  processedAttachment.text = textContent;
7252
7613
  processedAttachment.title = processedAttachment.title || "Text File";
7253
- runtime.logger.debug(`[Bootstrap] Extracted text content (first 100 chars): ${processedAttachment.text?.substring(0, 100)}...`);
7614
+ runtime.logger.debug({
7615
+ src: "plugin:bootstrap",
7616
+ agentId: runtime.agentId,
7617
+ textPreview: processedAttachment.text?.substring(0, 100)
7618
+ }, "Extracted text content");
7254
7619
  } else {
7255
- runtime.logger.warn(`[Bootstrap] Skipping non-plain-text document: ${contentType}`);
7620
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, contentType }, "Skipping non-plain-text document");
7256
7621
  }
7257
7622
  }
7258
7623
  processedAttachments.push(processedAttachment);
7259
7624
  } catch (error) {
7260
- runtime.logger.error({ error, attachmentUrl: attachment.url }, `[Bootstrap] Failed to process attachment ${attachment.url}:`);
7625
+ runtime.logger.error({
7626
+ src: "plugin:bootstrap",
7627
+ agentId: runtime.agentId,
7628
+ attachmentUrl: attachment.url,
7629
+ error: error instanceof Error ? error.message : String(error)
7630
+ }, "Failed to process attachment");
7261
7631
  processedAttachments.push(attachment);
7262
7632
  }
7263
7633
  }
@@ -7311,10 +7681,14 @@ var reactionReceivedHandler = async ({
7311
7681
  await runtime.createMemory(message, "messages");
7312
7682
  } catch (error) {
7313
7683
  if (error.code === "23505") {
7314
- runtime.logger.warn("[Bootstrap] Duplicate reaction memory, skipping");
7684
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Duplicate reaction memory, skipping");
7315
7685
  return;
7316
7686
  }
7317
- runtime.logger.error({ error }, "[Bootstrap] Error in reaction handler:");
7687
+ runtime.logger.error({
7688
+ src: "plugin:bootstrap",
7689
+ agentId: runtime.agentId,
7690
+ error: error instanceof Error ? error.message : String(error)
7691
+ }, "Error in reaction handler");
7318
7692
  }
7319
7693
  };
7320
7694
  var postGeneratedHandler = async ({
@@ -7325,12 +7699,12 @@ var postGeneratedHandler = async ({
7325
7699
  roomId,
7326
7700
  source
7327
7701
  }) => {
7328
- runtime.logger.info("[Bootstrap] Generating new post...");
7702
+ runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Generating new post");
7329
7703
  await runtime.ensureWorldExists({
7330
7704
  id: worldId,
7331
7705
  name: `${runtime.character.name}'s Feed`,
7332
7706
  agentId: runtime.agentId,
7333
- serverId: userId
7707
+ messageServerId: userId
7334
7708
  });
7335
7709
  await runtime.ensureRoomExists({
7336
7710
  id: roomId,
@@ -7338,7 +7712,7 @@ var postGeneratedHandler = async ({
7338
7712
  source,
7339
7713
  type: ChannelType9.FEED,
7340
7714
  channelId: `${userId}-home`,
7341
- serverId: userId,
7715
+ messageServerId: userId,
7342
7716
  worldId
7343
7717
  });
7344
7718
  const message = {
@@ -7387,8 +7761,7 @@ var postGeneratedHandler = async ({
7387
7761
  }
7388
7762
  retries++;
7389
7763
  if (!responseContent?.thought || !responseContent?.actions) {
7390
- runtime.logger.warn(`[Bootstrap] *** Missing required fields, retrying... ***
7391
- `, response, parsedXml, responseContent);
7764
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, response, parsedXml, responseContent }, "Missing required fields, retrying");
7392
7765
  }
7393
7766
  }
7394
7767
  state = await runtime.composeState(message, responseContent?.providers);
@@ -7401,7 +7774,7 @@ var postGeneratedHandler = async ({
7401
7774
  });
7402
7775
  const parsedXmlResponse = parseKeyValueXml9(xmlResponseText);
7403
7776
  if (!parsedXmlResponse) {
7404
- runtime.logger.error("[Bootstrap] Failed to parse XML response for post creation. Raw response:", xmlResponseText);
7777
+ runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, xmlResponseText }, "Failed to parse XML response for post creation");
7405
7778
  return;
7406
7779
  }
7407
7780
  function cleanupPostText(text) {
@@ -7419,7 +7792,7 @@ $2`);
7419
7792
  if (RM) {
7420
7793
  for (const m of RM.data.recentMessages) {
7421
7794
  if (cleanedText === m.content.text) {
7422
- runtime.logger.info({ cleanedText }, "[Bootstrap] Already recently posted that, retrying");
7795
+ runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, cleanedText }, "Already recently posted that, retrying");
7423
7796
  postGeneratedHandler({
7424
7797
  runtime,
7425
7798
  callback,
@@ -7437,7 +7810,7 @@ $2`);
7437
7810
  const googleRefusalRegex = /(i\s+can'?t\s+help\s+with\s+that|that\s+goes\s+against\s+(our\s+)?(policy|policies)|i'?m\s+still\s+learning|response\s+must\s+follow\s+(usage|safety)\s+policies|i'?ve\s+been\s+designed\s+to\s+avoid\s+that)/i;
7438
7811
  const generalRefusalRegex = /(response\s+was\s+withheld|content\s+was\s+filtered|this\s+request\s+cannot\s+be\s+completed|violates\s+our\s+safety\s+policy|content\s+is\s+not\s+available)/i;
7439
7812
  if (oaiRefusalRegex.test(cleanedText) || anthropicRefusalRegex.test(cleanedText) || googleRefusalRegex.test(cleanedText) || generalRefusalRegex.test(cleanedText)) {
7440
- runtime.logger.info({ cleanedText }, "[Bootstrap] Got prompt moderation refusal, retrying");
7813
+ runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, cleanedText }, "Got prompt moderation refusal, retrying");
7441
7814
  postGeneratedHandler({
7442
7815
  runtime,
7443
7816
  callback,
@@ -7468,16 +7841,21 @@ $2`);
7468
7841
  await callback?.(message2.content);
7469
7842
  }
7470
7843
  };
7471
- var syncSingleUser = async (entityId, runtime, serverId, channelId, type, source) => {
7844
+ var syncSingleUser = async (entityId, runtime, messageServerId, channelId, type, source) => {
7472
7845
  try {
7473
7846
  const entity = await runtime.getEntityById(entityId);
7474
- runtime.logger.info(`[Bootstrap] Syncing user: ${entity?.metadata?.username || entityId}`);
7847
+ runtime.logger.info({
7848
+ src: "plugin:bootstrap",
7849
+ agentId: runtime.agentId,
7850
+ entityId,
7851
+ username: entity?.metadata?.username
7852
+ }, "Syncing user");
7475
7853
  if (!channelId) {
7476
- runtime.logger.warn(`[Bootstrap] Cannot sync user ${entity?.id} without a valid channelId`);
7854
+ runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, entityId: entity?.id }, "Cannot sync user without a valid channelId");
7477
7855
  return;
7478
7856
  }
7479
7857
  const roomId = createUniqueUuid3(runtime, channelId);
7480
- const worldId = createUniqueUuid3(runtime, serverId);
7858
+ const worldId = createUniqueUuid3(runtime, messageServerId);
7481
7859
  const worldMetadata = type === ChannelType9.DM ? {
7482
7860
  ownership: {
7483
7861
  ownerId: entityId
@@ -7487,27 +7865,51 @@ var syncSingleUser = async (entityId, runtime, serverId, channelId, type, source
7487
7865
  },
7488
7866
  settings: {}
7489
7867
  } : undefined;
7490
- runtime.logger.info(`[Bootstrap] syncSingleUser - type: ${type}, isDM: ${type === ChannelType9.DM}, worldMetadata: ${JSON.stringify(worldMetadata)}`);
7868
+ runtime.logger.info({
7869
+ src: "plugin:bootstrap",
7870
+ agentId: runtime.agentId,
7871
+ type,
7872
+ isDM: type === ChannelType9.DM,
7873
+ worldMetadata
7874
+ }, "syncSingleUser");
7491
7875
  await runtime.ensureConnection({
7492
7876
  entityId,
7493
7877
  roomId,
7494
7878
  name: entity?.metadata?.name || entity?.metadata?.username || `User${entityId}`,
7495
7879
  source,
7496
7880
  channelId,
7497
- serverId,
7881
+ messageServerId,
7498
7882
  type,
7499
7883
  worldId,
7500
7884
  metadata: worldMetadata
7501
7885
  });
7502
7886
  try {
7503
7887
  const createdWorld = await runtime.getWorld(worldId);
7504
- runtime.logger.info(`[Bootstrap] Created world check - ID: ${worldId}, metadata: ${JSON.stringify(createdWorld?.metadata)}`);
7888
+ runtime.logger.info({
7889
+ src: "plugin:bootstrap",
7890
+ agentId: runtime.agentId,
7891
+ worldId,
7892
+ metadata: createdWorld?.metadata
7893
+ }, "Created world check");
7505
7894
  } catch (error) {
7506
- runtime.logger.error(`[Bootstrap] Failed to verify created world: ${error}`);
7895
+ runtime.logger.error({
7896
+ src: "plugin:bootstrap",
7897
+ agentId: runtime.agentId,
7898
+ error: error instanceof Error ? error.message : String(error)
7899
+ }, "Failed to verify created world");
7507
7900
  }
7508
- runtime.logger.success(`[Bootstrap] Successfully synced user: ${entity?.id}`);
7901
+ runtime.logger.success({
7902
+ src: "plugin:bootstrap",
7903
+ agentId: runtime.agentId,
7904
+ agentName: runtime.character.name,
7905
+ entityId: entity?.id
7906
+ }, "Successfully synced user");
7509
7907
  } catch (error) {
7510
- runtime.logger.error(`[Bootstrap] Error syncing user: ${error instanceof Error ? error.message : String(error)}`);
7908
+ runtime.logger.error({
7909
+ src: "plugin:bootstrap",
7910
+ agentId: runtime.agentId,
7911
+ error: error instanceof Error ? error.message : String(error)
7912
+ }, "Error syncing user");
7511
7913
  }
7512
7914
  };
7513
7915
  var handleServerSync = async ({
@@ -7518,13 +7920,17 @@ var handleServerSync = async ({
7518
7920
  source,
7519
7921
  onComplete
7520
7922
  }) => {
7521
- runtime.logger.debug(`[Bootstrap] Handling server sync event for server: ${world.name}`);
7923
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, serverName: world.name }, "Handling server sync event");
7522
7924
  try {
7523
7925
  await runtime.ensureConnections(entities, rooms, source, world);
7524
- runtime.logger.debug(`Successfully synced standardized world structure for ${world.name}`);
7926
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, worldName: world.name }, "Successfully synced standardized world structure");
7525
7927
  onComplete?.();
7526
7928
  } catch (error) {
7527
- runtime.logger.error(`Error processing standardized server data: ${error instanceof Error ? error.message : String(error)}`);
7929
+ runtime.logger.error({
7930
+ src: "plugin:bootstrap",
7931
+ agentId: runtime.agentId,
7932
+ error: error instanceof Error ? error.message : String(error)
7933
+ }, "Error processing standardized server data");
7528
7934
  }
7529
7935
  };
7530
7936
  var controlMessageHandler = async ({
@@ -7532,7 +7938,12 @@ var controlMessageHandler = async ({
7532
7938
  message
7533
7939
  }) => {
7534
7940
  try {
7535
- runtime.logger.debug(`[controlMessageHandler] Processing control message: ${message.payload.action} for room ${message.roomId}`);
7941
+ runtime.logger.debug({
7942
+ src: "plugin:bootstrap",
7943
+ agentId: runtime.agentId,
7944
+ action: message.payload.action,
7945
+ roomId: message.roomId
7946
+ }, "Processing control message");
7536
7947
  const serviceNames = Array.from(runtime.getAllServices().keys());
7537
7948
  const websocketServiceName = serviceNames.find((name) => name.toLowerCase().includes("websocket") || name.toLowerCase().includes("socket"));
7538
7949
  if (websocketServiceName) {
@@ -7546,15 +7957,19 @@ var controlMessageHandler = async ({
7546
7957
  roomId: message.roomId
7547
7958
  }
7548
7959
  });
7549
- runtime.logger.debug(`[controlMessageHandler] Control message ${message.payload.action} sent successfully`);
7960
+ runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, action: message.payload.action }, "Control message sent successfully");
7550
7961
  } else {
7551
- runtime.logger.error("[controlMessageHandler] WebSocket service does not have sendMessage method");
7962
+ runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId }, "WebSocket service does not have sendMessage method");
7552
7963
  }
7553
7964
  } else {
7554
- runtime.logger.error("[controlMessageHandler] No WebSocket service found to send control message");
7965
+ runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId }, "No WebSocket service found to send control message");
7555
7966
  }
7556
7967
  } catch (error) {
7557
- runtime.logger.error(`[controlMessageHandler] Error processing control message: ${error}`);
7968
+ runtime.logger.error({
7969
+ src: "plugin:bootstrap",
7970
+ agentId: runtime.agentId,
7971
+ error: error instanceof Error ? error.message : String(error)
7972
+ }, "Error processing control message");
7558
7973
  }
7559
7974
  };
7560
7975
  var events = {
@@ -7570,7 +7985,11 @@ var events = {
7570
7985
  ],
7571
7986
  [EventType2.MESSAGE_SENT]: [
7572
7987
  async (payload) => {
7573
- payload.runtime.logger.debug(`[Bootstrap] Message sent: ${payload.message.content.text}`);
7988
+ payload.runtime.logger.debug({
7989
+ src: "plugin:bootstrap",
7990
+ agentId: payload.runtime.agentId,
7991
+ text: payload.message.content.text
7992
+ }, "Message sent");
7574
7993
  }
7575
7994
  ],
7576
7995
  [EventType2.WORLD_JOINED]: [
@@ -7585,17 +8004,17 @@ var events = {
7585
8004
  ],
7586
8005
  [EventType2.ENTITY_JOINED]: [
7587
8006
  async (payload) => {
7588
- payload.runtime.logger.debug(`[Bootstrap] ENTITY_JOINED event received for entity ${payload.entityId}`);
8007
+ payload.runtime.logger.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, entityId: payload.entityId }, "ENTITY_JOINED event received");
7589
8008
  if (!payload.worldId) {
7590
- payload.runtime.logger.error("[Bootstrap] No worldId provided for entity joined");
8009
+ payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No worldId provided for entity joined");
7591
8010
  return;
7592
8011
  }
7593
8012
  if (!payload.roomId) {
7594
- payload.runtime.logger.error("[Bootstrap] No roomId provided for entity joined");
8013
+ payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No roomId provided for entity joined");
7595
8014
  return;
7596
8015
  }
7597
8016
  if (!payload.metadata?.type) {
7598
- payload.runtime.logger.error("[Bootstrap] No type provided for entity joined");
8017
+ payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No type provided for entity joined");
7599
8018
  return;
7600
8019
  }
7601
8020
  await syncSingleUser(payload.entityId, payload.runtime, payload.worldId, payload.roomId, payload.metadata.type, payload.source);
@@ -7613,9 +8032,18 @@ var events = {
7613
8032
  };
7614
8033
  await payload.runtime.updateEntity(entity);
7615
8034
  }
7616
- payload.runtime.logger.info(`[Bootstrap] User ${payload.entityId} left world ${payload.worldId}`);
8035
+ payload.runtime.logger.info({
8036
+ src: "plugin:bootstrap",
8037
+ agentId: payload.runtime.agentId,
8038
+ entityId: payload.entityId,
8039
+ worldId: payload.worldId
8040
+ }, "User left world");
7617
8041
  } catch (error) {
7618
- payload.runtime.logger.error("[Bootstrap] Error handling user left:", error instanceof Error ? error.message : String(error));
8042
+ payload.runtime.logger.error({
8043
+ src: "plugin:bootstrap",
8044
+ agentId: payload.runtime.agentId,
8045
+ error: error instanceof Error ? error.message : String(error)
8046
+ }, "Error handling user left");
7619
8047
  }
7620
8048
  }
7621
8049
  ],
@@ -7629,7 +8057,11 @@ var events = {
7629
8057
  }
7630
8058
  }
7631
8059
  } catch (error) {
7632
- logger22.error(`[Bootstrap] Error sending refetch request: ${error}`);
8060
+ logger16.error({
8061
+ src: "plugin:bootstrap",
8062
+ agentId: payload.runtime.agentId,
8063
+ error: error instanceof Error ? error.message : String(error)
8064
+ }, "Error sending refetch request");
7633
8065
  }
7634
8066
  },
7635
8067
  async (payload) => {
@@ -7649,9 +8081,17 @@ var events = {
7649
8081
  source: "actionHandler"
7650
8082
  }
7651
8083
  });
7652
- logger22.debug(`[Bootstrap] Logged ACTION_STARTED event for action ${payload.content?.actions?.[0]}`);
8084
+ logger16.debug({
8085
+ src: "plugin:bootstrap",
8086
+ agentId: payload.runtime.agentId,
8087
+ actionName: payload.content?.actions?.[0]
8088
+ }, "Logged ACTION_STARTED event");
7653
8089
  } catch (error) {
7654
- logger22.error(`[Bootstrap] Failed to log ACTION_STARTED event: ${error}`);
8090
+ logger16.error({
8091
+ src: "plugin:bootstrap",
8092
+ agentId: payload.runtime.agentId,
8093
+ error: error instanceof Error ? error.message : String(error)
8094
+ }, "Failed to log ACTION_STARTED event");
7655
8095
  }
7656
8096
  }
7657
8097
  ],
@@ -7665,19 +8105,35 @@ var events = {
7665
8105
  }
7666
8106
  }
7667
8107
  } catch (error) {
7668
- logger22.error(`[Bootstrap] Error sending refetch request: ${error}`);
8108
+ logger16.error({
8109
+ src: "plugin:bootstrap",
8110
+ agentId: payload.runtime.agentId,
8111
+ error: error instanceof Error ? error.message : String(error)
8112
+ }, "Error sending refetch request");
7669
8113
  }
7670
8114
  }
7671
8115
  ],
7672
8116
  [EventType2.EVALUATOR_STARTED]: [
7673
8117
  async (payload) => {
7674
- logger22.debug(`[Bootstrap] Evaluator started: ${payload.evaluatorName} (${payload.evaluatorId})`);
8118
+ logger16.debug({
8119
+ src: "plugin:bootstrap:evaluator",
8120
+ agentId: payload.runtime.agentId,
8121
+ evaluatorName: payload.evaluatorName,
8122
+ evaluatorId: payload.evaluatorId
8123
+ }, "Evaluator started");
7675
8124
  }
7676
8125
  ],
7677
8126
  [EventType2.EVALUATOR_COMPLETED]: [
7678
8127
  async (payload) => {
7679
- const status = payload.error ? `failed: ${payload.error.message}` : "completed";
7680
- logger22.debug(`[Bootstrap] Evaluator ${status}: ${payload.evaluatorName} (${payload.evaluatorId})`);
8128
+ const status = payload.error ? "failed" : "completed";
8129
+ logger16.debug({
8130
+ src: "plugin:bootstrap:evaluator",
8131
+ agentId: payload.runtime.agentId,
8132
+ status,
8133
+ evaluatorName: payload.evaluatorName,
8134
+ evaluatorId: payload.evaluatorId,
8135
+ error: payload.error?.message
8136
+ }, "Evaluator completed");
7681
8137
  }
7682
8138
  ],
7683
8139
  [EventType2.RUN_STARTED]: [
@@ -7697,9 +8153,13 @@ var events = {
7697
8153
  source: payload.source || "unknown"
7698
8154
  }
7699
8155
  });
7700
- logger22.debug(`[Bootstrap] Logged RUN_STARTED event for run ${payload.runId}`);
8156
+ logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_STARTED event");
7701
8157
  } catch (error) {
7702
- logger22.error(`[Bootstrap] Failed to log RUN_STARTED event: ${error}`);
8158
+ logger16.error({
8159
+ src: "plugin:bootstrap",
8160
+ agentId: payload.runtime.agentId,
8161
+ error: error instanceof Error ? error.message : String(error)
8162
+ }, "Failed to log RUN_STARTED event");
7703
8163
  }
7704
8164
  }
7705
8165
  ],
@@ -7723,9 +8183,18 @@ var events = {
7723
8183
  source: payload.source || "unknown"
7724
8184
  }
7725
8185
  });
7726
- logger22.debug(`[Bootstrap] Logged RUN_ENDED event for run ${payload.runId} with status ${payload.status}`);
8186
+ logger16.debug({
8187
+ src: "plugin:bootstrap",
8188
+ agentId: payload.runtime.agentId,
8189
+ runId: payload.runId,
8190
+ status: payload.status
8191
+ }, "Logged RUN_ENDED event");
7727
8192
  } catch (error) {
7728
- logger22.error(`[Bootstrap] Failed to log RUN_ENDED event: ${error}`);
8193
+ logger16.error({
8194
+ src: "plugin:bootstrap",
8195
+ agentId: payload.runtime.agentId,
8196
+ error: error instanceof Error ? error.message : String(error)
8197
+ }, "Failed to log RUN_ENDED event");
7729
8198
  }
7730
8199
  }
7731
8200
  ],
@@ -7749,9 +8218,13 @@ var events = {
7749
8218
  source: payload.source || "unknown"
7750
8219
  }
7751
8220
  });
7752
- logger22.debug(`[Bootstrap] Logged RUN_TIMEOUT event for run ${payload.runId}`);
8221
+ logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_TIMEOUT event");
7753
8222
  } catch (error) {
7754
- logger22.error(`[Bootstrap] Failed to log RUN_TIMEOUT event: ${error}`);
8223
+ logger16.error({
8224
+ src: "plugin:bootstrap",
8225
+ agentId: payload.runtime.agentId,
8226
+ error: error instanceof Error ? error.message : String(error)
8227
+ }, "Failed to log RUN_TIMEOUT event");
7755
8228
  }
7756
8229
  }
7757
8230
  ],
@@ -7837,5 +8310,5 @@ export {
7837
8310
  actionStateProvider
7838
8311
  };
7839
8312
 
7840
- //# debugId=AFB990BB999AB3A964756E2164756E21
8313
+ //# debugId=F550F36B3F910A4364756E2164756E21
7841
8314
  //# sourceMappingURL=index.js.map