@amaster.ai/pi-lark 0.1.2-beta.40 → 0.1.2-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/skills/lark-apps/SKILL.md +15 -3
- package/skills/lark-apps/references/lark-apps-automation.md +164 -0
- package/skills/lark-apps/references/lark-apps-db-execute.md +1 -1
- package/skills/lark-apps/references/lark-apps-db.md +2 -2
- package/skills/lark-apps/references/lark-apps-get.md +43 -0
- package/skills/lark-apps/references/lark-apps-html-publish.md +7 -2
- package/skills/lark-apps/references/lark-apps-init.md +1 -2
- package/skills/lark-apps/references/lark-apps-openapi-key.md +1 -1
- package/skills/lark-apps/references/lark-apps-release-create.md +3 -1
- package/skills/lark-base/SKILL.md +1 -1
- package/skills/lark-base/references/lark-base-dashboard-block-get-data.md +7 -7
- package/skills/lark-calendar/SKILL.md +89 -31
- package/skills/lark-calendar/references/lark-calendar-create.md +8 -39
- package/skills/lark-calendar/references/lark-calendar-room-find.md +5 -9
- package/skills/lark-calendar/references/lark-calendar-rsvp.md +1 -5
- package/skills/lark-calendar/references/lark-calendar-schedule-clear-time.md +59 -0
- package/skills/lark-calendar/references/lark-calendar-schedule-fuzzy-time.md +88 -0
- package/skills/lark-calendar/references/lark-calendar-schedule-meeting.md +67 -210
- package/skills/lark-calendar/references/lark-calendar-suggestion.md +1 -5
- package/skills/lark-calendar/references/lark-calendar-update.md +2 -7
- package/skills/lark-doc/SKILL.md +1 -1
- package/skills/lark-doc/references/lark-doc-fetch.md +4 -2
- package/skills/lark-doc/references/lark-doc-mindnote.md +17 -2
- package/skills/lark-doc/references/lark-doc-whiteboard.md +4 -0
- package/skills/lark-doc/references/lark-doc-xml-extended-blocks.md +35 -0
- package/skills/lark-doc/references/lark-doc-xml.md +3 -2
- package/skills/lark-drive/SKILL.md +17 -7
- package/skills/lark-drive/references/lark-drive-comment-location.md +16 -4
- package/skills/lark-drive/references/lark-drive-comments-guide.md +16 -8
- package/skills/lark-drive/references/lark-drive-delete.md +12 -0
- package/skills/lark-drive/references/lark-drive-export.md +39 -10
- package/skills/lark-drive/references/lark-drive-files-list.md +27 -2
- package/skills/lark-drive/references/lark-drive-inspect.md +2 -0
- package/skills/lark-drive/references/lark-drive-list-comments.md +125 -0
- package/skills/lark-drive/references/lark-drive-member-add.md +1 -1
- package/skills/lark-drive/references/lark-drive-permission-guide.md +12 -0
- package/skills/lark-drive/references/lark-drive-pull.md +3 -3
- package/skills/lark-drive/references/lark-drive-push.md +33 -6
- package/skills/lark-drive/references/lark-drive-status.md +12 -14
- package/skills/lark-drive/references/lark-drive-workflow-knowledge-organize.md +26 -20
- package/skills/lark-drive/references/lark-drive-workflow.md +2 -1
- package/skills/lark-im/SKILL.md +5 -4
- package/skills/lark-im/references/lark-im-messages-reply.md +1 -1
- package/skills/lark-im/references/lark-im-messages-send.md +1 -1
- package/skills/lark-mail/SKILL.md +12 -9
- package/skills/lark-mail/references/lark-mail-forward.md +1 -1
- package/skills/lark-mail/references/lark-mail-message-modify.md +48 -0
- package/skills/lark-mail/references/lark-mail-message-trash.md +41 -0
- package/skills/lark-mail/references/lark-mail-reply-all.md +1 -1
- package/skills/lark-mail/references/lark-mail-reply.md +1 -1
- package/skills/lark-mail/references/lark-mail-watch.md +1 -1
- package/skills/lark-markdown/SKILL.md +3 -2
- package/skills/lark-markdown/references/lark-markdown-create.md +22 -2
- package/skills/lark-minutes/SKILL.md +19 -4
- package/skills/lark-minutes/references/lark-minutes-download.md +0 -2
- package/skills/lark-minutes/references/lark-minutes-search.md +0 -2
- package/skills/lark-minutes/references/lark-minutes-speaker-replace.md +0 -2
- package/skills/lark-minutes/references/lark-minutes-summary.md +0 -2
- package/skills/lark-minutes/references/lark-minutes-todo.md +2 -4
- package/skills/lark-minutes/references/lark-minutes-update.md +0 -2
- package/skills/lark-minutes/references/lark-minutes-upload.md +10 -10
- package/skills/lark-shared/SKILL.md +26 -8
- package/skills/lark-sheets/SKILL.md +98 -29
- package/skills/lark-sheets/references/lark-sheets-batch-update.md +18 -9
- package/skills/lark-sheets/references/lark-sheets-changeset.md +105 -0
- package/skills/lark-sheets/references/lark-sheets-chart.md +4 -2
- package/skills/lark-sheets/references/lark-sheets-conditional-format.md +2 -0
- package/skills/lark-sheets/references/lark-sheets-filter-view.md +1 -1
- package/skills/lark-sheets/references/lark-sheets-float-image.md +6 -6
- package/skills/lark-sheets/references/lark-sheets-formula-translation.md +12 -3
- package/skills/lark-sheets/references/lark-sheets-formula-verify.md +77 -0
- package/skills/lark-sheets/references/lark-sheets-history.md +93 -0
- package/skills/lark-sheets/references/lark-sheets-pivot-table.md +7 -2
- package/skills/lark-sheets/references/lark-sheets-range-operations.md +44 -14
- package/skills/lark-sheets/references/lark-sheets-read-data.md +3 -3
- package/skills/lark-sheets/references/lark-sheets-sheet-structure.md +4 -4
- package/skills/lark-sheets/references/lark-sheets-visual-standards.md +4 -4
- package/skills/lark-sheets/references/lark-sheets-workbook.md +29 -4
- package/skills/lark-sheets/references/lark-sheets-write-cells.md +21 -11
- package/skills/lark-slides/SKILL.md +29 -18
- package/skills/lark-slides/references/asset-planning.md +16 -5
- package/skills/lark-slides/references/examples.md +57 -227
- package/skills/lark-slides/references/iconpark.md +2 -2
- package/skills/lark-slides/references/lark-slides-create.md +21 -2
- package/skills/lark-slides/references/lark-slides-media-upload.md +0 -1
- package/skills/lark-slides/references/lark-slides-pptx-template-workflows.md +89 -0
- package/skills/lark-slides/references/lark-slides-replace-pages.md +1 -1
- package/skills/lark-slides/references/lark-slides-replace-slide.md +1 -1
- package/skills/lark-slides/references/lark-slides-screenshot.md +11 -8
- package/skills/lark-slides/references/lark-slides-whiteboard.md +31 -30
- package/skills/lark-slides/references/lark-slides-xml-get.md +100 -0
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md +9 -7
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md +4 -4
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md +12 -10
- package/skills/lark-slides/references/lark-slides-xml-presentations-get.md +14 -13
- package/skills/lark-slides/references/planning-layer.md +32 -2
- package/skills/lark-slides/references/slides_chart_demo.xml +1 -0
- package/skills/lark-slides/references/slides_xml_schema_definition.xml +1 -1
- package/skills/lark-slides/references/troubleshooting.md +7 -25
- package/skills/lark-slides/references/validation-checklist.md +18 -9
- package/skills/lark-slides/references/visual-planning.md +4 -3
- package/skills/lark-slides/references/xml-format-guide.md +50 -1
- package/skills/lark-slides/references/xml-schema-quick-ref.md +7 -3
- package/skills/lark-slides/scripts/xml_text_overlap_lint.py +647 -52
- package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +529 -0
- package/skills/lark-task/SKILL.md +1 -0
- package/skills/lark-task/references/lark-task-create.md +14 -1
- package/skills/lark-vc/references/lark-vc-recording.md +0 -2
- package/skills/lark-vc-agent/SKILL.md +24 -14
- package/skills/lark-vc-agent/references/lark-vc-agent-meeting-events.md +65 -37
- package/skills/lark-vc-agent/references/lark-vc-agent-meeting-leave.md +1 -1
- package/skills/lark-vc-agent/references/lark-vc-agent-meeting-list-active.md +8 -8
- package/skills/lark-whiteboard/references/lark-whiteboard-workflow.md +5 -2
- package/skills/lark-wiki/SKILL.md +4 -2
- package/skills/lark-wiki/references/lark-wiki-node-get.md +1 -1
- package/skills/lark-wiki/references/lark-wiki-node-list.md +9 -2
- package/skills/lark-calendar/references/lark-calendar-agenda.md +0 -78
- package/skills/lark-calendar/references/lark-calendar-freebusy.md +0 -124
- package/skills/lark-calendar/references/lark-calendar-search-event.md +0 -29
- package/skills/lark-sheets/references/lark-sheets-core-operations.md +0 -103
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md +0 -220
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# drive +list-comments
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和权限处理。
|
|
4
|
+
|
|
5
|
+
列出 doc/docx/sheet/file/slides/base(bitable)/apps 的评论卡片。优先传用户给出的完整 URL,shortcut 会自动识别类型;apps 为妙搭类型,支持 `/page/<token>` URL;如果传 wiki URL 或 `--token <wiki_token> --type wiki`,会先解析到真实文档。
|
|
6
|
+
|
|
7
|
+
## 重要默认口径
|
|
8
|
+
|
|
9
|
+
- 默认只查未解决评论,即不额外传 `--solved-status` 或显式传 `--solved-status false`。即使用户说“所有评论”“全部评论”“把评论都列出来”,只要没有明确提到包含已解决评论,仍然按默认口径查询未解决评论。
|
|
10
|
+
- 仅当用户明确要求“包含已解决评论”“已解决和未解决都要”“全部历史评论”这类语义时,才传 `--solved-status all`。
|
|
11
|
+
- 是否还有下一页以输出里的 `has_more` 为准;`page_token` 只作为 `has_more=true` 时续跑下一页的游标。
|
|
12
|
+
|
|
13
|
+
## 命令
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 推荐:直接传用户给出的完整 URL。默认只查未解决评论。
|
|
17
|
+
lark-cli drive +list-comments \
|
|
18
|
+
--url "<DOCUMENT_URL>"
|
|
19
|
+
|
|
20
|
+
# 只有用户明确要求包含已解决评论时,才查询已解决和未解决的全部评论。
|
|
21
|
+
lark-cli drive +list-comments \
|
|
22
|
+
--url "<DOCUMENT_URL>" \
|
|
23
|
+
--solved-status all
|
|
24
|
+
|
|
25
|
+
# 查询已解决评论。
|
|
26
|
+
lark-cli drive +list-comments \
|
|
27
|
+
--url "<DOCUMENT_URL>" \
|
|
28
|
+
--solved-status true
|
|
29
|
+
|
|
30
|
+
# 只查全文评论或局部评论。
|
|
31
|
+
lark-cli drive +list-comments \
|
|
32
|
+
--url "<DOCUMENT_URL>" \
|
|
33
|
+
--comment-scope whole
|
|
34
|
+
|
|
35
|
+
lark-cli drive +list-comments \
|
|
36
|
+
--url "<DOCUMENT_URL>" \
|
|
37
|
+
--comment-scope partial
|
|
38
|
+
|
|
39
|
+
# 电子表格 URL 保留 /sheets/ 路径,直接原样传入;不要把 sheet token 拼成 /docx/<token>。
|
|
40
|
+
lark-cli drive +list-comments \
|
|
41
|
+
--url "https://example.larksuite.com/sheets/<SHEET_TOKEN>"
|
|
42
|
+
|
|
43
|
+
# 妙搭 apps URL 使用 /page/<token>,shortcut 会识别为 file_type=apps。
|
|
44
|
+
lark-cli drive +list-comments \
|
|
45
|
+
--url "https://example.feishu.cn/page/<APPS_TOKEN>/"
|
|
46
|
+
|
|
47
|
+
# wiki URL 会自动解包。
|
|
48
|
+
lark-cli drive +list-comments \
|
|
49
|
+
--url "https://example.larksuite.com/wiki/<WIKI_TOKEN>"
|
|
50
|
+
|
|
51
|
+
# 裸 wiki token 也支持,但必须显式声明 --type wiki。
|
|
52
|
+
lark-cli drive +list-comments \
|
|
53
|
+
--token "<WIKI_TOKEN>" \
|
|
54
|
+
--type wiki
|
|
55
|
+
|
|
56
|
+
# 裸 token 需要声明 token 对应类型;不要默认当作 docx。这里以 sheet 为例。
|
|
57
|
+
lark-cli drive +list-comments \
|
|
58
|
+
--token "<DOCUMENT_TOKEN>" \
|
|
59
|
+
--type sheet \
|
|
60
|
+
--page-size 100
|
|
61
|
+
|
|
62
|
+
# 妙搭裸 apps token 需要显式声明 --type apps。
|
|
63
|
+
lark-cli drive +list-comments \
|
|
64
|
+
--token "<APPS_TOKEN>" \
|
|
65
|
+
--type apps
|
|
66
|
+
|
|
67
|
+
# docx 需要评论定位关系时再带 need-relation;非 docx 会静默忽略。
|
|
68
|
+
lark-cli drive +list-comments \
|
|
69
|
+
--url "https://example.larksuite.com/docx/<DOCX_TOKEN>" \
|
|
70
|
+
--need-relation
|
|
71
|
+
|
|
72
|
+
# 分页续跑。
|
|
73
|
+
# 先看上一页输出的 has_more;只有 has_more=true 时,才用返回的 page_token 继续。
|
|
74
|
+
lark-cli drive +list-comments \
|
|
75
|
+
--url "<DOCUMENT_URL>" \
|
|
76
|
+
--page-size 100 \
|
|
77
|
+
--page-token "<NEXT_PAGE_TOKEN>"
|
|
78
|
+
|
|
79
|
+
# 预览请求链路,不发真实请求。
|
|
80
|
+
lark-cli drive +list-comments \
|
|
81
|
+
--url "https://example.larksuite.com/wiki/<WIKI_TOKEN>" \
|
|
82
|
+
--dry-run
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 参数
|
|
86
|
+
|
|
87
|
+
| 参数 | 必填 | 说明 |
|
|
88
|
+
|------|------|------|
|
|
89
|
+
| `--url` | 与 `--token` 二选一 | 推荐入口。支持 doc/docx/sheet/file/slides/base/bitable/apps/wiki URL;apps 妙搭 URL 使用 `/page/<token>`;wiki URL 会自动解析到真实文档。 |
|
|
90
|
+
| `--token` | 与 `--url` 二选一 | 裸 token 或 URL。裸 token 必须搭配 `--type`;wiki token 使用 `--type wiki`。 |
|
|
91
|
+
| `--type` | 裸 token 时必填 | 传 token 对应类型:`doc`、`docx`、`sheet`、`file`、`slides`、`bitable`、`base`、`apps`、`wiki`。wiki token 使用 `wiki`;传 `base` 时,CLI 会按 `bitable` 类型处理。 |
|
|
92
|
+
| `--solved-status` | 否 | `false` / `true` / `all`,默认 `false`。`false` 查未解决评论;`true` 查已解决评论;`all` 查全部评论。 |
|
|
93
|
+
| `--comment-scope` | 否 | `all` / `whole` / `partial`,默认 `all`。`all` 查全部范围;`whole` 查全文评论;`partial` 查局部评论。 |
|
|
94
|
+
| `--need-reaction` | 否 | 是否返回评论卡片上的 reaction 数据;只有用户明确需要 reaction 时才带。 |
|
|
95
|
+
| `--need-relation` | 否 | docx 评论定位关系字段;仅 docx 生效,非 docx 静默忽略。需要定位正文时先读 [`lark-drive-comment-location.md`](lark-drive-comment-location.md)。 |
|
|
96
|
+
| `--page-size` | 否 | 默认 50,最大 100。 |
|
|
97
|
+
| `--page-token` | 否 | 分页游标;本 shortcut 不自动翻页,按返回的 `page_token` 继续请求下一页。 |
|
|
98
|
+
|
|
99
|
+
## 行为说明
|
|
100
|
+
|
|
101
|
+
- `--comment-scope all` 查全部范围;`whole` 查全文评论;`partial` 查局部/选区评论。
|
|
102
|
+
- 当用户已经给出完整 URL 时,原样传给 `--url`;不要先提取 token 再重组成其他类型 URL。比如 sheet 保留 `/sheets/<token>`,wiki 保留 `/wiki/<token>`,妙搭 apps 保留 `/page/<token>`。
|
|
103
|
+
- URL 输入时不需要传 `--type`;如果 URL 类型和显式 `--type` 冲突,shortcut 会返回 validation error,建议移除 `--type`。
|
|
104
|
+
- wiki 输入会自动解析到真实文档,再查询评论列表。JSON 输出不额外返回 wiki token 或 wiki node。
|
|
105
|
+
- 输出中的 `items` 保留评论卡片字段,外层补充 `file_token`、`file_type`、`has_more`、`page_token`、`count`;`count` 是当前页返回的评论卡片数。是否继续分页以 `has_more` 为准,而不是只看 `page_token` 是否存在。
|
|
106
|
+
- 如果需要批量按评论 ID 查询、获取更多回复、创建/编辑/删除回复,继续使用原生 `drive file.comments batch_query` 或 `drive file.comment.replys.*`。
|
|
107
|
+
|
|
108
|
+
## 输出
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"file_token": "docx_token",
|
|
113
|
+
"file_type": "docx",
|
|
114
|
+
"items": [],
|
|
115
|
+
"has_more": false,
|
|
116
|
+
"page_token": "",
|
|
117
|
+
"count": 0
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 参考
|
|
122
|
+
|
|
123
|
+
- [lark-drive](../SKILL.md) -- 云空间(云盘/云存储)全部命令
|
|
124
|
+
- [lark-drive-comments-guide](lark-drive-comments-guide.md) -- 评论统计、回复限制和原生 API 说明
|
|
125
|
+
- [lark-drive-comment-location](lark-drive-comment-location.md) -- 使用 `need_relation` 定位 docx 正文
|
|
@@ -54,7 +54,7 @@ lark-cli drive +member-add \
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
批量部分失败时,`partial` 为 `true
|
|
57
|
+
批量部分失败时,`partial` 为 `true`,同一份结果以 `ok:false` 部分失败信封写到 **stdout**(stderr 不再输出单独的错误信封),CLI 以非零退出码结束。检查 `data` 中的 `requested_count`、`succeeded_count`、`members`、`missing_member_ids` 和可选的 `mismatched_member_ids`。响应顺序不影响匹配结果。
|
|
58
58
|
|
|
59
59
|
## 行为说明
|
|
60
60
|
|
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
如果用户只是想向文档 owner 申请访问权限,优先使用 [`lark-drive-apply-permission.md`](lark-drive-apply-permission.md)。
|
|
12
12
|
|
|
13
|
+
## 公开权限修改前门槛
|
|
14
|
+
|
|
15
|
+
公开权限修改是高风险写操作。执行 `drive permission.public patch --yes` 前同时确认:
|
|
16
|
+
|
|
17
|
+
| 条件 | 可执行信号 |
|
|
18
|
+
|------|------------|
|
|
19
|
+
| 具体目标 | 单个 URL/token,或用户确认过的资源列表 |
|
|
20
|
+
| 公开范围 | 用户明确选择组织内/互联网、可读/可编辑等具体 `link_share_entity` 档位 |
|
|
21
|
+
| 执行确认 | 用户在本轮确认按该目标和范围执行 |
|
|
22
|
+
|
|
23
|
+
“开放一下”“共享给大家”“让大家能看”只表达目标状态,不包含具体公开范围。先列出可选范围并停止等待用户选择;公开档位必须来自用户选择,CLI 的 `--yes` 只表示已获得用户对该档位的执行确认。
|
|
24
|
+
|
|
13
25
|
## 公开权限错误码
|
|
14
26
|
|
|
15
27
|
调用 `lark-cli drive permission.public patch` 更新文档公开权限失败时,如果返回以下错误码,按表格给用户明确下一步。不要把这些错误简单归类为缺少 scope;它们通常表示租户、对外分享或文档密级策略拦截。
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
| `summary.deleted_local` | 启用 `--delete-local --yes` 时删除的本地文件数 |
|
|
18
18
|
| `items[]` | 每个文件的明细(`rel_path` / `file_token` / `source_id` / `action` / 失败时的 `error`) |
|
|
19
19
|
|
|
20
|
-
`summary.failed > 0` 时命令以 **非零状态码**(`exit=1
|
|
20
|
+
`summary.failed > 0` 时命令以 **非零状态码**(`exit=1`)退出:同一份 `summary + items` 会以 `ok:false` 部分失败信封写到 **stdout**(字段在 `data.summary` / `data.items`),stderr 不再输出单独的错误信封;脚本/agent 直接通过 exit code 判断成败即可,不需要再去解 `summary.failed`。
|
|
21
21
|
|
|
22
22
|
## 远端同名文件冲突
|
|
23
23
|
|
|
24
|
-
如果 Drive 中多个条目映射到同一个 `rel_path
|
|
24
|
+
如果 Drive 中多个条目映射到同一个 `rel_path`,默认直接失败(stderr 类型化错误信封:`error.type=validation`、`error.subtype=failed_precondition`,`error.params[]` 逐条列出冲突的 `rel_path` 及碰撞条目),且不会下载、覆盖或删除任何本地文件。只有“多个 `type=file` 同名”的场景支持显式策略;`file-folder` 这类异构冲突始终直接失败。
|
|
25
25
|
|
|
26
26
|
| 策略 | 行为 |
|
|
27
27
|
|------|------|
|
|
@@ -80,7 +80,7 @@ lark-cli drive +pull --local-dir ./repo --folder-token fldcnxxxxxxxxx \
|
|
|
80
80
|
|
|
81
81
|
- `--delete-local`(无 `--yes`)→ Validate 直接报错:`--delete-local requires --yes`,没有任何下载、列表请求或删除发生。
|
|
82
82
|
- `--delete-local --yes`,**且下载阶段全部成功** → 扫一遍 `--local-dir` 下所有常规文件,把不在云端清单里的逐个 `os.Remove`。**只删常规文件,不删目录**:远端文件夹被删除后,对应本地目录会保留空壳。
|
|
83
|
-
- `--delete-local --yes`,**但下载阶段有任何条目失败** → **跳过整个删除阶段**,命令以 `
|
|
83
|
+
- `--delete-local --yes`,**但下载阶段有任何条目失败** → **跳过整个删除阶段**,命令以 `ok:false` 部分失败结果非零退出。设计意图:避免出现"前面下载失败、后面继续删本地文件"的半同步状态;操作者修好下载错误后再重跑即可。
|
|
84
84
|
- 远端同名文件冲突且使用默认 `fail` → 在下载阶段前失败,删除阶段不会运行。
|
|
85
85
|
- 不传 `--delete-local` → `summary.deleted_local` 永远是 0;命令对本地"多余"文件视而不见。
|
|
86
86
|
|
|
@@ -15,15 +15,16 @@
|
|
|
15
15
|
| `summary.skipped` | 因 `--if-exists=skip` 或 `--if-exists=smart` 命中“无需传输”而跳过的文件数 |
|
|
16
16
|
| `summary.failed` | 上传 / 覆盖 / 建目录 / 删除失败的条目数;**只要不为 0,命令就以非零状态退出**(结构化 `items[]` 仍在 stdout 上) |
|
|
17
17
|
| `summary.deleted_remote` | 启用 `--delete-remote --yes` 时删除的云端文件数 |
|
|
18
|
-
| `
|
|
18
|
+
| `summary.aborted` | 命中终止性错误并停止后续批处理时为 `true` |
|
|
19
|
+
| `items[]` | 每个条目的明细(`rel_path` / `file_token` / `action` / 覆盖时的 `version` / `size_bytes` / 失败时的 `error` / `hint` / `phase` / `error_class` / `code` / `subtype` / `retryable`) |
|
|
19
20
|
|
|
20
|
-
`items[].action` 取值:`uploaded` / `overwritten` / `skipped` / `folder_created` / `deleted_remote` / `failed` / `delete_failed`。
|
|
21
|
+
`items[].action` 取值:`uploaded` / `overwritten` / `skipped` / `folder_created` / `deleted_remote` / `already_deleted` / `failed` / `delete_failed`。
|
|
21
22
|
|
|
22
23
|
> 本地目录(包括空目录)会被镜像到 Drive;新建的子目录会以 `action: "folder_created"` 出现在 `items[]` 里,但**不计入** `summary.uploaded`(该字段只数文件)。已存在的远端目录复用其 token,不会重复 `create_folder`,也不会出现在 `items[]` 里。
|
|
23
24
|
|
|
24
25
|
## 远端同名文件冲突
|
|
25
26
|
|
|
26
|
-
如果 Drive 中多个条目映射到同一个 `rel_path
|
|
27
|
+
如果 Drive 中多个条目映射到同一个 `rel_path`,默认直接失败(stderr 类型化错误信封:`error.type=validation`、`error.subtype=failed_precondition`,`error.params[]` 逐条列出冲突的 `rel_path` 及碰撞条目),且不会上传、覆盖或进入 `--delete-remote` 删除阶段。只有“多个 `type=file` 同名”的场景支持显式策略;`file-folder` 这类异构冲突始终直接失败。
|
|
27
28
|
|
|
28
29
|
| 策略 | 行为 |
|
|
29
30
|
|------|------|
|
|
@@ -95,6 +96,7 @@ lark-cli drive +push --local-dir ./repo --folder-token fldcnxxxxxxxxx \
|
|
|
95
96
|
- `--delete-remote`(无 `--yes`)→ Validate 直接报错:`--delete-remote requires --yes`,不会发起任何列表 / 上传 / 删除请求。
|
|
96
97
|
- `--delete-remote --yes` → Validate 阶段还会**动态做一次** `space:document:delete` 的 scope 预检:缺这条 scope 时整次运行立刻失败、不发任何上传请求,避免出现"上传都成功了,但删除阶段才报 missing_scope"的半同步状态。
|
|
97
98
|
- `--delete-remote --yes`(且 scope 已授权)→ 正常执行:先把本地文件 push 上去,再扫一遍远端 `type=file` 列表,把不在本地清单里的逐个删除。**任何上传 / 覆盖 / 建目录失败时,整段 `--delete-remote` 阶段会被跳过**(stderr 上有提示),命令以非零状态退出,远端不会被破坏。
|
|
99
|
+
- 删除阶段如果服务端返回 `1061007 file has been delete`,说明目标远端文件在本次 DELETE 前已经不存在;这已经满足 `--delete-remote` 的目标状态,输出会记为 `action: "already_deleted"`,不计入 `summary.failed`,也不计入 `summary.deleted_remote`。
|
|
98
100
|
- 远端同名冲突且使用默认 `fail`,或冲突里混有 folder / 其他非 `type=file` 对象 → 在上传阶段前失败,删除阶段不会运行。
|
|
99
101
|
- 不传 `--delete-remote` → `summary.deleted_remote` 永远是 0;命令对远端"多余"文件视而不见。
|
|
100
102
|
- 在线文档(docx / sheet / bitable / ...)和快捷方式即使本地完全没有同名文件,也**不会**进入删除候选,因为它们从来不进 `summary.uploaded` 的对齐域。
|
|
@@ -110,22 +112,47 @@ lark-cli drive +push --local-dir ./repo --folder-token fldcnxxxxxxxxx \
|
|
|
110
112
|
"uploaded": 0,
|
|
111
113
|
"skipped": 0,
|
|
112
114
|
"failed": 0,
|
|
113
|
-
"deleted_remote": 0
|
|
115
|
+
"deleted_remote": 0,
|
|
116
|
+
"aborted": false
|
|
114
117
|
},
|
|
115
118
|
"items": [
|
|
116
119
|
{"rel_path": "...", "file_token": "...", "action": "folder_created"},
|
|
117
120
|
{"rel_path": "...", "file_token": "...", "action": "uploaded", "size_bytes": 0},
|
|
118
121
|
{"rel_path": "...", "file_token": "...", "action": "overwritten", "version": "...", "size_bytes": 0},
|
|
119
122
|
{"rel_path": "...", "file_token": "...", "action": "skipped", "size_bytes": 0},
|
|
120
|
-
{"rel_path": "...", "action": "failed", "size_bytes": 0, "error": "..."},
|
|
123
|
+
{"rel_path": "...", "action": "failed", "size_bytes": 0, "error": "...", "hint": "...", "phase": "upload", "error_class": "...", "code": 0, "subtype": "...", "retryable": false},
|
|
121
124
|
{"rel_path": "...", "file_token": "...", "action": "deleted_remote"},
|
|
122
|
-
{"rel_path": "...", "file_token": "...", "action": "
|
|
125
|
+
{"rel_path": "...", "file_token": "...", "action": "already_deleted"},
|
|
126
|
+
{"rel_path": "...", "file_token": "...", "action": "delete_failed", "error": "...", "hint": "...", "phase": "delete", "error_class": "...", "code": 0, "subtype": "...", "retryable": false}
|
|
123
127
|
]
|
|
124
128
|
}
|
|
125
129
|
```
|
|
126
130
|
|
|
127
131
|
`rel_path` 始终用 `/` 作为分隔符(跨平台一致)。
|
|
128
132
|
|
|
133
|
+
## 失败处理与 agent 行为
|
|
134
|
+
|
|
135
|
+
`+push` 的失败项带结构化字段,agent 必须优先读 `items[].error_class` / `phase` / `code`,不要只看自然语言 `error` 文本。`summary.aborted=true` 表示命令已经遇到终止性错误并停止后续批处理;这时**不要原样重试**,先修复根因。
|
|
136
|
+
|
|
137
|
+
常见终止性错误:
|
|
138
|
+
|
|
139
|
+
| `error_class` | 常见 `code` | 含义 | Agent 应对 |
|
|
140
|
+
|---|---:|---|---|
|
|
141
|
+
| `app_scope_missing` | `99991672` | 应用身份缺少 Drive / 文件夹相关 scope | 停止重试,引导开通错误里列出的应用身份权限,例如 `space:folder:create` 或 `drive:drive` |
|
|
142
|
+
| `user_scope_missing` | `99991679` | 用户身份缺少授权 | 停止重试,走 `lark-cli auth login --scope ...` 补错误里列出的 scope |
|
|
143
|
+
| `permission_denied` | `1061004` / HTTP 403 | 当前身份无权操作目标资源 | 停止重试,检查目标文件夹权限、身份类型(user / bot)和资源可见性 |
|
|
144
|
+
| `invalid_api_parameters` | `1061002` | API 参数被服务端拒绝 | 停止重试,检查 `--folder-token`、覆盖模式、`file_token`、文件名和上传参数;不要对同一参数组合批量重试 |
|
|
145
|
+
| `parent_node_missing` | `1061044` | 上传 / 建目录使用的父文件夹不存在或当前身份不可见 | 停止重试,检查 `--folder-token` 是否仍存在、是否有权限、父目录是否在 push 过程中被删除;不要继续上传同一目录树 |
|
|
146
|
+
| `parent_sibling_limit` | `1062507` | 目标父文件夹单层子节点数量超过上限 | 停止重试,清理目标目录、换一个 `--folder-token`,或把上传内容拆到多个子目录 |
|
|
147
|
+
| `rate_limited` | `99991400` | 触发频控 | 停止当前批次,退避后再重试 |
|
|
148
|
+
| `server_error` | `1061001` / `2200` | Drive 服务端异常 | 停止当前批次,稍后重试;保留 `log_id` 便于排查 |
|
|
149
|
+
|
|
150
|
+
非终止但需要解释的状态:
|
|
151
|
+
|
|
152
|
+
- `file_size_limit` / `1061043`:文件超过 Drive 上传限制。不要继续尝试同一文件;改拆分或换存储方式。
|
|
153
|
+
- `upload_size_mismatch` / `1062009`:本地文件在上传过程中发生变化,或声明大小与实际读取大小不一致。重新扫描本地文件后再 push。
|
|
154
|
+
- `remote_not_found` / `1061007`:一般表示远端文件已不存在。删除阶段的 `1061007` 会被视为 `already_deleted` 成功项;其他阶段需重新列表确认远端状态。
|
|
155
|
+
|
|
129
156
|
## 性能注意
|
|
130
157
|
|
|
131
158
|
- 默认 `skip` 下,已存在的远端文件一律不碰;`overwrite` 下,重复跑会重传所有命中的同名文件;`smart` 下会按 `modified_time` 跳过已对齐的远端文件,但对“远端更旧”的文件仍会进入覆盖路径,因此它减少的是**不必要的重传**,不是把覆盖风险完全拿掉。
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
## 远端同名文件冲突
|
|
21
21
|
|
|
22
|
-
如果 Drive 中多个条目映射到同一个 `rel_path`,`+status` 会在下载/hash
|
|
22
|
+
如果 Drive 中多个条目映射到同一个 `rel_path`,`+status` 会在下载/hash 前直接失败,在 stderr 返回类型化错误信封(`error.type=validation`、`error.subtype=failed_precondition`);`error.params[]` 每条的 `name` 是冲突的 `rel_path`,`reason` 枚举该路径下所有碰撞条目(`type` + `file_token`)。不要把这种情况当成普通 `modified`;它表示同步域本身有歧义,需要先整理云端结构,或在 `+pull` / `+push` 中仅对“duplicate file”场景显式选择冲突策略。
|
|
23
23
|
|
|
24
24
|
## 命令
|
|
25
25
|
|
|
@@ -76,20 +76,18 @@ lark-cli drive +status \
|
|
|
76
76
|
```json
|
|
77
77
|
{
|
|
78
78
|
"ok": false,
|
|
79
|
+
"identity": "user",
|
|
79
80
|
"error": {
|
|
80
|
-
"type": "
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
81
|
+
"type": "validation",
|
|
82
|
+
"subtype": "failed_precondition",
|
|
83
|
+
"message": "1 rel_path(s) map to multiple Drive entries",
|
|
84
|
+
"hint": "resolve the duplicate remote files first: re-run +pull with --on-duplicate-remote=rename (downloads each with a hashed suffix), or use --on-duplicate-remote=newest|oldest (supported by +pull/+sync/+push) to pick one, or delete the extra remote files; a plain retry will not help",
|
|
85
|
+
"params": [
|
|
86
|
+
{
|
|
87
|
+
"name": "dup.txt",
|
|
88
|
+
"reason": "2 Drive entries collide here: file <full_file_token>, folder <folder_token>"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
```
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# 知识整理工作流
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workflow id: `knowledge_organize`
|
|
4
|
+
|
|
5
|
+
Risk / Structure: `R2-R3` / `S3`
|
|
6
|
+
|
|
7
|
+
This file implements the registered knowledge organization workflow. Before execution, the agent MUST read [`lark-drive-workflow.md`](lark-drive-workflow.md) and [`../../lark-shared/SKILL.md`](../../lark-shared/SKILL.md), and follow the shared execution protocol, Artifact Contract, Workflow Loading rules, authentication rules, and write confirmation rules.
|
|
8
|
+
|
|
9
|
+
It defines the workflow-specific state machine and progressive loading map. Stage-specific rules live in phase files and MUST be loaded only when the workflow reaches the corresponding state.
|
|
4
10
|
|
|
5
11
|
Phase files are references for this workflow, not independent skills. Do not route user requests directly to a phase file.
|
|
6
12
|
|
|
@@ -80,7 +86,7 @@ When this workflow is triggered, the agent MUST:
|
|
|
80
86
|
|
|
81
87
|
## Runtime State
|
|
82
88
|
|
|
83
|
-
Agent MUST maintain these internal fields during one workflow run:
|
|
89
|
+
This workflow extends the shared Artifact Contract. Agent MUST maintain these internal fields during one workflow run:
|
|
84
90
|
|
|
85
91
|
| Field | Meaning |
|
|
86
92
|
|-------|---------|
|
|
@@ -114,24 +120,24 @@ Agent MUST maintain these internal fields during one workflow run:
|
|
|
114
120
|
|
|
115
121
|
## Execution State Machine
|
|
116
122
|
|
|
117
|
-
| State | Entry Condition | Agent MUST Do | User-Facing Output | wait_for_user | Next State |
|
|
118
|
-
|
|
119
|
-
| `PARSE_SCOPE` | Workflow triggered | Load discovery phase; parse target, environment, identity, and target type | Scope confirmation or clarification question | `true` | `INVENTORY` |
|
|
120
|
-
| `INVENTORY` | Scope confirmed | Load discovery phase; recursively list resources and build `resource_items` | Inventory progress / summary; continue automatically unless blocked | `false` unless blocked | `CONTENT_READ` |
|
|
121
|
-
| `CONTENT_READ` | Inventory complete | Load analysis phase; identify low-confidence items and perform mandatory partial read when needed | Low-confidence read summary | `false` unless auth / permission blocks | `ISSUE_ANALYSIS` |
|
|
122
|
-
| `ISSUE_ANALYSIS` | Resource list and partial reads ready | Load analysis phase; detect structure problems, evidence, and organization approach | Inventory result, problems, organization approach, and decision options | `true` | `RULE_GENERATION` |
|
|
123
|
-
| `RULE_GENERATION` | User confirms organization approach | Load analysis phase; generate classification rules and `target_tree` | No separate stop; target tree is shown with plan generation | `false` | `PLAN_GENERATION` |
|
|
124
|
-
| `PLAN_GENERATION` | Target tree ready | Load planning phase; generate complete internal `plan_items`; show target tree plus plan overview or page | Target tree and plan overview / paginated plan page | `true` | `EXEC_CONFIRM` |
|
|
125
|
-
| `EXEC_CONFIRM` | User wants execution | Load planning phase; ask user to choose execution scope | Execution options and write-operation summary | `true` | `EXECUTE` or `DONE` |
|
|
126
|
-
| `EXECUTE` | User explicitly confirmed execution scope | Load execution phase; execute only whitelisted write operations for confirmed scope while maintaining internal recovery state | Progress reports for large or long-running execution; if blocked after successful moves, ask whether to try restoring to `整理前的位置` | `false` unless blocked / recovery offered | `VERIFY`, `ROLLBACK_CONFIRM`, or `DONE` |
|
|
127
|
-
| `VERIFY` | Execution finished | Load execution phase; rescan target scope and compare actual path/token against plan | Verification table and final summary; if serious mismatches exist, ask whether to try restoring to `整理前的位置` | `false` unless recovery offered | `DONE` or `ROLLBACK_CONFIRM` |
|
|
128
|
-
| `ROLLBACK_CONFIRM` | User asks to restore after execution failure / verification mismatch / explicit rollback request | Load rollback phase; generate internal `rollback_plan`; ask whether to execute recovery | Recoverable scope and restore confirmation | `true` | `ROLLBACK` or `DONE` |
|
|
129
|
-
| `ROLLBACK` | User explicitly confirms restore execution | Load rollback phase; execute confirmed reverse moves only | Recovery progress / result | `false` | `ROLLBACK_VERIFY` |
|
|
130
|
-
| `ROLLBACK_VERIFY` | Recovery execution finished | Load rollback phase; verify restored locations and decide whether cleanup candidates exist | Recovery verification result | `false` | `ROLLBACK_CLEANUP_CONFIRM` or `DONE` |
|
|
131
|
-
| `ROLLBACK_CLEANUP_CONFIRM` | Cleanup candidates exist after recovery, or user asks to clean workflow-created empty folders / nodes | Load rollback phase; generate cleanup plan and ask for delete confirmation | Cleanup candidates and delete confirmation | `true` | `ROLLBACK_CLEANUP` or `DONE` |
|
|
132
|
-
| `ROLLBACK_CLEANUP` | User explicitly confirms cleanup deletion | Load rollback phase; delete only confirmed workflow-created safe-empty folders / nodes | Cleanup progress / result | `false` | `ROLLBACK_CLEANUP_VERIFY` |
|
|
133
|
-
| `ROLLBACK_CLEANUP_VERIFY` | Cleanup deletion finished | Load rollback phase; verify deleted cleanup targets | Cleanup verification result | `false` | `DONE` |
|
|
134
|
-
| `DONE` | No more action | Stop | Final answer | `false` | End |
|
|
123
|
+
| State | Protocol Step | Entry Condition | Agent MUST Do | User-Facing Output | wait_for_user | Next State |
|
|
124
|
+
|-------|---------------|-----------------|---------------|--------------------|---------------|------------|
|
|
125
|
+
| `PARSE_SCOPE` | `route` / `scope` | Workflow triggered | Load discovery phase; parse target, environment, identity, and target type | Scope confirmation or clarification question | `true` | `INVENTORY` |
|
|
126
|
+
| `INVENTORY` | `read` | Scope confirmed | Load discovery phase; recursively list resources and build `resource_items` | Inventory progress / summary; continue automatically unless blocked | `false` unless blocked | `CONTENT_READ` |
|
|
127
|
+
| `CONTENT_READ` | `read` | Inventory complete | Load analysis phase; identify low-confidence items and perform mandatory partial read when needed | Low-confidence read summary | `false` unless auth / permission blocks | `ISSUE_ANALYSIS` |
|
|
128
|
+
| `ISSUE_ANALYSIS` | `assess` / `plan` | Resource list and partial reads ready | Load analysis phase; detect structure problems, evidence, and organization approach | Inventory result, problems, organization approach, and decision options | `true` | `RULE_GENERATION` |
|
|
129
|
+
| `RULE_GENERATION` | `assess` / `plan` | User confirms organization approach | Load analysis phase; generate classification rules and `target_tree` | No separate stop; target tree is shown with plan generation | `false` | `PLAN_GENERATION` |
|
|
130
|
+
| `PLAN_GENERATION` | `assess` / `plan` | Target tree ready | Load planning phase; generate complete internal `plan_items`; show target tree plus plan overview or page | Target tree and plan overview / paginated plan page | `true` | `EXEC_CONFIRM` |
|
|
131
|
+
| `EXEC_CONFIRM` | `confirm` | User wants execution | Load planning phase; ask user to choose execution scope | Execution options and write-operation summary | `true` | `EXECUTE` or `DONE` |
|
|
132
|
+
| `EXECUTE` | `execute` | User explicitly confirmed execution scope | Load execution phase; execute only whitelisted write operations for confirmed scope while maintaining internal recovery state | Progress reports for large or long-running execution; if blocked after successful moves, ask whether to try restoring to `整理前的位置` | `false` unless blocked / recovery offered | `VERIFY`, `ROLLBACK_CONFIRM`, or `DONE` |
|
|
133
|
+
| `VERIFY` | `verify` | Execution finished | Load execution phase; rescan target scope and compare actual path/token against plan | Verification table and final summary; if serious mismatches exist, ask whether to try restoring to `整理前的位置` | `false` unless recovery offered | `DONE` or `ROLLBACK_CONFIRM` |
|
|
134
|
+
| `ROLLBACK_CONFIRM` | `recovery confirm` | User asks to restore after execution failure / verification mismatch / explicit rollback request | Load rollback phase; generate internal `rollback_plan`; ask whether to execute recovery | Recoverable scope and restore confirmation | `true` | `ROLLBACK` or `DONE` |
|
|
135
|
+
| `ROLLBACK` | `recovery execute` | User explicitly confirms restore execution | Load rollback phase; execute confirmed reverse moves only | Recovery progress / result | `false` | `ROLLBACK_VERIFY` |
|
|
136
|
+
| `ROLLBACK_VERIFY` | `recovery verify` | Recovery execution finished | Load rollback phase; verify restored locations and decide whether cleanup candidates exist | Recovery verification result | `false` | `ROLLBACK_CLEANUP_CONFIRM` or `DONE` |
|
|
137
|
+
| `ROLLBACK_CLEANUP_CONFIRM` | `cleanup confirm` | Cleanup candidates exist after recovery, or user asks to clean workflow-created empty folders / nodes | Load rollback phase; generate cleanup plan and ask for delete confirmation | Cleanup candidates and delete confirmation | `true` | `ROLLBACK_CLEANUP` or `DONE` |
|
|
138
|
+
| `ROLLBACK_CLEANUP` | `cleanup execute` | User explicitly confirms cleanup deletion | Load rollback phase; delete only confirmed workflow-created safe-empty folders / nodes | Cleanup progress / result | `false` | `ROLLBACK_CLEANUP_VERIFY` |
|
|
139
|
+
| `ROLLBACK_CLEANUP_VERIFY` | `cleanup verify` | Cleanup deletion finished | Load rollback phase; verify deleted cleanup targets | Cleanup verification result | `false` | `DONE` |
|
|
140
|
+
| `DONE` | `done` | No more action | Stop | Final answer | `false` | End |
|
|
135
141
|
|
|
136
142
|
## Progressive Load Map
|
|
137
143
|
|
|
@@ -97,7 +97,7 @@ Structure Level:
|
|
|
97
97
|
2. Entry file 超过约 300 行时,优先拆 `commands`、`outputs` 或 `artifacts` reference。
|
|
98
98
|
3. 只有执行、验证、恢复或 rollback 状态链复杂到影响可读性时,才升级到 `S3` phase files。
|
|
99
99
|
4. 垂直业务包优先作为已有 workflow 的 recipe / policy / template,不默认新增独立 workflow。
|
|
100
|
-
5. 已有样板:`permission_governance` 是 `R2/S2
|
|
100
|
+
5. 已有样板:`permission_governance` 是 `R2/S2`;`knowledge_organize` 是 `R2-R3/S3`。
|
|
101
101
|
|
|
102
102
|
## 加载与拆分边界
|
|
103
103
|
|
|
@@ -111,6 +111,7 @@ Structure Level:
|
|
|
111
111
|
| Workflow | Status | Risk | Structure | Entry File | Trigger |
|
|
112
112
|
|----------|--------|------|-----------|------------|---------|
|
|
113
113
|
| `permission_governance` | Registered | `R2` | `S2` | [`lark-drive-workflow-permission-governance.md`](lark-drive-workflow-permission-governance.md) | 权限审计、公开链接/外部访问、复制/下载/评论/分享设置、权限申请、owner 转移 / 批量 owner 转移、密级标签调整 |
|
|
114
|
+
| `knowledge_organize` | Registered | `R2-R3` | `S3` | [`lark-drive-workflow-knowledge-organize.md`](lark-drive-workflow-knowledge-organize.md) | 整理云盘 / 文件夹 / 文档库 / 知识库、盘点目录结构、归类资源、生成整理方案,并在用户确认后创建目录或移动资源 |
|
|
114
115
|
|
|
115
116
|
## Workflow Loading
|
|
116
117
|
|
package/skills/lark-im/SKILL.md
CHANGED
|
@@ -41,13 +41,14 @@ Chat (oc_xxx)
|
|
|
41
41
|
- `--as bot` means **bot identity** and uses `tenant_access_token`. Calls run as the app bot, so behavior depends on the bot's membership, app visibility, availability range, and bot-specific scopes.
|
|
42
42
|
- If an IM API says it supports both `user` and `bot`, the token type changes who the operator is. The same API can succeed with one identity and fail with the other because owner/admin status, chat membership, tenant boundary, or app availability are checked against the current caller.
|
|
43
43
|
|
|
44
|
-
### Sender Name Resolution
|
|
44
|
+
### Sender Name Resolution
|
|
45
45
|
|
|
46
|
-
When
|
|
46
|
+
When fetching messages (`+chat-messages-list`, `+threads-messages-list`, `+messages-mget`, `+messages-search`), the CLI shows a display name for both user and bot senders:
|
|
47
47
|
|
|
48
|
-
**
|
|
48
|
+
- **Server-provided name**: the read APIs return `sender_name` (plus the full-i18n `sender_i18n_names` map) on each message `sender`; the CLI surfaces it as the sender's `name` for users and bots alike. No name lookup and no extra permission are needed — **no contact scope** and no `application:bot.basic_info:read`.
|
|
49
|
+
- **Fallback to id**: when the server does not provide a name, the sender is shown by its id and the command still exits 0. There is no contact-directory fallback.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
The raw `sender_name` is not duplicated in output (its value is in `name`); the full `sender_i18n_names` map (all locales) is preserved for consumers that need a specific language, alongside an optional `open_bot_id` (`ou_`) for bot senders aligned with the message-receive event channel. System messages (`msg_type: system`) have no sender name — that is normal, not an error.
|
|
51
52
|
|
|
52
53
|
### Default message enrichment (reactions / update_time)
|
|
53
54
|
|
|
@@ -188,7 +188,7 @@ lark-cli im +messages-reply --message-id om_xxx --msg-type interactive --content
|
|
|
188
188
|
| `--video-cover <path\|url\|key>` | **Required with `--video`** | Cwd-relative local cover image path, URL, or `image_key` (`img_xxx`) |
|
|
189
189
|
| `--audio <path\|url\|key>` | One content option | Voice-message audio key, URL, or cwd-relative local path. Local paths and URLs must be Opus (`.opus` or Ogg Opus `.ogg`) |
|
|
190
190
|
| `--reply-in-thread` | No | Reply inside the thread. The reply appears in the target message's thread instead of the main chat stream |
|
|
191
|
-
| `--idempotency-key <key>` | No | Idempotency key; the same key sends only one reply within 1 hour
|
|
191
|
+
| `--idempotency-key <key>` | No | Idempotency key, max 50 characters; the same key sends only one reply within 1 hour |
|
|
192
192
|
| `--as <identity>` | No | Identity type: `bot` or `user` (default `bot`) |
|
|
193
193
|
| `--dry-run` | No | Print the request only, do not execute it |
|
|
194
194
|
|
|
@@ -191,7 +191,7 @@ lark-cli im +messages-send --chat-id oc_xxx --msg-type interactive --content '<c
|
|
|
191
191
|
| `--video-cover <path\|url\|key>` | **Required with `--video`** | Cwd-relative local cover image path, URL, or `image_key` (`img_xxx`). Local paths and URLs are uploaded automatically |
|
|
192
192
|
| `--audio <path\|url\|key>` | One content option | Voice-message audio key, URL, or cwd-relative local path. Local paths and URLs must be Opus (`.opus` or Ogg Opus `.ogg`) |
|
|
193
193
|
| `--msg-type <type>` | No | Message type (default `text`). If you use `--text` / `--markdown` / media flags, the effective type is inferred automatically. Explicitly setting a conflicting `--msg-type` fails validation |
|
|
194
|
-
| `--idempotency-key <key>` | No | Idempotency key; the same key sends only one message within 1 hour
|
|
194
|
+
| `--idempotency-key <key>` | No | Idempotency key, max 50 characters; the same key sends only one message within 1 hour |
|
|
195
195
|
| `--as <identity>` | No | Identity type: `bot` or `user` (default `bot`) |
|
|
196
196
|
| `--dry-run` | No | Print the request only, do not execute it |
|
|
197
197
|
|
|
@@ -79,7 +79,7 @@ metadata:
|
|
|
79
79
|
|
|
80
80
|
1. `+triage --from spam@x.com` → 列出 N 条结果
|
|
81
81
|
2. 展示:"将删除 N 封邮件(发件人 spam@x.com,主题:…),确认?"
|
|
82
|
-
3. 用户确认后 →
|
|
82
|
+
3. 用户确认后 → `+message-trash --message-ids ... --yes`
|
|
83
83
|
|
|
84
84
|
## 身份选择:优先使用 user 身份
|
|
85
85
|
|
|
@@ -96,13 +96,14 @@ metadata:
|
|
|
96
96
|
1. **确认身份** — 首次操作邮箱前先调用 `lark-cli mail user_mailboxes profile --params '{"user_mailbox_id":"me"}'` 获取当前用户的真实邮箱地址(`primary_email_address`),不要通过系统用户名猜测。后续判断"发件人是否为用户本人"时以此地址为准。
|
|
97
97
|
2. **浏览** — `+triage` 查看收件箱摘要,获取 `message_id` / `thread_id`
|
|
98
98
|
3. **阅读** — `+message` 只读单封邮件;已有多个 `message_id` 时用 `+messages` 批量读取,不要循环调用 `+message`;`+thread` 读整个会话
|
|
99
|
-
4.
|
|
100
|
-
5.
|
|
101
|
-
6.
|
|
102
|
-
7.
|
|
103
|
-
8.
|
|
104
|
-
9.
|
|
105
|
-
10.
|
|
99
|
+
4. **整理** — 标签、已读/未读状态和移动文件夹优先用 `+message-modify`;软删除优先用 `+message-trash`
|
|
100
|
+
5. **回复** — `+reply` / `+reply-all`(默认存草稿,加 `--confirm-send` 则立即发送)
|
|
101
|
+
6. **转发** — `+forward`(默认存草稿,加 `--confirm-send` 则立即发送)
|
|
102
|
+
7. **新邮件** — `+send` 存草稿(默认),加 `--confirm-send` 发送
|
|
103
|
+
8. **HTML body 预检(可选)** — 复杂 HTML body 提交前可先跑 `+lint-html` 看 lint 会改 / 删什么;写信路径(`+send` / `+draft-create` / `+reply` / `+reply-all` / `+forward` / `+draft-edit` body op)已内置 autofix,普通正文不必先跑。详见 [references/lark-mail-html.md](references/lark-mail-html.md) 中的「写入路径内置 HTML lint」章节
|
|
104
|
+
9. **确认投递** — 立即发送后用 `send_status` 查询投递状态,定时发送后在预定时间后再查询;取消定时发送用 `cancel_scheduled_send`
|
|
105
|
+
10. **编辑草稿** — `+draft-edit` 修改已有草稿。正文编辑通过 `--patch-file`:回复/转发草稿用 `set_reply_body` op 保留引用区,普通草稿用 `set_body` op
|
|
106
|
+
11. **已读回执** —
|
|
106
107
|
- **请求回执(写信侧)**:`--request-receipt` 仅在**用户显式要求**时添加,**不要从 subject / body 内容推断意图**。
|
|
107
108
|
- **响应回执(拉信侧)**:拉信看到 `label_ids` 含 `READ_RECEIPT_REQUEST`(或 `-607`)时,**必须先问用户**是否回执(不要自动回执,涉及隐私)。用户同意 → `+send-receipt` 响应;用户不同意但想消掉提示 → `+decline-receipt` 只清本地标签、不发邮件。
|
|
108
109
|
|
|
@@ -119,6 +120,8 @@ metadata:
|
|
|
119
120
|
- 查看发送邮件后的投递状态:发送成功后查看邮件投递状态;也覆盖发送拦截。ref: [lark-mail-send-status](references/lark-mail-send-status.md)
|
|
120
121
|
- 使用邮件模板:区分个人模板和静态 HTML 模板,发信类 shortcut 用 `--template-id` 套用模板。ref: [lark-mail-template](references/lark-mail-template.md)
|
|
121
122
|
- 撤回已发送邮件:撤回邮件并查询异步撤回状态。ref: [lark-mail-recall](references/lark-mail-recall.md)
|
|
123
|
+
- 修改邮件标签/已读状态/文件夹:优先使用 `+message-modify`。ref: [`+message-modify`](references/lark-mail-message-modify.md)
|
|
124
|
+
- 软删除邮件:优先使用 `+message-trash`。ref: [`+message-trash`](references/lark-mail-message-trash.md)
|
|
122
125
|
- 收信规则:创建、验证、删除自动处理收到邮件的规则。ref: [lark-mail-rules](references/lark-mail-rules.md)
|
|
123
126
|
- 分享邮件到 IM:分享邮件或会话到群聊、个人会话。ref: [lark-mail-share-to-chat](references/lark-mail-share-to-chat.md)
|
|
124
127
|
- 发送日程邀请邮件:在邮件中嵌入 `text/calendar` 日程邀请。ref: [lark-mail-calendar-invite](references/lark-mail-calendar-invite.md)
|
|
@@ -192,7 +195,7 @@ lark-cli mail +messages --message-ids <id1>,<id2>,<id3> --html=false
|
|
|
192
195
|
|
|
193
196
|
## 原生 API 调用规则
|
|
194
197
|
|
|
195
|
-
没有 Shortcut 覆盖的操作才使用原生 API
|
|
198
|
+
没有 Shortcut 覆盖的操作才使用原生 API。标签、已读状态、移动文件夹优先使用 `+message-modify`;软删除优先使用 `+message-trash`。调用步骤以本节为准;资源和 method 用 `lark-cli mail -h` / `lark-cli mail <resource> -h` 发现,不在入口保留完整资源表。
|
|
196
199
|
|
|
197
200
|
### Step 1 — 用 `-h` 确定要调用的 API(必须,不可跳过)
|
|
198
201
|
|
|
@@ -215,7 +215,7 @@ lark-cli mail user_mailbox.drafts cancel_scheduled_send --params '{"user_mailbox
|
|
|
215
215
|
**2. 标记已读**(可选)— 询问用户是否需要将原邮件标记为已读。如果用户同意:
|
|
216
216
|
|
|
217
217
|
```bash
|
|
218
|
-
lark-cli mail
|
|
218
|
+
lark-cli mail +message-modify --message-ids <原邮件ID> --remove-label-ids UNREAD
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
## 编辑转发草稿
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# mail +message-modify
|
|
2
|
+
|
|
3
|
+
`mail +message-modify` is the preferred shortcut for changing labels, read-state labels, or folder placement on existing messages.
|
|
4
|
+
|
|
5
|
+
Use it instead of raw `user_mailbox.messages batch_modify` when the operation targets concrete `message_id` values from `+triage`, `+message`, or `+messages`.
|
|
6
|
+
|
|
7
|
+
## Common Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
lark-cli mail +message-modify --message-ids <id1>,<id2> --add-label-ids unread
|
|
11
|
+
lark-cli mail +message-modify --message-ids <id> --remove-label-ids FLAGGED
|
|
12
|
+
lark-cli mail +message-modify --message-ids <id> --add-folder archive
|
|
13
|
+
lark-cli mail +message-modify --mailbox shared@example.com --message-ids <id> --add-folder folder_xxx
|
|
14
|
+
lark-cli mail +message-modify --message-ids <id> --add-label-ids custom_label_id --dry-run
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Flags
|
|
18
|
+
|
|
19
|
+
| Flag | Required | Notes |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| `--mailbox` | No | Mailbox that owns the messages. Defaults to `me`. |
|
|
22
|
+
| `--message-ids` | Yes | `string_array`; supports comma-separated values and repeated flags. |
|
|
23
|
+
| `--add-label-ids` | No | Adds labels. System labels `unread`, `important`, `other`, `flagged` normalize to upper case. |
|
|
24
|
+
| `--remove-label-ids` | No | Removes labels. Cannot overlap with `--add-label-ids`. |
|
|
25
|
+
| `--add-folder` | No | Moves to one folder. `inbox`, `sent`, `spam`, `archive`, `archived` normalize to system folder IDs. |
|
|
26
|
+
|
|
27
|
+
`TRASH` is intentionally rejected by this shortcut. Use `mail +message-trash --message-ids <id> --yes` for soft deletion.
|
|
28
|
+
|
|
29
|
+
## Behavior
|
|
30
|
+
|
|
31
|
+
- Message IDs are locally validated, de-duplicated in first-seen order, and sent in batches of 20.
|
|
32
|
+
- Custom label IDs are checked with `labels.get`; custom folder IDs are checked with `folders.get`.
|
|
33
|
+
- If no label or folder operation is requested, the command succeeds locally, emits all message IDs as `success_message_ids`, and makes no POST request.
|
|
34
|
+
- Single batch POST failures mark every message in that batch with the same failure reason; later batches still run.
|
|
35
|
+
- JSON output is intentionally compact:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"success_message_ids": ["id1"],
|
|
40
|
+
"failed_message_ids": [
|
|
41
|
+
{"message_id": "id2", "reason": "api error"}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## When Raw API Is Still Appropriate
|
|
47
|
+
|
|
48
|
+
Use raw `mail user_mailbox.messages batch_modify` only when you need a request shape that the shortcut intentionally does not expose, or when reproducing backend/API behavior exactly for diagnostics.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# mail +message-trash
|
|
2
|
+
|
|
3
|
+
`mail +message-trash` is the preferred shortcut for soft-deleting existing messages.
|
|
4
|
+
|
|
5
|
+
Use it after obtaining real `message_id` values from `+triage`, `+message`, or `+messages`, and after the user has confirmed the deletion preview.
|
|
6
|
+
|
|
7
|
+
## Common Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
lark-cli mail +message-trash --message-ids <id1>,<id2> --yes
|
|
11
|
+
lark-cli mail +message-trash --mailbox shared@example.com --message-ids <id> --yes
|
|
12
|
+
lark-cli mail +message-trash --message-ids <id1> --message-ids <id2> --dry-run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Flags
|
|
16
|
+
|
|
17
|
+
| Flag | Required | Notes |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| `--mailbox` | No | Mailbox that owns the messages. Defaults to `me`. |
|
|
20
|
+
| `--message-ids` | Yes | `string_array`; supports comma-separated values and repeated flags. |
|
|
21
|
+
| `--yes` | Yes for execution | Required by the high-risk write confirmation framework. |
|
|
22
|
+
|
|
23
|
+
## Behavior
|
|
24
|
+
|
|
25
|
+
- Message IDs are locally validated, de-duplicated in first-seen order, and sent in batches of 20.
|
|
26
|
+
- The shortcut calls `POST /open-apis/mail/v1/user_mailboxes/<mailbox>/messages/batch_trash` sequentially.
|
|
27
|
+
- Single batch POST failures mark every message in that batch with the same failure reason; later batches still run.
|
|
28
|
+
- JSON output is intentionally compact:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"success_message_ids": ["id1"],
|
|
33
|
+
"failed_message_ids": [
|
|
34
|
+
{"message_id": "id2", "reason": "api error"}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## When Raw API Is Still Appropriate
|
|
40
|
+
|
|
41
|
+
Use raw `mail user_mailbox.messages batch_trash` only when reproducing backend/API behavior exactly for diagnostics. For normal soft deletion, prefer this shortcut because it handles validation, batching, compact output, and `--yes` confirmation consistently.
|
|
@@ -203,7 +203,7 @@ lark-cli mail user_mailbox.drafts cancel_scheduled_send --params '{"user_mailbox
|
|
|
203
203
|
**2. 标记已读**(可选)— 询问用户是否需要将原邮件标记为已读。如果用户同意:
|
|
204
204
|
|
|
205
205
|
```bash
|
|
206
|
-
lark-cli mail
|
|
206
|
+
lark-cli mail +message-modify --message-ids <原邮件ID> --remove-label-ids UNREAD
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
## 相关命令
|