Skip to main content

Module api_onboard

Module api_onboard 

Source
Expand description

Onboard catalog endpoint — exposes the model_provider + model catalog the CLI wizard already uses, so the dashboard’s “+ Add model_provider” affordance and model-picker dropdown share the same source of truth as the CLI.

No catalog data is hand-maintained at this layer. list_model_providers() lives in zeroclaw-providers and is the canonical list; list_models() per model_provider fetches from models.dev (cached) or the model_provider’s own /models endpoint. Same code paths as the CLI wizard.

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.
CatalogModelProvider
CatalogResponse
ModelsQuery
ModelsResponse
OnboardRepairItem
OnboardStatusResponse
PickerItem
PickerResponse
SectionInfo
SectionItemPath
SectionPath
SectionSelectBody
POST /api/onboard/sections/<section>/items/<key> — instantiate the selected item in the live config (idempotent) and return the dotted prefix the frontend should fetch fields under.
SectionsResponse
SelectItemResponse

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_onboard_status
Pure derivation of the onboard-status response from a config snapshot. needs_onboarding 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/onboard/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/onboard/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/onboard/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_onboard_status
GET /api/onboard/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. Onboarding is complete iff at least one agent has its model_provider, risk_profile, and runtime_profile bound.
handle_section_picker
GET /api/onboard/sections/<section> — picker items for that section.
handle_section_select
handle_sections
GET /api/onboard/sections — list every top-level config section.