@elizaos/plugin-bootstrap 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -71,16 +71,16 @@ var require_dedent = __commonJS({
71
71
 
72
72
  // src/index.ts
73
73
  import {
74
- asUUID,
74
+ asUUID as asUUID2,
75
75
  ChannelType as ChannelType9,
76
76
  composePromptFromState as composePromptFromState10,
77
77
  ContentType as ContentType2,
78
78
  createUniqueUuid as createUniqueUuid3,
79
- EventType,
79
+ EventType as EventType2,
80
80
  imageDescriptionTemplate,
81
- logger as logger20,
81
+ logger as logger21,
82
82
  messageHandlerTemplate,
83
- ModelType as ModelType14,
83
+ ModelType as ModelType15,
84
84
  parseKeyValueXml as parseKeyValueXml9,
85
85
  postCreationTemplate,
86
86
  parseBooleanFromText as parseBooleanFromText2,
@@ -4561,7 +4561,7 @@ var updateEntityAction = {
4561
4561
 
4562
4562
  // src/evaluators/reflection.ts
4563
4563
  import { z } from "zod";
4564
- import { getEntityDetails, logger as logger10, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
4564
+ import { asUUID, getEntityDetails, logger as logger10, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
4565
4565
  import { composePrompt as composePrompt4 } from "@elizaos/core";
4566
4566
  import {
4567
4567
  ModelType as ModelType12
@@ -4723,14 +4723,18 @@ async function handler(runtime, message, state) {
4723
4723
  ) || [];
4724
4724
  await Promise.all(
4725
4725
  newFacts.map(async (fact) => {
4726
- const factMemory = await runtime.addEmbeddingToMemory({
4726
+ const factMemory = {
4727
+ id: asUUID(v4_default()),
4727
4728
  entityId: agentId,
4728
4729
  agentId,
4729
4730
  content: { text: fact.claim },
4730
4731
  roomId,
4731
4732
  createdAt: Date.now()
4732
- });
4733
- return runtime.createMemory(factMemory, "facts", true);
4733
+ };
4734
+ const createdMemoryId = await runtime.createMemory(factMemory, "facts", true);
4735
+ const createdMemory = { ...factMemory, id: createdMemoryId };
4736
+ await runtime.queueEmbeddingGeneration(createdMemory, "low");
4737
+ return createdMemory;
4734
4738
  })
4735
4739
  );
4736
4740
  let relationshipsArray = [];
@@ -6895,6 +6899,245 @@ var TaskService = class _TaskService extends Service {
6895
6899
  }
6896
6900
  };
6897
6901
 
6902
+ // src/services/embedding.ts
6903
+ import {
6904
+ Service as Service2,
6905
+ EventType,
6906
+ ModelType as ModelType14,
6907
+ logger as logger20
6908
+ } from "@elizaos/core";
6909
+ var EmbeddingGenerationService = class _EmbeddingGenerationService extends Service2 {
6910
+ static serviceType = "embedding-generation";
6911
+ capabilityDescription = "Handles asynchronous embedding generation for memories";
6912
+ queue = [];
6913
+ isProcessing = false;
6914
+ processingInterval = null;
6915
+ maxQueueSize = 1e3;
6916
+ batchSize = 10;
6917
+ // Process up to 10 embeddings at a time
6918
+ processingIntervalMs = 100;
6919
+ // Check queue every 100ms
6920
+ static async start(runtime) {
6921
+ logger20.info("[EmbeddingService] Starting embedding generation service");
6922
+ const service = new _EmbeddingGenerationService(runtime);
6923
+ await service.initialize();
6924
+ return service;
6925
+ }
6926
+ async initialize() {
6927
+ logger20.info("[EmbeddingService] Initializing embedding generation service");
6928
+ this.runtime.registerEvent(
6929
+ EventType.EMBEDDING_GENERATION_REQUESTED,
6930
+ this.handleEmbeddingRequest.bind(this)
6931
+ );
6932
+ this.startProcessing();
6933
+ }
6934
+ async handleEmbeddingRequest(payload) {
6935
+ const { memory, priority = "normal", retryCount = 0, maxRetries = 3 } = payload;
6936
+ if (memory.embedding) {
6937
+ logger20.debug("[EmbeddingService] Memory already has embeddings, skipping");
6938
+ return;
6939
+ }
6940
+ if (this.queue.length >= this.maxQueueSize) {
6941
+ logger20.warn(
6942
+ `[EmbeddingService] Queue is full (${this.queue.length}/${this.maxQueueSize}), making room`
6943
+ );
6944
+ this.makeRoomInQueue();
6945
+ }
6946
+ const queueItem = {
6947
+ memory,
6948
+ priority,
6949
+ retryCount,
6950
+ maxRetries,
6951
+ addedAt: Date.now()
6952
+ };
6953
+ this.insertItemByPriority(queueItem);
6954
+ logger20.debug(`[EmbeddingService] Added memory to queue. Queue size: ${this.queue.length}`);
6955
+ }
6956
+ /**
6957
+ * Make room in the queue by removing items based on priority and age
6958
+ * Removes 10% of the queue (minimum 1, maximum 10 items)
6959
+ */
6960
+ makeRoomInQueue() {
6961
+ const tenPercent = Math.floor(this.maxQueueSize * 0.1);
6962
+ const itemsToRemove = Math.min(10, Math.max(1, tenPercent));
6963
+ const itemsWithIndex = this.queue.map((item, index) => ({ item, originalIndex: index }));
6964
+ itemsWithIndex.sort((a2, b) => {
6965
+ const priorityOrder = { low: 0, normal: 1, high: 2 };
6966
+ const priorityDiff = priorityOrder[a2.item.priority] - priorityOrder[b.item.priority];
6967
+ if (priorityDiff !== 0) return priorityDiff;
6968
+ return a2.item.addedAt - b.item.addedAt;
6969
+ });
6970
+ const indicesToRemove = new Set(
6971
+ itemsWithIndex.slice(0, Math.min(itemsToRemove, itemsWithIndex.length)).map(({ originalIndex }) => originalIndex)
6972
+ );
6973
+ const newQueue = this.queue.filter((_, index) => !indicesToRemove.has(index));
6974
+ const removedCount = this.queue.length - newQueue.length;
6975
+ this.queue = newQueue;
6976
+ logger20.info(
6977
+ `[EmbeddingService] Removed ${removedCount} items from queue. New size: ${this.queue.length}`
6978
+ );
6979
+ }
6980
+ /**
6981
+ * Insert an item into the queue based on its priority
6982
+ * High priority items go to the front, normal in the middle, low at the end
6983
+ */
6984
+ insertItemByPriority(queueItem) {
6985
+ if (queueItem.priority === "high") {
6986
+ let insertIndex = 0;
6987
+ for (let i2 = 0; i2 < this.queue.length; i2++) {
6988
+ if (this.queue[i2].priority !== "high") break;
6989
+ insertIndex = i2 + 1;
6990
+ }
6991
+ this.queue.splice(insertIndex, 0, queueItem);
6992
+ } else if (queueItem.priority === "low") {
6993
+ this.queue.push(queueItem);
6994
+ } else {
6995
+ let insertIndex = 0;
6996
+ for (let i2 = 0; i2 < this.queue.length; i2++) {
6997
+ if (this.queue[i2].priority !== "high") {
6998
+ insertIndex = i2;
6999
+ break;
7000
+ }
7001
+ insertIndex = i2 + 1;
7002
+ }
7003
+ for (let i2 = insertIndex; i2 < this.queue.length; i2++) {
7004
+ if (this.queue[i2].priority === "low") {
7005
+ insertIndex = i2;
7006
+ break;
7007
+ }
7008
+ insertIndex = i2 + 1;
7009
+ }
7010
+ this.queue.splice(insertIndex, 0, queueItem);
7011
+ }
7012
+ }
7013
+ startProcessing() {
7014
+ if (this.processingInterval) {
7015
+ return;
7016
+ }
7017
+ this.processingInterval = setInterval(async () => {
7018
+ if (!this.isProcessing && this.queue.length > 0) {
7019
+ await this.processQueue();
7020
+ }
7021
+ }, this.processingIntervalMs);
7022
+ logger20.info("[EmbeddingService] Started processing loop");
7023
+ }
7024
+ async processQueue() {
7025
+ if (this.isProcessing || this.queue.length === 0) {
7026
+ return;
7027
+ }
7028
+ this.isProcessing = true;
7029
+ try {
7030
+ const batch = this.queue.splice(0, Math.min(this.batchSize, this.queue.length));
7031
+ logger20.debug(
7032
+ `[EmbeddingService] Processing batch of ${batch.length} items. Remaining in queue: ${this.queue.length}`
7033
+ );
7034
+ const promises = batch.map(async (item) => {
7035
+ try {
7036
+ await this.generateEmbedding(item);
7037
+ } catch (error) {
7038
+ logger20.error(
7039
+ { error, memoryId: item.memory.id },
7040
+ "[EmbeddingService] Error processing item:"
7041
+ );
7042
+ if (item.retryCount < item.maxRetries) {
7043
+ item.retryCount++;
7044
+ this.insertItemByPriority(item);
7045
+ logger20.debug(
7046
+ `[EmbeddingService] Re-queued item for retry (${item.retryCount}/${item.maxRetries})`
7047
+ );
7048
+ } else {
7049
+ await this.runtime.emitEvent(EventType.EMBEDDING_GENERATION_FAILED, {
7050
+ runtime: this.runtime,
7051
+ memory: item.memory,
7052
+ error: error instanceof Error ? error.message : String(error),
7053
+ source: "embeddingService"
7054
+ });
7055
+ }
7056
+ }
7057
+ });
7058
+ await Promise.all(promises);
7059
+ } finally {
7060
+ this.isProcessing = false;
7061
+ }
7062
+ }
7063
+ async generateEmbedding(item) {
7064
+ const { memory } = item;
7065
+ if (!memory.content?.text) {
7066
+ logger20.warn({ memoryId: memory.id }, "[EmbeddingService] Memory has no text content");
7067
+ return;
7068
+ }
7069
+ try {
7070
+ const startTime = Date.now();
7071
+ const embedding = await this.runtime.useModel(ModelType14.TEXT_EMBEDDING, {
7072
+ text: memory.content.text
7073
+ });
7074
+ const duration = Date.now() - startTime;
7075
+ logger20.debug(
7076
+ `[EmbeddingService] Generated embedding in ${duration}ms for memory ${memory.id}`
7077
+ );
7078
+ if (memory.id) {
7079
+ await this.runtime.updateMemory({
7080
+ id: memory.id,
7081
+ embedding
7082
+ });
7083
+ await this.runtime.emitEvent(EventType.EMBEDDING_GENERATION_COMPLETED, {
7084
+ runtime: this.runtime,
7085
+ memory: { ...memory, embedding },
7086
+ source: "embeddingService"
7087
+ });
7088
+ }
7089
+ } catch (error) {
7090
+ logger20.error(
7091
+ { error, memoryId: memory.id },
7092
+ "[EmbeddingService] Failed to generate embedding:"
7093
+ );
7094
+ throw error;
7095
+ }
7096
+ }
7097
+ async stop() {
7098
+ logger20.info("[EmbeddingService] Stopping embedding generation service");
7099
+ if (this.processingInterval) {
7100
+ clearInterval(this.processingInterval);
7101
+ this.processingInterval = null;
7102
+ }
7103
+ const highPriorityItems = this.queue.filter((item) => item.priority === "high");
7104
+ if (highPriorityItems.length > 0) {
7105
+ logger20.info(
7106
+ `[EmbeddingService] Processing ${highPriorityItems.length} high priority items before shutdown`
7107
+ );
7108
+ for (const item of highPriorityItems) {
7109
+ try {
7110
+ await this.generateEmbedding(item);
7111
+ } catch (error) {
7112
+ logger20.error({ error }, "[EmbeddingService] Error during shutdown processing:");
7113
+ }
7114
+ }
7115
+ }
7116
+ logger20.info(`[EmbeddingService] Stopped. ${this.queue.length} items remaining in queue`);
7117
+ }
7118
+ // Public methods for monitoring
7119
+ getQueueSize() {
7120
+ return this.queue.length;
7121
+ }
7122
+ getQueueStats() {
7123
+ const stats = {
7124
+ high: 0,
7125
+ normal: 0,
7126
+ low: 0,
7127
+ total: this.queue.length
7128
+ };
7129
+ for (const item of this.queue) {
7130
+ stats[item.priority]++;
7131
+ }
7132
+ return stats;
7133
+ }
7134
+ clearQueue() {
7135
+ const size = this.queue.length;
7136
+ this.queue = [];
7137
+ logger20.info(`[EmbeddingService] Cleared ${size} items from queue`);
7138
+ }
7139
+ };
7140
+
6898
7141
  // src/index.ts
6899
7142
  var latestResponseIds = /* @__PURE__ */ new Map();
6900
7143
  async function fetchMediaData(attachments) {
@@ -6936,21 +7179,36 @@ async function processAttachments(attachments, runtime) {
6936
7179
  imageUrl = `data:${contentType};base64,${buffer.toString("base64")}`;
6937
7180
  }
6938
7181
  try {
6939
- const response = await runtime.useModel(ModelType14.IMAGE_DESCRIPTION, {
7182
+ const response = await runtime.useModel(ModelType15.IMAGE_DESCRIPTION, {
6940
7183
  prompt: imageDescriptionTemplate,
6941
7184
  imageUrl
6942
7185
  });
6943
7186
  if (typeof response === "string") {
6944
7187
  const parsedXml = parseKeyValueXml9(response);
6945
- if (parsedXml?.description && parsedXml?.text) {
6946
- processedAttachment.description = parsedXml.description;
7188
+ if (parsedXml && (parsedXml.description || parsedXml.text)) {
7189
+ processedAttachment.description = parsedXml.description || "";
6947
7190
  processedAttachment.title = parsedXml.title || "Image";
6948
- processedAttachment.text = parsedXml.text;
7191
+ processedAttachment.text = parsedXml.text || parsedXml.description || "";
6949
7192
  runtime.logger.debug(
6950
7193
  `[Bootstrap] Generated description: ${processedAttachment.description?.substring(0, 100)}...`
6951
7194
  );
6952
7195
  } else {
6953
- runtime.logger.warn(`[Bootstrap] Failed to parse XML response for image description`);
7196
+ const responseStr = response;
7197
+ const titleMatch = responseStr.match(/<title>([^<]+)<\/title>/);
7198
+ const descMatch = responseStr.match(/<description>([^<]+)<\/description>/);
7199
+ const textMatch = responseStr.match(/<text>([^<]+)<\/text>/);
7200
+ if (titleMatch || descMatch || textMatch) {
7201
+ processedAttachment.title = titleMatch?.[1] || "Image";
7202
+ processedAttachment.description = descMatch?.[1] || "";
7203
+ processedAttachment.text = textMatch?.[1] || descMatch?.[1] || "";
7204
+ runtime.logger.debug(
7205
+ `[Bootstrap] Used fallback XML parsing - description: ${processedAttachment.description?.substring(0, 100)}...`
7206
+ );
7207
+ } else {
7208
+ runtime.logger.warn(
7209
+ `[Bootstrap] Failed to parse XML response for image description`
7210
+ );
7211
+ }
6954
7212
  }
6955
7213
  } else if (response && typeof response === "object" && "description" in response) {
6956
7214
  processedAttachment.description = response.description;
@@ -7045,14 +7303,14 @@ var messageReceivedHandler = async ({
7045
7303
  }
7046
7304
  const previousResponseId = agentResponses.get(message.roomId);
7047
7305
  if (previousResponseId) {
7048
- logger20.warn(
7306
+ logger21.warn(
7049
7307
  `[Bootstrap] Updating response ID for room ${message.roomId} from ${previousResponseId} to ${responseId} - this may discard in-progress responses`
7050
7308
  );
7051
7309
  }
7052
7310
  agentResponses.set(message.roomId, responseId);
7053
7311
  const runId = runtime.startRun();
7054
7312
  const startTime = Date.now();
7055
- await runtime.emitEvent(EventType.RUN_STARTED, {
7313
+ await runtime.emitEvent(EventType2.RUN_STARTED, {
7056
7314
  runtime,
7057
7315
  runId,
7058
7316
  messageId: message.id,
@@ -7067,7 +7325,7 @@ var messageReceivedHandler = async ({
7067
7325
  });
7068
7326
  const timeoutPromise = new Promise((_, reject) => {
7069
7327
  timeoutId = setTimeout(async () => {
7070
- await runtime.emitEvent(EventType.RUN_TIMEOUT, {
7328
+ await runtime.emitEvent(EventType2.RUN_TIMEOUT, {
7071
7329
  runtime,
7072
7330
  runId,
7073
7331
  messageId: message.id,
@@ -7092,23 +7350,23 @@ var messageReceivedHandler = async ({
7092
7350
  runtime.logger.debug(
7093
7351
  `[Bootstrap] Processing message: ${truncateToCompleteSentence(message.content.text || "", 50)}...`
7094
7352
  );
7095
- runtime.logger.debug("[Bootstrap] Saving message to memory and embeddings");
7353
+ runtime.logger.debug("[Bootstrap] Saving message to memory and queueing embeddings");
7354
+ let memoryToQueue;
7096
7355
  if (message.id) {
7097
7356
  const existingMemory = await runtime.getMemoryById(message.id);
7098
7357
  if (existingMemory) {
7099
7358
  runtime.logger.debug("[Bootstrap] Memory already exists, skipping creation");
7100
- await runtime.addEmbeddingToMemory(message);
7359
+ memoryToQueue = existingMemory;
7101
7360
  } else {
7102
- await Promise.all([
7103
- runtime.addEmbeddingToMemory(message),
7104
- runtime.createMemory(message, "messages")
7105
- ]);
7361
+ const createdMemoryId = await runtime.createMemory(message, "messages");
7362
+ memoryToQueue = { ...message, id: createdMemoryId };
7106
7363
  }
7364
+ await runtime.queueEmbeddingGeneration(memoryToQueue, "high");
7107
7365
  } else {
7108
- await Promise.all([
7109
- runtime.addEmbeddingToMemory(message),
7110
- runtime.createMemory(message, "messages")
7111
- ]);
7366
+ const memoryId = await runtime.createMemory(message, "messages");
7367
+ message.id = memoryId;
7368
+ memoryToQueue = { ...message, id: memoryId };
7369
+ await runtime.queueEmbeddingGeneration(memoryToQueue, "normal");
7112
7370
  }
7113
7371
  const agentUserState = await runtime.getParticipantUserState(
7114
7372
  message.roomId,
@@ -7117,7 +7375,7 @@ var messageReceivedHandler = async ({
7117
7375
  const defLllmOff = parseBooleanFromText2(runtime.getSetting("BOOTSTRAP_DEFLLMOFF"));
7118
7376
  if (defLllmOff && agentUserState === null) {
7119
7377
  runtime.logger.debug("bootstrap - LLM is off by default");
7120
- await runtime.emitEvent(EventType.RUN_ENDED, {
7378
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7121
7379
  runtime,
7122
7380
  runId,
7123
7381
  messageId: message.id,
@@ -7133,7 +7391,7 @@ var messageReceivedHandler = async ({
7133
7391
  }
7134
7392
  if (agentUserState === "MUTED" && !message.content.text?.toLowerCase().includes(runtime.character.name.toLowerCase())) {
7135
7393
  runtime.logger.debug(`[Bootstrap] Ignoring muted room ${message.roomId}`);
7136
- await runtime.emitEvent(EventType.RUN_ENDED, {
7394
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7137
7395
  runtime,
7138
7396
  runId,
7139
7397
  messageId: message.id,
@@ -7180,7 +7438,7 @@ var messageReceivedHandler = async ({
7180
7438
  `[Bootstrap] Evaluating response for ${runtime.character.name}
7181
7439
  Prompt: ${shouldRespondPrompt}`
7182
7440
  );
7183
- const response = await runtime.useModel(ModelType14.TEXT_SMALL, {
7441
+ const response = await runtime.useModel(ModelType15.TEXT_SMALL, {
7184
7442
  prompt: shouldRespondPrompt
7185
7443
  });
7186
7444
  runtime.logger.debug(
@@ -7214,7 +7472,7 @@ ${response}`
7214
7472
  let retries = 0;
7215
7473
  const maxRetries = 3;
7216
7474
  while (retries < maxRetries && (!responseContent?.thought || !responseContent?.actions)) {
7217
- let response = await runtime.useModel(ModelType14.TEXT_LARGE, {
7475
+ let response = await runtime.useModel(ModelType15.TEXT_LARGE, {
7218
7476
  prompt
7219
7477
  });
7220
7478
  runtime.logger.debug({ response }, "[Bootstrap] *** Raw LLM Response ***");
@@ -7272,7 +7530,7 @@ ${response}`
7272
7530
  const isSimple = responseContent.actions?.length === 1 && typeof responseContent.actions[0] === "string" && responseContent.actions[0].toUpperCase() === "REPLY" && (!responseContent.providers || responseContent.providers.length === 0);
7273
7531
  responseContent.simple = isSimple;
7274
7532
  const responseMessage = {
7275
- id: asUUID(v4_default()),
7533
+ id: asUUID2(v4_default()),
7276
7534
  entityId: runtime.agentId,
7277
7535
  agentId: runtime.agentId,
7278
7536
  content: responseContent,
@@ -7328,7 +7586,7 @@ ${response}`
7328
7586
  runtime.logger.info(
7329
7587
  `Ignore response discarded - newer message being processed for agent: ${runtime.agentId}, room: ${message.roomId}`
7330
7588
  );
7331
- await runtime.emitEvent(EventType.RUN_ENDED, {
7589
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7332
7590
  runtime,
7333
7591
  runId,
7334
7592
  messageId: message.id,
@@ -7346,7 +7604,7 @@ ${response}`
7346
7604
  runtime.logger.error(
7347
7605
  "[Bootstrap] Message ID is missing, cannot create ignore response."
7348
7606
  );
7349
- await runtime.emitEvent(EventType.RUN_ENDED, {
7607
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7350
7608
  runtime,
7351
7609
  runId,
7352
7610
  messageId: message.id,
@@ -7370,7 +7628,7 @@ ${response}`
7370
7628
  };
7371
7629
  await callback(ignoreContent);
7372
7630
  const ignoreMemory = {
7373
- id: asUUID(v4_default()),
7631
+ id: asUUID2(v4_default()),
7374
7632
  entityId: runtime.agentId,
7375
7633
  agentId: runtime.agentId,
7376
7634
  content: ignoreContent,
@@ -7431,7 +7689,7 @@ ${response}`
7431
7689
  channelType: message.content.channelType,
7432
7690
  roomName
7433
7691
  };
7434
- await runtime.emitEvent(EventType.RUN_ENDED, {
7692
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7435
7693
  runtime,
7436
7694
  runId,
7437
7695
  messageId: message.id,
@@ -7448,7 +7706,7 @@ ${response}`
7448
7706
  });
7449
7707
  } catch (error) {
7450
7708
  console.error("error is", error);
7451
- await runtime.emitEvent(EventType.RUN_ENDED, {
7709
+ await runtime.emitEvent(EventType2.RUN_ENDED, {
7452
7710
  runtime,
7453
7711
  runId,
7454
7712
  messageId: message.id,
@@ -7595,7 +7853,7 @@ var postGeneratedHandler = async ({
7595
7853
  let retries = 0;
7596
7854
  const maxRetries = 3;
7597
7855
  while (retries < maxRetries && (!responseContent?.thought || !responseContent?.actions)) {
7598
- const response = await runtime.useModel(ModelType14.TEXT_SMALL, {
7856
+ const response = await runtime.useModel(ModelType15.TEXT_SMALL, {
7599
7857
  prompt
7600
7858
  });
7601
7859
  console.log("prompt is", prompt);
@@ -7627,7 +7885,7 @@ var postGeneratedHandler = async ({
7627
7885
  state,
7628
7886
  template: runtime.character.templates?.postCreationTemplate || postCreationTemplate
7629
7887
  });
7630
- const xmlResponseText = await runtime.useModel(ModelType14.TEXT_LARGE, {
7888
+ const xmlResponseText = await runtime.useModel(ModelType15.TEXT_LARGE, {
7631
7889
  prompt: postPrompt
7632
7890
  });
7633
7891
  const parsedXmlResponse = parseKeyValueXml9(xmlResponseText);
@@ -7807,7 +8065,7 @@ var controlMessageHandler = async ({
7807
8065
  }
7808
8066
  };
7809
8067
  var events = {
7810
- [EventType.MESSAGE_RECEIVED]: [
8068
+ [EventType2.MESSAGE_RECEIVED]: [
7811
8069
  async (payload) => {
7812
8070
  if (!payload.callback) {
7813
8071
  payload.runtime.logger.error("No callback provided for message");
@@ -7821,7 +8079,7 @@ var events = {
7821
8079
  });
7822
8080
  }
7823
8081
  ],
7824
- [EventType.VOICE_MESSAGE_RECEIVED]: [
8082
+ [EventType2.VOICE_MESSAGE_RECEIVED]: [
7825
8083
  async (payload) => {
7826
8084
  if (!payload.callback) {
7827
8085
  payload.runtime.logger.error("No callback provided for voice message");
@@ -7835,7 +8093,7 @@ var events = {
7835
8093
  });
7836
8094
  }
7837
8095
  ],
7838
- [EventType.REACTION_RECEIVED]: [
8096
+ [EventType2.REACTION_RECEIVED]: [
7839
8097
  async (payload) => {
7840
8098
  await reactionReceivedHandler({
7841
8099
  runtime: payload.runtime,
@@ -7843,17 +8101,17 @@ var events = {
7843
8101
  });
7844
8102
  }
7845
8103
  ],
7846
- [EventType.POST_GENERATED]: [
8104
+ [EventType2.POST_GENERATED]: [
7847
8105
  async (payload) => {
7848
8106
  await postGeneratedHandler(payload);
7849
8107
  }
7850
8108
  ],
7851
- [EventType.MESSAGE_SENT]: [
8109
+ [EventType2.MESSAGE_SENT]: [
7852
8110
  async (payload) => {
7853
8111
  payload.runtime.logger.debug(`[Bootstrap] Message sent: ${payload.message.content.text}`);
7854
8112
  }
7855
8113
  ],
7856
- [EventType.MESSAGE_DELETED]: [
8114
+ [EventType2.MESSAGE_DELETED]: [
7857
8115
  async (payload) => {
7858
8116
  await messageDeletedHandler({
7859
8117
  runtime: payload.runtime,
@@ -7861,7 +8119,7 @@ var events = {
7861
8119
  });
7862
8120
  }
7863
8121
  ],
7864
- [EventType.CHANNEL_CLEARED]: [
8122
+ [EventType2.CHANNEL_CLEARED]: [
7865
8123
  async (payload) => {
7866
8124
  await channelClearedHandler({
7867
8125
  runtime: payload.runtime,
@@ -7871,17 +8129,17 @@ var events = {
7871
8129
  });
7872
8130
  }
7873
8131
  ],
7874
- [EventType.WORLD_JOINED]: [
8132
+ [EventType2.WORLD_JOINED]: [
7875
8133
  async (payload) => {
7876
8134
  await handleServerSync(payload);
7877
8135
  }
7878
8136
  ],
7879
- [EventType.WORLD_CONNECTED]: [
8137
+ [EventType2.WORLD_CONNECTED]: [
7880
8138
  async (payload) => {
7881
8139
  await handleServerSync(payload);
7882
8140
  }
7883
8141
  ],
7884
- [EventType.ENTITY_JOINED]: [
8142
+ [EventType2.ENTITY_JOINED]: [
7885
8143
  async (payload) => {
7886
8144
  payload.runtime.logger.debug(
7887
8145
  `[Bootstrap] ENTITY_JOINED event received for entity ${payload.entityId}`
@@ -7908,7 +8166,7 @@ var events = {
7908
8166
  );
7909
8167
  }
7910
8168
  ],
7911
- [EventType.ENTITY_LEFT]: [
8169
+ [EventType2.ENTITY_LEFT]: [
7912
8170
  async (payload) => {
7913
8171
  try {
7914
8172
  const entity = await payload.runtime.getEntityById(payload.entityId);
@@ -7928,28 +8186,28 @@ var events = {
7928
8186
  }
7929
8187
  }
7930
8188
  ],
7931
- [EventType.ACTION_STARTED]: [
8189
+ [EventType2.ACTION_STARTED]: [
7932
8190
  async (payload) => {
7933
- logger20.debug(`[Bootstrap] Action started: ${payload.actionName} (${payload.actionId})`);
8191
+ logger21.debug(`[Bootstrap] Action started: ${payload.actionName} (${payload.actionId})`);
7934
8192
  }
7935
8193
  ],
7936
- [EventType.ACTION_COMPLETED]: [
8194
+ [EventType2.ACTION_COMPLETED]: [
7937
8195
  async (payload) => {
7938
8196
  const status = payload.error ? `failed: ${payload.error.message}` : "completed";
7939
- logger20.debug(`[Bootstrap] Action ${status}: ${payload.actionName} (${payload.actionId})`);
8197
+ logger21.debug(`[Bootstrap] Action ${status}: ${payload.actionName} (${payload.actionId})`);
7940
8198
  }
7941
8199
  ],
7942
- [EventType.EVALUATOR_STARTED]: [
8200
+ [EventType2.EVALUATOR_STARTED]: [
7943
8201
  async (payload) => {
7944
- logger20.debug(
8202
+ logger21.debug(
7945
8203
  `[Bootstrap] Evaluator started: ${payload.evaluatorName} (${payload.evaluatorId})`
7946
8204
  );
7947
8205
  }
7948
8206
  ],
7949
- [EventType.EVALUATOR_COMPLETED]: [
8207
+ [EventType2.EVALUATOR_COMPLETED]: [
7950
8208
  async (payload) => {
7951
8209
  const status = payload.error ? `failed: ${payload.error.message}` : "completed";
7952
- logger20.debug(
8210
+ logger21.debug(
7953
8211
  `[Bootstrap] Evaluator ${status}: ${payload.evaluatorName} (${payload.evaluatorId})`
7954
8212
  );
7955
8213
  }
@@ -7987,7 +8245,6 @@ var bootstrapPlugin = {
7987
8245
  factsProvider,
7988
8246
  roleProvider,
7989
8247
  settingsProvider,
7990
- capabilitiesProvider,
7991
8248
  attachmentsProvider,
7992
8249
  providersProvider,
7993
8250
  actionsProvider,
@@ -7996,7 +8253,7 @@ var bootstrapPlugin = {
7996
8253
  recentMessagesProvider,
7997
8254
  worldProvider
7998
8255
  ],
7999
- services: [TaskService]
8256
+ services: [TaskService, EmbeddingGenerationService]
8000
8257
  };
8001
8258
  var index_default = bootstrapPlugin;
8002
8259
  export {