@efengx/openclaw-channel-dragon 0.5.4 → 0.5.6

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.
@@ -1,5 +1,4 @@
1
1
  import { IComponent } from "../../core/IComponent.js";
2
- import { BridgeComponent } from "../bridge/BridgeComponent.js";
3
2
  import { TelemetryComponent } from "../telemetry/TelemetryComponent.js";
4
3
  export interface ChannelOptions {
5
4
  accountId: string;
@@ -10,10 +9,9 @@ export interface ChannelOptions {
10
9
  }
11
10
  export declare class ChannelComponent implements IComponent {
12
11
  private options;
13
- private bridge;
14
12
  private telemetry;
15
13
  private processedMessageIds;
16
- constructor(options: ChannelOptions, bridge: BridgeComponent | null, telemetry: TelemetryComponent);
14
+ constructor(options: ChannelOptions, telemetry: TelemetryComponent);
17
15
  start(): Promise<void>;
18
16
  stop(): Promise<void>;
19
17
  deliverToOpenClaw: (content: string, sessionId?: string, modelId?: string, attachments?: any[], messageId?: string | number) => Promise<void>;
@@ -1,12 +1,10 @@
1
1
  const channelId = "dragon";
2
2
  export class ChannelComponent {
3
3
  options;
4
- bridge;
5
4
  telemetry;
6
5
  processedMessageIds = new Set();
7
- constructor(options, bridge, telemetry) {
6
+ constructor(options, telemetry) {
8
7
  this.options = options;
9
- this.bridge = bridge;
10
8
  this.telemetry = telemetry;
11
9
  }
12
10
  async start() { }
@@ -48,16 +46,6 @@ export class ChannelComponent {
48
46
  const text = payload?.text || "";
49
47
  if (!text && !payload?.tool_calls?.length)
50
48
  return;
51
- if (this.bridge?.client) {
52
- this.bridge.client.sendJson({
53
- type: "outbound_text",
54
- channel: channelId,
55
- text,
56
- tool_calls: payload?.tool_calls,
57
- reasoning_content: payload?.reasoning_content,
58
- route: { agentId, accountId, peer: { kind: "direct", id: sessionId }, sessionKey },
59
- });
60
- }
61
49
  await this.telemetry.reportReply({
62
50
  content: text,
63
51
  sessionId,
@@ -70,32 +58,12 @@ export class ChannelComponent {
70
58
  };
71
59
  handleOutboundText = async (ctx) => {
72
60
  const text = ctx?.text || "";
73
- const { accountId, agentId, logger } = this.options;
61
+ const { logger } = this.options;
74
62
  logger?.info?.(`[Dragon Plugin] Outbound Text (Action): "${text.substring(0, 50)}${text.length > 50 ? '...' : ''}"`);
75
- if (this.bridge?.client) {
76
- this.bridge.client.sendJson({
77
- type: "outbound_text",
78
- channel: channelId,
79
- text,
80
- route: { agentId, accountId, peer: ctx?.peer, sessionKey: ctx?.ctx?.SessionKey },
81
- });
82
- }
83
63
  await this.telemetry.reportReply({ content: text, sessionId: ctx?.peer?.id || 'default' });
84
64
  return { ok: true, messageId: Date.now().toString() };
85
65
  };
86
66
  handleAgentEvent = async (evt) => {
87
- const { agentId, accountId } = this.options;
88
- if (this.bridge?.client) {
89
- this.bridge.client.sendJson({
90
- type: "agent_event",
91
- channel: channelId,
92
- agentId,
93
- runId: evt.runId,
94
- stream: evt.stream,
95
- data: evt.data,
96
- sessionKey: evt.sessionKey
97
- });
98
- }
99
67
  await this.telemetry.reportEvent(evt.stream, evt.data, evt.ts);
100
68
  };
101
69
  }
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 { BridgeComponent } from "./components/bridge/BridgeComponent.js";
6
5
  import { PollingComponent } from "./components/sync/PollingComponent.js";
7
6
  import { TelemetryComponent } from "./components/telemetry/TelemetryComponent.js";
8
7
  import { HttpComponent } from "./components/http/HttpComponent.js";
@@ -24,18 +23,6 @@ async function getOrCreateContainer(account, ctx) {
24
23
  logger
25
24
  }));
26
25
  const telemetry = container.register('telemetry', new TelemetryComponent(http, account.agentId));
27
- let bridge = null;
28
- if (account.bridgeHost) {
29
- bridge = container.register('bridge', new BridgeComponent({
30
- host: account.bridgeHost,
31
- port: parseInt(account.bridgePort || "18799", 10),
32
- token: account.bridgeToken || "",
33
- agentId: account.agentId,
34
- gatewayPort: parseInt(account.gatewayPort || "18789", 10),
35
- gatewayToken: account.gatewayToken || "",
36
- logger
37
- }));
38
- }
39
26
  // 2. Channel Logic (Centralized)
40
27
  const channel = container.register('channel', new ChannelComponent({
41
28
  accountId: account.accountId,
@@ -43,7 +30,7 @@ async function getOrCreateContainer(account, ctx) {
43
30
  channelRuntime: ctx.channelRuntime,
44
31
  cfg: ctx.cfg,
45
32
  logger
46
- }, bridge, telemetry));
33
+ }, telemetry));
47
34
  // 3. Sync Infrastructure (SSE + Polling)
48
35
  container.register('sse', new SseComponent(http, channel, {
49
36
  agentId: account.agentId,
@@ -74,17 +61,11 @@ const base = createChannelPluginBase({
74
61
  },
75
62
  resolveAccount: (cfg, accountId = "default") => {
76
63
  const accountConfig = cfg.channels?.[channelId]?.accounts?.[accountId] || {};
77
- const host = accountConfig.bridgeHost || accountConfig.host;
78
64
  return {
79
65
  accountId,
80
66
  agentId: accountConfig.agentId || accountId,
81
67
  orchestratorUrl: accountConfig.orchestratorUrl || "http://127.0.0.1:4000",
82
68
  orchestratorAuthToken: accountConfig.orchestratorAuthToken || accountConfig.authToken,
83
- bridgeHost: host,
84
- bridgePort: accountConfig.bridgePort,
85
- bridgeToken: accountConfig.bridgeToken,
86
- gatewayPort: accountConfig.gatewayPort,
87
- gatewayToken: accountConfig.gatewayToken,
88
69
  };
89
70
  },
90
71
  },
@@ -97,6 +78,12 @@ const plugin = createChatChannelPlugin({
97
78
  startAccount: async (ctx) => {
98
79
  const account = base.config.resolveAccount(ctx.cfg, ctx.accountId);
99
80
  await getOrCreateContainer(account, ctx);
81
+ // v0.5.6+: Prevent channel exit by waiting for abort signal
82
+ if (ctx.abortSignal.aborted)
83
+ return;
84
+ await new Promise((resolve) => {
85
+ ctx.abortSignal.addEventListener('abort', resolve, { once: true });
86
+ });
100
87
  }
101
88
  },
102
89
  },
@@ -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.4",
5
+ "version": "0.5.6",
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.4",
3
+ "version": "0.5.6",
4
4
  "description": "Dragon workbench channel for OpenClaw",
5
5
  "author": "feng xiang <ofengx@gmail.com>",
6
6
  "type": "module",