> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK type index

> Reports, plans, outcomes, events, jobs, artifacts, workflows and error classes.

export const RemoteContract = () => <Warning>
    <strong>Preview surface.</strong> The root package types the intended
    workflow HTTP and SSE API. The reference engine does not ship a compatible
    workflow service today. Do not point it at the stable resident firer or
    <code>nika model serve</code>.
  </Warning>;

export const LocalContract = () => <Tip>
    <strong>Live surface.</strong> <code>@supernovae-st/nika-client/local</code>
    drives the released <code>nika</code> binary through its versioned machine
    contracts. It is the production path today.
  </Tip>;

## Local types

<LocalContract />

### LocalCheckReport

| Field                  | Type                              |
| ---------------------- | --------------------------------- |
| `reportVersion`        | `number`                          |
| `clean` · `parseFatal` | `boolean`                         |
| `cost`                 | `LocalCost \| null`               |
| `waves`                | `unknown[]`                       |
| `requirements`         | `Record<string, unknown> \| null` |
| `findings`             | `LocalFinding[]`                  |
| `permits`              | `LocalPermits \| null`            |
| `exitCode`             | `number`                          |
| `warnings`             | `string[]`                        |
| `raw`                  | `Record<string, unknown> \| null` |

### LocalPlan and outcomes

<div className="sdk-flight sdk-flight-compact">
  <span>LOCAL TYPES · VERSIONED SUBSET + RAW ESCAPE HATCH</span>

  <pre tabIndex={0}>
    {`LocalPlan
        ├── planVersion · workflow
        ├── tasks[] · waves[][]
        ├── cost · permits · requirements
        ├── warnings[]
        └── raw

        LocalRunOutcome ── exitCode · ok · events[]
        GoldenVerdict ──── passed · exitCode · output
        TraceVerdict ───── intact · head · exitCode · output`}
  </pre>
</div>

`NikaEvent` guarantees `kind: string` and stays open to additive engine fields.

## Remote types

<RemoteContract />

`JobStatus` is `pending | running | completed | failed | cancelled`.

The remote `NikaEvent` union contains:

* `started`
* `task_start`
* `task_complete`
* `task_failed`
* `artifact_written`
* `completed`
* `failed`
* `cancelled`

`NikaJob` carries the job identity, status, workflow, timestamps and optional
exit code and output. `NikaArtifact` carries name, size, format, content type
and optional checksum.

## Error classes

<div className="sdk-flight sdk-flight-compact">
  <span>REMOTE ERRORS · CATCH SPECIFIC FIRST</span>

  <pre tabIndex={0}>
    {`NikaError
        ├── NikaAPIError          status · body · requestId?
        ├── NikaConnectionError   cause?
        ├── NikaTimeoutError
        └── NikaJobError          job · exitCode?
          └── NikaJobCancelledError`}
  </pre>
</div>

## Continue

<CardGroup cols={2}>
  <Card title="Errors and exits" icon="triangle-exclamation" href="/sdk/runtime/errors">
    Apply the types to product control flow.
  </Card>

  <Card title="Run events" icon="wave-pulse" href="/sdk/runtime/events">
    Reduce the additive local journal.
  </Card>

  <Card title="SSE streaming" icon="signal" href="/sdk/remote/streaming">
    Consume the remote discriminated union.
  </Card>

  <Card title="Source types" icon="github" href="https://github.com/supernovae-st/nika-client/blob/main/src/types.ts">
    Read the exact declarations.
  </Card>
</CardGroup>
