agentgui 1.0.607 → 1.0.608
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/lib/acp-sdk-manager.js +9 -6
- package/package.json +1 -1
package/lib/acp-sdk-manager.js
CHANGED
|
@@ -26,11 +26,14 @@ let shuttingDown = false;
|
|
|
26
26
|
|
|
27
27
|
function log(msg) { console.log('[ACP-SDK] ' + msg); }
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function resolveCommand(tool) {
|
|
30
30
|
const ext = isWindows ? '.cmd' : '';
|
|
31
|
-
const localBin = path.join(projectRoot, 'node_modules', '.bin', cmd + ext);
|
|
32
|
-
if (fs.existsSync(localBin)) return localBin;
|
|
33
|
-
|
|
31
|
+
const localBin = path.join(projectRoot, 'node_modules', '.bin', tool.cmd + ext);
|
|
32
|
+
if (fs.existsSync(localBin)) return { bin: localBin, args: tool.args };
|
|
33
|
+
const bunx = path.join(projectRoot, 'node_modules', '.bin', 'bunx' + ext);
|
|
34
|
+
const runner = fs.existsSync(bunx) ? bunx : 'bunx';
|
|
35
|
+
if (tool.npxPkg) return { bin: runner, args: [tool.npxPkg, ...tool.args] };
|
|
36
|
+
return { bin: tool.cmd, args: tool.args };
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
function startProcess(tool) {
|
|
@@ -38,7 +41,7 @@ function startProcess(tool) {
|
|
|
38
41
|
const existing = processes.get(tool.id);
|
|
39
42
|
if (existing?.process && !existing.process.killed) return existing;
|
|
40
43
|
|
|
41
|
-
const
|
|
44
|
+
const resolved = resolveCommand(tool);
|
|
42
45
|
const entry = {
|
|
43
46
|
id: tool.id,
|
|
44
47
|
port: tool.port,
|
|
@@ -55,7 +58,7 @@ function startProcess(tool) {
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
try {
|
|
58
|
-
entry.process = spawn(
|
|
61
|
+
entry.process = spawn(resolved.bin, resolved.args, {
|
|
59
62
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
60
63
|
detached: false
|
|
61
64
|
});
|