> ## 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.

# Remote client

> Select authenticated nika serve HTTP with the same Nika client: served names, local snapshots and connection rules.

```ts theme={"system"}
import { Nika } from '@supernovae-st/nika'

const nika = new Nika({
  url: process.env.NIKA_URL!,
  token: process.env.NIKA_TOKEN!,
  requestTimeout: 30_000,
})
```

Supplying `url` selects HTTP. There is no environment-reading constructor:
read and validate deployment configuration in your application. New to
`nika serve`? Start with the [server quickstart](https://docs.nika.sh/sdk/remote/serve-quickstart.md).

## Served names and local snapshots

A **served name** selects a workflow the server serves. It is the workflow's
path from the server's project root (the folder holding `nika.yaml`), not
from `--workflows`: a server started with `--workflows ./workflows` serves
`workflows/release.nika`, and the short `release.nika` answers `not_found`
(404). `await nika.listWorkflows()` returns the exact names. `check()` and
`run()` send the name directly; no local engine or file is needed.

To submit local source instead, pass an explicit path such as
`./flows/release.nika` or an absolute path. The SDK then resolves a compatible
local engine from `bin`, `NIKA_BIN` or the platform package, captures an
immutable snapshot relative to `cwd`, and sends its exact bytes. It never
falls back from an unserved name to a local file. A snapshot freezes its
inputs, so a local path refuses `inputs`.

## Connection rules

Plain HTTP is accepted only to a loopback host (`localhost`, `127.0.0.0/8`,
`[::1]`), and only with `allowInsecureHttp: true`: even with the flag, a
plain-HTTP URL to another host is refused. Every other host needs HTTPS, so
the token never leaves the machine in plaintext. URLs cannot carry
credentials, queries or fragments; bearer tokens must be 32–512 visible ASCII
bytes.

```ts theme={"system"}
const loopback = new Nika({
  url: 'http://127.0.0.1:8787',
  token,
  allowInsecureHttp: true,
})
```

`requestTimeout` bounds HTTP admission. `fetch`, `eventBufferSize` and
`machineBufferBytes` are the other transport seams. `machineBufferBytes`
bounds one SSE frame or JSON document; its 16 MiB default is the server's own
job-store bound, so it holds every result the server settles. Neither bounds an
artifact download. The SDK does not expose automatic retry or concurrency
policy as constructor options.

## Check a served name

```ts theme={"system"}
const report = await nika.check('workflows/release.nika')
if (!report.clean) {
  console.error(report.error)
} else {
  console.log(report.status, report.snapshot_digest, report.root, report.units)
}
```

A successful served-name check returns `clean: true` with the resident's
compact acknowledgement: `status: "accepted"`, `snapshot_digest`, `root` and `units`.
A missing served name or a workflow admission refusal returns `clean: false`
with the typed resident `error` (`code`, optional `message`). This is not a
local findings report: it has no local process `exitCode` and does not invent
findings. Authentication, transport and protocol failures still throw.

An explicit local-path check retains the local engine's full check report;
when capture succeeds, the resident must acknowledge that exact snapshot
before the SDK returns it. Remote checks reject `model` and `nativeStrict`
overrides because the HTTP request has no envelope for them. `access` rides a
served name (`CheckByName.access`): the server's check is source-only and
evaluates no access plan, so it acknowledges any pin that is not empty or
blank.

> [accordion] Which published source this page describes
>
> > [!NOTE]
> >
> > These pages describe the published `@supernovae-st/nika@0.124.4`
> > [SDK release](https://github.com/supernovae-st/nika-client/tree/v0.124.4) and its matching
> > [bundled engine](https://github.com/supernovae-st/nika/releases/tag/v0.124.4). A newer engine
> > release or SDK main commit does not change an installed package. Use Node.js
> > 22 or newer, on macOS (arm64, x64) or Linux with glibc (x64, arm64); no
> > global Nika installation is required for local mode. Versioned transcripts,
> > recordings and measurements keep the release they were captured on;
> > selecting this package release does not re-run those examples.
>
> > [!NOTE]
> >
> > **The same client selects HTTP when `url` and
> > `token` are present.** A served name such as
> > `workflows/release.nika` (its path from the project root) goes
> > directly to the server and needs no local engine or file. An explicit local
> > path such as `./release.nika` needs a compatible local engine to
> > capture an immutable snapshot. The released OpenAPI of
> > `nika serve` 0.124.4 covers jobs, SSE events,
> > cancellation, trace verification, the artifacts a settled job's sealed
> > journal records (behind `run.artifacts()`), workflow listing,
> > schedule read and write, stateless authoring
> > (`POST /v1/compile`, behind `compile()`) and what a
> > workflow's declared ACP route offers (behind `accessOffer()`). It has no
> > `POST /v1/run`, job-list, or schedule list, delete, trigger
> > or backfill route. The server owns its engine version; check its
> > compatibility separately from the bundled local engine.

> [card] [Jobs](https://docs.nika.sh/sdk/remote/jobs.md)
>
> Admit, recover, observe and cancel durable jobs.

> [card] [Configuration](https://docs.nika.sh/sdk/reference/configuration.md)
>
> Read the exact local and remote unions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.