trace-sec 2.1.5 → 2.1.6
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/bin/trace.js +43 -1
- package/package.json +1 -1
package/bin/trace.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Node.js & NPX launcher for TRACE Python engine.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { spawn } from 'child_process';
|
|
8
|
+
import { spawn, execSync } from 'child_process';
|
|
9
9
|
import { existsSync, mkdirSync, cpSync, writeFileSync } from 'fs';
|
|
10
10
|
import { resolve, join, dirname } from 'path';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
@@ -102,6 +102,48 @@ for (const cand of candidatePythons) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
// Verify that the resolved Python environment has required TRACE dependencies
|
|
106
|
+
let depsOk = false;
|
|
107
|
+
try {
|
|
108
|
+
execSync(`"${pythonBin}" -c "import typer, rich, pydantic"`, { stdio: 'ignore' });
|
|
109
|
+
depsOk = true;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
depsOk = false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!depsOk) {
|
|
115
|
+
const dedicatedVenv = join(userHome, '.trace', 'venv');
|
|
116
|
+
const venvPython = join(dedicatedVenv, isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python');
|
|
117
|
+
|
|
118
|
+
if (existsSync(venvPython)) {
|
|
119
|
+
try {
|
|
120
|
+
execSync(`"${venvPython}" -c "import typer, rich, pydantic"`, { stdio: 'ignore' });
|
|
121
|
+
pythonBin = venvPython;
|
|
122
|
+
depsOk = true;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
depsOk = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!depsOk) {
|
|
129
|
+
console.log('\n\x1b[32m\x1b[1m[TRACE]\x1b[0m Initializing TRACE runtime dependencies in dedicated environment (~/.trace/venv)...');
|
|
130
|
+
try {
|
|
131
|
+
mkdirSync(join(userHome, '.trace'), { recursive: true });
|
|
132
|
+
if (!existsSync(venvPython)) {
|
|
133
|
+
console.log(' \x1b[38;2;255;158;59m›\x1b[0m Creating Python virtual environment in ~/.trace/venv...');
|
|
134
|
+
execSync(`"${pythonBin}" -m venv "${dedicatedVenv}"`, { stdio: 'inherit' });
|
|
135
|
+
}
|
|
136
|
+
console.log(' \x1b[38;2;255;158;59m›\x1b[0m Installing core dependencies (typer, rich, pydantic, tree-sitter, torch, transformers)...');
|
|
137
|
+
execSync(`"${venvPython}" -m pip install typer rich pydantic pydantic-settings networkx httpx orjson tomli-w tree-sitter tree-sitter-language-pack torch transformers safetensors onnxruntime numpy`, { stdio: 'inherit' });
|
|
138
|
+
pythonBin = venvPython;
|
|
139
|
+
console.log('\x1b[32m✓ Runtime dependencies provisioned successfully.\x1b[0m\n');
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.warn(`[TRACE] Automatic environment setup warning: ${e.message}`);
|
|
142
|
+
console.warn(`If command fails, install directly via: pip install git+https://github.com/VK-Amogh/TRACE.git\n`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
105
147
|
const cliArgs = ['-m', 'trace_engine.cli', ...args];
|
|
106
148
|
|
|
107
149
|
const proc = spawn(pythonBin, cliArgs, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trace-sec",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Threat Reconnaissance & Attack-path Correlation Engine — Security Verification Layer for Coding Agents with Fine-Tuned SecureBERT 2.0 & Laya AI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/trace.js",
|