ClawSkills logoClawSkills

Task Status

在聊天中发送针对长时间运行任务的简短状态描述。需要在多步骤操作期间提供定期更新、确认任务完成时使用

介绍

# Task Status Skill

## 快速开始

### 手动状态更新 ```bash python scripts/send_status.py "Starting data fetch..." "progress" "step1" python scripts/send_status.py "Processing complete" "success" "final" python scripts/send_status.py "Error: Missing API key" "error" "auth" ```

### 自动定期监控(每 5 秒) ```bash # Start monitoring a long-running task python scripts/monitor_task.py start "My Long Task" "processing"

# Monitor will send "Still working..." updates every 5 seconds # When task completes, report final status python scripts/monitor_task.py stop "My Long Task" "success" "Completed successfully!" ```

## 状态类型

- **progress**:正在进行的工作(显示 🔄 或 ->) - **success**:任务完成(显示 ✅ 或 OK) - **error**:任务失败(显示 ❌ 或 !) - **warning**:存在问题但继续执行(显示 ⚠️ 或 ?)

## 定期监控

`monitor_task.py` 脚本提供自动更新功能:

### 启动监控器 ```bash python scripts/monitor_task.py start "<task_name>" "<status_type>" [--interval <seconds>] ```

- 每 5 秒自动发送“Still working...”更新 - 在后台运行,直到被停止 - 可以自定义不同的时间间隔

### 停止监控器 ```bash python scripts/monitor_task.py stop "<task_name>" "<final_status>" "<final_message>" ```

### 示例:长文件处理 ```bash # Start monitoring python scripts/monitor_task.py start "video_processing" "progress"

# ... long processing happens here ...

# Stop with final status python scripts/monitor_task.py stop "video_processing" "success" "Processing complete!" ```

## 手动更新(快速状态)

用于无需监控的单次状态更新:

```bash python scripts/send_status.py "Still fetching data..." "progress" "fetch" python scripts/send_status.py "Processing records: 250/1000" "progress" "process" python scripts/send_status.py "Complete! 3 files ready" "success" "final" python scripts/send_status.py "Error: Connection timeout" "error" "api" ```

## 何时使用每种方法

### 使用手动更新,当: - 任务时间较短(30 秒以内) - 您希望控制何时发送更新 - 任务具有离散且有意义的里程碑

### 使用定期监控,当: - 任务运行时间较长(超过 1 分钟) - 您希望每 5 秒都有一致的“心跳”更新 - 任务有较长的静默工作期 - 您希望让用户确信工作正在进行中

## 消息指南

保持状态消息在 140 个字符以内。例如:

- **Progress**:“Still fetching data...”或“Processing records: 250/1000” - **Success**:“Complete! 3 files ready”或“Task finished successfully” - **Error**:“Error: Connection timeout”或“Failed: Missing API key” - **Warning**:“Continuing despite timeout”或“Partial success: 5/10 files”

## 高级用法

### 包含额外详情 ```bash python scripts/send_status.py "Uploading..." "progress" "upload" --details "File: report.pdf (2.4MB)" ```

### 不同的时间间隔 ```bash python scripts/monitor_task.py start "data_sync" "progress" --interval 10 ```

### 导入以在 Python 脚本中使用 ```python from send_status import send_status

def long_task(): send_status("Starting...", "progress", "step1") # ... work send_status("Step complete", "success", "step1") ```

## 使用 Clawdbot Cron 进行自动化

对于定时任务,请使用 Clawdbot 的 cron 功能:

```python # In a script or session from cron import add

# Every 5 seconds, check status job = { "text": "Check status update", "interval": "5s", "enabled": True } add(job) ```

这即使您没有主动监控也能发送状态更新。

## 安装

要使用此技能,请将 `task-status` 文件夹复制到您的 Clawdbot 技能目录中:

``` C:\Users\Luffy\AppData\Roaming\npm\node_modules\clawdbot\skills\task-status ```

或者将其添加到您的工作区,并在 `AGENTS.md` 或 `TOOLS.md` 中引用它。

安装完成后,任何需要定期状态更新的任务都可以使用该技能。

更多产品