Skip to the content
Krizaka TypeScript
Krizaka TypeScript

@krizaka/sovkora-client

One Sovkora client for the TypeScript products: start a run, read its status and outputs, typed errors, a time limit and a circuit breaker.

Install

bashTerminal
npm install @krizaka/sovkora-client

One client of Sovkora's edge for every Krizaka TypeScript product, instead of one copy per product (Verikora, soon Folioviv): start a Studio run, read its status and its outputs, wait for it. The base URL, the key and the clock are parameters — this package reads no environment and no wall clock.

import { createSovkoraClient, outputOf } from "@krizaka/sovkora-client";

const sovkora = createSovkoraClient({
  baseUrl: "https://api.sovkora.com",
  apiKey: env.AI_API_KEY,
  clock: { now: () => new Date() },
});

const { run } = await sovkora.startRun(
  "compliance-check",
  { document: text },
  { idempotencyKey: `doc-${documentId}-v${version}` },
);
const done = await sovkora.waitForRun(run.id); // or poll `getRun` yourself
if (done.status === "SUCCEEDED") use(outputOf(done, "report"));
  • Safe to retry. startRun with an idempotencyKey answers the run already started for the same key and inputs (replayed: true) instead of paying for a second one; the same key for other inputs is SOVKORA_KEY_REUSED.
  • Typed errors. Every failure is an SovkoraError with a stable code (SOVKORA_KEY, SOVKORA_CREDITS, SOVKORA_LOCKED, SOVKORA_INPUT, SOVKORA_NOT_FOUND, SOVKORA_BUSY with retryAfterSeconds, SOVKORA_UNAVAILABLE, SOVKORA_TIMEOUT, SOVKORA_SHAPE, SOVKORA_CIRCUIT_OPEN…) and the status a product answers its own caller with. A product translates the codes; none is a sentence. A failed run is not an error: waitForRun gives it back with its errorMessage.
  • A time limit and a circuit breaker, as options: timeoutMs (20 s by default) on every call; five failures in a row (no answer, timeout, 5xx) open the circuit for 30 s — it refuses at once, then lets one call probe. A refusal (401, 402, 404, 429…) is an answer and never opens it. circuit: false turns it off.
  • Contract-tested against the edge's answers kept as fixtures (test/fixtures): when the edge changes a shape, the fixture changes first.

Run events as a stream (Server-Sent Events, GET /api/v1/studios/runs/{id}/events) come in a later minor; waitForRun polls until then.

Exports

The 34 names the package exports, read from its types.

NameKindWhat it is
CHECK_CATEGORYconstantThe closed court category of a match; NONE for everything else.
CHECK_OUTCOMEconstant
CHECK_PURPOSEconstantThe checks a product may ask for: POST /api/v1/checks/\{purpose\}.
CHECK_REFUSALconstantWhy a check was refused; present exactly when the outcome is REFUSED.
CheckCategorytype
CheckOutcometype
CheckPurposeKeytype
CheckRefusaltype
CheckResulttypeThe closed answer of a check, as Sovkora's CheckResult: an outcome and a category, no record.
CheckSubjecttype
Circuittype
CircuitOptionstype
Clocktype
CollectCheckInputtype
createCircuitfunctionA circuit breaker over a dependency that may be down: after failureThreshold failures in a row it refuses at once (no waiting on a timeout, no load on a st…
createSovkoraClientfunctionSovkora's edge, for every TypeScript product: one client instead of one copy per product.
isTerminalfunctionThe run is over, green or not: nothing more will change.
outputOffunctionThe value of one output, or null when the run did not produce it (yet).
parseCheckfunctionReads a check's answer from the edge's JSON; anything else is SOVKORA_SHAPE.
parseInstallationsfunctionThe Studios an account installed: GET /api/v1/studios/installations.
parseRunfunctionReads a run from the edge's JSON; anything else is SOVKORA_SHAPE.
RUN_STATUSconstantWhere a run sits (sovkora-studio-service RunStatus).
RunOutputtypeOne output of a run (sovkora-studio-service RunArtefactResponse): type is a rendering hint (TEXT, IMAGE, VIDEO…).
SOVKORA_CODEconstantThe stable codes of a refusal or a failure of Sovkora's edge — a product translates them; none is a sentence.
SovkoraClienttype
SovkoraClientOptionstype
SovkoraCodetype
SovkoraErrorclass
sovkoraRefusalfunctionWhat the edge's status means for a product that answers its own caller: the status to send back and the code.
SovkoraRuntypeA run, as the edge answers it (GET /api/v1/studios/runs/\{id\}).
StartCheckInputtype
StartedRuntype
StartRunOptionstype
WaitOptionstype

Package

Version on npmNot on npm yet
LicenceApache-2.0
Node.js>=22
Dependenciesdate-fns ^4.4.0
Sourcesovkora-client

Changelog

1.0.0

Major changes

  • No retired code name anywhere (founder, 2026-11-06, krizaka-internal#2659).

    • @krizaka/org 1.0.0: brand ids are the commercial names (verikora, folioviv, sovkora, kridoc); OrgBrand.codeName becomes id, formerly is gone; CODE_NAMES is the historic table (retired → id) and brandOf(<retired>) throws; findCodeNames and the krizaka-code-names bin refuse the retired names everywhere, in any case, with no allowed span (history: CHANGELOG.md is skipped); org.products, org.family, apps/<id>.json and CastProduct use the new ids; every product's runtime config points at https://dev.<product>.com.
    • @krizaka/sovkora-client replaces the engine client published under its former code name (deprecated): createSovkoraClient, SovkoraClient, SovkoraError, SOVKORA_CODE with SOVKORA_* codes.
    • @krizaka/settings: displayNameSetting(id) and the brand checks take the new ids. @krizaka/config: no-hand-typed-family-name names the products by their commercial names.

0.2.1

Patch changes

  • The READMEs, comments and published declarations no longer name the products that left the organisation (krizaka/.github#413, rule no-departed-published). The sources were cleaned in #262 with an empty changeset, so the published tarballs still carried the old text; this release replaces them. No behaviour change.

0.2.0

Minor changes

  • New: startCheck(purpose, { subject, consented, runId }) and collectCheck(providerRef, { subjectId, consented }), the calls of Orazaka's HTTP door for external checks (POST /api/v1/checks/{court-records|credit}, GET /api/v1/checks/{providerRef}; orazaka-ai-engine#105). The answer is the closed CheckResult (outcome, refusal, category, providerRef): a refusal (NO_CONSENT, NO_KEY, BUDGET_EXHAUSTED, NOT_CONFIGURED) is a result, never an exception; 401/403/404/429 map to the existing stable codes. Exports the check types, constants and parseCheck.

0.1.0

Minor changes

  • New: @krizaka/orazaka-client, the one Orazaka client for the TypeScript products (#33). Start a Studio run (idempotency key), read its status and outputs, wait for it; typed errors with stable codes, a time limit and a circuit breaker as options; base URL, key and clock as parameters; a fixture-based contract test.

On this page