diff --git a/packages/app/src/app/agent/[serverId]/[agentId].tsx b/packages/app/src/app/agent/[serverId]/[agentId].tsx
index 4d6828ae1..6518ca364 100644
--- a/packages/app/src/app/agent/[serverId]/[agentId].tsx
+++ b/packages/app/src/app/agent/[serverId]/[agentId].tsx
@@ -7,6 +7,7 @@ import {
Modal,
useWindowDimensions,
LayoutChangeEvent,
+ ScrollView,
} from "react-native";
import { useLocalSearchParams, useRouter } from "expo-router";
import { useFocusEffect } from "@react-navigation/native";
@@ -180,12 +181,13 @@ function AgentScreenContent({ serverId, agentId, onBack }: AgentScreenContentPro
// This prevents infinite loops caused by useShallow not doing deep equality on object arrays
const childAgents = useMemo(() => {
if (!resolvedAgentId || !allAgents) return [];
- const children: Array<{ id: string; title: string | null }> = [];
+ const children: Array<{ id: string; title: string | null; createdAt: Date }> = [];
for (const [id, a] of allAgents) {
if (a.parentAgentId === resolvedAgentId) {
- children.push({ id, title: a.title });
+ children.push({ id, title: a.title, createdAt: a.createdAt });
}
}
+ children.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
return children;
}, [allAgents, resolvedAgentId]);
@@ -644,22 +646,28 @@ function AgentScreenContent({ serverId, agentId, onBack }: AgentScreenContentPro
{childAgents.length === 0 ? (
No sub-agents
) : (
- childAgents.map((child) => (
- handleNavigateToChildAgent(child.id)}
- style={styles.menuSubAgentItem}
- >
- 3}
+ >
+ {childAgents.map((child) => (
+ handleNavigateToChildAgent(child.id)}
+ style={styles.menuSubAgentItem}
>
- {child.title || "Untitled Agent"}
-
-
-
- ))
+
+ {child.title || "Untitled Agent"}
+
+
+
+ ))}
+
)}
@@ -932,6 +940,12 @@ const styles = StyleSheet.create((theme) => ({
paddingHorizontal: theme.spacing[3],
paddingVertical: theme.spacing[2],
},
+ menuSubAgentsList: {
+ maxHeight: (theme.spacing[2] * 2 + theme.fontSize.sm) * 3,
+ },
+ menuSubAgentsListContent: {
+ gap: theme.spacing[1],
+ },
menuSubAgentItem: {
flexDirection: "row",
alignItems: "center",