# `Juggernaut.View.Agent`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/view/agent.ex#L1)

The agent format (`--format agent`, see the [agent output guide](agent-output.md)): one
compact JSON document, format 1, summary first, then one page of survivors, then where
the page sits.

Keys keep the documented order and are never renamed or removed within format 1; new
keys may be added. Every survivor carries what an agent needs to write the missing
test: the diff, a source excerpt, the tests that ran and passed (with `file:line`), the
nearest miss, a suggested test file and the command that re-checks the mutant. A page
never hides survivors silently: `page.more` counts the rest and `page.next` is the
command that shows them.

After `not_scored`, `integration_only` lists every mutant killed only by integration
tests (`Juggernaut.View.integration_only/2`), never paged: each `id`, `core`, `file`,
`line`, `function`, `operator`, `variant` and `killed_by` (the killing test's
`file:line`). They count as killed (`summary.counts.integration_only`); each is a place
where no unit test catches the change.

Options: see `Juggernaut.View`.

# `document`

```elixir
@spec document(Juggernaut.Run.t(), keyword() | Juggernaut.View.options()) ::
  Jason.OrderedObject.t()
```

The agent document of `run` (`kind: run`).

# `mutant`

```elixir
@spec mutant(Juggernaut.Mutant.t(), Juggernaut.Result.t()) :: Jason.OrderedObject.t()
```

One mutant and its full result, whatever its status (the mutant object of `check`): the
survivor fields, the kill (kind, killing test, control), the reason and the job time.

# `render`

```elixir
@spec render(Juggernaut.Run.t(), keyword() | Juggernaut.View.options()) :: iodata()
```

The agent document of `run` followed by a newline.

# `summary`

```elixir
@spec summary(Juggernaut.Run.t(), keyword() | Juggernaut.View.options()) ::
  Jason.OrderedObject.t()
```

The summary object of `run` (`summary` in the document).

# `survivor`

```elixir
@spec survivor(
  Juggernaut.Mutant.t(),
  Juggernaut.Result.t(),
  Juggernaut.View.survivor_status() | Juggernaut.Result.status(),
  keyword() | Juggernaut.View.options()
) :: Jason.OrderedObject.t()
```

The survivor object of one mutant (also the mutant object of `check` and `explain`).
`status` is how it is listed (`View.survivor_status/2`), else the result's status.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
