Skip to content

Commit b528ec3

Browse files
authored
Merge pull request #24 from golemcloud/wasi-0.2.3
Updated to WASI 0.2.3
2 parents 603526a + bfe46ce commit b528ec3

File tree

37 files changed

+498
-180
lines changed

37 files changed

+498
-180
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- uses: davidB/rust-cargo-make@v1
5858
- uses: cargo-bins/cargo-binstall@main
5959
- name: Install cargo-component
60-
run: cargo binstall --force --locked cargo-component@0.20.0
60+
run: cargo binstall --force --locked cargo-component@0.21.1
6161
- name: Build all
6262
run: cargo make build-all
6363
build-test-components:
@@ -81,7 +81,7 @@ jobs:
8181
- uses: davidB/rust-cargo-make@v1
8282
- uses: cargo-bins/cargo-binstall@main
8383
- name: Install cargo-component
84-
run: cargo binstall --force --locked cargo-component@0.20.0
84+
run: cargo binstall --force --locked cargo-component@0.21.1
8585
- name: Build all test components
8686
run: cargo make build-test-components
8787
ollama-integration-tests:
@@ -107,8 +107,8 @@ jobs:
107107
- name: Install tools
108108
run: |
109109
set -e
110-
cargo binstall --force --locked cargo-component@0.20.0
111-
cargo binstall golem-cli@1.2.2-dev.11 --locked --force --no-confirm
110+
cargo binstall --force --locked cargo-component@0.21.1
111+
cargo binstall golem-cli@1.2.3 --locked --force --no-confirm
112112
cargo binstall wac-cli --locked --force --no-confirm
113113
- name: Start Ollama in Docker
114114
run: |
@@ -123,7 +123,7 @@ jobs:
123123
docker exec ollama ollama list | grep -q "qwen2.5:1.5b" || exit 1
124124
docker exec ollama ollama list | grep -q "gemma2:2b" || exit 1
125125
echo "Ollama setup completed."
126-
- name: Install and Run latest Golem Server
126+
- name: Install and Run latest Golem Server
127127
run: |
128128
set -e
129129
echo "Installing Golem server"
@@ -133,7 +133,7 @@ jobs:
133133
golem --version
134134
golem profile switch local
135135
nohup golem server run >golem-server.log 2>&1 &
136-
echo "Golem server started."
136+
echo "Golem server started."
137137
- name: Build and test Ollama integration
138138
run: |
139139
set -e
@@ -177,7 +177,7 @@ jobs:
177177
- uses: davidB/rust-cargo-make@v1
178178
- uses: cargo-bins/cargo-binstall@main
179179
- name: Install cargo-component
180-
run: cargo binstall --force --locked cargo-component@0.20.0
180+
run: cargo binstall --force --locked cargo-component@0.21.1
181181
- name: Build all components in release
182182
run: cargo make release-build-all
183183
- name: Login GH CLI
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package wasi:io@0.2.0;
2-
1+
package wasi:io@0.2.3;
32

3+
@since(version = 0.2.0)
44
interface error {
55
/// A resource which represents some error information.
66
///
@@ -11,16 +11,15 @@ interface error {
1111
/// `wasi:io/streams/stream-error` type.
1212
///
1313
/// To provide more specific error information, other interfaces may
14-
/// provide functions to further "downcast" this error into more specific
15-
/// error information. For example, `error`s returned in streams derived
16-
/// from filesystem types to be described using the filesystem's own
17-
/// error-code type, using the function
18-
/// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
19-
/// `borrow<error>` and returns
20-
/// `option<wasi:filesystem/types/error-code>`.
14+
/// offer functions to "downcast" this error into more specific types. For example,
15+
/// errors returned from streams derived from filesystem types can be described using
16+
/// the filesystem's own error-code type. This is done using the function
17+
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
18+
/// parameter and returns an `option<wasi:filesystem/types/error-code>`.
2119
///
2220
/// The set of functions which can "downcast" an `error` into a more
2321
/// concrete type is open.
22+
@since(version = 0.2.0)
2423
resource error {
2524
/// Returns a string that is suitable to assist humans in debugging
2625
/// this error.
@@ -29,6 +28,7 @@ interface error {
2928
/// It may change across platforms, hosts, or other implementation
3029
/// details. Parsing this string is a major platform-compatibility
3130
/// hazard.
31+
@since(version = 0.2.0)
3232
to-debug-string: func() -> string;
3333
}
3434
}
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.3;
22

33
/// A poll API intended to let users wait for I/O events on multiple handles
44
/// at once.
5+
@since(version = 0.2.0)
56
interface poll {
67
/// `pollable` represents a single I/O event which may be ready, or not.
8+
@since(version = 0.2.0)
79
resource pollable {
810

911
/// Return the readiness of a pollable. This function never blocks.
1012
///
1113
/// Returns `true` when the pollable is ready, and `false` otherwise.
14+
@since(version = 0.2.0)
1215
ready: func() -> bool;
1316

1417
/// `block` returns immediately if the pollable is ready, and otherwise
1518
/// blocks until ready.
1619
///
1720
/// This function is equivalent to calling `poll.poll` on a list
1821
/// containing only this pollable.
22+
@since(version = 0.2.0)
1923
block: func();
2024
}
2125

@@ -27,15 +31,17 @@ interface poll {
2731
/// The result `list<u32>` contains one or more indices of handles in the
2832
/// argument list that is ready for I/O.
2933
///
30-
/// If the list contains more elements than can be indexed with a `u32`
31-
/// value, this function traps.
34+
/// This function traps if either:
35+
/// - the list is empty, or:
36+
/// - the list contains more elements than can be indexed with a `u32` value.
3237
///
3338
/// A timeout can be implemented by adding a pollable from the
3439
/// wasi-clocks API to the list.
3540
///
3641
/// This function does not return a `result`; polling in itself does not
3742
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
3843
/// the pollables has an error, it is indicated by marking the source as
39-
/// being reaedy for I/O.
44+
/// being ready for I/O.
45+
@since(version = 0.2.0)
4046
poll: func(in: list<borrow<pollable>>) -> list<u32>;
4147
}

llm-anthropic/wit/deps/wasi:io/streams.wit

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.3;
22

33
/// WASI I/O is an I/O abstraction API which is currently focused on providing
44
/// stream types.
55
///
66
/// In the future, the component model is expected to add built-in stream types;
77
/// when it does, they are expected to subsume this API.
8+
@since(version = 0.2.0)
89
interface streams {
10+
@since(version = 0.2.0)
911
use error.{error};
12+
@since(version = 0.2.0)
1013
use poll.{pollable};
1114

1215
/// An error for input-stream and output-stream operations.
16+
@since(version = 0.2.0)
1317
variant stream-error {
1418
/// The last operation (a write or flush) failed before completion.
1519
///
1620
/// More information is available in the `error` payload.
21+
///
22+
/// After this, the stream will be closed. All future operations return
23+
/// `stream-error::closed`.
1724
last-operation-failed(error),
1825
/// The stream is closed: no more input will be accepted by the
1926
/// stream. A closed output-stream will return this error on all
@@ -29,6 +36,7 @@ interface streams {
2936
/// available, which could even be zero. To wait for data to be available,
3037
/// use the `subscribe` function to obtain a `pollable` which can be polled
3138
/// for using `wasi:io/poll`.
39+
@since(version = 0.2.0)
3240
resource input-stream {
3341
/// Perform a non-blocking read from the stream.
3442
///
@@ -56,13 +64,15 @@ interface streams {
5664
/// is not possible to allocate in wasm32, or not desirable to allocate as
5765
/// as a return value by the callee. The callee may return a list of bytes
5866
/// less than `len` in size while more bytes are available for reading.
67+
@since(version = 0.2.0)
5968
read: func(
6069
/// The maximum number of bytes to read
6170
len: u64
6271
) -> result<list<u8>, stream-error>;
6372

6473
/// Read bytes from a stream, after blocking until at least one byte can
6574
/// be read. Except for blocking, behavior is identical to `read`.
75+
@since(version = 0.2.0)
6676
blocking-read: func(
6777
/// The maximum number of bytes to read
6878
len: u64
@@ -72,13 +82,15 @@ interface streams {
7282
///
7383
/// Behaves identical to `read`, except instead of returning a list
7484
/// of bytes, returns the number of bytes consumed from the stream.
85+
@since(version = 0.2.0)
7586
skip: func(
7687
/// The maximum number of bytes to skip.
7788
len: u64,
7889
) -> result<u64, stream-error>;
7990

8091
/// Skip bytes from a stream, after blocking until at least one byte
8192
/// can be skipped. Except for blocking behavior, identical to `skip`.
93+
@since(version = 0.2.0)
8294
blocking-skip: func(
8395
/// The maximum number of bytes to skip.
8496
len: u64,
@@ -90,6 +102,7 @@ interface streams {
90102
/// The created `pollable` is a child resource of the `input-stream`.
91103
/// Implementations may trap if the `input-stream` is dropped before
92104
/// all derived `pollable`s created with this function are dropped.
105+
@since(version = 0.2.0)
93106
subscribe: func() -> pollable;
94107
}
95108

@@ -102,6 +115,11 @@ interface streams {
102115
/// promptly, which could even be zero. To wait for the stream to be ready to
103116
/// accept data, the `subscribe` function to obtain a `pollable` which can be
104117
/// polled for using `wasi:io/poll`.
118+
///
119+
/// Dropping an `output-stream` while there's still an active write in
120+
/// progress may result in the data being lost. Before dropping the stream,
121+
/// be sure to fully flush your writes.
122+
@since(version = 0.2.0)
105123
resource output-stream {
106124
/// Check readiness for writing. This function never blocks.
107125
///
@@ -112,6 +130,7 @@ interface streams {
112130
/// When this function returns 0 bytes, the `subscribe` pollable will
113131
/// become ready when this function will report at least 1 byte, or an
114132
/// error.
133+
@since(version = 0.2.0)
115134
check-write: func() -> result<u64, stream-error>;
116135

117136
/// Perform a write. This function never blocks.
@@ -127,6 +146,7 @@ interface streams {
127146
///
128147
/// returns Err(closed) without writing if the stream has closed since
129148
/// the last call to check-write provided a permit.
149+
@since(version = 0.2.0)
130150
write: func(
131151
contents: list<u8>
132152
) -> result<_, stream-error>;
@@ -155,6 +175,7 @@ interface streams {
155175
/// // Check for any errors that arose during `flush`
156176
/// let _ = this.check-write(); // eliding error handling
157177
/// ```
178+
@since(version = 0.2.0)
158179
blocking-write-and-flush: func(
159180
contents: list<u8>
160181
) -> result<_, stream-error>;
@@ -169,14 +190,16 @@ interface streams {
169190
/// writes (`check-write` will return `ok(0)`) until the flush has
170191
/// completed. The `subscribe` pollable will become ready when the
171192
/// flush has completed and the stream can accept more writes.
193+
@since(version = 0.2.0)
172194
flush: func() -> result<_, stream-error>;
173195

174196
/// Request to flush buffered output, and block until flush completes
175197
/// and stream is ready for writing again.
198+
@since(version = 0.2.0)
176199
blocking-flush: func() -> result<_, stream-error>;
177200

178201
/// Create a `pollable` which will resolve once the output-stream
179-
/// is ready for more writing, or an error has occured. When this
202+
/// is ready for more writing, or an error has occurred. When this
180203
/// pollable is ready, `check-write` will return `ok(n)` with n>0, or an
181204
/// error.
182205
///
@@ -185,6 +208,7 @@ interface streams {
185208
/// The created `pollable` is a child resource of the `output-stream`.
186209
/// Implementations may trap if the `output-stream` is dropped before
187210
/// all derived `pollable`s created with this function are dropped.
211+
@since(version = 0.2.0)
188212
subscribe: func() -> pollable;
189213

190214
/// Write zeroes to a stream.
@@ -193,6 +217,7 @@ interface streams {
193217
/// preconditions (must use check-write first), but instead of
194218
/// passing a list of bytes, you simply pass the number of zero-bytes
195219
/// that should be written.
220+
@since(version = 0.2.0)
196221
write-zeroes: func(
197222
/// The number of zero-bytes to write
198223
len: u64
@@ -222,14 +247,15 @@ interface streams {
222247
/// // Check for any errors that arose during `flush`
223248
/// let _ = this.check-write(); // eliding error handling
224249
/// ```
250+
@since(version = 0.2.0)
225251
blocking-write-zeroes-and-flush: func(
226252
/// The number of zero-bytes to write
227253
len: u64
228254
) -> result<_, stream-error>;
229255

230256
/// Read from one stream and write to another.
231257
///
232-
/// The behavior of splice is equivelant to:
258+
/// The behavior of splice is equivalent to:
233259
/// 1. calling `check-write` on the `output-stream`
234260
/// 2. calling `read` on the `input-stream` with the smaller of the
235261
/// `check-write` permitted length and the `len` provided to `splice`
@@ -240,6 +266,7 @@ interface streams {
240266
///
241267
/// This function returns the number of bytes transferred; it may be less
242268
/// than `len`.
269+
@since(version = 0.2.0)
243270
splice: func(
244271
/// The stream to read from
245272
src: borrow<input-stream>,
@@ -252,6 +279,7 @@ interface streams {
252279
/// This is similar to `splice`, except that it blocks until the
253280
/// `output-stream` is ready for writing, and the `input-stream`
254281
/// is ready for reading, before performing the `splice`.
282+
@since(version = 0.2.0)
255283
blocking-splice: func(
256284
/// The stream to read from
257285
src: borrow<input-stream>,
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.3;
22

3+
@since(version = 0.2.0)
34
world imports {
5+
@since(version = 0.2.0)
46
import streams;
7+
8+
@since(version = 0.2.0)
59
import poll;
610
}

llm-grok/wit/deps/wasi:io/error.wit

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package wasi:io@0.2.0;
2-
1+
package wasi:io@0.2.3;
32

3+
@since(version = 0.2.0)
44
interface error {
55
/// A resource which represents some error information.
66
///
@@ -11,16 +11,15 @@ interface error {
1111
/// `wasi:io/streams/stream-error` type.
1212
///
1313
/// To provide more specific error information, other interfaces may
14-
/// provide functions to further "downcast" this error into more specific
15-
/// error information. For example, `error`s returned in streams derived
16-
/// from filesystem types to be described using the filesystem's own
17-
/// error-code type, using the function
18-
/// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
19-
/// `borrow<error>` and returns
20-
/// `option<wasi:filesystem/types/error-code>`.
14+
/// offer functions to "downcast" this error into more specific types. For example,
15+
/// errors returned from streams derived from filesystem types can be described using
16+
/// the filesystem's own error-code type. This is done using the function
17+
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
18+
/// parameter and returns an `option<wasi:filesystem/types/error-code>`.
2119
///
2220
/// The set of functions which can "downcast" an `error` into a more
2321
/// concrete type is open.
22+
@since(version = 0.2.0)
2423
resource error {
2524
/// Returns a string that is suitable to assist humans in debugging
2625
/// this error.
@@ -29,6 +28,7 @@ interface error {
2928
/// It may change across platforms, hosts, or other implementation
3029
/// details. Parsing this string is a major platform-compatibility
3130
/// hazard.
31+
@since(version = 0.2.0)
3232
to-debug-string: func() -> string;
3333
}
3434
}

0 commit comments

Comments
 (0)