Docs
Repair
Fix a broken step in CI or in the app.
When the app changes and a step can’t find its element, trace-avatar/repair lists what the step could mean on the page now. chooseRepair picks one: code scores the candidates first, and an AI is asked only when no candidate is a clear winner. The chosen element is re-recorded the way the recorder does it and checked with the player’s own resolver. The fix is a suggestion that a person accepts.
In CI
trace-avatar-render invoice.trace.json --url … --out invoice.gif --repair --ai gateway
trace-avatar-render apply invoice.trace.json invoice.repair.json --accept 1,2 --out invoice.trace.jsonEach fix is verified by playing the guide again, up to 5 stalls in one run. The fixes go to <out>.repair.json with whether each was verified, how it was chosen and, for an unresolved step, the best 3 candidates. The render still exits 1.
Fix this step, in the app
With mount({ record: { allowed, save } }), an author who meets a guide that can’t find its element gets a card where it stalled: “Step 2 can’t find button “Save invoice”. Fix this step · Stop”.
- Fix this step shows its best guess with a ring: “Is it this? (button “Store invoice”)” Yes · No, I’ll point at it · Cancel.
- Pointing: the next click picks the element and never reaches the app; Esc goes back. A pick the player couldn’t find again on its own is refused, so a fix always works.
- The guide carries on from that step with the fixed trace, in the same mode. Save the guide hands it to record.save; Just this time keeps the fix for this session.
- People who may not record see nothing new; the fix code (about 8 KB) loads only when an author meets a stalled step.
A wait whose text changed
From 0.1.9. A guide recorded when the app said “Saved” stalls once the app says “Changes stored”. The card says “Step 3 waited for “Saved”, which never showed. Fix this step · Remove this wait · Stop”.
- Fix this step asks “Is it “Changes stored”?”. The candidates are the short texts where the wait looks, plus what showed while it waited, so a message that came and went is offered too (“seen while waiting”).
- Pointing picks the text to wait for. Buttons, links, fields, masked, ignored and blurred areas, and anything holding a value typed in the guide are never offered.
- Remove this wait drops the step, for an app that no longer needs one. A wait for something to go away offers Remove and Stop only.
- In CI,
--repairwrites a fix ofkind: 'until'. With no clear winner it offers a guess (by: 'guess'), kept only when playing the guide again gets past the wait.
From code
import { candidatesOf, targetFor, resolvesTo, elementOf } from 'trace-avatar/repair';
import { chooseRepair, repairSuggestion, apply } from 'trace-avatar/assist';
const list = candidatesOf(document); // [{ id, role, name, text, near }]
const choice = await chooseRepair(trace, stalledIndex, list, { ai }); // { id, by: 'score' | 'ai' | 'none', top }
const target = targetFor(choice.id);
if (resolvesTo(target, elementOf(choice.id))) next = apply(trace, [repairSuggestion(trace, stalledIndex, target)]);A field’s value is never read. Hidden, [data-trace-ignore] and [data-trace-blur] areas are never offered.
For a wait (0.1.9), the stalled event carries seen, the texts that showed while it waited:
import { textsOf, scopeFor } from 'trace-avatar/repair';
import { chooseWait, guessWait, waitSuggestion, apply } from 'trace-avatar/assist';
const texts = textsOf(scopeFor(step.target), { seen: stalled.seen }); // [{ id, text, recent?, gone? }]
const best = guessWait(await chooseWait(trace, i, texts, { ai }), texts); // { id, text, guess } | null
if (best) next = apply(trace, [waitSuggestion(trace, i, best.text)]);The full reference is in the README on GitHub.