@openagents-org/agent-launcher 0.2.19 → 0.2.21
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 +41 -2
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -220,9 +220,48 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
220
220
|
let stdout = '';
|
|
221
221
|
let stderr = '';
|
|
222
222
|
|
|
223
|
-
//
|
|
223
|
+
// Tool name → human-readable status
|
|
224
|
+
const toolLabels = {
|
|
225
|
+
exec: 'Running command...',
|
|
226
|
+
read: 'Reading file...',
|
|
227
|
+
write: 'Writing file...',
|
|
228
|
+
edit: 'Editing file...',
|
|
229
|
+
browser: 'Using browser...',
|
|
230
|
+
web_search: 'Searching the web...',
|
|
231
|
+
web_fetch: 'Fetching webpage...',
|
|
232
|
+
process: 'Running process...',
|
|
233
|
+
image_generate: 'Generating image...',
|
|
234
|
+
memory_search: 'Searching memory...',
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// Stream stderr in real-time to detect tool usage and send status updates
|
|
238
|
+
let stderrBuffer = '';
|
|
224
239
|
if (proc.stdout) proc.stdout.on('data', (d) => { stdout += d; });
|
|
225
|
-
if (proc.stderr) proc.stderr.on('data', (d) => {
|
|
240
|
+
if (proc.stderr) proc.stderr.on('data', (d) => {
|
|
241
|
+
const chunk = d.toString();
|
|
242
|
+
stderr += chunk;
|
|
243
|
+
stdout += chunk;
|
|
244
|
+
stderrBuffer += chunk;
|
|
245
|
+
|
|
246
|
+
// Process complete lines
|
|
247
|
+
const lines = stderrBuffer.split('\n');
|
|
248
|
+
stderrBuffer = lines.pop() || ''; // keep incomplete last line
|
|
249
|
+
|
|
250
|
+
for (const line of lines) {
|
|
251
|
+
const toolStart = line.match(/embedded run tool start:.*tool=(\w+)/);
|
|
252
|
+
if (toolStart) {
|
|
253
|
+
const toolName = toolStart[1];
|
|
254
|
+
const label = toolLabels[toolName] || `Using ${toolName}...`;
|
|
255
|
+
this._log(`Tool status: ${label}`);
|
|
256
|
+
this.sendStatus(channel, label).catch(() => {});
|
|
257
|
+
}
|
|
258
|
+
// Also detect agent thinking
|
|
259
|
+
const agentStart = line.match(/embedded run agent start/);
|
|
260
|
+
if (agentStart) {
|
|
261
|
+
this.sendStatus(channel, 'thinking...').catch(() => {});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
226
265
|
|
|
227
266
|
proc.on('error', (err) => reject(err));
|
|
228
267
|
proc.on('exit', (code) => {
|