dingtalk-aicard
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDingTalk AI Cards V0.8
DingTalk AI Cards V0.8
Create or edit an A2UI file from the user's content or image, look up only the contracts needed, and distinguish local validation from delivery and client rendering. This Skill uses the DingTalk V0.8 package based on A2UI 1.0: message is and send API is .
version"v1.0"protocolVersion"1.0"Follow the user's requested lookup, file, send or update directly; the references are not a mandatory sequence. Obey command and protocol requirements. Ask only when missing facts, interaction meaning or the target affect the outcome.
根据用户提供的内容或图片创建或编辑 A2UI 文件,仅查询所需契约,并区分本地验证、实际投递与客户端渲染。本 Skill 使用基于 A2UI 1.0 的 DingTalk V0.8 套件:消息的 为 ,发送 API 的 为 。
version"v1.0"protocolVersion"1.0"直接按照用户请求执行查询、文件操作、发送或更新;参考资料并非必须按固定顺序阅读。遵守命令和协议要求。仅当缺失的事实、交互含义或目标对象会影响结果时才询问。
Route by intent
按意图选择路径
Read only the relevant reference. Do not preload the complete protocol, every pattern, or the whole guide.
| Intent | First reference | Optional follow-up |
|---|---|---|
| Set up lookup and validation | Execution environment | Installed command help |
| Create or redesign from content or images | Visual focus and layout | One relevant pattern or example |
| Query a known name | Query a named contract | The result's source pointer |
| Find an unknown name | Component, function, or Token index | Query only the selected names |
| Construct or repair a card | Construct and validate | Diagnostic pointer and named contract |
| Send, preview, or update | Delivery boundary | Installed command help |
Use patterns for composition guidance and linked JSON for message shapes. Read a named example directly; use the example index only to choose one.
Composition patterns
组合模式
| Content | Reference |
|---|---|
| Notifications and reminders | Notification |
| Object facts and decisions | Detail |
| Illustrated content and attachments | Content |
| Metrics and reports | Report |
| Editable inputs and submission | Form |
| Generation and execution updates | Progress |
For editable inputs, also consult the form pattern for bindings and submission,
even when another pattern describes the card.
When replaying an execution example, read Examples and replay for its batch boundaries, even if the JSON was selected directly.
| 内容 | 参考资料 |
|---|---|
| 通知与提醒 | Notification |
| 对象信息与决策 | Detail |
| 图文内容与附件 | Content |
| 指标与报告 | Report |
| 可编辑输入与提交 | Form |
| 生成与执行更新 | Progress |
对于可编辑输入,即使卡片已由另一种模式描述,也应同时查阅 Form 模式,以了解 bindings 和提交机制。
回放执行示例时,即使已直接选择 JSON,也要阅读 示例与回放 以了解其批次边界。
Execution environment
执行环境
This edition uses native DWS commands, not Python. Confirm exposes , , and ; copying the Skill does not install commands. Lookup and lint are offline and need no Profile. Check each command's current help and structured envelope (, , , or ). If unavailable, references can guide a draft, but do not claim DWS validation.
dws aicard --helpexplainlintpreviewokoutcomedataerror.details本版本使用原生 DWS 命令,而不是 Python。确认 提供了 、 和 ;仅复制 Skill 并不会安装这些命令。查询和 lint 均可离线执行,无需 Profile。检查每个命令当前的帮助信息和结构化封装(、、 或 )。如果命令不可用,参考资料可以指导起草,但不要声称已完成 DWS 验证。
dws aicard --helpexplainlintpreviewokoutcomedataerror.detailsQuery a named contract
查询指定契约
bash
dws aicard explain Tabs --format json
dws aicard explain Text Row Column --compact --format jsonQuery only needed names. Compact and are lookup metadata, not A2UI fields. Query without for expanded fields; locates omitted details.
$contractRefdefinitions--compactsourcebash
dws aicard explain Tabs --format json
dws aicard explain Text Row Column --compact --format json仅查询所需名称。紧凑形式的 和 是查询元数据,不是 A2UI 字段。需要展开字段时,不要使用 ; 可用于定位被省略的详细信息。
$contractRefdefinitions--compactsourceConstruct and validate
构建与验证
Use as the contract. Write an ordered JSON message array.
Within one card, keep the same ; choose an ID suitable for that card
when creating it. A complete new card requires Surface creation, root data
initialization (even for static content), and a component with ID .
The recommended explicit form is:
references/protocol/surfaceId{}rootjson
[
{"version":"v1.0","createSurface":{"surfaceId":"example-surface","catalogId":"https://dingtalk.com/card/a2ui/catalogs/public/catalog.json"}},
{"version":"v1.0","updateDataModel":{"surfaceId":"example-surface","path":"/","value":{}}},
{"version":"v1.0","updateComponents":{"surfaceId":"example-surface","components":[{"id":"root","component":"Text","text":"Example"}]}}
]This is a structural example, not a business card to send. Protocol-valid inline
initialization in and is also
accepted; three separate messages are not the only valid representation.
createSurface.dataModelcreateSurface.components| Scenario | Messages and checks |
|---|---|
| Complete new card | Create and initialize as above; use |
| Host-created empty Surface | Initialize its existing ID without |
| Existing card update | Keep IDs and send only intentional changes; use Schema and resource checks, then check against known current state |
Removing from a complete file does not make it a safe delta.
Do not replay form defaults or unrelated initial data: that can overwrite user
input. Resource checks alone cannot prove an update preserves state or references.
createSurfacePreserve unrelated styling when editing. For ordinary new cards, prefer a root without background fields. If a root is needed, use and no background token. Honor explicit surface designs; see design guidance.
ColumnCardbackgroundColor: "#00FFFFFF"Prefer for rich text and static tables; for short titles and labels. Omit root for ordinary cards. Do not default to ; preserve it when requested and check insets.
MarkdownTextpaddingCardHeaderPreserve supplied facts and requested interactions; label demonstration data. Replace placeholders before delivery. Do not present unverified resources, unconnected actions, or simulated states as real and working.
REPLACE_*Choose literals or bindings as the field contract permits. Initialize bound data with the required types and update it through ; change component literals through . controls whether A2A messages include the full data model, not whether bindings work.
updateDataModelupdateComponentssendDataModelbash
dws aicard lint --file card.a2ui.json --format jsonChoose or for the selected scenario, and use only when serialized message strings are needed; it cannot be combined with . Check exit status and plus when selected. verifies the full package.
--preflight new-card--preflight resources--emit--fragmentdata.validdata.preflight.validdws aicard lint --self-check --format json以 为契约。编写有序的 JSON 消息数组。
references/protocol/在同一张卡片内,保持相同的 ;创建卡片时,应选择适合该卡片的 ID。完整的新卡片需要创建 Surface、初始化根数据(静态内容也需要初始化,即使是 ),并包含 ID 为 的 Component。
推荐的显式形式如下:
surfaceId{}rootjson
[
{"version":"v1.0","createSurface":{"surfaceId":"example-surface","catalogId":"https://dingtalk.com/card/a2ui/catalogs/public/catalog.json"}},
{"version":"v1.0","updateDataModel":{"surfaceId":"example-surface","path":"/","value":{}}},
{"version":"v1.0","updateComponents":{"surfaceId":"example-surface","components":[{"id":"root","component":"Text","text":"Example"}]}}
]这是用于展示结构的示例,不是用于发送的业务卡片。协议也接受在 和 中进行有效的内联初始化;三条独立消息并非唯一有效的表示形式。
createSurface.dataModelcreateSurface.components| 场景 | 消息与检查 |
|---|---|
| 完整的新卡片 | 如上创建并初始化;使用 |
| 宿主创建的空 Surface | 不包含 |
| 更新已有卡片 | 保留 ID,并且只发送有意进行的变更;使用 Schema 和资源检查,然后结合已知的当前状态进行检查 |
从完整文件中移除 并不会使其成为安全的增量。
不要重放 Form 默认值或无关的初始数据:这可能覆盖用户输入。
仅进行资源检查无法证明更新保留了状态或引用。
createSurface编辑时保留无关的样式。对于普通的新卡片,优先使用不含背景字段的根 。如果需要根 ,请使用 ,且不要使用 background token。遵循明确指定的 Surface 设计;参见设计指导。
ColumnCardbackgroundColor: "#00FFFFFF"富文本和静态表格优先使用 ;简短标题和标签使用 。普通卡片省略根级 。不要默认使用 ;按要求保留它,并检查 insets。
MarkdownTextpaddingCardHeader保留提供的事实和所请求的交互;为演示数据添加标签。投递前替换 占位符。不要将未经验证的资源、未连接的操作或模拟状态呈现为真实可用。
REPLACE_*根据字段契约允许的情况选择 literals 或 bindings。使用所需类型初始化绑定数据,并通过 更新它;通过 更改 Component literals。 控制 A2A 消息是否包含完整数据模型,而不是控制 bindings 是否生效。
updateDataModelupdateComponentssendDataModelbash
dws aicard lint --file card.a2ui.json --format json根据所选场景选择 或 ;仅在需要序列化后的消息字符串时使用 ;它不能与 组合使用。检查退出状态,以及 和所选预检对应的 。 验证整个套件。
--preflight new-card--preflight resources--emit--fragmentdata.validdata.preflight.validdws aicard lint --self-check --format jsonValidation scope
验证范围
Lint checks syntax and Schema fields. New-card preflight additionally checks initialization, root, duplicate IDs within a message, static references and cycles in the final component snapshot, not every intermediate streaming frame. Unreachable components are warnings. Resource preflight checks inline encoding; neither mode evaluates bindings or proves image loading. checks component/message fragments; it is not a way to bypass new-card initialization. Do not silently rewrite user data, remove requested components, or downgrade interactions to pass a check.
--fragmentA successful named lookup is not a full package check. Use the self-check supported by the selected execution environment; local checks do not establish client behavior.
Lint 检查语法和 Schema 字段。新卡片预检还会检查初始化、root、单条消息内的重复 ID,以及最终 Component 快照中的静态引用和循环引用,但不会检查每一个中间流式帧。不可达 Component 会产生警告。资源预检检查内联编码;两种模式都不会评估 bindings,也不能证明图片能够加载。 检查 Component/消息片段;它不是绕过新卡片初始化的方式。不要为了通过检查而悄悄重写用户数据、移除用户要求的 Component 或降级交互。
--fragment指定名称查询成功并不等于完成了整个套件检查。使用所选执行环境支持的自检;本地检查无法证明客户端行为。
Delivery boundary
投递边界
With native , read .
--emitdata.a2uiMessagesSend only when requested. Resolve exactly one target under the sending profile: for a conversation or for a person. Names are not target IDs. Inspect installed command help, JSON-encode the emitted message-string array as one argument, and call . Preserve the request, target, profile and returned . An uncertain result must be checked before another create; do not resend automatically.
--conversation-id--open-dingtalk-id--contentdws chat message send-a2ui-cardbizIdCreation starts in PROCESSING. Update with under the original profile. Keep the same and component IDs; send only intended or changes, not another or unrelated defaults. Static cards require with a nonempty valid delta; prepare it before sending and preserve business data. Stream complete messages, not JSON tokens. Resource preflight checks only the delta. If current state is known, validate it with the delta; Schema validity does not prove business safety.
dws chat message update-a2ui-card --biz-id <bizId> --content <message-strings> --flow-status <state>surfaceIdupdateDataModelupdateComponentscreateSurface--flow-status FINISHdws aicard preview --file card.a2ui.json--dry-rundws chat message update-a2ui-card --biz-id <data.bizId> --content <message-strings> --flow-status FINISHdata.bizIdbizCardIdupdateWarningopenTaskIdquery-send-statusAfter sending, use the available readback capability under the same profile and target to identify this exact card from returned instance/message identifiers. Generic card text and a nearby timestamp are not sufficient. Report request acceptance, same-target readback, client rendering and interaction separately. If readback is unavailable or inconclusive, mark it unverified; do not claim the user received or correctly rendered the card from API acceptance alone.
Report the file, checks actually run, and delivery result when requested. Local validation and request acceptance do not prove client rendering.
使用原生 时,读取 。
--emitdata.a2uiMessages仅在用户请求时发送。在发送 Profile 下解析且仅解析一个目标:会话使用 ,个人使用 。名称不是目标 ID。检查已安装命令的帮助信息,将 emit 输出的消息字符串数组 JSON 编码为单个 参数,然后调用 。保留请求、目标、Profile 以及返回的 。结果不确定时,必须先检查,再执行另一次 create;不要自动重新发送。
--conversation-id--open-dingtalk-id--contentdws chat message send-a2ui-cardbizId创建操作以 PROCESSING 状态开始。在原 Profile 下使用 进行更新。保持相同的 和 Component ID;只发送有意进行的 或 变更,不要再次发送 或无关的默认值。静态卡片要求使用 ,并提供非空的有效增量;发送前应准备好该增量,并保留业务数据。以完整消息流式发送,而不是 JSON token。资源预检只检查增量。如果已知当前状态,请结合增量对其进行验证;Schema 有效性不能证明业务安全性。
dws chat message update-a2ui-card --biz-id <bizId> --content <message-strings> --flow-status <state>surfaceIdupdateDataModelupdateComponentscreateSurface--flow-status FINISHdws aicard preview --file card.a2ui.json--dry-rundws chat message update-a2ui-card --biz-id <data.bizId> --content <message-strings> --flow-status FINISHdata.bizIdbizCardIddata.bizIdupdateWarningopenTaskIdquery-send-status发送后,在同一 Profile 和目标下使用可用的回读能力,根据返回的实例/消息标识符识别这张确切卡片。通用卡片文本和附近的时间戳不足以完成识别。分别报告请求受理、同目标回读、客户端渲染和交互情况。如果回读不可用或结果不确定,请将其标记为未验证;不要仅凭 API 受理就声称用户已收到卡片或卡片已正确渲染。
按要求报告文件、实际运行的检查以及投递结果。本地验证和请求受理不能证明客户端已正确渲染。