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

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