AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(platform/library): Infinite scroll in Agent Runs list (#10709)
Reinier van der Leeraa256f21cdb5
diff --git a/autogpt_platform/backend/backend/data/execution.py b/autogpt_platform/backend/backend/data/execution.pyindex 6b2aa5c60c..2e484fdc84 100644--- a/autogpt_platform/backend/backend/data/execution.py+++ b/autogpt_platform/backend/backend/data/execution.py@@ -39,6 +39,7 @@ from pydantic.fields import Fieldfrom backend.server.v2.store.exceptions import DatabaseErrorfrom backend.util import type as type_utilsfrom backend.util.json import SafeJson+from backend.util.models import Paginationfrom backend.util.retry import func_retryfrom backend.util.settings import Configfrom backend.util.truncate import truncate@@ -89,6 +90,7 @@ ExecutionStatus = AgentExecutionStatusclass GraphExecutionMeta(BaseDbModel):+ id: str # type: ignore # Override base class to make this requireduser_id: strgraph_id: strgraph_version: int@@ -384,13 +386,13 @@ class NodeExecutionResult(BaseModel):async def get_graph_executions(- graph_exec_id: str | None = None,- graph_id: str | None = None,- user_id: str | None = None,- statuses: list[ExecutionStatus] | None = None,- created_time_gte: datetime | None = None,- created_time_lte: datetime | None = None,- limit: int | None = None,+ graph_exec_id: Optional[str] = None,+ graph_id: Optional[str] = None,+ user_id: Optional[str] = None,+ statuses: Optional[list[ExecutionStatus]] = None,+ created_time_gte: Optional[datetime] = None,+ created_time_lte: Optional[datetime] = None,+ limit: Optional[int] = None,) -> list[GraphExecutionMeta]:"""⚠️ **Optional `user_id` check**: MUST USE check in user-facing endpoints."""where_filter: AgentGraphExecutionWhereInput = {@@ -418,6 +420,60 @@ async def get_graph_executions(return [GraphExecutionMeta.from_db(execution) for execution in executions]+class GraphExecutionsPaginated(BaseModel):+ """Response schema for paginated graph executions."""++ executions: list[GraphExecutionMeta]+ pagination: Pagination+++async def get_graph_executions_paginated(+ user_id: str,+ graph_id: Optional[str] = None,+ page: int = 1,+ page_size: int = 25,+ statuses: Optional[list[ExecutionStatus]] = None,+ created_time_gte: Optional[datetime] = None,+ created_time_lte: Optional[datetime] = None,+) -> GraphExecutionsPaginated:+ """Get paginated graph executions for a specific graph."""+ where_filter: AgentGraphExecutionWhereInput = {+ "isDeleted": False,+ "userId": user_id,+ }++ if graph_id:+ where_filter["agentGraphId"] = graph_id+ if created_time_gte or created_time_lte:+ where_filter["createdAt"] = {+ "gte": created_time_gte or datetime.min.replace(tzinfo=timezone.utc),+ "lte": created_time_lte or datetime.max.replace(tzinfo=timezone.utc),+ }+ if statuses:+ where_filter["OR"] = [{"executionStatus": status} for status in statuses]++ total_count = await AgentGraphExecution.prisma().count(where=where_filter)+ total_pages = (total_count + page_size - 1) // page_size++ offset = (page - 1) * page_size+ executions = await AgentGraphExecution.prisma().find_many(+ where=where_filter,+ order={"createdAt": "desc"},+ take=page_size,+ skip=offset,+ )++ return GraphExecutionsPaginated(+ executions=[GraphExecutionMeta.from_db(execution) for execution in executions],+ pagination=Pagination(+ total_items=total_count,+ total_pages=total_pages,+ current_page=page,+ page_size=page_size,+ ),+ )++async def get_graph_execution_meta(user_id: str, execution_id: str) -> GraphExecutionMeta | None:diff --git a/autogpt_platform/backend/backend/server/routers/v1.py b/autogpt_platform/backend/backend/server/routers/v1.pyindex 3655ccb6ef..41cdec3c6b 100644--- a/autogpt_platform/backend/backend/server/routers/v1.py+++ b/autogpt_platform/backend/backend/server/routers/v1.py@@ -15,6 +15,7 @@ from fastapi import (File,HTTPException,Path,+ Query,Request,Response,UploadFile,@@ -84,7 +85,6 @@ from backend.server.utils import get_user_idfrom backend.util.clients import get_scheduler_clientfrom backend.util.cloud_storage import get_cloud_storage_handlerfrom backend.util.exceptions import GraphValidationError, NotFoundError-from backend.util.feature_flag import feature_flagfrom backend.util.settings import Settingsfrom backend.util.virus_scanner import scan_content_safe@@ -820,11 +820,11 @@ async def _stop_graph_run(@v1_router.get(path="/executions",- summary="Get all executions",+ summary="List all executions",tags=["graphs"],dependencies=[Depends(auth_middleware)],)-async def get_graphs_executions(+async def list_graphs_executions(user_id: Annotated[str, Depends(get_user_id)],) -> list[execution_db.GraphExecutionMeta]:return await execution_db.get_graph_executions(user_id=user_id)@@ -832,15 +832,24 @@ async def get_graphs_executions(@v1_router.get(path="/graphs/{graph_id}/executions",- summary="Get graph executions",+ summary="List graph executions",tags=["graphs"],dependencies=[Depends(auth_middleware)],)-async def get_graph_executions(+async def list_graph_executions(graph_id: str,user_id: Annotated[str, Depends(get_user_id)],-) -> list[execution_db.GraphExecutionMeta]:- return await execution_db.get_graph_executions(graph_id=graph_id, user_id=user_id)+ page: int = Query(1, ge=1, description="Page number (1-indexed)"),+ page_size: int = Query(+ 25, ge=1, le=100, description="Number of executions per page"+ ),+) -> execution_db.GraphExecutionsPaginated:+ return await execution_db.get_graph_executions_paginated(+ graph_id=graph_id,+ user_id=user_id,+ page=page,+ page_size=page_size,+ )@v1_router.get(diff --git a/autogpt_platform/frontend/orval.config.ts b/autogpt_platform/frontend/orval.config.tsindex b37290cd81..434ba70a4c 100644--- a/autogpt_platform/frontend/orval.config.ts+++ b/autogpt_platform/frontend/orval.config.ts@@ -27,6 +27,7 @@ export default defineConfig({usePrefetch: true,// Will add more as their use cases arise},+ useDates: true,operations: {"getV2List library agents": {query: {@@ -34,6 +35,12 @@ export default defineConfig({useInfiniteQueryParam: "page",},},+ "getV1List graph executions": {+ query: {+ useInfinite: true,+ useInfiniteQueryParam: "page",+ },+ },},},},diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsxindex f485f56e54..7d13ea7546 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx@@ -41,6 +41,7 @@ import LoadingBox, { LoadingSpinner } from "@/components/ui/loading";import { useToast } from "@/components/molecules/Toast/use-toast";import { AgentRunDetailsView } from "./components/agent-run-details-view";import { AgentRunDraftView } from "./components/agent-run-draft-view";+import { useAgentRunsInfinite } from "../use-agent-runs";import { AgentRunsSelectorList } from "./components/agent-runs-selector-list";import { AgentScheduleDetailsView } from "./components/agent-schedule-details-view";@@ -55,7 +56,8 @@ export function OldAgentLibraryView() {const [graph, setGraph] = useState<Graph | null>(null); // Graph version corresponding to LibraryAgentconst [agent, setAgent] = useState<LibraryAgent | null>(null);- const [agentRuns, setAgentRuns] = useState<GraphExecutionMeta[]>([]);+ const agentRunsQuery = useAgentRunsInfinite(graph?.id); // only runs once graph.id is known+ const agentRuns = agentRunsQuery.agentRuns;const [agentPresets, setAgentPresets] = useState<LibraryAgentPreset[]>([]);const [schedules, setSchedules] = useState<Schedule[]>([]);const [selectedView, selectView] = useState<@@ -156,19 +158,22 @@ export function OldAgentLibraryView() {(graph && graph.version == _graph.version) || setGraph(_graph),);Promise.all([- api.getGraphExecutions(agent.graph_id),+ agentRunsQuery.refetchRuns(),api.listLibraryAgentPresets({graph_id: agent.graph_id,page_size: 100,}),- ]).then(([runs, presets]) => {- setAgentRuns(runs);+ ]).then(([runsQueryResult, presets]) => {setAgentPresets(presets.presets);+ const newestAgentRunsResponse = runsQueryResult.data?.pages[0];+ if (!newestAgentRunsResponse || newestAgentRunsResponse.status != 200)+ return;+ const newestAgentRuns = newestAgentRunsResponse.data.executions;// Preload the corresponding graph versions for the latest 10 runs- new Set(runs.slice(0, 10).map((run) => run.graph_version)).forEach(- (version) => getGraphVersion(agent.graph_id, version),- );+ new Set(+ newestAgentRuns.slice(0, 10).map((run) => run.graph_version),+ ).forEach((version) => getGraphVersion(agent.graph_id, version));});});}, [api, agentID, getGraphVersion, graph]);@@ -187,7 +192,7 @@ export function OldAgentLibraryView() {else if (!latest.started_at) return latest;return latest.started_at > current.started_at ? latest : current;}, agentRuns[0]);- selectRun(latestRun.id);+ selectRun(latestRun.id as GraphExecutionID);} else {// select top presetconst latestPreset = agentPresets.toSorted(@@ -277,18 +282,7 @@ export function OldAgentLibraryView() {incrementRuns();}- setAgentRuns((prev) => {- const index = prev.findIndex((run) => run.id === data.id);- if (index === -1) {- return [...prev, data];- }- const newRuns = [...prev];- newRuns[index] = { ...newRuns[index], ...data };- return newRuns;- });- if (data.id === selectedView.id) {- setSelectedRun((prev) => ({ ...prev, ...data }));- }+ agentRunsQuery.upsertAgentRun(data);},);@@ -344,7 +338,7 @@ export function OldAgentLibraryView() {if (selectedView.type == "run" && selectedView.id == run.id) {openRunDraftView();}- setAgentRuns((runs) => runs.filter((r) => r.id !== run.id));+ agentRunsQuery.removeAgentRun(run.id);},[api, selectedView, openRunDraftView],);@@ -481,9 +475,9 @@ export function OldAgentLibraryView() {{/* Sidebar w/ list of runs */}{/* TODO: render this below header in sm and md layouts */}<AgentRunsSelectorList- className="agpt-div w-full border-b lg:w-auto lg:border-b-0 lg:border-r"+ className="agpt-div w-full border-b pb-2 lg:w-auto lg:border-b-0 lg:border-r lg:pb-0"agent={agent}- agentRuns={agentRuns}+ agentRunsQuery={agentRunsQuery}agentPresets={agentPresets}schedules={schedules}selectedView={selectedView}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-runs-selector-list.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-runs-selector-list.tsxindex 6abdc815ed..0645d22496 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-runs-selector-list.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-runs-selector-list.tsx@@ -14,16 +14,19 @@ import {import { cn } from "@/lib/utils";import { Badge } from "@/components/ui/badge";-import { ScrollArea } from "@/components/ui/scroll-area";+import { Button } from "@/components/atoms/Button/Button";+import LoadingBox from "@/components/ui/loading";+import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll";import { Separator } from "@/components/ui/separator";import { agentRunStatusMap } from "@/components/agents/agent-run-status-chip";import AgentRunSummaryCard from "@/components/agents/agent-run-summary-card";-import { Button } from "../../../../../../../../components/atoms/Button/Button";+import { AgentRunsQuery } from "../../use-agent-runs";+import { ScrollArea } from "@/components/ui/scroll-area";interface AgentRunsSelectorListProps {agent: LibraryAgent;- agentRuns: GraphExecutionMeta[];+ agentRunsQuery: AgentRunsQuery;agentPresets: LibraryAgentPreset[];schedules: Schedule[];selectedView: { type: "run" | "preset" | "schedule"; id?: string };@@ -40,7 +43,13 @@ interface AgentRunsSelectorListProps {export function AgentRunsSelectorList({agent,- agentRuns,+ agentRunsQuery: {+ agentRuns,+ agentRunsLoading,+ hasMoreRuns,+ fetchMoreRuns,+ isFetchingMoreRuns,+ },agentPresets,schedules,selectedView,@@ -66,7 +75,7 @@ export function AgentRunsSelectorList({}}, [selectedView]);- const listItemClasses = "h-28 w-72 lg:h-32 xl:w-80";+ const listItemClasses = "h-28 w-72 lg:w-full lg:h-32";return (<aside className={cn("flex flex-col gap-4", className)}>@@ -101,84 +110,99 @@ export function AgentRunsSelectorList({</div>{/* Runs / Schedules list */}- <ScrollArea className="lg:h-[calc(100vh-200px)]">- <div className="flex gap-2 lg:flex-col">- {/* New Run button - only in small layouts */}- {allowDraftNewRun && (- <Button- size="large"- className={- "flex h-28 w-40 items-center gap-2 py-6 lg:hidden " +- (selectedView.type == "run" && !selectedView.id- ? "agpt-card-selected text-accent"- : "")- }- onClick={onSelectDraftNewRun}- leftIcon={<Plus className="h-6 w-6" />}- >- New {agent.has_external_trigger ? "trigger" : "run"}- </Button>- )}+ {agentRunsLoading && activeListTab === "runs" ? (+ <LoadingBox className="h-28 w-full lg:h-[calc(100vh-300px)] lg:w-72 xl:w-80" />+ ) : (+ <ScrollArea+ className="w-full lg:h-[calc(100vh-300px)] lg:w-72 xl:w-80"+ orientation={window.innerWidth >= 1024 ? "vertical" : "horizontal"}+ >+ <InfiniteScroll+ direction={window.innerWidth >= 1024 ? "vertical" : "horizontal"}+ hasNextPage={hasMoreRuns}+ fetchNextPage={fetchMoreRuns}+ isFetchingNextPage={isFetchingMoreRuns}+ >+ <div className="flex items-center gap-2 lg:flex-col">+ {/* New Run button - only in small layouts */}+ {allowDraftNewRun && (+ <Button+ size="large"+ className={+ "flex h-12 w-40 items-center gap-2 py-6 lg:hidden " ++ (selectedView.type == "run" && !selectedView.id+ ? "agpt-card-selected text-accent"+ : "")+ }+ onClick={onSelectDraftNewRun}+ leftIcon={<Plus className="h-6 w-6" />}+ >+ New {agent.has_external_trigger ? "trigger" : "run"}+ </Button>+ )}- {activeListTab === "runs" ? (- <>- {agentPresets- .toSorted(- (a, b) => b.updated_at.getTime() - a.updated_at.getTime(),- )- .map((preset) => (- <AgentRunSummaryCard- className={cn(listItemClasses, "lg:h-auto")}- key={preset.id}- type="preset"- status={preset.is_active ? "active" : "inactive"}- title={preset.name}- // timestamp={preset.last_run_time} // TODO: implement this- selected={selectedView.id === preset.id}- onClick={() => onSelectPreset(preset.id)}- onDelete={() => doDeletePreset(preset.id)}- />- ))}- {agentPresets.length > 0 && <Separator className="my-1" />}- {agentRuns- .toSorted(- (a, b) => b.started_at.getTime() - a.started_at.getTime(),- )- .map((run) => (+ {activeListTab === "runs" ? (+ <>+ {agentPresets+ .toSorted(+ (a, b) => b.updated_at.getTime() - a.updated_at.getTime(),+ )+ .map((preset) => (+ <AgentRunSummaryCard+ className={cn(listItemClasses, "lg:h-auto")}+ key={preset.id}+ type="preset"+ status={preset.is_active ? "active" : "inactive"}+ title={preset.name}+ // timestamp={preset.last_run_time} // TODO: implement this+ selected={selectedView.id === preset.id}+ onClick={() => onSelectPreset(preset.id)}+ onDelete={() => doDeletePreset(preset.id)}+ />+ ))}+ {agentPresets.length > 0 && <Separator className="my-1" />}+ {agentRuns+ .toSorted(+ (a, b) => b.started_at.getTime() - a.started_at.getTime(),+ )+ .map((run) => (+ <AgentRunSummaryCard+ className={listItemClasses}+ key={run.id}+ type="run"+ status={agentRunStatusMap[run.status]}+ title={+ (run.preset_id+ ? agentPresets.find((p) => p.id == run.preset_id)+ ?.name+ : null) ?? agent.name+ }+ timestamp={run.started_at}+ selected={selectedView.id === run.id}+ onClick={() => onSelectRun(run.id)}+ onDelete={() => doDeleteRun(run)}+ />+ ))}+ </>+ ) : (+ schedules.map((schedule) => (<AgentRunSummaryCardclassName={listItemClasses}- key={run.id}- type="run"- status={agentRunStatusMap[run.status]}- title={- (run.preset_id- ? agentPresets.find((p) => p.id == run.preset_id)?.name- : null) ?? agent.name- }- timestamp={run.started_at}- selected={selectedView.id === run.id}- onClick={() => onSelectRun(run.id)}- onDelete={() => doDeleteRun(run)}+ key={schedule.id}+ type="schedule"+ status="scheduled" // TODO: implement active/inactive status for schedules+ title={schedule.name}+ timestamp={schedule.next_run_time}+ selected={selectedView.id === schedule.id}+ onClick={() => onSelectSchedule(schedule.id)}+ onDelete={() => doDeleteSchedule(schedule.id)}/>- ))}- </>- ) : (- schedules.map((schedule) => (- <AgentRunSummaryCard- className={listItemClasses}- key={schedule.id}- type="schedule"- status="scheduled" // TODO: implement active/inactive status for schedules- title={schedule.name}- timestamp={schedule.next_run_time}- selected={selectedView.id === schedule.id}- onClick={() => onSelectSchedule(schedule.id)}- onDelete={() => doDeleteSchedule(schedule.id)}- />- ))- )}- </div>- </ScrollArea>+ ))+ )}+ </div>+ </InfiniteScroll>+ </ScrollArea>+ )}</aside>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/use-agent-runs.ts b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/use-agent-runs.tsnew file mode 100644index 0000000000..476b4bdf6d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/use-agent-runs.ts@@ -0,0 +1,201 @@+import {+ getV1ListGraphExecutionsResponse,+ useGetV1ListGraphExecutionsInfinite,+} from "@/app/api/__generated__/endpoints/graphs/graphs";+import { GraphExecutionsPaginated } from "@/app/api/__generated__/models/graphExecutionsPaginated";+import { getQueryClient } from "@/lib/react-query/queryClient";+import {+ GraphExecutionMeta as LegacyGraphExecutionMeta,+ GraphID,+ GraphExecutionID,+} from "@/lib/autogpt-server-api";+import { GraphExecutionMeta as RawGraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutionMeta";++export type GraphExecutionMeta = Omit<+ RawGraphExecutionMeta,+ "id" | "user_id" | "graph_id" | "preset_id" | "stats"+> &+ Pick<+ LegacyGraphExecutionMeta,+ "id" | "user_id" | "graph_id" | "preset_id" | "stats"+ >;++/** Hook to fetch runs for a specific graph, with support for infinite scroll.+ *+ * @param graphID - The ID of the graph to fetch agent runs for. This parameter is+ * optional in the sense that the hook doesn't run unless it is passed.+ * This way, it can be used in components where the graph ID is not+ * immediately available.+ */+export const useAgentRunsInfinite = (graphID?: GraphID) => {+ const queryClient = getQueryClient();+ const {+ data: queryResults,+ refetch: refetchRuns,+ isPending: agentRunsLoading,+ isRefetching: agentRunsReloading,+ hasNextPage: hasMoreRuns,+ fetchNextPage: fetchMoreRuns,+ isFetchingNextPage: isFetchingMoreRuns,+ queryKey,+ } = useGetV1ListGraphExecutionsInfinite(+ graphID!,+ { page: 1, page_size: 20 },+ {+ query: {+ getNextPageParam: (lastPage) => {+ const pagination = (lastPage.data as GraphExecutionsPaginated)+ .pagination;+ const hasMore =+ pagination.current_page * pagination.page_size <+ pagination.total_items;++ return hasMore ? pagination.current_page + 1 : undefined;+ },++ // Prevent query from running if graphID is not available (yet)+ ...(!graphID+ ? {+ enabled: false,+ queryFn: () =>+ // Fake empty response if graphID is not available (yet)+ Promise.resolve({+ status: 200,+ data: {+ executions: [],+ pagination: {+ current_page: 1,+ page_size: 20,+ total_items: 0,+ total_pages: 0,+ },+ },+ headers: new Headers(),+ } satisfies getV1ListGraphExecutionsResponse),+ }+ : {}),+ },+ },+ queryClient,+ );++ const agentRuns =+ queryResults?.pages.flatMap((page) => {+ const response = page.data as GraphExecutionsPaginated;+ return response.executions;+ }) ?? [];++ const agentRunCount = queryResults?.pages[-1]+ ? (queryResults.pages[-1].data as GraphExecutionsPaginated).pagination+ .total_items+ : 0;++ const upsertAgentRun = (newAgentRun: GraphExecutionMeta) => {+ queryClient.setQueryData(+ [queryKey, { page: 1, page_size: 20 }],+ (currentQueryData: typeof queryResults) => {+ if (!currentQueryData?.pages) return currentQueryData;++ const exists = currentQueryData.pages.some((page) => {+ const response = page.data as GraphExecutionsPaginated;+ return response.executions.some((run) => run.id === newAgentRun.id);+ });+ if (exists) {+ // If the run already exists, we update it+ return {+ ...currentQueryData,+ pages: currentQueryData.pages.map((page) => {+ const response = page.data as GraphExecutionsPaginated;+ const executions = response.executions;++ const index = executions.findIndex(+ (run) => run.id === newAgentRun.id,+ );+ if (index === -1) return page;++ const newExecutions = [...executions];+ newExecutions[index] = newAgentRun;++ return {+ ...page,+ data: {+ ...response,+ executions: newExecutions,+ },+ };+ }),+ };+ }++ // If the run does not exist, we add it to the first page+ const page = currentQueryData.pages[0];+ const updatedExecutions = [+ newAgentRun,+ ...(page.data as GraphExecutionsPaginated).executions,+ ];+ const updatedPage = {+ ...page,+ data: {+ ...page.data,+ executions: updatedExecutions,+ },+ };+ const updatedPages = [updatedPage, ...currentQueryData.pages.slice(1)];+ return {+ ...currentQueryData,+ pages: updatedPages,+ };+ },+ );+ };++ const removeAgentRun = (runID: GraphExecutionID) => {+ queryClient.setQueryData(+ [queryKey, { page: 1, page_size: 20 }],+ (currentQueryData: typeof queryResults) => {+ if (!currentQueryData?.pages) return currentQueryData;++ let found = false;+ return {+ ...currentQueryData,+ pages: currentQueryData.pages.map((page) => {+ const response = page.data as GraphExecutionsPaginated;+ const filteredExecutions = response.executions.filter(+ (run) => run.id !== runID,+ );+ if (filteredExecutions.length < response.executions.length) {+ found = true;+ }++ return {+ ...page,+ data: {+ ...response,+ executions: filteredExecutions,+ pagination: {+ ...response.pagination,+ total_items:+ response.pagination.total_items - (found ? 1 : 0),+ },+ },+ };+ }),+ };+ },+ );+ };++ return {+ agentRuns: agentRuns as GraphExecutionMeta[],+ refetchRuns,+ agentRunCount,+ agentRunsLoading: agentRunsLoading || agentRunsReloading,+ hasMoreRuns,+ fetchMoreRuns,+ isFetchingMoreRuns,+ upsertAgentRun,+ removeAgentRun,+ };+};++export type AgentRunsQuery = ReturnType<typeof useAgentRunsInfinite>;diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsxindex 4caa28d482..1b3926a6e1 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx@@ -28,7 +28,6 @@ export default function LibraryAgentList() {</div>) : (<InfiniteScroll- dataLength={agents.length}isFetchingNextPage={isFetchingNextPage}fetchNextPage={fetchNextPage}hasNextPage={hasNextPage}diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableCard/AgentTableCard.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableCard/AgentTableCard.tsxindex beae6ef010..1c078eea7d 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableCard/AgentTableCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableCard/AgentTableCard.tsx@@ -13,7 +13,7 @@ export interface AgentTableCardProps {sub_heading: string;description: string;imageSrc: string[];- dateSubmitted: string;+ dateSubmitted: Date;status: SubmissionStatus;runs: number;rating: number;@@ -80,7 +80,7 @@ export const AgentTableCard = ({<div className="mt-4 flex flex-wrap gap-4"><Status status={status} /><div className="text-sm text-neutral-600 dark:text-neutral-400">- {dateSubmitted}+ {dateSubmitted.toLocaleDateString()}</div><div className="text-sm text-neutral-600 dark:text-neutral-400">{runs.toLocaleString()} runsdiff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsxindex 8e85f7d66b..855c4d2f99 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/AgentTableRow.tsx@@ -25,11 +25,10 @@ export interface AgentTableRowProps {sub_heading: string;description: string;imageSrc: string[];- date_submitted: string;+ dateSubmitted: Date;status: SubmissionStatus;runs: number;rating: number;- dateSubmitted: string;id: number;video_url?: string;categories?: string[];@@ -130,7 +129,7 @@ export const AgentTableRow = ({{/* Date column */}<div className="text-sm text-neutral-600 dark:text-neutral-400">- {dateSubmitted}+ {dateSubmitted.toLocaleDateString()}</div>{/* Status column */}diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.tsindex 61359c231a..7014eec198 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/AgentTableRow/useAgentTableRow.ts@@ -18,7 +18,7 @@ interface useAgentTableRowProps {sub_heading: string;description: string;imageSrc: string[];- dateSubmitted: string;+ dateSubmitted: Date;status: SubmissionStatus;runs: number;rating: number;diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsxindex c466e9b9b9..9b10ecf088 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/MainDashboardPage.tsx@@ -86,13 +86,10 @@ export const MainDashboardPage = () => {agent_id: submission.agent_id,agent_version: submission.agent_version,sub_heading: submission.sub_heading,- date_submitted: submission.date_submitted,agentName: submission.name,description: submission.description,imageSrc: submission.image_urls || [""],- dateSubmitted: new Date(- submission.date_submitted,- ).toLocaleDateString(),+ dateSubmitted: submission.date_submitted,status: submission.status,runs: submission.runs,rating: submission.rating,diff --git a/autogpt_platform/frontend/src/app/api/mutators/custom-mutator.ts b/autogpt_platform/frontend/src/app/api/mutators/custom-mutator.tsindex 740e4e7ca1..aa443cf3c1 100644--- a/autogpt_platform/frontend/src/app/api/mutators/custom-mutator.ts+++ b/autogpt_platform/frontend/src/app/api/mutators/custom-mutator.ts@@ -5,6 +5,8 @@ import {import { isServerSide } from "@/lib/utils/is-server-side";import { getAgptServerBaseUrl } from "@/lib/env-config";+import { transformDates } from "./date-transformer";+const FRONTEND_BASE_URL =process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || "http://localhost:3000";const API_PROXY_BASE_URL = `${FRONTEND_BASE_URL}/api/proxy`; // Sending request via nextjs Server@@ -98,9 +100,12 @@ export const customMutator = async <T = any>(const response_data = await getBody<T>(response);+ // Transform ISO date strings to Date objects in the response data+ const transformedData = transformDates(response_data);+return {status: response.status,- data: response_data,+ data: transformedData,headers: response.headers,} as T;};diff --git a/autogpt_platform/frontend/src/app/api/mutators/date-transformer.ts b/autogpt_platform/frontend/src/app/api/mutators/date-transformer.tsnew file mode 100644index 0000000000..575495a3db--- /dev/null+++ b/autogpt_platform/frontend/src/app/api/mutators/date-transformer.ts@@ -0,0 +1,51 @@+/**+ * Date transformation utility for converting ISO date strings to Date objects+ * in API responses. This handles the conversion recursively for nested objects.+ */++// ISO date regex pattern to match strings that look like ISO dates+const ISO_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z?$/;++/**+ * Validates if a string is a valid ISO date and can be parsed+ */+function isValidISODate(dateString: string): boolean {+ if (!ISO_DATE_REGEX.test(dateString)) {+ return false;+ }++ const date = new Date(dateString);+ return !isNaN(date.getTime());+}++/**+ * Recursively transforms ISO date strings to Date objects in an object or array+ * @param obj - The object or array to transform+ * @returns The transformed object with Date objects+ */+export function transformDates<T>(obj: T): T {+ if (typeof obj !== "object" || obj === null) return obj;++ // Handle arrays+ if (Array.isArray(obj)) {+ return obj.map(transformDates) as T;+ }++ // Handle objects+ const transformed = {} as T;++ for (const [key, value] of Object.entries(obj)) {+ if (typeof value === "string" && isValidISODate(value)) {+ // Convert ISO date string to Date object+ (transformed as any)[key] = new Date(value);+ } else if (typeof value === "object") {+ // Recursively transform nested objects/arrays+ (transformed as any)[key] = transformDates(value);+ } else {+ // Keep primitive values as-is+ (transformed as any)[key] = value;+ }+ }++ return transformed;+}diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 13cb2f8359..45e65272ab 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -1580,8 +1580,8 @@"/api/executions": {"get": {"tags": ["v1", "graphs"],- "summary": "Get all executions",- "operationId": "getV1Get all executions",+ "summary": "List all executions",+ "operationId": "getV1List all executions","responses": {"200": {"description": "Successful Response",@@ -1592,7 +1592,7 @@"$ref": "#/components/schemas/GraphExecutionMeta"},"type": "array",- "title": "Response Getv1Get All Executions"+ "title": "Response Getv1List All Executions"}}}@@ -1603,14 +1603,41 @@"/api/graphs/{graph_id}/executions": {"get": {"tags": ["v1", "graphs"],- "summary": "Get graph executions",- "operationId": "getV1Get graph executions",+ "summary": "List graph executions",+ "operationId": "getV1List graph executions","parameters": [{"name": "graph_id","in": "path","required": true,"schema": { "type": "string", "title": "Graph Id" }+ },+ {+ "name": "page",+ "in": "query",+ "required": false,+ "schema": {+ "type": "integer",+ "minimum": 1,+ "description": "Page number (1-indexed)",+ "default": 1,+ "title": "Page"+ },+ "description": "Page number (1-indexed)"+ },+ {+ "name": "page_size",+ "in": "query",+ "required": false,+ "schema": {+ "type": "integer",+ "maximum": 100,+ "minimum": 1,+ "description": "Number of executions per page",+ "default": 25,+ "title": "Page Size"+ },+ "description": "Number of executions per page"}],"responses": {@@ -1619,11 +1646,7 @@"content": {"application/json": {"schema": {- "type": "array",- "items": {- "$ref": "#/components/schemas/GraphExecutionMeta"- },- "title": "Response Getv1Get Graph Executions"+ "$ref": "#/components/schemas/GraphExecutionsPaginated"}}}@@ -4484,6 +4507,7 @@},"type": "object","required": [+ "id","user_id","graph_id","graph_version",@@ -4561,6 +4585,7 @@},"type": "object","required": [+ "id","user_id","graph_id","graph_version",@@ -4616,6 +4641,7 @@},"type": "object","required": [+ "id","user_id","graph_id","graph_version",@@ -4629,6 +4655,20 @@],"title": "GraphExecutionWithNodes"},+ "GraphExecutionsPaginated": {+ "properties": {+ "executions": {+ "items": { "$ref": "#/components/schemas/GraphExecutionMeta" },+ "type": "array",+ "title": "Executions"+ },+ "pagination": { "$ref": "#/components/schemas/Pagination" }+ },+ "type": "object",+ "required": ["executions", "pagination"],+ "title": "GraphExecutionsPaginated",+ "description": "Response schema for paginated graph executions."+ },"GraphMeta": {"properties": {"id": { "type": "string", "title": "Id" },diff --git a/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/InfiniteScroll.tsx b/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/InfiniteScroll.tsxindex ae4f6f03e7..324293bc9c 100644--- a/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/InfiniteScroll.tsx+++ b/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/InfiniteScroll.tsx@@ -3,61 +3,70 @@import React from "react";import { cn } from "@/lib/utils";import { useInfiniteScroll } from "./useInfiniteScroll";+import LoadingBox from "@/components/ui/loading";-interface InfiniteScrollProps {+type InfiniteScrollProps = {children: React.ReactNode;- dataLength: number;hasNextPage: boolean;loader?: React.ReactNode;- endMessage?: React.ReactNode;scrollThreshold?: number;className?: string;- scrollableTarget?: string;onLoadMore?: () => void;isFetchingNextPage: boolean;fetchNextPage: () => void;-}+ direction?: "vertical" | "horizontal";+} & (+ | {+ loadedItemsCount: number;+ endMessage: React.ReactNode;+ }+ | {+ loadedItemsCount?: never;+ endMessage?: never;+ }+);export const InfiniteScroll: React.FC<InfiniteScrollProps> = ({children,- dataLength,+ loadedItemsCount,hasNextPage,loader,endMessage,className,scrollThreshold = 20,- scrollableTarget,onLoadMore,isFetchingNextPage,fetchNextPage,+ direction = "vertical",}) => {- const { containerRef, bottomRef } = useInfiniteScroll({+ const { containerRef, endOfListRef } = useInfiniteScroll({isFetchingNextPage,fetchNextPage,scrollThreshold,- scrollableTarget,onLoadMore,hasNextPage,});- const defaultLoader = (- <div className="flex w-full items-center justify-center py-4">- <div className="h-8 w-8 animate-spin rounded-full border-b-2 border-t-2 border-neutral-800" />- </div>- );+ const defaultLoader = <LoadingBox className="w-full py-4" spinnerSize={12} />;return (- <div ref={containerRef} className={cn("w-full", className)}>+ <div+ ref={containerRef}+ className={cn(+ direction === "vertical" ? "w-full" : "flex h-full items-center",+ className,+ )}+ >{children}{hasNextPage ? (<div- ref={bottomRef}- className="flex w-full items-center justify-center py-8"+ ref={endOfListRef}+ className={`flex items-center justify-center ${direction === "vertical" ? "w-full py-8" : "h-full flex-shrink-0 px-8"}`}>{loader || defaultLoader}</div>) : (- dataLength > 0 && endMessage+ loadedItemsCount && loadedItemsCount > 0 && endMessage)}</div>);diff --git a/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/useInfiniteScroll.ts b/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/useInfiniteScroll.tsindex c6801fb9b0..8962f7e1c9 100644--- a/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/useInfiniteScroll.ts+++ b/autogpt_platform/frontend/src/components/contextual/InfiniteScroll/useInfiniteScroll.ts@@ -1,10 +1,8 @@import { isServerSide } from "@/lib/utils/is-server-side";-import { debounce } from "lodash";import { useCallback, useEffect, useRef, useState } from "react";interface useInfiniteScrollProps {scrollThreshold: number;- scrollableTarget?: string;onLoadMore?: () => void;isFetchingNextPage: boolean;fetchNextPage: () => void;@@ -12,7 +10,6 @@ interface useInfiniteScrollProps {}export const useInfiniteScroll = ({- scrollableTarget,onLoadMore,hasNextPage,isFetchingNextPage,@@ -20,66 +17,50 @@ export const useInfiniteScroll = ({scrollThreshold,}: useInfiniteScrollProps) => {const containerRef = useRef<HTMLDivElement>(null);- const bottomRef = useRef<HTMLDivElement>(null);+ const endOfListRef = useRef<HTMLDivElement>(null);const [isInView, setIsInView] = useState(false);- const [isLoading, setIsLoading] = useState(false);-- const handleScroll = useCallback(() => {- if (containerRef.current && !isServerSide()) {- const container = containerRef.current;- const { bottom } = container.getBoundingClientRect();- const { innerHeight } = window;- const isVisible = bottom <= innerHeight + scrollThreshold;- setIsInView(isVisible);- }- }, [scrollThreshold]);-- const handleLoadMore = useCallback(() => {- if (hasNextPage && !isFetchingNextPage) {- fetchNextPage();- }- }, [hasNextPage, isFetchingNextPage, fetchNextPage]);+ const isLoadingRef = useRef(false);const loadMore = useCallback(async () => {- if (hasNextPage && !isLoading) {- setIsLoading(true);+ if (hasNextPage && !isFetchingNextPage && !isLoadingRef.current) {+ isLoadingRef.current = true;try {- handleLoadMore();+ fetchNextPage();onLoadMore?.();} finally {- setIsLoading(false);+ isLoadingRef.current = false;}}- }, [hasNextPage, isLoading, handleLoadMore, onLoadMore]);+ }, [hasNextPage, isFetchingNextPage, fetchNextPage, onLoadMore]);useEffect(() => {- if (!hasNextPage) return;-- const handleDebouncedScroll = debounce(handleScroll, 200);-- const scrollElement = scrollableTarget- ? document.querySelector(scrollableTarget)- : window;-- if (!scrollElement) return;+ if (!hasNextPage || !endOfListRef.current || isServerSide()) return;- scrollElement.addEventListener("scroll", handleDebouncedScroll);+ const observer = new IntersectionObserver(+ (entries) => {+ const [entry] = entries;+ setIsInView(entry.isIntersecting);+ },+ {+ rootMargin: `${scrollThreshold}px`,+ },+ );- handleScroll();+ observer.observe(endOfListRef.current);return () => {- scrollElement.removeEventListener("scroll", handleDebouncedScroll);+ observer.disconnect();};- }, [handleScroll, hasNextPage, scrollableTarget]);+ }, [hasNextPage, scrollThreshold]);useEffect(() => {- if (isInView && hasNextPage && !isLoading) {+ if (isInView && hasNextPage && !isLoadingRef.current) {loadMore();}- }, [isInView, hasNextPage, isLoading, loadMore]);+ }, [isInView, hasNextPage]);return {containerRef,- bottomRef,+ endOfListRef,};};diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.tsindex d69ff462db..4ff32afd81 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts@@ -34,15 +34,17 @@ export function useAgentSelectStep({const agents: Agent[] =(myAgents?.status === 200 &&- myAgents?.data?.agents- ?.map((agent: any) => ({- name: agent.agent_name,- id: agent.agent_id,- version: agent.agent_version,- lastEdited: agent.last_edited,- imageSrc: agent.agent_image || "https://picsum.photos/300/200",- description: agent.description || "",- }))+ myAgents.data?.agents+ .map(+ (agent): Agent => ({+ name: agent.agent_name,+ id: agent.agent_id,+ version: agent.agent_version,+ lastEdited: agent.last_edited.toLocaleDateString(),+ imageSrc: agent.agent_image || "https://picsum.photos/300/200",+ description: agent.description || "",+ }),+ ).sort((a: Agent, b: Agent) =>new Date(b.lastEdited).getTime() - new Date(a.lastEdited).getTime(),diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/helpers.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/helpers.tsxindex dbe16a0cf8..79834010f4 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/helpers.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/helpers.tsx@@ -91,29 +91,6 @@ export function createAgentInfoMap(return agentMap;}-export function convertLegacyExecutionToGenerated(- execution: GraphExecution,-): GeneratedGraphExecutionMeta {- return {- id: execution.id,- user_id: execution.user_id,- graph_id: execution.graph_id,- graph_version: execution.graph_version,- preset_id: execution.preset_id,- status: execution.status as AgentExecutionStatus,- started_at: execution.started_at.toISOString(),- ended_at: execution.ended_at.toISOString(),- stats: execution.stats || {- cost: 0,- duration: 0,- duration_cpu_only: 0,- node_exec_time: 0,- node_exec_time_cpu_only: 0,- node_exec_count: 0,- },- };-}-export function enrichExecutionWithAgentInfo(execution: GeneratedGraphExecutionMeta,agentInfoMap: Map<@@ -300,10 +277,9 @@ export function handleExecutionUpdate({ name: string; description: string; library_agent_id?: string }>,): NotificationState {- // Convert and enrich the execution- const convertedExecution = convertLegacyExecutionToGenerated(execution);+ // Enrich the executionconst enrichedExecution = enrichExecutionWithAgentInfo(- convertedExecution,+ execution,agentInfoMap,);diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.tsindex 540434e2f4..1797fa7876 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/useAgentActivityDropdown.ts@@ -1,4 +1,4 @@-import { useGetV1GetAllExecutions } from "@/app/api/__generated__/endpoints/graphs/graphs";+import { useGetV1ListAllExecutions } from "@/app/api/__generated__/endpoints/graphs/graphs";import { useGetV2ListLibraryAgents } from "@/app/api/__generated__/endpoints/library/library";import BackendAPI from "@/lib/autogpt-server-api/client";@@ -44,7 +44,7 @@ export function useAgentActivityDropdown() {data: executions,isSuccess: executionsSuccess,error: executionsError,- } = useGetV1GetAllExecutions();+ } = useGetV1ListAllExecutions();// Create a map of library agentsuseEffect(() => {diff --git a/autogpt_platform/frontend/src/components/ui/scroll-area.tsx b/autogpt_platform/frontend/src/components/ui/scroll-area.tsxindex 592d2b88b5..6d9cd61b97 100644--- a/autogpt_platform/frontend/src/components/ui/scroll-area.tsx+++ b/autogpt_platform/frontend/src/components/ui/scroll-area.tsx@@ -7,8 +7,10 @@ import { cn } from "@/lib/utils";const ScrollArea = React.forwardRef<React.ElementRef<typeof ScrollAreaPrimitive.Root>,- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>->(({ className, children, ...props }, ref) => (+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {+ orientation?: "vertical" | "horizontal" | "both";+ }+>(({ className, children, orientation = "vertical", ...props }, ref) => (<ScrollAreaPrimitive.Rootref={ref}className={cn("relative", className)}@@ -16,11 +18,15 @@ const ScrollArea = React.forwardRef<><ScrollAreaPrimitive.ViewportclassName="h-full w-full rounded-[inherit]"- style={{ overflowX: "hidden", overflowY: "scroll" }}+ style={{+ overflowX: orientation === "vertical" ? "hidden" : "scroll",+ overflowY: orientation === "horizontal" ? "hidden" : "scroll",+ }}>{children}</ScrollAreaPrimitive.Viewport>- <ScrollBar />+ {orientation !== "horizontal" && <ScrollBar />}+ {orientation !== "vertical" && <ScrollBar orientation="horizontal" />}<ScrollAreaPrimitive.Corner /></ScrollAreaPrimitive.Root>));diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/client.tsindex f3630c385e..7dc3cfc54a 100644--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts@@ -31,6 +31,7 @@ import type {GraphExecution,GraphExecutionID,GraphExecutionMeta,+ GraphExecutionsResponse,GraphID,GraphMeta,GraphUpdateable,@@ -285,7 +286,7 @@ export default class BackendAPI {);}- getGraphExecutions(graphID: GraphID): Promise<GraphExecutionMeta[]> {+ getGraphExecutions(graphID: GraphID): Promise<GraphExecutionsResponse> {return this._get(`/graphs/${graphID}/executions`).then((results) =>results.map(parseGraphExecutionTimestamps),);diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.tsindex 15c2894421..8b5efb4a61 100644--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts@@ -250,7 +250,7 @@ export type GraphExecutionMeta = {user_id: UserID;graph_id: GraphID;graph_version: number;- preset_id?: LibraryAgentPresetID;+ preset_id: LibraryAgentPresetID | null;status:| "QUEUED"| "RUNNING"@@ -260,16 +260,17 @@ export type GraphExecutionMeta = {| "INCOMPLETE";started_at: Date;ended_at: Date;- stats?: {- error?: string;+ stats: {+ error: string | null;cost: number;duration: number;duration_cpu_only: number;node_exec_time: number;node_exec_time_cpu_only: number;node_exec_count: number;- activity_status?: string;- };+ activity_status: string | null;+ [key: string]: any;+ } | null;};export type GraphExecutionID = Brand<string, "GraphExecutionID">;@@ -281,6 +282,11 @@ export type GraphExecution = GraphExecutionMeta & {node_executions?: NodeExecutionResult[];};+export type GraphExecutionsResponse = {+ executions: GraphExecutionMeta[];+ pagination: Pagination;+};+/* Mirror of backend/data/graph.py:GraphMeta */export type GraphMeta = {id: GraphID;@@ -433,12 +439,7 @@ export enum AgentStatus {export type LibraryAgentResponse = {agents: LibraryAgent[];- pagination: {- current_page: number;- page_size: number;- total_items: number;- total_pages: number;- };+ pagination: Pagination;};export type LibraryAgentPreset = {@@ -458,11 +459,7 @@ export type LibraryAgentPresetID = Brand<string, "LibraryAgentPresetID">;export type LibraryAgentPresetResponse = {presets: LibraryAgentPreset[];- pagination: {- total: number;- page: number;- size: number;- };+ pagination: Pagination;};export type LibraryAgentPresetCreatable = Omit<