Skip to main content

@svatah/yam-healer

Failure selection, model-free repair, verification and diff

Exports

ExportKindSignature
clearRegrounderfunctionexport function clearRegrounder(): voidPut the default back. For tests, and for a CLI that ran without a gateway.
clearReplayerfunctionexport function clearReplayer(): voidPut the default back. For tests, and for a CLI running without the runtime.
currentRegrounderfunctionexport function currentRegrounder(): RegrounderThe registered Regrounder, or the no-op default.
currentReplayerfunctionexport function currentReplayer(): Replayer
entryFromfunctionexport function entryFrom(An entry a heal proposal would write, built from a relocalization.
EvalBindinginterfaceexport interface EvalBindingA binding recorded at variant 0.
EvalCaseinterfaceexport interface EvalCaseOne binding on one variant.
FileChangeinterfaceexport interface FileChangeOne file's before and after, as text.
hasRegrounderfunctionexport function hasRegrounder(): booleanWhether anything but the no-op is registered — the report says so.
hasReplayerfunctionexport function hasReplayer(): booleanWhether anything but the session-state default is registered.
healfunctionexport async function heal(options: HealOptions): Promise<HealReport>Run the heal job. Nothing is written; the caller decides what to do with the diff.
HealingEvalOptionsinterfaceexport interface HealingEvalOptions
HealingEvalReportinterfaceexport interface HealingEvalReport
HealInputinterfaceexport interface HealInputOne failure to repair.
HealOptionsinterfaceexport interface HealOptions
HealReportinterfaceexport interface HealReport
HealResultinterfaceexport interface HealResultWhat happened to one failure.
METHODvariableMETHOD = [
MODEL_THRESHOLDvariableMODEL_THRESHOLD = 0.85REQ-HEAL-5: "with one model call at least 85 percent".
NO_REGROUNDERvariableNO_REGROUNDER: Regrounder The default: no model, no grounding, no pretence.
reachedRecordedPagefunctionexport async function reachedRecordedPage(Did the session actually land on the page the failure was recorded on?
readBindFailuresfunctionexport function readBindFailures(outputDir: string): HealInput[]Read .yam/bind-failures.jsonl.
readRunFailuresfunctionexport function readRunFailures(runDir: string): HealInput[]Read the locator failures out of a run directory (runs/<id>/results.jsonl).
reasonOffunctionexport function reasonOf(outcome: ReplayOutcome): string | undefinedThe explanation a replayer gave, when it gave one.
recordBaselinefunctionexport async function recordBaseline(Record bindings for every interactive element on every page, at variant 0.
registerRegrounderfunctionexport function registerRegrounder(regrounder: Regrounder): voidRegister the implementation module (b) provides. The CLI does this at start
registerReplayerfunctionexport function registerReplayer(replayer: Replayer): voidRegister module (b)'s runtime-backed replayer. @svatah/yam does this when
Regrounderinterfaceexport interface RegrounderThe model half of REQ-HEAL-1, as an interface the healer depends on and module
RegroundRequestinterfaceexport interface RegroundRequestWhat the healer knows about the element it is trying to re-find.
RELOCALIZE_THRESHOLDvariableRELOCALIZE_THRESHOLD = 0.6REQ-HEAL-5: "relocalization alone at least 60 percent".
renderHealingEvalMarkdownfunctionexport function renderHealingEvalMarkdown(
renderHealingEvalSummaryfunctionexport function renderHealingEvalSummary(report: HealingEvalReport): stringThe same numbers as one line, for a terminal.
renderHealMarkdownfunctionexport function renderHealMarkdown(report: HealReport): stringA Markdown report, for a pull request or the release notes (REQ-PKG-4).
renderHealReportfunctionexport function renderHealReport(report: HealReport): stringA plain-text report for a terminal.
ReplayContextinterfaceexport interface ReplayContextWhat a replayer needs beyond the failure itself (Draft 2.6, LLD §10).
Replayerinterfaceexport interface Replayer
ReplayOutcometypealiasexport type ReplayOutcome Whether the replayer got back to the failing step, and if not, why.
runHealingEvalfunctionexport async function runHealingEval(options: HealingEvalOptions): Promise<HealingEvalReport>The eval (REQ-HEAL-5).
samePathfunctionexport function samePath(a: string, b: string): booleanTwo URLs naming the same path, whatever their origin or query.
SESSION_STATE_REPLAYERvariableSESSION_STATE_REPLAYER: Replayer The default: restore the session state recorded with the failure.
unifiedDifffunctionexport function unifiedDiff(change: FileChange, context = CONTEXT): stringA unified diff for one file, or "" when nothing changed.
unifiedDiffForfunctionexport function unifiedDiffFor(changes: readonly FileChange[], context = CONTEXT): stringOne diff for a set of changed files, in path order.
unreachedfunctionexport function unreached(outcome: ReplayOutcome): booleanunreachable in either spelling.
VariantResultinterfaceexport interface VariantResult