@wecom/wecom-openclaw-plugin 2026.3.31-beta.3 → 2026.3.31-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +0,0 @@
1
- import type { OpenClawConfig } from "openclaw/plugin-sdk";
2
- import type { WeComMultiAccountConfig } from "./accounts.ts";
3
- /**
4
- * 默认策略:
5
- * - matrix(多账号): 开启 fail-closed,防止未绑定账号回退到 main
6
- * - legacy(单账号兼容): 维持历史行为,不强制拦截
7
- */
8
- /** 解析模式 */
9
- export type ResolvedMode = "disabled" | "legacy" | "matrix";
10
- /**
11
- * 检测配置中启用的模式
12
- */
13
- export declare function detectMode(config: WeComMultiAccountConfig | undefined): ResolvedMode;
14
- /**
15
- * 默认策略:
16
- * - matrix(多账号): 开启 fail-closed,防止未绑定账号回退到 main
17
- * - legacy(单账号兼容): 维持历史行为,不强制拦截
18
- */
19
- export declare function resolveWecomFailClosedOnDefaultRoute(cfg: OpenClawConfig): boolean;
20
- export declare function shouldRejectWecomDefaultRoute(params: {
21
- cfg: OpenClawConfig;
22
- matchedBy: string;
23
- useDynamicAgent: boolean;
24
- }): boolean;
@@ -1,34 +0,0 @@
1
- /**
2
- * 检测配置中启用的模式
3
- */
4
- export function detectMode(config) {
5
- if (!config || config.enabled === false)
6
- return "disabled";
7
- const accounts = config.accounts;
8
- if (accounts && typeof accounts === "object") {
9
- const enabledEntries = Object.values(accounts).filter((entry) => entry && entry.enabled !== false);
10
- if (enabledEntries.length > 0)
11
- return "matrix";
12
- }
13
- return "legacy";
14
- }
15
- /**
16
- * 默认策略:
17
- * - matrix(多账号): 开启 fail-closed,防止未绑定账号回退到 main
18
- * - legacy(单账号兼容): 维持历史行为,不强制拦截
19
- */
20
- export function resolveWecomFailClosedOnDefaultRoute(cfg) {
21
- const wecom = cfg.channels?.wecom;
22
- // @ts-ignore
23
- const explicit = wecom?.routing?.failClosedOnDefaultRoute;
24
- if (typeof explicit === "boolean")
25
- return explicit;
26
- return detectMode(wecom) === "matrix";
27
- }
28
- export function shouldRejectWecomDefaultRoute(params) {
29
- if (params.matchedBy !== "default")
30
- return false;
31
- if (params.useDynamicAgent)
32
- return false;
33
- return resolveWecomFailClosedOnDefaultRoute(params.cfg);
34
- }