Sign in

    workgraph-agent-cli

    Coding-agent nodes for workgraph

    agent
    coding-agent
    graph
    moonbit
    Download zip
    Author
    Version
    0.1.3
    License
    MIT
    Last updated
    2 months ago
    Downloads
    60

    #workgraph-agent-cli

    workgraph-agent-cli provides coding-agent contracts, graph nodes, and session resource management for workgraph-core. The core package remains provider-neutral and exposes only node patches and optional values; coding-agent status, policies, sessions, requests, responses, and identifiers are owned here.

    The package intentionally has no standalone example. Use the runnable workgraph-codex-cli and workgraph-opencode-cli examples to see this node with concrete coding-agent implementations.

    #Package

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

    The module prefers the Wasm/WASI target and supports JavaScript, native, and Wasm/WASI targets. Wasm GC is excluded because moonbitlang/async does not support it.

    CodingAgentSession

    pub(open) trait CodingAgentSession {
    fn id(Self) -> SessionId?
    async fn execute(Self, CodingAgentRequest) -> CodingAgentResponse
    async fn close(Self) -> Unit
    }

    Represents a live provider-specific coding-agent session.

    This trait is open so downstream integrations can provide session implementations for additional coding-agent providers.

    IdError

    pub suberror IdError {
    EmptyId(kind~ : String)
    } derive(
    Debug
    )

    ApprovalPolicy

    pub(all) enum ApprovalPolicy {
    Never
    OnRequest
    OnFailure
    Untrusted
    } derive(Eq,
    Debug
    )

    CodingAgent

    pub struct CodingAgent {
    id : CodingAgentId
    open : async (CodingAgentOpenContext) -> &CodingAgentSession
    }

    CodingAgent::CodingAgent

    Creates a coding-agent adapter.

    CodingAgentId

    pub struct CodingAgentId {
    value : String
    } derive(Eq, Hash,
    Debug
    )

    CodingAgentId::CodingAgentId

    fn CodingAgentId::CodingAgentId(value : String) -> CodingAgentId raise IdError

    CodingAgentId::to_string

    fn CodingAgentId::to_string(self : CodingAgentId) -> String

    CodingAgentNodeSpec

    CodingAgentNodeSpec::CodingAgentNodeSpec

    Creates the callbacks and resource policy used by a coding-agent node.

    CodingAgentOpenContext

    pub struct CodingAgentOpenContext {
    run_id :
    RunId

    task_group :
    TaskGroup
    [Unit]
    workspace : WorkspaceRef
    approval : ApprovalPolicy
    network : NetworkPolicy
    environment :
    HashMap
    [String, String]
    events :
    EventSink

    }

    CodingAgentOpenContext::CodingAgentOpenContext

    Creates the runtime context used to open a coding-agent session.

    CodingAgentRequest

    pub struct CodingAgentRequest {
    instruction : String
    context_files : ReadOnlyArray[
    Path
    ]
    } derive(Eq,
    Debug
    )

    CodingAgentRequest::CodingAgentRequest

    fn CodingAgentRequest::CodingAgentRequest(instruction : String, context_files : ReadOnlyArray[
    Path
    ]) -> CodingAgentRequest

    Creates one coding-agent request.

    CodingAgentResponse

    pub struct CodingAgentResponse {
    status : CodingAgentStatus
    summary : String?
    continuation_id : String?
    changed_files : ReadOnlyArray[
    Path
    ]
    } derive(
    Debug
    )

    CodingAgentResponse::CodingAgentResponse

    fn CodingAgentResponse::CodingAgentResponse(status~ : CodingAgentStatus, summary~ : String?, continuation_id~ : String?, changed_files~ : ReadOnlyArray[
    Path
    ]) -> CodingAgentResponse

    Creates one coding-agent response.

    CodingAgentStatus

    pub(all) enum CodingAgentStatus {
    Succeeded
    Failed
    NeedsApproval
    } derive(Eq,
    Debug
    )

    NetworkPolicy

    pub(all) enum NetworkPolicy {
    Disabled
    Enabled
    } derive(Eq,
    Debug
    )

    SessionId

    pub struct SessionId {
    value : String
    } derive(Eq, Hash,
    Debug
    )

    SessionId::SessionId

    fn SessionId::SessionId(value : String) -> SessionId raise IdError

    SessionId::to_string

    fn SessionId::to_string(self : SessionId) -> String

    WorkspaceRef

    pub struct WorkspaceRef {
    root :
    Path

    additional_writable_roots : ReadOnlyArray[
    Path
    ]
    } derive(Eq,
    Debug
    )

    WorkspaceRef::WorkspaceRef

    fn WorkspaceRef::WorkspaceRef(root :
    Path
    , additional_writable_roots : ReadOnlyArray[
    Path
    ]) -> WorkspaceRef

    Creates a writable workspace description for a coding agent.

    coding_agent_node

    Create a graph node that acquires a coding-agent session, executes a request, and decodes its response.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io