dingtalk-chat
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese群聊/消息
Group Chats/Messages
<!-- DWS_RUNTIME_CONTRACT_START -->
<!-- DWS_RUNTIME_CONTRACT_START -->
最小 DWS 执行契约
Minimal DWS Execution Contract
- 只用 ;结构化读取加
dws,按真实返回判断。--format json - 已知命令直调;参数/约束/安全不明查 leaf 窄 Schema。Schema 不可用才读已知 leaf Help 一次;用同 leaf Help 修正一次。
unknown flag不查 Help:优先错误中的明确 suggestion,其次已加载 Skill/reference 中的明确兼容入口;均无则报漂移并停,禁全 Catalog。低频 reference 不默认 Help,禁 root/parent/product Help。发现后必须执行或说明阻塞。unknown command - 不猜命令/flag/字段/ID/账号/业务事实;ID 来自真实返回。目标零命中/多候选/类型不明先消歧;仅可选时间/展示范围用契约默认,缺必需信息即停。
- 解析/读/写同一 profile,ID 不跨组织。多账号只用唯一 ;否则用户指定,禁止选择第一项、最近登录或最近使用账号。
isOrgCurrent=true - 不输出/记录 token、refresh token、appSecret、webhook token;已注入认证时不索要。
- 写须符合明确意图;确认以最终 Runtime gate/Schema 为准,确认后才加 。
--yes - 写后验证结果,不凭退出码宣称成功。退出须最终答复,区分完成、部分、阻塞、待确认、失败;保留已有数据及 。
complete/hasMore/stopReason/failures - 时间戳按会话时区展示,必要时保留原值。
- 认证/权限/profile/confirmation/未知错误只读 对应 reference,禁连续猜替代命令。
dingtalk-shared
- Use only ; add
dwsfor structured reads and judge by the actual return.--format json - Call known commands directly; if parameters/constraints/safety are unclear, consult the leaf's narrow Schema. Only if Schema is unavailable, read the known leaf Help once; for , correct once using the same leaf Help. For
unknown flag, do not consult Help: first use the explicit suggestion in the error, then the explicit compatible entry in the loaded Skill/reference; if neither exists, report drift and stop; full Catalog is prohibited. Low-frequency references do not default to Help; root/parent/product Help is prohibited. Once found, you must execute or explain the blockage.unknown command - Do not guess commands/flags/fields/IDs/accounts/business facts; IDs come from real returns. If the target has zero hits/multiple candidates/unknown type, disambiguate first; only optional time/display scope use contract defaults; stop when required information is missing.
- Resolve/read/write the same profile; IDs do not cross organizations. For multiple accounts, use only the unique ; otherwise use the user-specified account, and do not select the first item, last login, or most recently used account.
isOrgCurrent=true - Do not output/record token, refresh token, appSecret, webhook token; do not ask for credentials when authentication is already injected.
- Writes must match the explicit intent; confirmation follows the final Runtime gate/Schema; add only after confirmation.
--yes - Verify after writes; do not claim success based on the exit code alone. Final replies must distinguish completed, partial, blocked, pending confirmation, failed; preserve existing data and .
complete/hasMore/stopReason/failures - Timestamps are displayed in the session timezone; preserve original values when necessary.
- For authentication/permission/profile/confirmation/unknown errors, only read the corresponding reference in ; do not keep guessing substitute commands.
dingtalk-shared
对象与路由边界
Object and Routing Boundaries
- 是会话,
openConversationId是消息,messageId/openMessageId是发送任务,不可混用。openTaskId - 会话分组/分类走 ,群聊/聊天群走
category;会话列表无正文,总结/统计读消息。Pin/Top/Favorite 不是分类。chat group
- is a conversation,
openConversationIdis a message,messageId/openMessageIdis a send task; do not mix them.openTaskId - Conversation grouping/categorization uses ; group chats/chat groups use
category; the conversation list has no body, so read messages for summaries/statistics. Pin/Top/Favorite are not categories.chat group
Shortcut 发现(Shortcut-first)
Shortcut Discovery (Shortcut-first)
按 Golden Route/reference 选 Shortcut;仅缺底层字段用 atomic,低频走 reference/Catalog。
参数查 ;仅需且已发布 时查 outcomes/pagination,字段级再查 ;缺失不以 Help/样例推断。Schema 不可用才读一次已知 leaf Help; 用同 leaf Help 修正一次。 禁 Help:错误 suggestion → 已加载 Skill/reference 明确入口;均无则报漂移。禁全 Catalog/root/parent/product Help;低频 reference 不默认 Help。
<!-- VISIBLE_SHORTCUTS_END -->dws schema --cli-path "chat <leaf>" --compact --jq '{cli_path,parameters,constraints,confirmation}' -f jsonresultdata_schemaunknown flagunknown commandChoose Shortcuts per the Golden Route/reference; use atomic only when underlying fields are missing; low-frequency operations go to reference/Catalog.
Check parameters via ; when only is needed and already published, check outcomes/pagination; for field-level details, check ; missing fields must not be inferred from Help/examples. Only if Schema is unavailable, read the known leaf Help once; is corrected once with the same leaf Help. For , Help is prohibited: error suggestion -> explicit entry in loaded Skill/reference; if none, report drift. Full Catalog/root/parent/product Help is prohibited; low-frequency references do not default to Help.
<!-- VISIBLE_SHORTCUTS_END -->dws schema --cli-path "chat <leaf>" --compact --jq '{cli_path,parameters,constraints,confirmation}' -f jsonresultdata_schemaunknown flagunknown commandGolden Route
Golden Route
| 用户终点 | 唯一推荐入口 | 关键边界 |
|---|---|---|
| <!-- dws-intent: chat.read.conversation -->读取指定群聊/单聊 | | 全部时加 |
| <!-- dws-intent: chat.search.filtered --><!-- dws-intent: chat.read.reactions -->按关键词/发送者/@/类型/reaction 过滤 | | 默认 7 天;范围用 |
| 跨会话读取/总结/统计 | | 不先列会话逐群循环 |
| <!-- dws-intent: chat.conversation.active-since -->时间后活跃会话 | | 摘要;查 |
| 查看 @我的消息 | | 未指定群则跨会话;默认 7 天 |
| 查看未读消息 | | 需正文时沿 CID 读消息 |
| 已知消息 ID 批量取详情 | | 看 leaf Schema;保留会话上下文 |
| <!-- dws-intent: chat.send.dm -->按姓名发文本/Markdown | | 唯一解析;多候选停止 |
| <!-- dws-intent: chat.send.group -->按群名/ID 发文本/Markdown | | 多候选停止 |
| <!-- dws-intent: chat.send.advanced -->文件/Bot/Webhook/复杂 @ | | Bot 多群检查逐项 ledger |
| 全部会话 | | 含群聊/单聊,非正文 |
| 查加入/管理的群 | | 后者无 |
| 搜群或查看全部成员 | | 多候选停止;检查 buckets/完整性 |
| 查群资料/Bot/邀请链接 | | 只读 |
| <!-- dws-intent: chat.create.group -->创建/清理临时群 | | 已知 ID 用 |
| 改群资料/设置/禁言/管理员 | | 用真实群/用户 ID;写后读回 |
| 管理群身份 | 读 group-admin 角色 family | 角色 CRUD、成员绑定/解绑/查询;不切 atomic,写后回读 |
| <!-- dws-intent: chat.category.list-conversations -->列分类内会话 | | 分类≠群;先取 ID |
| <!-- dws-intent: chat.reply.quote -->引用回复 | | 用真实消息/CID;未知投递状态非成功 |
| 撤回/转发 | | 不复制正文冒充原生转发 |
| Pin/消息 Top/Favorite | | 对象互不替代;用对应查询验证 |
| 添加/移除 reaction | | 扩展动作读 |
| 会话置顶/免打扰/隐藏 | chat-conversation | 用真实 CID;会话 Top 非消息 Top |
| 已读/未读/清红点/清空 | | 已读需消息 ID;清空按 Runtime 确认 |
| 下载消息资源 | 查询加 | 不猜 ID;保留 ledger;临时 URL 不交付 |
次级:Thread ;<!-- dws-intent: chat.conversation.list-top -->置顶 ;上传 ;IM 事件走 。
+thread-repliesdws chat +conversation-list-topconversation-file uploaddingtalk-event| User endpoint | Only recommended entry | Key boundaries |
|---|---|---|
| <!-- dws-intent: chat.read.conversation -->Read a specific group chat/direct chat | | Add |
| <!-- dws-intent: chat.search.filtered --><!-- dws-intent: chat.read.reactions -->Filter by keyword/sender/@/type/reaction | | Default 7 days; use |
| Cross-conversation read/summary/statistics | | Do not list conversations first and loop group by group |
| <!-- dws-intent: chat.conversation.active-since -->Conversations active since a time | | Summary; check |
| View messages @ me | | Cross-conversation if no group is specified; default 7 days |
| View unread chats | | When body is needed, read messages via CID |
| Batch fetch details by known message ID | | See leaf Schema; preserve conversation context |
| <!-- dws-intent: chat.send.dm -->Send text/Markdown by name | | Unique resolution; stop on multiple candidates |
| <!-- dws-intent: chat.send.group -->Send text/Markdown by group name/ID | | Stop on multiple candidates |
| <!-- dws-intent: chat.send.advanced -->Files/Bot/Webhook/complex @ | | Bot multi-group check item by item with ledger |
| All conversations | | Includes group/direct, not body |
| View joined/managed groups | | The latter has no |
| Search group or view all members | | Stop on multiple candidates; check buckets/completeness |
| View group profile/Bot/invite link | | Read-only |
| <!-- dws-intent: chat.create.group -->Create/cleanup temporary group | | Use |
| Modify group profile/settings/mute/admin | | Use real group/user IDs; read back after writes |
| Manage group roles | Read the group-admin role family | Role CRUD, member bind/unbind/query; do not switch to atomic, read back after writes |
| <!-- dws-intent: chat.category.list-conversations -->List conversations in a category | | Category ≠ group; get the ID first |
| <!-- dws-intent: chat.reply.quote -->Reply with quote | | Use real message/CID; unknown delivery status is not success |
| Recall/forward | | Do not copy body and pretend it is a native forward |
| Pin/message Top/Favorite | | Objects are not interchangeable; verify with the corresponding query |
| Add/remove reactions | | Extension actions read |
| Conversation pin/DND/hide | chat-conversation | Use real CID; conversation Top is not message Top |
| Mark read/unread/clear red dot/clear messages | | Read requires message ID; clear follows Runtime confirmation |
| Download message resources | Add | Do not guess IDs; keep ledger; do not deliver temporary URLs |
Secondary: Thread ; <!-- dws-intent: chat.conversation.list-top -->pinned ; upload ; IM events go through .
+thread-repliesdws chat +conversation-list-topconversation-file uploaddingtalk-event关键结果语义
Key Result Semantics
- 查询保留范围、数量、完整性、停止原因、失败/下载 ledger;不完整不得称成功。消息仅 翻页,达预算返回有界 partial。
--page-all - 本地图片仅已有 才发内联 image,否则发 file;只上传不发送用
mediaId。conversation-file upload - 子消息用自身 messageId;缺 CID 才继承父 conversationId。写操作沿真实结果传 ID。
- Queries preserve scope, count, completeness, stop reason, failure/download ledger; incomplete results must not be called successful. Messages paginate only with ; reaching the budget returns a bounded partial.
--page-all - Local images are sent as inline image only when a already exists; otherwise send as file; use
mediaIdto only upload without sending.conversation-file upload - Child messages use their own messageId; inherit the parent conversationId only when CID is missing. Write operations pass IDs from real results.
写生命周期
Write Lifecycle
- 多步骤写先校验目标、限制、内容、确认,再沿稳定 ID 串行执行并验证;不截断或换目标。临时资源保留 ID/阶段,失败仅做已授权清理。
- Multi-step writes first validate target, limits, content, confirmation, then execute serially along stable IDs and verify; do not truncate or swap targets. Temporary resources keep IDs/stage; on failure, perform only authorized cleanup.
上下文预算
Context Budget
- Skill/Reference/leaf Schema/Help 各读一次;Schema 已给参数禁 Help。总结/统计/检索默认 ,资源下载仅显式 opt-in。
--no-reactions - 用 /
--fields/limit/compact 预览,禁--jq截 JSON;大正文落文件,保留 ID、正文证据、下步字段、完整性和失败项。head
- Read Skill/Reference/leaf Schema/Help once each; if Schema already provides parameters, Help is prohibited. Summary/statistics/search default to ; resource downloads are explicit opt-in only.
--no-reactions - Use /
--fields/limit/compact for preview; do not use--jqto truncate JSON; large bodies go to files, keeping IDs, body evidence, next-step fields, completeness, and failure items.head
按需加载
On-Demand Loading
任务≤1个
| 场景 | Reference |
|---|---|
| 消息 | 查询 / 动作 / 资源 |
| 群 | 读取 / 治理 |
| 会话/Bot | 会话 / Bot |
| 组合/话题/表情/卡片 | 组合 / 话题 / 表情 / 卡片/A2UI |
| 结果/其他原子能力 | contracts / chat |
Task ≤ 1
| Scenario | Reference |
|---|---|
| Messages | Query / Actions / Media |
| Groups | Discovery / Admin |
| Conversations/Bot | Conversation / Bot |
| Combined/Thread/Emoji/Card | Combined / Thread / Emoji / Card/A2UI |
| Outcomes/other atomic capabilities | contracts / chat |
错误最短路径
Shortest Error Path
- 零命中/多候选:停止写并消歧,禁默认第一项。
- 参数/确认不明查 leaf Schema;Schema 不可用才查已知 leaf Help。用同 leaf Help 修正一次;
unknown flag不查 Help:先用错误的明确 suggestion,再用已加载 Skill/reference 的明确兼容入口;无则报漂移并停,禁全 Catalog。unknown command - 仅 按原命令重试一次;API/internal/MCP、写后不一致或无重试性即停,不换 Shortcut/atomic。保留 Trace ID、已完成/待清理项并最终答复;
retryable=true等用户确认,不补confirmation_required。--yes
- Zero hits/multiple candidates: stop and disambiguate; do not default to the first item.
- If parameters/confirmation are unclear, check the leaf Schema; only if Schema is unavailable, check the known leaf Help. is corrected once with the same leaf Help;
unknown flagdoes not check Help: first use the explicit suggestion in the error, then the explicit compatible entry in the loaded Skill/reference; if none, report drift and stop; full Catalog is prohibited.unknown command - Only retry once with the original command when ; API/internal/MCP, post-write inconsistency, or non-retryable means stop, do not switch Shortcut/atomic. Keep Trace ID, completed/pending-cleanup items and give a final reply;
retryable=truewaits for user confirmation, do not addconfirmation_required.--yes