summaryrefslogtreecommitdiff
path: root/subagents
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-09-02 09:30:11 -0600
committert <t@tjp.lol>2026-09-02 09:30:55 -0600
commitfd2b3dfd85d8d87716481425216abc5e8cdd9c1b (patch)
tree25c9dc386150d963c39e6883803f69a4b2d6bcd3 /subagents
parent997d80bc69a6363e8c65a987dace0e30d761522d (diff)
Sort completed subagents above active ones
Diffstat (limited to 'subagents')
-rw-r--r--subagents/progress.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/subagents/progress.lua b/subagents/progress.lua
index 7cad2fa..fc86935 100644
--- a/subagents/progress.lua
+++ b/subagents/progress.lua
@@ -202,9 +202,21 @@ function card_mt:event(event)
repaint(self)
end
+local function sort_cards(board)
+ local positions = {}
+ for index, card in ipairs(board.cards) do positions[card] = index end
+ table.sort(board.cards, function(a, b)
+ local a_done, b_done = a.status ~= "running", b.status ~= "running"
+ if a_done ~= b_done then return a_done end
+ if a.sequence ~= b.sequence then return a.sequence < b.sequence end
+ return positions[a] < positions[b]
+ end)
+end
+
function card_mt:done(status, message)
self.status = GLYPHS[status] and status or "failed"
if self.status ~= "completed" then marker(self, message) else self.partial = false end
+ if self.board then sort_cards(self.board) end
repaint(self)
end