@searchfe/openclaw-baiduapp 0.1.0-beta.7 → 0.1.0-beta.9

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.d.ts CHANGED
@@ -269,6 +269,18 @@ declare const baiduAppPlugin: {
269
269
  messageId: string;
270
270
  error?: Error;
271
271
  }>;
272
+ sendMedia: (params: {
273
+ cfg: PluginConfig;
274
+ accountId?: string | null;
275
+ to: string;
276
+ text: string;
277
+ mediaUrl?: string;
278
+ }) => Promise<{
279
+ channel: string;
280
+ ok: boolean;
281
+ messageId: string;
282
+ error?: Error;
283
+ }>;
272
284
  };
273
285
  gateway: {
274
286
  startAccount: (ctx: {
package/dist/index.js CHANGED
@@ -4298,8 +4298,10 @@ function encryptBaiduAppPlaintext(params) {
4298
4298
  }
4299
4299
 
4300
4300
  // src/api.ts
4301
+ var logger = createLogger("openclaw-baiduapp:api");
4301
4302
  async function sendBaiduAppMessage(account, target, message) {
4302
4303
  if (!account.canSendActive) {
4304
+ logger.error("Account not configured for active sending (missing appKey, token, or encodingAESKey)");
4303
4305
  return {
4304
4306
  ok: false,
4305
4307
  errcode: -1,
@@ -4326,36 +4328,41 @@ async function sendBaiduAppMessage(account, target, message) {
4326
4328
  });
4327
4329
  const sendMessageUrl = `${account.apiBase}/chat/openclaw/callback`;
4328
4330
  const url = `${sendMessageUrl}?timestamp=${encodeURIComponent(timestamp)}&ak=${encodeURIComponent(account.appKey ?? "")}&nonce=${encodeURIComponent(nonce)}&msg_signature=${encodeURIComponent(msgSignature)}`;
4331
+ const body = JSON.stringify({ encrypt });
4332
+ logger.info(`POST ${url}`);
4333
+ logger.debug(`request body: ${body}`);
4329
4334
  const resp = await fetch(url, {
4330
4335
  method: "POST",
4331
- body: JSON.stringify({ encrypt }),
4336
+ body,
4332
4337
  headers: { "Content-Type": "application/json" }
4333
4338
  });
4334
4339
  const text = await resp.text();
4335
4340
  if (!text) {
4336
- return {
4337
- ok: false,
4338
- errcode: resp.status,
4339
- errmsg: `empty response from server (status=${resp.status})`
4340
- };
4341
+ const errmsg = `empty response from server (status=${resp.status})`;
4342
+ logger.error(`request failed: ${errmsg}`);
4343
+ return { ok: false, errcode: resp.status, errmsg };
4341
4344
  }
4342
4345
  let data;
4343
4346
  try {
4344
4347
  data = JSON.parse(text);
4345
4348
  } catch {
4346
- return {
4347
- ok: false,
4348
- errcode: resp.status,
4349
- errmsg: `invalid JSON response (status=${resp.status}, body=${text.slice(0, 200)})`
4350
- };
4349
+ const errmsg = `invalid JSON response (status=${resp.status}, body=${text.slice(0, 200)})`;
4350
+ logger.error(`request failed: ${errmsg}`);
4351
+ return { ok: false, errcode: resp.status, errmsg };
4351
4352
  }
4352
- return {
4353
+ const result = {
4353
4354
  ok: data.errcode === 0,
4354
4355
  errcode: data.errcode,
4355
4356
  errmsg: data.errmsg,
4356
4357
  invaliduser: data.invaliduser,
4357
4358
  msgid: data.msgid
4358
4359
  };
4360
+ if (result.ok) {
4361
+ logger.info(`request succeeded: msgid=${result.msgid ?? "unknown"}`);
4362
+ } else {
4363
+ logger.error(`request failed: errcode=${result.errcode} errmsg=${result.errmsg ?? "unknown"}`);
4364
+ }
4365
+ return result;
4359
4366
  }
4360
4367
 
4361
4368
  // src/bot.ts
@@ -4380,15 +4387,15 @@ function resolveSenderId(msg) {
4380
4387
  async function dispatchBaiduAppMessage(params) {
4381
4388
  const { cfg, account, msg, core, hooks } = params;
4382
4389
  const safeCfg = cfg ?? {};
4383
- const logger = createLogger("openclaw-baiduapp", { log: params.log, error: params.error });
4390
+ const logger2 = createLogger("openclaw-baiduapp", { log: params.log, error: params.error });
4384
4391
  const senderId = resolveSenderId(msg);
4385
4392
  const chatId = senderId;
4386
4393
  const accountConfig = account?.config ?? {};
4387
4394
  const dmPolicy = resolveDmPolicy(accountConfig);
4388
4395
  const allowFrom = resolveAllowFrom(accountConfig);
4389
- logger.debug(`dispatch: sender=${senderId} dmPolicy=${dmPolicy} allowFrom=[${allowFrom.join(",")}]`);
4396
+ logger2.debug(`dispatch: sender=${senderId} dmPolicy=${dmPolicy} allowFrom=[${allowFrom.join(",")}]`);
4390
4397
  if (dmPolicy === "disabled") {
4391
- logger.info(`dispatch rejected: dm disabled for account ${account.accountId}`);
4398
+ logger2.info(`dispatch rejected: dm disabled for account ${account.accountId}`);
4392
4399
  return;
4393
4400
  }
4394
4401
  const policyResult = checkDmPolicy({
@@ -4397,12 +4404,12 @@ async function dispatchBaiduAppMessage(params) {
4397
4404
  allowFrom
4398
4405
  });
4399
4406
  if (!policyResult.allowed) {
4400
- logger.info(`dispatch rejected: policy=${dmPolicy} reason=${policyResult.reason} sender=${senderId}`);
4407
+ logger2.info(`dispatch rejected: policy=${dmPolicy} reason=${policyResult.reason} sender=${senderId}`);
4401
4408
  return;
4402
4409
  }
4403
4410
  const channel = core.channel;
4404
4411
  if (!channel?.routing?.resolveAgentRoute || !channel.reply?.dispatchReplyWithBufferedBlockDispatcher) {
4405
- logger.warn("core routing or buffered dispatcher missing, skipping dispatch");
4412
+ logger2.warn("core routing or buffered dispatcher missing, skipping dispatch");
4406
4413
  return;
4407
4414
  }
4408
4415
  const route = channel.routing.resolveAgentRoute({
@@ -4411,11 +4418,11 @@ async function dispatchBaiduAppMessage(params) {
4411
4418
  accountId: account.accountId,
4412
4419
  peer: { kind: "dm", id: chatId }
4413
4420
  });
4414
- logger.info(
4421
+ logger2.info(
4415
4422
  `route resolved: sessionKey=${route.sessionKey} agentId=${route.agentId ?? "default"} accountId=${route.accountId}`
4416
4423
  );
4417
4424
  const rawBody = extractBaiduAppContent(msg);
4418
- logger.debug(
4425
+ logger2.debug(
4419
4426
  `message content extracted: len=${rawBody.length} preview="${rawBody.slice(0, 80)}${rawBody.length > 80 ? "..." : ""}"`
4420
4427
  );
4421
4428
  const fromLabel = `user:${senderId}`;
@@ -4478,7 +4485,7 @@ async function dispatchBaiduAppMessage(params) {
4478
4485
  sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
4479
4486
  ctx: ctxPayload,
4480
4487
  onRecordError: (err) => {
4481
- logger.error(`openclaw-baiduapp: failed updating session meta: ${String(err)}`);
4488
+ logger2.error(`openclaw-baiduapp: failed updating session meta: ${String(err)}`);
4482
4489
  }
4483
4490
  });
4484
4491
  }
@@ -4487,7 +4494,7 @@ async function dispatchBaiduAppMessage(params) {
4487
4494
  channel: "openclaw-baiduapp",
4488
4495
  accountId: account.accountId
4489
4496
  }) : void 0;
4490
- logger.info(`dispatching to agent: sessionKey=${route.sessionKey} sender=${senderId}`);
4497
+ logger2.info(`dispatching to agent: sessionKey=${route.sessionKey} sender=${senderId}`);
4491
4498
  await channel.reply.dispatchReplyWithBufferedBlockDispatcher({
4492
4499
  ctx: ctxPayload,
4493
4500
  cfg: safeCfg,
@@ -4495,20 +4502,20 @@ async function dispatchBaiduAppMessage(params) {
4495
4502
  deliver: async (payload) => {
4496
4503
  const rawText = payload.text ?? "";
4497
4504
  if (!rawText.trim()) {
4498
- logger.debug("deliver callback: empty text, skipping");
4505
+ logger2.debug("deliver callback: empty text, skipping");
4499
4506
  return;
4500
4507
  }
4501
4508
  const converted = channel.text?.convertMarkdownTables && tableMode ? channel.text.convertMarkdownTables(rawText, tableMode) : rawText;
4502
- logger.debug(`deliver callback: textLen=${converted.length}`);
4509
+ logger2.debug(`deliver callback: textLen=${converted.length}`);
4503
4510
  hooks.onChunk(converted);
4504
4511
  },
4505
4512
  onError: (err, info) => {
4506
4513
  hooks.onError?.(err);
4507
- logger.error(`${info.kind} reply failed: ${String(err)}`);
4514
+ logger2.error(`${info.kind} reply failed: ${String(err)}`);
4508
4515
  }
4509
4516
  }
4510
4517
  });
4511
- logger.info(`agent reply dispatch complete: sessionKey=${route.sessionKey} sender=${senderId}`);
4518
+ logger2.info(`agent reply dispatch complete: sessionKey=${route.sessionKey} sender=${senderId}`);
4512
4519
  }
4513
4520
 
4514
4521
  // src/runtime.ts
@@ -4797,7 +4804,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
4797
4804
  const nonce = query.get("nonce") ?? "";
4798
4805
  const signature = resolveSignatureParam(query);
4799
4806
  const primary = targets[0];
4800
- const logger = buildLogger(primary);
4807
+ const logger2 = buildLogger(primary);
4801
4808
  if (req.method === "GET") {
4802
4809
  const echostr = query.get("echostr") ?? "";
4803
4810
  if (!timestamp || !nonce || !signature || !echostr) {
@@ -4833,7 +4840,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
4833
4840
  jsonError(res, "decrypt failed");
4834
4841
  return true;
4835
4842
  }
4836
- const selected2 = selectDecryptedTarget({ candidates: decryptedCandidates2, logger });
4843
+ const selected2 = selectDecryptedTarget({ candidates: decryptedCandidates2, logger: logger2 });
4837
4844
  jsonOk(res, selected2.plaintext);
4838
4845
  return true;
4839
4846
  }
@@ -4861,14 +4868,14 @@ async function handleBaiduAppWebhookRequest(req, res) {
4861
4868
  msgSignature = xmlData.MsgSignature ?? signature;
4862
4869
  msgTimestamp = xmlData.TimeStamp ?? timestamp;
4863
4870
  msgNonce = xmlData.Nonce ?? nonce;
4864
- logger.info(`inbound xml parsed: hasEncrypt=${Boolean(encrypt)}, msg_signature=${msgSignature ? "yes" : "no"}`);
4871
+ logger2.info(`inbound xml parsed: hasEncrypt=${Boolean(encrypt)}, msg_signature=${msgSignature ? "yes" : "no"}`);
4865
4872
  } else {
4866
4873
  try {
4867
4874
  const record = JSON.parse(rawBody);
4868
4875
  encrypt = String(record.encrypt ?? record.Encrypt ?? "");
4869
- logger.info(`inbound json parsed: hasEncrypt=${Boolean(encrypt)}`);
4876
+ logger2.info(`inbound json parsed: hasEncrypt=${Boolean(encrypt)}`);
4870
4877
  } catch {
4871
- logger.warn(`inbound payload parse failed: not valid xml or json`);
4878
+ logger2.warn(`inbound payload parse failed: not valid xml or json`);
4872
4879
  jsonError(res, "invalid payload format");
4873
4880
  return true;
4874
4881
  }
@@ -4890,14 +4897,14 @@ async function handleBaiduAppWebhookRequest(req, res) {
4890
4897
  });
4891
4898
  });
4892
4899
  if (signatureMatched.length === 0) {
4893
- logger.warn(`signature verification failed: checked ${targets.length} account(s), none matched`);
4900
+ logger2.warn(`signature verification failed: checked ${targets.length} account(s), none matched`);
4894
4901
  jsonError(res, "unauthorized");
4895
4902
  return true;
4896
4903
  }
4897
- logger.debug(`signature verified: ${signatureMatched.length} account(s) matched`);
4904
+ logger2.debug(`signature verified: ${signatureMatched.length} account(s) matched`);
4898
4905
  const decryptable = signatureMatched.filter((candidate) => Boolean(candidate.account.encodingAESKey));
4899
4906
  if (decryptable.length === 0) {
4900
- logger.warn(`no account has encodingAESKey configured`);
4907
+ logger2.warn(`no account has encodingAESKey configured`);
4901
4908
  jsonError(res, "openclaw-baiduapp not configured");
4902
4909
  return true;
4903
4910
  }
@@ -4906,14 +4913,14 @@ async function handleBaiduAppWebhookRequest(req, res) {
4906
4913
  encrypt
4907
4914
  });
4908
4915
  if (decryptedCandidates.length === 0) {
4909
- logger.warn(`decrypt failed for all ${decryptable.length} candidate account(s)`);
4916
+ logger2.warn(`decrypt failed for all ${decryptable.length} candidate account(s)`);
4910
4917
  jsonError(res, "decrypt failed");
4911
4918
  return true;
4912
4919
  }
4913
- const selected = selectDecryptedTarget({ candidates: decryptedCandidates, logger });
4920
+ const selected = selectDecryptedTarget({ candidates: decryptedCandidates, logger: logger2 });
4914
4921
  const target = selected.target;
4915
4922
  if (!target.account.configured || !target.account.token || !target.account.encodingAESKey) {
4916
- logger.warn(`selected account ${target.account.accountId} not fully configured`);
4923
+ logger2.warn(`selected account ${target.account.accountId} not fully configured`);
4917
4924
  jsonError(res, "openclaw-baiduapp not configured");
4918
4925
  return true;
4919
4926
  }
@@ -4922,13 +4929,13 @@ async function handleBaiduAppWebhookRequest(req, res) {
4922
4929
  const msgtype = String(msg.msgtype ?? msg.MsgType ?? "").toLowerCase();
4923
4930
  const msgid = msg.msgid ?? msg.MsgId ? String(msg.msgid ?? msg.MsgId) : void 0;
4924
4931
  const inboundSenderId = msg.from?.userid?.trim() ?? msg.FromUserName?.trim();
4925
- logger.info(
4932
+ logger2.info(
4926
4933
  `inbound: type=${msgtype || "unknown"} msgid=${msgid ?? "none"} sender=${inboundSenderId ?? "unknown"} account=${target.account.accountId}`
4927
4934
  );
4928
4935
  if (msgtype === "stream") {
4929
4936
  const streamId2 = String(msg.stream?.id ?? "").trim();
4930
4937
  const state = streamId2 ? streams.get(streamId2) : void 0;
4931
- logger.info(
4938
+ logger2.info(
4932
4939
  `[REPLY-MODE:STREAM-POLL] stream poll request: streamId=${streamId2 || "none"} found=${Boolean(state)} finished=${state?.finished ?? "n/a"} contentLen=${state?.content.length ?? 0}`
4933
4940
  );
4934
4941
  const reply = state ? buildStreamReplyFromState(state) : buildStreamReplyFromState({
@@ -4949,7 +4956,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
4949
4956
  }
4950
4957
  if (msgid && msgidToStreamId.has(msgid)) {
4951
4958
  const streamId2 = msgidToStreamId.get(msgid) ?? "";
4952
- logger.debug(`duplicate msgid detected: msgid=${msgid} streamId=${streamId2}, returning placeholder`);
4959
+ logger2.debug(`duplicate msgid detected: msgid=${msgid} streamId=${streamId2}, returning placeholder`);
4953
4960
  const reply = buildStreamPlaceholderReply(streamId2);
4954
4961
  jsonOk(
4955
4962
  res,
@@ -4966,15 +4973,15 @@ async function handleBaiduAppWebhookRequest(req, res) {
4966
4973
  const eventtype = String(
4967
4974
  msg.event?.eventtype ?? msg.Event ?? ""
4968
4975
  ).toLowerCase();
4969
- logger.info(`event received: type=${eventtype || "unknown"}`);
4976
+ logger2.info(`event received: type=${eventtype || "unknown"}`);
4970
4977
  if (eventtype === "enter_chat" || eventtype === "subscribe") {
4971
4978
  const welcome = target.account.config.welcomeText?.trim();
4972
4979
  if (welcome && target.account.canSendActive) {
4973
4980
  const senderId2 = msg.from?.userid?.trim() ?? msg.FromUserName?.trim();
4974
4981
  if (senderId2) {
4975
- logger.info(`sending welcome message to ${senderId2}`);
4982
+ logger2.info(`sending welcome message to ${senderId2}`);
4976
4983
  sendBaiduAppMessage(target.account, { userId: senderId2 }, welcome).catch((err) => {
4977
- logger.error(`failed to send welcome message: ${String(err)}`);
4984
+ logger2.error(`failed to send welcome message: ${String(err)}`);
4978
4985
  });
4979
4986
  }
4980
4987
  }
@@ -5013,7 +5020,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
5013
5020
  finished: false,
5014
5021
  content: ""
5015
5022
  });
5016
- logger.info(`stream created: streamId=${streamId} msgid=${msgid ?? "none"}`);
5023
+ logger2.info(`stream created: streamId=${streamId} msgid=${msgid ?? "none"}`);
5017
5024
  const core = tryGetBaiduAppRuntime();
5018
5025
  const senderId = msg.from?.userid?.trim() ?? msg.FromUserName?.trim();
5019
5026
  if (core) {
@@ -5021,7 +5028,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
5021
5028
  if (state) {
5022
5029
  state.started = true;
5023
5030
  }
5024
- logger.info(
5031
+ logger2.info(
5025
5032
  `agent dispatch started: streamId=${streamId} sender=${senderId ?? "unknown"} canSendActive=${target.account.canSendActive}`
5026
5033
  );
5027
5034
  const hooks = {
@@ -5031,7 +5038,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
5031
5038
  return;
5032
5039
  }
5033
5040
  appendStreamContent(current, text);
5034
- logger.debug(
5041
+ logger2.debug(
5035
5042
  `chunk received: streamId=${streamId} chunkLen=${text.length} totalLen=${current.content.length}`
5036
5043
  );
5037
5044
  target.statusSink?.({ lastOutboundAt: Date.now() });
@@ -5044,7 +5051,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
5044
5051
  current.finished = true;
5045
5052
  current.updatedAt = Date.now();
5046
5053
  }
5047
- logger.error(`openclaw-baiduapp agent failed: ${String(err)}`);
5054
+ logger2.error(`openclaw-baiduapp agent failed: ${String(err)}`);
5048
5055
  }
5049
5056
  };
5050
5057
  dispatchBaiduAppMessage({
@@ -5061,33 +5068,33 @@ async function handleBaiduAppWebhookRequest(req, res) {
5061
5068
  current.finished = true;
5062
5069
  current.updatedAt = Date.now();
5063
5070
  const contentLen = current.content.trim().length;
5064
- logger.info(
5071
+ logger2.info(
5065
5072
  `agent dispatch done: streamId=${streamId} contentLen=${contentLen} canSendActive=${target.account.canSendActive} sender=${senderId ?? "none"}`
5066
5073
  );
5067
5074
  if (!target.account.canSendActive) {
5068
- logger.warn(
5075
+ logger2.warn(
5069
5076
  `active send skipped: appKey/appSecret not configured for account ${target.account.accountId}`
5070
5077
  );
5071
5078
  } else if (!senderId) {
5072
- logger.warn(`active send skipped: senderId is empty`);
5079
+ logger2.warn(`active send skipped: senderId is empty`);
5073
5080
  } else if (!contentLen) {
5074
- logger.warn(`active send skipped: agent produced no content`);
5081
+ logger2.warn(`active send skipped: agent produced no content`);
5075
5082
  }
5076
5083
  if (target.account.canSendActive && senderId && current.content.trim()) {
5077
5084
  try {
5078
5085
  const chunks = splitMessageByBytes(current.content, MAX_MESSAGE_BYTES);
5079
- logger.info(
5086
+ logger2.info(
5080
5087
  `[REPLY-MODE:ACTIVE-SEND] active send starting: streamId=${streamId} to=${senderId} chunks=${chunks.length} contentLen=${contentLen}`
5081
5088
  );
5082
5089
  for (let i = 0; i < chunks.length; i++) {
5083
5090
  await sendBaiduAppMessage(target.account, { userId: senderId }, chunks[i]);
5084
- logger.debug(`active send chunk ${i + 1}/${chunks.length} sent: streamId=${streamId}`);
5091
+ logger2.debug(`active send chunk ${i + 1}/${chunks.length} sent: streamId=${streamId}`);
5085
5092
  }
5086
- logger.info(
5093
+ logger2.info(
5087
5094
  `[REPLY-MODE:ACTIVE-SEND] active send complete: streamId=${streamId} chunks=${chunks.length}`
5088
5095
  );
5089
5096
  } catch (err) {
5090
- logger.error(`active send failed: streamId=${streamId} error=${String(err)}`);
5097
+ logger2.error(`active send failed: streamId=${streamId} error=${String(err)}`);
5091
5098
  }
5092
5099
  }
5093
5100
  }
@@ -5099,10 +5106,10 @@ async function handleBaiduAppWebhookRequest(req, res) {
5099
5106
  current.finished = true;
5100
5107
  current.updatedAt = Date.now();
5101
5108
  }
5102
- logger.error(`agent dispatch failed: streamId=${streamId} error=${String(err)}`);
5109
+ logger2.error(`agent dispatch failed: streamId=${streamId} error=${String(err)}`);
5103
5110
  });
5104
5111
  } else {
5105
- logger.warn(`runtime not available: streamId=${streamId} \u2014 agent dispatch skipped, no reply will be generated`);
5112
+ logger2.warn(`runtime not available: streamId=${streamId} \u2014 agent dispatch skipped, no reply will be generated`);
5106
5113
  const state = streams.get(streamId);
5107
5114
  if (state) {
5108
5115
  state.finished = true;
@@ -5110,7 +5117,7 @@ async function handleBaiduAppWebhookRequest(req, res) {
5110
5117
  }
5111
5118
  }
5112
5119
  const placeholderReply = buildStreamPlaceholderReply(streamId);
5113
- logger.debug(`stream placeholder reply sent: streamId=${streamId}`);
5120
+ logger2.debug(`stream placeholder reply sent: streamId=${streamId}`);
5114
5121
  jsonOk(
5115
5122
  res,
5116
5123
  buildEncryptedJsonReply({
@@ -5333,6 +5340,48 @@ var baiduAppPlugin = {
5333
5340
  error: err instanceof Error ? err : new Error(String(err))
5334
5341
  };
5335
5342
  }
5343
+ },
5344
+ sendMedia: async (params) => {
5345
+ const account = resolveBaiduAppAccount({ cfg: params.cfg, accountId: params.accountId ?? void 0 });
5346
+ if (!account.canSendActive) {
5347
+ return {
5348
+ channel: "openclaw-baiduapp",
5349
+ ok: false,
5350
+ messageId: "",
5351
+ error: new Error("Account not configured for active sending (missing appKey or appSecret)")
5352
+ };
5353
+ }
5354
+ let to = params.to;
5355
+ const channelPrefix = "openclaw-baiduapp:";
5356
+ if (to.startsWith(channelPrefix)) {
5357
+ to = to.slice(channelPrefix.length);
5358
+ }
5359
+ const target = to.startsWith("user:") ? { userId: to.slice(5) } : { userId: to };
5360
+ const content = params.text?.trim() || params.mediaUrl || "";
5361
+ if (!content) {
5362
+ return {
5363
+ channel: "openclaw-baiduapp",
5364
+ ok: false,
5365
+ messageId: "",
5366
+ error: new Error("No content to send (media not supported, text is empty)")
5367
+ };
5368
+ }
5369
+ try {
5370
+ const result = await sendBaiduAppMessage(account, target, content);
5371
+ return {
5372
+ channel: "openclaw-baiduapp",
5373
+ ok: result.ok,
5374
+ messageId: result.msgid ?? "",
5375
+ error: result.ok ? void 0 : new Error(result.errmsg ?? "send failed")
5376
+ };
5377
+ } catch (err) {
5378
+ return {
5379
+ channel: "openclaw-baiduapp",
5380
+ ok: false,
5381
+ messageId: "",
5382
+ error: err instanceof Error ? err : new Error(String(err))
5383
+ };
5384
+ }
5336
5385
  }
5337
5386
  },
5338
5387
  gateway: {