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

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
@@ -399,6 +399,28 @@ var createPrettyConfig = () => ({
399
399
  colorize: true,
400
400
  translateTime: "yyyy-mm-dd HH:MM:ss",
401
401
  ignore: "pid,hostname",
402
+ levelColors: {
403
+ 60: "red",
404
+ // fatal
405
+ 50: "red",
406
+ // error
407
+ 40: "yellow",
408
+ // warn
409
+ 30: "blue",
410
+ // info
411
+ 29: "green",
412
+ // log
413
+ 28: "cyan",
414
+ // progress
415
+ 27: "greenBright",
416
+ // success
417
+ 20: "magenta",
418
+ // debug
419
+ 10: "grey",
420
+ // trace
421
+ "*": "white"
422
+ // default for any unspecified level
423
+ },
402
424
  customPrettifiers: {
403
425
  level: (inputData) => {
404
426
  let level;
@@ -658,6 +680,21 @@ Response format should be formatted in a valid JSON block like this:
658
680
  }
659
681
  \`\`\`
660
682
  Your response should include the valid JSON block and nothing else.`;
683
+ var providersTemplate = `# Task: Determine which providers would be most relevant for {{agentName}} to use in responding to this message.
684
+ {{providers}}
685
+ # Instructions: Based on the context and message, select the providers that would give {{agentName}} the most relevant information for crafting a response.
686
+ Consider the following when selecting providers:
687
+ - What information would help {{agentName}} understand the context better?
688
+ - What data would help {{agentName}} provide a more informed response?
689
+ - What providers might have relevant historical or contextual information?
690
+
691
+ Response format should be formatted in a valid JSON block like this:
692
+ \`\`\`json
693
+ {
694
+ "providers": ["<string>", "<string>", ...]
695
+ }
696
+ \`\`\`
697
+ Your response should include the valid JSON block and nothing else.`;
661
698
  var messageHandlerTemplate = `# Task: Generate dialog and actions for the character {{agentName}}.
662
699
  {{providers}}
663
700
  # 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 +703,7 @@ First, think about what you want to do next and plan your actions. Then, write t
666
703
  "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
704
  "providers" should be an optional array of the providers that {{agentName}} will use to have the right context for responding and acting
668
705
  "evaluators" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding
706
+ "message" should be the next message for {{agentName}} which they will send to the conversation.
669
707
  These are the available valid actions: {{actionNames}}
670
708
 
671
709
  Response format should be formatted in a valid JSON block like this:
@@ -673,7 +711,8 @@ Response format should be formatted in a valid JSON block like this:
673
711
  {
674
712
  "thought": "<string>",
675
713
  "actions": ["<string>", "<string>", ...],
676
- "providers": ["<string>", "<string>", ...]
714
+ "providers": ["<string>", "<string>", ...],
715
+ "message": "<string>"
677
716
  }
678
717
  \`\`\`
679
718
 
@@ -1242,6 +1281,7 @@ var AgentRuntime = class {
1242
1281
  evaluators = [];
1243
1282
  providers = [];
1244
1283
  plugins = [];
1284
+ isInitialized = false;
1245
1285
  events = /* @__PURE__ */ new Map();
1246
1286
  stateCache = /* @__PURE__ */ new Map();
1247
1287
  fetch = fetch;
@@ -1343,9 +1383,13 @@ var AgentRuntime = class {
1343
1383
  }
1344
1384
  }
1345
1385
  if (plugin.services) {
1346
- plugin.services.forEach((service) => {
1347
- this.servicesInitQueue.add(service);
1348
- });
1386
+ for (const service of plugin.services) {
1387
+ if (this.isInitialized) {
1388
+ await this.registerService(service);
1389
+ } else {
1390
+ this.servicesInitQueue.add(service);
1391
+ }
1392
+ }
1349
1393
  }
1350
1394
  }
1351
1395
  getAllServices() {
@@ -1359,6 +1403,10 @@ var AgentRuntime = class {
1359
1403
  }
1360
1404
  }
1361
1405
  async initialize() {
1406
+ if (this.isInitialized) {
1407
+ this.runtimeLogger.warn("Agent already initialized");
1408
+ return;
1409
+ }
1362
1410
  const registeredPluginNames = /* @__PURE__ */ new Set();
1363
1411
  const pluginRegistrationPromises = [];
1364
1412
  for (const plugin of [...this.plugins]) {
@@ -1447,6 +1495,7 @@ var AgentRuntime = class {
1447
1495
  for (const service of this.servicesInitQueue) {
1448
1496
  await this.registerService(service);
1449
1497
  }
1498
+ this.isInitialized = true;
1450
1499
  }
1451
1500
  async handleProcessingError(error, context) {
1452
1501
  this.runtimeLogger.error(`Error ${context}:`, error?.message || error || "Unknown error");
@@ -2778,6 +2827,7 @@ export {
2778
2827
  postActionResponseFooter,
2779
2828
  postCreationTemplate,
2780
2829
  prependWavHeader,
2830
+ providersTemplate,
2781
2831
  saltSettingValue,
2782
2832
  saltWorldSettings,
2783
2833
  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.29",
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": "626255eb1570b074feacafa3fdf82d0cf957cfc1"
80
80
  }