forge-lcdl

Task `pw_quiz_mechanics_discover` v1

Given a bounded page_probe, an interaction_probe, optional operator hints, and source_constraints, infer a PageMechanicsSpec-compatible JSON object for an interactive quiz. The runtime (not LCDL) executes Playwright…

Task pw_quiz_mechanics_discover v1

Summary

Given a bounded page_probe, an interaction_probe, optional operator hints, and source_constraints, infer a PageMechanicsSpec-compatible JSON object for an interactive quiz. The runtime (not LCDL) executes Playwright using this spec.

Output schema_version for this task is the literal page_mechanics.v1 (dot form). This differs from the structural checklist artifact page_mechanics/v1/contract.md identifier page_mechanics_v1; both describe the same family of payloads with different version-string conventions—normalize at boundaries if needed.

Inputs

Field Type Required Notes
url string yes Non-empty after strip.
page_probe object yes Bounded probe JSON (page_probe_v1 aligned); may be {}.
interaction_probe object yes Outcome of at least one interaction (interaction_probe_v1 aligned); may be {}.
source_constraints object yes Hints such as expected_option_count, expected_choice_mode, allowed_modes; may be {}.
allowed_action_kinds array of string yes Non-empty subset of mechanics action kinds (see page_mechanics); must not include eval, execute_js, or script.
operator_hints string no Short hints for the model; omit or "".
temperature number no Default 0.05.
timeout_sec int no Default profile.timeout_sec.

User JSON is UTF-8 capped at 100000 bytes before the LLM call.

Output

One JSON object validated after parse:

Check Rule
Top-level keys schema_version, page_kind, confidence, question, actions, grading, loop, safety, notes — all required.
schema_version Exactly page_mechanics.v1.
page_kind Exactly interactive_quiz.
confidence Numeric; coerced to [0.0, 1.0] (invalid → 0.0).
question, grading, loop, safety JSON objects (may be {} except grading must be present).
notes String (may be "").
actions JSON object (not an array). Mechanics steps live under named phases; any nested dict carrying a string kind is validated as a Playwright mechanics step.
Action kind values Must appear in the request’s allowed_action_kinds; never eval, execute_js, script (case-insensitive; hyphen variants normalized).

Grading sub-objects may contain their own "kind" fields (e.g. signal taxonomy); validators only inspect nodes nested under actions.

Policy

  • Output exactly one JSON object (no Python, no prose outside JSON).
  • Never instruct bypass of login, CAPTCHA, paywalls, anti-bot protections, or proctored exam controls.
  • Prefer conservative selectors and explicit waits; no free-form JavaScript execution fields.

Implementation

  • Uses run_json_contract_task (chat_with_json_mode_then_plain, parse_json_object_lenient).
  • Post-validation walks actions recursively for Playwright step dicts.

Changelog

  • v1 — Initial interactive quiz mechanics discovery task.