- 移除 TodoItem 中的 priority、created_at 和 updated_at 字段 - 强制每个任务都必须有唯一 id,且由用户负责生成 - 修改合并模式逻辑,merge=true 下保留未提及的旧任务 - 支持已完成和已取消任务重新激活(状态改回 pending 或 in_progress) - 禁止 in_progress 状态退回到 pending,必须标记为 completed 或 cancelled - 优化状态转换校验,允许特定状态间合法切换 - 简化任务变更消息,移除详细的新增/更新/移除统计 - 更新文档和示例,明确 id 必须由用户生成和使用 - 修复和补充测试,增强状态转换和合并模式验证 - 调整任务时间戳生成逻辑,统一使用当前时间及索引 - 该变更提供更合理的任务状态机械及管理模式,提升稳定性和易用性
87 lines
2.7 KiB
Markdown
87 lines
2.7 KiB
Markdown
# task +subscribe-event
|
|
|
|
> **Prerequisites:** Please read `../lark-shared/SKILL.md` to understand authentication, global parameters, and security rules.
|
|
>
|
|
> **⚠️ Note:** This API supports both `user` and `bot` identities. Use `user` to subscribe the current user's accessible tasks; use `bot` to subscribe tasks the **application is responsible for**.
|
|
|
|
Subscribe task update events with the current identity.
|
|
|
|
This shortcut is different from `event +subscribe`:
|
|
- `task +subscribe-event` registers task-event access for the **current identity**
|
|
- with `--as user`, it subscribes the **current user** to task events for tasks they created, are responsible for, or follow
|
|
- with `--as bot`, it subscribes using the **application identity** for tasks the application is responsible for
|
|
|
|
The task event type is:
|
|
|
|
```text
|
|
task.task.update_user_access_v2
|
|
```
|
|
|
|
Within this event, task changes are represented by commit types (string values). Deduped list:
|
|
|
|
```text
|
|
task_assignees_update
|
|
task_completed_update
|
|
task_create
|
|
task_deleted
|
|
task_desc_update
|
|
task_followers_update
|
|
task_reminders_update
|
|
task_start_due_update
|
|
task_summary_update
|
|
```
|
|
|
|
Event payload shape (example):
|
|
|
|
```json
|
|
{
|
|
"event_id": "evt_xxx",
|
|
"event_types": ["task_summary_update"],
|
|
"task_guid": "task_guid_xxx",
|
|
"timestamp": "1775793266152",
|
|
"type": "task.task.update_user_access_v2"
|
|
}
|
|
```
|
|
|
|
- `type`: event type, should be `task.task.update_user_access_v2`
|
|
- `event_id`: unique event id (useful for dedup)
|
|
- `event_types`: list of commit types (see the deduped list above)
|
|
- `task_guid`: the task GUID that changed
|
|
- `timestamp`: event timestamp (ms)
|
|
|
|
In practice, this means:
|
|
- with `--as user`, the subscribed user can receive updates for tasks visible to them through authorship, assignment, or following
|
|
- with `--as bot`, the subscription covers tasks the application is responsible for
|
|
|
|
To actually receive the subscribed events, use the standard event WebSocket receiver:
|
|
|
|
```bash
|
|
lark-cli event +subscribe --event-types task.task.update_user_access_v2 --compact --quiet
|
|
```
|
|
|
|
The full flow is:
|
|
1. Register the subscription with `lark-cli task +subscribe-event [--as user|bot]`
|
|
2. Receive those events with `lark-cli event +subscribe --event-types task.task.update_user_access_v2 ...`
|
|
|
|
## Recommended Commands
|
|
|
|
```bash
|
|
lark-cli task +subscribe-event
|
|
```
|
|
# Subscribe with app identity
|
|
lark-cli task +subscribe-event --as bot
|
|
|
|
|
|
## Parameters
|
|
|
|
This shortcut has no additional parameters.
|
|
|
|
## Workflow
|
|
|
|
1. Confirm whether the user wants to subscribe with `user` identity or `bot` identity.
|
|
2. Execute `lark-cli task +subscribe-event`
|
|
3. Report whether the subscription succeeded, and clarify which identity the subscription applies to.
|
|
|
|
> [!CAUTION]
|
|
> This is a **Write Operation** -- You must confirm the user's intent before executing.
|