fix(#1215): show omitted process output count (#1232)

This commit is contained in:
m57 authored and GitHub committed 2026-09-23 11:26:45 +03:00
1 parent 62b865b7d1
commit e539d650cf
10 files changed
+57

No files matched your search

@@ -495,6 +495,13 @@ private fun ExpandedToolContent(
}
}
view.outputCut?.let { omitted ->
Text(
text = stringResource(R.string.chat_tool_output_omitted, omitted),
style = MaterialTheme.typography.labelSmall.copy(color = statusColors.warning),
)
}
// ── Duration footer ──
view.durationLabel?.let {
Text(
@@ -41,6 +41,8 @@ internal interface ToolRenderer {
*/
internal data class ToolViewExtras(
val detailLabel: String? = null,
/** Process output characters omitted by the backend. */
val outputCut: Long? = null,
val stdout: String? = null,
val stderr: String? = null,
val exitCode: Int? = null,
@@ -35,6 +35,8 @@ data class ToolView(
val detail: String = "",
/** Optional section label above [detail] (e.g. "Search results"). */
val detailLabel: String? = null,
/** Process output characters omitted by the backend. */
val outputCut: Long? = null,
/** Compact count, e.g. "3 results". */
val countLabel: String? = null,
/** Human duration, e.g. "1.2s". */
@@ -106,6 +106,7 @@ object ToolViewBuilder {
subtitle = subtitle,
detail = clampedDetail,
detailLabel = extras.detailLabel,
outputCut = extras.outputCut,
countLabel = countLabel?.let { (count, noun) -> "$count ${ToolCounts.pluralizeNoun(noun, count)}" },
durationLabel = ToolJson.durationLabel(call.result),
stdout = clampedStdout,
@@ -3,9 +3,12 @@ package com.m57.hermescontrol.ui.chat.tool.render
import com.m57.hermescontrol.ui.chat.tool.ToolCall
import com.m57.hermescontrol.ui.chat.tool.ToolJson
import com.m57.hermescontrol.ui.chat.tool.ToolRenderer
import com.m57.hermescontrol.ui.chat.tool.ToolViewExtras
import com.m57.hermescontrol.ui.chat.tool.ToolViewStatus
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.longOrNull
/** `cronjob`: job listings with schedules, or the mutated job's key fields. */
internal object CronjobRenderer : ToolRenderer {
@@ -214,6 +217,15 @@ internal object SessionSearchRenderer : ToolRenderer {
/** `process`: background session listings and lifecycle acks. */
internal object ProcessRenderer : ToolRenderer {
override fun extras(
call: ToolCall,
status: ToolViewStatus,
): ToolViewExtras {
if (status == ToolViewStatus.RUNNING) return ToolViewExtras.NONE
val count = (call.result?.get("output_cut") as? JsonPrimitive)?.takeUnless { it.isString }?.longOrNull
return ToolViewExtras(outputCut = count?.takeIf { it > 0 })
}
override fun subtitle(call: ToolCall): String {
val action = ToolJson.firstString(call.args, listOf("action"))
val procId = ToolJson.firstString(call.args, listOf("session_id"))