@elizaos/server 1.5.8-alpha.11 → 1.5.8-alpha.13
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 +68 -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.13",
|
|
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", `path: ${req.path}, method: ${req.method}`, {
|
|
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,78 @@ 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}`, error instanceof Error ? error.message : String(error), {
|
|
6371
|
+
path: reqPath,
|
|
6372
|
+
agent: agentIdFromQuery
|
|
6373
|
+
});
|
|
6374
|
+
if (!res.headersSent) {
|
|
6375
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6376
|
+
res.status(status).json({
|
|
6377
|
+
error: error instanceof Error ? error.message : "Error processing wildcard route"
|
|
6378
|
+
});
|
|
6379
|
+
}
|
|
6380
|
+
handled = true;
|
|
6387
6381
|
}
|
|
6388
|
-
}
|
|
6389
|
-
|
|
6390
|
-
|
|
6382
|
+
}
|
|
6383
|
+
} else {
|
|
6384
|
+
logger26.debug(`Agent ${runtime.character.name} attempting plugin route match: [${route.type.toUpperCase()}] ${routePath} vs request path: ${baselessReqPath}`);
|
|
6385
|
+
let matcher;
|
|
6386
|
+
try {
|
|
6387
|
+
matcher = import_path_to_regexp.match(routePath, { decode: decodeURIComponent });
|
|
6388
|
+
} catch (err) {
|
|
6389
|
+
logger26.error(`Invalid plugin route path syntax for agent ${agentIdFromQuery}: "${routePath}"`, err instanceof Error ? err.message : String(err));
|
|
6390
|
+
continue;
|
|
6391
|
+
}
|
|
6392
|
+
const matched = matcher(baselessReqPath);
|
|
6393
|
+
if (matched) {
|
|
6394
|
+
logger26.debug(`Agent ${runtime.character.name} plugin route matched: [${route.type.toUpperCase()}] ${routePath} vs request path: ${reqPath}`);
|
|
6395
|
+
req.params = { ...matched.params || {} };
|
|
6391
6396
|
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
|
-
}
|
|
6397
|
+
if (route.handler) {
|
|
6398
|
+
route.handler(req, res, runtime);
|
|
6419
6399
|
handled = true;
|
|
6420
6400
|
}
|
|
6401
|
+
} catch (error) {
|
|
6402
|
+
logger26.error(`Error handling plugin route for agent ${agentIdFromQuery}: ${routePath}`, error instanceof Error ? error.message : String(error), {
|
|
6403
|
+
path: reqPath,
|
|
6404
|
+
agent: agentIdFromQuery,
|
|
6405
|
+
params: req.params
|
|
6406
|
+
});
|
|
6407
|
+
if (!res.headersSent) {
|
|
6408
|
+
const status = error instanceof Error && "code" in error && error.code === "ENOENT" || error instanceof Error && error.message?.includes("not found") ? 404 : 500;
|
|
6409
|
+
res.status(status).json({
|
|
6410
|
+
error: error instanceof Error ? error.message : "Error processing route"
|
|
6411
|
+
});
|
|
6412
|
+
}
|
|
6413
|
+
handled = true;
|
|
6421
6414
|
}
|
|
6422
6415
|
}
|
|
6423
6416
|
}
|
|
6417
|
+
}
|
|
6418
|
+
return handled;
|
|
6419
|
+
}
|
|
6420
|
+
if (agentIdFromQuery && validateUuid22(agentIdFromQuery)) {
|
|
6421
|
+
const runtime = agents.get(agentIdFromQuery);
|
|
6422
|
+
if (runtime) {
|
|
6423
|
+
logger26.debug(`Agent-scoped request for Agent ID: ${agentIdFromQuery} from query. Path: ${reqPath}`);
|
|
6424
|
+
handled = findRouteInRuntime(runtime);
|
|
6424
6425
|
} else {
|
|
6425
6426
|
logger26.warn(`Agent ID ${agentIdFromQuery} provided in query, but agent runtime not found. Path: ${reqPath}.`);
|
|
6426
6427
|
if (reqPath.startsWith("/api/")) {
|
|
@@ -6455,57 +6456,7 @@ function createPluginRouteHandler(agents) {
|
|
|
6455
6456
|
for (const [_, runtime] of agents) {
|
|
6456
6457
|
if (handled)
|
|
6457
6458
|
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
|
-
}
|
|
6459
|
+
handled = findRouteInRuntime(runtime);
|
|
6509
6460
|
}
|
|
6510
6461
|
}
|
|
6511
6462
|
if (handled) {
|
|
@@ -7608,7 +7559,7 @@ class AgentServer {
|
|
|
7608
7559
|
directives: {
|
|
7609
7560
|
defaultSrc: ["'self'"],
|
|
7610
7561
|
styleSrc: ["'self'", "'unsafe-inline'", "https:", "http:"],
|
|
7611
|
-
scriptSrc: ["
|
|
7562
|
+
scriptSrc: ["*", "'unsafe-inline'", "'unsafe-eval'"],
|
|
7612
7563
|
imgSrc: ["'self'", "data:", "blob:", "https:", "http:"],
|
|
7613
7564
|
fontSrc: ["'self'", "https:", "http:", "data:"],
|
|
7614
7565
|
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.13",
|
|
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": "af94cbb41adda91dde3d38002a79d3f608cf677b",
|
|
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.13",
|
|
57
|
+
"@elizaos/plugin-sql": "1.5.8-alpha.13",
|
|
58
58
|
"@types/express": "^5.0.2",
|
|
59
59
|
"@types/helmet": "^4.0.0",
|
|
60
60
|
"@types/multer": "^1.4.13",
|