@amaster.ai/pi-lark 0.1.2-beta.51 → 0.1.2-beta.53
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 +10 -4
- package/skills/lark-apps/references/lark-apps-cloud-dev.md +5 -4
- package/skills/lark-apps/references/lark-apps-create.md +6 -3
- package/skills/lark-apps/references/lark-apps-get.md +1 -1
- package/skills/lark-apps/references/lark-apps-list.md +1 -1
- package/skills/lark-apps/references/lark-apps-local-dev.md +27 -1
- package/skills/lark-apps/references/lark-apps-release-create.md +1 -1
- package/skills/lark-base/SKILL.md +11 -4
- package/skills/lark-base/references/lark-base-dashboard-block-get-data.md +17 -1
- package/skills/lark-base/references/lark-base-dashboard.md +17 -4
- package/skills/lark-base/references/lark-base-field-json.md +2 -0
- package/skills/lark-calendar/SKILL.md +1 -1
- package/skills/lark-doc/SKILL.md +1 -0
- package/skills/lark-doc/references/lark-doc-history.md +13 -14
- package/skills/lark-drive/SKILL.md +7 -5
- package/skills/lark-drive/references/lark-drive-apply-permission.md +1 -1
- package/skills/lark-drive/references/lark-drive-copy.md +87 -0
- package/skills/lark-drive/references/lark-drive-export.md +3 -0
- package/skills/lark-drive/references/lark-drive-task-result.md +3 -0
- package/skills/lark-drive/references/lark-drive-update-title.md +78 -0
- package/skills/lark-event/SKILL.md +7 -4
- package/skills/lark-event/references/lark-event-vc.md +8 -2
- package/skills/lark-im/SKILL.md +5 -5
- package/skills/lark-im/references/lark-im-chat-list.md +9 -2
- package/skills/lark-im/references/lark-im-chat-members-list.md +7 -4
- package/skills/lark-im/references/lark-im-chat-messages-list.md +10 -3
- package/skills/lark-im/references/lark-im-chat-search.md +9 -2
- package/skills/lark-im/references/lark-im-feed-group-list-item.md +2 -2
- package/skills/lark-im/references/lark-im-feed-group-list.md +2 -2
- package/skills/lark-im/references/lark-im-feed-shortcut-list.md +1 -1
- package/skills/lark-im/references/lark-im-flag-list.md +2 -2
- package/skills/lark-im/references/lark-im-message-enrichment.md +1 -1
- package/skills/lark-im/references/lark-im-messages-search.md +4 -5
- package/skills/lark-im/references/lark-im-threads-messages-list.md +8 -4
- package/skills/lark-mail/references/lark-mail-triage.md +19 -4
- package/skills/lark-minutes/SKILL.md +1 -1
- package/skills/lark-minutes/references/lark-minutes-search.md +6 -7
- package/skills/lark-shared/SKILL.md +3 -3
- package/skills/lark-sheets/SKILL.md +83 -82
- package/skills/lark-sheets/references/lark-sheets-batch-update.md +13 -58
- package/skills/lark-sheets/references/lark-sheets-chart.md +2 -1
- package/skills/lark-sheets/references/lark-sheets-conditional-format.md +1 -1
- package/skills/lark-sheets/references/lark-sheets-range-operations.md +5 -5
- package/skills/lark-sheets/references/lark-sheets-read-data.md +80 -6
- package/skills/lark-sheets/references/lark-sheets-sheet-structure.md +21 -10
- package/skills/lark-sheets/references/lark-sheets-styles-put.md +93 -0
- package/skills/lark-sheets/references/lark-sheets-visual-standards.md +2 -2
- package/skills/lark-sheets/references/lark-sheets-workbook.md +4 -3
- package/skills/lark-sheets/references/lark-sheets-write-cells.md +40 -12
- package/skills/lark-sheets/scripts/lark_detect_subtables.py +593 -0
- package/skills/lark-sheets/scripts/lark_inspect_workbook.py +188 -0
- package/skills/lark-sheets/scripts/lark_profile_table.py +614 -0
- package/skills/lark-sheets/scripts/lark_sheet_range.py +176 -0
- package/skills/lark-sheets/scripts/lark_sheet_read_cli.py +184 -0
- package/skills/lark-sheets/scripts/sheets_df.py +21 -3
- package/skills/lark-slides/SKILL.md +25 -40
- package/skills/lark-slides/references/lark-slides-add-slide.md +92 -0
- package/skills/lark-slides/references/lark-slides-create.md +16 -35
- package/skills/lark-slides/references/lark-slides-delete-slide.md +65 -0
- package/skills/lark-slides/references/lark-slides-edit-workflows.md +5 -3
- package/skills/lark-slides/references/lark-slides-media-upload.md +3 -25
- package/skills/lark-slides/references/lark-slides-replace-pages.md +6 -4
- package/skills/lark-slides/references/lark-slides-replace-slide.md +22 -1
- package/skills/lark-slides/references/lark-slides-screenshot.md +31 -13
- package/skills/lark-slides/references/lark-slides-xml-presentations-get.md +5 -5
- package/skills/lark-slides/references/slides_chart_demo.xml +1 -1
- package/skills/lark-slides/references/slides_xml_schema_definition.xml +48 -4
- package/skills/lark-slides/references/troubleshooting.md +1 -2
- package/skills/lark-slides/references/validation-checklist.md +3 -3
- package/skills/lark-slides/references/xml-schema-quick-ref.md +23 -9
- package/skills/lark-slides/scripts/sxsd_validator.py +154 -10
- package/skills/lark-slides/scripts/xml_text_overlap_lint.py +360 -76
- package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +1138 -214
- package/skills/lark-whiteboard/SKILL.md +15 -8
- package/skills/lark-whiteboard/references/lark-whiteboard-export.md +4 -3
- package/skills/lark-whiteboard/references/lark-whiteboard-update.md +4 -4
- package/skills/lark-whiteboard/references/lark-whiteboard-workflow.md +19 -17
- package/skills/lark-whiteboard/routes/dsl.md +8 -2
- package/skills/lark-whiteboard/routes/mermaid.md +1 -1
- package/skills/lark-whiteboard/routes/svg-edit.md +5 -2
- package/skills/lark-whiteboard/routes/svg.md +3 -1
- package/skills/lark-whiteboard/scenes/mention.md +71 -0
- package/skills/lark-wiki/SKILL.md +5 -3
- package/skills/lark-wiki/references/lark-wiki-delete-space.md +6 -3
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md +0 -219
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md +0 -126
|
@@ -136,6 +136,8 @@ lark-cli drive +export \
|
|
|
136
136
|
- `--only-schema` 只支持 `bitable` 导出为 `.base`,用于仅导出表结构
|
|
137
137
|
- 如果格式不匹配,CLI 会返回 typed validation error,并在 `hint` 中给出可重试的 `--file-extension` 建议;例如 `docx + csv` 会提示改用 `docx/pdf/markdown`,或改传 sheet/bitable URL
|
|
138
138
|
- shortcut 内部固定有限轮询:最多 10 次,每次间隔 5 秒
|
|
139
|
+
- 创建导出任务时收到 `rate_limit` / `99991400` 不会生成 `ticket`;至少等待 1 分钟后重跑原 `drive +export`,持续限频时从 1 分钟开始指数退避
|
|
140
|
+
- 状态轮询一旦收到 `rate_limit` / `99991400` 会立即停止,不会继续消耗剩余轮询次数;错误会保留原始 typed metadata,并在 `hint` 中提供已有 `ticket` 的续查命令
|
|
139
141
|
- 轮询超时不是失败;会返回 `ticket`、`timed_out=true` 和 `next_command`,供后续继续查询
|
|
140
142
|
|
|
141
143
|
## 错误码处理
|
|
@@ -144,6 +146,7 @@ lark-cli drive +export \
|
|
|
144
146
|
|--------|------|----------|
|
|
145
147
|
| `1069914` | token 非法或 token/type 不匹配;常见原因是把 Wiki node token 当作底层 `docx` / `sheet` / `bitable` token 使用,没有传 `--doc-type wiki` | 优先改用 `--url <Wiki URL>`;只有裸 Wiki token 时,用 `--token <WIKI_NODE_TOKEN> --doc-type wiki`。不确定 token 类型时,先用 `lark-cli drive +inspect --url <TOKEN> --type wiki` 检查是否能解包为 Wiki node;如果不是 Wiki token,再检查 token 来源、`--doc-type` 是否与实际资源类型一致 |
|
|
146
148
|
| `1069902` | 没有当前导出任务所需权限 | 不要直接重试同一命令;先确认当前 `--as` 身份是否能访问该文档、是否有下载/导出权限,以及文档是否受分享、密级或租户策略限制。需要补权限时,让文档 owner 或管理员授权后再执行 |
|
|
149
|
+
| `99991400` / `rate_limit` | OpenAPI 请求频率受限 | 立即停止并按错误 `hint` 处理:没有 `ticket` 时,至少等待 1 分钟后重跑原 `drive +export`;已有 `ticket` 时,只执行 `drive +task_result --scenario export` 续查,不要重复创建任务。持续限频时从 1 分钟开始指数退避 |
|
|
147
150
|
| `99991679` | 缺少 OpenAPI scope | 按错误 envelope 中的 `missing_scopes` / `required_scope` / `hint` 补齐授权;常见方式是重新执行 `lark-cli auth login --scope "<缺失 scope>"`。补 scope 前不要反复重试导出命令 |
|
|
148
151
|
|
|
149
152
|
## 推荐续跑方式
|
|
@@ -329,6 +329,9 @@ lark-cli drive +export --token <SOURCE_DOC_TOKEN> --doc-type docx --file-extensi
|
|
|
329
329
|
# 2. 继续查询导出结果
|
|
330
330
|
lark-cli drive +task_result --scenario export --ticket <EXPORT_TICKET> --file-token <SOURCE_DOC_TOKEN>
|
|
331
331
|
|
|
332
|
+
# 如果返回 rate_limit / 99991400:至少等待 1 分钟后重试同一条 +task_result;
|
|
333
|
+
# 若仍限频,以 1 分钟为起点继续指数退避。
|
|
334
|
+
|
|
332
335
|
# 3. 拿到 file_token 后下载
|
|
333
336
|
lark-cli drive +export-download --file-token <EXPORTED_FILE_TOKEN>
|
|
334
337
|
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# drive +update-title
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
|
4
|
+
|
|
5
|
+
重命名云空间(云盘/云存储)里的文件、文件夹、在线文档或知识库节点。
|
|
6
|
+
|
|
7
|
+
## 命令
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 推荐:传 URL(自动识别类型和 token)
|
|
11
|
+
lark-cli drive +update-title \
|
|
12
|
+
--url 'https://example.larksuite.com/docx/<DOCX_TOKEN>' \
|
|
13
|
+
--title '<NEW_TITLE>'
|
|
14
|
+
|
|
15
|
+
# 裸 token 必须显式传 --type
|
|
16
|
+
lark-cli drive +update-title \
|
|
17
|
+
--token <FILE_TOKEN> \
|
|
18
|
+
--type file \
|
|
19
|
+
--title '<NEW_TITLE>.xlsx'
|
|
20
|
+
|
|
21
|
+
# 知识库节点:传 /wiki/ URL 里的 node_token
|
|
22
|
+
lark-cli drive +update-title \
|
|
23
|
+
--url 'https://example.larksuite.com/wiki/<NODE_TOKEN>' \
|
|
24
|
+
--title '<NEW_TITLE>'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 参数
|
|
28
|
+
|
|
29
|
+
| 参数 | 必填 | 说明 |
|
|
30
|
+
|------|------|------|
|
|
31
|
+
| `--url` | 与 `--token` 二选一 | 目标 URL,支持 `/docx/`、`/sheets/`、`/base/`、`/bitable/`、`/slides/`、`/file/`、`/drive/folder/`、`/wiki/` |
|
|
32
|
+
| `--token` | 与 `--url` 二选一 | 目标 token 或 URL;裸 token 必须配合 `--type` |
|
|
33
|
+
| `--type` | 裸 token 时必填 | `docx`、`sheet`、`bitable`(`base` 为兼容别名)、`slides`、`file`、`folder`、`wiki`;传 URL 时可省略,显式传入时必须与 URL 类型一致 |
|
|
34
|
+
| `--title` | 是 | 新标题,别名 `--new-title`;不能为空或纯空白,首尾空格会被去掉 |
|
|
35
|
+
| `--on-extension-mismatch` | 否 | 仅 `--type file`:`keep`(默认,标题缺后缀时自动补上当前后缀,后缀不一致时报错)/ `allow`(跳过校验,原样提交)。传给其他 `--type` 会报错 |
|
|
36
|
+
|
|
37
|
+
## 行为说明
|
|
38
|
+
|
|
39
|
+
- **空标题会被拒绝**:CLI 拒绝空或纯空白的 `--title`
|
|
40
|
+
- **`file` 类型会校验后缀**:`--type file` 的标题就是完整文件名。CLI 会比对 `--title` 与当前文件名的后缀:没有后缀时默认补上当前后缀(输出里用 `extension_appended` 说明),后缀不一致时拦截(`a.md` → `a.txt`)。要跳过校验加 `--on-extension-mismatch=allow`
|
|
41
|
+
- **wiki 不解包**:`--type wiki` 用 `/wiki/` URL 里的 `wiki_token`,传底层文档 token 会 `981003`
|
|
42
|
+
- **不支持旧版 doc 和思维笔记**:服务端不支持改这两类的标题(`type=doc` / `type=mindnote` 返回 `981002 params error`),CLI 在本地就拒绝,不会白发一次写请求
|
|
43
|
+
- **不支持妙搭 apps**:要改妙搭应用标题,切换到 [`lark-apps`](../../lark-apps/SKILL.md) 业务域处理
|
|
44
|
+
|
|
45
|
+
## 输出
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"updated": true,
|
|
50
|
+
"file_token": "<file_token>",
|
|
51
|
+
"type": "docx",
|
|
52
|
+
"title": "<new_title>",
|
|
53
|
+
"url": "https://example.feishu.cn/docx/<file_token>"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`--type file` 且未用 `allow` 时,额外返回改名前的文件名,改错了可以据此一条命令改回去;自动补了后缀还会带上 `extension_appended`:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"updated": true,
|
|
62
|
+
"title": "<new_title>.txt",
|
|
63
|
+
"previous_title": "<old_title>.txt",
|
|
64
|
+
"extension_appended": ".txt"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 常见错误
|
|
69
|
+
|
|
70
|
+
| 错误码 | 含义 | 处理 |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `99991672` / `99991679` | 缺失 scope | 按错误里的 `missing_scopes`、`hint` 申请/授权所需 scope 后重试 |
|
|
73
|
+
| `99991400` | 命中接口限频 | 等待一段时间后重试;批量改名时保持串行并降低频率 |
|
|
74
|
+
|
|
75
|
+
## 参考
|
|
76
|
+
|
|
77
|
+
- [lark-drive](../SKILL.md) -- 云空间(云盘/云存储)全部命令
|
|
78
|
+
- [lark-shared](../../lark-shared/SKILL.md) -- 认证和全局参数
|
|
@@ -32,7 +32,7 @@ metadata:
|
|
|
32
32
|
| `--max-events N` | Exit after N events. Default 0 = unlimited |
|
|
33
33
|
| `--timeout D` | Exit after duration D (e.g. `30s`, `2m`). Default 0 = no timeout. Whichever of `--max-events` / `--timeout` fires first wins |
|
|
34
34
|
| `--output-dir <dir>` | Write each event as a file (relative paths only; prevents traversal) |
|
|
35
|
-
| `--quiet` | Suppress stderr diagnostics. **AI should not use this** — it
|
|
35
|
+
| `--quiet` | Suppress ready/exit markers and per-event stderr diagnostics, including drop warnings. This can hide event loss. **AI should not use this** — it removes readiness and integrity signals |
|
|
36
36
|
| `--as user\|bot\|auto` | Identity for the session (see lark-shared) |
|
|
37
37
|
|
|
38
38
|
|
|
@@ -42,6 +42,9 @@ metadata:
|
|
|
42
42
|
# Default: stream every event for the key (no filter, no projection)
|
|
43
43
|
lark-cli event consume im.message.receive_v1 --as bot
|
|
44
44
|
|
|
45
|
+
# List every EventKey of one domain (the authoritative, always-current catalog)
|
|
46
|
+
lark-cli event list --domain vc --json
|
|
47
|
+
|
|
45
48
|
# Grab one sample event to inspect payload shape
|
|
46
49
|
lark-cli event consume im.message.receive_v1 --max-events 1 --timeout 30s --as bot
|
|
47
50
|
|
|
@@ -57,7 +60,7 @@ wait
|
|
|
57
60
|
|
|
58
61
|
## Call flow
|
|
59
62
|
|
|
60
|
-
1. `lark-cli event list --json` → pick a legal key
|
|
63
|
+
1. `lark-cli event list --json` → pick a legal key. `--domain <d>` narrows to one domain; the domains are `application`, `approval`, `board`, `card`, `im`, `minutes`, `task`, `vc`. An unknown domain fails with the valid set listed in the hint.
|
|
61
64
|
2. `lark-cli event schema <key> --json` → read `resolved_output_schema` + `jq_root_path` to determine field paths
|
|
62
65
|
3. `lark-cli event consume <key> [--jq '<expr>']` → consume
|
|
63
66
|
|
|
@@ -94,7 +97,7 @@ Orchestrators should treat `reason: limit/timeout/signal` (all exit 0) as "busin
|
|
|
94
97
|
|
|
95
98
|
### Never `kill -9`
|
|
96
99
|
|
|
97
|
-
**Avoid `kill -9` on consume processes
|
|
100
|
+
**Avoid `kill -9` on consume processes** for EventKeys whose PreConsume registers a server-side subscription **and** unsubscribes on exit (minutes, vc, board keys): `kill -9` skips the OAPI unsubscribe and leaks the server-side subscription (symptoms: "subscription already exists" on restart, duplicate event delivery). Keys whose subscription is a durable relation with no cleanup (task, approval keys) do not leak this way, but SIGTERM or closing stdin remains the right shutdown for every key.
|
|
98
101
|
|
|
99
102
|
### One consume, one EventKey (multi-key = multi-shell)
|
|
100
103
|
|
|
@@ -151,6 +154,6 @@ Lark-defined semantic tags (**not** JSON Schema's standard `format`). Common val
|
|
|
151
154
|
| Approval | [`references/lark-event-approval.md`](references/lark-event-approval.md) | Catalog of 2 Approval EventKeys (`approval.instance.status_changed_v4`, `approval.task.status_changed_v4`) + optional/multi `subscription_type` pre-registration + user-auth subscription lifecycle + flat output field reference |
|
|
152
155
|
| IM | [`references/lark-event-im.md`](references/lark-event-im.md) | Catalog of 12 IM EventKeys + shape notes (flat vs V2 envelope) + `im.message.receive_v1` field gotchas (`sender_id` is open_id only; `.content` is plain text except for `interactive` cards) + common jq recipes (filter by chat_type / message_type / sender); for `card.action.trigger` see also [`../lark-im/references/lark-im-card-action-reply.md`](../lark-im/references/lark-im-card-action-reply.md) |
|
|
153
156
|
| Task | [`references/lark-event-task.md`](references/lark-event-task.md) | Catalog of 1 Task EventKey (`task.task.update_user_access_v2`) + Native V2 envelope shape + task commit types + user/bot subscription notes |
|
|
154
|
-
| VC | [`references/lark-event-vc.md`](references/lark-event-vc.md) | Catalog of
|
|
157
|
+
| VC | [`references/lark-event-vc.md`](references/lark-event-vc.md) | Catalog of 7 VC EventKeys (meeting lifecycle `participant_meeting_started/joined/ended_v1`, `vc.note.generated_v1`, recording `recording_started/transcript_generated/ended_v1`) + field reference + source type semantics; the live list is always `lark-cli event list --domain vc --json` |
|
|
155
158
|
| Minutes | [`references/lark-event-minutes.md`](references/lark-event-minutes.md) | Catalog of 1 Minutes EventKey (`minutes.minute.generated_v1`) + field reference + source type semantics (meeting only) |
|
|
156
159
|
| Whiteboard | [`references/lark-event-whiteboard.md`](references/lark-event-whiteboard.md) | Catalog of 1 Board EventKey (`board.whiteboard.updated_v1`) + per-whiteboard subscription model (requires `-p whiteboard_id=<token>`) + payload field reference (whiteboard_id / operator_ids triple-id) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Prerequisite:** Read [`../SKILL.md`](../SKILL.md) first for the `event consume` essentials (commands, subprocess contract, jq usage).
|
|
4
4
|
|
|
5
|
-
## Key catalog (
|
|
5
|
+
## Key catalog (7)
|
|
6
6
|
|
|
7
7
|
| EventKey | Purpose |
|
|
8
8
|
|---|---|
|
|
@@ -10,8 +10,11 @@
|
|
|
10
10
|
| `vc.meeting.participant_meeting_joined_v1` | The current user has joined a meeting |
|
|
11
11
|
| `vc.meeting.participant_meeting_ended_v1` | A meeting the current user participates in has ended |
|
|
12
12
|
| `vc.note.generated_v1` | A note has been generated (meeting, recording, upload, etc.) |
|
|
13
|
+
| `vc.recording.recording_started_v1` | A recording_bean recording has started (Feishu software only) |
|
|
14
|
+
| `vc.recording.recording_transcript_generated_v1` | Recording_bean transcript items were generated (Feishu software only) |
|
|
15
|
+
| `vc.recording.recording_ended_v1` | A recording_bean recording ended and uploaded successfully (Feishu software only) |
|
|
13
16
|
|
|
14
|
-
All
|
|
17
|
+
All seven keys use a **Custom schema** (flat output) and carry a **PreConsume hook** that auto-subscribes / unsubscribes via OAPI on first / last consumer. All require `--as user`.
|
|
15
18
|
|
|
16
19
|
## Scopes & auth
|
|
17
20
|
|
|
@@ -21,6 +24,9 @@ All four keys use a **Custom schema** (flat output) and carry a **PreConsume hoo
|
|
|
21
24
|
| `vc.meeting.participant_meeting_joined_v1` | `vc:meeting.meetingevent:read` | user |
|
|
22
25
|
| `vc.meeting.participant_meeting_ended_v1` | `vc:meeting.meetingevent:read` | user |
|
|
23
26
|
| `vc.note.generated_v1` | `vc:note:read` | user |
|
|
27
|
+
| `vc.recording.recording_started_v1` | `vc:recording:read` | user |
|
|
28
|
+
| `vc.recording.recording_transcript_generated_v1` | `vc:recording:read` | user |
|
|
29
|
+
| `vc.recording.recording_ended_v1` | `vc:recording:read` | user |
|
|
24
30
|
|
|
25
31
|
---
|
|
26
32
|
|
package/skills/lark-im/SKILL.md
CHANGED
|
@@ -104,17 +104,17 @@ Shortcut 是对常用操作的高级封装(`lark-cli im +<verb> [flags]`)。
|
|
|
104
104
|
| Shortcut | 说明 |
|
|
105
105
|
|----------|------|
|
|
106
106
|
| [`+chat-create`](references/lark-im-chat-create.md) | Create a group chat or topic chat; user/bot; --chat-mode group|topic; private/public; invites users/bots; optionally sets bot manager |
|
|
107
|
-
| [`+chat-list`](references/lark-im-chat-list.md) | List chats the current user/bot is a member of; defaults to groups; pass --types=p2p,group to include p2p single chats (user-only); user/bot; supports sorting, pagination, --exclude-muted (user-only) |
|
|
107
|
+
| [`+chat-list`](references/lark-im-chat-list.md) | List chats the current user/bot is a member of; defaults to groups; pass --types=p2p,group to include p2p single chats (user-only); user/bot; supports sorting, auto-pagination, --exclude-muted (user-only) |
|
|
108
108
|
| [`+chat-members-list`](references/lark-im-chat-members-list.md) | List members of a chat; returns separate users[] / bots[] buckets; callable as user or bot; --member-types filters which kinds to return; --page-all pagination; surfaces truncations[] when the server caps a bucket |
|
|
109
|
-
| [`+chat-messages-list`](references/lark-im-chat-messages-list.md) | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range/
|
|
110
|
-
| [`+chat-search`](references/lark-im-chat-search.md) | Search visible group chats by --query keyword and/or --member-ids; user/bot; e.g. look up chat_id by group name; supports type filters, sorting, pagination, and --exclude-muted (user identity only) |
|
|
109
|
+
| [`+chat-messages-list`](references/lark-im-chat-messages-list.md) | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range, --order asc/desc sorting, auto-pagination |
|
|
110
|
+
| [`+chat-search`](references/lark-im-chat-search.md) | Search visible group chats by --query keyword and/or --member-ids; user/bot; e.g. look up chat_id by group name; supports type filters, sorting, auto-pagination, and --exclude-muted (user identity only) |
|
|
111
111
|
| [`+chat-update`](references/lark-im-chat-update.md) | Update group chat name or description; user/bot; updates a chat's name or description |
|
|
112
112
|
| [`+messages-mget`](references/lark-im-messages-mget.md) | Batch get messages by IDs; user/bot; fetches up to 50 om_ message IDs, formats sender names, expands thread replies |
|
|
113
113
|
| [`+messages-reply`](references/lark-im-messages-reply.md) | Reply to a message (supports thread replies); user/bot; supports text/markdown/post/media replies, reply-in-thread, idempotency key |
|
|
114
114
|
| [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download images/files from a message; user/bot; supports automatic chunked download for large files (8MB chunks), auto-detects file extension from Content-Type |
|
|
115
|
-
| [`+messages-search`](references/lark-im-messages-search.md) | Search messages across chats (supports keyword, sender, time range filters) with user identity;
|
|
115
|
+
| [`+messages-search`](references/lark-im-messages-search.md) | Search messages across chats (supports keyword, sender, time range filters) with user or bot identity; filters by chat/sender/attachment/time, supports auto-pagination via `--page-all` / `--page-limit`, enriches results via batched mget and chats batch_query |
|
|
116
116
|
| [`+messages-send`](references/lark-im-messages-send.md) | Send a message to a chat or direct message; user/bot; sends to chat-id or user-id with text/markdown/post/media, supports idempotency key |
|
|
117
|
-
| [`+threads-messages-list`](references/lark-im-threads-messages-list.md) | List messages in a thread; user/bot; accepts om_/omt_ input, resolves message IDs to thread_id, supports
|
|
117
|
+
| [`+threads-messages-list`](references/lark-im-threads-messages-list.md) | List messages in a thread; user/bot; accepts om_/omt_ input, resolves message IDs to thread_id, supports --order asc/desc sorting, auto-pagination |
|
|
118
118
|
| [`+flag-create`](references/lark-im-flag-create.md) | Create a bookmark on a message; user-only; defaults to message-layer flag; use --flag-type feed for feed-layer flag (item_type auto-detected from chat mode) |
|
|
119
119
|
| [`+flag-cancel`](references/lark-im-flag-cancel.md) | Cancel (remove) a bookmark. When no --flag-type is given, best-effort double-cancel: removes message layer and (when chat_type is determinable) feed layer |
|
|
120
120
|
| [`+flag-list`](references/lark-im-flag-list.md) | List bookmarks; user-only; auto-enriches feed-type thread entries with message content; `--page-all` is capped by `--page-limit` (default 20, max 1000), and `has_more=true` means the result is incomplete |
|
|
@@ -23,6 +23,9 @@ lark-cli im +chat-list --page-size 50
|
|
|
23
23
|
# Pagination
|
|
24
24
|
lark-cli im +chat-list --page-token "xxx"
|
|
25
25
|
|
|
26
|
+
# Fetch multiple pages automatically, up to 10 pages by default
|
|
27
|
+
lark-cli im +chat-list --page-all
|
|
28
|
+
|
|
26
29
|
# Drop muted chats (user identity only)
|
|
27
30
|
lark-cli im +chat-list --exclude-muted
|
|
28
31
|
|
|
@@ -50,13 +53,17 @@ lark-cli im +chat-list --as user --types p2p
|
|
|
50
53
|
| `--types <strings>` | No | `group`, `p2p` (comma-separated or repeated) | Chat types to include. Omitted = groups only (backward compatible). `p2p` requires user identity (`--as user`); under `--as bot`, `--types=p2p` alone is rejected and `--types=p2p,group` is silently downgraded to `group` |
|
|
51
54
|
| `--sort <field>` | No | `create_time` (default, ascending), `active_time` (descending) | Result ordering |
|
|
52
55
|
| `--page-size <n>` | No | 1-100, default 20 | Number of results per page |
|
|
53
|
-
| `--page-token <token>` | No | - |
|
|
56
|
+
| `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
|
|
57
|
+
| `--page-all` | No | - | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
|
|
58
|
+
| `--page-limit <n>` | No | 1-1000, default 10 | Maximum pages fetched by `--page-all` |
|
|
54
59
|
| `--exclude-muted` | No | User identity only | Drop chats the current user has muted (do-not-disturb). Under `--as bot`, the flag is silently inactive; see "Filtering muted chats" below |
|
|
55
60
|
| `--format json` | No | - | Output as JSON |
|
|
56
61
|
| `--dry-run` | No | - | Preview the request without executing it |
|
|
57
62
|
|
|
58
63
|
> **Note:** Supports both `--as user` (default) and `--as bot`. When using bot identity, the app must have bot capability enabled.
|
|
59
64
|
|
|
65
|
+
With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
|
|
66
|
+
|
|
60
67
|
## Output Fields
|
|
61
68
|
|
|
62
69
|
| Field | Description |
|
|
@@ -156,7 +163,7 @@ done
|
|
|
156
163
|
|
|
157
164
|
| Symptom | Root Cause | Solution |
|
|
158
165
|
|---------|---------|---------|
|
|
159
|
-
|
|
|
166
|
+
| `invalid --page-size 101: must be between 1 and 100` | page-size is out of range | Use an integer between 1 and 100 |
|
|
160
167
|
| Permission denied (99991672) | The bot app does not have `im:chat:read` TAT permission enabled | Enable the permission for the app in the Open Platform console |
|
|
161
168
|
| Permission denied (99991679) with `--as user` | UAT is not authorized for `im:chat:read` | Run `lark-cli auth login --scope "im:chat:read"` |
|
|
162
169
|
| `Bot ability is not activated` (232025) | The app does not have bot capability enabled | Enable bot capability in the Open Platform console |
|
|
@@ -19,9 +19,12 @@ lark-cli im +chat-members-list --chat-id oc_xxx --member-types user,bot
|
|
|
19
19
|
# Walk every page (capped by --page-limit; 0 = unlimited)
|
|
20
20
|
lark-cli im +chat-members-list --chat-id oc_xxx --page-all --page-limit 0
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Fetch one page starting at a specific cursor
|
|
23
23
|
lark-cli im +chat-members-list --chat-id oc_xxx --page-token "xxx"
|
|
24
24
|
|
|
25
|
+
# Continue automatically from a specific cursor
|
|
26
|
+
lark-cli im +chat-members-list --chat-id oc_xxx --page-token "xxx" --page-all
|
|
27
|
+
|
|
25
28
|
# JSON output / preview the request
|
|
26
29
|
lark-cli im +chat-members-list --chat-id oc_xxx --format json
|
|
27
30
|
lark-cli im +chat-members-list --chat-id oc_xxx --dry-run
|
|
@@ -35,7 +38,7 @@ lark-cli im +chat-members-list --chat-id oc_xxx --dry-run
|
|
|
35
38
|
| `--member-types <strings>` | No | `user`, `bot` (comma-separated or repeated) | Member types to return. Omitted = all |
|
|
36
39
|
| `--member-id-type <type>` | No | `open_id` (default), `union_id`, `user_id` | ID type for `member_id` in the response |
|
|
37
40
|
| `--page-size <n>` | No | 1-100, default 20 | Results per page. With `--page-all` and no explicit `--page-size`, the max (100) is used automatically to minimize round-trips |
|
|
38
|
-
| `--page-token <token>` | No | - |
|
|
41
|
+
| `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
|
|
39
42
|
| `--page-all` | No | - | Automatically walk every page (capped by `--page-limit`) |
|
|
40
43
|
| `--page-limit <n>` | No | default 10, `0` = unlimited | Max pages to fetch with `--page-all` |
|
|
41
44
|
| `--page-delay <ms>` | No | default 200, `0` = no delay | Delay between pages during `--page-all` (throttle to avoid rate limits on large lists) |
|
|
@@ -70,7 +73,7 @@ A truncated result is *not* fixable by paging further — it is a server-side ca
|
|
|
70
73
|
- With `--page-all` and no explicit `--page-size`, the shortcut uses the maximum page size (100) so a full walk takes the fewest round-trips. An explicit `--page-size` is always honored.
|
|
71
74
|
- `--page-all` sleeps `--page-delay` ms (default 200) between pages to avoid hammering the API when a tenant has no server-side member cap and the list spans many pages. Set `--page-delay 0` to disable.
|
|
72
75
|
- `--page-all` stops at `--page-limit` pages (default 10). When it stops early, `has_more` stays `true` so you know the result is incomplete; re-run with `--page-limit 0` for everything.
|
|
73
|
-
- `--page-token` and `--page-all` together:
|
|
76
|
+
- `--page-token` and `--page-all` together: automatic pagination starts at the supplied cursor and continues until exhaustion or `--page-limit`.
|
|
74
77
|
- Across pages, `users[]` and `bots[]` are concatenated; `truncations` / `has_more` / `page_token` come from the last page fetched.
|
|
75
78
|
|
|
76
79
|
## Common Errors and Troubleshooting
|
|
@@ -78,6 +81,6 @@ A truncated result is *not* fixable by paging further — it is a server-side ca
|
|
|
78
81
|
| Symptom | Root Cause | | Solution |
|
|
79
82
|
|---------|---------|---|---------|
|
|
80
83
|
| `--chat-id is required` | `--chat-id` omitted | | Provide the `oc_xxx` chat ID |
|
|
81
|
-
|
|
|
84
|
+
| `invalid --page-size 101: must be between 1 and 100` | out of range | | Use 1-100 |
|
|
82
85
|
| `--member-types contains invalid value` | value other than `user`/`bot` | | Use `user`, `bot`, or both |
|
|
83
86
|
| Permission denied | missing `im:chat.members:read` | | Bot: enable the scope in the console. User: `lark-cli auth login --scope "im:chat.members:read"` |
|
|
@@ -29,6 +29,9 @@ lark-cli im +chat-messages-list --chat-id oc_xxx --order asc --page-size 20
|
|
|
29
29
|
# Pagination
|
|
30
30
|
lark-cli im +chat-messages-list --chat-id oc_xxx --page-token "xxx"
|
|
31
31
|
|
|
32
|
+
# Fetch multiple pages automatically, up to 10 pages by default
|
|
33
|
+
lark-cli im +chat-messages-list --chat-id oc_xxx --page-all
|
|
34
|
+
|
|
32
35
|
# JSON output
|
|
33
36
|
lark-cli im +chat-messages-list --chat-id oc_xxx --format json
|
|
34
37
|
```
|
|
@@ -43,7 +46,9 @@ lark-cli im +chat-messages-list --chat-id oc_xxx --format json
|
|
|
43
46
|
| `--end <time>` | No | End time (ISO 8601 or date only) |
|
|
44
47
|
| `--order <order>` | No | Sort order: `asc` / `desc` (default `desc`) |
|
|
45
48
|
| `--page-size <n>` | No | Page size (default 50, max 50) |
|
|
46
|
-
| `--page-token <token>` | No |
|
|
49
|
+
| `--page-token <token>` | No | Starting cursor, normally returned by a previous response |
|
|
50
|
+
| `--page-all` | No | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
|
|
51
|
+
| `--page-limit <n>` | No | Maximum pages fetched by `--page-all` (default 10, range 1-1000) |
|
|
47
52
|
| `--no-reactions` | No | Skip auto-fetching the `reactions` block |
|
|
48
53
|
| `--download-resources` | No | Download message resources (image/file/audio/video/media + post-embedded, excluding stickers) into `./lark-im-resources/` and attach a `resources` block. Off by default; no extra requests when omitted |
|
|
49
54
|
|
|
@@ -106,12 +111,14 @@ Each message contains:
|
|
|
106
111
|
|
|
107
112
|
## Pagination (`has_more` / `page_token`)
|
|
108
113
|
|
|
109
|
-
`im +chat-messages-list` returns `has_more` and `page_token` when more data is available. Use `--page-token` to continue:
|
|
114
|
+
By default, `im +chat-messages-list` fetches one page. It returns `has_more` and `page_token` when more data is available. Use `--page-token` to continue:
|
|
110
115
|
|
|
111
116
|
```bash
|
|
112
117
|
lark-cli im +chat-messages-list --chat-id oc_xxx --page-token <PAGE_TOKEN>
|
|
113
118
|
```
|
|
114
119
|
|
|
120
|
+
With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
|
|
121
|
+
|
|
115
122
|
You can also fall back to the generic API:
|
|
116
123
|
|
|
117
124
|
```bash
|
|
@@ -149,7 +156,7 @@ lark-cli api GET /open-apis/im/v1/messages \
|
|
|
149
156
|
lark-cli im +chat-search --as bot --query "<chat name keyword>" --format json
|
|
150
157
|
lark-cli im +chat-messages-list --as bot --chat-id <chat_id> --page-size 50 --format json
|
|
151
158
|
```
|
|
152
|
-
|
|
159
|
+
If the request is keyword search across message content, `im +messages-search --as bot` is also supported. Continue with `--page-token` if `has_more=true`.
|
|
153
160
|
|
|
154
161
|
## References
|
|
155
162
|
|
|
@@ -33,6 +33,9 @@ lark-cli im +chat-search --query "project" --page-size 10
|
|
|
33
33
|
# Pagination
|
|
34
34
|
lark-cli im +chat-search --query "project" --page-token "xxx"
|
|
35
35
|
|
|
36
|
+
# Fetch multiple pages automatically, up to 10 pages by default
|
|
37
|
+
lark-cli im +chat-search --query "project" --page-all
|
|
38
|
+
|
|
36
39
|
# JSON output
|
|
37
40
|
lark-cli im +chat-search --query "project" --format json
|
|
38
41
|
|
|
@@ -52,13 +55,17 @@ lark-cli im +chat-search --query "project" --dry-run
|
|
|
52
55
|
| `--disable-search-by-user` | No | - | Disable member-name-based matching and search by group name only |
|
|
53
56
|
| `--sort <field>` | No | `create_time`, `update_time`, `member_count` | Sort field (always descending) |
|
|
54
57
|
| `--page-size <n>` | No | 1-100, default 20 | Number of results per page |
|
|
55
|
-
| `--page-token <token>` | No | - |
|
|
58
|
+
| `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
|
|
59
|
+
| `--page-all` | No | - | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
|
|
60
|
+
| `--page-limit <n>` | No | 1-1000, default 10 | Maximum pages fetched by `--page-all` |
|
|
56
61
|
| `--exclude-muted` | No | User identity only | Drop chats the current user has muted (do-not-disturb). Under `--as bot`, the flag is silently inactive (mute is a per-user setting); see "Filtering muted chats" below |
|
|
57
62
|
| `--format json` | No | - | Output as JSON |
|
|
58
63
|
| `--dry-run` | No | - | Preview the request without executing it |
|
|
59
64
|
|
|
60
65
|
> **Note:** Supports both `--as user` (default) and `--as bot`. When using bot identity, the app must have bot capability enabled.
|
|
61
66
|
|
|
67
|
+
With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
|
|
68
|
+
|
|
62
69
|
> **CAUTION:** `--sort` is **always descending** — the search API only ranks the chosen field high-to-low (e.g. `member_count` = most members first). There is no ascending option. If the user asks for "fewest first / ascending / 从少到多", tell them the search API does not support ascending order; any low-to-high view requires re-sorting the fetched page client-side and is not an upstream sort. Do **not** invent values like `member_count_asc` or pass `asc` (they are rejected).
|
|
63
70
|
|
|
64
71
|
## Output Fields
|
|
@@ -121,7 +128,7 @@ lark-cli im +messages-send --chat-id "$CHAT_ID" --text "Today's progress update"
|
|
|
121
128
|
|---------|---------|---------|
|
|
122
129
|
| `--query and --member-ids cannot both be empty` | Both were omitted | Provide at least `--query` or `--member-ids` |
|
|
123
130
|
| Empty results | No visible chats matched the keyword or filters | Relax the keyword or filters and try again |
|
|
124
|
-
|
|
|
131
|
+
| `invalid --page-size 101: must be between 1 and 100` | page-size is out of range | Use an integer between 1 and 100 |
|
|
125
132
|
| Permission denied (99991672) | The bot app does not have `im:chat:read` TAT permission enabled | Enable the permission for the app in the Open Platform console |
|
|
126
133
|
| Permission denied (99991679) with `--as user` | UAT is not authorized for `im:chat:read` | Run `lark-cli auth login --scope "im:chat:read"` |
|
|
127
134
|
| `Bot ability is not activated` (232025) | The app does not have bot capability enabled | Enable bot capability in the Open Platform console |
|
|
@@ -34,13 +34,13 @@ lark-cli im +feed-group-list-item --as user --feed-group-id ofg_xxx \
|
|
|
34
34
|
|---|---|---|
|
|
35
35
|
| `--feed-group-id` | Yes | Feed group ID (`ofg_xxx`); path parameter |
|
|
36
36
|
| `--page-size` | No | Records per page, 1–50 (default 50) |
|
|
37
|
-
| `--page-token` | No |
|
|
37
|
+
| `--page-token` | No | Starting cursor, normally returned by a previous response |
|
|
38
38
|
| `--page-all` | No | Auto-paginate and merge all pages |
|
|
39
39
|
| `--page-limit` | No | Max pages when `--page-all` is set, 1–1000 (default 20) |
|
|
40
40
|
| `--start-time` | No | Update-time window start (Unix milliseconds as a decimal string) |
|
|
41
41
|
| `--end-time` | No | Update-time window end (Unix milliseconds as a decimal string) |
|
|
42
42
|
|
|
43
|
-
When `--page-token`
|
|
43
|
+
When `--page-token` and `--page-all` are supplied together, automatic pagination starts at that cursor and continues until exhaustion or `--page-limit`.
|
|
44
44
|
|
|
45
45
|
## Output
|
|
46
46
|
|
|
@@ -31,13 +31,13 @@ lark-cli im +feed-group-list --as user --page-all \
|
|
|
31
31
|
| Flag | Required | Description |
|
|
32
32
|
|---|---|---|
|
|
33
33
|
| `--page-size` | No | Records per page, 1–50 (default 50). Caps the combined `groups` + `deleted_groups` count, so a page may hold fewer live groups than the size suggests |
|
|
34
|
-
| `--page-token` | No |
|
|
34
|
+
| `--page-token` | No | Starting cursor, normally returned by a previous response |
|
|
35
35
|
| `--page-all` | No | Auto-paginate and merge all pages (both lists) |
|
|
36
36
|
| `--page-limit` | No | Max pages when `--page-all` is set, 1–1000 (default 20) |
|
|
37
37
|
| `--start-time` | No | Update-time window start (Unix milliseconds as a decimal string) |
|
|
38
38
|
| `--end-time` | No | Update-time window end (Unix milliseconds as a decimal string) |
|
|
39
39
|
|
|
40
|
-
When `--page-token`
|
|
40
|
+
When `--page-token` and `--page-all` are supplied together, automatic pagination starts at that cursor and continues until exhaustion or `--page-limit`.
|
|
41
41
|
|
|
42
42
|
## Output
|
|
43
43
|
|
|
@@ -10,7 +10,7 @@ Lists **one page** of the **current user's** feed shortcuts.
|
|
|
10
10
|
|
|
11
11
|
- Only **CHAT-type** shortcuts are exposed via OpenAPI today (others in the IDL are not yet whitelisted).
|
|
12
12
|
- The shortcut is a **thin one-page wrapper** — there is no built-in auto-pagination. Callers drive their own loop when they actually need to paginate.
|
|
13
|
-
- Server-side page size is controlled by the service; in normal use one page usually covers the list.
|
|
13
|
+
- Server-side page size is controlled by the service, so this command has no `--page-size` flag; in normal use one page usually covers the list.
|
|
14
14
|
- Pagination tokens are opaque. If a token is rejected because the shortcut list changed, restart by omitting `--page-token`.
|
|
15
15
|
|
|
16
16
|
## Commands
|
|
@@ -8,7 +8,7 @@ This skill maps to shortcut: `lark-cli im +flag-list`. Underlying API: `GET /ope
|
|
|
8
8
|
|
|
9
9
|
The API returns data sorted by `update_time` in **ascending order**, meaning **oldest first, newest last**. When `has_more=true`, continue pagination until `has_more=false`; only then is the last item in the merged result authoritative as the newest flag. If pagination stops while `has_more=true`, the last item is only the newest observed flag.
|
|
10
10
|
|
|
11
|
-
`--page-all` enables automatic pagination but is still capped by `--page-limit`. The default cap is 20 pages; **20 is not the hard maximum**. Set `--page-limit` between 1 and 1000 when a larger scan is required. A response with `has_more=true` is incomplete, even when `flag_items` is empty; increase the limit or resume from the returned `page_token` before reporting an authoritative latest item or count.
|
|
11
|
+
`--page-all` enables automatic pagination but is still capped by `--page-limit`. When `--page-token` is also supplied, it sets the starting cursor and pagination continues from there. The default cap is 20 pages; **20 is not the hard maximum**. Set `--page-limit` between 1 and 1000 when a larger scan is required. A response with `has_more=true` is incomplete, even when `flag_items` is empty; increase the limit or resume from the returned `page_token` before reporting an authoritative latest item or count.
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
@@ -40,7 +40,7 @@ lark-cli im +flag-list --as user --page-all --page-limit 1000
|
|
|
40
40
|
| Parameter | Default | Description |
|
|
41
41
|
|------|------|------|
|
|
42
42
|
| `--page-size <n>` | 50 | Range 1-50 (server max is 50) |
|
|
43
|
-
| `--page-token <token>` | empty |
|
|
43
|
+
| `--page-token <token>` | empty | Starting cursor from a previous response; an empty cursor still selects the first page |
|
|
44
44
|
| `--page-all` | false | Auto-paginate and merge results, capped by `--page-limit` |
|
|
45
45
|
| `--page-limit <n>` | 20 | Max pages in `--page-all` mode; configurable range 1-1000 (20 is only the default) |
|
|
46
46
|
| `--enrich-feed-thread` | true | Auto-enrich feed-layer thread entries with message content (calls `im.messages.mget`) |
|
|
@@ -36,7 +36,7 @@ Use `--download-resources` when you want the binaries on disk in one pass; other
|
|
|
36
36
|
|
|
37
37
|
## Scope requirement
|
|
38
38
|
|
|
39
|
-
The default enrichment requires `im:message.reactions:read`, already declared in each shortcut's `UserScopes` / `BotScopes` (or `Scopes` for the
|
|
39
|
+
The default enrichment requires `im:message.reactions:read`, already declared in each shortcut's `UserScopes` / `BotScopes` (or `Scopes` for the search command), so the framework's pre-flight check surfaces a `missing_scope` error before the request is sent. Bots that were registered before this scope was added need an incremental authorization in the Feishu developer console; users can run:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
lark-cli auth login --scope "im:message.reactions:read"
|
|
@@ -6,8 +6,6 @@ Search Feishu messages across conversations. This shortcut automatically perform
|
|
|
6
6
|
|
|
7
7
|
By default each result message also carries a `reactions` block (counts + details from `im.reactions.batch_query`) when the server has reactions for it, and `update_time` for messages that were actually edited. With `--page-all`, every page is enriched; pass `--no-reactions` to skip the extra round-trip. See [message enrichment](lark-im-message-enrichment.md) for the full contract.
|
|
8
8
|
|
|
9
|
-
> **User identity only** (`--as user`). Bot identity is not supported.
|
|
10
|
-
|
|
11
9
|
This skill maps to the shortcut: `lark-cli im +messages-search` (internally calls `POST /open-apis/im/v1/messages/search` + batched `GET /open-apis/im/v1/messages/mget`, then batch-fetches chat context).
|
|
12
10
|
|
|
13
11
|
## Commands
|
|
@@ -80,11 +78,11 @@ lark-cli im +messages-search --query "test" --dry-run
|
|
|
80
78
|
| `--start <time>` | No | Start time with local timezone offset required (e.g. `2026-03-24T00:00:00+08:00`) |
|
|
81
79
|
| `--end <time>` | No | End time with local timezone offset required (e.g. `2026-03-25T23:59:59+08:00`) |
|
|
82
80
|
| `--page-size <n>` | No | Page size (default 20, range 1-50) |
|
|
83
|
-
| `--page-token <token>` | No |
|
|
81
|
+
| `--page-token <token>` | No | Starting cursor, normally returned by a previous response |
|
|
84
82
|
| `--page-all` | No | Automatically paginate through all result pages (up to 40 pages) |
|
|
85
83
|
| `--page-limit <n>` | No | Max pages to fetch when auto-pagination is enabled (default 20, max 40). Setting it explicitly also enables auto-pagination |
|
|
86
84
|
| `--format <fmt>` | No | Output format: `json` (default) / `pretty` / `table` / `ndjson` / `csv` |
|
|
87
|
-
| `--as <identity>` | No | Identity type
|
|
85
|
+
| `--as <identity>` | No | Identity type: `user` or `bot` |
|
|
88
86
|
| `--dry-run` | No | Print the request only, do not execute it |
|
|
89
87
|
|
|
90
88
|
## Core Constraints
|
|
@@ -135,6 +133,7 @@ Each message in JSON output contains:
|
|
|
135
133
|
- Default behavior is still **single-page**.
|
|
136
134
|
- `--page-token` is the manual continuation mechanism when you already have a token from a previous response.
|
|
137
135
|
- `--page-all` enables auto-pagination and uses a default cap of **40 pages**.
|
|
136
|
+
- With both flags, auto-pagination starts at `--page-token` and continues from that cursor.
|
|
138
137
|
- `--page-limit <n>` enables auto-pagination with an explicit cap. If you pass `--page-limit` without `--page-all`, auto-pagination is still enabled.
|
|
139
138
|
- When auto-pagination stops because of the configured page cap, the response still includes the last `has_more` / `page_token` so you can continue manually.
|
|
140
139
|
|
|
@@ -162,7 +161,7 @@ Use `im +messages-resources-download` if you need to fetch the underlying image
|
|
|
162
161
|
|
|
163
162
|
Use `--query` only for real message keywords. If the user asks for activity review such as "最近一周我和哪些 Bot 有过交互" or "整理我和某人的聊天记录", and the useful constraints are sender type, chat, person, or time range, keep `--query ""` and rely on those filters. Do not put generic instruction words such as "看看", "总结", "交互内容", or "聊天记录" into `--query`; those words often over-constrain message search and hide the relevant messages.
|
|
164
163
|
|
|
165
|
-
This guidance applies
|
|
164
|
+
This guidance applies to both user and bot identity. If the user explicitly asks for application/bot identity, run `im +messages-search --as bot`; for named-group history/listing intents where search is not needed, resolving the group with `im +chat-search --as bot` and listing messages with `im +chat-messages-list --as bot --chat-id <chat_id>` is still a good narrower path.
|
|
166
165
|
|
|
167
166
|
```bash
|
|
168
167
|
# Review recent bot interactions without forcing a keyword
|
|
@@ -23,6 +23,9 @@ lark-cli im +threads-messages-list --thread omt_xxx --page-size 20
|
|
|
23
23
|
# Pagination
|
|
24
24
|
lark-cli im +threads-messages-list --thread omt_xxx --page-token <PAGE_TOKEN>
|
|
25
25
|
|
|
26
|
+
# Fetch multiple pages automatically, up to 10 pages by default
|
|
27
|
+
lark-cli im +threads-messages-list --thread omt_xxx --page-all
|
|
28
|
+
|
|
26
29
|
# Output format options
|
|
27
30
|
lark-cli im +threads-messages-list --thread omt_xxx --format pretty
|
|
28
31
|
lark-cli im +threads-messages-list --thread omt_xxx --format table
|
|
@@ -43,8 +46,10 @@ lark-cli im +threads-messages-list --thread omt_xxx --dry-run
|
|
|
43
46
|
| `--no-reactions` | No | Skip auto-fetching the `reactions` block |
|
|
44
47
|
| `--download-resources` | No | Download message resources (image/file/audio/video/media + post-embedded, excluding stickers) into `./lark-im-resources/` and attach a `resources` block. Off by default |
|
|
45
48
|
| `--order <order>` | No | Sort order: `asc` (default) / `desc` |
|
|
46
|
-
| `--page-size <n>` | No | Number of items per page (default 50, range 1-
|
|
47
|
-
| `--page-token <token>` | No |
|
|
49
|
+
| `--page-size <n>` | No | Number of items per page (default 50, range 1-50) |
|
|
50
|
+
| `--page-token <token>` | No | Starting cursor, normally returned by a previous response |
|
|
51
|
+
| `--page-all` | No | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
|
|
52
|
+
| `--page-limit <n>` | No | Maximum pages fetched by `--page-all` (default 10, range 1-1000) |
|
|
48
53
|
| `--format <fmt>` | No | Output format: `json` (default) / `pretty` / `table` / `ndjson` / `csv` |
|
|
49
54
|
| `--as <identity>` | No | Identity type: `user` (default) / `bot` |
|
|
50
55
|
| `--dry-run` | No | Print the request only, do not execute it |
|
|
@@ -61,8 +66,7 @@ Thread messages do not support `start_time` / `end_time` filtering because of Fe
|
|
|
61
66
|
|
|
62
67
|
### 3. Pagination (`has_more` / `page_token`)
|
|
63
68
|
|
|
64
|
-
-
|
|
65
|
-
- If you need the complete thread, keep paginating; if you only need an overview, the first page is often enough
|
|
69
|
+
Default is one page. With `--page-all`, `--page-token` sets the starting cursor; if `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
|
|
66
70
|
|
|
67
71
|
### 4. Recommended expansion strategy
|
|
68
72
|
|
|
@@ -13,6 +13,8 @@ lark-cli mail +triage
|
|
|
13
13
|
|
|
14
14
|
# 查看收件箱未读
|
|
15
15
|
lark-cli mail +triage --filter '{"folder":"inbox","is_unread":true}'
|
|
16
|
+
lark-cli mail +triage --folder INBOX --is-unread
|
|
17
|
+
lark-cli mail +triage --filter is_unread
|
|
16
18
|
|
|
17
19
|
# 全文搜索
|
|
18
20
|
lark-cli mail +triage --query "合同审批"
|
|
@@ -25,6 +27,8 @@ lark-cli mail +triage --query "项目评审" --filter '{"time_range":{"start_tim
|
|
|
25
27
|
|
|
26
28
|
# 指定文件夹
|
|
27
29
|
lark-cli mail +triage --filter '{"folder":"sent"}'
|
|
30
|
+
lark-cli mail +triage --filter folder=sent
|
|
31
|
+
lark-cli mail +triage --folder sent
|
|
28
32
|
|
|
29
33
|
# 系统标签(可通过 folder 或 label 传入,搜索时自动转为 folder)
|
|
30
34
|
lark-cli mail +triage --filter '{"folder":"flagged"}'
|
|
@@ -47,17 +51,28 @@ lark-cli mail +triage --page-size 10
|
|
|
47
51
|
|
|
48
52
|
| 参数 | 默认 | 说明 |
|
|
49
53
|
|------|------|------|
|
|
50
|
-
| `--filter <
|
|
54
|
+
| `--filter <filter>` | — | 筛选条件(见下方字段说明) |
|
|
55
|
+
| `--folder <name-or-id>` | — | 文件夹名称或系统文件夹 ID 筛选;等价于设置 `filter.folder` |
|
|
56
|
+
| `--folder-id <id>` | — | 明确的文件夹 ID 筛选;等价于设置 `filter.folder_id` |
|
|
57
|
+
| `--is-unread` | — | 只看未读;等价于设置 `filter.is_unread=true` |
|
|
51
58
|
| `--query <text>` | — | 全文搜索关键词 |
|
|
52
59
|
| `--format <mode>` | `table` | `table` / `json` / `data`(`json` 和 `data` 均输出含分页信息的对象) |
|
|
53
60
|
| `--max <n>` | `20` | 最大返回条数(1-400),内部自动分页拉取 |
|
|
54
|
-
| `--page-size <n>` | — | `--max`
|
|
61
|
+
| `--page-size <n>` | — | `--max` 的别名;重复指定时后出现的值生效 |
|
|
55
62
|
| `--page-token <token>` | — | 上一次响应返回的分页令牌,传入后从该位置继续拉取。令牌带 `search:` 或 `list:` 前缀,标识来源路径,不可混用 |
|
|
56
63
|
| `--labels` | — | table 格式时额外显示 labels 列 |
|
|
57
64
|
| `--mailbox <id>` | `me` | 邮箱地址 |
|
|
58
65
|
|
|
59
66
|
### `--filter` 支持的字段
|
|
60
67
|
|
|
68
|
+
`--filter` 有三种写法:
|
|
69
|
+
|
|
70
|
+
- JSON 对象:`--filter '{"folder":"INBOX","is_unread":true}'`,用于组合多个字段或传数组/对象字段
|
|
71
|
+
- 单个 `key=value`:`--filter folder=INBOX`、`--filter is_unread=true`
|
|
72
|
+
- 裸未读快捷写法:`--filter is_unread`
|
|
73
|
+
|
|
74
|
+
多个筛选条件请使用 JSON 对象,`folder=INBOX,is_unread=true` 这种逗号拼接的 key=value 不支持。
|
|
75
|
+
|
|
61
76
|
| 字段 | 类型 | 说明 |
|
|
62
77
|
|------|------|------|
|
|
63
78
|
| `folder` | string | 文件夹名称筛选。系统文件夹固定值:`inbox`/`sent`/`draft`/`trash`/`spam`/`archive`/`priority`/`flagged`/`other`/`scheduled`,也支持自定义文件夹名称。子文件夹需用 `parent_name/child_name` 格式,可通过 folder list 接口查看 |
|
|
@@ -73,7 +88,7 @@ lark-cli mail +triage --page-size 10
|
|
|
73
88
|
|
|
74
89
|
> **系统标签说明**:`IMPORTANT`/`FLAGGED`/`OTHER` 可通过 `folder` 或 `label` 传入(也支持中文别名 `重要邮件`/`已加旗标`/`其他邮件`、搜索名 `priority`/`flagged`/`other`)。搜索时自动转为 folder 字段,列表时自动转为 label_id。label list 接口不返回这三个系统标签。
|
|
75
90
|
>
|
|
76
|
-
> **⚠️
|
|
91
|
+
> **⚠️ 注意**:查询未读可用 `--is-unread`、`--filter is_unread`、`--filter is_unread=true` 或 JSON 写法 `"is_unread":true`。
|
|
77
92
|
可运行 `mail +triage --print-filter-schema` 查看完整字段说明。
|
|
78
93
|
|
|
79
94
|
## 输出
|
|
@@ -108,7 +123,7 @@ lark-cli mail +triage --page-size 10
|
|
|
108
123
|
|
|
109
124
|
### `table` 格式
|
|
110
125
|
|
|
111
|
-
`page_token` 信息输出在 stderr,自动携带 `--query`/`--filter`/`--mailbox` 参数方便续页:
|
|
126
|
+
`page_token` 信息输出在 stderr,自动携带 `--query`/`--filter`/`--folder`/`--folder-id`/`--is-unread`/`--mailbox` 参数方便续页:
|
|
112
127
|
```text
|
|
113
128
|
15 message(s)
|
|
114
129
|
next page: mail +triage --query '合同审批' --page-token 'search:abc123...'
|
|
@@ -26,7 +26,7 @@ metadata:
|
|
|
26
26
|
|
|
27
27
|
| Shortcut | 说明 |
|
|
28
28
|
|----------|------|
|
|
29
|
-
| [`+search`](references/lark-minutes-search.md) |
|
|
29
|
+
| [`+search`](references/lark-minutes-search.md) | 按关键词、所有者、参与者、时间范围搜索妙记;支持 user/bot 身份 |
|
|
30
30
|
| [`+detail`](references/lark-minutes-detail.md) | 查询妙记详情(标题和关联的纪要note_id),按需获取 AI 产物(总结、待办、章节、逐字稿、关键词) |
|
|
31
31
|
| [`+download`](references/lark-minutes-download.md) | 下载妙记音视频媒体文件 |
|
|
32
32
|
| [`+upload`](references/lark-minutes-upload.md) | 上传 file_token 生成妙记 |
|