Skip to content
LogoLogo

Standard Library

Planned modules and service categories

The VibeLang standard library is a product direction, not an implemented API. Module names and signatures on this page are illustrative.

Design Contract

The standard library should:

  • operate on ordinary VibeLang values and functions
  • return Result<A, E> for recoverable errors
  • define platform services as abstract classes extending Context
  • work across TypeScript, native, and Wasm where applicable
  • derive schemas and codecs from ordinary types
  • include structured concurrency without a fiber runtime

Core Data

Planned areas include:

Array  Chunk  HashMap  HashSet  Optional  Result  Data  Match

TypeScript-compatible built-ins remain available on the TypeScript target. Portable alternatives should not require wrapper values merely for effect tracking.

Schema and Encoding

Schema  Codec  Json  JsonSchema  Equivalence  Hash

These artifacts are derived at comptime where possible. Parsing failures return Results.

Configuration and Time

Config  Duration  Instant  Schedule

Reading environment variables or the wall clock requires a capability. Pure duration arithmetic does not.

Platform Services

FileSystem  HttpClient  Clock  Random  Environment  Console
Path  Process  Socket  Terminal

Each service can have Node, Bun, Deno, browser, edge, native, WASI, and test implementations where the host supports it.

Services use the same library-shaped declaration and access model as application capabilities:

import { Context } from "vibelang/context"
 
abstract class Clock extends Context {
  abstract now(): Instant
}
 
function timestamp(): Instant {
  const clock = Clock.context()
  return clock.now()
}

The inherited Clock.context() method is compiler-aware: it adds Clock to timestamp's inferred context channel, while callers continue to use timestamp() with no explicit context argument. Layers from vibelang/provider supply the target-specific implementation.

Concurrency and Streams

Stream  Queue  Semaphore  Channel

The library uses static concurrency combinators, cancellation, and workers rather than introducing Effect-style fibers or parser-level Promise syntax. TC39 concurrency governors may provide a future limit for async-iterator fan-out.

Durable Runtime

Action  Flow  Artifact  Signal  Journal  Deployment

These APIs connect compiler-derived plans to coordinator and worker runtimes.

Agent Library

The separately packaged @vibelang/agent is planned to provide MDX prompt rendering, model adapters, TypeScript compilation, sandbox execution, and optional Action/Flow durability adapters.

Implementation Strategy

Compute-heavy portable components may use Wasm, including implementations written in Zig. JavaScript/Wasm boundaries should be chosen by measurement. Host-specific implementations remain behind capabilities.