gewe-openclaw 2026.2.2 → 2026.2.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/delivery.ts +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gewe-openclaw",
3
- "version": "2026.2.2",
3
+ "version": "2026.2.3",
4
4
  "type": "module",
5
5
  "description": "OpenClaw GeWe channel plugin",
6
6
  "license": "MIT",
package/src/delivery.ts CHANGED
@@ -497,6 +497,21 @@ async function resolveLinkThumbUrl(params: {
497
497
  }
498
498
  }
499
499
 
500
+ function normalizeMediaToken(raw: string): string {
501
+ let value = raw.trim();
502
+ if (value.toUpperCase().startsWith("MEDIA:")) {
503
+ value = value.slice("MEDIA:".length).trim();
504
+ }
505
+ if (
506
+ (value.startsWith("`") && value.endsWith("`")) ||
507
+ (value.startsWith("\"") && value.endsWith("\"")) ||
508
+ (value.startsWith("'") && value.endsWith("'"))
509
+ ) {
510
+ value = value.slice(1, -1).trim();
511
+ }
512
+ return value;
513
+ }
514
+
500
515
  async function stageMedia(params: {
501
516
  account: ResolvedGeweAccount;
502
517
  cfg: OpenClawConfig;
@@ -504,7 +519,7 @@ async function stageMedia(params: {
504
519
  allowRemote: boolean;
505
520
  }): Promise<ResolvedMedia> {
506
521
  const core = getGeweRuntime();
507
- const rawUrl = params.mediaUrl.trim();
522
+ const rawUrl = normalizeMediaToken(params.mediaUrl);
508
523
  if (!rawUrl) throw new Error("mediaUrl is empty");
509
524
 
510
525
  if (looksLikeHttpUrl(rawUrl) && params.allowRemote) {
@@ -598,6 +613,7 @@ export async function deliverGewePayload(params: {
598
613
  const trimmedText = payload.text?.trim() ?? "";
599
614
  const mediaUrl =
600
615
  payload.mediaUrl?.trim() || payload.mediaUrls?.[0]?.trim() || "";
616
+ const normalizedMediaUrl = normalizeMediaToken(mediaUrl);
601
617
 
602
618
  if (geweData?.link) {
603
619
  const link = geweData.link;
@@ -625,12 +641,12 @@ export async function deliverGewePayload(params: {
625
641
  if (mediaUrl) {
626
642
  const audioAsVoice = payload.audioAsVoice === true;
627
643
  const forceFile = geweData?.forceFile === true;
628
- const ttsVoiceHint = !forceFile && looksLikeTtsVoiceMediaUrl(mediaUrl);
644
+ const ttsVoiceHint = !forceFile && looksLikeTtsVoiceMediaUrl(normalizedMediaUrl);
629
645
  const wantsVoice = !forceFile && (audioAsVoice || ttsVoiceHint);
630
646
  const staged = await stageMedia({
631
647
  account,
632
648
  cfg,
633
- mediaUrl,
649
+ mediaUrl: normalizedMediaUrl,
634
650
  allowRemote: !wantsVoice,
635
651
  });
636
652
  const contentType = staged.contentType;