REA computer-use environment, v0.1.0
Browse files- README.md +110 -0
- bundle/README.md +40 -0
- bundle/artifacts/poster-headline-check/verify.py +340 -0
- bundle/envs/inkscape/SKILL.md +10 -0
- bundle/envs/inkscape/env.toml +4 -0
- bundle/envs/inkscape/inkscape_app.py +746 -0
- bundle/envs/inkscape/seed/.config/inkscape/cphistory.xml +5 -0
- bundle/envs/inkscape/seed/.config/inkscape/extension-errors.log +42 -0
- bundle/envs/inkscape/seed/.config/inkscape/pages.csv +77 -0
- bundle/envs/inkscape/seed/.config/inkscape/preferences.xml +493 -0
- bundle/envs/inkscape/seed/.local/share/Trash/files/poster.svg +76 -0
- bundle/envs/inkscape/seed/Documents/poster.svg +76 -0
- bundle/evals/inkscape.toml +1 -0
- bundle/tasks/poster-headline.json +9 -0
- bundle/tasks/smoke.json +7 -0
- media/hero.gif +3 -0
- media/solve-1.mp4 +3 -0
- media/solve-2.mp4 +3 -0
- media/solve-3.mp4 +3 -0
- media/witness.mp4 +3 -0
- results.json +81 -0
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pretty_name: Inkscape computer-use environment from a one-line request (REA)
|
| 4 |
+
tags:
|
| 5 |
+
- computer-use
|
| 6 |
+
- cua
|
| 7 |
+
- gui-agent
|
| 8 |
+
- rl-environment
|
| 9 |
+
- agentenv
|
| 10 |
+
- desktop
|
| 11 |
+
- linux
|
| 12 |
+
- rea
|
| 13 |
+
- vector-graphics
|
| 14 |
+
- svg
|
| 15 |
+
- design
|
| 16 |
+
- from-request
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Inkscape: a computer-use environment built from a one-line request
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
|
| 23 |
+
**The real Inkscape 1.2 vector graphics 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.**
|
| 24 |
+
|
| 25 |
+
Claude Code built this environment from a one-line request in about 19 minutes, with only REA's build skill and MCP tools; [How it was made](#how-it-was-made) has the request and the steps. In the environment, Inkscape starts on its first-run Welcome screen with no document open. The agent has to open the poster in `Documents/poster.svg`, change its headline from Spring Plant Swap to Autumn Seed Exchange, and save. It sees only the screen and acts only with the mouse and keyboard.
|
| 26 |
+
|
| 27 |
+
## Watch
|
| 28 |
+
|
| 29 |
+
- 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)
|
| 30 |
+
- Witness, which proves the task can be done through the computer: [witness.mp4](media/witness.mp4)
|
| 31 |
+
|
| 32 |
+
Each video is the computer's own screen recording at 10 frames per second.
|
| 33 |
+
|
| 34 |
+
## The task
|
| 35 |
+
|
| 36 |
+
> Change the poster's headline in Documents/poster.svg to Autumn Seed Exchange and save it.
|
| 37 |
+
|
| 38 |
+
`bundle/artifacts/poster-headline-check/verify.py` reads the app's files through the computer's `data/get` view and passes only if every check holds:
|
| 39 |
+
|
| 40 |
+
| Check | Kind | File |
|
| 41 |
+
| --- | --- | --- |
|
| 42 |
+
| `headline-text` | `value_equals` | `Documents/poster.svg` |
|
| 43 |
+
| `date-unchanged` | `value_equals` | `Documents/poster.svg` |
|
| 44 |
+
|
| 45 |
+
The checks read the saved SVG as XML and find each line of text by its layer label and `id`, never by position: the headline must read "Autumn Seed Exchange" exactly, and the date line must be unchanged. The headline's pointer is identical, character for character, to the one in the hand-built [Inkscape environment](https://huggingface.co/datasets/earakely-scale/InkscapeComputerEnv-REA), though this poster's wording was invented independently.
|
| 46 |
+
|
| 47 |
+
## Results
|
| 48 |
+
|
| 49 |
+
3 of 3 runs passed, about $0.92 per run.
|
| 50 |
+
|
| 51 |
+
| Run | Outcome | Turns | Cost | Video |
|
| 52 |
+
| --- | --- | --- | --- | --- |
|
| 53 |
+
| 1 | passed | 23 | $1.55 | [video](media/solve-1.mp4) |
|
| 54 |
+
| 2 | passed | 21 | $0.51 | [video](media/solve-2.mp4) |
|
| 55 |
+
| 3 | passed | 18 | $0.70 | [video](media/solve-3.mp4) |
|
| 56 |
+
|
| 57 |
+
## Run it
|
| 58 |
+
|
| 59 |
+
You need Docker. `agentenv-framework` builds the computer: Ubuntu 24.04 with the app installed from Ubuntu's archive (`inkscape` 1.2.2).
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
pip install agentenv-framework==0.9.1431
|
| 63 |
+
hf download earakely-scale/InkscapeFromRequestComputerEnv-REA --repo-type dataset --local-dir inkscape-request
|
| 64 |
+
agent-env run inkscape-request/bundle --task poster-headline --agent claude-code --model <model>
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
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.
|
| 68 |
+
|
| 69 |
+
## How it was made
|
| 70 |
+
|
| 71 |
+
Claude Code built this environment from a one-line request, given only [REA](https://github.com/morluto/rea)'s build skill and REA's MCP tools:
|
| 72 |
+
|
| 73 |
+
> Build me an Inkscape environment where the agent changes a poster's headline and saves it.
|
| 74 |
+
|
| 75 |
+
It asked only the three questions the skill asks up front, wrote no app-specific scripts, and finished in about 19 minutes. The steps were REA's usual ones:
|
| 76 |
+
|
| 77 |
+
1. **Capture.** REA launched Inkscape on a Linux desktop and recorded its package, windows and opened files while the edit was made. It also recorded the app's state folders before and after.
|
| 78 |
+
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.
|
| 79 |
+
3. **Task.** The task's checks were validated against the capture: they fail on the starting state and pass on the captured end state.
|
| 80 |
+
4. **Witness.** In a fresh computer, the edit was made through computer actions alone, and the checks were read at four stages. They held on the first try:
|
| 81 |
+
|
| 82 |
+
| Stage | Checks |
|
| 83 |
+
| --- | --- |
|
| 84 |
+
| `seed` | fail, as expected |
|
| 85 |
+
| `after_edit` | pass |
|
| 86 |
+
| `near_miss` | fail, as expected: the headline was retyped as "Autumn Seed Exchnage" |
|
| 87 |
+
| `after_reset` | fail, as expected: `data/reset` restored the seed |
|
| 88 |
+
|
| 89 |
+
The agent runs came after the build: Claude Code with Claude Sonnet 5.5 (`--model anthropic/claude-sonnet-5-5 --no-emulate`, on an amd64 host) solved the task 3 times, each run recorded.
|
| 90 |
+
|
| 91 |
+
## What's inside
|
| 92 |
+
|
| 93 |
+
```
|
| 94 |
+
bundle/ the agentenv bundle: envs/ (app module, seed files), tasks/, artifacts/ (verifier), evals/
|
| 95 |
+
media/ witness and agent-run recordings (MP4) with short GIF previews
|
| 96 |
+
results.json the runs above, with each check's result
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Limits
|
| 100 |
+
|
| 101 |
+
- Inkscape starts on its first-run Welcome screen with no document open, so the agent must open `Documents/poster.svg` itself. That makes this task harder than the hand-built [Inkscape environment](https://huggingface.co/datasets/earakely-scale/InkscapeComputerEnv-REA)'s, where the poster is already open: these runs took 18 to 23 turns, against 10 there.
|
| 102 |
+
- The new headline is longer than the old one and, at 48 pt, runs past the page's right edge. The checks read only the text, so this is cosmetic; all three agents pointed it out and left the size alone.
|
| 103 |
+
- The checks expect the headline to stay one `tspan` inside the `text` with id `headline`, in the layer labelled Layer 1, and to match exactly. A correct-looking poster whose headline was retyped as a new text object, moved to another layer or split over two lines fails.
|
| 104 |
+
- The computer installs whatever `inkscape` Ubuntu 24.04's archive holds at build time (1.2.2 for these runs); it is not pinned.
|
| 105 |
+
- The seed also holds an identical copy of the poster under `~/.local/share/Trash/files`, which the capture picked up; the checks read only `Documents/poster.svg`.
|
| 106 |
+
- Three runs is a small sample: the solve rate shows the task is solvable, not how hard it is.
|
| 107 |
+
|
| 108 |
+
## Licences
|
| 109 |
+
|
| 110 |
+
The bundle code, the task and the synthetic seed files are Apache-2.0. Inkscape itself is not included: the computer installs it from Ubuntu's archive (`inkscape` 1.2.2) at build time, under its own licence (GNU GPL).
|
bundle/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Inkscape computer app
|
| 2 |
+
|
| 3 |
+
Exported by REA's `export-desktop-application` from a capture of the `inkscape` package
|
| 4 |
+
(capture Evidence `ev_0da6a9a44d419cae65e63e9313874ef8b262f45cf66c1c9e0d2d53b4efa84d18`). It was checked against agentenv-framework
|
| 5 |
+
0.9.1431.
|
| 6 |
+
|
| 7 |
+
- `envs/inkscape/` is a computer app on the `ubuntu-24.04` base with the `reference` driver, for
|
| 8 |
+
`amd64` and `arm64`. It installs `inkscape` from the distribution archive, launches `sh -c cd "$HOME" 2>/dev/null; exec 'inkscape'` at boot and is ready
|
| 9 |
+
when a window of class `Inkscape` appears.
|
| 10 |
+
- Owned paths: `~/.config/inkscape`, `~/.local/share/Trash/files`, `~/Documents`.
|
| 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 at checkpoint `seed`.
|
| 13 |
+
Text files and dconf keys spell the capture host's name as `localhost`, `user@host` as `user@localhost`
|
| 14 |
+
and the home as `/home/user`, which the computer respells to its own at boot.
|
| 15 |
+
- `tasks/smoke.json` deploys the app.
|
| 16 |
+
|
| 17 |
+
Run the task with `agent-env run <this folder>`, or only the deploy with `--task smoke`.
|
| 18 |
+
|
| 19 |
+
The seed is synthetic test data made for this showcase; it holds no one's real files.
|
| 20 |
+
|
| 21 |
+
## Task `poster-headline`
|
| 22 |
+
|
| 23 |
+
`tasks/poster-headline.json` deploys the app, has the agent work through the computer from the prompt below, and grades
|
| 24 |
+
the outcome with `artifacts/poster-headline-check/verify.py`, which reads the app's `data/get` views and needs
|
| 25 |
+
no model. `evals/inkscape.toml` names it, so a run of the bundle runs it.
|
| 26 |
+
|
| 27 |
+
> Change the poster's headline in Documents/poster.svg to Autumn Seed Exchange and save it.
|
| 28 |
+
|
| 29 |
+
Checks, each of which must pass:
|
| 30 |
+
|
| 31 |
+
- `headline-text`: `{"kind":"value_equals","file":"Documents/poster.svg","pointer":"/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0","value":"Autumn Seed Exchange"}`
|
| 32 |
+
- `date-unchanged`: `{"kind":"value_equals","file":"Documents/poster.svg","pointer":"/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=event-date]/children/[name=tspan]/children/0","value":"Saturday 12 April, 10 am to 3 pm"}`
|
| 33 |
+
|
| 34 |
+
REA kept the task because its checks fail on the seed (`headline-text`) 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 poster-headline --agent claude-code --model MODEL
|
bundle/artifacts/poster-headline-check/verify.py
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Checks of the task poster-headline against the inkscape 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 math
|
| 8 |
+
import re
|
| 9 |
+
|
| 10 |
+
from agentenv_protocol import client as protocol
|
| 11 |
+
from agentenv_protocol.types import RPC_PATH
|
| 12 |
+
|
| 13 |
+
APP = "inkscape"
|
| 14 |
+
CHECKS = [
|
| 15 |
+
{"id": "headline-text", "kind": "value_equals", "file": "Documents/poster.svg", "pointer": "/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0", "value": "Autumn Seed Exchange"},
|
| 16 |
+
{"id": "date-unchanged", "kind": "value_equals", "file": "Documents/poster.svg", "pointer": "/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=event-date]/children/[name=tspan]/children/0", "value": "Saturday 12 April, 10 am to 3 pm"},
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
MISSING = object()
|
| 20 |
+
INDEX = re.compile(r"0|[1-9][0-9]*")
|
| 21 |
+
VIEW_FORMATS = ("text", "json", "keyfile", "xml")
|
| 22 |
+
NUMERAL = re.compile(r"[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _shown(value) -> str:
|
| 26 |
+
text = json.dumps(value, ensure_ascii=False, separators=(",", ":"))
|
| 27 |
+
return text if len(text) <= 200 else text[:200] + "…"
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _same(actual, expected) -> bool:
|
| 31 |
+
"""JSON equality: numbers by value but never a boolean for a number, objects by their keys, arrays in order."""
|
| 32 |
+
if isinstance(expected, list):
|
| 33 |
+
return (isinstance(actual, list) and len(actual) == len(expected)
|
| 34 |
+
and all(_same(item, wanted) for item, wanted in zip(actual, expected)))
|
| 35 |
+
if isinstance(expected, dict):
|
| 36 |
+
return (isinstance(actual, dict) and len(actual) == len(expected)
|
| 37 |
+
and all(key in actual and _same(actual[key], value) for key, value in expected.items()))
|
| 38 |
+
if isinstance(expected, bool) or isinstance(actual, bool):
|
| 39 |
+
return isinstance(expected, bool) and isinstance(actual, bool) and actual == expected
|
| 40 |
+
if isinstance(expected, (int, float)):
|
| 41 |
+
return isinstance(actual, (int, float)) and actual == expected
|
| 42 |
+
return type(actual) is type(expected) and actual == expected
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _bracketed(token: str) -> bool:
|
| 46 |
+
return len(token) >= 2 and token.startswith("[") and token.endswith("]")
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def _selector(token: str):
|
| 50 |
+
"""A selector's conditions, [KEY=VALUE] or [@KEY=VALUE] one or more times, or None when the token is not one."""
|
| 51 |
+
if not _bracketed(token):
|
| 52 |
+
return None
|
| 53 |
+
conditions = []
|
| 54 |
+
for part in token[1:-1].split("]["):
|
| 55 |
+
key, equals, value = part.partition("=")
|
| 56 |
+
name = key[1:] if key.startswith("@") else key
|
| 57 |
+
if not equals or not name:
|
| 58 |
+
return None
|
| 59 |
+
conditions.append((key.startswith("@"), name, value))
|
| 60 |
+
return conditions
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _selects(member, conditions) -> bool:
|
| 64 |
+
"""Whether an array member meets every condition; selectors compare strings only."""
|
| 65 |
+
if not isinstance(member, dict):
|
| 66 |
+
return False
|
| 67 |
+
for attribute, key, value in conditions:
|
| 68 |
+
fields = member.get("attributes") if attribute else member
|
| 69 |
+
if not isinstance(fields, dict) or not isinstance(fields.get(key), str) or fields[key] != value:
|
| 70 |
+
return False
|
| 71 |
+
return True
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def _step(items: list, token: str, last: bool):
|
| 75 |
+
"""One step into an array, by index or by a selector that must match one member, or none when it is the last."""
|
| 76 |
+
if INDEX.fullmatch(token):
|
| 77 |
+
return ("member", items[int(token)]) if int(token) < len(items) else ("none", None)
|
| 78 |
+
conditions = _selector(token)
|
| 79 |
+
if conditions is None:
|
| 80 |
+
return ("unresolved", f"{token} is not a selector of the form [KEY=VALUE]") if _bracketed(token) else (
|
| 81 |
+
"none", None)
|
| 82 |
+
matched = [item for item in items if _selects(item, conditions)]
|
| 83 |
+
if len(matched) == 1:
|
| 84 |
+
return "member", matched[0]
|
| 85 |
+
if len(matched) > 1:
|
| 86 |
+
return "unresolved", f"{token} matches {len(matched)} members, not one"
|
| 87 |
+
return ("none" if last else "unresolved"), f"{token} matches no member"
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def _locate(view, pointer: str):
|
| 91 |
+
"""Where a pointer leads: ("value", value), ("none", why or None) or ("unresolved", problem), with the pointers
|
| 92 |
+
to the arrays a selector searched on the way."""
|
| 93 |
+
current, searched = view, []
|
| 94 |
+
segments = pointer[1:].split("/")
|
| 95 |
+
for position, segment in enumerate(segments):
|
| 96 |
+
token = segment.replace("~1", "/").replace("~0", "~")
|
| 97 |
+
if isinstance(current, list):
|
| 98 |
+
if not INDEX.fullmatch(token) and _selector(token) is not None:
|
| 99 |
+
searched.append("".join("/" + part for part in segments[:position]))
|
| 100 |
+
kind, found = _step(current, token, position == len(segments) - 1)
|
| 101 |
+
if kind != "member":
|
| 102 |
+
return kind, found, searched
|
| 103 |
+
current = found
|
| 104 |
+
elif isinstance(current, dict) and token in current:
|
| 105 |
+
current = current[token]
|
| 106 |
+
else:
|
| 107 |
+
return "none", None, searched
|
| 108 |
+
return "value", current, searched
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def _number(value):
|
| 112 |
+
"""A number, or a numeral string read as one; None for anything else, a boolean, or a numeral past the doubles."""
|
| 113 |
+
if isinstance(value, bool):
|
| 114 |
+
return None
|
| 115 |
+
if isinstance(value, (int, float)):
|
| 116 |
+
return value
|
| 117 |
+
if not isinstance(value, str) or not NUMERAL.fullmatch(value):
|
| 118 |
+
return None
|
| 119 |
+
number = float(value)
|
| 120 |
+
return number if math.isfinite(number) else None
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def _entry_leaves_out(entry) -> bool:
|
| 124 |
+
return isinstance(entry, dict) and (isinstance(entry.get("view_error"), str) or (
|
| 125 |
+
entry.get("format") in ("text", "xml") and isinstance(entry.get("view"), dict)
|
| 126 |
+
and entry["view"].get("truncated") is True))
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def _viewless_entry(view, pointer: str):
|
| 130 |
+
"""The name of the entry whose view a pointer goes into when it has none, so its null is no JSON value, and
|
| 131 |
+
why: binary, unread, or of a format without a view; None when it has one."""
|
| 132 |
+
parts = pointer[1:].split("/")
|
| 133 |
+
if len(parts) < 3 or parts[0] != "entries" or parts[2] != "view":
|
| 134 |
+
return None
|
| 135 |
+
kind, item, _ = _locate(view, "/entries/" + parts[1])
|
| 136 |
+
if kind != "value" or not isinstance(item, dict):
|
| 137 |
+
return None
|
| 138 |
+
if isinstance(item.get("view_error"), str):
|
| 139 |
+
reason = f"has no view: {item['view_error']}"
|
| 140 |
+
elif item.get("format") == "binary":
|
| 141 |
+
reason = "is binary and has no view"
|
| 142 |
+
elif item.get("format") not in VIEW_FORMATS:
|
| 143 |
+
reason = "has no view"
|
| 144 |
+
else:
|
| 145 |
+
return None
|
| 146 |
+
return (item["name"] if isinstance(item.get("name"), str) else ""), reason
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def _array_leaves_out(form, view, array: str) -> bool:
|
| 150 |
+
"""Whether an array a selector searched may lack members: in a zip the listing or its entry's view, else the
|
| 151 |
+
view's own truncation."""
|
| 152 |
+
if form != "zip":
|
| 153 |
+
return _truncated(form, view)
|
| 154 |
+
if array == "/entries":
|
| 155 |
+
return isinstance(view, dict) and view.get("truncated") is True
|
| 156 |
+
return _zip_leaves_out(view, array)
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def _zip_leaves_out(view, pointer: str) -> bool:
|
| 160 |
+
"""Whether a zip view leaves out what a pointer reaches: for a pointer into one listed entry, only that entry."""
|
| 161 |
+
if not isinstance(view, dict):
|
| 162 |
+
return False
|
| 163 |
+
parts = pointer[1:].split("/")
|
| 164 |
+
if parts[0] == "entries" and len(parts) > 1:
|
| 165 |
+
kind, entry, _ = _locate(view, "/entries/" + parts[1])
|
| 166 |
+
return _entry_leaves_out(entry) if kind == "value" else view.get("truncated") is True
|
| 167 |
+
entries = view.get("entries") if isinstance(view.get("entries"), list) else []
|
| 168 |
+
return view.get("truncated") is True or any(_entry_leaves_out(entry) for entry in entries)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def _truncated(form, view) -> bool:
|
| 172 |
+
if not isinstance(view, dict):
|
| 173 |
+
return False
|
| 174 |
+
if form in ("text", "xml"):
|
| 175 |
+
return view.get("truncated") is True
|
| 176 |
+
if form != "sqlite":
|
| 177 |
+
return False
|
| 178 |
+
tables = view.get("tables")
|
| 179 |
+
return view.get("tables_truncated") is True or any(
|
| 180 |
+
isinstance(table, dict) and (table.get("truncated") is True or isinstance(table.get("error"), str))
|
| 181 |
+
for table in (tables.values() if isinstance(tables, dict) else []))
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def _view_of(check, entry, form):
|
| 185 |
+
"""The view, whether it is truncated, and why the check cannot read it; an absent file reads as empty."""
|
| 186 |
+
if entry is None:
|
| 187 |
+
return None, False, None
|
| 188 |
+
if isinstance(entry.get("error"), str):
|
| 189 |
+
return None, False, f"{check['file']} has no view: {entry['error']}"
|
| 190 |
+
if entry.get("format") in (None, "binary"):
|
| 191 |
+
return None, False, f"{check['file']} is binary and has no view"
|
| 192 |
+
if form is not None and entry.get("format") != form:
|
| 193 |
+
return None, False, f"{check['file']} is read as {entry.get('format')}, not {form}"
|
| 194 |
+
return entry.get("view"), _truncated(entry.get("format"), entry.get("view")), None
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def _undecided(check):
|
| 198 |
+
return False, f"the view of {check['file']} is truncated, so what it leaves out is unknown"
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def _compared(check, n: int, what: str):
|
| 202 |
+
operator = next(key for key in ("equals", "at_least", "at_most") if check.get(key) is not None)
|
| 203 |
+
expected = check[operator]
|
| 204 |
+
met = n == expected if operator == "equals" else n >= expected if operator == "at_least" else n <= expected
|
| 205 |
+
return met, f"{n} {what}, expected {operator.replace('_', ' ')} {expected}"
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def _lines(check, entry):
|
| 209 |
+
view, truncated, problem = _view_of(check, entry, "text")
|
| 210 |
+
if problem is not None:
|
| 211 |
+
return False, problem
|
| 212 |
+
lines = view.get("lines") if isinstance(view, dict) and isinstance(view.get("lines"), list) else []
|
| 213 |
+
lines = [line for line in lines if isinstance(line, str)]
|
| 214 |
+
file = check["file"]
|
| 215 |
+
if check["kind"] == "lines_present":
|
| 216 |
+
missing = next((line for line in check["lines"] if line not in lines), None)
|
| 217 |
+
return (True, f"{file} has the line(s) {_shown(check['lines'])}") if missing is None else (
|
| 218 |
+
False, f"{file} has no line {_shown(missing)}")
|
| 219 |
+
if truncated:
|
| 220 |
+
return _undecided(check)
|
| 221 |
+
if check["kind"] == "lines_absent":
|
| 222 |
+
found = next((line for line in check["lines"] if line in lines), None)
|
| 223 |
+
return (True, f"{file} has none of the lines {_shown(check['lines'])}") if found is None else (
|
| 224 |
+
False, f"{file} still has the line {_shown(found)}")
|
| 225 |
+
if check.get("contains") is not None:
|
| 226 |
+
n = sum(1 for line in lines if check["contains"] in line)
|
| 227 |
+
return _compared(check, n, f"line(s) of {file} contain {_shown(check['contains'])}")
|
| 228 |
+
n = sum(1 for line in lines if line == check["exact"])
|
| 229 |
+
return _compared(check, n, f"line(s) of {file} match {_shown(check['exact'])}")
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def _near(at: str, found, expected, tolerance):
|
| 233 |
+
"""A value compared within a tolerance: numbers, and numeral strings, by their difference."""
|
| 234 |
+
number = _number(found)
|
| 235 |
+
within = f"within {_shown(tolerance)} of {_shown(expected)}"
|
| 236 |
+
if number is None:
|
| 237 |
+
return False, f"{at} is {_shown(found)}, not a number"
|
| 238 |
+
if abs(number - expected) <= tolerance:
|
| 239 |
+
return True, f"{at} is {_shown(found)}, {within}"
|
| 240 |
+
return False, f"{at} is {_shown(found)}, not {within}"
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
def _value(check, entry):
|
| 244 |
+
view, truncated, problem = _view_of(check, entry, None)
|
| 245 |
+
if problem is not None:
|
| 246 |
+
return False, problem
|
| 247 |
+
kind, found, searched = ("none", None, []) if entry is None else _locate(view, check["pointer"])
|
| 248 |
+
at = f"{check['file']} at {check['pointer']}"
|
| 249 |
+
viewless = _viewless_entry(view, check["pointer"]) if entry is not None and entry.get("format") == "zip" else None
|
| 250 |
+
if viewless is not None:
|
| 251 |
+
return False, f"{check['file']} entry {viewless[0]} {viewless[1]}"
|
| 252 |
+
# A selector tells one member from several only in an array the view holds whole.
|
| 253 |
+
if any(_array_leaves_out(entry.get("format"), view, array) for array in searched):
|
| 254 |
+
return _undecided(check)
|
| 255 |
+
if kind == "unresolved":
|
| 256 |
+
return False, f"{at}: {found}"
|
| 257 |
+
if entry is not None and entry.get("format") == "zip":
|
| 258 |
+
truncated = _zip_leaves_out(view, check["pointer"])
|
| 259 |
+
if check["kind"] == "value_equals" and isinstance(check["value"], (dict, list)) and truncated:
|
| 260 |
+
return _undecided(check)
|
| 261 |
+
if check["kind"] == "value_equals":
|
| 262 |
+
if kind == "none":
|
| 263 |
+
return False, f"{at} has no value" if found is None else f"{at}: {found}"
|
| 264 |
+
expected = check["value"]
|
| 265 |
+
if check.get("tolerance") is not None and isinstance(expected, (int, float)) and not isinstance(expected, bool):
|
| 266 |
+
return _near(at, found, expected, check["tolerance"])
|
| 267 |
+
if _same(found, check["value"]):
|
| 268 |
+
return True, f"{at} is {_shown(check['value'])}"
|
| 269 |
+
return False, f"{at} is {_shown(found)}, not {_shown(check['value'])}"
|
| 270 |
+
if truncated:
|
| 271 |
+
return _undecided(check)
|
| 272 |
+
return (True, f"{at} has no value") if kind == "none" else (False, f"{at} is {_shown(found)}")
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def _rows(check, entry):
|
| 276 |
+
view, _, problem = _view_of(check, entry, "sqlite")
|
| 277 |
+
if problem is not None:
|
| 278 |
+
return False, problem
|
| 279 |
+
view = view if isinstance(view, dict) else {}
|
| 280 |
+
tables = view.get("tables") if isinstance(view.get("tables"), dict) else {}
|
| 281 |
+
table = tables[check["table"]] if check["table"] in tables else MISSING
|
| 282 |
+
name = f"{check['file']} table {check['table']}"
|
| 283 |
+
if table is MISSING and view.get("tables_truncated") is True:
|
| 284 |
+
return _undecided(check)
|
| 285 |
+
table = table if isinstance(table, dict) else {}
|
| 286 |
+
if isinstance(table.get("error"), str):
|
| 287 |
+
return False, f"{name} could not be read: {table['error']}"
|
| 288 |
+
columns = table.get("columns") if isinstance(table.get("columns"), list) else []
|
| 289 |
+
rows = table.get("rows") if isinstance(table.get("rows"), list) else []
|
| 290 |
+
where = check.get("where") or {}
|
| 291 |
+
|
| 292 |
+
def matches(row) -> bool:
|
| 293 |
+
return isinstance(row, list) and all(
|
| 294 |
+
column in columns and columns.index(column) < len(row) and _same(row[columns.index(column)], value)
|
| 295 |
+
for column, value in where.items())
|
| 296 |
+
|
| 297 |
+
n = sum(1 for row in rows if matches(row))
|
| 298 |
+
if check["kind"] == "row_present":
|
| 299 |
+
return (n > 0, f"{name} has a row with {_shown(where)}" if n > 0 else f"{name} has no row with {_shown(where)}")
|
| 300 |
+
if table.get("truncated") is True:
|
| 301 |
+
return _undecided(check)
|
| 302 |
+
if check["kind"] == "row_absent":
|
| 303 |
+
return (True, f"{name} has no row with {_shown(where)}") if n == 0 else (
|
| 304 |
+
False, f"{name} has {n} row(s) with {_shown(where)}")
|
| 305 |
+
return _compared(check, n, f"row(s) of {name}" + (f" with {_shown(where)}" if "where" in check else ""))
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
def _verdict(check, entry):
|
| 309 |
+
kind = check["kind"]
|
| 310 |
+
if kind == "file_present":
|
| 311 |
+
return (entry is not None, f"{check['file']} exists" if entry is not None else f"{check['file']} does not exist")
|
| 312 |
+
if kind == "file_absent":
|
| 313 |
+
return (entry is None, f"{check['file']} does not exist" if entry is None else f"{check['file']} exists")
|
| 314 |
+
if kind in ("lines_present", "lines_absent", "line_count"):
|
| 315 |
+
return _lines(check, entry)
|
| 316 |
+
if kind in ("value_equals", "value_absent"):
|
| 317 |
+
return _value(check, entry)
|
| 318 |
+
return _rows(check, entry)
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
def evaluate(checks: list, views: dict) -> list:
|
| 322 |
+
"""One result per check against the views data/get returned, by home path."""
|
| 323 |
+
results = []
|
| 324 |
+
for check in checks:
|
| 325 |
+
passed, description = _verdict(check, views.get(check["file"]))
|
| 326 |
+
results.append({"id": check["id"], "result": passed, "description": description})
|
| 327 |
+
return results
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
async def verify(mcp_url, env_url):
|
| 331 |
+
card = await protocol.get_card(env_url)
|
| 332 |
+
child = protocol.find_child(card, APP)
|
| 333 |
+
if child is None:
|
| 334 |
+
raise RuntimeError(f"the computer at {env_url} lists no app named {APP}")
|
| 335 |
+
answer = await protocol.get_data(env_url + (child.get("url") or RPC_PATH).removesuffix(RPC_PATH), timeout=120)
|
| 336 |
+
states = [part.data["state"] for part in answer.parts
|
| 337 |
+
if part.kind == "data" and isinstance(part.data.get("state"), dict)]
|
| 338 |
+
if not states:
|
| 339 |
+
raise RuntimeError(f"the {APP} app's data/get returned no state views")
|
| 340 |
+
return evaluate(CHECKS, states[0])
|
bundle/envs/inkscape/SKILL.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: Use Inkscape on this Linux desktop; its window has class Inkscape.
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Inkscape
|
| 6 |
+
|
| 7 |
+
Inkscape is open on the desktop at boot. Its window's class is `Inkscape`.
|
| 8 |
+
|
| 9 |
+
Its files live under `~/.config/inkscape`, `~/.local/share/Trash/files`, `~/Documents`. Work through the application's own
|
| 10 |
+
window and dialogs; the result is read from those files.
|
bundle/envs/inkscape/env.toml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
type = "computer_app"
|
| 2 |
+
module = "inkscape_app.py:Inkscape"
|
| 3 |
+
computer = "ubuntu-24.04"
|
| 4 |
+
driver = "reference"
|
bundle/envs/inkscape/inkscape_app.py
ADDED
|
@@ -0,0 +1,746 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Inkscape as an agentenv computer app, exported by REA from a desktop application capture.
|
| 2 |
+
|
| 3 |
+
Package: inkscape (captured at 1.2.2-2ubuntu12). Capture Evidence: ev_0da6a9a44d419cae65e63e9313874ef8b262f45cf66c1c9e0d2d53b4efa84d18.
|
| 4 |
+
The seed is synthetic test data made for this showcase.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import contextlib
|
| 10 |
+
import copy
|
| 11 |
+
import hashlib
|
| 12 |
+
import io
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import os
|
| 16 |
+
import re
|
| 17 |
+
import sqlite3
|
| 18 |
+
import struct
|
| 19 |
+
import subprocess
|
| 20 |
+
import sys
|
| 21 |
+
import tempfile
|
| 22 |
+
import zipfile
|
| 23 |
+
import zlib
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
from xml.parsers import expat
|
| 26 |
+
|
| 27 |
+
from agentenv_protocol import add_data, get_data, reset_data
|
| 28 |
+
from agentenv_protocol.computer import AptSource, ComputerAppEnvironment, Download, Launch, Packages, Ready, RunScript, computer_app, linux, ready_check
|
| 29 |
+
from agentenv_protocol.computer.app_data import INITIAL, add, get, in_thread, keep_initial, reset
|
| 30 |
+
from agentenv_protocol.types import DataPart
|
| 31 |
+
|
| 32 |
+
HERE = Path(__file__).resolve().parent
|
| 33 |
+
SEED_HOME = "/home/user"
|
| 34 |
+
PATHS = [".config/inkscape", ".local/share/Trash/files", "Documents"]
|
| 35 |
+
DCONF = ""
|
| 36 |
+
TEXT_SEEDS = frozenset([".config/inkscape/cphistory.xml", ".config/inkscape/extension-errors.log", ".config/inkscape/pages.csv", ".config/inkscape/preferences.xml", ".local/share/Trash/files/poster.svg", "Documents/poster.svg"])
|
| 37 |
+
WINDOW_CLASS = "Inkscape"
|
| 38 |
+
|
| 39 |
+
XML_SUFFIXES = (".xml", ".xbel", ".plist", ".svg", ".ui")
|
| 40 |
+
GROUP_HEADER = re.compile(r"^\[([^\]]+)\]$")
|
| 41 |
+
LINE_BREAK = re.compile(r"\r?\n")
|
| 42 |
+
SQLITE_HEADER = b"SQLite format 3\x00"
|
| 43 |
+
GVDB_HEADER = b"GVariant"
|
| 44 |
+
ZIP_HEADER = b"PK\x03\x04"
|
| 45 |
+
XML_SPACE = "xml:space"
|
| 46 |
+
MAX_VIEW_BYTES = 64 * 1024 * 1024
|
| 47 |
+
MAX_SAFE_INTEGER = 2**53 - 1
|
| 48 |
+
MAX_TABLES = 64
|
| 49 |
+
MAX_ROWS = 500
|
| 50 |
+
MAX_LINES = 5000
|
| 51 |
+
MAX_XML_NODES = 5000
|
| 52 |
+
MAX_XML_DEPTH = 64
|
| 53 |
+
SQLITE_BUSY_S = 0.25
|
| 54 |
+
MAX_PARSED_BYTES = 4 * 1024 * 1024
|
| 55 |
+
MAX_JSON_VIEW_DEPTH = 500
|
| 56 |
+
JSON_TOO_DEEP = f"nested deeper than the {MAX_JSON_VIEW_DEPTH} levels a JSON view keeps"
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def _respelled(text: str, home: Path) -> str:
|
| 60 |
+
"""The seed's home path respelled to this computer's home, only where a whole path segment ends after it."""
|
| 61 |
+
return re.sub(re.escape(SEED_HOME) + r"(?![\w.@+~-])", lambda _: str(home), text)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _respelled_utf16(data: bytes, home: Path) -> bytes:
|
| 65 |
+
"""A UTF-16 text file with a byte-order mark respelled like a text seed, its mark kept; any other bytes as given."""
|
| 66 |
+
for mark, codec in ((b"\xff\xfe", "utf-16-le"), (b"\xfe\xff", "utf-16-be")):
|
| 67 |
+
if data.startswith(mark):
|
| 68 |
+
try:
|
| 69 |
+
text = data[len(mark):].decode(codec)
|
| 70 |
+
except UnicodeDecodeError:
|
| 71 |
+
return data
|
| 72 |
+
return mark + _respelled(text, home).encode(codec) if SEED_HOME in text else data
|
| 73 |
+
return data
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
#: What marks a window as not yet the app's own: skipping the taskbar, as splash screens and dialogs do, or a splash type.
|
| 77 |
+
SPLASH_MARKS = ("_NET_WM_STATE_SKIP_TASKBAR", "_NET_WM_WINDOW_TYPE_SPLASH")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def _taskbar_window(window_class: str) -> bool:
|
| 81 |
+
"""Whether a top-level window of the given class that the taskbar lists is shown; a splash screen or a dialog
|
| 82 |
+
skips the taskbar."""
|
| 83 |
+
def xprop(*args: str) -> str:
|
| 84 |
+
done = subprocess.run(["xprop", *args], capture_output=True, text=True)
|
| 85 |
+
return done.stdout if done.returncode == 0 else ""
|
| 86 |
+
|
| 87 |
+
for window in re.findall(r"0x[0-9a-f]+", xprop("-root", "_NET_CLIENT_LIST").partition("#")[2]):
|
| 88 |
+
props = xprop("-id", window, "WM_CLASS", "_NET_WM_STATE", "_NET_WM_WINDOW_TYPE")
|
| 89 |
+
classes = re.findall(r'"((?:[^"\\]|\\.)*)"', props.partition("WM_CLASS")[2].split("\n", 1)[0])
|
| 90 |
+
if window_class in classes and not any(mark in props for mark in SPLASH_MARKS):
|
| 91 |
+
return True
|
| 92 |
+
return False
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def _seed_home(home: Path) -> None:
|
| 96 |
+
"""Copy the captured files into this computer's home; text files, UTF-16 ones too, have the seed's home path
|
| 97 |
+
respelled."""
|
| 98 |
+
seed = HERE / "seed"
|
| 99 |
+
for source in sorted(seed.rglob("*")) if seed.is_dir() else []:
|
| 100 |
+
if not source.is_file():
|
| 101 |
+
continue
|
| 102 |
+
relative = source.relative_to(seed).as_posix()
|
| 103 |
+
target = home / relative
|
| 104 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 105 |
+
data = source.read_bytes()
|
| 106 |
+
if relative in TEXT_SEEDS:
|
| 107 |
+
data = _respelled(data.decode("utf-8"), home).encode("utf-8")
|
| 108 |
+
else:
|
| 109 |
+
data = _respelled_utf16(data, home)
|
| 110 |
+
target.write_bytes(data)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def _dconf(arguments: list, environment: dict) -> str:
|
| 114 |
+
return subprocess.run(["dconf", *arguments], env={**os.environ, **environment}, capture_output=True, text=True,
|
| 115 |
+
check=True).stdout
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def _load_dconf(home: Path) -> None:
|
| 119 |
+
"""Compile the captured dconf keys into the user database without D-Bus, which is not up yet. Keys already there
|
| 120 |
+
stay unless captured: dconf compile reads the key files in name order and a later file wins. A failure is
|
| 121 |
+
reported and the app starts without them."""
|
| 122 |
+
if not DCONF:
|
| 123 |
+
return
|
| 124 |
+
database = home / ".config" / "dconf" / "user"
|
| 125 |
+
try:
|
| 126 |
+
database.parent.mkdir(parents=True, exist_ok=True)
|
| 127 |
+
with tempfile.TemporaryDirectory(dir=database.parent) as scratch:
|
| 128 |
+
keyfiles = Path(scratch, "keyfiles")
|
| 129 |
+
keyfiles.mkdir()
|
| 130 |
+
if database.is_file():
|
| 131 |
+
profile = Path(scratch, "profile")
|
| 132 |
+
profile.write_text(f"file-db:{database}\n")
|
| 133 |
+
existing = _dconf(["dump", "/"], {"DCONF_PROFILE": str(profile)})
|
| 134 |
+
(keyfiles / "00-existing").write_text(existing)
|
| 135 |
+
(keyfiles / "01-captured").write_text(_respelled(DCONF, home))
|
| 136 |
+
_dconf(["compile", str(Path(scratch, "user")), str(keyfiles)], {})
|
| 137 |
+
os.replace(Path(scratch, "user"), database)
|
| 138 |
+
except (OSError, subprocess.CalledProcessError) as error:
|
| 139 |
+
detail = (getattr(error, "stderr", None) or "").strip().splitlines()
|
| 140 |
+
print(f"warning: the captured dconf settings were not loaded: {detail[-1] if detail else error}",
|
| 141 |
+
file=sys.stderr)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def _sqlite_text(data: bytes):
|
| 145 |
+
text = data.decode("utf-8", "replace")
|
| 146 |
+
return {"text": text, "bytes_hex": data.hex()} if "�" in text else text
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def _cell(value):
|
| 150 |
+
if isinstance(value, bytes):
|
| 151 |
+
return {"blob_hex": value.hex()}
|
| 152 |
+
if isinstance(value, int) and abs(value) > MAX_SAFE_INTEGER:
|
| 153 |
+
return {"integer": str(value)}
|
| 154 |
+
# JSON has no infinities or negative zero; REA's SQLite reader spells them as strings.
|
| 155 |
+
if isinstance(value, float) and (math.isinf(value) or (value == 0 and math.copysign(1, value) < 0)):
|
| 156 |
+
return "Infinity" if value == math.inf else "-Infinity" if value == -math.inf else "-0"
|
| 157 |
+
return value
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def _table(db, name: str, primary_key: list) -> dict:
|
| 161 |
+
quoted = '"' + name.replace('"', '""') + '"'
|
| 162 |
+
cursor = db.execute(f"select * from main.{quoted} not indexed limit {MAX_ROWS + 1}")
|
| 163 |
+
rows = [[_cell(value) for value in row] for row in cursor]
|
| 164 |
+
return {"columns": [column[0] for column in cursor.description], "primary_key": primary_key,
|
| 165 |
+
"rows": rows[:MAX_ROWS], "truncated": len(rows) > MAX_ROWS}
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def _sqlite(path: Path) -> dict:
|
| 169 |
+
"""The database's ordinary tables, in schema order, up to REA's table and row limits."""
|
| 170 |
+
with contextlib.closing(sqlite3.connect(path.resolve().as_uri() + "?mode=ro", uri=True, timeout=SQLITE_BUSY_S)) as db:
|
| 171 |
+
kinds = dict(db.execute("select name, type from pragma_table_list where schema = 'main'"))
|
| 172 |
+
names = [name for (name,) in db.execute("select name from sqlite_schema where type = 'table'")
|
| 173 |
+
if kinds.get(name) == "table"]
|
| 174 |
+
keys = {name: [key for (key,) in db.execute(
|
| 175 |
+
"select name from pragma_table_info(?, 'main') where pk > 0 order by pk", (name,))]
|
| 176 |
+
for name in names[:MAX_TABLES]}
|
| 177 |
+
db.text_factory = _sqlite_text
|
| 178 |
+
tables = {name: _table(db, name, keys[name]) for name in names[:MAX_TABLES]}
|
| 179 |
+
cut = len(names) > MAX_TABLES
|
| 180 |
+
return {"format": "sqlite", "view": {"tables": tables, "tables_truncated": cut},
|
| 181 |
+
"truncated": cut or any(table["truncated"] for table in tables.values())}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def _text(text: str) -> dict:
|
| 185 |
+
lines = LINE_BREAK.split(text)
|
| 186 |
+
if lines[-1] == "":
|
| 187 |
+
lines.pop()
|
| 188 |
+
view = {"lines": lines[:MAX_LINES], "line_count": len(lines), "truncated": len(lines) > MAX_LINES}
|
| 189 |
+
return {"format": "text", "view": view, "truncated": view["truncated"]}
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def _keyfile_line(raw: str) -> tuple:
|
| 193 |
+
"""A key file line as REA reads it: skip (blank or comment), group, entry or other."""
|
| 194 |
+
line = raw.strip()
|
| 195 |
+
if not line or line[0] in "#;":
|
| 196 |
+
return ("skip",)
|
| 197 |
+
header = GROUP_HEADER.match(line)
|
| 198 |
+
if header:
|
| 199 |
+
return ("group", header.group(1))
|
| 200 |
+
key, equals, value = line.partition("=")
|
| 201 |
+
return ("entry", key.strip(), value.strip()) if equals and key else ("other",)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def _is_keyfile(text: str) -> bool:
|
| 205 |
+
"""REA's rule: at least one group, and nothing a key file view would drop."""
|
| 206 |
+
kinds = {_keyfile_line(line)[0] for line in LINE_BREAK.split(text)}
|
| 207 |
+
return "group" in kinds and "other" not in kinds
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def _keyfile(text: str) -> dict:
|
| 211 |
+
groups, group = {}, ""
|
| 212 |
+
for line in map(_keyfile_line, LINE_BREAK.split(text)):
|
| 213 |
+
if line[0] == "group":
|
| 214 |
+
group = line[1]
|
| 215 |
+
groups.setdefault(group, {})
|
| 216 |
+
elif line[0] == "entry":
|
| 217 |
+
groups.setdefault(group, {})[line[1]] = line[2]
|
| 218 |
+
return groups
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def _expat(namespaces: bool):
|
| 222 |
+
"""An expat parser that refuses DOCTYPEs as REA does; with namespaces it also enforces their rules, as REA's
|
| 223 |
+
parser does, and without them it reports names as the document spells them."""
|
| 224 |
+
parser = expat.ParserCreate(namespace_separator=" " if namespaces else None)
|
| 225 |
+
|
| 226 |
+
def doctype(*_) -> None:
|
| 227 |
+
raise ValueError("the document declares a DOCTYPE")
|
| 228 |
+
|
| 229 |
+
parser.StartDoctypeDeclHandler = doctype
|
| 230 |
+
return parser
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class _XmlReader:
|
| 234 |
+
"""REA's XML view built as expat reads: names as spelled, declarations as attributes, text split where REA's DOM
|
| 235 |
+
splits it (an empty CDATA section joins the text around it), and each node counted against REA's limits."""
|
| 236 |
+
|
| 237 |
+
def __init__(self) -> None:
|
| 238 |
+
self.remaining, self.truncated, self.root = MAX_XML_NODES, False, None
|
| 239 |
+
#: Per open element: its view or None when left out, whether xml:space="preserve" applies inside it, and
|
| 240 |
+
#: whether it holds an element, which makes whitespace-only text in it formatting.
|
| 241 |
+
self.open = []
|
| 242 |
+
self.text, self.cdata = [], None
|
| 243 |
+
|
| 244 |
+
def read(self, text: str) -> None:
|
| 245 |
+
parser = _expat(False)
|
| 246 |
+
parser.buffer_text = True
|
| 247 |
+
parser.StartElementHandler, parser.EndElementHandler = self._start, self._end
|
| 248 |
+
parser.CharacterDataHandler = self._data
|
| 249 |
+
parser.StartCdataSectionHandler, parser.EndCdataSectionHandler = self._cdata_start, self._cdata_end
|
| 250 |
+
parser.CommentHandler = parser.ProcessingInstructionHandler = self._other
|
| 251 |
+
parser.Parse(text, True)
|
| 252 |
+
|
| 253 |
+
def _admit(self) -> bool:
|
| 254 |
+
"""Whether the next node inside a kept element is kept, within the node and depth limits; one past them
|
| 255 |
+
marks the view truncated."""
|
| 256 |
+
if self.open and self.open[-1][0] is None:
|
| 257 |
+
return False
|
| 258 |
+
if self.remaining <= 0 or len(self.open) > MAX_XML_DEPTH:
|
| 259 |
+
self.truncated = True
|
| 260 |
+
return False
|
| 261 |
+
self.remaining -= 1
|
| 262 |
+
return True
|
| 263 |
+
|
| 264 |
+
def _text_node(self, text: str) -> None:
|
| 265 |
+
if self._admit():
|
| 266 |
+
self.open[-1][0]["children"].append(text)
|
| 267 |
+
|
| 268 |
+
def _flush(self) -> None:
|
| 269 |
+
if self.text:
|
| 270 |
+
text, self.text = "".join(self.text), []
|
| 271 |
+
self._text_node(text)
|
| 272 |
+
|
| 273 |
+
def _data(self, text: str) -> None:
|
| 274 |
+
(self.text if self.cdata is None else self.cdata).append(text)
|
| 275 |
+
|
| 276 |
+
def _cdata_start(self) -> None:
|
| 277 |
+
self.cdata = []
|
| 278 |
+
|
| 279 |
+
def _cdata_end(self) -> None:
|
| 280 |
+
text, self.cdata = "".join(self.cdata), None
|
| 281 |
+
if text:
|
| 282 |
+
self._flush()
|
| 283 |
+
self._text_node(text)
|
| 284 |
+
|
| 285 |
+
def _other(self, *_) -> None:
|
| 286 |
+
"""A comment or processing instruction, counted like any node and never kept."""
|
| 287 |
+
self._flush()
|
| 288 |
+
if self.open:
|
| 289 |
+
self._admit()
|
| 290 |
+
|
| 291 |
+
def _start(self, name: str, attributes: dict) -> None:
|
| 292 |
+
self._flush()
|
| 293 |
+
parent = self.open[-1] if self.open else [None, False, False]
|
| 294 |
+
parent[2] = True
|
| 295 |
+
view = {"name": name, "attributes": attributes, "children": []} if self._admit() else None
|
| 296 |
+
if view is not None and parent[0] is not None:
|
| 297 |
+
parent[0]["children"].append(view)
|
| 298 |
+
space = attributes.get(XML_SPACE)
|
| 299 |
+
self.open.append([view, space == "preserve" if space else parent[1], False])
|
| 300 |
+
|
| 301 |
+
def _end(self, _name: str) -> None:
|
| 302 |
+
self._flush()
|
| 303 |
+
view, preserve, holds_element = self.open.pop()
|
| 304 |
+
if view is not None and holds_element and not preserve:
|
| 305 |
+
view["children"] = [child for child in view["children"] if not isinstance(child, str) or child.strip()]
|
| 306 |
+
if not self.open:
|
| 307 |
+
self.root = view
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def _xml_view(text: str):
|
| 311 |
+
"""REA's XML view, or None for a document REA's parser refuses: a pass with namespaces checks the document as REA's
|
| 312 |
+
parser does, then a pass without them reads names as spelled, as REA's view keeps them."""
|
| 313 |
+
reader = _XmlReader()
|
| 314 |
+
try:
|
| 315 |
+
_expat(True).Parse(text, True)
|
| 316 |
+
reader.read(text)
|
| 317 |
+
except (expat.ExpatError, ValueError):
|
| 318 |
+
return None
|
| 319 |
+
return {"root": reader.root, "truncated": reader.truncated}
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
def _not_json(constant: str):
|
| 323 |
+
raise ValueError(f"{constant} is not JSON")
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
class _Inexact(Exception):
|
| 327 |
+
"""A JSON number that REA's state view refuses, since reading it would change it."""
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def _digits(text: str) -> str:
|
| 331 |
+
return re.split(r"[eE]", text.lstrip("-"))[0].replace(".", "").strip("0") or "0"
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
def _js_string(value: float) -> str:
|
| 335 |
+
"""How JavaScript's String() writes a finite double: an integer below 1e21 in full, any other in shortest form."""
|
| 336 |
+
return str(int(value)) if value.is_integer() and abs(value) < 1e21 else repr(value)
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
def _safe_number(text: str) -> bool:
|
| 340 |
+
"""lossless-json's isSafeNumber: an integer spelling within 2^53, or a float spelling that keeps its digits."""
|
| 341 |
+
if re.fullmatch(r"-?[0-9]+", text):
|
| 342 |
+
return len(text.lstrip("-")) <= 16 and abs(int(text)) <= MAX_SAFE_INTEGER
|
| 343 |
+
value = float(text)
|
| 344 |
+
if not math.isfinite(value):
|
| 345 |
+
return False
|
| 346 |
+
written = _js_string(value)
|
| 347 |
+
return written == text or _digits(written) == _digits(text)
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def _exact_number(text: str):
|
| 351 |
+
"""A JSON number read only when reading it changes nothing, as REA's state view rules: its spelling and its
|
| 352 |
+
written-back form both safe, and not -0."""
|
| 353 |
+
value = float(text)
|
| 354 |
+
if (not _safe_number(text) or not math.isfinite(value) or not _safe_number(_js_string(value))
|
| 355 |
+
or (value == 0 and math.copysign(1, value) < 0)):
|
| 356 |
+
raise _Inexact(text)
|
| 357 |
+
return int(text) if re.fullmatch(r"-?[0-9]+", text) else value
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
_INEXACT = object()
|
| 361 |
+
_LEVEL_END = object()
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
def _number_or_mark(spelling: str):
|
| 365 |
+
"""A JSON number read exactly, or a mark for one REA's state view refuses."""
|
| 366 |
+
try:
|
| 367 |
+
return _exact_number(spelling)
|
| 368 |
+
except _Inexact:
|
| 369 |
+
return _INEXACT
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
def _holds_inexact(value) -> bool:
|
| 373 |
+
"""Whether a parsed JSON value still holds a marked number once duplicate keys kept their last value; one
|
| 374 |
+
iterator per nesting level, so no child list is copied."""
|
| 375 |
+
levels = [iter((value,))]
|
| 376 |
+
while levels:
|
| 377 |
+
item = next(levels[-1], _LEVEL_END)
|
| 378 |
+
if item is _LEVEL_END:
|
| 379 |
+
levels.pop()
|
| 380 |
+
elif item is _INEXACT:
|
| 381 |
+
return True
|
| 382 |
+
elif isinstance(item, dict):
|
| 383 |
+
levels.append(iter(item.values()))
|
| 384 |
+
elif isinstance(item, list):
|
| 385 |
+
levels.append(iter(item))
|
| 386 |
+
return False
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def _deeper_than(root, limit: int) -> bool:
|
| 390 |
+
"""Whether a parsed JSON value nests deeper than a limit, as REA checks it: a value's depth is the number of
|
| 391 |
+
iterators open above it, one per nesting level, so no child list is copied."""
|
| 392 |
+
levels = [iter((root,))]
|
| 393 |
+
while levels:
|
| 394 |
+
item = next(levels[-1], _LEVEL_END)
|
| 395 |
+
if item is _LEVEL_END:
|
| 396 |
+
levels.pop()
|
| 397 |
+
elif len(levels) - 1 > limit:
|
| 398 |
+
return True
|
| 399 |
+
elif isinstance(item, dict):
|
| 400 |
+
levels.append(iter(item.values()))
|
| 401 |
+
elif isinstance(item, list):
|
| 402 |
+
levels.append(iter(item))
|
| 403 |
+
return False
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
def _text_view(name: str, text: str) -> dict:
|
| 407 |
+
"""The format REA's state view detects for decoded text, and its view."""
|
| 408 |
+
trimmed = re.sub(r"^[\s]+", "", text)
|
| 409 |
+
if name.endswith(".json") or trimmed[:1] in ("[", "{"):
|
| 410 |
+
# The whole text must parse, and duplicate keys settle, before an inexact number makes it JSON with an error.
|
| 411 |
+
try:
|
| 412 |
+
view = json.loads(text, parse_constant=_not_json, parse_float=_number_or_mark, parse_int=_number_or_mark)
|
| 413 |
+
except RecursionError:
|
| 414 |
+
# Nesting too deep for Python to parse is far deeper than REA's view keeps.
|
| 415 |
+
return {"format": "json", "view": None, "error": JSON_TOO_DEEP}
|
| 416 |
+
except ValueError:
|
| 417 |
+
pass
|
| 418 |
+
else:
|
| 419 |
+
if _holds_inexact(view):
|
| 420 |
+
return {"format": "json", "view": None,
|
| 421 |
+
"error": "a number in it cannot be read exactly, such as an integer above 2^53"}
|
| 422 |
+
if _deeper_than(view, MAX_JSON_VIEW_DEPTH):
|
| 423 |
+
return {"format": "json", "view": None, "error": JSON_TOO_DEEP}
|
| 424 |
+
return {"format": "json", "view": view, "truncated": False}
|
| 425 |
+
lowered = name.lower()
|
| 426 |
+
if lowered.endswith(XML_SUFFIXES) or trimmed.startswith("<?xml"):
|
| 427 |
+
view = _xml_view(text)
|
| 428 |
+
return _text(text) if view is None else {"format": "xml", "view": view, "truncated": view["truncated"]}
|
| 429 |
+
if _is_keyfile(text):
|
| 430 |
+
return {"format": "keyfile", "view": {"groups": _keyfile(text)}, "truncated": False}
|
| 431 |
+
return _text(text)
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
def _view(path: Path) -> dict:
|
| 435 |
+
"""A typed JSON view of one file in the shapes of REA's state view; truncated says the view is partial."""
|
| 436 |
+
too_large = {"format": None, "view": None, "error": "larger than 64 MiB, the most the view reads"}
|
| 437 |
+
if path.stat().st_size > MAX_VIEW_BYTES:
|
| 438 |
+
return too_large
|
| 439 |
+
with path.open("rb") as file:
|
| 440 |
+
data = file.read(8192)
|
| 441 |
+
whole = not data.startswith(SQLITE_HEADER) and b"\x00" not in data
|
| 442 |
+
data += file.read(MAX_VIEW_BYTES + 1 - len(data)) if whole else b""
|
| 443 |
+
if data.startswith(SQLITE_HEADER):
|
| 444 |
+
return _sqlite(path)
|
| 445 |
+
if data.startswith(ZIP_HEADER):
|
| 446 |
+
return _zip(path)
|
| 447 |
+
if len(data) > MAX_VIEW_BYTES:
|
| 448 |
+
return too_large
|
| 449 |
+
try:
|
| 450 |
+
text = data.decode("utf-8-sig") if whole else None
|
| 451 |
+
except UnicodeDecodeError:
|
| 452 |
+
text = None
|
| 453 |
+
return {"format": "binary", "view": None, "truncated": False} if text is None else _text_view(path.name, text)
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
def _views(home: Path, paths: list) -> dict:
|
| 457 |
+
"""A view of every file under the app's paths, keyed by its home-relative path."""
|
| 458 |
+
files = {}
|
| 459 |
+
for owned in paths:
|
| 460 |
+
root = home / owned
|
| 461 |
+
candidates = [root] if root.is_file() else sorted(root.rglob("*")) if root.is_dir() else []
|
| 462 |
+
for path in candidates:
|
| 463 |
+
if path.is_file() and not path.is_symlink():
|
| 464 |
+
key = path.relative_to(home).as_posix()
|
| 465 |
+
try:
|
| 466 |
+
files[key] = _view(path)
|
| 467 |
+
except (OSError, ValueError, sqlite3.Error, RecursionError) as error:
|
| 468 |
+
files[key] = {"format": None, "view": None, "error": str(error)}
|
| 469 |
+
return files
|
| 470 |
+
|
| 471 |
+
MAX_ZIP_ENTRIES = 1000
|
| 472 |
+
MAX_ZIP_ENTRY_BYTES = 16 * 1024 * 1024
|
| 473 |
+
MAX_ZIP_BYTES = 64 * 1024 * 1024
|
| 474 |
+
MAX_ZIP_RATIO = 100
|
| 475 |
+
ZIP_READ_CHUNK = 64 * 1024
|
| 476 |
+
ZIP_END = b"PK\x05\x06"
|
| 477 |
+
ZIP_CENTRAL = b"PK\x01\x02"
|
| 478 |
+
ZIP64_LOCATOR = b"PK\x06\x07"
|
| 479 |
+
ZIP64_END = b"PK\x06\x06"
|
| 480 |
+
#: Formats an archive entry may have whose reader needs a tool, a worker or another archive opened.
|
| 481 |
+
NOT_READ_INSIDE = ((SQLITE_HEADER, "sqlite", "a SQLite database"), (GVDB_HEADER, "dconf", "a dconf database"),
|
| 482 |
+
(ZIP_HEADER, "zip", "an archive"))
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
def _entry_view(name: str, data: bytes) -> dict:
|
| 486 |
+
"""An archive entry's format and view by the rules a file's follow; a database or an archive inside is not
|
| 487 |
+
read."""
|
| 488 |
+
for header, form, inside in NOT_READ_INSIDE:
|
| 489 |
+
if data.startswith(header):
|
| 490 |
+
return {"format": form, "view": None, "error": f"{inside} inside an archive is not read"}
|
| 491 |
+
try:
|
| 492 |
+
text = data.decode("utf-8-sig") if b"\x00" not in data[:8192] else None
|
| 493 |
+
except UnicodeDecodeError:
|
| 494 |
+
text = None
|
| 495 |
+
if text is None:
|
| 496 |
+
return {"format": "binary", "view": None}
|
| 497 |
+
view = _text_view(name, text)
|
| 498 |
+
if view["format"] in ("json", "keyfile") and len(data) > MAX_PARSED_BYTES:
|
| 499 |
+
return {"format": view["format"], "view": None,
|
| 500 |
+
"error": "larger than the 4 MiB limit for JSON and key file views"}
|
| 501 |
+
return view
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
def _zip_refusal(info, spent: int):
|
| 505 |
+
"""Why an entry is not read, checked in REA's order, or None; spent is the archive's bytes read so far."""
|
| 506 |
+
if info.flag_bits & 0x1:
|
| 507 |
+
return "encrypted, so it is not read"
|
| 508 |
+
if info.compress_type not in (zipfile.ZIP_STORED, zipfile.ZIP_DEFLATED):
|
| 509 |
+
return f"compressed with method {info.compress_type}, which the view does not read"
|
| 510 |
+
if info.file_size > MAX_ZIP_ENTRY_BYTES:
|
| 511 |
+
return "larger than the 16 MiB an entry's view reads"
|
| 512 |
+
if info.file_size > MAX_ZIP_RATIO * info.compress_size:
|
| 513 |
+
return f"expands more than {MAX_ZIP_RATIO} times, so it is not read"
|
| 514 |
+
if spent + info.file_size > MAX_ZIP_BYTES:
|
| 515 |
+
return "past the 64 MiB read from one archive"
|
| 516 |
+
return None
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
def _entry_bytes(archive, info):
|
| 520 |
+
"""An entry's uncompressed bytes, or None when they fail its CRC-32 or are not exactly its declared size. Reading
|
| 521 |
+
stops one byte past that size, which data past a short declared size fills, and asks for a bounded chunk at a
|
| 522 |
+
time, which bounds what the decompressor expands per call, so a forged small size holds no more than that."""
|
| 523 |
+
probe = copy.copy(info)
|
| 524 |
+
probe.file_size = info.file_size + 1
|
| 525 |
+
data = bytearray()
|
| 526 |
+
try:
|
| 527 |
+
with archive.open(probe) as member:
|
| 528 |
+
while len(data) <= info.file_size:
|
| 529 |
+
chunk = member.read(min(probe.file_size - len(data), ZIP_READ_CHUNK))
|
| 530 |
+
if not chunk:
|
| 531 |
+
break
|
| 532 |
+
data += chunk
|
| 533 |
+
except (zipfile.BadZipFile, zlib.error, EOFError, OSError, ValueError):
|
| 534 |
+
return None
|
| 535 |
+
return data if len(data) == info.file_size else None
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
def _zip_entry(archive, info, refusal):
|
| 539 |
+
"""One entry of a zip view: its name, size and digest, and its own format and view, or why it was not read."""
|
| 540 |
+
entry = {"name": info.filename, "size": info.file_size, "sha256": None, "format": None, "view": None,
|
| 541 |
+
"view_error": refusal}
|
| 542 |
+
if refusal is not None:
|
| 543 |
+
return entry
|
| 544 |
+
data = _entry_bytes(archive, info)
|
| 545 |
+
if data is None:
|
| 546 |
+
return {**entry, "view_error": "its compressed data is damaged"}
|
| 547 |
+
view = _entry_view(info.filename, data)
|
| 548 |
+
return {**entry, "sha256": hashlib.sha256(data).hexdigest(), "format": view["format"],
|
| 549 |
+
"view": view.get("view"), "view_error": view.get("error")}
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
def _zip_end(file, size: int):
|
| 553 |
+
"""Where an archive's central directory ends, how long it is and the offset it declares, from the last end
|
| 554 |
+
record whose comment reaches the end of the file and, when a Zip64 locator precedes it whatever that record
|
| 555 |
+
holds, the Zip64 one just before the locator; None without an end record, or when sentinels defer to a
|
| 556 |
+
Zip64 record that is missing."""
|
| 557 |
+
window = min(size, 22 + 0xFFFF)
|
| 558 |
+
file.seek(size - window)
|
| 559 |
+
tail = file.read(window)
|
| 560 |
+
at = tail.rfind(ZIP_END, 0, len(tail) - 18)
|
| 561 |
+
while at >= 0 and at + 22 + int.from_bytes(tail[at + 20:at + 22], "little") != len(tail):
|
| 562 |
+
at = tail.rfind(ZIP_END, 0, at + 3)
|
| 563 |
+
if at < 0:
|
| 564 |
+
return None
|
| 565 |
+
total, length, offset = struct.unpack_from("<HII", tail, at + 10)
|
| 566 |
+
end = size - window + at
|
| 567 |
+
record = end - 20 - 56
|
| 568 |
+
if record < 0:
|
| 569 |
+
return end, length, offset
|
| 570 |
+
file.seek(end - 20)
|
| 571 |
+
if file.read(4) != ZIP64_LOCATOR:
|
| 572 |
+
return end, length, offset
|
| 573 |
+
file.seek(record)
|
| 574 |
+
zip64 = file.read(56)
|
| 575 |
+
if len(zip64) == 56 and zip64[:4] == ZIP64_END:
|
| 576 |
+
length, offset = struct.unpack_from("<QQ", zip64, 40)
|
| 577 |
+
return record, length, offset
|
| 578 |
+
if total == 0xFFFF or 0xFFFFFFFF in (length, offset):
|
| 579 |
+
return None
|
| 580 |
+
return end, length, offset
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
def _zip_unicode_path(raw: bytes, flags: int, extra: bytes):
|
| 584 |
+
"""An Info-ZIP Unicode Path when zip.js uses it: version 1, no UTF-8 flag, and the CRC-32 of the stored name."""
|
| 585 |
+
at = 0
|
| 586 |
+
while at + 4 <= len(extra):
|
| 587 |
+
kind, length = struct.unpack_from("<HH", extra, at)
|
| 588 |
+
if kind == 0x7075:
|
| 589 |
+
data = extra[at + 4:at + 4 + length]
|
| 590 |
+
usable = (length >= 5 and len(data) == length and data[0] == 1 and not flags & 0x800
|
| 591 |
+
and int.from_bytes(data[1:5], "little") == zlib.crc32(raw))
|
| 592 |
+
return data[5:] if usable else None
|
| 593 |
+
at += 4 + length
|
| 594 |
+
return None
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
def _zip_ends_in_slash(raw: bytes, flags: int, extra: bytes):
|
| 598 |
+
"""Whether an entry's name, as REA decodes it, ends in a slash; None when it must be UTF-8 and is not."""
|
| 599 |
+
utf8 = _zip_unicode_path(raw, flags, extra)
|
| 600 |
+
if utf8 is None and flags & 0x800:
|
| 601 |
+
utf8 = raw
|
| 602 |
+
if utf8 is None:
|
| 603 |
+
return raw.endswith(b"/")
|
| 604 |
+
try:
|
| 605 |
+
return utf8.decode("utf-8").endswith("/")
|
| 606 |
+
except UnicodeDecodeError:
|
| 607 |
+
return None
|
| 608 |
+
|
| 609 |
+
|
| 610 |
+
def _zip_directory(file, size: int, keep: int):
|
| 611 |
+
"""An archive's central directory read a record at a time, keeping the first file entries' records, as many as keep allows, and
|
| 612 |
+
counting the rest, as REA reads it: (start, declared offset, records, count), or None when it cannot be read.
|
| 613 |
+
Directories are told apart as zip.js tells them: a final slash, a Unix directory mode, or the MS-DOS attribute."""
|
| 614 |
+
located = _zip_end(file, size)
|
| 615 |
+
if located is None:
|
| 616 |
+
return None
|
| 617 |
+
end, length, declared = located
|
| 618 |
+
start = end - length
|
| 619 |
+
if start < 0:
|
| 620 |
+
return None
|
| 621 |
+
file.seek(start)
|
| 622 |
+
records, count, at = [], 0, start
|
| 623 |
+
while at < end:
|
| 624 |
+
fixed = file.read(46)
|
| 625 |
+
if at + 46 > end or len(fixed) < 46 or fixed[:4] != ZIP_CENTRAL:
|
| 626 |
+
return None
|
| 627 |
+
made_by, flags = struct.unpack_from("<H2xH", fixed, 4)
|
| 628 |
+
name_length, extra_length, comment_length = struct.unpack_from("<HHH", fixed, 28)
|
| 629 |
+
external = struct.unpack_from("<I", fixed, 38)[0]
|
| 630 |
+
rest = file.read(name_length + extra_length + comment_length)
|
| 631 |
+
at += 46 + name_length + extra_length + comment_length
|
| 632 |
+
if len(rest) < name_length + extra_length + comment_length or at > end:
|
| 633 |
+
return None
|
| 634 |
+
slash = _zip_ends_in_slash(rest[:name_length], flags, rest[name_length:name_length + extra_length])
|
| 635 |
+
if slash is None:
|
| 636 |
+
return None
|
| 637 |
+
if not (slash or (external >> 16) & 0o170000 == 0o040000 or (made_by >> 8 == 0 and external & 0x10)):
|
| 638 |
+
count += 1
|
| 639 |
+
if len(records) < keep:
|
| 640 |
+
records.append(fixed + rest)
|
| 641 |
+
return start, declared, records, count
|
| 642 |
+
|
| 643 |
+
|
| 644 |
+
class _BoundedArchive(io.RawIOBase):
|
| 645 |
+
"""An archive as zipfile reads it: its entries in place, then a directory of the kept records alone and end
|
| 646 |
+
records for them, so zipfile parses no more records than the view lists."""
|
| 647 |
+
|
| 648 |
+
def __init__(self, file, start: int, tail: bytes) -> None:
|
| 649 |
+
super().__init__()
|
| 650 |
+
self._file, self._start, self._tail, self._at = file, start, tail, 0
|
| 651 |
+
|
| 652 |
+
def readable(self) -> bool:
|
| 653 |
+
return True
|
| 654 |
+
|
| 655 |
+
def seekable(self) -> bool:
|
| 656 |
+
return True
|
| 657 |
+
|
| 658 |
+
def tell(self) -> int:
|
| 659 |
+
return self._at
|
| 660 |
+
|
| 661 |
+
def seek(self, offset: int, whence: int = 0) -> int:
|
| 662 |
+
self._at = offset + (0, self._at, self._start + len(self._tail))[whence]
|
| 663 |
+
return self._at
|
| 664 |
+
|
| 665 |
+
def readinto(self, buffer) -> int:
|
| 666 |
+
view = memoryview(buffer)
|
| 667 |
+
if self._at < self._start:
|
| 668 |
+
self._file.seek(self._at)
|
| 669 |
+
count = self._file.readinto(view[:self._start - self._at])
|
| 670 |
+
else:
|
| 671 |
+
chunk = self._tail[self._at - self._start:self._at - self._start + len(view)]
|
| 672 |
+
count = len(chunk)
|
| 673 |
+
view[:count] = chunk
|
| 674 |
+
self._at += count
|
| 675 |
+
return count
|
| 676 |
+
|
| 677 |
+
|
| 678 |
+
def _zip(path: Path) -> dict:
|
| 679 |
+
"""A zip archive's file entries in archive order, up to REA's entry, size, ratio and archive limits; nothing is
|
| 680 |
+
extracted to disk, no archive inside is opened, and zipfile is shown only the directory records listed."""
|
| 681 |
+
entries, spent = [], 0
|
| 682 |
+
try:
|
| 683 |
+
with path.open("rb") as file:
|
| 684 |
+
directory = _zip_directory(file, os.fstat(file.fileno()).st_size, MAX_ZIP_ENTRIES)
|
| 685 |
+
if directory is None:
|
| 686 |
+
raise zipfile.BadZipFile("no readable central directory")
|
| 687 |
+
start, declared, records, count = directory
|
| 688 |
+
kept = b"".join(records)
|
| 689 |
+
offset = declared if declared <= 0xFFFFFFFF else start
|
| 690 |
+
# zipfile follows a Zip64 locator signature wherever one sits before the end record, and the kept records
|
| 691 |
+
# may end in those bytes, so a real Zip64 end record and locator for them come first.
|
| 692 |
+
tail = (kept
|
| 693 |
+
+ struct.pack("<4sQ2H2I4Q", ZIP64_END, 44, 45, 45, 0, 0, len(records), len(records), len(kept), offset)
|
| 694 |
+
+ struct.pack("<4sIQI", ZIP64_LOCATOR, 0, offset + len(kept), 1)
|
| 695 |
+
+ struct.pack("<4s4H2IH", ZIP_END, 0, 0, len(records), len(records), len(kept), offset, 0))
|
| 696 |
+
with zipfile.ZipFile(_BoundedArchive(file, start, tail)) as archive:
|
| 697 |
+
for info in archive.infolist():
|
| 698 |
+
refusal = _zip_refusal(info, spent)
|
| 699 |
+
spent += info.file_size if refusal is None else 0
|
| 700 |
+
entries.append(_zip_entry(archive, info, refusal))
|
| 701 |
+
except (zipfile.BadZipFile, zlib.error, EOFError, NotImplementedError, OSError, ValueError, struct.error):
|
| 702 |
+
return {"format": "zip", "view": None, "error": "not a readable zip archive"}
|
| 703 |
+
view = {"entries": entries, "entry_count": count, "truncated": count > len(entries)}
|
| 704 |
+
return {"format": "zip", "view": view, "truncated": view["truncated"]}
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
@computer_app(supports=[{"os": {"type": "linux", "display": ["x11"]}, "arch": ["amd64", "arm64"]}])
|
| 708 |
+
@linux(
|
| 709 |
+
packages=Packages(apt=["inkscape"]),
|
| 710 |
+
launch=Launch(at="boot", command=["sh", "-c", "cd \"$HOME\" 2>/dev/null; exec 'inkscape'"], window={"class": "Inkscape"}, ready=Ready(window=True)),
|
| 711 |
+
paths=PATHS,
|
| 712 |
+
skill="SKILL.md",
|
| 713 |
+
)
|
| 714 |
+
class Inkscape(ComputerAppEnvironment):
|
| 715 |
+
"""Inkscape, launched at boot with the captured state in its home.
|
| 716 |
+
|
| 717 |
+
Declaring data hooks switches off agentenv's default data plane, so these call its helpers: the seed is kept as
|
| 718 |
+
the initial state, reset restores it, add writes files under PATHS, and get returns those files plus a typed JSON
|
| 719 |
+
view of each.
|
| 720 |
+
"""
|
| 721 |
+
|
| 722 |
+
def __init__(self) -> None:
|
| 723 |
+
super().__init__()
|
| 724 |
+
if not INITIAL.exists():
|
| 725 |
+
_seed_home(Path.home())
|
| 726 |
+
_load_dconf(Path.home())
|
| 727 |
+
keep_initial(self.paths)
|
| 728 |
+
|
| 729 |
+
@add_data
|
| 730 |
+
async def add_files(self, parts: list) -> None:
|
| 731 |
+
await add(parts, self.paths)
|
| 732 |
+
|
| 733 |
+
@get_data
|
| 734 |
+
async def get_files(self, write_namespace=None) -> list:
|
| 735 |
+
files = await get(self.paths, write_namespace)
|
| 736 |
+
views = await in_thread(_views, Path.home(), self.paths)
|
| 737 |
+
return [*files, DataPart(data={"state": views})]
|
| 738 |
+
|
| 739 |
+
@reset_data
|
| 740 |
+
async def reset_files(self) -> None:
|
| 741 |
+
await reset(self.paths)
|
| 742 |
+
|
| 743 |
+
@ready_check
|
| 744 |
+
def main_window_shown(self) -> bool:
|
| 745 |
+
"""A window of the app's class that the taskbar lists is shown, not only a splash screen or a dialog."""
|
| 746 |
+
return _taskbar_window(WINDOW_CLASS)
|
bundle/envs/inkscape/seed/.config/inkscape/cphistory.xml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
| 2 |
+
<cphistory>
|
| 3 |
+
<operations />
|
| 4 |
+
<params />
|
| 5 |
+
</cphistory>
|
bundle/envs/inkscape/seed/.config/inkscape/extension-errors.log
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Extension "Formula (pdflatex)" failed to load because a dependency was not met.
|
| 2 |
+
Dependency:
|
| 3 |
+
type: executable
|
| 4 |
+
location: path
|
| 5 |
+
string: pdflatex
|
| 6 |
+
|
| 7 |
+
Extension "EPS Input" failed to load because a dependency was not met.
|
| 8 |
+
Dependency:
|
| 9 |
+
type: executable
|
| 10 |
+
location: path
|
| 11 |
+
string: ps2pdf
|
| 12 |
+
|
| 13 |
+
Extension "Export to PDF via Scribus" failed to load because a dependency was not met.
|
| 14 |
+
Dependency:
|
| 15 |
+
type: executable
|
| 16 |
+
location: path
|
| 17 |
+
string: scribus
|
| 18 |
+
|
| 19 |
+
Extension "PostScript Input" failed to load because a dependency was not met.
|
| 20 |
+
Dependency:
|
| 21 |
+
type: executable
|
| 22 |
+
location: path
|
| 23 |
+
string: ps2pdf
|
| 24 |
+
|
| 25 |
+
Extension "GIMP XCF" failed to load because a dependency was not met.
|
| 26 |
+
Dependency:
|
| 27 |
+
type: executable
|
| 28 |
+
location: path
|
| 29 |
+
string: gimp
|
| 30 |
+
|
| 31 |
+
Extension "Optimized PNG" failed to load because a dependency was not met.
|
| 32 |
+
Dependency:
|
| 33 |
+
type: executable
|
| 34 |
+
location: path
|
| 35 |
+
string: optipng
|
| 36 |
+
|
| 37 |
+
Extension "XFIG Input" failed to load because a dependency was not met.
|
| 38 |
+
Dependency:
|
| 39 |
+
type: executable
|
| 40 |
+
location: path
|
| 41 |
+
string: fig2dev
|
| 42 |
+
|
bundle/envs/inkscape/seed/.config/inkscape/pages.csv
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#Inkscape page sizes
|
| 2 |
+
#NAME, WIDTH, HEIGHT, UNIT
|
| 3 |
+
A4, 210, 297, mm
|
| 4 |
+
US Letter, 8.5, 11, in
|
| 5 |
+
US Legal, 8.5, 14, in
|
| 6 |
+
US Executive, 7.25, 10.5, in
|
| 7 |
+
US Ledger/Tabloid, 11, 17, in
|
| 8 |
+
A0, 841, 1189, mm
|
| 9 |
+
A1, 594, 841, mm
|
| 10 |
+
A2, 420, 594, mm
|
| 11 |
+
A3, 297, 420, mm
|
| 12 |
+
A5, 148, 210, mm
|
| 13 |
+
A6, 105, 148, mm
|
| 14 |
+
A7, 74, 105, mm
|
| 15 |
+
A8, 52, 74, mm
|
| 16 |
+
A9, 37, 52, mm
|
| 17 |
+
A10, 26, 37, mm
|
| 18 |
+
B0, 1000, 1414, mm
|
| 19 |
+
B1, 707, 1000, mm
|
| 20 |
+
B2, 500, 707, mm
|
| 21 |
+
B3, 353, 500, mm
|
| 22 |
+
B4, 250, 353, mm
|
| 23 |
+
B5, 176, 250, mm
|
| 24 |
+
B6, 125, 176, mm
|
| 25 |
+
B7, 88, 125, mm
|
| 26 |
+
B8, 62, 88, mm
|
| 27 |
+
B9, 44, 62, mm
|
| 28 |
+
B10, 31, 44, mm
|
| 29 |
+
C0, 917, 1297, mm
|
| 30 |
+
C1, 648, 917, mm
|
| 31 |
+
C2, 458, 648, mm
|
| 32 |
+
C3, 324, 458, mm
|
| 33 |
+
C4, 229, 324, mm
|
| 34 |
+
C5, 162, 229, mm
|
| 35 |
+
C6, 114, 162, mm
|
| 36 |
+
C7, 81, 114, mm
|
| 37 |
+
C8, 57, 81, mm
|
| 38 |
+
C9, 40, 57, mm
|
| 39 |
+
C10, 28, 40, mm
|
| 40 |
+
D1, 545, 771, mm
|
| 41 |
+
D2, 385, 545, mm
|
| 42 |
+
D3, 272, 385, mm
|
| 43 |
+
D4, 192, 272, mm
|
| 44 |
+
D5, 136, 192, mm
|
| 45 |
+
D6, 96, 136, mm
|
| 46 |
+
D7, 68, 96, mm
|
| 47 |
+
E3, 400, 560, mm
|
| 48 |
+
E4, 280, 400, mm
|
| 49 |
+
E5, 200, 280, mm
|
| 50 |
+
E6, 140, 200, mm
|
| 51 |
+
CSE, 462, 649, pt
|
| 52 |
+
US #10 Envelope, 9.5, 4.125, in
|
| 53 |
+
DL Envelope, 220, 110, mm
|
| 54 |
+
Banner 468x60, 468, 60, px
|
| 55 |
+
Icon 16x16, 16, 16, px
|
| 56 |
+
Icon 32x32, 32, 32, px
|
| 57 |
+
Icon 48x48, 48, 48, px
|
| 58 |
+
ID Card (ISO 7810), 85.60, 53.98, mm
|
| 59 |
+
Business Card (US), 3.5, 2, in
|
| 60 |
+
Business Card (Europe), 85, 55, mm
|
| 61 |
+
Business Card (AU/NZ), 90, 55, mm
|
| 62 |
+
Arch A, 9, 12, in
|
| 63 |
+
Arch B, 12, 18, in
|
| 64 |
+
Arch C, 18, 24, in
|
| 65 |
+
Arch D, 24, 36, in
|
| 66 |
+
Arch E, 36, 48, in
|
| 67 |
+
Arch E1, 30, 42, in
|
| 68 |
+
Video SD / PAL, 768, 576, px
|
| 69 |
+
Video SD-Widescreen / PAL, 1024, 576, px
|
| 70 |
+
Video SD / NTSC, 544, 480, px
|
| 71 |
+
Video SD-Widescreen / NTSC, 872, 486, px
|
| 72 |
+
Video HD 720p, 1280, 720, px
|
| 73 |
+
Video HD 1080p, 1920, 1080, px
|
| 74 |
+
Video DCI 2k (Full Frame), 2048, 1080, px
|
| 75 |
+
Video UHD 4k, 3840, 2160, px
|
| 76 |
+
Video DCI 4k (Full Frame), 4096, 2160, px
|
| 77 |
+
Video UHD 8k, 7680, 4320, px
|
bundle/envs/inkscape/seed/.config/inkscape/preferences.xml
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<inkscape version="1"
|
| 3 |
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
| 4 |
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape">
|
| 5 |
+
<group id="window">
|
| 6 |
+
<group id="menu" state="1"/>
|
| 7 |
+
<group id="commands" state="1"/>
|
| 8 |
+
<group id="snaptoolbox" state="1"/>
|
| 9 |
+
<group id="toppanel" state="1"/>
|
| 10 |
+
<group id="toolbox" state="1"/>
|
| 11 |
+
<group id="statusbar" state="1"/>
|
| 12 |
+
<group id="panels" state="1"/>
|
| 13 |
+
<group id="rulers" state="1"/>
|
| 14 |
+
<group id="scrollbars" state="1"/>
|
| 15 |
+
</group>
|
| 16 |
+
<group id="fullscreen">
|
| 17 |
+
<group id="menu" state="1"/>
|
| 18 |
+
<group id="commands" state="1"/>
|
| 19 |
+
<group id="snaptoolbox" state="1"/>
|
| 20 |
+
<group id="toppanel" state="1"/>
|
| 21 |
+
<group id="toolbox" state="1"/>
|
| 22 |
+
<group id="statusbar" state="1"/>
|
| 23 |
+
<group id="panels" state="1"/>
|
| 24 |
+
<group id="rulers" state="1"/>
|
| 25 |
+
<group id="scrollbars" state="1"/>
|
| 26 |
+
</group>
|
| 27 |
+
<group id="focus">
|
| 28 |
+
<group id="menu" state="0"/>
|
| 29 |
+
<group id="commands" state="0"/>
|
| 30 |
+
<group id="snaptoolbox" state="0"/>
|
| 31 |
+
<group id="toppanel" state="0"/>
|
| 32 |
+
<group id="toolbox" state="0"/>
|
| 33 |
+
<group id="statusbar" state="0"/>
|
| 34 |
+
<group id="panels" state="0"/>
|
| 35 |
+
<group id="rulers" state="0"/>
|
| 36 |
+
<group id="scrollbars" state="0"/>
|
| 37 |
+
</group>
|
| 38 |
+
|
| 39 |
+
<group id="template">
|
| 40 |
+
<sodipodi:namedview
|
| 41 |
+
id="base"
|
| 42 |
+
pagecolor="#ffffff"
|
| 43 |
+
pageopacity="0.0"
|
| 44 |
+
pagecheckerboard="0"
|
| 45 |
+
bordercolor="#000000"
|
| 46 |
+
borderopacity="0.25"
|
| 47 |
+
objecttolerance="10.0"
|
| 48 |
+
gridtolerance="10.0"
|
| 49 |
+
guidetolerance="10.0"
|
| 50 |
+
pageshadow="2" />
|
| 51 |
+
</group>
|
| 52 |
+
|
| 53 |
+
<group id="tools" bounding_box="0">
|
| 54 |
+
|
| 55 |
+
<group id="shapes" style="fill-rule:evenodd;" selcue="1" gradientdrag="1">
|
| 56 |
+
<eventcontext id="rect" style="fill:blue;" usecurrent="1"/>
|
| 57 |
+
<eventcontext id="3dbox" style="stroke:none;stroke-linejoin:round;" usecurrent="1">
|
| 58 |
+
<side id="XYfront" style="fill:#8686bf;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 59 |
+
<side id="XYrear" style="fill:#e9e9ff;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 60 |
+
<side id="XZtop" style="fill:#4d4d9f;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 61 |
+
<side id="XZbottom" style="fill:#afafde;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 62 |
+
<side id="YZright" style="fill:#353564;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 63 |
+
<side id="YZleft" style="fill:#d7d7ff;stroke:none;stroke-linejoin:round;" usecurrent="0"/>
|
| 64 |
+
</eventcontext>
|
| 65 |
+
<eventcontext id="arc" style="fill:red;" end="0" start="0" usecurrent="1"/>
|
| 66 |
+
<eventcontext id="star" magnitude="5" style="fill:yellow;" usecurrent="1"/>
|
| 67 |
+
<eventcontext id="spiral" style="fill:none;stroke:black" expansion="1" usecurrent="0"/>
|
| 68 |
+
</group>
|
| 69 |
+
|
| 70 |
+
<group id="freehand"
|
| 71 |
+
style="fill:none;stroke:black;stroke-opacity:1;stroke-linejoin:miter;stroke-linecap:butt;">
|
| 72 |
+
<eventcontext id="pencil" tolerance="15.0" selcue="1" style="stroke-width:1px;" usecurrent="1" average_all_sketches="1"/>
|
| 73 |
+
<eventcontext id="pen" mode="drag" selcue="1" style="stroke-width:1px;" usecurrent="1"/>
|
| 74 |
+
</group>
|
| 75 |
+
|
| 76 |
+
<eventcontext id="calligraphic" style="fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;"
|
| 77 |
+
mass="2" angle="30" width="15.118" thinning="10" flatness="-90" cap_rounding="0.0" usecurrent="1"
|
| 78 |
+
tracebackground="0" usepressure="1" usetilt="0" keep_selected="1" abs_width="1" unit="mm">
|
| 79 |
+
|
| 80 |
+
<group id="preset">
|
| 81 |
+
<group id="cp0" name="Dip pen" mass="2" wiggle="0.0" angle="30.0" thinning="10" tremor="0.0" flatness="-90" cap_rounding="0.0" tracebackground="0" usepressure="1" usetilt="1" />
|
| 82 |
+
<group id="cp1" name="Marker" mass="2" wiggle="0.0" angle="90.0" thinning="0.0" tremor="0.0" flatness="0.0" cap_rounding="1.0" tracebackground="0" usepressure="0" usetilt="0" />
|
| 83 |
+
<group id="cp2" name="Brush" mass="2" wiggle="25" angle="45.0" thinning="-40" tremor="0.0" flatness="16" cap_rounding=".1" tracebackground="0" usepressure="1" usetilt="1" />
|
| 84 |
+
<group id="cp3" name="Wiggly" usetilt="1" tracebackground="0" usepressure="1" cap_rounding="0.1" flatness="16" tremor="18" thinning="-30" angle="30" wiggle="50" mass="0" />
|
| 85 |
+
<group id="cp4" name="Splotch" width="100" usetilt="1" tracebackground="0" usepressure="0" cap_rounding="1" flatness="0" tremor="10" thinning="30" angle="30" wiggle="0" mass="0" />
|
| 86 |
+
<group id="cp5" name="Tracing" width="50" mass="0" wiggle="0.0" angle="0.0" thinning="0.0" tremor="0.0" flatness="0" cap_rounding="0.0" tracebackground="1" usepressure="1" usetilt="1"/>
|
| 87 |
+
</group>
|
| 88 |
+
</eventcontext>
|
| 89 |
+
|
| 90 |
+
<eventcontext id="eraser" mode="1" style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none;"
|
| 91 |
+
mass="3.00" drag="1" angle="30" width="10" thinning="0.1" flatness="0.0" cap_rounding="1.4" usecurrent="0"
|
| 92 |
+
tracebackground="0" usepressure="1" usetilt="0" selcue="1">
|
| 93 |
+
</eventcontext>
|
| 94 |
+
|
| 95 |
+
<eventcontext id="lpetool" mode="drag" style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none;">
|
| 96 |
+
</eventcontext>
|
| 97 |
+
|
| 98 |
+
<eventcontext id="text" usecurrent="1" gradientdrag="1"
|
| 99 |
+
font_sample="AaBbCcIiPpQq12369$€¢?.;/()"
|
| 100 |
+
show_sample_in_list="1" use_svg2="1"
|
| 101 |
+
style="fill:black;fill-opacity:1;line-height:1.25;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:40px;" selcue="1"/>
|
| 102 |
+
|
| 103 |
+
<eventcontext id="nodes" selcue="1" gradientdrag="1"
|
| 104 |
+
pathflash_enabled="1" pathflash_unselected="0" pathflash_timeout="500" show_handles="1" show_outline="0"
|
| 105 |
+
sculpting_profile="1" single_node_transform_handles="0" show_transform_handles="0" live_outline="1" live_objects="1" show_helperpath="0" x="0" y="0" edit_clipping_paths="0" edit_masks="0" />
|
| 106 |
+
<eventcontext id="marker" selcue="1" gradientdrag="1" />
|
| 107 |
+
<eventcontext id="tweak" selcue="0" gradientdrag="0" show_handles="0" width="0.2" force="0.2" fidelity="0.5" usepressure="1" style="fill:red;stroke:none;" usecurrent="1"/>
|
| 108 |
+
<eventcontext id="spray" selcue="1" gradientdrag="0" usepressure="1" width="15" population="70" mode="1" rotation_variation="0" scale_variation="0" standard_deviation="70" mean="0"/>
|
| 109 |
+
<eventcontext id="gradient" selcue="1"/>
|
| 110 |
+
<eventcontext id="mesh" selcue="1"/>
|
| 111 |
+
<eventcontext id="zoom" selcue="1" gradientdrag="0"/>
|
| 112 |
+
<eventcontext id="dropper" selcue="1" gradientdrag="1" pick="1" setalpha="1"/>
|
| 113 |
+
<eventcontext id="select" selcue="1" gradientdrag="0"/>
|
| 114 |
+
<eventcontext id="connector" style="fill:none;fill-rule:evenodd;stroke:black;stroke-opacity:1;stroke-linejoin:miter;stroke-width:1px;stroke-linecap:butt;" selcue="1"/>
|
| 115 |
+
<eventcontext id="paintbucket" style="fill:#a0a0a0;stroke:none;" usecurrent="1"/>
|
| 116 |
+
<group
|
| 117 |
+
id="geometric"
|
| 118 |
+
mode="drag" />
|
| 119 |
+
</group>
|
| 120 |
+
|
| 121 |
+
<group id="palette">
|
| 122 |
+
<group id="dashes">
|
| 123 |
+
<dash id="solid" style="stroke-dasharray:none"/>
|
| 124 |
+
<dash id="dash-1-1" style="stroke-dasharray:1,1"/>
|
| 125 |
+
<dash id="dash-1-2" style="stroke-dasharray:1,2"/>
|
| 126 |
+
<dash id="dash-1-3" style="stroke-dasharray:1,3"/>
|
| 127 |
+
<dash id="dash-1-4" style="stroke-dasharray:1,4"/>
|
| 128 |
+
<dash id="dash-1-6" style="stroke-dasharray:1,6"/>
|
| 129 |
+
<dash id="dash-1-8" style="stroke-dasharray:1,8"/>
|
| 130 |
+
<dash id="dash-1-12" style="stroke-dasharray:1,12"/>
|
| 131 |
+
<dash id="dash-1-24" style="stroke-dasharray:1,24"/>
|
| 132 |
+
<dash id="dash-1-48" style="stroke-dasharray:1,48"/>
|
| 133 |
+
<dash id="dash-empty" style="stroke-dasharray:0 11"/>
|
| 134 |
+
<dash id="dash-2-1" style="stroke-dasharray:2,1"/>
|
| 135 |
+
<dash id="dash-3-1" style="stroke-dasharray:3,1"/>
|
| 136 |
+
<dash id="dash-4-1" style="stroke-dasharray:4,1"/>
|
| 137 |
+
<dash id="dash-6-1" style="stroke-dasharray:6,1"/>
|
| 138 |
+
<dash id="dash-8-1" style="stroke-dasharray:8,1"/>
|
| 139 |
+
<dash id="dash-12-1" style="stroke-dasharray:12,1"/>
|
| 140 |
+
<dash id="dash-24-1" style="stroke-dasharray:24,1"/>
|
| 141 |
+
<dash id="dash-2-2" style="stroke-dasharray:2,2"/>
|
| 142 |
+
<dash id="dash-3-3" style="stroke-dasharray:3,3"/>
|
| 143 |
+
<dash id="dash-4-4" style="stroke-dasharray:4,4"/>
|
| 144 |
+
<dash id="dash-6-6" style="stroke-dasharray:6,6"/>
|
| 145 |
+
<dash id="dash-8-8" style="stroke-dasharray:8,8"/>
|
| 146 |
+
<dash id="dash-12-12" style="stroke-dasharray:12,12"/>
|
| 147 |
+
<dash id="dash-24-24" style="stroke-dasharray:24,24"/>
|
| 148 |
+
<dash id="dash-2-4" style="stroke-dasharray:2,4"/>
|
| 149 |
+
<dash id="dash-4-2" style="stroke-dasharray:4,2"/>
|
| 150 |
+
<dash id="dash-2-6" style="stroke-dasharray:2,6"/>
|
| 151 |
+
<dash id="dash-6-2" style="stroke-dasharray:6,2"/>
|
| 152 |
+
<dash id="dash-4-8" style="stroke-dasharray:4,8"/>
|
| 153 |
+
<dash id="dash-8-4" style="stroke-dasharray:8,4"/>
|
| 154 |
+
<dash id="dash-2-1-012-1" style="stroke-dasharray:2,1,0.5,1"/>
|
| 155 |
+
<dash id="dash-4-2-1-2" style="stroke-dasharray:4,2,1,2"/>
|
| 156 |
+
<dash id="dash-8-2-1-2" style="stroke-dasharray:8,2,1,2"/>
|
| 157 |
+
<dash id="dash-012-012" style="stroke-dasharray:0.5,0.5"/>
|
| 158 |
+
<dash id="dash-014-014" style="stroke-dasharray:0.25,0.25"/>
|
| 159 |
+
<dash id="dash-0110-0110" style="stroke-dasharray:0.1,0.1"/>
|
| 160 |
+
</group>
|
| 161 |
+
</group>
|
| 162 |
+
|
| 163 |
+
<group id="colorselector" page="0" switcher="1" />
|
| 164 |
+
|
| 165 |
+
<group id="embedded">
|
| 166 |
+
<group id="swatches"
|
| 167 |
+
panel_size="1"
|
| 168 |
+
panel_mode="1"
|
| 169 |
+
panel_ratio="100"
|
| 170 |
+
panel_wrap="0"
|
| 171 |
+
palette="Inkscape default" />
|
| 172 |
+
</group>
|
| 173 |
+
|
| 174 |
+
<group id="dialogs">
|
| 175 |
+
<group id="toolbox"/>
|
| 176 |
+
<group id="fillstroke"/>
|
| 177 |
+
<group id="filtereffects"/>
|
| 178 |
+
<group id="textandfont"/>
|
| 179 |
+
<group id="transformation" applyseparately="0"/>
|
| 180 |
+
<group id="align"/>
|
| 181 |
+
<group id="xml" h="500" w="300" />
|
| 182 |
+
<group id="find"/>
|
| 183 |
+
<group id="spellcheck" w="200" h="250" ignorenumbers="1"/>
|
| 184 |
+
<group id="documentoptions" state="1"/>
|
| 185 |
+
<group id="preferences" state="1"/>
|
| 186 |
+
<group id="gradienteditor"/>
|
| 187 |
+
<group id="object"/>
|
| 188 |
+
<group id="export" default="" append_extension="1" path="">
|
| 189 |
+
<group id="exportarea"/>
|
| 190 |
+
<group id="defaultxdpi"/>
|
| 191 |
+
</group>
|
| 192 |
+
<group id="save_as" default="" append_extension="1" enable_preview="1" path="" use_current_dir="1"/>
|
| 193 |
+
<group id="save_copy" default="" append_extension="1" enable_preview="1" path=""/>
|
| 194 |
+
<group id="open" enable_preview="1" path=""/>
|
| 195 |
+
<group id="import" enable_preview="1" path="" ask="1" ask_svg="1" link="link" scale="optimizeSpeed"/>
|
| 196 |
+
<group id="debug" redirect="0"/>
|
| 197 |
+
<group id="clonetiler" dotrace="0" />
|
| 198 |
+
<group id="gridtiler" />
|
| 199 |
+
<group id="extension-error" show-on-startup="0"/>
|
| 200 |
+
<group id="memory" />
|
| 201 |
+
<group id="messages" />
|
| 202 |
+
<group id="swatches" />
|
| 203 |
+
<group id="iconpreview" />
|
| 204 |
+
<group id="aboutextensions" />
|
| 205 |
+
<group id="treeeditor" />
|
| 206 |
+
<group id="layers" maxDepth="20" w="200" h="300" />
|
| 207 |
+
<group id="trace" state="1" />
|
| 208 |
+
<group id="script" />
|
| 209 |
+
<group id="input" />
|
| 210 |
+
<group id="colorpickerwindow" />
|
| 211 |
+
<group id="undo-history" />
|
| 212 |
+
</group>
|
| 213 |
+
<group id="printing">
|
| 214 |
+
<settings id="ps"/>
|
| 215 |
+
<group id="debug" add-label-comments="0"/>
|
| 216 |
+
</group>
|
| 217 |
+
|
| 218 |
+
<group id="options"
|
| 219 |
+
rotationlock="1">
|
| 220 |
+
<group id="renderingcache" size="512" />
|
| 221 |
+
<group id="useoldpdfexporter" value="0" />
|
| 222 |
+
<group id="highlightoriginal" value="1" />
|
| 223 |
+
<group id="relinkclonesonduplicate" value="0" />
|
| 224 |
+
<group id="mapalt" value="1" />
|
| 225 |
+
<group id="trackalt" value="0" />
|
| 226 |
+
<group id="switchonextinput" value="0" />
|
| 227 |
+
<group id="useextinput" value="1" />
|
| 228 |
+
<group id="nudgedistance" value="2px"/>
|
| 229 |
+
<group id="rotationsnapsperpi" value="12"/>
|
| 230 |
+
<group id="cursortolerance" value="8.0"/>
|
| 231 |
+
<group id="dragtolerance" value="4.0"/>
|
| 232 |
+
<group id="grabsize" value="4"/>
|
| 233 |
+
<group
|
| 234 |
+
id="displayprofile"
|
| 235 |
+
enable="0"
|
| 236 |
+
from_display="0"
|
| 237 |
+
intent="0"
|
| 238 |
+
uri="" />
|
| 239 |
+
<group
|
| 240 |
+
id="softproof"
|
| 241 |
+
enable="0"
|
| 242 |
+
intent="0"
|
| 243 |
+
gamutcolor="#808080"
|
| 244 |
+
gamutwarn="0"
|
| 245 |
+
bpc="0"
|
| 246 |
+
preserveblack="0"
|
| 247 |
+
uri="" />
|
| 248 |
+
<group id="savewindowgeometry" value="1"/>
|
| 249 |
+
<group id="defaultoffsetwidth" value="2px"/>
|
| 250 |
+
<group id="defaultscale" value="2px"/>
|
| 251 |
+
<group id="maxrecentdocuments" value="36"/>
|
| 252 |
+
<group id="zoomincrement" value="1.414213562"/>
|
| 253 |
+
<group id="zoomcorrection" value="1.0" unit="mm"/>
|
| 254 |
+
<group id="keyscroll" value="15"/>
|
| 255 |
+
<group id="wheelscroll" value="40"/>
|
| 256 |
+
<group id="spacebarpans" value="1"/>
|
| 257 |
+
<group id="transientpolicy" value="1"/>
|
| 258 |
+
<group id="scrollingacceleration" value="0.4"/>
|
| 259 |
+
<group id="snapdelay" value="0"/>
|
| 260 |
+
<group id="snapweight" value="0.5"/>
|
| 261 |
+
<group id="snapclosestonly" value="0"/>
|
| 262 |
+
<group id="snapindicator" value="1"/>
|
| 263 |
+
<group id="autoscrollspeed" value="0.7"/>
|
| 264 |
+
<group id="autoscrolldistance" value="-10"/>
|
| 265 |
+
<group id="simplifythreshold" value="0.002"/>
|
| 266 |
+
<group id="bitmapeditor" value="gimp"/>
|
| 267 |
+
<group id="svgeditor" value="inkscape"/>
|
| 268 |
+
<group id="bitmapautoreload" value="1"/>
|
| 269 |
+
<group id="dialogtype" value="1"/>
|
| 270 |
+
<group id="dialogsskiptaskbar" value="1"/>
|
| 271 |
+
<group id="defaultwindowsize" value="2" />
|
| 272 |
+
<group id="arenatilescachesize" value="8192"/>
|
| 273 |
+
<group id="preservetransform" value="0"/>
|
| 274 |
+
<group id="clonecompensation" value="1"/>
|
| 275 |
+
<group id="cloneorphans" value="0"/>
|
| 276 |
+
<group id="stickyzoom" value="0"/>
|
| 277 |
+
<group id="selcue" value="2"/>
|
| 278 |
+
<group id="transform" stroke="1" rectcorners="1" pattern="1" gradient="1" />
|
| 279 |
+
<group id="dash" scale="1" />
|
| 280 |
+
<group id="kbselection" inlayer="1" onlyvisible="1" onlysensitive="1" />
|
| 281 |
+
<group id="selection" layerdeselect="1" />
|
| 282 |
+
<group id="createbitmap"/>
|
| 283 |
+
<group id="compassangledisplay" value="0"/>
|
| 284 |
+
<group id="middlemousezoom" value="1"/>
|
| 285 |
+
<group id="maskobject" topmost="1" remove="1"/>
|
| 286 |
+
<group id="blurquality" value="0"/>
|
| 287 |
+
<group id="filterquality" value="1"/>
|
| 288 |
+
<group id="showfiltersinfobox" value="1" />
|
| 289 |
+
<group id="startmode" outline="0"/>
|
| 290 |
+
<group id="outlinemode" value="0"/>
|
| 291 |
+
|
| 292 |
+
<group id="wireframecolors"
|
| 293 |
+
onlight="255"
|
| 294 |
+
ondark="4294967295"
|
| 295 |
+
images="4278190335"
|
| 296 |
+
clips="16711935"
|
| 297 |
+
masks="65535"/>
|
| 298 |
+
<group id="svgoutput"
|
| 299 |
+
disable_optimizations="0"
|
| 300 |
+
usenamedcolors="0"
|
| 301 |
+
numericprecision="8"
|
| 302 |
+
minimumexponent="-8"
|
| 303 |
+
inlineattrs="0"
|
| 304 |
+
indent="2"
|
| 305 |
+
pathstring_format="2"
|
| 306 |
+
forcerepeatcommands="0"
|
| 307 |
+
incorrect_attributes_warn="1"
|
| 308 |
+
incorrect_attributes_remove="0"
|
| 309 |
+
incorrect_style_properties_warn="1"
|
| 310 |
+
incorrect_style_properties_remove="0"
|
| 311 |
+
style_defaults_warn="1"
|
| 312 |
+
style_defaults_remove="0"
|
| 313 |
+
check_on_reading="0"
|
| 314 |
+
check_on_editing="0"
|
| 315 |
+
check_on_writing="0"
|
| 316 |
+
sort_attributes="0"/>
|
| 317 |
+
<group id="externalresources">
|
| 318 |
+
<group id="xml"
|
| 319 |
+
allow_net_access="0"/>
|
| 320 |
+
</group>
|
| 321 |
+
<group id="forkgradientvectors" value="1"/>
|
| 322 |
+
<group id="iconrender" named_nodelay="0"/>
|
| 323 |
+
<group id="autosave" enable="1" interval="10" path="" max="50"/>
|
| 324 |
+
<group id="grids"
|
| 325 |
+
no_emphasize_when_zoomedout="0">
|
| 326 |
+
<group id="xy"
|
| 327 |
+
units="px"
|
| 328 |
+
origin_x="0.0"
|
| 329 |
+
origin_y="0.0"
|
| 330 |
+
spacing_x="1.0"
|
| 331 |
+
spacing_y="1.0"
|
| 332 |
+
empspacing="5"
|
| 333 |
+
dotted="0"/>
|
| 334 |
+
<group id="axonom"
|
| 335 |
+
units="mm"
|
| 336 |
+
origin_x="0.0"
|
| 337 |
+
origin_y="0.0"
|
| 338 |
+
spacing_y="1.0"
|
| 339 |
+
angle_x="30.0"
|
| 340 |
+
angle_z="30.0"
|
| 341 |
+
empspacing="5"/>
|
| 342 |
+
</group>
|
| 343 |
+
<group id="workarounds"
|
| 344 |
+
colorsontop="0"
|
| 345 |
+
partialdynamic="0"/>
|
| 346 |
+
<group
|
| 347 |
+
id="font"
|
| 348 |
+
unitType="2" />
|
| 349 |
+
<group
|
| 350 |
+
id="boot"
|
| 351 |
+
theme="colorful" />
|
| 352 |
+
</group>
|
| 353 |
+
|
| 354 |
+
<group
|
| 355 |
+
id="extensions"
|
| 356 |
+
org.inkscape.output.png.inkscape.png_bitdepth="99"
|
| 357 |
+
org.inkscape.output.png.inkscape.png_compression="6"
|
| 358 |
+
org.inkscape.output.png.inkscape.png_antialias="2" />
|
| 359 |
+
|
| 360 |
+
<group id="desktop"
|
| 361 |
+
style="fill:#000000">
|
| 362 |
+
<group
|
| 363 |
+
width="640"
|
| 364 |
+
height="480"
|
| 365 |
+
x="0"
|
| 366 |
+
y="0"
|
| 367 |
+
maximized="1"
|
| 368 |
+
fullscreen="0"
|
| 369 |
+
id="geometry" />
|
| 370 |
+
<group
|
| 371 |
+
id="XYfront" />
|
| 372 |
+
<group
|
| 373 |
+
id="XYrear" />
|
| 374 |
+
<group
|
| 375 |
+
id="XZtop" />
|
| 376 |
+
<group
|
| 377 |
+
id="XZbottom" />
|
| 378 |
+
<group
|
| 379 |
+
id="YZleft" />
|
| 380 |
+
<group
|
| 381 |
+
id="YZright" />
|
| 382 |
+
</group>
|
| 383 |
+
|
| 384 |
+
<group id="devices">
|
| 385 |
+
</group>
|
| 386 |
+
|
| 387 |
+
<group
|
| 388 |
+
id="toolbox"
|
| 389 |
+
icononly="1"
|
| 390 |
+
secondary="1"
|
| 391 |
+
simplesnap="1"
|
| 392 |
+
small="1">
|
| 393 |
+
<group
|
| 394 |
+
id="tools"
|
| 395 |
+
icononly="1"
|
| 396 |
+
small="0"
|
| 397 |
+
iconsize="16">
|
| 398 |
+
<group
|
| 399 |
+
id="buttons" />
|
| 400 |
+
</group>
|
| 401 |
+
<group
|
| 402 |
+
id="controlbars"
|
| 403 |
+
iconsize="16" />
|
| 404 |
+
</group>
|
| 405 |
+
|
| 406 |
+
<group
|
| 407 |
+
id="statusbar">
|
| 408 |
+
<group
|
| 409 |
+
id="visibility" />
|
| 410 |
+
</group>
|
| 411 |
+
|
| 412 |
+
<group
|
| 413 |
+
id="iconpreview"
|
| 414 |
+
autoRefresh="1"
|
| 415 |
+
pack="1"
|
| 416 |
+
selectionHold="1"
|
| 417 |
+
showFrames="1"
|
| 418 |
+
selectionOnly="0">
|
| 419 |
+
<group
|
| 420 |
+
id="sizes">
|
| 421 |
+
<group
|
| 422 |
+
id="default">
|
| 423 |
+
<group
|
| 424 |
+
value="16"
|
| 425 |
+
show="1"
|
| 426 |
+
id="size16" />
|
| 427 |
+
<group
|
| 428 |
+
value="22"
|
| 429 |
+
show="0"
|
| 430 |
+
id="size22" />
|
| 431 |
+
<group
|
| 432 |
+
value="24"
|
| 433 |
+
show="1"
|
| 434 |
+
id="size24" />
|
| 435 |
+
<group
|
| 436 |
+
value="32"
|
| 437 |
+
show="1"
|
| 438 |
+
id="size32" />
|
| 439 |
+
<group
|
| 440 |
+
value="48"
|
| 441 |
+
show="1"
|
| 442 |
+
id="size48" />
|
| 443 |
+
<group
|
| 444 |
+
value="50"
|
| 445 |
+
show="0"
|
| 446 |
+
id="size50" />
|
| 447 |
+
<group
|
| 448 |
+
value="64"
|
| 449 |
+
show="0"
|
| 450 |
+
id="size64" />
|
| 451 |
+
<group
|
| 452 |
+
value="72"
|
| 453 |
+
show="0"
|
| 454 |
+
id="size72" />
|
| 455 |
+
<group
|
| 456 |
+
value="80"
|
| 457 |
+
show="0"
|
| 458 |
+
id="size80" />
|
| 459 |
+
<group
|
| 460 |
+
value="96"
|
| 461 |
+
show="0"
|
| 462 |
+
id="size96" />
|
| 463 |
+
<group
|
| 464 |
+
value="128"
|
| 465 |
+
show="1"
|
| 466 |
+
id="size128" />
|
| 467 |
+
<group
|
| 468 |
+
value="256"
|
| 469 |
+
show="0"
|
| 470 |
+
id="size256" />
|
| 471 |
+
</group>
|
| 472 |
+
</group>
|
| 473 |
+
</group>
|
| 474 |
+
<group id="debug">
|
| 475 |
+
<group id="latency" skew="1"/>
|
| 476 |
+
</group>
|
| 477 |
+
<group id="ui"
|
| 478 |
+
language=""/>
|
| 479 |
+
<group
|
| 480 |
+
id="live_effects"
|
| 481 |
+
flattening="0" />
|
| 482 |
+
<group
|
| 483 |
+
id="theme"
|
| 484 |
+
defaultPreferDarkTheme="1"
|
| 485 |
+
defaultIconTheme="multicolor"
|
| 486 |
+
defaultGtkTheme="Adwaita"
|
| 487 |
+
narrowSpinButton="1"
|
| 488 |
+
preferDarkTheme="1"
|
| 489 |
+
darkTheme="1"
|
| 490 |
+
symbolicIcons="1"
|
| 491 |
+
symbolicDefaultBaseColors="1"
|
| 492 |
+
symbolicDefaultHighColors="0"/>
|
| 493 |
+
</inkscape>
|
bundle/envs/inkscape/seed/.local/share/Trash/files/poster.svg
ADDED
|
|
bundle/envs/inkscape/seed/Documents/poster.svg
ADDED
|
|
bundle/evals/inkscape.toml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
tasks = ["poster-headline"]
|
bundle/tasks/poster-headline.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{"id":"env","type":"deploy_env","env_id":"inkscape"},
|
| 3 |
+
{"id":"agent","type":"deploy_agent","env_ids":["inkscape"]},
|
| 4 |
+
{"id":"skills","type":"add_skills","env_ids":["inkscape"]},
|
| 5 |
+
{"id":"record","type":"start_computer_recording","env_id":"inkscape","name":"agent","depends_on":["env"]},
|
| 6 |
+
{"id":"task","type":"prompt_agent","depends_on":["skills","record"],"prompt":"Change the poster's headline in Documents/poster.svg to Autumn Seed Exchange and save it."},
|
| 7 |
+
{"id":"check","type":"env_outcome_verifier","env_id":"inkscape","file_artifact_id":"poster-headline-check","verifier_id":"poster-headline","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": "inkscape"
|
| 6 |
+
}
|
| 7 |
+
]
|
media/hero.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:60556a655276f6eb345b161d3c9e49be10d0e19fe81062076c80c84537ea3396
|
| 3 |
+
size 5259733
|
media/solve-2.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54ce32e41bc5bc2881c448c925d041b6ad34959206fdb4c10dd543e6a3099d72
|
| 3 |
+
size 4744365
|
media/solve-3.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:068d876e8e37ded70bbebff47d34aac1e3bf8ccaf246adb2edeed236918bc7ca
|
| 3 |
+
size 2361304
|
media/witness.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd3cff2b30775e407e518718537096d709711ba977b64c1e283db7a84a5e679c
|
| 3 |
+
size 15023479
|
results.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"environment": "Inkscape",
|
| 3 |
+
"app_version": "Inkscape 1.2 vector graphics editor",
|
| 4 |
+
"task": "poster-headline",
|
| 5 |
+
"prompt": "Change the poster's headline in Documents/poster.svg to Autumn Seed Exchange and save it.",
|
| 6 |
+
"agent": "claude-code",
|
| 7 |
+
"model": "claude-sonnet-5-5",
|
| 8 |
+
"agentenv_framework": "0.9.1431",
|
| 9 |
+
"witness": "checks failed on the seed, passed after an edit made through computer actions, failed on a near miss (the typo \"Autumn Seed Exchnage\") and failed again after data/reset, in a fresh computer; held on the first try",
|
| 10 |
+
"runs": [
|
| 11 |
+
{
|
| 12 |
+
"run": 1,
|
| 13 |
+
"verdict": "passed",
|
| 14 |
+
"turns": 23,
|
| 15 |
+
"usd": 1.55,
|
| 16 |
+
"checks": {
|
| 17 |
+
"poster-headline": {
|
| 18 |
+
"score": 1.0,
|
| 19 |
+
"results": [
|
| 20 |
+
{
|
| 21 |
+
"id": "headline-text",
|
| 22 |
+
"result": true,
|
| 23 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0 is \"Autumn Seed Exchange\""
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"id": "date-unchanged",
|
| 27 |
+
"result": true,
|
| 28 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=event-date]/children/[name=tspan]/children/0 is \"Saturday 12 April, 10 am to 3 pm\""
|
| 29 |
+
}
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"run": 2,
|
| 36 |
+
"verdict": "passed",
|
| 37 |
+
"turns": 21,
|
| 38 |
+
"usd": 0.51,
|
| 39 |
+
"checks": {
|
| 40 |
+
"poster-headline": {
|
| 41 |
+
"score": 1.0,
|
| 42 |
+
"results": [
|
| 43 |
+
{
|
| 44 |
+
"id": "headline-text",
|
| 45 |
+
"result": true,
|
| 46 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0 is \"Autumn Seed Exchange\""
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"id": "date-unchanged",
|
| 50 |
+
"result": true,
|
| 51 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=event-date]/children/[name=tspan]/children/0 is \"Saturday 12 April, 10 am to 3 pm\""
|
| 52 |
+
}
|
| 53 |
+
]
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"run": 3,
|
| 59 |
+
"verdict": "passed",
|
| 60 |
+
"turns": 18,
|
| 61 |
+
"usd": 0.7,
|
| 62 |
+
"checks": {
|
| 63 |
+
"poster-headline": {
|
| 64 |
+
"score": 1.0,
|
| 65 |
+
"results": [
|
| 66 |
+
{
|
| 67 |
+
"id": "headline-text",
|
| 68 |
+
"result": true,
|
| 69 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0 is \"Autumn Seed Exchange\""
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"id": "date-unchanged",
|
| 73 |
+
"result": true,
|
| 74 |
+
"description": "Documents/poster.svg at /root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=event-date]/children/[name=tspan]/children/0 is \"Saturday 12 April, 10 am to 3 pm\""
|
| 75 |
+
}
|
| 76 |
+
]
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
]
|
| 81 |
+
}
|