# THE HOST CONTRACT OF THE SHIPPED ARTIFACT.
#
# WHAT THIS FILE IS. The published wasm is not self-contained: it imports a SET
# of symbols from the `moonbitlang/async` HOST ABI -- the file IO, the process
# calls, the event loop -- and the HOST has to provide every one of them when
# the module is instantiated. `moonx` provides them from the async runtime
# bundled with the USER's MoonBit toolchain. So the artifact's host
# requirements are a property of the PUBLISHED BYTES, and nothing in the
# source tree can see them.
#
# THE HOST ABI NAME DID NOT CHANGE, AND THAT IS THE SURPRISING PART. The
# runtime moved from the standalone `moonbitlang/async` MODULE into the
# toolchain-bundled `moonbitlang/core` module, so the package path is now
# `moonbitlang/core/async` and there is no dependency to pin. But a wasm
# import's module name comes from the FFI declaration in the SOURCE, and
# `moonbitlang/core/async` still declares its host externs under the ABI name
# "moonbitlang/async" -- measured in the toolchain's own source, every
# `= "moonbitlang/async" "..."` declaration is still there. So the host
# supplies the same MODULE as before; what changed is the SET of symbols, and
# the set got BIGGER.
#
# WHY IT IS PINNED. On 2026-10-30 the `moonbitlang/async` 0.22.5 -> 0.22.6 bump
# added three host-required symbols to the published wasm:
#
#     moonbitlang/async thread_pool/make_write_console_job
#     moonbitlang/async thread_pool/make_read_console_job
#     moonbitlang/async thread_pool/get_read_console_result
#
# async 0.22.6 declares those three as externs the HOST must supply; 0.22.4
# and 0.22.5 do not declare them at all. A user whose toolchain bundled
# 0.22.5 therefore got, from 0.4.38:
#
#     LinkError: WebAssembly.Instance(): Import #5 "moonbitlang/async"
#     "thread_pool/make_write_console_job": function import requires a callable
#
# The 104-import surface of 0.4.37 links on such a toolchain; the 107-import
# surface of 0.4.38 does not. No test caught it, because every gate here runs
# the analyzer from SOURCE -- the published BYTES were never linked against a
# host.
#
# THE RULE, AND IT CHANGED ON 2026-11-17 (0606). This file IS the contract,
# and it is a FLOOR: these are the symbols the host has to be able to provide.
# The gate checks that the artifact's `moonbitlang/async` imports are a SUBSET
# of this list -- a symbol outside it is a FAIL, because the host would have
# to supply something an older toolchain does not have, and that is the
# direction that DROPS USERS. A symbol in this list that a particular build
# does not import is a NOTE, not a failure.
#
# WHY THE RULE CHANGED. The exact mirror -- the imports equal to this list,
# in both directions -- was the wrong property, and MEASUREMENT is what showed
# it. `moon publish` uploads the SOURCE and mooncakes compiles it SERVER-SIDE,
# so the published artifact links against the REGISTRY's builder toolchain and
# not against this machine's. MEASURED on the published 0.4.52 bytes and on
# this tree's own release build, of the SAME source:
#
#     the LOCAL release build   107 imports, 93 from `moonbitlang/async`
#     the PUBLISHED 0.4.52       106 imports, 92 from `moonbitlang/async`
#
#         in the published and not in the local:  thread_pool/make_openat_job
#         in the local and not in the published:  thread_pool/make_fsync_job
#                                                thread_pool/make_open_stat_job
#
# Published 0.4.50 and 0.4.51 both matched the mirror exactly -- 107 imports,
# 93 each -- so this arrived with 0.4.52, and it is the BUILDER's toolchain
# generation, not this tree.
#
# A dependency bump that widens the artifact's host requirements must still
# edit this file -- and the edit is a decision: it raises the minimum MoonBit
# toolchain a user needs, and that has to be written down in the README and the
# CHANGELOG. What changed is only the DIRECTION of the check, because the
# artifact's exact set is not this repository's to decide.
#
# WHAT CHANGED WHEN THE RUNTIME MOVED INTO `moonbitlang/core` (0.4.45, measured
# 2026-11-09). The symbol count went 90 -> 93. Five symbols are new:
#
#     stdio/get_stdio_handle
#     thread_pool/get_read_console_result
#     thread_pool/make_read_console_job
#     thread_pool/make_write_console_job
#     thread_pool/run_job
#
# and two are gone: `io/errno_is_read_EOF/windows` and
# `thread_pool/errno_is_cancelled`, which the newer runtime no longer declares.
# The three console-job symbols are the same three that broke 0.4.38; the two
# others are new with the merged runtime.
#
# `min-host-core` is the bundled `moonbitlang/core` whose `core/async` declares
# an extern set covering the symbols below. It was MEASURED, not guessed:
# the standalone `moonbitlang/async` 0.22.5 covers only 89 of the 93 (it has
# `stdio/get_stdio_handle` and neither of the four thread_pool additions), so a
# toolchain still bundling the standalone module CANNOT instantiate this
# artifact. The bundled core 0.10.21+06da1ed44 -- the one the `moon 0.1.20261117`
# toolchain carries -- and that toolchain's runtime together cover all 93: the
# runtime supplies the one symbol (`thread_pool/make_openat_job`) that no core
# declares.
#
# `min-host-toolchain` is NEW (0606), and it exists because ONE symbol is not
# the core's to provide. `thread_pool/make_openat_job` -- the file-IO job the
# registry's builder emitted -- is declared by no core, and the toolchain's
# RUNTIME implements it, as `moonbit_rt_make_openat_job` in
# `~/.moon/lib/runtime/fs.c`. So the floor is the TOOLCHAIN (`moon
# 0.1.20261117`), and the gate checks the toolchain's core AND its runtime.
# MEASURED on this host: the core declares 213 externs, the runtime implements
# 288 `moonbit_rt_*` names, and the UNION of the two covers all 93 symbols below.
#
# The floor is a TOOLCHAIN now, not a pin: `moon.mod` no longer depends on
# `moonbitlang/async` at all, so there is nothing in the source tree that
# could disagree with it. The gate checks the three things that CAN disagree --
# the artifact's imports against the contract, the toolchain's bundled core
# AND runtime against the contract -- and it checks that the dependency has
# not come back.
#
# 0615. THE TOOLCHAIN MOVED UNDER THIS CONTRACT, and the contract moved with
# it. MEASURED: this host's bundled core went from 0.10.20+65efd5b93 to
# 0.10.21+06da1ed44 on 2026-11-20, with `moon` 0.1.20261117 -- the toolchain
# updated itself, with no change to this repository. The gate said the same
# thing in its own words: "the floor and the toolchain are one fact, and a
# toolchain that moved must move the floor."
#
# AND THE SET MOVED WITH IT, and the movement was MEASURED, not assumed. The
# core 0.10.21 declares `thread_pool/make_openat_job` where 0.10.20 declared
# `thread_pool/make_open_stat_job`, and NEITHER of them declares the other --
# so the old symbol is not in the new toolchain at all, and a floor that
# lists a symbol no host can provide is a floor that drops users. MEASURED,
# after rebuilding BOTH artifacts against the new core:
#
#     the LOCAL debug build     106 imports, 92 from `moonbitlang/async`
#     the LOCAL release build   106 imports, 92 from `moonbitlang/async`
#
#     the contract is wider than either build by 2:
#         thread_pool/make_fsync_job
#         thread_pool/make_open_stat_job
#
# `make_open_stat_job` is GONE from the list below, because the new core
# declares it and the new runtime does not implement it, so no host on the
# new toolchain can provide it. `make_fsync_job` STAYS: the new toolchain
# does provide it, and a floor is a floor -- it covers the older artifact
# that needed it. THAT IS WHY THE LIST IS 93 AND NOT 92.
#
# AND THE TWO BUILDS AGREE NOW, which they did not before: with the old core
# the local build and the release build of the same source differed by one
# symbol, because the builder decides the set. The floor is now the union of
# what this source's own two artifacts require, plus the one symbol the
# older artifact needed and the new toolchain still provides.
#
# A TOOLCHAIN THAT MOVES IS NOT A VERDICT ABOUT THE CODE, and the fix is not
# to ignore the gate -- it is to move the floor, and to write down that it
# moved and what it cost. The CI runner installs the NEWEST toolchain, so a
# contract that did not move would fail there first.

min-host-core: 0.10.21+06da1ed44
min-host-toolchain: 0.1.20261117
host-abi-module: moonbitlang/async
symbols: 93

# --- the symbols the artifact requires from the `moonbitlang/async` HOST ABI ---
# --------------------------------------------------------------------------
# generated from the artifact on 2026-11-09 by _verify tools; 93 symbols
# widened to 94 on 2026-11-17 (0606): the union of the LOCAL build's 93 and
# the PUBLISHED 0.4.52 build's 92, so the contract is a FLOOR that serves both
# narrowed to 93 on 2026-11-20 (0615): the toolchain moved to core
# 0.10.21+06da1ed44, which declares `thread_pool/make_openat_job` where
# 0.10.20 declared `thread_pool/make_open_stat_job`, and the old symbol is
# provided by NO host on the new toolchain. `thread_pool/make_fsync_job`
# stays: the new toolchain provides it, and a floor covers the older artifact
# that needed it.
# --------------------------------------------------------------------------

c_buffer/free
c_buffer/is_null
c_buffer/new
event_bus/create
event_bus/destroy
event_bus/event_bytes_transferred/windows
event_bus/event_events/unix
event_bus/event_fd
event_bus/event_io_result/windows
event_bus/event_pid
event_bus/get_event
event_bus/register_pid
event_bus/try_register
event_bus/wait
fd_util/close_fd
fd_util/invalid_fd
fd_util/pipe
fs/dir_buffer_min_size
fs/dir_entry_get_file_id
fs/dir_entry_get_name_len
fs/dir_entry_get_name_offset
fs/dir_entry_is_dir
fs/dir_entry_is_hidden
fs/dir_entry_length
io/cancel_io_result/windows
io/free_io_result/windows
io/io_result_copy_read/windows
io/io_result_get_event/windows
io/io_result_get_status/windows
io/make_file_read_io_result/windows
io/make_file_write_io_result/windows
io/make_socket_read_io_result/windows
io/make_socket_write_io_result/windows
io/read/unix
io/read/windows
io/write/unix
io/write/windows
os_error/errno_to_string
os_error/free_errno_str
os_error/get_errno
os_string/decode
os_string/decode_len
process/argv_array_add_encoded_entry/unix
process/argv_array_add_entry/unix
process/env_add_entry
process/get_process_result
process/kill
process/make_argv_array/unix
process/make_env
process/terminate
runtime/cleanup_WSA
runtime/exit
runtime/get_platform
runtime/init_WSA
runtime/terminate_process_by_signal
signal/get_signal_by_index
signal/set_console_control_handler
signal/set_global_cancellation_signals
signal/start_signal_handler
signal/terminate_signal_handler
stdio/get_stdio_handle
thread_pool/cancel_worker_with_retry
thread_pool/destroy_thread_pool
thread_pool/fetch_completion/unix
thread_pool/free_job
thread_pool/free_worker
thread_pool/get_read_console_result
thread_pool/get_read_result
thread_pool/get_stat_result
thread_pool/init_thread_pool
thread_pool/job_get_err
thread_pool/job_get_ret
thread_pool/make_fstatx_job
thread_pool/make_fsync_job
thread_pool/make_openat_job
thread_pool/make_read_console_job
thread_pool/make_read_job
thread_pool/make_readdir_job
thread_pool/make_statx_job
thread_pool/make_wait_for_process_job
thread_pool/make_write_console_job
thread_pool/make_write_job
thread_pool/open_job_get_fd
thread_pool/run_job
thread_pool/spawn_job/set_cwd
thread_pool/spawn_job/set_no_console_window
thread_pool/spawn_job/unix
thread_pool/spawn_job/windows
thread_pool/spawn_job_get_result_handle
thread_pool/spawn_worker
thread_pool/wake_worker
thread_pool/worker_enter_idle
time/get_ms_since_epoch
