Explorer

wasi

WASI 0.3 capabilities (Clocks, Random, I/O) for capability-based DI · Public

Snapshot history

Status: Done · Every branch of the project (change the status there)

wasi.wasi.datetime: Type  // WASI 0.3 datetime record type with seconds and nanoseconds
wasi.wasi.wall-clock: Type  // WASI 0.3 wall-clock capability interface with now: () -> datetime
wasi.wasi.monotonic-clock: Type  // WASI 0.3 monotonic-clock capability interface with now: () -> number (nanoseconds)
wasi.wasi.random: Type  // WASI 0.3 random capability interface with get-random-u64: () -> number
wasi.clock-now: Fn(clock: Record{now: Fn() -> Record{seconds: Number, nanoseconds: Number}}) -> Record{seconds: Number, nanoseconds: Number}  // Invoke now() on a WASI Wall Clock capability to get the current datetime
wasi.monotonic-now: Fn(clock: Record{now: Fn() -> Number}) -> Number  // Invoke now() on a WASI Monotonic Clock capability to get the monotonic timestamp in nanoseconds
wasi.random-u64: Fn(random: Record{get_random_u64: Fn() -> Number}) -> Number  // Invoke get_random_u64() on a WASI Random capability to get a random 64-bit integer
wasi.clock-get-seconds: Fn(clock: Record{now: Fn() -> Record{seconds: Number, nanoseconds: Number}}) -> Number  // Invoke now() on a WASI Wall Clock capability and extract seconds
wasi.clock-is-expired: Fn(clock: Record{now: Fn() -> Record{seconds: Number, nanoseconds: Number}}, deadline: Number) -> Boolean  // Check if the current WASI Clock time has reached or passed a deadline
wasi.outgoing-request: Type  // HTTP request to send, like wasi:http/types.outgoing-request (method, absolute URL, headers, body bytes). secret_headers are headers whose value is prefix followed by the value of the secret: the host puts the value just before sending, only to the URLs the user allowed for the secret, so the program never sees it
wasi.incoming-response: Type  // Received HTTP response, like wasi:http/types.incoming-response. text is the body decoded as UTF-8
wasi.http-result: Type  // Result of wasi:http/outgoing-handler.handle: the response, or an error message (network error, CORS error, ...)
wasi.io: Type  // (en) A definy.io program that ends with a message (done(message)) shown on the screen. Run in the run panel or with definy_run_io; outgoing_request sends an HTTP request with the host fetch (secrets go in secret_headers of the request) and get_parts reads the latest expressions of parts to compile quoted code (docs/wasi-io.md)