@elizaos/plugin-bootstrap 1.0.20 → 1.1.1

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.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { Action, Evaluator, Provider, Plugin, Media, IAgentRuntime, Room } from '@elizaos/core';
2
2
 
3
+ /**
4
+ * Represents an action that allows the agent to generate an image using a generated prompt.
5
+ *
6
+ * This action can be used in a chain where the agent needs to visualize or illustrate a concept, emotion, or scene.
7
+ */
8
+ declare const generateImageAction: Action;
9
+
3
10
  /**
4
11
  * Represents an action that allows selecting an option for a pending task that has multiple options.
5
12
  * @type {Action}
@@ -441,4 +448,4 @@ declare function processAttachments(attachments: Media[], runtime: IAgentRuntime
441
448
  declare function shouldBypassShouldRespond(runtime: IAgentRuntime, room?: Room, source?: string): boolean;
442
449
  declare const bootstrapPlugin: Plugin;
443
450
 
444
- export { actionsProvider, anxietyProvider, attachmentsProvider, bootstrapPlugin, capabilitiesProvider, characterProvider, choiceAction, choiceProvider, bootstrapPlugin as default, entitiesProvider, evaluatorsProvider, factsProvider, fetchMediaData, followRoomAction, ignoreAction, muteRoomAction, noneAction, processAttachments, providersProvider, recentMessagesProvider, reflectionEvaluator, relationshipsProvider, replyAction, roleProvider, sendMessageAction, settingsProvider, shouldBypassShouldRespond, timeProvider, unfollowRoomAction, unmuteRoomAction, updateEntityAction, updateRoleAction, updateSettingsAction, worldProvider };
451
+ export { actionsProvider, anxietyProvider, attachmentsProvider, bootstrapPlugin, capabilitiesProvider, characterProvider, choiceAction, choiceProvider, bootstrapPlugin as default, entitiesProvider, evaluatorsProvider, factsProvider, fetchMediaData, followRoomAction, generateImageAction, ignoreAction, muteRoomAction, noneAction, processAttachments, providersProvider, recentMessagesProvider, reflectionEvaluator, relationshipsProvider, replyAction, roleProvider, sendMessageAction, settingsProvider, shouldBypassShouldRespond, timeProvider, unfollowRoomAction, unmuteRoomAction, updateEntityAction, updateRoleAction, updateSettingsAction, worldProvider };
package/dist/index.js CHANGED
@@ -3763,14 +3763,14 @@ var require_encoding = __commonJS({
3763
3763
  import {
3764
3764
  asUUID,
3765
3765
  ChannelType as ChannelType9,
3766
- composePromptFromState as composePromptFromState9,
3767
- ContentType,
3766
+ composePromptFromState as composePromptFromState10,
3767
+ ContentType as ContentType2,
3768
3768
  createUniqueUuid as createUniqueUuid3,
3769
3769
  EventType,
3770
3770
  imageDescriptionTemplate,
3771
3771
  logger as logger18,
3772
3772
  messageHandlerTemplate,
3773
- ModelType as ModelType13,
3773
+ ModelType as ModelType14,
3774
3774
  parseKeyValueXml,
3775
3775
  postCreationTemplate,
3776
3776
  Role as Role2,
@@ -3830,12 +3830,140 @@ function v4(options, buf, offset) {
3830
3830
  }
3831
3831
  var v4_default = v4;
3832
3832
 
3833
+ // src/actions/imageGeneration.ts
3834
+ import {
3835
+ composePromptFromState,
3836
+ ModelType,
3837
+ ContentType
3838
+ } from "@elizaos/core";
3839
+ var imageGenerationTemplate = `# Task: Generate an image prompt for {{agentName}}.
3840
+ {{providers}}
3841
+ # Instructions:
3842
+ Write a clear, concise, and visually descriptive prompt that should be used to generate an image representing {{agentName}}'s next action or visualization for the conversation.
3843
+
3844
+ Your response should be formatted in a valid JSON block like this:
3845
+ \`\`\`json
3846
+ {
3847
+ "prompt": "<string>"
3848
+ }
3849
+ \`\`\`
3850
+
3851
+ Your response should include the valid JSON block and nothing else.`;
3852
+ var generateImageAction = {
3853
+ name: "GENERATE_IMAGE",
3854
+ similes: ["DRAW", "CREATE_IMAGE", "RENDER_IMAGE", "VISUALIZE"],
3855
+ description: "Generates an image based on a generated prompt reflecting the current conversation. Use GENERATE_IMAGE when the agent needs to visualize, illustrate, or demonstrate something visually for the user.",
3856
+ validate: async (_runtime) => {
3857
+ return true;
3858
+ },
3859
+ handler: async (runtime, message, state, _options, callback, responses) => {
3860
+ const allProviders = responses?.flatMap((res) => res.content?.providers ?? []) ?? [];
3861
+ state = await runtime.composeState(message, [...allProviders ?? [], "RECENT_MESSAGES"]);
3862
+ const prompt = composePromptFromState({
3863
+ state,
3864
+ template: imageGenerationTemplate
3865
+ });
3866
+ const promptResponse = await runtime.useModel(ModelType.OBJECT_LARGE, {
3867
+ prompt
3868
+ });
3869
+ const imagePrompt = typeof promptResponse === "object" && promptResponse && "prompt" in promptResponse ? String(promptResponse.prompt) : "Unable to generate descriptive prompt for image";
3870
+ const imageResponse = await runtime.useModel(ModelType.IMAGE, {
3871
+ prompt: imagePrompt
3872
+ });
3873
+ if (!imageResponse || imageResponse.length === 0 || !imageResponse[0]?.url) {
3874
+ console.error("generateImageAction: Image generation failed - no valid response received", {
3875
+ imageResponse,
3876
+ imagePrompt
3877
+ });
3878
+ return;
3879
+ }
3880
+ const imageUrl = imageResponse[0].url;
3881
+ const responseContent = {
3882
+ attachments: [
3883
+ {
3884
+ id: v4_default(),
3885
+ url: imageUrl,
3886
+ title: "Generated Image",
3887
+ contentType: ContentType.IMAGE
3888
+ }
3889
+ ],
3890
+ thought: `Generated an image based on: "${imagePrompt}"`,
3891
+ actions: ["GENERATE_IMAGE"],
3892
+ text: imagePrompt
3893
+ };
3894
+ await callback(responseContent);
3895
+ return true;
3896
+ },
3897
+ examples: [
3898
+ [
3899
+ {
3900
+ name: "{{name1}}",
3901
+ content: {
3902
+ text: "Can you show me what a futuristic city looks like?"
3903
+ }
3904
+ },
3905
+ {
3906
+ name: "{{name2}}",
3907
+ content: {
3908
+ text: "Sure, I'll create a futuristic city image for you. One moment...",
3909
+ actions: ["GENERATE_IMAGE"]
3910
+ }
3911
+ }
3912
+ ],
3913
+ [
3914
+ {
3915
+ name: "{{name1}}",
3916
+ content: {
3917
+ text: "What does a neural network look like visually?"
3918
+ }
3919
+ },
3920
+ {
3921
+ name: "{{name2}}",
3922
+ content: {
3923
+ text: "I\u2019ll create a visualization of a neural network for you, one sec...",
3924
+ actions: ["GENERATE_IMAGE"]
3925
+ }
3926
+ }
3927
+ ],
3928
+ [
3929
+ {
3930
+ name: "{{name1}}",
3931
+ content: {
3932
+ text: "Can you visualize the feeling of calmness for me?"
3933
+ }
3934
+ },
3935
+ {
3936
+ name: "{{name2}}",
3937
+ content: {
3938
+ text: "Creating an image to capture calmness for you, please wait a moment...",
3939
+ actions: ["GENERATE_IMAGE"]
3940
+ }
3941
+ }
3942
+ ],
3943
+ [
3944
+ {
3945
+ name: "{{name1}}",
3946
+ content: {
3947
+ text: "What does excitement look like as an image?"
3948
+ }
3949
+ },
3950
+ {
3951
+ name: "{{name2}}",
3952
+ content: {
3953
+ text: "Let me generate an image that represents excitement for you, give me a second...",
3954
+ actions: ["GENERATE_IMAGE"]
3955
+ }
3956
+ }
3957
+ ]
3958
+ ]
3959
+ };
3960
+
3833
3961
  // src/actions/choice.ts
3834
3962
  import {
3835
3963
  composePrompt,
3836
3964
  getUserServerRole,
3837
3965
  logger,
3838
- ModelType,
3966
+ ModelType as ModelType2,
3839
3967
  parseJSONObjectFromText
3840
3968
  } from "@elizaos/core";
3841
3969
  var optionExtractionTemplate = `# Task: Extract selected task and option from user message
@@ -3938,7 +4066,7 @@ ${task.options?.map((opt) => `- ${opt.name}: ${opt.description}`).join("\n")}`;
3938
4066
  },
3939
4067
  template: optionExtractionTemplate
3940
4068
  });
3941
- const result = await runtime.useModel(ModelType.TEXT_SMALL, {
4069
+ const result = await runtime.useModel(ModelType2.TEXT_SMALL, {
3942
4070
  prompt,
3943
4071
  stopSequences: []
3944
4072
  });
@@ -4055,9 +4183,9 @@ ${task.options?.map((opt) => `- ${opt.name}: ${opt.description}`).join("\n")}`;
4055
4183
  // src/actions/followRoom.ts
4056
4184
  import {
4057
4185
  booleanFooter,
4058
- composePromptFromState,
4186
+ composePromptFromState as composePromptFromState2,
4059
4187
  logger as logger2,
4060
- ModelType as ModelType2
4188
+ ModelType as ModelType3
4061
4189
  } from "@elizaos/core";
4062
4190
  var shouldFollowTemplate = `# Task: Decide if {{agentName}} should start following this room, i.e. eagerly participating without explicit mentions.
4063
4191
 
@@ -4090,12 +4218,12 @@ var followRoomAction = {
4090
4218
  throw new Error("State is required for followRoomAction");
4091
4219
  }
4092
4220
  async function _shouldFollow(state2) {
4093
- const shouldFollowPrompt = composePromptFromState({
4221
+ const shouldFollowPrompt = composePromptFromState2({
4094
4222
  state: state2,
4095
4223
  template: shouldFollowTemplate
4096
4224
  // Define this template separately
4097
4225
  });
4098
- const response = await runtime.useModel(ModelType2.TEXT_SMALL, {
4226
+ const response = await runtime.useModel(ModelType3.TEXT_SMALL, {
4099
4227
  runtime,
4100
4228
  prompt: shouldFollowPrompt,
4101
4229
  stopSequences: []
@@ -4658,9 +4786,9 @@ var ignoreAction = {
4658
4786
  // src/actions/muteRoom.ts
4659
4787
  import {
4660
4788
  booleanFooter as booleanFooter2,
4661
- composePromptFromState as composePromptFromState2,
4789
+ composePromptFromState as composePromptFromState3,
4662
4790
  logger as logger3,
4663
- ModelType as ModelType3
4791
+ ModelType as ModelType4
4664
4792
  } from "@elizaos/core";
4665
4793
  var shouldMuteTemplate = `# Task: Decide if {{agentName}} should mute this room and stop responding unless explicitly mentioned.
4666
4794
 
@@ -4690,12 +4818,12 @@ var muteRoomAction = {
4690
4818
  throw new Error("State is required for muting a room");
4691
4819
  }
4692
4820
  async function _shouldMute(state2) {
4693
- const shouldMutePrompt = composePromptFromState2({
4821
+ const shouldMutePrompt = composePromptFromState3({
4694
4822
  state: state2,
4695
4823
  template: shouldMuteTemplate
4696
4824
  // Define this template separately
4697
4825
  });
4698
- const response = await runtime.useModel(ModelType3.TEXT_SMALL, {
4826
+ const response = await runtime.useModel(ModelType4.TEXT_SMALL, {
4699
4827
  runtime,
4700
4828
  prompt: shouldMutePrompt,
4701
4829
  stopSequences: []
@@ -5002,8 +5130,8 @@ var noneAction = {
5002
5130
 
5003
5131
  // src/actions/reply.ts
5004
5132
  import {
5005
- composePromptFromState as composePromptFromState3,
5006
- ModelType as ModelType4
5133
+ composePromptFromState as composePromptFromState4,
5134
+ ModelType as ModelType5
5007
5135
  } from "@elizaos/core";
5008
5136
  var replyTemplate = `# Task: Generate dialog for the character {{agentName}}.
5009
5137
  {{providers}}
@@ -5030,11 +5158,11 @@ var replyAction = {
5030
5158
  handler: async (runtime, message, state, _options, callback, responses) => {
5031
5159
  const allProviders = responses?.flatMap((res) => res.content?.providers ?? []) ?? [];
5032
5160
  state = await runtime.composeState(message, [...allProviders ?? [], "RECENT_MESSAGES"]);
5033
- const prompt = composePromptFromState3({
5161
+ const prompt = composePromptFromState4({
5034
5162
  state,
5035
5163
  template: replyTemplate
5036
5164
  });
5037
- const response = await runtime.useModel(ModelType4.OBJECT_LARGE, {
5165
+ const response = await runtime.useModel(ModelType5.OBJECT_LARGE, {
5038
5166
  prompt
5039
5167
  });
5040
5168
  const responseContent = {
@@ -5115,7 +5243,7 @@ import {
5115
5243
  ChannelType,
5116
5244
  composePrompt as composePrompt2,
5117
5245
  logger as logger4,
5118
- ModelType as ModelType5,
5246
+ ModelType as ModelType6,
5119
5247
  Role
5120
5248
  } from "@elizaos/core";
5121
5249
  var canModifyRole = (currentRole, targetRole, newRole) => {
@@ -5209,7 +5337,7 @@ var updateRoleAction = {
5209
5337
  `
5210
5338
  });
5211
5339
  const result = await runtime.useModel(
5212
- ModelType5.OBJECT_LARGE,
5340
+ ModelType6.OBJECT_LARGE,
5213
5341
  {
5214
5342
  prompt: extractionPrompt,
5215
5343
  schema: {
@@ -5319,10 +5447,10 @@ var updateRoleAction = {
5319
5447
 
5320
5448
  // src/actions/sendMessage.ts
5321
5449
  import {
5322
- composePromptFromState as composePromptFromState4,
5450
+ composePromptFromState as composePromptFromState5,
5323
5451
  findEntityByName,
5324
5452
  logger as logger5,
5325
- ModelType as ModelType6,
5453
+ ModelType as ModelType7,
5326
5454
  parseJSONObjectFromText as parseJSONObjectFromText2
5327
5455
  } from "@elizaos/core";
5328
5456
  var targetExtractionTemplate = `# Task: Extract Target and Source Information
@@ -5402,11 +5530,11 @@ var sendMessageAction = {
5402
5530
  const sourceEntityId = message.entityId;
5403
5531
  const room = state.data.room ?? await runtime.getRoom(message.roomId);
5404
5532
  const worldId = room.worldId;
5405
- const targetPrompt = composePromptFromState4({
5533
+ const targetPrompt = composePromptFromState5({
5406
5534
  state,
5407
5535
  template: targetExtractionTemplate
5408
5536
  });
5409
- const targetResult = await runtime.useModel(ModelType6.TEXT_SMALL, {
5537
+ const targetResult = await runtime.useModel(ModelType7.TEXT_SMALL, {
5410
5538
  prompt: targetPrompt,
5411
5539
  stopSequences: []
5412
5540
  });
@@ -5569,11 +5697,11 @@ var import_dedent2 = __toESM(require_dedent(), 1);
5569
5697
  import {
5570
5698
  ChannelType as ChannelType2,
5571
5699
  composePrompt as composePrompt3,
5572
- composePromptFromState as composePromptFromState5,
5700
+ composePromptFromState as composePromptFromState6,
5573
5701
  createUniqueUuid,
5574
5702
  findWorldsForOwner,
5575
5703
  logger as logger6,
5576
- ModelType as ModelType7,
5704
+ ModelType as ModelType8,
5577
5705
  parseJSONObjectFromText as parseJSONObjectFromText3
5578
5706
  } from "@elizaos/core";
5579
5707
  var messageCompletionFooter = `
@@ -5766,7 +5894,7 @@ async function extractSettingValues(runtime, _message, state, worldSettings) {
5766
5894
  };
5767
5895
  var extractValidSettings = extractValidSettings2;
5768
5896
  const result = await runtime.useModel(
5769
- ModelType7.OBJECT_LARGE,
5897
+ ModelType8.OBJECT_LARGE,
5770
5898
  {
5771
5899
  prompt: basePrompt,
5772
5900
  output: "array",
@@ -5851,7 +5979,7 @@ async function handleOnboardingComplete(runtime, worldSettings, _state, callback
5851
5979
  },
5852
5980
  template: completionTemplate
5853
5981
  });
5854
- const response = await runtime.useModel(ModelType7.TEXT_LARGE, {
5982
+ const response = await runtime.useModel(ModelType8.TEXT_LARGE, {
5855
5983
  prompt
5856
5984
  });
5857
5985
  const responseContent = parseJSONObjectFromText3(response);
@@ -5885,7 +6013,7 @@ async function generateSuccessResponse(runtime, worldSettings, state, messages,
5885
6013
  },
5886
6014
  template: successTemplate
5887
6015
  });
5888
- const response = await runtime.useModel(ModelType7.TEXT_LARGE, {
6016
+ const response = await runtime.useModel(ModelType8.TEXT_LARGE, {
5889
6017
  prompt
5890
6018
  });
5891
6019
  const responseContent = parseJSONObjectFromText3(response);
@@ -5918,7 +6046,7 @@ async function generateFailureResponse(runtime, worldSettings, state, callback)
5918
6046
  },
5919
6047
  template: failureTemplate
5920
6048
  });
5921
- const response = await runtime.useModel(ModelType7.TEXT_LARGE, {
6049
+ const response = await runtime.useModel(ModelType8.TEXT_LARGE, {
5922
6050
  prompt
5923
6051
  });
5924
6052
  const responseContent = parseJSONObjectFromText3(response);
@@ -5938,11 +6066,11 @@ async function generateFailureResponse(runtime, worldSettings, state, callback)
5938
6066
  }
5939
6067
  async function generateErrorResponse(runtime, state, callback) {
5940
6068
  try {
5941
- const prompt = composePromptFromState5({
6069
+ const prompt = composePromptFromState6({
5942
6070
  state,
5943
6071
  template: errorTemplate
5944
6072
  });
5945
- const response = await runtime.useModel(ModelType7.TEXT_LARGE, {
6073
+ const response = await runtime.useModel(ModelType8.TEXT_LARGE, {
5946
6074
  prompt
5947
6075
  });
5948
6076
  const responseContent = parseJSONObjectFromText3(response);
@@ -6234,8 +6362,8 @@ var updateSettingsAction = {
6234
6362
  // src/actions/unfollowRoom.ts
6235
6363
  import {
6236
6364
  booleanFooter as booleanFooter3,
6237
- composePromptFromState as composePromptFromState6,
6238
- ModelType as ModelType8,
6365
+ composePromptFromState as composePromptFromState7,
6366
+ ModelType as ModelType9,
6239
6367
  parseBooleanFromText
6240
6368
  } from "@elizaos/core";
6241
6369
  var shouldUnfollowTemplate = `# Task: Decide if {{agentName}} should stop closely following this previously followed room and only respond when mentioned.
@@ -6261,12 +6389,12 @@ var unfollowRoomAction = {
6261
6389
  },
6262
6390
  handler: async (runtime, message, state, _options, _callback, _responses) => {
6263
6391
  async function _shouldUnfollow(state2) {
6264
- const shouldUnfollowPrompt = composePromptFromState6({
6392
+ const shouldUnfollowPrompt = composePromptFromState7({
6265
6393
  state: state2,
6266
6394
  template: shouldUnfollowTemplate
6267
6395
  // Define this template separately
6268
6396
  });
6269
- const response = await runtime.useModel(ModelType8.TEXT_SMALL, {
6397
+ const response = await runtime.useModel(ModelType9.TEXT_SMALL, {
6270
6398
  prompt: shouldUnfollowPrompt
6271
6399
  });
6272
6400
  const parsedResponse = parseBooleanFromText(response.trim());
@@ -6556,9 +6684,9 @@ var unfollowRoomAction = {
6556
6684
  // src/actions/unmuteRoom.ts
6557
6685
  import {
6558
6686
  booleanFooter as booleanFooter4,
6559
- composePromptFromState as composePromptFromState7,
6687
+ composePromptFromState as composePromptFromState8,
6560
6688
  logger as logger7,
6561
- ModelType as ModelType9
6689
+ ModelType as ModelType10
6562
6690
  } from "@elizaos/core";
6563
6691
  var shouldUnmuteTemplate = `# Task: Decide if {{agentName}} should unmute this previously muted room and start considering it for responses again.
6564
6692
 
@@ -6583,12 +6711,12 @@ var unmuteRoomAction = {
6583
6711
  },
6584
6712
  handler: async (runtime, message, state, _options, _callback, _responses) => {
6585
6713
  async function _shouldUnmute(state2) {
6586
- const shouldUnmutePrompt = composePromptFromState7({
6714
+ const shouldUnmutePrompt = composePromptFromState8({
6587
6715
  state: state2,
6588
6716
  template: shouldUnmuteTemplate
6589
6717
  // Define this template separately
6590
6718
  });
6591
- const response = await runtime.useModel(ModelType9.TEXT_SMALL, {
6719
+ const response = await runtime.useModel(ModelType10.TEXT_SMALL, {
6592
6720
  runtime,
6593
6721
  prompt: shouldUnmutePrompt,
6594
6722
  stopSequences: []
@@ -6749,10 +6877,10 @@ var unmuteRoomAction = {
6749
6877
 
6750
6878
  // src/actions/updateEntity.ts
6751
6879
  import {
6752
- composePromptFromState as composePromptFromState8,
6880
+ composePromptFromState as composePromptFromState9,
6753
6881
  findEntityByName as findEntityByName2,
6754
6882
  logger as logger8,
6755
- ModelType as ModelType10
6883
+ ModelType as ModelType11
6756
6884
  } from "@elizaos/core";
6757
6885
  var componentTemplate = `# Task: Extract Source and Update Component Data
6758
6886
 
@@ -6851,11 +6979,11 @@ var updateEntityAction = {
6851
6979
  return;
6852
6980
  }
6853
6981
  let existingComponent = null;
6854
- const prompt = composePromptFromState8({
6982
+ const prompt = composePromptFromState9({
6855
6983
  state,
6856
6984
  template: componentTemplate
6857
6985
  });
6858
- const result = await runtime.useModel(ModelType10.TEXT_LARGE, {
6986
+ const result = await runtime.useModel(ModelType11.TEXT_LARGE, {
6859
6987
  prompt,
6860
6988
  stopSequences: []
6861
6989
  });
@@ -6984,7 +7112,7 @@ import { z } from "zod";
6984
7112
  import { getEntityDetails, logger as logger9 } from "@elizaos/core";
6985
7113
  import { composePrompt as composePrompt4 } from "@elizaos/core";
6986
7114
  import {
6987
- ModelType as ModelType11
7115
+ ModelType as ModelType12
6988
7116
  } from "@elizaos/core";
6989
7117
  var relationshipSchema = z.object({
6990
7118
  sourceEntityId: z.string(),
@@ -7109,7 +7237,7 @@ async function handler(runtime, message, state) {
7109
7237
  template: runtime.character.templates?.reflectionTemplate || reflectionTemplate
7110
7238
  });
7111
7239
  try {
7112
- const reflection = await runtime.useModel(ModelType11.OBJECT_SMALL, {
7240
+ const reflection = await runtime.useModel(ModelType12.OBJECT_SMALL, {
7113
7241
  prompt
7114
7242
  // Remove schema validation to avoid zod issues
7115
7243
  });
@@ -7953,7 +8081,7 @@ var evaluatorsProvider = {
7953
8081
  };
7954
8082
 
7955
8083
  // src/providers/facts.ts
7956
- import { ModelType as ModelType12 } from "@elizaos/core";
8084
+ import { ModelType as ModelType13 } from "@elizaos/core";
7957
8085
  import { logger as logger12 } from "@elizaos/core";
7958
8086
  function formatFacts2(facts) {
7959
8087
  return facts.reverse().map((fact) => fact.content.text).join("\n");
@@ -7971,7 +8099,7 @@ var factsProvider = {
7971
8099
  unique: false
7972
8100
  });
7973
8101
  const last5Messages = recentMessages.slice(-5).map((message2) => message2.content.text).join("\n");
7974
- const embedding = await runtime.useModel(ModelType12.TEXT_EMBEDDING, {
8102
+ const embedding = await runtime.useModel(ModelType13.TEXT_EMBEDDING, {
7975
8103
  text: last5Messages
7976
8104
  });
7977
8105
  const [relevantFacts, recentFactsData] = await Promise.all([
@@ -10295,7 +10423,7 @@ async function processAttachments(attachments, runtime) {
10295
10423
  const processedAttachment = { ...attachment };
10296
10424
  const isRemote = /^(http|https):\/\//.test(attachment.url);
10297
10425
  const url = isRemote ? attachment.url : getLocalServerUrl(attachment.url);
10298
- if (attachment.contentType === ContentType.IMAGE && !attachment.description) {
10426
+ if (attachment.contentType === ContentType2.IMAGE && !attachment.description) {
10299
10427
  logger18.debug(`[Bootstrap] Generating description for image: ${attachment.url}`);
10300
10428
  let imageUrl = url;
10301
10429
  if (!isRemote) {
@@ -10306,7 +10434,7 @@ async function processAttachments(attachments, runtime) {
10306
10434
  imageUrl = `data:${contentType};base64,${buffer.toString("base64")}`;
10307
10435
  }
10308
10436
  try {
10309
- const response = await runtime.useModel(ModelType13.IMAGE_DESCRIPTION, {
10437
+ const response = await runtime.useModel(ModelType14.IMAGE_DESCRIPTION, {
10310
10438
  prompt: imageDescriptionTemplate,
10311
10439
  imageUrl
10312
10440
  });
@@ -10335,7 +10463,7 @@ async function processAttachments(attachments, runtime) {
10335
10463
  } catch (error) {
10336
10464
  logger18.error(`[Bootstrap] Error generating image description:`, error);
10337
10465
  }
10338
- } else if (attachment.contentType === ContentType.DOCUMENT && !attachment.text) {
10466
+ } else if (attachment.contentType === ContentType2.DOCUMENT && !attachment.text) {
10339
10467
  const res = await lib_default(url);
10340
10468
  if (!res.ok) throw new Error(`Failed to fetch document: ${res.statusText}`);
10341
10469
  const contentType = res.headers.get("content-type") || "";
@@ -10486,7 +10614,7 @@ var messageReceivedHandler = async ({
10486
10614
  }
10487
10615
  let shouldRespond = true;
10488
10616
  if (!shouldSkipShouldRespond) {
10489
- const shouldRespondPrompt = composePromptFromState9({
10617
+ const shouldRespondPrompt = composePromptFromState10({
10490
10618
  state,
10491
10619
  template: runtime.character.templates?.shouldRespondTemplate || shouldRespondTemplate
10492
10620
  });
@@ -10494,7 +10622,7 @@ var messageReceivedHandler = async ({
10494
10622
  `[Bootstrap] Evaluating response for ${runtime.character.name}
10495
10623
  Prompt: ${shouldRespondPrompt}`
10496
10624
  );
10497
- const response = await runtime.useModel(ModelType13.TEXT_SMALL, {
10625
+ const response = await runtime.useModel(ModelType14.TEXT_SMALL, {
10498
10626
  prompt: shouldRespondPrompt
10499
10627
  });
10500
10628
  logger18.debug(
@@ -10520,7 +10648,7 @@ ${response}`
10520
10648
  if (!state.values.actionNames) {
10521
10649
  logger18.warn("actionNames data missing from state, even though it was requested");
10522
10650
  }
10523
- const prompt = composePromptFromState9({
10651
+ const prompt = composePromptFromState10({
10524
10652
  state,
10525
10653
  template: runtime.character.templates?.messageHandlerTemplate || messageHandlerTemplate
10526
10654
  });
@@ -10528,7 +10656,7 @@ ${response}`
10528
10656
  let retries = 0;
10529
10657
  const maxRetries = 3;
10530
10658
  while (retries < maxRetries && (!responseContent?.thought || !responseContent?.actions)) {
10531
- let response = await runtime.useModel(ModelType13.TEXT_LARGE, {
10659
+ let response = await runtime.useModel(ModelType14.TEXT_LARGE, {
10532
10660
  prompt
10533
10661
  });
10534
10662
  logger18.debug("[Bootstrap] *** Raw LLM Response ***\n", response);
@@ -10774,7 +10902,7 @@ var postGeneratedHandler = async ({
10774
10902
  if (entity?.metadata?.twitter?.userName || entity?.metadata?.userName) {
10775
10903
  state.values.twitterUserName = entity?.metadata?.twitter?.userName || entity?.metadata?.userName;
10776
10904
  }
10777
- const prompt = composePromptFromState9({
10905
+ const prompt = composePromptFromState10({
10778
10906
  state,
10779
10907
  template: runtime.character.templates?.messageHandlerTemplate || messageHandlerTemplate
10780
10908
  });
@@ -10782,7 +10910,7 @@ var postGeneratedHandler = async ({
10782
10910
  let retries = 0;
10783
10911
  const maxRetries = 3;
10784
10912
  while (retries < maxRetries && (!responseContent?.thought || !responseContent?.actions)) {
10785
- const response = await runtime.useModel(ModelType13.TEXT_SMALL, {
10913
+ const response = await runtime.useModel(ModelType14.TEXT_SMALL, {
10786
10914
  prompt
10787
10915
  });
10788
10916
  console.log("prompt is", prompt);
@@ -10810,11 +10938,11 @@ var postGeneratedHandler = async ({
10810
10938
  }
10811
10939
  }
10812
10940
  state = await runtime.composeState(message, responseContent?.providers);
10813
- const postPrompt = composePromptFromState9({
10941
+ const postPrompt = composePromptFromState10({
10814
10942
  state,
10815
10943
  template: runtime.character.templates?.postCreationTemplate || postCreationTemplate
10816
10944
  });
10817
- const xmlResponseText = await runtime.useModel(ModelType13.TEXT_LARGE, {
10945
+ const xmlResponseText = await runtime.useModel(ModelType14.TEXT_LARGE, {
10818
10946
  prompt: postPrompt
10819
10947
  });
10820
10948
  const parsedXmlResponse = parseKeyValueXml(xmlResponseText);
@@ -11150,7 +11278,8 @@ var bootstrapPlugin = {
11150
11278
  updateEntityAction,
11151
11279
  choiceAction,
11152
11280
  updateRoleAction,
11153
- updateSettingsAction
11281
+ updateSettingsAction,
11282
+ generateImageAction
11154
11283
  ],
11155
11284
  // this is jank, these events are not valid
11156
11285
  events,
@@ -11191,6 +11320,7 @@ export {
11191
11320
  factsProvider,
11192
11321
  fetchMediaData,
11193
11322
  followRoomAction,
11323
+ generateImageAction,
11194
11324
  ignoreAction,
11195
11325
  muteRoomAction,
11196
11326
  noneAction,