Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions internal/engine/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ type Config struct {
// at .cog/run/kernel.log.jsonl. Leave empty for the default.
KernelLogPath string

// Mod3URL is the base URL (scheme + host + port) of the mod3 voice service
// that owns per-channel communication state (voice, output device, queue)
// keyed on kernel-issued session IDs. The kernel forwards channel-session
// registration to this URL; mod3 remains the per-channel state owner while
// the kernel retains identity authority (ADR-082 split).
//
// Default: http://localhost:7860. Override via `mod3_url` in kernel.yaml
// (top-level or under v3:) or via the COGOS_MOD3_URL env var.
Mod3URL string

LocalModel string

localModelConfigured bool
Expand All @@ -99,6 +109,7 @@ type kernelConfigSection struct {
LocalModel string `yaml:"local_model"`
DigestPaths map[string]string `yaml:"digest_paths"`
KernelLogPath string `yaml:"kernel_log_path"`
Mod3URL string `yaml:"mod3_url"`
}

// kernelConfig is the on-disk YAML shape of .cog/config/kernel.yaml.
Expand Down Expand Up @@ -137,6 +148,7 @@ func LoadConfig(workspaceRoot string, port int) (*Config, error) {
ToolCallValidationEnabled: true,
LocalModel: defaultOllamaModel,
DigestPaths: make(map[string]string),
Mod3URL: "http://localhost:7860",
}

// Load from file if present.
Expand All @@ -150,6 +162,12 @@ func LoadConfig(workspaceRoot string, port int) (*Config, error) {
}
}

// Env override for the mod3 URL. Env wins over file; flags stay flag-only
// (we don't surface `--mod3-url` in CLI; one env var + YAML is enough).
if v := os.Getenv("COGOS_MOD3_URL"); v != "" {
cfg.Mod3URL = v
}

// Flag override.
if port != 0 {
cfg.Port = port
Expand Down Expand Up @@ -211,6 +229,9 @@ func applyKernelSection(cfg *Config, s kernelConfigSection) {
if s.KernelLogPath != "" {
cfg.KernelLogPath = s.KernelLogPath
}
if s.Mod3URL != "" {
cfg.Mod3URL = s.Mod3URL
}
}

// findWorkspaceRoot walks up from dir until it finds a directory containing a
Expand Down
Loading
Loading