emma-hermes/scripts/README.md

101 lines
2.8 KiB
Markdown

# Smoke / helper scripts
This directory includes a few operator-facing smoke runners that exercise real tools instead of mocks.
## ego-browser smoke runners
### Form smoke
```bash
./scripts/ego_browser_form_smoke.sh
# or override the value
./scripts/ego_browser_form_smoke.sh SmokeValue42
```
What it does:
- creates a tiny local form page
- serves it over `http.server`
- opens it with `ego-browser`
- fills the text field
- reads the field value and status text back from the page
Expected output is JSON containing:
- `title: "Hermes Ego Browser Form Smoke"`
- `value`
- `status`
- a local loopback `url`
### Screenshot smoke
```bash
./scripts/ego_browser_screenshot_smoke.sh
```
What it does:
- runs a real `hermes chat` browser task against `https://www.google.com/`
- verifies the run loads the `ego-browser` skill
- verifies it does **not** load the generic `software-development:screenshot` skill
- extracts the screenshot path from verbose output
- OCRs the saved screenshot and confirms expected page text is present
Expected output is JSON containing:
- `title: "Google"`
- `url` beginning with `https://www.google.com/`
- `capture_method: "browser_vision-via-hermes-chat"`
- `screenshot_path`
- `ocr_text`
If you want the script to keep a machine-readable copy of the JSON result for CI or
artifact upload, set:
```bash
EGO_BROWSER_SCREENSHOT_RESULT_JSON=/tmp/ego-browser-screenshot-result.json \
./scripts/ego_browser_screenshot_smoke.sh
```
## Opt-in pytest wrapper
There is an opt-in pytest wrapper at:
```bash
tests/tools/test_ego_browser_smoke_scripts.py
```
Run the form smoke test through pytest with:
```bash
RUN_EGO_BROWSER_SMOKE=1 python -m pytest tests/tools/test_ego_browser_smoke_scripts.py -q
```
That run executes the form smoke and skips the screenshot smoke unless you explicitly opt in:
```bash
RUN_EGO_BROWSER_SMOKE=1 RUN_EGO_BROWSER_SCREENSHOT_SMOKE=1 \
python -m pytest tests/tools/test_ego_browser_smoke_scripts.py -q
```
Why the extra flag?
- the screenshot smoke shells into a full `hermes chat` session
- that path is slower and more environment-sensitive than the direct form smoke
- we keep it opt-in so normal targeted runs stay stable and low-noise
## Manual CI workflow
There is also an opt-in GitHub Actions workflow:
```text
.github/workflows/ego-browser-smoke.yml
```
It is intentionally `workflow_dispatch` only and expects a self-hosted macOS runner
that already has:
- `ego-browser`
- `tesseract`
- Python 3 available for `uv sync`
Use it when you want a real CI-hosted smoke pass without forcing browser-smoke noise
into the default PR lanes. When screenshot smoke is enabled there, the workflow also
uploads the captured screenshot plus the parsed JSON result as an artifact, and writes
the screenshot path / OCR summary into the Actions job summary.