@openagents-org/agent-launcher 0.2.20 → 0.2.22
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 +28 -7
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -211,9 +211,19 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
211
211
|
};
|
|
212
212
|
|
|
213
213
|
if (IS_WINDOWS) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
// Spawn node directly with the JS entry point instead of cmd.exe /C
|
|
215
|
+
// to get unbuffered stderr for real-time tool status streaming
|
|
216
|
+
const nodeBin = path.join(path.dirname(binary), 'node.exe');
|
|
217
|
+
const entryPoint = path.join(path.dirname(binary), 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
218
|
+
if (fs.existsSync(nodeBin) && fs.existsSync(entryPoint)) {
|
|
219
|
+
spawnBinary = nodeBin;
|
|
220
|
+
spawnArgs = [entryPoint, ...args];
|
|
221
|
+
} else {
|
|
222
|
+
// Fallback to cmd.exe (buffered stderr)
|
|
223
|
+
spawnBinary = process.env.COMSPEC || 'cmd.exe';
|
|
224
|
+
const quotedArgs = args.map((a) => a.includes(' ') ? `"${a}"` : a);
|
|
225
|
+
spawnArgs = ['/C', binary, ...quotedArgs];
|
|
226
|
+
}
|
|
217
227
|
}
|
|
218
228
|
|
|
219
229
|
const proc = spawn(spawnBinary, spawnArgs, spawnOpts);
|
|
@@ -234,20 +244,31 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
234
244
|
memory_search: 'Searching memory...',
|
|
235
245
|
};
|
|
236
246
|
|
|
237
|
-
// Stream stderr in real-time to detect tool usage
|
|
247
|
+
// Stream stderr in real-time to detect tool usage and send status updates
|
|
248
|
+
let stderrBuffer = '';
|
|
238
249
|
if (proc.stdout) proc.stdout.on('data', (d) => { stdout += d; });
|
|
239
250
|
if (proc.stderr) proc.stderr.on('data', (d) => {
|
|
240
251
|
const chunk = d.toString();
|
|
241
252
|
stderr += chunk;
|
|
242
253
|
stdout += chunk;
|
|
254
|
+
stderrBuffer += chunk;
|
|
255
|
+
|
|
256
|
+
// Process complete lines
|
|
257
|
+
const lines = stderrBuffer.split('\n');
|
|
258
|
+
stderrBuffer = lines.pop() || ''; // keep incomplete last line
|
|
243
259
|
|
|
244
|
-
|
|
245
|
-
for (const line of chunk.split('\n')) {
|
|
260
|
+
for (const line of lines) {
|
|
246
261
|
const toolStart = line.match(/embedded run tool start:.*tool=(\w+)/);
|
|
247
262
|
if (toolStart) {
|
|
248
263
|
const toolName = toolStart[1];
|
|
249
264
|
const label = toolLabels[toolName] || `Using ${toolName}...`;
|
|
250
|
-
|
|
265
|
+
this._log(`Tool status: ${label}`);
|
|
266
|
+
this.sendStatus(channel, label).catch(() => {});
|
|
267
|
+
}
|
|
268
|
+
// Also detect agent thinking
|
|
269
|
+
const agentStart = line.match(/embedded run agent start/);
|
|
270
|
+
if (agentStart) {
|
|
271
|
+
this.sendStatus(channel, 'thinking...').catch(() => {});
|
|
251
272
|
}
|
|
252
273
|
}
|
|
253
274
|
});
|