feat(host-agent): make execution history authoritative
Tests / Test failed: 2, passed: 830

This commit is contained in:
2026-07-15 11:46:27 +08:00
parent ccde30e378
commit 77d4813bb2
46 changed files with 890 additions and 3132 deletions
+20 -17
View File
@@ -37,14 +37,14 @@ uv run --package device-host-agent device-host-agent
```
At startup, the Host Agent loads device registrations from
`tasks/device_config.sqlite3`, the same `DeviceConfigStore` used by the local
Runtime console API. Register or update devices before starting the Host Agent,
then restart it to reload changes. In Compose,
`tasks/device_config.sqlite3`. Register or update devices before starting the
Host Agent, then restart it to reload changes. In Compose,
`HOST_AGENT_TASKS_PATH` selects the host directory mounted at `/app/tasks`; it
defaults to `./tasks`.
The Host Agent only initiates outbound HTTP requests. It does not expose an
inbound port.
The Host Agent only initiates outbound requests to the Cloud Control Plane. It
does expose an authenticated local console on loopback by default; this is not
a Cloud-facing inbound API.
## Direct Edge Enrollment
@@ -96,9 +96,9 @@ image, repository, log, or general backup.
The Host Agent always serves a small local-only web console on the
edge machine: heartbeat/enrollment status, registered local devices, current
assignment progress, local device add/edit/remove, a local account password
change, and recent assignment/heartbeat history. It authenticates with the
same local account created by `device-host-agent setup` above — there is no
separate console credential.
change, assignment/heartbeat history, and complete execution evidence. It
authenticates with the same local account created by `device-host-agent setup`
above; there is no separate console credential.
```text
HOST_AGENT_CONSOLE_BIND_HOST=127.0.0.1
@@ -123,10 +123,10 @@ HOST_AGENT_CONSOLE_HISTORY_LIMIT=200
### Task progress storage and retention
The Host Agent persists step-by-step task execution state (metadata +
timeline screenshots) to local SQLite/files on the edge machine. These
paths are independent from the Runtime's own `tasks/tasks.sqlite3` and
do not collide when both processes run on the same host.
The Host Agent persists step-by-step task execution state (metadata, Timeline
artifacts, screenshots, OCR, and UI-tree results) to local SQLite/files on the
edge machine. Runtime is an in-process library, so there is no second Runtime
database or service to inspect.
```text
HOST_AGENT_TASK_PROGRESS_DB_PATH=host_agent_data/task_progress.sqlite3
@@ -147,12 +147,15 @@ HOST_AGENT_TASK_RETENTION_MAX_AGE_DAYS=7
**Viewing live and historical task progress:**
- **Host Agent console**: Open `http://127.0.0.1:8765/tasks` for the task
list (status, device, timestamps). Click a task ID to see the detail page
with full step-by-step timeline and inlined screenshots.
- **Host Agent console**: Open `http://127.0.0.1:8765/tasks` for the
authoritative list of tasks actually executing on that Host (Cloud task ID,
attempt, status, device, timestamps). Click an execution ID for the full
step-by-step timeline with before/after screenshots, operation details, OCR,
and UI-tree results.
- **Cloud console**: The Cloud Console task detail page shows the latest
coarse-grained progress badge (step index, status, summary) that the Host
Agent piggybacks on each lease renewal.
Agent piggybacks on each lease renewal. For Cloud-proxy hosts it also shows
retained LLM prompt/decision history, but it does not store screenshots.
Treat `HOST_AGENT_CONSOLE_ALLOW_NON_LOOPBACK` as an explicit,
operator-accepted risk: the console has no built-in TLS and no rate
@@ -380,7 +383,7 @@ back to the upstream.
## Runtime AI Planner
The Host Agent reuses the local Runtime planner. Unlike the shared Runtime
The Host Agent reuses the shared Runtime planner. Unlike the shared Runtime
library (whose own default is the deterministic stub planner), the **Host
Agent defaults `AI_PLANNER_ENABLED` to on** -- it is the actual device-control
path, so goal assignments use a model unless an operator explicitly opts out.