OptionalAgentParent agent-run id the CDP session sets before Run (links the goal's prompt runs to it).
OptionalAgentParent agent-run-step id the CDP session sets before Run (nests child prompt steps under it).
ProtectedauthProtectedbrowserProtectedcancelledWhether Stop() has been called — checked at the top of each step and at the finer-grained checkpoints inside a step.
OptionalContextThe MJ user the goal run executes as; the CDP session sets it from the session's context user.
ProtectedjudgeProtectednavigationOptionalOnPer-step progress hook the CDP session sets before Run (drives live narration).
ProtectedtoolWhether the run has been stopped — by Stop or by its own expiry.
Exposed because "the engine stopped waiting" and "the engine stopped working" are different things: a step blocked in a page call keeps running after the run is scored, and this is what says whether it has been told to unwind at its next cooperative checkpoint.
Optional metadata provider override. Callers should set
instance.Provider = providerToUse before invoking Run()
in multi-provider contexts. Falls back to the global default provider when unset.
ProtectedexecuteRoute controller prompt through MJ AIPromptRunner.
If a ControllerPromptRef was resolved to an entity, uses AIPromptRunner for full MJ integration (template rendering, model selection, prompt run logging, token tracking). Otherwise falls back to the base implementation (direct LLM call).
ProtectedexecuteRoute judge prompt through MJ AIPromptRunner.
If a JudgePromptRef was resolved to an entity, uses AIPromptRunner. Otherwise falls back to the base implementation.
ProtectedhealSelf-heal a diverged replay step. Only selector drift is healable here: re-resolve the recorded target's role+name against a fresh element list, with ambiguous cases escalating to the healTargetViaLLM seam and low-confidence matches failing rather than guessing. On a confident match, execute the corrected action, verify the postcondition, rewrite the trace step's selector in place, and return true.
Flow drift (a failed postcondition) is not selector-healable and returns false, so the run falls back to the LLM tier.
ReplayHeal: 'off' skips all of this — the step diverges as recorded.
'deterministic' keeps the role+name re-resolution but never asks a model.
ProtectedhealLLM heal disambiguation (leg 1b). Overrides the base no-op:
when deterministic role+name re-resolution can't uniquely re-find a drifted
target, ask the cheap "Computer Use - Heal" prompt which of the CURRENT
indexed elements is the intended one, returning { index, confidence }. The
caller's shouldAcceptHeal gate (0.6) decides whether to trust it — a
low-confidence heal still fails the step rather than guessing.
Fail-soft everywhere: no heal prompt in metadata, a failed/errored prompt run, or an unparseable response all return confidence 0 — heal then only succeeds on the deterministic path, exactly as before this override existed.
NOTE: this AIPromptRunner routing mirrors the proven controller/judge
path. It runs on the replay-with-heal tier, which the driver dispatch
now reaches; the MJ Replay override primes healPromptEntity so this
override is live rather than the base confidence-0 no-op. The response parser
below is pure + tested.
ProtectedlogProtectedlogOptionalerror: unknownProtectedonHook for run completion. Currently logs completion status. Can be extended to update agent run records or trigger post-run workflows.
ProtectedonPersist step screenshot as AIPromptRunMedia entity.
Links the screenshot to the most recent prompt run (from the controller call in this step). Fire-and-forget — media persistence errors are logged but don't fail the run.
Replay a recorded trace on the deterministic tier. The driver
dispatch calls this instead of Run when a valid trace exists; the
base ComputerUseEngine.Replay owns the full replay/heal/postcondition
loop. This override primes the MJ-specific fields the replay tier needs:
contextUser, the resolved "Computer Use - Heal" prompt (so
healTargetViaLLM can disambiguate a drifted target through
AIPromptRunner instead of its confidence-0 no-op), and the "Computer Use -
Judge" prompt so the base loop can score the replayed end-state for
goal-completion parity with the LLM tier — the driver returns a Completed
replay directly with no LLM leg, so the goal verdict must originate here.
Run()'s controller/tools setup is deliberately skipped — replay never
invokes the controller.
Adapts the transport-neutral base params into MJRunComputerUseParams (carrying the acting user
The base computer-use params the CDP session built (goal + step cap + start url).
The computer-use run result.
Inject a pre-created browser adapter for shared session support. When set, the engine skips Launch()/Close() — the caller owns the lifecycle. Used by parallel test execution to share browser contexts across tests.
Inject a shared judge-verdict cache. When set, the engine reuses a cached verdict for an identical (goal, URL, visible-state) key instead of calling the LLM judge — the cross-attempt generalization of within-run gating. The driver owns the instance so verdicts survive attempt boundaries; unset → no cross-attempt caching (behavior unchanged).
Request cancellation of a running run. Cooperative: sets the flag the
engine's checkpoints observe AND aborts the shared signal so in-flight LLM
calls and settle/backoff delays return promptly. The run unwinds
to a Cancelled result within seconds — at the next checkpoint — rather
than running the current step to completion.
StaticparseParse the heal prompt's JSON { index, confidence } response. Pure +
static so it is unit-testable without an engine. Tolerant: strips a fenced
code block; a missing / non-integer / negative index or non-numeric
confidence yields { confidence: 0 } (no disambiguation); confidence is
clamped to [0, 1]. A confident heal MUST name an index.
The MJ-aware goal engine bound in production. Extends MJComputerUseEngine (prompt-runner routing, vision-model auto-selection, credential resolution, media persistence) and satisfies the ComputerUseGoalRun seam: