@efengx/openclaw-channel-dragon 0.5.2 → 0.5.4
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.
|
@@ -13,7 +13,7 @@ export declare class ChannelComponent implements IComponent {
|
|
|
13
13
|
private bridge;
|
|
14
14
|
private telemetry;
|
|
15
15
|
private processedMessageIds;
|
|
16
|
-
constructor(options: ChannelOptions, bridge: BridgeComponent, telemetry: TelemetryComponent);
|
|
16
|
+
constructor(options: ChannelOptions, bridge: BridgeComponent | null, telemetry: TelemetryComponent);
|
|
17
17
|
start(): Promise<void>;
|
|
18
18
|
stop(): Promise<void>;
|
|
19
19
|
deliverToOpenClaw: (content: string, sessionId?: string, modelId?: string, attachments?: any[], messageId?: string | number) => Promise<void>;
|
|
@@ -48,7 +48,7 @@ export class ChannelComponent {
|
|
|
48
48
|
const text = payload?.text || "";
|
|
49
49
|
if (!text && !payload?.tool_calls?.length)
|
|
50
50
|
return;
|
|
51
|
-
if (this.bridge
|
|
51
|
+
if (this.bridge?.client) {
|
|
52
52
|
this.bridge.client.sendJson({
|
|
53
53
|
type: "outbound_text",
|
|
54
54
|
channel: channelId,
|
|
@@ -72,7 +72,7 @@ export class ChannelComponent {
|
|
|
72
72
|
const text = ctx?.text || "";
|
|
73
73
|
const { accountId, agentId, logger } = this.options;
|
|
74
74
|
logger?.info?.(`[Dragon Plugin] Outbound Text (Action): "${text.substring(0, 50)}${text.length > 50 ? '...' : ''}"`);
|
|
75
|
-
if (this.bridge
|
|
75
|
+
if (this.bridge?.client) {
|
|
76
76
|
this.bridge.client.sendJson({
|
|
77
77
|
type: "outbound_text",
|
|
78
78
|
channel: channelId,
|
|
@@ -85,7 +85,7 @@ export class ChannelComponent {
|
|
|
85
85
|
};
|
|
86
86
|
handleAgentEvent = async (evt) => {
|
|
87
87
|
const { agentId, accountId } = this.options;
|
|
88
|
-
if (this.bridge
|
|
88
|
+
if (this.bridge?.client) {
|
|
89
89
|
this.bridge.client.sendJson({
|
|
90
90
|
type: "agent_event",
|
|
91
91
|
channel: channelId,
|
|
@@ -37,7 +37,7 @@ export class PollingComponent {
|
|
|
37
37
|
if (messages.length > 0) {
|
|
38
38
|
logger?.debug?.(`[Dragon Plugin] [Recovery] Polled ${messages.length} pending messages.`);
|
|
39
39
|
for (const m of messages) {
|
|
40
|
-
await this.channel.deliverToOpenClaw(String(m.content || ''), String(m.sessionId || 'default'), m.modelId, m.attachments, m.id);
|
|
40
|
+
await this.channel.deliverToOpenClaw(String(m.content || ''), String(m.sessionId || 'default'), m.modelId, m.attachments, m.externalId || m.id);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
package/dist/index.js
CHANGED
|
@@ -24,15 +24,18 @@ async function getOrCreateContainer(account, ctx) {
|
|
|
24
24
|
logger
|
|
25
25
|
}));
|
|
26
26
|
const telemetry = container.register('telemetry', new TelemetryComponent(http, account.agentId));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
}
|
|
36
39
|
// 2. Channel Logic (Centralized)
|
|
37
40
|
const channel = container.register('channel', new ChannelComponent({
|
|
38
41
|
accountId: account.accountId,
|
package/openclaw.plugin.json
CHANGED