@openagents-org/agent-launcher 0.2.22 → 0.2.24
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 +1 -1
- package/src/adapters/openclaw.js +23 -6
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
const path = require('path');
|
|
16
|
+
const os = require('os');
|
|
16
17
|
const { spawn, execSync } = require('child_process');
|
|
17
18
|
|
|
18
19
|
const BaseAdapter = require('./base');
|
|
@@ -211,15 +212,31 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
211
212
|
};
|
|
212
213
|
|
|
213
214
|
if (IS_WINDOWS) {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
|
|
215
|
+
// Find node.exe to spawn openclaw.mjs directly (unbuffered stderr)
|
|
216
|
+
const portableNodeDir = path.join(os.homedir(), '.openagents', 'nodejs');
|
|
217
|
+
const searchDirs = [portableNodeDir];
|
|
218
|
+
try { const { getExtraBinDirs } = require('../paths'); searchDirs.push(...getExtraBinDirs()); } catch {}
|
|
219
|
+
let nodeBin = null;
|
|
220
|
+
for (const d of searchDirs) {
|
|
221
|
+
const candidate = path.join(d, 'node.exe');
|
|
222
|
+
if (fs.existsSync(candidate)) { nodeBin = candidate; break; }
|
|
223
|
+
}
|
|
224
|
+
// Find openclaw entry point
|
|
225
|
+
const possibleEntries = [
|
|
226
|
+
path.join(path.dirname(binary), 'node_modules', 'openclaw', 'openclaw.mjs'),
|
|
227
|
+
path.join(os.homedir(), '.openagents', 'nodejs', 'node_modules', 'openclaw', 'openclaw.mjs'),
|
|
228
|
+
];
|
|
229
|
+
let entryPoint = null;
|
|
230
|
+
for (const e of possibleEntries) {
|
|
231
|
+
if (fs.existsSync(e)) { entryPoint = e; break; }
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (nodeBin && entryPoint) {
|
|
235
|
+
// Direct spawn — unbuffered stderr for real-time tool streaming
|
|
219
236
|
spawnBinary = nodeBin;
|
|
220
237
|
spawnArgs = [entryPoint, ...args];
|
|
221
238
|
} else {
|
|
222
|
-
// Fallback to cmd.exe (buffered stderr)
|
|
239
|
+
// Fallback to cmd.exe (buffered stderr — no real-time status)
|
|
223
240
|
spawnBinary = process.env.COMSPEC || 'cmd.exe';
|
|
224
241
|
const quotedArgs = args.map((a) => a.includes(' ') ? `"${a}"` : a);
|
|
225
242
|
spawnArgs = ['/C', binary, ...quotedArgs];
|