Skip to content

feat(chat): tag user-identity message sends with edition clawType for the "Send from AI" indicator#450

Open
PeterGuy326 wants to merge 1 commit into
mainfrom
feat/chat-send-ai-claw-type
Open

feat(chat): tag user-identity message sends with edition clawType for the "Send from AI" indicator#450
PeterGuy326 wants to merge 1 commit into
mainfrom
feat/chat-send-ai-claw-type

Conversation

@PeterGuy326

Copy link
Copy Markdown
Collaborator

Summary

The IM server renders a per-edition "Send from AI" indicator (通过AI发送 / Send from AI / 悟空AI发送 …, localized server-side) on messages based on the clawType argument of the send tools. Today only chat message reply carries it — and it hardcodes "wukong", so open-source replies are mislabeled with the Wukong AI identity, while plain sends carry no identity at all.

This PR makes every user-identity send path carry the correct edition claw identity:

  • pkg/edition: new Hooks.ClawTypeValue field + edition.ClawType() accessor. Empty value falls back to DefaultOSSClawType ("openClaw"); overlays (e.g. wukong) set their own.
  • chat message send: attaches clawType on all four argument shapes — group markdown, openDingTalkId direct, --user direct (send_direct_message_as_user), and rich-media (image/file).
  • chat message reply: replaces the hardcoded "wukong" with edition.ClawType() (bug fix for the open-source build).
  • Bot sends are intentionally untouched — they already render as bot messages and must not carry the user-identity claw tag.

Testing

  • go build ./... / go vet clean.
  • New unit tests:
    • TestChatMessageSendCarriesClawType — all 5 user-identity paths assert clawType == DefaultOSSClawType.
    • TestChatMessageSendByBotOmitsClawType — bot path stays clean.
    • pkg/edition tests for default fallback and overlay override.
  • Live verification against production gateway with a dev build:
    • --dry-run shows "clawType": "openClaw" in the JSON-RPC arguments.
    • Real send_personal_message (conversation id) send → success: true, openTaskId returned.
    • Real send_direct_message_as_user (--user) send → errorCode: 0, ok — the server accepts the new argument on this tool as well.
  • test/cli_compat aitable failures are pre-existing on main (missing testdata/empty_catalog.json fixture), verified on a clean origin/main worktree; unrelated to this change.

Notes

Whether the indicator text actually renders depends on the server-side rollout of the localized labels (通用: 通过AI发送 / Send from AI; wukong: 悟空AI发送 / Send from Wukong AI). The CLI-side contract — truthful clawType on every user-identity send — is complete with this PR.

Attach the clawType tool argument to every user-identity send path
(send_personal_message text/rich-media/reply and
send_direct_message_as_user) so the IM server can render the
"Send from AI" indicator on delivered messages. The value comes from a
new edition hook (Hooks.ClawTypeValue, exposed via edition.ClawType())
that falls back to DefaultOSSClawType ("openClaw"); overlays such as
wukong set their own identity to get their branded indicator.

Also fixes the reply command, which hardcoded clawType="wukong" and
made open-source replies carry the Wukong AI identity.

Bot sends intentionally stay untouched: they already render as bot
messages and must not carry the user-identity claw tag.
PeterGuy326 pushed a commit to PeterGuy326/dingtalk-workspace-cli that referenced this pull request Jun 10, 2026
- attendance: address the server by its exact registry ID 'attendance'
  (the 'attendance-wukong' alias only resolved via prefix fallback)
- chat: send clawType as edition.DefaultOSSClawType instead of a
  hardcoded internal edition value (aligns with upstream PR DingTalk-Real-AI#450 intent)
- Makefile: open tree builds the open edition only; drop the edition knob
- neutralize internal-edition wording in new-file comments
  (editions, products/output, helpers/drive, doc jsonml, endpoints_open)

Remaining 'wukong' tokens are either the cross-repo build-tag contract
(//go:build !wukong) or comments that already exist verbatim on upstream
main. Regression: attendance 119/119, chat 159/159, 0 CLI errors.
@PeterGuy326

PeterGuy326 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

End-to-end verification on production: the 通过AI发送 (Send from AI) indicator now renders under messages sent by this branch's build.

Send from AI indicator rendered on a delivered message

Repro: dws chat message send --user <userId> --title ... --text ... built from feat/chat-send-ai-claw-typesend_direct_message_as_user with clawType: "openClaw" → server returned errorCode: 0 and the DingTalk client shows the indicator on the delivered message. The same renders for the send_personal_message paths (group / openDingTalkId / conversation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant