MCPcopy Create free account

hub / github.com/WecomTeam/wecom-openclaw-plugin / functions

Functions367 in github.com/WecomTeam/wecom-openclaw-plugin

↓ 70 callersMethodget
获取 chatId 对应的 reqId(仅内存)
src/reqid-store.ts:36
↓ 43 callersMethodset
设置 chatId 对应的 reqId(仅写入内存)
src/reqid-store.ts:34
↓ 41 callersMethoddelete
删除 chatId 对应的 reqId
src/reqid-store.ts:40
↓ 25 callersMethodupdateStream
* **updateStream (更新流状态)** * * 原子更新流状态,并自动刷新 updatedAt 时间戳。 * @param streamId 流会话 ID * @param mutator 状态修改函数
src/webhook/state.ts:150
↓ 19 callersFunctionresolveWeComAccountMulti
(params: { cfg: OpenClawConfig; accountId?: string | null; })
src/accounts.ts:151
↓ 12 callersMethodonStreamFinished
* 在一个 stream 完成后推进会话队列:将 queued 批次提升为 active,并在需要时触发 flush。
src/webhook/state.ts:334
↓ 11 callersFunctionasText
(value: unknown)
src/shared/xml-parser.ts:99
↓ 11 callersMethodgetStream
* **getStream (获取流状态)** * * 根据 streamId 获取当前的会话状态。 * @param streamId 流会话 ID
src/webhook/state.ts:97
↓ 10 callersFunctionwecomFetch
(input: string | URL, init?: RequestInit, opts?: WecomHttpOptions)
src/webhook/http.ts:51
↓ 9 callersMethodaddPendingMessage
* **addPendingMessage (添加待处理消息 / 防抖聚合)** * * 将收到的消息加入待处理队列。如果相同 pendingKey 已存在,则是防抖聚合;否则创建新条目。 * 会自动设置或重置防抖定时器。 * * @param
src/webhook/state.ts:185
↓ 9 callersMethodmatch
* 判断是否对当前调用生效 * * 返回 true 时才会执行 beforeCall / afterCall
src/mcp/interceptors/types.ts:57
↓ 8 callersFunctionwithTimeout
( promise: Promise<T>, timeoutMs: number, message?: string, )
src/timeout.ts:15
↓ 7 callersFunctioncoerceToInt
* 将 LLM 可能输出的字符串/非法值修正为企业微信 API 要求的整数。 * 返回修正后的整数,若无法识别则返回 undefined(由调用方决定是否删除该字段)。
src/template-card-parser.ts:22
↓ 7 callersFunctiongetActiveReplyUrl
* 获取 response_url
src/webhook/monitor.ts:1219
↓ 7 callersFunctiongetMonitorState
()
src/webhook/gateway.ts:86
↓ 7 callersFunctionhasMultiAccounts
(cfg: OpenClawConfig)
src/accounts.ts:42
↓ 7 callersFunctionsetWeComAccountMulti
( cfg: OpenClawConfig, updates: Partial<WeComConfig>, accountId?: string, )
src/accounts.ts:237
↓ 6 callersFunctioncacheKey
* 生成多账号感知的缓存 key * * 不同账号的同一 category 对应不同的 MCP Server(URL、凭据均不同), * 必须用 accountId:category 的复合键隔离,避免跨账号缓存污染。
src/mcp/transport.ts:156
↓ 6 callersFunctionisAgentConfigured
(target: WecomWebhookTarget)
src/webhook/helpers.ts:187
↓ 6 callersFunctionresolveDefaultWeComAccountId
(cfg: OpenClawConfig)
src/accounts.ts:71
↓ 6 callersFunctionsendBotFallbackPromptNow
* 通过 response_url 推送 Bot 兜底提示 * * 对齐 lh 版:直接 POST JSON,不加密。
src/webhook/monitor.ts:1238
↓ 6 callersFunctionsendJsonRpc
( category: string, method: string, params?: Record<string, unknown>, options?: SendJsonRpcOptions, )
src/mcp/transport.ts:663
↓ 6 callersFunctionsendText
发送纯文本响应
src/webhook/handler.ts:181
↓ 6 callersFunctionsendWeComMessage
* 使用 SDK 的 sendMessage 主动发送企业微信消息 * 优先 Bot WebSocket,不可用时自动回退到 Agent HTTP API
src/channel.ts:33
↓ 6 callersFunctiontextResult
(data: unknown)
src/mcp/tool.ts:53
↓ 5 callersFunctionbuildFallbackPrompt
(params: { kind: "media" | "timeout" | "error"; agentConfigured: boolean; userId?: string; filename?:
src/webhook/helpers.ts:92
↓ 5 callersFunctionresolveWecomEgressProxyUrlFromNetwork
(network: any)
src/agent/api-client.ts:11
↓ 5 callersFunctionsendWeComReply
(params: { wsClient: WSClient; frame: WsFrame; text?: string; runtime: RuntimeEnv; /** 是否为流式回复的最终消息,
src/message-sender.ts:42
↓ 4 callersFunctionagentDmMedia
* 通过 Agent 私信发送媒体(对齐 lh 版 sendAgentDmMedia) * * 对齐 lh 版:接受 mediaUrlOrPath,内部判断 URL 或本地路径。
src/webhook/monitor.ts:1325
↓ 4 callersFunctioncleanup
()
src/monitor.ts:956
↓ 4 callersFunctionclearCategoryCache
(accountId: string, category: string)
src/mcp/transport.ts:597
↓ 4 callersFunctioncoerceToBool
将 LLM 可能输出的字符串/非法值修正为布尔值
src/template-card-parser.ts:38
↓ 4 callersMethodcreateStream
* **createStream (创建流会话)** * * 初始化一个新的流式会话状态。 * @param params.msgid (可选) 企业微信消息 ID,用于后续去重映射 * @returns 生成的 streamId (Hex 字符串)
src/webhook/state.ts:65
↓ 4 callersFunctiondecryptWecomMediaWithMeta
( url: string, encodingAESKey: string, params?: { maxBytes?: number; http?: WecomHttpOptions }, )
src/webhook/media.ts:40
↓ 4 callersFunctionformatDecryptError
格式化解密错误信息(对齐原版格式:message + cause)
src/webhook/helpers.ts:450
↓ 4 callersFunctiongenerateKey
* 生成唯一的 question_key / submit_button.key。
src/template-card-parser.ts:397
↓ 4 callersFunctiongetAccessToken
(agent: ResolvedAgentAccount)
src/agent/api-client.ts:82
↓ 4 callersFunctiongetOrCreateReqIdStore
* ReqId 持久化存储管理 * 参考 createPersistentDedupe 模式:内存 + 磁盘双层、文件锁、原子写入、TTL 过期、防抖写入 * 重启后可从磁盘恢复,确保主动推送消息时能获取到 reqId
src/state-manager.ts:197
↓ 4 callersFunctiongetWeComWebSocket
(accountId: string)
src/state-manager.ts:75
↓ 4 callersFunctioninferInboundMediaMeta
* 推断入站媒体的 MIME 和文件名(对齐原版 inferInboundMediaMeta) * * 优先级链:magic bytes > HTTP header > URL 路径 > 文件名扩展 > 默认值
src/webhook/helpers.ts:632
↓ 4 callersFunctionlistWeComAccountIds
(cfg: OpenClawConfig)
src/accounts.ts:50
↓ 4 callersMethodmarkStarted
* **markStarted (标记流开始)** * * 标记该流会话已经开始处理(通常在 Agent 启动后调用)。
src/webhook/state.ts:163
↓ 4 callersFunctionpickBotFileName
从消息中提取显式文件名(对齐原版 pickBotFileName)
src/webhook/helpers.ts:460
↓ 4 callersFunctionpolicyCmd
(value: string)
src/shared/command-auth.ts:86
↓ 4 callersFunctionpolicyCmd
(value: string)
src/webhook/command-auth.ts:124
↓ 4 callersMethodrequestFlush
* 请求刷新:如果该批次当前为 active,则立即 flush;否则标记 ready,等待前序批次完成后再 flush。
src/webhook/state.ts:293
↓ 4 callersFunctionsanitizeInboundFilename
清理文件名(移除非法字符)
src/webhook/helpers.ts:491
↓ 4 callersFunctionsendJson
发送 JSON 响应 (Content-Type: application/json)
src/webhook/handler.ts:165
↓ 4 callersFunctionsendRawJsonRpc
* 发送原始 HTTP 请求到 MCP Server(底层方法) * * 自动携带 Mcp-Session-Id 请求头(如果有), * 并从响应头中更新 sessionId。
src/mcp/transport.ts:322
↓ 4 callersMethodsetFlushHandler
* **setFlushHandler (设置防抖刷新回调)** * * 当防抖计时器结束时调用的处理函数。通常用于触发 Agent 进行消息处理。 * @param handler 回调函数,接收聚合后的 PendingInbound 对象
src/webhook/state.ts:54
↓ 4 callersFunctiontruncateUtf8Bytes
(text: string, maxBytes: number)
src/webhook/helpers.ts:68
↓ 4 callersFunctionuseActiveReplyOnce
* 使用 response_url 发送一次性请求
src/webhook/monitor.ts:1226
↓ 3 callersFunctioncloneTemplateCard
(card: TemplateCard)
src/template-card-manager.ts:59
↓ 3 callersFunctioncomputeMd5
(data: Buffer | string)
src/webhook/helpers.ts:231
↓ 3 callersFunctioncreateWeComMcpTool
(options: CreateWeComMcpToolOptions = {})
src/mcp/tool.ts:192
↓ 3 callersFunctiondetectMimeFallback
fallback 版 detectMime,参考 weclaw/src/media/mime.ts
src/openclaw-compat.ts:148
↓ 3 callersFunctionencryptResponse
构造加密 JSON 响应(返回对象,不做 stringify)
src/webhook/handler.ts:151
↓ 3 callersFunctionextractAgentId
(msg: WecomAgentInboundMessage)
src/shared/xml-parser.ts:80
↓ 3 callersFunctionguessContentTypeFromPath
(filePath: string)
src/webhook/helpers.ts:194
↓ 3 callersMethodmarkFinished
* **markFinished (标记流结束)** * * 标记该流会话已完成,不再接收内容更新。
src/webhook/state.ts:172
↓ 3 callersFunctionnormalizeContentType
归一化 Content-Type
src/webhook/helpers.ts:520
↓ 3 callersFunctionnormalizeOptionalString
(value: string | undefined)
src/mcp/tool.ts:58
↓ 3 callersFunctionnormalizeWecomAllowFromEntry
(raw: string)
src/shared/command-auth.ts:7
↓ 3 callersFunctionnormalizeWecomAllowFromEntry
归一化白名单条目:去除空格、统一小写、去掉 wecom:/user:/userid: 前缀
src/webhook/command-auth.ts:16
↓ 3 callersFunctionprocessDynamicRouting
(params: DynamicRoutingParams)
src/dynamic-routing.ts:71
↓ 3 callersFunctionresolveSignatureParam
* 从查询参数中提取签名字段 * * 企微不同场景下签名参数名不一致,按优先级依次尝试: * msg_signature → msgsignature → signature
src/webhook/handler.ts:51
↓ 3 callersFunctionresolveWecomSenderUserId
(msg: WebhookInboundMessage)
src/webhook/helpers.ts:736
↓ 3 callersFunctionsendEncryptedReply
* 发送加密回复响应 (Content-Type: text/plain) * * 企微官方参考实现要求加密 JSON 以 text/plain 返回。
src/webhook/handler.ts:175
↓ 3 callersFunctionsendText
(params: { agent: ResolvedAgentAccount; toUser?: string; toParty?: string; toTag?: string;
src/agent/api-client.ts:134
↓ 2 callersFunctionapplyFileSizeLimits
( fileSize: number, detectedType: WeComMediaType, contentType?: string, )
src/media-uploader.ts:162
↓ 2 callersFunctionbuildInboundBody
(msg: WebhookInboundMessage)
src/webhook/helpers.ts:764
↓ 2 callersFunctionbuildStreamPlaceholderReply
( streamId: string, placeholderContent?: string, )
src/webhook/helpers.ts:844
↓ 2 callersFunctionbuildStreamReplyFromState
(state: StreamState, maxBytes: number)
src/webhook/helpers.ts:209
↓ 2 callersFunctionbuildStreamResponse
(stream: StreamState)
src/webhook/helpers.ts:883
↓ 2 callersFunctioncoerceCheckboxMode
* 修正 checkbox.mode: * - 0 → 单选,1 → 多选,仅允许这两个值 * - 字符串数字 "0"/"1" → 整数 * - 语义别名 "multi"/"single" 等 → 对应整数 * - 其他正整数(如 2)→ clamp 到 1(多选) * - 无法识别 →
src/template-card-parser.ts:67
↓ 2 callersFunctiondetectMime
( bufferOrOpts: Buffer | DetectMimeOptions, )
src/openclaw-compat.ts:185
↓ 2 callersFunctiondetectWeComMediaType
(mimeType: string)
src/media-uploader.ts:62
↓ 2 callersFunctionenqueueWeComChatTask
(params: { accountId: string; chatId: string; task: () => Promise<void>; })
src/chat-queue.ts:30
↓ 2 callersFunctionextractBizData
* 从 MCP tools/call 返回结构中提取业务 JSON 数据 * * MCP result 格式:{ content: [{ type: "text", text: "{...json...}" }] }
src/mcp/interceptors/smartsheet-upload.ts:251
↓ 2 callersFunctionextractMsgType
(msg: WecomAgentInboundMessage)
src/shared/xml-parser.ts:29
↓ 2 callersFunctionfindMatchingTarget
* 从已注册的 Target 中匹配签名 * * 匹配策略: * 1. 如果路径中有 accountId,优先精确匹配 * 2. 用 filter 收集所有签名匹配的 Target * 3. 检查冲突:0 个 = not_found,1 个 = matched,>1 个 = conflic
src/webhook/handler.ts:236
↓ 2 callersFunctionfinishThinkingStream
* 关闭 thinking 流(发送 finish=true 的流式消息) * * thinking 是通过 replyStream 用 streamId 发的流式消息, * 只有同一 streamId 的 replyStream(finish=true) 才能关闭它。 * * ⚠️ 注意
src/monitor.ts:429
↓ 2 callersMethodflushPending
* **flushPending (触发消息处理)** * * 内部方法:防抖时间结束后,将聚合的消息一次性推送给 flushHandler。
src/webhook/state.ts:315
↓ 2 callersFunctionformatPairingApproveHint
(channelId: string)
src/openclaw-compat.ts:524
↓ 2 callersMethodgetStreamByMsgId
* **getStreamByMsgId (通过 msgid 查找流 ID)** * * 用于消息去重:检查该 msgid 是否已经关联由正在进行或已完成的流会话。 * @param msgid 企业微信消息 ID
src/webhook/state.ts:107
↓ 2 callersFunctiongetTemplateCardCacheKey
(accountId: string, taskId: string)
src/template-card-manager.ts:33
↓ 2 callersFunctionhasActiveTargets
()
src/webhook/target.ts:119
↓ 2 callersFunctioninitializeSession
* 对指定 URL 执行 Streamable HTTP 的 initialize 握手 * * 发送 initialize → 接收 serverInfo → 发送 initialized 通知。 * 如果服务端未返回 Mcp-Session-Id,则标记为无状态模式,后续请求跳过 sess
src/mcp/transport.ts:419
↓ 2 callersFunctionisExpired
检查条目是否过期
src/reqid-store.ts:64
↓ 2 callersFunctionisGeneric
(m?: string)
src/openclaw-compat.ts:154
↓ 2 callersFunctionisWebSocketBot
* 判断账户是否为长连接机器人(通过 botId + secret 配置)
src/mcp/transport.ts:179
↓ 2 callersFunctionlistConfiguredAccountIds
* 列出 accounts 字段中配置的所有账号 ID(已 normalize)。
src/accounts.ts:30
↓ 2 callersFunctionlooksLikeSendLocalFileIntent
(rawBody: string)
src/webhook/helpers.ts:162
↓ 2 callersFunctionnormalizeWebhookPath
* 标准化 Webhook 路径 * * 统一格式:以 `/` 开头且不以 `/` 结尾。
src/webhook/target.ts:29
↓ 2 callersFunctionprepareWeComMessage
* 解析并校验企业微信消息(防抖前阶段:Step 1-4) * * 执行消息解析、策略检查、媒体下载等前置操作, * 返回一个可用于防抖缓冲的 entry,或 null(消息被过滤/跳过时)。
src/monitor.ts:696
↓ 2 callersFunctionprocessTemplateCardsIfNeeded
(params: { wsClient: WSClient; frame: WsFrame; state: MessageState; account: ResolvedWeComAccount; r
src/template-card-manager.ts:264
↓ 2 callersFunctionprocessWeComMessageNow
* 处理企业微信消息(Step 5-7) * * 接收解析后的消息数据,执行初始化状态、发送 thinking、路由到核心。 * 同一会话中的消息通过串行队列保证按序执行。
src/monitor.ts:822
↓ 2 callersMethodprune
* **prune (清理过期状态)** * * 清理过期的流会话、msgid 映射以及残留的 Pending 消息。 * @param now 当前时间戳 (毫秒)
src/webhook/state.ts:367
↓ 2 callersFunctionpruneTemplateCardCache
()
src/template-card-manager.ts:37
↓ 2 callersFunctionreadResponseBodyAsBuffer
(res: Response, maxBytes?: number)
src/webhook/http.ts:88
next →1–100 of 367, ranked by callers