Datasets:
REA computer-use environment, v0.1.0
Browse files- README.md +92 -0
- bundle/README.md +40 -0
- bundle/artifacts/debug-off-check/verify.py +200 -0
- bundle/envs/geany/SKILL.md +10 -0
- bundle/envs/geany/env.toml +4 -0
- bundle/envs/geany/geany_app.py +426 -0
- bundle/envs/geany/seed/.config/geany/filedefs/filetypes.README +2 -0
- bundle/envs/geany/seed/.config/geany/geany.conf +188 -0
- bundle/envs/geany/seed/.config/geany/keybindings.conf +0 -0
- bundle/envs/geany/seed/.config/geany/session.conf +29 -0
- bundle/envs/geany/seed/.config/geany/templates/templates.README +2 -0
- bundle/envs/geany/seed/Documents/shop/settings.py +9 -0
- bundle/evals/geany.toml +1 -0
- bundle/tasks/debug-off.json +9 -0
- bundle/tasks/smoke.json +7 -0
- media/hero.gif +3 -0
- media/solve-1.gif +3 -0
- media/solve-1.mp4 +3 -0
- media/solve-2.gif +3 -0
- media/solve-2.mp4 +3 -0
- media/solve-3.gif +3 -0
- media/solve-3.mp4 +3 -0
- media/witness.gif +3 -0
- media/witness.mp4 +3 -0
- results.json +96 -0
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pretty_name: Geany computer-use environment (REA)
|
| 4 |
+
tags:
|
| 5 |
+
- computer-use
|
| 6 |
+
- cua
|
| 7 |
+
- gui-agent
|
| 8 |
+
- rl-environment
|
| 9 |
+
- agentenv
|
| 10 |
+
- desktop
|
| 11 |
+
- linux
|
| 12 |
+
- rea
|
| 13 |
+
- code-editor
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Geany: a computer-use environment
|
| 17 |
+
|
| 18 |
+

|
| 19 |
+
|
| 20 |
+
**The real Geany 2.0 code editor running on an Ubuntu 24.04 desktop, as an [agentenv](https://pypi.org/project/agentenv-framework/) computer environment. An agent completes the task only through screenshots, mouse and keyboard, and a verifier grades the saved files with no model.**
|
| 21 |
+
|
| 22 |
+
Geany opens a small Python settings file for a corner shop. The agent has to find two settings in the editor, turn debug mode off and move the port from 8000 to 8080, then save. It sees only the screen and acts only with the mouse and keyboard.
|
| 23 |
+
|
| 24 |
+
## Watch
|
| 25 |
+
|
| 26 |
+
- Agent runs (Claude Code with Claude Sonnet 5.5): [run 1](media/solve-1.mp4), [run 2](media/solve-2.mp4), [run 3](media/solve-3.mp4)
|
| 27 |
+
- Scripted witness, which proves the task can be done through the computer: [witness.mp4](media/witness.mp4)
|
| 28 |
+
|
| 29 |
+
Each video is the computer's own screen recording at 10 frames per second.
|
| 30 |
+
|
| 31 |
+
## The task
|
| 32 |
+
|
| 33 |
+
> In the shop's settings.py open in Geany, turn debug mode off and change the port to 8080, then save the file.
|
| 34 |
+
|
| 35 |
+
`bundle/artifacts/debug-off-check/verify.py` reads the app's files through the computer's `data/get` view and passes only if every check holds:
|
| 36 |
+
|
| 37 |
+
| Check | Kind | File |
|
| 38 |
+
| --- | --- | --- |
|
| 39 |
+
| `changed` | `lines_present` | `Documents/shop/settings.py` |
|
| 40 |
+
| `old-gone` | `lines_absent` | `Documents/shop/settings.py` |
|
| 41 |
+
| `rest-kept` | `lines_present` | `Documents/shop/settings.py` |
|
| 42 |
+
|
| 43 |
+
The checks read the saved file line by line: the two new lines are present, the two old ones are gone, and the rest of the file is untouched.
|
| 44 |
+
|
| 45 |
+
## Results
|
| 46 |
+
|
| 47 |
+
3 of 3 runs passed, about $0.63 per run.
|
| 48 |
+
|
| 49 |
+
| Run | Outcome | Turns | Cost | Video |
|
| 50 |
+
| --- | --- | --- | --- | --- |
|
| 51 |
+
| 1 | passed | 9 | $0.88 | [video](media/solve-1.mp4) |
|
| 52 |
+
| 2 | passed | 9 | $0.63 | [video](media/solve-2.mp4) |
|
| 53 |
+
| 3 | passed | 9 | $0.38 | [video](media/solve-3.mp4) |
|
| 54 |
+
|
| 55 |
+
## Run it
|
| 56 |
+
|
| 57 |
+
You need Docker. `agentenv-framework` builds the computer: Ubuntu 24.04 with the app installed from Ubuntu's archive (`geany` 2.0-1build2).
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
pip install agentenv-framework==0.9.1431
|
| 61 |
+
hf download earakely-scale/GeanyComputerEnv-REA --repo-type dataset --local-dir geany
|
| 62 |
+
agent-env run geany/bundle --task debug-off --agent claude-code --model <model>
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
The agent needs a model provider configured for agentenv. `--task smoke` only boots the computer, with no agent. `bundle/README.md` describes the bundle in detail.
|
| 66 |
+
|
| 67 |
+
## How it was made
|
| 68 |
+
|
| 69 |
+
[REA](https://github.com/morluto/rea) built this environment from a real session with the app:
|
| 70 |
+
|
| 71 |
+
1. **Capture.** REA launched Geany on a Linux desktop and recorded its package, windows and opened files while a scripted user made the edit. It also recorded the app's state folders before and after.
|
| 72 |
+
2. **Export.** REA turned the capture into an agentenv `computer_app`. It installs the app, seeds the starting files, starts the app, and waits for its main window. It also serves typed views of the app's files for verifiers.
|
| 73 |
+
3. **Task.** The task's checks were validated against the capture: they fail on the starting state and pass on the captured end state.
|
| 74 |
+
4. **Witness and runs.** Scripted computer actions solved the task in a fresh computer, and the verifier failed before, passed after and failed again after `data/reset`. Then an agent solved it 3 times, each run recorded.
|
| 75 |
+
|
| 76 |
+
## What's inside
|
| 77 |
+
|
| 78 |
+
```
|
| 79 |
+
bundle/ the agentenv bundle: envs/ (app module, seed files), tasks/, artifacts/ (verifier), evals/
|
| 80 |
+
media/ witness and agent-run recordings (MP4) with short GIF previews
|
| 81 |
+
results.json the runs above, with each check's result
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
## Limits
|
| 85 |
+
|
| 86 |
+
- The checks read whole lines, so an equivalent edit written differently (for example `DEBUG=False` without spaces) fails.
|
| 87 |
+
- The computer uses the `geany` version in Ubuntu 24.04's archive at build time; it is not pinned.
|
| 88 |
+
- Three runs is a small sample: the solve rate shows the task is solvable, not how hard it is.
|
| 89 |
+
|
| 90 |
+
## Licences
|
| 91 |
+
|
| 92 |
+
The bundle code, the task and the synthetic seed files are Apache-2.0. Geany itself is not included: the computer installs it from Ubuntu's archive (`geany` 2.0-1build2) at build time, under its own licence (GPL-2.0-or-later).
|
bundle/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Geany computer app
|
| 2 |
+
|
| 3 |
+
Exported by REA's `export-desktop-application` from a capture of the `geany` package
|
| 4 |
+
(capture Evidence `ev_4684c2005297be81cf1370fb88326bd891831f5d8ffde813cc0b2e4bca4659a9`). It was checked against agentenv-framework
|
| 5 |
+
0.9.1431.
|
| 6 |
+
|
| 7 |
+
- `envs/geany/` is a computer app on the `ubuntu-24.04` base with the `reference` driver, for
|
| 8 |
+
`amd64` and `arm64`. It installs `geany` from the distribution archive, launches `sh -c exec 'geany' "$HOME"/'Documents/shop/settings.py'` at boot and is ready
|
| 9 |
+
when a window of class `Geany` appears.
|
| 10 |
+
- Owned paths: `~/.config/geany`, `~/Documents/shop`.
|
| 11 |
+
`data/get` returns their files and a typed JSON view of each; `data/reset` restores the seed.
|
| 12 |
+
- Seed: 6 file(s) from the user's home before the capture, with the captured home path
|
| 13 |
+
respelled in text files.
|
| 14 |
+
- `tasks/smoke.json` deploys the app.
|
| 15 |
+
|
| 16 |
+
Run the task with `agent-env run <this folder>`, or only the deploy with `--task smoke`.
|
| 17 |
+
|
| 18 |
+
The seed is synthetic test data made for this showcase; it holds no one's real files.
|
| 19 |
+
|
| 20 |
+
## Task `debug-off`
|
| 21 |
+
|
| 22 |
+
`tasks/debug-off.json` deploys the app, has the agent work through the computer from the prompt below, and grades
|
| 23 |
+
the outcome with `artifacts/debug-off-check/verify.py`, which reads the app's `data/get` views and needs
|
| 24 |
+
no model. `evals/geany.toml` names it, so a run of the bundle runs it.
|
| 25 |
+
|
| 26 |
+
> In the shop's settings.py open in Geany, turn debug mode off and change the port to 8080, then save the file.
|
| 27 |
+
|
| 28 |
+
Checks, each of which must pass:
|
| 29 |
+
|
| 30 |
+
- `changed`: `{"kind":"lines_present","file":"Documents/shop/settings.py","lines":["DEBUG = False","PORT = 8080"]}`
|
| 31 |
+
- `old-gone`: `{"kind":"lines_absent","file":"Documents/shop/settings.py","lines":["DEBUG = True","PORT = 8000"]}`
|
| 32 |
+
- `rest-kept`: `{"kind":"lines_present","file":"Documents/shop/settings.py","lines":["APP_NAME = \"Corner Shop\"","HOST = \"127.0.0.1\"","DATABASE_URL = \"sqlite:///shop.db\"","ITEMS_PER_PAGE = 20","CURRENCY = \"EUR\""]}`
|
| 33 |
+
|
| 34 |
+
REA kept the task because its checks fail on the seed (`changed`, `old-gone`) and all
|
| 35 |
+
pass on the captured end state.
|
| 36 |
+
|
| 37 |
+
To measure a solve rate, run the task k times (3 by default) with the agent and model to measure, and count the runs
|
| 38 |
+
whose summary line says `passed`; a run that says `failed` did not finish and is run again rather than counted:
|
| 39 |
+
|
| 40 |
+
agent-env run <this folder> --task debug-off --agent claude-code --model MODEL
|
bundle/artifacts/debug-off-check/verify.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Checks of the task debug-off against the geany app's state, exported by REA from a desktop application capture.
|
| 2 |
+
|
| 3 |
+
It reads the app's data/get through the computer, takes the typed views of its files and evaluates each check: no
|
| 4 |
+
model, no code from the task. A failure to reach the app raises, so the run fails rather than scoring the agent.
|
| 5 |
+
"""
|
| 6 |
+
import json
|
| 7 |
+
import re
|
| 8 |
+
|
| 9 |
+
from agentenv_protocol import client as protocol
|
| 10 |
+
from agentenv_protocol.types import RPC_PATH
|
| 11 |
+
|
| 12 |
+
APP = "geany"
|
| 13 |
+
CHECKS = [
|
| 14 |
+
{"id": "changed", "kind": "lines_present", "file": "Documents/shop/settings.py", "lines": ["DEBUG = False", "PORT = 8080"]},
|
| 15 |
+
{"id": "old-gone", "kind": "lines_absent", "file": "Documents/shop/settings.py", "lines": ["DEBUG = True", "PORT = 8000"]},
|
| 16 |
+
{"id": "rest-kept", "kind": "lines_present", "file": "Documents/shop/settings.py", "lines": ["APP_NAME = \"Corner Shop\"", "HOST = \"127.0.0.1\"", "DATABASE_URL = \"sqlite:///shop.db\"", "ITEMS_PER_PAGE = 20", "CURRENCY = \"EUR\""]},
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _shown(value) -> str:
|
| 23 |
+
text = json.dumps(value, ensure_ascii=False, separators=(",", ":"))
|
| 24 |
+
return text if len(text) <= 200 else text[:200] + "…"
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _same(actual, expected) -> bool:
|
| 28 |
+
"""JSON equality: numbers by value but never a boolean for a number, objects by their keys, arrays in order."""
|
| 29 |
+
if isinstance(expected, list):
|
| 30 |
+
return (isinstance(actual, list) and len(actual) == len(expected)
|
| 31 |
+
and all(_same(item, wanted) for item, wanted in zip(actual, expected)))
|
| 32 |
+
if isinstance(expected, dict):
|
| 33 |
+
return (isinstance(actual, dict) and len(actual) == len(expected)
|
| 34 |
+
and all(key in actual and _same(actual[key], value) for key, value in expected.items()))
|
| 35 |
+
if isinstance(expected, bool) or isinstance(actual, bool):
|
| 36 |
+
return isinstance(expected, bool) and isinstance(actual, bool) and actual == expected
|
| 37 |
+
if isinstance(expected, (int, float)):
|
| 38 |
+
return isinstance(actual, (int, float)) and actual == expected
|
| 39 |
+
return type(actual) is type(expected) and actual == expected
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _resolve(view, pointer: str):
|
| 43 |
+
current = view
|
| 44 |
+
for raw in pointer[1:].split("/"):
|
| 45 |
+
token = raw.replace("~1", "/").replace("~0", "~")
|
| 46 |
+
if isinstance(current, list):
|
| 47 |
+
if not re.fullmatch(r"0|[1-9][0-9]*", token) or int(token) >= len(current):
|
| 48 |
+
return MISSING
|
| 49 |
+
current = current[int(token)]
|
| 50 |
+
elif isinstance(current, dict) and token in current:
|
| 51 |
+
current = current[token]
|
| 52 |
+
else:
|
| 53 |
+
return MISSING
|
| 54 |
+
return current
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _truncated(form, view) -> bool:
|
| 58 |
+
if not isinstance(view, dict):
|
| 59 |
+
return False
|
| 60 |
+
if form in ("text", "xml"):
|
| 61 |
+
return view.get("truncated") is True
|
| 62 |
+
if form != "sqlite":
|
| 63 |
+
return False
|
| 64 |
+
tables = view.get("tables")
|
| 65 |
+
return view.get("tables_truncated") is True or any(
|
| 66 |
+
isinstance(table, dict) and (table.get("truncated") is True or isinstance(table.get("error"), str))
|
| 67 |
+
for table in (tables.values() if isinstance(tables, dict) else []))
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _view_of(check, entry, form):
|
| 71 |
+
"""The view, whether it is truncated, and why the check cannot read it; an absent file reads as empty."""
|
| 72 |
+
if entry is None:
|
| 73 |
+
return None, False, None
|
| 74 |
+
if isinstance(entry.get("error"), str):
|
| 75 |
+
return None, False, f"{check['file']} has no view: {entry['error']}"
|
| 76 |
+
if entry.get("format") in (None, "binary"):
|
| 77 |
+
return None, False, f"{check['file']} is binary and has no view"
|
| 78 |
+
if form is not None and entry.get("format") != form:
|
| 79 |
+
return None, False, f"{check['file']} is read as {entry.get('format')}, not {form}"
|
| 80 |
+
return entry.get("view"), _truncated(entry.get("format"), entry.get("view")), None
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def _undecided(check):
|
| 84 |
+
return False, f"the view of {check['file']} is truncated, so what it leaves out is unknown"
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _compared(check, n: int, what: str):
|
| 88 |
+
operator = next(key for key in ("equals", "at_least", "at_most") if check.get(key) is not None)
|
| 89 |
+
expected = check[operator]
|
| 90 |
+
met = n == expected if operator == "equals" else n >= expected if operator == "at_least" else n <= expected
|
| 91 |
+
return met, f"{n} {what}, expected {operator.replace('_', ' ')} {expected}"
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def _lines(check, entry):
|
| 95 |
+
view, truncated, problem = _view_of(check, entry, "text")
|
| 96 |
+
if problem is not None:
|
| 97 |
+
return False, problem
|
| 98 |
+
lines = view.get("lines") if isinstance(view, dict) and isinstance(view.get("lines"), list) else []
|
| 99 |
+
lines = [line for line in lines if isinstance(line, str)]
|
| 100 |
+
file = check["file"]
|
| 101 |
+
if check["kind"] == "lines_present":
|
| 102 |
+
missing = next((line for line in check["lines"] if line not in lines), None)
|
| 103 |
+
return (True, f"{file} has the line(s) {_shown(check['lines'])}") if missing is None else (
|
| 104 |
+
False, f"{file} has no line {_shown(missing)}")
|
| 105 |
+
if truncated:
|
| 106 |
+
return _undecided(check)
|
| 107 |
+
if check["kind"] == "lines_absent":
|
| 108 |
+
found = next((line for line in check["lines"] if line in lines), None)
|
| 109 |
+
return (True, f"{file} has none of the lines {_shown(check['lines'])}") if found is None else (
|
| 110 |
+
False, f"{file} still has the line {_shown(found)}")
|
| 111 |
+
if check.get("contains") is not None:
|
| 112 |
+
n = sum(1 for line in lines if check["contains"] in line)
|
| 113 |
+
return _compared(check, n, f"line(s) of {file} contain {_shown(check['contains'])}")
|
| 114 |
+
n = sum(1 for line in lines if line == check["exact"])
|
| 115 |
+
return _compared(check, n, f"line(s) of {file} match {_shown(check['exact'])}")
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def _value(check, entry):
|
| 119 |
+
view, truncated, problem = _view_of(check, entry, None)
|
| 120 |
+
if problem is not None:
|
| 121 |
+
return False, problem
|
| 122 |
+
found = MISSING if entry is None else _resolve(view, check["pointer"])
|
| 123 |
+
at = f"{check['file']} at {check['pointer']}"
|
| 124 |
+
if check["kind"] == "value_equals" and isinstance(check["value"], (dict, list)) and truncated:
|
| 125 |
+
return _undecided(check)
|
| 126 |
+
if check["kind"] == "value_equals":
|
| 127 |
+
if found is not MISSING and _same(found, check["value"]):
|
| 128 |
+
return True, f"{at} is {_shown(check['value'])}"
|
| 129 |
+
return False, f"{at} has no value" if found is MISSING else f"{at} is {_shown(found)}, not {_shown(check['value'])}"
|
| 130 |
+
if truncated:
|
| 131 |
+
return _undecided(check)
|
| 132 |
+
return (True, f"{at} has no value") if found is MISSING else (False, f"{at} is {_shown(found)}")
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def _rows(check, entry):
|
| 136 |
+
view, _, problem = _view_of(check, entry, "sqlite")
|
| 137 |
+
if problem is not None:
|
| 138 |
+
return False, problem
|
| 139 |
+
view = view if isinstance(view, dict) else {}
|
| 140 |
+
tables = view.get("tables") if isinstance(view.get("tables"), dict) else {}
|
| 141 |
+
table = tables[check["table"]] if check["table"] in tables else MISSING
|
| 142 |
+
name = f"{check['file']} table {check['table']}"
|
| 143 |
+
if table is MISSING and view.get("tables_truncated") is True:
|
| 144 |
+
return _undecided(check)
|
| 145 |
+
table = table if isinstance(table, dict) else {}
|
| 146 |
+
if isinstance(table.get("error"), str):
|
| 147 |
+
return False, f"{name} could not be read: {table['error']}"
|
| 148 |
+
columns = table.get("columns") if isinstance(table.get("columns"), list) else []
|
| 149 |
+
rows = table.get("rows") if isinstance(table.get("rows"), list) else []
|
| 150 |
+
where = check.get("where") or {}
|
| 151 |
+
|
| 152 |
+
def matches(row) -> bool:
|
| 153 |
+
return isinstance(row, list) and all(
|
| 154 |
+
column in columns and columns.index(column) < len(row) and _same(row[columns.index(column)], value)
|
| 155 |
+
for column, value in where.items())
|
| 156 |
+
|
| 157 |
+
n = sum(1 for row in rows if matches(row))
|
| 158 |
+
if check["kind"] == "row_present":
|
| 159 |
+
return (n > 0, f"{name} has a row with {_shown(where)}" if n > 0 else f"{name} has no row with {_shown(where)}")
|
| 160 |
+
if table.get("truncated") is True:
|
| 161 |
+
return _undecided(check)
|
| 162 |
+
if check["kind"] == "row_absent":
|
| 163 |
+
return (True, f"{name} has no row with {_shown(where)}") if n == 0 else (
|
| 164 |
+
False, f"{name} has {n} row(s) with {_shown(where)}")
|
| 165 |
+
return _compared(check, n, f"row(s) of {name}" + (f" with {_shown(where)}" if "where" in check else ""))
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def _verdict(check, entry):
|
| 169 |
+
kind = check["kind"]
|
| 170 |
+
if kind == "file_present":
|
| 171 |
+
return (entry is not None, f"{check['file']} exists" if entry is not None else f"{check['file']} does not exist")
|
| 172 |
+
if kind == "file_absent":
|
| 173 |
+
return (entry is None, f"{check['file']} does not exist" if entry is None else f"{check['file']} exists")
|
| 174 |
+
if kind in ("lines_present", "lines_absent", "line_count"):
|
| 175 |
+
return _lines(check, entry)
|
| 176 |
+
if kind in ("value_equals", "value_absent"):
|
| 177 |
+
return _value(check, entry)
|
| 178 |
+
return _rows(check, entry)
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def evaluate(checks: list, views: dict) -> list:
|
| 182 |
+
"""One result per check against the views data/get returned, by home path."""
|
| 183 |
+
results = []
|
| 184 |
+
for check in checks:
|
| 185 |
+
passed, description = _verdict(check, views.get(check["file"]))
|
| 186 |
+
results.append({"id": check["id"], "result": passed, "description": description})
|
| 187 |
+
return results
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
async def verify(mcp_url, env_url):
|
| 191 |
+
card = await protocol.get_card(env_url)
|
| 192 |
+
child = protocol.find_child(card, APP)
|
| 193 |
+
if child is None:
|
| 194 |
+
raise RuntimeError(f"the computer at {env_url} lists no app named {APP}")
|
| 195 |
+
answer = await protocol.get_data(env_url + (child.get("url") or RPC_PATH).removesuffix(RPC_PATH), timeout=120)
|
| 196 |
+
states = [part.data["state"] for part in answer.parts
|
| 197 |
+
if part.kind == "data" and isinstance(part.data.get("state"), dict)]
|
| 198 |
+
if not states:
|
| 199 |
+
raise RuntimeError(f"the {APP} app's data/get returned no state views")
|
| 200 |
+
return evaluate(CHECKS, states[0])
|
bundle/envs/geany/SKILL.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: Use Geany on this Linux desktop; its window has class Geany.
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Geany
|
| 6 |
+
|
| 7 |
+
Geany is open on the desktop at boot. Its window's class is `Geany`.
|
| 8 |
+
|
| 9 |
+
Its files live under `~/.config/geany`, `~/Documents/shop`. Work through the application's own
|
| 10 |
+
window and dialogs; the result is read from those files.
|
bundle/envs/geany/env.toml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
type = "computer_app"
|
| 2 |
+
module = "geany_app.py:Geany"
|
| 3 |
+
computer = "ubuntu-24.04"
|
| 4 |
+
driver = "reference"
|
bundle/envs/geany/geany_app.py
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Geany as an agentenv computer app, exported by REA from a desktop application capture.
|
| 2 |
+
|
| 3 |
+
Package: geany (captured at 2.0-1build2). Capture Evidence: ev_4684c2005297be81cf1370fb88326bd891831f5d8ffde813cc0b2e4bca4659a9.
|
| 4 |
+
The seed is synthetic test data made for this showcase.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import contextlib
|
| 10 |
+
import json
|
| 11 |
+
import math
|
| 12 |
+
import os
|
| 13 |
+
import re
|
| 14 |
+
import sqlite3
|
| 15 |
+
import subprocess
|
| 16 |
+
import sys
|
| 17 |
+
import tempfile
|
| 18 |
+
import xml.etree.ElementTree as ElementTree
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
from agentenv_protocol import add_data, get_data, reset_data
|
| 22 |
+
from agentenv_protocol.computer import AptSource, ComputerAppEnvironment, Download, Launch, Packages, Ready, RunScript, computer_app, linux, ready_check
|
| 23 |
+
from agentenv_protocol.computer.app_data import INITIAL, add, get, in_thread, keep_initial, reset
|
| 24 |
+
from agentenv_protocol.types import DataPart
|
| 25 |
+
|
| 26 |
+
HERE = Path(__file__).resolve().parent
|
| 27 |
+
CAPTURED_HOME = "/home/ada"
|
| 28 |
+
PATHS = [".config/geany", "Documents/shop"]
|
| 29 |
+
DCONF = ""
|
| 30 |
+
TEXT_SEEDS = frozenset([".config/geany/filedefs/filetypes.README", ".config/geany/geany.conf", ".config/geany/keybindings.conf", ".config/geany/session.conf", ".config/geany/templates/templates.README", "Documents/shop/settings.py"])
|
| 31 |
+
WINDOW_CLASS = "Geany"
|
| 32 |
+
|
| 33 |
+
XML_SUFFIXES = (".xml", ".xbel", ".plist", ".svg", ".ui")
|
| 34 |
+
GROUP_HEADER = re.compile(r"^\[([^\]]+)\]$")
|
| 35 |
+
LINE_BREAK = re.compile(r"\r?\n")
|
| 36 |
+
SQLITE_HEADER = b"SQLite format 3\x00"
|
| 37 |
+
XML_SPACE = "{http://www.w3.org/XML/1998/namespace}space"
|
| 38 |
+
MAX_VIEW_BYTES = 64 * 1024 * 1024
|
| 39 |
+
MAX_SAFE_INTEGER = 2**53 - 1
|
| 40 |
+
MAX_TABLES = 64
|
| 41 |
+
MAX_ROWS = 500
|
| 42 |
+
MAX_LINES = 5000
|
| 43 |
+
MAX_XML_NODES = 5000
|
| 44 |
+
MAX_XML_DEPTH = 64
|
| 45 |
+
SQLITE_BUSY_S = 0.25
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _respelled(text: str, home: Path) -> str:
|
| 49 |
+
"""The captured home path respelled to this computer's home, only where a whole path segment ends after it."""
|
| 50 |
+
return re.sub(re.escape(CAPTURED_HOME) + r"(?![\w.@+~-])", lambda _: str(home), text)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def _respelled_utf16(data: bytes, home: Path) -> bytes:
|
| 54 |
+
"""A UTF-16 text file with a byte-order mark respelled like a text seed, its mark kept; any other bytes as given."""
|
| 55 |
+
for mark, codec in ((b"\xff\xfe", "utf-16-le"), (b"\xfe\xff", "utf-16-be")):
|
| 56 |
+
if data.startswith(mark):
|
| 57 |
+
try:
|
| 58 |
+
text = data[len(mark):].decode(codec)
|
| 59 |
+
except UnicodeDecodeError:
|
| 60 |
+
return data
|
| 61 |
+
return mark + _respelled(text, home).encode(codec) if CAPTURED_HOME in text else data
|
| 62 |
+
return data
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
#: What marks a window as not yet the app's own: skipping the taskbar, as splash screens and dialogs do, or a splash type.
|
| 66 |
+
SPLASH_MARKS = ("_NET_WM_STATE_SKIP_TASKBAR", "_NET_WM_WINDOW_TYPE_SPLASH")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def _taskbar_window(window_class: str) -> bool:
|
| 70 |
+
"""Whether a top-level window of the given class that the taskbar lists is shown; a splash screen or a dialog
|
| 71 |
+
skips the taskbar."""
|
| 72 |
+
def xprop(*args: str) -> str:
|
| 73 |
+
done = subprocess.run(["xprop", *args], capture_output=True, text=True)
|
| 74 |
+
return done.stdout if done.returncode == 0 else ""
|
| 75 |
+
|
| 76 |
+
for window in re.findall(r"0x[0-9a-f]+", xprop("-root", "_NET_CLIENT_LIST").partition("#")[2]):
|
| 77 |
+
props = xprop("-id", window, "WM_CLASS", "_NET_WM_STATE", "_NET_WM_WINDOW_TYPE")
|
| 78 |
+
classes = re.findall(r'"((?:[^"\\]|\\.)*)"', props.partition("WM_CLASS")[2].split("\n", 1)[0])
|
| 79 |
+
if window_class in classes and not any(mark in props for mark in SPLASH_MARKS):
|
| 80 |
+
return True
|
| 81 |
+
return False
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def _seed_home(home: Path) -> None:
|
| 85 |
+
"""Copy the captured files into this computer's home; text files, UTF-16 ones too, have the captured home path
|
| 86 |
+
respelled."""
|
| 87 |
+
seed = HERE / "seed"
|
| 88 |
+
for source in sorted(seed.rglob("*")) if seed.is_dir() else []:
|
| 89 |
+
if not source.is_file():
|
| 90 |
+
continue
|
| 91 |
+
relative = source.relative_to(seed).as_posix()
|
| 92 |
+
target = home / relative
|
| 93 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 94 |
+
data = source.read_bytes()
|
| 95 |
+
if relative in TEXT_SEEDS:
|
| 96 |
+
data = _respelled(data.decode("utf-8"), home).encode("utf-8")
|
| 97 |
+
else:
|
| 98 |
+
data = _respelled_utf16(data, home)
|
| 99 |
+
target.write_bytes(data)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def _dconf(arguments: list, environment: dict) -> str:
|
| 103 |
+
return subprocess.run(["dconf", *arguments], env={**os.environ, **environment}, capture_output=True, text=True,
|
| 104 |
+
check=True).stdout
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def _load_dconf(home: Path) -> None:
|
| 108 |
+
"""Compile the captured dconf keys into the user database without D-Bus, which is not up yet. Keys already there
|
| 109 |
+
stay unless captured: dconf compile reads the key files in name order and a later file wins. A failure is
|
| 110 |
+
reported and the app starts without them."""
|
| 111 |
+
if not DCONF:
|
| 112 |
+
return
|
| 113 |
+
database = home / ".config" / "dconf" / "user"
|
| 114 |
+
try:
|
| 115 |
+
database.parent.mkdir(parents=True, exist_ok=True)
|
| 116 |
+
with tempfile.TemporaryDirectory(dir=database.parent) as scratch:
|
| 117 |
+
keyfiles = Path(scratch, "keyfiles")
|
| 118 |
+
keyfiles.mkdir()
|
| 119 |
+
if database.is_file():
|
| 120 |
+
profile = Path(scratch, "profile")
|
| 121 |
+
profile.write_text(f"file-db:{database}\n")
|
| 122 |
+
existing = _dconf(["dump", "/"], {"DCONF_PROFILE": str(profile)})
|
| 123 |
+
(keyfiles / "00-existing").write_text(existing)
|
| 124 |
+
(keyfiles / "01-captured").write_text(_respelled(DCONF, home))
|
| 125 |
+
_dconf(["compile", str(Path(scratch, "user")), str(keyfiles)], {})
|
| 126 |
+
os.replace(Path(scratch, "user"), database)
|
| 127 |
+
except (OSError, subprocess.CalledProcessError) as error:
|
| 128 |
+
detail = (getattr(error, "stderr", None) or "").strip().splitlines()
|
| 129 |
+
print(f"warning: the captured dconf settings were not loaded: {detail[-1] if detail else error}",
|
| 130 |
+
file=sys.stderr)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def _sqlite_text(data: bytes):
|
| 134 |
+
text = data.decode("utf-8", "replace")
|
| 135 |
+
return {"text": text, "bytes_hex": data.hex()} if "�" in text else text
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def _cell(value):
|
| 139 |
+
if isinstance(value, bytes):
|
| 140 |
+
return {"blob_hex": value.hex()}
|
| 141 |
+
if isinstance(value, int) and abs(value) > MAX_SAFE_INTEGER:
|
| 142 |
+
return {"integer": str(value)}
|
| 143 |
+
# JSON has no infinities or negative zero; REA's SQLite reader spells them as strings.
|
| 144 |
+
if isinstance(value, float) and (math.isinf(value) or (value == 0 and math.copysign(1, value) < 0)):
|
| 145 |
+
return "Infinity" if value == math.inf else "-Infinity" if value == -math.inf else "-0"
|
| 146 |
+
return value
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def _table(db, name: str, primary_key: list) -> dict:
|
| 150 |
+
quoted = '"' + name.replace('"', '""') + '"'
|
| 151 |
+
cursor = db.execute(f"select * from main.{quoted} not indexed limit {MAX_ROWS + 1}")
|
| 152 |
+
rows = [[_cell(value) for value in row] for row in cursor]
|
| 153 |
+
return {"columns": [column[0] for column in cursor.description], "primary_key": primary_key,
|
| 154 |
+
"rows": rows[:MAX_ROWS], "truncated": len(rows) > MAX_ROWS}
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def _sqlite(path: Path) -> dict:
|
| 158 |
+
"""The database's ordinary tables, in schema order, up to REA's table and row limits."""
|
| 159 |
+
with contextlib.closing(sqlite3.connect(path.resolve().as_uri() + "?mode=ro", uri=True, timeout=SQLITE_BUSY_S)) as db:
|
| 160 |
+
kinds = dict(db.execute("select name, type from pragma_table_list where schema = 'main'"))
|
| 161 |
+
names = [name for (name,) in db.execute("select name from sqlite_schema where type = 'table'")
|
| 162 |
+
if kinds.get(name) == "table"]
|
| 163 |
+
keys = {name: [key for (key,) in db.execute(
|
| 164 |
+
"select name from pragma_table_info(?, 'main') where pk > 0 order by pk", (name,))]
|
| 165 |
+
for name in names[:MAX_TABLES]}
|
| 166 |
+
db.text_factory = _sqlite_text
|
| 167 |
+
tables = {name: _table(db, name, keys[name]) for name in names[:MAX_TABLES]}
|
| 168 |
+
cut = len(names) > MAX_TABLES
|
| 169 |
+
return {"format": "sqlite", "view": {"tables": tables, "tables_truncated": cut},
|
| 170 |
+
"truncated": cut or any(table["truncated"] for table in tables.values())}
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def _text(text: str) -> dict:
|
| 174 |
+
lines = LINE_BREAK.split(text)
|
| 175 |
+
if lines[-1] == "":
|
| 176 |
+
lines.pop()
|
| 177 |
+
view = {"lines": lines[:MAX_LINES], "line_count": len(lines), "truncated": len(lines) > MAX_LINES}
|
| 178 |
+
return {"format": "text", "view": view, "truncated": view["truncated"]}
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def _keyfile_line(raw: str) -> tuple:
|
| 182 |
+
"""A key file line as REA reads it: skip (blank or comment), group, entry or other."""
|
| 183 |
+
line = raw.strip()
|
| 184 |
+
if not line or line[0] in "#;":
|
| 185 |
+
return ("skip",)
|
| 186 |
+
header = GROUP_HEADER.match(line)
|
| 187 |
+
if header:
|
| 188 |
+
return ("group", header.group(1))
|
| 189 |
+
key, equals, value = line.partition("=")
|
| 190 |
+
return ("entry", key.strip(), value.strip()) if equals and key else ("other",)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def _is_keyfile(text: str) -> bool:
|
| 194 |
+
"""REA's rule: at least one group, and nothing a key file view would drop."""
|
| 195 |
+
kinds = {_keyfile_line(line)[0] for line in LINE_BREAK.split(text)}
|
| 196 |
+
return "group" in kinds and "other" not in kinds
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def _keyfile(text: str) -> dict:
|
| 200 |
+
groups, group = {}, ""
|
| 201 |
+
for line in map(_keyfile_line, LINE_BREAK.split(text)):
|
| 202 |
+
if line[0] == "group":
|
| 203 |
+
group = line[1]
|
| 204 |
+
groups.setdefault(group, {})
|
| 205 |
+
elif line[0] == "entry":
|
| 206 |
+
groups.setdefault(group, {})[line[1]] = line[2]
|
| 207 |
+
return groups
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class _XmlTree(ElementTree.TreeBuilder):
|
| 211 |
+
"""Keeps comments and processing instructions, which REA's node limit counts, and refuses DOCTYPEs as REA does."""
|
| 212 |
+
|
| 213 |
+
def __init__(self) -> None:
|
| 214 |
+
super().__init__(insert_comments=True, insert_pis=True)
|
| 215 |
+
|
| 216 |
+
def doctype(self, name, pubid, system) -> None:
|
| 217 |
+
raise ValueError("the document declares a DOCTYPE")
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
def _xml_children(element) -> list:
|
| 221 |
+
nodes = [element.text] if element.text else []
|
| 222 |
+
for child in element:
|
| 223 |
+
nodes.append(child)
|
| 224 |
+
if child.tail:
|
| 225 |
+
nodes.append(child.tail)
|
| 226 |
+
return nodes
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def _xml(node, depth: int, budget: dict, scope: tuple):
|
| 230 |
+
"""A node as REA's XML view keeps it: an element with its attributes and children, or its text; None when it is
|
| 231 |
+
formatting whitespace, a comment, or past REA's node and depth limits."""
|
| 232 |
+
if budget["remaining"] <= 0 or depth > MAX_XML_DEPTH:
|
| 233 |
+
budget["truncated"] = True
|
| 234 |
+
return None
|
| 235 |
+
budget["remaining"] -= 1
|
| 236 |
+
preserve, element_content = scope
|
| 237 |
+
if isinstance(node, str):
|
| 238 |
+
return None if not node.strip() and element_content and not preserve else node
|
| 239 |
+
if not isinstance(node.tag, str):
|
| 240 |
+
return None
|
| 241 |
+
space = node.get(XML_SPACE)
|
| 242 |
+
nodes = _xml_children(node)
|
| 243 |
+
inner = (space == "preserve" if space else preserve,
|
| 244 |
+
any(not isinstance(child, str) and isinstance(child.tag, str) for child in nodes))
|
| 245 |
+
children = [_xml(child, depth + 1, budget, inner) for child in nodes]
|
| 246 |
+
return {"name": node.tag, "attributes": dict(node.attrib), "children": [c for c in children if c is not None]}
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
def _xml_view(text: str):
|
| 250 |
+
parser = ElementTree.XMLParser(target=_XmlTree())
|
| 251 |
+
try:
|
| 252 |
+
parser.feed(text)
|
| 253 |
+
root = parser.close()
|
| 254 |
+
except (ElementTree.ParseError, ValueError):
|
| 255 |
+
return None
|
| 256 |
+
budget = {"remaining": MAX_XML_NODES, "truncated": False}
|
| 257 |
+
tree = _xml(root, 0, budget, (False, False))
|
| 258 |
+
return None if tree is None else {"root": tree, "truncated": budget["truncated"]}
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def _not_json(constant: str):
|
| 262 |
+
raise ValueError(f"{constant} is not JSON")
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
class _Inexact(Exception):
|
| 266 |
+
"""A JSON number that REA's state view refuses, since reading it would change it."""
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def _digits(text: str) -> str:
|
| 270 |
+
return re.split(r"[eE]", text.lstrip("-"))[0].replace(".", "").strip("0") or "0"
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
def _js_string(value: float) -> str:
|
| 274 |
+
"""How JavaScript's String() writes a finite double: an integer below 1e21 in full, any other in shortest form."""
|
| 275 |
+
return str(int(value)) if value.is_integer() and abs(value) < 1e21 else repr(value)
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
def _safe_number(text: str) -> bool:
|
| 279 |
+
"""lossless-json's isSafeNumber: an integer spelling within 2^53, or a float spelling that keeps its digits."""
|
| 280 |
+
if re.fullmatch(r"-?[0-9]+", text):
|
| 281 |
+
return len(text.lstrip("-")) <= 16 and abs(int(text)) <= MAX_SAFE_INTEGER
|
| 282 |
+
value = float(text)
|
| 283 |
+
if not math.isfinite(value):
|
| 284 |
+
return False
|
| 285 |
+
written = _js_string(value)
|
| 286 |
+
return written == text or _digits(written) == _digits(text)
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
def _exact_number(text: str):
|
| 290 |
+
"""A JSON number read only when reading it changes nothing, as REA's state view rules: its spelling and its
|
| 291 |
+
written-back form both safe, and not -0."""
|
| 292 |
+
value = float(text)
|
| 293 |
+
if (not _safe_number(text) or not math.isfinite(value) or not _safe_number(_js_string(value))
|
| 294 |
+
or (value == 0 and math.copysign(1, value) < 0)):
|
| 295 |
+
raise _Inexact(text)
|
| 296 |
+
return int(text) if re.fullmatch(r"-?[0-9]+", text) else value
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
_INEXACT = object()
|
| 300 |
+
_INEXACT_END = object()
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
def _number_or_mark(spelling: str):
|
| 304 |
+
"""A JSON number read exactly, or a mark for one REA's state view refuses."""
|
| 305 |
+
try:
|
| 306 |
+
return _exact_number(spelling)
|
| 307 |
+
except _Inexact:
|
| 308 |
+
return _INEXACT
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
def _holds_inexact(value) -> bool:
|
| 312 |
+
"""Whether a parsed JSON value still holds a marked number once duplicate keys kept their last value; one
|
| 313 |
+
iterator per nesting level, so no child list is copied."""
|
| 314 |
+
levels = [iter((value,))]
|
| 315 |
+
while levels:
|
| 316 |
+
item = next(levels[-1], _INEXACT_END)
|
| 317 |
+
if item is _INEXACT_END:
|
| 318 |
+
levels.pop()
|
| 319 |
+
elif item is _INEXACT:
|
| 320 |
+
return True
|
| 321 |
+
elif isinstance(item, dict):
|
| 322 |
+
levels.append(iter(item.values()))
|
| 323 |
+
elif isinstance(item, list):
|
| 324 |
+
levels.append(iter(item))
|
| 325 |
+
return False
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
def _text_view(name: str, text: str) -> dict:
|
| 329 |
+
"""The format REA's state view detects for decoded text, and its view."""
|
| 330 |
+
trimmed = re.sub(r"^[\s]+", "", text)
|
| 331 |
+
if name.endswith(".json") or trimmed[:1] in ("[", "{"):
|
| 332 |
+
# The whole text must parse, and duplicate keys settle, before an inexact number makes it JSON with an error.
|
| 333 |
+
try:
|
| 334 |
+
view = json.loads(text, parse_constant=_not_json, parse_float=_number_or_mark, parse_int=_number_or_mark)
|
| 335 |
+
except ValueError:
|
| 336 |
+
pass
|
| 337 |
+
else:
|
| 338 |
+
if _holds_inexact(view):
|
| 339 |
+
return {"format": "json", "view": None,
|
| 340 |
+
"error": "a number in it cannot be read exactly, such as an integer above 2^53"}
|
| 341 |
+
return {"format": "json", "view": view, "truncated": False}
|
| 342 |
+
lowered = name.lower()
|
| 343 |
+
if lowered.endswith(XML_SUFFIXES) or trimmed.startswith("<?xml"):
|
| 344 |
+
view = _xml_view(text)
|
| 345 |
+
return _text(text) if view is None else {"format": "xml", "view": view, "truncated": view["truncated"]}
|
| 346 |
+
if _is_keyfile(text):
|
| 347 |
+
return {"format": "keyfile", "view": {"groups": _keyfile(text)}, "truncated": False}
|
| 348 |
+
return _text(text)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
def _view(path: Path) -> dict:
|
| 352 |
+
"""A typed JSON view of one file in the shapes of REA's state view; truncated says the view is partial."""
|
| 353 |
+
too_large = {"format": None, "view": None, "error": "larger than 64 MiB, the most the view reads"}
|
| 354 |
+
if path.stat().st_size > MAX_VIEW_BYTES:
|
| 355 |
+
return too_large
|
| 356 |
+
with path.open("rb") as file:
|
| 357 |
+
data = file.read(8192)
|
| 358 |
+
whole = not data.startswith(SQLITE_HEADER) and b"\x00" not in data
|
| 359 |
+
data += file.read(MAX_VIEW_BYTES + 1 - len(data)) if whole else b""
|
| 360 |
+
if data.startswith(SQLITE_HEADER):
|
| 361 |
+
return _sqlite(path)
|
| 362 |
+
if len(data) > MAX_VIEW_BYTES:
|
| 363 |
+
return too_large
|
| 364 |
+
try:
|
| 365 |
+
text = data.decode("utf-8-sig") if whole else None
|
| 366 |
+
except UnicodeDecodeError:
|
| 367 |
+
text = None
|
| 368 |
+
return {"format": "binary", "view": None, "truncated": False} if text is None else _text_view(path.name, text)
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
def _views(home: Path, paths: list) -> dict:
|
| 372 |
+
"""A view of every file under the app's paths, keyed by its home-relative path."""
|
| 373 |
+
files = {}
|
| 374 |
+
for owned in paths:
|
| 375 |
+
root = home / owned
|
| 376 |
+
candidates = [root] if root.is_file() else sorted(root.rglob("*")) if root.is_dir() else []
|
| 377 |
+
for path in candidates:
|
| 378 |
+
if path.is_file() and not path.is_symlink():
|
| 379 |
+
key = path.relative_to(home).as_posix()
|
| 380 |
+
try:
|
| 381 |
+
files[key] = _view(path)
|
| 382 |
+
except (OSError, ValueError, sqlite3.Error, RecursionError) as error:
|
| 383 |
+
files[key] = {"format": None, "view": None, "error": str(error)}
|
| 384 |
+
return files
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
@computer_app(supports=[{"os": {"type": "linux", "display": ["x11"]}, "arch": ["amd64", "arm64"]}])
|
| 388 |
+
@linux(
|
| 389 |
+
packages=Packages(apt=["geany"]),
|
| 390 |
+
launch=Launch(at="boot", command=["sh", "-c", "exec 'geany' \"$HOME\"/'Documents/shop/settings.py'"], window={"class": "Geany"}, ready=Ready(window=True)),
|
| 391 |
+
paths=PATHS,
|
| 392 |
+
skill="SKILL.md",
|
| 393 |
+
)
|
| 394 |
+
class Geany(ComputerAppEnvironment):
|
| 395 |
+
"""Geany, launched at boot with the captured state in its home.
|
| 396 |
+
|
| 397 |
+
Declaring data hooks switches off agentenv's default data plane, so these call its helpers: the seed is kept as
|
| 398 |
+
the initial state, reset restores it, add writes files under PATHS, and get returns those files plus a typed JSON
|
| 399 |
+
view of each.
|
| 400 |
+
"""
|
| 401 |
+
|
| 402 |
+
def __init__(self) -> None:
|
| 403 |
+
super().__init__()
|
| 404 |
+
if not INITIAL.exists():
|
| 405 |
+
_seed_home(Path.home())
|
| 406 |
+
_load_dconf(Path.home())
|
| 407 |
+
keep_initial(self.paths)
|
| 408 |
+
|
| 409 |
+
@add_data
|
| 410 |
+
async def add_files(self, parts: list) -> None:
|
| 411 |
+
await add(parts, self.paths)
|
| 412 |
+
|
| 413 |
+
@get_data
|
| 414 |
+
async def get_files(self, write_namespace=None) -> list:
|
| 415 |
+
files = await get(self.paths, write_namespace)
|
| 416 |
+
views = await in_thread(_views, Path.home(), self.paths)
|
| 417 |
+
return [*files, DataPart(data={"state": views})]
|
| 418 |
+
|
| 419 |
+
@reset_data
|
| 420 |
+
async def reset_files(self) -> None:
|
| 421 |
+
await reset(self.paths)
|
| 422 |
+
|
| 423 |
+
@ready_check
|
| 424 |
+
def main_window_shown(self) -> bool:
|
| 425 |
+
"""A window of the app's class that the taskbar lists is shown, not only a splash screen or a dialog."""
|
| 426 |
+
return _taskbar_window(WINDOW_CLASS)
|
bundle/envs/geany/seed/.config/geany/filedefs/filetypes.README
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copy files from /usr/share/geany/filedefs to this directory to overwrite them. To use the defaults, just delete the file in this directory.
|
| 2 |
+
For more information read the documentation (in /usr/share/doc/geany/html/index.html or visit https://www.geany.org/).
|
bundle/envs/geany/seed/.config/geany/geany.conf
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[geany]
|
| 2 |
+
pref_main_load_session=true
|
| 3 |
+
pref_main_project_file_in_basedir=true
|
| 4 |
+
pref_main_save_winpos=true
|
| 5 |
+
pref_main_save_wingeom=true
|
| 6 |
+
pref_main_confirm_exit=false
|
| 7 |
+
pref_main_suppress_status_messages=false
|
| 8 |
+
switch_msgwin_pages=false
|
| 9 |
+
beep_on_errors=true
|
| 10 |
+
auto_focus=false
|
| 11 |
+
sidebar_symbol_visible=true
|
| 12 |
+
sidebar_openfiles_visible=true
|
| 13 |
+
editor_font=Monospace 10
|
| 14 |
+
tagbar_font=Sans 9
|
| 15 |
+
msgwin_font=Monospace 9
|
| 16 |
+
show_notebook_tabs=true
|
| 17 |
+
show_tab_cross=true
|
| 18 |
+
tab_order_ltr=true
|
| 19 |
+
tab_order_beside=false
|
| 20 |
+
tab_pos_editor=2
|
| 21 |
+
tab_pos_msgwin=0
|
| 22 |
+
tab_label_length=1000
|
| 23 |
+
show_indent_guide=false
|
| 24 |
+
show_white_space=false
|
| 25 |
+
show_line_endings=false
|
| 26 |
+
show_line_endings_only_when_differ=false
|
| 27 |
+
show_markers_margin=true
|
| 28 |
+
show_linenumber_margin=true
|
| 29 |
+
long_line_enabled=true
|
| 30 |
+
long_line_type=0
|
| 31 |
+
long_line_column=72
|
| 32 |
+
long_line_color=#C2EBC2
|
| 33 |
+
symbolcompletion_max_height=10
|
| 34 |
+
symbolcompletion_min_chars=4
|
| 35 |
+
use_folding=true
|
| 36 |
+
unfold_all_children=false
|
| 37 |
+
use_indicators=true
|
| 38 |
+
line_wrapping=false
|
| 39 |
+
auto_close_xml_tags=true
|
| 40 |
+
complete_snippets=true
|
| 41 |
+
auto_complete_symbols=true
|
| 42 |
+
pref_editor_disable_dnd=false
|
| 43 |
+
pref_editor_smart_home_key=true
|
| 44 |
+
pref_editor_newline_strip=false
|
| 45 |
+
line_break_column=72
|
| 46 |
+
auto_continue_multiline=true
|
| 47 |
+
comment_toggle_mark=~
|
| 48 |
+
scroll_stop_at_last_line=true
|
| 49 |
+
autoclose_chars=0
|
| 50 |
+
pref_editor_default_new_encoding=UTF-8
|
| 51 |
+
pref_editor_default_open_encoding=none
|
| 52 |
+
default_eol_character=2
|
| 53 |
+
pref_editor_new_line=true
|
| 54 |
+
pref_editor_ensure_convert_line_endings=false
|
| 55 |
+
pref_editor_replace_tabs=false
|
| 56 |
+
pref_editor_trail_space=false
|
| 57 |
+
pref_toolbar_show=true
|
| 58 |
+
pref_toolbar_append_to_menu=false
|
| 59 |
+
pref_toolbar_use_gtk_default_style=true
|
| 60 |
+
pref_toolbar_use_gtk_default_icon=true
|
| 61 |
+
pref_toolbar_icon_style=0
|
| 62 |
+
pref_toolbar_icon_size=0
|
| 63 |
+
pref_template_developer=Unknown
|
| 64 |
+
pref_template_company=
|
| 65 |
+
pref_template_mail=ada@e81232be457d
|
| 66 |
+
pref_template_initial=U
|
| 67 |
+
pref_template_version=1.0
|
| 68 |
+
pref_template_year=%Y
|
| 69 |
+
pref_template_date=%Y-%m-%d
|
| 70 |
+
pref_template_datetime=%d.%m.%Y %H:%M:%S %Z
|
| 71 |
+
context_action_cmd=
|
| 72 |
+
sidebar_visible=true
|
| 73 |
+
statusbar_visible=true
|
| 74 |
+
msgwindow_visible=true
|
| 75 |
+
fullscreen=false
|
| 76 |
+
symbols_group_by_type=true
|
| 77 |
+
color_picker_palette=
|
| 78 |
+
scribble_text=Type here what you want, use it as a notice/scratch board
|
| 79 |
+
scribble_pos=57
|
| 80 |
+
custom_date_format=
|
| 81 |
+
default_open_path=
|
| 82 |
+
cmdline_new_files=true
|
| 83 |
+
notebook_double_click_hides_widgets=false
|
| 84 |
+
tab_close_switch_to_mru=false
|
| 85 |
+
tab_pos_sidebar=2
|
| 86 |
+
openfiles_path_mode=2
|
| 87 |
+
sidebar_pos=0
|
| 88 |
+
symbols_sort_mode=0
|
| 89 |
+
msgwin_orientation=1
|
| 90 |
+
highlighting_invert_all=false
|
| 91 |
+
pref_main_search_use_current_word=true
|
| 92 |
+
check_detect_indent=false
|
| 93 |
+
detect_indent_width=false
|
| 94 |
+
use_tab_to_indent=true
|
| 95 |
+
backspace_unindent=true
|
| 96 |
+
pref_editor_tab_width=4
|
| 97 |
+
indent_mode=2
|
| 98 |
+
indent_type=1
|
| 99 |
+
virtualspace=1
|
| 100 |
+
change_history_markers=false
|
| 101 |
+
change_history_indicators=false
|
| 102 |
+
autocomplete_doc_words=false
|
| 103 |
+
completion_drops_rest_of_word=false
|
| 104 |
+
autocompletion_max_entries=30
|
| 105 |
+
autocompletion_update_freq=250
|
| 106 |
+
color_scheme=
|
| 107 |
+
scroll_lines_around_cursor=0
|
| 108 |
+
mru_length=10
|
| 109 |
+
disk_check_timeout=30
|
| 110 |
+
show_editor_scrollbars=true
|
| 111 |
+
brace_match_ltgt=false
|
| 112 |
+
use_gtk_word_boundaries=true
|
| 113 |
+
complete_snippets_whilst_editing=false
|
| 114 |
+
indent_hard_tab_width=8
|
| 115 |
+
editor_ime_interaction=0
|
| 116 |
+
use_atomic_file_saving=false
|
| 117 |
+
gio_unsafe_save_backup=false
|
| 118 |
+
use_gio_unsafe_file_saving=true
|
| 119 |
+
keep_edit_history_on_reload=true
|
| 120 |
+
show_keep_edit_history_on_reload_msg=true
|
| 121 |
+
reload_clean_doc_on_file_change=false
|
| 122 |
+
save_config_on_file_change=true
|
| 123 |
+
extract_filetype_regex=-\\*-\\s*([^\\s]+)\\s*-\\*-
|
| 124 |
+
allow_always_save=false
|
| 125 |
+
find_selection_type=0
|
| 126 |
+
replace_and_find_by_default=true
|
| 127 |
+
show_symbol_list_expanders=true
|
| 128 |
+
compiler_tab_autoscroll=true
|
| 129 |
+
statusbar_template=line: %l / %L col: %c sel: %s %w %t %mEOL: %M encoding: %e filetype: %f scope: %S
|
| 130 |
+
new_document_after_close=false
|
| 131 |
+
msgwin_status_visible=true
|
| 132 |
+
msgwin_compiler_visible=true
|
| 133 |
+
msgwin_messages_visible=true
|
| 134 |
+
msgwin_scribble_visible=true
|
| 135 |
+
warn_on_project_close=true
|
| 136 |
+
|
| 137 |
+
[tools]
|
| 138 |
+
terminal_cmd=x-terminal-emulator -e "/bin/sh %c"
|
| 139 |
+
browser_cmd=
|
| 140 |
+
grep_cmd=grep
|
| 141 |
+
|
| 142 |
+
[printing]
|
| 143 |
+
print_cmd=
|
| 144 |
+
use_gtk_printing=true
|
| 145 |
+
print_line_numbers=true
|
| 146 |
+
print_page_numbers=true
|
| 147 |
+
print_page_header=true
|
| 148 |
+
page_header_basename=false
|
| 149 |
+
page_header_datefmt=%c
|
| 150 |
+
|
| 151 |
+
[VTE]
|
| 152 |
+
load_vte=true
|
| 153 |
+
send_cmd_prefix=
|
| 154 |
+
send_selection_unsafe=false
|
| 155 |
+
|
| 156 |
+
[build-menu]
|
| 157 |
+
number_ft_menu_items=0
|
| 158 |
+
number_non_ft_menu_items=0
|
| 159 |
+
number_exec_menu_items=0
|
| 160 |
+
|
| 161 |
+
[search]
|
| 162 |
+
pref_search_hide_find_dialog=false
|
| 163 |
+
pref_search_always_wrap=false
|
| 164 |
+
pref_search_current_file_dir=true
|
| 165 |
+
fif_regexp=false
|
| 166 |
+
fif_case_sensitive=true
|
| 167 |
+
fif_match_whole_word=false
|
| 168 |
+
fif_invert_results=false
|
| 169 |
+
fif_recursive=false
|
| 170 |
+
fif_extra_options=
|
| 171 |
+
fif_use_extra_options=false
|
| 172 |
+
fif_files=
|
| 173 |
+
fif_files_mode=0
|
| 174 |
+
find_regexp=false
|
| 175 |
+
find_regexp_multiline=false
|
| 176 |
+
find_case_sensitive=false
|
| 177 |
+
find_escape_sequences=false
|
| 178 |
+
find_match_whole_word=false
|
| 179 |
+
find_match_word_start=false
|
| 180 |
+
find_close_dialog=true
|
| 181 |
+
replace_regexp=false
|
| 182 |
+
replace_regexp_multiline=false
|
| 183 |
+
replace_case_sensitive=false
|
| 184 |
+
replace_escape_sequences=false
|
| 185 |
+
replace_match_whole_word=false
|
| 186 |
+
replace_match_word_start=false
|
| 187 |
+
replace_search_backwards=false
|
| 188 |
+
replace_close_dialog=true
|
bundle/envs/geany/seed/.config/geany/keybindings.conf
ADDED
|
File without changes
|
bundle/envs/geany/seed/.config/geany/session.conf
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[files]
|
| 2 |
+
recent_files=
|
| 3 |
+
recent_projects=
|
| 4 |
+
current_page=0
|
| 5 |
+
|
| 6 |
+
[project]
|
| 7 |
+
session_file=
|
| 8 |
+
project_file_path=/home/ada/projects
|
| 9 |
+
|
| 10 |
+
[geany]
|
| 11 |
+
treeview_position=156
|
| 12 |
+
msgwindow_position=368
|
| 13 |
+
geometry=0;0;900;600;0;
|
| 14 |
+
sidebar_page=0
|
| 15 |
+
|
| 16 |
+
[search]
|
| 17 |
+
find_all_expanded=false
|
| 18 |
+
replace_all_expanded=false
|
| 19 |
+
position_find_x=-1
|
| 20 |
+
position_find_y=-1
|
| 21 |
+
position_replace_x=-1
|
| 22 |
+
position_replace_y=-1
|
| 23 |
+
position_fif_x=-1
|
| 24 |
+
position_fif_y=-1
|
| 25 |
+
|
| 26 |
+
[plugins]
|
| 27 |
+
load_plugins=true
|
| 28 |
+
custom_plugin_path=
|
| 29 |
+
active_plugins=;
|
bundle/envs/geany/seed/.config/geany/templates/templates.README
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
There are several template files in this directory. For these templates you can use wildcards.
|
| 2 |
+
For more information read the documentation (in /usr/share/doc/geany/html/index.html or visit https://www.geany.org/).
|
bundle/envs/geany/seed/Documents/shop/settings.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Settings for the corner shop web app."""
|
| 2 |
+
|
| 3 |
+
APP_NAME = "Corner Shop"
|
| 4 |
+
DEBUG = True
|
| 5 |
+
HOST = "127.0.0.1"
|
| 6 |
+
PORT = 8000
|
| 7 |
+
DATABASE_URL = "sqlite:///shop.db"
|
| 8 |
+
ITEMS_PER_PAGE = 20
|
| 9 |
+
CURRENCY = "EUR"
|
bundle/evals/geany.toml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
tasks = ["debug-off"]
|
bundle/tasks/debug-off.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{"id":"env","type":"deploy_env","env_id":"geany"},
|
| 3 |
+
{"id":"agent","type":"deploy_agent","env_ids":["geany"]},
|
| 4 |
+
{"id":"skills","type":"add_skills","env_ids":["geany"]},
|
| 5 |
+
{"id":"record","type":"start_computer_recording","env_id":"geany","name":"agent","depends_on":["env"]},
|
| 6 |
+
{"id":"task","type":"prompt_agent","depends_on":["skills","record"],"prompt":"In the shop's settings.py open in Geany, turn debug mode off and change the port to 8080, then save the file."},
|
| 7 |
+
{"id":"check","type":"env_outcome_verifier","env_id":"geany","file_artifact_id":"debug-off-check","verifier_id":"debug-off","depends_on":["task"]},
|
| 8 |
+
{"id":"end","type":"end_computer_recording","name":"agent","depends_on":["task"]}
|
| 9 |
+
]
|
bundle/tasks/smoke.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "env",
|
| 4 |
+
"type": "deploy_env",
|
| 5 |
+
"env_id": "geany"
|
| 6 |
+
}
|
| 7 |
+
]
|
media/hero.gif
ADDED
|
Git LFS Details
|
media/solve-1.gif
ADDED
|
Git LFS Details
|
media/solve-1.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b2ba94426fb6834337fc66b2ec0ac8278dcfc44ccca40fbc006337cad6584ec4
|
| 3 |
+
size 428211
|
media/solve-2.gif
ADDED
|
Git LFS Details
|
media/solve-2.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19f60ec4ebb244634399a88668617322dcbcb507b51103b925139cbe6caea246
|
| 3 |
+
size 432107
|
media/solve-3.gif
ADDED
|
Git LFS Details
|
media/solve-3.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a15a337f3615bb205cc984b3c24f56e79ee8aa190465574528bc21cb407505a
|
| 3 |
+
size 431696
|
media/witness.gif
ADDED
|
Git LFS Details
|
media/witness.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69bb47302e1c399c5cbb9e050335e473a268d7a23d42940cd0899971d4db779e
|
| 3 |
+
size 124164
|
results.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"environment": "Geany",
|
| 3 |
+
"app_version": "Geany 2.0 code editor",
|
| 4 |
+
"task": "debug-off",
|
| 5 |
+
"prompt": "In the shop's settings.py open in Geany, turn debug mode off and change the port to 8080, then save the file.",
|
| 6 |
+
"agent": "claude-code",
|
| 7 |
+
"model": "claude-sonnet-5-5",
|
| 8 |
+
"agentenv_framework": "0.9.1431",
|
| 9 |
+
"witness": "verifier failed on the seed, passed after a scripted edit through computer actions, failed again after data/reset",
|
| 10 |
+
"runs": [
|
| 11 |
+
{
|
| 12 |
+
"run": 1,
|
| 13 |
+
"verdict": "passed",
|
| 14 |
+
"turns": 9,
|
| 15 |
+
"usd": 0.88,
|
| 16 |
+
"checks": {
|
| 17 |
+
"debug-off": {
|
| 18 |
+
"score": 1.0,
|
| 19 |
+
"results": [
|
| 20 |
+
{
|
| 21 |
+
"id": "changed",
|
| 22 |
+
"result": true,
|
| 23 |
+
"description": "Documents/shop/settings.py has the line(s) [\"DEBUG = False\",\"PORT = 8080\"]"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"id": "old-gone",
|
| 27 |
+
"result": true,
|
| 28 |
+
"description": "Documents/shop/settings.py has none of the lines [\"DEBUG = True\",\"PORT = 8000\"]"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"id": "rest-kept",
|
| 32 |
+
"result": true,
|
| 33 |
+
"description": "Documents/shop/settings.py has the line(s) [\"APP_NAME = \\\"Corner Shop\\\"\",\"HOST = \\\"127.0.0.1\\\"\",\"DATABASE_URL = \\\"sqlite:///shop.db\\\"\",\"ITEMS_PER_PAGE = 20\",\"CURRENCY = \\\"EUR\\\"\"]"
|
| 34 |
+
}
|
| 35 |
+
]
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"run": 2,
|
| 41 |
+
"verdict": "passed",
|
| 42 |
+
"turns": 9,
|
| 43 |
+
"usd": 0.63,
|
| 44 |
+
"checks": {
|
| 45 |
+
"debug-off": {
|
| 46 |
+
"score": 1.0,
|
| 47 |
+
"results": [
|
| 48 |
+
{
|
| 49 |
+
"id": "changed",
|
| 50 |
+
"result": true,
|
| 51 |
+
"description": "Documents/shop/settings.py has the line(s) [\"DEBUG = False\",\"PORT = 8080\"]"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"id": "old-gone",
|
| 55 |
+
"result": true,
|
| 56 |
+
"description": "Documents/shop/settings.py has none of the lines [\"DEBUG = True\",\"PORT = 8000\"]"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"id": "rest-kept",
|
| 60 |
+
"result": true,
|
| 61 |
+
"description": "Documents/shop/settings.py has the line(s) [\"APP_NAME = \\\"Corner Shop\\\"\",\"HOST = \\\"127.0.0.1\\\"\",\"DATABASE_URL = \\\"sqlite:///shop.db\\\"\",\"ITEMS_PER_PAGE = 20\",\"CURRENCY = \\\"EUR\\\"\"]"
|
| 62 |
+
}
|
| 63 |
+
]
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"run": 3,
|
| 69 |
+
"verdict": "passed",
|
| 70 |
+
"turns": 9,
|
| 71 |
+
"usd": 0.38,
|
| 72 |
+
"checks": {
|
| 73 |
+
"debug-off": {
|
| 74 |
+
"score": 1.0,
|
| 75 |
+
"results": [
|
| 76 |
+
{
|
| 77 |
+
"id": "changed",
|
| 78 |
+
"result": true,
|
| 79 |
+
"description": "Documents/shop/settings.py has the line(s) [\"DEBUG = False\",\"PORT = 8080\"]"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"id": "old-gone",
|
| 83 |
+
"result": true,
|
| 84 |
+
"description": "Documents/shop/settings.py has none of the lines [\"DEBUG = True\",\"PORT = 8000\"]"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"id": "rest-kept",
|
| 88 |
+
"result": true,
|
| 89 |
+
"description": "Documents/shop/settings.py has the line(s) [\"APP_NAME = \\\"Corner Shop\\\"\",\"HOST = \\\"127.0.0.1\\\"\",\"DATABASE_URL = \\\"sqlite:///shop.db\\\"\",\"ITEMS_PER_PAGE = 20\",\"CURRENCY = \\\"EUR\\\"\"]"
|
| 90 |
+
}
|
| 91 |
+
]
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
]
|
| 96 |
+
}
|