@elizaos/server 1.5.8-alpha.2 → 1.5.8-alpha.21
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/api/agents/panels.d.ts.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/runtime/logging.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -158
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../../src/api/agents/panels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../../src/api/agents/panels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,MAAM,CAwCxF"}
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkB5C;;;;GAIG;AAIH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,EAChC,cAAc,EAAE,WAAW,GAC1B,cAAc,CAkBhB;AAyCD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkB5C;;;;GAIG;AAIH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,EAChC,cAAc,EAAE,WAAW,GAC1B,cAAc,CAkBhB;AAyCD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,cAAc,CA6NjG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,EAChC,cAAc,EAAE,WAAW,GAC1B,OAAO,CAAC,MAAM,CAuEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/api/runtime/logging.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AA8B9B;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/api/runtime/logging.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AA8B9B;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAkKpD"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,eAAe,EACf,KAAK,aAAa,EAElB,KAAK,IAAI,EAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,OAA8B,MAAM,SAAS,CAAC;AAGrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAYrD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EAEd,MAAM,YAAY,CAAC;AAKpB;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBxD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAqB3E;AAMD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,EACrB,IAAI,EAAE,OAAO,CAAC,YAAY,KACvB,IAAI,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CA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;IAK/B,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IAWnD;;;;OAIG;IACG,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpE;;;;OAIG;IACG,qBAAqB,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE;;;;OAIG;IACG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAIzD;;;;OAIG;IACG,kBAAkB,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAaxD;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA8C/B;AAGD,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,UAAU,CAAC;AAGlB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1731,9 +1731,9 @@ function createAgentPanelsRouter(agents) {
|
|
|
1731
1731
|
return sendError(res, 404, "NOT_FOUND", "Agent not found");
|
|
1732
1732
|
}
|
|
1733
1733
|
try {
|
|
1734
|
-
const publicPanels = runtime.
|
|
1734
|
+
const publicPanels = runtime.routes.filter((route) => route.public === true && route.type === "GET" && route.name).map((route) => ({
|
|
1735
1735
|
name: route.name,
|
|
1736
|
-
path: `/api${route.path.startsWith("/") ? route.path : `/${route.path}`}?agentId=${agentId}`
|
|
1736
|
+
path: `/api/agents/${agentId}/plugins${route.path.startsWith("/") ? route.path : `/${route.path}`}?agentId=${agentId}`
|
|
1737
1737
|
}));
|
|
1738
1738
|
sendSuccess(res, publicPanels);
|
|
1739
1739
|
} catch (error) {
|
|
@@ -5547,7 +5547,7 @@ function createHealthRouter(agents, serverInstance) {
|
|
|
5547
5547
|
}
|
|
5548
5548
|
|
|
5549
5549
|
// src/api/runtime/logging.ts
|
|
5550
|
-
import { logger as logger23 } from "@elizaos/core";
|
|
5550
|
+
import { logger as logger23, recentLogs } from "@elizaos/core";
|
|
5551
5551
|
import express24 from "express";
|
|
5552
5552
|
var LOG_LEVELS = {
|
|
5553
5553
|
fatal: 60,
|
|
@@ -5568,24 +5568,60 @@ function createLoggingRouter() {
|
|
|
5568
5568
|
const requestedAgentName = req.query.agentName?.toString() || "all";
|
|
5569
5569
|
const requestedAgentId = req.query.agentId?.toString() || "all";
|
|
5570
5570
|
const limit = Math.min(Number(req.query.limit) || 100, 1000);
|
|
5571
|
-
const destination = logger23[Symbol.for("pino-destination")];
|
|
5572
|
-
if (!destination?.recentLogs) {
|
|
5573
|
-
return res.status(500).json({
|
|
5574
|
-
error: "Logger destination not available",
|
|
5575
|
-
message: "The logger is not configured to maintain recent logs"
|
|
5576
|
-
});
|
|
5577
|
-
}
|
|
5578
5571
|
try {
|
|
5579
|
-
const
|
|
5572
|
+
const recentLogsString = recentLogs();
|
|
5573
|
+
let logEntries = [];
|
|
5574
|
+
if (recentLogsString) {
|
|
5575
|
+
const lines = recentLogsString.split(`
|
|
5576
|
+
`).filter((line) => line.trim());
|
|
5577
|
+
logEntries = lines.map((line, index) => {
|
|
5578
|
+
const cleanLine = line.replace(/\u001B\[[0-9;]*m/g, "");
|
|
5579
|
+
const logMatch = cleanLine.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\s+(\w+)\s+(.+)$/);
|
|
5580
|
+
if (logMatch) {
|
|
5581
|
+
const [, timestamp, levelStr, message] = logMatch;
|
|
5582
|
+
let level = LOG_LEVELS.info;
|
|
5583
|
+
const levelLower = levelStr.trim().toLowerCase();
|
|
5584
|
+
if (levelLower === "error")
|
|
5585
|
+
level = LOG_LEVELS.error;
|
|
5586
|
+
else if (levelLower === "warn")
|
|
5587
|
+
level = LOG_LEVELS.warn;
|
|
5588
|
+
else if (levelLower === "info")
|
|
5589
|
+
level = LOG_LEVELS.info;
|
|
5590
|
+
else if (levelLower === "log")
|
|
5591
|
+
level = LOG_LEVELS.log;
|
|
5592
|
+
else if (levelLower === "progress")
|
|
5593
|
+
level = LOG_LEVELS.progress;
|
|
5594
|
+
else if (levelLower === "success")
|
|
5595
|
+
level = LOG_LEVELS.success;
|
|
5596
|
+
else if (levelLower === "debug")
|
|
5597
|
+
level = LOG_LEVELS.debug;
|
|
5598
|
+
else if (levelLower === "trace")
|
|
5599
|
+
level = LOG_LEVELS.trace;
|
|
5600
|
+
else if (levelLower === "fatal")
|
|
5601
|
+
level = LOG_LEVELS.fatal;
|
|
5602
|
+
return {
|
|
5603
|
+
time: new Date(timestamp).getTime(),
|
|
5604
|
+
level,
|
|
5605
|
+
msg: message.trim()
|
|
5606
|
+
};
|
|
5607
|
+
} else {
|
|
5608
|
+
return {
|
|
5609
|
+
time: Date.now() - (lines.length - index) * 1000,
|
|
5610
|
+
level: LOG_LEVELS.info,
|
|
5611
|
+
msg: line.trim()
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5580
5616
|
const requestedLevelValue = requestedLevel === "all" ? 0 : LOG_LEVELS[requestedLevel] || LOG_LEVELS.info;
|
|
5581
|
-
const logsWithAgentNames =
|
|
5582
|
-
const logsWithAgentIds =
|
|
5583
|
-
const totalLogs =
|
|
5617
|
+
const logsWithAgentNames = logEntries.filter((l) => l.agentName).length;
|
|
5618
|
+
const logsWithAgentIds = logEntries.filter((l) => l.agentId).length;
|
|
5619
|
+
const totalLogs = logEntries.length;
|
|
5584
5620
|
const agentNamePopulationRate = totalLogs > 0 ? logsWithAgentNames / totalLogs : 0;
|
|
5585
5621
|
const agentIdPopulationRate = totalLogs > 0 ? logsWithAgentIds / totalLogs : 0;
|
|
5586
5622
|
const isAgentNameDataSparse = agentNamePopulationRate < 0.1;
|
|
5587
5623
|
const isAgentIdDataSparse = agentIdPopulationRate < 0.1;
|
|
5588
|
-
const filtered =
|
|
5624
|
+
const filtered = logEntries.filter((log) => {
|
|
5589
5625
|
const timeMatch = log.time >= since;
|
|
5590
5626
|
let levelMatch = true;
|
|
5591
5627
|
if (requestedLevel && requestedLevel !== "all") {
|
|
@@ -5609,27 +5645,11 @@ function createLoggingRouter() {
|
|
|
5609
5645
|
}
|
|
5610
5646
|
return timeMatch && levelMatch && agentNameMatch && agentIdMatch;
|
|
5611
5647
|
}).slice(-limit);
|
|
5612
|
-
logger23.debug(
|
|
5613
|
-
requestedLevel,
|
|
5614
|
-
requestedLevelValue,
|
|
5615
|
-
requestedAgentName,
|
|
5616
|
-
requestedAgentId,
|
|
5617
|
-
filteredCount: filtered.length,
|
|
5618
|
-
totalLogs: recentLogs.length,
|
|
5619
|
-
logsWithAgentNames,
|
|
5620
|
-
logsWithAgentIds,
|
|
5621
|
-
agentNamePopulationRate: Math.round(agentNamePopulationRate * 100) + "%",
|
|
5622
|
-
agentIdPopulationRate: Math.round(agentIdPopulationRate * 100) + "%",
|
|
5623
|
-
isAgentNameDataSparse,
|
|
5624
|
-
isAgentIdDataSparse,
|
|
5625
|
-
sampleLogAgentNames: recentLogs.slice(0, 5).map((log) => log.agentName),
|
|
5626
|
-
uniqueAgentNamesInLogs: [...new Set(recentLogs.map((log) => log.agentName))].filter(Boolean),
|
|
5627
|
-
exactAgentNameMatches: recentLogs.filter((log) => log.agentName === requestedAgentName).length
|
|
5628
|
-
}));
|
|
5648
|
+
logger23.debug(`Logs request processed: ${filtered.length}/${logEntries.length} logs returned ` + `(level: ${requestedLevel}, agent: ${requestedAgentName})`);
|
|
5629
5649
|
res.json({
|
|
5630
5650
|
logs: filtered,
|
|
5631
5651
|
count: filtered.length,
|
|
5632
|
-
total:
|
|
5652
|
+
total: logEntries.length,
|
|
5633
5653
|
requestedLevel,
|
|
5634
5654
|
agentName: requestedAgentName,
|
|
5635
5655
|
agentId: requestedAgentId,
|
|
@@ -5646,14 +5666,7 @@ function createLoggingRouter() {
|
|
|
5646
5666
|
router.post("/logs", logsHandler);
|
|
5647
5667
|
const logsClearHandler = (_req, res) => {
|
|
5648
5668
|
try {
|
|
5649
|
-
|
|
5650
|
-
if (!destination?.clear) {
|
|
5651
|
-
return res.status(500).json({
|
|
5652
|
-
error: "Logger clear method not available",
|
|
5653
|
-
message: "The logger is not configured to clear logs"
|
|
5654
|
-
});
|
|
5655
|
-
}
|
|
5656
|
-
destination.clear();
|
|
5669
|
+
logger23.clear();
|
|
5657
5670
|
logger23.debug("Logs cleared via API endpoint");
|
|
5658
5671
|
res.json({ status: "success", message: "Logs cleared successfully" });
|
|
5659
5672
|
} catch (error) {
|
|
@@ -5826,7 +5839,7 @@ import express29 from "express";
|
|
|
5826
5839
|
// package.json
|
|
5827
5840
|
var package_default = {
|
|
5828
5841
|
name: "@elizaos/server",
|
|
5829
|
-
version: "1.5.8-alpha.
|
|
5842
|
+
version: "1.5.8-alpha.21",
|
|
5830
5843
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5831
5844
|
publishConfig: {
|
|
5832
5845
|
access: "public",
|
|
@@ -6321,11 +6334,11 @@ function setupLogStreaming(io, router) {
|
|
|
6321
6334
|
}
|
|
6322
6335
|
function createPluginRouteHandler(agents) {
|
|
6323
6336
|
return (req, res, next) => {
|
|
6324
|
-
logger26.debug("Handling plugin request in the plugin route handler",
|
|
6337
|
+
logger26.debug("Handling plugin request in the plugin route handler", `path: ${req.path}, method: ${req.method}`, {
|
|
6325
6338
|
path: req.path,
|
|
6326
6339
|
method: req.method,
|
|
6327
6340
|
query: req.query
|
|
6328
|
-
})
|
|
6341
|
+
});
|
|
6329
6342
|
const agentApiRoutePattern = /^\/agents\/[a-f0-9-]{36}\/(?!plugins\/)/i;
|
|
6330
6343
|
if (agentApiRoutePattern.test(req.path)) {
|
|
6331
6344
|
logger26.debug(`Skipping agent API route in plugin handler: ${req.path}`);
|
|
@@ -6350,77 +6363,81 @@ function createPluginRouteHandler(agents) {
|
|
|
6350
6363
|
let handled = false;
|
|
6351
6364
|
const agentIdFromQuery = req.query.agentId;
|
|
6352
6365
|
const reqPath = req.path;
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
route.handler(req, res, runtime);
|
|
6371
|
-
handled = true;
|
|
6372
|
-
}
|
|
6373
|
-
} catch (error) {
|
|
6374
|
-
logger26.error(`Error handling plugin wildcard route for agent ${agentIdFromQuery}: ${routePath}`, JSON.stringify({
|
|
6375
|
-
error: error instanceof Error ? error.message : String(error),
|
|
6376
|
-
path: reqPath,
|
|
6377
|
-
agent: agentIdFromQuery
|
|
6378
|
-
}));
|
|
6379
|
-
if (!res.headersSent) {
|
|
6380
|
-
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6381
|
-
res.status(status).json({
|
|
6382
|
-
error: error instanceof Error ? error.message : "Error processing wildcard route"
|
|
6383
|
-
});
|
|
6384
|
-
}
|
|
6366
|
+
const baselessReqPath = reqPath.replace(/\/api\/agents\/[^\/]+\/plugins/, "");
|
|
6367
|
+
logger26.debug("Plugin Request Path", baselessReqPath);
|
|
6368
|
+
function findRouteInRuntime(runtime) {
|
|
6369
|
+
for (const route of runtime.routes) {
|
|
6370
|
+
if (handled)
|
|
6371
|
+
break;
|
|
6372
|
+
const methodMatches = req.method.toLowerCase() === route.type.toLowerCase();
|
|
6373
|
+
if (!methodMatches)
|
|
6374
|
+
continue;
|
|
6375
|
+
const routePath = route.path;
|
|
6376
|
+
if (routePath.endsWith("/*")) {
|
|
6377
|
+
const baseRoute = routePath.slice(0, -1);
|
|
6378
|
+
if (baselessReqPath.startsWith(baseRoute)) {
|
|
6379
|
+
logger26.debug(`Agent ${runtime.character.name} plugin wildcard route: [${route.type.toUpperCase()}] ${routePath} for request: ${reqPath}`);
|
|
6380
|
+
try {
|
|
6381
|
+
if (route.handler) {
|
|
6382
|
+
route.handler(req, res, runtime);
|
|
6385
6383
|
handled = true;
|
|
6386
6384
|
}
|
|
6385
|
+
} catch (error) {
|
|
6386
|
+
logger26.error(`Error handling plugin wildcard route for agent ${agentIdFromQuery}: ${routePath}`, error instanceof Error ? error.message : String(error), {
|
|
6387
|
+
path: reqPath,
|
|
6388
|
+
agent: agentIdFromQuery
|
|
6389
|
+
});
|
|
6390
|
+
if (!res.headersSent) {
|
|
6391
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6392
|
+
res.status(status).json({
|
|
6393
|
+
error: error instanceof Error ? error.message : "Error processing wildcard route"
|
|
6394
|
+
});
|
|
6395
|
+
}
|
|
6396
|
+
handled = true;
|
|
6387
6397
|
}
|
|
6388
|
-
}
|
|
6389
|
-
|
|
6390
|
-
|
|
6398
|
+
}
|
|
6399
|
+
} else {
|
|
6400
|
+
logger26.debug(`Agent ${runtime.character.name} attempting plugin route match: [${route.type.toUpperCase()}] ${routePath} vs request path: ${baselessReqPath}`);
|
|
6401
|
+
let matcher;
|
|
6402
|
+
try {
|
|
6403
|
+
matcher = import_path_to_regexp.match(routePath, { decode: decodeURIComponent });
|
|
6404
|
+
} catch (err) {
|
|
6405
|
+
logger26.error(`Invalid plugin route path syntax for agent ${agentIdFromQuery}: "${routePath}"`, err instanceof Error ? err.message : String(err));
|
|
6406
|
+
continue;
|
|
6407
|
+
}
|
|
6408
|
+
const matched = matcher(baselessReqPath);
|
|
6409
|
+
if (matched) {
|
|
6410
|
+
logger26.debug(`Agent ${runtime.character.name} plugin route matched: [${route.type.toUpperCase()}] ${routePath} vs request path: ${reqPath}`);
|
|
6411
|
+
req.params = { ...matched.params || {} };
|
|
6391
6412
|
try {
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
logger26.error(`Invalid plugin route path syntax for agent ${agentIdFromQuery}: "${routePath}"`, err instanceof Error ? err.message : String(err));
|
|
6395
|
-
continue;
|
|
6396
|
-
}
|
|
6397
|
-
const matched = matcher(reqPath);
|
|
6398
|
-
if (matched) {
|
|
6399
|
-
logger26.debug(`Agent ${agentIdFromQuery} plugin route matched: [${route.type.toUpperCase()}] ${routePath} vs request path: ${reqPath}`);
|
|
6400
|
-
req.params = { ...matched.params || {} };
|
|
6401
|
-
try {
|
|
6402
|
-
if (route.handler) {
|
|
6403
|
-
route.handler(req, res, runtime);
|
|
6404
|
-
handled = true;
|
|
6405
|
-
}
|
|
6406
|
-
} catch (error) {
|
|
6407
|
-
logger26.error(`Error handling plugin route for agent ${agentIdFromQuery}: ${routePath}`, JSON.stringify({
|
|
6408
|
-
error: error instanceof Error ? error.message : String(error),
|
|
6409
|
-
path: reqPath,
|
|
6410
|
-
agent: agentIdFromQuery,
|
|
6411
|
-
params: req.params
|
|
6412
|
-
}));
|
|
6413
|
-
if (!res.headersSent) {
|
|
6414
|
-
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6415
|
-
res.status(status).json({
|
|
6416
|
-
error: error instanceof Error ? error.message : "Error processing route"
|
|
6417
|
-
});
|
|
6418
|
-
}
|
|
6413
|
+
if (route.handler) {
|
|
6414
|
+
route.handler(req, res, runtime);
|
|
6419
6415
|
handled = true;
|
|
6420
6416
|
}
|
|
6417
|
+
} catch (error) {
|
|
6418
|
+
logger26.error(`Error handling plugin route for agent ${agentIdFromQuery}: ${routePath}`, error instanceof Error ? error.message : String(error), {
|
|
6419
|
+
path: reqPath,
|
|
6420
|
+
agent: agentIdFromQuery,
|
|
6421
|
+
params: req.params
|
|
6422
|
+
});
|
|
6423
|
+
if (!res.headersSent) {
|
|
6424
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6425
|
+
res.status(status).json({
|
|
6426
|
+
error: error instanceof Error ? error.message : "Error processing route"
|
|
6427
|
+
});
|
|
6428
|
+
}
|
|
6429
|
+
handled = true;
|
|
6421
6430
|
}
|
|
6422
6431
|
}
|
|
6423
6432
|
}
|
|
6433
|
+
}
|
|
6434
|
+
return handled;
|
|
6435
|
+
}
|
|
6436
|
+
if (agentIdFromQuery && validateUuid22(agentIdFromQuery)) {
|
|
6437
|
+
const runtime = agents.get(agentIdFromQuery);
|
|
6438
|
+
if (runtime) {
|
|
6439
|
+
logger26.debug(`Agent-scoped request for Agent ID: ${agentIdFromQuery} from query. Path: ${reqPath}`);
|
|
6440
|
+
handled = findRouteInRuntime(runtime);
|
|
6424
6441
|
} else {
|
|
6425
6442
|
logger26.warn(`Agent ID ${agentIdFromQuery} provided in query, but agent runtime not found. Path: ${reqPath}.`);
|
|
6426
6443
|
if (reqPath.startsWith("/api/")) {
|
|
@@ -6455,57 +6472,7 @@ function createPluginRouteHandler(agents) {
|
|
|
6455
6472
|
for (const [_, runtime] of agents) {
|
|
6456
6473
|
if (handled)
|
|
6457
6474
|
break;
|
|
6458
|
-
|
|
6459
|
-
if (handled)
|
|
6460
|
-
break;
|
|
6461
|
-
const methodMatches = req.method.toLowerCase() === route.type.toLowerCase();
|
|
6462
|
-
if (!methodMatches)
|
|
6463
|
-
continue;
|
|
6464
|
-
const routePath = route.path.startsWith("/") ? route.path : `/${route.path}`;
|
|
6465
|
-
if (routePath.includes(":")) {
|
|
6466
|
-
continue;
|
|
6467
|
-
}
|
|
6468
|
-
if (routePath.endsWith("/*")) {
|
|
6469
|
-
const baseRoute = routePath.slice(0, -1);
|
|
6470
|
-
if (reqPath.startsWith(baseRoute)) {
|
|
6471
|
-
logger26.debug(`Global plugin wildcard route: [${route.type.toUpperCase()}] ${routePath} (Agent: ${runtime.agentId}) for request: ${reqPath}`);
|
|
6472
|
-
try {
|
|
6473
|
-
route?.handler?.(req, res, runtime);
|
|
6474
|
-
handled = true;
|
|
6475
|
-
} catch (error) {
|
|
6476
|
-
logger26.error(`Error handling global plugin wildcard route ${routePath} (Agent: ${runtime.agentId})`, JSON.stringify({
|
|
6477
|
-
error: error instanceof Error ? error.message : String(error),
|
|
6478
|
-
path: reqPath
|
|
6479
|
-
}));
|
|
6480
|
-
if (!res.headersSent) {
|
|
6481
|
-
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6482
|
-
res.status(status).json({
|
|
6483
|
-
error: error instanceof Error ? error.message : "Error processing wildcard route"
|
|
6484
|
-
});
|
|
6485
|
-
}
|
|
6486
|
-
handled = true;
|
|
6487
|
-
}
|
|
6488
|
-
}
|
|
6489
|
-
} else if (reqPath === routePath) {
|
|
6490
|
-
logger26.debug(`Global plugin route matched: [${route.type.toUpperCase()}] ${routePath} (Agent: ${runtime.agentId}) for request: ${reqPath}`);
|
|
6491
|
-
try {
|
|
6492
|
-
route?.handler?.(req, res, runtime);
|
|
6493
|
-
handled = true;
|
|
6494
|
-
} catch (error) {
|
|
6495
|
-
logger26.error(`Error handling global plugin route ${routePath} (Agent: ${runtime.agentId})`, JSON.stringify({
|
|
6496
|
-
error: error instanceof Error ? error.message : String(error),
|
|
6497
|
-
path: reqPath
|
|
6498
|
-
}));
|
|
6499
|
-
if (!res.headersSent) {
|
|
6500
|
-
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6501
|
-
res.status(status).json({
|
|
6502
|
-
error: error instanceof Error ? error.message : "Error processing route"
|
|
6503
|
-
});
|
|
6504
|
-
}
|
|
6505
|
-
handled = true;
|
|
6506
|
-
}
|
|
6507
|
-
}
|
|
6508
|
-
}
|
|
6475
|
+
handled = findRouteInRuntime(runtime);
|
|
6509
6476
|
}
|
|
6510
6477
|
}
|
|
6511
6478
|
if (handled) {
|
|
@@ -7608,7 +7575,7 @@ class AgentServer {
|
|
|
7608
7575
|
directives: {
|
|
7609
7576
|
defaultSrc: ["'self'"],
|
|
7610
7577
|
styleSrc: ["'self'", "'unsafe-inline'", "https:", "http:"],
|
|
7611
|
-
scriptSrc: ["
|
|
7578
|
+
scriptSrc: ["*", "'unsafe-inline'", "'unsafe-eval'"],
|
|
7612
7579
|
imgSrc: ["'self'", "data:", "blob:", "https:", "http:"],
|
|
7613
7580
|
fontSrc: ["'self'", "https:", "http:", "data:"],
|
|
7614
7581
|
connectSrc: ["'self'", "ws:", "wss:", "https:", "http:"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/server",
|
|
3
|
-
"version": "1.5.8-alpha.
|
|
3
|
+
"version": "1.5.8-alpha.21",
|
|
4
4
|
"description": "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"which": "^4.0.0",
|
|
52
52
|
"ws": "^8.18.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "5fa9cc42ef5c7e1e481c75b4e5c2f9726837dce4",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@elizaos/core": "1.5.8-alpha.
|
|
57
|
-
"@elizaos/plugin-sql": "1.5.8-alpha.
|
|
56
|
+
"@elizaos/core": "1.5.8-alpha.21",
|
|
57
|
+
"@elizaos/plugin-sql": "1.5.8-alpha.21",
|
|
58
58
|
"@types/express": "^5.0.2",
|
|
59
59
|
"@types/helmet": "^4.0.0",
|
|
60
60
|
"@types/multer": "^1.4.13",
|