Contract at server dev 4a98af3: /api/v2/me pinned (me.json)
CI / check (push) Canceled after 0s

The server added the `me.json` fixture (c51722b), built by the route's own
serialiser. The app's language and the assistant's speech services now
read through `Me`'s named facts -- `accountLanguage` (null when unsaid, so
a kept answer stands), `speechToText` (null when unsaid: the assistant
then still tries the instance), `hasSpeechToText`, `hasTextToSpeech` --
and ContractTest holds them to the fixture.

Strings regenerated at the same ref: the subagent states and the tree's
context line are in the server's catalogues now (sk 355/358).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 10:16:30 +00:00
1 parent e8d8236530
commit 73e753ab57
14 files changed
+114 -8

No files matched your search

@@ -169,7 +169,7 @@ class MainActivity : ComponentActivity() {
// otherwise. Read once per instance in use; kept, so the next start has it at once.
LaunchedEffect(instance.id) {
runCatching { lembas.instances.clientFor(instance).me() }.onSuccess { me ->
if (me.language.isNotBlank()) lembas.instances.savePrefs { it.copy(accountLanguage = me.language) }
me.accountLanguage?.let { language -> lembas.instances.savePrefs { it.copy(accountLanguage = language) } }
}
}
// The list is read again each time the drawer opens, so a new title or a finished
@@ -72,7 +72,24 @@ data class Me(
@SerialName("default_model") val defaultModel: String? = null,
val permissions: Map<String, Boolean> = emptyMap(),
val services: Map<String, Boolean> = emptyMap(),
)
) {
/**
* The language the app follows by default (`i18n.for_user`: the account's choice, else the
* instance's); null when the server said none, so a kept earlier answer stands.
*/
val accountLanguage: String? get() = language.ifBlank { null }
/**
* The instance's speech-to-text, through the server (the assistant's LLeMbas voice input):
* true or false as the server said it, null when it did not say.
*/
val speechToText: Boolean? get() = services["stt"]
val hasSpeechToText: Boolean get() = speechToText == true
/** The instance's text-to-speech (the assistant's voice reply, Read aloud). */
val hasTextToSpeech: Boolean get() = services["tts"] == true
}
@Serializable
data class ModelInfo(
@@ -147,7 +147,7 @@ class AssistController(private val context: Context, private val scope: Coroutin
try {
val me = api.me()
val models = api.models()
stt = me.services["stt"]
stt = me.speechToText
val chosen = prefs.assistantModel.takeIf { id -> models.any { it.id == id } }
?: me.defaultModel?.takeIf { id -> models.any { it.id == id } }
?: models.firstOrNull { it.default }?.id
@@ -157,8 +157,8 @@ class AssistController(private val context: Context, private val scope: Coroutin
connection = Connection.Online,
models = models,
modelId = it.modelId ?: chosen,
canSpeak = me.services["tts"] == true,
canListen = me.services["stt"] == true || PhoneRecognizer.available(context),
canSpeak = me.hasTextToSpeech,
canListen = me.hasSpeechToText || PhoneRecognizer.available(context),
)
}
} catch (e: Exception) {