Files
Edgar ArakelyanandClaude Opus 5.5 ac23dc8077 feat(desktop): read XML with a plain DOCTYPE, and check an element's whole text (#9050)
* 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>

* 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>

* 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>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:20:12 +00:00
..

Desktop application environments

Goal: REA turns an application installed and used on a Linux desktop into an agent environment's computer application. The real application installs into a computer image, launches to ready, exposes reset, load and get over its own state, and ships with tasks graded through that state.

The work lands as one PR per step:

  1. Pin the real agent environment lane to the framework release that carries the computer application contract.
  2. Capture: launch the application on the user's desktop and record its inventory, windows and home-directory state at checkpoints.
  3. State view: decide which paths are the application's state and read their formats into a typed JSON view.
  4. Export: write the computer application class, environment card, skill and seed.
  5. Verification inside an agent environment computer: put, boot, ready, reset equals the seed, grader checks.
  6. Tasks: an agent writes a prompt and declarative checks from the observed change, REA keeps the task when the checks fail on the seed and pass on the captured end state, and a run of the bundle measures an agent's solve rate.
  7. Three applications end to end: Mousepad (plain files), GnuCash saving to SQLite, and Joplin (Electron, SQLite).
  8. Vendor packages: closed-source applications from a vendor apt repository, with its verified signing key and the packages of the libraries they load, starting with Typora.
  9. Vendor .deb files: closed-source applications installed from a downloaded .deb file, which the computer downloads from an operator's URL and checks by its captured SHA-256, starting with VariCAD.
  10. Document views: documents saved as zip archives (FreeCAD, OpenDocument, Office Open XML, EPUB) read as their entries, checked by name rather than position, namespaced XML included, and numbers compared within a tolerance, starting with FreeCAD.
  11. Capture for building: one capture makes the seed and then the change, at checkpoints the export and the task draft are told; apt lists from a user-space apt-get update are found; the application does not inherit the computer's control token; and the bundle holds neither the capture host's name nor its user's.
  12. Build computer: an agentenv computer REA keeps up from a request or a bundle, with REA installed inside for building, driven through REA's MCP tools while an agent builds the environment.
  13. XML text checks: XML whose DOCTYPE only names its DTD read as XML, starting with AbiWord, and checks of an element's whole text across the runs an app splits a paragraph into.

Version 1 covers Linux with X11, applications whose state lives in files or SQLite under the home directory, and real applications from public packages. It uses the user's real state and keeps everything local.