@openagents-org/agent-launcher 0.2.21 → 0.2.23
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 +29 -3
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,9 +212,34 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
211
212
|
};
|
|
212
213
|
|
|
213
214
|
if (IS_WINDOWS) {
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
215
|
+
// Find node.exe to spawn openclaw.mjs directly (unbuffered stderr)
|
|
216
|
+
const { getExtraBinDirs } = require('../paths');
|
|
217
|
+
const extraDirs = getExtraBinDirs();
|
|
218
|
+
let nodeBin = null;
|
|
219
|
+
for (const d of extraDirs) {
|
|
220
|
+
const candidate = path.join(d, 'node.exe');
|
|
221
|
+
if (fs.existsSync(candidate)) { nodeBin = candidate; break; }
|
|
222
|
+
}
|
|
223
|
+
// Find openclaw entry point
|
|
224
|
+
const possibleEntries = [
|
|
225
|
+
path.join(path.dirname(binary), 'node_modules', 'openclaw', 'openclaw.mjs'),
|
|
226
|
+
path.join(os.homedir(), '.openagents', 'nodejs', 'node_modules', 'openclaw', 'openclaw.mjs'),
|
|
227
|
+
];
|
|
228
|
+
let entryPoint = null;
|
|
229
|
+
for (const e of possibleEntries) {
|
|
230
|
+
if (fs.existsSync(e)) { entryPoint = e; break; }
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (nodeBin && entryPoint) {
|
|
234
|
+
// Direct spawn — unbuffered stderr for real-time tool streaming
|
|
235
|
+
spawnBinary = nodeBin;
|
|
236
|
+
spawnArgs = [entryPoint, ...args];
|
|
237
|
+
} else {
|
|
238
|
+
// Fallback to cmd.exe (buffered stderr — no real-time status)
|
|
239
|
+
spawnBinary = process.env.COMSPEC || 'cmd.exe';
|
|
240
|
+
const quotedArgs = args.map((a) => a.includes(' ') ? `"${a}"` : a);
|
|
241
|
+
spawnArgs = ['/C', binary, ...quotedArgs];
|
|
242
|
+
}
|
|
217
243
|
}
|
|
218
244
|
|
|
219
245
|
const proc = spawn(spawnBinary, spawnArgs, spawnOpts);
|