router

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 102 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecTrackPaths

func ExecTrackPaths(frontendDirectory string) (channel, directory string)

ExecTrackPaths names the session-private request FIFO that receives segment requests and the directory where the router creates per-command files.

func HasModelOverride

func HasModelOverride(args []string) bool

HasModelOverride distinguishes a user's model selection from an automatic launch default, without interpreting option operands or prompt text.

func PrintUsage

func PrintUsage(w io.Writer)

PrintUsage describes the session-only launch interface.

func ProviderModelCatalog

func ProviderModelCatalog(body []byte, session Session) ([]byte, error)

ProviderModelCatalog adds only configured providers to the private catalog. It rebuilds cached provider entries from a native v2 template, preserving other models and Codex’s evolving instruction and executor metadata.

func RunOwnedToolPluginWorker

func RunOwnedToolPluginWorker(ctx context.Context, argv0 string, args []string, stdin *os.File, stdout, stderr io.Writer) (bool, int)

RunToolPluginWorker handles the private child-process mode used by a stable contributed-tool frontend.

func RunPostCompactHook

func RunPostCompactHook(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) int

RunPostCompactHook implements Codex's context-injecting SessionStart hook, not PostCompact (which does not accept additionalContext). Codex owns when it runs and records its output; no router request or model round trip is needed.

func RunSession

func RunSession(ctx context.Context, args []string, issues *CriticalErrors, ready func(Session), artifacts func([]string)) (runErr error)

RunSession owns the private router for one wrapped Codex process. artifacts receives retained debug paths at completion, even if startup was canceled.

func RunSessionCorpusInspection

func RunSessionCorpusInspection(ctx context.Context, args []string, stdout, stderr io.Writer) int

RunSessionCorpusInspection is read-only. Counts are per rollout: inherited calls in forks are not summed into an invented global workload.

func RunSessionInspection

func RunSessionInspection(ctx context.Context, args []string, stdout, stderr io.Writer) int

RunSessionInspection is an offline, read-only entry point. It deliberately does not open the writable replay store or install a router/runtime.

func RunSessionUIReplay

func RunSessionUIReplay(ctx context.Context, args []string, stdin, stdout, stderr *os.File) (code int)

RunSessionUIReplay is an offline entry point. It shares the native presenter, but constructs no host, upstream connection, execution capability, or store.

func RunStorageInspection

func RunStorageInspection(ctx context.Context, args []string, stdout, stderr io.Writer) int

RunStorageInspection reads only an explicitly selected retained call or object. It does not open the writable store, acquire/create locks, scan other sessions, alter permissions or execute retained inputs.

func RunToolPluginWorker

func RunToolPluginWorker(
	ctx context.Context,
	argv0 string,
	args []string,
	stdin *os.File,
	stdout, stderr io.Writer,
) (bool, int)

func SplitCommand

func SplitCommand(args []string) (routerArgs, command []string, err error)

SplitCommand parses router flags without consuming the following command or its arguments.

func StartAppServerUI

func StartAppServerUI(ctx context.Context, cmd *exec.Cmd, stdin, stdout *os.File, resumeThread string, resumeArgv []string, approvals bool) (func() error, error)

StartAppServerUI starts the native terminal frontend without router observers. Codex app-server owns execution; the launcher still owns routing, environment, invocation-local configuration and cancellation.

Types

type CriticalErrors

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

CriticalErrors retains bounded, actionable session notices with complete error text, but no request snapshots or operational event history. It outlives router shutdown so the launcher can report notices that could not reach Codex.

func NewCriticalErrors

func NewCriticalErrors() *CriticalErrors

func (*CriticalErrors) Pending

func (c *CriticalErrors) Pending() []string

Pending is called after the router has stopped, outside Codex's terminal UI.

type OpenCodeConfig

type OpenCodeConfig struct {
	Go  OpenCodeServiceConfig `toml:"opencode_go"`
	Zen OpenCodeServiceConfig `toml:"opencode_zen"`
	// contains filtered or unexported fields
}

OpenCodeConfig enables each independently authenticated service when its key is nonempty. It is invocation-local; loading never writes user configuration.

func (OpenCodeConfig) DefaultModel

func (c OpenCodeConfig) DefaultModel() string

DefaultModel picks a stable available model from the first authenticated service. An explicit invocation model always takes precedence.

func (OpenCodeConfig) Enabled

func (c OpenCodeConfig) Enabled() bool

type OpenCodeServiceConfig

type OpenCodeServiceConfig struct {
	APIKey string `toml:"api_key"`
}

type Session

type Session struct {
	BaseURL                string
	JournalEnabled         bool
	PostCompactRecovery    bool
	VCSGuard               bool
	GrokEnabled            bool
	GrokUnprefixed         bool
	ThirdPartyOnly         bool
	OpenCode               OpenCodeConfig
	AXReadOutput           string
	SkillsManagerAvailable bool
	// StartAppUI starts the UI and returns its joined lifetime.
	// VCSGuard controls remote-write prompts independently of Codex policy.
	StartAppUI           func(ctx context.Context, cmd *exec.Cmd, stdin, stdout *os.File, resumeThread string, resumeArgv []string, approvals bool) (func() error, error)
	StartHeadless        func(context.Context, *exec.Cmd, io.Reader, io.Writer) (func() error, error)
	FrontendDirectory    string
	NativeTraceDirectory string
}

Session is available only after initialization and listener binding succeed.

Source Files

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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