feat(chat): support --at-users on chat message reply - #794
Conversation
Closes DingTalk-Real-AI#359. Rebuilt on current main per @PeterGuy326's review of DingTalk-Real-AI#451, which was written against the pre-DingTalk-Real-AI#565 executor/helper architecture and did not cover the current Schema contract. reply now accepts a comma-separated --at-users list of userIds or openDingTalkIds. userIds resolve to openDingTalkIds via the existing resolveOpenDingTalkIDs helper, and the matching @ markers in the reply body are normalized to <@openDingTalkId> with normalizeAtPlaceholders(wrapAngle=true) -- the same shape message send uses for user-identity messages. Resolved ids are forwarded as atOpenDingTalkIds. Schema catalog, parameter bindings, agent metadata and selection hints are updated alongside, plus both chat reference docs and a test. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
The generated artifacts conflicted on their source_hash fields against 31 commits of main. Regenerated with make generate-schema-agent-metadata and make generate-schema-catalog rather than hand-merging the hashes.
Head branch was pushed to by a user without write access
e7674ce to
a1f7dfa
Compare
The coverage gate wants 100% on changed code and was at 97.4359% (38 of 39 statements). The gap was the error branch that reports an unresolvable --at-users value. Added a case where the directory lookup returns no mapping, asserting the command errors and does not send the reply with an unresolved @.
Head branch was pushed to by a user without write access
|
Rebased onto main and got CI green -- a1f7dfa + fda8cf2. The branch was 31 commits behind, which is what all four red checks came down to. The rebase conflicted only on generated artifacts ( That left the coverage gate at 97.4359% on changed code against a 100% target -- 38 of 39 statements. The one gap was the branch that reports an unresolvable Everything is green. |
Head branch was pushed to by a user without write access
|
Merged main. The branch is mergeable again and the only red check is a macOS timeout that also happens on main. What the merge needed, since main moved a fair way:
On the failing check. and So main is already at roughly 92 percent of the 10 minute budget by itself, and this branch is not slower than main. A GitHub macOS runner is slower than my laptop, which is enough to push it over. Locally the full job command passes: If you want, the cheap fix is raising |
|
The two red Test jobs look like a suite-duration problem rather than a failure in this change.
This PR adds 7 lines to A re-run would probably be enough to tell whether it's marginal or consistently over, but |
Main moved on, so the generated artifacts were taken from main and regenerated rather than merged textually: - schema_agent_metadata, the audit file and param_aliases_generated.go come from `make generate-schema` on top of main, not from resolving the JSON by hand. - schema_catalog.json was deleted upstream, so that deletion is accepted and the catalog is regenerated by the same target. - schema_parameter_bindings.json keeps the chat reply at-users -> atOpenDingTalkIds mapping, with the reviewed baseline hash updated to the resulting manifest. The chat docs were restructured on main from one file into a routing layer with details under references/chat/, so the --at-users documentation was ported into references/chat/chat-message.md instead of merged into the old monolith. go build ./... is clean, and internal/helpers, internal/app and internal/cli all pass. make lint reports pre-existing findings in nine files that are byte identical to main and untouched here.
Head branch was pushed to by a user without write access
650e1c9 to
d364744
Compare
Closes #359. Supersedes #451.
@PeterGuy326 关闭 #451 时说明:需求本身仍有效,但那份实现基于 #565 之前的
executor/helper command 架构,而
reply现已改为静态 handler,文件与主干大幅漂移,且未覆盖当前 Schema contract,并欢迎基于最新 main 提交新的聚焦 PR。这就是那份新 PR。
改动
dws chat message reply新增--at-users,接受逗号分隔的 userId 或openDingTalkId:
resolveOpenDingTalkIDs解析为 openDingTalkId;已是openDingTalkId 的值原样保留。
normalizeAtPlaceholders(wrapAngle=true)统一为<@openDingTalkId>,与message send处理用户身份消息的方式一致。atOpenDingTalkIds随工具参数下发。未引入新的辅助函数,全部复用
message send已有的 at-mention 路径。Schema contract
这是 #451 缺失的部分,本 PR 一并更新:
internal/cli/schema_catalog.jsoninternal/cli/schema_parameter_bindings.jsoninternal/cli/schema_agent_metadata/chat.json与index.jsoninternal/cli/schema_agent_metadata_audit.jsoninternal/cli/schema_hints/selection/chat.json文档与测试
skills/mono/references/products/chat.md与skills/multi/dingtalk-chat/references/chat.md同步说明与示例。internal/helpers/chat_message_reply_at_users_test.go。验证
go build ./...、go vet ./...通过;internal/helpers、internal/app、internal/cli全部通过。