* feat(desktop): capture a Linux desktop application in use Add `capture-desktop-application`, a CLI-only, Linux and X11 capture that launches an installed desktop application, watches it while it is used and writes capture Evidence plus SHA-256 addressed content: - inventory: desktop entry, launch command, executable, package and its apt sources (or snap, flatpak, AppImage), Electron markers and candidate state directories; - session: the launched process tree, client windows from xprop with the first application window time and a window match, and files held open; - state: a stat walk of the home directory before launch, at checkpoints read from stdin, at stop and after exit, with created, modified, deleted and retyped paths and the content of changed files and state directories. It refuses non-Linux hosts, missing DISPLAY or xprop, a non-empty output folder and an application whose window is already open, and signals only processes it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): own launched processes, confirm walk coverage and keep cancelled captures - Launch through the owned provider path with a run token; release with SIGTERM, then the token-verified group cleanup, after every session. Processes without the token are never signalled; each records whether it carries it, and the session records whether cleanup was verified. - Report creations and deletions only where a walk listed the nearest existing directory; count the rest as unconfirmed. - Retain a file only when it is still the walked version, through owned no-follow reads; charge the budget only for new content; create files exclusively in a private output folder owned by the caller. - Walk content roots outside the home directory, compare paths in their physical spelling, and run executables from the caller's directory. - Refuse when the window list cannot be read, re-evaluate window ownership each sample, handle one queued request per sample with a bounded stdin queue, and write the capture with end reason `cancelled` on interruption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep owned cleanup failures and fresh digests - Allow a capture cancelled before any requested checkpoint to hold only the baseline. - Retry an incomplete stop once; if cleanup is still unverified, write the capture and fail with the run token and process group as cleanup resources. - Classify path changes after a walk (ENOTDIR and other selected-file errors) as changed_since_walk instead of failing the capture. - Treat a non-directory ancestor as proof that nothing existed beneath it. - Report a before digest only for the file version it was read from. - Derive stderr_truncated from stderr's own byte counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(desktop): state view over a capture folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep failed file-handle closes owned for retry Content reads pass retainFailedClose, so a handle whose close fails stays owned by the content store; the capture retries those closes after it is written and fails with the output folder as the cleanup resource if one still cannot be closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): read a captured application's state Add inspect-desktop-application-state, a CLI command that reads a capture folder into the application's state: every retained or changed file with its role and reasons, a typed JSON view of each version (SQLite through the shared worker, dconf through a private dconf dump, JSON, XML, key files, text) and the kinds of change between versions (lines, values, keys, rows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): report process and handle cleanup failures together When both the launched processes and a retained file's handle remain unresolved after the capture is written, one cleanup error now lists both reasons and both resource sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): export a captured application as an agentenv computer app Add export-desktop-application, which writes an agentenv bundle with one computer_app environment from a capture folder and its state view: the apt package, a boot launch matched on the captured window class with a window ready check, owned paths from the state roles, a seed of the baseline files, data hooks that call agentenv's add/get/reset helpers with a typed JSON view on get, a skill, a README and a deploy smoke task. The desktop CLI commands now load their services lazily. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep state views faithful to the capture - Read key files, XML attributes, dconf groups and SQLite tables into dictionaries without inherited properties, so captured keys such as __proto__ stay data. - Version databases with their write-ahead log as of each checkpoint, and stage only digest-verified bytes for the SQLite and dconf readers. - Detect the format per version, report format changes, keep JSON null and empty containers as values, keep XML text and preserved whitespace, and mark truncated views (including XML depth) and comparisons of them. - Number versions and changes by checkpoint index, decide baseline presence from the captured type, and keep tagged SQLite integers, text bytes and blobs distinct. - Carry the capture's limitations and omitted content forward, match state directories by their home path, index changes once per capture, keep failed handle closes owned, and finish the CLI through the shared owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep coverage, logs and handles honest in the state view - Read coverage flags only from formats whose readers write them, so JSON fields named truncated stay data. - Fail a SQLite version whose write-ahead log existed but was not retained or does not match its digest, instead of reading the database alone. - Close retained content on every exit, including cancellation, and report a close that still fails together with the primary failure. - Finish the CLI with the canonical operation name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): export only what the computer can install and seed - Refuse packages not from the Ubuntu 24.04 archive, since the computer installs by name from that archive. - Start the launch command in the captured working directory. - Respell the home path only in files the state view read as text. - Report files that were not retained instead of dropping them silently. - Load captured dconf keys for apps that own no files. - Keep home-level files as owned paths; rename reserved Python class names. - Mark truncated SQLite and text views in the class's get view, and read file types the way the state view does. - Release the output tree through a resource scope, and read seeds through an owner closed on every exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep staged folders owned, symlinked state roots and XML values - Stage database bytes in a private runtime root released through a resource scope, so a failed removal keeps its owner and is reported with the read's outcome. - Report cleanup facts and owners from desktop failures instead of wrapping them as a plain adapter error. - Record the state directories as walked, in their physical spelling, and match roles against both spellings, so files in a symlinked state directory are not mistaken for selected documents. - Keep whitespace-only XML leaf values; drop only formatting between elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read XML in the exported app the way the state view does Keep whitespace-only leaf values and xml:space="preserve" text in the generated get view; drop only formatting between elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): release retained handles with their owners, read older captures - Release retained-content handles whose close failed through a resource scope on every exit; a release that fails again reports the exact handle owners. A read that finished keeps its bytes when only its close failed. - Accept captures written before state directories were recorded, and say in the state view's limitations that symlinked state directories may be misclassed for them. - Compute each XML element's whitespace context once instead of scanning siblings for every text run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): boot without the working folder, bound XML, accept mirrors - Try the captured working directory only when an argument is relative, and start the app even when that folder is missing. - Cut the generated XML view at REA's node and depth limits, and keep one unreadable file from failing data/get. - Accept Ubuntu 24.04 mirrors, not only the canonical hosts; PPAs and other repositories are still refused. - Read seeds through the retained-content owner's new signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): state view review round - Stage a retained -journal beside its database so the SQLite worker accepts an inactive journal and refuses a hot one; a -wal or -journal that existed but was not retained (including one omitted at the baseline) makes the version unreadable. - Keep tables that read when another fails, and let cancellation and unfinished cleanup propagate instead of becoming view errors. - Read text as a key file only when every line parses as one. - Rank a file named in a window title or selected by the caller as a document even when the application holds it open; match titles on file-name boundaries; leave the display name out of dconf matching. - Bound JSON and key file views (4 MiB, 500 levels, exact numbers) and report too-large, missing and altered retained content separately. - Add no version or change while a database stays absent. - Read staged databases in place instead of copying them again. - Give Evidence the same limitations as the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): export review round - Load captured dconf keys without D-Bus: install dconf-cli, compile the existing and captured key files into the user database, and warn on failure instead of stopping the server. - Start relative-argument launches in the captured working directory, the home included, since the framework launches from the app folder; respell the home itself and option values under it. - Read views in a thread, skip files over 64 MiB, align the generated readers with the state view's, and close SQLite connections. - Never own the home or a shared base folder; map a symlinked state directory's files back to their home spelling. - Report omitted files and unretained opened folders. - Name the module so it cannot shadow another, and keep the class off the module's own names; derive names the bundle check accepts. - Write seeds as they are read, and remove an unpublished bundle on failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): capture review round - Ask the launch process group and token carriers to exit before killing them, on errors too; report incomplete cleanup with its facts. - Count descendants of the launch as started by the capture even when their environment cannot be read; treat a reused pid as a new process. - Follow symlinked desktop entries; name a flatpak's state after its application id; match flatpak windows by name only. - Stop on end of input; refuse empty, duplicate and reserved checkpoint names; require whitespace after the checkpoint keyword. - Stay on each walk root's device, and never walk or retain `/` or a directory containing the home; say so in the limitations. - Refuse a window manager that does not publish _NET_CLIENT_LIST. - Remove retained content when a capture fails before it is written. - Skip reading a file larger than the remaining content budget. - Record apt's archive origin for each package source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read an unset client list as no windows when supported xfwm4 leaves _NET_CLIENT_LIST unset while it manages no windows, so the capture refused an ordinary desktop with nothing open. Read _NET_SUPPORTED with the list: an unset list means no windows when the window manager supports it, and the capture is refused only when it does not. `xprop`'s "no such atom" output now reads as unset too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): accept packages by apt's archive origin Accept a package source when apt reports its origin as Ubuntu for a noble suite, so mirrors count and PPAs or other repositories that merely have "ubuntu" in their URL do not. Captures made before origins were recorded fall back to Canonical's own archive hosts. Seed reads report why retained content could not be used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): capture and export apps from vendor apt repositories A closed-source app installed from its vendor's apt repository, such as Typora, can now be captured and exported as a computer app. - The capture records each non-Ubuntu repository listing the installed version (uri, suite, components from apt's sources files, one-line or deb822) and the key that signs it: the signed-by key, or the trusted key that gpgv shows verifies the repository's signed index. The key is retained with the capture. - The capture records the packages owning the libraries the executable loads (DT_NEEDED with RUNPATH and the linker cache, through REA's ELF readers), since a vendor package may not depend on them. - The export declares a verified vendor repository as an AptSource with its key, installs a vendor package's library packages, and adds --no-sandbox to an Electron app's launch, since a container denies Chromium's sandbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): report a locked database at once in data/get A database the running app holds locked made each data/get wait sqlite's five-second busy timeout before reporting it. Record the Typora run in an agentenv computer in the verification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(desktop): detect key files without splitting the whole text Read lines one at a time and stop at the first that a key file view would drop, instead of splitting a file of up to 64 MiB into arrays before its format is known. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep symlinked homes and state folders under the home in exports - Respell a path under its state folder's logical spelling only when that spelling is under the captured home, so a symlinked HOME keeps its files; pair walked and logical state folders only when the capture lists the same number, and match the innermost folder first. - When two files map to one home path, keep the one present before the capture and name the other in the limitations. - Read key files in the generated data/get with the state view's rule, checked against it by running the helper under python3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): end captures on zombies and keep cleanup owners - A zombie or dead process no longer keeps the session open. - Remove only the partial capture file this run created. - Keep the exact owners of handles and processes whose cleanup failed on the returned error, so a retry can release them; test the published capture's cleanup-failure branch with mixed outcomes and retries. - Release the application once even when the exit checkpoint fails. - A cancellation before the capture is written removes what it retained. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): vendor package review round - Match apt sources through `apt-get indextargets`, which covers flat `./` and `/` suites and gives each release file and sources entry. - Accept a key whose signature verifies even when the release carries another signature without a key here; keep only the verifying key from a keyring holding several (OpenPGP packet splitter). - Install the package from its repository's release (`name/<release>`), declare one source per URI and suite, support only the capture host's architecture, and refuse Ubuntu Pro repositories. - List only library packages the computer can install; walk libraries only for vendor installs, with RPATH inherited as ld.so does, normalized paths, and DT_NEEDED bounded while reading. - Put --no-sandbox after the program an env wrapper launches; keep the gpgv folder's owner when its removal fails; respect --max-file-bytes for keys; wait 0.25 s on a busy SQLite database in data/get. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): keep the vendor spec's gpgv command on one line A code span broken across lines left `<binary keyring>` for VitePress to read as an unclosed HTML tag, so the docs build failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): add a validated task to exported desktop applications Each capture can now yield one agentenv task in its exported bundle. An agent writes the task (a prompt plus declarative checks over the app's data/get views); REA validates it and stays model-free. - `describe-desktop-application-task` summarises a capture's net change per file (role, format, views before and after) and drafts checks. - Checks: file presence, lines present/absent/counted, JSON-pointer values, SQLite rows and counts. REA keeps a task only if a check fails on the seed and every check passes on the captured end state; a file that was not retained at the baseline counts as absent, as the computer starts. - `export-desktop-application --task` writes tasks/NAME.json (deploy, agent, skills, recording, prompt, verifier), a compiled verify.py that reads data/get, and an eval. A boundary test runs the verifier under python3 and checks it agrees with REA's evaluator on every check kind. - Docs, spec and skill guidance, with the solve-rate recipe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): keep the seed test in its own block Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): record the task verifier driven in an agentenv computer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): record the Typora task run in an agentenv computer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep task checks bounded, complete and attributable - line_count counts lines holding a substring (contains) instead of matching a regular expression, which could stall the verifier on agent-written text and read differently in Python. - value_equals of a whole object or array is undecided on a truncated view. - The draft keeps a database whose rows changed under an unchanged hash, and a file whose truncated views match while it changed. - A task file that cannot be read keeps the reader's detail, and a failed cleanup keeps the read failure as its primary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): leave a file with one version out of the task draft Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): update the task verification's test counts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): record the task solve rate with Claude Code and Sonnet 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): capture and export apps installed from a downloaded .deb capture-desktop-application --package-file reads the file's control fields with dpkg-deb and records its SHA-256, size and dependencies when it holds the installed package; the file itself is never kept. The library walk now also runs for local installs. export-desktop-application --package-url declares agentenv's Download(url, sha256) for that file, its dependencies and library packages as apt packages, and a run script that installs it with dpkg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): seed app-named dotfiles and respell UTF-16 seeds The capture now treats dotfiles in the home named after the application (.varicad-cfg.ini, .notesrc) as state roots, so a file the app only reads during the capture is still seeded. The exported seeding respells the captured home in UTF-16 text files with a byte-order mark, keeping the mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): hold readiness until the app's own window shows An exported app is ready only once a window of its class that the taskbar lists is shown, so a splash screen of the class, which skips the taskbar, no longer counts as the app being up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): record VariCAD captured, exported and run in an agentenv computer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep exported views strict JSON for infinite and inexact numbers The exported data/get spells infinite and negative-zero SQLite reals as REA's SQLite reader does ("Infinity", "-Infinity", "-0"), and refuses a JSON file holding a number that reading would change (1e999, integers past 2^53, -0, rounded fractions) with the state view's own error, instead of a view with an infinity in it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep package-file facts tied to one file and URLs unechoed - A --package-url refusal never repeats the URL, and credentials are checked before the scheme. - The package file's identity must hold between dpkg-deb's read and the hash. - A failed close keeps its cleanup owner even when the capture is cancelled. - Readiness also ignores windows typed as splash screens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): record database logs and keep state changes distinct - A selected path that is not a directory brings its -wal and -journal as content roots, so the capture records whether they exist and retains them. - The state view treats a file as absent only under recorded content roots and refuses a database whose log presence is unknown. - JSON changes list containers too, so an array that becomes an object with the same members is a change. - Key file entries escape the key as a JSON pointer segment, so [a/b] c and [a] b/c stay apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep watching through unread samples and late workers - An unreadable window list is unknown, not zero windows, and is named in the limitations. - Before ending the session, live run-token carriers no parent link reached are tracked; an unreadable process table leaves the exit unknown. - An env prefix's assignments find the program and name its XDG folders. - flatpak run options that take a value are skipped with it, -- is honoured and a /arch/branch suffix is dropped from the id. - State directories include the entry's full id. - Path options refuse empty values; roots count toward the entry limit. - A capture file whose close failed stays owned and is retried on discard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): bound apt sources, keep older captures and cleanup owners - Sources files parse into one stanza per line or deb822 paragraph with its URIs and suites kept as lists, so no URI x suite product is built. - Repository architectures and release are optional, so captures written before they were recorded parse; the export treats them as unrestricted and unknown. - Library sources are matched against every index of a declared repository's URI, suite and components. - Two failures side by side keep both causes and both cleanup owners, and a host file whose close fails reports a lease on its handle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): match escaped key file entries and suggest containers through members - The draft's key file lookup uses the state view's escaped `group/key`, so a key holding `/` or `~` still gets its suggestion. - JSON and XML changes now list containers too; the draft suggests an added or removed container through its listed members, and a container only when none of its members is listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read relative PATH entries from the launch folder A program, or an empty or relative PATH entry, is resolved from the folder the program starts in, as the launch does, so `env PATH=. app` with the entry's Path still finds the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(desktop): compare JSON views on one shared path JSON and XML changes are found by walking both trees with one shared pointer path, building a pointer only for a listed value, so memory follows depth rather than every container's full path. A pointer over 4096 characters is counted but not listed. A 256-level document with 4000-character keys went from about 251 MiB of heap to under 1 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep JSON Lines as text in the exported reader The exported reader parses the whole text before an inexact number makes it JSON with an error, so JSON Lines with an integer above 2^53 stay text as in REA. Over-long integer spellings are unsafe without converting them. The guide no longer claims large integers keep their value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep the state-path help free of dash-led words The CLI alias check reads `-wal` and `-journal` in help text as short flags, so the help names the write-ahead log and rollback journal instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): never record or export apt source credentials - Source URIs lose any user name and password as they are parsed, the way apt splits them, and so do index-target URIs and descriptions and the sources apt-cache policy lists, so matching works whether or not apt prints them. - A repository whose entry held credentials is marked `uri_credentials_removed`, and the export refuses it, or an older capture whose URI still holds them, with a reason that names no URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): look programs up without normalizing their paths Program paths and PATH entries are joined rather than resolved, so `..` after a symbolic link means what it means to the launch. The lookup moves to its own module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): note inexact JSON numbers with a flag, not a list The exported reader only needs to know whether any number was inexact, so it keeps a boolean instead of every rejected spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse older captures that still hold apt credentials A capture written before credentials were removed counted the credentialed repository's libraries as installable, so the export refuses it whole and asks for a new capture rather than declaring packages no source offers. Recorded policy sources are redacted in export messages too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): keep the credential fixture on an example host A login on a real host reads as a secret to the commit scanner, so the older capture's fixture uses apt.example.com like the other credential tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): tidy looked-up paths and search relative entries only for env Empty and `.` segments are dropped from a looked-up program path, which keeps `/snap/bin/` entries recognisable as snaps, while `..` is still left for the kernel. Relative and empty PATH entries are searched only in the PATH an `env` prefix sets, which travels with the exported launch; the host's own PATH does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep excluded and unwalked database logs unknown The capture records the paths every walk left out, and the state view treats a log as absent only under content roots the baseline walked completely and outside those exclusions, so an excluded or unvisited log leaves the database unread rather than read without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): judge JSON numbers after duplicate keys settle The exported reader marks an inexact number instead of flagging it during the parse, then looks for marks in the parsed value, so a number a later duplicate key overwrote no longer refuses the file, as in REA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): redact a repository's policy source when it names it An older capture whose policy source matched no sources entry kept that text whole, and the export named the repository by it; the export now names it without any user name or password. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): never signal the launch group on unknown membership When the current read cannot observe a carrier's process group, the carrier is signalled on its own instead of letting an older process-table row grant a group-wide SIGTERM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): look programs up in the launch's order and refuse host-relative finds The lookup searches PATH as the launch does, an empty entry meaning the launch folder, so inspection and launch name the same program. A program found only through a relative or empty entry of the host's own PATH is refused, since the exported computer would not have it; an env prefix's PATH travels with the command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): count unchecked paths and keep logs behind them unknown Each walk counts the paths it could not stat and the directories on another device it did not enter, and the checkpoint records it as `unchecked_paths`. The state view treats a log as absent only when the baseline left nothing unchecked, so a log whose stat failed stays unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(desktop): scan parsed JSON with one iterator per level The check for marked numbers walks the parsed value with an iterator per nesting level instead of copying each container's children; a million-entry array went from about 15.7 MiB to 8.1 MiB of peak traced memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): start a relative program from its captured folder An exported launch whose program path is relative, such as `./app` from an entry's Path, now changes to the captured working directory first, as it already did for relative arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): read zipped documents and name XML elements in task checks - A file that starts as a zip archive gets a `zip` view listing its entries in archive order, each with its own format and view, within limits on entries, bytes and expansion; the exported Python reader matches it. - A pointer segment applied to an array may be a selector, `[KEY=VALUE]` or `[@KEY=VALUE]` for XML attributes, matching exactly one member, so checks name elements instead of positions that shift between saves and versions. - `value_equals` takes an optional numeric `tolerance`, comparing numbers and numeric strings. - Changes inside zip views are listed by selector, and the task draft suggests name-addressed checks. FreeCAD's `.FCStd` is the first case: a hole cut into a plate is verified from the zipped `Document.xml` on files from both FreeCAD 0.21 and 1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): record the desktop entry's package and app profiles in any case - A launch from a desktop entry records the package that owns the entry, so the export installs the app the entry starts (Writer, not only libreoffice-common); the program's own package is kept as executable_package when it differs. - State folders match the app's names ignoring letter case, as direct children of the XDG folders and the home, so GIMP's ~/.config/GIMP profile is seeded and reset; roles follow the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): read namespaced XML alike in REA and the exported verifier The exported Python reader now names XML elements and attributes as the document spells them (svg, text:p, sodipodi:docname, xml:space), with namespace declarations kept as attributes, which is what REA's view already produced. Export therefore accepts checks into Inkscape SVGs, LibreOffice content.xml and namespaced XML inside zips, and the draft suggests them. expat replaces ElementTree: one pass with namespace processing refuses what REA's parser refuses, and a streaming pass builds the view within the same node and depth limits. Text splits at CDATA, comments and processing instructions as REA's DOM splits it. Fixtures are real Inkscape 1.2.2 and LibreOffice 24.2 saves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): install the program's own package and keep unknown owners unknown - When the desktop entry's package does not own the program it runs, the export installs the program's package too. The capture records why it cannot (executable_package_reason), and the export then refuses. - The export owns a state folder in the letter case the app wrote it, as the state roles already did, so data/get and data/reset cover a profile folder the app created during the capture. - A dpkg-query that fails or exits 2 or higher leaves the package unknown instead of reading as "no owner". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep selector checks undecided on partial views and pair members one to one - A selector check is undecided while an array it searched may be missing members: a cut zip listing, or a truncated XML or entry view. Both evaluators agree. - Diffs pair the members of two versions one to one, so two new elements can no longer both match the same old one and hide an addition. - The task draft descends into JSON values and readable entries added whole, and never suggests an element by its position, last step included. - The export's namespace refusal also checks XML entries inside the value a pointer names, such as the whole listing. - The exported reader keeps REA's 500-level JSON depth limit, so one deep entry no longer hides the rest of the archive, and treats an entry whose data runs past its declared size as damaged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): check approved packages against the repositories the export keeps The capture approved library packages and the program's package against every repository with a verified key, but the export can still leave a repository out: its key dropped by the content budget, an architecture restriction, or a conflicting key. Each repository now records the packages only it supplies (`supplies`). The export drops stranded library packages with a limitation, and refuses when the program's own package is stranded. Captures without `supplies` behave as before. The install limitations move to appExportInstallLimitations.ts to keep appExportInstall.ts under the line limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): compare type changes in place, keep empty values and unread entries honest - When an array becomes another type, its members are compared with what their pointers name there, so values that are still present no longer look removed. - The draft checks an added empty array or object by equality. - The exported reader's JSON depth check keeps one iterator per level and copies no wide list, back to the memory peak before the check. - An entry whose view could not be read is no `null` value: the draft suggests no check on it, and a check into its view fails in both evaluators with the read error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): decide entry view checks only on entries with a view, and walk JSON depth by level - A check into an archive entry's view needs an entry read in a format with a view. A binary or unread entry's `view` of `null` no longer passes a `null` or absence check, in either evaluator, and the draft suggests no absence inside an entry that ends without a view. - REA's JSON depth check keeps one iterator per level instead of queuing a pair per member, so 800,000 nulls need 18 MiB instead of more than 64. The helper came with the state view; its Python twin was fixed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse an export whose desktop entry runs a program no package owns When a package owns the desktop entry but no package owns the program it runs, such as one in ~/.local/bin first on PATH, the capture keeps the entry's package and records why the program cannot be installed. Export refuses instead of installing a package that does not bring that program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): bound zip entry reads, export metadata checks, and diff by the evaluator's pointer rules - The exported reader inflates a zip entry at most 64 KiB at a time and stops a byte past its declared size, so a forged small size no longer holds the whole stream in memory (77.5 MiB to 0.1 MiB on a 32 KiB bomb). - The namespace refusal applies only to checks that depend on an entry's XML, so checks on an entry's name, size or digest, or on its absence, export. - Diffs find a member's counterpart by the evaluator's pointer rules, so a selector step across a type change no longer reports a present value removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read at most 1,000 zip directory records, and index arrays once per diff - Both zip readers now read the central directory a record at a time, keep the first 1,000 file records and count the rest, then hand the library an archive whose directory holds only those. Directories are told apart as zip.js does, so the Python reader stops listing attribute-marked directories as files. 600,000 entries now peak at 1.3 MiB in Python (was 293.6 MiB) and need 24 MiB of heap in REA. - The exported Python zip reader moves to appExportPythonZip.ts. - Diffs look members up through an index built once per compared array, so 20,000 selector keys against 20,000 members take 31 ms, not 5.4 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): pick seed and end by checkpoint, and keep the capture host out of bundles - Export, task export and the task draft take --seed-checkpoint and --end-checkpoint, so one capture can make the seed in the app and then the edit; the defaults stay the baseline and the last version. - Capture reads apt's lists folder and trusted keys from apt-config, so a user-space apt-get update under APT_CONFIG is found, and starts the app without AGENTENV_* variables. - Capture records the host name and user. Export rewrites user@host, the host name as a whole name and the captured home in text, UTF-16 and dconf seeds, ships SEED_HOME=/home/user instead of the capture user's home, lists scrubbed and unscrubbable seeds, and refuses checks that name the host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): check tasks against the shipped seed and scrub JSON and XML by value - Task validation reads the seed as the bundle ships it, after the scrub, so a task whose end value the scrub writes into the seed is refused. - JSON strings and XML text, attribute values, comments and CDATA are scrubbed as their decoded values and rewritten only when they change, so syntax stays valid and escaped identities are found. - One leftover search covers every shipped file's path and contents, generated module and dconf keys included; the strict whole-name rule is kept for replacing only. - A host named localhost is never replaced, but user@localhost is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): resolve a record's selector keys together, and follow Zip64 locators without sentinels - The diff resolves all of a record's selector-shaped keys in one lookup: conditions are normalized per field, selectors grouped by field set, and only the values asked for are kept, so retained memory grows with the keys, not members times field sets (68 MB to 5.5 MB, 76 MB to 4.9 MB on the reported cases). - Both zip readers follow a Zip64 locator just before the end record whatever the classic record holds, as zipfile does, so valid Zip64 archives with ordinary classic values read again. The exported module's synthetic tail carries a real Zip64 end record, so bytes that only look like a locator no longer make zipfile refuse it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): scrub JSON values only, with a scanner whose stack does not grow with string length JSON seeds are walked one string at a time, finding each closing quote with indexOf and a backslash count instead of a backtracking regex, so a 16,000,000-character string no longer overflows the stack. Member names are never rewritten, so two keys cannot collide; a name holding the host leaves the file in unscrubbed_files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): scrub dconf and UTF-16 seeds by format, search check values for the host, and gate checks on the selected ends - dconf: the host scrub ran over the whole key file, so on a host named `true` `wrap=true` became an invalid `wrap=localhost`. Only decoded GVariant string values are scrubbed now; keys, groups, bytestrings, dictionary keys and object paths ship as captured and are reported. - Task identity: the host search read the serialized check, whose field names (`file`, `kind`) and default ids matched hosts of those names. It now reads the check's string values only. - Value checks: the text-file refusal read every recorded version; it now reads only the shipped seed and the end. - UTF-16 seeds: the plain scrubber renamed JSON keys and XML names; the decoded text's format now picks the scrubber, keeping the byte order mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): pair members by identity first, build selectors lazily, and refuse oversized and deep text before building a view - Pairing: an element with an identifier (name, id, xid, *:id) pairs only by it, so an unchanged id still names an edited element instead of a removal and an addition, and two objects of one type are never paired as a rename. Selectors keep the tag apart from each attribute condition and spell only the chosen one, so a long tag with many attributes no longer multiplies. - Size: REA's detection and the exported reader decide JSON with a scanner that builds no value, and refuse a view over the parsed-view limit before building it, in files and zip entries alike. - Deep text: the exported reader confirms the whole text is JSON before reporting a nesting depth error, as REA reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): count a selector's matches over every sibling while identified elements choose only their identifiers Identity-first pairing also dropped an identified sibling's other attributes from the counts that prove a selector names one member, so a shared attribute such as `color` or `fill` could be chosen though it matched two siblings: the diff reported present elements removed and drafts lost their checks. Counting now covers every attribute of every sibling; only the choice is limited to an identified element's tag and identifiers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): tell a UTF-16 seed's format without building it, and scrub XML without one piece per token Choosing the scrubber for a decoded UTF-16 seed ran the full state detection, which built the whole XML document (or JSON value), so a large seed within the capture limit could exhaust memory at export. A syntax pass now decides the format (the JSON token scan, and the XML parser's events keeping only the open elements), and the XML scrubber copies out only the spans it changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
330 lines
21 KiB
Markdown
330 lines
21 KiB
Markdown
# Desktop application export
|
|
|
|
`rea export-desktop-application <capture-folder> <directory>` turns a folder
|
|
written by [desktop application capture](desktop-application-capture.md) 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.
|
|
|
|
```sh
|
|
rea export-desktop-application ./mousepad-capture ./mousepad-bundle
|
|
agent-env run ./mousepad-bundle --dry-run
|
|
```
|
|
|
|
The export reads the capture and its [state view](desktop-application-state.md);
|
|
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](desktop-application-tasks.md). `--package-url`
|
|
says where the computer downloads the package of an application installed from
|
|
a `.deb` file; see [Applications from a .deb file](#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](#the-seed-checkpoint).
|
|
|
|
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 as `a=`, 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
|
|
transitional `firefox` does 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's `supplies`), 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, as `vim-common`'s entry runs `vim`'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_reason` without
|
|
`executable_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 as
|
|
`Ubuntu` for 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 (`.asc` when it is armored, which agentenv tells by its
|
|
content). 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 whose `arch=`
|
|
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 `.deb`
|
|
file the capture recorded and `--package-url` is 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 both `amd64` and `arm64` for 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 `.deb` file 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, so when an argument, or
|
|
the program's own path such as `./app`, is relative the command first
|
|
changes to the captured working directory
|
|
(`"$HOME"` when that was the home), and still starts if that folder is
|
|
missing. The export refuses a capture that saw no application window.
|
|
- For an Electron application (the capture found its fuse sentinel or a
|
|
`resources/app.asar`), `--no-sandbox` right 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/GIMP` profile GIMP created
|
|
during the capture beside the candidate `~/.config/gimp` is owned as
|
|
`.config/GIMP`, not as the folder of its first file. The home itself and
|
|
the shared `.config`, `.local`, `.local/share`, `.local/state` and `.cache`
|
|
folders 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/add` and `data/reset` call agentenv's `add`
|
|
and `reset`, and `data/get` returns the files under `paths` plus 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 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`.
|
|
|
|
## 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 and byte
|
|
order), and in the dconf keys, `user@host` becomes `user@localhost`, the
|
|
host name standing alone becomes `localhost`, and the captured home becomes
|
|
`/home/user` wherever 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 as `e81232be457d.local`, so a host named `ubuntu` leaves
|
|
`ports.ubuntu.com/ubuntu-ports` alone. A host named `localhost` is left
|
|
alone, but its `user@localhost` still takes the computer's user. The user
|
|
name alone is never replaced, since a short one such as `ada` or `user` is
|
|
also ordinary text. A rewritten seed is written with its own SHA-256, and
|
|
`scrubbed_files` and the README list it.
|
|
- JSON and XML keep their syntax. In JSON only string values change, each
|
|
read as its decoded value, so `\u0065` escapes cannot hide the host, and is
|
|
written back as JSON only when it changed; numbers and `true`, `false` and
|
|
`null` stay as they are even for a host named `true`. Member names are never
|
|
rewritten, since `{"ubuntu": 1, "localhost": 2}` on a host named `ubuntu`
|
|
would get two `localhost` keys and lose a setting; a file whose names hold
|
|
the host is listed in `unscrubbed_files` instead. 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 `true` leaves `wrap=true` alone. A value whose string does not
|
|
parse, or that holds an object path or signature, ships as captured.
|
|
- `SEED_HOME` in 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 is `user`, with its home in `/home/user`, and
|
|
`localhost` is 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@host` anywhere, as in
|
|
`e81232be457d.local` or a seed named `e81232be457d-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 in `unscrubbed_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@host` or 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 named
|
|
`file` or `kind` refuses 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 from `ada@e81232be457d` to
|
|
`user@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](desktop-application-capture.md)), then pass
|
|
`--package-url` to the export with an `http://` or `https://` URL the computer
|
|
can download that same file from:
|
|
|
|
```sh
|
|
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 `:any`
|
|
qualifiers, 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 runs `dpkg -i` on 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](desktop-application-state.md)'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 DOCTYPEs refused and REA's
|
|
node, depth and whitespace rules, 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 nested more than 500 levels deep, gets an `error` instead of a view, as in
|
|
REA, while 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. Known differences remain:
|
|
|
|
- dconf databases are reported as binary, since REA reads them with `dconf`;
|
|
inside an archive, one is `dconf` with an error, as in REA.
|
|
- Zip entry names: a name in an Info-ZIP Unicode Path extra field is used only
|
|
where Python's `zipfile` reads 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.
|
|
|
|
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`.
|