@efengx/openclaw-channel-dragon 0.1.55 → 0.1.57
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 +18 -16
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ async function startPolling(ctx) {
|
|
|
159
159
|
continue;
|
|
160
160
|
const dataLines = raw
|
|
161
161
|
.split('\n')
|
|
162
|
-
.filter((l) => l.startsWith('data:'))
|
|
162
|
+
.filter((l) => typeof l === 'string' && l.startsWith('data:'))
|
|
163
163
|
.map((l) => l.slice('data:'.length).trim());
|
|
164
164
|
if (!dataLines.length)
|
|
165
165
|
continue;
|
|
@@ -173,7 +173,7 @@ async function startPolling(ctx) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
catch (e) {
|
|
176
|
-
logger?.error?.(`dragon channel: failed to parse SSE data: ${e?.message || e}
|
|
176
|
+
logger?.error?.(`dragon channel: failed to parse SSE data: ${e?.message || e}`, e?.stack);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
};
|
|
@@ -268,7 +268,7 @@ async function startPolling(ctx) {
|
|
|
268
268
|
catch (e) {
|
|
269
269
|
if (e?.name === 'AbortError')
|
|
270
270
|
break;
|
|
271
|
-
logger?.error?.(`dragon channel: SSE loop error: ${e?.message || e}
|
|
271
|
+
logger?.error?.(`dragon channel: SSE loop error: ${e?.message || e}`, e?.stack);
|
|
272
272
|
// reconnect delay (cap 10s)
|
|
273
273
|
const delayMs = Math.min(10_000, 500 + attempt * 500);
|
|
274
274
|
await new Promise((r) => setTimeout(r, delayMs));
|
|
@@ -342,7 +342,7 @@ const gateway = {
|
|
|
342
342
|
await startPolling(ctx);
|
|
343
343
|
}
|
|
344
344
|
catch (err) {
|
|
345
|
-
logger?.error?.(`dragon channel: fatal poll error: ${err.message}
|
|
345
|
+
logger?.error?.(`dragon channel: fatal poll error: ${err.message}`, err.stack);
|
|
346
346
|
}
|
|
347
347
|
},
|
|
348
348
|
};
|
|
@@ -419,15 +419,15 @@ const entry = defineChannelPluginEntry({
|
|
|
419
419
|
const agentEventHandler = api.runtime?.events?.onAgentEvent || InfraRuntime.onAgentEvent;
|
|
420
420
|
if (typeof agentEventHandler === 'function') {
|
|
421
421
|
agentEventHandler((evt) => {
|
|
422
|
-
|
|
423
|
-
return;
|
|
422
|
+
const logger = cachedRuntime?.logger ?? cachedRuntime?.log;
|
|
424
423
|
// Filter by sessionKey to ensure we only send events belonging to this channel
|
|
425
424
|
const sessionKey = evt.sessionKey;
|
|
426
425
|
if (!sessionKey || !sessionKey.startsWith(`${channelId}:`))
|
|
427
426
|
return;
|
|
428
427
|
// Extract details
|
|
429
428
|
const { stream, data, runId } = evt;
|
|
430
|
-
//
|
|
429
|
+
// Debug log for troubleshooting missing tool calls
|
|
430
|
+
logger?.debug?.(`[Dragon] Received agent event: stream=${stream}, runId=${runId}, dataKeys=${Object.keys(data || {})}`);
|
|
431
431
|
// We care about certain streams for the UI "Thinking" status
|
|
432
432
|
if (stream === "thinking" || stream === "tool" || stream === "item" || stream === "plan") {
|
|
433
433
|
// Extract agentId from sessionKey "dragon:agent-xxx:..."
|
|
@@ -508,15 +508,17 @@ const entry = defineChannelPluginEntry({
|
|
|
508
508
|
logger?.error?.(`[Dragon] Telemetry resolution failed: ${e.message}`);
|
|
509
509
|
}
|
|
510
510
|
// 2. Also send to local bridge (WebSocket)
|
|
511
|
-
bridgeClient
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
511
|
+
if (bridgeClient) {
|
|
512
|
+
bridgeClient.sendJson({
|
|
513
|
+
type: "agent_event",
|
|
514
|
+
channel: channelId,
|
|
515
|
+
agentId,
|
|
516
|
+
runId,
|
|
517
|
+
stream,
|
|
518
|
+
data,
|
|
519
|
+
sessionKey
|
|
520
|
+
});
|
|
521
|
+
}
|
|
520
522
|
}
|
|
521
523
|
});
|
|
522
524
|
}
|
package/openclaw.plugin.json
CHANGED