{
  "suite": "org.classprofiles.operator/core@1",
  "fixtures": [
    {
      "id": "core.list_surfaces.addressable",
      "title": "Job 1: every surface an agent may work with carries an identifier and a kind",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": {
            "state": "ok",
            "assert": [
              { "path": "$.surfaces", "length_gte": 1 },
              { "path": "$.surfaces[*].id", "nonempty_string": true },
              { "path": "$.surfaces[0].kind", "matches": "^(browser|desktop|terminal|other)$" }
            ]
          }
        }
      ]
    },
    {
      "id": "core.perceive.reads_surface",
      "title": "Jobs 2 and 10: reading returns actionable targets, the words, and how settled things are",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}" } },
          "expect": {
            "state": "ok",
            "assert": [
              { "path": "$.targets", "length_gte": 1 },
              { "path": "$.targets[*].ref", "nonempty_string": true },
              { "path": "$.targets[*].role", "nonempty_string": true },
              { "path": "$.readiness", "equals": "settled" },
              { "path": "$.text", "nonempty_string": true }
            ]
          }
        }
      ]
    },
    {
      "id": "core.perceive.query_narrows",
      "title": "Job 3: a control can be found by what it does, and narrowing returns less than everything",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets", "snapshot": "ALL" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}", "query": "Submit" } },
          "expect": {
            "state": "ok",
            "assert": [
              { "path": "$.targets", "length_gte": 1, "length_lte": 1 },
              { "path": "$.targets[0].name", "equals": "Submit" },
              { "path": "$.targets", "subset_of": "{ALL}" }
            ]
          }
        }
      ]
    },
    {
      "id": "core.act.press_reports_outcome",
      "title": "Jobs 4 and 6: pressing a control says what changed, without a second call to find out",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}", "query": "Submit" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets[0].ref", "bind": "T" }] }
        },
        {
          "call": {
            "verb": "operator.act",
            "args": { "surface_id": "{S}", "target": "{T}", "action": "press" }
          },
          "expect": {
            "state": "ok",
            "assert": [
              { "path": "$.changed", "equals": true },
              { "path": "$.readiness", "nonempty_string": true }
            ]
          }
        }
      ]
    },
    {
      "id": "core.act.no_observable_change_is_reported",
      "title": "Job 6: acting on something inert says so, instead of looking like success",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}", "query": "Inert" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets[0].ref", "bind": "T" }] }
        },
        {
          "call": {
            "verb": "operator.act",
            "args": { "surface_id": "{S}", "target": "{T}", "action": "press" }
          },
          "expect": {
            "state": "ok",
            "assert": [
              { "path": "$.changed", "equals": false },
              { "path": "$.blocked_by", "absent": true }
            ]
          }
        }
      ]
    },
    {
      "id": "core.act.enter_text",
      "title": "Job 5: text entered into a field is readable back from the surface",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}", "query": "Notes" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets[0].ref", "bind": "T" }] }
        },
        {
          "call": {
            "verb": "operator.act",
            "args": {
              "surface_id": "{S}",
              "target": "{T}",
              "action": "enter_text",
              "value": "design review"
            }
          },
          "expect": { "state": "ok", "assert": [{ "path": "$.changed", "equals": true }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.text", "matches": "design review" }] }
        }
      ]
    },
    {
      "id": "core.act.scroll",
      "title": "Job 9: scrolling is an ordinary input and reports its own outcome",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}", "query": "Below" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets[0].ref", "bind": "T" }] }
        },
        {
          "call": {
            "verb": "operator.act",
            "args": { "surface_id": "{S}", "target": "{T}", "action": "scroll" }
          },
          "expect": { "state": "ok", "assert": [{ "path": "$.readiness", "nonempty_string": true }] }
        }
      ]
    },
    {
      "id": "core.settle.reports_readiness",
      "title": "Job 7: waiting reports what it found rather than simply returning",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.settle", "args": { "surface_id": "{S}" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.readiness", "equals": "settled" }] }
        }
      ]
    },
    {
      "id": "core.errors.unknown_target",
      "title": "Job 8: a target that does not exist fails loudly instead of acting on whatever is nearby",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": {
            "verb": "operator.act",
            "args": { "surface_id": "{S}", "target": "no-such-target", "action": "press" }
          },
          "expect": { "state": "error", "assert": [{ "path": "$.error.code", "equals": -32602 }] }
        }
      ]
    },
    {
      "id": "core.risk.reads_leave_the_surface_alone",
      "title": "Risk check: reading and waiting are declared read-only, so they must move nothing",
      "steps": [
        {
          "call": { "verb": "operator.list_surfaces", "args": {} },
          "expect": { "state": "ok", "assert": [{ "path": "$.surfaces[0].id", "bind": "S" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.targets", "snapshot": "BEFORE" }] }
        },
        {
          "call": { "verb": "operator.settle", "args": { "surface_id": "{S}" } },
          "expect": { "state": "ok", "assert": [{ "path": "$.readiness", "equals": "settled" }] }
        },
        {
          "call": { "verb": "operator.perceive", "args": { "surface_id": "{S}" } },
          "expect": {
            "state": "ok",
            "assert": [{ "path": "$.targets", "unordered_equals_snapshot": "BEFORE" }]
          }
        }
      ]
    }
  ]
}
