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

推荐订阅源

P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
B
Blog
月光博客
月光博客
博客园 - 【当耐特】
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
博客园 - Franky
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Last Week in AI
Last Week in AI
B
Blog RSS Feed
H
Help Net Security

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
refactor: share MSTeams outbound send resolvers · opencla...
vincentkoc · 2026-05-30 · via Recent Commits to openclaw:main
1-

import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";

1+

import {

2+

resolveOutboundSendDep,

3+

type OutboundSendDeps,

4+

} from "openclaw/plugin-sdk/channel-outbound";

25

import {

36

attachChannelToResult,

47

createAttachedChannelResultAdapter,

@@ -25,6 +28,48 @@ function asObjectRecord(value: unknown): Record<string, unknown> | undefined {

25282629

const MSTEAMS_TEXT_CHUNK_LIMIT = 4000;

273031+

type MSTeamsSendConfig = Parameters<typeof sendMessageMSTeams>[0]["cfg"];

32+

type MSTeamsSendResult = { messageId: string; conversationId: string };

33+

type MSTeamsMediaSendOptions = {

34+

mediaUrl?: string;

35+

mediaLocalRoots?: readonly string[];

36+

mediaReadFile?: (filePath: string) => Promise<Buffer>;

37+

};

38+

type MSTeamsTextSendFn = (to: string, text: string) => Promise<MSTeamsSendResult>;

39+

type MSTeamsMediaSendFn = (

40+

to: string,

41+

text: string,

42+

opts?: MSTeamsMediaSendOptions,

43+

) => Promise<MSTeamsSendResult>;

44+45+

function resolveMSTeamsTextSend(params: {

46+

cfg: MSTeamsSendConfig;

47+

deps?: OutboundSendDeps;

48+

}): MSTeamsTextSendFn {

49+

return (

50+

resolveOutboundSendDep<MSTeamsTextSendFn>(params.deps, "msteams") ??

51+

((to, text) => sendMessageMSTeams({ cfg: params.cfg, to, text }))

52+

);

53+

}

54+55+

function resolveMSTeamsMediaSend(params: {

56+

cfg: MSTeamsSendConfig;

57+

deps?: OutboundSendDeps;

58+

}): MSTeamsMediaSendFn {

59+

return (

60+

resolveOutboundSendDep<MSTeamsMediaSendFn>(params.deps, "msteams") ??

61+

((to, text, opts) =>

62+

sendMessageMSTeams({

63+

cfg: params.cfg,

64+

to,

65+

text,

66+

mediaUrl: opts?.mediaUrl,

67+

mediaLocalRoots: opts?.mediaLocalRoots,

68+

mediaReadFile: opts?.mediaReadFile,

69+

}))

70+

);

71+

}

72+2873

export const msteamsOutbound: ChannelOutboundAdapter = {

2974

deliveryMode: "direct",

3075

chunker: chunkTextForOutbound,

@@ -91,26 +136,7 @@ export const msteamsOutbound: ChannelOutboundAdapter = {

91136

}),

92137

);

93138

if (mediaUrls.length > 0) {

94-

type SendFn = (

95-

to: string,

96-

text: string,

97-

opts?: {

98-

mediaUrl?: string;

99-

mediaLocalRoots?: readonly string[];

100-

mediaReadFile?: (filePath: string) => Promise<Buffer>;

101-

},

102-

) => Promise<{ messageId: string; conversationId: string }>;

103-

const send =

104-

resolveOutboundSendDep<SendFn>(deps, "msteams") ??

105-

((to, text, opts) =>

106-

sendMessageMSTeams({

107-

cfg,

108-

to,

109-

text,

110-

mediaUrl: opts?.mediaUrl,

111-

mediaLocalRoots: opts?.mediaLocalRoots,

112-

mediaReadFile: opts?.mediaReadFile,

113-

}));

139+

const send = resolveMSTeamsMediaSend({ cfg, deps });

114140

const result = await sendPayloadMediaSequence({

115141

text,

116142

mediaUrls,

@@ -122,18 +148,12 @@ export const msteamsOutbound: ChannelOutboundAdapter = {

122148

}

123149

}

124150

if (text.trim()) {

125-

type SendFn = (

126-

to: string,

127-

text: string,

128-

) => Promise<{ messageId: string; conversationId: string }>;

129-

const send =

130-

resolveOutboundSendDep<SendFn>(deps, "msteams") ??

131-

((to, text) => sendMessageMSTeams({ cfg, to, text }));

151+

const send = resolveMSTeamsTextSend({ cfg, deps });

132152

const chunks = resolveTextChunksWithFallback(

133153

text,

134154

chunkTextForOutbound(text, MSTEAMS_TEXT_CHUNK_LIMIT),

135155

);

136-

let result: Awaited<ReturnType<SendFn>>;

156+

let result: Awaited<ReturnType<MSTeamsTextSendFn>>;

137157

for (const chunk of chunks) {

138158

result = await send(to, chunk);

139159

}

@@ -144,36 +164,11 @@ export const msteamsOutbound: ChannelOutboundAdapter = {

144164

...createAttachedChannelResultAdapter({

145165

channel: "msteams",

146166

sendText: async ({ cfg, to, text, deps }) => {

147-

type SendFn = (

148-

to: string,

149-

text: string,

150-

) => Promise<{ messageId: string; conversationId: string }>;

151-

const send =

152-

resolveOutboundSendDep<SendFn>(deps, "msteams") ??

153-

((to, text) => sendMessageMSTeams({ cfg, to, text }));

167+

const send = resolveMSTeamsTextSend({ cfg, deps });

154168

return await send(to, text);

155169

},

156170

sendMedia: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, mediaReadFile, deps }) => {

157-

type SendFn = (

158-

to: string,

159-

text: string,

160-

opts?: {

161-

mediaUrl?: string;

162-

mediaLocalRoots?: readonly string[];

163-

mediaReadFile?: (filePath: string) => Promise<Buffer>;

164-

},

165-

) => Promise<{ messageId: string; conversationId: string }>;

166-

const send =

167-

resolveOutboundSendDep<SendFn>(deps, "msteams") ??

168-

((to, text, opts) =>

169-

sendMessageMSTeams({

170-

cfg,

171-

to,

172-

text,

173-

mediaUrl: opts?.mediaUrl,

174-

mediaLocalRoots: opts?.mediaLocalRoots,

175-

mediaReadFile: opts?.mediaReadFile,

176-

}));

171+

const send = resolveMSTeamsMediaSend({ cfg, deps });

177172

return await send(to, text, { mediaUrl, mediaLocalRoots, mediaReadFile });

178173

},

179174

sendPoll: async ({ cfg, to, poll }) => {