@xopcai/xopc 0.0.14 → 0.0.16

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.
Files changed (161) hide show
  1. package/dist/extensions/feishu/src/adapters/onboard-cli.d.ts +7 -0
  2. package/dist/extensions/feishu/src/adapters/onboard-cli.js +432 -0
  3. package/dist/extensions/feishu/src/adapters/onboard-cli.js.map +1 -0
  4. package/dist/extensions/feishu/src/auth/pairing.d.ts +7 -0
  5. package/dist/extensions/feishu/src/auth/pairing.js +45 -0
  6. package/dist/extensions/feishu/src/auth/pairing.js.map +1 -0
  7. package/dist/extensions/feishu/src/auth/paths.d.ts +2 -0
  8. package/dist/extensions/feishu/src/auth/paths.js +18 -0
  9. package/dist/extensions/feishu/src/auth/paths.js.map +1 -0
  10. package/dist/extensions/feishu/src/directory/directory-adapter.d.ts +2 -0
  11. package/dist/extensions/feishu/src/directory/directory-adapter.js +27 -0
  12. package/dist/extensions/feishu/src/directory/directory-adapter.js.map +1 -0
  13. package/dist/extensions/feishu/src/format.d.ts +21 -0
  14. package/dist/extensions/feishu/src/format.js +99 -0
  15. package/dist/extensions/feishu/src/format.js.map +1 -0
  16. package/dist/extensions/feishu/src/index.d.ts +5 -0
  17. package/dist/extensions/feishu/src/index.js +3 -0
  18. package/dist/extensions/feishu/src/outbound/actions.d.ts +51 -0
  19. package/dist/extensions/feishu/src/outbound/actions.js +62 -0
  20. package/dist/extensions/feishu/src/outbound/actions.js.map +1 -0
  21. package/dist/extensions/feishu/src/outbound/media-load.d.ts +12 -0
  22. package/dist/extensions/feishu/src/outbound/media-load.js +125 -0
  23. package/dist/extensions/feishu/src/outbound/media-load.js.map +1 -0
  24. package/dist/extensions/feishu/src/outbound/outbound-adapter.d.ts +2 -0
  25. package/dist/extensions/feishu/src/outbound/outbound-adapter.js +201 -0
  26. package/dist/extensions/feishu/src/outbound/outbound-adapter.js.map +1 -0
  27. package/dist/extensions/feishu/src/plugin.d.ts +70 -0
  28. package/dist/extensions/feishu/src/plugin.js +313 -0
  29. package/dist/extensions/feishu/src/plugin.js.map +1 -0
  30. package/dist/extensions/feishu/src/schema/config-schema.d.ts +215 -0
  31. package/dist/extensions/feishu/src/schema/config-schema.js +198 -0
  32. package/dist/extensions/feishu/src/schema/config-schema.js.map +1 -0
  33. package/dist/extensions/feishu/src/state/accounts.d.ts +38 -0
  34. package/dist/extensions/feishu/src/state/accounts.js +96 -0
  35. package/dist/extensions/feishu/src/state/accounts.js.map +1 -0
  36. package/dist/extensions/feishu/src/state/message-bindings.d.ts +11 -0
  37. package/dist/extensions/feishu/src/state/message-bindings.js +41 -0
  38. package/dist/extensions/feishu/src/state/message-bindings.js.map +1 -0
  39. package/dist/extensions/feishu/src/state/thread-bindings.js +46 -0
  40. package/dist/extensions/feishu/src/state/thread-bindings.js.map +1 -0
  41. package/dist/extensions/feishu/src/status/doctor.d.ts +2 -0
  42. package/dist/extensions/feishu/src/status/doctor.js +38 -0
  43. package/dist/extensions/feishu/src/status/doctor.js.map +1 -0
  44. package/dist/extensions/feishu/src/status/status-adapter.d.ts +3 -0
  45. package/dist/extensions/feishu/src/status/status-adapter.js +45 -0
  46. package/dist/extensions/feishu/src/status/status-adapter.js.map +1 -0
  47. package/dist/extensions/feishu/src/streaming/streaming-adapter.d.ts +3 -0
  48. package/dist/extensions/feishu/src/streaming/streaming-adapter.js +242 -0
  49. package/dist/extensions/feishu/src/streaming/streaming-adapter.js.map +1 -0
  50. package/dist/extensions/feishu/src/subagent-hooks.js +52 -0
  51. package/dist/extensions/feishu/src/subagent-hooks.js.map +1 -0
  52. package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.js +95 -0
  53. package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.js.map +1 -0
  54. package/dist/extensions/feishu/src/tools/docx/docx-color-text.js +75 -0
  55. package/dist/extensions/feishu/src/tools/docx/docx-color-text.js.map +1 -0
  56. package/dist/extensions/feishu/src/tools/docx/docx-table-ops.js +173 -0
  57. package/dist/extensions/feishu/src/tools/docx/docx-table-ops.js.map +1 -0
  58. package/dist/extensions/feishu/src/tools/docx/docx-types.js +1 -0
  59. package/dist/extensions/feishu/src/tools/tools.d.ts +5 -0
  60. package/dist/extensions/feishu/src/tools/tools.js +46 -0
  61. package/dist/extensions/feishu/src/tools/tools.js.map +1 -0
  62. package/dist/extensions/feishu/src/transport/client/client.d.ts +6 -0
  63. package/dist/extensions/feishu/src/transport/client/client.js +41 -0
  64. package/dist/extensions/feishu/src/transport/client/client.js.map +1 -0
  65. package/dist/extensions/feishu/src/transport/client/lark-sdk-logger.d.ts +13 -0
  66. package/dist/extensions/feishu/src/transport/client/lark-sdk-logger.js +104 -0
  67. package/dist/extensions/feishu/src/transport/client/lark-sdk-logger.js.map +1 -0
  68. package/dist/extensions/feishu/src/transport/reliability/dedupe.d.ts +7 -0
  69. package/dist/extensions/feishu/src/transport/reliability/dedupe.js +30 -0
  70. package/dist/extensions/feishu/src/transport/reliability/dedupe.js.map +1 -0
  71. package/dist/extensions/feishu/src/transport/socket-mode/monitor.d.ts +19 -0
  72. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +326 -0
  73. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js.map +1 -0
  74. package/dist/extensions/feishu/src/transport/socket-mode/retry.d.ts +1 -0
  75. package/dist/extensions/feishu/src/transport/socket-mode/retry.js +10 -0
  76. package/dist/extensions/feishu/src/transport/socket-mode/retry.js.map +1 -0
  77. package/dist/extensions/feishu/src/transport/text/mentions.d.ts +1 -0
  78. package/dist/extensions/feishu/src/transport/text/mentions.js +9 -0
  79. package/dist/extensions/feishu/src/transport/text/mentions.js.map +1 -0
  80. package/dist/extensions/feishu/src/transport/webhook/monitor.d.ts +19 -0
  81. package/dist/extensions/feishu/src/transport/webhook/monitor.js +271 -0
  82. package/dist/extensions/feishu/src/transport/webhook/monitor.js.map +1 -0
  83. package/dist/extensions/feishu/src/ui/config-surface.d.ts +2 -0
  84. package/dist/extensions/feishu/src/ui/config-surface.js +6 -0
  85. package/dist/extensions/feishu/src/ui/config-surface.js.map +1 -0
  86. package/dist/extensions/feishu/xopc.extension.json +18 -0
  87. package/dist/extensions/telegram/xopc.extension.json +20 -0
  88. package/dist/extensions/weixin/xopc.extension.json +17 -0
  89. package/dist/gateway/static/root/assets/{agents-C2blSFQk.js → agents-Dy5cGVVQ.js} +2 -2
  90. package/dist/gateway/static/root/assets/{agents-C2blSFQk.js.map → agents-Dy5cGVVQ.js.map} +1 -1
  91. package/dist/gateway/static/root/assets/{apps-page-Dg7InQ41.js → apps-page-BOpDR0Lz.js} +2 -2
  92. package/dist/gateway/static/root/assets/{apps-page-Dg7InQ41.js.map → apps-page-BOpDR0Lz.js.map} +1 -1
  93. package/dist/gateway/static/root/assets/channels-settings-CrCesccB.js +9 -0
  94. package/dist/gateway/static/root/assets/channels-settings-CrCesccB.js.map +1 -0
  95. package/dist/gateway/static/root/assets/{cron-page-B-7O4_QQ.js → cron-page-B_XY0gPt.js} +2 -2
  96. package/dist/gateway/static/root/assets/{cron-page-B-7O4_QQ.js.map → cron-page-B_XY0gPt.js.map} +1 -1
  97. package/dist/gateway/static/root/assets/{cron-utils-DvRPM814.js → cron-utils-BYdnLwhl.js} +2 -2
  98. package/dist/gateway/static/root/assets/{cron-utils-DvRPM814.js.map → cron-utils-BYdnLwhl.js.map} +1 -1
  99. package/dist/gateway/static/root/assets/{dist-DYzyRkRh.js → dist-DvaA5uNp.js} +2 -2
  100. package/dist/gateway/static/root/assets/{dist-DYzyRkRh.js.map → dist-DvaA5uNp.js.map} +1 -1
  101. package/dist/gateway/static/root/assets/{extension-debug-page-DV-NwlaY.js → extension-debug-page-CPSk7gFW.js} +2 -2
  102. package/dist/gateway/static/root/assets/{extension-debug-page-DV-NwlaY.js.map → extension-debug-page-CPSk7gFW.js.map} +1 -1
  103. package/dist/gateway/static/root/assets/{extension-page-UUKLJwpo.js → extension-page-COdbk9I6.js} +2 -2
  104. package/dist/gateway/static/root/assets/{extension-page-UUKLJwpo.js.map → extension-page-COdbk9I6.js.map} +1 -1
  105. package/dist/gateway/static/root/assets/{extension-settings-page-R4VlbZOj.js → extension-settings-page-BlEz2Ily.js} +2 -2
  106. package/dist/gateway/static/root/assets/{extension-settings-page-R4VlbZOj.js.map → extension-settings-page-BlEz2Ily.js.map} +1 -1
  107. package/dist/gateway/static/root/assets/index-BQNdJlkw.css +1 -0
  108. package/dist/gateway/static/root/assets/index-tm9ZY35l.js +144 -0
  109. package/dist/gateway/static/root/assets/{index-BCVqNi5T.js.map → index-tm9ZY35l.js.map} +1 -1
  110. package/dist/gateway/static/root/assets/{logs-page-BgUDjMge.js → logs-page-LSa0jmLO.js} +2 -2
  111. package/dist/gateway/static/root/assets/{logs-page-BgUDjMge.js.map → logs-page-LSa0jmLO.js.map} +1 -1
  112. package/dist/gateway/static/root/assets/sessions-page-cn2fi_V3.js +2 -0
  113. package/dist/gateway/static/root/assets/sessions-page-cn2fi_V3.js.map +1 -0
  114. package/dist/gateway/static/root/assets/{settings-page-Doa_lzdW.js → settings-page-CyHd5szQ.js} +2 -2
  115. package/dist/gateway/static/root/assets/{settings-page-Doa_lzdW.js.map → settings-page-CyHd5szQ.js.map} +1 -1
  116. package/dist/gateway/static/root/assets/{skills-page-BdNqg2NG.js → skills-page-irjxwW9u.js} +2 -2
  117. package/dist/gateway/static/root/assets/{skills-page-BdNqg2NG.js.map → skills-page-irjxwW9u.js.map} +1 -1
  118. package/dist/gateway/static/root/channel-icons/feishu.svg +12 -0
  119. package/dist/gateway/static/root/channel-icons/lark.svg +12 -0
  120. package/dist/gateway/static/root/channel-icons/telegram.svg +1 -0
  121. package/dist/gateway/static/root/channel-icons/wechat.svg +1 -0
  122. package/dist/gateway/static/root/channel-icons/weixin.svg +1 -0
  123. package/dist/gateway/static/root/index.html +2 -2
  124. package/dist/package.js +1 -1
  125. package/dist/src/agent/agent-manager.d.ts +1 -0
  126. package/dist/src/agent/agent-manager.js +1 -0
  127. package/dist/src/agent/agent-manager.js.map +1 -1
  128. package/dist/src/agent/service.js +3 -0
  129. package/dist/src/agent/service.js.map +1 -1
  130. package/dist/src/agent/tools/delegate-tool.d.ts +8 -0
  131. package/dist/src/agent/tools/delegate-tool.js +60 -2
  132. package/dist/src/agent/tools/delegate-tool.js.map +1 -1
  133. package/dist/src/agent/tools/factory.d.ts +1 -0
  134. package/dist/src/agent/tools/factory.js +2 -0
  135. package/dist/src/agent/tools/factory.js.map +1 -1
  136. package/dist/src/channels/envelope-timestamp.d.ts +5 -0
  137. package/dist/src/channels/envelope-timestamp.js +10 -1
  138. package/dist/src/channels/envelope-timestamp.js.map +1 -1
  139. package/dist/src/channels/feishu/index.d.ts +5 -0
  140. package/dist/src/channels/feishu/index.js +4 -0
  141. package/dist/src/chat-commands/types.d.ts +1 -1
  142. package/dist/src/extensions/types/hooks.d.ts +46 -1
  143. package/dist/src/extensions/types/hooks.js +3 -0
  144. package/dist/src/extensions/types/hooks.js.map +1 -1
  145. package/dist/src/gateway/service.js +1 -1
  146. package/dist/src/generated/bundled-channel-plugins.d.ts +2 -1
  147. package/dist/src/generated/bundled-channel-plugins.js +8 -2
  148. package/dist/src/generated/bundled-channel-plugins.js.map +1 -1
  149. package/dist/src/providers/env-keys.js +1 -0
  150. package/dist/src/providers/env-keys.js.map +1 -1
  151. package/dist/src/providers/index.js +5 -0
  152. package/dist/src/providers/index.js.map +1 -1
  153. package/dist/src/session/session-title.js +2 -1
  154. package/dist/src/session/session-title.js.map +1 -1
  155. package/package.json +2 -2
  156. package/dist/gateway/static/root/assets/channels-settings-CHOL7G_P.js +0 -9
  157. package/dist/gateway/static/root/assets/channels-settings-CHOL7G_P.js.map +0 -1
  158. package/dist/gateway/static/root/assets/index-BCVqNi5T.js +0 -144
  159. package/dist/gateway/static/root/assets/index-XbYityMf.css +0 -1
  160. package/dist/gateway/static/root/assets/sessions-page-L2VUocA4.js +0 -2
  161. package/dist/gateway/static/root/assets/sessions-page-L2VUocA4.js.map +0 -1
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Feishu/Lark channel plugin (Socket Mode first).
3
+ *
4
+ * This is intentionally decomposed into small modules so we can grow toward
5
+ * openclaw `extensions/feishu` parity without turning `plugin.ts` into a monolith.
6
+ */
7
+ import type { Config } from '@xopcai/xopc/config/schema.js';
8
+ import type { ChannelCapabilities, ChannelDoctorAdapter, ChannelOutboundAdapter, ChannelPlugin, ChannelPluginDefaults, ChannelPluginInitOptions, ChannelPluginReloadMeta, ChannelPluginStartOptions, ChannelSecurityAdapter, ChannelStatusAdapter } from '@xopcai/xopc/channels/plugin-types.js';
9
+ import { type ResolvedFeishuAccount } from './state/accounts.js';
10
+ export declare class FeishuChannelPlugin implements ChannelPlugin<ResolvedFeishuAccount> {
11
+ readonly id: "feishu";
12
+ readonly reload: ChannelPluginReloadMeta;
13
+ readonly meta: {
14
+ readonly id: "feishu";
15
+ readonly label: "Feishu";
16
+ readonly selectionLabel: "Feishu/Lark (飞书)";
17
+ readonly docsPath: "/channels/feishu";
18
+ readonly blurb: "Feishu/Lark enterprise messaging (Socket Mode).";
19
+ readonly order: 4;
20
+ };
21
+ readonly capabilities: ChannelCapabilities;
22
+ readonly defaults: ChannelPluginDefaults;
23
+ readonly configSchema: {
24
+ schema: {};
25
+ validate: (raw: unknown) => {
26
+ ok: true;
27
+ errors?: undefined;
28
+ } | {
29
+ ok: false;
30
+ errors: string[];
31
+ };
32
+ };
33
+ readonly configSurface: import("@xopcai/xopc/channels/plugins/types.adapters.js").ChannelConfigSurfaceAdapter;
34
+ onboard: import("@xopcai/xopc/channels/plugins/types.adapters.js").ChannelOnboardAdapter;
35
+ private bus;
36
+ private cfg;
37
+ private abortControllers;
38
+ config: {
39
+ listAccountIds: (cfg: Config) => string[];
40
+ resolveAccount: (cfg: Config, accountId?: string | null) => ResolvedFeishuAccount;
41
+ isConfigured: (account: ResolvedFeishuAccount) => Promise<boolean>;
42
+ describeAccount: (account: ResolvedFeishuAccount) => {
43
+ accountId: string;
44
+ channelId: string;
45
+ enabled: boolean;
46
+ configured: boolean;
47
+ status: string;
48
+ };
49
+ };
50
+ security: ChannelSecurityAdapter<ResolvedFeishuAccount>;
51
+ outbound: ChannelOutboundAdapter;
52
+ streaming: import("@xopcai/xopc/channels/plugin-types.js").ChannelStreamingAdapter;
53
+ status: ChannelStatusAdapter<ResolvedFeishuAccount>;
54
+ doctor: ChannelDoctorAdapter;
55
+ directory: import("@xopcai/xopc/channels/plugins/types.adapters.js").ChannelDirectoryAdapter;
56
+ actions: {
57
+ handleAction(_ctx: any): Promise<void>;
58
+ };
59
+ agentTools: {
60
+ name: string;
61
+ description: string;
62
+ execute: (toolCtx: any, args: any) => Promise<any>;
63
+ }[];
64
+ init(options: ChannelPluginInitOptions): Promise<void>;
65
+ start(options?: ChannelPluginStartOptions): Promise<void>;
66
+ stop(accountId?: string): Promise<void>;
67
+ channelIsRunning(cfg: Config): boolean;
68
+ onConfigUpdated(cfg: Config): Promise<void>;
69
+ }
70
+ export declare const feishuPlugin: FeishuChannelPlugin;
@@ -0,0 +1,313 @@
1
+ import { createLogger } from "../../../src/utils/logger/index.js";
2
+ import { init_logger } from "../../../src/utils/logger.js";
3
+ import { evaluateAccess, resolveDmPolicy, resolveGroupPolicy } from "../../../src/channels/security.js";
4
+ import { FeishuConfigSchema } from "./schema/config-schema.js";
5
+ import { listFeishuAccountIds, resolveFeishuAccount } from "./state/accounts.js";
6
+ import { createFeishuSocketModeMonitor } from "./transport/socket-mode/monitor.js";
7
+ import { createFeishuWebhookMonitor } from "./transport/webhook/monitor.js";
8
+ import { createFeishuOutboundAdapter } from "./outbound/outbound-adapter.js";
9
+ import { createFeishuStatusAdapter } from "./status/status-adapter.js";
10
+ import { createFeishuDoctorAdapter } from "./status/doctor.js";
11
+ import { feishuConfigSurface } from "./ui/config-surface.js";
12
+ import { createFeishuStreamingAdapter } from "./streaming/streaming-adapter.js";
13
+ import { readFrameworkAllowFromList } from "./auth/pairing.js";
14
+ import { addReactionFeishu, editMessageFeishu, getMessageFeishu, listPinsFeishu, listReactionsFeishu, pinMessageFeishu, removeReactionFeishu, unpinMessageFeishu } from "./outbound/actions.js";
15
+ import { createFeishuDirectoryAdapter } from "./directory/directory-adapter.js";
16
+ import { feishuWhoAmI } from "./tools/tools.js";
17
+ import { feishuOnboardAdapter } from "./adapters/onboard-cli.js";
18
+ import { isDeepStrictEqual } from "node:util";
19
+ //#region extensions/feishu/src/plugin.ts
20
+ /**
21
+ * Feishu/Lark channel plugin (Socket Mode first).
22
+ *
23
+ * This is intentionally decomposed into small modules so we can grow toward
24
+ * openclaw `extensions/feishu` parity without turning `plugin.ts` into a monolith.
25
+ */
26
+ init_logger();
27
+ const log = createLogger("FeishuPlugin");
28
+ var FeishuChannelPlugin = class {
29
+ id = "feishu";
30
+ reload = { configPrefixes: ["channels.feishu"] };
31
+ meta = {
32
+ id: "feishu",
33
+ label: "Feishu",
34
+ selectionLabel: "Feishu/Lark (飞书)",
35
+ docsPath: "/channels/feishu",
36
+ blurb: "Feishu/Lark enterprise messaging (Socket Mode).",
37
+ order: 4
38
+ };
39
+ capabilities = {
40
+ chatTypes: ["direct", "channel"],
41
+ reactions: true,
42
+ threads: true,
43
+ media: true,
44
+ polls: false,
45
+ nativeCommands: false,
46
+ blockStreaming: false,
47
+ edit: true,
48
+ reply: true
49
+ };
50
+ defaults = {
51
+ queue: { debounceMs: 0 },
52
+ outbound: { textChunkLimit: 4e3 },
53
+ streaming: { blockStreamingCoalesce: {
54
+ minChars: 200,
55
+ idleMs: 2500
56
+ } }
57
+ };
58
+ configSchema = {
59
+ schema: {},
60
+ validate: (raw) => {
61
+ const r = FeishuConfigSchema.safeParse(raw);
62
+ return r.success ? { ok: true } : {
63
+ ok: false,
64
+ errors: [r.error.message]
65
+ };
66
+ }
67
+ };
68
+ configSurface = feishuConfigSurface;
69
+ onboard = feishuOnboardAdapter;
70
+ bus;
71
+ cfg;
72
+ abortControllers = /* @__PURE__ */ new Map();
73
+ config = {
74
+ listAccountIds: (cfg) => listFeishuAccountIds(cfg),
75
+ resolveAccount: (cfg, accountId) => resolveFeishuAccount(cfg, accountId),
76
+ isConfigured: async (account) => account.configured,
77
+ describeAccount: (account) => ({
78
+ accountId: account.accountId,
79
+ channelId: "feishu",
80
+ enabled: account.enabled,
81
+ configured: account.configured,
82
+ status: account.configured ? void 0 : "unconfigured"
83
+ })
84
+ };
85
+ security = {
86
+ resolveDmPolicy: ({ account }) => resolveDmPolicy(account.dmPolicy, "pairing"),
87
+ resolveGroupPolicy: ({ account }) => resolveGroupPolicy(account.groupPolicy, "allowlist"),
88
+ checkAccess: (ctx, account, _cfg) => {
89
+ const isDm = !ctx.isGroup;
90
+ const frameworkAllowFrom = readFrameworkAllowFromList(account.accountId);
91
+ const allowFrom = [...(isDm ? account.allowFrom : account.groupAllowFrom ?? account.allowFrom) ?? [], ...frameworkAllowFrom];
92
+ if (isDm) return evaluateAccess({
93
+ context: {
94
+ channel: "feishu",
95
+ accountId: account.accountId,
96
+ chatId: ctx.chatId,
97
+ senderId: ctx.senderId,
98
+ senderName: ctx.senderName,
99
+ isGroup: false,
100
+ isDm: true
101
+ },
102
+ dmPolicy: account.dmPolicy,
103
+ allowFrom
104
+ });
105
+ return evaluateAccess({
106
+ context: {
107
+ channel: "feishu",
108
+ accountId: account.accountId,
109
+ chatId: ctx.chatId,
110
+ senderId: ctx.senderId,
111
+ senderName: ctx.senderName,
112
+ isGroup: true,
113
+ isDm: false
114
+ },
115
+ groupPolicy: account.groupPolicy,
116
+ allowFrom
117
+ });
118
+ }
119
+ };
120
+ outbound = createFeishuOutboundAdapter();
121
+ streaming = createFeishuStreamingAdapter(() => this.cfg);
122
+ status = createFeishuStatusAdapter();
123
+ doctor = createFeishuDoctorAdapter();
124
+ directory = createFeishuDirectoryAdapter();
125
+ actions = { async handleAction(_ctx) {} };
126
+ agentTools = [
127
+ {
128
+ name: "feishu_read",
129
+ description: "Read a Feishu message by messageId (debug/utility).",
130
+ execute: async (toolCtx, args) => {
131
+ const messageId = typeof args?.messageId === "string" ? args.messageId : toolCtx.messageId;
132
+ if (!messageId) throw new Error("feishu_read requires messageId");
133
+ return await getMessageFeishu({
134
+ cfg: this.cfg,
135
+ accountId: toolCtx.accountId,
136
+ messageId
137
+ });
138
+ }
139
+ },
140
+ {
141
+ name: "feishu_edit",
142
+ description: "Edit a Feishu message by messageId.",
143
+ execute: async (toolCtx, args) => {
144
+ const messageId = typeof args?.messageId === "string" ? args.messageId : toolCtx.messageId;
145
+ const text = typeof args?.text === "string" ? args.text : "";
146
+ if (!messageId) throw new Error("feishu_edit requires messageId");
147
+ if (!text.trim()) throw new Error("feishu_edit requires text");
148
+ return await editMessageFeishu({
149
+ cfg: this.cfg,
150
+ accountId: toolCtx.accountId,
151
+ messageId,
152
+ text
153
+ });
154
+ }
155
+ },
156
+ {
157
+ name: "feishu_scopes_probe",
158
+ description: "Probe Feishu credentials/scopes (placeholder for full docs/wiki/drive tools).",
159
+ execute: async (toolCtx) => {
160
+ return await feishuWhoAmI({
161
+ cfg: this.cfg,
162
+ accountId: toolCtx.accountId
163
+ });
164
+ }
165
+ },
166
+ {
167
+ name: "feishu_react",
168
+ description: "Add/remove/list reactions for a message.",
169
+ execute: async (toolCtx, args) => {
170
+ const a = args;
171
+ const messageId = typeof a?.messageId === "string" ? a.messageId : toolCtx.messageId;
172
+ if (!messageId) throw new Error("feishu_react requires messageId");
173
+ if (!(resolveFeishuAccount(this.cfg, toolCtx.accountId ?? "default").actions?.reactions !== false)) throw new Error("Feishu reactions are disabled via channels.feishu.actions.reactions");
174
+ if (a?.list === true) return await listReactionsFeishu({
175
+ cfg: this.cfg,
176
+ accountId: toolCtx.accountId,
177
+ messageId,
178
+ emojiType: typeof a?.emojiType === "string" ? a.emojiType : void 0
179
+ });
180
+ if (a?.remove === true) {
181
+ const reactionId = typeof a?.reactionId === "string" ? a.reactionId : "";
182
+ if (!reactionId) throw new Error("feishu_react remove requires reactionId");
183
+ return await removeReactionFeishu({
184
+ cfg: this.cfg,
185
+ accountId: toolCtx.accountId,
186
+ messageId,
187
+ reactionId
188
+ });
189
+ }
190
+ const emojiType = typeof a?.emojiType === "string" ? a.emojiType : "";
191
+ if (!emojiType) throw new Error("feishu_react requires emojiType");
192
+ return await addReactionFeishu({
193
+ cfg: this.cfg,
194
+ accountId: toolCtx.accountId,
195
+ messageId,
196
+ emojiType
197
+ });
198
+ }
199
+ },
200
+ {
201
+ name: "feishu_pins",
202
+ description: "Pin/unpin/list pins for a chat.",
203
+ execute: async (toolCtx, args) => {
204
+ const a = args;
205
+ const action = typeof a?.action === "string" ? a.action : "";
206
+ if (action === "list") {
207
+ const chatId = typeof a?.chatId === "string" ? a.chatId : toolCtx.chatId;
208
+ if (!chatId) throw new Error("feishu_pins list requires chatId");
209
+ return await listPinsFeishu({
210
+ cfg: this.cfg,
211
+ accountId: toolCtx.accountId,
212
+ chatId,
213
+ startTime: typeof a?.startTime === "string" ? a.startTime : void 0,
214
+ endTime: typeof a?.endTime === "string" ? a.endTime : void 0,
215
+ pageSize: typeof a?.pageSize === "number" ? a.pageSize : void 0,
216
+ pageToken: typeof a?.pageToken === "string" ? a.pageToken : void 0
217
+ });
218
+ }
219
+ const messageId = typeof a?.messageId === "string" ? a.messageId : toolCtx.messageId;
220
+ if (!messageId) throw new Error("feishu_pins requires messageId");
221
+ if (action === "pin") return await pinMessageFeishu({
222
+ cfg: this.cfg,
223
+ accountId: toolCtx.accountId,
224
+ messageId
225
+ });
226
+ if (action === "unpin") return await unpinMessageFeishu({
227
+ cfg: this.cfg,
228
+ accountId: toolCtx.accountId,
229
+ messageId
230
+ });
231
+ throw new Error("feishu_pins requires action: pin | unpin | list");
232
+ }
233
+ }
234
+ ];
235
+ async init(options) {
236
+ this.bus = options.bus;
237
+ this.cfg = options.config;
238
+ log.debug("Feishu plugin initialized");
239
+ }
240
+ async start(options) {
241
+ const section = this.cfg.channels?.feishu;
242
+ if (!section || section.enabled !== true) return;
243
+ const ids = options?.accountId ? [options.accountId] : listFeishuAccountIds(this.cfg);
244
+ for (const accountId of ids) {
245
+ const account = resolveFeishuAccount(this.cfg, accountId);
246
+ if (!account.enabled || !account.configured) continue;
247
+ if (this.abortControllers.has(accountId)) continue;
248
+ const ac = new AbortController();
249
+ this.abortControllers.set(accountId, ac);
250
+ const monitor = createFeishuSocketModeMonitor({
251
+ account,
252
+ config: this.cfg,
253
+ bus: this.bus,
254
+ abortSignal: ac.signal,
255
+ security: { checkAccess: (ctx) => this.security.checkAccess?.(ctx, account, this.cfg) }
256
+ });
257
+ (account.connectionMode === "webhook" ? createFeishuWebhookMonitor({
258
+ account,
259
+ config: this.cfg,
260
+ bus: this.bus,
261
+ abortSignal: ac.signal,
262
+ security: { checkAccess: (ctx) => this.security.checkAccess?.(ctx, account, this.cfg) }
263
+ }) : monitor).run().catch((err) => {
264
+ if (err?.name === "AbortError") {
265
+ log.debug({ accountId }, "Feishu monitor stopped");
266
+ return;
267
+ }
268
+ log.error({
269
+ err,
270
+ accountId
271
+ }, "Feishu monitor exited with error");
272
+ });
273
+ log.info({
274
+ accountId,
275
+ mode: account.connectionMode
276
+ }, "Feishu monitor started");
277
+ }
278
+ }
279
+ async stop(accountId) {
280
+ const ids = accountId ? [accountId] : [...this.abortControllers.keys()];
281
+ for (const id of ids) {
282
+ const ac = this.abortControllers.get(id);
283
+ if (ac) {
284
+ ac.abort();
285
+ this.abortControllers.delete(id);
286
+ }
287
+ }
288
+ }
289
+ channelIsRunning(cfg) {
290
+ return listFeishuAccountIds(cfg).some((id) => {
291
+ const a = resolveFeishuAccount(cfg, id);
292
+ return a.enabled !== false && a.configured && this.abortControllers.has(id);
293
+ });
294
+ }
295
+ async onConfigUpdated(cfg) {
296
+ const prev = this.cfg.channels?.feishu;
297
+ const next = cfg.channels?.feishu;
298
+ if (!next || next.enabled !== true) {
299
+ this.cfg = cfg;
300
+ await this.stop();
301
+ return;
302
+ }
303
+ this.cfg = cfg;
304
+ if (isDeepStrictEqual(prev, next) && this.channelIsRunning(cfg)) return;
305
+ await this.stop();
306
+ await this.start();
307
+ }
308
+ };
309
+ const feishuPlugin = new FeishuChannelPlugin();
310
+ //#endregion
311
+ export { FeishuChannelPlugin, feishuPlugin };
312
+
313
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../../../extensions/feishu/src/plugin.ts"],"sourcesContent":["/**\n * Feishu/Lark channel plugin (Socket Mode first).\n *\n * This is intentionally decomposed into small modules so we can grow toward\n * openclaw `extensions/feishu` parity without turning `plugin.ts` into a monolith.\n */\n\nimport { isDeepStrictEqual } from 'node:util';\n\nimport type { Config } from '@xopcai/xopc/config/schema.js';\nimport type { MessageBus } from '@xopcai/xopc/infra/bus/index.js';\nimport type {\n ChannelCapabilities,\n ChannelDoctorAdapter,\n ChannelOutboundAdapter,\n ChannelPlugin,\n ChannelPluginDefaults,\n ChannelPluginInitOptions,\n ChannelPluginReloadMeta,\n ChannelPluginStartOptions,\n ChannelSecurityAdapter,\n ChannelSecurityContext,\n ChannelStatusAdapter,\n ChatType,\n} from '@xopcai/xopc/channels/plugin-types.js';\nimport { createLogger } from '@xopcai/xopc/utils/logger.js';\nimport { evaluateAccess, resolveDmPolicy, resolveGroupPolicy } from '@xopcai/xopc/channels/security.js';\n\nimport { FeishuConfigSchema, type FeishuConfig } from './schema/config-schema.js';\nimport { listFeishuAccountIds, resolveFeishuAccount, type ResolvedFeishuAccount } from './state/accounts.js';\nimport { createFeishuSocketModeMonitor } from './transport/socket-mode/monitor.js';\nimport { createFeishuWebhookMonitor } from './transport/webhook/monitor.js';\nimport { createFeishuOutboundAdapter } from './outbound/outbound-adapter.js';\nimport { createFeishuStatusAdapter } from './status/status-adapter.js';\nimport { createFeishuDoctorAdapter } from './status/doctor.js';\nimport { feishuConfigSurface } from './ui/config-surface.js';\nimport { createFeishuStreamingAdapter } from './streaming/streaming-adapter.js';\nimport { readFrameworkAllowFromList } from './auth/pairing.js';\nimport {\n addReactionFeishu,\n editMessageFeishu,\n getMessageFeishu,\n listPinsFeishu,\n listReactionsFeishu,\n pinMessageFeishu,\n removeReactionFeishu,\n unpinMessageFeishu,\n} from './outbound/actions.js';\nimport { createFeishuDirectoryAdapter } from './directory/directory-adapter.js';\nimport { feishuWhoAmI } from './tools/tools.js';\nimport { feishuOnboardAdapter } from './adapters/onboard-cli.js';\n\nconst log = createLogger('FeishuPlugin');\n\nexport class FeishuChannelPlugin implements ChannelPlugin<ResolvedFeishuAccount> {\n readonly id = 'feishu' as const;\n\n readonly reload: ChannelPluginReloadMeta = {\n configPrefixes: ['channels.feishu'],\n };\n\n readonly meta = {\n id: 'feishu',\n label: 'Feishu',\n selectionLabel: 'Feishu/Lark (飞书)',\n docsPath: '/channels/feishu',\n blurb: 'Feishu/Lark enterprise messaging (Socket Mode).',\n order: 4,\n } as const;\n\n readonly capabilities: ChannelCapabilities = {\n chatTypes: ['direct', 'channel'] as ChatType[],\n reactions: true,\n threads: true,\n media: true,\n polls: false,\n nativeCommands: false,\n blockStreaming: false,\n edit: true,\n reply: true,\n } as any;\n\n readonly defaults: ChannelPluginDefaults = {\n queue: { debounceMs: 0 },\n outbound: { textChunkLimit: 4000 },\n streaming: {\n blockStreamingCoalesce: {\n minChars: 200,\n idleMs: 2500,\n },\n },\n };\n\n readonly configSchema = {\n schema: {},\n validate: (raw: unknown) => {\n const r = FeishuConfigSchema.safeParse(raw);\n return r.success ? { ok: true as const } : { ok: false as const, errors: [r.error.message] };\n },\n };\n\n readonly configSurface = feishuConfigSurface;\n\n onboard = feishuOnboardAdapter;\n\n private bus!: MessageBus;\n private cfg!: Config;\n private abortControllers = new Map<string, AbortController>();\n\n config = {\n listAccountIds: (cfg: Config) => listFeishuAccountIds(cfg),\n resolveAccount: (cfg: Config, accountId?: string | null) => resolveFeishuAccount(cfg, accountId),\n isConfigured: async (account: ResolvedFeishuAccount) => account.configured,\n describeAccount: (account: ResolvedFeishuAccount) => ({\n accountId: account.accountId,\n channelId: 'feishu',\n enabled: account.enabled,\n configured: account.configured,\n status: account.configured ? undefined : 'unconfigured',\n }),\n };\n\n security: ChannelSecurityAdapter<ResolvedFeishuAccount> = {\n resolveDmPolicy: ({ account }: { account: ResolvedFeishuAccount }) =>\n resolveDmPolicy(account.dmPolicy, 'pairing'),\n resolveGroupPolicy: ({ account }: { account: ResolvedFeishuAccount }) =>\n resolveGroupPolicy(account.groupPolicy, 'allowlist'),\n checkAccess: (ctx: ChannelSecurityContext, account: ResolvedFeishuAccount, _cfg: Config) => {\n const isDm = !ctx.isGroup;\n const frameworkAllowFrom = readFrameworkAllowFromList(account.accountId);\n const baseAllowFrom = isDm ? account.allowFrom : account.groupAllowFrom ?? account.allowFrom;\n const allowFrom = [...(baseAllowFrom ?? []), ...frameworkAllowFrom];\n if (isDm) {\n return evaluateAccess({\n context: {\n channel: 'feishu',\n accountId: account.accountId,\n chatId: ctx.chatId,\n senderId: ctx.senderId,\n senderName: ctx.senderName,\n isGroup: false,\n isDm: true,\n },\n dmPolicy: account.dmPolicy,\n allowFrom,\n });\n }\n return evaluateAccess({\n context: {\n channel: 'feishu',\n accountId: account.accountId,\n chatId: ctx.chatId,\n senderId: ctx.senderId,\n senderName: ctx.senderName,\n isGroup: true,\n isDm: false,\n },\n groupPolicy: account.groupPolicy,\n allowFrom,\n });\n },\n };\n\n outbound: ChannelOutboundAdapter = createFeishuOutboundAdapter();\n\n streaming = createFeishuStreamingAdapter(() => this.cfg);\n\n status: ChannelStatusAdapter<ResolvedFeishuAccount> = createFeishuStatusAdapter();\n\n doctor: ChannelDoctorAdapter = createFeishuDoctorAdapter();\n\n directory = createFeishuDirectoryAdapter();\n\n actions = {\n async handleAction(_ctx: any): Promise<void> {\n // TODO: Wire interactive card actions (card.action.trigger) to this adapter.\n },\n };\n\n agentTools = [\n {\n name: 'feishu_read',\n description: 'Read a Feishu message by messageId (debug/utility).',\n execute: async (toolCtx, args) => {\n const messageId = typeof (args as any)?.messageId === 'string' ? (args as any).messageId : toolCtx.messageId;\n if (!messageId) throw new Error('feishu_read requires messageId');\n return await getMessageFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId });\n },\n },\n {\n name: 'feishu_edit',\n description: 'Edit a Feishu message by messageId.',\n execute: async (toolCtx, args) => {\n const messageId = typeof (args as any)?.messageId === 'string' ? (args as any).messageId : toolCtx.messageId;\n const text = typeof (args as any)?.text === 'string' ? (args as any).text : '';\n if (!messageId) throw new Error('feishu_edit requires messageId');\n if (!text.trim()) throw new Error('feishu_edit requires text');\n return await editMessageFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId, text });\n },\n },\n {\n name: 'feishu_scopes_probe',\n description: 'Probe Feishu credentials/scopes (placeholder for full docs/wiki/drive tools).',\n execute: async (toolCtx) => {\n return await feishuWhoAmI({ cfg: this.cfg, accountId: toolCtx.accountId });\n },\n },\n {\n name: 'feishu_react',\n description: 'Add/remove/list reactions for a message.',\n execute: async (toolCtx, args) => {\n const a = args as any;\n const messageId = typeof a?.messageId === 'string' ? a.messageId : toolCtx.messageId;\n if (!messageId) throw new Error('feishu_react requires messageId');\n\n const account = resolveFeishuAccount(this.cfg, toolCtx.accountId ?? 'default');\n const enabled = (account.actions as any)?.reactions !== false;\n if (!enabled) {\n throw new Error('Feishu reactions are disabled via channels.feishu.actions.reactions');\n }\n\n if (a?.list === true) {\n return await listReactionsFeishu({\n cfg: this.cfg,\n accountId: toolCtx.accountId,\n messageId,\n emojiType: typeof a?.emojiType === 'string' ? a.emojiType : undefined,\n });\n }\n\n if (a?.remove === true) {\n const reactionId = typeof a?.reactionId === 'string' ? a.reactionId : '';\n if (!reactionId) throw new Error('feishu_react remove requires reactionId');\n return await removeReactionFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId, reactionId });\n }\n\n const emojiType = typeof a?.emojiType === 'string' ? a.emojiType : '';\n if (!emojiType) throw new Error('feishu_react requires emojiType');\n return await addReactionFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId, emojiType });\n },\n },\n {\n name: 'feishu_pins',\n description: 'Pin/unpin/list pins for a chat.',\n execute: async (toolCtx, args) => {\n const a = args as any;\n const action = typeof a?.action === 'string' ? a.action : '';\n if (action === 'list') {\n const chatId = typeof a?.chatId === 'string' ? a.chatId : toolCtx.chatId;\n if (!chatId) throw new Error('feishu_pins list requires chatId');\n return await listPinsFeishu({\n cfg: this.cfg,\n accountId: toolCtx.accountId,\n chatId,\n startTime: typeof a?.startTime === 'string' ? a.startTime : undefined,\n endTime: typeof a?.endTime === 'string' ? a.endTime : undefined,\n pageSize: typeof a?.pageSize === 'number' ? a.pageSize : undefined,\n pageToken: typeof a?.pageToken === 'string' ? a.pageToken : undefined,\n });\n }\n const messageId = typeof a?.messageId === 'string' ? a.messageId : toolCtx.messageId;\n if (!messageId) throw new Error('feishu_pins requires messageId');\n if (action === 'pin') {\n return await pinMessageFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId });\n }\n if (action === 'unpin') {\n return await unpinMessageFeishu({ cfg: this.cfg, accountId: toolCtx.accountId, messageId });\n }\n throw new Error('feishu_pins requires action: pin | unpin | list');\n },\n },\n ];\n\n async init(options: ChannelPluginInitOptions): Promise<void> {\n this.bus = options.bus;\n this.cfg = options.config;\n log.debug('Feishu plugin initialized');\n }\n\n async start(options?: ChannelPluginStartOptions): Promise<void> {\n const section = this.cfg.channels?.feishu as FeishuConfig | undefined;\n if (!section || section.enabled !== true) {\n return;\n }\n\n const ids = options?.accountId ? [options.accountId] : listFeishuAccountIds(this.cfg);\n for (const accountId of ids) {\n const account = resolveFeishuAccount(this.cfg, accountId);\n if (!account.enabled || !account.configured) continue;\n if (this.abortControllers.has(accountId)) continue;\n\n const ac = new AbortController();\n this.abortControllers.set(accountId, ac);\n\n const monitor = createFeishuSocketModeMonitor({\n account,\n config: this.cfg,\n bus: this.bus,\n abortSignal: ac.signal,\n security: {\n checkAccess: (ctx: ChannelSecurityContext) => this.security.checkAccess?.(ctx, account, this.cfg),\n },\n });\n\n const runner =\n account.connectionMode === 'webhook'\n ? createFeishuWebhookMonitor({\n account,\n config: this.cfg,\n bus: this.bus,\n abortSignal: ac.signal,\n security: {\n checkAccess: (ctx: ChannelSecurityContext) =>\n this.security.checkAccess?.(ctx, account, this.cfg),\n },\n })\n : monitor;\n\n void runner.run().catch((err) => {\n if ((err as { name?: string } | undefined)?.name === 'AbortError') {\n log.debug({ accountId }, 'Feishu monitor stopped');\n return;\n }\n log.error({ err, accountId }, 'Feishu monitor exited with error');\n });\n\n log.info({ accountId, mode: account.connectionMode }, 'Feishu monitor started');\n }\n }\n\n async stop(accountId?: string): Promise<void> {\n const ids = accountId ? [accountId] : [...this.abortControllers.keys()];\n for (const id of ids) {\n const ac = this.abortControllers.get(id);\n if (ac) {\n ac.abort();\n this.abortControllers.delete(id);\n }\n }\n }\n\n channelIsRunning(cfg: Config): boolean {\n const ids = listFeishuAccountIds(cfg);\n return ids.some((id) => {\n const a = resolveFeishuAccount(cfg, id);\n return a.enabled !== false && a.configured && this.abortControllers.has(id);\n });\n }\n\n async onConfigUpdated(cfg: Config): Promise<void> {\n const prev = this.cfg.channels?.feishu as unknown;\n const next = cfg.channels?.feishu as { enabled?: boolean } | undefined;\n const channelOff = !next || next.enabled !== true;\n\n if (channelOff) {\n this.cfg = cfg;\n await this.stop();\n return;\n }\n\n this.cfg = cfg;\n\n if (isDeepStrictEqual(prev, next) && this.channelIsRunning(cfg)) {\n return;\n }\n\n await this.stop();\n await this.start();\n }\n}\n\nexport const feishuPlugin = new FeishuChannelPlugin();\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;aAyB4D;AA2B5D,MAAM,MAAM,aAAa,eAAe;AAExC,IAAa,sBAAb,MAAiF;CAC/E,KAAc;CAEd,SAA2C,EACzC,gBAAgB,CAAC,kBAAkB,EACpC;CAED,OAAgB;EACd,IAAI;EACJ,OAAO;EACP,gBAAgB;EAChB,UAAU;EACV,OAAO;EACP,OAAO;EACR;CAED,eAA6C;EAC3C,WAAW,CAAC,UAAU,UAAU;EAChC,WAAW;EACX,SAAS;EACT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@@
1
+ import { z } from 'zod';
2
+ export declare const FeishuAccountConfigSchema: z.ZodObject<{
3
+ name: z.ZodOptional<z.ZodString>;
4
+ enabled: z.ZodOptional<z.ZodBoolean>;
5
+ appId: z.ZodOptional<z.ZodString>;
6
+ appSecret: z.ZodOptional<z.ZodString>;
7
+ domain: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
8
+ feishu: "feishu";
9
+ lark: "lark";
10
+ }>, z.ZodString]>>;
11
+ connectionMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
12
+ webhook: "webhook";
13
+ websocket: "websocket";
14
+ }>>>;
15
+ webhookHost: z.ZodOptional<z.ZodString>;
16
+ webhookPort: z.ZodOptional<z.ZodNumber>;
17
+ webhookPath: z.ZodOptional<z.ZodString>;
18
+ verificationToken: z.ZodOptional<z.ZodString>;
19
+ encryptKey: z.ZodOptional<z.ZodString>;
20
+ dmPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
21
+ pairing: "pairing";
22
+ open: "open";
23
+ disabled: "disabled";
24
+ allowlist: "allowlist";
25
+ }>>>;
26
+ groupPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
27
+ open: "open";
28
+ disabled: "disabled";
29
+ allowlist: "allowlist";
30
+ }>>>;
31
+ allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
32
+ groupAllowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
33
+ requireMention: z.ZodOptional<z.ZodBoolean>;
34
+ historyLimit: z.ZodOptional<z.ZodNumber>;
35
+ textChunkLimit: z.ZodOptional<z.ZodNumber>;
36
+ renderMode: z.ZodOptional<z.ZodEnum<{
37
+ auto: "auto";
38
+ raw: "raw";
39
+ card: "card";
40
+ }>>;
41
+ replyInThread: z.ZodOptional<z.ZodEnum<{
42
+ enabled: "enabled";
43
+ disabled: "disabled";
44
+ }>>;
45
+ typingIndicator: z.ZodOptional<z.ZodBoolean>;
46
+ reactionNotifications: z.ZodOptional<z.ZodEnum<{
47
+ off: "off";
48
+ all: "all";
49
+ own: "own";
50
+ }>>;
51
+ streaming: z.ZodOptional<z.ZodBoolean>;
52
+ blockStreamingCoalesce: z.ZodOptional<z.ZodObject<{
53
+ enabled: z.ZodOptional<z.ZodBoolean>;
54
+ minChars: z.ZodOptional<z.ZodNumber>;
55
+ idleMs: z.ZodOptional<z.ZodNumber>;
56
+ }, z.core.$strict>>;
57
+ tools: z.ZodOptional<z.ZodObject<{
58
+ doc: z.ZodOptional<z.ZodBoolean>;
59
+ chat: z.ZodOptional<z.ZodBoolean>;
60
+ wiki: z.ZodOptional<z.ZodBoolean>;
61
+ drive: z.ZodOptional<z.ZodBoolean>;
62
+ perm: z.ZodOptional<z.ZodBoolean>;
63
+ bitable: z.ZodOptional<z.ZodBoolean>;
64
+ scopes: z.ZodOptional<z.ZodBoolean>;
65
+ }, z.core.$strict>>;
66
+ actions: z.ZodOptional<z.ZodObject<{
67
+ reactions: z.ZodOptional<z.ZodBoolean>;
68
+ }, z.core.$strict>>;
69
+ dynamicAgentCreation: z.ZodOptional<z.ZodObject<{
70
+ enabled: z.ZodOptional<z.ZodBoolean>;
71
+ workspaceTemplate: z.ZodOptional<z.ZodString>;
72
+ agentDirTemplate: z.ZodOptional<z.ZodString>;
73
+ maxAgents: z.ZodOptional<z.ZodNumber>;
74
+ }, z.core.$strict>>;
75
+ }, z.core.$strip>;
76
+ export declare const FeishuConfigSchema: z.ZodObject<{
77
+ enabled: z.ZodDefault<z.ZodBoolean>;
78
+ defaultAccount: z.ZodOptional<z.ZodString>;
79
+ appId: z.ZodOptional<z.ZodString>;
80
+ appSecret: z.ZodOptional<z.ZodString>;
81
+ domain: z.ZodOptional<z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
82
+ feishu: "feishu";
83
+ lark: "lark";
84
+ }>, z.ZodString]>>>;
85
+ connectionMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
86
+ webhook: "webhook";
87
+ websocket: "websocket";
88
+ }>>>;
89
+ webhookHost: z.ZodOptional<z.ZodString>;
90
+ webhookPort: z.ZodOptional<z.ZodNumber>;
91
+ webhookPath: z.ZodOptional<z.ZodString>;
92
+ verificationToken: z.ZodOptional<z.ZodString>;
93
+ encryptKey: z.ZodOptional<z.ZodString>;
94
+ dmPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
95
+ pairing: "pairing";
96
+ open: "open";
97
+ disabled: "disabled";
98
+ allowlist: "allowlist";
99
+ }>>>;
100
+ groupPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
101
+ open: "open";
102
+ disabled: "disabled";
103
+ allowlist: "allowlist";
104
+ }>>>;
105
+ allowFrom: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>;
106
+ groupAllowFrom: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>;
107
+ requireMention: z.ZodOptional<z.ZodBoolean>;
108
+ historyLimit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
109
+ textChunkLimit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
110
+ reactionNotifications: z.ZodOptional<z.ZodEnum<{
111
+ off: "off";
112
+ all: "all";
113
+ own: "own";
114
+ }>>;
115
+ streaming: z.ZodOptional<z.ZodBoolean>;
116
+ blockStreamingCoalesce: z.ZodOptional<z.ZodObject<{
117
+ enabled: z.ZodOptional<z.ZodBoolean>;
118
+ minChars: z.ZodOptional<z.ZodNumber>;
119
+ idleMs: z.ZodOptional<z.ZodNumber>;
120
+ }, z.core.$strict>>;
121
+ tools: z.ZodOptional<z.ZodObject<{
122
+ doc: z.ZodOptional<z.ZodBoolean>;
123
+ chat: z.ZodOptional<z.ZodBoolean>;
124
+ wiki: z.ZodOptional<z.ZodBoolean>;
125
+ drive: z.ZodOptional<z.ZodBoolean>;
126
+ perm: z.ZodOptional<z.ZodBoolean>;
127
+ bitable: z.ZodOptional<z.ZodBoolean>;
128
+ scopes: z.ZodOptional<z.ZodBoolean>;
129
+ }, z.core.$strict>>;
130
+ actions: z.ZodOptional<z.ZodObject<{
131
+ reactions: z.ZodOptional<z.ZodBoolean>;
132
+ }, z.core.$strict>>;
133
+ dynamicAgentCreation: z.ZodOptional<z.ZodObject<{
134
+ enabled: z.ZodOptional<z.ZodBoolean>;
135
+ workspaceTemplate: z.ZodOptional<z.ZodString>;
136
+ agentDirTemplate: z.ZodOptional<z.ZodString>;
137
+ maxAgents: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$strict>>;
139
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
140
+ name: z.ZodOptional<z.ZodString>;
141
+ enabled: z.ZodOptional<z.ZodBoolean>;
142
+ appId: z.ZodOptional<z.ZodString>;
143
+ appSecret: z.ZodOptional<z.ZodString>;
144
+ domain: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
145
+ feishu: "feishu";
146
+ lark: "lark";
147
+ }>, z.ZodString]>>;
148
+ connectionMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
149
+ webhook: "webhook";
150
+ websocket: "websocket";
151
+ }>>>;
152
+ webhookHost: z.ZodOptional<z.ZodString>;
153
+ webhookPort: z.ZodOptional<z.ZodNumber>;
154
+ webhookPath: z.ZodOptional<z.ZodString>;
155
+ verificationToken: z.ZodOptional<z.ZodString>;
156
+ encryptKey: z.ZodOptional<z.ZodString>;
157
+ dmPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
158
+ pairing: "pairing";
159
+ open: "open";
160
+ disabled: "disabled";
161
+ allowlist: "allowlist";
162
+ }>>>;
163
+ groupPolicy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
164
+ open: "open";
165
+ disabled: "disabled";
166
+ allowlist: "allowlist";
167
+ }>>>;
168
+ allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
169
+ groupAllowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
170
+ requireMention: z.ZodOptional<z.ZodBoolean>;
171
+ historyLimit: z.ZodOptional<z.ZodNumber>;
172
+ textChunkLimit: z.ZodOptional<z.ZodNumber>;
173
+ renderMode: z.ZodOptional<z.ZodEnum<{
174
+ auto: "auto";
175
+ raw: "raw";
176
+ card: "card";
177
+ }>>;
178
+ replyInThread: z.ZodOptional<z.ZodEnum<{
179
+ enabled: "enabled";
180
+ disabled: "disabled";
181
+ }>>;
182
+ typingIndicator: z.ZodOptional<z.ZodBoolean>;
183
+ reactionNotifications: z.ZodOptional<z.ZodEnum<{
184
+ off: "off";
185
+ all: "all";
186
+ own: "own";
187
+ }>>;
188
+ streaming: z.ZodOptional<z.ZodBoolean>;
189
+ blockStreamingCoalesce: z.ZodOptional<z.ZodObject<{
190
+ enabled: z.ZodOptional<z.ZodBoolean>;
191
+ minChars: z.ZodOptional<z.ZodNumber>;
192
+ idleMs: z.ZodOptional<z.ZodNumber>;
193
+ }, z.core.$strict>>;
194
+ tools: z.ZodOptional<z.ZodObject<{
195
+ doc: z.ZodOptional<z.ZodBoolean>;
196
+ chat: z.ZodOptional<z.ZodBoolean>;
197
+ wiki: z.ZodOptional<z.ZodBoolean>;
198
+ drive: z.ZodOptional<z.ZodBoolean>;
199
+ perm: z.ZodOptional<z.ZodBoolean>;
200
+ bitable: z.ZodOptional<z.ZodBoolean>;
201
+ scopes: z.ZodOptional<z.ZodBoolean>;
202
+ }, z.core.$strict>>;
203
+ actions: z.ZodOptional<z.ZodObject<{
204
+ reactions: z.ZodOptional<z.ZodBoolean>;
205
+ }, z.core.$strict>>;
206
+ dynamicAgentCreation: z.ZodOptional<z.ZodObject<{
207
+ enabled: z.ZodOptional<z.ZodBoolean>;
208
+ workspaceTemplate: z.ZodOptional<z.ZodString>;
209
+ agentDirTemplate: z.ZodOptional<z.ZodString>;
210
+ maxAgents: z.ZodOptional<z.ZodNumber>;
211
+ }, z.core.$strict>>;
212
+ }, z.core.$strip>>>;
213
+ }, z.core.$strip>;
214
+ export type FeishuConfig = z.infer<typeof FeishuConfigSchema>;
215
+ export type FeishuAccountConfig = z.infer<typeof FeishuAccountConfigSchema>;