AGPL-3.0-or-later · forever.

HTTP + SSE · preview

The remote client contract.

Jobs, workflows, artifacts, retries and SSE are typed now. The compatible HTTP server surface is not shipped yet.

The root package types the intended remote workflow API. It is useful for integration work now, but it needs a compatible HTTP surface that the reference engine does not ship today.

Read this before you connect.

Do not point this client at the current nika serve command. That command is the resident cadence runner, not an HTTP API. Use LocalNika for production against the released binary today.

The intended remote boundary.

A compatible service supplies an HTTPS origin and bearer token. The client owns bounded retries, timeouts and a request semaphore.

import { Nika } from '@supernovae-st/nika-client'

const nika = new Nika({
  url: process.env.NIKA_URL!,
  token: process.env.NIKA_TOKEN!,
  timeout: 30_000,
  retries: 2,
  concurrency: 24,
})

Submit, wait or stream.

The jobs namespace covers submission, status, cancellation, artifacts and an SSE stream with idle detection and Last-Event-Id reconnection.

const { job_id } = await nika.jobs.submit('pipeline.nika.yaml', {
  topic: 'workflow engines',
})

for await (const event of nika.jobs.stream(job_id)) {
  console.log(event.type)
}

Keep large bytes out of memory.

Text, JSON, binary downloads and ReadableStream artifacts are separate methods. runAndCollect deliberately skips binary artifacts.

const stream = await nika.jobs.artifactStream(job_id, 'dataset.csv')

for await (const chunk of stream) {
  await sink.write(chunk)
}