Sign in

    moonohos

    Build MoonBit computation libraries for HarmonyOS Native/Node-API.

    harmonyos
    native
    ffi
    node-api
    code-generation
    Download zip
    Author
    Version
    0.3.0
    License
    Apache-2.0
    Last updated
    19 days ago
    Downloads
    21

    #MoonOHOS

    MoonOHOS 将 MoonBit 核心逻辑编译为 HarmonyOS Native 模块。ArkTS 负责 UI 和系统交互,MoonBit 负责算法、计算和业务核心。

    0.3 源码提供 MoonBit 实现的构建 CLI、标量、String/Bytes、Array/Struct 接口生成器和可打开的 Stage 示例应用。所有函数都是同步接口,耗时任务应等待后续异步支持。

    首版验收记录保留在 0.1 验证记录,后续结果分别记录在 0.2 验证记录 和 0.3 验证记录。ARM64 真机运行尚未验证。

    #验证环境

    • Windows x64,Moon 0.1.20260920,moonc v0.10.14+7d59c7ec9,Core 0.10.14+7d59c7ec9,async 0.21.0。
    • DevEco Studio 26,内置 HarmonyOS SDK API 26。
    • 编译目标 arm64-v8a、x86_64;ARM64 真机和旧 SDK 兼容性分别验证。
    • CLI 在 Windows 上由 Moon 自动选择 MSVC 构建,需要安装 C++ Build Tools;鸿蒙模块使用 SDK Clang/CMake/Ninja。

    当前实现固定以上版本,版本检查不通过时停止,不自动升级工具链或修改全局开发环境。

    #快速开始

    源码仓库:shop1111/MoonOHOS。Mooncakes 模块为 shop1111/moonohos@0.3.0,使用上述固定工具链可安装 CLI:

    moon install shop1111/moonohos/cmd/moonohos@0.3.0 moonohos --version

    CLI 本身通过 Native 后端构建。HarmonyOS SDK 仍需在本地安装,并通过 --sdk 提供。完整示例及验证脚本请从源码仓库获取。

    在项目根目录执行 PowerShell:

    moon update moon build --target native --release --deny-warn cmd/moonohos $taskCli = '.\_build\native\release\build\cmd\moonohos\moonohos.exe' & $taskCli build --sdk 'D:\apps\DevEco Studio\sdk' .\scripts\build_example.ps1 -DevEco 'D:\apps\DevEco Studio'

    --sdk 接受 DevEco 的 sdk 目录、OpenHarmony SDK 组件目录或 Native 目录;这里的 OpenHarmony 是 DevEco 内置组件名称,不代表已经验证独立 OpenHarmony 产品。

    在 DevEco 打开 examples/harmony,运行 EntryAbility。页面显示 42、中文文本、Uint8Array 和批量 Sample 分析,并自动检查标量、引用类型、嵌套容器和重复调用。日志标签是 MoonOHOS,成功标记是 MOONOHOS_RUNTIME_PASS。scripts/build_example.ps1 生成未签名 HAP;目标设备是否允许安装需按设备实际规则处理,脚本不设置签名。

    #接入已有 MoonBit 库

    创建 moonohos.json:

    { "version": 1, "module": "./my-core", "package": "username/my-core", "nativeModule": "moonohos", "functions": [ { "name": "add", "params": [{"name": "left", "type": "Int"}, {"name": "right", "type": "Int"}], "return": "Int" } ] }

    函数必须是所选包公开的普通函数,参数、顺序和返回类型必须与清单完全一致。package 必须属于 module 指向的模块;模块内子包也可选。

    & $taskCli build --config .\moonohos.json --sdk 'D:\apps\DevEco Studio\sdk' --abi x86_64 --out .\native-package & $taskCli build --config .\moonohos.json --sdk 'D:\apps\DevEco Studio\sdk' --dry-run

    路径均相对清单文件解析,包含 --out 和相对形式的 --sdk。默认构建两个 ABI,默认输出 _build/moonohos/dist。输出目录必须不存在;重复构建请使用新的目录或先自行清理旧产物。--dry-run 验证配置和工具链,不创建输出或暂存目录。完整签名核对和阶段规划使用 check / plan。

    MoonBitC 适配边界ArkTS
    Intint32_tnumber,有限整数,范围 −2147483648…2147483647
    Doubledoublenumber,参数和返回值必须有限
    Boolint32_tboolean
    Unit 返回值voidvoid
    Stringmoonbit_string_t,内部固定版本 ABIstring,UTF-16 码元原样复制
    Bytesmoonbit_bytes_t,内部固定版本 ABIUint8Array,复制视图范围
    Array[T]不透明指针与编译器生成的访问函数Array<T>
    具名普通 Struct不透明指针与编译器生成的访问函数具名 interface

    缺少参数或类型错误抛出 TypeError,无效数值抛出 RangeError;额外参数与普通 JavaScript 调用一致,被忽略。Int 运算遵循 MoonBit 的 32 位回绕语义。Node-API 操作失败抛出 Error,已有 pending exception 保留。MoonBit panic 可能终止应用进程,不能当作可捕获的业务错误。

    String 支持空串、中文、emoji、内嵌 NUL 和未配对代理码元,按明确长度转换,不经过 UTF-8。Bytes 只接受普通、未分离 ArrayBuffer 上的 Uint8Array,包括 subarray();不接受 ArrayBuffer、DataView、Uint8ClampedArray、其他 TypedArray 或共享缓冲区。返回数组拥有独立内存,修改它不会改变输入。长度超过 INT32_MAX 或容量计算溢出抛出 RangeError,错误对象或分离缓冲区抛出 TypeError。

    输入先复制到 C++ 缓冲区,再在锁内分配 MoonBit 对象;调用完成后复制结果并分别释放输入和返回值引用,解锁后创建 ArkTS 返回值。固定编译器导出函数借用参数、返回一个持有的引用;即便返回输入本体,也分别释放两份引用。C++ 分配异常转换为 Error;MoonBit panic 和运行时分配失败可能终止进程。C 头文件用于内部适配,不承诺跨 MoonBit 版本的引用类型 ABI。

    不支持泛型、#value 结构体、可选或标记参数、raise、回调、异步接口和额外 Native stub。也拒绝所选模块及其依赖内的 Native stub/pre-build hook。纯 MoonBit 依赖仍通过 Moon 正常解析;本地工作区依赖需要先改为可解析的模块依赖。支持 moon.mod 和旧 moon.mod.json,源目录必须在模块内部,不复制嵌套模块及符号链接。

    清单仍为 version 1,函数参数及 return 使用 "String"、"Bytes",可与标量类型任意组合。例如生成后:

    import native from 'libmoonohos.so'; const text: string = native.join_text('你好,', 'MoonBit 🌙'); const bytes: Uint8Array = native.echo_bytes(new Uint8Array([0, 127, 255]));

    #Array / Struct 契约

    清单继续使用 version: 1,可增加 types:

    "types": [ {"name": "Sample", "fields": [ {"name": "label", "type": "String"}, {"name": "values", "type": "Array[Double]"} ]} ]

    目标包需提供同名公开普通结构体,包装包必须能构造并读取全部字段。函数、字段和嵌套类型通过 .mbti 声明解析及实际包装包编译核对。类型依赖必须无环;泛型、不可访问字段、遗漏字段和未知声明语法会失败。

    数组仅接受普通、稠密、非 Sendable 数组。TypedArray 使用 Bytes 契约,不可作为 Array。记录需要声明字段均为自有属性,额外属性忽略;null、缺失字段、数组空洞和循环对象抛出 TypeError。非循环的重复对象分别复制。错误诊断包含具体字段或数组索引。

    每次输入或输出转换最多嵌套 32 层、处理 1,048,576 个元素/字段、复制 64 MiB 数据,超限抛出 RangeError。仅有顶层 String/Bytes 的旧接口仍使用 INT32_MAX 长度规则。Array/Struct 通过编译器生成的构造、追加、长度和读取函数转换,C++ 不依赖其私有内存布局。输入、返回值和引用型字段读取结果分别释放,不按地址合并引用。

    #分析、校验和缓存

    & $taskCli doctor --sdk 'D:\apps\DevEco Studio\sdk' --json & $taskCli check --config moonohos.json --json & $taskCli inspect --config moonohos.json --json & $taskCli plan --config moonohos.json --abi x86_64 --json & $taskCli verify --out _build/moonohos/dist --json & $taskCli build --sdk 'D:\apps\DevEco Studio\sdk' --out _build/moonohos/dist-cached --cache --json

    doctor 检查固定工具链和 SDK 文件;check 核对声明并严格编译临时包装包;inspect 给出接口和可达类型摘要;plan 给出有序构建阶段、依赖和引用转换规划;verify 无需 SDK,核对清单、文件完整性、SHA256、类型包、可重定位 CMake、ELF64 架构、内存映射、注册符号和动态依赖。verify --out 相对当前目录,其余项目命令的路径相对清单文件。

    成功退出 0,参数错误退出 2,诊断或构建失败退出 3。--json 输出单个结构化报告。外部进程始终使用参数数组启动,默认超时 300 秒并取消本次启动的子进程。阶段命令、耗时、标准输出和错误写入工作目录,分发包不含这些机器相关日志。

    缓存默认关闭。启用后先解析依赖和核对接口,再按 ABI、源码和依赖内容、清单、Core、运行时、编译器、SDK 及生成器内容计算键。命中前验证整个包;损坏条目改名保留证据后重建。输出目录必须不存在;完成的包通过移动暂存目录发布,失败不会将半成品放入输出目录。缓存与工作目录位于清单旁的 _build/moonohos/。

    旧 Config、ValueType 和生成函数仍保留;复杂接口使用 parse_project()、Project.generate() 等公共入口。生产代码门槛由 python scripts/count_production.py 逐文件统计,排除测试、示例、fixture、生成源码、注释及纯字符串/模板正文。Windows CI 使用固定版本执行严格 Native 检查、测试、接口一致性、CLI 构建、打包、代码量门槛和真实生成代码 ASan;SDK/HAP/模拟器检查独立在本机执行。

    #产物接入

    dist/ libs/arm64-v8a/libmoonohos.so libs/x86_64/libmoonohos.so types/libmoonohos/index.d.ts types/libmoonohos/oh-package.json5 cmake/MoonOHOS.cmake manifest.json README.md NOTICE.NativeSDK.txt NOTICE.MoonBit.txt

    将 libs/<abi>/*.so 放入应用的 entry/libs/<abi>/,将类型包放入 entry/src/main/cpp/types/。在 entry/oh-package.json5 中声明:

    {"dependencies":{"libmoonohos.so":"file:./src/main/cpp/types/libmoonohos"}}

    运行 ohpm install,在 ArkTS 中导入 libmoonohos.so。如果需要在自己的 CMake 中引用动态库,可包含 cmake/MoonOHOS.cmake;该导入本身不会将动态库打进 HAP。实际接入方式见示例工程。

    编译器只生成 C,MoonOHOS 使用同版本的五个运行时源码和头文件重新交叉编译。C 适配层将编译器的 Unit 整数返回值规范为 void;Node-API 层串行初始化和调用。C++ 标准库静态链接,避免需要另行分发 libc++_shared.so。不执行生成程序的 main,不混入 Windows 运行时对象。

    manifest.json 的 moonohosVersion 记录生成器版本;runtime=not_run 表示 CLI 没有执行鸿蒙应用。构建日志、编译命令和暂存源码保留于清单旁的 _build/moonohos/work-*,失败时可用于定位;分发包不包含 SDK 绝对路径。

    分发动态库时保留两份 NOTICE,并补充业务库自身的许可证。MoonOHOS 源码使用 Apache-2.0;第三方组件说明见 THIRD_PARTY.md。

    #验证

    moon fmt moon check --target native --deny-warn moon test --target native --deny-warn moon info --target native python scripts\verify_manual.py 'D:\apps\DevEco Studio\sdk' python scripts\verify_host.py python scripts\verify_integration.py 'D:\apps\DevEco Studio\sdk' .\scripts\verify_device.ps1 -Hdc 'D:\apps\DevEco Studio\sdk\default\openharmony\toolchains\hdc.exe'

    手写 fixture 验证最初的 Int 链路。宿主测试用 MSVC AddressSanitizer 执行实际生成的 MoonBit C 代码和 Node-API callback,覆盖 UTF-16、字节视图、返回输入本体、错误类型、范围错误、逐项 API 失败、pending exception 及注册失败。测试专用 failpoint 模拟输入与结果缓冲区分配异常,运行时 malloc/free 计数核对 10000 轮调用后的存活分配增量为零;这些检测不修改分发库。宿主替身不验证 HarmonyOS 加载器。

    集成检查验证中文、空格路径、干净双 ABI 构建、原始源码保持不变和错误配置,并额外构建引用类型与所有返回类型组合的 fixture,执行独立 ASan/分配计数测试。宿主日志位于 _build/host-asan-v0.3/。

    设备验证脚本需要 PowerShell 7,要求模拟器已经连接,会安装当前示例 HAP、停止并启动示例进程两次,保存新成功日志、页面截图和 HAP SHA256。默认目标为 127.0.0.1:5555,可用 -Target 指定其他连接;每条 hdc 命令超时 45 秒即失败。证据默认写入 _build/validation-v0.3/,保留首版证据。它独立于构建 CLI。

    下一阶段:异步和线程协议 → MoonBit 调用 HarmonyOS Native API 的 SDK。

    ConfigError

    pub(all) suberror ConfigError {
    Invalid(String)
    } derive(
    Debug
    )

    ConfigError::to_repr

    #deprecated("`ConfigError::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn ConfigError::to_repr(ConfigError) ->
    Repr

    BuildStage

    pub struct BuildStage {
    id : String
    description : String
    dependencies : Array[String]
    abi : String?
    outputs : Array[String]
    }

    BuildStage::to_json

    fn BuildStage::to_json(self : BuildStage) -> Json

    Callable

    pub struct Callable {
    name : String
    params : Array[FieldDef]
    result : TypeExpr
    }

    Callable::signature

    fn Callable::signature(self : Callable) -> String

    CliOptions

    pub struct CliOptions {
    command : Command
    config : String
    sdk : String?
    abis : Array[String]
    output : String
    json : Bool
    dry_run : Bool
    cache : Bool
    }

    Command

    pub(all) enum Command {
    Build
    Doctor
    Check
    Inspect
    Plan
    Verify
    Help
    Version
    } derive(Eq,
    Debug
    )

    Command::equal

    #deprecated("`Command::equal` is deprecated, use `Eq::equal` instead.")
    fn Command::equal(Command, Command) -> Bool

    Command::not_equal

    #deprecated("`Command::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn Command::not_equal(x : Command, y : Command) -> Bool

    Command::to_repr

    #deprecated("`Command::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn Command::to_repr(Command) ->
    Repr

    Config

    pub struct Config {
    module_dir : String
    package_name : String
    native_module : String
    functions : Array[Function]
    }

    Config::to_project

    fn Config::to_project(self : Config) -> Project

    ContentFingerprint

    pub struct ContentFingerprint {
    domain : String
    name : String
    digest : String
    }

    ContentFingerprint::to_json

    ConversionLimits

    pub struct ConversionLimits {
    depth : Int
    nodes : Int
    bytes : Int
    }

    ConversionLimits::to_json

    fn ConversionLimits::to_json(self : ConversionLimits) -> Json

    Diagnostic

    pub(all) struct Diagnostic {
    stage : String
    code : String
    message : String
    context : Array[String]
    }

    Diagnostic::render

    fn Diagnostic::render(self : Diagnostic) -> String

    Diagnostic::to_json

    fn Diagnostic::to_json(self : Diagnostic) -> Json

    ElfInfo

    pub struct ElfInfo {
    abi : String
    dependencies : Array[String]
    imports : Array[String]
    exports : Array[String]
    soname : String?
    segments : Array[ElfSegment]
    }

    ElfInfo::to_json

    fn ElfInfo::to_json(self : ElfInfo) -> Json

    ElfSegment

    pub struct ElfSegment {
    offset : Int
    file_size : Int
    memory_size : UInt64
    address : UInt64
    flags : Int
    alignment : UInt64
    }

    ElfSegment::to_json

    fn ElfSegment::to_json(self : ElfSegment) -> Json

    EnvironmentFact

    pub struct EnvironmentFact {
    name : String
    actual : String
    expected : String
    available : Bool
    }

    EnvironmentFact::passed

    fn EnvironmentFact::passed(self : EnvironmentFact) -> Bool

    EnvironmentFact::to_json

    fn EnvironmentFact::to_json(self : EnvironmentFact) -> Json

    FieldDef

    pub struct FieldDef {
    name : String
    kind : TypeExpr
    }

    Function

    pub struct Function {
    name : String
    params : Array[Parameter]
    result : ValueType
    }

    GeneratedArtifacts

    pub struct GeneratedArtifacts {
    wrapper : String
    package_file : String
    header : String
    embed : String
    native : String
    declarations : String
    cmake : String
    }

    InterfaceFunction

    pub struct InterfaceFunction {
    name : String
    params : Array[TypeExpr]
    result : TypeExpr
    unsupported : String?
    }

    InterfaceRecord

    pub struct InterfaceRecord {
    name : String
    fields : Array[FieldDef]
    unsupported : String?
    }

    PackageFile

    pub struct PackageFile {
    path : String
    size : Int
    checksum : String
    }

    PackageFile::to_json

    fn PackageFile::to_json(self : PackageFile) -> Json

    PackageFile::verify

    fn PackageFile::verify(self : PackageFile, data : Bytes) -> Unit raise ConfigError

    PackageInterface

    pub struct PackageInterface {
    functions : Array[InterfaceFunction]
    records : Array[InterfaceRecord]
    }

    PackageManifest

    pub struct PackageManifest {
    module_name : String
    version : String
    abis : Array[String]
    files : Array[PackageFile]
    }

    Parameter

    pub struct Parameter {
    name : String
    kind : ValueType
    }

    Project

    pub struct Project {
    module_dir : String
    package_name : String
    native_module : String
    records : Array[RecordDef]
    functions : Array[Callable]
    }

    Project::build_plan

    fn Project::build_plan(self : Project, abis : Array[String]) -> Json raise ConfigError

    Project::business_adapters

    fn Project::business_adapters(self : Project) -> String raise ConfigError

    Project::business_header

    fn Project::business_header(self : Project) -> String raise ConfigError

    Project::business_wrapper

    fn Project::business_wrapper(self : Project) -> String raise ConfigError

    Generates only business exports; container accessors are added by the backend.

    Project::generate

    fn Project::generate(self : Project) -> GeneratedArtifacts raise ConfigError

    Project::generate_arrays

    fn Project::generate_arrays(self : Project) -> GeneratedArtifacts raise ConfigError

    Project::generation_plan

    fn Project::generation_plan(self : Project) -> Json raise ConfigError

    Project::reachable_types

    fn Project::reachable_types(self : Project) -> Array[TypeExpr] raise ConfigError

    Dependencies precede their users; declaration order is deterministic.

    Project::record_def

    fn Project::record_def(self : Project, name : String) -> RecordDef raise ConfigError

    Project::record_order

    fn Project::record_order(self : Project) -> Array[RecordDef] raise ConfigError

    Project::summary

    fn Project::summary(self : Project) -> Json raise ConfigError

    Project::validate

    fn Project::validate(self : Project) -> Unit raise ConfigError

    Project::verify_interface

    fn Project::verify_interface(self : Project, text : String) -> Unit raise ConfigError

    RecordDef

    pub struct RecordDef {
    name : String
    fields : Array[FieldDef]
    }

    Sha256

    pub struct Sha256 {
    state : Array[UInt]
    pending : Array[Byte]
    count : UInt64
    }

    FIPS 180-4 SHA-256. All arithmetic intentionally wraps at 32 bits.

    Sha256::digest

    fn Sha256::digest(self : Sha256) -> String

    Finalization uses a copy; calling digest repeatedly does not mutate state.

    Sha256::new

    fn Sha256::new() -> Sha256

    Sha256::update

    fn Sha256::update(self : Sha256, data : Bytes) -> Unit

    TypeExpr

    pub(all) enum TypeExpr {
    Scalar(ValueType)
    List(TypeExpr)
    Record(String)
    } derive(Eq,
    Debug
    )

    TypeExpr::ark_name

    fn TypeExpr::ark_name(self : TypeExpr) -> String

    TypeExpr::c_name

    fn TypeExpr::c_name(self : TypeExpr) -> String

    TypeExpr::equal

    #deprecated("`TypeExpr::equal` is deprecated, use `Eq::equal` instead.")
    fn TypeExpr::equal(TypeExpr, TypeExpr) -> Bool

    TypeExpr::is_reference

    fn TypeExpr::is_reference(self : TypeExpr) -> Bool

    TypeExpr::moon_name

    fn TypeExpr::moon_name(self : TypeExpr) -> String

    TypeExpr::not_equal

    #deprecated("`TypeExpr::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn TypeExpr::not_equal(x : TypeExpr, y : TypeExpr) -> Bool

    TypeExpr::to_repr

    #deprecated("`TypeExpr::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn TypeExpr::to_repr(TypeExpr) ->
    Repr

    TypeExpr::wrapper_name

    fn TypeExpr::wrapper_name(self : TypeExpr) -> String

    ValueType

    pub(all) enum ValueType {
    Int32
    Float64
    Boolean
    Text
    Binary
    Void
    } derive(Eq,
    Debug
    )

    ValueType::ark_name

    fn ValueType::ark_name(self : ValueType) -> String

    ValueType::c_name

    fn ValueType::c_name(self : ValueType) -> String

    ValueType::equal

    #deprecated("`ValueType::equal` is deprecated, use `Eq::equal` instead.")
    fn ValueType::equal(ValueType, ValueType) -> Bool

    ValueType::moon_name

    fn ValueType::moon_name(self : ValueType) -> String

    ValueType::not_equal

    #deprecated("`ValueType::not_equal` is deprecated, use `Eq::not_equal` instead.")
    fn ValueType::not_equal(x : ValueType, y : ValueType) -> Bool

    ValueType::to_repr

    #deprecated("`ValueType::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn ValueType::to_repr(ValueType) ->
    Repr

    build_stages

    fn build_stages(project : Project, abis : Array[String]) -> Array[BuildStage] raise ConfigError

    c_header

    fn c_header(config : Config) -> String

    cmake_source

    fn cmake_source(config : Config) -> String

    command_name

    fn command_name(command : Command) -> String

    compiler_commands

    fn compiler_commands(plan : String, moon_home : String) -> Array[Array[String]] raise ConfigError

    Selects compiler-only commands; excludes host C compilers and runtime objects.

    content_cache_key

    fn content_cache_key(entries : Array[ContentFingerprint]) -> String raise ConfigError

    conversion_limits

    fn conversion_limits() -> ConversionLimits

    declarations

    fn declarations(config : Config) -> String

    embed_source

    fn embed_source(config : Config) -> String

    environment_fact

    fn environment_fact(name : String, actual : String, expected : String, available : Bool) -> EnvironmentFact

    environment_report

    fn environment_report(facts : Array[EnvironmentFact]) -> Json

    failure_report

    fn failure_report(command : String, diagnostic : Diagnostic, parameter? : Bool) -> Json

    fingerprint

    fn fingerprint(domain : String, name : String, data : Bytes) -> ContentFingerprint

    identifier

    fn identifier(name : String) -> Bool

    ignored_cache_component

    fn ignored_cache_component(name : String) -> Bool

    inspect_elf

    fn inspect_elf(bytes : Bytes) -> ElfInfo raise ConfigError

    native_source

    fn native_source(config : Config) -> String

    package_file

    fn package_file(path : String, data : Bytes) -> PackageFile raise ConfigError

    package_requirements

    fn package_requirements(module_name : String, abis : Array[String]) -> Array[String]

    parse_abis

    fn parse_abis(text : String) -> Array[String] raise ConfigError

    parse_cli

    fn parse_cli(args : Array[String]) -> CliOptions raise ConfigError

    Arguments exclude the executable name. Paths are resolved by the command.

    parse_config

    fn parse_config(text : String) -> Config raise ConfigError

    parse_package_interface

    fn parse_package_interface(text : String) -> PackageInterface

    Parses selected declarations structurally; unrelated traits remain opaque.

    parse_package_manifest

    fn parse_package_manifest(text : String) -> PackageManifest raise ConfigError

    parse_project

    fn parse_project(text : String) -> Project raise ConfigError

    parse_type_expr

    fn parse_type_expr(text : String, result? : Bool) -> TypeExpr raise ConfigError

    pinned_environment

    fn pinned_environment() -> Array[(String, String)]

    runtime_files

    fn runtime_files() -> Array[String]

    sdk_candidates

    fn sdk_candidates(path : String) -> Array[String]

    sdk_files

    fn sdk_files() -> Array[String]

    seal_manifest

    fn seal_manifest(manifest : Json, files : Array[PackageFile]) -> Json raise ConfigError

    sha256

    fn sha256(data : Bytes) -> String

    signature

    fn signature(fn_ : Function) -> String

    success_report

    fn success_report(command : String, result : Json) -> Json

    tokenize

    fn tokenize(line : String) -> Array[String] raise ConfigError

    Tokenizes Moon 20260920 dry-run command quoting. Never evaluates a shell.

    validate_distribution_metadata

    fn validate_distribution_metadata(json : Json) -> Unit raise ConfigError

    validate_package_path

    fn validate_package_path(path : String) -> Unit raise ConfigError

    validate_stages

    fn validate_stages(stages : Array[BuildStage]) -> Unit raise ConfigError

    verify_import_file

    fn verify_import_file(text : String, manifest : PackageManifest) -> Unit raise ConfigError

    verify_interface

    fn verify_interface(config : Config, text : String) -> Unit raise ConfigError

    verify_library

    fn verify_library(info : ElfInfo, manifest : PackageManifest, abi : String) -> Unit raise ConfigError

    verify_type_package

    fn verify_type_package(text : String, manifest : PackageManifest) -> Unit raise ConfigError

    wrapper_package

    fn wrapper_package(config : Config) -> String

    wrapper_source

    fn wrapper_source(config : Config) -> String