@elizaos/core 1.0.3 → 1.0.5

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.
Files changed (35) hide show
  1. package/dist/chunk-2HSL25IJ.js +40 -0
  2. package/dist/{chunk-HRFT5KDK.js → chunk-AU4RQ3C3.js} +184 -402
  3. package/dist/chunk-FEPOSPNK.js +157 -0
  4. package/dist/chunk-JX2SRFHQ.js +59 -0
  5. package/dist/chunk-SIAA4J6H.js +21 -0
  6. package/dist/chunk-U2ADTLZY.js +50 -0
  7. package/dist/chunk-YIBXLDIR.js +42 -0
  8. package/dist/index-BHW44X0A.d.ts +112 -0
  9. package/dist/{index-DVKkCFlY.d.ts → index-S6eSMHDH.d.ts} +8 -9
  10. package/dist/index.d.ts +17 -9
  11. package/dist/index.js +7 -1
  12. package/dist/specs/v1/actionExample.d.ts +41 -0
  13. package/dist/specs/v1/actionExample.js +13 -0
  14. package/dist/specs/v1/index.d.ts +10 -4
  15. package/dist/specs/v1/index.js +30 -19
  16. package/dist/specs/v1/messages.d.ts +31 -0
  17. package/dist/specs/v1/messages.js +18 -0
  18. package/dist/specs/v1/posts.d.ts +10 -0
  19. package/dist/specs/v1/posts.js +12 -0
  20. package/dist/specs/v1/provider.d.ts +21 -0
  21. package/dist/specs/v1/provider.js +10 -0
  22. package/dist/specs/v1/runtime.d.ts +146 -0
  23. package/dist/specs/v1/runtime.js +12 -0
  24. package/dist/specs/v1/state.d.ts +21 -0
  25. package/dist/specs/v1/state.js +9 -0
  26. package/dist/specs/v1/templates.d.ts +42 -0
  27. package/dist/specs/v1/templates.js +11 -0
  28. package/dist/{index-Cy9ZgQIe.d.ts → specs/v1/types.d.ts} +137 -555
  29. package/dist/specs/v1/types.js +33 -0
  30. package/dist/specs/v1/uuid.d.ts +27 -0
  31. package/dist/specs/v1/uuid.js +14 -0
  32. package/dist/specs/v2/index.d.ts +2 -4
  33. package/dist/specs/v2/index.js +7 -1
  34. package/dist/{types-DzoA9aTJ.d.ts → types-D9v-eW3g.d.ts} +4 -7
  35. package/package.json +4 -4
@@ -1,18 +1,43 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
- var __commonJS = (cb, mod) => function __require2() {
10
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
- };
12
- var __export = (target, all) => {
13
- for (var name in all)
14
- __defProp(target, name, { get: all[name], enumerable: true });
15
- };
1
+ import {
2
+ createTemplateFunction,
3
+ getTemplateValues,
4
+ processTemplate
5
+ } from "./chunk-2HSL25IJ.js";
6
+ import {
7
+ ActionTimelineType,
8
+ CacheKeyPrefix,
9
+ CacheStore,
10
+ GoalStatus,
11
+ IrysDataType,
12
+ IrysMessageType,
13
+ KnowledgeScope,
14
+ LoggingLevel,
15
+ ModelClass,
16
+ ModelProviderName,
17
+ Service,
18
+ ServiceType,
19
+ TokenizerType,
20
+ TranscriptionProvider
21
+ } from "./chunk-FEPOSPNK.js";
22
+ import {
23
+ convertContentToV1,
24
+ convertContentToV2,
25
+ fromV2ActionExample,
26
+ toV2ActionExample
27
+ } from "./chunk-U2ADTLZY.js";
28
+ import {
29
+ fromV2Provider,
30
+ toV2Provider
31
+ } from "./chunk-JX2SRFHQ.js";
32
+ import {
33
+ fromV2State,
34
+ toV2State
35
+ } from "./chunk-YIBXLDIR.js";
36
+ import {
37
+ __commonJS,
38
+ __export,
39
+ __require
40
+ } from "./chunk-SIAA4J6H.js";
16
41
 
17
42
  // ../../node_modules/pg/node_modules/pg-types/node_modules/postgres-array/index.js
18
43
  var require_postgres_array = __commonJS({
@@ -5070,21 +5095,21 @@ var v2_exports = {};
5070
5095
  __export(v2_exports, {
5071
5096
  AgentRuntime: () => AgentRuntime2,
5072
5097
  AgentStatus: () => AgentStatus,
5073
- CacheKeyPrefix: () => CacheKeyPrefix,
5098
+ CacheKeyPrefix: () => CacheKeyPrefix2,
5074
5099
  ChannelType: () => ChannelType,
5075
5100
  ContentType: () => ContentType,
5076
5101
  DatabaseAdapter: () => DatabaseAdapter,
5077
5102
  EventType: () => EventType,
5078
- KnowledgeScope: () => KnowledgeScope,
5103
+ KnowledgeScope: () => KnowledgeScope2,
5079
5104
  MemoryType: () => MemoryType,
5080
5105
  ModelType: () => ModelType,
5081
5106
  PlatformPrefix: () => PlatformPrefix,
5082
5107
  Role: () => Role,
5083
5108
  SOCKET_MESSAGE_TYPE: () => SOCKET_MESSAGE_TYPE,
5084
5109
  Semaphore: () => Semaphore2,
5085
- Service: () => Service,
5110
+ Service: () => Service2,
5086
5111
  ServiceBuilder: () => ServiceBuilder2,
5087
- ServiceType: () => ServiceType,
5112
+ ServiceType: () => ServiceType2,
5088
5113
  TEEMode: () => TEEMode,
5089
5114
  TeeType: () => TeeType,
5090
5115
  VECTOR_DIMS: () => VECTOR_DIMS,
@@ -5181,7 +5206,7 @@ var ModelType = {
5181
5206
  OBJECT_SMALL: "OBJECT_SMALL",
5182
5207
  OBJECT_LARGE: "OBJECT_LARGE"
5183
5208
  };
5184
- var ServiceType = {
5209
+ var ServiceType2 = {
5185
5210
  TRANSCRIPTION: "transcription",
5186
5211
  VIDEO: "video",
5187
5212
  BROWSER: "browser",
@@ -5211,8 +5236,8 @@ var ContentType = /* @__PURE__ */ ((ContentType3) => {
5211
5236
  })(ContentType || {});
5212
5237
  var ChannelType = /* @__PURE__ */ ((ChannelType4) => {
5213
5238
  ChannelType4["SELF"] = "SELF";
5214
- ChannelType4["DM"] = "dm";
5215
- ChannelType4["GROUP"] = "group";
5239
+ ChannelType4["DM"] = "DM";
5240
+ ChannelType4["GROUP"] = "GROUP";
5216
5241
  ChannelType4["VOICE_DM"] = "VOICE_DM";
5217
5242
  ChannelType4["VOICE_GROUP"] = "VOICE_GROUP";
5218
5243
  ChannelType4["FEED"] = "FEED";
@@ -5227,15 +5252,15 @@ var AgentStatus = /* @__PURE__ */ ((AgentStatus3) => {
5227
5252
  AgentStatus3["INACTIVE"] = "inactive";
5228
5253
  return AgentStatus3;
5229
5254
  })(AgentStatus || {});
5230
- var KnowledgeScope = /* @__PURE__ */ ((KnowledgeScope4) => {
5255
+ var KnowledgeScope2 = /* @__PURE__ */ ((KnowledgeScope4) => {
5231
5256
  KnowledgeScope4["SHARED"] = "shared";
5232
5257
  KnowledgeScope4["PRIVATE"] = "private";
5233
5258
  return KnowledgeScope4;
5234
- })(KnowledgeScope || {});
5235
- var CacheKeyPrefix = /* @__PURE__ */ ((CacheKeyPrefix4) => {
5259
+ })(KnowledgeScope2 || {});
5260
+ var CacheKeyPrefix2 = /* @__PURE__ */ ((CacheKeyPrefix4) => {
5236
5261
  CacheKeyPrefix4["KNOWLEDGE"] = "knowledge";
5237
5262
  return CacheKeyPrefix4;
5238
- })(CacheKeyPrefix || {});
5263
+ })(CacheKeyPrefix2 || {});
5239
5264
  var TEEMode = /* @__PURE__ */ ((TEEMode3) => {
5240
5265
  TEEMode3["OFF"] = "OFF";
5241
5266
  TEEMode3["LOCAL"] = "LOCAL";
@@ -5353,7 +5378,7 @@ var VECTOR_DIMS = {
5353
5378
  XXL: 1536,
5354
5379
  XXXL: 3072
5355
5380
  };
5356
- var Service = class {
5381
+ var Service2 = class {
5357
5382
  constructor(runtime) {
5358
5383
  if (runtime) {
5359
5384
  this.runtime = runtime;
@@ -5456,7 +5481,7 @@ var ModelType2 = {
5456
5481
  OBJECT_SMALL: "OBJECT_SMALL",
5457
5482
  OBJECT_LARGE: "OBJECT_LARGE"
5458
5483
  };
5459
- var ServiceType2 = {
5484
+ var ServiceType3 = {
5460
5485
  TRANSCRIPTION: "transcription",
5461
5486
  VIDEO: "video",
5462
5487
  BROWSER: "browser",
@@ -5486,8 +5511,8 @@ var ContentType2 = /* @__PURE__ */ ((ContentType3) => {
5486
5511
  })(ContentType2 || {});
5487
5512
  var ChannelType2 = /* @__PURE__ */ ((ChannelType4) => {
5488
5513
  ChannelType4["SELF"] = "SELF";
5489
- ChannelType4["DM"] = "dm";
5490
- ChannelType4["GROUP"] = "group";
5514
+ ChannelType4["DM"] = "DM";
5515
+ ChannelType4["GROUP"] = "GROUP";
5491
5516
  ChannelType4["VOICE_DM"] = "VOICE_DM";
5492
5517
  ChannelType4["VOICE_GROUP"] = "VOICE_GROUP";
5493
5518
  ChannelType4["FEED"] = "FEED";
@@ -5497,7 +5522,7 @@ var ChannelType2 = /* @__PURE__ */ ((ChannelType4) => {
5497
5522
  ChannelType4["API"] = "API";
5498
5523
  return ChannelType4;
5499
5524
  })(ChannelType2 || {});
5500
- var Service2 = class {
5525
+ var Service3 = class {
5501
5526
  constructor(runtime) {
5502
5527
  if (runtime) {
5503
5528
  this.runtime = runtime;
@@ -5517,15 +5542,15 @@ var AgentStatus2 = /* @__PURE__ */ ((AgentStatus3) => {
5517
5542
  AgentStatus3["INACTIVE"] = "inactive";
5518
5543
  return AgentStatus3;
5519
5544
  })(AgentStatus2 || {});
5520
- var KnowledgeScope2 = /* @__PURE__ */ ((KnowledgeScope4) => {
5545
+ var KnowledgeScope3 = /* @__PURE__ */ ((KnowledgeScope4) => {
5521
5546
  KnowledgeScope4["SHARED"] = "shared";
5522
5547
  KnowledgeScope4["PRIVATE"] = "private";
5523
5548
  return KnowledgeScope4;
5524
- })(KnowledgeScope2 || {});
5525
- var CacheKeyPrefix2 = /* @__PURE__ */ ((CacheKeyPrefix4) => {
5549
+ })(KnowledgeScope3 || {});
5550
+ var CacheKeyPrefix3 = /* @__PURE__ */ ((CacheKeyPrefix4) => {
5526
5551
  CacheKeyPrefix4["KNOWLEDGE"] = "knowledge";
5527
5552
  return CacheKeyPrefix4;
5528
- })(CacheKeyPrefix2 || {});
5553
+ })(CacheKeyPrefix3 || {});
5529
5554
  var TEEMode2 = /* @__PURE__ */ ((TEEMode3) => {
5530
5555
  TEEMode3["OFF"] = "OFF";
5531
5556
  TEEMode3["LOCAL"] = "LOCAL";
@@ -6263,6 +6288,23 @@ var options = {
6263
6288
  }
6264
6289
  }
6265
6290
  };
6291
+ var createLogger = (bindings = false) => {
6292
+ const opts = { ...options };
6293
+ if (bindings) {
6294
+ opts.base = bindings;
6295
+ opts.transport = {
6296
+ target: "pino-pretty",
6297
+ // this is just a string, not a dynamic import
6298
+ options: {
6299
+ colorize: true,
6300
+ translateTime: "SYS:standard",
6301
+ ignore: "pid,hostname"
6302
+ }
6303
+ };
6304
+ }
6305
+ const logger3 = pino(opts);
6306
+ return logger3;
6307
+ };
6266
6308
  var logger = pino(options);
6267
6309
  if (typeof process !== "undefined") {
6268
6310
  let stream = null;
@@ -6296,21 +6338,6 @@ if (typeof process !== "undefined") {
6296
6338
  };
6297
6339
  }
6298
6340
  }
6299
- var createLogger = (bindings = {}) => {
6300
- return pino({
6301
- level: process.env.LOG_LEVEL || "info",
6302
- base: bindings,
6303
- transport: {
6304
- target: "pino-pretty",
6305
- // this is just a string, not a dynamic import
6306
- options: {
6307
- colorize: true,
6308
- translateTime: "SYS:standard",
6309
- ignore: "pid,hostname"
6310
- }
6311
- }
6312
- });
6313
- };
6314
6341
  var elizaLogger = logger;
6315
6342
  var logger_default = logger;
6316
6343
 
@@ -6757,7 +6784,7 @@ var PostgresSpanProcessor = class {
6757
6784
  return Promise.resolve();
6758
6785
  }
6759
6786
  };
6760
- var InstrumentationService = class _InstrumentationService extends Service2 {
6787
+ var InstrumentationService = class _InstrumentationService extends Service3 {
6761
6788
  constructor(config) {
6762
6789
  super();
6763
6790
  this.name = "INSTRUMENTATION";
@@ -6783,7 +6810,7 @@ var InstrumentationService = class _InstrumentationService extends Service2 {
6783
6810
  }
6784
6811
  }
6785
6812
  static {
6786
- this.serviceType = ServiceType2.INSTRUMENTATION;
6813
+ this.serviceType = ServiceType3.INSTRUMENTATION;
6787
6814
  }
6788
6815
  initializeProviders() {
6789
6816
  if (!this.isEnabled()) return;
@@ -8699,6 +8726,94 @@ var AgentRuntime = class {
8699
8726
  return evaluators;
8700
8727
  });
8701
8728
  }
8729
+ // highly SQL optimized queries
8730
+ async ensureConnections(entities, rooms, source, world) {
8731
+ console.log("ensureConnections entities:", entities);
8732
+ console.log("ensureConnections rooms:", rooms);
8733
+ console.log("ensureConnections source:", source);
8734
+ console.log("ensureConnections world:", world);
8735
+ if (!entities) {
8736
+ console.trace();
8737
+ this.logger.error("ensureConnections - no entities");
8738
+ return;
8739
+ }
8740
+ if (!rooms || rooms.length === 0) {
8741
+ console.trace();
8742
+ this.logger.error("ensureConnections - no rooms");
8743
+ return;
8744
+ }
8745
+ await this.ensureWorldExists({ ...world, agentId: this.agentId });
8746
+ const firstRoom = rooms[0];
8747
+ const chunkArray = (arr, size) => arr.reduce((chunks, item, i) => {
8748
+ if (i % size === 0) chunks.push([]);
8749
+ chunks[chunks.length - 1].push(item);
8750
+ return chunks;
8751
+ }, []);
8752
+ const roomIds = rooms.map((r2) => r2.id);
8753
+ const roomExistsCheck = await this.getRoomsByIds(roomIds);
8754
+ const roomsIdExists = roomExistsCheck.map((r2) => r2.id);
8755
+ const roomsToCreate = roomIds.filter((id) => !roomsIdExists.includes(id));
8756
+ const rf = {
8757
+ worldId: world.id,
8758
+ serverId: world.serverId,
8759
+ source,
8760
+ agentId: this.agentId
8761
+ };
8762
+ if (roomsToCreate.length) {
8763
+ this.logger.debug(
8764
+ "runtime/ensureConnections - create",
8765
+ roomsToCreate.length.toLocaleString(),
8766
+ "rooms"
8767
+ );
8768
+ const roomObjsToCreate = rooms.filter((r2) => roomsToCreate.includes(r2.id)).map((r2) => ({ ...r2, ...rf }));
8769
+ await this.createRooms(roomObjsToCreate);
8770
+ }
8771
+ const entityIds = entities.map((e) => e.id);
8772
+ const entityExistsCheck = await this.adapter.getEntityByIds(entityIds);
8773
+ const entitiesToUpdate = entityExistsCheck.map((e) => e.id);
8774
+ const entitiesToCreate = entities.filter((e) => !entitiesToUpdate.includes(e.id));
8775
+ const r = {
8776
+ roomId: firstRoom.id,
8777
+ channelId: firstRoom.channelId,
8778
+ type: firstRoom.type
8779
+ };
8780
+ const wf = {
8781
+ worldId: world.id,
8782
+ serverId: world.serverId
8783
+ };
8784
+ if (entitiesToCreate.length) {
8785
+ this.logger.debug(
8786
+ "runtime/ensureConnections - creating",
8787
+ entitiesToCreate.length.toLocaleString(),
8788
+ "entities..."
8789
+ );
8790
+ const ef = {
8791
+ ...r,
8792
+ ...wf,
8793
+ source,
8794
+ agentId: this.agentId
8795
+ };
8796
+ const entitiesToCreateWFields = entitiesToCreate.map((e) => ({ ...e, ...ef }));
8797
+ const batches = chunkArray(entitiesToCreateWFields, 5e3);
8798
+ for (const batch of batches) {
8799
+ await this.createEntities(batch);
8800
+ }
8801
+ }
8802
+ await this.ensureParticipantInRoom(this.agentId, firstRoom.id);
8803
+ const entityIdsInFirstRoom = await this.getParticipantsForRoom(firstRoom.id);
8804
+ const entityIdsInFirstRoomFiltered = entityIdsInFirstRoom.filter(Boolean);
8805
+ const missingIdsInRoom = entityIds.filter((id) => !entityIdsInFirstRoomFiltered.includes(id));
8806
+ if (missingIdsInRoom.length) {
8807
+ this.logger.debug(
8808
+ "runtime/ensureConnections - Missing",
8809
+ missingIdsInRoom.length.toLocaleString(),
8810
+ "connections in",
8811
+ firstRoom.id
8812
+ );
8813
+ await this.addParticipantsRoom(missingIdsInRoom, firstRoom.id);
8814
+ }
8815
+ this.logger.success(`Success: Successfully connected world`);
8816
+ }
8702
8817
  async ensureConnection({
8703
8818
  entityId,
8704
8819
  roomId,
@@ -9918,7 +10033,7 @@ var ServiceBuilder = class {
9918
10033
  const description = this.description;
9919
10034
  const startFn = this.startFn;
9920
10035
  const stopFn = this.stopFn;
9921
- return class extends Service2 {
10036
+ return class extends Service3 {
9922
10037
  constructor() {
9923
10038
  super(...arguments);
9924
10039
  this.capabilityDescription = description;
@@ -9952,17 +10067,17 @@ var v1_exports = {};
9952
10067
  __export(v1_exports, {
9953
10068
  ActionTimelineType: () => ActionTimelineType,
9954
10069
  AgentRuntime: () => AgentRuntime3,
9955
- CacheKeyPrefix: () => CacheKeyPrefix3,
10070
+ CacheKeyPrefix: () => CacheKeyPrefix,
9956
10071
  CacheStore: () => CacheStore,
9957
10072
  GoalStatus: () => GoalStatus,
9958
10073
  IrysDataType: () => IrysDataType,
9959
10074
  IrysMessageType: () => IrysMessageType,
9960
- KnowledgeScope: () => KnowledgeScope3,
10075
+ KnowledgeScope: () => KnowledgeScope,
9961
10076
  LoggingLevel: () => LoggingLevel,
9962
10077
  ModelClass: () => ModelClass,
9963
10078
  ModelProviderName: () => ModelProviderName,
9964
- Service: () => Service3,
9965
- ServiceType: () => ServiceType3,
10079
+ Service: () => Service,
10080
+ ServiceType: () => ServiceType,
9966
10081
  TokenizerType: () => TokenizerType,
9967
10082
  TranscriptionProvider: () => TranscriptionProvider,
9968
10083
  asUUID: () => asUUID3,
@@ -10026,6 +10141,7 @@ var formatPosts3 = ({
10026
10141
  };
10027
10142
 
10028
10143
  // src/specs/v1/runtime.ts
10144
+ var DEFAULT_SERVER_ID = "00000000-0000-0000-0000-000000000000";
10029
10145
  var AgentRuntime3 = class {
10030
10146
  get agentId() {
10031
10147
  return this._runtime.agentId;
@@ -10235,8 +10351,8 @@ var AgentRuntime3 = class {
10235
10351
  source: "Unknown",
10236
10352
  type: "Unknown",
10237
10353
  channelId: roomId,
10238
- serverId: "0",
10239
- worldId: "0",
10354
+ serverId: DEFAULT_SERVER_ID,
10355
+ worldId: DEFAULT_SERVER_ID,
10240
10356
  metadata: {}
10241
10357
  });
10242
10358
  }
@@ -10296,185 +10412,6 @@ Text: ${attachment.text}
10296
10412
  }
10297
10413
  };
10298
10414
 
10299
- // src/specs/v1/types.ts
10300
- var GoalStatus = /* @__PURE__ */ ((GoalStatus2) => {
10301
- GoalStatus2["DONE"] = "DONE";
10302
- GoalStatus2["FAILED"] = "FAILED";
10303
- GoalStatus2["IN_PROGRESS"] = "IN_PROGRESS";
10304
- return GoalStatus2;
10305
- })(GoalStatus || {});
10306
- var ModelClass = /* @__PURE__ */ ((ModelClass2) => {
10307
- ModelClass2["SMALL"] = "small";
10308
- ModelClass2["MEDIUM"] = "medium";
10309
- ModelClass2["LARGE"] = "large";
10310
- ModelClass2["EMBEDDING"] = "embedding";
10311
- ModelClass2["IMAGE"] = "image";
10312
- return ModelClass2;
10313
- })(ModelClass || {});
10314
- var ModelProviderName = /* @__PURE__ */ ((ModelProviderName2) => {
10315
- ModelProviderName2["OPENAI"] = "openai";
10316
- ModelProviderName2["ETERNALAI"] = "eternalai";
10317
- ModelProviderName2["ANTHROPIC"] = "anthropic";
10318
- ModelProviderName2["GROK"] = "grok";
10319
- ModelProviderName2["GROQ"] = "groq";
10320
- ModelProviderName2["LLAMACLOUD"] = "llama_cloud";
10321
- ModelProviderName2["TOGETHER"] = "together";
10322
- ModelProviderName2["LLAMALOCAL"] = "llama_local";
10323
- ModelProviderName2["LMSTUDIO"] = "lmstudio";
10324
- ModelProviderName2["GOOGLE"] = "google";
10325
- ModelProviderName2["MISTRAL"] = "mistral";
10326
- ModelProviderName2["CLAUDE_VERTEX"] = "claude_vertex";
10327
- ModelProviderName2["REDPILL"] = "redpill";
10328
- ModelProviderName2["OPENROUTER"] = "openrouter";
10329
- ModelProviderName2["OLLAMA"] = "ollama";
10330
- ModelProviderName2["HEURIST"] = "heurist";
10331
- ModelProviderName2["GALADRIEL"] = "galadriel";
10332
- ModelProviderName2["FAL"] = "falai";
10333
- ModelProviderName2["GAIANET"] = "gaianet";
10334
- ModelProviderName2["ALI_BAILIAN"] = "ali_bailian";
10335
- ModelProviderName2["VOLENGINE"] = "volengine";
10336
- ModelProviderName2["NANOGPT"] = "nanogpt";
10337
- ModelProviderName2["HYPERBOLIC"] = "hyperbolic";
10338
- ModelProviderName2["VENICE"] = "venice";
10339
- ModelProviderName2["NVIDIA"] = "nvidia";
10340
- ModelProviderName2["NINETEEN_AI"] = "nineteen_ai";
10341
- ModelProviderName2["AKASH_CHAT_API"] = "akash_chat_api";
10342
- ModelProviderName2["LIVEPEER"] = "livepeer";
10343
- ModelProviderName2["LETZAI"] = "letzai";
10344
- ModelProviderName2["DEEPSEEK"] = "deepseek";
10345
- ModelProviderName2["INFERA"] = "infera";
10346
- ModelProviderName2["BEDROCK"] = "bedrock";
10347
- ModelProviderName2["ATOMA"] = "atoma";
10348
- ModelProviderName2["SECRETAI"] = "secret_ai";
10349
- ModelProviderName2["NEARAI"] = "nearai";
10350
- return ModelProviderName2;
10351
- })(ModelProviderName || {});
10352
- var CacheStore = /* @__PURE__ */ ((CacheStore2) => {
10353
- CacheStore2["REDIS"] = "redis";
10354
- CacheStore2["DATABASE"] = "database";
10355
- CacheStore2["FILESYSTEM"] = "filesystem";
10356
- return CacheStore2;
10357
- })(CacheStore || {});
10358
- var Service3 = class _Service {
10359
- static {
10360
- this.instance = null;
10361
- }
10362
- static get serviceType() {
10363
- throw new Error("Service must implement static serviceType getter");
10364
- }
10365
- static getInstance() {
10366
- if (!_Service.instance) {
10367
- _Service.instance = new this();
10368
- }
10369
- return _Service.instance;
10370
- }
10371
- get serviceType() {
10372
- return this.constructor.serviceType;
10373
- }
10374
- };
10375
- var IrysMessageType = /* @__PURE__ */ ((IrysMessageType2) => {
10376
- IrysMessageType2["REQUEST"] = "REQUEST";
10377
- IrysMessageType2["DATA_STORAGE"] = "DATA_STORAGE";
10378
- IrysMessageType2["REQUEST_RESPONSE"] = "REQUEST_RESPONSE";
10379
- return IrysMessageType2;
10380
- })(IrysMessageType || {});
10381
- var IrysDataType = /* @__PURE__ */ ((IrysDataType2) => {
10382
- IrysDataType2["FILE"] = "FILE";
10383
- IrysDataType2["IMAGE"] = "IMAGE";
10384
- IrysDataType2["OTHER"] = "OTHER";
10385
- return IrysDataType2;
10386
- })(IrysDataType || {});
10387
- var ServiceType3 = /* @__PURE__ */ ((ServiceType4) => {
10388
- ServiceType4["IMAGE_DESCRIPTION"] = "image_description";
10389
- ServiceType4["TRANSCRIPTION"] = "transcription";
10390
- ServiceType4["VIDEO"] = "video";
10391
- ServiceType4["TEXT_GENERATION"] = "text_generation";
10392
- ServiceType4["BROWSER"] = "browser";
10393
- ServiceType4["SPEECH_GENERATION"] = "speech_generation";
10394
- ServiceType4["PDF"] = "pdf";
10395
- ServiceType4["INTIFACE"] = "intiface";
10396
- ServiceType4["AWS_S3"] = "aws_s3";
10397
- ServiceType4["BUTTPLUG"] = "buttplug";
10398
- ServiceType4["SLACK"] = "slack";
10399
- ServiceType4["VERIFIABLE_LOGGING"] = "verifiable_logging";
10400
- ServiceType4["IRYS"] = "irys";
10401
- ServiceType4["TEE_LOG"] = "tee_log";
10402
- ServiceType4["GOPLUS_SECURITY"] = "goplus_security";
10403
- ServiceType4["WEB_SEARCH"] = "web_search";
10404
- ServiceType4["EMAIL_AUTOMATION"] = "email_automation";
10405
- ServiceType4["NKN_CLIENT_SERVICE"] = "nkn_client_service";
10406
- return ServiceType4;
10407
- })(ServiceType3 || {});
10408
- var LoggingLevel = /* @__PURE__ */ ((LoggingLevel2) => {
10409
- LoggingLevel2["DEBUG"] = "debug";
10410
- LoggingLevel2["VERBOSE"] = "verbose";
10411
- LoggingLevel2["NONE"] = "none";
10412
- return LoggingLevel2;
10413
- })(LoggingLevel || {});
10414
- var TokenizerType = /* @__PURE__ */ ((TokenizerType2) => {
10415
- TokenizerType2["Auto"] = "auto";
10416
- TokenizerType2["TikToken"] = "tiktoken";
10417
- return TokenizerType2;
10418
- })(TokenizerType || {});
10419
- var TranscriptionProvider = /* @__PURE__ */ ((TranscriptionProvider2) => {
10420
- TranscriptionProvider2["OpenAI"] = "openai";
10421
- TranscriptionProvider2["Deepgram"] = "deepgram";
10422
- TranscriptionProvider2["Local"] = "local";
10423
- return TranscriptionProvider2;
10424
- })(TranscriptionProvider || {});
10425
- var ActionTimelineType = /* @__PURE__ */ ((ActionTimelineType2) => {
10426
- ActionTimelineType2["ForYou"] = "foryou";
10427
- ActionTimelineType2["Following"] = "following";
10428
- return ActionTimelineType2;
10429
- })(ActionTimelineType || {});
10430
- var KnowledgeScope3 = /* @__PURE__ */ ((KnowledgeScope4) => {
10431
- KnowledgeScope4["SHARED"] = "shared";
10432
- KnowledgeScope4["PRIVATE"] = "private";
10433
- return KnowledgeScope4;
10434
- })(KnowledgeScope3 || {});
10435
- var CacheKeyPrefix3 = /* @__PURE__ */ ((CacheKeyPrefix4) => {
10436
- CacheKeyPrefix4["KNOWLEDGE"] = "knowledge";
10437
- return CacheKeyPrefix4;
10438
- })(CacheKeyPrefix3 || {});
10439
-
10440
- // src/specs/v1/state.ts
10441
- var DEFAULT_STATE = {
10442
- bio: "",
10443
- lore: "",
10444
- messageDirections: "",
10445
- postDirections: "",
10446
- actors: "",
10447
- recentMessages: "",
10448
- recentMessagesData: []
10449
- };
10450
- function fromV2State(stateV2) {
10451
- const state = {
10452
- ...DEFAULT_STATE,
10453
- ...stateV2.values,
10454
- ...stateV2.data,
10455
- text: stateV2.text
10456
- };
10457
- for (const key in stateV2) {
10458
- if (key !== "values" && key !== "data" && key !== "text") {
10459
- state[key] = stateV2[key];
10460
- }
10461
- }
10462
- return state;
10463
- }
10464
- function toV2State(state) {
10465
- const stateV2 = {
10466
- values: {},
10467
- data: {},
10468
- text: state.text || ""
10469
- };
10470
- for (const key in state) {
10471
- if (key !== "text") {
10472
- stateV2[key] = state[key];
10473
- }
10474
- }
10475
- return stateV2;
10476
- }
10477
-
10478
10415
  // src/specs/v1/uuid.ts
10479
10416
  function asUUID3(id) {
10480
10417
  const validUuid = validateUuid2(id);
@@ -10487,136 +10424,6 @@ function generateUuidFromString(input) {
10487
10424
  return stringToUuid2(input);
10488
10425
  }
10489
10426
 
10490
- // src/specs/v1/actionExample.ts
10491
- function convertContentToV1(content) {
10492
- if (!content) {
10493
- return { text: "" };
10494
- }
10495
- return {
10496
- text: content.text || "",
10497
- // V2 uses 'actions' array, V1 might use 'action' string
10498
- action: Array.isArray(content.actions) && content.actions.length > 0 ? content.actions[0] : void 0,
10499
- // Copy all other properties
10500
- ...Object.entries(content).filter(([key]) => !["text", "actions", "action"].includes(key)).reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {})
10501
- };
10502
- }
10503
- function convertContentToV2(content) {
10504
- if (!content) {
10505
- return { text: "" };
10506
- }
10507
- return {
10508
- text: content.text || "",
10509
- // V1 uses 'action' string, V2 uses 'actions' array
10510
- actions: content.action ? [content.action] : [],
10511
- // Copy all other properties
10512
- ...Object.entries(content).filter(([key]) => !["text", "action"].includes(key)).reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {})
10513
- };
10514
- }
10515
- function fromV2ActionExample(exampleV2) {
10516
- if (!exampleV2) {
10517
- return { user: "", content: { text: "" } };
10518
- }
10519
- return {
10520
- user: exampleV2.name || "",
10521
- content: convertContentToV1(exampleV2.content)
10522
- };
10523
- }
10524
- function toV2ActionExample(example) {
10525
- if (!example) {
10526
- return { name: "", content: { text: "" } };
10527
- }
10528
- return {
10529
- name: example.user || "",
10530
- content: convertContentToV2(example.content)
10531
- };
10532
- }
10533
-
10534
- // src/specs/v1/provider.ts
10535
- function fromV2Provider(providerV2) {
10536
- return {
10537
- name: providerV2.name,
10538
- description: providerV2.description,
10539
- dynamic: providerV2.dynamic,
10540
- position: providerV2.position,
10541
- private: providerV2.private,
10542
- get: async (runtime, message, state) => {
10543
- const stateV2 = state ? toV2State(state) : void 0;
10544
- try {
10545
- const result = await providerV2.get(runtime, message, stateV2);
10546
- return result.text || "";
10547
- } catch (error) {
10548
- console.error(`Error in v2 provider ${providerV2.name}:`, error);
10549
- throw error;
10550
- }
10551
- }
10552
- };
10553
- }
10554
- function toV2Provider(provider) {
10555
- return {
10556
- name: provider.name || "unnamed-provider",
10557
- description: provider.description,
10558
- dynamic: provider.dynamic,
10559
- position: provider.position,
10560
- private: provider.private,
10561
- get: async (runtime, message, state) => {
10562
- try {
10563
- const result = await provider.get(runtime, message, state);
10564
- if (typeof result === "object" && result !== null) {
10565
- return {
10566
- ...result,
10567
- values: result.values || {},
10568
- data: result.data || {},
10569
- text: result.text || ""
10570
- };
10571
- }
10572
- return {
10573
- values: {},
10574
- data: {},
10575
- text: String(result || "")
10576
- };
10577
- } catch (error) {
10578
- console.error(`Error in v1 provider ${provider.name || "unnamed"}:`, error);
10579
- throw error;
10580
- }
10581
- }
10582
- };
10583
- }
10584
-
10585
- // src/specs/v1/templates.ts
10586
- function createTemplateFunction(template) {
10587
- if (typeof template === "string") {
10588
- return () => template;
10589
- } else {
10590
- return (state) => {
10591
- if (!state) {
10592
- return "";
10593
- }
10594
- return template({ state });
10595
- };
10596
- }
10597
- }
10598
- function processTemplate(template, state) {
10599
- if (!template) {
10600
- return "";
10601
- }
10602
- if (!state) {
10603
- return typeof template === "string" ? template : "";
10604
- }
10605
- if (typeof template === "string") {
10606
- return template;
10607
- } else {
10608
- return template({ state });
10609
- }
10610
- }
10611
- function getTemplateValues(state, defaultValues) {
10612
- if (!state || !state.values) {
10613
- return defaultValues || {};
10614
- }
10615
- const stateValues = state.values;
10616
- const defaults = defaultValues || {};
10617
- return { ...defaults, ...stateValues };
10618
- }
10619
-
10620
10427
  // src/specs/index.ts
10621
10428
  var defaultSpec = v2_exports;
10622
10429
 
@@ -11557,14 +11364,14 @@ function defineService2(definition) {
11557
11364
  export {
11558
11365
  asUUID2 as asUUID,
11559
11366
  ModelType2 as ModelType,
11560
- ServiceType2 as ServiceType,
11367
+ ServiceType3 as ServiceType,
11561
11368
  MemoryType2 as MemoryType,
11562
11369
  ContentType2 as ContentType,
11563
11370
  ChannelType2 as ChannelType,
11564
- Service2 as Service,
11371
+ Service3 as Service,
11565
11372
  AgentStatus2 as AgentStatus,
11566
- KnowledgeScope2 as KnowledgeScope,
11567
- CacheKeyPrefix2 as CacheKeyPrefix,
11373
+ KnowledgeScope3 as KnowledgeScope,
11374
+ CacheKeyPrefix3 as CacheKeyPrefix,
11568
11375
  TEEMode2 as TEEMode,
11569
11376
  TeeType2 as TeeType,
11570
11377
  Role2 as Role,
@@ -11588,8 +11395,8 @@ export {
11588
11395
  formatActions2 as formatActions,
11589
11396
  DatabaseAdapter2 as DatabaseAdapter,
11590
11397
  Sentry,
11591
- logger,
11592
11398
  createLogger,
11399
+ logger,
11593
11400
  elizaLogger,
11594
11401
  composePrompt,
11595
11402
  composePromptFromState,
@@ -11641,13 +11448,13 @@ export {
11641
11448
  defineService,
11642
11449
  asUUID as asUUID2,
11643
11450
  ModelType as ModelType2,
11644
- ServiceType as ServiceType2,
11451
+ ServiceType2,
11645
11452
  MemoryType as MemoryType2,
11646
11453
  ContentType as ContentType2,
11647
11454
  ChannelType as ChannelType2,
11648
11455
  AgentStatus as AgentStatus2,
11649
- KnowledgeScope as KnowledgeScope2,
11650
- CacheKeyPrefix as CacheKeyPrefix2,
11456
+ KnowledgeScope2,
11457
+ CacheKeyPrefix2,
11651
11458
  TEEMode as TEEMode2,
11652
11459
  TeeType as TeeType2,
11653
11460
  Role as Role2,
@@ -11666,7 +11473,7 @@ export {
11666
11473
  getMemoryText as getMemoryText2,
11667
11474
  createServiceError as createServiceError2,
11668
11475
  VECTOR_DIMS as VECTOR_DIMS2,
11669
- Service as Service2,
11476
+ Service2,
11670
11477
  composeActionExamples as composeActionExamples2,
11671
11478
  formatActionNames as formatActionNames2,
11672
11479
  formatActions as formatActions2,
@@ -11725,33 +11532,8 @@ export {
11725
11532
  formatTimestamp3,
11726
11533
  formatPosts3,
11727
11534
  AgentRuntime3,
11728
- GoalStatus,
11729
- ModelClass,
11730
- ModelProviderName,
11731
- CacheStore,
11732
- Service3,
11733
- IrysMessageType,
11734
- IrysDataType,
11735
- ServiceType3,
11736
- LoggingLevel,
11737
- TokenizerType,
11738
- TranscriptionProvider,
11739
- ActionTimelineType,
11740
- KnowledgeScope3,
11741
- CacheKeyPrefix3,
11742
- fromV2State,
11743
- toV2State,
11744
11535
  asUUID3,
11745
11536
  generateUuidFromString,
11746
- convertContentToV1,
11747
- convertContentToV2,
11748
- fromV2ActionExample,
11749
- toV2ActionExample,
11750
- fromV2Provider,
11751
- toV2Provider,
11752
- createTemplateFunction,
11753
- processTemplate,
11754
- getTemplateValues,
11755
11537
  v1_exports,
11756
11538
  defaultSpec
11757
11539
  };