@efengx/openclaw-channel-dragon 0.5.15 → 0.5.17

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 CHANGED
@@ -2,7 +2,6 @@ import { defineChannelPluginEntry, createChatChannelPlugin, createChannelPluginB
2
2
  import { createRawChannelSendResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
3
3
  import * as InfraRuntime from "openclaw/plugin-sdk/infra-runtime";
4
4
  import { ServiceContainer } from "./core/ServiceContainer.js";
5
- import { PollingComponent } from "./components/sync/PollingComponent.js";
6
5
  import { TelemetryComponent } from "./components/telemetry/TelemetryComponent.js";
7
6
  import { HttpComponent } from "./components/http/HttpComponent.js";
8
7
  import { ChannelComponent } from "./components/channel/ChannelComponent.js";
@@ -31,18 +30,11 @@ async function getOrCreateContainer(account, ctx) {
31
30
  cfg: ctx.cfg,
32
31
  logger
33
32
  }, telemetry));
34
- // 3. Sync Infrastructure (SSE + Polling)
33
+ // 3. Sync Infrastructure
35
34
  container.register('sse', new SseComponent(http, channel, {
36
35
  agentId: account.agentId,
37
36
  logger
38
37
  }));
39
- container.register('polling', new PollingComponent(http, channel, {
40
- agentId: account.agentId,
41
- accountId: account.accountId,
42
- channelRuntime: ctx.channelRuntime,
43
- abortSignal: ctx.abortSignal,
44
- logger
45
- }));
46
38
  await container.startAll();
47
39
  containers.set(key, container);
48
40
  return container;
@@ -2,7 +2,7 @@
2
2
  "id": "dragon",
3
3
  "name": "Dragon Workbench Channel",
4
4
  "description": "Connect OpenClaw to the Dragon agent-client workbench chat.",
5
- "version": "0.5.15",
5
+ "version": "0.5.17",
6
6
  "enabledByDefault": true,
7
7
  "activation": {
8
8
  "onCapabilities": ["hook"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efengx/openclaw-channel-dragon",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "Dragon workbench channel for OpenClaw",
5
5
  "author": "feng xiang <ofengx@gmail.com>",
6
6
  "type": "module",
@@ -1,17 +0,0 @@
1
- import { type DragonBridgeClient } from "../../ws.js";
2
- import { IComponent } from "../../core/IComponent.js";
3
- export declare class BridgeComponent implements IComponent {
4
- private options;
5
- client: DragonBridgeClient | undefined;
6
- constructor(options: {
7
- host?: string;
8
- port: number;
9
- token: string;
10
- agentId: string;
11
- gatewayPort: number;
12
- gatewayToken: string;
13
- logger?: any;
14
- });
15
- start(): Promise<void>;
16
- stop(): Promise<void>;
17
- }
@@ -1,45 +0,0 @@
1
- import { connectToDragonBridge } from "../../ws.js";
2
- export class BridgeComponent {
3
- options;
4
- client;
5
- constructor(options) {
6
- this.options = options;
7
- }
8
- async start() {
9
- const { host, port, token, agentId, gatewayPort, gatewayToken, logger } = this.options;
10
- this.client = connectToDragonBridge({
11
- host,
12
- port,
13
- token,
14
- onConnected: () => {
15
- logger?.info?.("dragon channel: connected to dragon bridge");
16
- this.client?.sendJson({
17
- type: "hello",
18
- channel: "dragon",
19
- agentId,
20
- port: gatewayPort,
21
- token: gatewayToken,
22
- version: "0.1.27",
23
- timestamp: Date.now()
24
- });
25
- },
26
- onDisconnected: () => {
27
- logger?.info?.("dragon channel: disconnected from dragon bridge");
28
- },
29
- onMessage: (msg) => {
30
- const t = msg?.type;
31
- if (t === "ping") {
32
- this.client?.sendJson({ type: "pong", t: Date.now() });
33
- return;
34
- }
35
- if (t === "hot_control") {
36
- const { command } = msg;
37
- logger?.info?.(`dragon channel: received hot control: ${command}`);
38
- }
39
- },
40
- });
41
- }
42
- async stop() {
43
- // WebSocket close logic if needed
44
- }
45
- }
@@ -1,19 +0,0 @@
1
- import { IComponent } from "../../core/IComponent.js";
2
- import { HttpComponent } from "../http/HttpComponent.js";
3
- import { ChannelComponent } from "../channel/ChannelComponent.js";
4
- export declare class PollingComponent implements IComponent {
5
- private http;
6
- private channel;
7
- private options;
8
- private pollInterval;
9
- constructor(http: HttpComponent, channel: ChannelComponent, options: {
10
- agentId: string;
11
- accountId: string;
12
- channelRuntime?: any;
13
- abortSignal: AbortSignal;
14
- logger?: any;
15
- });
16
- start(): Promise<void>;
17
- stop(): Promise<void>;
18
- private consumePendingMessages;
19
- }
@@ -1,42 +0,0 @@
1
- export class PollingComponent {
2
- http;
3
- channel;
4
- options;
5
- pollInterval = null;
6
- constructor(http, channel, options) {
7
- this.http = http;
8
- this.channel = channel;
9
- this.options = options;
10
- }
11
- async start() {
12
- // 1. Initial consume
13
- void this.consumePendingMessages();
14
- // 2. Periodic recovery polling (every 60s)
15
- this.pollInterval = setInterval(() => {
16
- void this.consumePendingMessages();
17
- }, 60_000);
18
- }
19
- async stop() {
20
- if (this.pollInterval)
21
- clearInterval(this.pollInterval);
22
- }
23
- async consumePendingMessages() {
24
- const { agentId, logger } = this.options;
25
- try {
26
- const res = await this.http.fetch(`/api/agents/${agentId}/messages/poll`);
27
- if (res.ok) {
28
- const data = (await res.json());
29
- const messages = data.messages || [];
30
- if (messages.length > 0) {
31
- logger?.debug?.(`[Dragon Plugin] [Recovery] Polled ${messages.length} pending messages.`);
32
- for (const m of messages) {
33
- await this.channel.deliverToOpenClaw(String(m.content || ''), String(m.sessionId || 'default'), m.modelId, m.attachments, m.externalId || m.id);
34
- }
35
- }
36
- }
37
- }
38
- catch (e) {
39
- // Quiet fail for recovery polling
40
- }
41
- }
42
- }