Skip to content

Add config option type for boolean on/off toggles#576

Open
fscarponi wants to merge 1 commit intoagentclientprotocol:mainfrom
fscarponi:fabrizio.scarponi/flag-config-option
Open

Add config option type for boolean on/off toggles#576
fscarponi wants to merge 1 commit intoagentclientprotocol:mainfrom
fscarponi:fabrizio.scarponi/flag-config-option

Conversation

@fscarponi
Copy link
Contributor

@fscarponi fscarponi commented Feb 24, 2026

#541 implementation

This PR adds a new boolean type to session configuration options, enabling agents to expose simple ON/OFF toggles (e.g., "Brave Mode", "Read Only", "Produce Report") as first-class config options alongside the existing select type.

All new types are gated behind the unstable_boolean_config feature flag, so they can be iterated on without breaking the stable API.

Motivation

The current select config option type works well for choosing between multiple values (models, modes, reasoning levels), but it doesn't naturally cover the use case of a simple on/off toggle. Without a dedicated boolean type, clients would need custom, non-agnostic logic to distinguish boolean toggles from regular selectors — defeating the purpose of a standardized protocol.

A dedicated boolean type allows clients to natively render toggle switches or checkboxes without guessing.

Changes

Rust schema (src/agent.rs) — gated behind #[cfg(feature = "unstable_boolean_config")]:

  • Added SessionConfigBoolean struct with a current_value: bool field
  • Added Boolean(SessionConfigBoolean) variant to SessionConfigKind (discriminated via "type": "boolean")
  • Added boolean() convenience constructor on SessionConfigOption

Always available (backward compatible, no-op when no boolean options exist):

  • Added SessionConfigOptionValue enum (#[serde(untagged)]: String | Bool) to support both string and boolean values in SetSessionConfigOptionRequest
  • Added From impls (SessionConfigValueId, bool, &str) for ergonomic construction
  • The SetSessionConfigOptionRequest.value field type changed from SessionConfigValueId to SessionConfigOptionValue — source-compatible for existing callers thanks to From impls

Feature flag (Cargo.toml):

  • Added unstable_boolean_config feature, included in the unstable meta-feature

Documentation (docs/protocol/session-config-options.mdx):

  • Added "Boolean Options" section documenting the new type
  • Added a brave_mode boolean example to the Initial State JSON
  • Updated the session/set_config_option parameter docs to reflect string | boolean value type

RFD (docs/rfds/flag-config-option.mdx):

  • Included RFD document describing the motivation, proposal, and FAQ

Generated schemas:

  • schema.json — stable, does not include boolean type
  • schema.unstable.json — includes boolean type
  • All derived files regenerated via npm run generate

Wire compatibility

  • Fully backward-compatible. SessionConfigOptionValue uses #[serde(untagged)], so existing JSON payloads with string values continue to deserialize correctly. The new boolean variant is additive and only available when the unstable feature is enabled.

Verification

  • cargo clippy (no features) — no warnings
  • cargo clippy --all-features — no warnings
  • cargo test — 26 tests + 2 doctests pass (stable)
  • cargo test --all-features — 27 tests + 2 doctests pass (with boolean)
  • npm run generate — schemas regenerated successfully
  • prettier --check . / cargo fmt -- --check — formatting clean

@fscarponi fscarponi requested a review from a team as a code owner February 24, 2026 14:00
@fscarponi fscarponi changed the title Add flag config option type for boolean on/off toggles Add config option type for boolean on/off toggles Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant