{
  "schemaVersion": "1.0",
  "item": {
    "slug": "claw-lark-patches",
    "name": "claw-lark Patches",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/Pengxiao-Wang/claw-lark-patches",
    "canonicalUrl": "https://clawhub.ai/Pengxiao-Wang/claw-lark-patches",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/claw-lark-patches",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claw-lark-patches",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/patch-details.md",
      "scripts/apply-patches.sh"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/claw-lark-patches"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/claw-lark-patches",
    "agentPageUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent",
    "manifestUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "claw-lark Patches",
        "body": "claw-lark is a compiled plugin — we patch dist files directly. Every plugin update wipes these patches. This skill documents exactly what to change and provides an auto-apply script."
      },
      {
        "title": "Quick Apply",
        "body": "bash scripts/apply-patches.sh\n\nThen restart gateway: openclaw gateway restart"
      },
      {
        "title": "Patches Overview",
        "body": "Four files are patched:\n\nchannel.js — messaging.targetResolver (target ID recognition) + outbound account resolution\nmonitor.js — requireMention filtering + reply-in-thread for deliver callback\nprovider.js — reply-in-thread for sendTextMessage\nsend.js — reply-in-thread for SDK reply calls"
      },
      {
        "title": "0. channel.js — Target Resolution + Account Resolution (2026-02-22)",
        "body": "Problem 1: message(send, lark, \"oc_xxx\") returns \"Unknown target\" because claw-lark has no messaging.targetResolver.looksLikeId. The core doesn't recognize oc_/ou_/on_ as valid IDs and falls through to directory lookup which fails.\n\nFix: Add messaging property to larkPlugin export:\n\nImport looksLikeLarkId, normalizeLarkTarget from ./utils.js\nAdd messaging.targetResolver.looksLikeId using existing looksLikeLarkId()\nAdd messaging.normalizeTarget using existing normalizeLarkTarget()\n\nProblem 2: outbound.sendText gets { cfg, to, accountId } from core but expects { account, recipientId }. The account object is undefined → \"Cannot read properties of undefined (reading 'appId')\".\n\nFix: All 5 outbound methods (sendText, sendMedia, downloadMedia, addReaction, removeReaction) add:\n\nconst account = args.account ?? resolveAccount(args.cfg, args.accountId ?? \"default\");\nconst recipientId = args.recipientId ?? args.to;"
      },
      {
        "title": "1. monitor.js — requireMention Filter",
        "body": "Location: routeMessage() function, after parseMessage(event) and the log line.\n\nWhat: In group chats, skip messages that don't @mention our bot.\n\nKey facts:\n\nevent.message is the correct path (NOT event.event.message)\nLark webhook message.mentions contains mention data with id.open_id\nBot open_id: set via BOT_OPEN_ID env var when running apply-patches.sh\nAll bots lack user_id (empty string) — cannot use !user_id to detect \"is it me\"\n@_user_N text placeholders appear for ALL @'d bots, not just ours — don't use regex match\nFallback: if mentions array empty, check parsed.text.includes(\"@\" + BOT_NAME) (set via BOT_NAME env var)"
      },
      {
        "title": "2. monitor.js — Reply in Thread (deliver callback)",
        "body": "Location: Inside dispatchReplyWithBufferedBlockDispatcher deliver callback.\n\nWhat:\n\nSet replyToId = payload.replyToId || parsed.threadId || parsed.messageId (always have a value)\nUse client.im.message.reply() with reply_in_thread: true instead of client.im.message.create() with root_id\n\nKey facts:\n\nroot_id on create only associates with existing thread, does NOT create new thread\nreply_in_thread: true on reply API creates a new thread\nWorks in both p2p and group chats"
      },
      {
        "title": "3. provider.js — sendTextMessage Thread Reply",
        "body": "Location: sendTextMessage() function.\n\nWhat: When threadId is provided, use client.im.message.reply() instead of client.im.message.create()."
      },
      {
        "title": "4. send.js — reply_in_thread on SDK Reply",
        "body": "Location: sendMessageLark() and sendCardLark() reply branches.\n\nWhat: Add reply_in_thread: true to data object in client.im.message.reply() calls."
      },
      {
        "title": "Verification",
        "body": "After applying patches and restarting gateway:\n\nSend a group message WITHOUT @bot → should be silently ignored\nSend a group message WITH @bot → should reply in thread\nSend a DM → should reply in thread\n@ another bot → should be silently ignored"
      },
      {
        "title": "See Also",
        "body": "references/patch-details.md — Full code diffs for each patch"
      }
    ],
    "body": "claw-lark Patches\n\nclaw-lark is a compiled plugin — we patch dist files directly. Every plugin update wipes these patches. This skill documents exactly what to change and provides an auto-apply script.\n\nQuick Apply\nbash scripts/apply-patches.sh\n\n\nThen restart gateway: openclaw gateway restart\n\nPatches Overview\n\nFour files are patched:\n\nchannel.js — messaging.targetResolver (target ID recognition) + outbound account resolution\nmonitor.js — requireMention filtering + reply-in-thread for deliver callback\nprovider.js — reply-in-thread for sendTextMessage\nsend.js — reply-in-thread for SDK reply calls\nPatch Details\n0. channel.js — Target Resolution + Account Resolution (2026-02-22)\n\nProblem 1: message(send, lark, \"oc_xxx\") returns \"Unknown target\" because claw-lark has no messaging.targetResolver.looksLikeId. The core doesn't recognize oc_/ou_/on_ as valid IDs and falls through to directory lookup which fails.\n\nFix: Add messaging property to larkPlugin export:\n\nImport looksLikeLarkId, normalizeLarkTarget from ./utils.js\nAdd messaging.targetResolver.looksLikeId using existing looksLikeLarkId()\nAdd messaging.normalizeTarget using existing normalizeLarkTarget()\n\nProblem 2: outbound.sendText gets { cfg, to, accountId } from core but expects { account, recipientId }. The account object is undefined → \"Cannot read properties of undefined (reading 'appId')\".\n\nFix: All 5 outbound methods (sendText, sendMedia, downloadMedia, addReaction, removeReaction) add:\n\nconst account = args.account ?? resolveAccount(args.cfg, args.accountId ?? \"default\");\nconst recipientId = args.recipientId ?? args.to;\n\n1. monitor.js — requireMention Filter\n\nLocation: routeMessage() function, after parseMessage(event) and the log line.\n\nWhat: In group chats, skip messages that don't @mention our bot.\n\nKey facts:\n\nevent.message is the correct path (NOT event.event.message)\nLark webhook message.mentions contains mention data with id.open_id\nBot open_id: set via BOT_OPEN_ID env var when running apply-patches.sh\nAll bots lack user_id (empty string) — cannot use !user_id to detect \"is it me\"\n@_user_N text placeholders appear for ALL @'d bots, not just ours — don't use regex match\nFallback: if mentions array empty, check parsed.text.includes(\"@\" + BOT_NAME) (set via BOT_NAME env var)\n2. monitor.js — Reply in Thread (deliver callback)\n\nLocation: Inside dispatchReplyWithBufferedBlockDispatcher deliver callback.\n\nWhat:\n\nSet replyToId = payload.replyToId || parsed.threadId || parsed.messageId (always have a value)\nUse client.im.message.reply() with reply_in_thread: true instead of client.im.message.create() with root_id\n\nKey facts:\n\nroot_id on create only associates with existing thread, does NOT create new thread\nreply_in_thread: true on reply API creates a new thread\nWorks in both p2p and group chats\n3. provider.js — sendTextMessage Thread Reply\n\nLocation: sendTextMessage() function.\n\nWhat: When threadId is provided, use client.im.message.reply() instead of client.im.message.create().\n\n4. send.js — reply_in_thread on SDK Reply\n\nLocation: sendMessageLark() and sendCardLark() reply branches.\n\nWhat: Add reply_in_thread: true to data object in client.im.message.reply() calls.\n\nVerification\n\nAfter applying patches and restarting gateway:\n\nSend a group message WITHOUT @bot → should be silently ignored\nSend a group message WITH @bot → should reply in thread\nSend a DM → should reply in thread\n@ another bot → should be silently ignored\nSee Also\nreferences/patch-details.md — Full code diffs for each patch"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/Pengxiao-Wang/claw-lark-patches",
    "publisherUrl": "https://clawhub.ai/Pengxiao-Wang/claw-lark-patches",
    "owner": "Pengxiao-Wang",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/claw-lark-patches",
    "downloadUrl": "https://openagent3.xyz/downloads/claw-lark-patches",
    "agentUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent",
    "manifestUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/claw-lark-patches/agent.md"
  }
}