Skip to main content

Module api_sections

Module api_sections 

Source
Expand description

Curated config-section endpoints. Used by the /config page in the web dashboard to navigate the schema by curated section rather than raw prop paths. OpenAPI is authoritative for the exact route set.

Structs§

AgentOptionsResponse
All alias-reference choices an agent form needs, in one round-trip. Channels and model model_providers are returned in dotted form (telegram.default, anthropic.work); the bundle/profile/namespace lists are bare HashMap keys.
ModelsQuery
SectionItemPath
SectionPath
SectionSelectBody
POST /api/config/sections/<section>/items/<key> — instantiate the selected item in the live config (idempotent) and return the dotted prefix the frontend should fetch fields under.

Functions§

build_agent_options
Build the AgentOptionsResponse from a config snapshot. Pure function so tests can drive the same code path the handler runs without spinning up an AppState.
derive_section_status
Pure derivation of the section status response from a config snapshot. needs_quickstart is false iff at least one enabled [agents.<alias>] block has a resolved model provider with a selected model plus resolved risk/runtime profile refs. A provider without a bound, runnable agent is not a completion signal: chat dispatch still bounces with a setup error in that state.
handle_agent_options
GET /api/config/agent-options — every alias-reference list the agent form needs, derived from the live config. Mirrors the lists the TUI computes locally for its alias pickers.
handle_catalog
GET /api/config/catalog — list every model provider the CLI wizard knows about. The dashboard shows these in the “+ Add model provider” picker so CLI / web stay in sync.
handle_catalog_models
GET /api/config/catalog/models?model_provider=<name> — fetch the model list for one model_provider. Same code path the CLI wizard uses (zeroclaw_providers::create_model_provider(...).list_models()), which goes through the models.dev cached catalog for OpenAI / Anthropic / Gemini, the live /v1/models endpoint for OpenRouter, etc.
handle_section_picker
GET /api/config/sections/<section> — picker items for that section.
handle_section_select
handle_section_status
GET /api/config/status — boolean signal for the dashboard’s fresh-install redirect. The daemon writes a default config.toml on first init, so file existence isn’t a useful “is the user new?” check. Section status: ready iff at least one agent has its model_provider, risk_profile, and runtime_profile bound.
handle_sections
GET /api/config/sections — list every top-level config section.