diff --git a/CHANGELOG.md b/CHANGELOG.md index 86445eb..f4b960c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,11 +50,14 @@ is in alpha and releases come off `main`. is shown as before. A scheduled run under way says it too (*Waiting for coder: all its slots are in use*). The words are your instance's, in your language. -- **Subagents, as a list** (the server's subagent tree, once it sends one): the activity sheet +- **Subagents, as a list**: while a reply runs with subagents, the activity sheet shows the main agent and each subagent -- its name, its position, what it is doing now and how full its context is -- with the ones that ended after them, dimmed, saying how each ended (*done*, *out of context*, *stopped*), and the open slots. A subagent's row opens its - conversation, read-only. + conversation, read-only. In an agent chat the Subagents setting is there too, and goes to the + computer the chat runs on, which runs them. +- **An approval says which subagent asks** -- *Subagent parser (s1), reviews the parser, + asks:* -- when a subagent needs something nobody in its tree may allow. ### Fixed diff --git a/app/src/main/java/eu/llembas/android/api/LiveReply.kt b/app/src/main/java/eu/llembas/android/api/LiveReply.kt index 0adb690..8d72ae0 100644 --- a/app/src/main/java/eu/llembas/android/api/LiveReply.kt +++ b/app/src/main/java/eu/llembas/android/api/LiveReply.kt @@ -19,6 +19,8 @@ data class LiveReply( val progress: Progress? = null, val cards: List = emptyList(), val jobs: List = emptyList(), + /** The subagent tree (spec 3.4.0), from the `tree` frame; null until there is one. */ + val tree: SubagentTree? = null, val metrics: Metrics? = null, val steered: Set = emptySet(), /** Set by `done`: the finished row, which replaces this in the transcript. */ @@ -53,6 +55,8 @@ data class LiveReply( "jobs" -> decode(JobsFrame.serializer(), data)?.let { copy(jobs = it.jobs) } ?: this + "tree" -> decode(TreeFrame.serializer(), data)?.let { copy(tree = it.tree) } ?: this + "metrics" -> decode(Metrics.serializer(), data)?.let { copy(metrics = it) } ?: this "done" -> decode(DoneFrame.serializer(), data)?.let { diff --git a/app/src/main/java/eu/llembas/android/api/Models.kt b/app/src/main/java/eu/llembas/android/api/Models.kt index 66213bb..7074c8d 100644 --- a/app/src/main/java/eu/llembas/android/api/Models.kt +++ b/app/src/main/java/eu/llembas/android/api/Models.kt @@ -419,8 +419,13 @@ data class CardItem( val plan: JsonObject? = null, @SerialName("mode_choice") val modeChoice: Boolean = false, val job: String = "", + /** The tree subagent asking (spec 3.4.0), for a call nobody in the tree may allow; null otherwise. */ + val subagent: CardSubagent? = null, ) +@Serializable +data class CardSubagent(val id: String = "", val name: String = "", val position: String = "") + @Serializable data class Card( val id: String, @@ -485,6 +490,10 @@ data class SteeredFrame(val ids: List = emptyList()) @Serializable data class StatusFrame(val text: String = "", val progress: Progress? = null) +/** The `tree` frame (spec 3.4.0): the subagent tree, once there is one, whenever it changes. */ +@Serializable +data class TreeFrame(val tree: SubagentTree? = null) + @Serializable data class AskFrame(val cards: List = emptyList()) @@ -648,11 +657,6 @@ data class Activity( val context: ContextUse? = null, val outputs: List = emptyList(), val plan: JsonObject? = null, - /** - * The subagent tree (harness spec 3.4.0, `subagents.md` §12), where the server sends it; - * null from an older one, which the Tasks section's team members stand for. - */ - val tree: SubagentTree? = null, ) @Serializable diff --git a/app/src/main/java/eu/llembas/android/ui/chat/ActivityPanel.kt b/app/src/main/java/eu/llembas/android/ui/chat/ActivityPanel.kt index 9138458..c3b323c 100644 --- a/app/src/main/java/eu/llembas/android/ui/chat/ActivityPanel.kt +++ b/app/src/main/java/eu/llembas/android/ui/chat/ActivityPanel.kt @@ -81,6 +81,7 @@ import eu.llembas.android.api.AgentDetail import eu.llembas.android.api.ContextUse import eu.llembas.android.api.Output import eu.llembas.android.api.RoomMessage +import eu.llembas.android.api.SubagentTree import eu.llembas.android.api.TreeLogic import eu.llembas.android.lembas import eu.llembas.android.ui.MarkdownText @@ -254,6 +255,7 @@ fun ActivityPanel(chatId: String?, state: ChatState, model: ChatViewModel, canOp canCompact = chatId != null && !state.running, compacting = state.compacting, canOpenFiles = canOpenFiles, + tree = state.tree, onClose = close, ) } @@ -299,6 +301,7 @@ fun ActivityContent( compacting: Boolean = false, canOpenFiles: Boolean = true, unfolded: Boolean = false, + tree: SubagentTree? = null, onClose: () -> Unit = {}, ) { val palette = LocalPalette.current @@ -332,15 +335,15 @@ fun ActivityContent( } // 3.4.0: the subagents as a reduced list, each opening its conversation read-only; // the Tasks section then holds the background jobs, the members being in the list. - val tree = activity.tree?.takeIf { TreeLogic.hasSubagents(it) } - if (tree != null) { + val shownTree = tree?.takeIf { TreeLogic.hasSubagents(it) } + if (shownTree != null) { item { - Section(stringResource(R.string.team_agents), count = tree.agents.count { !it.isMain }.takeIf { it > 0 }) { - SubagentList(tree) { agent -> actions.read(ActivityLogic.ofTreeAgent(agent)) } + Section(stringResource(R.string.team_agents), count = shownTree.agents.count { !it.isMain }.takeIf { it > 0 }) { + SubagentList(shownTree) { agent -> actions.read(ActivityLogic.ofTreeAgent(agent)) } } } } - val tasks = if (tree != null) activity.copy(agents = activity.agents.filter { it.kind != "member" }, team = null) else activity + val tasks = if (shownTree != null) activity.copy(agents = activity.agents.filter { it.kind != "member" }, team = null) else activity item { Section(stringResource(R.string.activity_tasks)) { TasksSection(tasks, readAt, now, actions, unfolded) } } activity.team?.let { team -> item { Section(stringResource(R.string.team_room), count = team.room.size.takeIf { it > 0 }) { RoomSection(team) } } diff --git a/app/src/main/java/eu/llembas/android/ui/chat/Cards.kt b/app/src/main/java/eu/llembas/android/ui/chat/Cards.kt index 4ff13c8..3719bb5 100644 --- a/app/src/main/java/eu/llembas/android/ui/chat/Cards.kt +++ b/app/src/main/java/eu/llembas/android/ui/chat/Cards.kt @@ -73,7 +73,14 @@ private fun Approval(card: Card, onAnswer: (CardAnswer) -> Unit) { Text(stringResource(R.string.card_approval), style = MaterialTheme.typography.titleMedium) card.items.forEach { item -> // A subagent asks, not the chat's own turn: said first, as the page says it. - if (item.job.isNotBlank()) { + val subagent = item.subagent + if (subagent != null) { + Text( + stringResource(R.string.card_subagent_asks, subagent.name, subagent.id, subagent.position.ifBlank { "—" }), + style = MaterialTheme.typography.labelLarge, + color = palette.accent, + ) + } else if (item.job.isNotBlank()) { Text(stringResource(R.string.card_asker, item.job), style = MaterialTheme.typography.labelLarge, color = palette.accent) } // `title` is the heading ("Run a command"); `detail` is the thing itself, the command. diff --git a/app/src/main/java/eu/llembas/android/ui/chat/ChatViewModel.kt b/app/src/main/java/eu/llembas/android/ui/chat/ChatViewModel.kt index bada2f7..5e60094 100644 --- a/app/src/main/java/eu/llembas/android/ui/chat/ChatViewModel.kt +++ b/app/src/main/java/eu/llembas/android/ui/chat/ChatViewModel.kt @@ -25,6 +25,7 @@ import eu.llembas.android.api.LiveReply import eu.llembas.android.api.Message import eu.llembas.android.api.ModelInfo import eu.llembas.android.api.StreamClient +import eu.llembas.android.api.SubagentTree import eu.llembas.android.api.Turn import eu.llembas.android.lembas import eu.llembas.android.ui.explain @@ -73,6 +74,8 @@ data class ChatState( val compacting: Boolean = false, /** What a chat not made yet will be made with: chosen in the top bar and the tune sheet. */ val draft: Draft = Draft(), + /** The subagent tree (spec 3.4.0) from this chat's last `tree` frame; null until one came. */ + val tree: SubagentTree? = null, ) /** @@ -190,7 +193,7 @@ class ChatViewModel(app: Application) : viewModelScope.launch { try { val client = api() - _state.update { it.copy(loading = chatId != null || agent, error = null) } + _state.update { it.copy(loading = chatId != null || agent, error = null, tree = null) } val list = runCatching { client.modelList(chatId) }.getOrNull() val models = list?.models.orEmpty() _state.update { it.copy(modelsCap = list?.subagentsCap) } @@ -246,7 +249,11 @@ class ChatViewModel(app: Application) : _state.update { it.copy(live = LiveReply(messageId)) } try { StreamClient(api()).follow(chat.id, messageId).collect { frame -> - _state.update { s -> s.copy(live = (s.live ?: LiveReply(messageId)).apply(frame.event, frame.data)) } + _state.update { s -> + val live = (s.live ?: LiveReply(messageId)).apply(frame.event, frame.data) + // The tree outlives the reply: kept for the activity sheet once it ends. + s.copy(live = live, tree = live.tree ?: s.tree) + } } } catch (e: CancellationException) { throw e diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index f080651..b0414f5 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -254,6 +254,7 @@ hotovo zastaveno %1$s se ptá: + Podagent %1$s (%2$s), %3$s, se ptá: Model uvádí: %1$s Upravit to před spuštěním Povolením se spustí to, co je v poli. Znovu se to neporovnává s pravidly této konverzace — napsali jste to vy. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d2408b8..0cf3c25 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -254,6 +254,7 @@ fertig angehalten %1$s fragt: + Subagent %1$s (%2$s), %3$s, fragt: Es sagt: %1$s Vor dem Ausführen ändern Erlauben führt aus, was im Feld steht. Es wird nicht erneut gegen die Regeln dieses Chats geprüft — Sie haben es eingegeben. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cc8a147..3398626 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -254,6 +254,7 @@ terminado detenido %1$s pregunta: + El subagente %1$s (%2$s), %3$s, pregunta: Dice: %1$s Cambiar esto antes de que se ejecute Permitir ejecuta lo que hay en el cuadro. No se vuelve a comprobar con las reglas de este chat: lo ha escrito usted. diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1707de4..590cd74 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -254,6 +254,7 @@ terminé arrêté %1$s demande : + Le sous-agent %1$s (%2$s), %3$s, demande : Il dit : %1$s Modifier ceci avant l\'exécution Autoriser exécute ce qui se trouve dans le champ. Ce n\'est pas revérifié par rapport aux règles de cette conversation — c\'est vous qui l\'avez saisi. diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 2b7c09f..4d4ddbe 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -254,6 +254,7 @@ kész leállítva %1$s kérdezi: + A(z) %1$s alügynök (%2$s), %3$s, kérdezi: Ezt mondja: %1$s Módosítás futtatás előtt Az Engedélyezés azt futtatja, ami a mezőben van. Nem ellenőrizzük újra a csevegés szabályai szerint – ezt Ön írta be. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d3a369b..a7ff1b0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -254,6 +254,7 @@ finito interrotto %1$s chiede: + Il subagente %1$s (%2$s), %3$s, chiede: Dice: %1$s Modificalo prima che venga eseguito Consenti esegue ciò che c\'è nel campo. Non viene ricontrollato rispetto alle regole di questa chat — l\'hai scritto tu. diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 9774adf..b149fa1 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -254,6 +254,7 @@ gotowe zatrzymane %1$s pyta: + Podagent %1$s (%2$s), %3$s, pyta: Mówi: %1$s Zmień to przed uruchomieniem Zezwolenie uruchamia to, co jest w polu. Nie jest to ponownie sprawdzane z regułami tego czatu — zostało wpisane ręcznie. diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 22d4df6..edda85b 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -254,6 +254,7 @@ hotovo zastavené %1$s sa pýta: + Podagent %1$s (%2$s), %3$s, sa pýta: Model uvádza: %1$s Upraviť to pred spustením Povolením sa spustí to, čo je v poli. Znova sa to neporovnáva s pravidlami tejto konverzácie — napísali ste to vy. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b1f5c4..3414601 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -263,6 +263,7 @@ %1$s%% context Open slots: %1$s %1$s asks: + Subagent %1$s (%2$s), %3$s, asks: It says: %1$s Change this before it runs Allow runs what is in the box. It is not checked against this chat\'s rules again — you typed it. diff --git a/app/src/test/java/eu/llembas/android/ContractTest.kt b/app/src/test/java/eu/llembas/android/ContractTest.kt index 7904266..e56da17 100644 --- a/app/src/test/java/eu/llembas/android/ContractTest.kt +++ b/app/src/test/java/eu/llembas/android/ContractTest.kt @@ -2,6 +2,7 @@ package eu.llembas.android import eu.llembas.android.api.APP_API import eu.llembas.android.api.AskFrame +import eu.llembas.android.api.CardSubagent import eu.llembas.android.api.Chat import eu.llembas.android.api.ChatPage import eu.llembas.android.api.DoneFrame @@ -18,6 +19,7 @@ import eu.llembas.android.api.SteeredFrame import eu.llembas.android.api.StepsFrame import eu.llembas.android.api.Tail import eu.llembas.android.api.ToolCall +import eu.llembas.android.api.TreeFrame import eu.llembas.android.ui.chat.approvalTexts import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.ListSerializer @@ -137,7 +139,7 @@ class ContractTest { fun aDeviceApprovalCorrectsItsDetail() { // A device's approval: the heading in `title`, the command in `detail` -- the text an // `editable` item corrects -- no "Something else", and the subagent asking in `job`. - val approval = read("event_ask", AskFrame.serializer()).cards.single { it.kind == "approval" } + val approval = read("event_ask", AskFrame.serializer()).cards.first { it.kind == "approval" } val item = approval.items.single() assertEquals("Run a command", item.title) assertEquals("rm -rf build", item.detail) @@ -163,12 +165,36 @@ class ContractTest { assertNull(chat.subagents) assertEquals(4, chat.agents?.max) assertFalse(page.more) - // The agent chat's own facts: not offered (its subagents run on its device), the cap said. + // The agent chat's own facts (3.4.0): offered -- the setting goes to its device -- the cap said. val agent = read("chat_agent", Chat.serializer()) - assertEquals(false, agent.subagents?.offered) + assertEquals(true, agent.subagents?.offered) assertEquals(32, agent.subagents?.cap) } + @Test + fun aTreeSubagentAsksThePerson() { + // A device's subagent asks for what nobody in its tree may allow: the card names it. + val cards = read("event_ask", AskFrame.serializer()).cards + val item = cards.single { c -> c.items.any { it.subagent != null } }.items.single() + assertEquals(CardSubagent(id = "s1", name = "parser", position = "reviews the parser"), item.subagent) + assertEquals("git push", item.detail) + assertEquals("", item.job) + assertNull(cards.first().items.single().subagent) + } + + @Test + fun theTreeFrame() { + val tree = read("event_tree", TreeFrame.serializer()).tree!! + assertEquals(1, tree.openSlots) + assertEquals(listOf("lead", "parser"), tree.agents.map { it.name }) + assertEquals("Review src/parse.ts.", tree.agents[1].task) + assertEquals(6, tree.agents[1].contextPercent) + assertEquals("done", tree.ended.single().state) + assertNull(tree.ended.single().progress) + // The stream carries it; the reply keeps it. + assertEquals(tree, LiveReply("m").apply("tree", text("event_tree")).tree) + } + @Test fun everyFrameParses() { assertTrue(read("event_steps", StepsFrame.serializer()).steps.isNotEmpty()) @@ -177,7 +203,7 @@ class ContractTest { assertEquals("Bake lembas", read("event_plan", Plan.serializer()).title) assertTrue(read("event_status", StatusFrame.serializer()).text.isNotEmpty()) val cards = read("event_ask", AskFrame.serializer()).cards - assertEquals(listOf("question", "approval", "plan"), cards.map { it.kind }) + assertEquals(listOf("question", "approval", "plan", "approval"), cards.map { it.kind }) assertEquals(listOf("Honey", "Plain"), cards[0].items[0].options.map { it.label }) assertTrue(cards[1].items[0].editable) assertNotNull(cards[2].items[0].plan) diff --git a/app/src/test/java/eu/llembas/android/SubagentsTest.kt b/app/src/test/java/eu/llembas/android/SubagentsTest.kt index 8290801..8919856 100644 --- a/app/src/test/java/eu/llembas/android/SubagentsTest.kt +++ b/app/src/test/java/eu/llembas/android/SubagentsTest.kt @@ -43,8 +43,8 @@ class SubagentsTest { val chat = read("chat", Chat.serializer()) assertEquals(SubagentsOffer(offered = true, namedOnly = false, cap = 32), chat.subagents) val agentChat = read("chat_agent", Chat.serializer()) - // An agent chat is never offered subagents by the server (they run on its device); the cap is said. - assertEquals(SubagentsOffer(offered = false, cap = 32), agentChat.subagents) + // An agent chat is offered subagents (3.4.0): its device runs them, the setting goes down. + assertEquals(SubagentsOffer(offered = true, cap = 32), agentChat.subagents) val activity = read("activity", ActivityEnvelope.serializer()).activity assertEquals(true, activity.subagentsOffered) diff --git a/app/src/test/java/eu/llembas/android/shots/Fakes.kt b/app/src/test/java/eu/llembas/android/shots/Fakes.kt index 1eef211..1162948 100644 --- a/app/src/test/java/eu/llembas/android/shots/Fakes.kt +++ b/app/src/test/java/eu/llembas/android/shots/Fakes.kt @@ -203,41 +203,39 @@ object Fakes { ) /** - * The activity sheet of a chat with subagents (spec 3.4.0's tree): the main agent, a + * The subagent tree beside the activity sheet (spec 3.4.0's tree): the main agent, a * sub-manager with one under it paused, one waiting for a slot, an open slot and one ended. */ - val activityTree = activity.copy( - tree = SubagentTree( - min = 2, - max = 5, - size = 4, - openSlots = 1, - agents = listOf( - TreeAgent( - id = "lead", name = "lead", position = "the main agent", state = "working", model = "qwen", mode = "edit", manager = true, - context = TreeContext(41_200, 131_072), progress = Progress(phase = "waiting_for_subagents", since = 1762790400000, running = 2), - ), - TreeAgent( - id = "s1", name = "parser", position = "reviews the parser and everything that reads its output", parent = "lead", - state = "working", model = "qwen", mode = "edit", manager = true, context = TreeContext(9_100, 131_072), - progress = Progress(phase = "running_tool", since = 1762790401000, tool = "read", what = "src/parse.ts"), - ), - TreeAgent( - id = "s3", name = "lexer", position = "the lexer's tests", parent = "parser", state = "paused", - model = "qwen", mode = "manual", context = TreeContext(112_000, 131_072), progress = Progress(phase = "thinking", since = 1762790402000), - ), - TreeAgent(id = "s4", name = "docs", position = "writes the changelog", parent = "lead", state = "waiting", model = "qwen", mode = "edit"), + val tree = SubagentTree( + min = 2, + max = 5, + size = 4, + openSlots = 1, + agents = listOf( + TreeAgent( + id = "lead", name = "lead", position = "the main agent", state = "working", model = "qwen", mode = "edit", manager = true, + context = TreeContext(41_200, 131_072), progress = Progress(phase = "waiting_for_subagents", since = 1762790400000, running = 2), ), - ended = listOf( - TreeAgent( - id = "s2", - name = "scout", - position = "finds the old parser", - parent = "lead", - state = "out_of_context", - ended = 1762790300000, - findings = 2, - ), + TreeAgent( + id = "s1", name = "parser", position = "reviews the parser and everything that reads its output", parent = "lead", + state = "working", model = "qwen", mode = "edit", manager = true, context = TreeContext(9_100, 131_072), + progress = Progress(phase = "running_tool", since = 1762790401000, tool = "read", what = "src/parse.ts"), + ), + TreeAgent( + id = "s3", name = "lexer", position = "the lexer's tests", parent = "parser", state = "paused", + model = "qwen", mode = "manual", context = TreeContext(112_000, 131_072), progress = Progress(phase = "thinking", since = 1762790402000), + ), + TreeAgent(id = "s4", name = "docs", position = "writes the changelog", parent = "lead", state = "waiting", model = "qwen", mode = "edit"), + ), + ended = listOf( + TreeAgent( + id = "s2", + name = "scout", + position = "finds the old parser", + parent = "lead", + state = "out_of_context", + ended = 1762790300000, + findings = 2, ), ), ) diff --git a/app/src/test/java/eu/llembas/android/shots/ScreenShots.kt b/app/src/test/java/eu/llembas/android/shots/ScreenShots.kt index 27bf8b9..ad45081 100644 --- a/app/src/test/java/eu/llembas/android/shots/ScreenShots.kt +++ b/app/src/test/java/eu/llembas/android/shots/ScreenShots.kt @@ -175,7 +175,9 @@ class ScreenShots { shoot("14-activity", Phone.Scroll, content = sheet) shoot("15-activity-open", Phone.Scroll, content = open) // Spec 3.4.0's subagents: the reduced list above the background tasks. - val tree: @Composable () -> Unit = { SheetOver { ActivityContent(Fakes.activityTree, readAt = 0, now = 0, actions = NoActivityActions) } } + val tree: @Composable () -> Unit = { + SheetOver { ActivityContent(Fakes.activity, readAt = 0, now = 0, actions = NoActivityActions, tree = Fakes.tree) } + } shoot("26-subagents", Phone.Scroll, content = tree) shoot("26-subagents", Phone.Small, fontScale = 1.5f, content = tree) shoot("16-activity-new-chat") { @@ -216,9 +218,11 @@ class ScreenShots { fun cards() { val frame = requireNotNull(javaClass.classLoader!!.getResource("event_ask.json")).readText() val cards = eu.llembas.android.api.LembasJson.decodeFromString(eu.llembas.android.api.AskFrame.serializer(), frame).cards - val approval = cards.single { it.kind == "approval" } + val approval = cards.first { it.kind == "approval" } + val fromSubagent = cards.first { it.kind == "approval" && it.items.any { item -> item.subagent != null } } val question = cards.first { it.kind == "question" } shoot("24-approval") { SheetOver { CardSheet(approval, onAnswer = {}) } } + shoot("24-approval-subagent") { SheetOver { CardSheet(fromSubagent, onAnswer = {}) } } shoot("24-approval", Phone.Small, fontScale = 1.5f) { SheetOver { CardSheet(approval, onAnswer = {}) } } shoot("25-question") { SheetOver { CardSheet(question, onAnswer = {}) } } } diff --git a/contract/chat_agent.json b/contract/chat_agent.json index c70370e..efc07d4 100644 --- a/contract/chat_agent.json +++ b/contract/chat_agent.json @@ -22,7 +22,7 @@ "max": 4 }, "subagents": { - "offered": false, + "offered": true, "named_only": false, "cap": 32 }, diff --git a/contract/event_ask.json b/contract/event_ask.json index d95979a..851bad4 100644 --- a/contract/event_ask.json +++ b/contract/event_ask.json @@ -34,7 +34,8 @@ "editable": false, "plan": null, "mode_choice": true, - "job": "" + "job": "", + "subagent": null } ] }, @@ -61,7 +62,8 @@ "editable": true, "plan": null, "mode_choice": true, - "job": "explore (job1)" + "job": "explore (job1)", + "subagent": null } ] }, @@ -119,7 +121,40 @@ ] }, "mode_choice": true, - "job": "" + "job": "", + "subagent": null + } + ] + }, + { + "id": "card4", + "kind": "approval", + "why": "", + "dismissable": false, + "expires_in": null, + "items": [ + { + "index": 0, + "key": "0", + "kind": "approval", + "tool": "bash", + "title": "Run a command", + "header": "", + "detail": "git push", + "reason": "Edit mode asks before anything that runs a command.", + "purpose": "", + "options": [], + "multiple": false, + "free_text": false, + "editable": true, + "plan": null, + "mode_choice": true, + "job": "", + "subagent": { + "id": "s1", + "name": "parser", + "position": "reviews the parser" + } } ] } diff --git a/contract/event_tree.json b/contract/event_tree.json new file mode 100644 index 0000000..0928efb --- /dev/null +++ b/contract/event_tree.json @@ -0,0 +1,75 @@ +{ + "tree": { + "min": 1, + "max": 4, + "size": 2, + "open_slots": 1, + "agents": [ + { + "id": "lead", + "name": "lead", + "position": "the main agent", + "parent": null, + "state": "working", + "model": "qwen-27b", + "mode": "edit", + "request": [], + "manager": true, + "context": { + "used": 41200, + "window": 131072 + }, + "progress": { + "phase": "thinking", + "since": 1767323045000 + }, + "findings": 0, + "messages": 2 + }, + { + "id": "s2", + "name": "parser", + "position": "reviews the parser", + "parent": "lead", + "state": "working", + "model": "qwen-27b", + "mode": "manual", + "task": "Review src/parse.ts.", + "request": [ + "write" + ], + "manager": false, + "context": { + "used": 9100, + "window": 131072 + }, + "progress": { + "phase": "running_tool", + "since": 1767323045000, + "tool": "read", + "what": "src/parse.ts" + }, + "findings": 2, + "messages": 3 + } + ], + "ended": [ + { + "id": "s1", + "name": "scout", + "position": "maps the code", + "parent": "lead", + "state": "done", + "model": "qwen-27b", + "mode": "edit", + "task": "Map it.", + "request": [], + "manager": false, + "progress": null, + "findings": 1, + "messages": 1, + "ended": 1767323045000 + } + ] + } +} diff --git a/contract/lock.json b/contract/lock.json index 9c533de..75a1b3d 100644 --- a/contract/lock.json +++ b/contract/lock.json @@ -1,5 +1,5 @@ { - "ref": "45c1e0dcca5241aa930faf83199de781415dcdb2", - "commit": "45c1e0dcca5241aa930faf83199de781415dcdb2", - "sha256": "2b47bd88eff340c8f20fa267654c26bef45ac47d38d002d905015b966e55cf95" + "ref": "2fd3c031468a4ea34e187142020a7ec16c118a3e", + "commit": "2fd3c031468a4ea34e187142020a7ec16c118a3e", + "sha256": "b3bf3570ff57b64c0b9ae18243231e90b26da93b1c9684ea9f2fe173f7d786cc" } diff --git a/scripts/strings.py b/scripts/strings.py index ac88ba8..c9b9cfb 100755 --- a/scripts/strings.py +++ b/scripts/strings.py @@ -283,6 +283,7 @@ STRINGS: dict[str, str] = { "tree_context": "%1$s%% context", "tree_open_slots": "Open slots: %1$s", "card_asker": "%1$s asks:", + "card_subagent_asks": "Subagent %1$s (%2$s), %3$s, asks:", "card_it_says": "It says: %1$s", "card_change_before": "Change this before it runs", "card_edit_runs": "Allow runs what is in the box. It is not checked against this chat's rules again — you typed it.", @@ -410,6 +411,7 @@ SERVER_ENGLISH: dict[str, str] = { "progress_line": "{{text}} · {{elapsed}}", "tree_context": "{{percent}}% context", "card_asker": "%(job)s asks:", + "card_subagent_asks": "Subagent %(name)s (%(id)s), %(position)s, asks:", "card_it_says": "It says: %(purpose)s", "activity_used": "%(percent)s%% used", "activity_tools_offered": "%(n)s tools offered.",