@elizaos/core 1.0.0-beta.27 → 1.0.0-beta.28

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
@@ -658,6 +658,21 @@ Response format should be formatted in a valid JSON block like this:
658
658
  }
659
659
  \`\`\`
660
660
  Your response should include the valid JSON block and nothing else.`;
661
+ var providersTemplate = `# Task: Determine which providers would be most relevant for {{agentName}} to use in responding to this message.
662
+ {{providers}}
663
+ # Instructions: Based on the context and message, select the providers that would give {{agentName}} the most relevant information for crafting a response.
664
+ Consider the following when selecting providers:
665
+ - What information would help {{agentName}} understand the context better?
666
+ - What data would help {{agentName}} provide a more informed response?
667
+ - What providers might have relevant historical or contextual information?
668
+
669
+ Response format should be formatted in a valid JSON block like this:
670
+ \`\`\`json
671
+ {
672
+ "providers": ["<string>", "<string>", ...]
673
+ }
674
+ \`\`\`
675
+ Your response should include the valid JSON block and nothing else.`;
661
676
  var messageHandlerTemplate = `# Task: Generate dialog and actions for the character {{agentName}}.
662
677
  {{providers}}
663
678
  # 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.
@@ -666,6 +681,7 @@ First, think about what you want to do next and plan your actions. Then, write t
666
681
  "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)
667
682
  "providers" should be an optional array of the providers that {{agentName}} will use to have the right context for responding and acting
668
683
  "evaluators" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding
684
+ "message" should be the next message for {{agentName}} which they will send to the conversation.
669
685
  These are the available valid actions: {{actionNames}}
670
686
 
671
687
  Response format should be formatted in a valid JSON block like this:
@@ -673,7 +689,8 @@ Response format should be formatted in a valid JSON block like this:
673
689
  {
674
690
  "thought": "<string>",
675
691
  "actions": ["<string>", "<string>", ...],
676
- "providers": ["<string>", "<string>", ...]
692
+ "providers": ["<string>", "<string>", ...],
693
+ "message": "<string>"
677
694
  }
678
695
  \`\`\`
679
696
 
@@ -1242,6 +1259,7 @@ var AgentRuntime = class {
1242
1259
  evaluators = [];
1243
1260
  providers = [];
1244
1261
  plugins = [];
1262
+ isInitialized = false;
1245
1263
  events = /* @__PURE__ */ new Map();
1246
1264
  stateCache = /* @__PURE__ */ new Map();
1247
1265
  fetch = fetch;
@@ -1343,9 +1361,13 @@ var AgentRuntime = class {
1343
1361
  }
1344
1362
  }
1345
1363
  if (plugin.services) {
1346
- plugin.services.forEach((service) => {
1347
- this.servicesInitQueue.add(service);
1348
- });
1364
+ for (const service of plugin.services) {
1365
+ if (this.isInitialized) {
1366
+ await this.registerService(service);
1367
+ } else {
1368
+ this.servicesInitQueue.add(service);
1369
+ }
1370
+ }
1349
1371
  }
1350
1372
  }
1351
1373
  getAllServices() {
@@ -1359,6 +1381,11 @@ var AgentRuntime = class {
1359
1381
  }
1360
1382
  }
1361
1383
  async initialize() {
1384
+ if (this.isInitialized) {
1385
+ this.runtimeLogger.warn("Agent already initialized");
1386
+ return;
1387
+ }
1388
+ this.isInitialized = true;
1362
1389
  const registeredPluginNames = /* @__PURE__ */ new Set();
1363
1390
  const pluginRegistrationPromises = [];
1364
1391
  for (const plugin of [...this.plugins]) {
@@ -2778,6 +2805,7 @@ export {
2778
2805
  postActionResponseFooter,
2779
2806
  postCreationTemplate,
2780
2807
  prependWavHeader,
2808
+ providersTemplate,
2781
2809
  saltSettingValue,
2782
2810
  saltWorldSettings,
2783
2811
  shouldRespondTemplate,
package/dist/prompts.d.ts CHANGED
@@ -112,7 +112,8 @@ 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\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.";
115
+ export declare const providersTemplate = "# Task: Determine which providers would be most relevant for {{agentName}} to use in responding to this message.\n{{providers}}\n# Instructions: Based on the context and message, select the providers that would give {{agentName}} the most relevant information for crafting a response.\nConsider the following when selecting providers:\n- What information would help {{agentName}} understand the context better?\n- What data would help {{agentName}} provide a more informed response?\n- What providers might have relevant historical or contextual information?\n\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\nYour response should include the valid JSON block and nothing else.";
116
+ 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\"message\" should be the next message for {{agentName}} which they will send to the conversation.\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 \"message\": \"<string>\"\n}\n```\n\nYour response should include the valid JSON block and nothing else.";
116
117
  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
118
  export declare const booleanFooter = "Respond with only a YES or a NO.";
118
119
  /**
package/dist/runtime.d.ts CHANGED
@@ -33,6 +33,7 @@ export declare class AgentRuntime implements IAgentRuntime {
33
33
  readonly evaluators: Evaluator[];
34
34
  readonly providers: Provider[];
35
35
  readonly plugins: Plugin[];
36
+ private isInitialized;
36
37
  events: Map<string, ((params: any) => Promise<void>)[]>;
37
38
  stateCache: Map<`${string}-${string}-${string}-${string}-${string}`, {
38
39
  values: {
package/dist/types.d.ts CHANGED
@@ -772,7 +772,7 @@ export interface IAgentRuntime extends IDatabaseAdapter {
772
772
  }): Promise<void>;
773
773
  getService<T extends Service>(service: ServiceTypeName | string): T | null;
774
774
  getAllServices(): Map<ServiceTypeName, Service>;
775
- registerService(service: typeof Service): void;
775
+ registerService(service: typeof Service): Promise<void>;
776
776
  registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
777
777
  setSetting(key: string, value: string | boolean | null | any, secret: boolean): void;
778
778
  getSetting(key: string): string | boolean | null | any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "1.0.0-beta.27",
3
+ "version": "1.0.0-beta.28",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -76,5 +76,5 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "2d8cc230c67ecbb23e653e2133bc1fdab9c6fbf4"
79
+ "gitHead": "a46935714cc0ca724360973e73ce2995cb783018"
80
80
  }