@efengx/openclaw-channel-dragon 0.1.51 → 0.1.54
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/dist/index.js +65 -35
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ async function startPolling(ctx) {
|
|
|
69
69
|
}
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const deliverToOpenClaw = async (content, sessionId = 'default') => {
|
|
72
|
+
const deliverToOpenClaw = async (content, sessionId = 'default', modelId) => {
|
|
73
73
|
const msg = String(content || '').trim();
|
|
74
74
|
if (!msg)
|
|
75
75
|
return;
|
|
@@ -94,6 +94,7 @@ async function startPolling(ctx) {
|
|
|
94
94
|
CommandSource: "native",
|
|
95
95
|
CommandAuthorized: true,
|
|
96
96
|
Timestamp: Date.now(),
|
|
97
|
+
Model: modelId,
|
|
97
98
|
},
|
|
98
99
|
cfg: ctx.cfg,
|
|
99
100
|
dispatcherOptions: {
|
|
@@ -168,7 +169,7 @@ async function startPolling(ctx) {
|
|
|
168
169
|
if (!evt || evt.agentId !== agentId)
|
|
169
170
|
continue;
|
|
170
171
|
if (evt.type === 'WORKBENCH_MESSAGE') {
|
|
171
|
-
await deliverToOpenClaw(String(evt?.payload?.content || ''), String(evt?.payload?.sessionId || 'default'));
|
|
172
|
+
await deliverToOpenClaw(String(evt?.payload?.content || ''), String(evt?.payload?.sessionId || 'default'), evt?.payload?.modelId);
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
catch (e) {
|
|
@@ -427,48 +428,77 @@ const entry = defineChannelPluginEntry({
|
|
|
427
428
|
// Extract details
|
|
428
429
|
const { stream, data, runId } = evt;
|
|
429
430
|
// We care about certain streams for the UI "Thinking" status
|
|
431
|
+
// We care about certain streams for the UI "Thinking" status
|
|
430
432
|
if (stream === "thinking" || stream === "tool" || stream === "item" || stream === "plan") {
|
|
431
433
|
// Extract agentId from sessionKey "dragon:agent-xxx:..."
|
|
432
434
|
const agentId = sessionKey.split(':')[1] || "";
|
|
435
|
+
const accountId = sessionKey.split(':')[2] || "default";
|
|
433
436
|
const logger = cachedRuntime?.logger ?? cachedRuntime?.log;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
}
|
|
437
|
+
// 1. Report to Orchestrator (Async) for Web UI / Trajectory
|
|
438
|
+
try {
|
|
439
|
+
const cfg = api.runtime?.cfg;
|
|
440
|
+
if (cfg) {
|
|
441
|
+
const account = entry.resolveAccount(cfg, accountId);
|
|
442
|
+
if (account?.orchestratorUrl) {
|
|
443
|
+
const telemetryUrl = `${account.orchestratorUrl}/api/agents/${agentId}/messages/reply`;
|
|
444
|
+
// Decide what to send to orchestrator
|
|
445
|
+
let telemetryPayload = null;
|
|
446
|
+
if (stream === "thinking") {
|
|
447
|
+
telemetryPayload = {
|
|
448
|
+
content: "", // Content can be empty for pure reasoning update
|
|
449
|
+
metadata: { isTelemetry: true, reasoning_content: data, stream: "thinking" }
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
else if (stream === "tool" || (stream === "item" && data?.kind === "tool")) {
|
|
453
|
+
const toolName = data?.name || data?.title || "unknown tool";
|
|
454
|
+
if (data?.status === "completed" || data?.phase === "end" || data?.output) {
|
|
455
|
+
telemetryPayload = {
|
|
456
|
+
content: `[Tool Result] ${toolName}`,
|
|
457
|
+
metadata: {
|
|
458
|
+
isTelemetry: true,
|
|
459
|
+
toolName: toolName,
|
|
460
|
+
toolInput: data?.input,
|
|
461
|
+
toolOutput: data?.output || data?.summary,
|
|
462
|
+
toolCallId: data?.toolCallId || runId,
|
|
463
|
+
status: "completed",
|
|
464
|
+
stream: "tool"
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
// Initial tool call info
|
|
470
|
+
telemetryPayload = {
|
|
471
|
+
content: `[Tool Call] ${toolName}...`,
|
|
472
|
+
metadata: {
|
|
473
|
+
isTelemetry: true,
|
|
474
|
+
toolName: toolName,
|
|
475
|
+
toolInput: data?.input,
|
|
476
|
+
status: "running",
|
|
477
|
+
stream: "tool"
|
|
478
|
+
}
|
|
479
|
+
};
|
|
464
480
|
}
|
|
465
481
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
482
|
+
else if (stream === "plan") {
|
|
483
|
+
telemetryPayload = {
|
|
484
|
+
content: `[Plan] ${data.title || "Updating steps..."}`,
|
|
485
|
+
metadata: { isTelemetry: true, data, stream: "plan" }
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
if (telemetryPayload) {
|
|
489
|
+
void fetch(telemetryUrl, {
|
|
490
|
+
method: "POST",
|
|
491
|
+
headers: { "Content-Type": "application/json" },
|
|
492
|
+
body: JSON.stringify(telemetryPayload),
|
|
493
|
+
}).catch(e => logger?.error?.(`[Dragon] Failed to sync telemetry: ${e.message}`));
|
|
494
|
+
}
|
|
469
495
|
}
|
|
470
496
|
}
|
|
471
497
|
}
|
|
498
|
+
catch (e) {
|
|
499
|
+
logger?.error?.(`[Dragon] Telemetry resolution failed: ${e.message}`);
|
|
500
|
+
}
|
|
501
|
+
// 2. Also send to local bridge (WebSocket)
|
|
472
502
|
bridgeClient.sendJson({
|
|
473
503
|
type: "agent_event",
|
|
474
504
|
channel: channelId,
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efengx/openclaw-channel-dragon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.54",
|
|
4
4
|
"description": "Dragon workbench channel for OpenClaw",
|
|
5
5
|
"author": "feng xiang <ofengx@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"openclaw.plugin.json",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"lint": "echo \"(skip)\""
|
|
17
|
+
},
|
|
14
18
|
"dependencies": {
|
|
15
19
|
"openclaw": "^2026.4.12"
|
|
16
20
|
},
|
|
@@ -32,9 +36,5 @@
|
|
|
32
36
|
},
|
|
33
37
|
"publishConfig": {
|
|
34
38
|
"access": "public"
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "tsc -p tsconfig.json",
|
|
38
|
-
"lint": "echo \"(skip)\""
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|