// Package agentconfig defines the secret-free, repository-owned catalog for // external CLI agent providers. It is intentionally separate from the Edge // provider-pool configuration in packages/go/config. package agentconfig const ( SchemaVersion = "1" DefaultProbeTimeoutMS = 10_000 ) // Catalog declares official provider, model, and profile identities. type Catalog struct { Version string `yaml:"version"` Providers []Provider `yaml:"providers"` Models []Model `yaml:"models"` Profiles []Profile `yaml:"profiles"` } // Provider declares one installed CLI family and its non-secret probes. type Provider struct { ID string `yaml:"id"` Command string `yaml:"command"` VersionProbe CommandProbe `yaml:"version_probe"` Authentication AuthenticationProbe `yaml:"authentication"` ModelProbe ModelProbe `yaml:"model_probe,omitempty"` Capabilities []string `yaml:"capabilities"` } // CommandProbe runs a bounded command and records only redacted output. type CommandProbe struct { Args []string `yaml:"args"` TimeoutMS int `yaml:"timeout_ms,omitempty"` } // AuthenticationProbe classifies an external CLI's existing authentication. // A zero exit status is sufficient when SuccessPattern is empty. type AuthenticationProbe struct { Args []string `yaml:"args"` TimeoutMS int `yaml:"timeout_ms,omitempty"` SuccessPattern string `yaml:"success_pattern,omitempty"` UnauthenticatedPattern string `yaml:"unauthenticated_pattern,omitempty"` } // ModelProbe optionally returns one supported model target per output line. // When Args is empty, the validated static model declaration is authoritative. type ModelProbe struct { Args []string `yaml:"args,omitempty"` TimeoutMS int `yaml:"timeout_ms,omitempty"` } // Model maps an official model ID to one provider-native target. type Model struct { ID string `yaml:"id"` Provider string `yaml:"provider"` Target string `yaml:"target"` } // Profile binds one official provider/model pair to the common CLI runtime. type Profile struct { ID string `yaml:"id"` Provider string `yaml:"provider"` Model string `yaml:"model"` Args []string `yaml:"args"` ResumeArgs []string `yaml:"resume_args,omitempty"` Env []string `yaml:"env,omitempty"` Mode string `yaml:"mode,omitempty"` OutputFormat string `yaml:"output_format,omitempty"` Persistent bool `yaml:"persistent,omitempty"` Terminal bool `yaml:"terminal,omitempty"` ResponseIdleTimeoutMS int `yaml:"response_idle_timeout_ms,omitempty"` StartupIdleTimeoutMS int `yaml:"startup_idle_timeout_ms,omitempty"` MaxConcurrency int `yaml:"max_concurrency,omitempty"` Capabilities []string `yaml:"capabilities"` } // ResolvedProfile is the validated provider/model/profile triple consumed by a // runtime factory. type ResolvedProfile struct { Provider Provider Model Model Profile Profile } // ResolveProfile returns the official identity triple for a profile. func (c Catalog) ResolveProfile(profileID string) (ResolvedProfile, bool) { var resolved ResolvedProfile for _, profile := range c.Profiles { if profile.ID == profileID { resolved.Profile = profile break } } if resolved.Profile.ID == "" { return ResolvedProfile{}, false } for _, provider := range c.Providers { if provider.ID == resolved.Profile.Provider { resolved.Provider = provider break } } for _, model := range c.Models { if model.ID == resolved.Profile.Model { resolved.Model = model break } } if resolved.Provider.ID == "" || resolved.Model.ID == "" { return ResolvedProfile{}, false } return resolved, true }