@elizaos/core 1.5.12-alpha.1 → 1.5.12
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/browser/index.browser.js +119 -141
- package/dist/browser/index.browser.js.map +16 -74
- package/dist/index.browser.d.ts +0 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.d.ts.map +1 -1
- package/dist/node/index.node.js +92 -304
- package/dist/node/index.node.js.map +9 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/schemas/character.d.ts +179 -21
- package/dist/schemas/character.d.ts.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/elizaos.d.ts +0 -152
- package/dist/elizaos.d.ts.map +0 -1
- package/dist/utils/node.d.ts +0 -6
- package/dist/utils/node.d.ts.map +0 -1
package/dist/index.browser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,eAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;CAGxB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export * from './runtime';
|
|
|
21
21
|
export * from './settings';
|
|
22
22
|
export * from './services';
|
|
23
23
|
export * from './search';
|
|
24
|
-
export * from './elizaos';
|
|
25
24
|
export declare const isBrowser: boolean;
|
|
26
25
|
export declare const isNode: boolean;
|
|
27
26
|
export * from './utils/server-health';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,eAAO,MAAM,SAAS,SAG+B,CAAC;AACtD,eAAO,MAAM,MAAM,SAG2B,CAAC;AAG/C,cAAc,uBAAuB,CAAC"}
|
package/dist/index.node.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export * from './utils';
|
|
|
9
9
|
export * from './schemas/character';
|
|
10
10
|
export * from './utils/environment';
|
|
11
11
|
export * from './utils/buffer';
|
|
12
|
-
export * from './utils/
|
|
12
|
+
export * from './utils/server-health';
|
|
13
|
+
export * from './utils/paths';
|
|
13
14
|
export * from './actions';
|
|
14
15
|
export * from './database';
|
|
15
16
|
export * from './entities';
|
|
@@ -20,7 +21,6 @@ export * from './runtime';
|
|
|
20
21
|
export * from './settings';
|
|
21
22
|
export * from './services';
|
|
22
23
|
export * from './search';
|
|
23
|
-
export * from './elizaos';
|
|
24
24
|
export declare const isBrowser = false;
|
|
25
25
|
export declare const isNode = true;
|
|
26
26
|
//# sourceMappingURL=index.node.d.ts.map
|
package/dist/index.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,MAAM,OAAO,CAAC"}
|
package/dist/node/index.node.js
CHANGED
|
@@ -19680,8 +19680,8 @@ var require_reporter = __commonJS((exports) => {
|
|
|
19680
19680
|
errors: state.errors
|
|
19681
19681
|
};
|
|
19682
19682
|
};
|
|
19683
|
-
function ReporterError(
|
|
19684
|
-
this.path =
|
|
19683
|
+
function ReporterError(path2, msg) {
|
|
19684
|
+
this.path = path2;
|
|
19685
19685
|
this.rethrow(msg);
|
|
19686
19686
|
}
|
|
19687
19687
|
inherits(ReporterError, Error);
|
|
@@ -25878,7 +25878,7 @@ var getDefaultProjectName = () => {
|
|
|
25878
25878
|
};
|
|
25879
25879
|
|
|
25880
25880
|
// ../../node_modules/langsmith/dist/index.js
|
|
25881
|
-
var __version__ = "0.3.
|
|
25881
|
+
var __version__ = "0.3.68";
|
|
25882
25882
|
|
|
25883
25883
|
// ../../node_modules/langsmith/dist/utils/env.js
|
|
25884
25884
|
var globalEnv;
|
|
@@ -41884,7 +41884,7 @@ function parseBooleanFromText2(value) {
|
|
|
41884
41884
|
}
|
|
41885
41885
|
return false;
|
|
41886
41886
|
}
|
|
41887
|
-
var uuidSchema = z2.string().
|
|
41887
|
+
var uuidSchema = z2.string().uuid();
|
|
41888
41888
|
function validateUuid(value) {
|
|
41889
41889
|
const result = uuidSchema.safeParse(value);
|
|
41890
41890
|
return result.success ? result.data : null;
|
|
@@ -42110,14 +42110,14 @@ var styleSchema = z3.object({
|
|
|
42110
42110
|
chat: z3.array(z3.string()).optional(),
|
|
42111
42111
|
post: z3.array(z3.string()).optional()
|
|
42112
42112
|
}).optional();
|
|
42113
|
-
var settingsSchema = z3.record(z3.
|
|
42114
|
-
var secretsSchema = z3.record(z3.
|
|
42113
|
+
var settingsSchema = z3.record(z3.union([z3.string(), z3.boolean(), z3.number(), z3.any()])).optional();
|
|
42114
|
+
var secretsSchema = z3.record(z3.union([z3.string(), z3.boolean(), z3.number()])).optional();
|
|
42115
42115
|
var characterSchema = z3.object({
|
|
42116
42116
|
id: uuidSchema2.optional(),
|
|
42117
42117
|
name: z3.string().min(1, "Character name is required"),
|
|
42118
42118
|
username: z3.string().optional(),
|
|
42119
42119
|
system: z3.string().optional(),
|
|
42120
|
-
templates: z3.record(
|
|
42120
|
+
templates: z3.record(templateTypeSchema).optional(),
|
|
42121
42121
|
bio: z3.union([z3.string(), z3.array(z3.string())]),
|
|
42122
42122
|
messageExamples: z3.array(z3.array(messageExampleSchema)).optional(),
|
|
42123
42123
|
postExamples: z3.array(z3.string()).optional(),
|
|
@@ -42315,16 +42315,85 @@ var BufferUtils = {
|
|
|
42315
42315
|
byteLength,
|
|
42316
42316
|
randomBytes
|
|
42317
42317
|
};
|
|
42318
|
-
// src/utils/
|
|
42319
|
-
|
|
42320
|
-
|
|
42318
|
+
// src/utils/server-health.ts
|
|
42319
|
+
async function waitForServerReady(options) {
|
|
42320
|
+
const {
|
|
42321
|
+
port,
|
|
42322
|
+
endpoint = "/api/agents",
|
|
42323
|
+
maxWaitTime = 30000,
|
|
42324
|
+
pollInterval = 1000,
|
|
42325
|
+
requestTimeout = 2000,
|
|
42326
|
+
host = "localhost",
|
|
42327
|
+
protocol = "http"
|
|
42328
|
+
} = options;
|
|
42329
|
+
const url = `${protocol}://${host}:${port}${endpoint}`;
|
|
42330
|
+
const startTime = Date.now();
|
|
42331
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
42332
|
+
let controller;
|
|
42333
|
+
let timeoutId;
|
|
42321
42334
|
try {
|
|
42322
|
-
|
|
42323
|
-
|
|
42324
|
-
|
|
42335
|
+
controller = new AbortController;
|
|
42336
|
+
timeoutId = setTimeout(() => {
|
|
42337
|
+
if (controller) {
|
|
42338
|
+
controller.abort();
|
|
42339
|
+
}
|
|
42340
|
+
}, requestTimeout);
|
|
42341
|
+
const response = await fetch(url, {
|
|
42342
|
+
signal: controller.signal
|
|
42343
|
+
});
|
|
42344
|
+
if (timeoutId) {
|
|
42345
|
+
clearTimeout(timeoutId);
|
|
42346
|
+
timeoutId = undefined;
|
|
42347
|
+
}
|
|
42348
|
+
if (response.ok) {
|
|
42349
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
42350
|
+
return;
|
|
42351
|
+
}
|
|
42352
|
+
} catch (error) {} finally {
|
|
42353
|
+
if (timeoutId) {
|
|
42354
|
+
clearTimeout(timeoutId);
|
|
42355
|
+
}
|
|
42356
|
+
}
|
|
42357
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
42325
42358
|
}
|
|
42326
|
-
|
|
42327
|
-
}
|
|
42359
|
+
throw new Error(`Server failed to become ready at ${url} within ${maxWaitTime}ms`);
|
|
42360
|
+
}
|
|
42361
|
+
async function pingServer(options) {
|
|
42362
|
+
const {
|
|
42363
|
+
port,
|
|
42364
|
+
endpoint = "/api/agents",
|
|
42365
|
+
requestTimeout = 2000,
|
|
42366
|
+
host = "localhost",
|
|
42367
|
+
protocol = "http"
|
|
42368
|
+
} = options;
|
|
42369
|
+
const url = `${protocol}://${host}:${port}${endpoint}`;
|
|
42370
|
+
let controller;
|
|
42371
|
+
let timeoutId;
|
|
42372
|
+
try {
|
|
42373
|
+
controller = new AbortController;
|
|
42374
|
+
timeoutId = setTimeout(() => {
|
|
42375
|
+
if (controller) {
|
|
42376
|
+
controller.abort();
|
|
42377
|
+
}
|
|
42378
|
+
}, requestTimeout);
|
|
42379
|
+
const response = await fetch(url, {
|
|
42380
|
+
signal: controller.signal
|
|
42381
|
+
});
|
|
42382
|
+
if (timeoutId) {
|
|
42383
|
+
clearTimeout(timeoutId);
|
|
42384
|
+
timeoutId = undefined;
|
|
42385
|
+
}
|
|
42386
|
+
return response.ok;
|
|
42387
|
+
} catch (error) {
|
|
42388
|
+
return false;
|
|
42389
|
+
} finally {
|
|
42390
|
+
if (timeoutId) {
|
|
42391
|
+
clearTimeout(timeoutId);
|
|
42392
|
+
}
|
|
42393
|
+
}
|
|
42394
|
+
}
|
|
42395
|
+
// src/utils/paths.ts
|
|
42396
|
+
import path from "node:path";
|
|
42328
42397
|
|
|
42329
42398
|
class ElizaPaths {
|
|
42330
42399
|
cache = new Map;
|
|
@@ -42332,7 +42401,7 @@ class ElizaPaths {
|
|
|
42332
42401
|
const cached = this.cache.get("dataDir");
|
|
42333
42402
|
if (cached)
|
|
42334
42403
|
return cached;
|
|
42335
|
-
const dir =
|
|
42404
|
+
const dir = process.env.ELIZA_DATA_DIR || path.join(process.cwd(), ".eliza");
|
|
42336
42405
|
this.cache.set("dataDir", dir);
|
|
42337
42406
|
return dir;
|
|
42338
42407
|
}
|
|
@@ -42340,7 +42409,7 @@ class ElizaPaths {
|
|
|
42340
42409
|
const cached = this.cache.get("databaseDir");
|
|
42341
42410
|
if (cached)
|
|
42342
42411
|
return cached;
|
|
42343
|
-
const dir =
|
|
42412
|
+
const dir = process.env.ELIZA_DATABASE_DIR || process.env.PGLITE_DATA_DIR || path.join(this.getDataDir(), ".elizadb");
|
|
42344
42413
|
this.cache.set("databaseDir", dir);
|
|
42345
42414
|
return dir;
|
|
42346
42415
|
}
|
|
@@ -42348,7 +42417,7 @@ class ElizaPaths {
|
|
|
42348
42417
|
const cached = this.cache.get("charactersDir");
|
|
42349
42418
|
if (cached)
|
|
42350
42419
|
return cached;
|
|
42351
|
-
const dir =
|
|
42420
|
+
const dir = process.env.ELIZA_DATA_DIR_CHARACTERS || path.join(this.getDataDir(), "data", "characters");
|
|
42352
42421
|
this.cache.set("charactersDir", dir);
|
|
42353
42422
|
return dir;
|
|
42354
42423
|
}
|
|
@@ -42356,7 +42425,7 @@ class ElizaPaths {
|
|
|
42356
42425
|
const cached = this.cache.get("generatedDir");
|
|
42357
42426
|
if (cached)
|
|
42358
42427
|
return cached;
|
|
42359
|
-
const dir =
|
|
42428
|
+
const dir = process.env.ELIZA_DATA_DIR_GENERATED || path.join(this.getDataDir(), "data", "generated");
|
|
42360
42429
|
this.cache.set("generatedDir", dir);
|
|
42361
42430
|
return dir;
|
|
42362
42431
|
}
|
|
@@ -42364,7 +42433,7 @@ class ElizaPaths {
|
|
|
42364
42433
|
const cached = this.cache.get("uploadsAgentsDir");
|
|
42365
42434
|
if (cached)
|
|
42366
42435
|
return cached;
|
|
42367
|
-
const dir =
|
|
42436
|
+
const dir = process.env.ELIZA_DATA_DIR_UPLOADS_AGENTS || path.join(this.getDataDir(), "data", "uploads", "agents");
|
|
42368
42437
|
this.cache.set("uploadsAgentsDir", dir);
|
|
42369
42438
|
return dir;
|
|
42370
42439
|
}
|
|
@@ -42372,7 +42441,7 @@ class ElizaPaths {
|
|
|
42372
42441
|
const cached = this.cache.get("uploadsChannelsDir");
|
|
42373
42442
|
if (cached)
|
|
42374
42443
|
return cached;
|
|
42375
|
-
const dir =
|
|
42444
|
+
const dir = process.env.ELIZA_DATA_DIR_UPLOADS_CHANNELS || path.join(this.getDataDir(), "data", "uploads", "channels");
|
|
42376
42445
|
this.cache.set("uploadsChannelsDir", dir);
|
|
42377
42446
|
return dir;
|
|
42378
42447
|
}
|
|
@@ -42424,84 +42493,6 @@ function resetPaths() {
|
|
|
42424
42493
|
}
|
|
42425
42494
|
pathsInstance = null;
|
|
42426
42495
|
}
|
|
42427
|
-
|
|
42428
|
-
// src/utils/server-health.ts
|
|
42429
|
-
async function waitForServerReady(options) {
|
|
42430
|
-
const {
|
|
42431
|
-
port,
|
|
42432
|
-
endpoint = "/api/agents",
|
|
42433
|
-
maxWaitTime = 30000,
|
|
42434
|
-
pollInterval = 1000,
|
|
42435
|
-
requestTimeout = 2000,
|
|
42436
|
-
host = "localhost",
|
|
42437
|
-
protocol = "http"
|
|
42438
|
-
} = options;
|
|
42439
|
-
const url = `${protocol}://${host}:${port}${endpoint}`;
|
|
42440
|
-
const startTime = Date.now();
|
|
42441
|
-
while (Date.now() - startTime < maxWaitTime) {
|
|
42442
|
-
let controller;
|
|
42443
|
-
let timeoutId;
|
|
42444
|
-
try {
|
|
42445
|
-
controller = new AbortController;
|
|
42446
|
-
timeoutId = setTimeout(() => {
|
|
42447
|
-
if (controller) {
|
|
42448
|
-
controller.abort();
|
|
42449
|
-
}
|
|
42450
|
-
}, requestTimeout);
|
|
42451
|
-
const response = await fetch(url, {
|
|
42452
|
-
signal: controller.signal
|
|
42453
|
-
});
|
|
42454
|
-
if (timeoutId) {
|
|
42455
|
-
clearTimeout(timeoutId);
|
|
42456
|
-
timeoutId = undefined;
|
|
42457
|
-
}
|
|
42458
|
-
if (response.ok) {
|
|
42459
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
42460
|
-
return;
|
|
42461
|
-
}
|
|
42462
|
-
} catch (error) {} finally {
|
|
42463
|
-
if (timeoutId) {
|
|
42464
|
-
clearTimeout(timeoutId);
|
|
42465
|
-
}
|
|
42466
|
-
}
|
|
42467
|
-
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
42468
|
-
}
|
|
42469
|
-
throw new Error(`Server failed to become ready at ${url} within ${maxWaitTime}ms`);
|
|
42470
|
-
}
|
|
42471
|
-
async function pingServer(options) {
|
|
42472
|
-
const {
|
|
42473
|
-
port,
|
|
42474
|
-
endpoint = "/api/agents",
|
|
42475
|
-
requestTimeout = 2000,
|
|
42476
|
-
host = "localhost",
|
|
42477
|
-
protocol = "http"
|
|
42478
|
-
} = options;
|
|
42479
|
-
const url = `${protocol}://${host}:${port}${endpoint}`;
|
|
42480
|
-
let controller;
|
|
42481
|
-
let timeoutId;
|
|
42482
|
-
try {
|
|
42483
|
-
controller = new AbortController;
|
|
42484
|
-
timeoutId = setTimeout(() => {
|
|
42485
|
-
if (controller) {
|
|
42486
|
-
controller.abort();
|
|
42487
|
-
}
|
|
42488
|
-
}, requestTimeout);
|
|
42489
|
-
const response = await fetch(url, {
|
|
42490
|
-
signal: controller.signal
|
|
42491
|
-
});
|
|
42492
|
-
if (timeoutId) {
|
|
42493
|
-
clearTimeout(timeoutId);
|
|
42494
|
-
timeoutId = undefined;
|
|
42495
|
-
}
|
|
42496
|
-
return response.ok;
|
|
42497
|
-
} catch (error) {
|
|
42498
|
-
return false;
|
|
42499
|
-
} finally {
|
|
42500
|
-
if (timeoutId) {
|
|
42501
|
-
clearTimeout(timeoutId);
|
|
42502
|
-
}
|
|
42503
|
-
}
|
|
42504
|
-
}
|
|
42505
42496
|
// src/actions.ts
|
|
42506
42497
|
var import_unique_names_generator2 = __toESM(require_dist4(), 1);
|
|
42507
42498
|
var composeActionExamples = (actionsData, count) => {
|
|
@@ -45115,9 +45106,7 @@ class AgentRuntime {
|
|
|
45115
45106
|
await this.adapter.init();
|
|
45116
45107
|
}
|
|
45117
45108
|
async close() {
|
|
45118
|
-
|
|
45119
|
-
await this.adapter.close();
|
|
45120
|
-
}
|
|
45109
|
+
await this.adapter.close();
|
|
45121
45110
|
}
|
|
45122
45111
|
async getAgent(agentId) {
|
|
45123
45112
|
return await this.adapter.getAgent(agentId);
|
|
@@ -45809,206 +45798,6 @@ function defineService(definition) {
|
|
|
45809
45798
|
return createService(definition.serviceType).withDescription(definition.description).withStart(definition.start).withStop(definition.stop || (() => Promise.resolve())).build();
|
|
45810
45799
|
}
|
|
45811
45800
|
|
|
45812
|
-
// src/elizaos.ts
|
|
45813
|
-
class ElizaOS extends EventTarget {
|
|
45814
|
-
runtimes = new Map;
|
|
45815
|
-
editableMode = false;
|
|
45816
|
-
async addAgents(agents) {
|
|
45817
|
-
const promises = agents.map(async (agent) => {
|
|
45818
|
-
const runtime = new AgentRuntime({
|
|
45819
|
-
character: agent.character,
|
|
45820
|
-
plugins: agent.plugins || []
|
|
45821
|
-
});
|
|
45822
|
-
this.runtimes.set(runtime.agentId, runtime);
|
|
45823
|
-
this.dispatchEvent(new CustomEvent("agent:added", {
|
|
45824
|
-
detail: { agentId: runtime.agentId, character: agent.character }
|
|
45825
|
-
}));
|
|
45826
|
-
return runtime.agentId;
|
|
45827
|
-
});
|
|
45828
|
-
const ids = await Promise.all(promises);
|
|
45829
|
-
this.dispatchEvent(new CustomEvent("agents:added", {
|
|
45830
|
-
detail: { agentIds: ids, count: ids.length }
|
|
45831
|
-
}));
|
|
45832
|
-
return ids;
|
|
45833
|
-
}
|
|
45834
|
-
registerAgent(runtime) {
|
|
45835
|
-
if (this.runtimes.has(runtime.agentId)) {
|
|
45836
|
-
throw new Error(`Agent ${runtime.agentId} already registered`);
|
|
45837
|
-
}
|
|
45838
|
-
this.runtimes.set(runtime.agentId, runtime);
|
|
45839
|
-
this.dispatchEvent(new CustomEvent("agent:registered", {
|
|
45840
|
-
detail: { agentId: runtime.agentId, runtime }
|
|
45841
|
-
}));
|
|
45842
|
-
}
|
|
45843
|
-
async updateAgent(agentId, updates) {
|
|
45844
|
-
if (!this.editableMode) {
|
|
45845
|
-
throw new Error("Editable mode not enabled");
|
|
45846
|
-
}
|
|
45847
|
-
const runtime = this.runtimes.get(agentId);
|
|
45848
|
-
if (!runtime) {
|
|
45849
|
-
throw new Error(`Agent ${agentId} not found`);
|
|
45850
|
-
}
|
|
45851
|
-
Object.assign(runtime.character, updates);
|
|
45852
|
-
this.dispatchEvent(new CustomEvent("agent:updated", {
|
|
45853
|
-
detail: { agentId, updates }
|
|
45854
|
-
}));
|
|
45855
|
-
}
|
|
45856
|
-
async deleteAgents(agentIds) {
|
|
45857
|
-
await this.stopAgents(agentIds);
|
|
45858
|
-
for (const id of agentIds) {
|
|
45859
|
-
this.runtimes.delete(id);
|
|
45860
|
-
}
|
|
45861
|
-
this.dispatchEvent(new CustomEvent("agents:deleted", {
|
|
45862
|
-
detail: { agentIds, count: agentIds.length }
|
|
45863
|
-
}));
|
|
45864
|
-
}
|
|
45865
|
-
async startAgents(agentIds) {
|
|
45866
|
-
const ids = agentIds || Array.from(this.runtimes.keys());
|
|
45867
|
-
await Promise.all(ids.map(async (id) => {
|
|
45868
|
-
const runtime = this.runtimes.get(id);
|
|
45869
|
-
if (!runtime) {
|
|
45870
|
-
throw new Error(`Agent ${id} not found`);
|
|
45871
|
-
}
|
|
45872
|
-
await runtime.initialize();
|
|
45873
|
-
this.dispatchEvent(new CustomEvent("agent:started", {
|
|
45874
|
-
detail: { agentId: id }
|
|
45875
|
-
}));
|
|
45876
|
-
}));
|
|
45877
|
-
this.dispatchEvent(new CustomEvent("agents:started", {
|
|
45878
|
-
detail: { agentIds: ids, count: ids.length }
|
|
45879
|
-
}));
|
|
45880
|
-
}
|
|
45881
|
-
async stopAgents(agentIds) {
|
|
45882
|
-
const ids = agentIds || Array.from(this.runtimes.keys());
|
|
45883
|
-
await Promise.all(ids.map(async (id) => {
|
|
45884
|
-
const runtime = this.runtimes.get(id);
|
|
45885
|
-
if (runtime) {
|
|
45886
|
-
await runtime.stop();
|
|
45887
|
-
}
|
|
45888
|
-
}));
|
|
45889
|
-
this.dispatchEvent(new CustomEvent("agents:stopped", {
|
|
45890
|
-
detail: { agentIds: ids, count: ids.length }
|
|
45891
|
-
}));
|
|
45892
|
-
}
|
|
45893
|
-
getAgent(id) {
|
|
45894
|
-
return this.runtimes.get(id);
|
|
45895
|
-
}
|
|
45896
|
-
getAgents() {
|
|
45897
|
-
return Array.from(this.runtimes.values());
|
|
45898
|
-
}
|
|
45899
|
-
getAgentsByIds(ids) {
|
|
45900
|
-
return ids.map((id) => this.runtimes.get(id)).filter((runtime) => runtime !== undefined);
|
|
45901
|
-
}
|
|
45902
|
-
getAgentsByNames(names3) {
|
|
45903
|
-
const nameSet = new Set(names3.map((n) => n.toLowerCase()));
|
|
45904
|
-
return this.getAgents().filter((runtime) => nameSet.has(runtime.character.name.toLowerCase()));
|
|
45905
|
-
}
|
|
45906
|
-
getAgentById(id) {
|
|
45907
|
-
return this.getAgent(id);
|
|
45908
|
-
}
|
|
45909
|
-
getAgentByName(name) {
|
|
45910
|
-
const lowercaseName = name.toLowerCase();
|
|
45911
|
-
return this.getAgents().find((runtime) => runtime.character.name.toLowerCase() === lowercaseName);
|
|
45912
|
-
}
|
|
45913
|
-
getAgentByCharacterName(name) {
|
|
45914
|
-
return this.getAgentByName(name);
|
|
45915
|
-
}
|
|
45916
|
-
getAgentByCharacterId(characterId) {
|
|
45917
|
-
return this.getAgents().find((runtime) => runtime.character.id === characterId);
|
|
45918
|
-
}
|
|
45919
|
-
async sendMessage(agentId, message, options) {
|
|
45920
|
-
const runtime = this.runtimes.get(agentId);
|
|
45921
|
-
if (!runtime) {
|
|
45922
|
-
throw new Error(`Agent ${agentId} not found`);
|
|
45923
|
-
}
|
|
45924
|
-
const memory = typeof message === "string" ? {
|
|
45925
|
-
id: v4_default(),
|
|
45926
|
-
entityId: options?.userId || "system",
|
|
45927
|
-
agentId,
|
|
45928
|
-
roomId: options?.roomId || agentId,
|
|
45929
|
-
content: { text: message },
|
|
45930
|
-
createdAt: Date.now(),
|
|
45931
|
-
metadata: options?.metadata
|
|
45932
|
-
} : message;
|
|
45933
|
-
const responses = [];
|
|
45934
|
-
await runtime.processActions(memory, responses);
|
|
45935
|
-
this.dispatchEvent(new CustomEvent("message:sent", {
|
|
45936
|
-
detail: { agentId, message: memory, responses }
|
|
45937
|
-
}));
|
|
45938
|
-
return responses;
|
|
45939
|
-
}
|
|
45940
|
-
async sendMessages(messages) {
|
|
45941
|
-
const results = await Promise.all(messages.map(async ({ agentId, message, options }) => {
|
|
45942
|
-
try {
|
|
45943
|
-
const responses = await this.sendMessage(agentId, message, options);
|
|
45944
|
-
return { agentId, responses };
|
|
45945
|
-
} catch (error) {
|
|
45946
|
-
return {
|
|
45947
|
-
agentId,
|
|
45948
|
-
responses: [],
|
|
45949
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
45950
|
-
};
|
|
45951
|
-
}
|
|
45952
|
-
}));
|
|
45953
|
-
this.dispatchEvent(new CustomEvent("messages:sent", {
|
|
45954
|
-
detail: { results, count: messages.length }
|
|
45955
|
-
}));
|
|
45956
|
-
return results;
|
|
45957
|
-
}
|
|
45958
|
-
async validateApiKeys(agents) {
|
|
45959
|
-
const results = new Map;
|
|
45960
|
-
const ids = agents || Array.from(this.runtimes.keys());
|
|
45961
|
-
for (const id of ids) {
|
|
45962
|
-
const runtime = this.runtimes.get(id);
|
|
45963
|
-
if (runtime) {
|
|
45964
|
-
const hasKeys = !!(runtime.getSetting("OPENAI_API_KEY") || runtime.getSetting("ANTHROPIC_API_KEY"));
|
|
45965
|
-
results.set(id, hasKeys);
|
|
45966
|
-
}
|
|
45967
|
-
}
|
|
45968
|
-
return results;
|
|
45969
|
-
}
|
|
45970
|
-
async healthCheck(agents) {
|
|
45971
|
-
const results = new Map;
|
|
45972
|
-
const ids = agents || Array.from(this.runtimes.keys());
|
|
45973
|
-
for (const id of ids) {
|
|
45974
|
-
const runtime = this.runtimes.get(id);
|
|
45975
|
-
const status = {
|
|
45976
|
-
alive: !!runtime,
|
|
45977
|
-
responsive: true
|
|
45978
|
-
};
|
|
45979
|
-
if (typeof process !== "undefined") {
|
|
45980
|
-
status.memoryUsage = process.memoryUsage().heapUsed;
|
|
45981
|
-
status.uptime = process.uptime();
|
|
45982
|
-
}
|
|
45983
|
-
results.set(id, status);
|
|
45984
|
-
}
|
|
45985
|
-
return results;
|
|
45986
|
-
}
|
|
45987
|
-
getRuntimeAccessor() {
|
|
45988
|
-
return {
|
|
45989
|
-
getAgent: (id) => this.getAgent(id),
|
|
45990
|
-
getAgents: () => this.getAgents(),
|
|
45991
|
-
getState: (agentId) => {
|
|
45992
|
-
const agent = this.getAgent(agentId);
|
|
45993
|
-
if (!agent)
|
|
45994
|
-
return;
|
|
45995
|
-
const agentRuntime = agent;
|
|
45996
|
-
if (agentRuntime.stateCache && agentRuntime.stateCache.size > 0) {
|
|
45997
|
-
const states = Array.from(agentRuntime.stateCache.values());
|
|
45998
|
-
return states[states.length - 1];
|
|
45999
|
-
}
|
|
46000
|
-
return;
|
|
46001
|
-
}
|
|
46002
|
-
};
|
|
46003
|
-
}
|
|
46004
|
-
enableEditableMode() {
|
|
46005
|
-
this.editableMode = true;
|
|
46006
|
-
this.dispatchEvent(new CustomEvent("mode:editable", {
|
|
46007
|
-
detail: { editable: true }
|
|
46008
|
-
}));
|
|
46009
|
-
}
|
|
46010
|
-
}
|
|
46011
|
-
|
|
46012
45801
|
// src/entities.ts
|
|
46013
45802
|
var entityResolutionTemplate = `# Task: Resolve Entity Name
|
|
46014
45803
|
Message Sender: {{senderName}} (ID: {{senderId}})
|
|
@@ -46373,7 +46162,6 @@ export {
|
|
|
46373
46162
|
IBrowserService,
|
|
46374
46163
|
EventType,
|
|
46375
46164
|
Environment,
|
|
46376
|
-
ElizaOS,
|
|
46377
46165
|
DatabaseAdapter,
|
|
46378
46166
|
ContentType,
|
|
46379
46167
|
ChannelType,
|
|
@@ -46384,5 +46172,5 @@ export {
|
|
|
46384
46172
|
AgentRuntime
|
|
46385
46173
|
};
|
|
46386
46174
|
|
|
46387
|
-
//# debugId=
|
|
46175
|
+
//# debugId=919E5D09308269D664756E2164756E21
|
|
46388
46176
|
//# sourceMappingURL=index.node.js.map
|