@elizaos/server 1.5.9-alpha.1 → 1.5.9-alpha.10
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/crud.d.ts +0 -1
- package/dist/api/agents/index.d.ts +0 -1
- package/dist/api/agents/lifecycle.d.ts +0 -1
- package/dist/api/agents/logs.d.ts +0 -1
- package/dist/api/agents/panels.d.ts +0 -1
- package/dist/api/agents/runs.d.ts +0 -1
- package/dist/api/agents/worlds.d.ts +0 -1
- package/dist/api/audio/audioBuffer.d.ts +0 -1
- package/dist/api/audio/conversation.d.ts +0 -1
- package/dist/api/audio/index.d.ts +0 -1
- package/dist/api/audio/processing.d.ts +0 -1
- package/dist/api/audio/synthesis.d.ts +0 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/media/agents.d.ts +0 -1
- package/dist/api/media/channels.d.ts +0 -1
- package/dist/api/media/index.d.ts +0 -1
- package/dist/api/memory/agents.d.ts +0 -1
- package/dist/api/memory/groups.d.ts +0 -1
- package/dist/api/memory/index.d.ts +0 -1
- package/dist/api/memory/rooms.d.ts +0 -1
- package/dist/api/messaging/channels.d.ts +0 -1
- package/dist/api/messaging/core.d.ts +0 -1
- package/dist/api/messaging/errors/SessionErrors.d.ts +0 -1
- package/dist/api/messaging/index.d.ts +0 -1
- package/dist/api/messaging/servers.d.ts +0 -1
- package/dist/api/messaging/sessions.d.ts +0 -1
- package/dist/api/runtime/debug.d.ts +0 -1
- package/dist/api/runtime/health.d.ts +0 -1
- package/dist/api/runtime/index.d.ts +0 -1
- package/dist/api/runtime/logging.d.ts +0 -1
- package/dist/api/shared/constants.d.ts +0 -1
- package/dist/api/shared/file-utils.d.ts +0 -1
- package/dist/api/shared/index.d.ts +0 -1
- package/dist/api/shared/middleware.d.ts +0 -1
- package/dist/api/shared/response-utils.d.ts +0 -1
- package/dist/api/shared/uploads/index.d.ts +0 -1
- package/dist/api/shared/validation.d.ts +0 -1
- package/dist/api/system/environment.d.ts +0 -1
- package/dist/api/system/index.d.ts +0 -1
- package/dist/api/system/version.d.ts +0 -1
- package/dist/api/tee/index.d.ts +0 -1
- package/dist/api/tee/tee.d.ts +0 -1
- package/dist/authMiddleware.d.ts +0 -1
- package/dist/bus.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +430 -298
- package/dist/loader.d.ts +0 -1
- package/dist/scripts/copy-client-dist.d.ts +0 -1
- package/dist/services/message.d.ts +0 -1
- package/dist/socketio/index.d.ts +0 -1
- package/dist/types/sessions.d.ts +0 -1
- package/dist/types.d.ts +18 -1
- package/dist/upload.d.ts +0 -1
- package/dist/utils/media-transformer.d.ts +16 -0
- package/package.json +4 -4
- package/dist/api/agents/crud.d.ts.map +0 -1
- package/dist/api/agents/index.d.ts.map +0 -1
- package/dist/api/agents/lifecycle.d.ts.map +0 -1
- package/dist/api/agents/logs.d.ts.map +0 -1
- package/dist/api/agents/panels.d.ts.map +0 -1
- package/dist/api/agents/runs.d.ts.map +0 -1
- package/dist/api/agents/worlds.d.ts.map +0 -1
- package/dist/api/audio/audioBuffer.d.ts.map +0 -1
- package/dist/api/audio/conversation.d.ts.map +0 -1
- package/dist/api/audio/index.d.ts.map +0 -1
- package/dist/api/audio/processing.d.ts.map +0 -1
- package/dist/api/audio/synthesis.d.ts.map +0 -1
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/media/agents.d.ts.map +0 -1
- package/dist/api/media/channels.d.ts.map +0 -1
- package/dist/api/media/index.d.ts.map +0 -1
- package/dist/api/memory/agents.d.ts.map +0 -1
- package/dist/api/memory/groups.d.ts.map +0 -1
- package/dist/api/memory/index.d.ts.map +0 -1
- package/dist/api/memory/rooms.d.ts.map +0 -1
- package/dist/api/messaging/channels.d.ts.map +0 -1
- package/dist/api/messaging/core.d.ts.map +0 -1
- package/dist/api/messaging/errors/SessionErrors.d.ts.map +0 -1
- package/dist/api/messaging/index.d.ts.map +0 -1
- package/dist/api/messaging/servers.d.ts.map +0 -1
- package/dist/api/messaging/sessions.d.ts.map +0 -1
- package/dist/api/runtime/debug.d.ts.map +0 -1
- package/dist/api/runtime/health.d.ts.map +0 -1
- package/dist/api/runtime/index.d.ts.map +0 -1
- package/dist/api/runtime/logging.d.ts.map +0 -1
- package/dist/api/shared/constants.d.ts.map +0 -1
- package/dist/api/shared/file-utils.d.ts.map +0 -1
- package/dist/api/shared/index.d.ts.map +0 -1
- package/dist/api/shared/middleware.d.ts.map +0 -1
- package/dist/api/shared/response-utils.d.ts.map +0 -1
- package/dist/api/shared/uploads/index.d.ts.map +0 -1
- package/dist/api/shared/validation.d.ts.map +0 -1
- package/dist/api/system/environment.d.ts.map +0 -1
- package/dist/api/system/index.d.ts.map +0 -1
- package/dist/api/system/version.d.ts.map +0 -1
- package/dist/api/tee/index.d.ts.map +0 -1
- package/dist/api/tee/tee.d.ts.map +0 -1
- package/dist/authMiddleware.d.ts.map +0 -1
- package/dist/bus.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/loader.d.ts.map +0 -1
- package/dist/scripts/copy-client-dist.d.ts.map +0 -1
- package/dist/services/message.d.ts.map +0 -1
- package/dist/socketio/index.d.ts.map +0 -1
- package/dist/types/sessions.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/upload.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -439,7 +439,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
439
439
|
// ../../node_modules/dotenv/lib/main.js
|
|
440
440
|
var require_main = __commonJS((exports, module) => {
|
|
441
441
|
var fs4 = __require("fs");
|
|
442
|
-
var
|
|
442
|
+
var path5 = __require("path");
|
|
443
443
|
var os = __require("os");
|
|
444
444
|
var crypto = __require("crypto");
|
|
445
445
|
var packageJson = require_package();
|
|
@@ -557,7 +557,7 @@ var require_main = __commonJS((exports, module) => {
|
|
|
557
557
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
558
558
|
}
|
|
559
559
|
} else {
|
|
560
|
-
possibleVaultPath =
|
|
560
|
+
possibleVaultPath = path5.resolve(process.cwd(), ".env.vault");
|
|
561
561
|
}
|
|
562
562
|
if (fs4.existsSync(possibleVaultPath)) {
|
|
563
563
|
return possibleVaultPath;
|
|
@@ -565,7 +565,7 @@ var require_main = __commonJS((exports, module) => {
|
|
|
565
565
|
return null;
|
|
566
566
|
}
|
|
567
567
|
function _resolveHome(envPath) {
|
|
568
|
-
return envPath[0] === "~" ?
|
|
568
|
+
return envPath[0] === "~" ? path5.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
569
569
|
}
|
|
570
570
|
function _configVault(options) {
|
|
571
571
|
const debug = Boolean(options && options.debug);
|
|
@@ -582,7 +582,7 @@ var require_main = __commonJS((exports, module) => {
|
|
|
582
582
|
return { parsed };
|
|
583
583
|
}
|
|
584
584
|
function configDotenv(options) {
|
|
585
|
-
const dotenvPath =
|
|
585
|
+
const dotenvPath = path5.resolve(process.cwd(), ".env");
|
|
586
586
|
let encoding = "utf8";
|
|
587
587
|
const debug = Boolean(options && options.debug);
|
|
588
588
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -606,13 +606,13 @@ var require_main = __commonJS((exports, module) => {
|
|
|
606
606
|
}
|
|
607
607
|
let lastError;
|
|
608
608
|
const parsedAll = {};
|
|
609
|
-
for (const
|
|
609
|
+
for (const path6 of optionPaths) {
|
|
610
610
|
try {
|
|
611
|
-
const parsed = DotenvModule.parse(fs4.readFileSync(
|
|
611
|
+
const parsed = DotenvModule.parse(fs4.readFileSync(path6, { encoding }));
|
|
612
612
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
613
613
|
} catch (e) {
|
|
614
614
|
if (debug) {
|
|
615
|
-
_debug(`Failed to load ${
|
|
615
|
+
_debug(`Failed to load ${path6} ${e.message}`);
|
|
616
616
|
}
|
|
617
617
|
lastError = e;
|
|
618
618
|
}
|
|
@@ -627,7 +627,7 @@ var require_main = __commonJS((exports, module) => {
|
|
|
627
627
|
const shortPaths = [];
|
|
628
628
|
for (const filePath of optionPaths) {
|
|
629
629
|
try {
|
|
630
|
-
const relative =
|
|
630
|
+
const relative = path5.relative(process.cwd(), filePath);
|
|
631
631
|
shortPaths.push(relative);
|
|
632
632
|
} catch (e) {
|
|
633
633
|
if (debug) {
|
|
@@ -6587,19 +6587,19 @@ var require_module_details_from_path = __commonJS((exports, module) => {
|
|
|
6587
6587
|
basedir += segments[i] + sep;
|
|
6588
6588
|
}
|
|
6589
6589
|
}
|
|
6590
|
-
var
|
|
6590
|
+
var path7 = "";
|
|
6591
6591
|
var lastSegmentIndex = segments.length - 1;
|
|
6592
6592
|
for (var i2 = index + offset;i2 <= lastSegmentIndex; i2++) {
|
|
6593
6593
|
if (i2 === lastSegmentIndex) {
|
|
6594
|
-
|
|
6594
|
+
path7 += segments[i2];
|
|
6595
6595
|
} else {
|
|
6596
|
-
|
|
6596
|
+
path7 += segments[i2] + sep;
|
|
6597
6597
|
}
|
|
6598
6598
|
}
|
|
6599
6599
|
return {
|
|
6600
6600
|
name,
|
|
6601
6601
|
basedir,
|
|
6602
|
-
path:
|
|
6602
|
+
path: path7
|
|
6603
6603
|
};
|
|
6604
6604
|
};
|
|
6605
6605
|
});
|
|
@@ -6691,8 +6691,8 @@ var require_path_parse = __commonJS((exports, module) => {
|
|
|
6691
6691
|
|
|
6692
6692
|
// ../../node_modules/require-in-the-middle/node_modules/resolve/lib/node-modules-paths.js
|
|
6693
6693
|
var require_node_modules_paths = __commonJS((exports, module) => {
|
|
6694
|
-
var
|
|
6695
|
-
var parse =
|
|
6694
|
+
var path7 = __require("path");
|
|
6695
|
+
var parse = path7.parse || require_path_parse();
|
|
6696
6696
|
var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
|
|
6697
6697
|
var prefix = "/";
|
|
6698
6698
|
if (/^([A-Za-z]:)/.test(absoluteStart)) {
|
|
@@ -6708,7 +6708,7 @@ var require_node_modules_paths = __commonJS((exports, module) => {
|
|
|
6708
6708
|
}
|
|
6709
6709
|
return paths.reduce(function(dirs, aPath) {
|
|
6710
6710
|
return dirs.concat(modules.map(function(moduleDir) {
|
|
6711
|
-
return
|
|
6711
|
+
return path7.resolve(prefix, aPath, moduleDir);
|
|
6712
6712
|
}));
|
|
6713
6713
|
}, []);
|
|
6714
6714
|
};
|
|
@@ -7037,7 +7037,7 @@ var require_is_core_module = __commonJS((exports, module) => {
|
|
|
7037
7037
|
var require_async = __commonJS((exports, module) => {
|
|
7038
7038
|
var fs6 = __require("fs");
|
|
7039
7039
|
var getHomedir = require_homedir();
|
|
7040
|
-
var
|
|
7040
|
+
var path7 = __require("path");
|
|
7041
7041
|
var caller = require_caller();
|
|
7042
7042
|
var nodeModulesPaths = require_node_modules_paths();
|
|
7043
7043
|
var normalizeOptions = require_normalize_options();
|
|
@@ -7046,8 +7046,8 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7046
7046
|
var homedir = getHomedir();
|
|
7047
7047
|
var defaultPaths = function() {
|
|
7048
7048
|
return [
|
|
7049
|
-
|
|
7050
|
-
|
|
7049
|
+
path7.join(homedir, ".node_modules"),
|
|
7050
|
+
path7.join(homedir, ".node_libraries")
|
|
7051
7051
|
];
|
|
7052
7052
|
};
|
|
7053
7053
|
var defaultIsFile = function isFile(file, cb) {
|
|
@@ -7102,7 +7102,7 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7102
7102
|
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
|
|
7103
7103
|
var dirs = nodeModulesPaths(start, opts, x);
|
|
7104
7104
|
for (var i = 0;i < dirs.length; i++) {
|
|
7105
|
-
dirs[i] =
|
|
7105
|
+
dirs[i] = path7.join(dirs[i], x);
|
|
7106
7106
|
}
|
|
7107
7107
|
return dirs;
|
|
7108
7108
|
};
|
|
@@ -7134,10 +7134,10 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7134
7134
|
var packageIterator = opts.packageIterator;
|
|
7135
7135
|
var extensions = opts.extensions || [".js"];
|
|
7136
7136
|
var includeCoreModules = opts.includeCoreModules !== false;
|
|
7137
|
-
var basedir = opts.basedir ||
|
|
7137
|
+
var basedir = opts.basedir || path7.dirname(caller());
|
|
7138
7138
|
var parent = opts.filename || basedir;
|
|
7139
7139
|
opts.paths = opts.paths || defaultPaths();
|
|
7140
|
-
var absoluteStart =
|
|
7140
|
+
var absoluteStart = path7.resolve(basedir);
|
|
7141
7141
|
maybeRealpath(realpath, absoluteStart, opts, function(err2, realStart) {
|
|
7142
7142
|
if (err2)
|
|
7143
7143
|
cb(err2);
|
|
@@ -7147,7 +7147,7 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7147
7147
|
var res;
|
|
7148
7148
|
function init(basedir2) {
|
|
7149
7149
|
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
|
7150
|
-
res =
|
|
7150
|
+
res = path7.resolve(basedir2, x);
|
|
7151
7151
|
if (x === "." || x === ".." || x.slice(-1) === "/")
|
|
7152
7152
|
res += "/";
|
|
7153
7153
|
if (/\/$/.test(x) && res === basedir2) {
|
|
@@ -7216,17 +7216,17 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7216
7216
|
if (pkg)
|
|
7217
7217
|
onpkg(null, pkg);
|
|
7218
7218
|
else
|
|
7219
|
-
loadpkg(
|
|
7219
|
+
loadpkg(path7.dirname(file), onpkg);
|
|
7220
7220
|
function onpkg(err2, pkg_, dir) {
|
|
7221
7221
|
pkg = pkg_;
|
|
7222
7222
|
if (err2)
|
|
7223
7223
|
return cb2(err2);
|
|
7224
7224
|
if (dir && pkg && opts.pathFilter) {
|
|
7225
|
-
var rfile =
|
|
7225
|
+
var rfile = path7.relative(dir, file);
|
|
7226
7226
|
var rel = rfile.slice(0, rfile.length - exts2[0].length);
|
|
7227
7227
|
var r = opts.pathFilter(pkg, x3, rel);
|
|
7228
7228
|
if (r)
|
|
7229
|
-
return load([""].concat(extensions.slice()),
|
|
7229
|
+
return load([""].concat(extensions.slice()), path7.resolve(dir, r), pkg);
|
|
7230
7230
|
}
|
|
7231
7231
|
isFile(file, onex);
|
|
7232
7232
|
}
|
|
@@ -7249,11 +7249,11 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7249
7249
|
return cb2(null);
|
|
7250
7250
|
maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
|
|
7251
7251
|
if (unwrapErr)
|
|
7252
|
-
return loadpkg(
|
|
7253
|
-
var pkgfile =
|
|
7252
|
+
return loadpkg(path7.dirname(dir), cb2);
|
|
7253
|
+
var pkgfile = path7.join(pkgdir, "package.json");
|
|
7254
7254
|
isFile(pkgfile, function(err2, ex) {
|
|
7255
7255
|
if (!ex)
|
|
7256
|
-
return loadpkg(
|
|
7256
|
+
return loadpkg(path7.dirname(dir), cb2);
|
|
7257
7257
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
7258
7258
|
if (err3)
|
|
7259
7259
|
cb2(err3);
|
|
@@ -7276,12 +7276,12 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7276
7276
|
maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
|
|
7277
7277
|
if (unwrapErr)
|
|
7278
7278
|
return cb2(unwrapErr);
|
|
7279
|
-
var pkgfile =
|
|
7279
|
+
var pkgfile = path7.join(pkgdir, "package.json");
|
|
7280
7280
|
isFile(pkgfile, function(err2, ex) {
|
|
7281
7281
|
if (err2)
|
|
7282
7282
|
return cb2(err2);
|
|
7283
7283
|
if (!ex)
|
|
7284
|
-
return loadAsFile(
|
|
7284
|
+
return loadAsFile(path7.join(x2, "index"), fpkg, cb2);
|
|
7285
7285
|
readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
|
7286
7286
|
if (err3)
|
|
7287
7287
|
return cb2(err3);
|
|
@@ -7298,25 +7298,25 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7298
7298
|
if (pkg.main === "." || pkg.main === "./") {
|
|
7299
7299
|
pkg.main = "index";
|
|
7300
7300
|
}
|
|
7301
|
-
loadAsFile(
|
|
7301
|
+
loadAsFile(path7.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
|
|
7302
7302
|
if (err4)
|
|
7303
7303
|
return cb2(err4);
|
|
7304
7304
|
if (m)
|
|
7305
7305
|
return cb2(null, m, pkg2);
|
|
7306
7306
|
if (!pkg2)
|
|
7307
|
-
return loadAsFile(
|
|
7308
|
-
var dir =
|
|
7307
|
+
return loadAsFile(path7.join(x2, "index"), pkg2, cb2);
|
|
7308
|
+
var dir = path7.resolve(x2, pkg2.main);
|
|
7309
7309
|
loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
|
|
7310
7310
|
if (err5)
|
|
7311
7311
|
return cb2(err5);
|
|
7312
7312
|
if (n)
|
|
7313
7313
|
return cb2(null, n, pkg3);
|
|
7314
|
-
loadAsFile(
|
|
7314
|
+
loadAsFile(path7.join(x2, "index"), pkg3, cb2);
|
|
7315
7315
|
});
|
|
7316
7316
|
});
|
|
7317
7317
|
return;
|
|
7318
7318
|
}
|
|
7319
|
-
loadAsFile(
|
|
7319
|
+
loadAsFile(path7.join(x2, "/index"), pkg, cb2);
|
|
7320
7320
|
});
|
|
7321
7321
|
});
|
|
7322
7322
|
});
|
|
@@ -7325,7 +7325,7 @@ var require_async = __commonJS((exports, module) => {
|
|
|
7325
7325
|
if (dirs.length === 0)
|
|
7326
7326
|
return cb2(null, undefined);
|
|
7327
7327
|
var dir = dirs[0];
|
|
7328
|
-
isDirectory(
|
|
7328
|
+
isDirectory(path7.dirname(dir), isdir);
|
|
7329
7329
|
function isdir(err2, isdir2) {
|
|
7330
7330
|
if (err2)
|
|
7331
7331
|
return cb2(err2);
|
|
@@ -7549,7 +7549,7 @@ var require_is_core = __commonJS((exports, module) => {
|
|
|
7549
7549
|
var require_sync = __commonJS((exports, module) => {
|
|
7550
7550
|
var isCore = require_is_core_module();
|
|
7551
7551
|
var fs6 = __require("fs");
|
|
7552
|
-
var
|
|
7552
|
+
var path7 = __require("path");
|
|
7553
7553
|
var getHomedir = require_homedir();
|
|
7554
7554
|
var caller = require_caller();
|
|
7555
7555
|
var nodeModulesPaths = require_node_modules_paths();
|
|
@@ -7558,8 +7558,8 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7558
7558
|
var homedir = getHomedir();
|
|
7559
7559
|
var defaultPaths = function() {
|
|
7560
7560
|
return [
|
|
7561
|
-
|
|
7562
|
-
|
|
7561
|
+
path7.join(homedir, ".node_modules"),
|
|
7562
|
+
path7.join(homedir, ".node_libraries")
|
|
7563
7563
|
];
|
|
7564
7564
|
};
|
|
7565
7565
|
var defaultIsFile = function isFile(file) {
|
|
@@ -7608,7 +7608,7 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7608
7608
|
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
|
|
7609
7609
|
var dirs = nodeModulesPaths(start, opts, x);
|
|
7610
7610
|
for (var i = 0;i < dirs.length; i++) {
|
|
7611
|
-
dirs[i] =
|
|
7611
|
+
dirs[i] = path7.join(dirs[i], x);
|
|
7612
7612
|
}
|
|
7613
7613
|
return dirs;
|
|
7614
7614
|
};
|
|
@@ -7628,12 +7628,12 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7628
7628
|
var packageIterator = opts.packageIterator;
|
|
7629
7629
|
var extensions = opts.extensions || [".js"];
|
|
7630
7630
|
var includeCoreModules = opts.includeCoreModules !== false;
|
|
7631
|
-
var basedir = opts.basedir ||
|
|
7631
|
+
var basedir = opts.basedir || path7.dirname(caller());
|
|
7632
7632
|
var parent = opts.filename || basedir;
|
|
7633
7633
|
opts.paths = opts.paths || defaultPaths();
|
|
7634
|
-
var absoluteStart = maybeRealpathSync(realpathSync,
|
|
7634
|
+
var absoluteStart = maybeRealpathSync(realpathSync, path7.resolve(basedir), opts);
|
|
7635
7635
|
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
|
7636
|
-
var res =
|
|
7636
|
+
var res = path7.resolve(absoluteStart, x);
|
|
7637
7637
|
if (x === "." || x === ".." || x.slice(-1) === "/")
|
|
7638
7638
|
res += "/";
|
|
7639
7639
|
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
|
@@ -7650,12 +7650,12 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7650
7650
|
err.code = "MODULE_NOT_FOUND";
|
|
7651
7651
|
throw err;
|
|
7652
7652
|
function loadAsFileSync(x2) {
|
|
7653
|
-
var pkg = loadpkg(
|
|
7653
|
+
var pkg = loadpkg(path7.dirname(x2));
|
|
7654
7654
|
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
7655
|
-
var rfile =
|
|
7655
|
+
var rfile = path7.relative(pkg.dir, x2);
|
|
7656
7656
|
var r = opts.pathFilter(pkg.pkg, x2, rfile);
|
|
7657
7657
|
if (r) {
|
|
7658
|
-
x2 =
|
|
7658
|
+
x2 = path7.resolve(pkg.dir, r);
|
|
7659
7659
|
}
|
|
7660
7660
|
}
|
|
7661
7661
|
if (isFile(x2)) {
|
|
@@ -7676,9 +7676,9 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7676
7676
|
}
|
|
7677
7677
|
if (/[/\\]node_modules[/\\]*$/.test(dir))
|
|
7678
7678
|
return;
|
|
7679
|
-
var pkgfile =
|
|
7679
|
+
var pkgfile = path7.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
|
7680
7680
|
if (!isFile(pkgfile)) {
|
|
7681
|
-
return loadpkg(
|
|
7681
|
+
return loadpkg(path7.dirname(dir));
|
|
7682
7682
|
}
|
|
7683
7683
|
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
7684
7684
|
if (pkg && opts.packageFilter) {
|
|
@@ -7687,7 +7687,7 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7687
7687
|
return { pkg, dir };
|
|
7688
7688
|
}
|
|
7689
7689
|
function loadAsDirectorySync(x2) {
|
|
7690
|
-
var pkgfile =
|
|
7690
|
+
var pkgfile = path7.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
7691
7691
|
if (isFile(pkgfile)) {
|
|
7692
7692
|
try {
|
|
7693
7693
|
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
@@ -7705,16 +7705,16 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7705
7705
|
pkg.main = "index";
|
|
7706
7706
|
}
|
|
7707
7707
|
try {
|
|
7708
|
-
var m2 = loadAsFileSync(
|
|
7708
|
+
var m2 = loadAsFileSync(path7.resolve(x2, pkg.main));
|
|
7709
7709
|
if (m2)
|
|
7710
7710
|
return m2;
|
|
7711
|
-
var n2 = loadAsDirectorySync(
|
|
7711
|
+
var n2 = loadAsDirectorySync(path7.resolve(x2, pkg.main));
|
|
7712
7712
|
if (n2)
|
|
7713
7713
|
return n2;
|
|
7714
7714
|
} catch (e) {}
|
|
7715
7715
|
}
|
|
7716
7716
|
}
|
|
7717
|
-
return loadAsFileSync(
|
|
7717
|
+
return loadAsFileSync(path7.join(x2, "/index"));
|
|
7718
7718
|
}
|
|
7719
7719
|
function loadNodeModulesSync(x2, start) {
|
|
7720
7720
|
var thunk = function() {
|
|
@@ -7723,7 +7723,7 @@ var require_sync = __commonJS((exports, module) => {
|
|
|
7723
7723
|
var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
|
|
7724
7724
|
for (var i = 0;i < dirs.length; i++) {
|
|
7725
7725
|
var dir = dirs[i];
|
|
7726
|
-
if (isDirectory(
|
|
7726
|
+
if (isDirectory(path7.dirname(dir))) {
|
|
7727
7727
|
var m2 = loadAsFileSync(dir);
|
|
7728
7728
|
if (m2)
|
|
7729
7729
|
return m2;
|
|
@@ -7809,7 +7809,7 @@ var require_package2 = __commonJS((exports, module) => {
|
|
|
7809
7809
|
|
|
7810
7810
|
// ../../node_modules/require-in-the-middle/index.js
|
|
7811
7811
|
var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
7812
|
-
var
|
|
7812
|
+
var path7 = __require("path");
|
|
7813
7813
|
var Module = __require("module");
|
|
7814
7814
|
var debug = require_src5()("require-in-the-middle");
|
|
7815
7815
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
@@ -7985,7 +7985,7 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
7985
7985
|
}
|
|
7986
7986
|
moduleName = filename;
|
|
7987
7987
|
} else if (hasWhitelist === true && modules.includes(filename)) {
|
|
7988
|
-
const parsedPath =
|
|
7988
|
+
const parsedPath = path7.parse(filename);
|
|
7989
7989
|
moduleName = parsedPath.name;
|
|
7990
7990
|
basedir = parsedPath.dir;
|
|
7991
7991
|
} else {
|
|
@@ -8023,7 +8023,7 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
8023
8023
|
}
|
|
8024
8024
|
if (res !== filename) {
|
|
8025
8025
|
if (internals === true) {
|
|
8026
|
-
moduleName = moduleName +
|
|
8026
|
+
moduleName = moduleName + path7.sep + path7.relative(basedir, filename);
|
|
8027
8027
|
debug("preparing to process require of internal file: %s", moduleName);
|
|
8028
8028
|
} else {
|
|
8029
8029
|
debug("ignoring require of non-main module file: %s", res);
|
|
@@ -8059,8 +8059,8 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
8059
8059
|
}
|
|
8060
8060
|
};
|
|
8061
8061
|
function resolveModuleName(stat) {
|
|
8062
|
-
const normalizedPath =
|
|
8063
|
-
return
|
|
8062
|
+
const normalizedPath = path7.sep !== "/" ? stat.path.split(path7.sep).join("/") : stat.path;
|
|
8063
|
+
return path7.posix.join(stat.name, normalizedPath).replace(normalize, "");
|
|
8064
8064
|
}
|
|
8065
8065
|
});
|
|
8066
8066
|
|
|
@@ -8128,7 +8128,7 @@ var require_RequireInTheMiddleSingleton = __commonJS((exports) => {
|
|
|
8128
8128
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8129
8129
|
exports.RequireInTheMiddleSingleton = undefined;
|
|
8130
8130
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
8131
|
-
var
|
|
8131
|
+
var path7 = __require("path");
|
|
8132
8132
|
var ModuleNameTrie_1 = require_ModuleNameTrie();
|
|
8133
8133
|
var isMocha = [
|
|
8134
8134
|
"afterEach",
|
|
@@ -8173,7 +8173,7 @@ var require_RequireInTheMiddleSingleton = __commonJS((exports) => {
|
|
|
8173
8173
|
}
|
|
8174
8174
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
8175
8175
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
8176
|
-
return
|
|
8176
|
+
return path7.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path7.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
8177
8177
|
}
|
|
8178
8178
|
});
|
|
8179
8179
|
|
|
@@ -8229,7 +8229,7 @@ var require_register = __commonJS((exports) => {
|
|
|
8229
8229
|
|
|
8230
8230
|
// ../../node_modules/import-in-the-middle/index.js
|
|
8231
8231
|
var require_import_in_the_middle = __commonJS((exports, module) => {
|
|
8232
|
-
var
|
|
8232
|
+
var path7 = __require("path");
|
|
8233
8233
|
var parse = require_module_details_from_path();
|
|
8234
8234
|
var { fileURLToPath: fileURLToPath2 } = __require("url");
|
|
8235
8235
|
var { MessageChannel } = __require("worker_threads");
|
|
@@ -8324,7 +8324,7 @@ var require_import_in_the_middle = __commonJS((exports, module) => {
|
|
|
8324
8324
|
if (moduleName === name) {
|
|
8325
8325
|
if (baseDir) {
|
|
8326
8326
|
if (internals) {
|
|
8327
|
-
name = name +
|
|
8327
|
+
name = name + path7.sep + path7.relative(baseDir, fileURLToPath2(filename));
|
|
8328
8328
|
} else {
|
|
8329
8329
|
if (!getExperimentalPatchInternals() && !baseDir.endsWith(specifiers.get(filename)))
|
|
8330
8330
|
continue;
|
|
@@ -8395,7 +8395,7 @@ var require_utils5 = __commonJS((exports) => {
|
|
|
8395
8395
|
var require_instrumentation2 = __commonJS((exports) => {
|
|
8396
8396
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8397
8397
|
exports.InstrumentationBase = undefined;
|
|
8398
|
-
var
|
|
8398
|
+
var path7 = __require("path");
|
|
8399
8399
|
var util_1 = __require("util");
|
|
8400
8400
|
var semver_1 = require_semver2();
|
|
8401
8401
|
var shimmer_1 = require_shimmer();
|
|
@@ -8493,7 +8493,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
8493
8493
|
}
|
|
8494
8494
|
_extractPackageVersion(baseDir) {
|
|
8495
8495
|
try {
|
|
8496
|
-
const json = (0, fs_1.readFileSync)(
|
|
8496
|
+
const json = (0, fs_1.readFileSync)(path7.join(baseDir, "package.json"), {
|
|
8497
8497
|
encoding: "utf8"
|
|
8498
8498
|
});
|
|
8499
8499
|
const version = JSON.parse(json).version;
|
|
@@ -8535,7 +8535,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
8535
8535
|
return exports2;
|
|
8536
8536
|
}
|
|
8537
8537
|
const files = module2.files ?? [];
|
|
8538
|
-
const normalizedName =
|
|
8538
|
+
const normalizedName = path7.normalize(name);
|
|
8539
8539
|
const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName).filter((f) => isSupported(f.supportedVersions, version, module2.includePrerelease));
|
|
8540
8540
|
return supportedFileInstrumentations.reduce((patchedExports, file) => {
|
|
8541
8541
|
file.moduleExports = patchedExports;
|
|
@@ -8581,8 +8581,8 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
8581
8581
|
this._warnOnPreloadedModules();
|
|
8582
8582
|
for (const module2 of this._modules) {
|
|
8583
8583
|
const hookFn = (exports2, name, baseDir) => {
|
|
8584
|
-
if (!baseDir &&
|
|
8585
|
-
const parsedPath =
|
|
8584
|
+
if (!baseDir && path7.isAbsolute(name)) {
|
|
8585
|
+
const parsedPath = path7.parse(name);
|
|
8586
8586
|
name = parsedPath.name;
|
|
8587
8587
|
baseDir = parsedPath.dir;
|
|
8588
8588
|
}
|
|
@@ -8591,7 +8591,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
8591
8591
|
const onRequire = (exports2, name, baseDir) => {
|
|
8592
8592
|
return this._onRequire(module2, exports2, name, baseDir);
|
|
8593
8593
|
};
|
|
8594
|
-
const hook =
|
|
8594
|
+
const hook = path7.isAbsolute(module2.name) ? new require_in_the_middle_1.Hook([module2.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module2.name, onRequire);
|
|
8595
8595
|
this._hooks.push(hook);
|
|
8596
8596
|
const esmHook = new import_in_the_middle_1.Hook([module2.name], { internals: false }, hookFn);
|
|
8597
8597
|
this._hooks.push(esmHook);
|
|
@@ -8999,12 +8999,12 @@ var require_utils6 = __commonJS((exports) => {
|
|
|
8999
8999
|
const reqUrlObject = requestUrl || {};
|
|
9000
9000
|
const protocol = reqUrlObject.protocol || fallbackProtocol;
|
|
9001
9001
|
const port = (reqUrlObject.port || "").toString();
|
|
9002
|
-
const
|
|
9002
|
+
const path7 = reqUrlObject.path || "/";
|
|
9003
9003
|
let host = reqUrlObject.host || reqUrlObject.hostname || headers.host || "localhost";
|
|
9004
9004
|
if (host.indexOf(":") === -1 && port && port !== "80" && port !== "443") {
|
|
9005
9005
|
host += `:${port}`;
|
|
9006
9006
|
}
|
|
9007
|
-
return `${protocol}//${host}${
|
|
9007
|
+
return `${protocol}//${host}${path7}`;
|
|
9008
9008
|
};
|
|
9009
9009
|
exports.getAbsoluteUrl = getAbsoluteUrl;
|
|
9010
9010
|
var parseResponseStatus = (kind, statusCode) => {
|
|
@@ -11766,9 +11766,9 @@ var require_getMachineId_linux = __commonJS((exports) => {
|
|
|
11766
11766
|
var api_1 = require_src();
|
|
11767
11767
|
async function getMachineId() {
|
|
11768
11768
|
const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
|
|
11769
|
-
for (const
|
|
11769
|
+
for (const path7 of paths) {
|
|
11770
11770
|
try {
|
|
11771
|
-
const result = await fs_1.promises.readFile(
|
|
11771
|
+
const result = await fs_1.promises.readFile(path7, { encoding: "utf8" });
|
|
11772
11772
|
return result.trim();
|
|
11773
11773
|
} catch (e) {
|
|
11774
11774
|
api_1.diag.debug(`error reading machine id: ${e}`);
|
|
@@ -13967,15 +13967,15 @@ var require_utils10 = __commonJS((exports) => {
|
|
|
13967
13967
|
return { isLayerPathStored: true };
|
|
13968
13968
|
};
|
|
13969
13969
|
exports.storeLayerPath = storeLayerPath;
|
|
13970
|
-
var getRouterPath = (
|
|
13970
|
+
var getRouterPath = (path7, layer) => {
|
|
13971
13971
|
const stackLayer = layer.handle?.stack?.[0];
|
|
13972
13972
|
if (stackLayer?.route?.path) {
|
|
13973
|
-
return `${
|
|
13973
|
+
return `${path7}${stackLayer.route.path}`;
|
|
13974
13974
|
}
|
|
13975
13975
|
if (stackLayer?.handle?.stack) {
|
|
13976
|
-
return (0, exports.getRouterPath)(
|
|
13976
|
+
return (0, exports.getRouterPath)(path7, stackLayer);
|
|
13977
13977
|
}
|
|
13978
|
-
return
|
|
13978
|
+
return path7;
|
|
13979
13979
|
};
|
|
13980
13980
|
exports.getRouterPath = getRouterPath;
|
|
13981
13981
|
var getLayerMetadata = (route, layer, layerPath) => {
|
|
@@ -14056,7 +14056,7 @@ var require_utils10 = __commonJS((exports) => {
|
|
|
14056
14056
|
};
|
|
14057
14057
|
function getConstructedRoute(req) {
|
|
14058
14058
|
const layersStore = Array.isArray(req[internal_types_1._LAYERS_STORE_PROPERTY]) ? req[internal_types_1._LAYERS_STORE_PROPERTY] : [];
|
|
14059
|
-
const meaningfulPaths = layersStore.filter((
|
|
14059
|
+
const meaningfulPaths = layersStore.filter((path7) => path7 !== "/" && path7 !== "/*");
|
|
14060
14060
|
if (meaningfulPaths.length === 1 && meaningfulPaths[0] === "*") {
|
|
14061
14061
|
return "*";
|
|
14062
14062
|
}
|
|
@@ -14068,7 +14068,7 @@ var require_utils10 = __commonJS((exports) => {
|
|
|
14068
14068
|
if (layersStore.length === 0) {
|
|
14069
14069
|
return;
|
|
14070
14070
|
}
|
|
14071
|
-
if (layersStore.every((
|
|
14071
|
+
if (layersStore.every((path7) => path7 === "/")) {
|
|
14072
14072
|
return req.originalUrl === "/" ? "/" : undefined;
|
|
14073
14073
|
}
|
|
14074
14074
|
const constructedRoute = getConstructedRoute(req);
|
|
@@ -14657,25 +14657,25 @@ var require_utils11 = __commonJS((exports) => {
|
|
|
14657
14657
|
span.setAttribute(AttributeNames_1.AttributeNames.SOURCE, source);
|
|
14658
14658
|
}
|
|
14659
14659
|
exports.addSpanSource = addSpanSource;
|
|
14660
|
-
function createFieldIfNotExists(tracer, getConfig, contextValue, info,
|
|
14661
|
-
let field = getField(contextValue,
|
|
14660
|
+
function createFieldIfNotExists(tracer, getConfig, contextValue, info, path8) {
|
|
14661
|
+
let field = getField(contextValue, path8);
|
|
14662
14662
|
let spanAdded = false;
|
|
14663
14663
|
if (!field) {
|
|
14664
14664
|
spanAdded = true;
|
|
14665
|
-
const parent = getParentField(contextValue,
|
|
14665
|
+
const parent = getParentField(contextValue, path8);
|
|
14666
14666
|
field = {
|
|
14667
14667
|
parent,
|
|
14668
|
-
span: createResolverSpan(tracer, getConfig, contextValue, info,
|
|
14668
|
+
span: createResolverSpan(tracer, getConfig, contextValue, info, path8, parent.span),
|
|
14669
14669
|
error: null
|
|
14670
14670
|
};
|
|
14671
|
-
addField(contextValue,
|
|
14671
|
+
addField(contextValue, path8, field);
|
|
14672
14672
|
}
|
|
14673
14673
|
return { spanAdded, field };
|
|
14674
14674
|
}
|
|
14675
|
-
function createResolverSpan(tracer, getConfig, contextValue, info,
|
|
14675
|
+
function createResolverSpan(tracer, getConfig, contextValue, info, path8, parentSpan) {
|
|
14676
14676
|
const attributes = {
|
|
14677
14677
|
[AttributeNames_1.AttributeNames.FIELD_NAME]: info.fieldName,
|
|
14678
|
-
[AttributeNames_1.AttributeNames.FIELD_PATH]:
|
|
14678
|
+
[AttributeNames_1.AttributeNames.FIELD_PATH]: path8.join("."),
|
|
14679
14679
|
[AttributeNames_1.AttributeNames.FIELD_TYPE]: info.returnType.toString()
|
|
14680
14680
|
};
|
|
14681
14681
|
const span = tracer.startSpan(`${enum_1.SpanNames.RESOLVE} ${attributes[AttributeNames_1.AttributeNames.FIELD_PATH]}`, {
|
|
@@ -14706,15 +14706,15 @@ var require_utils11 = __commonJS((exports) => {
|
|
|
14706
14706
|
}
|
|
14707
14707
|
}
|
|
14708
14708
|
exports.getOperation = getOperation;
|
|
14709
|
-
function addField(contextValue,
|
|
14710
|
-
return contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
14709
|
+
function addField(contextValue, path8, field) {
|
|
14710
|
+
return contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL].fields[path8.join(".")] = field;
|
|
14711
14711
|
}
|
|
14712
|
-
function getField(contextValue,
|
|
14713
|
-
return contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
14712
|
+
function getField(contextValue, path8) {
|
|
14713
|
+
return contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL].fields[path8.join(".")];
|
|
14714
14714
|
}
|
|
14715
|
-
function getParentField(contextValue,
|
|
14716
|
-
for (let i =
|
|
14717
|
-
const field = getField(contextValue,
|
|
14715
|
+
function getParentField(contextValue, path8) {
|
|
14716
|
+
for (let i = path8.length - 1;i > 0; i--) {
|
|
14717
|
+
const field = getField(contextValue, path8.slice(0, i));
|
|
14718
14718
|
if (field) {
|
|
14719
14719
|
return field;
|
|
14720
14720
|
}
|
|
@@ -14723,9 +14723,9 @@ var require_utils11 = __commonJS((exports) => {
|
|
|
14723
14723
|
span: contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL].span
|
|
14724
14724
|
};
|
|
14725
14725
|
}
|
|
14726
|
-
function pathToArray(mergeItems,
|
|
14726
|
+
function pathToArray(mergeItems, path8) {
|
|
14727
14727
|
const flattened = [];
|
|
14728
|
-
let curr =
|
|
14728
|
+
let curr = path8;
|
|
14729
14729
|
while (curr) {
|
|
14730
14730
|
let key = curr.key;
|
|
14731
14731
|
if (mergeItems && typeof key === "number") {
|
|
@@ -14862,14 +14862,14 @@ var require_utils11 = __commonJS((exports) => {
|
|
|
14862
14862
|
if (!contextValue[symbols_1.OTEL_GRAPHQL_DATA_SYMBOL]) {
|
|
14863
14863
|
return fieldResolver.call(this, source, args, contextValue, info);
|
|
14864
14864
|
}
|
|
14865
|
-
const
|
|
14866
|
-
const depth =
|
|
14865
|
+
const path8 = pathToArray(config.mergeItems, info && info.path);
|
|
14866
|
+
const depth = path8.filter((item) => typeof item === "string").length;
|
|
14867
14867
|
let field;
|
|
14868
14868
|
let shouldEndSpan = false;
|
|
14869
14869
|
if (config.depth >= 0 && config.depth < depth) {
|
|
14870
|
-
field = getParentField(contextValue,
|
|
14870
|
+
field = getParentField(contextValue, path8);
|
|
14871
14871
|
} else {
|
|
14872
|
-
const newField = createFieldIfNotExists(tracer, getConfig, contextValue, info,
|
|
14872
|
+
const newField = createFieldIfNotExists(tracer, getConfig, contextValue, info, path8);
|
|
14873
14873
|
field = newField.field;
|
|
14874
14874
|
shouldEndSpan = newField.spanAdded;
|
|
14875
14875
|
}
|
|
@@ -18245,7 +18245,7 @@ var require_RequireInTheMiddleSingleton2 = __commonJS((exports) => {
|
|
|
18245
18245
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18246
18246
|
exports.RequireInTheMiddleSingleton = undefined;
|
|
18247
18247
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
18248
|
-
var
|
|
18248
|
+
var path8 = __require("path");
|
|
18249
18249
|
var ModuleNameTrie_1 = require_ModuleNameTrie2();
|
|
18250
18250
|
var isMocha = [
|
|
18251
18251
|
"afterEach",
|
|
@@ -18290,7 +18290,7 @@ var require_RequireInTheMiddleSingleton2 = __commonJS((exports) => {
|
|
|
18290
18290
|
}
|
|
18291
18291
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
18292
18292
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
18293
|
-
return
|
|
18293
|
+
return path8.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path8.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
18294
18294
|
}
|
|
18295
18295
|
});
|
|
18296
18296
|
|
|
@@ -18340,7 +18340,7 @@ var require_utils15 = __commonJS((exports) => {
|
|
|
18340
18340
|
var require_instrumentation11 = __commonJS((exports) => {
|
|
18341
18341
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18342
18342
|
exports.InstrumentationBase = undefined;
|
|
18343
|
-
var
|
|
18343
|
+
var path8 = __require("path");
|
|
18344
18344
|
var util_1 = __require("util");
|
|
18345
18345
|
var semver_1 = require_semver3();
|
|
18346
18346
|
var shimmer_1 = require_shimmer2();
|
|
@@ -18438,7 +18438,7 @@ var require_instrumentation11 = __commonJS((exports) => {
|
|
|
18438
18438
|
}
|
|
18439
18439
|
_extractPackageVersion(baseDir) {
|
|
18440
18440
|
try {
|
|
18441
|
-
const json = (0, fs_1.readFileSync)(
|
|
18441
|
+
const json = (0, fs_1.readFileSync)(path8.join(baseDir, "package.json"), {
|
|
18442
18442
|
encoding: "utf8"
|
|
18443
18443
|
});
|
|
18444
18444
|
const version = JSON.parse(json).version;
|
|
@@ -18480,7 +18480,7 @@ var require_instrumentation11 = __commonJS((exports) => {
|
|
|
18480
18480
|
return exports2;
|
|
18481
18481
|
}
|
|
18482
18482
|
const files = module2.files ?? [];
|
|
18483
|
-
const normalizedName =
|
|
18483
|
+
const normalizedName = path8.normalize(name);
|
|
18484
18484
|
const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName).filter((f) => isSupported(f.supportedVersions, version, module2.includePrerelease));
|
|
18485
18485
|
return supportedFileInstrumentations.reduce((patchedExports, file) => {
|
|
18486
18486
|
file.moduleExports = patchedExports;
|
|
@@ -18526,8 +18526,8 @@ var require_instrumentation11 = __commonJS((exports) => {
|
|
|
18526
18526
|
this._warnOnPreloadedModules();
|
|
18527
18527
|
for (const module2 of this._modules) {
|
|
18528
18528
|
const hookFn = (exports2, name, baseDir) => {
|
|
18529
|
-
if (!baseDir &&
|
|
18530
|
-
const parsedPath =
|
|
18529
|
+
if (!baseDir && path8.isAbsolute(name)) {
|
|
18530
|
+
const parsedPath = path8.parse(name);
|
|
18531
18531
|
name = parsedPath.name;
|
|
18532
18532
|
baseDir = parsedPath.dir;
|
|
18533
18533
|
}
|
|
@@ -18536,7 +18536,7 @@ var require_instrumentation11 = __commonJS((exports) => {
|
|
|
18536
18536
|
const onRequire = (exports2, name, baseDir) => {
|
|
18537
18537
|
return this._onRequire(module2, exports2, name, baseDir);
|
|
18538
18538
|
};
|
|
18539
|
-
const hook =
|
|
18539
|
+
const hook = path8.isAbsolute(module2.name) ? new require_in_the_middle_1.Hook([module2.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module2.name, onRequire);
|
|
18540
18540
|
this._hooks.push(hook);
|
|
18541
18541
|
const esmHook = new import_in_the_middle_1.Hook([module2.name], { internals: false }, hookFn);
|
|
18542
18542
|
this._hooks.push(esmHook);
|
|
@@ -22399,7 +22399,7 @@ var require_RequireInTheMiddleSingleton3 = __commonJS((exports) => {
|
|
|
22399
22399
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22400
22400
|
exports.RequireInTheMiddleSingleton = undefined;
|
|
22401
22401
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
22402
|
-
var
|
|
22402
|
+
var path8 = __require("path");
|
|
22403
22403
|
var ModuleNameTrie_1 = require_ModuleNameTrie3();
|
|
22404
22404
|
var isMocha = [
|
|
22405
22405
|
"afterEach",
|
|
@@ -22444,7 +22444,7 @@ var require_RequireInTheMiddleSingleton3 = __commonJS((exports) => {
|
|
|
22444
22444
|
}
|
|
22445
22445
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
22446
22446
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
22447
|
-
return
|
|
22447
|
+
return path8.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path8.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
22448
22448
|
}
|
|
22449
22449
|
});
|
|
22450
22450
|
|
|
@@ -22494,7 +22494,7 @@ var require_utils20 = __commonJS((exports) => {
|
|
|
22494
22494
|
var require_instrumentation17 = __commonJS((exports) => {
|
|
22495
22495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22496
22496
|
exports.InstrumentationBase = undefined;
|
|
22497
|
-
var
|
|
22497
|
+
var path8 = __require("path");
|
|
22498
22498
|
var util_1 = __require("util");
|
|
22499
22499
|
var semver_1 = require_semver5();
|
|
22500
22500
|
var shimmer_1 = require_shimmer3();
|
|
@@ -22591,7 +22591,7 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
22591
22591
|
}
|
|
22592
22592
|
_extractPackageVersion(baseDir) {
|
|
22593
22593
|
try {
|
|
22594
|
-
const json = (0, fs_1.readFileSync)(
|
|
22594
|
+
const json = (0, fs_1.readFileSync)(path8.join(baseDir, "package.json"), {
|
|
22595
22595
|
encoding: "utf8"
|
|
22596
22596
|
});
|
|
22597
22597
|
const version = JSON.parse(json).version;
|
|
@@ -22634,7 +22634,7 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
22634
22634
|
return exports2;
|
|
22635
22635
|
}
|
|
22636
22636
|
const files = (_a = module2.files) !== null && _a !== undefined ? _a : [];
|
|
22637
|
-
const normalizedName =
|
|
22637
|
+
const normalizedName = path8.normalize(name);
|
|
22638
22638
|
const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName).filter((f) => isSupported(f.supportedVersions, version, module2.includePrerelease));
|
|
22639
22639
|
return supportedFileInstrumentations.reduce((patchedExports, file) => {
|
|
22640
22640
|
file.moduleExports = patchedExports;
|
|
@@ -22680,8 +22680,8 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
22680
22680
|
this._warnOnPreloadedModules();
|
|
22681
22681
|
for (const module2 of this._modules) {
|
|
22682
22682
|
const hookFn = (exports2, name, baseDir) => {
|
|
22683
|
-
if (!baseDir &&
|
|
22684
|
-
const parsedPath =
|
|
22683
|
+
if (!baseDir && path8.isAbsolute(name)) {
|
|
22684
|
+
const parsedPath = path8.parse(name);
|
|
22685
22685
|
name = parsedPath.name;
|
|
22686
22686
|
baseDir = parsedPath.dir;
|
|
22687
22687
|
}
|
|
@@ -22690,7 +22690,7 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
22690
22690
|
const onRequire = (exports2, name, baseDir) => {
|
|
22691
22691
|
return this._onRequire(module2, exports2, name, baseDir);
|
|
22692
22692
|
};
|
|
22693
|
-
const hook =
|
|
22693
|
+
const hook = path8.isAbsolute(module2.name) ? new require_in_the_middle_1.Hook([module2.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module2.name, onRequire);
|
|
22694
22694
|
this._hooks.push(hook);
|
|
22695
22695
|
const esmHook = new import_in_the_middle_1.Hook([module2.name], { internals: false }, hookFn);
|
|
22696
22696
|
this._hooks.push(esmHook);
|
|
@@ -23321,11 +23321,11 @@ var require_instrumentation19 = __commonJS((exports) => {
|
|
|
23321
23321
|
const router = dispatchLayer.router;
|
|
23322
23322
|
const routesStack = router?.stack ?? [];
|
|
23323
23323
|
for (const pathLayer of routesStack) {
|
|
23324
|
-
const
|
|
23324
|
+
const path8 = pathLayer.path;
|
|
23325
23325
|
const pathStack = pathLayer.stack;
|
|
23326
23326
|
for (let j = 0;j < pathStack.length; j++) {
|
|
23327
23327
|
const routedMiddleware = pathStack[j];
|
|
23328
|
-
pathStack[j] = this._patchLayer(routedMiddleware, true,
|
|
23328
|
+
pathStack[j] = this._patchLayer(routedMiddleware, true, path8);
|
|
23329
23329
|
}
|
|
23330
23330
|
}
|
|
23331
23331
|
return dispatchLayer;
|
|
@@ -24504,7 +24504,10 @@ var require_src35 = __commonJS((exports) => {
|
|
|
24504
24504
|
// src/index.ts
|
|
24505
24505
|
import {
|
|
24506
24506
|
logger as logger30,
|
|
24507
|
-
parseBooleanFromText
|
|
24507
|
+
parseBooleanFromText,
|
|
24508
|
+
getDatabaseDir,
|
|
24509
|
+
getGeneratedDir as getGeneratedDir2,
|
|
24510
|
+
getUploadsAgentsDir as getUploadsAgentsDir4
|
|
24508
24511
|
} from "@elizaos/core";
|
|
24509
24512
|
import cors2 from "cors";
|
|
24510
24513
|
import express33 from "express";
|
|
@@ -25052,7 +25055,7 @@ var helmet = Object.assign(function helmet2(options = {}) {
|
|
|
25052
25055
|
import * as fs6 from "node:fs";
|
|
25053
25056
|
import http4 from "node:http";
|
|
25054
25057
|
import os3 from "node:os";
|
|
25055
|
-
import
|
|
25058
|
+
import path8, { basename as basename2, dirname as dirname3, extname, join as join4 } from "node:path";
|
|
25056
25059
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
25057
25060
|
|
|
25058
25061
|
// src/api/index.ts
|
|
@@ -26253,6 +26256,87 @@ var internalMessageBus = new InternalMessageBus;
|
|
|
26253
26256
|
internalMessageBus.setMaxListeners(50);
|
|
26254
26257
|
var bus_default = internalMessageBus;
|
|
26255
26258
|
|
|
26259
|
+
// src/utils/media-transformer.ts
|
|
26260
|
+
import path from "node:path";
|
|
26261
|
+
import { getGeneratedDir, getUploadsAgentsDir, getUploadsChannelsDir } from "@elizaos/core";
|
|
26262
|
+
var ID_PATTERN = /^([^/\\]+)[/\\]([^/\\]+)$/;
|
|
26263
|
+
var PATH_CONFIGS = [
|
|
26264
|
+
{
|
|
26265
|
+
getPath: getGeneratedDir,
|
|
26266
|
+
apiPrefix: "/media/generated/",
|
|
26267
|
+
pattern: ID_PATTERN
|
|
26268
|
+
},
|
|
26269
|
+
{
|
|
26270
|
+
getPath: getUploadsAgentsDir,
|
|
26271
|
+
apiPrefix: "/media/uploads/agents/",
|
|
26272
|
+
pattern: ID_PATTERN
|
|
26273
|
+
},
|
|
26274
|
+
{
|
|
26275
|
+
getPath: getUploadsChannelsDir,
|
|
26276
|
+
apiPrefix: "/media/uploads/channels/",
|
|
26277
|
+
pattern: ID_PATTERN
|
|
26278
|
+
}
|
|
26279
|
+
];
|
|
26280
|
+
var isExternalUrl = (p) => /^(?:https?:|blob:|data:|file:|ipfs:|s3:|gs:)/i.test(p);
|
|
26281
|
+
function transformPathToApiUrl(filePath) {
|
|
26282
|
+
if (!filePath || isExternalUrl(filePath) || filePath.startsWith("/media/") || !path.isAbsolute(filePath)) {
|
|
26283
|
+
return filePath;
|
|
26284
|
+
}
|
|
26285
|
+
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
26286
|
+
for (const config of PATH_CONFIGS) {
|
|
26287
|
+
const configPathRaw = config.getPath().replace(/\\/g, "/");
|
|
26288
|
+
const configPath = configPathRaw.endsWith("/") ? configPathRaw : `${configPathRaw}/`;
|
|
26289
|
+
if (normalizedPath === configPathRaw || normalizedPath.startsWith(configPath)) {
|
|
26290
|
+
const relative = normalizedPath === configPathRaw ? "" : normalizedPath.slice(configPath.length);
|
|
26291
|
+
if (relative) {
|
|
26292
|
+
const match = relative.match(config.pattern);
|
|
26293
|
+
if (match) {
|
|
26294
|
+
const [, id, filename] = match;
|
|
26295
|
+
return `${config.apiPrefix}${encodeURIComponent(id)}${"/"}${encodeURIComponent(filename)}`;
|
|
26296
|
+
}
|
|
26297
|
+
}
|
|
26298
|
+
}
|
|
26299
|
+
}
|
|
26300
|
+
return filePath;
|
|
26301
|
+
}
|
|
26302
|
+
function attachmentsToApiUrls(attachments) {
|
|
26303
|
+
if (!attachments)
|
|
26304
|
+
return attachments;
|
|
26305
|
+
if (Array.isArray(attachments)) {
|
|
26306
|
+
return attachments.map((attachment) => {
|
|
26307
|
+
if (typeof attachment === "string") {
|
|
26308
|
+
return transformPathToApiUrl(attachment);
|
|
26309
|
+
}
|
|
26310
|
+
if (attachment?.url) {
|
|
26311
|
+
return { ...attachment, url: transformPathToApiUrl(attachment.url) };
|
|
26312
|
+
}
|
|
26313
|
+
return attachment;
|
|
26314
|
+
});
|
|
26315
|
+
}
|
|
26316
|
+
if (typeof attachments === "string") {
|
|
26317
|
+
return transformPathToApiUrl(attachments);
|
|
26318
|
+
}
|
|
26319
|
+
if (attachments?.url) {
|
|
26320
|
+
return { ...attachments, url: transformPathToApiUrl(attachments.url) };
|
|
26321
|
+
}
|
|
26322
|
+
return attachments;
|
|
26323
|
+
}
|
|
26324
|
+
function transformMessageAttachments(message) {
|
|
26325
|
+
if (!message || typeof message !== "object") {
|
|
26326
|
+
return message;
|
|
26327
|
+
}
|
|
26328
|
+
if (message.content && typeof message.content === "object" && "attachments" in message.content) {
|
|
26329
|
+
const content = message.content;
|
|
26330
|
+
if (content.attachments) {
|
|
26331
|
+
content.attachments = attachmentsToApiUrls(content.attachments);
|
|
26332
|
+
}
|
|
26333
|
+
}
|
|
26334
|
+
if (message.metadata?.attachments) {
|
|
26335
|
+
message.metadata.attachments = attachmentsToApiUrls(message.metadata.attachments);
|
|
26336
|
+
}
|
|
26337
|
+
return message;
|
|
26338
|
+
}
|
|
26339
|
+
|
|
26256
26340
|
// src/api/messaging/core.ts
|
|
26257
26341
|
var DEFAULT_SERVER_ID = "00000000-0000-0000-0000-000000000000";
|
|
26258
26342
|
function createMessagingCoreRouter(serverInstance) {
|
|
@@ -26292,6 +26376,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26292
26376
|
metadata
|
|
26293
26377
|
};
|
|
26294
26378
|
const createdMessage = await serverInstance.createMessage(newRootMessageData);
|
|
26379
|
+
const transformedAttachments = attachmentsToApiUrls(metadata?.attachments ?? raw_message?.attachments);
|
|
26295
26380
|
if (serverInstance.socketIO) {
|
|
26296
26381
|
serverInstance.socketIO.to(channel_id).emit("messageBroadcast", {
|
|
26297
26382
|
senderId: author_id,
|
|
@@ -26304,7 +26389,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26304
26389
|
id: createdMessage.id,
|
|
26305
26390
|
thought: raw_message?.thought,
|
|
26306
26391
|
actions: raw_message?.actions,
|
|
26307
|
-
attachments:
|
|
26392
|
+
attachments: transformedAttachments
|
|
26308
26393
|
});
|
|
26309
26394
|
}
|
|
26310
26395
|
res.status(201).json({ success: true, data: createdMessage });
|
|
@@ -26350,6 +26435,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26350
26435
|
metadata
|
|
26351
26436
|
};
|
|
26352
26437
|
const savedMessage = await serverInstance.createMessage(baseData);
|
|
26438
|
+
const transformedAttachments = attachmentsToApiUrls(metadata?.attachments ?? raw_message?.attachments);
|
|
26353
26439
|
if (serverInstance.socketIO) {
|
|
26354
26440
|
serverInstance.socketIO.to(channel_id).emit("messageBroadcast", {
|
|
26355
26441
|
senderId: author_id,
|
|
@@ -26362,7 +26448,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26362
26448
|
id: savedMessage.id,
|
|
26363
26449
|
thought: raw_message?.thought,
|
|
26364
26450
|
actions: raw_message?.actions,
|
|
26365
|
-
attachments:
|
|
26451
|
+
attachments: transformedAttachments,
|
|
26366
26452
|
updatedAt: new Date(savedMessage.updatedAt).getTime(),
|
|
26367
26453
|
rawMessage: raw_message
|
|
26368
26454
|
});
|
|
@@ -26407,6 +26493,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26407
26493
|
if (!updated) {
|
|
26408
26494
|
return res.status(404).json({ success: false, error: "Message not found" });
|
|
26409
26495
|
}
|
|
26496
|
+
const transformedAttachments = attachmentsToApiUrls(metadata?.attachments ?? raw_message?.attachments);
|
|
26410
26497
|
if (serverInstance.socketIO) {
|
|
26411
26498
|
serverInstance.socketIO.to(updated.channelId).emit("messageBroadcast", {
|
|
26412
26499
|
senderId: author_id || updated.authorId,
|
|
@@ -26419,7 +26506,7 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
26419
26506
|
id: updated.id,
|
|
26420
26507
|
thought: raw_message?.thought,
|
|
26421
26508
|
actions: raw_message?.actions,
|
|
26422
|
-
attachments:
|
|
26509
|
+
attachments: transformedAttachments,
|
|
26423
26510
|
updatedAt: new Date(updated.updatedAt).getTime(),
|
|
26424
26511
|
rawMessage: raw_message
|
|
26425
26512
|
});
|
|
@@ -26637,7 +26724,8 @@ import {
|
|
|
26637
26724
|
ModelType,
|
|
26638
26725
|
ChannelType as ChannelType2,
|
|
26639
26726
|
logger as logger12,
|
|
26640
|
-
validateUuid as validateUuid13
|
|
26727
|
+
validateUuid as validateUuid13,
|
|
26728
|
+
getUploadsChannelsDir as getUploadsChannelsDir2
|
|
26641
26729
|
} from "@elizaos/core";
|
|
26642
26730
|
import express12 from "express";
|
|
26643
26731
|
|
|
@@ -27357,7 +27445,7 @@ var ALLOWED_MEDIA_MIME_TYPES = [
|
|
|
27357
27445
|
// src/api/messaging/channels.ts
|
|
27358
27446
|
import multer from "multer";
|
|
27359
27447
|
import fs from "fs";
|
|
27360
|
-
import
|
|
27448
|
+
import path2 from "path";
|
|
27361
27449
|
var DEFAULT_SERVER_ID3 = "00000000-0000-0000-0000-000000000000";
|
|
27362
27450
|
var channelStorage = multer.memoryStorage();
|
|
27363
27451
|
var channelUploadMiddleware = multer({
|
|
@@ -27376,15 +27464,15 @@ var channelUploadMiddleware = multer({
|
|
|
27376
27464
|
}
|
|
27377
27465
|
});
|
|
27378
27466
|
async function saveChannelUploadedFile(file, channelId) {
|
|
27379
|
-
const uploadDir =
|
|
27467
|
+
const uploadDir = path2.join(getUploadsChannelsDir2(), channelId);
|
|
27380
27468
|
if (!fs.existsSync(uploadDir)) {
|
|
27381
27469
|
fs.mkdirSync(uploadDir, { recursive: true });
|
|
27382
27470
|
}
|
|
27383
27471
|
const timestamp = Date.now();
|
|
27384
27472
|
const random = Math.round(Math.random() * 1e9);
|
|
27385
|
-
const ext =
|
|
27473
|
+
const ext = path2.extname(file.originalname);
|
|
27386
27474
|
const filename = `${timestamp}-${random}${ext}`;
|
|
27387
|
-
const filePath =
|
|
27475
|
+
const filePath = path2.join(uploadDir, filename);
|
|
27388
27476
|
fs.writeFileSync(filePath, file.buffer);
|
|
27389
27477
|
const url = `/media/uploads/channels/${channelId}/${filename}`;
|
|
27390
27478
|
return { filename, url };
|
|
@@ -27524,16 +27612,27 @@ function createChannelsRouter(agents, serverInstance) {
|
|
|
27524
27612
|
try {
|
|
27525
27613
|
const messages = await serverInstance.getMessagesForChannel(channelId, limit, beforeDate);
|
|
27526
27614
|
const messagesForGui = messages.map((msg) => {
|
|
27527
|
-
|
|
27528
|
-
|
|
27529
|
-
|
|
27530
|
-
|
|
27531
|
-
|
|
27615
|
+
let rawMessage = {};
|
|
27616
|
+
try {
|
|
27617
|
+
rawMessage = typeof msg.rawMessage === "string" ? JSON.parse(msg.rawMessage) : msg.rawMessage;
|
|
27618
|
+
} catch (e) {
|
|
27619
|
+
logger12.warn("[Messages Router] Failed to parse rawMessage for message", msg.id);
|
|
27620
|
+
}
|
|
27621
|
+
const { content, metadata } = transformMessageAttachments({
|
|
27622
|
+
content: msg.content,
|
|
27532
27623
|
metadata: {
|
|
27533
27624
|
...msg.metadata,
|
|
27534
27625
|
thought: rawMessage?.thought,
|
|
27535
|
-
actions: rawMessage?.actions
|
|
27626
|
+
actions: rawMessage?.actions,
|
|
27627
|
+
attachments: rawMessage?.attachments ?? msg.metadata?.attachments
|
|
27536
27628
|
}
|
|
27629
|
+
});
|
|
27630
|
+
return {
|
|
27631
|
+
...msg,
|
|
27632
|
+
content,
|
|
27633
|
+
metadata,
|
|
27634
|
+
created_at: new Date(msg.createdAt).getTime(),
|
|
27635
|
+
updated_at: new Date(msg.updatedAt).getTime()
|
|
27537
27636
|
};
|
|
27538
27637
|
});
|
|
27539
27638
|
res.json({ success: true, data: { messages: messagesForGui } });
|
|
@@ -28721,17 +28820,28 @@ function createSessionsRouter(agents, serverInstance) {
|
|
|
28721
28820
|
} catch (error) {
|
|
28722
28821
|
logger13.warn(`[Sessions API] Failed to parse rawMessage for message ${msg.id}`, error instanceof Error ? error.message : String(error));
|
|
28723
28822
|
}
|
|
28724
|
-
|
|
28725
|
-
id: msg.id,
|
|
28823
|
+
const transformedMessage = transformMessageAttachments({
|
|
28726
28824
|
content: msg.content,
|
|
28727
|
-
authorId: msg.authorId,
|
|
28728
|
-
isAgent: msg.sourceType === "agent_response",
|
|
28729
|
-
createdAt: msg.createdAt,
|
|
28730
28825
|
metadata: {
|
|
28731
28826
|
...msg.metadata,
|
|
28732
28827
|
thought: rawMessage.thought,
|
|
28733
28828
|
actions: rawMessage.actions
|
|
28734
28829
|
}
|
|
28830
|
+
});
|
|
28831
|
+
const metadata = {
|
|
28832
|
+
thought: rawMessage.thought,
|
|
28833
|
+
actions: rawMessage.actions
|
|
28834
|
+
};
|
|
28835
|
+
if (transformedMessage.metadata && typeof transformedMessage.metadata === "object") {
|
|
28836
|
+
Object.assign(metadata, transformedMessage.metadata);
|
|
28837
|
+
}
|
|
28838
|
+
return {
|
|
28839
|
+
id: msg.id,
|
|
28840
|
+
content: typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content),
|
|
28841
|
+
authorId: msg.authorId,
|
|
28842
|
+
isAgent: msg.sourceType === "agent_response",
|
|
28843
|
+
createdAt: msg.createdAt,
|
|
28844
|
+
metadata
|
|
28735
28845
|
};
|
|
28736
28846
|
});
|
|
28737
28847
|
const oldestMessage = simplifiedMessages[simplifiedMessages.length - 1];
|
|
@@ -28927,11 +29037,11 @@ function messagingRouter(agents, serverInstance) {
|
|
|
28927
29037
|
import express17 from "express";
|
|
28928
29038
|
|
|
28929
29039
|
// src/api/media/agents.ts
|
|
28930
|
-
import { validateUuid as validateUuid15, logger as logger14, getContentTypeFromMimeType } from "@elizaos/core";
|
|
29040
|
+
import { validateUuid as validateUuid15, logger as logger14, getContentTypeFromMimeType, getUploadsAgentsDir as getUploadsAgentsDir2 } from "@elizaos/core";
|
|
28931
29041
|
import express15 from "express";
|
|
28932
29042
|
import multer2 from "multer";
|
|
28933
29043
|
import fs2 from "fs";
|
|
28934
|
-
import
|
|
29044
|
+
import path3 from "path";
|
|
28935
29045
|
var storage = multer2.memoryStorage();
|
|
28936
29046
|
var upload = multer2({
|
|
28937
29047
|
storage,
|
|
@@ -28948,15 +29058,15 @@ var upload = multer2({
|
|
|
28948
29058
|
}
|
|
28949
29059
|
});
|
|
28950
29060
|
async function saveUploadedFile(file, agentId) {
|
|
28951
|
-
const uploadDir =
|
|
29061
|
+
const uploadDir = path3.join(getUploadsAgentsDir2(), agentId);
|
|
28952
29062
|
if (!fs2.existsSync(uploadDir)) {
|
|
28953
29063
|
fs2.mkdirSync(uploadDir, { recursive: true });
|
|
28954
29064
|
}
|
|
28955
29065
|
const timestamp = Date.now();
|
|
28956
29066
|
const random = Math.round(Math.random() * 1e9);
|
|
28957
|
-
const ext =
|
|
29067
|
+
const ext = path3.extname(file.originalname);
|
|
28958
29068
|
const filename = `${timestamp}-${random}${ext}`;
|
|
28959
|
-
const filePath =
|
|
29069
|
+
const filePath = path3.join(uploadDir, filename);
|
|
28960
29070
|
fs2.writeFileSync(filePath, file.buffer);
|
|
28961
29071
|
const url = `/media/uploads/agents/${agentId}/${filename}`;
|
|
28962
29072
|
return { filename, url };
|
|
@@ -28995,11 +29105,11 @@ function createAgentMediaRouter() {
|
|
|
28995
29105
|
}
|
|
28996
29106
|
|
|
28997
29107
|
// src/api/media/channels.ts
|
|
28998
|
-
import { validateUuid as validateUuid16, logger as logger15 } from "@elizaos/core";
|
|
29108
|
+
import { validateUuid as validateUuid16, logger as logger15, getUploadsChannelsDir as getUploadsChannelsDir3 } from "@elizaos/core";
|
|
28999
29109
|
import express16 from "express";
|
|
29000
29110
|
import multer3 from "multer";
|
|
29001
29111
|
import fs3 from "fs";
|
|
29002
|
-
import
|
|
29112
|
+
import path4 from "path";
|
|
29003
29113
|
var storage2 = multer3.memoryStorage();
|
|
29004
29114
|
var upload2 = multer3({
|
|
29005
29115
|
storage: storage2,
|
|
@@ -29017,15 +29127,15 @@ var upload2 = multer3({
|
|
|
29017
29127
|
}
|
|
29018
29128
|
});
|
|
29019
29129
|
async function saveUploadedFile2(file, channelId) {
|
|
29020
|
-
const uploadDir =
|
|
29130
|
+
const uploadDir = path4.join(getUploadsChannelsDir3(), channelId);
|
|
29021
29131
|
if (!fs3.existsSync(uploadDir)) {
|
|
29022
29132
|
fs3.mkdirSync(uploadDir, { recursive: true });
|
|
29023
29133
|
}
|
|
29024
29134
|
const timestamp = Date.now();
|
|
29025
29135
|
const random = Math.round(Math.random() * 1e9);
|
|
29026
|
-
const ext =
|
|
29136
|
+
const ext = path4.extname(file.originalname);
|
|
29027
29137
|
const filename = `${timestamp}-${random}${ext}`;
|
|
29028
|
-
const filePath =
|
|
29138
|
+
const filePath = path4.join(uploadDir, filename);
|
|
29029
29139
|
fs3.writeFileSync(filePath, file.buffer);
|
|
29030
29140
|
const url = `/media/uploads/channels/${channelId}/${filename}`;
|
|
29031
29141
|
return { filename, url };
|
|
@@ -29083,7 +29193,7 @@ import express19 from "express";
|
|
|
29083
29193
|
import { validateUuid as validateUuid18, logger as logger18, createUniqueUuid as createUniqueUuid4, ChannelType as ChannelType4 } from "@elizaos/core";
|
|
29084
29194
|
import express18 from "express";
|
|
29085
29195
|
// src/api/shared/file-utils.ts
|
|
29086
|
-
import { logger as logger16 } from "@elizaos/core";
|
|
29196
|
+
import { logger as logger16, getUploadsAgentsDir as getUploadsAgentsDir3, getUploadsChannelsDir as getUploadsChannelsDir4 } from "@elizaos/core";
|
|
29087
29197
|
var cleanupUploadedFile = (file) => {
|
|
29088
29198
|
logger16.debug(`[FILE] Multer file ${file.originalname} in memory, no cleanup needed`);
|
|
29089
29199
|
};
|
|
@@ -29780,7 +29890,7 @@ var import_dotenv = __toESM(require_main(), 1);
|
|
|
29780
29890
|
import { logger as logger24 } from "@elizaos/core";
|
|
29781
29891
|
import express29 from "express";
|
|
29782
29892
|
import { existsSync, writeFileSync } from "fs";
|
|
29783
|
-
import
|
|
29893
|
+
import path5 from "path";
|
|
29784
29894
|
import fs4 from "fs/promises";
|
|
29785
29895
|
async function parseEnvFile(filePath) {
|
|
29786
29896
|
try {
|
|
@@ -29809,17 +29919,17 @@ function getLocalEnvPath() {
|
|
|
29809
29919
|
function resolveEnvFile(startDir = process.cwd()) {
|
|
29810
29920
|
let currentDir = startDir;
|
|
29811
29921
|
while (true) {
|
|
29812
|
-
const candidate =
|
|
29922
|
+
const candidate = path5.join(currentDir, ".env");
|
|
29813
29923
|
if (existsSync(candidate)) {
|
|
29814
29924
|
return candidate;
|
|
29815
29925
|
}
|
|
29816
|
-
const parentDir =
|
|
29926
|
+
const parentDir = path5.dirname(currentDir);
|
|
29817
29927
|
if (parentDir === currentDir) {
|
|
29818
29928
|
break;
|
|
29819
29929
|
}
|
|
29820
29930
|
currentDir = parentDir;
|
|
29821
29931
|
}
|
|
29822
|
-
return
|
|
29932
|
+
return path5.join(startDir, ".env");
|
|
29823
29933
|
}
|
|
29824
29934
|
function createEnvironmentRouter() {
|
|
29825
29935
|
const router = express29.Router();
|
|
@@ -29893,7 +30003,7 @@ import express30 from "express";
|
|
|
29893
30003
|
// package.json
|
|
29894
30004
|
var package_default = {
|
|
29895
30005
|
name: "@elizaos/server",
|
|
29896
|
-
version: "1.5.9-alpha.
|
|
30006
|
+
version: "1.5.9-alpha.10",
|
|
29897
30007
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
29898
30008
|
publishConfig: {
|
|
29899
30009
|
access: "public",
|
|
@@ -30251,6 +30361,7 @@ class SocketIORouter {
|
|
|
30251
30361
|
};
|
|
30252
30362
|
const createdRootMessage = await this.serverInstance.createMessage(newRootMessageData);
|
|
30253
30363
|
logger25.info(`[SocketIO ${socket.id}] Message from ${senderId} (msgId: ${payload.messageId || "N/A"}) submitted to central store (central ID: ${createdRootMessage.id}). It will be processed by agents and broadcasted upon their reply.`);
|
|
30364
|
+
const transformedAttachments = attachmentsToApiUrls(attachments);
|
|
30254
30365
|
const messageBroadcast = {
|
|
30255
30366
|
id: createdRootMessage.id,
|
|
30256
30367
|
senderId,
|
|
@@ -30261,7 +30372,7 @@ class SocketIORouter {
|
|
|
30261
30372
|
serverId,
|
|
30262
30373
|
createdAt: new Date(createdRootMessage.createdAt).getTime(),
|
|
30263
30374
|
source: source || "socketio_client",
|
|
30264
|
-
attachments
|
|
30375
|
+
attachments: transformedAttachments
|
|
30265
30376
|
};
|
|
30266
30377
|
socket.to(channelId).emit("messageBroadcast", messageBroadcast);
|
|
30267
30378
|
socket.emit("messageBroadcast", {
|
|
@@ -30375,7 +30486,11 @@ function setupLogStreaming(io, router) {
|
|
|
30375
30486
|
try {
|
|
30376
30487
|
let logEntry;
|
|
30377
30488
|
if (typeof data === "string") {
|
|
30378
|
-
|
|
30489
|
+
try {
|
|
30490
|
+
logEntry = JSON.parse(data);
|
|
30491
|
+
} catch (parseError) {
|
|
30492
|
+
logEntry = { message: data, level: "info" };
|
|
30493
|
+
}
|
|
30379
30494
|
} else {
|
|
30380
30495
|
logEntry = data;
|
|
30381
30496
|
}
|
|
@@ -31201,15 +31316,16 @@ var messageBusConnectorPlugin = {
|
|
|
31201
31316
|
|
|
31202
31317
|
// src/loader.ts
|
|
31203
31318
|
import fs5 from "node:fs";
|
|
31204
|
-
import
|
|
31319
|
+
import path6 from "node:path";
|
|
31205
31320
|
import { fileURLToPath } from "node:url";
|
|
31206
31321
|
import {
|
|
31207
31322
|
logger as logger29,
|
|
31208
31323
|
parseAndValidateCharacter,
|
|
31209
|
-
validateCharacter
|
|
31324
|
+
validateCharacter,
|
|
31325
|
+
getCharactersDir
|
|
31210
31326
|
} from "@elizaos/core";
|
|
31211
31327
|
var __filename2 = fileURLToPath(import.meta.url);
|
|
31212
|
-
var __dirname2 =
|
|
31328
|
+
var __dirname2 = path6.dirname(__filename2);
|
|
31213
31329
|
function tryLoadFile(filePath) {
|
|
31214
31330
|
try {
|
|
31215
31331
|
return fs5.readFileSync(filePath, "utf8");
|
|
@@ -31301,32 +31417,32 @@ async function loadCharacter(filePath) {
|
|
|
31301
31417
|
}
|
|
31302
31418
|
return jsonToCharacter(parseResult.data);
|
|
31303
31419
|
}
|
|
31304
|
-
function handleCharacterLoadError(
|
|
31420
|
+
function handleCharacterLoadError(path7, error) {
|
|
31305
31421
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
31306
31422
|
if (errorMsg.includes("ENOENT") || errorMsg.includes("no such file")) {
|
|
31307
|
-
logger29.error(`Character file not found: ${
|
|
31308
|
-
throw new Error(`Character '${
|
|
31423
|
+
logger29.error(`Character file not found: ${path7}`);
|
|
31424
|
+
throw new Error(`Character '${path7}' not found. Please check if the file exists and the path is correct.`);
|
|
31309
31425
|
} else if (errorMsg.includes("Character validation failed")) {
|
|
31310
|
-
logger29.error(`Character validation failed for: ${
|
|
31311
|
-
throw new Error(`Character file '${
|
|
31426
|
+
logger29.error(`Character validation failed for: ${path7}`);
|
|
31427
|
+
throw new Error(`Character file '${path7}' contains invalid character data. ${errorMsg}`);
|
|
31312
31428
|
} else if (errorMsg.includes("JSON")) {
|
|
31313
|
-
logger29.error(`JSON parsing error in character file: ${
|
|
31314
|
-
throw new Error(`Character file '${
|
|
31429
|
+
logger29.error(`JSON parsing error in character file: ${path7}`);
|
|
31430
|
+
throw new Error(`Character file '${path7}' has malformed JSON. Please check the file content.`);
|
|
31315
31431
|
} else if (errorMsg.includes("Invalid JSON")) {
|
|
31316
|
-
logger29.error(`Invalid JSON in character file: ${
|
|
31317
|
-
throw new Error(`Character file '${
|
|
31432
|
+
logger29.error(`Invalid JSON in character file: ${path7}`);
|
|
31433
|
+
throw new Error(`Character file '${path7}' has invalid JSON format. Please check the file content.`);
|
|
31318
31434
|
} else {
|
|
31319
|
-
logger29.error(`Error loading character from ${
|
|
31320
|
-
throw new Error(`Failed to load character '${
|
|
31435
|
+
logger29.error(`Error loading character from ${path7}: ${errorMsg}`);
|
|
31436
|
+
throw new Error(`Failed to load character '${path7}': ${errorMsg}`);
|
|
31321
31437
|
}
|
|
31322
31438
|
}
|
|
31323
|
-
async function safeLoadCharacter(
|
|
31439
|
+
async function safeLoadCharacter(path7) {
|
|
31324
31440
|
try {
|
|
31325
|
-
const character = await loadCharacter(
|
|
31326
|
-
logger29.info(`Successfully loaded character from: ${
|
|
31441
|
+
const character = await loadCharacter(path7);
|
|
31442
|
+
logger29.info(`Successfully loaded character from: ${path7}`);
|
|
31327
31443
|
return character;
|
|
31328
31444
|
} catch (e) {
|
|
31329
|
-
return handleCharacterLoadError(
|
|
31445
|
+
return handleCharacterLoadError(path7, e);
|
|
31330
31446
|
}
|
|
31331
31447
|
}
|
|
31332
31448
|
async function loadCharacterTryPath(characterPath) {
|
|
@@ -31346,27 +31462,27 @@ async function loadCharacterTryPath(characterPath) {
|
|
|
31346
31462
|
const jsonPath = hasJsonExtension ? characterPath : `${characterPath}.json`;
|
|
31347
31463
|
const basePathsToTry = [
|
|
31348
31464
|
basePath,
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
|
|
31357
|
-
|
|
31465
|
+
path6.resolve(process.cwd(), basePath),
|
|
31466
|
+
path6.resolve(process.cwd(), "..", "..", basePath),
|
|
31467
|
+
path6.resolve(process.cwd(), "..", "..", "..", basePath),
|
|
31468
|
+
path6.resolve(process.cwd(), "agent", basePath),
|
|
31469
|
+
path6.resolve(__dirname2, basePath),
|
|
31470
|
+
path6.resolve(__dirname2, "characters", path6.basename(basePath)),
|
|
31471
|
+
path6.resolve(__dirname2, "../characters", path6.basename(basePath)),
|
|
31472
|
+
path6.resolve(__dirname2, "../../characters", path6.basename(basePath)),
|
|
31473
|
+
path6.resolve(__dirname2, "../../../characters", path6.basename(basePath))
|
|
31358
31474
|
];
|
|
31359
31475
|
const jsonPathsToTry = hasJsonExtension ? [] : [
|
|
31360
31476
|
jsonPath,
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
|
|
31364
|
-
|
|
31365
|
-
|
|
31366
|
-
|
|
31367
|
-
|
|
31368
|
-
|
|
31369
|
-
|
|
31477
|
+
path6.resolve(process.cwd(), jsonPath),
|
|
31478
|
+
path6.resolve(process.cwd(), "..", "..", jsonPath),
|
|
31479
|
+
path6.resolve(process.cwd(), "..", "..", "..", jsonPath),
|
|
31480
|
+
path6.resolve(process.cwd(), "agent", jsonPath),
|
|
31481
|
+
path6.resolve(__dirname2, jsonPath),
|
|
31482
|
+
path6.resolve(__dirname2, "characters", path6.basename(jsonPath)),
|
|
31483
|
+
path6.resolve(__dirname2, "../characters", path6.basename(jsonPath)),
|
|
31484
|
+
path6.resolve(__dirname2, "../../characters", path6.basename(jsonPath)),
|
|
31485
|
+
path6.resolve(__dirname2, "../../../characters", path6.basename(jsonPath))
|
|
31370
31486
|
];
|
|
31371
31487
|
const pathsToTry = Array.from(new Set([...basePathsToTry, ...jsonPathsToTry]));
|
|
31372
31488
|
let lastError = null;
|
|
@@ -31388,11 +31504,11 @@ function commaSeparatedStringToArray(commaSeparated) {
|
|
|
31388
31504
|
}
|
|
31389
31505
|
async function readCharactersFromStorage(characterPaths) {
|
|
31390
31506
|
try {
|
|
31391
|
-
const uploadDir =
|
|
31507
|
+
const uploadDir = getCharactersDir();
|
|
31392
31508
|
await fs5.promises.mkdir(uploadDir, { recursive: true });
|
|
31393
31509
|
const fileNames = await fs5.promises.readdir(uploadDir);
|
|
31394
31510
|
for (const fileName of fileNames) {
|
|
31395
|
-
characterPaths.push(
|
|
31511
|
+
characterPaths.push(path6.join(uploadDir, fileName));
|
|
31396
31512
|
}
|
|
31397
31513
|
} catch (err) {
|
|
31398
31514
|
logger29.error(`Error reading directory: ${err.message}`);
|
|
@@ -32886,8 +33002,8 @@ function isValidProtocol(protocol) {
|
|
|
32886
33002
|
return protocol === "http" || protocol === "https";
|
|
32887
33003
|
}
|
|
32888
33004
|
function dsnToString(dsn, withPassword = false) {
|
|
32889
|
-
const { host, path:
|
|
32890
|
-
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}` + `@${host}${port ? `:${port}` : ""}/${
|
|
33005
|
+
const { host, path: path7, pass, port, projectId, protocol, publicKey } = dsn;
|
|
33006
|
+
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}` + `@${host}${port ? `:${port}` : ""}/${path7 ? `${path7}/` : path7}${projectId}`;
|
|
32891
33007
|
}
|
|
32892
33008
|
function dsnFromString(str) {
|
|
32893
33009
|
const match2 = DSN_REGEX.exec(str);
|
|
@@ -32898,11 +33014,11 @@ function dsnFromString(str) {
|
|
|
32898
33014
|
return;
|
|
32899
33015
|
}
|
|
32900
33016
|
const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match2.slice(1);
|
|
32901
|
-
let
|
|
33017
|
+
let path7 = "";
|
|
32902
33018
|
let projectId = lastPath;
|
|
32903
33019
|
const split = projectId.split("/");
|
|
32904
33020
|
if (split.length > 1) {
|
|
32905
|
-
|
|
33021
|
+
path7 = split.slice(0, -1).join("/");
|
|
32906
33022
|
projectId = split.pop();
|
|
32907
33023
|
}
|
|
32908
33024
|
if (projectId) {
|
|
@@ -32911,7 +33027,7 @@ function dsnFromString(str) {
|
|
|
32911
33027
|
projectId = projectMatch[0];
|
|
32912
33028
|
}
|
|
32913
33029
|
}
|
|
32914
|
-
return dsnFromComponents({ host, pass, path:
|
|
33030
|
+
return dsnFromComponents({ host, pass, path: path7, projectId, port, protocol, publicKey });
|
|
32915
33031
|
}
|
|
32916
33032
|
function dsnFromComponents(components) {
|
|
32917
33033
|
return {
|
|
@@ -36070,9 +36186,9 @@ function stripUrlQueryAndFragment(urlPath) {
|
|
|
36070
36186
|
return urlPath.split(/[?#]/, 1)[0];
|
|
36071
36187
|
}
|
|
36072
36188
|
function getSanitizedUrlString(url) {
|
|
36073
|
-
const { protocol, host, path:
|
|
36189
|
+
const { protocol, host, path: path7 } = url;
|
|
36074
36190
|
const filteredHost = host?.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || "";
|
|
36075
|
-
return `${protocol ? `${protocol}://` : ""}${filteredHost}${
|
|
36191
|
+
return `${protocol ? `${protocol}://` : ""}${filteredHost}${path7}`;
|
|
36076
36192
|
}
|
|
36077
36193
|
// ../../node_modules/@sentry/core/build/esm/utils/sdkMetadata.js
|
|
36078
36194
|
function applySdkMetadata(options, name, names = [name], source = "npm") {
|
|
@@ -36694,8 +36810,8 @@ function splitPath(filename) {
|
|
|
36694
36810
|
const parts = splitPathRe.exec(truncated);
|
|
36695
36811
|
return parts ? parts.slice(1) : [];
|
|
36696
36812
|
}
|
|
36697
|
-
function dirname(
|
|
36698
|
-
const result = splitPath(
|
|
36813
|
+
function dirname(path7) {
|
|
36814
|
+
const result = splitPath(path7);
|
|
36699
36815
|
const root = result[0] || "";
|
|
36700
36816
|
let dir = result[1];
|
|
36701
36817
|
if (!root && !dir) {
|
|
@@ -38097,7 +38213,7 @@ function hasWrap(instrumentation) {
|
|
|
38097
38213
|
|
|
38098
38214
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/SentryHttpInstrumentation.js
|
|
38099
38215
|
var import_api4 = __toESM(require_src(), 1);
|
|
38100
|
-
var
|
|
38216
|
+
var import_core40 = __toESM(require_src8(), 1);
|
|
38101
38217
|
var import_instrumentation2 = __toESM(require_src6(), 1);
|
|
38102
38218
|
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
38103
38219
|
|
|
@@ -38109,8 +38225,8 @@ function getRequestUrl(requestOptions) {
|
|
|
38109
38225
|
const protocol = requestOptions.protocol || "";
|
|
38110
38226
|
const hostname = requestOptions.hostname || requestOptions.host || "";
|
|
38111
38227
|
const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) ? "" : `:${requestOptions.port}`;
|
|
38112
|
-
const
|
|
38113
|
-
return `${protocol}//${hostname}${port}${
|
|
38228
|
+
const path7 = requestOptions.path ? requestOptions.path : "/";
|
|
38229
|
+
return `${protocol}//${hostname}${port}${path7}`;
|
|
38114
38230
|
}
|
|
38115
38231
|
|
|
38116
38232
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/constants.js
|
|
@@ -38119,7 +38235,7 @@ var MAX_BODY_BYTE_LENGTH = 1024 * 1024;
|
|
|
38119
38235
|
|
|
38120
38236
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/incoming-requests.js
|
|
38121
38237
|
var import_api2 = __toESM(require_src(), 1);
|
|
38122
|
-
var
|
|
38238
|
+
var import_core34 = __toESM(require_src8(), 1);
|
|
38123
38239
|
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
38124
38240
|
import { errorMonitor } from "events";
|
|
38125
38241
|
var HTTP_SERVER_INSTRUMENTED_KEY = import_api2.createContextKey("sentry_http_server_instrumented");
|
|
@@ -38220,10 +38336,10 @@ function instrumentServer(server, {
|
|
|
38220
38336
|
applyCustomAttributesOnSpan?.(span, request, response);
|
|
38221
38337
|
incomingRequestSpanHook?.(span, request, response);
|
|
38222
38338
|
const rpcMetadata = {
|
|
38223
|
-
type:
|
|
38339
|
+
type: import_core34.RPCType.HTTP,
|
|
38224
38340
|
span
|
|
38225
38341
|
};
|
|
38226
|
-
import_api2.context.with(
|
|
38342
|
+
import_api2.context.with(import_core34.setRPCMetadata(import_api2.trace.setSpan(import_api2.context.active(), span), rpcMetadata), () => {
|
|
38227
38343
|
import_api2.context.bind(import_api2.context.active(), request);
|
|
38228
38344
|
import_api2.context.bind(import_api2.context.active(), response);
|
|
38229
38345
|
let isEnded = false;
|
|
@@ -38410,7 +38526,7 @@ function getIncomingRequestAttributesOnResponse(request, response) {
|
|
|
38410
38526
|
[import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE]: statusCode,
|
|
38411
38527
|
"http.status_text": statusMessage?.toUpperCase()
|
|
38412
38528
|
};
|
|
38413
|
-
const rpcMetadata =
|
|
38529
|
+
const rpcMetadata = import_core34.getRPCMetadata(import_api2.context.active());
|
|
38414
38530
|
if (socket) {
|
|
38415
38531
|
const { localAddress, localPort, remoteAddress, remotePort } = socket;
|
|
38416
38532
|
newAttributes[import_semantic_conventions.SEMATTRS_NET_HOST_IP] = localAddress;
|
|
@@ -38420,7 +38536,7 @@ function getIncomingRequestAttributesOnResponse(request, response) {
|
|
|
38420
38536
|
}
|
|
38421
38537
|
newAttributes[import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE] = statusCode;
|
|
38422
38538
|
newAttributes["http.status_text"] = (statusMessage || "").toUpperCase();
|
|
38423
|
-
if (rpcMetadata?.type ===
|
|
38539
|
+
if (rpcMetadata?.type === import_core34.RPCType.HTTP && rpcMetadata.route !== undefined) {
|
|
38424
38540
|
const routeName = rpcMetadata.route;
|
|
38425
38541
|
newAttributes[import_semantic_conventions.ATTR_HTTP_ROUTE] = routeName;
|
|
38426
38542
|
}
|
|
@@ -38430,11 +38546,11 @@ function isKnownPrefetchRequest(req) {
|
|
|
38430
38546
|
return req.headers["next-router-prefetch"] === "1";
|
|
38431
38547
|
}
|
|
38432
38548
|
function isStaticAssetRequest(urlPath) {
|
|
38433
|
-
const
|
|
38434
|
-
if (
|
|
38549
|
+
const path7 = stripUrlQueryAndFragment(urlPath);
|
|
38550
|
+
if (path7.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
38435
38551
|
return true;
|
|
38436
38552
|
}
|
|
38437
|
-
if (
|
|
38553
|
+
if (path7.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
38438
38554
|
return true;
|
|
38439
38555
|
}
|
|
38440
38556
|
return false;
|
|
@@ -38443,7 +38559,7 @@ function shouldIgnoreSpansForIncomingRequest(request, {
|
|
|
38443
38559
|
ignoreStaticAssets,
|
|
38444
38560
|
ignoreSpansForIncomingRequests
|
|
38445
38561
|
}) {
|
|
38446
|
-
if (
|
|
38562
|
+
if (import_core34.isTracingSuppressed(import_api2.context.active())) {
|
|
38447
38563
|
return true;
|
|
38448
38564
|
}
|
|
38449
38565
|
const urlPath = request.url;
|
|
@@ -38464,7 +38580,7 @@ function shouldIgnoreSpansForIncomingRequest(request, {
|
|
|
38464
38580
|
var import_semantic_conventions2 = __toESM(require_src2(), 1);
|
|
38465
38581
|
var api = __toESM(require_src(), 1);
|
|
38466
38582
|
var import_api3 = __toESM(require_src(), 1);
|
|
38467
|
-
var
|
|
38583
|
+
var import_core37 = __toESM(require_src8(), 1);
|
|
38468
38584
|
var import_sdk_trace_base = __toESM(require_src10(), 1);
|
|
38469
38585
|
var SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE = "sentry.parentIsRemote";
|
|
38470
38586
|
var SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION = "sentry.graphql.operation";
|
|
@@ -38739,7 +38855,7 @@ function makeTraceState({
|
|
|
38739
38855
|
sampled
|
|
38740
38856
|
}) {
|
|
38741
38857
|
const dscString = dsc ? dynamicSamplingContextToSentryBaggageHeader(dsc) : undefined;
|
|
38742
|
-
const traceStateBase = new
|
|
38858
|
+
const traceStateBase = new import_core37.TraceState;
|
|
38743
38859
|
const traceStateWithDsc = dscString ? traceStateBase.set(SENTRY_TRACE_STATE_DSC, dscString) : traceStateBase;
|
|
38744
38860
|
return sampled === false ? traceStateWithDsc.set(SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING, "1") : traceStateWithDsc;
|
|
38745
38861
|
}
|
|
@@ -38751,14 +38867,14 @@ function setIsSetup(element) {
|
|
|
38751
38867
|
setupElements.add(element);
|
|
38752
38868
|
}
|
|
38753
38869
|
|
|
38754
|
-
class SentryPropagator extends
|
|
38870
|
+
class SentryPropagator extends import_core37.W3CBaggagePropagator {
|
|
38755
38871
|
constructor() {
|
|
38756
38872
|
super();
|
|
38757
38873
|
setIsSetup("SentryPropagator");
|
|
38758
38874
|
this._urlMatchesTargetsMap = new LRUMap(100);
|
|
38759
38875
|
}
|
|
38760
38876
|
inject(context4, carrier, setter) {
|
|
38761
|
-
if (
|
|
38877
|
+
if (import_core37.isTracingSuppressed(context4)) {
|
|
38762
38878
|
DEBUG_BUILD3 && debug.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");
|
|
38763
38879
|
return;
|
|
38764
38880
|
}
|
|
@@ -38925,7 +39041,7 @@ function startSpan2(options, callback) {
|
|
|
38925
39041
|
return wrapper(() => {
|
|
38926
39042
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38927
39043
|
const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
|
|
38928
|
-
const ctx = shouldSkipSpan ?
|
|
39044
|
+
const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
|
|
38929
39045
|
const spanOptions = getSpanOptions(options);
|
|
38930
39046
|
return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
|
|
38931
39047
|
return handleCallbackErrors(() => callback(span), () => {
|
|
@@ -38943,7 +39059,7 @@ function startSpanManual2(options, callback) {
|
|
|
38943
39059
|
return wrapper(() => {
|
|
38944
39060
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38945
39061
|
const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
|
|
38946
|
-
const ctx = shouldSkipSpan ?
|
|
39062
|
+
const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
|
|
38947
39063
|
const spanOptions = getSpanOptions(options);
|
|
38948
39064
|
return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
|
|
38949
39065
|
return handleCallbackErrors(() => callback(span, () => span.end()), () => {
|
|
@@ -38961,7 +39077,7 @@ function startInactiveSpan2(options) {
|
|
|
38961
39077
|
return wrapper(() => {
|
|
38962
39078
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38963
39079
|
const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
|
|
38964
|
-
const ctx = shouldSkipSpan ?
|
|
39080
|
+
const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
|
|
38965
39081
|
const spanOptions = getSpanOptions(options);
|
|
38966
39082
|
const span = tracer.startSpan(name, spanOptions, ctx);
|
|
38967
39083
|
return span;
|
|
@@ -39045,7 +39161,7 @@ function getActiveSpanWrapper2(parentSpan) {
|
|
|
39045
39161
|
} : (callback) => callback();
|
|
39046
39162
|
}
|
|
39047
39163
|
function suppressTracing2(callback) {
|
|
39048
|
-
const ctx =
|
|
39164
|
+
const ctx = import_core37.suppressTracing(import_api3.context.active());
|
|
39049
39165
|
return import_api3.context.with(ctx, callback);
|
|
39050
39166
|
}
|
|
39051
39167
|
function setupEventContextTrace(client) {
|
|
@@ -39702,7 +39818,7 @@ function wrapSamplingDecision({
|
|
|
39702
39818
|
function getBaseTraceState(context4, spanAttributes) {
|
|
39703
39819
|
const parentSpan = import_api3.trace.getSpan(context4);
|
|
39704
39820
|
const parentContext = parentSpan?.spanContext();
|
|
39705
|
-
let traceState = parentContext?.traceState || new
|
|
39821
|
+
let traceState = parentContext?.traceState || new import_core37.TraceState;
|
|
39706
39822
|
const url = spanAttributes[import_semantic_conventions2.SEMATTRS_HTTP_URL] || spanAttributes[import_semantic_conventions2.ATTR_URL_FULL];
|
|
39707
39823
|
if (url && typeof url === "string") {
|
|
39708
39824
|
traceState = traceState.set(SENTRY_TRACE_STATE_URL, url);
|
|
@@ -39813,8 +39929,8 @@ function getRequestOptions(request) {
|
|
|
39813
39929
|
function getRequestUrl2(request) {
|
|
39814
39930
|
const hostname = request.getHeader("host") || request.host;
|
|
39815
39931
|
const protocol = request.protocol;
|
|
39816
|
-
const
|
|
39817
|
-
return `${protocol}//${hostname}${
|
|
39932
|
+
const path7 = request.path;
|
|
39933
|
+
return `${protocol}//${hostname}${path7}`;
|
|
39818
39934
|
}
|
|
39819
39935
|
|
|
39820
39936
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/SentryHttpInstrumentation.js
|
|
@@ -39896,7 +40012,7 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
|
|
|
39896
40012
|
addTracePropagationHeadersToOutgoingRequest(request, this._propagationDecisionMap);
|
|
39897
40013
|
}
|
|
39898
40014
|
_shouldIgnoreOutgoingRequest(request) {
|
|
39899
|
-
if (
|
|
40015
|
+
if (import_core40.isTracingSuppressed(import_api4.context.active())) {
|
|
39900
40016
|
return true;
|
|
39901
40017
|
}
|
|
39902
40018
|
const ignoreOutgoingRequests = this.getConfig().ignoreOutgoingRequests;
|
|
@@ -39948,7 +40064,7 @@ var httpIntegration = defineIntegration((options = {}) => {
|
|
|
39948
40064
|
});
|
|
39949
40065
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js
|
|
39950
40066
|
var import_api5 = __toESM(require_src(), 1);
|
|
39951
|
-
var
|
|
40067
|
+
var import_core44 = __toESM(require_src8(), 1);
|
|
39952
40068
|
var import_instrumentation3 = __toESM(require_src6(), 1);
|
|
39953
40069
|
import * as diagch from "diagnostics_channel";
|
|
39954
40070
|
|
|
@@ -40068,7 +40184,7 @@ class SentryNodeFetchInstrumentation extends import_instrumentation3.Instrumenta
|
|
|
40068
40184
|
});
|
|
40069
40185
|
}
|
|
40070
40186
|
_shouldIgnoreOutgoingRequest(request) {
|
|
40071
|
-
if (
|
|
40187
|
+
if (import_core44.isTracingSuppressed(import_api5.context.active())) {
|
|
40072
40188
|
return true;
|
|
40073
40189
|
}
|
|
40074
40190
|
const url = getAbsoluteUrl2(request.origin, request.path);
|
|
@@ -40116,19 +40232,19 @@ function getBreadcrumbData2(request) {
|
|
|
40116
40232
|
return {};
|
|
40117
40233
|
}
|
|
40118
40234
|
}
|
|
40119
|
-
function getAbsoluteUrl2(origin,
|
|
40235
|
+
function getAbsoluteUrl2(origin, path7 = "/") {
|
|
40120
40236
|
try {
|
|
40121
|
-
const url = new URL(
|
|
40237
|
+
const url = new URL(path7, origin);
|
|
40122
40238
|
return url.toString();
|
|
40123
40239
|
} catch {
|
|
40124
40240
|
const url = `${origin}`;
|
|
40125
|
-
if (url.endsWith("/") &&
|
|
40126
|
-
return `${url}${
|
|
40241
|
+
if (url.endsWith("/") && path7.startsWith("/")) {
|
|
40242
|
+
return `${url}${path7.slice(1)}`;
|
|
40127
40243
|
}
|
|
40128
|
-
if (!url.endsWith("/") && !
|
|
40129
|
-
return `${url}/${
|
|
40244
|
+
if (!url.endsWith("/") && !path7.startsWith("/")) {
|
|
40245
|
+
return `${url}/${path7.slice(1)}`;
|
|
40130
40246
|
}
|
|
40131
|
-
return `${url}${
|
|
40247
|
+
return `${url}${path7}`;
|
|
40132
40248
|
}
|
|
40133
40249
|
}
|
|
40134
40250
|
|
|
@@ -40446,16 +40562,16 @@ function emplace(map, key, contents) {
|
|
|
40446
40562
|
}
|
|
40447
40563
|
return value;
|
|
40448
40564
|
}
|
|
40449
|
-
function shouldSkipContextLinesForFile(
|
|
40450
|
-
if (
|
|
40565
|
+
function shouldSkipContextLinesForFile(path7) {
|
|
40566
|
+
if (path7.startsWith("node:"))
|
|
40451
40567
|
return true;
|
|
40452
|
-
if (
|
|
40568
|
+
if (path7.endsWith(".min.js"))
|
|
40453
40569
|
return true;
|
|
40454
|
-
if (
|
|
40570
|
+
if (path7.endsWith(".min.cjs"))
|
|
40455
40571
|
return true;
|
|
40456
|
-
if (
|
|
40572
|
+
if (path7.endsWith(".min.mjs"))
|
|
40457
40573
|
return true;
|
|
40458
|
-
if (
|
|
40574
|
+
if (path7.startsWith("data:"))
|
|
40459
40575
|
return true;
|
|
40460
40576
|
return false;
|
|
40461
40577
|
}
|
|
@@ -40507,9 +40623,9 @@ function makeLineReaderRanges(lines, linecontext) {
|
|
|
40507
40623
|
}
|
|
40508
40624
|
return out;
|
|
40509
40625
|
}
|
|
40510
|
-
function getContextLinesFromFile(
|
|
40626
|
+
function getContextLinesFromFile(path7, ranges, output) {
|
|
40511
40627
|
return new Promise((resolve2, _reject) => {
|
|
40512
|
-
const stream = createReadStream(
|
|
40628
|
+
const stream = createReadStream(path7);
|
|
40513
40629
|
const lineReaded = createInterface({
|
|
40514
40630
|
input: stream
|
|
40515
40631
|
});
|
|
@@ -40527,8 +40643,8 @@ function getContextLinesFromFile(path6, ranges, output) {
|
|
|
40527
40643
|
let rangeStart = range[0];
|
|
40528
40644
|
let rangeEnd = range[1];
|
|
40529
40645
|
function onStreamError(e) {
|
|
40530
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
40531
|
-
DEBUG_BUILD2 && debug.error(`Failed to read file: ${
|
|
40646
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path7, 1);
|
|
40647
|
+
DEBUG_BUILD2 && debug.error(`Failed to read file: ${path7}. Error: ${e}`);
|
|
40532
40648
|
lineReaded.close();
|
|
40533
40649
|
lineReaded.removeAllListeners();
|
|
40534
40650
|
destroyStreamAndResolve();
|
|
@@ -41114,8 +41230,8 @@ function collectRequireModules() {
|
|
|
41114
41230
|
const paths = getRequireCachePaths();
|
|
41115
41231
|
const infos = {};
|
|
41116
41232
|
const seen = new Set;
|
|
41117
|
-
paths.forEach((
|
|
41118
|
-
let dir =
|
|
41233
|
+
paths.forEach((path7) => {
|
|
41234
|
+
let dir = path7;
|
|
41119
41235
|
const updir = () => {
|
|
41120
41236
|
const orig = dir;
|
|
41121
41237
|
dir = dirname2(orig);
|
|
@@ -41888,8 +42004,8 @@ function envToBool(value, options) {
|
|
|
41888
42004
|
|
|
41889
42005
|
// ../../node_modules/@sentry/node-core/build/esm/utils/module.js
|
|
41890
42006
|
import { posix, sep } from "node:path";
|
|
41891
|
-
function normalizeWindowsPath(
|
|
41892
|
-
return
|
|
42007
|
+
function normalizeWindowsPath(path7) {
|
|
42008
|
+
return path7.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
41893
42009
|
}
|
|
41894
42010
|
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
41895
42011
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
@@ -42300,15 +42416,15 @@ var _nativeNodeFetchIntegration2 = (options = {}) => {
|
|
|
42300
42416
|
};
|
|
42301
42417
|
};
|
|
42302
42418
|
var nativeNodeFetchIntegration2 = defineIntegration(_nativeNodeFetchIntegration2);
|
|
42303
|
-
function getAbsoluteUrl3(origin,
|
|
42419
|
+
function getAbsoluteUrl3(origin, path7 = "/") {
|
|
42304
42420
|
const url = `${origin}`;
|
|
42305
|
-
if (url.endsWith("/") &&
|
|
42306
|
-
return `${url}${
|
|
42421
|
+
if (url.endsWith("/") && path7.startsWith("/")) {
|
|
42422
|
+
return `${url}${path7.slice(1)}`;
|
|
42307
42423
|
}
|
|
42308
|
-
if (!url.endsWith("/") && !
|
|
42309
|
-
return `${url}/${
|
|
42424
|
+
if (!url.endsWith("/") && !path7.startsWith("/")) {
|
|
42425
|
+
return `${url}/${path7.slice(1)}`;
|
|
42310
42426
|
}
|
|
42311
|
-
return `${url}${
|
|
42427
|
+
return `${url}${path7}`;
|
|
42312
42428
|
}
|
|
42313
42429
|
function _shouldInstrumentSpans(options, clientOptions = {}) {
|
|
42314
42430
|
return typeof options.spans === "boolean" ? options.spans : !clientOptions.skipOpenTelemetrySetup && hasSpansEnabled(clientOptions);
|
|
@@ -42382,7 +42498,7 @@ import * as dc from "node:diagnostics_channel";
|
|
|
42382
42498
|
|
|
42383
42499
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/fastify-otel/index.js
|
|
42384
42500
|
var import_api10 = __toESM(require_src(), 1);
|
|
42385
|
-
var
|
|
42501
|
+
var import_core71 = __toESM(require_src8(), 1);
|
|
42386
42502
|
var import_instrumentation5 = __toESM(require_src6(), 1);
|
|
42387
42503
|
var import_semantic_conventions3 = __toESM(require_src2(), 1);
|
|
42388
42504
|
import dc__default from "node:diagnostics_channel";
|
|
@@ -42978,11 +43094,11 @@ var qmarksTestNoExtDot = ([$0]) => {
|
|
|
42978
43094
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
42979
43095
|
};
|
|
42980
43096
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
42981
|
-
var
|
|
43097
|
+
var path7 = {
|
|
42982
43098
|
win32: { sep: "\\" },
|
|
42983
43099
|
posix: { sep: "/" }
|
|
42984
43100
|
};
|
|
42985
|
-
var sep2 = defaultPlatform === "win32" ?
|
|
43101
|
+
var sep2 = defaultPlatform === "win32" ? path7.win32.sep : path7.posix.sep;
|
|
42986
43102
|
minimatch.sep = sep2;
|
|
42987
43103
|
var GLOBSTAR = Symbol("globstar **");
|
|
42988
43104
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -43767,8 +43883,8 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43767
43883
|
if (import_api10.trace.getSpan(ctx) == null) {
|
|
43768
43884
|
ctx = import_api10.propagation.extract(ctx, request2.headers);
|
|
43769
43885
|
}
|
|
43770
|
-
const rpcMetadata =
|
|
43771
|
-
if (request2.routeOptions.url != null && rpcMetadata?.type ===
|
|
43886
|
+
const rpcMetadata = import_core71.getRPCMetadata(ctx);
|
|
43887
|
+
if (request2.routeOptions.url != null && rpcMetadata?.type === import_core71.RPCType.HTTP) {
|
|
43772
43888
|
rpcMetadata.route = request2.routeOptions.url;
|
|
43773
43889
|
}
|
|
43774
43890
|
const span = this[kInstrumentation].tracer.startSpan("request", {
|
|
@@ -43928,7 +44044,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43928
44044
|
|
|
43929
44045
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/instrumentation.js
|
|
43930
44046
|
var import_api12 = __toESM(require_src(), 1);
|
|
43931
|
-
var
|
|
44047
|
+
var import_core72 = __toESM(require_src8(), 1);
|
|
43932
44048
|
var import_instrumentation6 = __toESM(require_src6(), 1);
|
|
43933
44049
|
var import_semantic_conventions4 = __toESM(require_src2(), 1);
|
|
43934
44050
|
|
|
@@ -44053,9 +44169,9 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
|
|
|
44053
44169
|
}
|
|
44054
44170
|
instrumentation._wrap(reply, "send", instrumentation._patchSend());
|
|
44055
44171
|
const anyRequest = request2;
|
|
44056
|
-
const rpcMetadata =
|
|
44172
|
+
const rpcMetadata = import_core72.getRPCMetadata(import_api12.context.active());
|
|
44057
44173
|
const routeName = anyRequest.routeOptions ? anyRequest.routeOptions.url : request2.routerPath;
|
|
44058
|
-
if (routeName && rpcMetadata?.type ===
|
|
44174
|
+
if (routeName && rpcMetadata?.type === import_core72.RPCType.HTTP) {
|
|
44059
44175
|
rpcMetadata.route = routeName;
|
|
44060
44176
|
}
|
|
44061
44177
|
const method = request2.method || "GET";
|
|
@@ -44717,9 +44833,9 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
|
|
|
44717
44833
|
}
|
|
44718
44834
|
init() {
|
|
44719
44835
|
const instrumentationModule = new import_instrumentation8.InstrumentationNodeModuleDefinition("postgres", SUPPORTED_VERSIONS2);
|
|
44720
|
-
["src", "cf/src", "cjs/src"].forEach((
|
|
44721
|
-
instrumentationModule.files.push(new import_instrumentation8.InstrumentationNodeModuleFile(`postgres/${
|
|
44722
|
-
instrumentationModule.files.push(new import_instrumentation8.InstrumentationNodeModuleFile(`postgres/${
|
|
44836
|
+
["src", "cf/src", "cjs/src"].forEach((path8) => {
|
|
44837
|
+
instrumentationModule.files.push(new import_instrumentation8.InstrumentationNodeModuleFile(`postgres/${path8}/connection.js`, ["*"], this._patchConnection.bind(this), this._unwrap.bind(this)));
|
|
44838
|
+
instrumentationModule.files.push(new import_instrumentation8.InstrumentationNodeModuleFile(`postgres/${path8}/query.js`, SUPPORTED_VERSIONS2, this._patchQuery.bind(this), this._unwrap.bind(this)));
|
|
44723
44839
|
});
|
|
44724
44840
|
return [instrumentationModule];
|
|
44725
44841
|
}
|
|
@@ -45902,11 +46018,7 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
|
|
|
45902
46018
|
return client;
|
|
45903
46019
|
}
|
|
45904
46020
|
// src/index.ts
|
|
45905
|
-
import {
|
|
45906
|
-
createDatabaseAdapter,
|
|
45907
|
-
DatabaseMigrationService,
|
|
45908
|
-
plugin as sqlPlugin
|
|
45909
|
-
} from "@elizaos/plugin-sql";
|
|
46021
|
+
import sqlPlugin, { createDatabaseAdapter, DatabaseMigrationService } from "@elizaos/plugin-sql";
|
|
45910
46022
|
import { existsSync as existsSync4 } from "node:fs";
|
|
45911
46023
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
45912
46024
|
function expandTildePath(filepath) {
|
|
@@ -45917,11 +46029,11 @@ function expandTildePath(filepath) {
|
|
|
45917
46029
|
if (filepath === "~") {
|
|
45918
46030
|
return process.cwd();
|
|
45919
46031
|
} else if (filepath.startsWith("~/")) {
|
|
45920
|
-
return
|
|
46032
|
+
return path8.join(process.cwd(), filepath.slice(2));
|
|
45921
46033
|
} else if (filepath.startsWith("~~")) {
|
|
45922
46034
|
return filepath;
|
|
45923
46035
|
} else {
|
|
45924
|
-
return
|
|
46036
|
+
return path8.join(process.cwd(), filepath.slice(1));
|
|
45925
46037
|
}
|
|
45926
46038
|
}
|
|
45927
46039
|
return filepath;
|
|
@@ -45931,10 +46043,17 @@ function resolvePgliteDir(dir, fallbackDir) {
|
|
|
45931
46043
|
if (existsSync4(envPath)) {
|
|
45932
46044
|
import_dotenv2.default.config({ path: envPath });
|
|
45933
46045
|
}
|
|
45934
|
-
|
|
45935
|
-
|
|
45936
|
-
|
|
45937
|
-
|
|
46046
|
+
if (dir) {
|
|
46047
|
+
const resolved2 = expandTildePath(dir);
|
|
46048
|
+
process.env.PGLITE_DATA_DIR = resolved2;
|
|
46049
|
+
return resolved2;
|
|
46050
|
+
}
|
|
46051
|
+
if (fallbackDir && !process.env.PGLITE_DATA_DIR && !process.env.ELIZA_DATABASE_DIR) {
|
|
46052
|
+
const resolved2 = expandTildePath(fallbackDir);
|
|
46053
|
+
process.env.PGLITE_DATA_DIR = resolved2;
|
|
46054
|
+
return resolved2;
|
|
46055
|
+
}
|
|
46056
|
+
const resolved = getDatabaseDir();
|
|
45938
46057
|
process.env.PGLITE_DATA_DIR = resolved;
|
|
45939
46058
|
return resolved;
|
|
45940
46059
|
}
|
|
@@ -46176,8 +46295,8 @@ class AgentServer {
|
|
|
46176
46295
|
logger30.info("Web UI disabled for security (production mode)");
|
|
46177
46296
|
}
|
|
46178
46297
|
}
|
|
46179
|
-
const uploadsBasePath =
|
|
46180
|
-
const generatedBasePath =
|
|
46298
|
+
const uploadsBasePath = getUploadsAgentsDir4();
|
|
46299
|
+
const generatedBasePath = getGeneratedDir2();
|
|
46181
46300
|
fs6.mkdirSync(uploadsBasePath, { recursive: true });
|
|
46182
46301
|
fs6.mkdirSync(generatedBasePath, { recursive: true });
|
|
46183
46302
|
this.app.get("/media/uploads/agents/:agentId/:filename", (req, res) => {
|
|
@@ -46227,9 +46346,22 @@ class AgentServer {
|
|
|
46227
46346
|
res.status(403).json({ error: "Access denied" });
|
|
46228
46347
|
return;
|
|
46229
46348
|
}
|
|
46230
|
-
|
|
46349
|
+
if (!existsSync4(filePath)) {
|
|
46350
|
+
res.status(404).json({ error: "File not found" });
|
|
46351
|
+
return;
|
|
46352
|
+
}
|
|
46353
|
+
const absolutePath = path8.resolve(filePath);
|
|
46354
|
+
const options2 = {
|
|
46355
|
+
dotfiles: "deny"
|
|
46356
|
+
};
|
|
46357
|
+
res.sendFile(absolutePath, options2, (err) => {
|
|
46231
46358
|
if (err) {
|
|
46232
|
-
|
|
46359
|
+
const ext2 = extname(filename).toLowerCase();
|
|
46360
|
+
const mimeType = ext2 === ".png" ? "image/png" : ext2 === ".jpg" || ext2 === ".jpeg" ? "image/jpeg" : "application/octet-stream";
|
|
46361
|
+
res.setHeader("Content-Type", mimeType);
|
|
46362
|
+
const stream = fs6.createReadStream(absolutePath);
|
|
46363
|
+
stream.on("error", () => res.status(404).json({ error: "File not found" }));
|
|
46364
|
+
stream.pipe(res);
|
|
46233
46365
|
}
|
|
46234
46366
|
});
|
|
46235
46367
|
});
|
|
@@ -46299,11 +46431,11 @@ class AgentServer {
|
|
|
46299
46431
|
if (this.isWebUIEnabled) {
|
|
46300
46432
|
const possiblePaths = [
|
|
46301
46433
|
this.clientPath,
|
|
46302
|
-
|
|
46303
|
-
|
|
46434
|
+
path8.resolve(__dirname3, "client"),
|
|
46435
|
+
path8.resolve(__dirname3, "../../client/dist"),
|
|
46304
46436
|
(() => {
|
|
46305
46437
|
try {
|
|
46306
|
-
return
|
|
46438
|
+
return path8.resolve(path8.dirname(__require.resolve("@elizaos/client/package.json")), "dist");
|
|
46307
46439
|
} catch {
|
|
46308
46440
|
return null;
|
|
46309
46441
|
}
|
|
@@ -46311,12 +46443,12 @@ class AgentServer {
|
|
|
46311
46443
|
(() => {
|
|
46312
46444
|
try {
|
|
46313
46445
|
if (process.argv[1]) {
|
|
46314
|
-
const serverPath =
|
|
46315
|
-
const possibleClientPath =
|
|
46316
|
-
if (existsSync4(
|
|
46446
|
+
const serverPath = path8.dirname(process.argv[1]);
|
|
46447
|
+
const possibleClientPath = path8.join(serverPath, "client");
|
|
46448
|
+
if (existsSync4(path8.join(possibleClientPath, "index.html"))) {
|
|
46317
46449
|
return possibleClientPath;
|
|
46318
46450
|
}
|
|
46319
|
-
if (existsSync4(
|
|
46451
|
+
if (existsSync4(path8.join(serverPath, "index.html"))) {
|
|
46320
46452
|
return serverPath;
|
|
46321
46453
|
}
|
|
46322
46454
|
}
|
|
@@ -46325,8 +46457,8 @@ class AgentServer {
|
|
|
46325
46457
|
})(),
|
|
46326
46458
|
(() => {
|
|
46327
46459
|
try {
|
|
46328
|
-
const bunGlobalPath =
|
|
46329
|
-
if (existsSync4(
|
|
46460
|
+
const bunGlobalPath = path8.join(os3.homedir(), ".bun/install/global/node_modules/@elizaos/server/dist/client");
|
|
46461
|
+
if (existsSync4(path8.join(bunGlobalPath, "index.html"))) {
|
|
46330
46462
|
return bunGlobalPath;
|
|
46331
46463
|
}
|
|
46332
46464
|
try {
|
|
@@ -46336,8 +46468,8 @@ class AgentServer {
|
|
|
46336
46468
|
});
|
|
46337
46469
|
if (proc.exitCode === 0 && proc.stdout) {
|
|
46338
46470
|
const npmRoot = new TextDecoder().decode(proc.stdout).trim();
|
|
46339
|
-
const globalServerPath =
|
|
46340
|
-
if (existsSync4(
|
|
46471
|
+
const globalServerPath = path8.join(npmRoot, "@elizaos/server/dist/client");
|
|
46472
|
+
if (existsSync4(path8.join(globalServerPath, "index.html"))) {
|
|
46341
46473
|
return globalServerPath;
|
|
46342
46474
|
}
|
|
46343
46475
|
}
|
|
@@ -46348,15 +46480,15 @@ class AgentServer {
|
|
|
46348
46480
|
...[
|
|
46349
46481
|
"/usr/local/lib/node_modules/@elizaos/server/dist/client",
|
|
46350
46482
|
"/usr/lib/node_modules/@elizaos/server/dist/client",
|
|
46351
|
-
|
|
46483
|
+
path8.join(os3.homedir(), ".npm-global/lib/node_modules/@elizaos/server/dist/client"),
|
|
46352
46484
|
(() => {
|
|
46353
46485
|
try {
|
|
46354
|
-
const nvmPath =
|
|
46486
|
+
const nvmPath = path8.join(os3.homedir(), ".nvm/versions/node");
|
|
46355
46487
|
if (existsSync4(nvmPath)) {
|
|
46356
46488
|
const versions = fs6.readdirSync(nvmPath);
|
|
46357
46489
|
for (const version of versions) {
|
|
46358
|
-
const cliPath =
|
|
46359
|
-
if (existsSync4(
|
|
46490
|
+
const cliPath = path8.join(nvmPath, version, "lib/node_modules/@elizaos/server/dist/client");
|
|
46491
|
+
if (existsSync4(path8.join(cliPath, "index.html"))) {
|
|
46360
46492
|
return cliPath;
|
|
46361
46493
|
}
|
|
46362
46494
|
}
|
|
@@ -46370,7 +46502,7 @@ class AgentServer {
|
|
|
46370
46502
|
logger30.debug(`[STATIC] process.argv[1]: ${process.argv[1]}`);
|
|
46371
46503
|
logger30.debug(`[STATIC] __dirname: ${__dirname3}`);
|
|
46372
46504
|
for (const possiblePath of possiblePaths) {
|
|
46373
|
-
if (possiblePath && existsSync4(
|
|
46505
|
+
if (possiblePath && existsSync4(path8.join(possiblePath, "index.html"))) {
|
|
46374
46506
|
clientPath = possiblePath;
|
|
46375
46507
|
logger30.info(`[STATIC] Found client files at: ${clientPath}`);
|
|
46376
46508
|
break;
|
|
@@ -46459,7 +46591,7 @@ class AgentServer {
|
|
|
46459
46591
|
}
|
|
46460
46592
|
const resolvedClientPath = clientPath || this.clientPath;
|
|
46461
46593
|
if (resolvedClientPath) {
|
|
46462
|
-
const indexFilePath =
|
|
46594
|
+
const indexFilePath = path8.join(resolvedClientPath, "index.html");
|
|
46463
46595
|
if (!existsSync4(indexFilePath)) {
|
|
46464
46596
|
logger30.error(`[STATIC] index.html not found at expected path: ${indexFilePath}`);
|
|
46465
46597
|
logger30.error(`[STATIC] Client path was: ${resolvedClientPath}`);
|