@efengx/openclaw-channel-dragon 0.5.26 → 0.5.27

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
@@ -140,6 +140,46 @@ const plugin = createChatChannelPlugin({
140
140
  };
141
141
  }
142
142
  }
143
+ },
144
+ actions: {
145
+ describeMessageTool: ({ cfg, accountId }) => {
146
+ return { actions: ["send"] };
147
+ },
148
+ handleAction: async (ctx) => {
149
+ const { action, params, cfg, accountId } = ctx;
150
+ if (action === "send") {
151
+ const account = base.config.resolveAccount(cfg, accountId);
152
+ const container = await getOrCreateContainer(account, ctx);
153
+ const channel = container.get('channel');
154
+ let target = params.to || params.target || ctx.toolContext?.currentChannelId || "default";
155
+ for (const prefix of ["dragon-workbench-", "dragon-workbench:", "dragon-", "dragon:"]) {
156
+ if (target.startsWith(prefix)) {
157
+ target = target.substring(prefix.length);
158
+ }
159
+ }
160
+ const sessionId = target || "default";
161
+ let text = params.message || params.text || "";
162
+ const media = params.media || params.mediaUrl || params.path || params.filePath || params.fileUrl;
163
+ if (media && typeof media === 'string') {
164
+ const mediaLine = `MEDIA: ${media}`;
165
+ if (!text.includes(mediaLine)) {
166
+ text = text ? `${text}\n${mediaLine}` : mediaLine;
167
+ }
168
+ }
169
+ const result = await channel.handleOutboundText({
170
+ text,
171
+ peer: { id: sessionId }
172
+ });
173
+ return {
174
+ ok: result.ok,
175
+ ...result.messageId ? { messageId: result.messageId } : {},
176
+ didSendViaMessagingTool: true,
177
+ messagingToolSentTexts: [text],
178
+ messagingToolSentTargets: [target]
179
+ };
180
+ }
181
+ throw new Error(`Action "${action}" is not supported by the dragon channel plugin.`);
182
+ }
143
183
  }
144
184
  },
145
185
  outbound: {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const dragonChannelPluginVersion = "0.5.26";
1
+ export declare const dragonChannelPluginVersion = "0.5.27";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const dragonChannelPluginVersion = "0.5.26";
1
+ export const dragonChannelPluginVersion = "0.5.27";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efengx/openclaw-channel-dragon",
3
- "version": "0.5.26",
3
+ "version": "0.5.27",
4
4
  "description": "Dragon workbench channel for OpenClaw",
5
5
  "author": "feng xiang <ofengx@gmail.com>",
6
6
  "type": "module",