mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
feat(agent): rebuild a kept Lab build from Updates, and tidy the chat's tool rows, costs, processes and times
This commit is contained in:
1 parent
90b80cb84b
commit
eb3da7595f
5 files changed
+17
-6
No files matched your search
@@ -55,7 +55,7 @@ object AgentProcesses {
|
||||
}
|
||||
lastTicks = stats.mapValues { it.value.ticks }
|
||||
lastAt = now
|
||||
return out.sortedWith(compareByDescending<Proc> { it.agent }.thenBy { it.seconds * -1 })
|
||||
return out.sortedWith(compareByDescending<Proc> { it.agent }.thenBy { it.seconds })
|
||||
}
|
||||
|
||||
/** Ends [pid] and everything it started, children first so none is left to be re-parented. */
|
||||
|
||||
@@ -85,7 +85,7 @@ private fun AgentTurnEnd(entry: Entry.Finished) {
|
||||
else -> entry.usage?.let { u ->
|
||||
buildList {
|
||||
if (u.durationMs > 0) add(clock(u.durationMs / 1000))
|
||||
if (u.costUsd > 0) add("$" + String.format(java.util.Locale.US, "%.2f", u.costUsd))
|
||||
if (u.costUsd >= 0.005) add("$" + String.format(java.util.Locale.US, "%.2f", u.costUsd))
|
||||
if (u.inputTokens > 0 || u.outputTokens > 0) add(stringResource(R.string.agent_tokens, tokens(u.inputTokens), tokens(u.outputTokens)))
|
||||
}.joinToString(" · ")
|
||||
}
|
||||
@@ -146,11 +146,11 @@ private fun AgentToolCall(entry: Entry.Used, running: Boolean) {
|
||||
val pal = LocalPalette.current
|
||||
var open by rememberSaveable(entry.id.ifEmpty { entry.detail }) { mutableStateOf(false) }
|
||||
Column(
|
||||
Modifier.fillMaxWidth().padding(horizontal = 4.dp).clip(Shape12).background(pal.surfaceVariant).animateContentSize().testTag("agent-tool"),
|
||||
Modifier.fillMaxWidth().padding(horizontal = 4.dp).clip(Shape12).background(pal.surfaceVariant).animateContentSize(),
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().clickable { open = !open }.padding(horizontal = 10.dp, vertical = 8.dp),
|
||||
modifier = Modifier.fillMaxWidth().clickable { open = !open }.testTag("agent-tool").padding(horizontal = 10.dp, vertical = 8.dp),
|
||||
) {
|
||||
Box(Modifier.size(16.dp), contentAlignment = Alignment.Center) {
|
||||
when {
|
||||
|
||||
@@ -107,7 +107,10 @@ internal fun AgentHistory(modifier: Modifier, onOpened: () -> Unit) {
|
||||
Text(chat.title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(
|
||||
if (armed) stringResource(R.string.agent_history_delete_warning)
|
||||
else AgentHarness.byId(chat.harness).name + " · " + DateUtils.getRelativeTimeSpanString(chat.updated, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS),
|
||||
else AgentHarness.byId(chat.harness).name + " · " + when {
|
||||
System.currentTimeMillis() - chat.updated < 60_000 -> stringResource(R.string.agent_just_now)
|
||||
else -> DateUtils.getRelativeTimeSpanString(chat.updated, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS).toString()
|
||||
},
|
||||
fontSize = 12.5.sp, color = if (armed) AttentionAmber else pal.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -285,7 +285,13 @@ private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions) {
|
||||
tests.forEach { t -> TestRow(t, u.follow.pr == t.pr) { ua.onFollow(Follow(Channel.TEST, t.pr)) } }
|
||||
}
|
||||
}
|
||||
LabBuilds()
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
LabBuilds(onRebuild = if (com.droiddeck.launcher.agent.AgentHost.installed) { info ->
|
||||
com.droiddeck.launcher.agent.AgentHost.send(context, context.getString(R.string.agent_rebuild_lab, info.label))
|
||||
context.startActivity(android.content.Intent(context, com.droiddeck.launcher.FrontEndActivity::class.java)
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "agent")
|
||||
.addFlags(android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP or android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT))
|
||||
} else null)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1164,6 +1164,7 @@
|
||||
<string name="agent_failed">Failed: %1$s</string>
|
||||
<string name="agent_exited">%1$s ended (exit %2$d)</string>
|
||||
<string name="agent_stopped">Stopped</string>
|
||||
<string name="agent_rebuild_lab">Rebuild my Lab build %1$s for the installed version of DroidDeck and restart on it.</string>
|
||||
<string name="agent_tokens">%1$s in · %2$s out</string>
|
||||
<string name="agent_thinking">Thinking</string>
|
||||
<string name="agent_thought">Thought</string>
|
||||
@@ -1186,6 +1187,7 @@
|
||||
<string name="agent_plan_hint">Proposes a plan without changing anything</string>
|
||||
<string name="agent_history">Conversations</string>
|
||||
<string name="agent_history_empty">No conversations yet</string>
|
||||
<string name="agent_just_now">Just now</string>
|
||||
<string name="agent_history_delete">Delete</string>
|
||||
<string name="agent_history_delete_warning">Deletes it and its attachments</string>
|
||||
<string name="agent_processes">Processes</string>
|
||||
|
||||
Reference in new issue
Block a user