@efengx/openclaw-channel-dragon 0.5.6 → 0.5.8
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.
|
@@ -6,7 +6,6 @@ export declare class PollingComponent implements IComponent {
|
|
|
6
6
|
private channel;
|
|
7
7
|
private options;
|
|
8
8
|
private pollInterval;
|
|
9
|
-
private heartbeatInterval;
|
|
10
9
|
constructor(http: HttpComponent, channel: ChannelComponent, options: {
|
|
11
10
|
agentId: string;
|
|
12
11
|
accountId: string;
|
|
@@ -17,5 +16,4 @@ export declare class PollingComponent implements IComponent {
|
|
|
17
16
|
start(): Promise<void>;
|
|
18
17
|
stop(): Promise<void>;
|
|
19
18
|
private consumePendingMessages;
|
|
20
|
-
private sendHeartbeat;
|
|
21
19
|
}
|
|
@@ -3,7 +3,6 @@ export class PollingComponent {
|
|
|
3
3
|
channel;
|
|
4
4
|
options;
|
|
5
5
|
pollInterval = null;
|
|
6
|
-
heartbeatInterval = null;
|
|
7
6
|
constructor(http, channel, options) {
|
|
8
7
|
this.http = http;
|
|
9
8
|
this.channel = channel;
|
|
@@ -16,16 +15,10 @@ export class PollingComponent {
|
|
|
16
15
|
this.pollInterval = setInterval(() => {
|
|
17
16
|
void this.consumePendingMessages();
|
|
18
17
|
}, 60_000);
|
|
19
|
-
// 3. Heartbeat for OpenClaw keep-alive (every 30s)
|
|
20
|
-
this.heartbeatInterval = setInterval(() => {
|
|
21
|
-
void this.sendHeartbeat();
|
|
22
|
-
}, 30_000);
|
|
23
18
|
}
|
|
24
19
|
async stop() {
|
|
25
20
|
if (this.pollInterval)
|
|
26
21
|
clearInterval(this.pollInterval);
|
|
27
|
-
if (this.heartbeatInterval)
|
|
28
|
-
clearInterval(this.heartbeatInterval);
|
|
29
22
|
}
|
|
30
23
|
async consumePendingMessages() {
|
|
31
24
|
const { agentId, logger } = this.options;
|
|
@@ -46,23 +39,4 @@ export class PollingComponent {
|
|
|
46
39
|
// Quiet fail for recovery polling
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
|
-
async sendHeartbeat() {
|
|
50
|
-
const { agentId, logger, channelRuntime } = this.options;
|
|
51
|
-
try {
|
|
52
|
-
// Orchestrator Heartbeat
|
|
53
|
-
await this.http.fetch(`/api/agents/${agentId}/telemetry`, {
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: { "Content-Type": "application/json" },
|
|
56
|
-
body: JSON.stringify({ type: "plugin_heartbeat", value: { timestamp: Date.now() } }),
|
|
57
|
-
});
|
|
58
|
-
// OpenClaw Runtime Activity Report (if supported by SDK)
|
|
59
|
-
if (typeof channelRuntime?.reportActivity === 'function') {
|
|
60
|
-
channelRuntime.reportActivity();
|
|
61
|
-
}
|
|
62
|
-
logger?.debug?.(`[Dragon Plugin] Heartbeat sent for ${agentId}`);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
logger?.warn?.(`[Dragon Plugin] Heartbeat failed: ${e.message}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
42
|
}
|
package/dist/index.js
CHANGED
|
@@ -57,10 +57,10 @@ const base = createChannelPluginBase({
|
|
|
57
57
|
},
|
|
58
58
|
config: {
|
|
59
59
|
listAccountIds: (cfg) => {
|
|
60
|
-
return Object.keys(cfg
|
|
60
|
+
return Object.keys(cfg?.channels?.[channelId]?.accounts || { "default": {} });
|
|
61
61
|
},
|
|
62
62
|
resolveAccount: (cfg, accountId = "default") => {
|
|
63
|
-
const accountConfig = cfg
|
|
63
|
+
const accountConfig = cfg?.channels?.[channelId]?.accounts?.[accountId] || {};
|
|
64
64
|
return {
|
|
65
65
|
accountId,
|
|
66
66
|
agentId: accountConfig.agentId || accountId,
|
|
@@ -113,11 +113,11 @@ const entry = defineChannelPluginEntry({
|
|
|
113
113
|
if (!sessionKey || !sessionKey.startsWith(`${channelId}:`))
|
|
114
114
|
return;
|
|
115
115
|
const accountId = sessionKey.split(':')[2] || "default";
|
|
116
|
-
const account = base.config.resolveAccount(api
|
|
116
|
+
const account = base.config.resolveAccount(api?.runtime?.cfg, accountId);
|
|
117
117
|
const container = await getOrCreateContainer(account, {
|
|
118
|
-
cfg: api
|
|
118
|
+
cfg: api?.runtime?.cfg,
|
|
119
119
|
abortSignal: new AbortController().signal,
|
|
120
|
-
channelRuntime: api
|
|
120
|
+
channelRuntime: api?.runtime?.channelRuntime // Ensure runtime is passed
|
|
121
121
|
});
|
|
122
122
|
const channel = container.get('channel');
|
|
123
123
|
await channel.handleAgentEvent(evt);
|
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.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Dragon workbench channel for OpenClaw",
|
|
5
5
|
"author": "feng xiang <ofengx@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"openclaw.plugin.json",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"lint": "echo \"(skip)\""
|
|
17
|
-
},
|
|
18
14
|
"dependencies": {
|
|
19
15
|
"openclaw": "^2026.4.12"
|
|
20
16
|
},
|
|
@@ -36,5 +32,9 @@
|
|
|
36
32
|
},
|
|
37
33
|
"publishConfig": {
|
|
38
34
|
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.json",
|
|
38
|
+
"lint": "echo \"(skip)\""
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|