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 ¶
- func CombinedText(values []map[string]any) string
- func FinalAnswer(notifications []map[string]any) string
- func ThreadID(result map[string]any) string
- type AppServer
- func (s *AppServer) Close()
- func (s *AppServer) NotificationCount() int
- func (s *AppServer) NotificationsSince(index int) []map[string]any
- func (s *AppServer) Request(method string, params map[string]any, timeout time.Duration) (map[string]any, error)
- func (s *AppServer) Start() error
- func (s *AppServer) WaitNotification(method string, timeout time.Duration, startIndex int) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedText ¶
CombinedText flattens every string value across the notifications (the fallback when there is no structured final-answer phase).
func FinalAnswer ¶
FinalAnswer extracts the agent's final-answer text from a turn's notifications.
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 (*AppServer) Close ¶
func (s *AppServer) Close()
Close interrupts (then kills) the app-server subprocess.
func (*AppServer) NotificationCount ¶
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 ¶
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) 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).