2521690 2c7714268f feat: 补强 demo 后端任务指标与 edge-agent 执行骨架
- 新增 task_report 任务级聚合指标 task_metrics
- 补充创建任务幂等与失败路径/冲突测试
- 将后端测试基线提升到 20 passed
- 新增 edge-agent 初始化代码、启动脚本与打包脚本
- 新增 http_health_check、check_port、check_process、grep_log 执行器
- 补充 edge-agent 基础测试并提升基线到 10 passed
- 同步更新 backend README 与当前进度总结
2026-04-09 10:51:19 +08:00

69 lines
1.3 KiB
Markdown

# Smart Deploy Agent Demo Edge Agent
## Setup
```bash
python -m venv .venv
.venv\Scripts\python -m pip install -e edge-agent
```
## Run Once
```bash
set PYTHONPATH=edge-agent
.venv\Scripts\python -m app.main --once
```
## Run Loop
```bash
set PYTHONPATH=edge-agent
.venv\Scripts\python -m app.main
```
## Test
```bash
set PYTHONPATH=edge-agent
C:\Users\MH\AppData\Local\Programs\Python\Python311\python.exe -m pytest edge-agent/tests -q -p no:cacheprovider
```
## Default Runtime Notes
1. default backend url: `http://127.0.0.1:8000`
2. default edge id: `edge-shanghai-001`
3. current registered tools:
`http_health_check`
`check_port`
`check_process`
`grep_log`
4. current bootstrap implements:
heartbeat
pull task
execute registered tools
report result
report event
## Package Scripts
Current repo includes:
1. `scripts/start-windows.ps1`
2. `scripts/start-linux.sh`
3. `scripts/package-windows.ps1`
4. `scripts/package-linux.sh`
These scripts currently prepare a portable package skeleton and startup entrypoints.
They do not yet bundle a private Python runtime.
## Packaging Direction
For user-side delivery, this edge agent is intended to be bundled as:
1. Windows: `zip` portable package
2. Linux: `tar.gz` self-contained runtime directory
## Current Verification Baseline
Current edge-agent baseline: `10 passed`