MoonBit SDKs for OpenCode CLI execution and managed Server lifecycle
Dependencies
///|
async fn example {
let opencode = @opencode_sdk.OpenCode::OpenCode()
let thread = opencode.start_thread(
options=@opencode_sdk.ThreadOptions::ThreadOptions(
model="opencode-go/deepseek-v4-flash",
),
)
let turn = thread.run(
@opencode_sdk.Input::Prompt("Explain this repository in one paragraph."),
)
println(turn.final_response)
}import {
"totto2727/opencode-sdk@0.2.2",
}import {
"totto2727/opencode-sdk" @opencode_sdk,
}///|
async fn stream_example {
let thread = @opencode_sdk.OpenCode::OpenCode().start_thread()
thread.run_streamed(
@opencode_sdk.Input::Prompt("Summarize the current changes."),
async fn(event) {
match event {
@opencode_sdk.Text(text) => println(text.text)
_ => ()
}
@async.pause()
},
)
}MoonBit SDKs for OpenCode CLI execution and managed Server lifecycle
Dependencies