@meet-im/meet 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meet-im/meet",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Meet channel plugin",
6
6
  "scripts": {
package/src/bot.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  recordPendingHistoryEntryIfEnabled,
7
7
  } from "openclaw/plugin-sdk/reply-history"
8
8
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id"
9
+ import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"
9
10
  import type { MeetBot, MsgContent } from "@meet-im/meet-bot-jssdk"
10
11
  import type { ResolvedMeetAccount, MeetMessageContext } from "./types.js"
11
12
  import { msgContentToContext, extractQuoteMessageMedia } from "./sdk-bridge.js"
@@ -199,7 +200,7 @@ export async function handleMeetMessage(params: {
199
200
  }
200
201
 
201
202
  const meetFrom = `meet:${ctx.senderId}`
202
- const meetTo = isGroup ? `channel:${ctx.chatId}` : `user:${ctx.senderId}`
203
+ const meetTo = ctx.chatId
203
204
 
204
205
  const peerId = isGroup ? ctx.chatId : ctx.senderId
205
206
 
@@ -380,6 +381,7 @@ export async function handleMeetMessage(params: {
380
381
  })
381
382
 
382
383
  const { createMeetReplyDispatcher } = await import("./reply-dispatcher.js")
384
+ const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, route.agentId)
383
385
  const { dispatcher, replyOptions, markDispatchIdle } = await createMeetReplyDispatcher({
384
386
  cfg,
385
387
  agentId: route.agentId,
@@ -389,6 +391,7 @@ export async function handleMeetMessage(params: {
389
391
  accountId,
390
392
  bot,
391
393
  botUserId,
394
+ mediaLocalRoots,
392
395
  })
393
396
 
394
397
  log(`[${accountId}]: dispatching to AI agent=${route.agentId} session=${route.sessionKey} history=${inboundHistory?.length ?? 0}`)
@@ -2,7 +2,7 @@ import type { MeetBot } from "@meet-im/meet-bot-jssdk"
2
2
  import type { ClawdbotConfig, RuntimeEnv, ReplyPayload } from "openclaw/plugin-sdk"
3
3
  import { createReplyPrefixContext } from "openclaw/plugin-sdk/channel-runtime"
4
4
  import { getMeetRuntime } from "./runtime.js"
5
- import { sendMessageMeet } from "./send.js"
5
+ import { sendMessageMeet, sendMediaMeet } from "./send.js"
6
6
 
7
7
  /**
8
8
  * 匹配末尾不完整的 mention 开始: <@ 或 <@xxx (没有闭合的 >)
@@ -73,12 +73,13 @@ export type CreateMeetReplyDispatcherOpts = {
73
73
  accountId: string
74
74
  bot: MeetBot
75
75
  botUserId: string
76
+ mediaLocalRoots?: readonly string[]
76
77
  }
77
78
 
78
79
  export async function createMeetReplyDispatcher(
79
80
  opts: CreateMeetReplyDispatcherOpts,
80
81
  ) {
81
- const { cfg, agentId, chatId, replyToMessageId, accountId } = opts
82
+ const { cfg, agentId, chatId, replyToMessageId, accountId, mediaLocalRoots } = opts
82
83
  const core = getMeetRuntime()
83
84
 
84
85
  const textChunkLimit = core.channel.text.resolveTextChunkLimit(cfg, "meet", accountId, {
@@ -97,10 +98,40 @@ export async function createMeetReplyDispatcher(
97
98
  },
98
99
  deliver: async (payload: ReplyPayload, _info) => {
99
100
  const text = payload.text ?? ""
100
- if (!text.trim()) {
101
+ const mediaUrls = payload.mediaUrls ?? (payload.mediaUrl ? [payload.mediaUrl] : [])
102
+
103
+ // 如果既没有文本也没有媒体,直接返回
104
+ if (!text.trim() && mediaUrls.length === 0) {
101
105
  return
102
106
  }
103
107
 
108
+ // 处理媒体文件:先发送媒体,再发送文本
109
+ // 如果有媒体,第一个媒体带上文本作为 caption,后续媒体不带文本
110
+ if (mediaUrls.length > 0) {
111
+ // 第一个媒体带上 caption
112
+ await sendMediaMeet({
113
+ cfg,
114
+ to: chatId,
115
+ text: text.trim() || undefined,
116
+ mediaUrl: mediaUrls[0],
117
+ mediaLocalRoots,
118
+ accountId,
119
+ })
120
+ // 后续媒体不带文本
121
+ for (let i = 1; i < mediaUrls.length; i++) {
122
+ await sendMediaMeet({
123
+ cfg,
124
+ to: chatId,
125
+ text: undefined,
126
+ mediaUrl: mediaUrls[i],
127
+ mediaLocalRoots,
128
+ accountId,
129
+ })
130
+ }
131
+ return
132
+ }
133
+
134
+ // 只有文本,分片发送
104
135
  const rawChunks = core.channel.text.chunkTextWithMode(text, textChunkLimit, chunkMode)
105
136
  const protectedChunks = protectMentionsInChunks(rawChunks)
106
137