AiSettingsState
State holder behind AiSettingsSection — the ModelManager settings screen the toolkit never shipped one for. Same shape as com.siddharth.kmp.designsystem.ThemeController: a plain class, StateFlow-exposed, testable with fakes in commonTest, bound as a Koin screen-scoped instance by the consuming app.
Provider keys are read/written through getKey/setKey rather than a com.siddharth.kmp.llmchat.SecureKeyStore directly — that type has a different constructor per platform (Android needs a Context), so it can't be built generically in commonMain; the same reason com.siddharth.kmp.llmchat.loadAiProviderConfig takes a plain function instead. Pass keyStore::getKey / keyStore::setKey at the call site.
manifest is caller-supplied because ModelManager itself doesn't expose one (by design — see ModelManifestEntry's KDoc): pass the same list the app gave its ModelManager.
Constructors
Functions
Cancels an in-flight download. ModelManager.download resumes from the .tmp a cancelled transfer leaves behind (surfaced as com.siddharth.kmp.ai.ModelDownloadState.PARTIALLY_DOWNLOADED), so this is a real pause, not a restart-from-zero — no new cancellation plumbing needed, the manager already tears down its resumable state on any interruption.
Saves (or, when apiKey is null/blank, clears) the key for providerId.
Starts (or resumes) downloading modelId in this state's own scope. licenseAcknowledged must be true for a model whose OnDeviceModelRow.requiresLicenseAck is true — see ModelManager.download.
Runs one real completion against providerId's saved key and records the typed AiFailure if it fails — so a wrong key reads "unauthorized" here instead of an empty reply three screens later.