Public declaration syntax from harness-sdk/src/settings.rs Original source SHA-256: c4b8dafe6af6911f1e2df6ce2bffedc8f7afb5b3fd58c78ce1a42d1e7dcbda07 Function bodies and constant values are omitted. This is not the complete implementation. Source line 35 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum ProviderKind { /// Local / remote Flocks engine — drives an underlying coding CLI /// (Claude Code, Codex, Gemini-CLI, etc.) which talks to a model. Flocks, /// Foundry inference gateway — vendor-agnostic, routes to many /// upstreams. Foundry, /// Forge ANVIL agent — direct provider integration (e.g., /// Anthropic, OpenAI, Google) bound to an OAS-identified agent. Forge, /// Direct provider integration without a routing layer. Direct, } Source line 52 #[must_use] pub fn label(self) -> &'static str; Source line 64 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProviderInfo { /// Stable identifier (used to apply selection back to the adapter). pub id: String, /// User-visible name. pub name: String, /// Source category. pub kind: ProviderKind, /// One-line description shown in the palette. pub description: String, /// Whether the provider is currently reachable / authenticated. pub healthy: bool, /// `true` when this is the currently-selected provider. pub active: bool } Source line 81 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ModelInfo { /// Stable identifier scoped to its provider. pub id: String, /// User-visible name (e.g. `"Claude Opus 4.7"`). pub name: String, /// Provider that hosts this model. pub provider_id: String, /// Optional context window in tokens. pub context_window: Option, /// Optional capability tags ("coding", "vision", "tool-use", …). pub capabilities: Vec, /// `true` when this is the currently-selected model. pub active: bool } Source line 100 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ModeInfo { /// Stable identifier (e.g. `"build"`, `"plan"`, `"read"`, `"auto"`). pub id: String, /// User-visible name. pub name: String, /// Single-sentence summary shown in the palette. pub description: String, /// Default provider when this mode activates. pub default_provider: Option, /// Default model when this mode activates. pub default_model: Option, /// `true` when this is the currently-selected mode. pub active: bool } Source line 120 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProviderSettingField { /// Stable identifier (e.g. `"api_key"`, `"base_url"`, `"timeout_seconds"`). pub id: String, /// User-visible label. pub label: String, /// One-line description. pub description: String, /// Field kind — drives palette rendering + input handling. pub kind: ProviderSettingKind, /// Current value (already redacted for secret fields). pub value: String, /// `true` when the value is sensitive — palette displays as /// `••••••` and the runtime never logs it. pub secret: bool, /// `true` when this field is the primary "selected" entry of an /// enum/picker (e.g. the active Flocks CLI inside the Flocks /// provider's settings). pub active: bool } Source line 143 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "kind", rename_all = "kebab-case")] pub enum ProviderSettingKind { /// Free-form string input (api keys, urls). Text, /// Integer (timeouts, retries, max-tokens). Integer, /// Boolean toggle. Bool, /// Drill-in picker — selecting this opens a sub-page listing /// `options`. Picker { /// Available choices. options: Vec, }, } Source line 160 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProviderSettingOption { pub id: String, pub label: String, pub description: String } Source line 168 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct FlocksCli { /// Stable identifier (e.g. `"claude-code"`, `"codex"`, `"gemini-cli"`). pub id: String, /// User-visible name. pub name: String, /// Path or command resolved by the runtime. pub command: String, /// Models this CLI can drive. pub models: Vec, /// `true` when this CLI is the currently-selected Flocks driver. pub active: bool } Source line 185 #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct SettingsSnapshot { /// Provider catalogue (Flocks / Foundry / Forge / Direct …). pub providers: Vec, /// Mode catalogue (Build / Plan / Auto / Read …). pub modes: Vec, /// Flat list of every model the adapter knows about, *including* /// the models exposed by Flocks CLIs. Each `ModelInfo` carries /// its `provider_id` so the palette can filter by provider. /// Adapters that only support Flocks may leave this empty and /// rely on `flocks_clis` instead. #[serde(default)] pub models: Vec, /// Flocks-CLI catalogue (each CLI carries its own model list). pub flocks_clis: Vec, /// Per-provider configurable fields keyed by `provider_id`. The /// palette renders this as the "Settings" tab on each provider's /// drill-in. Adapters typically populate this from Forge's /// `ProviderSettings` introspection. #[serde(default)] pub provider_settings: std::collections::HashMap> } Source line 211 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "kind", rename_all = "kebab-case")] pub enum SettingsAction { /// Swap to a different provider. Adapter is expected to re-route /// future `send_message` calls. SetProvider { provider_id: String }, /// Swap to a model on the currently-active provider. SetModel { provider_id: String, model_id: String, }, /// Activate a mode (which may in turn change provider+model). SetMode { mode_id: String }, /// Configure Flocks to drive a specific CLI. SetFlocksCli { cli_id: String }, /// Configure a model for a specific Flocks CLI. SetFlocksCliModel { cli_id: String, model_id: String }, /// Update a provider configuration field (api key, base URL, /// timeout, etc.). The adapter validates the value and may /// reject it via [`SettingsApplyResult::fail`]. SetProviderSetting { provider_id: String, field_id: String, value: String, }, /// Open a settings sub-page that the adapter may want to handle /// out-of-band (e.g. opening an external editor). OpenSubPage { page_id: String }, } Source line 241 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SettingsApplyResult { /// Whether the action succeeded. pub ok: bool, /// Optional human-readable status message (shown as a flash). pub message: Option } Source line 251 #[must_use] pub fn ok() -> Self; Source line 260 #[must_use] pub fn ok_with(message: impl Into) -> Self; Source line 269 #[must_use] pub fn fail(message: impl Into) -> Self;