This is the canonical module-by-module reference for the sts:* builtin surface.
In checked .sts files, soundscript injects the core prelude names so ordinary code can use them
without repeating imports in every file.
The ambient names are:
- carriers and constructors:
Result,Option,Ok,Err,Some,None,ok,err,some,none - control-flow helpers:
Try,Match,where,Defer - carrier guards:
isOk,isErr,isSome,isNone - failure helpers and terminal helpers:
Failure,todo,unreachable
That ambient surface is intentionally small. It exists to make the sound path easy to reach in
.sts, not to create a second hidden standard library.
sts:prelude is the explicit import form of the same core surface.
Use it when you want the prelude names in a file that prefers imports, or when you want an import statement to make the ownership boundary obvious.
It re-exports the same core values and types:
Result,Option,Ok,Err,Some,Noneok,err,some,noneisOk,isErr,isSome,isNoneTry,Match,whereFailureDefer,todo,unreachable
The stable sts:* surface stays focused and composable.
sts:resultowns the canonicalResult/Optioncarriers and result-first helpers such asmapErr,tapErr,unwrapOr,unwrapOrElse,unwrapOrThrow, andcollect.sts:matchownsMatchandwhere.sts:failuresownsFailure,ErrorFrame, andnormalizeThrown(...).sts:jsonowns JSON boundary helpers for parsing, stringifying, and plain JSON validation, plus small record helpers such asisJsonObject,emptyJsonRecord,copyJsonRecord, andmergeJsonRecords, plus bridge helpers such asdecodeJson,encodeJson,validateDecodeJson, andvalidateEncodeJson.sts:decodeowns decoder contracts and structural decode helpers such asliteral,nullable,defaulted,preprocess,minLength,startsWith,multipleOf,pattern,format, object key policy helpers, andvalidateDecode(...).sts:encodeowns encoder contracts, structural encode combinators, object key policy helpers, andvalidateEncode(...).sts:codecowns codec contracts and adapter helpers, including explicit conversion helpers such ascodec.isoDateandcodec.url.sts:metadataowns derive metadata inspection helpers such asmetadataOf(...)andattachMetadata(...).sts:concurrencyis the portable root forAsyncResult,Task, and cancellation failures; it does not pull in provider-backed runtime modules.sts:concurrency/taskownsTask<T, E>and result-first async helpers exposed throughTask.*.sts:concurrency/runtimeowns js-node structured concurrency primitives such asTaskGroupandAsyncContext; other targets gate that module until they have a provider.sts:capabilities,sts:time,sts:console,sts:streams,sts:path, andsts:bytesare JS-neutral portable support modules.sts:bytesis the shared low-level byte surface for zero-copy views, explicit copies, shared-buffer detection, and host-boundary buffer conversion.sts:capabilitiesreports narrow audit names such asurl.parse,time.timer,fs.read,process.spawn,net.tcp, andhttp.server, with coarse module aliases kept for ergonomics.sts:fs,sts:env,sts:cli,sts:process,sts:http, andsts:netare initial js-node provider modules and are capability-gated away from browser/Wasm targets.sts:httpexposes WebRequest/Responsehandlers, not raw Node handler types.sts:net/dns,sts:net/tcp, andsts:net/tlsprovide narrower raw networking entry points, whilests:process/commandandsts:process/signalsprovide narrower process entry points.sts:compareownsEq,Order, and comparator composition helpers.sts:hashowns hashing and equality-key protocols.sts:deriveowns compiler-provided declaration macros such aseq,hash,decode,encode,codec, andtagged.sts:hktowns low-level higher-kinded type machinery.sts:typeclassesownsFunctor,Applicative,Monad,AsyncMonad, andDo.sts:url,sts:fetch,sts:streams,sts:text,sts:random, andsts:cryptoare the initial portable leaf modules.sts:crypto/digestandsts:crypto/hmacprovide narrower crypto entry points; key-management APIs are still deferred.sts:randomexposes result-returning portable helpers, not rawcryptoorgetRandomValueshost exports.
If you are deciding where a helper should live, prefer the narrowest leaf module that honestly matches the ownership boundary.
The portable stdlib is being implemented JS-first. The current checked behavior is:
| Surface | js-browser | js-node |
|---|---|---|
pure language modules (sts:result, sts:json, sts:decode, sts:encode, etc.) |
yes | yes |
portable Web-style modules (sts:url, sts:fetch, sts:streams, sts:text, sts:random, sts:crypto, sts:crypto/digest, sts:crypto/hmac) |
yes | yes |
JS-neutral support (sts:capabilities, sts:time, sts:console, sts:path, sts:bytes) |
yes | yes |
task helpers (sts:concurrency/task) |
yes | yes |
structured concurrency runtime (sts:concurrency/runtime, TaskGroup, AsyncContext) |
no | yes |
| parallel/sync/atomics provider modules | gated | gated |
filesystem (sts:fs) |
no | yes |
environment (sts:env) |
no | yes |
CLI (sts:cli) |
no | yes |
process information and child processes (sts:process, sts:process/command, sts:process/signals) |
no | yes |
| HTTP client | use sts:fetch |
use sts:fetch |
HTTP server (sts:http) |
no | yes |
raw DNS/TCP/TLS networking (sts:net, sts:net/dns, sts:net/tcp, sts:net/tls) |
no | yes |
raw Web host imports (web:*) |
// #[interop] required |
no |
raw Node host imports (node:*) |
no | // #[interop] required |
app/embedder ambient values (extern:*) |
// #[interop] required |
// #[interop] required |
js-browser diagnostics intentionally reject js-node provider modules rather than exposing stubs
that fail later at runtime. Browser networking should use fetch, WebSocket, WebTransport, and
other Web-platform APIs instead of sts:net.
Wasm target runtime work is deferred. New JS-provider modules should remain unsupported there until the Wasm compiler/runtime can lower those capabilities through the host-provider model.
Soundscript does not have external compatibility obligations yet, so the stdlib can still make breaking cleanup changes before the stable contract.
The old async helper shape has been removed:
- use
sts:concurrency/taskinstead ofsts:async - access task helpers through
Task.*rather than a flat set of bare functions - use
Task.all(...)for promise fanout instead of the removedparallel(...) - keep true parallel execution under
sts:concurrency/parallel - keep synchronization and atomic shared-memory APIs under
sts:concurrency/syncandsts:concurrency/atomics, not top-levelsts:syncorsts:atomics
The fuller proposed surface is tracked in
docs/plans/portable-stdlib-api-surface.md.
The repository also contains builtin modules that are implemented but intentionally outside the stable v1 contract.
sts:numericssts:valuests:thunksts:sqlsts:csssts:graphqlsts:debugsts:experimental/*
Those surfaces are useful to know about, but they should not be treated as part of the stable release-facing contract yet.
For most application code, start with this order:
sts:preludefor small result/option/control-flow helperssts:jsonfor JSON boundariessts:decodeandsts:encodefor schema-driven validation, issue accumulation, and serializationsts:failureswhen you need to normalize foreign throws or attach structured failure data