workgraph-opencode-cli

OpenCode CLI integration for workgraph

agent
graph
moonbit
opencode
moon add totto2727/workgraph-opencode-cli@0.2.0
Download zip
Author
Version
0.2.0
License
MIT
Last updated
21 hours ago
Downloads
4
README

#workgraph-opencode-cli

workgraph-opencode-cli implements the Workgraph coding-agent contract through totto2727/agent-sdk/cli/opencode. Its public OpenCodeAgentOptions and opencode_agent constructor remain the composition root for OpenCode-native option types from totto2727/opencode-sdk/cli.

opencode_agent returns a configured agent-sdk Cli through CodingAgent.open; the shared node owns session acquisition, prompt serialization, agent-bound continuation selection, response decoding, and relative context-file resolution against the Workgraph workspace. Absolute Path values and caller order are retained. Provider errors and prompt cancellation propagate unchanged, with provider cleanup owned by the cancellable CliSession.prompt call. There is no Workgraph session wrapper, logical close, or post-close error.

#Package

import {
"totto2727/workgraph-opencode-cli"
}

Version 0.2.0 prefers Wasm/WASI and supports Wasm/WASI and native from the same production source; JavaScript is not supported. It resolves totto2727/agent-sdk@0.2.0 and totto2727/opencode-sdk@0.4.0 from the MoonBit registry. The shared CI check follows the Wasm/WASI preferred target and loads the OpenCode CLI from the repository's ci Nix dev shell. Fake CLI process tests run only on native.

#Example

The src/examples/basic example can use local OpenCode CLI configuration and runs a read-only prompt in the current workspace. It is an optional credentialed smoke, not a required test gate.

moon run --target native package/workgraph-opencode-cli/src/examples/basic

#
OpenCodeAgentOptions

pub struct OpenCodeAgentOptions {
opencode_path_override :
Path
?
config : Map[String, Json]?
resume_thread_id : String?
model : String?
agent : String?
variant : String?
title : String?
thinking : Bool
extra_env : Map[String, String]
}

Configuration shared by every OpenCode CLI session opened by this adapter.

#
OpenCodeAgentOptions::OpenCodeAgentOptions

fn OpenCodeAgentOptions::OpenCodeAgentOptions(opencode_path_override? :
Path
, config? : Map[String, Json], resume_thread_id? : String, model? : String, agent? : String, variant? : String, title? : String, thinking? : Bool, extra_env? : Map[String, String]) -> OpenCodeAgentOptions

Creates OpenCode adapter options with the CLI SDK's defaults.

#
opencode_agent

Creates a coding agent backed by the provider-neutral OpenCode CLI factory.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io