@elizaos/core 1.0.0-beta.0 → 1.0.0-beta.3

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
@@ -173,9 +173,6 @@ var CacheKeyPrefix = /* @__PURE__ */ ((CacheKeyPrefix2) => {
173
173
  CacheKeyPrefix2["KNOWLEDGE"] = "knowledge";
174
174
  return CacheKeyPrefix2;
175
175
  })(CacheKeyPrefix || {});
176
- var TeeLogDAO = class {
177
- db;
178
- };
179
176
  var TEEMode = /* @__PURE__ */ ((TEEMode2) => {
180
177
  TEEMode2["OFF"] = "OFF";
181
178
  TEEMode2["LOCAL"] = "LOCAL";
@@ -184,7 +181,6 @@ var TEEMode = /* @__PURE__ */ ((TEEMode2) => {
184
181
  return TEEMode2;
185
182
  })(TEEMode || {});
186
183
  var TeeType = /* @__PURE__ */ ((TeeType2) => {
187
- TeeType2["SGX_GRAMINE"] = "sgx_gramine";
188
184
  TeeType2["TDX_DSTACK"] = "tdx_dstack";
189
185
  return TeeType2;
190
186
  })(TeeType || {});
@@ -461,17 +457,50 @@ var customLevels = {
461
457
  var raw = parseBooleanFromText(process?.env?.LOG_JSON_FORMAT) || false;
462
458
  var isDebugMode = (process?.env?.LOG_LEVEL || "").toLowerCase() === "debug";
463
459
  var effectiveLogLevel = isDebugMode ? "debug" : process?.env?.DEFAULT_LOG_LEVEL || "info";
460
+ var createPrettyConfig = () => ({
461
+ colorize: true,
462
+ translateTime: "yyyy-mm-dd HH:MM:ss",
463
+ ignore: "pid,hostname",
464
+ customPrettifiers: {
465
+ level: (inputData) => {
466
+ let level;
467
+ if (typeof inputData === "object" && inputData !== null) {
468
+ level = inputData.level || inputData.value;
469
+ } else {
470
+ level = inputData;
471
+ }
472
+ const levelNames = {
473
+ 10: "TRACE",
474
+ 20: "DEBUG",
475
+ 27: "SUCCESS",
476
+ 28: "PROGRESS",
477
+ 29: "LOG",
478
+ 30: "INFO",
479
+ 40: "WARN",
480
+ 50: "ERROR",
481
+ 60: "FATAL"
482
+ };
483
+ if (typeof level === "number") {
484
+ return levelNames[level] || `LEVEL${level}`;
485
+ }
486
+ if (level === void 0 || level === null) {
487
+ return "UNKNOWN";
488
+ }
489
+ return String(level).toUpperCase();
490
+ },
491
+ // Add a custom prettifier for error messages
492
+ msg: (msg) => {
493
+ return msg.replace(/ERROR \([^)]+\):/g, "ERROR:");
494
+ }
495
+ },
496
+ messageFormat: "{msg}"
497
+ });
464
498
  var createStream = async () => {
465
499
  if (raw) {
466
500
  return void 0;
467
501
  }
468
502
  const pretty = await import("pino-pretty");
469
- return pretty.default({
470
- colorize: true,
471
- translateTime: "yyyy-mm-dd HH:MM:ss",
472
- ignore: "pid,hostname"
473
- // Don't use minimumLevel since we're filtering in the destination
474
- });
503
+ return pretty.default(createPrettyConfig());
475
504
  };
476
505
  var options = {
477
506
  level: effectiveLogLevel,
@@ -480,15 +509,32 @@ var options = {
480
509
  hooks: {
481
510
  logMethod(inputArgs, method) {
482
511
  const [arg1, ...rest] = inputArgs;
512
+ const formatError = (err) => ({
513
+ message: `(${err.name}) ${err.message}`,
514
+ stack: err.stack?.split("\n").map((line) => line.trim())
515
+ });
483
516
  if (typeof arg1 === "object") {
484
- const messageParts = rest.map(
485
- (arg) => typeof arg === "string" ? arg : JSON.stringify(arg)
486
- );
487
- const message = messageParts.join(" ");
488
- method.apply(this, [arg1, message]);
517
+ if (arg1 instanceof Error) {
518
+ method.apply(this, [
519
+ {
520
+ error: formatError(arg1)
521
+ }
522
+ ]);
523
+ } else {
524
+ const messageParts = rest.map(
525
+ (arg) => typeof arg === "string" ? arg : JSON.stringify(arg)
526
+ );
527
+ const message = messageParts.join(" ");
528
+ method.apply(this, [arg1, message]);
529
+ }
489
530
  } else {
490
531
  const context = {};
491
- const messageParts = [arg1, ...rest].map((arg) => typeof arg === "string" ? arg : arg);
532
+ const messageParts = [arg1, ...rest].map((arg) => {
533
+ if (arg instanceof Error) {
534
+ return formatError(arg);
535
+ }
536
+ return typeof arg === "string" ? arg : arg;
537
+ });
492
538
  const message = messageParts.filter((part) => typeof part === "string").join(" ");
493
539
  const jsonParts = messageParts.filter((part) => typeof part === "object");
494
540
  Object.assign(context, ...jsonParts);
@@ -503,37 +549,7 @@ if (typeof process !== "undefined") {
503
549
  if (!raw) {
504
550
  try {
505
551
  const pretty = __require("pino-pretty");
506
- stream = pretty.default ? pretty.default({
507
- colorize: true,
508
- translateTime: "yyyy-mm-dd HH:MM:ss",
509
- ignore: "pid,hostname",
510
- customLevels: {
511
- names: {
512
- fatal: 60,
513
- error: 50,
514
- warn: 40,
515
- info: 30,
516
- log: 29,
517
- progress: 28,
518
- success: 27,
519
- debug: 20,
520
- trace: 10
521
- },
522
- // Map custom level values to their display text
523
- // This ensures consistent level names in pretty-printed output
524
- customLevelNames: {
525
- 10: "TRACE",
526
- 20: "DEBUG",
527
- 27: "SUCCESS",
528
- 28: "PROGRESS",
529
- 29: "LOG",
530
- 30: "INFO",
531
- 40: "WARN",
532
- 50: "ERROR",
533
- 60: "FATAL"
534
- }
535
- }
536
- }) : null;
552
+ stream = pretty.default ? pretty.default(createPrettyConfig()) : null;
537
553
  } catch (e) {
538
554
  createStream().then((prettyStream) => {
539
555
  const destination = new InMemoryDestination(prettyStream);
@@ -5286,6 +5302,11 @@ var recentMessagesProvider = {
5286
5302
  })
5287
5303
  ]);
5288
5304
  const recentPosts = formattedRecentPosts && formattedRecentPosts.length > 0 ? addHeader("# Posts in Thread", formattedRecentPosts) : "";
5305
+ const metaData = message.metadata;
5306
+ const recieveMessage = addHeader(
5307
+ "# Received Message:",
5308
+ `${metaData?.entityName || "unknown"}: ${message.content.text}`
5309
+ );
5289
5310
  const recentMessages = formattedRecentMessages && formattedRecentMessages.length > 0 ? addHeader("# Conversation Messages", formattedRecentMessages) : "";
5290
5311
  const interactionEntityMap = /* @__PURE__ */ new Map();
5291
5312
  if (recentInteractionsData.length > 0) {
@@ -5357,7 +5378,7 @@ var recentMessagesProvider = {
5357
5378
  recentPostInteractions,
5358
5379
  recentInteractions: isPostFormat ? recentPostInteractions : recentMessageInteractions
5359
5380
  };
5360
- const text = [isPostFormat ? recentPosts : recentMessages].filter(Boolean).join("\n\n");
5381
+ const text = [isPostFormat ? recentPosts : recentMessages + recieveMessage].filter(Boolean).join("\n\n");
5361
5382
  return {
5362
5383
  data,
5363
5384
  values,
@@ -6422,7 +6443,7 @@ var messageReceivedHandler = async ({
6422
6443
  status: "started",
6423
6444
  source: "messageHandler"
6424
6445
  });
6425
- const timeoutDuration = 5 * 60 * 1e3;
6446
+ const timeoutDuration = 60 * 60 * 1e3;
6426
6447
  let timeoutId;
6427
6448
  const timeoutPromise = new Promise((_, reject) => {
6428
6449
  timeoutId = setTimeout(async () => {
@@ -6436,10 +6457,10 @@ var messageReceivedHandler = async ({
6436
6457
  status: "timeout",
6437
6458
  endTime: Date.now(),
6438
6459
  duration: Date.now() - startTime,
6439
- error: "Run exceeded 5 minute timeout",
6460
+ error: "Run exceeded 60 minute timeout",
6440
6461
  source: "messageHandler"
6441
6462
  });
6442
- reject(new Error("Run exceeded 5 minute timeout"));
6463
+ reject(new Error("Run exceeded 60 minute timeout"));
6443
6464
  }, timeoutDuration);
6444
6465
  });
6445
6466
  const processingPromise = (async () => {
@@ -7735,7 +7756,7 @@ var AgentRuntime = class {
7735
7756
  * @returns The room ID of the room between the agent and the user.
7736
7757
  * @throws An error if the room cannot be created.
7737
7758
  */
7738
- async ensureRoomExists({ id, name, source, type, channelId, serverId, worldId }) {
7759
+ async ensureRoomExists({ id, name, source, type, channelId, serverId, worldId, metadata }) {
7739
7760
  const room = await this.adapter.getRoom(id);
7740
7761
  if (!room) {
7741
7762
  await this.adapter.createRoom({
@@ -7746,7 +7767,8 @@ var AgentRuntime = class {
7746
7767
  type,
7747
7768
  channelId,
7748
7769
  serverId,
7749
- worldId
7770
+ worldId,
7771
+ metadata
7750
7772
  });
7751
7773
  this.runtimeLogger.debug(`Room ${id} created successfully.`);
7752
7774
  }
@@ -8236,7 +8258,6 @@ export {
8236
8258
  Service,
8237
8259
  ServiceType,
8238
8260
  TEEMode,
8239
- TeeLogDAO,
8240
8261
  TeeType,
8241
8262
  addHeader,
8242
8263
  asUUID,
package/dist/runtime.d.ts CHANGED
@@ -168,7 +168,7 @@ export declare class AgentRuntime implements IAgentRuntime {
168
168
  * @returns The room ID of the room between the agent and the user.
169
169
  * @throws An error if the room cannot be created.
170
170
  */
171
- ensureRoomExists({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<void>;
171
+ ensureRoomExists({ id, name, source, type, channelId, serverId, worldId, metadata }: Room): Promise<void>;
172
172
  /**
173
173
  * Composes the agent's state by gathering data from enabled providers.
174
174
  * @param message - The message to use as context for state composition
package/dist/types.d.ts CHANGED
@@ -878,13 +878,6 @@ export interface IFileService extends Service {
878
878
  }>;
879
879
  generateSignedUrl(fileName: string, expiresIn: number): Promise<string>;
880
880
  }
881
- export interface ITeeLogService extends Service {
882
- log(agentId: string, roomId: string, entityId: string, type: string, content: string): Promise<boolean>;
883
- generateAttestation<T>(reportData: string, hashAlgorithm?: T | any): Promise<string>;
884
- getAllAgents(): Promise<TeeAgent[]>;
885
- getAgent(agentId: string): Promise<TeeAgent | null>;
886
- getLogs(query: TeeLogQuery, page: number, pageSize: number): Promise<TeePageQuery<TeeLog[]>>;
887
- }
888
881
  export interface TestCase {
889
882
  name: string;
890
883
  fn: (runtime: IAgentRuntime) => Promise<void> | void;
@@ -893,25 +886,6 @@ export interface TestSuite {
893
886
  name: string;
894
887
  tests: TestCase[];
895
888
  }
896
- export interface TeeLog {
897
- id: string;
898
- agentId: string;
899
- roomId: string;
900
- entityId: string;
901
- type: string;
902
- content: string;
903
- timestamp: number;
904
- signature: string;
905
- }
906
- export interface TeeLogQuery {
907
- agentId?: string;
908
- roomId?: string;
909
- entityId?: string;
910
- type?: string;
911
- containsContent?: string;
912
- startTimestamp?: number;
913
- endTimestamp?: number;
914
- }
915
889
  export interface TeeAgent {
916
890
  id: string;
917
891
  agentId: string;
@@ -920,21 +894,6 @@ export interface TeeAgent {
920
894
  publicKey: string;
921
895
  attestation: string;
922
896
  }
923
- export interface TeePageQuery<Result = any> {
924
- page: number;
925
- pageSize: number;
926
- total?: number;
927
- data?: Result;
928
- }
929
- export declare abstract class TeeLogDAO<DB = any> {
930
- db: DB;
931
- abstract initialize(): Promise<void>;
932
- abstract addLog(log: TeeLog): Promise<boolean>;
933
- abstract getPagedLogs(query: TeeLogQuery, page: number, pageSize: number): Promise<TeePageQuery<TeeLog[]>>;
934
- abstract addAgent(agent: TeeAgent): Promise<boolean>;
935
- abstract getAgent(agentId: string): Promise<TeeAgent>;
936
- abstract getAllAgents(): Promise<TeeAgent[]>;
937
- }
938
897
  export declare enum TEEMode {
939
898
  OFF = "OFF",
940
899
  LOCAL = "LOCAL",// For local development with simulator
@@ -959,12 +918,7 @@ export interface RemoteAttestationMessage {
959
918
  content: string;
960
919
  };
961
920
  }
962
- export interface SgxAttestation {
963
- quote: string;
964
- timestamp: number;
965
- }
966
921
  export declare enum TeeType {
967
- SGX_GRAMINE = "sgx_gramine",
968
922
  TDX_DSTACK = "tdx_dstack"
969
923
  }
970
924
  export interface TeeVendorConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.3",
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": "a8eb749d82e370638c7124f2ddebc2ae7ef47f22"
75
+ "gitHead": "7fafcbac799e40bd30f1e2acd3239262e79bbb2f"
76
76
  }