Contract at server dev 3e6f6da: notifications, monitor mode, pinning, parity routes, queued
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
Re-pinned contract/ and the strings at the server's dev 3e6f6da (after f7f2ff2 parity routes,
96240be pinning, 00c209a monitor mode, fd0a386 scheduled-result notifications, a8a3733
progress gaps).
- Message.progress: a queued prompt draws the server's queued line ("2 ahead · 12s").
loading_model and reading_prompt's tokens were already drawn (Progress.kt).
- Schedule.watch / ScheduleRun.watch: a watching schedule names its address on its page;
`unchanged` runs are drawn quiet, as Unchanged.
- ScheduleRun.notification parsed (title, body, public, actions, labels) for the push work.
- The schedules frame's version hash moved (ScheduleContractTest).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
36 files changed
+571
-15
No files matched your search
@@ -412,6 +412,8 @@ data class Message(
|
||||
val steps: List<Step> = emptyList(),
|
||||
val plan: JsonObject? = null,
|
||||
val metrics: Metrics? = null,
|
||||
/** A prompt queued behind a running reply: `{phase: queued, since, ahead}`; null otherwise. */
|
||||
val progress: Progress? = null,
|
||||
) {
|
||||
val isUser: Boolean get() = role == "user"
|
||||
}
|
||||
|
||||
@@ -63,6 +63,10 @@ data class ScheduleRun(
|
||||
val preview: String = "",
|
||||
val error: RunError? = null,
|
||||
val notified: Boolean = false,
|
||||
/** The notification the server made for this run, when it made one (see [RunNotification]). */
|
||||
val notification: RunNotification? = null,
|
||||
/** A watching schedule's look at its address on this run (`unchanged` when nothing moved). */
|
||||
val watch: RunWatch? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -96,6 +100,8 @@ data class Schedule(
|
||||
@SerialName("chat_id") val chatId: String? = null,
|
||||
@SerialName("fired_count") val firedCount: Int = 0,
|
||||
@SerialName("failure_streak") val failureStreak: Int = 0,
|
||||
/** Monitor mode: what the schedule watches; the model runs only when it changed. */
|
||||
val watch: ScheduleWatch? = null,
|
||||
@SerialName("last_error") val lastError: String? = null,
|
||||
@SerialName("last_run") val lastRun: ScheduleRun? = null,
|
||||
val running: Boolean = false,
|
||||
@@ -171,3 +177,31 @@ data class SchedulingModel(
|
||||
/** `GET`/`PUT /schedules/models`: the models, the instance's order, and the person's narrowing. */
|
||||
@Serializable
|
||||
data class SchedulingModels(val models: List<SchedulingModel> = emptyList(), val instance: List<String> = emptyList(), val mine: List<String> = emptyList())
|
||||
|
||||
/** What a watching schedule looks at before each run: [kind] `url` and the address. */
|
||||
@Serializable
|
||||
data class ScheduleWatch(val kind: String = "", val target: String = "", @SerialName("changed_at") val changedAt: String? = null)
|
||||
|
||||
/** One run's look: whether the address [changed] since the last one, or why the look failed. */
|
||||
@Serializable
|
||||
data class RunWatch(val kind: String = "", val changed: Boolean = false, val first: Boolean = false, val bytes: Long = 0, val error: String? = null)
|
||||
|
||||
/** The lock-screen half of a [RunNotification]: the task's name and Finished / Failed only. */
|
||||
@Serializable
|
||||
data class PublicNotice(val title: String = "", val body: String = "")
|
||||
|
||||
/**
|
||||
* A scheduled run's notification as the server wrote it, in the owner's language: [title] (the
|
||||
* task's name) and [body] (the result's first lines) for an unlocked phone, [public] for the
|
||||
* lock screen, and [actions] (`open`, `run_again`, `pause`) with their [labels]. [ask] names the
|
||||
* action the body asks about (`pause` after failures).
|
||||
*/
|
||||
@Serializable
|
||||
data class RunNotification(
|
||||
val title: String = "",
|
||||
val body: String = "",
|
||||
val public: PublicNotice = PublicNotice(),
|
||||
val actions: List<String> = emptyList(),
|
||||
val labels: Map<String, String> = emptyMap(),
|
||||
val ask: String = "",
|
||||
)
|
||||
@@ -88,6 +88,7 @@ import eu.llembas.android.api.ToolCall
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.MarkdownText
|
||||
import eu.llembas.android.ui.Segment
|
||||
import eu.llembas.android.ui.progressLineOf
|
||||
import eu.llembas.android.ui.splitFences
|
||||
import eu.llembas.android.ui.theme.LocalPalette
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -154,8 +155,9 @@ fun UserMessage(message: Message, canEdit: Boolean, onEdit: () -> Unit, modifier
|
||||
}
|
||||
}
|
||||
if (message.queued) {
|
||||
// The server's queued progress ("Queued, 2 ahead · 12s") where it sends one.
|
||||
Text(
|
||||
stringResource(R.string.queued),
|
||||
progressLineOf(message.progress) ?: stringResource(R.string.queued),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = palette.inkFaint,
|
||||
modifier = Modifier.padding(top = 4.dp, end = 4.dp),
|
||||
|
||||
@@ -11,7 +11,7 @@ enum class Tone { Good, Quiet, Bad, Waiting, Neutral }
|
||||
object ScheduleLogic {
|
||||
fun tone(status: String): Tone = when (status) {
|
||||
"ok" -> Tone.Good
|
||||
"silent" -> Tone.Quiet
|
||||
"silent", "unchanged" -> Tone.Quiet
|
||||
"failed", "missed" -> Tone.Bad
|
||||
"waiting", "running" -> Tone.Waiting
|
||||
else -> Tone.Neutral
|
||||
|
||||
@@ -301,6 +301,7 @@ fun StatusChip(status: String, missed: Int = 0) {
|
||||
val words = when (status) {
|
||||
"ok" -> stringResource(R.string.run_ok)
|
||||
"silent" -> stringResource(R.string.run_silent)
|
||||
"unchanged" -> stringResource(R.string.run_unchanged)
|
||||
"failed" -> stringResource(R.string.run_failed)
|
||||
"missed" -> stringResource(R.string.run_missed, maxOf(missed, 1).toString())
|
||||
"skipped" -> stringResource(R.string.run_skipped)
|
||||
@@ -535,6 +536,15 @@ private fun ScheduleBody(
|
||||
if (facts.isNotEmpty()) {
|
||||
Text(facts.joinToString(" · "), style = MaterialTheme.typography.bodySmall, color = palette.inkFaint)
|
||||
}
|
||||
schedule.watch?.target?.takeIf { it.isNotBlank() }?.let { url ->
|
||||
Text(
|
||||
stringResource(R.string.schedule_watching) + ": " + url,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = palette.inkFaint,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user