示例可无限期把聊天和审批事件写入未加保护的本地文件
原文依据:5 处示例把多个消费者放到后台并重定向到 `.ndjson` 文件,却没有设置事件数或超时;文档同时说明默认运行无限制。消息内容会被转换成人类可读文本,审批输出包含状态、用户标识和审批/任务标识。
只要事件持续到达,文件就会不断增长,可能占满磁盘,并在本地长期保留聊天内容和业务审批元数据。文件权限、加密、轮转和删除均未在这些指令中指定。
文档中的活动示例确实把聊天与审批流重定向到相对路径的 NDJSON 文件,并在这些示例中未设置事件数或超时;默认值意味着消费者可持续运行和积累事件数据。内容可能包括可读消息、用户标识、审批及任务标识和状态。源码没有说明文件权限,因此“未加保护”本身无法确认,但长期明文落盘造成的隐私、磁盘占用和留存风险成立。用户可要求限定时长/数量、指定受限目录并确认文件权限与清理策略。
| `--jq <expr>` | jq expression to filter / transform each event; empty output skips the event || `--max-events N` | Exit after N events. Default 0 = unlimited || `--timeout D` | Exit after duration D (e.g. `30s`, `2m`). Default 0 = no timeout. Whichever of `--max-events` / `--timeout` fires first wins || `--output-dir <dir>` | Write each event as a file (relative paths only; prevents traversal) || `--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 || `--as user\|bot\|auto` | Identity for the session (see lark-shared) |查看另外 4 个位置
# Consume multiple EventKeys concurrently (one shape per process, no dispatcher)lark-cli event consume im.message.receive_v1 --as bot > receive.ndjson &lark-cli event consume im.message.reaction.created_v1 --as bot > reaction.ndjson &wait**`.content` shape depends on `message_type`** (this key uses a flat Custom schema; see [`events/im/message_receive.go`](../../../events/im/message_receive.go)):| message_type | `.content` shape | How to read ||---|---|---|| `text` / `post` / `image` / `file` / `audio` / `sticker` / `share_chat` / `share_user` / `media` / `system` | Human-readable text (convertlib-processed; `@mentions` resolved to display names) | Use `.content` directly || `interactive` (card) | Raw card JSON string (structured actions can't be losslessly flattened) | `.content \| fromjson` to get the card object ||---|---|---|| `approval_code` | string | Approval definition code; not a subscription dimension || `instance_code` | string | Approval instance code || `task_id` | string | Approval task id || `external_id` | string | Third-party approval external id, when present || `task_external_id` | string | Third-party task external id, when emitted || `assigned_user` | object | Task assignee or operator user IDs, omitted for automatic flows without an operator || `assigned_user.open_id` | string (open_id) | Task assignee or operator open_id, when present || `assigned_user.union_id` | string (union_id) | Task assignee or operator union_id, when present || `assigned_user.user_id` | string (user_id) | Task assignee or operator tenant user_id, when present || `status` | string enum | `REVERTED`, `PENDING`, `APPROVED`, `REJECTED`, `TRANSFERRED`, `ROLLBACK`, `DONE`, `OVERTIME_CLOSE`, `OVERTIME_RECOVER` || `operate_time` | string (timestamp_ms) | Status change time |# Broad approval status listening:# run both EventKeys as separate processes; omit subscription_type so each registers both relations.lark-cli event consume approval.instance.status_changed_v4 \ --as user > approval-instance.ndjson &lark-cli event consume approval.task.status_changed_v4 \ --as user > approval-task.ndjson &wait