Sign in

    agent-sdk

    Provider-neutral MoonBit interfaces for agent CLI SDKs

    agent
    cli
    codex
    opencode
    sdk
    moonbit
    Download zip
    Author
    Version
    0.2.1
    License
    MIT
    Last updated
    2 months ago
    Downloads
    124

    #moonbit: backend: wasm import: - path: totto2727/agent-sdk@0.2.1/cli alias: cli - path: totto2727/agent-sdk@0.2.1/cli/codex alias: codex_adapter

    #totto2727/agent-sdk

    Provider-neutral MoonBit interfaces for running Codex and OpenCode CLI sessions while leaving each provider's native options, event models, errors, and continuation behavior in its own SDK.

    #Usage

    Use the provider-neutral session contract from the common CLI package, then select the Codex adapter or OpenCode adapter.

    After adding the packages described in Setup, ask Codex to summarize a repository and return its provider-neutral response:

    ///|
    pub async fn summarize_repository() -> @cli.FinalResponse {
    let response = @codex_adapter.codex_cli().start().prompt(
    @cli.Prompt::Prompt("Summarize the repository status"),
    )
    response
    }

    #Key features

    • One provider-neutral Cli, CliSession, Prompt, and FinalResponse contract for both adapters.

    • Opaque continuations keep provider-owned resume behavior out of consumer code.

    • Codex reports completed patch paths through FinalResponse.changed_files; OpenCode returns an empty change list because its current event model does not expose a reliable set.

    • The module supports both wasm and native targets and prefers wasm for target-unspecified builds.

    #Prerequisites

    • MoonBit: Install the MoonBit toolchain and moon command.

    • Provider CLI: Install Codex or OpenCode when using the corresponding adapter, or provide its executable through the provider SDK's native client options.

    • Wasm host: Supply the process bridge provided by the provider SDK stack, including its shared agent-core dependency, when running the Wasm target.

    #Setup

    1. Add the module to your MoonBit project.

    moon add totto2727/agent-sdk@0.2.1

    1. Import the common package and the provider adapter package needed by your application in moon.pkg.

    import {
    "totto2727/agent-sdk/cli" @cli,
    "totto2727/agent-sdk/cli/codex" @codex_adapter,
    }

    See the package-specific usage guides for checked examples and provider-native options.

    #API

    The Mooncakes module API reference links to the maintained generated API for the common package, Codex adapter, and OpenCode adapter.

    #Development

    For repository structure and development commands, see AGENTS.md.

    #License

    MIT; see LICENSE.

    This README was generated from the share-artifact skill and README template.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io