nyxora 1.4.6 → 1.4.8
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/README.md +4 -4
- package/dist/system/pluginManager.js +34 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
**Secure AI execution framework for Web3 agents.**
|
|
3
3
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](
|
|
6
|
-
[](
|
|
7
|
-
[](
|
|
5
|
+
[](#️-security-threat-model--permission-boundary)
|
|
6
|
+
[](#📐-architecture-workflow)
|
|
7
|
+
[](#️-security-threat-model--permission-boundary)
|
|
8
8
|
|
|
9
9
|
Nyxora is a **secure, non-custodial runtime infrastructure for autonomous onchain agents** built with Node.js and React. Designed for autonomous workflows with a premium Glassmorphism UI dashboard and strict client-side key isolation. It operates under a strict **Human-in-the-Loop** execution model for financial transactions.
|
|
10
10
|
|
|
@@ -73,7 +73,7 @@ npm run build && npm run start
|
|
|
73
73
|
|
|
74
74
|
For complete technical deep-dives, please visit our official VitePress Documentation Site!
|
|
75
75
|
|
|
76
|
-
> **🔗 [Read the Full Nyxora Documentation Here](
|
|
76
|
+
> **🔗 [Read the Full Nyxora Documentation Here](https://perasyudha.github.io/Nyxora/)**
|
|
77
77
|
|
|
78
78
|
*(Includes guides on Secure Wallet Imports, API Key Rotations, Troubleshooting, and Custom Skill Development).*
|
|
79
79
|
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.pluginManager = exports.PluginManager = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const vm_1 = __importDefault(require("vm"));
|
|
9
10
|
class PluginManager {
|
|
10
11
|
skills = new Map();
|
|
11
12
|
async loadPlugins() {
|
|
@@ -18,20 +19,43 @@ class PluginManager {
|
|
|
18
19
|
for (const file of files) {
|
|
19
20
|
if (file.endsWith('.js') || file.endsWith('.ts')) {
|
|
20
21
|
try {
|
|
21
|
-
// Dynamic import requires relative path from this file or absolute path
|
|
22
|
-
// For TS compiled to JS, absolute path is safer
|
|
23
22
|
const absolutePath = path_1.default.resolve(pluginsDir, file);
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const code = fs_1.default.readFileSync(absolutePath, 'utf8');
|
|
24
|
+
// Construct a restricted require function for the sandbox
|
|
25
|
+
const restrictedRequire = (moduleName) => {
|
|
26
|
+
const blockedModules = ['fs', 'child_process', 'os', 'net', 'tls', 'cluster', 'worker_threads'];
|
|
27
|
+
if (blockedModules.includes(moduleName)) {
|
|
28
|
+
throw new Error(`Sandboxing error: Access to the '${moduleName}' module is blocked for security reasons.`);
|
|
29
|
+
}
|
|
30
|
+
// Allow fetch and other safe modules by delegating to actual require
|
|
31
|
+
return require(moduleName);
|
|
32
|
+
};
|
|
33
|
+
// Create the sandbox environment
|
|
34
|
+
const sandbox = {
|
|
35
|
+
require: restrictedRequire,
|
|
36
|
+
console: console,
|
|
37
|
+
module: { exports: {} },
|
|
38
|
+
exports: {},
|
|
39
|
+
process: { env: {} }, // Hide actual environment variables
|
|
40
|
+
Buffer: Buffer,
|
|
41
|
+
setTimeout: setTimeout,
|
|
42
|
+
clearTimeout: clearTimeout,
|
|
43
|
+
setInterval: setInterval,
|
|
44
|
+
clearInterval: clearInterval,
|
|
45
|
+
};
|
|
46
|
+
const context = vm_1.default.createContext(sandbox);
|
|
47
|
+
const script = new vm_1.default.Script(code, { filename: file });
|
|
48
|
+
// Execute the plugin code inside the VM
|
|
49
|
+
script.runInContext(context);
|
|
50
|
+
const moduleExports = sandbox.module.exports;
|
|
51
|
+
if (moduleExports.toolDefinition && moduleExports.execute) {
|
|
52
|
+
const toolName = moduleExports.toolDefinition.function.name;
|
|
53
|
+
this.skills.set(toolName, moduleExports);
|
|
54
|
+
console.log(`[PluginManager] Loaded sandboxed external skill: ${toolName}`);
|
|
31
55
|
}
|
|
32
56
|
}
|
|
33
57
|
catch (error) {
|
|
34
|
-
console.error(`[PluginManager] Failed to load plugin ${file}:`, error);
|
|
58
|
+
console.error(`[PluginManager] Failed to load sandboxed plugin ${file}:`, error.message);
|
|
35
59
|
}
|
|
36
60
|
}
|
|
37
61
|
}
|