@elizaos/core 1.0.0-alpha.65 → 1.0.0-alpha.67

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
@@ -626,9 +626,6 @@ var formatMessages = ({
626
626
  messages,
627
627
  entities
628
628
  }) => {
629
- const newestMessageWithContentPlan = messages.find(
630
- (message) => message.content.plan
631
- );
632
629
  const messageStrings = messages.reverse().filter((message) => message.entityId).map((message) => {
633
630
  const messageText = message.content.text;
634
631
  const messageActions = message.content.actions;
@@ -646,8 +643,7 @@ var formatMessages = ({
646
643
  const timestampString = `${timeString} (${timestamp}) [${shortId}]`;
647
644
  const textString = messageText ? `${timestampString} ${formattedName}: ${messageText}` : null;
648
645
  const actionString = messageActions && messageActions.length > 0 ? `${textString ? "" : timestampString} (${formattedName}'s actions: ${messageActions.join(", ")})` : null;
649
- const planString = newestMessageWithContentPlan?.id === message.id ? `(${formattedName}'s plan: ${newestMessageWithContentPlan?.content?.plan})` : null;
650
- const messageString = [textString, thoughtString, planString, actionString, attachmentString].filter(Boolean).join("\n");
646
+ const messageString = [textString, thoughtString, actionString, attachmentString].filter(Boolean).join("\n");
651
647
  return messageString;
652
648
  }).join("\n");
653
649
  return messageStrings;
@@ -697,14 +693,12 @@ First, think about what you want to do next and plan your actions. Then, write t
697
693
  "actions" should be an array of the actions {{agentName}} plans to take based on the thought (if none, use IGNORE, if simply responding with text, use REPLY)
698
694
  "providers" should be an optional array of the providers that {{agentName}} will use to have the right context for responding and acting
699
695
  "evaluators" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding
700
- "plan" should be explanation of the message you plan to send, the actions you plan to take, and the data providers you plan to use.
701
696
  These are the available valid actions: {{actionNames}}
702
697
 
703
698
  Response format should be formatted in a valid JSON block like this:
704
699
  \`\`\`json
705
700
  {
706
701
  "thought": "<string>",
707
- "plan": "<string>",
708
702
  "actions": ["<string>", "<string>", ...],
709
703
  "providers": ["<string>", "<string>", ...]
710
704
  }
@@ -1219,7 +1213,7 @@ async function findWorldForOwner(runtime, entityId) {
1219
1213
  return world;
1220
1214
  }
1221
1215
  }
1222
- logger.info(`No server found for owner ${entityId}`);
1216
+ logger.debug(`No server found for owner ${entityId}`);
1223
1217
  return null;
1224
1218
  } catch (error) {
1225
1219
  logger.error(`Error finding server for owner: ${error}`);
@@ -2394,13 +2388,12 @@ var replyAction = {
2394
2388
  state,
2395
2389
  template: replyTemplate
2396
2390
  });
2397
- const response = await runtime.useModel(ModelType.TEXT_SMALL, {
2391
+ const response = await runtime.useModel(ModelType.OBJECT_LARGE, {
2398
2392
  prompt
2399
2393
  });
2400
- const responseContentObj = parseJSONObjectFromText(response);
2401
2394
  const responseContent = {
2402
- thought: responseContentObj.thought,
2403
- text: responseContentObj.message || "",
2395
+ thought: response.thought,
2396
+ text: response.message || "",
2404
2397
  actions: ["REPLY"]
2405
2398
  };
2406
2399
  await callback(responseContent);
@@ -3269,13 +3262,12 @@ var updateSettingsAction = {
3269
3262
  validate: async (runtime, message, _state) => {
3270
3263
  try {
3271
3264
  if (message.content.channelType !== "dm" /* DM */) {
3272
- logger.info(`Skipping settings in non-DM channel (type: ${message.content.channelType})`);
3265
+ logger.debug(`Skipping settings in non-DM channel (type: ${message.content.channelType})`);
3273
3266
  return false;
3274
3267
  }
3275
- logger.info(`Looking for server where user ${message.entityId} is owner`);
3268
+ logger.debug(`Looking for server where user ${message.entityId} is owner`);
3276
3269
  const world = await findWorldForOwner(runtime, message.entityId);
3277
3270
  if (!world) {
3278
- logger.error(`No server ownership found for user ${message.entityId}`);
3279
3271
  return false;
3280
3272
  }
3281
3273
  const worldSettings = world.metadata.settings;
@@ -3283,7 +3275,7 @@ var updateSettingsAction = {
3283
3275
  logger.error(`No settings state found for server ${world.serverId}`);
3284
3276
  return false;
3285
3277
  }
3286
- logger.info(`Found valid settings state for server ${world.serverId}`);
3278
+ logger.debug(`Found valid settings state for server ${world.serverId}`);
3287
3279
  return true;
3288
3280
  } catch (error) {
3289
3281
  logger.error(`Error validating settings action: ${error}`);
@@ -5803,6 +5795,18 @@ var settingsProvider = {
5803
5795
  text: "Error: Room not found"
5804
5796
  };
5805
5797
  }
5798
+ if (!room.worldId) {
5799
+ logger.debug("No world found for settings provider -- settings provider will be skipped");
5800
+ return {
5801
+ data: {
5802
+ settings: []
5803
+ },
5804
+ values: {
5805
+ settings: "Room does not have a worldId -- settings provider will be skipped"
5806
+ },
5807
+ text: "Room does not have a worldId -- settings provider will be skipped"
5808
+ };
5809
+ }
5806
5810
  const type = room.type;
5807
5811
  const isOnboarding = type === "dm" /* DM */;
5808
5812
  let world;
@@ -5824,6 +5828,10 @@ var settingsProvider = {
5824
5828
  } else {
5825
5829
  try {
5826
5830
  world = await runtime.getWorld(room.worldId);
5831
+ if (!world) {
5832
+ logger.error(`No world found for room ${room.worldId}`);
5833
+ throw new Error(`No world found for room ${room.worldId}`);
5834
+ }
5827
5835
  serverId = world.serverId;
5828
5836
  if (serverId) {
5829
5837
  worldSettings = await getWorldSettings2(runtime, serverId);
@@ -6462,13 +6470,13 @@ var messageReceivedHandler = async ({
6462
6470
  let responseContent = null;
6463
6471
  let retries = 0;
6464
6472
  const maxRetries = 3;
6465
- while (retries < maxRetries && (!responseContent?.thought || !responseContent?.plan || !responseContent?.actions)) {
6473
+ while (retries < maxRetries && (!responseContent?.thought || !responseContent?.actions)) {
6466
6474
  const response2 = await runtime.useModel(ModelType.TEXT_SMALL, {
6467
6475
  prompt
6468
6476
  });
6469
6477
  responseContent = parseJSONObjectFromText(response2);
6470
6478
  retries++;
6471
- if ((!responseContent?.thought || !responseContent?.plan) && !responseContent?.actions) {
6479
+ if (!responseContent?.thought && !responseContent?.actions) {
6472
6480
  logger.warn("*** Missing required fields, retrying... ***");
6473
6481
  }
6474
6482
  }
@@ -6480,7 +6488,6 @@ var messageReceivedHandler = async ({
6480
6488
  return;
6481
6489
  }
6482
6490
  if (responseContent) {
6483
- responseContent.plan = responseContent.plan?.trim();
6484
6491
  responseContent.inReplyTo = createUniqueUuid(runtime, message.id);
6485
6492
  responseMessages = [
6486
6493
  {
@@ -6498,7 +6505,6 @@ var messageReceivedHandler = async ({
6498
6505
  agentId: runtime.agentId,
6499
6506
  content: {
6500
6507
  thought: responseContent.thought,
6501
- plan: responseContent.plan,
6502
6508
  actions: responseContent.actions,
6503
6509
  providers: responseContent.providers
6504
6510
  },
@@ -6626,7 +6632,6 @@ var postGeneratedHandler = async ({
6626
6632
  source: "twitter",
6627
6633
  channelType: "FEED" /* FEED */,
6628
6634
  thought: jsonResponse.thought || "",
6629
- plan: jsonResponse.plan || "",
6630
6635
  type: "post"
6631
6636
  },
6632
6637
  roomId: message.roomId,
package/dist/prompts.d.ts CHANGED
@@ -112,7 +112,7 @@ export declare const formatMessages: ({ messages, entities, }: {
112
112
  }) => string;
113
113
  export declare const formatTimestamp: (messageDate: number) => string;
114
114
  export declare const shouldRespondTemplate = "# Task: Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.\n{{providers}}\n# Instructions: Decide if {{agentName}} should respond to or interact with the conversation.\nIf the message is directed at or relevant to {{agentName}}, respond with RESPOND action.\nIf a user asks {{agentName}} to be quiet, respond with STOP action.\nIf {{agentName}} should ignore the message, respond with IGNORE action.\nIf responding with the RESPOND action, include a list of optional providers that could be relevant to the response.\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"name\": \"{{agentName}}\",\n\t\"reasoning\": \"<string>\",\n \"action\": \"RESPOND\" | \"IGNORE\" | \"STOP\",\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\nYour response should include the valid JSON block and nothing else.";
115
- export declare const messageHandlerTemplate = "# Task: Generate dialog and actions for the character {{agentName}}.\n{{providers}}\n# Instructions: Write a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be an array of the actions {{agentName}} plans to take based on the thought (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be an optional array of the providers that {{agentName}} will use to have the right context for responding and acting\n\"evaluators\" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding\n\"plan\" should be explanation of the message you plan to send, the actions you plan to take, and the data providers you plan to use.\nThese are the available valid actions: {{actionNames}}\n\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"thought\": \"<string>\",\n \"plan\": \"<string>\",\n \"actions\": [\"<string>\", \"<string>\", ...],\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\n\nYour response should include the valid JSON block and nothing else.";
115
+ export declare const messageHandlerTemplate = "# Task: Generate dialog and actions for the character {{agentName}}.\n{{providers}}\n# Instructions: Write a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be an array of the actions {{agentName}} plans to take based on the thought (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be an optional array of the providers that {{agentName}} will use to have the right context for responding and acting\n\"evaluators\" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding\nThese are the available valid actions: {{actionNames}}\n\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"thought\": \"<string>\",\n \"actions\": [\"<string>\", \"<string>\", ...],\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\n\nYour response should include the valid JSON block and nothing else.";
116
116
  export declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n```json\n{ \"thought\": \"I am thinking about writing a post about the importance of AI in our lives\", \"post\": \"AI is changing the world and it is important to understand how it works\", \"imagePrompt\": \"A futuristic cityscape with flying cars and people using AI to do things\" }\n```\n\n2. A post about dogs\n```json\n{ \"thought\": \"I am thinking about writing a post about dogs\", \"post\": \"Dogs are man's best friend and they are loyal and loving\", \"imagePrompt\": \"A dog playing with a ball in a park\" }\n```\n\n3. A post about finding a new job\n```json\n{ \"thought\": \"Getting a job is hard, I bet there's a good tweet in that\", \"post\": \"Just keep going!\", \"imagePrompt\": \"A person looking at a computer screen with a job search website\" }\n```\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in a valid JSON block like this:\n```json\n{ \"thought\": \"<string>\", \"post\": \"<string>\", \"imagePrompt\": \"<string>\" }\n```\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding, inlcuding a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.\nYour reponse should ONLY contain a valid JSON block and nothing else.";
117
117
  export declare const booleanFooter = "Respond with only a YES or a NO.";
118
118
  /**
package/dist/types.d.ts CHANGED
@@ -16,8 +16,6 @@ export declare function asUUID(id: string): UUID;
16
16
  export interface Content {
17
17
  /** The agent's internal thought process */
18
18
  thought?: string;
19
- /** The agent's plan for the next message */
20
- plan?: string;
21
19
  /** The main text content visible to users */
22
20
  text?: string;
23
21
  /** Optional actions to be performed */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "1.0.0-alpha.65",
3
+ "version": "1.0.0-alpha.67",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "8c706f7a89a77ac0c401b6a55e5b9613f839ed3f"
75
+ "gitHead": "d98e073424f67e556e4a753251355fbefa7c664b"
76
76
  }