@elizaos/core 1.5.10 → 1.5.11-alpha.2
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 +63 -63
- package/dist/browser/index.browser.js.map +7 -6
- package/dist/elizaos.d.ts +152 -0
- package/dist/elizaos.d.ts.map +1 -0
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- 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 +300 -88
- package/dist/node/index.node.js.map +8 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/utils/node.d.ts +6 -0
- package/dist/utils/node.d.ts.map +1 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/package.json +2 -2
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(path, msg) {
|
|
19684
|
+
this.path = path;
|
|
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.69";
|
|
25882
25882
|
|
|
25883
25883
|
// ../../node_modules/langsmith/dist/utils/env.js
|
|
25884
25884
|
var globalEnv;
|
|
@@ -42315,85 +42315,16 @@ var BufferUtils = {
|
|
|
42315
42315
|
byteLength,
|
|
42316
42316
|
randomBytes
|
|
42317
42317
|
};
|
|
42318
|
-
// src/utils/
|
|
42319
|
-
|
|
42320
|
-
|
|
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;
|
|
42318
|
+
// src/utils/paths.ts
|
|
42319
|
+
var pathJoin = (...parts) => {
|
|
42320
|
+
if (typeof process !== "undefined" && process.platform) {
|
|
42334
42321
|
try {
|
|
42335
|
-
|
|
42336
|
-
|
|
42337
|
-
|
|
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));
|
|
42358
|
-
}
|
|
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
|
-
}
|
|
42322
|
+
const path = __require("node:path");
|
|
42323
|
+
return path.join(...parts);
|
|
42324
|
+
} catch {}
|
|
42393
42325
|
}
|
|
42394
|
-
|
|
42395
|
-
|
|
42396
|
-
import path from "node:path";
|
|
42326
|
+
return parts.filter((part) => part).join("/").replace(/\/+/g, "/").replace(/\/$/, "");
|
|
42327
|
+
};
|
|
42397
42328
|
|
|
42398
42329
|
class ElizaPaths {
|
|
42399
42330
|
cache = new Map;
|
|
@@ -42401,7 +42332,7 @@ class ElizaPaths {
|
|
|
42401
42332
|
const cached = this.cache.get("dataDir");
|
|
42402
42333
|
if (cached)
|
|
42403
42334
|
return cached;
|
|
42404
|
-
const dir = process.env
|
|
42335
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATA_DIR || (typeof process !== "undefined" && process.cwd ? pathJoin(process.cwd(), ".eliza") : ".eliza");
|
|
42405
42336
|
this.cache.set("dataDir", dir);
|
|
42406
42337
|
return dir;
|
|
42407
42338
|
}
|
|
@@ -42409,7 +42340,7 @@ class ElizaPaths {
|
|
|
42409
42340
|
const cached = this.cache.get("databaseDir");
|
|
42410
42341
|
if (cached)
|
|
42411
42342
|
return cached;
|
|
42412
|
-
const dir = process.env
|
|
42343
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATABASE_DIR || typeof process !== "undefined" && process.env?.PGLITE_DATA_DIR || pathJoin(this.getDataDir(), ".elizadb");
|
|
42413
42344
|
this.cache.set("databaseDir", dir);
|
|
42414
42345
|
return dir;
|
|
42415
42346
|
}
|
|
@@ -42417,7 +42348,7 @@ class ElizaPaths {
|
|
|
42417
42348
|
const cached = this.cache.get("charactersDir");
|
|
42418
42349
|
if (cached)
|
|
42419
42350
|
return cached;
|
|
42420
|
-
const dir = process.env
|
|
42351
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATA_DIR_CHARACTERS || pathJoin(this.getDataDir(), "data", "characters");
|
|
42421
42352
|
this.cache.set("charactersDir", dir);
|
|
42422
42353
|
return dir;
|
|
42423
42354
|
}
|
|
@@ -42425,7 +42356,7 @@ class ElizaPaths {
|
|
|
42425
42356
|
const cached = this.cache.get("generatedDir");
|
|
42426
42357
|
if (cached)
|
|
42427
42358
|
return cached;
|
|
42428
|
-
const dir = process.env
|
|
42359
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATA_DIR_GENERATED || pathJoin(this.getDataDir(), "data", "generated");
|
|
42429
42360
|
this.cache.set("generatedDir", dir);
|
|
42430
42361
|
return dir;
|
|
42431
42362
|
}
|
|
@@ -42433,7 +42364,7 @@ class ElizaPaths {
|
|
|
42433
42364
|
const cached = this.cache.get("uploadsAgentsDir");
|
|
42434
42365
|
if (cached)
|
|
42435
42366
|
return cached;
|
|
42436
|
-
const dir = process.env
|
|
42367
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATA_DIR_UPLOADS_AGENTS || pathJoin(this.getDataDir(), "data", "uploads", "agents");
|
|
42437
42368
|
this.cache.set("uploadsAgentsDir", dir);
|
|
42438
42369
|
return dir;
|
|
42439
42370
|
}
|
|
@@ -42441,7 +42372,7 @@ class ElizaPaths {
|
|
|
42441
42372
|
const cached = this.cache.get("uploadsChannelsDir");
|
|
42442
42373
|
if (cached)
|
|
42443
42374
|
return cached;
|
|
42444
|
-
const dir = process.env
|
|
42375
|
+
const dir = typeof process !== "undefined" && process.env?.ELIZA_DATA_DIR_UPLOADS_CHANNELS || pathJoin(this.getDataDir(), "data", "uploads", "channels");
|
|
42445
42376
|
this.cache.set("uploadsChannelsDir", dir);
|
|
42446
42377
|
return dir;
|
|
42447
42378
|
}
|
|
@@ -42493,6 +42424,84 @@ function resetPaths() {
|
|
|
42493
42424
|
}
|
|
42494
42425
|
pathsInstance = null;
|
|
42495
42426
|
}
|
|
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
|
+
}
|
|
42496
42505
|
// src/actions.ts
|
|
42497
42506
|
var import_unique_names_generator2 = __toESM(require_dist4(), 1);
|
|
42498
42507
|
var composeActionExamples = (actionsData, count) => {
|
|
@@ -45106,7 +45115,9 @@ class AgentRuntime {
|
|
|
45106
45115
|
await this.adapter.init();
|
|
45107
45116
|
}
|
|
45108
45117
|
async close() {
|
|
45109
|
-
|
|
45118
|
+
if (this.adapter) {
|
|
45119
|
+
await this.adapter.close();
|
|
45120
|
+
}
|
|
45110
45121
|
}
|
|
45111
45122
|
async getAgent(agentId) {
|
|
45112
45123
|
return await this.adapter.getAgent(agentId);
|
|
@@ -45798,6 +45809,206 @@ function defineService(definition) {
|
|
|
45798
45809
|
return createService(definition.serviceType).withDescription(definition.description).withStart(definition.start).withStop(definition.stop || (() => Promise.resolve())).build();
|
|
45799
45810
|
}
|
|
45800
45811
|
|
|
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
|
+
|
|
45801
46012
|
// src/entities.ts
|
|
45802
46013
|
var entityResolutionTemplate = `# Task: Resolve Entity Name
|
|
45803
46014
|
Message Sender: {{senderName}} (ID: {{senderId}})
|
|
@@ -46162,6 +46373,7 @@ export {
|
|
|
46162
46373
|
IBrowserService,
|
|
46163
46374
|
EventType,
|
|
46164
46375
|
Environment,
|
|
46376
|
+
ElizaOS,
|
|
46165
46377
|
DatabaseAdapter,
|
|
46166
46378
|
ContentType,
|
|
46167
46379
|
ChannelType,
|
|
@@ -46172,5 +46384,5 @@ export {
|
|
|
46172
46384
|
AgentRuntime
|
|
46173
46385
|
};
|
|
46174
46386
|
|
|
46175
|
-
//# debugId=
|
|
46387
|
+
//# debugId=796B1B79AC3F114D64756E2164756E21
|
|
46176
46388
|
//# sourceMappingURL=index.node.js.map
|