LLeMbas for Android 0.1.0 (alpha, unreleased): the first commit
CI / check (push) Canceled after 0s

A native client for a LLeMbas instance on the server's /api/v2, and the
phone's digital assistant.

- Sign in by device code; the token sealed in the Android Keystore; several
  instances.
- Chats and agent chats: the list, a chat with its reply streaming as JSON
  server-sent events (reconnecting, whole blocks), thinking, tool calls,
  steered messages, the plan, jobs, stop, edit, regenerate, continue, the
  model, effort and Plan mode, attachments and dictation.
- Cards in a sheet, answered as the page's form says it; first answer wins.
- Notifications through UnifiedPush, no Google services; an approval can be
  answered from its notification.
- The digital assistant: a VoiceInteractionService with its session (a sheet
  over the current app, "Include screen" off by default), a recognition
  service through the instance's speech-to-text, the lock-screen path that
  asks to unlock before sending, a Quick Settings tile and an Ask shortcut.
- Share to LLeMbas; Moria and Shire from the server's tokens; nine
  languages; a self-updater in the `full` flavour, none in `fdroid`.

Generated and pinned from the server, each checked in CI: the theme
(tokens.lock.json), the contract (contract/lock.json, server 2124ba9), the
strings and the icons. Built and tested only on GitHub Actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-10-21 13:44:30 +00:00
commit 4f09bc41bb
96 files changed
+7932

No files matched your search

@@ -0,0 +1,64 @@
package eu.llembas.android
import eu.llembas.android.api.ApiClient
import eu.llembas.android.api.ApiException
import eu.llembas.android.api.CardAnswer
import eu.llembas.android.api.normaliseBase
import kotlinx.coroutines.test.runTest
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Before
import org.junit.Test
class ClientTest {
private lateinit var server: MockWebServer
@Before
fun up() {
server = MockWebServer().apply { start() }
}
@After
fun down() = server.shutdown()
private fun client() = ApiClient(server.url("/").toString().trimEnd('/'), "lmb_test")
@Test
fun anAddressBecomesABase() {
assertEquals("https://llm.example.org", normaliseBase(" llm.example.org/ "))
assertEquals("http://10.1.2.3:8080", normaliseBase("http://10.1.2.3:8080"))
}
@Test
fun everyCallCarriesTheToken() = runTest {
server.enqueue(MockResponse().setBody("""{"api":1,"account":{"name":"Frodo","email":"f@shire.test"}}"""))
assertEquals("Frodo", client().me().account.name)
val request = server.takeRequest()
assertEquals("/api/v2/me", request.path)
assertEquals("Bearer lmb_test", request.getHeader("Authorization"))
}
@Test
fun aRefusalIsTheServersOwnSentence() = runTest {
server.enqueue(MockResponse().setResponseCode(409).setBody("""{"detail":"That question is no longer waiting for an answer."}"""))
try {
client().answer("c", "card", CardAnswer(verdict = "allow"))
fail("a 409 must throw")
} catch (e: ApiException) {
assertEquals(409, e.status)
assertEquals("That question is no longer waiting for an answer.", e.message)
}
}
@Test
fun aCardAnswerIsThePagesFormInJson() = runTest {
server.enqueue(MockResponse().setBody("""{"answered":true}"""))
client().answer("c1", "card1", CardAnswer(choices = mapOf("q0" to listOf("Tea"))))
val body = server.takeRequest().body.readUtf8()
assertTrue(body, body.contains(""""choices":{"q0":["Tea"]}"""))
}
}