@mindexec/cli 0.2.96 → 0.2.97
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/package.json +2 -2
- package/server.js +64 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindexec/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.97",
|
|
4
4
|
"description": "MindExec local runtime and bridge CLI",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"type": "module",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"node": ">=20"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@mindexec/remote": "^0.1.15",
|
|
50
|
+
"@mindexec/remote": "^0.1.15",
|
|
51
51
|
"@openai/codex-sdk": "^0.137.0",
|
|
52
52
|
"chokidar": "^3.6.0",
|
|
53
53
|
"cors": "^2.8.5",
|
package/server.js
CHANGED
|
@@ -2993,15 +2993,72 @@ function resolveRemoteAgentLauncher() {
|
|
|
2993
2993
|
// Fall back to npx for source checkouts or older package installs.
|
|
2994
2994
|
}
|
|
2995
2995
|
|
|
2996
|
-
const
|
|
2996
|
+
const npxCli = resolveNpxCliLauncher();
|
|
2997
|
+
if (npxCli) {
|
|
2998
|
+
return {
|
|
2999
|
+
command: process.execPath,
|
|
3000
|
+
argsPrefix: [npxCli, '-y', '@mindexec/remote@latest'],
|
|
3001
|
+
launcher: npxCli,
|
|
3002
|
+
usingNpx: true
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
if (process.platform === 'win32') {
|
|
3007
|
+
return {
|
|
3008
|
+
command: process.env.ComSpec || 'cmd.exe',
|
|
3009
|
+
argsPrefix: ['/d', '/s', '/c', 'npx.cmd', '-y', '@mindexec/remote@latest'],
|
|
3010
|
+
launcher: 'cmd.exe /c npx.cmd',
|
|
3011
|
+
usingNpx: true
|
|
3012
|
+
};
|
|
3013
|
+
}
|
|
3014
|
+
|
|
2997
3015
|
return {
|
|
2998
|
-
command:
|
|
3016
|
+
command: 'npx',
|
|
2999
3017
|
argsPrefix: ['-y', '@mindexec/remote@latest'],
|
|
3000
|
-
launcher:
|
|
3018
|
+
launcher: 'npx',
|
|
3001
3019
|
usingNpx: true
|
|
3002
3020
|
};
|
|
3003
3021
|
}
|
|
3004
3022
|
|
|
3023
|
+
function resolveNpxCliLauncher() {
|
|
3024
|
+
const candidates = [];
|
|
3025
|
+
const npmExecPath = String(process.env.npm_execpath || '').trim();
|
|
3026
|
+
if (npmExecPath) {
|
|
3027
|
+
const normalized = npmExecPath.replace(/\\/g, '/');
|
|
3028
|
+
if (/\/npx-cli\.js$/i.test(normalized)) {
|
|
3029
|
+
candidates.push(npmExecPath);
|
|
3030
|
+
} else if (/\/npm-cli\.js$/i.test(normalized)) {
|
|
3031
|
+
candidates.push(path.join(path.dirname(npmExecPath), 'npx-cli.js'));
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
const nodeRoot = path.dirname(process.execPath);
|
|
3036
|
+
candidates.push(
|
|
3037
|
+
path.join(nodeRoot, 'node_modules', 'npm', 'bin', 'npx-cli.js'),
|
|
3038
|
+
path.join(BRIDGE_ROOT, 'node_modules', 'npm', 'bin', 'npx-cli.js')
|
|
3039
|
+
);
|
|
3040
|
+
|
|
3041
|
+
const seen = new Set();
|
|
3042
|
+
for (const candidate of candidates) {
|
|
3043
|
+
const resolved = path.resolve(candidate);
|
|
3044
|
+
const key = resolved.toLowerCase();
|
|
3045
|
+
if (seen.has(key)) {
|
|
3046
|
+
continue;
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
seen.add(key);
|
|
3050
|
+
try {
|
|
3051
|
+
if (statSync(resolved).isFile()) {
|
|
3052
|
+
return resolved;
|
|
3053
|
+
}
|
|
3054
|
+
} catch {
|
|
3055
|
+
// Try the next possible npm installation.
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
return '';
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3005
3062
|
async function stopRemoteAgentConnection(reason = 'stopped') {
|
|
3006
3063
|
const previous = remoteAgentState;
|
|
3007
3064
|
if (previous.proc) {
|
|
@@ -3156,6 +3213,10 @@ async function startRemoteAgentConnectionAttempt(options = {}) {
|
|
|
3156
3213
|
|
|
3157
3214
|
let child;
|
|
3158
3215
|
try {
|
|
3216
|
+
logEvent(
|
|
3217
|
+
'remote',
|
|
3218
|
+
`managed RemoteAgent launch ${formatKeyValue('launcher', launcher.launcher)} ${formatKeyValue('manager', manager)}`,
|
|
3219
|
+
'remote');
|
|
3159
3220
|
child = spawn(launcher.command, args, {
|
|
3160
3221
|
cwd: BRIDGE_ROOT,
|
|
3161
3222
|
stdio: ['ignore', 'pipe', 'pipe'],
|