Documentation
¶
Index ¶
Constants ¶
const ( EnvModel = "YOTTACODE_MODEL" EnvBaseURL = "YOTTACODE_BASE_URL" EnvAPIKey = "YOTTACODE_API_KEY" EnvAllowPaths = "YOTTACODE_ALLOW_PATHS" EnvProvider = "YOTTACODE_PROVIDER" EnvReasoningEffort = "YOTTACODE_REASONING_EFFORT" EnvEnableWebSearch = "YOTTACODE_ENABLE_WEB_SEARCH" EnvDisableWebSearch = "YOTTACODE_DISABLE_WEB_SEARCH" EnvEnableXSearch = "YOTTACODE_ENABLE_X_SEARCH" EnvEnableCodeInterpreter = "YOTTACODE_ENABLE_CODE_INTERPRETER" EnvSearchAllowedDomains = "YOTTACODE_SEARCH_ALLOWED_DOMAINS" EnvSearchExcludedDomains = "YOTTACODE_SEARCH_EXCLUDED_DOMAINS" EnvXSearchAllowedHandles = "YOTTACODE_X_SEARCH_ALLOWED_HANDLES" EnvXSearchExcludedHandles = "YOTTACODE_X_SEARCH_EXCLUDED_HANDLES" EnvXSearchFromDate = "YOTTACODE_X_SEARCH_FROM_DATE" EnvXSearchToDate = "YOTTACODE_X_SEARCH_TO_DATE" )
Env var names that back the flags. Exported so tests and the TUI splash can reference them without hand-typing the strings.
Variables ¶
This section is empty.
Functions ¶
func BuildRouter ¶
BuildRouter returns a multi-provider router as adapter.Client when cfg.Router.Enabled, otherwise returns (nil, nil) to signal "use the single-adapter dispatch path." Errors only on misconfiguration that Validate didn't catch (e.g., an env-backed API key is missing at runtime even though api_key_env was declared).
Each candidate's adapter is built via adapter.NewWithConfig with the same builtin-tool / search flags that the primary adapter would have received. Capability gating across heterogeneous providers is a Phase 2 concern; the first candidate's profile is the representative one returned by router.Profile().
func Resolve ¶
func Resolve(opts *ChatOptions) error
Resolve fills empty fields from environment variables and configured provider profiles, then errors out when required config (model, base URL) is still missing.
Resolution order, lowest precedence first:
- Configured provider profile (from ~/.yottacode/config.toml)
- Generic env vars (YOTTACODE_MODEL / _BASE_URL / _API_KEY)
- CLI flags (already populated on opts when this is called)
Stated as fill-in-blanks: any field already set on opts wins; an empty field is filled from env, then from the matching profile.
Before reading any env, .env files at ~/.yottacode/.env and <cwd>/.yottacode/.env are loaded into the process environment (cwd wins, OS env always wins over both). This is how API keys reach Resolve without ever living in config.toml.
We deliberately do NOT bake in defaults like qwen3.5:latest or localhost:11434 — silently dialing localhost when the user forgot to set up Ollama is a worse failure mode than a clear "set --model or $YOTTACODE_MODEL" message.
Types ¶
type ChatOptions ¶
type ChatOptions struct {
Model string
BaseURL string
APIKey string
SystemPrompt string
Resume string
// Summarized requests that, when Resume is non-empty, the session
// be loaded with its prior transcript replaced by a structured
// summary (the same path /resume --summarized takes inside the
// TUI). Defaults to false; only the `resume` subcommand sets it.
Summarized bool
// BypassPermissions auto-approves every tool call without prompting.
// DANGEROUS — model-emitted commands run without a human in the loop.
// Explicit `deny` rules in .yottacode/permissions.json are still
// honored, but every other approval gate is skipped. Reserved for
// trusted CI / scripted contexts; never enable in shared shells.
BypassPermissions bool
MaxIterations int
Provider string
ReasoningEffort string
EnableWebSearch bool
DisableWebSearch bool
EnableXSearch bool
EnableCodeInterpreter bool
SearchAllowedDomains string
SearchExcludedDomains string
XSearchAllowedHandles string
XSearchExcludedHandles string
XSearchFromDate string
XSearchToDate string
// AllowPaths is a comma-separated list of additional roots the
// model's filesystem write tools are allowed to mutate, beyond the
// session's cwd. Useful when legitimate work spans sibling repos
// or shared dirs. Empty by default — writes confine to cwd.
AllowPaths string
}
ChatOptions carries the flags the root TUI and `run` subcommand share. Lives in this package because both internal/tui and internal/oneshot consume it.