///|
async fn main {
let wf = @workflow.Workflow(
runner=@spawn.contract_runner(launch=_ => {
@spawn.LaunchSpec(command="moonx", args=[
"moonbitlang/workflow/shim/codex",
"--result-file",
@spawn.ResultFilePlaceholder,
])
}),
max_calls=1,
)
let report = wf.agent(
prompt="Describe the repository's public API in three sentences.",
kind="explore",
max_steps=8,
)
println(report.stringify())
}moonx moonbitlang/workflow/shim/codex --help| Option | Codex mapping |
|---|---|
| --result-file PATH | Required: where the result file goes. |
| --command EXE | CLI executable; default codex. |
| --model NAME | -m NAME; absent leaves selection to the CLI. |
| --cwd DIR | Working directory of the CLI process. |
| --writable | Selects the write-capable sandbox below. |
| --schema FILE | --output-schema FILE, unless the request supplies a schema. |
| -- ARGS... | Passed after the shim's options and before the positional prompt. |
{
"answer": "The repository exposes ...",
"engine": "codex",
"thread_id": "example-thread",
"notices": ["An optional configuration setting was ignored."]
}| CLI event | Adapter behavior |
|---|---|
| thread.started | Records the thread id. |
| item.completed with reasoning | Ignored for step counting. |
| item.completed with error | A notice, not a step or terminal failure. |
| Other item.completed | Adds a step; an agent_message replaces the stored answer. |
| turn.completed | Adds its usage to the run's when input/output counters are valid. |
| turn.failed or top-level error with a message | Records a terminal failure; the first message wins. |
| How the run ended | Result status |
|---|---|
| An agent message, and a clean or nonzero exit without a recorded failure | completed, with the report as output |
| The step ceiling | max_steps_exhausted |
| Parent stdin EOF | interrupted |
| turn.failed or a top-level error, a launch failure, or a nonzero exit without a message | failed, with the reason |
| A clean exit without an agent message | no_report |
moon run shim/codex --target native -- --help
moon test shim/codex --target native
moon test shim/codex --target wasm