ai-app: a phone interface to Claude Code and llama.cpp sessions
A Rust backend that owns the sessions and an Android app that reads them. The server spawns and adopts CLI processes, normalises everything they emit into one event model, keeps the transcript, and serves it over pinned TLS on a WireGuard interface; the phone streams that, replies, sends images, and imports conversations the machine already has. `AGENTS.md` is the working guide -- what runs where, what has been measured, and the faults that were expensive to find. `PLAN.md` is the design record. History before this point was squashed away. It was a personal project's running commentary and carried a name and a couple of machine paths that have no business in a public repository; the tree is what mattered and the tree is here.
This commit is contained in:
commit
b172c464ea
100 files changed
+31795
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package com.example.aiapp
|
||||
|
||||
/**
|
||||
* What a screen knows about something it had to fetch: still finding out, got it, or couldn't.
|
||||
*
|
||||
* Three states rather than a value alongside a nullable error, because "we couldn't find out" must
|
||||
* not share a representation with "there is nothing" -- a failed fetch would otherwise render as an
|
||||
* empty list, which is the one wrong answer that looks like a right one.
|
||||
*
|
||||
* [Loading] and [Error] carry no payload, so they are `LoadState<Nothing>` and this is covariant in
|
||||
* [T]: one `LoadState.Loading` serves every screen rather than each needing its own.
|
||||
*/
|
||||
sealed class LoadState<out T> {
|
||||
data object Loading : LoadState<Nothing>()
|
||||
|
||||
data class Loaded<out T>(val value: T) : LoadState<T>()
|
||||
|
||||
data class Error(val message: String) : LoadState<Nothing>()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The failure a fetch produces. Api.kt writes its messages to be read on this screen, so
|
||||
* this passes one through rather than replacing it; the fallback covers only a throwable
|
||||
* with no message at all, which [ApiException] never is.
|
||||
*/
|
||||
fun failed(e: ApiException): Error = Error(e.message ?: "Unknown error")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user