codexapp

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package codexapp drives a real Codex CLI app-server over JSON-RPC (stdio) and parses its output. It is the reusable "run a real Codex turn from Go" adapter — an external-tool integration with zero knowledge of mnemon's governance, the autopilot, or any demo. It depends only on the standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombinedText

func CombinedText(values []map[string]any) string

CombinedText flattens every string value across the notifications (the fallback when there is no structured final-answer phase).

func FinalAnswer

func FinalAnswer(notifications []map[string]any) string

FinalAnswer extracts the agent's final-answer text from a turn's notifications.

func ThreadID

func ThreadID(result map[string]any) string

ThreadID extracts the thread id from a thread/start result.

Types

type AppServer

type AppServer struct {
	// contains filtered or unexported fields
}

AppServer is a running `codex app-server` process spoken to over JSON-RPC on stdio. It is driven from a SINGLE goroutine (request/waitNotification drain the same message channel); callers must not invoke its methods concurrently.

func New

func New(command, cwd string) *AppServer

New returns an unstarted AppServer that will launch `command app-server` in cwd.

func (*AppServer) Close

func (s *AppServer) Close()

Close interrupts (then kills) the app-server subprocess.

func (*AppServer) NotificationCount

func (s *AppServer) NotificationCount() int

NotificationCount returns the number of notifications received so far (the cursor a caller passes to NotificationsSince/WaitNotification to scope to events after an action).

func (*AppServer) NotificationsSince

func (s *AppServer) NotificationsSince(index int) []map[string]any

NotificationsSince returns a copy of the notifications received after index.

func (*AppServer) Request

func (s *AppServer) Request(method string, params map[string]any, timeout time.Duration) (map[string]any, error)

Request sends a JSON-RPC request and waits up to timeout for its response.

func (*AppServer) Start

func (s *AppServer) Start() error

Start launches the app-server subprocess and begins reading its stdio.

func (*AppServer) WaitNotification

func (s *AppServer) WaitNotification(method string, timeout time.Duration, startIndex int) (map[string]any, error)

WaitNotification waits up to timeout for a notification with the given method, starting from startIndex into the notification log (use NotificationCount before the action that triggers it).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL