# Orchestrator Extensions Configuration Fragment

[[elements]]
border_bottom = false
border_top = true
name = "extensions_section_header"
title = "🔌 Extensions Configuration"
type = "section_header"

# Extension Auto-Loading
[[elements]]
default = false
help = "Automatically load extensions from registry at startup"
name = "auto_load_extensions"
nickel_path = ["orchestrator", "extensions", "auto_load"]
prompt = "Auto-Load Extensions"
type = "confirm"

# OCI Registry Configuration (conditional on auto-load)
[[elements]]
condition = "auto_load_extensions == true"
default = "http://localhost:5000"
help = "OCI registry URL for discovering extensions (e.g., http://harbor:5000)"
name = "oci_registry_url"
nickel_path = ["orchestrator", "extensions", "oci_registry_url"]
prompt = "OCI Registry URL"
required = true
type = "text"

[[elements]]
condition = "auto_load_extensions == true"
default = "provisioning"
help = "Namespace/project in OCI registry for extensions"
name = "oci_namespace"
nickel_path = ["orchestrator", "extensions", "oci_namespace"]
prompt = "OCI Namespace"
required = true
type = "text"

[[elements]]
condition = "auto_load_extensions == true"
default = ""
help = "OCI registry authentication username (leave empty for anonymous)"
name = "oci_registry_username"
nickel_path = ["orchestrator", "extensions", "oci_registry_username"]
prompt = "OCI Registry Username"
type = "text"

[[elements]]
condition = "auto_load_extensions == true"
default = ""
help = "OCI registry authentication password (leave empty for anonymous)"
name = "oci_registry_password"
nickel_path = ["orchestrator", "extensions", "oci_registry_password"]
prompt = "OCI Registry Password"
type = "password"

# Extension Discovery Configuration
[[elements]]
condition = "auto_load_extensions == true"
default = 3600
help = "Extension discovery interval in seconds (range: 300-86400)"
max = 86400
min = 300
name = "extensions_discovery_interval"
nickel_path = ["orchestrator", "extensions", "discovery_interval_seconds"]
prompt = "Discovery Interval (seconds)"
type = "number"

[[elements]]
condition = "auto_load_extensions == true"
default = 5
help = "Maximum number of concurrent extension loads (range: ${constraint.orchestrator.extensions.max_concurrent.min}-${constraint.orchestrator.extensions.max_concurrent.max})"
max = "${constraint.orchestrator.extensions.max_concurrent.max}"
min = "${constraint.orchestrator.extensions.max_concurrent.min}"
name = "extensions_max_concurrent"
nickel_path = ["orchestrator", "extensions", "max_concurrent"]
prompt = "Max Concurrent Extensions"
type = "number"

# Extension Execution Settings
[[elements]]
condition = "auto_load_extensions == true"
default = 30000
help = "Timeout for extension initialization in milliseconds (range: 1000-300000)"
max = 300000
min = 1000
name = "extensions_init_timeout"
nickel_path = ["orchestrator", "extensions", "init_timeout_ms"]
prompt = "Init Timeout (ms)"
type = "number"

[[elements]]
condition = "auto_load_extensions == true"
default = false
help = "Enable sandboxed execution for untrusted extensions"
name = "extensions_sandbox_enabled"
nickel_path = ["orchestrator", "extensions", "sandbox", "enabled"]
prompt = "Enable Sandbox Mode"
type = "confirm"

[[elements]]
condition = "auto_load_extensions == true && extensions_sandbox_enabled == true"
default = true
help = "Restrict network access for sandboxed extensions"
name = "extensions_sandbox_restrict_network"
nickel_path = ["orchestrator", "extensions", "sandbox", "restrict_network"]
prompt = "Restrict Network Access"
type = "confirm"

[[elements]]
condition = "auto_load_extensions == true && extensions_sandbox_enabled == true"
default = 512
help = "Maximum memory for sandboxed extension in MB (range: 64-4096)"
max = 4096
min = 64
name = "extensions_sandbox_max_memory_mb"
nickel_path = ["orchestrator", "extensions", "sandbox", "max_memory_mb"]
prompt = "Max Memory (MB)"
type = "number"

[[elements]]
condition = "auto_load_extensions == true && extensions_sandbox_enabled == true"
default = 1
help = "Maximum CPU cores for sandboxed extension"
max = 8
min = 0.1
name = "extensions_sandbox_max_cpu"
nickel_path = ["orchestrator", "extensions", "sandbox", "max_cpu"]
prompt = "Max CPU Cores"
type = "number"

# Extension Versioning and Compatibility
[[elements]]
condition = "auto_load_extensions == true"
default = true
help = "Enable version compatibility checking"
name = "extensions_version_check_enabled"
nickel_path = ["orchestrator", "extensions", "version_check", "enabled"]
prompt = "Enable Version Check"
type = "confirm"

[[elements]]
condition = "auto_load_extensions == true"
default = false
help = "Allow prerelease/beta extension versions"
name = "extensions_allow_prerelease"
nickel_path = ["orchestrator", "extensions", "allow_prerelease"]
prompt = "Allow Prerelease Versions"
type = "confirm"

# Extension Health Checking
[[elements]]
condition = "auto_load_extensions == true"
default = true
help = "Enable health checks for loaded extensions"
name = "extensions_health_check_enabled"
nickel_path = ["orchestrator", "extensions", "health_check", "enabled"]
prompt = "Enable Health Checks"
type = "confirm"

[[elements]]
condition = "auto_load_extensions == true && extensions_health_check_enabled == true"
default = 30000
help = "Health check interval in milliseconds (range: 5000-300000)"
max = 300000
min = 5000
name = "extensions_health_check_interval"
nickel_path = ["orchestrator", "extensions", "health_check", "interval_ms"]
prompt = "Health Check Interval (ms)"
type = "number"

[[elements]]
condition = "auto_load_extensions == true && extensions_health_check_enabled == true"
default = 3
help = "Number of failed health checks before unloading extension"
max = 10
min = 1
name = "extensions_health_check_failure_threshold"
nickel_path = ["orchestrator", "extensions", "health_check", "failure_threshold"]
prompt = "Failure Threshold"
type = "number"
