Pinned to the server's dev at 69f4800: a reply's end on the events route; a message whose arrival is unknown says so
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
The end frame is the one this app was built against: `reply` with `live` false, once per reply (event_reply_end.json, read in SecondReviewTest with what an end does to the list and to an open chat). Nothing in the handling changed. Tokens and strings are read at the same commit. A person's message with origin `unsure` (queued, never sent by itself: it was handed to the linked computer and nobody heard whether it arrived) carries the server's sentence in place of the queued line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
21 files changed
+91
-16
No files matched your search
@@ -24,6 +24,9 @@ What is said here of replies that start by themselves needs an instance newer th
|
||||
|
||||
### Changed
|
||||
|
||||
- **A message of which it is not known whether it reached the linked computer says so**, in
|
||||
the instance's words, instead of looking queued: the instance does not send it by itself.
|
||||
Sending it again or discarding it is done on the web page for now.
|
||||
- **A turn the linked computer started is a quiet note**, as a schedule's line is: it never
|
||||
looks like something you typed.
|
||||
- In an agent chat, a finished reply that holds nothing, after such a turn, says "The reply to
|
||||
|
||||
@@ -150,6 +150,17 @@ fun drawn(message: Message, first: Boolean, reportChat: Boolean): Drawn = when {
|
||||
/** The `origin` of a turn the linked computer's harness started by itself. */
|
||||
const val ORIGIN_HARNESS = "harness"
|
||||
|
||||
/** The `origin` of a message handed to the linked computer whose arrival there was never heard. */
|
||||
const val ORIGIN_UNSURE = "unsure"
|
||||
|
||||
/**
|
||||
* Whether this is the person's message of which nobody knows whether it reached the linked
|
||||
* computer (`origin` `unsure`, waiting): the instance never sends it by itself, so it is not
|
||||
* "queued, two ahead" -- it says what it is, in the instance's sentence. Any other origin this
|
||||
* app does not know is drawn as none.
|
||||
*/
|
||||
val Message.fateUnknown: Boolean get() = isUser && queued && origin == ORIGIN_UNSURE
|
||||
|
||||
/** Whether nobody typed this row: the server wrote it (`machine`), or a device's harness did. */
|
||||
val Message.byMachine: Boolean get() = machine || origin == ORIGIN_HARNESS
|
||||
|
||||
|
||||
@@ -455,9 +455,10 @@ data class ChatDetail(val chat: Chat, val messages: List<Message> = emptyList(),
|
||||
|
||||
/**
|
||||
* `GET /events`, frame `reply`: a reply started in the chat [chatId] -- whoever started it, this
|
||||
* app's own too. [messageId] is the reply's row; [live] false says it had already ended when the
|
||||
* frame was sent. An event, not a state: it is said once (and, on a connection just opened, for
|
||||
* every reply being written then).
|
||||
* app's own too -- and, with [live] false, that it is over (`event_reply_end.json`): once per
|
||||
* reply, however it ended; a reply shorter than the news of its start is said by that one frame
|
||||
* alone. [messageId] is the reply's row. An event, not a state: a start is said once (and, on a
|
||||
* connection just opened, for every reply being written then), an end once and never again.
|
||||
*/
|
||||
@Serializable
|
||||
data class ReplyFrame(@SerialName("chat_id") val chatId: String = "", @SerialName("message_id") val messageId: String = "", val live: Boolean = false)
|
||||
|
||||
@@ -171,10 +171,11 @@ 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.
|
||||
// Not one whose arrival at the computer is unknown: that one waits for the person, not for its turn.
|
||||
Text(
|
||||
progressLineOf(message.progress) ?: stringResource(R.string.queued),
|
||||
if (message.fateUnknown) stringResource(R.string.fate_unknown) else progressLineOf(message.progress) ?: stringResource(R.string.queued),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = palette.inkFaint,
|
||||
color = if (message.fateUnknown) palette.warning else palette.inkFaint,
|
||||
modifier = Modifier.padding(top = 4.dp, end = 4.dp),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 37a09bb6ee2f248ff23ab49df344e7ae0143b1ef. Do not edit.
|
||||
// Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 69f480095cfa77b5d25debf560aab3d26783e197. Do not edit.
|
||||
package eu.llembas.android.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Pokračovat</string>
|
||||
<string name="older">Starší zprávy</string>
|
||||
<string name="queued">Čeká na odeslání</string>
|
||||
<string name="fate_unknown">Není známo, zda se tato zpráva dostala do počítače. Odešlete ji znovu, nebo ji zahoďte.</string>
|
||||
<string name="reply_unrecorded">Odpověď na toto nebyla zaznamenána.</string>
|
||||
<string name="thinking">Přemýšlí</string>
|
||||
<string name="thought">Přemýšlel</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Fortsetzen</string>
|
||||
<string name="older">Frühere Nachrichten</string>
|
||||
<string name="queued">Wartet auf das Senden</string>
|
||||
<string name="fate_unknown">Es ist nicht bekannt, ob dies den Computer erreicht hat. Senden Sie es erneut oder verwerfen Sie es.</string>
|
||||
<string name="reply_unrecorded">Die Antwort darauf wurde nicht aufgezeichnet.</string>
|
||||
<string name="thinking">Denkt nach</string>
|
||||
<string name="thought">Nachgedacht</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Continuar</string>
|
||||
<string name="older">Mensajes anteriores</string>
|
||||
<string name="queued">Esperando para enviarse</string>
|
||||
<string name="fate_unknown">No se sabe si esto llegó al ordenador. Envíalo de nuevo o descártalo.</string>
|
||||
<string name="reply_unrecorded">La respuesta a esto no se registró.</string>
|
||||
<string name="thinking">Pensando</string>
|
||||
<string name="thought">Pensamiento</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Continuer</string>
|
||||
<string name="older">Messages précédents</string>
|
||||
<string name="queued">En attente d\'envoi</string>
|
||||
<string name="fate_unknown">On ne sait pas si ce message est parvenu à l’ordinateur. Renvoyez-le ou supprimez-le.</string>
|
||||
<string name="reply_unrecorded">La réponse à ceci n’a pas été enregistrée.</string>
|
||||
<string name="thinking">Réflexion</string>
|
||||
<string name="thought">Réflexion</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Folytatás</string>
|
||||
<string name="older">Korábbi üzenetek</string>
|
||||
<string name="queued">Küldésre vár</string>
|
||||
<string name="fate_unknown">Nem tudni, hogy ez eljutott-e a számítógéphez. Küldje el újra, vagy vesse el.</string>
|
||||
<string name="reply_unrecorded">Az erre adott válasz nem lett rögzítve.</string>
|
||||
<string name="thinking">Gondolkodás</string>
|
||||
<string name="thought">Gondolkodott</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Continua</string>
|
||||
<string name="older">Messaggi precedenti</string>
|
||||
<string name="queued">In attesa di invio</string>
|
||||
<string name="fate_unknown">Non si sa se questo messaggio abbia raggiunto il computer. Invialo di nuovo o scartalo.</string>
|
||||
<string name="reply_unrecorded">La risposta a questo non è stata registrata.</string>
|
||||
<string name="thinking">Ragionamento</string>
|
||||
<string name="thought">Ha ragionato</string>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 37a09bb6ee2f248ff23ab49df344e7ae0143b1ef (moria). Do not edit. -->
|
||||
<!-- Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 69f480095cfa77b5d25debf560aab3d26783e197 (moria). Do not edit. -->
|
||||
<resources>
|
||||
<color name="token_bg">#FF0B0D10</color>
|
||||
<color name="token_surface">#FF11151A</color>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Kontynuuj</string>
|
||||
<string name="older">Wcześniejsze wiadomości</string>
|
||||
<string name="queued">Czeka na wysłanie</string>
|
||||
<string name="fate_unknown">Nie wiadomo, czy ta wiadomość dotarła do komputera. Wyślij ją ponownie albo odrzuć.</string>
|
||||
<string name="reply_unrecorded">Odpowiedź na to nie została zapisana.</string>
|
||||
<string name="thinking">Rozumowanie</string>
|
||||
<string name="thought">Rozumowanie</string>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<string name="continue_reply">Pokračovať</string>
|
||||
<string name="older">Staršie správy</string>
|
||||
<string name="queued">Čaká na odoslanie</string>
|
||||
<string name="fate_unknown">Nie je známe, či sa táto správa dostala do počítača. Odošlite ju znova alebo ju zahoďte.</string>
|
||||
<string name="reply_unrecorded">Odpoveď na toto nebola zaznamenaná.</string>
|
||||
<string name="thinking">Premýšľa</string>
|
||||
<string name="thought">Premýšľal</string>
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<string name="continue_reply">Continue</string>
|
||||
<string name="older">Earlier messages</string>
|
||||
<string name="queued">Waiting to be sent</string>
|
||||
<string name="fate_unknown">It is not known whether this reached the computer. Send it again, or discard it.</string>
|
||||
<string name="reply_unrecorded">The reply to this was not recorded.</string>
|
||||
<string name="thinking">Thinking</string>
|
||||
<string name="thought">Thought</string>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 37a09bb6ee2f248ff23ab49df344e7ae0143b1ef (shire). Do not edit. -->
|
||||
<!-- Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at 69f480095cfa77b5d25debf560aab3d26783e197 (shire). Do not edit. -->
|
||||
<resources>
|
||||
<color name="token_bg">#FFF1EAD6</color>
|
||||
<color name="token_surface">#FFF8F3E5</color>
|
||||
|
||||
@@ -3,12 +3,16 @@ package eu.llembas.android
|
||||
import eu.llembas.android.api.Chat
|
||||
import eu.llembas.android.api.ChatDetail
|
||||
import eu.llembas.android.api.ChatPage
|
||||
import eu.llembas.android.api.Drawn
|
||||
import eu.llembas.android.api.Frame
|
||||
import eu.llembas.android.api.LembasJson
|
||||
import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.Outcome
|
||||
import eu.llembas.android.api.ReplyFrame
|
||||
import eu.llembas.android.api.Step
|
||||
import eu.llembas.android.api.drawn
|
||||
import eu.llembas.android.api.fateUnknown
|
||||
import eu.llembas.android.api.reopened
|
||||
import eu.llembas.android.api.replyUnrecorded
|
||||
import eu.llembas.android.api.unrecordedReplies
|
||||
@@ -378,6 +382,45 @@ class SecondReviewTest {
|
||||
assertSame(list, list.ended(said("c9", live = false), open = null))
|
||||
}
|
||||
|
||||
private fun fixture(name: String): String = requireNotNull(javaClass.classLoader!!.getResource("$name.json")) {
|
||||
"contract/$name.json is missing"
|
||||
}.readText()
|
||||
|
||||
@Test
|
||||
fun theEndFrameIsReadAsTheServerWritesItAndDoesWhatAnEndDoes() {
|
||||
val start = LembasJson.decodeFromString(ReplyFrame.serializer(), fixture("event_reply"))
|
||||
val end = LembasJson.decodeFromString(ReplyFrame.serializer(), fixture("event_reply_end"))
|
||||
// The same reply, said twice: once being written, once over.
|
||||
assertEquals(ReplyFrame(chatId = start.chatId, messageId = start.messageId, live = false), end)
|
||||
assertTrue(start.live)
|
||||
val list = ChatsState(chats = listOf(Chat(id = end.chatId, running = true)), more = false)
|
||||
// No read for it, the mark gone, something new.
|
||||
assertFalse(list.readsFor(end, shown = true))
|
||||
assertEquals(listOf(Chat(id = end.chatId, running = false, unread = true)), list.ended(end, open = null).chats)
|
||||
// The pair is the proof that this instance says the ends.
|
||||
val ends = ReplyEnds()
|
||||
ends.hear(start)
|
||||
ends.hear(end)
|
||||
assertTrue(ends.said)
|
||||
// For the chat on screen that followed the reply, it is no news.
|
||||
val open = ChatState(chat = Chat(id = end.chatId), messages = listOf(reply(end.messageId, complete = false)), live = LiveReply(end.messageId))
|
||||
assertFalse(open.asksFor(end))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMessageWhoseArrivalIsUnknownSaysSoAndNotThatItWaitsItsTurn() {
|
||||
val unsure = Message(id = "q1", role = "user", text = "And the bread?", queued = true, origin = "unsure")
|
||||
assertTrue(unsure.fateUnknown)
|
||||
// Still the person's own bubble.
|
||||
assertEquals(Drawn.Person, drawn(unsure, first = false, reportChat = false))
|
||||
// Once sent it is a turn like any other; a queued prompt is only queued; a reply is never this.
|
||||
assertFalse(unsure.copy(queued = false, origin = "").fateUnknown)
|
||||
assertFalse(unsure.copy(origin = "").fateUnknown)
|
||||
assertFalse(unsure.copy(role = "assistant").fateUnknown)
|
||||
// An origin this app does not know is drawn as none.
|
||||
assertEquals(Drawn.Person, drawn(unsure.copy(queued = false, origin = "somewhere"), first = false, reportChat = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anInstanceProvesItSaysTheEndsWithOneEndOfAReplyItSaidStarted() {
|
||||
val ends = ReplyEnds()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"chat_id": "chat1",
|
||||
"message_id": "msg2",
|
||||
"live": false
|
||||
}
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ref": "37a09bb6ee2f248ff23ab49df344e7ae0143b1ef",
|
||||
"commit": "37a09bb6ee2f248ff23ab49df344e7ae0143b1ef",
|
||||
"sha256": "f133b407c1fcfa0106c35ca0edfea3b150a5c1faafbe6652c7e47b5d40ff4178"
|
||||
"ref": "69f480095cfa77b5d25debf560aab3d26783e197",
|
||||
"commit": "69f480095cfa77b5d25debf560aab3d26783e197",
|
||||
"sha256": "8431c8a0214c699ef591b4fcbb96e4262834cf154aaf731896c282d7f453b4b8"
|
||||
}
|
||||
@@ -64,6 +64,8 @@ STRINGS: dict[str, str] = {
|
||||
"continue_reply": "Continue",
|
||||
"older": "Earlier messages",
|
||||
"queued": "Waiting to be sent",
|
||||
# A message handed to the linked computer whose arrival was never heard (`origin` `unsure`): the server's sentence.
|
||||
"fate_unknown": "It is not known whether this reached the computer. Send it again, or discard it.",
|
||||
# In place of a finished reply that holds nothing, after a turn nobody typed (the server's sentence).
|
||||
"reply_unrecorded": "The reply to this was not recorded.",
|
||||
"thinking": "Thinking",
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"tag": "37a09bb6ee2f248ff23ab49df344e7ae0143b1ef",
|
||||
"commit": "37a09bb6ee2f248ff23ab49df344e7ae0143b1ef",
|
||||
"sha256": "d6db24a6e64b211bc93917d3e8ce66fdbdb3d944fb2d6a4e4610ab261e4bf1fd",
|
||||
"tag": "69f480095cfa77b5d25debf560aab3d26783e197",
|
||||
"commit": "69f480095cfa77b5d25debf560aab3d26783e197",
|
||||
"sha256": "c2045c57039da6573e9efc5aa99753f0238301a139cbf75932c81e8058cdbff0",
|
||||
"res": {
|
||||
"values": "cb1d1a1c12e2f286b4abcd45aa5048cb4c43612c3b64e099b4effb2d0c524c92",
|
||||
"values-night": "db1b33a4bcdff43bdcc96d83e5378aed184457fedf69e26edb23a68adbbb6e5e"
|
||||
"values": "167f908b373da57d383f5ccd032ee42beb0153cd62991ef3f60a9c1d77cc25e2",
|
||||
"values-night": "060a0ca61bfa4cbe7bd7283e44b1324a35ef463c209c4f363f574b5454db4153"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user