Simcraft execution APIv0.1.0
Reference execution API for batch runs and interactive sessions.
The execution service is not publicly reachable: every model on this site runs in your browser through WebAssembly. This page documents the service's HTTP contract. The WebSocket half of the interface, live interactive sessions, is not covered here.
The HTTP + WebSocket API served by simcraft-server and implemented by the private crates/simcraft-server package. POST an OSDL document to start a batch run or interactive session. Poll its status and stream the typed event stream over WebSocket. The IDE's run panel and @simcraft/client use this API against local and remote servers. A hosted execution service is expected to expose the same surface.
Documents and events follow the published schemas: model documents per spec/schemas/osdl.schema.json, event envelopes per spec/schemas/osdl.events.schema.json. Results follow the results JSON contract in docs/contracts.md, shared byte-for-byte with the CLI and the WASM engine. The interactive session lifecycle is documented in docs/interactive-session-protocol.md.
The reference server enables permissive CORS and has no authentication. It is built for local and trusted-network use. Runs and sessions are held in memory and are not persisted across restarts.
Base URL#
/api: Same-origin hosted endpointhttp://localhost:8420: Localsimcraft-server(default port 8420)
GET /v0/health#
Liveness and version.
Always returns ok: true with the server version. Use it to discover whether a Simcraft server is listening before offering remote execution.
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · HealthResponse |
The server is up. |
GET /v0/libraries#
Registered component library definitions.
The library definitions (per spec/schemas/osdl.library.schema.json) registered in this server's engine, verbatim. A plugin distribution (see the Plugin API section of docs/contracts.md) reports its additional libraries here, which is how tooling such as the IDE palette discovers plugin components at runtime.
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · array<object> |
A JSON array of library documents. |
POST /v0/validate#
Validate a document without running it.
Validates one OSDL document for schema structure, semantic diagnostics, and buildability against the registered libraries. It never accepts execution options or starts a run. Returns 200 with the diagnostics array. An empty array means the document is valid.
Request body
| Content type | Schema |
|---|---|
application/jsonrequired |
ValidateRequest |
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · array<Diagnostic> |
Validation diagnostics (empty when valid). |
422 |
— | The request shape is invalid or contains fields other than document. |
POST /v0/runs#
Start a run.
Prepares the posted run before accepting it. Preparation validates the requested limits against server maximums, validates the OSDL document and selected experiment, applies parameter overrides, and builds the execution plan. A 201 response means the worker was created and the run is retained. Poll GET /v0/runs/{id} for completion and subscribe to GET /v0/runs/{id}/events for the live event stream.
The server has 128 run slots. Preparing requests, runs available through the status and event endpoints, and still-running workers deleted from lookup occupy these slots. Completed and failed runs keep their slot until deletion or expiry. A later POST removes completed or failed runs that have been retained for more than 3,600 seconds. Capacity does not evict a non-expired run.
Determinism: identical (document, experiment, parameters, seed, replication) produce byte-identical results, the same as a local CLI run. trace does not enter that tuple: it selects what the run streams, never what it computes.
Request body
| Content type | Schema |
|---|---|
application/jsonrequired |
RunRequest |
Responses
| Status | Schema | Description |
|---|---|---|
201 |
application/json · RunCreated |
The run was accepted and its worker was created. |
400 |
application/json · RunValidationErrorResponse |
Preparation failed validation. Causes include a requested limit above the server maximum, a zero limit, an invalid document, an unavailable component library, an invalid experiment or parameter override, or an execution plan that exceeds a requested resource limit. No worker is created. |
422 |
— | The request shape is invalid or contains an unknown field. |
429 |
application/json · ErrorResponse |
All 128 run slots are occupied. Retry after deleting a retained run, after an active worker exits following deletion, or when a completed or failed run is old enough for the retry to expire it. |
500 |
application/json · ErrorResponse |
The preparation task could not complete, the worker thread could not be created, or the run identifier counter is exhausted. |
GET /v0/runs/{id}#
Poll run status and results.
Returns the run's current state. Results appear in the shared results JSON shape after successful completion. Execution failures and caught worker panics produce status: error.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Run identifier returned by createRun. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · RunState |
The current state of the run. |
404 |
application/json · ErrorResponse |
No run with this id. |
DELETE /v0/runs/{id}#
Delete a run.
Removes the run from status and event lookup immediately. Deleting an active run does not cancel its worker. The worker keeps its run slot until it exits, and an event stream connected before deletion can continue until the worker exits. Deleting a completed or failed run releases its slot.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Run identifier returned by createRun. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
204 |
— | The run was deleted. |
404 |
application/json · ErrorResponse |
No run with this id. |
GET /v0/runs/{id}/events#
Stream the typed event stream (WebSocket).
WebSocket upgrade. What the socket carries is fixed when the run is created. A run with trace off or collect streams sim.started, sim.progress, sim.completed, sim.error, sim.aborted, and param.changed only, at most 100 progress frames per replication, and its replay buffer holds a few thousand frames. A run with trace live streams every envelope it produces. There is no per-subscriber selection: the run decides, so every subscriber reads the same stream.
On connect the server replays the buffered envelopes, then streams live. The replay buffer is bounded to the newest 50,000 frames. A subscriber that connects late to an event-heavy run receives a trace that starts mid-run. Event seq values restart at 1 for each replication. A complete trace starts with run.scenario 0, run.replication 1, and seq 1. Any other first-envelope values identify a dropped prefix. Subscribers connected from the start miss nothing. Each envelope is one text frame of JSON per spec/schemas/osdl.events.schema.json. run.experiment, run.replication, and run.scenario are set on every event.
Normal execution finishes with a terminal sim.completed, sim.error, or sim.aborted frame. Multi-replication runs contain interior sim.completed frames, and the socket stays open across them. A caught worker panic records status: error but bypasses normal terminal-frame emission. The server then closes the socket with code 1000 and reason run completed.
A subscriber that falls behind the live broadcast is resynchronized from the replay buffer: the server resends only the frames that subscriber has not received, so its trace carries no gap and no duplicate. A subscriber that falls behind by more than the buffer retains cannot be resynchronized, and the server closes the socket with code 1008 and reason trace cut: replay buffer no longer covers this subscriber. Deleting the run does not close the sockets already streaming it; they run on until the run completes.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Run identifier returned by createRun. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
101 |
— | Switching protocols: the connection upgrades to a WebSocket carrying EventEnvelope text frames. |
404 |
text/plain · string |
No run with this id (plain-text body). |
POST /v0/sessions#
Start an interactive session.
Prepares one selected scenario and replication, creates its worker, and waits for the initial paused snapshot. A successful session starts at simulation time 0 with speed 1.0 on root branch b1. The default server retains at most 8 sessions and 32 branches per session through its maxBranches policy. Completed and errored sessions remain retained for 3,600 seconds unless deleted.
Request body
| Content type | Schema |
|---|---|
application/jsonrequired |
SessionRequest |
Responses
| Status | Schema | Description |
|---|---|---|
201 |
application/json · SessionCreated |
The worker published its initial paused snapshot. |
400 |
application/json · RunValidationErrorResponse | ErrorResponse |
Preparation, validation, or trajectory selection failed. |
403 |
application/json · ErrorResponse |
Interactive sessions are disabled by host policy. |
422 |
— | The request shape is invalid or contains an unknown field. |
429 |
application/json · ErrorResponse |
All interactive session slots are occupied. |
500 |
application/json · ErrorResponse |
The preparation task or worker could not start, a component panicked while the engine initialized, or the session identifier counter is exhausted. A panic is reported as session worker panicked: <message>. |
GET /v0/sessions/{id}#
Get an interactive session snapshot.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Session identifier returned by createSession. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · SessionSnapshot |
The current session snapshot. |
404 |
application/json · ErrorResponse |
No session with this id. |
DELETE /v0/sessions/{id}#
Delete an interactive session.
Removes the session from lookup and disconnects its worker.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Session identifier returned by createSession. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
204 |
— | The session was deleted. |
404 |
application/json · ErrorResponse |
No session with this id. |
POST /v0/sessions/{id}/commands#
Control an interactive session.
Applies one tagged command and returns the immediate post-command snapshot. runTo, runToEnd, seek, and switchBranch targets that require replay return promptly with state playing; the worker advances in bounded bursts. A rebuilt seek to time zero returns state paused. Branch-switch replay finishes to the target tip. During that replay pause is a no-op, setSpeed, switchBranch, and stop apply, and every other command returns the unchanged snapshot with a transient error field. Observe asynchronous target arrival, completion, or failure through session.status frames or GET /v0/sessions/{id}. seek and switchBranch can rebuild a completed or errored session. Other commands return its final snapshot unchanged. Parameter-name, parameter-value, branch-id, and branch-limit validation failures return status 200 with the unchanged snapshot and a transient error field.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Session identifier returned by createSession. Opaque; do not parse. |
Request body
| Content type | Schema |
|---|---|
application/jsonrequired |
SessionCommand |
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/json · SessionSnapshot |
The immediate post-command session snapshot. |
404 |
application/json · ErrorResponse |
No session with this id. |
409 |
application/json · ErrorResponse |
The session worker is unavailable. |
422 |
— | The command shape is invalid or contains an unknown field. |
GET /v0/sessions/{id}/events#
Stream interactive session events (WebSocket).
WebSocket upgrade. The server replays buffered simulation envelopes, then streams live simulation envelopes and session.status frames. Status frames are emitted on state, generation, or active-branch transitions and at a 100 ms cadence while state is playing, including turbo advancement. Status frames bypass the replay buffer, so late subscribers read GET /v0/sessions/{id} for the current snapshot. The buffer retains the newest 50,000 simulation event frames. Event seq restarts at 1 after a replay generation change. A live parameter edit keeps the generation and emits param.changed in the current trace. The socket stays open across completed and error states because seek and switchBranch can revive the session. It ends when the client disconnects or delivery fails, and closes with code 1000 and reason stream closed when the session is deleted or expires. A subscriber that falls behind the live broadcast is resynchronized from the replay buffer: the server resends only the event frames that subscriber has not received, so its trace carries no gap and no duplicate, but it does miss the status frames sent while it was behind. A subscriber that falls behind by more than the buffer retains cannot be resynchronized, and the server closes the socket with code 1008 and reason trace cut: replay buffer no longer covers this subscriber. Clearing the buffer, which seek backward and switchBranch do, cuts a subscriber that was still behind in the previous generation.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
Session identifier returned by createSession. Opaque; do not parse. |
Responses
| Status | Schema | Description |
|---|---|---|
101 |
— | Switching protocols: the connection carries EventEnvelope and SessionStatusFrame text frames. |
404 |
text/plain · string |
No session with this id (plain-text body). |
GET /v0/runs/{id}/scenarios/{scenario}/replications/{replication}/events#
Fetch one replication's collected trace.
Returns the envelopes a single replication recorded during a collect run, as NDJSON. The first line is a header object carrying runId, scenario, replication, cap, envelopes, discarded, truncated, from and count; every line after it is one envelope. envelopes is the total the replication recorded and count is how many this response carries, so a client renders its position as from + 1 to from + count of envelopes. Truncation is reported before the payload it describes. One replication of the packaged M/M/1 example records about 80,000 envelopes and 17 MB, so a reader pages with from and limit rather than fetching a whole replication. Available once the run has finished. A run started off or live recorded nothing and answers 409.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string |
|
scenariorequired |
path | integer |
Sweep scenario index, 0 when the experiment declares no sweep. |
replicationrequired |
path | integer |
Replication number, counting from 1. |
from |
query | integer |
Index of the first envelope to return, counting from 0. A from past the end returns an empty window whose header reports from as the total, so a client paging forward discovers the end without an error. |
limit |
query | integer |
Envelopes to return. Absent returns every envelope after from, which is what the endpoint served before windows existed. A value above 5000 is clamped rather than refused, and the header reports how much was returned. |
Responses
| Status | Schema | Description |
|---|---|---|
200 |
application/x-ndjson · string |
The replication's trace as NDJSON, header line first. |
404 |
— | No such run, scenario or replication. |
409 |
— | The run did not collect a trace, or has not finished. |
410 |
— | The collected trace was displaced by a newer collecting run. |
Schemas#
HealthResponse#
| Field | Type | Description |
|---|---|---|
okrequired |
true |
|
versionrequired |
string |
Server version (the simcraft-server crate version). |
RunRequest#
| Field | Type | Description |
|---|---|---|
documentrequired |
OsdlDocument |
|
experiment |
string |
Name of the experiment to run. Defaults to the first experiment in the document. |
parameters |
map<string, number | integer | boolean | string> |
Model parameter overrides by name. Applied after the experiment's fixed parameters and after sweep values, the same precedence as the CLI's --param. |
seed |
integer |
RNG seed override (unsigned 64-bit). When neither this nor the experiment provides a seed, 0 is used. min 0 |
emit_state_events |
boolean |
Include state.changed envelopes for state-store writes. A run with trace off streams none of them, and a collect run records them instead of streaming them: state.changed is not a lifecycle event. |
emitStateEvents |
boolean |
Camel-case alias for emit_state_events. |
trace |
"off" | "live" | "collect" |
What the run does with the envelopes it mints. off, the default, mints run lifecycle envelopes only (sim.started, sim.progress, sim.completed, sim.error, sim.aborted, param.changed), which is what a batch run needs for a progress bar and a result, and it lets replications run in parallel. live mints every envelope and streams it in run order as the run produces it, which is what a timeline can be rebuilt from live; ordering the stream funnels every replication through one channel, so a live run does not run its replications in parallel. collect mints every envelope, streams the lifecycle ones, and records the rest per replication for a client to fetch once the run finishes, which keeps the parallel speed and the full trace at the cost of holding the trace in memory. The setting is fixed at creation and applies to every subscriber. default "off" |
limits |
RunLimits |
Optional per-run maximums. Each supplied value must be at least 1 and no greater than the matching server maximum. Omitted fields inherit the server maximum. |
trace_cap |
integer |
Envelopes each replication records in collect mode. A replication that mints more keeps its oldest trace_cap envelopes and reports the rest as discarded. Ignored in off and live. default 100000 · min 1 · max 1000000 |
traceCap |
integer |
Camel-case alias for trace_cap. default 100000 · min 1 · max 1000000 |
SessionRequest#
| Field | Type | Description |
|---|---|---|
documentrequired |
OsdlDocument |
|
experiment |
string |
Experiment name. Defaults to the first experiment in the document. |
parameters |
map<string, number | integer | boolean | string> |
Model parameter overrides by name. default {} |
seed |
integer |
Root RNG seed override. The experiment seed is used when omitted, then 0. min 0 |
scenario |
integer |
Zero-based index in the prepared sweep. default 0 · min 0 |
replication |
integer |
One-based replication selection. Zero is rejected during preparation. default 1 · min 0 · max 4294967295 |
emitStateEvents |
boolean |
Include state.changed envelopes for state-store writes. default false |
limits |
RunLimits |
Optional per-session maximums. Omitted fields inherit the server maximum. |
SessionCreated#
| Field | Type | Description |
|---|---|---|
sessionIdrequired |
string |
Opaque session identifier for status, commands, deletion, and events. |
SessionSnapshot#
| Field | Type | Description |
|---|---|---|
staterequired |
"paused" | "playing" | "completed" | "error" |
|
generationrequired |
integer |
Replay generation. Starts at 1 and increases when seek rebuilds the run or any switchBranch command rebuilds its target. min 1 |
timerequired |
number |
Playhead position. During playback this is the paced virtual clock and can sit between event times. Seek and runTo park it at their target when the trajectory remains live. |
durationrequired |
number |
Selected experiment duration. |
speedrequired |
number |
Simulation-time units advanced per real second during paced playback. |
eventsrequired |
integer |
Advisory dispatched-event counter derived from the trajectory event sequence for the current generation. It resets when the generation increases. Each dispatched event increments it, including simultaneous events dispatched by one time-granularity step. min 0 |
branchIdrequired |
string |
Identifier of the active branch. |
branchesrequired |
array<BranchSummary> |
Branch tree over the shared prepared document, scenario, replication, and seed. |
results |
Results |
Single-trajectory results. Present after successful completion. |
error |
string |
Execution error message when state is error. A command reply can contain a transient validation error without changing the stored snapshot. |
BranchSummary#
| Field | Type | Description |
|---|---|---|
idrequired |
string |
Session-local branch identifier. pattern ^b[1-9][0-9]*$ |
parentIdrequired |
string | null |
Parent branch identifier. The root branch uses null. |
forkTimerequired |
number |
Playhead position where this branch forked. |
forkSeqrequired |
integer |
Envelope sequence boundary where this branch forked. min 0 |
editsrequired |
integer |
Number of entries in the branch's cumulative parameter edit log. min 0 · max 4294967295 |
tipTimerequired |
number |
Latest published playhead position for this branch. |
SessionCommand#
One interactive control command, tagged by command.
command: "pause"| Field | Type | Description |
|---|---|---|
commandrequired |
"pause" |
command: "resume"| Field | Type | Description |
|---|---|---|
commandrequired |
"resume" |
command: "step"| Field | Type | Description |
|---|---|---|
commandrequired |
"step" |
|
granularity |
"time" | "event" |
default "time" |
count |
integer |
Number of step calls. Zero is treated as one. default 1 · min 0 · max 4294967295 |
command: "runTo"| Field | Type | Description |
|---|---|---|
commandrequired |
"runTo" |
|
timerequired |
number |
Inclusive simulation-time target. |
command: "seek"| Field | Type | Description |
|---|---|---|
commandrequired |
"seek" |
|
timerequired |
number |
Target clamped to the session duration. Forward targets use turbo. Backward targets and seeks on completed or errored sessions rebuild the run in a new generation. |
command: "runToEnd"| Field | Type | Description |
|---|---|---|
commandrequired |
"runToEnd" |
command: "setSpeed"| Field | Type | Description |
|---|---|---|
commandrequired |
"setSpeed" |
|
multiplierrequired |
number |
Positive finite values replace the current speed. Other values leave it unchanged. |
command: "setParameter"Pauses first, creates and activates a child branch, and applies the override at the current envelope sequence. The generation does not change. The engine emits param.changed. Unknown names, invalid values, and the 32-branch default maxBranches limit return the unchanged snapshot with a transient error.
| Field | Type | Description |
|---|---|---|
commandrequired |
"setParameter" |
|
namerequired |
string |
Declared model parameter name. |
valuerequired |
number | boolean |
Numeric or boolean override value. Booleans resolve numerically as 1 or 0. |
command: "switchBranch"Rebuilds the target branch in a new generation, schedules its cumulative edit log, and replays by envelope sequence to its recorded tip. Replay uses bounded bursts. Until replay reaches the tip, pause is a no-op and commands that would continue from the replay position are refused with a transient error field.
| Field | Type | Description |
|---|---|---|
commandrequired |
"switchBranch" |
|
branchIdrequired |
string |
Existing session-local branch identifier. |
command: "stop"| Field | Type | Description |
|---|---|---|
commandrequired |
"stop" |
SessionStatusFrame#
Current snapshot sent on state, generation, or active-branch transitions and at a 100 ms cadence while state is playing, including turbo advancement. Status frames are not retained in the replay buffer.
| Field | Type | Description |
|---|---|---|
typerequired |
"session.status" |
|
payloadrequired |
SessionSnapshot |
RunLimits#
Requested per-run resource limits. Omitted fields inherit the matching server maximum. The documented defaults and maximums describe the default server configuration.
| Field | Type | Description |
|---|---|---|
componentsMax |
integer |
Maximum built components. default 4096 · min 1 · max 4096 |
connectionsMax |
integer |
Maximum model connections. default 16384 · min 1 · max 16384 |
roundsMax |
integer |
Maximum built resolution rounds. default 1024 · min 1 · max 1024 |
roundParticipantsMax |
integer |
Maximum participants across built resolution rounds. default 16384 · min 1 · max 16384 |
scenariosMax |
integer |
Maximum sweep scenarios. default 4096 · min 1 · max 4096 |
replicationsMax |
integer |
Maximum replications per scenario. default 1024 · min 1 · max 1024 |
runsMax |
integer |
Maximum scenario-replication runs. default 16384 · min 1 · max 16384 |
calendarEntriesMax |
integer |
Maximum queued calendar entries per replication. default 1000000 · min 1 · max 1000000 |
dispatchesMax |
integer |
Maximum calendar dispatches per replication. default 10000000 · min 1 · max 10000000 |
dispatchesSameTimeMax |
integer |
Maximum consecutive dispatches at one simulation time. default 1000000 · min 1 · max 1000000 |
entitiesMax |
integer |
Maximum created entities per replication. default 10000000 · min 1 · max 10000000 |
outputPointsMax |
integer |
Maximum recorded scalar output points per replication. default 10000000 · min 1 · max 10000000 |
ValidateRequest#
| Field | Type | Description |
|---|---|---|
documentrequired |
OsdlDocument |
OsdlDocument#
A complete OSDL model document, valid against the model schema spec/schemas/osdl.schema.json (https://osdl.dev/schemas/0.1/osdl.schema.json). Every component type used must be available to the engine.
No properties.
TraceCap#
Envelopes each replication records in collect mode. Present only for a collecting run.
integer min 1 · max 1000000
TraceRetention#
Retention state of the collected traces. Present only for a collecting run.
"pending" | "retained" | "dropped"
RunCreated#
| Field | Type | Description |
|---|---|---|
runIdrequired |
string |
Opaque run identifier for the status and events endpoints. |
tracerequired |
"off" | "live" | "collect" |
What the run does with the envelopes it mints. off, the default, mints run lifecycle envelopes only (sim.started, sim.progress, sim.completed, sim.error, sim.aborted, param.changed), which is what a batch run needs for a progress bar and a result, and it lets replications run in parallel. live mints every envelope and streams it in run order as the run produces it, which is what a timeline can be rebuilt from live; ordering the stream funnels every replication through one channel, so a live run does not run its replications in parallel. collect mints every envelope, streams the lifecycle ones, and records the rest per replication for a client to fetch once the run finishes, which keeps the parallel speed and the full trace at the cost of holding the trace in memory. The setting is fixed at creation and applies to every subscriber. default "off" |
traceCap |
TraceCap |
RunState#
Current state of a run, discriminated by status. Every variant carries trace. A collecting run also carries traceCap and traces. A completed collecting run carries traceCut when its cap truncated at least one replication.
status: "running"| Field | Type | Description |
|---|---|---|
statusrequired |
"running" |
|
tracerequired |
"off" | "live" | "collect" |
What the run does with the envelopes it mints. off, the default, mints run lifecycle envelopes only (sim.started, sim.progress, sim.completed, sim.error, sim.aborted, param.changed), which is what a batch run needs for a progress bar and a result, and it lets replications run in parallel. live mints every envelope and streams it in run order as the run produces it, which is what a timeline can be rebuilt from live; ordering the stream funnels every replication through one channel, so a live run does not run its replications in parallel. collect mints every envelope, streams the lifecycle ones, and records the rest per replication for a client to fetch once the run finishes, which keeps the parallel speed and the full trace at the cost of holding the trace in memory. The setting is fixed at creation and applies to every subscriber. default "off" |
traceCap |
TraceCap |
|
traces |
TraceRetention |
|
traceCut |
string |
Summary of the first replication whose collected trace exceeded traceCap. Present after a truncated collecting run completes. |
status: "completed"| Field | Type | Description |
|---|---|---|
statusrequired |
"completed" |
|
resultsrequired |
Results |
|
tracerequired |
"off" | "live" | "collect" |
What the run does with the envelopes it mints. off, the default, mints run lifecycle envelopes only (sim.started, sim.progress, sim.completed, sim.error, sim.aborted, param.changed), which is what a batch run needs for a progress bar and a result, and it lets replications run in parallel. live mints every envelope and streams it in run order as the run produces it, which is what a timeline can be rebuilt from live; ordering the stream funnels every replication through one channel, so a live run does not run its replications in parallel. collect mints every envelope, streams the lifecycle ones, and records the rest per replication for a client to fetch once the run finishes, which keeps the parallel speed and the full trace at the cost of holding the trace in memory. The setting is fixed at creation and applies to every subscriber. default "off" |
traceCap |
TraceCap |
|
traces |
TraceRetention |
|
traceCut |
string |
Summary of the first replication whose collected trace exceeded traceCap. Present after a truncated collecting run completes. |
status: "error"| Field | Type | Description |
|---|---|---|
statusrequired |
"error" |
|
errorrequired |
string |
Execution error message. A caught worker panic starts with run worker panicked:. |
tracerequired |
"off" | "live" | "collect" |
What the run does with the envelopes it mints. off, the default, mints run lifecycle envelopes only (sim.started, sim.progress, sim.completed, sim.error, sim.aborted, param.changed), which is what a batch run needs for a progress bar and a result, and it lets replications run in parallel. live mints every envelope and streams it in run order as the run produces it, which is what a timeline can be rebuilt from live; ordering the stream funnels every replication through one channel, so a live run does not run its replications in parallel. collect mints every envelope, streams the lifecycle ones, and records the rest per replication for a client to fetch once the run finishes, which keeps the parallel speed and the full trace at the cost of holding the trace in memory. The setting is fixed at creation and applies to every subscriber. default "off" |
traceCap |
TraceCap |
|
traces |
TraceRetention |
|
traceCut |
string |
Summary of the first replication whose collected trace exceeded traceCap. Present after a truncated collecting run completes. |
Results#
The shared results JSON, identical to the stdout of simcraft run/sweep and the return of the WASM engine's run (see docs/contracts.md).
| Field | Type | Description |
|---|---|---|
osdlrequired |
"0.1" |
|
modelrequired |
string |
Model name from the document. |
experimentrequired |
string |
Name of the experiment that ran. |
scenariosrequired |
array<Scenario> |
One per sweep cross-product point; a single element with empty parameters when the experiment has no sweep. |
Scenario#
| Field | Type | Description |
|---|---|---|
indexrequired |
integer |
Position in the sweep cross product. min 0 |
parametersrequired |
map<string, number | integer | boolean | string> |
Only the swept parameter values for this scenario; empty when there is no sweep. |
replicationsrequired |
array<Replication> |
|
aggregate |
map<string, map<string, map<string, AggregateStat>>> |
Per output key, recorder type, and statistic: the cross-replication aggregate. Timeseries recorders are not aggregated. |
Replication#
| Field | Type | Description |
|---|---|---|
replicationrequired |
integer |
1-based replication number. min 1 |
seedrequired |
integer |
The derived RNG seed this replication ran with. min 0 |
outputsrequired |
map<string, Output> |
Keyed by the output's as alias if set, else its state path. |
Output#
Recorder results for one declared output, keyed by recorder type.
objectobject
objectobject
objectobject
AggregateStat#
| Field | Type | Description |
|---|---|---|
meanrequired |
number |
|
stdrequired |
number |
|
minrequired |
number |
|
maxrequired |
number |
|
nrequired |
integer |
Number of replications aggregated. |
EventEnvelope#
One event on the typed simulation event stream, sent as a single WebSocket text frame. The envelope shape is defined by spec/schemas/osdl.events.schema.json (https://osdl.dev/schemas/0.1/osdl.events.schema.json). Every envelope carries v, seq, time, type, and source; over this transport run.experiment, run.replication, and run.scenario are always set.
No properties.
ErrorResponse#
| Field | Type | Description |
|---|---|---|
errorrequired |
string |
Human-readable error message. |
RunValidationErrorResponse#
| Field | Type | Description |
|---|---|---|
errorrequired |
"validation failed" |
|
diagnosticsrequired |
array<Diagnostic> |
min items 1 |
Diagnostic#
One validation finding, as emitted by the core validator (also the CLI's validate --format json element shape).
| Field | Type | Description |
|---|---|---|
severityrequired |
"error" | "warning" |
|
coderequired |
string |
Stable machine-readable code, e.g. core.unknown-type. |
targetrequired |
object |
What the finding is about: the model, a component, a connection, or a parameter. |
messagerequired |
string |