* feat(desktop): capture, draft, export and witness a task inside a build computer - start_build_capture runs REA's capture inside the computer through a small controller over computer-exec, after a user-space apt-get update; mark_build_checkpoint returns once the capture confirms the checkpoint; stop_build_capture returns the draft between seed and end. - export_build_environment exports with the requester's task inside the computer and fetches the bundle through data/get in bounded batches. - check_build_task grades a computer's data/get with REA's evaluator and, through seed, after_edit, near_miss and after_reset stages, records a witness with the action log and the screen recording; act_on_build_computer gains reset. - Capture progress lines carry window, checkpoint and refusal events; apps start in the home; a pack script builds the runtime archive; long tools send progress notifications. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): make build capture and witness steps retryable, and close the near-miss reset hole - A capture whose start answer is lost is stopped at once and kept unreleased until the stop is confirmed; a lost checkpoint answer is recovered from the capture's own log, and draft and export use the checkpoints its Evidence records; stop can be repeated to resume reading its result. - A witness can check its seed again after a failed read, and keeps its stages in a saving state until the record is written, so a failed save can be retried without reading the app again. - after_edit and near_miss count only click, drag, scroll, type and key, so a reset no longer stands in for the near-miss edit. - A .deb build keeps its package file for capture and passes its URL to export; bundle downloads write each checked file before fetching the next; an apt-get update failure reports its exit code and log tail; reset sends progress while it waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep the Trash out of seeds, bundle folders unwritten and first frames drawn From the blind Inkscape rebuild: - Paths in ~/.local/share/Trash get a desktop_trash reason and the shared_desktop role, so a file trashed before seed is neither owned nor seeded; the export names it in a limitation. - The keep helper runs with PYTHONDONTWRITEBYTECODE=1, so starting a computer from a bundle folder no longer writes __pycache__ into it. - start_build_computer waits, bounded, until the first frame is not one colour before returning it. From review: a .deb that apt also offers exports from apt, since export passes --package-url only when the capture says the package must come from its file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): bound the first-frame wait's retries to the time left, with progress throughout Each retry of the drawn-first-frame wait runs under an abort that fires at the 10 s deadline, and the latest frame is returned when time runs out. connect takes the first frame itself while its progress heartbeat still runs, reporting "waiting for the desktop to draw". The wait moves to DrawnScreenshot.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): serialize each build computer's calls, keep one recording id, and separate unreadable checks from failures - One queue per computer: actions, capture steps and witness checks run one at a time, so two overlapping after_edit checks can no longer both be filed and let the witness hold without a near miss. Close cancels the running and queued calls; different computers still run concurrently. - The witness keeps one recording request id per computer, so a seed retried after a lost reply recovers the recording it started. - A check that could not read its file is undecided, not a failure, so a temporary read error can't satisfy seed, near_miss or after_reset; such a stage is refused and can be checked again. - The export's file listing is written to a file and read back in bounded batches, so a large bundle no longer overruns exec's 1 MiB output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): treat failures on cut views as undecided, require a decided seed failure at export, and keep a close's cancellation - A presence check that misses its line, row or pointed value in a view cut short is undecided rather than failed, since the data may sit in the part left out; a witness stage can no longer be proved by such a failure. - Export counts only decided failures on the seed, and refuses a task whose every seed failure is undecided. - A step whose turn was aborted by a close or the caller returns cancelled even when its work finished, so start_build_capture no longer reports success for a computer being removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep a step's saved result when a cancellation arrives during its commit Reporting cancelled for any step whose turn was aborted after its work replaced a completed export or witness save with a bare cancellation, losing what was saved and leaving the witness unreadable. Steps now return what they completed; only start_build_capture, which commits nothing, checks its turn after the post-launch screenshot and reports cancelled. Asking again for a saved witness's final check returns its record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse a saved witness's repeated check for another folder Asking again for the check that ended a witness returned its saved record whatever directory came with it, so a caller naming another folder got success though nothing was saved there. A different folder is now refused, as an unfinished seed's retry already is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): assert the facts of cut-view and undecided outcomes, not their sentences The new cut-view, missing-value, undecided-refusal and witness tests froze whole descriptions, so a harmless rewording broke them. They now check each outcome's id, passed and undecided exactly and the facts its message must carry (file, pointer, line, row, stage) separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): read XML with a plain DOCTYPE, and check an element's whole text - Both readers accept a DOCTYPE with only a name and an optional PUBLIC or SYSTEM identifier, record it as the view's doctype, and never fetch the DTD or expand entities beyond XML's five; an internal subset, an external entity and a parameter entity stay refused alike. - text_equals and text_contains compare the concatenated text of the element (or text node or attribute) a pointer reaches, as XPath string() does, with optional normalize_whitespace; both evaluators agree, and a text check on a truncated element is undecided. - Whitespace-only text between elements is dropped only when the element holds no other text, so text split into runs keeps its spaces. - The draft suggests text_equals for an element whose text changed. So an AbiWord .abw reads as XML, and its paragraph's text is checked whole however AbiWord splits it into <c> runs, as Writer's spans are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): draft whole-text checks on the paragraph, read only text as text, and skip asctime stamps - A changed value is read at both ends, so text that became a run still marks its paragraph, and the drafted text_equals moves up out of mixed content to the nearest ancestor named by an attribute, such as AbiWord's p by its xid. - Text checks accept only a text node or an attribute value; element names and doctype fields fail, in both evaluators. - isTimestamp also recognises asctime dates (Www Mmm dd hh:mm:ss yyyy). - XML files are drafted with the keyed diff the archive entries use, so no suggestion reaches an element by position; the shared logic moves to appTaskDraftNamed.ts. - Text-check tests assert facts, not whole sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep checks on a changed attribute inside a paragraph whose text check replaces its runs' A drafted whole-text check on a paragraph hid every change inside it, so a link whose label and href both changed drafted only the paragraph's text and the new destination went unchecked. The text check now covers text and runs added or removed whole; a changed name or attribute of an element both versions hold keeps its own check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read an attribute called name or attributes as an attribute when the draft keeps its check The owner of `.../attributes/name` was taken as `.../attributes`, so a changed `name` attribute inside a paragraph with a text check was dropped again. The owner is now read by segment, attributes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): draft text checks from text in runs added whole, and name a text element by its own id before its container Text typed into a run the diff lists whole was never read, so the draft kept only a presence check on the run, which wrong text also passed. Such text now marks the nearest element both ends hold, or, when none can take the check, the added element's own text. The climb also names an element by an identifier of its own (id, xml:id, xid) before a larger container, so a headline under a long layer keeps a whole-text check that survives re-split runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): expect the whole-text check where #8988's pairing test meets text checks On this branch a changed element's text is drafted as `text_equals` on the element, so the identity pairing test now expects that check, under the same `[@role=body]` key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(skills): build a computer-app environment from a request The product skill gains references/desktop-build.md, a procedure that takes Claude from a request such as "an Inkscape environment where the agent changes a poster's headline" to a witnessed bundle and a report, through start_build_computer, act_on_build_computer, the build capture tools, export_build_environment and check_build_task: questions asked once upfront, pauses only when blocked, a seed made in the app, content checks by selector, a witness with a near miss and a reset in a fresh computer, and solver runs only within a budget. setup installs the new reference; skillVersion 61. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(skills): fold the blind Inkscape rebuild's friction into the build skill key takes an array of one chord's keys; check for a text cursor before typing in apps with single-key shortcuts; in Save As, click Documents and type only the file name; anything saved before seed, the Trash included, is part of the seed; dismiss first-run dialogs before seed; a bundle's app starts with the seed's files but need not open the document; Inkscape's window class is Inkscape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(skills): fold the held-out AbiWord build's friction into the build skill Name the act fields and link the guide; a region screenshot becomes the latest frame; a drawn caret is not focus; confirm dialogs with Return; check the dialog's folder when the app shows only a name; an XML file the draft shows as lines was read as text, so use short line checks; and keep text checks to the value the edit types, since some apps save a reloaded document differently. Later witness stages take no directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(skills): state the export's seed rule, the Trash exception and draft refusals exactly The export refuses a task unless at least one check fails on the seed and every check passes at the end; a file moved to the Trash is left out of the seed, so trash a stray file rather than starting over; a null draft names its cause in draft_refusal; and a line check on a format read as text only approximates a value, so bound it and call it approximate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(skills): teach the build skill to use DOCTYPE and whole-text checks The skill now checks text an app splits into runs whole with text_equals or text_contains, finds an AbiWord paragraph by its xid, and drops the Writer revision-id workaround. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(skills): point text checks at the paragraph, and say what the scrub replaces From the AbiWord rebuild: point a text check at the paragraph or another element the edit keeps, never at a run a reopened document splits; how to name an unchanged element; the export replaces the host name, user@host and home path while a bare user name stays; AbiWord's entry and class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep every text check on a cut element undecided, in both evaluators The XML reader drops text deeper than its depth limit but keeps later siblings, and an element's whole text joins both sides, so a text_contains on a cut element could match text the file never holds ("at 3" + deep "WRONG" + ":30 PM" read as "at 3:30 PM"). Any text check on an element of a cut view is now undecided again, as #9050 had it, in REA's evaluator and the exported verifier; a text node or attribute value stays decided. The text check tests assert facts rather than sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): open the seed's document at launch, and say when a seed was made for the task An exported app now opens the seed's one document at launch when its desktop entry's Exec takes files, so a solving agent starts in the document rather than on the app's start screen; a command that already names a file is kept, and several documents or an Exec without a file code keep the launch and say why. `--synthetic-seed`, which the build export passes, words the README and limitations for a seed made in the build computer instead of asking to keep the user's data local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): count only a document the launch names, absolute or from its working directory, as already opened A settings path under the home, such as geany's --config, kept the seed's document from opening, and a relative document argument was missed and appended again. An argument now counts only when it resolves, from the captured working directory, to a file the capture gave the document role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): check the seed and launch wording against their formatters, and the facts on their own The tests froze the README's and limitations' sentences, so a harmless rewrite broke them. The wording now comes from exported formatters (`seedWording`, `seedLimitation`, `launchDocumentNote`, `NO_LAUNCH_DOCUMENT`), the tests compare against those, and check the facts separately: which document opens, the respelled path in the command, the README naming it, `--synthetic-seed` and the Evidence's `synthetic_seed`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(desktop): plan the export's seeds and launch in their own module The merged export module passed the file and function size limits; the seed digests and the launch command now come from `DesktopExportLaunch.ts`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep a reset applied when the screenshot asked after it fails Once data/reset and the ready wait succeed, act_on_build_computer's reset is applied in the action log and returns success; a screenshot asked of it that is then refused or throws is named in the result's screenshot_error, with no frame, so the next after_reset stage is not refused. Cancellation still propagates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep checks for elements without text beside a text edit, and normalize DOCTYPE system id line endings A review found two gaps. - A paragraph's whole-text check covered every element added or removed inside it, including ones holding no text: an image frame, a line break. A solver who typed the text but never inserted the image passed. Such an element now keeps its own presence or absence check. - The Python reader kept a DOCTYPE system literal's CRLF where TypeScript normalizes it to LF. Both now report LF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): wait out long build commands, fail a reset that restores nothing, and tie the witness to its bundle A review found five gaps. - Commands in the computer answer only when they end, but fetch stops waiting for headers after 300 s. So a slow export, draft or start always failed. A command with its own deadline now waits on node:http, bounded by that deadline. - after_reset held whenever some check failed, so a reset that changed nothing passed on the near-miss state. Each check must now come out as it did at the seed. - A failed or partial apt-get update left lists that looked complete, so a second start skipped the update. The update is now recorded only when it succeeds, and rerun otherwise. - A witness on a bundle computer graded whatever task it was given. Its seed stage now refuses a task whose steps or checks differ from the bundle's. - A task too large for one command argument (96 KiB) is refused before the export runs, instead of failing with E2BIG in the computer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): advertise a checkpoint-name pattern that compiles in every JS regex mode main's advertised-pattern test compiles every input schema pattern in v mode, which refuses an unescaped hyphen in a character class. The checkpoint name's hyphen is now escaped, and it means the same in u mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): import textSyntaxFormat once in the state format tests main's mixed-case JSON suffix fix and this branch both added the import, and the merge kept both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep a completed reset, an unread seed, and a failed apt update A cancel after data/reset no longer drops the restore from the action log, so a near miss cannot treat the restored seed as an edit. An unreadable seed check that later passes leaves after_reset undecided instead of failing the witness. apt-get update is kept only when Error-Mode reports success and a package list was fetched. The controller reply schema lives with the controller, and capture progress lines are read by their domain parser. * fix(desktop): keep a whitespace-only run under the paragraph text check A run whose only text is whitespace is still text the paragraph check reads. It no longer gets its own presence check, which a later save of the same words without that run would fail. Images and breaks, whose text is empty, still keep their own checks. * fix(desktop): keep an unread reset and a cut text check undecided after_reset stays undecided when any check was not read, even if another check still fails and the unread result's boolean matches the seed. A text check for a child past a truncated view is undecided in both evaluators. A reset whose reply is lost blocks a near miss until a later input or a reset whose reply arrives. * fix(desktop): retry a witness recording and a published record's cleanup A recording that fails to end or download is not written into the witness folder, and a manifest already received is fetched again without ending the recording twice. A folder that is published while its handles fail to close keeps that record and retries the same cleanup instead of writing the folder again. * fix(desktop): keep a published witness error and tag an app data refusal A second failure to close a published witness returns the original error, so its record and cleanup lease stay bound. A reset the app itself refuses is an AppDataRefusal; only a reply that is not that refusal stays unsettled. A missing child of a cut view is undecided with the same description in both evaluators, and the shared cases cover it. * fix(desktop): align a cut view's missing text with the Python check A missing child of a truncated view is undecided for the same sentence in both evaluators, including the pointer the view does not contain. * fix(desktop): keep one published witness cleanup across retries A published record and its bound cleanup error stay together. A later close failure returns that error, and the unused path that built a fresh adapter error is gone. * fix(desktop): keep a bundle task read inside the witness result A cancelled, refused, or failed read of the bundle's task files returns the witness's Result, including a cleanup lease when a handle would not close. * fix(desktop): check build runtime export capability * fix(desktop): provide complete runtime repack command * fix(desktop): retain runtime probe failures * fix(desktop): recognize captured file URL documents * fix(desktop): render captured file URLs at launch * fix(desktop): isolate launcher URL encoding * test(desktop): move launch execution to boundary suite * style: fix desktop launch test formatting * style: format native command path schema --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
24 KiB
Desktop application export
rea export-desktop-application <capture-folder> <directory> turns a folder
written by desktop application capture into an
agentenv bundle holding one computer app environment: the real application,
installed from the distribution archive, its vendor's apt repository or the
.deb file it was installed from on the ubuntu-24.04 computer base, launched
at boot, seeded with the user's state and serving that state through agentenv's
data operations.
rea export-desktop-application ./mousepad-capture ./mousepad-bundle
agent-env run ./mousepad-bundle --dry-run
The export reads the capture and its state view;
it does not run the application. --name sets the environment name; otherwise
it comes from the desktop entry id or the program, with an app- prefix when
that name would not be a portable bundle name (for example all digits). The
output directory must be new or empty. --task adds a task an agent wrote for
the capture, once REA has validated it against the capture; see
desktop application tasks. --package-url
says where the computer downloads the package of an application installed from
a .deb file; see Applications from a .deb file.
--seed-checkpoint names the checkpoint whose state seeds the bundle, the
baseline by default, and --end-checkpoint the one a task must pass on, the
capture's last by default; see The seed checkpoint.
--synthetic-seed says the seed was made for the task, as a build agent makes
it in a build computer, rather than taken from the
user's own data; see A seed made for the task.
The command returns Evidence with operation export_desktop_application and
predicate type rea.desktop-application-export, listing the environment name,
the seed and end checkpoints, owned paths, seed files, the seeds it
rewrote to remove the capture host's name and user (scrubbed_files), the
bundle files that still hold them (unscrubbed_files), and written files,
the last three by their path in the bundle. A failed export, cancellation
included, removes the bundle it had not yet published, so no partial copy of the
user's data remains. If the bundle was published but its output handles could
not be closed, the command reports a cleanup error that carries the export
Evidence; the bundle itself is complete.
The bundle
| Path | Contents |
|---|---|
envs/<name>/env.toml |
type = "computer_app", the module and class, computer = "ubuntu-24.04", driver = "reference" |
envs/<name>/<file>.py |
The ComputerAppEnvironment class |
envs/<name>/SKILL.md |
What the app is, its window class and where its files live |
envs/<name>/seed/ |
The application's files at the seed checkpoint, by home-relative path |
envs/<name>/apt-keys/ |
The signing key of each vendor apt repository the app installs from |
envs/<name>/install-package.sh |
With --package-url: the run script that installs the downloaded package with dpkg |
tasks/smoke.json |
A task that deploys the app |
tasks/<task>.json |
With --task: the agent's task, its verifier in artifacts/ and the eval in evals/ |
README.md |
What was exported, from which capture, and what to keep in mind |
The class file is <name>_app.py with hyphens as underscores, for example
mousepad_app.py: agentenv imports it under its stem, so a plain <name>.py
could shadow a standard library module such as calendar. A class name that
would collide with a name the module imports or defines, such as Path, takes
an App suffix.
The class declares:
Packages(apt=[...])with the package the capture found. A vendor package is named<package>/<release>, its repository's release (the Suite apt reports asa=, or else its Codename), so apt takes it from that repository even when the Ubuntu archive offers a higher version or epoch, as noble's transitionalfirefoxdoes over packages.mozilla.org's; it is named alone when the release names neither, or when the capture was written before releases were recorded. Its library packages follow, so a package that leaves out dependencies on the libraries it loads, as Typora's Electron package does, still starts; library packages the capture found neither the Ubuntu 24.04 archive nor a declared repository offers are left out, with a limitation, and so are those only repositories the export leaves out supply (a repository'ssupplies), such as one whose key the capture could not retain. An archive package's declared dependencies are trusted as they are. When the desktop entry's package is not the one that owns the program it runs, asvim-common's entry runsvim's program, the program's package (executable_package) follows the app's by name, since the entry's package need not depend on it; a capture that found no archive or declared repository offering it records why, and the export refuses it with that reason, as it does when only repositories it leaves out supply it, or when no package owns the program at all (executable_package_reasonwithoutexecutable_package). The package must come from the Ubuntu 24.04 archive or a mirror of it, or from a vendor apt repository whose signing key the capture verified and retained. A source counts as the archive when apt reports its origin asUbuntufor a noble suite; a capture made before origins were recorded counts only Canonical's own archive hosts.- For a vendor repository,
sources=[AptSource(apt=..., suite=..., components=[...], key="apt-keys/<name>.gpg")], with the retained key copied to that path (.ascwhen it is armored, which agentenv tells by its content). A PPA added withadd-apt-repository, whose sources entry holds its key inSigned-By, exports that key asapt-keys/<name>.asc. apt takes one key per URI and suite, so sources that share them, such as one repository listed for two architectures, are declared once, with their components merged; one with a different key is left out. A repository whose key the capture did not verify, an Ubuntu Pro (ESM) repository, one whose sources entry's URI held a user name or password (which the capture did not record and the export never writes; the reason names neither them nor the URI), one not reached over http or https, or one whosearch=restriction leaves out the capture host's architecture is refused with its reason (a capture written before restrictions were recorded counts as unrestricted); when another usable repository lists the same version it is left out instead, with a limitation. The export also refuses snaps, flatpaks, AppImages, and a package no recorded repository lists unless it was installed from a.debfile the capture recorded and--package-urlis given, since the computer could not install them by name, and a capture written before credentials were removed whose repository URI still holds them, since it counted that repository's libraries as installable; capture it again. @computer_app(supports=...)with bothamd64andarm64for an archive package, which the archive serves for both, and only the capture host's architecture for a vendor package, since its repository may serve no other. A vendor package captured on any other architecture is refused. A package installed from its.debfile supports only that file's architecture.- A launch at boot with the captured command, ready when a window of the
captured class appears and one of them is listed in the taskbar and is not
typed as a splash: a splash screen or a dialog of the class skips the
taskbar or says it is a splash, and an app whose splash shows first would
otherwise count as ready before its own window opens. Arguments that are the captured home or under it, and
<option>=<path>values under it, are respelled under the computer user's$HOME. agentenv starts the app in its own folder, where an open or save dialog would show the framework's files, so the command first changes to the captured working directory ("$HOME"when that was the home, as for a desktop entry withoutPath), which a relative argument or program path such as./appalso needs, and still starts if that folder is missing. The export refuses a capture that saw no application window. - The seed's document, opened at launch, so the app shows it rather than its
start screen: when the seed holds exactly one file the state view gives the
documentrole, and the desktop entry'sExectakes files (a%f,%F,%uor%Ufield code), its path under$HOMEis appended to the command. A command that already names a document, absolute or from its working directory, as one captured with--argument <file>does, is kept as it is; a settings path under the home does not count. A seed with no document launches as captured. With several, no desktop entry or anExecthat takes no file, the app launches as captured and the README and the result's limitations say why. A reset relaunches the app, so it opens the document again. - For an Electron application (the capture found its fuse sentinel or a
resources/app.asar),--no-sandboxright after the program unless the command already has it: Chromium's sandbox needs user namespaces the computer's container does not grant, and Electron exits without them. The README and the result's limitations say the sandbox is off. paths: the state directories holding the application's state files and the folders holding its documents, nested folders collapsed. A folder beside a state directory whose name differs from it only in letter case is owned whole in the files' spelling, so a~/.config/GIMPprofile GIMP created during the capture beside the candidate~/.config/gimpis owned as.config/GIMP, not as the folder of its first file. The home itself and the shared.config,.local,.local/share,.local/stateand.cachefolders are never owned whole: a file directly in one is owned as itself. Files the capture recorded under a symlinked state directory's physical spelling are mapped back to the innermost such directory's home spelling, unless that spelling is outside the captured home, as when the home itself is a symbolic link. When two files map to one home path, the export uses the one present before the capture, else the first by path, and a limitation names the other.- Data hooks, because declaring any hook switches off agentenv's default data
plane: the class seeds the home once per boot and keeps it as the initial
state with
keep_initial,data/addanddata/resetcall agentenv'saddandreset, anddata/getreturns the files underpathsplus a data part with a typed JSON view of each, read in a worker thread. An application with no observed state declares no paths and no hooks.
A file under the owned paths whose bytes at the seed the capture did not
retain is not seeded: one in the state view without retained content at that
checkpoint, or one the capture omitted (for example too large or past the
content budget). The result lists them in unseeded_files and the README
names them. When the application held files open in folders whose starting
content the capture did not retain, a limitation names those folders. The
desktop Trash, ~/.local/share/Trash, is never the application's, so a file
the user moved there is neither owned nor seeded, even when a window title
names it; a limitation lists the files the Trash held at the seed.
The application's dconf keys at the seed, if any, are written once when the
app first starts, also for an application that owns no files, and the class adds
dconf-cli to its apt packages for that. The server starts before the
desktop's D-Bus session, so the class does not use dconf load: it dumps any
existing user database through a file-db: profile, then runs dconf compile
on that dump and the captured keys, in that name order so the captured keys
win, and replaces ~/.config/dconf/user. If that fails, the server prints a
one-line warning and the app starts without the captured keys. data/reset does
not restore them.
The seed checkpoint
By default the seed is the state before the capture, its baseline, and a
task's end state is the capture's last checkpoint. --seed-checkpoint and
--end-checkpoint name others, so one capture can make a seed and then a
change: the user creates and saves a document and takes checkpoint seed,
then edits and saves it and takes checkpoint end. Exported with
--seed-checkpoint seed --end-checkpoint end, the bundle seeds the document
as it was saved at seed, owned paths, dconf keys and unseeded files
included, and a task must fail on that seed and pass on the state at end.
A file's state at a checkpoint is its last version recorded at or before it.
The export refuses a name the capture does not hold exactly once, and an end
checkpoint taken before the seed checkpoint; inspect-desktop-application-state
lists the names in capture.checkpoints.
A seed made for the task
By default the seed is the user's real data: the README and the result's
limitations say to keep the bundle local and not publish it. With
--synthetic-seed they say instead that the seed was made for the task, and
to read envs/<name>/seed/ before publishing the bundle; the export cannot
tell the two apart, so the flag is the caller's word. export_build_environment
passes it, since the building agent makes the seed in the build computer. The
Evidence records it as synthetic_seed.
Host name and user
A seed can hold the capture host's name and the user's: Geany saved its mail
template as pref_template_mail=ada@e81232be457d, the user ada on a
container named e81232be457d, and many files hold the home path
/home/ada. The capture records host.hostname and host.user, and the
export removes them from what the bundle ships:
- In seeded text files (text, JSON, key files and XML in the state view), in
UTF-16 files that start with a byte-order mark (keeping the mark, byte order
and a following U+FEFF content character), and in the dconf keys,
user@hostbecomesuser@localhost, the host name standing alone becomeslocalhost, and the captured home becomes/home/userwherever it is followed by/, the end of the text, or a character that cannot continue a file name. The host name counts only as a whole name: not inside a longer word, before a-, or as a label of a domain such ase81232be457d.local, so a host namedubuntuleavesports.ubuntu.com/ubuntu-portsalone. A host namedlocalhostis left alone, but itsuser@localhoststill takes the computer's user. The user name alone is never replaced, since a short one such asadaoruseris also ordinary text. A rewritten seed is written with its own SHA-256, andscrubbed_filesand the README list it. - JSON and XML keep their syntax. In JSON only string values change, each
read as its decoded value, so
\u0065escapes cannot hide the host, and is written back as JSON only when it changed; numbers andtrue,falseandnullstay as they are even for a host namedtrue. Member names are never rewritten, since{"ubuntu": 1, "localhost": 2}on a host namedubuntuwould get twolocalhostkeys and lose a setting; a file whose names hold the host is listed inunscrubbed_filesinstead. In XML only character data, attribute values, comments and CDATA change, character references decoded the same way; element and attribute names and processing instructions stay. A UTF-16 file is scrubbed by the format its text would have in UTF-8, so JSON or XML in UTF-16 follows these rules too. - In the dconf keys only GVariant strings change, each read as its decoded
value and written back in its own quotes only when it changed. Group names,
keys, dictionary keys, bytestrings and everything outside quotes stay, so a
host named
trueleaveswrap=truealone. A value whose string does not parse, or that holds an object path or signature, ships as captured. SEED_HOMEin the class is/home/user, the home the seed spells, which the class respells to the computer's own home when it seeds the home at boot, as it did the captured home before. The replacements read as the computer's own: its user isuser, with its home in/home/user, andlocalhostis the name every host has for itself.- Binary files, SQLite databases among them, and text files over 256 MiB are
copied as captured. Then every file the bundle ships, the class module with
its dconf keys and the README included, is searched by a looser rule than
the replacement's: the host name and
user@hostanywhere, as ine81232be457d.localor a seed namede81232be457d-notes.txt, and the captured home as a whole path, in its path and its content, JSON and dconf strings and XML references decoded and the replacements themselves set aside. Each one found is listed inunscrubbed_files, and in the README unless it is the README, to check before sharing the bundle. Bytes that are not text are searched as they are, so a binary file that holds the host in another encoding is not listed. - A task check whose values name
user@hostor the host name anywhere, by that rule, is refused, as one naming the captured home is: the bundle does not hold them. Its field names, kind and id are not values, so a host namedfileorkindrefuses no check. A task's checks must fail on the seed as the bundle ships it, scrubbed, so a check the scrub itself satisfies, such as a mail setting the user changed fromada@e81232be457dtouser@localhost, does not count as failing there.
A capture written before the host's name and user were recorded has only its home removed, with a limitation saying so; capture again to remove the rest.
Applications from a .deb file
A closed-source application you installed from a .deb file you downloaded,
such as VariCAD from varicad.com, is not in any apt repository the computer can
use. Capture it with --package-file naming that file (see
desktop application capture), then pass
--package-url to the export with an http:// or https:// URL the computer
can download that same file from:
rea capture-desktop-application --executable varicad --package-file ~/Downloads/varicad2026-en_2.03_amd64.deb --output ./varicad-capture
rea export-desktop-application ./varicad-capture ./varicad-bundle --package-url https://files.example.com/varicad2026-en_2.03_amd64.deb
The class then declares, beside Packages:
downloads=[Download(url=..., sha256=..., to="vendor/<file>", arch=...)]with the captured file's SHA-256. agentenv downloads the URL once, when the bundle is put, and refuses the file unless its SHA-256 matches, so the computer installs exactly the captured version. The bundle does not contain the package.Packages(apt=[...])with the first alternative of each of the file's Depends and Pre-Depends entries, without version constraints or:anyqualifiers, then the library packages the capture found, since a vendor's binary may load libraries its Depends leaves out.run=[RunScript(script="install-package.sh")], a script the export writes into the environment folder. agentenv runs it as root from the app's folder once the apt packages are installed and the download is in place, with the network off: it runsdpkg -ion the download and then removes it.
The bundle supports only the file's architecture. Vendor sites often refuse automated downloads, as varicad.com does, so the URL may need to point at a copy you keep, such as a private mirror; you must be allowed to use that copy, and the package's licence, such as a 30-day trial's terms, is yours to check. The README and the result's limitations say so.
The export refuses a package no recorded repository lists when --package-url
is missing, saying to capture with --package-file if the capture lacks it. It
also refuses --package-url when the capture recorded no package file, giving
the capture's package_file_reason when there is one; when the archive or a
declared vendor repository installs the package already; when the URL is not
written as http:// or https:// or holds a user name or password; and when
the file is built for an architecture other than amd64, arm64 or all.
Typed views
The views follow the state view's formats and
shapes: SQLite tables (at most 64 ordinary tables, tables_truncated past
that, and per table columns, primary_key, at most 500 rows and
truncated, with blobs, unsafe integers and text that is not UTF-8 tagged as
REA tags them), JSON, XML as {root, truncated} with REA's node, depth and
whitespace rules and its doctype when the document declares one, key file
groups, text as
{lines, line_count, truncated} split on \n and \r\n, and zip archives
as their entries, read with Python's zipfile from the file in place, with
REA's entry, size, compression ratio and archive limits and its wording for an
entry it does not read. The module reads the central directory itself, as REA
does, and shows zipfile only the records it lists, reading each entry in
bounded chunks no further than a byte past its declared size. A JSON file
holding a number JavaScript cannot read exactly, such as an integer above 2^53,
or whose retained value nests more than 500 levels deep, gets an error instead of a view, as in
REA. Duplicate keys keep their last value before the depth check. Text that is not one JSON
document, such as JSON Lines, stays text. Format detection follows REA's
rules. Files larger than 64 MiB get an error instead of a view
and are not read. XML is read with Python's expat twice: with namespace
processing, which refuses what REA's parser refuses, such as an undeclared
prefix, then without it, so element and attribute names keep the prefixes the
document spells and namespace declarations stay attributes, as in REA's view;
text splits into nodes where REA's splits it, at CDATA sections, comments and
processing instructions. Both passes read a DOCTYPE as REA does: with
parameter entity parsing off, so the DTD it names is never read, and handlers
that refuse an internal subset, an external entity and an entity expat would
skip; the first pass also checks each start tag for a reference to an
undeclared entity, which expat drops from an attribute value without a word
when a DOCTYPE names a DTD. Known differences remain:
- dconf databases are reported as binary, since REA reads them with
dconf; inside an archive, one isdconfwith an error, as in REA. - Zip entry names: a name in an Info-ZIP Unicode Path extra field is used only
where Python's
zipfilereads it (3.12 and later), and an entry whose local header names it differently from the central directory is damaged rather than read. - SQLite databases are read in place, read-only, rather than from a staged copy;
a write lock the running app holds is waited out for a quarter of a second
and then gives the file an
error, and so does a table or column name that is not UTF-8.
Unless it was made for the task, the seed is the
user's real data. Keep the bundle local and do not publish it.
The class was checked against agentenv-framework 0.9.1431 with
python -m agentenv_protocol.computer._declare and agent-env run --dry-run.