exampleutil

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentCodex     = "codex"
	AgentClaude    = "claude"
	AgentCursor    = "cursor"
	AgentCodebuddy = "codebuddy"
)

Variables

This section is empty.

Functions

func AGUIExamplePolicy

func AGUIExamplePolicy() adaptor.SharedOption

AGUIExamplePolicy returns the policy option appropriate for the resolved AG-UI agent driver:

  • claude: enable interactive PlanReview + Question approvals. Permission stays auto-approve because the demo has no host-side tool executor; the CLI would hang on Bash/Edit/Write waiting for a tool_result otherwise.
  • codex/cursor/codebuddy: skip approvals & questions by default so the demo can run end-to-end on the local CLI.

It is a SharedOption, so it can seed adaptor.New (as here) or override a single Run/Stream call.

func Check

func Check(condition bool, format string, args ...any)

func CommandEnvForAgent

func CommandEnvForAgent(agent string) string

func CommandSummary

func CommandSummary(cfg LiveAgentConfig) map[string]any

func DefaultCommandForAgent

func DefaultCommandForAgent(agent string) string

func DefaultModelForAgent

func DefaultModelForAgent(agent string) string

func DiscoverHealthyAgentCommand

func DiscoverHealthyAgentCommand(agent, override string) (string, string, bool)

func DriverTypeForAgent

func DriverTypeForAgent(agent string) string

func EnsureWindowsProcessEnv

func EnsureWindowsProcessEnv(base []string) []string

func Fatalf

func Fatalf(format string, args ...any)

func LiveAgentSummary

func LiveAgentSummary(cfg LiveAgentConfig) map[string]any

func ModelEnvForAgent

func ModelEnvForAgent(agent string) string

func Must

func Must(err error, format string, args ...any)

func NewAGUIStreamingAgent

func NewAGUIStreamingAgent(cwd string) (*adaptor.Agent, string)

NewAGUIStreamingAgent builds the Agent used by web-chat/aguiclient and web-chat/copilotkit. The returned string is the resolved driver name.

v1 shape: one adaptor.New call taking the driver value plus agent-level defaults. WithThreadStore is what makes agent.Thread(key) work — the AG-UI frontend always sends threadId, and the bridge turns it into a thread key.

func NewLiveDriver

func NewLiveDriver(cfg LiveAgentConfig) driver.Driver

NewLiveDriver builds a driver value for the resolved local CLI. The four built-in packages all expose the same one-line shape — codex.Driver(codex.Config{...}) — so the example helper is just a switch over which Config type to fill.

func NonInteractive

func NonInteractive(agent string, sandbox adaptor.SandboxLevel) adaptor.SharedOption

NonInteractive returns the policy as a SharedOption, so the same value works as an adaptor.New default and as a per-call Run/Stream override.

func NonInteractivePolicy

func NonInteractivePolicy(agent string, sandbox adaptor.SandboxLevel) adaptor.Policy

NonInteractivePolicy combines portable unattended approval routing with the requested sandbox when the selected Driver advertises isolation. A non-zero unsupported policy is rejected before launch, so sandbox remains inherited for providers that do not expose an isolation control.

func PrintJSON

func PrintJSON(value any)

func ProbeAgentCommand

func ProbeAgentCommand(command string) bool

func RequireHealthyAgentCommand

func RequireHealthyAgentCommand(agent, override string) (string, string)

func ResolveAGUIAgent

func ResolveAGUIAgent() string

ResolveAGUIAgent returns the driver name for AG-UI streaming examples. Env AGUI_AGENT (or first positional override via scripts): "codex" | "claude" | "cursor". Default is codex. Unknown values abort the example process.

func ResolveAgentModel

func ResolveAgentModel(agent, override string) string

func ResolveLiveAgent

func ResolveLiveAgent(raw string) string

func SupportedAgents

func SupportedAgents() string

func WrapCommandForPlatform

func WrapCommandForPlatform(command string, args []string) (string, []string)

Types

type LiveAgentConfig

type LiveAgentConfig struct {
	Agent       string
	DriverType  string
	Model       string
	Command     string
	CommandNote string
	CWD         string
	Env         []driver.EnvBinding
	ExtraArgs   []string
}

LiveAgentConfig is the resolved local-CLI agent configuration shared by the examples. Command is always a runnable binary discovered from PATH, a provider-specific env var, or an explicit -command flag.

func ResolveLiveAgentConfig

func ResolveLiveAgentConfig(rawAgent, rawModel, rawCommand, cwd string) LiveAgentConfig

Jump to

Keyboard shortcuts

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