"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.DingTalkGroupConfigSchema = exports.DingTalkConfigSchema = exports.DingTalkAccountConfigSchema = void 0;var _zod = require("zod"); // ======================= DingTalk Config Schema ======================= /** 群聊策略 */ /** 单个群组的独立配置 Schema */ const DingTalkGroupConfigSchema = exports.DingTalkGroupConfigSchema = _zod.z.object({ /** 工具策略 */ tools: _zod.z.object({ allow: _zod.z.array(_zod.z.string()).optional(), deny: _zod.z.array(_zod.z.string()).optional() }).optional(), /** 是否启用该群 */ enabled: _zod.z.boolean().optional(), /** 群内发送者白名单 */ allowFrom: _zod.z.array(_zod.z.union([_zod.z.string(), _zod.z.number()])).optional(), /** 群级系统提示词 */ systemPrompt: _zod.z.string().optional() }).strict(); /** * 单个钉钉账户配置 Schema * 每个账户对应一个钉钉企业机器人应用 */ const DingTalkAccountConfigSchema = exports.DingTalkAccountConfigSchema = _zod.z.object({ /** 账户名称 */ name: _zod.z.string().optional(), /** 是否启用 */ enabled: _zod.z.boolean().optional(), /** 钉钉应用 AppKey */ clientId: _zod.z.string().optional(), /** 钉钉应用 AppSecret */ clientSecret: _zod.z.string().optional(), /** 允许的发送者白名单(单聊),默认 ["*"] 允许所有人 */ allowFrom: _zod.z.array(_zod.z.union([_zod.z.string(), _zod.z.number()])).optional(), /** 群聊策略:open=允许所有群, allowlist=白名单, disabled=禁止群聊 */ groupPolicy: _zod.z.enum(["open", "allowlist", "disabled"]).optional(), /** 群聊白名单(openConversationId 列表),groupPolicy=allowlist 时生效 */ groupAllowFrom: _zod.z.array(_zod.z.union([_zod.z.string(), _zod.z.number()])).optional(), /** 按群 ID 的独立配置 */ groups: _zod.z.record(_zod.z.string(), DingTalkGroupConfigSchema).optional() }); /** * 钉钉渠道配置 Schema * * 支持两种配置格式(兼容旧版单账户 + 新版多账户): * * 单账户(旧版兼容): * ```json * { "channels": { "ddingtalk": { "clientId": "xxx", "clientSecret": "yyy" } } } * ``` * * 多账户(新版): * ```json * { "channels": { "ddingtalk": { * "accounts": { * "bot1": { "clientId": "xxx", "clientSecret": "yyy" }, * "bot2": { "clientId": "aaa", "clientSecret": "bbb" } * }, * "defaultAccount": "bot1" * } } } * ``` * * 顶层字段作为所有账户的默认值,账户级字段可覆盖。 */ const DingTalkConfigSchema = exports.DingTalkConfigSchema = DingTalkAccountConfigSchema.extend({ /** 多账户配置字典,key 为 accountId */ accounts: _zod.z.record(_zod.z.string(), DingTalkAccountConfigSchema).optional(), /** 默认账户 ID(多账户时指定) */ defaultAccount: _zod.z.string().optional() }); // ======================= Resolved Account Type ======================= /** * 解析后的钉钉账户配置 */ // ======================= Message Types ======================= /** * 会话类型 */ // 1: 单聊, 2: 群聊 /** * 消息类型 */ // ======================= 消息内容类型 ======================= /** 图片消息内容 */ /** 音频消息内容 */ /** 视频消息内容 */ /** 文件消息内容 */ // ======================= 富文本消息类型 ======================= /** 富文本元素类型 */ /** 富文本元素 - 文本 */ /** 富文本元素 - 图片 */ /** 富文本元素联合类型 */ /** 富文本消息内容 */ /** 消息内容联合类型 */ /** * 钉钉机器人消息数据(来自 Stream 回调) */ /** * Webhook 响应 */ // ======================= 回复消息体类型 ======================= /** @ 配置 */ /** 回复消息体 - 文本 */ /** 回复消息体 - Markdown */ /** 回复消息体联合类型 */ /* v9-8953d9f2fc03c5ba */