It is intended to be portable at least between Unix-family platforms and
Windows.
@@ -51,7 +51,7 @@ represented as a u64.
u64
-
Import interface wasi:io/error@0.2.0
+
Import interface wasi:io/error@0.2.0
Types
resource error
@@ -61,17 +61,15 @@ which provides some human-readable information about the error.
In the wasi:io package, this resource is returned through the
wasi:io/streams/stream-error type.
To provide more specific error information, other interfaces may
-provide functions to further "downcast" this error into more specific
-error information. For example, errors returned in streams derived
-from filesystem types to be described using the filesystem's own
-error-code type, using the function
-wasi:filesystem/types/filesystem-error-code, which takes a parameter
-borrow<error> and returns
-option<wasi:filesystem/types/error-code>.
+offer functions to "downcast" this error into more specific types. For example,
+errors returned from streams derived from filesystem types can be described using
+the filesystem's own error-code type. This is done using the function
+wasi:filesystem/types/filesystem-error-code, which takes a borrow<error>
+parameter and returns an option<wasi:filesystem/types/error-code>.
The set of functions which can "downcast" an error into a more
concrete type is open.
Functions
-
[method]error.to-debug-string: func
+
[method]error.to-debug-string: func
Returns a string that is suitable to assist humans in debugging
this error.
WARNING: The returned string should not be consumed mechanically!
@@ -80,13 +78,13 @@ details. Parsing this string is a major platform-compatibility
hazard.
@@ -120,14 +118,17 @@ containing only this pollable.
interest, and waits until one or more of the events is ready for I/O.
The result list<u32> contains one or more indices of handles in the
argument list that is ready for I/O.
-
If the list contains more elements than can be indexed with a u32
-value, this function traps.
+
This function traps if either:
+
+
the list is empty, or:
+
the list contains more elements than can be indexed with a u32 value.
+
A timeout can be implemented by adding a pollable from the
wasi-clocks API to the list.
This function does not return a result; polling in itself does not
do any I/O so it doesn't fail. If any of the I/O sources identified by
the pollables has an error, it is indicated by marking the source as
-being reaedy for I/O.
WASI I/O is an I/O abstraction API which is currently focused on providing
stream types.
In the future, the component model is expected to add built-in stream types;
@@ -175,14 +176,17 @@ use the subscribe function to obtain a po
for using wasi:io/poll.
resource output-stream
An output bytestream.
-
output-streams are non-blocking to the extent practical on
+
output-streams are non-blocking to the extent practical on
underlying platforms. Except where specified otherwise, I/O operations also
always return promptly, after the number of bytes that can be written
promptly, which could even be zero. To wait for the stream to be ready to
accept data, the subscribe function to obtain a pollable which can be
-polled for using wasi:io/poll.
+polled for using wasi:io/poll.
+
Dropping an output-stream while there's still an active write in
+progress may result in the data being lost. Before dropping the stream,
+be sure to fully flush your writes.
Functions
-
[method]input-stream.read: func
+
[method]input-stream.read: func
Perform a non-blocking read from the stream.
When the source of a read is binary data, the bytes from the source
are returned verbatim. When the source of a read is known to the
@@ -206,51 +210,51 @@ as a return value by the callee. The callee may return a list of bytes
less than len in size while more bytes are available for reading.
Create a pollable which will resolve once either the specified stream
has bytes available to read or the other end of the stream has been
closed.
@@ -259,13 +263,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.
Check readiness for writing. This function never blocks.
Returns the number of bytes permitted for the next call to write,
or an error. Calling write with more bytes than this function has
@@ -275,13 +279,13 @@ become ready when this function will report at least 1 byte, or an
error.
When the destination of a write is binary data, the bytes from
contents are written verbatim. When the destination of a write is
@@ -294,14 +298,14 @@ length of less than or equal to n. Otherwise, this function will trap.
Request to flush buffered output. This function never blocks.
This tells the output-stream that the caller intends any buffered
output to be flushed. the output which is expected to be flushed
@@ -343,26 +347,26 @@ completed. The subscribe pollable will become ready when the
flush has completed and the stream can accept more writes.
Create a pollable which will resolve once the output-stream
-is ready for more writing, or an error has occured. When this
+is ready for more writing, or an error has occurred. When this
pollable is ready, check-write will return ok(n) with n>0, or an
error.
If the stream is closed, this pollable is always ready immediately.
@@ -371,13 +375,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.
This should be used precisely like write with the exact same
preconditions (must use check-write first), but instead of
@@ -385,14 +389,14 @@ passing a list of bytes, you simply pass the number of zero-bytes
that should be written.
Read from one stream and write to another, with blocking.
This is similar to splice, except that it blocks until the
output-stream is ready for writing, and the input-stream
is ready for reading, before performing the splice.
This interface defines all of the types and methods for implementing
HTTP Requests and Responses, both incoming and outgoing, as well as
their headers, trailers, and bodies.
Get all of the values corresponding to a key. If the key is not present
in this fields or is syntactically invalid, an empty list is returned.
However, if the key is present but empty, this is represented by a list
with one or more empty field-values present.
Retrieve the full set of keys and values in the Fields. Like the
constructor, the list represents each key-value pair.
The outer list represents each key-value pair in the Fields. Keys
@@ -902,65 +904,65 @@ which have multiple values are represented by multiple entries in this
list with the same key.
Make a deep copy of the Fields. Equivalent in behavior to calling the
fields constructor on the return value of entries. The resulting
fields is mutable.
Returns the resource corresponding to the outgoing Body for this
Request.
Returns success on the first call: the outgoing-body resource for
@@ -1013,109 +1015,109 @@ this outgoing-request can be retrie
calls will return error.
Set the combination of the HTTP Path and Query for the Request.
When none, this represents an empty Path and empty Query. Fails is the
string given is not a syntactically valid path and query uri component.
Set the HTTP Related Scheme for the Request. When none, the
implementation may choose an appropriate default scheme. Fails if the
string given is not a syntactically valid uri scheme.
Get the HTTP Authority for the Request. A value of none may be used
with Related Schemes which do not require an Authority. The HTTP and
HTTPS schemes always require an authority.
Set the HTTP Authority for the Request. A value of none may be used
with Related Schemes which do not require an Authority. The HTTP and
HTTPS schemes always require an authority. Fails if the string given is
not a syntactically valid uri authority.
Set the timeout for receiving subsequent chunks of bytes in the Response
body stream. An error return value indicates that this timeout is not
supported.
Returns a pollable which becomes ready when either the trailers have
been received, or an error has occurred. When this pollable is ready,
the get method will return some.
Returns the contents of the trailers, or an error which occurred,
once the future is ready.
The outer option represents future readiness. Users can wait on this
@@ -1314,11 +1316,11 @@ resource is immutable, and a child. Use of the set, appendfuture-trailers is dropped.
Returns the resource corresponding to the outgoing Body for this Response.
Returns success on the first call: the outgoing-body resource for
this outgoing-response can be retrieved at most once. Subsequent
calls will return error.
The returned output-stream is a child resource: it must be dropped
before the parent outgoing-body resource is dropped (or finished),
@@ -1395,13 +1397,13 @@ this outgoing-body may be retrieved at
will return error.
Finalize an outgoing body, optionally providing trailers. This must be
called to signal that the response is complete. If the outgoing-body
is dropped without calling outgoing-body.finalize, the implementation
@@ -1412,26 +1414,26 @@ to the body (via write) does not match the value given in the
Content-Length.
Returns a pollable which becomes ready when either the Response has
been received, or an error has occurred. When this pollable is ready,
the get method will return some.
WASI Wall Clock is a clock API intended to let users query the current
time. The name "wall" makes an analogy to a "clock on the wall", which
is not necessarily monotonic as it may be reset.
@@ -59,14 +59,17 @@ containing only this pollable.
interest, and waits until one or more of the events is ready for I/O.
The result list<u32> contains one or more indices of handles in the
argument list that is ready for I/O.
-
If the list contains more elements than can be indexed with a u32
-value, this function traps.
+
This function traps if either:
+
+
the list is empty, or:
+
the list contains more elements than can be indexed with a u32 value.
+
A timeout can be implemented by adding a pollable from the
wasi-clocks API to the list.
This function does not return a result; polling in itself does not
do any I/O so it doesn't fail. If any of the I/O sources identified by
the pollables has an error, it is indicated by marking the source as
-being reaedy for I/O.
@@ -146,17 +147,15 @@ which provides some human-readable information about the error.
In the wasi:io package, this resource is returned through the
wasi:io/streams/stream-error type.
To provide more specific error information, other interfaces may
-provide functions to further "downcast" this error into more specific
-error information. For example, errors returned in streams derived
-from filesystem types to be described using the filesystem's own
-error-code type, using the function
-wasi:filesystem/types/filesystem-error-code, which takes a parameter
-borrow<error> and returns
-option<wasi:filesystem/types/error-code>.
+offer functions to "downcast" this error into more specific types. For example,
+errors returned from streams derived from filesystem types can be described using
+the filesystem's own error-code type. This is done using the function
+wasi:filesystem/types/filesystem-error-code, which takes a borrow<error>
+parameter and returns an option<wasi:filesystem/types/error-code>.
The set of functions which can "downcast" an error into a more
concrete type is open.
Functions
-
[method]error.to-debug-string: func
+
[method]error.to-debug-string: func
Returns a string that is suitable to assist humans in debugging
this error.
WARNING: The returned string should not be consumed mechanically!
@@ -165,13 +164,13 @@ details. Parsing this string is a major platform-compatibility
hazard.
WASI I/O is an I/O abstraction API which is currently focused on providing
stream types.
In the future, the component model is expected to add built-in stream types;
@@ -210,14 +209,17 @@ use the subscribe function to obtain a po
for using wasi:io/poll.
resource output-stream
An output bytestream.
-
output-streams are non-blocking to the extent practical on
+
output-streams are non-blocking to the extent practical on
underlying platforms. Except where specified otherwise, I/O operations also
always return promptly, after the number of bytes that can be written
promptly, which could even be zero. To wait for the stream to be ready to
accept data, the subscribe function to obtain a pollable which can be
-polled for using wasi:io/poll.
+polled for using wasi:io/poll.
+
Dropping an output-stream while there's still an active write in
+progress may result in the data being lost. Before dropping the stream,
+be sure to fully flush your writes.
Functions
-
[method]input-stream.read: func
+
[method]input-stream.read: func
Perform a non-blocking read from the stream.
When the source of a read is binary data, the bytes from the source
are returned verbatim. When the source of a read is known to the
@@ -241,51 +243,51 @@ as a return value by the callee. The callee may return a list of bytes
less than len in size while more bytes are available for reading.
Create a pollable which will resolve once either the specified stream
has bytes available to read or the other end of the stream has been
closed.
@@ -294,13 +296,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.
Check readiness for writing. This function never blocks.
Returns the number of bytes permitted for the next call to write,
or an error. Calling write with more bytes than this function has
@@ -310,13 +312,13 @@ become ready when this function will report at least 1 byte, or an
error.
When the destination of a write is binary data, the bytes from
contents are written verbatim. When the destination of a write is
@@ -329,14 +331,14 @@ length of less than or equal to n. Otherwise, this function will trap.
Request to flush buffered output. This function never blocks.
This tells the output-stream that the caller intends any buffered
output to be flushed. the output which is expected to be flushed
@@ -378,26 +380,26 @@ completed. The subscribe pollable will become ready when the
flush has completed and the stream can accept more writes.
Create a pollable which will resolve once the output-stream
-is ready for more writing, or an error has occured. When this
+is ready for more writing, or an error has occurred. When this
pollable is ready, check-write will return ok(n) with n>0, or an
error.
If the stream is closed, this pollable is always ready immediately.
@@ -406,13 +408,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.
This should be used precisely like write with the exact same
preconditions (must use check-write first), but instead of
@@ -420,14 +422,14 @@ passing a list of bytes, you simply pass the number of zero-bytes
that should be written.
Read from one stream and write to another, with blocking.
This is similar to splice, except that it blocks until the
output-stream is ready for writing, and the input-stream
is ready for reading, before performing the splice.
This interface defines all of the types and methods for implementing
HTTP Requests and Responses, both incoming and outgoing, as well as
their headers, trailers, and bodies.
Get all of the values corresponding to a key. If the key is not present
in this fields or is syntactically invalid, an empty list is returned.
However, if the key is present but empty, this is represented by a list
with one or more empty field-values present.
Retrieve the full set of keys and values in the Fields. Like the
constructor, the list represents each key-value pair.
The outer list represents each key-value pair in the Fields. Keys
@@ -837,65 +839,65 @@ which have multiple values are represented by multiple entries in this
list with the same key.
Make a deep copy of the Fields. Equivalent in behavior to calling the
fields constructor on the return value of entries. The resulting
fields is mutable.
Set the combination of the HTTP Path and Query for the Request.
When none, this represents an empty Path and empty Query. Fails is the
string given is not a syntactically valid path and query uri component.
Set the HTTP Related Scheme for the Request. When none, the
implementation may choose an appropriate default scheme. Fails if the
string given is not a syntactically valid uri scheme.
Get the HTTP Authority for the Request. A value of none may be used
with Related Schemes which do not require an Authority. The HTTP and
HTTPS schemes always require an authority.
Set the HTTP Authority for the Request. A value of none may be used
with Related Schemes which do not require an Authority. The HTTP and
HTTPS schemes always require an authority. Fails if the string given is
not a syntactically valid uri authority.
Set the timeout for receiving subsequent chunks of bytes in the Response
body stream. An error return value indicates that this timeout is not
supported.
Returns a pollable which becomes ready when either the trailers have
been received, or an error has occurred. When this pollable is ready,
the get method will return some.
Returns the contents of the trailers, or an error which occurred,
once the future is ready.
The outer option represents future readiness. Users can wait on this
@@ -1249,11 +1251,11 @@ resource is immutable, and a child. Use of the set, appendfuture-trailers is dropped.
Returns the resource corresponding to the outgoing Body for this Response.
Returns success on the first call: the outgoing-body resource for
this outgoing-response can be retrieved at most once. Subsequent
calls will return error.
The returned output-stream is a child resource: it must be dropped
before the parent outgoing-body resource is dropped (or finished),
@@ -1330,13 +1332,13 @@ this outgoing-body may be retrieved at
will return error.
Finalize an outgoing body, optionally providing trailers. This must be
called to signal that the response is complete. If the outgoing-body
is dropped without calling outgoing-body.finalize, the implementation
@@ -1347,26 +1349,26 @@ to the body (via write) does not match the value given in the
Content-Length.
Returns a pollable which becomes ready when either the Response has
been received, or an error has occurred. When this pollable is ready,
the get method will return some.
WASI Wall Clock is a clock API intended to let users query the current
time. The name "wall" makes an analogy to a "clock on the wall", which
is not necessarily monotonic as it may be reset.
diff --git a/wit/deps.lock b/wit/deps.lock
index 96be4b2..34441a5 100644
--- a/wit/deps.lock
+++ b/wit/deps.lock
@@ -1,29 +1,29 @@
[cli]
url = "https://github.com/WebAssembly/wasi-cli/archive/main.tar.gz"
-sha256 = "285865a31d777181b075f39e92bcfe59c89cd6bacce660be1b9a627646956258"
-sha512 = "da2622210a9e3eea82b99f1a5b8a44ce5443d009cb943f7bca0bf9cf4360829b289913d7ee727c011f0f72994ea7dc8e661ebcc0a6b34b587297d80cd9b3f7e8"
+sha256 = "a690bfee4b365af5ec012cb664c82ce53076bef5263d3da45c5da42271eaf98c"
+sha512 = "21e687cb2d8d7ba2ba5bcf40ef43b8c68e4f2c1c6e8dd147166e695b3462a1650d2b806636c8608e8b42d24a498016a003d6127ebb784bf4f5b329ed1d07817e"
[clocks]
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
-sha256 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
-sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"
+sha256 = "b7fbb753c70fe6727ea3456bc2cde3230df69d1f4f004cda7014625783959e50"
+sha512 = "99310e017418553a0613247a65aef39e46b08b27f2d3d170465f5ecb97ec9c0ccbcb4e358526440ba6ef9d37cf991d04367ffa6b87d2d8db4e1b36a737f2191e"
[filesystem]
url = "https://github.com/WebAssembly/wasi-filesystem/archive/main.tar.gz"
-sha256 = "498c465cfd04587db40f970fff2185daa597d074c20b68a8bcbae558f261499b"
-sha512 = "ead452f9b7bfb88593a502ec00d76d4228003d51c40fd0408aebc32d35c94673551b00230d730873361567cc209ec218c41fb4e95bad194268592c49e7964347"
+sha256 = "cc45d3ebf145274e7e4d1eb516099c87c68ef6062447e3f8bcd492d60dfa27a8"
+sha512 = "0b0af2b253de228fb282f270f5337df728834421000b6a2a789cc47460b36548babd1f77eca698308fef00896ce3c8509071b0da636babd6e87599e4d1400e53"
[io]
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
-sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
-sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"
+sha256 = "f1d1f111840529e06cd5f53726ebac82f344caf64f65a38dfef84e036643ef75"
+sha512 = "8a09fb15e4a5d46c910d4a05ed90551166192dcfb28309f08f23237ad926fb4685ce95f06905929cb47e209b291b26d1baa92c3e3dbabf81308654453927ec26"
[random]
url = "https://github.com/WebAssembly/wasi-random/archive/main.tar.gz"
-sha256 = "7371d03c037d924caba2587fb2e7c5773a0d3c5fcecbf7971e0e0ba57973c53d"
-sha512 = "964c4e8925a53078e4d94ba907b54f89a0b7e154f46823a505391471466c17f53c8692682e5c85771712acd88b348686173fc07c53a3cfe3d301b8cd8ddd0de4"
+sha256 = "2f0014e946e38947afe120836b17cdcfa608be993d38d55b81cc2d31e7e70b16"
+sha512 = "51ee623509040de77b0ba236e29589102538aacd3dd67168b06a09bf6ae469c762818fc07b5039d2a8b1838f4b5a5965a7c81ed0e2d47b142bece9d1ab8b93a6"
[sockets]
url = "https://github.com/WebAssembly/wasi-sockets/archive/main.tar.gz"
-sha256 = "622bd28bbeb43736375dc02bd003fd3a016ff8ee91e14bab488325c6b38bf966"
-sha512 = "5a63c1f36de0c4548e1d2297bdbededb28721cbad94ef7825c469eae29d7451c97e00b4c1d6730ee1ec0c4a5aac922961a2795762d4a0c3bb54e30a391a84bae"
+sha256 = "5321ba37115d503bfe0880349e99ecbd26ee812708fa83d2b276ec8ee7571443"
+sha512 = "c3d71c2afa1475bf10d86b1e0623e2292e5dd407cf54103ad0d05c07fa95323bff9ad06e929d508b318a0a99a67132793fb9a04c17585843e24f090f5ee91367"
diff --git a/wit/deps/cli/command.wit b/wit/deps/cli/command.wit
index d8005bd..0fc85e9 100644
--- a/wit/deps/cli/command.wit
+++ b/wit/deps/cli/command.wit
@@ -1,7 +1,10 @@
package wasi:cli@0.2.0;
+@since(version = 0.2.0)
world command {
+ @since(version = 0.2.0)
include imports;
+ @since(version = 0.2.0)
export run;
}
diff --git a/wit/deps/cli/environment.wit b/wit/deps/cli/environment.wit
index 7006523..2f449bd 100644
--- a/wit/deps/cli/environment.wit
+++ b/wit/deps/cli/environment.wit
@@ -1,3 +1,4 @@
+@since(version = 0.2.0)
interface environment {
/// Get the POSIX-style environment variables.
///
@@ -7,12 +8,15 @@ interface environment {
/// Morally, these are a value import, but until value imports are available
/// in the component model, this import function should return the same
/// values each time it is called.
+ @since(version = 0.2.0)
get-environment: func() -> list>;
/// Get the POSIX-style arguments to the program.
+ @since(version = 0.2.0)
get-arguments: func() -> list;
/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
+ @since(version = 0.2.0)
initial-cwd: func() -> option;
}
diff --git a/wit/deps/cli/exit.wit b/wit/deps/cli/exit.wit
index d0c2b82..357e670 100644
--- a/wit/deps/cli/exit.wit
+++ b/wit/deps/cli/exit.wit
@@ -1,4 +1,6 @@
+@since(version = 0.2.0)
interface exit {
/// Exit the current instance and any linked instances.
+ @since(version = 0.2.0)
exit: func(status: result);
}
diff --git a/wit/deps/cli/imports.wit b/wit/deps/cli/imports.wit
index 083b84a..cd59ba1 100644
--- a/wit/deps/cli/imports.wit
+++ b/wit/deps/cli/imports.wit
@@ -1,20 +1,36 @@
package wasi:cli@0.2.0;
+@since(version = 0.2.0)
world imports {
+ @since(version = 0.2.0)
include wasi:clocks/imports@0.2.0;
+ @since(version = 0.2.0)
include wasi:filesystem/imports@0.2.0;
+ @since(version = 0.2.0)
include wasi:sockets/imports@0.2.0;
+ @since(version = 0.2.0)
include wasi:random/imports@0.2.0;
+ @since(version = 0.2.0)
include wasi:io/imports@0.2.0;
+ @since(version = 0.2.0)
import environment;
+ @since(version = 0.2.0)
import exit;
+ @since(version = 0.2.0)
import stdin;
+ @since(version = 0.2.0)
import stdout;
+ @since(version = 0.2.0)
import stderr;
+ @since(version = 0.2.0)
import terminal-input;
+ @since(version = 0.2.0)
import terminal-output;
+ @since(version = 0.2.0)
import terminal-stdin;
+ @since(version = 0.2.0)
import terminal-stdout;
+ @since(version = 0.2.0)
import terminal-stderr;
}
diff --git a/wit/deps/cli/run.wit b/wit/deps/cli/run.wit
index a70ee8c..655346e 100644
--- a/wit/deps/cli/run.wit
+++ b/wit/deps/cli/run.wit
@@ -1,4 +1,6 @@
+@since(version = 0.2.0)
interface run {
/// Run the program.
+ @since(version = 0.2.0)
run: func() -> result;
}
diff --git a/wit/deps/cli/stdio.wit b/wit/deps/cli/stdio.wit
index 31ef35b..e9502a9 100644
--- a/wit/deps/cli/stdio.wit
+++ b/wit/deps/cli/stdio.wit
@@ -1,17 +1,26 @@
+@since(version = 0.2.0)
interface stdin {
+ @since(version = 0.2.0)
use wasi:io/streams@0.2.0.{input-stream};
+ @since(version = 0.2.0)
get-stdin: func() -> input-stream;
}
+@since(version = 0.2.0)
interface stdout {
+ @since(version = 0.2.0)
use wasi:io/streams@0.2.0.{output-stream};
+ @since(version = 0.2.0)
get-stdout: func() -> output-stream;
}
+@since(version = 0.2.0)
interface stderr {
+ @since(version = 0.2.0)
use wasi:io/streams@0.2.0.{output-stream};
+ @since(version = 0.2.0)
get-stderr: func() -> output-stream;
}
diff --git a/wit/deps/cli/terminal.wit b/wit/deps/cli/terminal.wit
index 38c724e..d305498 100644
--- a/wit/deps/cli/terminal.wit
+++ b/wit/deps/cli/terminal.wit
@@ -3,8 +3,10 @@
/// In the future, this may include functions for disabling echoing,
/// disabling input buffering so that keyboard events are sent through
/// immediately, querying supported features, and so on.
+@since(version = 0.2.0)
interface terminal-input {
/// The input side of a terminal.
+ @since(version = 0.2.0)
resource terminal-input;
}
@@ -13,37 +15,48 @@ interface terminal-input {
/// In the future, this may include functions for querying the terminal
/// size, being notified of terminal size changes, querying supported
/// features, and so on.
+@since(version = 0.2.0)
interface terminal-output {
/// The output side of a terminal.
+ @since(version = 0.2.0)
resource terminal-output;
}
/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
+@since(version = 0.2.0)
interface terminal-stdin {
+ @since(version = 0.2.0)
use terminal-input.{terminal-input};
/// If stdin is connected to a terminal, return a `terminal-input` handle
/// allowing further interaction with it.
+ @since(version = 0.2.0)
get-terminal-stdin: func() -> option;
}
/// An interface providing an optional `terminal-output` for stdout as a
/// link-time authority.
+@since(version = 0.2.0)
interface terminal-stdout {
+ @since(version = 0.2.0)
use terminal-output.{terminal-output};
/// If stdout is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
+ @since(version = 0.2.0)
get-terminal-stdout: func() -> option;
}
/// An interface providing an optional `terminal-output` for stderr as a
/// link-time authority.
+@since(version = 0.2.0)
interface terminal-stderr {
+ @since(version = 0.2.0)
use terminal-output.{terminal-output};
/// If stderr is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
+ @since(version = 0.2.0)
get-terminal-stderr: func() -> option;
}
diff --git a/wit/deps/clocks/monotonic-clock.wit b/wit/deps/clocks/monotonic-clock.wit
index 4e4dc3a..afbd700 100644
--- a/wit/deps/clocks/monotonic-clock.wit
+++ b/wit/deps/clocks/monotonic-clock.wit
@@ -7,38 +7,43 @@ package wasi:clocks@0.2.0;
///
/// A monotonic clock is a clock which has an unspecified initial value, and
/// successive reads of the clock will produce non-decreasing values.
-///
-/// It is intended for measuring elapsed time.
+@since(version = 0.2.0)
interface monotonic-clock {
+ @since(version = 0.2.0)
use wasi:io/poll@0.2.0.{pollable};
/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
/// the same monotonic-clock.
+ @since(version = 0.2.0)
type instant = u64;
/// A duration of time, in nanoseconds.
+ @since(version = 0.2.0)
type duration = u64;
/// Read the current value of the clock.
///
/// The clock is monotonic, therefore calling this function repeatedly will
/// produce a sequence of non-decreasing values.
+ @since(version = 0.2.0)
now: func() -> instant;
/// Query the resolution of the clock. Returns the duration of time
/// corresponding to a clock tick.
+ @since(version = 0.2.0)
resolution: func() -> duration;
/// Create a `pollable` which will resolve once the specified instant
- /// occured.
+ /// has occurred.
+ @since(version = 0.2.0)
subscribe-instant: func(
when: instant,
) -> pollable;
- /// Create a `pollable` which will resolve once the given duration has
- /// elapsed, starting at the time at which this function was called.
- /// occured.
+ /// Create a `pollable` that will resolve after the specified duration has
+ /// elapsed from the time this function is invoked.
+ @since(version = 0.2.0)
subscribe-duration: func(
when: duration,
) -> pollable;
diff --git a/wit/deps/clocks/timezone.wit b/wit/deps/clocks/timezone.wit
new file mode 100644
index 0000000..3c28688
--- /dev/null
+++ b/wit/deps/clocks/timezone.wit
@@ -0,0 +1,55 @@
+package wasi:clocks@0.2.0;
+
+@unstable(feature = clocks-timezone)
+interface timezone {
+ @unstable(feature = clocks-timezone)
+ use wall-clock.{datetime};
+
+ /// Return information needed to display the given `datetime`. This includes
+ /// the UTC offset, the time zone name, and a flag indicating whether
+ /// daylight saving time is active.
+ ///
+ /// If the timezone cannot be determined for the given `datetime`, return a
+ /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
+ /// saving time.
+ @unstable(feature = clocks-timezone)
+ display: func(when: datetime) -> timezone-display;
+
+ /// The same as `display`, but only return the UTC offset.
+ @unstable(feature = clocks-timezone)
+ utc-offset: func(when: datetime) -> s32;
+
+ /// Information useful for displaying the timezone of a specific `datetime`.
+ ///
+ /// This information may vary within a single `timezone` to reflect daylight
+ /// saving time adjustments.
+ @unstable(feature = clocks-timezone)
+ record timezone-display {
+ /// The number of seconds difference between UTC time and the local
+ /// time of the timezone.
+ ///
+ /// The returned value will always be less than 86400 which is the
+ /// number of seconds in a day (24*60*60).
+ ///
+ /// In implementations that do not expose an actual time zone, this
+ /// should return 0.
+ utc-offset: s32,
+
+ /// The abbreviated name of the timezone to display to a user. The name
+ /// `UTC` indicates Coordinated Universal Time. Otherwise, this should
+ /// reference local standards for the name of the time zone.
+ ///
+ /// In implementations that do not expose an actual time zone, this
+ /// should be the string `UTC`.
+ ///
+ /// In time zones that do not have an applicable name, a formatted
+ /// representation of the UTC offset may be returned, such as `-04:00`.
+ name: string,
+
+ /// Whether daylight saving time is active.
+ ///
+ /// In implementations that do not expose an actual time zone, this
+ /// should return false.
+ in-daylight-saving-time: bool,
+ }
+}
diff --git a/wit/deps/clocks/wall-clock.wit b/wit/deps/clocks/wall-clock.wit
index 440ca0f..4b08d71 100644
--- a/wit/deps/clocks/wall-clock.wit
+++ b/wit/deps/clocks/wall-clock.wit
@@ -13,8 +13,10 @@ package wasi:clocks@0.2.0;
/// monotonic, making it unsuitable for measuring elapsed time.
///
/// It is intended for reporting the current date and time for humans.
+@since(version = 0.2.0)
interface wall-clock {
/// A time and date in seconds plus nanoseconds.
+ @since(version = 0.2.0)
record datetime {
seconds: u64,
nanoseconds: u32,
@@ -33,10 +35,12 @@ interface wall-clock {
///
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
+ @since(version = 0.2.0)
now: func() -> datetime;
/// Query the resolution of the clock.
///
/// The nanoseconds field of the output is always less than 1000000000.
+ @since(version = 0.2.0)
resolution: func() -> datetime;
}
diff --git a/wit/deps/clocks/world.wit b/wit/deps/clocks/world.wit
index c022457..76a9206 100644
--- a/wit/deps/clocks/world.wit
+++ b/wit/deps/clocks/world.wit
@@ -1,6 +1,11 @@
package wasi:clocks@0.2.0;
+@since(version = 0.2.0)
world imports {
+ @since(version = 0.2.0)
import monotonic-clock;
+ @since(version = 0.2.0)
import wall-clock;
+ @unstable(feature = clocks-timezone)
+ import timezone;
}
diff --git a/wit/deps/filesystem/preopens.wit b/wit/deps/filesystem/preopens.wit
index da801f6..08094ab 100644
--- a/wit/deps/filesystem/preopens.wit
+++ b/wit/deps/filesystem/preopens.wit
@@ -1,8 +1,11 @@
package wasi:filesystem@0.2.0;
+@since(version = 0.2.0)
interface preopens {
+ @since(version = 0.2.0)
use types.{descriptor};
/// Return the set of preopened directories, and their path.
+ @since(version = 0.2.0)
get-directories: func() -> list>;
}
diff --git a/wit/deps/filesystem/types.wit b/wit/deps/filesystem/types.wit
index 11108fc..d061d5f 100644
--- a/wit/deps/filesystem/types.wit
+++ b/wit/deps/filesystem/types.wit
@@ -23,16 +23,21 @@ package wasi:filesystem@0.2.0;
/// [WASI filesystem path resolution].
///
/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
+@since(version = 0.2.0)
interface types {
+ @since(version = 0.2.0)
use wasi:io/streams@0.2.0.{input-stream, output-stream, error};
+ @since(version = 0.2.0)
use wasi:clocks/wall-clock@0.2.0.{datetime};
/// File size or length of a region within a file.
+ @since(version = 0.2.0)
type filesize = u64;
/// The type of a filesystem object referenced by a descriptor.
///
/// Note: This was called `filetype` in earlier versions of WASI.
+ @since(version = 0.2.0)
enum descriptor-type {
/// The type of the descriptor or file is unknown or is different from
/// any of the other types specified.
@@ -56,6 +61,7 @@ interface types {
/// Descriptor flags.
///
/// Note: This was called `fdflags` in earlier versions of WASI.
+ @since(version = 0.2.0)
flags descriptor-flags {
/// Read mode: Data can be read.
read,
@@ -77,7 +83,7 @@ interface types {
/// WASI. At this time, it should be interpreted as a request, and not a
/// requirement.
data-integrity-sync,
- /// Requests that reads be performed at the same level of integrety
+ /// Requests that reads be performed at the same level of integrity
/// requested for writes. This is similar to `O_RSYNC` in POSIX.
///
/// The precise semantics of this operation have not yet been defined for
@@ -99,6 +105,7 @@ interface types {
/// File attributes.
///
/// Note: This was called `filestat` in earlier versions of WASI.
+ @since(version = 0.2.0)
record descriptor-stat {
/// File type.
%type: descriptor-type,
@@ -125,6 +132,7 @@ interface types {
}
/// Flags determining the method of how paths are resolved.
+ @since(version = 0.2.0)
flags path-flags {
/// As long as the resolved path corresponds to a symbolic link, it is
/// expanded.
@@ -132,6 +140,7 @@ interface types {
}
/// Open flags used by `open-at`.
+ @since(version = 0.2.0)
flags open-flags {
/// Create file if it does not exist, similar to `O_CREAT` in POSIX.
create,
@@ -144,9 +153,11 @@ interface types {
}
/// Number of hard links to an inode.
+ @since(version = 0.2.0)
type link-count = u64;
/// When setting a timestamp, this gives the value to set it to.
+ @since(version = 0.2.0)
variant new-timestamp {
/// Leave the timestamp set to its previous value.
no-change,
@@ -248,6 +259,7 @@ interface types {
}
/// File or memory access pattern advisory information.
+ @since(version = 0.2.0)
enum advice {
/// The application has no advice to give on its behavior with respect
/// to the specified data.
@@ -271,6 +283,7 @@ interface types {
/// A 128-bit hash value, split into parts because wasm doesn't have a
/// 128-bit integer type.
+ @since(version = 0.2.0)
record metadata-hash-value {
/// 64 bits of a 128-bit hash value.
lower: u64,
@@ -281,6 +294,7 @@ interface types {
/// A descriptor is a reference to a filesystem object, which may be a file,
/// directory, named pipe, special file, or other object on which filesystem
/// calls may be made.
+ @since(version = 0.2.0)
resource descriptor {
/// Return a stream for reading from a file, if available.
///
@@ -290,6 +304,7 @@ interface types {
/// file and they do not interfere with each other.
///
/// Note: This allows using `read-stream`, which is similar to `read` in POSIX.
+ @since(version = 0.2.0)
read-via-stream: func(
/// The offset within the file at which to start reading.
offset: filesize,
@@ -301,6 +316,7 @@ interface types {
///
/// Note: This allows using `write-stream`, which is similar to `write` in
/// POSIX.
+ @since(version = 0.2.0)
write-via-stream: func(
/// The offset within the file at which to start writing.
offset: filesize,
@@ -312,11 +328,13 @@ interface types {
///
/// Note: This allows using `write-stream`, which is similar to `write` with
/// `O_APPEND` in in POSIX.
+ @since(version = 0.2.0)
append-via-stream: func() -> result;
/// Provide file advisory information on a descriptor.
///
/// This is similar to `posix_fadvise` in POSIX.
+ @since(version = 0.2.0)
advise: func(
/// The offset within the file to which the advisory applies.
offset: filesize,
@@ -332,6 +350,7 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fdatasync` in POSIX.
+ @since(version = 0.2.0)
sync-data: func() -> result<_, error-code>;
/// Get flags associated with a descriptor.
@@ -340,6 +359,7 @@ interface types {
///
/// Note: This returns the value that was the `fs_flags` value returned
/// from `fdstat_get` in earlier versions of WASI.
+ @since(version = 0.2.0)
get-flags: func() -> result;
/// Get the dynamic type of a descriptor.
@@ -352,12 +372,14 @@ interface types {
///
/// Note: This returns the value that was the `fs_filetype` value returned
/// from `fdstat_get` in earlier versions of WASI.
+ @since(version = 0.2.0)
get-type: func() -> result;
/// Adjust the size of an open file. If this increases the file's size, the
/// extra bytes are filled with zeros.
///
/// Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
+ @since(version = 0.2.0)
set-size: func(size: filesize) -> result<_, error-code>;
/// Adjust the timestamps of an open file or directory.
@@ -365,6 +387,7 @@ interface types {
/// Note: This is similar to `futimens` in POSIX.
///
/// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
+ @since(version = 0.2.0)
set-times: func(
/// The desired values of the data access timestamp.
data-access-timestamp: new-timestamp,
@@ -383,6 +406,7 @@ interface types {
/// In the future, this may change to return a `stream`.
///
/// Note: This is similar to `pread` in POSIX.
+ @since(version = 0.2.0)
read: func(
/// The maximum number of bytes to read.
length: filesize,
@@ -399,6 +423,7 @@ interface types {
/// In the future, this may change to take a `stream`.
///
/// Note: This is similar to `pwrite` in POSIX.
+ @since(version = 0.2.0)
write: func(
/// Data to write
buffer: list,
@@ -415,6 +440,7 @@ interface types {
/// This always returns a new stream which starts at the beginning of the
/// directory. Multiple streams may be active on the same directory, and they
/// do not interfere with each other.
+ @since(version = 0.2.0)
read-directory: func() -> result;
/// Synchronize the data and metadata of a file to disk.
@@ -423,11 +449,13 @@ interface types {
/// opened for writing.
///
/// Note: This is similar to `fsync` in POSIX.
+ @since(version = 0.2.0)
sync: func() -> result<_, error-code>;
/// Create a directory.
///
/// Note: This is similar to `mkdirat` in POSIX.
+ @since(version = 0.2.0)
create-directory-at: func(
/// The relative path at which to create the directory.
path: string,
@@ -442,6 +470,7 @@ interface types {
/// modified, use `metadata-hash`.
///
/// Note: This was called `fd_filestat_get` in earlier versions of WASI.
+ @since(version = 0.2.0)
stat: func() -> result;
/// Return the attributes of a file or directory.
@@ -451,6 +480,7 @@ interface types {
/// discussion of alternatives.
///
/// Note: This was called `path_filestat_get` in earlier versions of WASI.
+ @since(version = 0.2.0)
stat-at: func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -464,6 +494,7 @@ interface types {
///
/// Note: This was called `path_filestat_set_times` in earlier versions of
/// WASI.
+ @since(version = 0.2.0)
set-times-at: func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -478,6 +509,7 @@ interface types {
/// Create a hard link.
///
/// Note: This is similar to `linkat` in POSIX.
+ @since(version = 0.2.0)
link-at: func(
/// Flags determining the method of how the path is resolved.
old-path-flags: path-flags,
@@ -507,6 +539,7 @@ interface types {
/// `error-code::read-only`.
///
/// Note: This is similar to `openat` in POSIX.
+ @since(version = 0.2.0)
open-at: func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -524,6 +557,7 @@ interface types {
/// filesystem, this function fails with `error-code::not-permitted`.
///
/// Note: This is similar to `readlinkat` in POSIX.
+ @since(version = 0.2.0)
readlink-at: func(
/// The relative path of the symbolic link from which to read.
path: string,
@@ -534,6 +568,7 @@ interface types {
/// Return `error-code::not-empty` if the directory is not empty.
///
/// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
+ @since(version = 0.2.0)
remove-directory-at: func(
/// The relative path to a directory to remove.
path: string,
@@ -542,6 +577,7 @@ interface types {
/// Rename a filesystem object.
///
/// Note: This is similar to `renameat` in POSIX.
+ @since(version = 0.2.0)
rename-at: func(
/// The relative source path of the file or directory to rename.
old-path: string,
@@ -557,6 +593,7 @@ interface types {
/// `error-code::not-permitted`.
///
/// Note: This is similar to `symlinkat` in POSIX.
+ @since(version = 0.2.0)
symlink-at: func(
/// The contents of the symbolic link.
old-path: string,
@@ -568,6 +605,7 @@ interface types {
///
/// Return `error-code::is-directory` if the path refers to a directory.
/// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
+ @since(version = 0.2.0)
unlink-file-at: func(
/// The relative path to a file to unlink.
path: string,
@@ -579,6 +617,7 @@ interface types {
/// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
/// wasi-filesystem does not expose device and inode numbers, so this function
/// may be used instead.
+ @since(version = 0.2.0)
is-same-object: func(other: borrow) -> bool;
/// Return a hash of the metadata associated with a filesystem object referred
@@ -600,12 +639,14 @@ interface types {
/// computed hash.
///
/// However, none of these is required.
+ @since(version = 0.2.0)
metadata-hash: func() -> result;
/// Return a hash of the metadata associated with a filesystem object referred
/// to by a directory descriptor and a relative path.
///
/// This performs the same hash computation as `metadata-hash`.
+ @since(version = 0.2.0)
metadata-hash-at: func(
/// Flags determining the method of how the path is resolved.
path-flags: path-flags,
@@ -615,8 +656,10 @@ interface types {
}
/// A stream of directory entries.
+ @since(version = 0.2.0)
resource directory-entry-stream {
/// Read a single directory entry from a `directory-entry-stream`.
+ @since(version = 0.2.0)
read-directory-entry: func() -> result