Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(ruflo-console): the claims view picks the newest open task first

ruvbe2fc099b971
diff --git a/plugins/ruflo-console/hooks/data/parse.ts b/plugins/ruflo-console/hooks/data/parse.ts
index d6e95a9406..0b0da93fb3 100644
--- a/plugins/ruflo-console/hooks/data/parse.ts
+++ b/plugins/ruflo-console/hooks/data/parse.ts
@@ -66,7 +66,7 @@ export const msOf = (value: unknown): number | undefined => {
export type SwarmInfo = { id: string; topology: string; status: string; maxAgents?: number; strategy?: string; agentIds: string[]; updatedAt?: string }
export type AgentRecord = { id: string; type: string; name?: string; status: string; health?: number; taskCount?: number; createdAtMs?: number }
-export type TaskRecord = { id: string; type: string; description: string; status: string; assignedTo: string[] }
+export type TaskRecord = { id: string; type: string; description: string; status: string; assignedTo: string[]; createdAtMs?: number }
export type Claimant = { kind: 'agent' | 'human'; id: string; agentType?: string; name?: string }
export type ClaimRecord = {
issueId: string
@@ -182,6 +182,7 @@ export function parseTasks(text: string | null): TaskRecord[] {
description: plain(task.description, 200),
status: stringOf(task.status, 20) ?? 'unknown',
assignedTo: (Array.isArray(task.assignedTo) ? task.assignedTo : []).slice(0, 50).flatMap(agent => (idOf(agent) !== null ? [agent as string] : [])),
+ ...(msOf(task.createdAt) !== undefined && { createdAtMs: msOf(task.createdAt) }),
},
]
})
diff --git a/plugins/ruflo-console/hooks/views/select.ts b/plugins/ruflo-console/hooks/views/select.ts
index a045c2e7aa..b198bbf5cc 100644
--- a/plugins/ruflo-console/hooks/views/select.ts
+++ b/plugins/ruflo-console/hooks/views/select.ts
@@ -3,11 +3,11 @@ import type { State } from '../state'
const at = <T>(list: readonly T[], index: number): T | null => (list.length === 0 ? null : (list[((index % list.length) + list.length) % list.length] ?? null))
-/** Tasks no claim names and ruflo does not mark done: what "Claim task" can take. */
+/** Tasks no claim names and ruflo does not mark done, newest first: what "Claim task" can take. */
export const openTasks = (state: State): TaskRecord[] => {
const claimed = new Set((state.snapshot?.claims ?? []).map(claim => claim.issueId))
- return (state.snapshot?.tasks ?? []).filter(task => !claimed.has(task.id) && !/complete|done|cancel|fail/i.test(task.status))
+ return (state.snapshot?.tasks ?? []).filter(task => !claimed.has(task.id) && !/complete|done|cancel|fail/i.test(task.status)).sort((a, b) => (b.createdAtMs ?? 0) - (a.createdAtMs ?? 0))
}
/** What the claims view's buttons act on: indexes wrap, so a re-read that shortens a list never strands them. */