@elizaos/server 1.6.0-beta.1 → 1.6.1-alpha.1
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/client/assets/{main-eWX6ruOp.js → main-BNtEiK3o.js} +65 -65
- package/dist/client/assets/main-BNtEiK3o.js.map +1 -0
- package/dist/client/assets/{main-CkbfKgca.css → main-BOBWcKWW.css} +119 -1
- package/dist/client/assets/{main-BXR0yfv8.js → main-C4q5_rtN.js} +3 -3
- package/dist/client/assets/{main-BXR0yfv8.js.map → main-C4q5_rtN.js.map} +1 -1
- package/dist/client/assets/{react-vendor-D5Td5IIA.js → react-vendor-pe76PXQl.js} +2 -2
- package/dist/client/assets/{react-vendor-D5Td5IIA.js.map → react-vendor-pe76PXQl.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/index.js +197 -58
- package/package.json +5 -5
- package/dist/client/assets/main-eWX6ruOp.js.map +0 -1
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
7
7
|
<title>ElizaOS - Client</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-C4q5_rtN.js"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/dist/index.js
CHANGED
|
@@ -23032,6 +23032,16 @@ import { validateUuid as validateUuid6 } from "@elizaos/core";
|
|
|
23032
23032
|
import express6 from "express";
|
|
23033
23033
|
function createAgentRunsRouter(elizaOS) {
|
|
23034
23034
|
const router = express6.Router();
|
|
23035
|
+
const RUNS_CACHE_TTL = 15000;
|
|
23036
|
+
const runsCache = new Map;
|
|
23037
|
+
const buildCacheKey = (agentId, query) => JSON.stringify({
|
|
23038
|
+
agentId,
|
|
23039
|
+
roomId: query.roomId || null,
|
|
23040
|
+
status: query.status || null,
|
|
23041
|
+
limit: query.limit || null,
|
|
23042
|
+
from: query.from || null,
|
|
23043
|
+
to: query.to || null
|
|
23044
|
+
});
|
|
23035
23045
|
router.get("/:agentId/runs", async (req, res) => {
|
|
23036
23046
|
const agentId = validateUuid6(req.params.agentId);
|
|
23037
23047
|
if (!agentId) {
|
|
@@ -23049,74 +23059,179 @@ function createAgentRunsRouter(elizaOS) {
|
|
|
23049
23059
|
const limitNum = Math.min(Number(limit) || 20, 100);
|
|
23050
23060
|
const fromTime = from ? Number(from) : undefined;
|
|
23051
23061
|
const toTime = to ? Number(to) : undefined;
|
|
23052
|
-
const
|
|
23062
|
+
const cacheKey = !fromTime && !toTime ? buildCacheKey(agentId, { roomId, status, limit: limitNum }) : null;
|
|
23063
|
+
if (cacheKey) {
|
|
23064
|
+
const cached = runsCache.get(cacheKey);
|
|
23065
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
23066
|
+
return sendSuccess(res, cached.payload);
|
|
23067
|
+
}
|
|
23068
|
+
}
|
|
23069
|
+
const adapter = runtime.adapter;
|
|
23070
|
+
const allowedStatuses = [
|
|
23071
|
+
"started",
|
|
23072
|
+
"completed",
|
|
23073
|
+
"timeout",
|
|
23074
|
+
"error",
|
|
23075
|
+
"all"
|
|
23076
|
+
];
|
|
23077
|
+
const statusFilter = typeof status === "string" && allowedStatuses.includes(status) ? status : undefined;
|
|
23078
|
+
if (adapter?.getAgentRunSummaries) {
|
|
23079
|
+
try {
|
|
23080
|
+
const fastResult = await adapter.getAgentRunSummaries({
|
|
23081
|
+
limit: limitNum,
|
|
23082
|
+
roomId: roomId ? roomId : undefined,
|
|
23083
|
+
status: statusFilter,
|
|
23084
|
+
from: fromTime,
|
|
23085
|
+
to: toTime
|
|
23086
|
+
});
|
|
23087
|
+
if (cacheKey) {
|
|
23088
|
+
runsCache.set(cacheKey, {
|
|
23089
|
+
payload: fastResult,
|
|
23090
|
+
expiresAt: Date.now() + RUNS_CACHE_TTL
|
|
23091
|
+
});
|
|
23092
|
+
}
|
|
23093
|
+
return sendSuccess(res, fastResult);
|
|
23094
|
+
} catch (error) {
|
|
23095
|
+
runtime.logger?.warn?.(`Optimized run summary query failed, falling back to log aggregation: ${error instanceof Error ? error.message : String(error)}`);
|
|
23096
|
+
}
|
|
23097
|
+
}
|
|
23098
|
+
const directAgentRunEventsPromise = runtime.getLogs({
|
|
23053
23099
|
entityId: agentId,
|
|
23054
23100
|
roomId: roomId ? roomId : undefined,
|
|
23055
23101
|
type: "run_event",
|
|
23056
|
-
count:
|
|
23057
|
-
});
|
|
23102
|
+
count: 1000
|
|
23103
|
+
}).catch(() => []);
|
|
23104
|
+
const directRunEvents = await directAgentRunEventsPromise;
|
|
23058
23105
|
const runMap = new Map;
|
|
23059
|
-
|
|
23060
|
-
const
|
|
23061
|
-
|
|
23062
|
-
|
|
23063
|
-
|
|
23064
|
-
|
|
23065
|
-
|
|
23066
|
-
|
|
23067
|
-
|
|
23068
|
-
|
|
23069
|
-
|
|
23070
|
-
runMap.
|
|
23071
|
-
runId,
|
|
23072
|
-
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
23082
|
-
|
|
23083
|
-
|
|
23084
|
-
|
|
23085
|
-
|
|
23086
|
-
|
|
23087
|
-
|
|
23088
|
-
|
|
23089
|
-
|
|
23090
|
-
|
|
23106
|
+
const ingestRunEvents = (logs) => {
|
|
23107
|
+
for (const log of logs) {
|
|
23108
|
+
const body = log.body;
|
|
23109
|
+
const runId = body.runId;
|
|
23110
|
+
if (!runId)
|
|
23111
|
+
continue;
|
|
23112
|
+
const logTime = new Date(log.createdAt).getTime();
|
|
23113
|
+
if (fromTime && logTime < fromTime)
|
|
23114
|
+
continue;
|
|
23115
|
+
if (toTime && logTime > toTime)
|
|
23116
|
+
continue;
|
|
23117
|
+
if (!runMap.has(runId)) {
|
|
23118
|
+
runMap.set(runId, {
|
|
23119
|
+
runId,
|
|
23120
|
+
status: "started",
|
|
23121
|
+
startedAt: null,
|
|
23122
|
+
endedAt: null,
|
|
23123
|
+
durationMs: null,
|
|
23124
|
+
messageId: body.messageId,
|
|
23125
|
+
roomId: body.roomId,
|
|
23126
|
+
entityId: body.entityId,
|
|
23127
|
+
metadata: body.metadata || {}
|
|
23128
|
+
});
|
|
23129
|
+
}
|
|
23130
|
+
const run = runMap.get(runId);
|
|
23131
|
+
const eventStatus = body.status;
|
|
23132
|
+
if (eventStatus === "started") {
|
|
23133
|
+
run.startedAt = logTime;
|
|
23134
|
+
} else if (eventStatus === "completed" || eventStatus === "timeout" || eventStatus === "error") {
|
|
23135
|
+
run.status = eventStatus;
|
|
23136
|
+
run.endedAt = logTime;
|
|
23137
|
+
if (run.startedAt) {
|
|
23138
|
+
run.durationMs = logTime - run.startedAt;
|
|
23139
|
+
}
|
|
23091
23140
|
}
|
|
23092
23141
|
}
|
|
23142
|
+
};
|
|
23143
|
+
ingestRunEvents(directRunEvents);
|
|
23144
|
+
const needsMoreRuns = () => runMap.size < limitNum;
|
|
23145
|
+
if (needsMoreRuns()) {
|
|
23146
|
+
try {
|
|
23147
|
+
const recentMessages = await runtime.getMemories({
|
|
23148
|
+
tableName: "messages",
|
|
23149
|
+
roomId: roomId ? roomId : undefined,
|
|
23150
|
+
count: 200
|
|
23151
|
+
});
|
|
23152
|
+
const authorIds = Array.from(new Set(recentMessages.map((m) => m.entityId).filter((eid) => Boolean(eid) && eid !== agentId))).slice(0, 10);
|
|
23153
|
+
const authorRunEvents = await Promise.all(authorIds.map((authorId) => runtime.getLogs({
|
|
23154
|
+
entityId: authorId,
|
|
23155
|
+
roomId: roomId ? roomId : undefined,
|
|
23156
|
+
type: "run_event",
|
|
23157
|
+
count: 500
|
|
23158
|
+
}).catch(() => [])));
|
|
23159
|
+
for (const logs of authorRunEvents) {
|
|
23160
|
+
ingestRunEvents(logs);
|
|
23161
|
+
if (!needsMoreRuns())
|
|
23162
|
+
break;
|
|
23163
|
+
}
|
|
23164
|
+
} catch {}
|
|
23165
|
+
}
|
|
23166
|
+
if (!roomId && needsMoreRuns()) {
|
|
23167
|
+
try {
|
|
23168
|
+
const worlds = await runtime.getAllWorlds();
|
|
23169
|
+
const roomIds = [];
|
|
23170
|
+
for (const w of worlds) {
|
|
23171
|
+
try {
|
|
23172
|
+
const rooms = await runtime.getRooms(w.id);
|
|
23173
|
+
roomIds.push(...rooms.map((r) => r.id));
|
|
23174
|
+
} catch {}
|
|
23175
|
+
if (roomIds.length > 20)
|
|
23176
|
+
break;
|
|
23177
|
+
}
|
|
23178
|
+
const participantLogs = await Promise.all(roomIds.map(async (rId) => {
|
|
23179
|
+
try {
|
|
23180
|
+
const participants = await runtime.getParticipantsForRoom(rId);
|
|
23181
|
+
const otherParticipants = participants.filter((pid) => pid !== agentId).slice(0, 5);
|
|
23182
|
+
const logsPerParticipant = await Promise.all(otherParticipants.map((participantId) => runtime.getLogs({
|
|
23183
|
+
entityId: participantId,
|
|
23184
|
+
roomId: rId,
|
|
23185
|
+
type: "run_event",
|
|
23186
|
+
count: 300
|
|
23187
|
+
}).catch(() => [])));
|
|
23188
|
+
return logsPerParticipant.flat();
|
|
23189
|
+
} catch {
|
|
23190
|
+
return [];
|
|
23191
|
+
}
|
|
23192
|
+
}));
|
|
23193
|
+
for (const logs of participantLogs) {
|
|
23194
|
+
ingestRunEvents(logs);
|
|
23195
|
+
if (!needsMoreRuns())
|
|
23196
|
+
break;
|
|
23197
|
+
}
|
|
23198
|
+
} catch {}
|
|
23093
23199
|
}
|
|
23094
23200
|
let runs = Array.from(runMap.values());
|
|
23095
|
-
if (
|
|
23096
|
-
runs = runs.filter((run) => run.status ===
|
|
23201
|
+
if (statusFilter && statusFilter !== "all") {
|
|
23202
|
+
runs = runs.filter((run) => run.status === statusFilter);
|
|
23097
23203
|
}
|
|
23098
23204
|
runs.sort((a, b) => (b.startedAt || 0) - (a.startedAt || 0));
|
|
23099
23205
|
const limitedRuns = runs.slice(0, limitNum);
|
|
23100
23206
|
const runIdSet = new Set(limitedRuns.map((r) => r.runId));
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
|
|
23119
|
-
|
|
23207
|
+
let actionLogs = [];
|
|
23208
|
+
let evaluatorLogs = [];
|
|
23209
|
+
let genericLogs = [];
|
|
23210
|
+
if (runIdSet.size > 0) {
|
|
23211
|
+
const logFetchCount = Math.max(200, limitNum * 50);
|
|
23212
|
+
const [action, evaluator, generic] = await Promise.all([
|
|
23213
|
+
runtime.getLogs({
|
|
23214
|
+
entityId: agentId,
|
|
23215
|
+
roomId: roomId ? roomId : undefined,
|
|
23216
|
+
type: "action",
|
|
23217
|
+
count: logFetchCount
|
|
23218
|
+
}).catch(() => []),
|
|
23219
|
+
runtime.getLogs({
|
|
23220
|
+
entityId: agentId,
|
|
23221
|
+
roomId: roomId ? roomId : undefined,
|
|
23222
|
+
type: "evaluator",
|
|
23223
|
+
count: logFetchCount
|
|
23224
|
+
}).catch(() => []),
|
|
23225
|
+
runtime.getLogs({
|
|
23226
|
+
entityId: agentId,
|
|
23227
|
+
roomId: roomId ? roomId : undefined,
|
|
23228
|
+
count: logFetchCount
|
|
23229
|
+
}).catch(() => [])
|
|
23230
|
+
]);
|
|
23231
|
+
actionLogs = action;
|
|
23232
|
+
evaluatorLogs = evaluator;
|
|
23233
|
+
genericLogs = generic;
|
|
23234
|
+
}
|
|
23120
23235
|
const countsByRunId = {};
|
|
23121
23236
|
for (const run of limitedRuns) {
|
|
23122
23237
|
countsByRunId[run.runId] = { actions: 0, modelCalls: 0, errors: 0, evaluators: 0 };
|
|
@@ -23171,6 +23286,12 @@ function createAgentRunsRouter(elizaOS) {
|
|
|
23171
23286
|
total: runs.length,
|
|
23172
23287
|
hasMore: runs.length > limitNum
|
|
23173
23288
|
};
|
|
23289
|
+
if (cacheKey) {
|
|
23290
|
+
runsCache.set(cacheKey, {
|
|
23291
|
+
payload: response,
|
|
23292
|
+
expiresAt: Date.now() + RUNS_CACHE_TTL
|
|
23293
|
+
});
|
|
23294
|
+
}
|
|
23174
23295
|
sendSuccess(res, response);
|
|
23175
23296
|
} catch (error) {
|
|
23176
23297
|
sendError(res, 500, "RUNS_ERROR", "Error retrieving agent runs", error instanceof Error ? error.message : String(error));
|
|
@@ -23196,7 +23317,25 @@ function createAgentRunsRouter(elizaOS) {
|
|
|
23196
23317
|
roomId: roomId ? roomId : undefined,
|
|
23197
23318
|
count: 2000
|
|
23198
23319
|
});
|
|
23199
|
-
const
|
|
23320
|
+
const recentForDetail = await runtime.getMemories({
|
|
23321
|
+
tableName: "messages",
|
|
23322
|
+
roomId: roomId ? roomId : undefined,
|
|
23323
|
+
count: 300
|
|
23324
|
+
});
|
|
23325
|
+
const detailAuthorIds = Array.from(new Set(recentForDetail.map((m) => m.entityId).filter((eid) => Boolean(eid) && eid !== agentId)));
|
|
23326
|
+
const participantRunEvents = [];
|
|
23327
|
+
for (const authorId of detailAuthorIds) {
|
|
23328
|
+
try {
|
|
23329
|
+
const rLogs = await runtime.getLogs({
|
|
23330
|
+
entityId: authorId,
|
|
23331
|
+
roomId: roomId ? roomId : undefined,
|
|
23332
|
+
type: "run_event",
|
|
23333
|
+
count: 2000
|
|
23334
|
+
});
|
|
23335
|
+
participantRunEvents.push(...rLogs);
|
|
23336
|
+
} catch {}
|
|
23337
|
+
}
|
|
23338
|
+
const related = logs.concat(participantRunEvents).filter((l) => l.body.runId === runId);
|
|
23200
23339
|
const runEvents = related.filter((l) => l.type === "run_event").sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
23201
23340
|
const started = runEvents.find((e) => e.body.status === "started");
|
|
23202
23341
|
const last = runEvents[runEvents.length - 1];
|
|
@@ -27458,7 +27597,7 @@ import express30 from "express";
|
|
|
27458
27597
|
// package.json
|
|
27459
27598
|
var package_default = {
|
|
27460
27599
|
name: "@elizaos/server",
|
|
27461
|
-
version: "1.6.
|
|
27600
|
+
version: "1.6.1-alpha.1",
|
|
27462
27601
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
27463
27602
|
publishConfig: {
|
|
27464
27603
|
access: "public",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/server",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1-alpha.1",
|
|
4
4
|
"description": "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dev": "bun run build.ts --watch"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@elizaos/client": "1.6.
|
|
47
|
+
"@elizaos/client": "1.6.1-alpha.1",
|
|
48
48
|
"@types/node": "^24.0.1",
|
|
49
49
|
"prettier": "3.5.3",
|
|
50
50
|
"tsx": "4.19.4",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"which": "^4.0.0",
|
|
53
53
|
"ws": "^8.18.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "d7b2569dc9bb3b51e140b20d90ac4c22a4c9400e",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@elizaos/core": "1.6.
|
|
58
|
-
"@elizaos/plugin-sql": "1.6.
|
|
57
|
+
"@elizaos/core": "1.6.1-alpha.1",
|
|
58
|
+
"@elizaos/plugin-sql": "1.6.1-alpha.1",
|
|
59
59
|
"@sentry/node": "^10.11.0",
|
|
60
60
|
"@types/express": "^5.0.2",
|
|
61
61
|
"@types/helmet": "^4.0.0",
|