import type {
ChannelThreadingContext,
ChannelThreadingToolContext,
} from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime"; import { resolveSlackAccount, resolveSlackReplyToMode } from "./accounts.js"; import { normalizeSlackThreadTsCandidate } from "./thread-ts.js";
export function buildSlackThreadingToolContext(params: {
cfg: OpenClawConfig;
accountId?: string | null;
context: ChannelThreadingContext;
hasRepliedRef?: { value: boolean };
}): ChannelThreadingToolContext { const account = resolveSlackAccount({
cfg: params.cfg,
accountId: params.accountId,
}); const configuredReplyToMode = resolveSlackReplyToMode(account, params.context.ChatType); const hasExplicitThreadTarget = params.context.MessageThreadId != null; const effectiveReplyToMode = hasExplicitThreadTarget ? "all" : configuredReplyToMode; const threadId = params.context.MessageThreadId ?? params.context.ReplyToId; // For channel messages, To is "channel:C…" — extract the bare ID. // For DMs, To is "user:U…" which can't be used for reactions; fall back // to NativeChannelId (the raw Slack channel id, e.g. "D…"). const currentChannelId = params.context.To?.startsWith("channel:")
? params.context.To.slice("channel:".length)
: normalizeOptionalString(params.context.NativeChannelId); return {
currentChannelId,
currentThreadTs: normalizeSlackThreadTsCandidate(threadId),
replyToMode: effectiveReplyToMode,
hasRepliedRef: params.hasRepliedRef,
};
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.