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

4.1 KiB

Tasks for an exported desktop application

Outcome

Each capture yields one agentenv task in its exported bundle. An agent writes the task's prompt and declarative checks from the change the capture recorded; REA validates the task against the capture and keeps it only if its checks fail on the seed and pass on the captured end state. The bundle runs the task with a computer-use agent and grades it with a verifier that reads the app's data/get and evaluates the same checks. REA stays model-free and never runs code the agent wrote.

Requirements

  • rea describe-desktop-application-task CAPTURE (CLI only) returns Evidence with operation describe_desktop_application_task and predicate type rea.desktop-application-task-draft: the environment name, title and window class; the export's owned paths; each file under them whose state differs between its first and last version, with role, both versions and the net change from diffStateViews (text listing each line once, plus the lines at both ends whose count changed); and a draft task with a placeholder prompt and checks suggested from the net change of documents, or of application state when no document changed. Views are shown only for those files, cut at 200 items and 2,000 characters.
  • The task file is JSON with a portable name other than smoke, a prompt and 1 to 32 checks, parsed by a zod schema in src/domain/desktop/. Check kinds: file_present, file_absent, lines_present, lines_absent, line_count (exact or contains; equals, at_least or at_most), value_equals (optional numeric tolerance) and value_absent (RFC 6901 pointer, with selectors on arrays), text_equals and text_contains (an XML element's whole text at a pointer, optional normalize_whitespace; see XML text checks), row_present, row_absent and row_count (SQLite table, where by column). Ids default to check-N and must be unique.
  • Semantics: an absent file reads as empty; a file without a view fails every check but presence; line checks need a text view and row checks a SQLite view; JSON equality by value, never a boolean for a number; contains matches a line holding it; checks decided by what a view leaves out, and value_equals of a whole object or array, fail on a truncated view. No regular expressions: a pattern run on agent-written text can stall the verifier, and the two evaluators would read some differently.
  • Refusals, each naming the check: a file outside the owned paths or not spelled as a home path; the empty pointer; a pointer not starting with / or into text; a repeated line; a tolerance whose value is not a number; a value that names the captured home or looks like a date and time (ISO 8601, or C's asctime form); the draft's placeholder prompt.
  • export-desktop-application --task FILE evaluates the checks on the state view's first versions (the seed) and last versions (the end), refuses a task whose every check passes on the seed and a check that fails at the end, and refuses more than one task file. It writes tasks/NAME.json (deploy_env, deploy_agent, add_skills, start_computer_recording, prompt_agent, env_outcome_verifier, end_computer_recording), artifacts/NAME-check/verify.py and evals/ENV.toml naming the task, and a README section with the prompt, the checks and the solve-rate recipe.
  • The verifier finds the app among the computer's child environments, calls its data/get and evaluates the checks in Python with the TypeScript evaluator's semantics, one result per check; it raises when the app cannot be reached.
  • The product skill tells an agent how to describe the change, write the prompt and the checks, and export.

Non-goals

  • No REA command that runs agents or measures a solve rate; the user guide gives the agent-env run recipe.
  • No checks over dconf keys, which data/get serves as binary, or over files outside the owned paths.
  • No timestamp detection beyond ISO 8601 and asctime date-times; other volatile values are left to the author.
  • No more than one task per capture.