Skip to content

feat(mail): add contact search workflow and multi_entity search API#437

Open
chanthuang wants to merge 2 commits intomainfrom
feat/mail-contact-search
Open

feat(mail): add contact search workflow and multi_entity search API#437
chanthuang wants to merge 2 commits intomainfrom
feat/mail-contact-search

Conversation

@chanthuang
Copy link
Copy Markdown
Collaborator

@chanthuang chanthuang commented Apr 13, 2026

Summary

  • Add recipient search workflow to mail skill template (search by name, email keyword, or group name with rich result display)
  • Regenerate SKILL.md with multi_entity.search command

Changes

  • skill-template/domains/mail.md: new "Recipient Search" section with search examples, entity type table, and multi-match display format
  • skills/lark-mail/SKILL.md: regenerated to include multi_entity.search and search workflow

No Go code changes. No breaking changes.

Test plan

  • BOE environment: lark-cli mail multi_entity search --as user --data '{"query":"陈煌"}' returns results with name/email/department/tag
  • Multi-result display verified with various queries (name, email keyword, group name)
  • AI agent end-to-end: natural language "send email to X" triggers search workflow

Summary by CodeRabbit

  • Documentation
    • Added recipient-search guidance for finding email addresses by name, keyword, or group.
    • Clarified supported result types and that only entries containing an email are considered.
    • Defined handling: single match (auto-fill), multiple matches (show candidates with name/email/department/tag/display_name/type/member_count where present), no match (prompt new query or accept direct email).
    • Documented using confirmed emails in compose shortcuts and that full emails skip search.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added domain/mail PR touches the mail domain size/M Single-domain feat or fix with limited business impact labels Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2540257-95cb-4c6b-8d7e-dced02401575

📥 Commits

Reviewing files that changed from the base of the PR and between a51e180 and 47d446a.

📒 Files selected for processing (2)
  • skill-template/domains/mail.md
  • skills/lark-mail/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • skills/lark-mail/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • skill-template/domains/mail.md

📝 Walkthrough

Walkthrough

Added documentation for recipient search using lark-cli mail multi_entity search --as user --data '{"query":"<关键词>"}': examples, result type mappings, rules to filter entries with email, branching for single/multiple/none matches, guidance to populate compose shortcut --to/--cc/--bcc, and handling when user supplies a full address.

Changes

Cohort / File(s) Summary
Mail Recipient Search Documentation
skill-template/domains/mail.md, skills/lark-mail/SKILL.md
Added a "recipient search" section with CLI usage and examples; documented multi_entity.search result type → tag mappings; specified filtering for entries containing email; described branching for single/multiple/no matches and candidate display fields (name/email/department/tag/display_name/type/member_count, omitting empty fields); instructed to pass confirmed email into compose shortcut --to/--cc/--bcc; noted that a full email provided by user skips search.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

documentation

Suggested reviewers

  • infeng

Poem

🐰 I hopped through lists to sniff an inbox key,
I found one, I tucked it in — so quick and free.
Many names I nudged and gently showed,
None? I twitched and asked for another go.
Now letters fly with a rabbit's glee ✉️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding contact search workflow and multi_entity search API support to the mail feature.
Description check ✅ Passed The pull request description covers all required sections: Summary, Changes, and Test Plan with specific verification steps documented.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mail-contact-search

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR adds a recipient-search workflow section to the mail.md skill template and regenerates SKILL.md, documenting how AI agents should call multi_entity search to resolve names/keywords to email addresses before composing messages. The changes are documentation-only (no Go code touched) and the two files are kept in sync with identical content.

Confidence Score: 5/5

Safe to merge — documentation-only changes with no Go code touched

All findings are P2 style suggestions; the workflow guidance is clear and the two files are kept in sync

No files require special attention

Important Files Changed

Filename Overview
skill-template/domains/mail.md Adds recipient-search workflow section with command usage, entity-type table, and AI agent processing rules; content mirrors the SKILL.md addition
skills/lark-mail/SKILL.md Regenerated to include identical recipient-search workflow section; no changes to API Resources section or permissions table entries

Sequence Diagram

sequenceDiagram
    participant User
    participant Agent
    participant CLI as lark-cli

    User->>Agent: "Send email to 张三"
    alt User provides full email address
        Agent->>User: Use address directly (no search needed)
    else Name / keyword / group provided
        Agent->>CLI: multi_entity search --as user --data '{"query":"张三"}'
        CLI-->>Agent: List of matching entities (user/mail_group/chat/external_contact)
        Agent->>Agent: Filter entities with non-empty email field
        alt No matches
            Agent->>User: 未找到,请换关键词或直接提供邮箱
        else One or more matches
            Agent->>User: Display candidates (name/email/dept/tag/type/member_count)
            User->>Agent: Confirm recipient email
        end
    end
    Agent->>CLI: +send --to confirmed_email --subject ... --body ...
    Agent->>User: Show draft summary, await explicit confirmation
    User->>Agent: Approve send
    Agent->>CLI: +send --confirm-send
    CLI-->>Agent: message_id
    Agent->>CLI: messages send_status
    CLI-->>Agent: Delivery status per recipient
    Agent->>User: Report delivery result
Loading

Reviews (3): Last reviewed commit: "fix: require user confirmation for all c..." | Re-trigger Greptile


| 方法 | 所需 scope |
|------|-----------|
| `multi_entity.search` | `mail:user_mailbox:readonly` |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Scope for multi_entity.search may be too narrow

multi_entity.search returns users, enterprise mail groups, chats, and external contacts. Scoping it to mail:user_mailbox:readonly (a mailbox-read permission) looks narrower than what a cross-entity directory search typically needs. If the AI agent requests only this scope and the API actually requires a contact/directory scope as well, the call will silently fail or return partial results at runtime.

Could you confirm this is the full required scope from the API spec, or verify it against lark-cli schema mail.multi_entity.search? Is mail:user_mailbox:readonly confirmed as the only required scope for multi_entity.search, or does this API need additional contact/directory scopes?

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
skills/lark-mail/SKILL.md (1)

304-305: Fill in the multi_entity.search method description

Line 304 currently leaves the method description blank (- \search` —`). Consider adding a short description for parity with neighboring sections and better discoverability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/lark-mail/SKILL.md` around lines 304 - 305, Add a concise description
for the multi_entity.search method where it currently reads "- `search` —":
briefly state that multi_entity.search performs a query across multiple entities
and returns matched entity records (with relevance/metadata) or paginated
results; reference the method name `multi_entity.search` and mirror the style of
neighboring method descriptions for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skill-template/domains/mail.md`:
- Around line 87-95: The fenced code block showing the "找到多个匹配\"组\"的结果..."
example is missing a language tag which triggers markdownlint MD040; update that
triple-backtick block (the sample list with entries "团队邮件组 <team@example.com>",
"项目群 <project@example.com>", "张群 <zhangqun@example.com>") to include a language
identifier (e.g., ```text) immediately after the opening backticks so the block
is explicitly marked as text.

---

Nitpick comments:
In `@skills/lark-mail/SKILL.md`:
- Around line 304-305: Add a concise description for the multi_entity.search
method where it currently reads "- `search` —": briefly state that
multi_entity.search performs a query across multiple entities and returns
matched entity records (with relevance/metadata) or paginated results; reference
the method name `multi_entity.search` and mirror the style of neighboring method
descriptions for consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8c2185fd-4ed6-4948-a334-63c9b5390064

📥 Commits

Reviewing files that changed from the base of the PR and between 3917b77 and 3cc9dbb.

📒 Files selected for processing (2)
  • skill-template/domains/mail.md
  • skills/lark-mail/SKILL.md

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@47d446a407aaad58810d09ee4ab19d9188200d17

🧩 Skill update

npx skills add larksuite/cli#feat/mail-contact-search -y -g

@chanthuang chanthuang force-pushed the feat/mail-contact-search branch from 3cc9dbb to 0caadd2 Compare April 13, 2026 04:40
- Add recipient search workflow to mail skill template (search by name,
  email keyword, or group name with rich result display)
- Regenerate SKILL.md with multi_entity.search command

Change-Id: Ie307af16a5ee38dac99c1d8d0df528730bf847d0
Co-Authored-By: AI
@chanthuang chanthuang force-pushed the feat/mail-contact-search branch from 0caadd2 to a51e180 Compare April 13, 2026 04:42
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/lark-mail/SKILL.md`:
- Around line 382-385: The multi_entity.search entry in SKILL.md currently has
no description; update the `multi_entity.search` documentation to include a
concise summary of what the method does, the expected inputs (e.g., query
string, filters, pagination params), the shape of returned results (e.g., list
of entities with id/name/score and pagination metadata), error/edge-case
behavior, and a short usage example or note linking to related methods (e.g.,
`multi_entity.get` or `multi_entity.list`) for discoverability; ensure the
header `### multi_entity` keeps the bullet `- \`search\` —` followed by a one-
or two-sentence summary and brief parameter/return bullets so the API table is
consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41d5cc0b-2d01-41f0-96e4-98a0dba9eb20

📥 Commits

Reviewing files that changed from the base of the PR and between 0caadd2 and a51e180.

📒 Files selected for processing (2)
  • skill-template/domains/mail.md
  • skills/lark-mail/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • skill-template/domains/mail.md

Comment on lines +382 to +385
### multi_entity

- `search` —

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fill in the multi_entity.search method description.

search is currently documented with an empty description, which makes the API resource table inconsistent and less useful for discoverability.

✍️ Suggested doc patch
 ### multi_entity
 
-  - `search` — 
+  - `search` — 搜索可作为收件人的实体(用户、邮件组、群聊、外部联系人),返回可用邮箱地址及类型信息
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### multi_entity
- `search`
### multi_entity
- `search`搜索可作为收件人的实体(用户、邮件组、群聊、外部联系人),返回可用邮箱地址及类型信息
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/lark-mail/SKILL.md` around lines 382 - 385, The multi_entity.search
entry in SKILL.md currently has no description; update the `multi_entity.search`
documentation to include a concise summary of what the method does, the expected
inputs (e.g., query string, filters, pagination params), the shape of returned
results (e.g., list of entities with id/name/score and pagination metadata),
error/edge-case behavior, and a short usage example or note linking to related
methods (e.g., `multi_entity.get` or `multi_entity.list`) for discoverability;
ensure the header `### multi_entity` keeps the bullet `- \`search\` —` followed
by a one- or two-sentence summary and brief parameter/return bullets so the API
table is consistent.

multi_entity.search is a fuzzy keyword search — a single result does
not guarantee an exact match (e.g. searching "张三" may only return
"张三丰"). Always show candidates for user confirmation before using
the email address in compose parameters.

Change-Id: I447c54cd59b06a88c5d6806bfe76f0adfdceb1ce
Co-Authored-By: AI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/mail PR touches the mail domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants