@teovilla/code-runner-contract
v0.5.0
Published
Single-source-of-truth wire contract for code-runner: generated TS types + zod validators + channel/event helpers shared by the SDKs and the gateway.
Downloads
613
Readme
@teovilla/code-runner-contract
The shared wire contract for code-runner — the single source of truth for the types, validators, and channel/event names exchanged between the gateway, the worker, and the client SDKs.
You usually don't depend on this package directly — it's a transitive dependency of
@teovilla/code-runner-sdk-node
and @teovilla/code-runner-react,
which re-export the types you need. Install it on its own only if you're building your own client.
npm install @teovilla/code-runner-contractWhat's inside
- Types —
ExecuteRequest,ExecuteResponse,JobStatus,JobState,LanguageInfo,FileInput,Limits,LimitsOverride, and the soketi event payloadsStageEvent,OutputChunkEvent,ResultEvent,StdinMessage,ControlMessage. - Zod validators — a
<Name>Schemafor each type. - Helpers —
channelForJob(jobId)→private-run-<jobId>,stdinChannel,controlChannel,keys, andevents({ stage, stdout, stderr, result }).
import { channelForJob, events, type ResultEvent } from "@teovilla/code-runner-contract";
const channel = channelForJob(jobId); // "private-run-<jobId>"The contract is generated from schema/wire.schema.json. To consume the raw JSON Schema:
import schema from "@teovilla/code-runner-contract/schema" with { type: "json" };License
MIT
