WASI 從 0.2 到 0.3 的時間線:2024 年 1 月投票、十二個 0.2.x 小版本、2026 年 6 月 11 日 0.3.0,之後仍是雙月發版
2019 年 3 月 27 日,Mozilla Hacks 上有一篇文章,替 WASI 開了頭。標題是 “Standardizing WASI: A system interface to run WebAssembly outside the web”,作者 Lin Clark。它的第一個問題問得很直接:瀏覽器外面的程式碼,要怎麼跟系統講話。原文是 “Code outside of a browser needs a way to talk to the system — a system interface.”
接著給了前提。WebAssembly 本來就關在沙箱裡,”The host (which might be a browser, or might be a wasm runtime) puts functions in the sandbox that the code can use.” 這樣設計的好處,文中寫成 “This means that the host can limit what a program can do on a program-by-program basis.”,思路則借自 capability-oriented systems,文中點名 CloudABI 和 Capsicum。
這篇想把後面的事照日期一格一格走完。WASI 的版本名稱本身就容易讓人搞混:0.1 叫 preview1,0.2 又叫 Preview 2,0.3 叫 Preview 3;0.2 的 release 頁發布日和它的投票日還差了三個月。我把日期都攤開,不替官方挑一個。
先講讀法的界線。我讀的是 WebAssembly/WASI 的 release notes、repo 裡的 docs、Bytecode Alliance 的兩篇宣告文,以及 wasmtime 幾個版本的 release notes。沒有安裝 wasmtime,沒有編譯或執行任何 WASI 元件,文中的 WIT 片段全是官方原文的引用,不是我寫的。我查的時候,GitHub 對這個 repo 的 license 欄位顯示 NOASSERTION,判不出是哪一種授權,我也不替它寫一個。
preview1:函式簽章長得像 C
preview1 的定義寫在 WASI repo 的 wasi-0.1 分支 README 裡。它對應的 import module 名稱是 wasi_snapshot_preview1,更早的 preview0 是 wasi_unstable。它用 witx 這個 IDL 描述,README 對它的型別系統有一段很直白的形容:
It had a low-level C-like type system that emphasized raw pointers, and callees were expected to have access to the caller’s entire linear memory, exported as “memory”. It also had an implied global file descriptor table.
為什麼這樣設計?官方 0.2 的宣告文自己給了部分答案,”WASI being based on POSIX made it very biased toward C, with raw pointers everywhere.”,還有 “much of WASI 0.1 was closely derived from CloudABI.” 現行 README 的說法是 preview1 的主要影響來源是 POSIX 和 CloudABI。
要我用日常的東西比喻,這很像送貨員來了,包裹沒有遞出去,你把整個家的鑰匙給了他,再期待他只碰玄關那一箱。這是我的比喻,不是官方的說法。它在單一個 C 程式裡很順手,因為指標本來就是程式語言的日常;一旦兩個用不同語言寫的模組要互相呼叫,「對方可以看到我整塊線性記憶體」就變成要特別處理的假設。這一段推論是我讀 README 後自己拼的,官方文字只寫到上面那兩段。
那當年大家怎麼湊合?我找過,答案是沒查到。官方文件裡沒有一句直接講社群怎麼繞過 preview1 的限制。我手上只有幾個旁證:wasi-0.1 README 提到 proc_raise 沒被廣泛支援,理由是 “because Wasm itself has no signal-handling facilities”;socket 的部分,preview1 只新增過 sock_accept 一個函式,README 寫的是 “Sockets support with listen and connect is being added in preview2.”;中間還出現過一條叫 ephemeral 的支線,README 說它 “no longer being actively developed”,而 “preview2” 這個名字後來改指 wit 為底的新一輪設計。
另一個旁證在比較晚的地方。wasmtime v45.0.0 的 release notes 有一句 “The WASIp1-to-WASIp2 adapter now handles nonblocking I/O in fd_{read,write}“,意思是舊的 preview1 模組靠一層 adapter 跑在 p2 上。這層 adapter 為什麼出現、誰先做的,我沒查。
2024 年 1 月:以 component model 重來
0.2 的投票日,兩份官方來源給的日子不一樣。v0.2.0 的 release 頁寫 “This version officially launched with the vote in the WASI Subgroup January 24th.”;Bytecode Alliance 的宣告文,署名 Dan Gohman、日期 Jan 25, 2024,寫的是 “The WASI Subgroup voted on January 25, 2024 to launch WASI 0.2, also known as WASI Preview 2, or WASIp2!”
所以我只寫 2024 年 1 月下旬,兩個日期並列。另外,v0.2.0 的 release 頁本身是 2024-04-24 才發的,跟投票日隔了三個月,兩個日期都不能叫「0.2 發布日」。
這一輪改了什麼?宣告文的一句話說得最乾脆:
WASI is now officially based on the Wasm component model, which makes it cross-language and virtualizable.
現行 README 對 0.2 的描述是用 Wit IDL 定義的一組模組化 API,吸收 0.1 的教訓,包括支援更多來源語言、模組化、更有表達力的型別系統、可虛擬化。這四個詞,我讀起來是在逐項回應前一節那個「C 的指標、一整塊記憶體、全域 fd 表」的設計,這個對應是我的讀法,README 沒有這樣逐項寫。
宣告文展望 0.3 的時候,提到 “adding the future and stream types to Wit”。這句我是透過摘錄看到的,前後文沒全讀,所以只當作一個伏筆放在這裡。
兩年的 0.2.x:多數是流程,不是新 API
投票之後,0.2 進入固定節奏。v0.2.1(2024-08-01)的 release notes 寫明規則:”WASI is released on the first Thursday of every other month. All releases of WASI 0.2.* are backwards-compatible.” 下面這張表是我從主 repo 的 release notes 挑出來的日期與可見內容,不是每個版本都列。
| 版本 | 發布日 | release notes 裡可見的內容 |
|---|---|---|
| v0.2.0 | 2024-04-24 | 一句話,指向 1 月 24 日的投票 |
| v0.2.1 | 2024-08-01 | @since、@unstable feature gates |
| v0.2.2 | 2024-10-03 | @deprecated feature gate,用在 wasi:http/proxy world |
| v0.2.3 | 2024-12-05 | 小幅文件更新 |
| v0.2.4 | 2025-02-06 | 列出 wasi-tls phase 1 |
| v0.2.6 | 2025-06-12 | 加入 wasi-otel 作為 phase 0 proposal |
| v0.2.8 | 2025-10-07 | 只有 “Release WASI v0.2.8” |
| v0.2.9 | 2025-12-02 | proposals 併進 WASI 單一 repo(PR #826) |
| v0.3.0-rc | 2026-01-06、2026-02-09、2026-03-15 | 三顆 prerelease |
| v0.2.12 | 2026-06-02 | stabilize next(PR #923) |
十二個小版本(v0.2.1 到 v0.2.12)讀下來,對外可見的新功能很少,大部分是流程和文件。這個歸納只限於 WASI 主 repo 的 release notes,各個 proposal 自己 repo 的 release 我沒一個個讀。v0.2.9 那一欄也值得記:我逐版讀過 notes(v0.2.5 只讀到前 14 行),v0.2.1 到 v0.2.8 都沒有「把 proposals 併進單一 repo」這一項,要到 v0.2.9(2025-12-02)才列出。
再看日期的交錯。第一顆 0.3 的 rc(2026-01-06)出現的時候,0.2 還沒停:v0.2.10 在 2026-02-03,夾在第一、第二顆 rc 之間;v0.2.11 在 2026-04-07,已經在第三顆 rc 之後;v0.2.12 則是 2026-06-02,離 0.3.0 只差九天。
這一段有一件事我沒弄懂。v0.2.12 的 notes 有一條 “remove CLI: Exit With Code from Phase 2”(PR #913),而 wasmtime v46.0.0 的 notes 寫 “Wasmtime supports WASI 0.2.12, which notably includes exit-with-code in stable.”。兩句擺在一起,我讀起來方向相反,兩者的關係我沒追,不能寫成因果。
2026 年 6 月 11 日:0.3.0 把 async 放進元件模型
rc 階段留下幾條 notes。rc-2026-02-09 有一條標題是 “Async write prevents Rust bindings and component composition”(PR #870),rc-2026-03-15 則有 sockets 新增 EPIPE 錯誤碼(#887)、wasi:random 允許 get-random-bytes 回傳少於要求的位元組(#901)。我只讀了 notes 的標題,PR 內文沒讀。
2026-06-11,v0.3.0 發布,release notes 的第一句話是:
WASI 0.3 is official, and async is now native to WebAssembly Components. The WASI Subgroup voted to ratify WASI 0.3.0, rebasing WASI onto the WebAssembly Component Model’s async primitives.
同一頁還有一段自我描述:”Most of the changes in the 0.3 interfaces are entirely mechanical. WASI 0.2 had to perform some acrobatics to make async work, but now that async is native to the component model we can write the same things we did before but much more ergonomically.”
官方放了一張 0.2 到 0.3 的對照表。我把它整理成下面這樣,寫法以官方原文為準,中文括註是我加的。
| 0.2 的寫法 | 0.3 的寫法 |
|---|---|
resource pollable |
future<T> |
resource input-stream |
stream<u8> |
resource output-stream |
stream<u8>(寫入方向) |
poll(list<pollable>) |
await on a future (runtime-handled) |
資源上的 subscribe() |
呼叫直接回傳 future<...> |
start-foo / finish-foo |
foo: async func(...) |
用程式碼看最清楚。wasi:cli 的 stdout,0.2 是這樣:
1 | get-stdout: func() -> output-stream; |
0.3 變成:
1 | write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>; |
原文對方向的描述是 “WASI 0.2 handed you an output-stream that you wrote into imperatively. WASI 0.3 has you pass in a stream<u8> and get back a future that resolves when the write completes.” 誰握著寫入的那一端,翻過來了:以前是系統給你一根水管,你往裡灌;現在是你把整捲水管交出去,系統回你一張「灌完了再通知」的收據。這個比喻是我加的,簽章本身是官方的。
這張表讀起來確實「機械」,每一格都是一對一替換。Bytecode Alliance 同一天的宣告文,對 0.2 的批評不是人體工學,而是組合:
In WASI 0.2 each component needed its own event loop/async runtime. If a component used streaming or async APIs, it couldn’t be composed with any other components.
另一句說 0.3 的 async 是 “completion-based, not readiness-based.”,做法是在 canonical ABI 加上 stream<T>、future<T> 和 async 這三個一級公民。
這裡我有個立場:這次改版最大的價值是讓元件能互相組合,語法變順手只是附帶的結果。理由是兩份官方文字的重心不同,release notes 的口氣是「同樣的事寫起來更順」,宣告文則說 0.2 的元件「組不起來」。如果只是變順,不需要在 rc 階段專門有一條 “prevents Rust bindings and component composition” 的修正(我只讀了這條的標題,PR 內文沒讀)。要改變我這個看法,需要有人實際把兩個都用 stream 的元件組合起來,結果發現組合還是得各自帶 event loop。我沒做過這個實驗,這是我讀文件後的判斷,不是結果。
sockets 的變化也有同樣的味道。原文:”The network resource is gone. WASI 0.2 modeled network access as a capability resource threaded through every bind/connect/lookup call. WASI 0.3 removes it entirely; network access is granted via world imports.” 每一組 start/finish 也都併成一個 async func。wasi:http 是改最多的,兩個 world 分別叫 wasi:http/service 與 wasi:http/middleware,後者取代 0.2 時代的 proxy world。同一頁官方宣稱 service chaining “will reduce the time for calling other microservices from milliseconds to nanoseconds: six orders of magnitude.”,這是官方在 release notes 裡的說法,我沒量過,不能當成實測結果。wasi:clocks 官方說 “deliberately, mostly renames”,例如 wall-clock 改成 system-clock、datetime 改成 instant。
「網路能不能連,由元件宣告的 world imports 決定」這句,和 WASI docs/Capabilities.md 裡 “The Wasm language has no syscall instructions or built-in I/O facilities.” 是同一條線。官方文件裡我沒找到任何提到 AI agent 或 LLM 的句子,所以這條線我只當規格背景,不往任何新場景推。
wasmtime 的對應:從 v45 到 v51
runtime 這邊,wasmtime v45.0.0(2026-05-21)的 notes 有 “Initial support for invoking component functions asynchronously has been added”,這項和 0.3 的關係我沒查。v46.0.0(2026-06-22)寫得很直接:
Wasmtime now supports WASI 0.3.0 by default and the
component-model-asyncwasm feature is now enabled by default.
宣告文在 6 月 11 日就預告過 “Wasmtime 46 will ship WASI 0.3.0 with Component Model Async enabled by default.”,兩邊對得上。v47.0.0(2026-07-20)移除了 wasi-threads 和 wasmtime 自己的 wasi-common crate。最新的 v51.0.0(2026-11-20)notes 裡還有 “Buffering of outgoing wasip3 http requests is now configurable.” 和 “Panic when a component cancels a stream or future copy on the wrong end has been fixed.” 這顯示 0.3 的實作到 v51 還在修 async 的邊角問題,但我沒統計數量,不寫「很多」。
其他工具鏈就更薄了。宣告文只寫 “jco, the JavaScript Component Model toolchain, also supports all of WASI 0.3.”,另一句 “you’ll be able to write WASI 0.3 components in Rust, Go, JavaScript, Python, and more.” 用的是未來式。各語言現況,我沒查。
0.3.1 以後:雙月列車繼續
0.3.0 是一場投票,0.2.0 也是。投票之後都接上固定的雙月節奏,差別在日子怎麼訂。v0.3.1(2026-08-11)的 notes 開頭:
This is the first point release in the 0.3.x series, which we’ll be releasing every two months.
docs/Release.md 把規則寫成 “New patch versions of WASI (0.3.x) are released every two months, on the second Tuesday of the month.”,時程表上 0.3.1 是 2026-08-11,0.3.2 是 2026-10-13,下一個 0.3.3 排在 2026-12-08(截至 11 月 21 日還沒發布,只能說是官方時程表上的下一格)。我的讀法是這看起來像看日曆發版,不是等功能到齊;這是我的解讀,文件沒有用這句話。0.2.1 的 notes 也是雙月節奏,所以「看日曆」不是 0.3 才有的,0.3 變的是日子改訂在每個發版月的第二個星期二。
0.3.1 帶進兩個 component model 的新東西:implements 和 map<K, V>。原文說 map<K, V> 讓 WIT 能直接表達動態的鍵值集合,”replacing the previous pattern of needing to write list<tuple<K, V>>.”,同時警告 “both runtimes and toolchains must support these features in order to be compatible with WASI 0.3.1 or later.”
docs/ComponentModelFeatures.md 把這個「採用」講得很清楚:0.3.0 採用 async lift/lower 與 future、stream,0.3.1 採用 map<K, V> 和 implements/external-id,採用日期都是 2026-08-06。原文有一句容易被讀漏:”Adopting a feature does not mean that any WASI API uses it. It means that WASI APIs in that release and later may use it, and that runtimes and toolchains which implement that WASI version must implement the feature regardless of whether it is used yet.” 換句話說,版本號先綁住 runtime 的義務,至於 API 用不用,是另一回事。
v0.3.2(2026-10-13)的 notes 幾乎全是治理與流程:新增 v0.3.1 規格、HTTP champions 名單異動、triage 關閉模板,沒有新 API。wasmtime 是否已支援 map<K, V> 與 implements,我沒逐版 grep v47 到 v51 的 notes,這題標未查證。
還沒收尾的幾件事
走到 2026-11-21,有幾件事擺在同一個畫面上,彼此對不太起來。
README 現在仍寫 “[WASI 0.3] (Preview 3) is the current preview.”,同時 v0.3.0 的 release notes 寫 official、寫 ratify。兩份官方文字措辭有落差,我不替它們判斷哪一個算數。docs/Proposals.md 把 Clocks、Random、Filesystem、Sockets、CLI、HTTP 六個都列在 “Phase 3 - Implementation Phase”,Phase 4 和 Phase 5 兩張表是空的。0.3.0 的投票日,release 頁沒寫,我也查不到,標未查證。
docs/Release.md 的時程表一路排到 0.3.9(2027-12-14),那是計畫,不是已經發生的事。表的下面有一句 “Once we are ready to ship WASI 1.0 we may schedule a one-off release outside the release train again.”,1.0 在 Release.md 裡只出現在這句假設,沒有日期。
一個還在 Phase 3、README 仍稱 preview 的規格,卻已經有雙月列車和排到 2027 年底的日曆。下一次有人把 Phase 4 那張空表填上第一列,會是哪一個 proposal,又會在哪一個二月、四月或六月的第二個星期二宣布?
原文來源:Mozilla Hacks:Standardizing WASI(2019-03-27)、Bytecode Alliance:WASI 0.2、Bytecode Alliance:WASI 0.3、WebAssembly/WASI releases(v0.2.0 至 v0.3.2 與三顆 rc)、WASI docs/Release.md、docs/ComponentModelFeatures.md、docs/Proposals.md、docs/Capabilities.md、README 與 wasi-0.1 分支 README、bytecodealliance/wasmtime releases(v45.0.0、v46.0.0、v47.0.0、v51.0.0;版本皆在 2026-11-21 前發布)










