























@@ -1,5 +1,6 @@
11import type { AgentToolResult } from "@mariozechner/pi-agent-core";
22import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
3+import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
34import { parseSlackBlocksInput } from "./blocks-input.js";
45import {
56createActionGate,
@@ -26,6 +27,19 @@ const messagingActions = new Set([
2627const reactionsActions = new Set(["react", "reactions"]);
2728const pinActions = new Set(["pinMessage", "unpinMessage", "listPins"]);
282930+function sameSlackChannelTarget(targetChannel: string, currentChannelId: string): boolean {
31+const parsedTarget = parseSlackTarget(targetChannel, {
32+defaultKind: "channel",
33+});
34+if (!parsedTarget || parsedTarget.kind !== "channel") {
35+return false;
36+}
37+return (
38+normalizeLowercaseStringOrEmpty(parsedTarget.id) ===
39+normalizeLowercaseStringOrEmpty(currentChannelId)
40+);
41+}
42+2943type SlackActionsRuntimeModule = typeof import("./actions.runtime.js");
3044type SlackAccountsRuntimeModule = typeof import("./accounts.runtime.js");
3145@@ -105,16 +119,8 @@ function resolveThreadTsFromContext(
105119return undefined;
106120}
107121108-const parsedTarget = parseSlackTarget(targetChannel, {
109-defaultKind: "channel",
110-});
111-if (!parsedTarget || parsedTarget.kind !== "channel") {
112-return undefined;
113-}
114-const normalizedTarget = parsedTarget.id;
115-116122// Different channel - don't inject
117-if (normalizedTarget !== context.currentChannelId) {
123+if (!sameSlackChannelTarget(targetChannel, context.currentChannelId)) {
118124return undefined;
119125}
120126@@ -267,8 +273,7 @@ export async function handleSlackAction(
267273// threadTs: once we send a message to the current channel, consider the
268274// first reply "used" so later tool calls don't auto-thread again.
269275if (context?.hasRepliedRef && context.currentChannelId) {
270-const parsedTarget = parseSlackTarget(to, { defaultKind: "channel" });
271-if (parsedTarget?.kind === "channel" && parsedTarget.id === context.currentChannelId) {
276+if (sameSlackChannelTarget(to, context.currentChannelId)) {
272277context.hasRepliedRef.value = true;
273278}
274279}
@@ -310,8 +315,7 @@ export async function handleSlackAction(
310315}
311316312317if (context?.hasRepliedRef && context.currentChannelId) {
313-const parsedTarget = parseSlackTarget(to, { defaultKind: "channel" });
314-if (parsedTarget?.kind === "channel" && parsedTarget.id === context.currentChannelId) {
318+if (sameSlackChannelTarget(to, context.currentChannelId)) {
315319context.hasRepliedRef.value = true;
316320}
317321}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。