@krizaka/sovkora-client
Un seul client Sovkora pour les produits TypeScript : lancer un run, lire son statut et ses résultats, des erreurs typées, un délai maximal et un coupe-circuit.
Installer
npm install @krizaka/sovkora-clientLe README ci-dessous est celui du paquet sur npm, en anglais.
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.
startRunwith anidempotencyKeyanswers 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 isSOVKORA_KEY_REUSED. - Typed errors. Every failure is an
SovkoraErrorwith a stablecode(SOVKORA_KEY,SOVKORA_CREDITS,SOVKORA_LOCKED,SOVKORA_INPUT,SOVKORA_NOT_FOUND,SOVKORA_BUSYwithretryAfterSeconds,SOVKORA_UNAVAILABLE,SOVKORA_TIMEOUT,SOVKORA_SHAPE,SOVKORA_CIRCUIT_OPEN…) and thestatusa product answers its own caller with. A product translates the codes; none is a sentence. A failed run is not an error:waitForRungives it back with itserrorMessage. - 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: falseturns 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
Les 34 noms que le paquet exporte, lus dans ses types.
| Nom | Nature | Ce que c’est |
|---|---|---|
CHECK_CATEGORY | constante | The closed court category of a match; NONE for everything else. |
CHECK_OUTCOME | constante | |
CHECK_PURPOSE | constante | The checks a product may ask for: POST /api/v1/checks/\{purpose\}. |
CHECK_REFUSAL | constante | Why a check was refused; present exactly when the outcome is REFUSED. |
CheckCategory | type | |
CheckOutcome | type | |
CheckPurposeKey | type | |
CheckRefusal | type | |
CheckResult | type | The closed answer of a check, as Sovkora's CheckResult: an outcome and a category, no record. |
CheckSubject | type | |
Circuit | type | |
CircuitOptions | type | |
Clock | type | |
CollectCheckInput | type | |
createCircuit | fonction | A 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… |
createSovkoraClient | fonction | Sovkora's edge, for every TypeScript product: one client instead of one copy per product. |
isTerminal | fonction | The run is over, green or not: nothing more will change. |
outputOf | fonction | The value of one output, or null when the run did not produce it (yet). |
parseCheck | fonction | Reads a check's answer from the edge's JSON; anything else is SOVKORA_SHAPE. |
parseInstallations | fonction | The Studios an account installed: GET /api/v1/studios/installations. |
parseRun | fonction | Reads a run from the edge's JSON; anything else is SOVKORA_SHAPE. |
RUN_STATUS | constante | Where a run sits (sovkora-studio-service RunStatus). |
RunOutput | type | One output of a run (sovkora-studio-service RunArtefactResponse): type is a rendering hint (TEXT, IMAGE, VIDEO…). |
SOVKORA_CODE | constante | The stable codes of a refusal or a failure of Sovkora's edge — a product translates them; none is a sentence. |
SovkoraClient | type | |
SovkoraClientOptions | type | |
SovkoraCode | type | |
SovkoraError | classe | |
sovkoraRefusal | fonction | What the edge's status means for a product that answers its own caller: the status to send back and the code. |
SovkoraRun | type | A run, as the edge answers it (GET /api/v1/studios/runs/\{id\}). |
StartCheckInput | type | |
StartedRun | type | |
StartRunOptions | type | |
WaitOptions | type |
Paquet
| Version sur npm | Pas encore sur npm |
| Licence | Apache-2.0 |
| Node.js | >=22 |
| Dépendances | date-fns ^4.4.0 |
| Code source | sovkora-client |
Journal des versions
1.0.0
Major changes
-
No retired code name anywhere (founder, 2026-11-06, krizaka-internal#2659).
@krizaka/org1.0.0: brand ids are the commercial names (verikora,folioviv,sovkora,kridoc);OrgBrand.codeNamebecomesid,formerlyis gone;CODE_NAMESis the historic table (retired → id) andbrandOf(<retired>)throws;findCodeNamesand thekrizaka-code-namesbin refuse the retired names everywhere, in any case, with no allowed span (history:CHANGELOG.mdis skipped);org.products,org.family,apps/<id>.jsonandCastProductuse the new ids; every product's runtime config points athttps://dev.<product>.com.@krizaka/sovkora-clientreplaces the engine client published under its former code name (deprecated):createSovkoraClient,SovkoraClient,SovkoraError,SOVKORA_CODEwithSOVKORA_*codes.@krizaka/settings:displayNameSetting(id)and the brand checks take the new ids.@krizaka/config:no-hand-typed-family-namenames 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 })andcollectCheck(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 closedCheckResult(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 andparseCheck.
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.