Display per harness spec 3.7.0: the end line, durations, locale numbers, the cards' actions
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
- A reply that was stopped or failed keeps the progress text at its end (display.md section 4): "Stopped: by you", "Failed: ...". message.stopped was never drawn, and a failure showed the raw error. The reason comes from the stream's last status frame and stays with the finished row; a stored row gives "Stopped" or "Failed: <first line of its error>". - A finished tool call shows its duration (0.4s, 1m 05s, 2h 03m) from the call's `ms`, where the server sends it; none while running or when denied. - Counts in the progress line are in the phone's locale format (Locale.ROOT is the spec's plain format, which the conformance cases use); a cut `what` ends in an ellipsis, counted in code points; the clock is joined with the shared progress_line separator. - Approval card: Allow once / Always allow / Deny / Deny, and say why. Plan card: Approve, continue in Edit / in Manual, and Revise. - fetch-contract.py pins the spec's display.json as harness_display.json once the server's copy of the spec has it; DisplayTest then runs its duration and end cases. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
22 files changed
+428
-41
No files matched your search
@@ -36,7 +36,7 @@ data class Progress(
|
||||
) {
|
||||
companion object {
|
||||
/** `loop.json` `progress.no_elapsed`: drawn as their text alone. */
|
||||
val NO_ELAPSED = setOf("stopped", "failed")
|
||||
val NO_ELAPSED = END_PHASES
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,14 +51,16 @@ fun interface ProgressWords {
|
||||
}
|
||||
|
||||
/**
|
||||
* The phase's text, its fields filled (`progress.md` §2): numbers as integers, a rate with one
|
||||
* decimal in [locale]'s format, `retrying`'s `in` counted down to [now]. Null for a phase this
|
||||
* app does not know -- a newer server's -- so the caller falls back to the `status` text.
|
||||
* The phase's text, its fields filled (`progress.md` §2): every count and measure in [locale]'s
|
||||
* own number format (`display.md` §6: the phone's grouping and decimal mark; [Locale.ROOT] is the
|
||||
* spec's plain format), a title that had to be cut ending in `…`, `retrying`'s `in` counted down
|
||||
* to [now]. Null for a phase this app does not know -- a newer server's -- so the caller falls
|
||||
* back to the `status` text.
|
||||
*/
|
||||
fun progressText(progress: Progress, words: ProgressWords, now: Long, locale: Locale = Locale.getDefault()): String? {
|
||||
val p = progress
|
||||
return when (p.phase) {
|
||||
"queued" -> if (p.ahead != null) words.text("queued_ahead", "${p.ahead}") else words.text("queued")
|
||||
"queued" -> if (p.ahead != null) words.text("queued_ahead", localeNumber(p.ahead.toLong(), locale)) else words.text("queued")
|
||||
|
||||
"waiting_for_model" -> {
|
||||
val model = p.model ?: return null
|
||||
@@ -72,7 +74,8 @@ fun progressText(progress: Progress, words: ProgressWords, now: Long, locale: Lo
|
||||
val done = p.done
|
||||
val total = p.total
|
||||
if (done != null && total != null && total > 0) {
|
||||
words.text("reading_prompt", "$done", "$total", "${done.toLong() * 100 / total}")
|
||||
val percent = localeNumber(done.toLong() * 100 / total, locale)
|
||||
words.text("reading_prompt", localeNumber(done.toLong(), locale), localeNumber(total.toLong(), locale), percent)
|
||||
} else {
|
||||
words.text("reading_prompt_bare")
|
||||
}
|
||||
@@ -80,11 +83,13 @@ fun progressText(progress: Progress, words: ProgressWords, now: Long, locale: Lo
|
||||
|
||||
"thinking" -> words.text("thinking")
|
||||
|
||||
"writing" -> p.rate?.let { words.text("writing", String.format(locale, "%.1f", it)) } ?: words.text("writing_bare")
|
||||
"writing" -> p.rate?.let { words.text("writing", localeNumber(it, 1, locale)) } ?: words.text("writing_bare")
|
||||
|
||||
"running_tool" -> {
|
||||
val tool = p.tool ?: return null
|
||||
if (!p.what.isNullOrBlank()) words.text("running_tool", tool, p.what.take(80)) else words.text("running_tool_bare", tool)
|
||||
// The call's short title (display.md §1): one line, and `…` where it had to be cut.
|
||||
val what = shortTitle(p.what)
|
||||
if (what != null) words.text("running_tool", tool, what) else words.text("running_tool_bare", tool)
|
||||
}
|
||||
|
||||
"waiting_for_person" -> {
|
||||
@@ -96,7 +101,7 @@ fun progressText(progress: Progress, words: ProgressWords, now: Long, locale: Lo
|
||||
words.text("waiting_for_person", what)
|
||||
}
|
||||
|
||||
"waiting_for_subagents" -> words.text("waiting_for_subagents", "${p.running ?: 0}")
|
||||
"waiting_for_subagents" -> words.text("waiting_for_subagents", localeNumber((p.running ?: 0).toLong(), locale))
|
||||
|
||||
"compacting" -> words.text("compacting")
|
||||
|
||||
|
||||
Reference in new issue
Block a user