@efengx/openclaw-channel-dragon 0.5.6 → 0.5.7
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/openclaw.plugin.json
CHANGED