惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
G
Google Developers Blog
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
爱范儿
爱范儿
B
Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
博客园_首页
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(slack): reduce message hot-path overhead · openclaw/...
vincentkoc · 2026-05-07 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -109,7 +109,13 @@ const UNICODE_TO_SLACK: Record<string, string> = {

109109

};

110110
111111

function toSlackEmojiName(emoji: string): string {

112-

const trimmed = emoji.trim().replace(/^:+|:+$/g, "");

112+

let trimmed = emoji.trim();

113+

while (trimmed.startsWith(":")) {

114+

trimmed = trimmed.slice(1);

115+

}

116+

while (trimmed.endsWith(":")) {

117+

trimmed = trimmed.slice(0, -1);

118+

}

113119

return UNICODE_TO_SLACK[trimmed] ?? trimmed;

114120

}

115121
Original file line numberDiff line numberDiff line change

@@ -262,29 +262,29 @@ export async function resolveSlackMessageContent(params: {

262262

threadStarter: params.threadStarter,

263263

});

264264
265-

const media =

265+

const mediaPromise =

266266

ownFiles && ownFiles.length > 0

267-

? await (async () => {

268-

const { resolveSlackMedia } = await loadSlackMediaModule();

269-

return resolveSlackMedia({

267+

? loadSlackMediaModule().then(({ resolveSlackMedia }) =>

268+

resolveSlackMedia({

270269

files: ownFiles,

271270

token: params.botToken,

272271

maxBytes: params.mediaMaxBytes,

273-

});

274-

})()

275-

: null;

272+

}),

273+

)

274+

: Promise.resolve(null);

276275
277-

const attachmentContent =

276+

const attachmentContentPromise =

278277

params.message.attachments && params.message.attachments.length > 0

279-

? await (async () => {

280-

const { resolveSlackAttachmentContent } = await loadSlackMediaModule();

281-

return resolveSlackAttachmentContent({

278+

? loadSlackMediaModule().then(({ resolveSlackAttachmentContent }) =>

279+

resolveSlackAttachmentContent({

282280

attachments: params.message.attachments,

283281

token: params.botToken,

284282

maxBytes: params.mediaMaxBytes,

285-

});

286-

})()

287-

: null;

283+

}),

284+

)

285+

: Promise.resolve(null);

286+
287+

const [media, attachmentContent] = await Promise.all([mediaPromise, attachmentContentPromise]);

288288
289289

const mergedMedia = [...(media ?? []), ...(attachmentContent?.media ?? [])];

290290

const effectiveDirectMedia = mergedMedia.length > 0 ? mergedMedia : null;

Original file line numberDiff line numberDiff line change

@@ -67,6 +67,8 @@ import { isSlackSubteamMentionForBot } from "./subteam-mentions.js";

6767

import type { PreparedSlackMessage } from "./types.js";

6868
6969

const mentionRegexCache = new WeakMap<SlackMonitorContext, Map<string, RegExp[]>>();

70+

const SLACK_ANY_MENTION_RE = /<@[^>]+>|<!subteam\^[^>]+>/;

71+

const SLACK_SUBTEAM_MENTION_MARKER = "<!subteam^";

7072
7173

function resolveCachedMentionRegexes(

7274

ctx: SlackMonitorContext,

@@ -286,17 +288,20 @@ export async function prepareSlackMessage(params: {

286288

return null;

287289

}

288290

const { senderId, allowFromLower } = authorization;

289-

const hasAnyMention = /<@[^>]+>|<!subteam\^[^>]+>/.test(message.text ?? "");

291+

const messageText = message.text ?? "";

292+

const hasAnyMention = SLACK_ANY_MENTION_RE.test(messageText);

293+

const hasSubteamMention = messageText.includes(SLACK_SUBTEAM_MENTION_MARKER);

290294

const explicitlyMentioned = Boolean(

291295

ctx.botUserId &&

292-

(message.text?.includes(`<@${ctx.botUserId}>`) ||

293-

(await isSlackSubteamMentionForBot({

294-

client: ctx.app.client,

295-

text: message.text,

296-

botUserId: ctx.botUserId,

297-

teamId: ctx.teamId,

298-

log: logVerbose,

299-

}))),

296+

(messageText.includes(`<@${ctx.botUserId}>`) ||

297+

(hasSubteamMention &&

298+

(await isSlackSubteamMentionForBot({

299+

client: ctx.app.client,

300+

text: messageText,

301+

botUserId: ctx.botUserId,

302+

teamId: ctx.teamId,

303+

log: logVerbose,

304+

})))),

300305

);

301306

const seedTopLevelRoomThreadBySource =

302307

opts.source === "app_mention" || opts.wasMentioned === true || explicitlyMentioned;

@@ -315,7 +320,7 @@ export async function prepareSlackMessage(params: {

315320

opts.wasMentioned ??

316321

(!isDirectMessage &&

317322

matchesMentionWithExplicit({

318-

text: message.text ?? "",

323+

text: messageText,

319324

mentionRegexes,

320325

explicit: {

321326

hasAnyMention,