@elizaos/server 1.5.8-alpha.10 → 1.5.8-alpha.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/api/index.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -117
- package/package.json +4 -4
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,aAA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E,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,sBAAsB,CAAC,EAAE,IAAI,CAAC;KAC/B,GACA,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;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
|
@@ -5826,7 +5826,7 @@ import express29 from "express";
|
|
|
5826
5826
|
// package.json
|
|
5827
5827
|
var package_default = {
|
|
5828
5828
|
name: "@elizaos/server",
|
|
5829
|
-
version: "1.5.8-alpha.
|
|
5829
|
+
version: "1.5.8-alpha.12",
|
|
5830
5830
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5831
5831
|
publishConfig: {
|
|
5832
5832
|
access: "public",
|
|
@@ -6321,11 +6321,11 @@ function setupLogStreaming(io, router) {
|
|
|
6321
6321
|
}
|
|
6322
6322
|
function createPluginRouteHandler(agents) {
|
|
6323
6323
|
return (req, res, next) => {
|
|
6324
|
-
logger26.debug("Handling plugin request in the plugin route handler",
|
|
6324
|
+
logger26.debug("Handling plugin request in the plugin route handler", {
|
|
6325
6325
|
path: req.path,
|
|
6326
6326
|
method: req.method,
|
|
6327
6327
|
query: req.query
|
|
6328
|
-
})
|
|
6328
|
+
});
|
|
6329
6329
|
const agentApiRoutePattern = /^\/agents\/[a-f0-9-]{36}\/(?!plugins\/)/i;
|
|
6330
6330
|
if (agentApiRoutePattern.test(req.path)) {
|
|
6331
6331
|
logger26.debug(`Skipping agent API route in plugin handler: ${req.path}`);
|
|
@@ -6350,77 +6350,80 @@ function createPluginRouteHandler(agents) {
|
|
|
6350
6350
|
let handled = false;
|
|
6351
6351
|
const agentIdFromQuery = req.query.agentId;
|
|
6352
6352
|
const reqPath = req.path;
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
logger26.debug(`Agent ${agentIdFromQuery} plugin wildcard route: [${route.type.toUpperCase()}] ${routePath} for request: ${reqPath}`);
|
|
6368
|
-
try {
|
|
6369
|
-
if (route.handler) {
|
|
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
|
-
}
|
|
6353
|
+
const baselessReqPath = reqPath.replace(/\/api\/agents\/[^\/]+\/plugins/, "");
|
|
6354
|
+
logger26.debug("Plugin Request Path", baselessReqPath);
|
|
6355
|
+
function findRouteInRuntime(runtime) {
|
|
6356
|
+
for (const route of runtime.routes) {
|
|
6357
|
+
if (handled)
|
|
6358
|
+
break;
|
|
6359
|
+
const routePath = route.path;
|
|
6360
|
+
if (routePath.endsWith("/*")) {
|
|
6361
|
+
const baseRoute = routePath.slice(0, -1);
|
|
6362
|
+
if (baselessReqPath.startsWith(baseRoute)) {
|
|
6363
|
+
logger26.debug(`Agent ${runtime.character.name} plugin wildcard route: [${route.type.toUpperCase()}] ${routePath} for request: ${reqPath}`);
|
|
6364
|
+
try {
|
|
6365
|
+
if (route.handler) {
|
|
6366
|
+
route.handler(req, res, runtime);
|
|
6385
6367
|
handled = true;
|
|
6386
6368
|
}
|
|
6369
|
+
} catch (error) {
|
|
6370
|
+
logger26.error(`Error handling plugin wildcard route for agent ${agentIdFromQuery}: ${routePath}`, {
|
|
6371
|
+
error,
|
|
6372
|
+
path: reqPath,
|
|
6373
|
+
agent: agentIdFromQuery
|
|
6374
|
+
});
|
|
6375
|
+
if (!res.headersSent) {
|
|
6376
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6377
|
+
res.status(status).json({
|
|
6378
|
+
error: error instanceof Error ? error.message : "Error processing wildcard route"
|
|
6379
|
+
});
|
|
6380
|
+
}
|
|
6381
|
+
handled = true;
|
|
6387
6382
|
}
|
|
6388
|
-
}
|
|
6389
|
-
|
|
6390
|
-
|
|
6383
|
+
}
|
|
6384
|
+
} else {
|
|
6385
|
+
logger26.debug(`Agent ${runtime.character.name} attempting plugin route match: [${route.type.toUpperCase()}] ${routePath} vs request path: ${baselessReqPath}`);
|
|
6386
|
+
let matcher;
|
|
6387
|
+
try {
|
|
6388
|
+
matcher = import_path_to_regexp.match(routePath, { decode: decodeURIComponent });
|
|
6389
|
+
} catch (err) {
|
|
6390
|
+
logger26.error(`Invalid plugin route path syntax for agent ${agentIdFromQuery}: "${routePath}"`, err);
|
|
6391
|
+
continue;
|
|
6392
|
+
}
|
|
6393
|
+
const matched = matcher(baselessReqPath);
|
|
6394
|
+
if (matched) {
|
|
6395
|
+
logger26.debug(`Agent ${runtime.character.name} plugin route matched: [${route.type.toUpperCase()}] ${routePath} vs request path: ${reqPath}`);
|
|
6396
|
+
req.params = { ...matched.params || {} };
|
|
6391
6397
|
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
|
-
}
|
|
6398
|
+
if (route.handler) {
|
|
6399
|
+
route.handler(req, res, runtime);
|
|
6419
6400
|
handled = true;
|
|
6420
6401
|
}
|
|
6402
|
+
} catch (error) {
|
|
6403
|
+
logger26.error(`Error handling plugin route for agent ${agentIdFromQuery}: ${routePath}`, {
|
|
6404
|
+
error,
|
|
6405
|
+
path: reqPath,
|
|
6406
|
+
agent: agentIdFromQuery,
|
|
6407
|
+
params: req.params
|
|
6408
|
+
});
|
|
6409
|
+
if (!res.headersSent) {
|
|
6410
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6411
|
+
res.status(status).json({
|
|
6412
|
+
error: error instanceof Error ? error.message : "Error processing route"
|
|
6413
|
+
});
|
|
6414
|
+
}
|
|
6415
|
+
handled = true;
|
|
6421
6416
|
}
|
|
6422
6417
|
}
|
|
6423
6418
|
}
|
|
6419
|
+
}
|
|
6420
|
+
return handled;
|
|
6421
|
+
}
|
|
6422
|
+
if (agentIdFromQuery && validateUuid22(agentIdFromQuery)) {
|
|
6423
|
+
const runtime = agents.get(agentIdFromQuery);
|
|
6424
|
+
if (runtime) {
|
|
6425
|
+
logger26.debug(`Agent-scoped request for Agent ID: ${agentIdFromQuery} from query. Path: ${reqPath}`);
|
|
6426
|
+
handled = findRouteInRuntime(runtime);
|
|
6424
6427
|
} else {
|
|
6425
6428
|
logger26.warn(`Agent ID ${agentIdFromQuery} provided in query, but agent runtime not found. Path: ${reqPath}.`);
|
|
6426
6429
|
if (reqPath.startsWith("/api/")) {
|
|
@@ -6455,57 +6458,7 @@ function createPluginRouteHandler(agents) {
|
|
|
6455
6458
|
for (const [_, runtime] of agents) {
|
|
6456
6459
|
if (handled)
|
|
6457
6460
|
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
|
-
}
|
|
6461
|
+
handled = findRouteInRuntime(runtime);
|
|
6509
6462
|
}
|
|
6510
6463
|
}
|
|
6511
6464
|
if (handled) {
|
|
@@ -7608,7 +7561,7 @@ class AgentServer {
|
|
|
7608
7561
|
directives: {
|
|
7609
7562
|
defaultSrc: ["'self'"],
|
|
7610
7563
|
styleSrc: ["'self'", "'unsafe-inline'", "https:", "http:"],
|
|
7611
|
-
scriptSrc: ["
|
|
7564
|
+
scriptSrc: ["*", "'unsafe-inline'", "'unsafe-eval'"],
|
|
7612
7565
|
imgSrc: ["'self'", "data:", "blob:", "https:", "http:"],
|
|
7613
7566
|
fontSrc: ["'self'", "https:", "http:", "data:"],
|
|
7614
7567
|
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.12",
|
|
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": "2d04ade03dae7a1a8548e395cc6043438f0f751d",
|
|
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.12",
|
|
57
|
+
"@elizaos/plugin-sql": "1.5.8-alpha.12",
|
|
58
58
|
"@types/express": "^5.0.2",
|
|
59
59
|
"@types/helmet": "^4.0.0",
|
|
60
60
|
"@types/multer": "^1.4.13",
|