Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions packages/mobile/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Agent Orchestrator — Mobile

Expo (expo-router) mobile supervisor for Agent Orchestrator. Four tabs — Kanban, PRs,
Orchestrator, Settings — plus a Chat-first spawn flow, a native conversation surface,
the existing live terminal, and a preview browser. Chat sessions expose durable history,
Expo (expo-router) mobile supervisor for Agent Orchestrator. Three native tabs — Workers,
Projects, Pull Requests — with Settings and Notifications in their headers, plus a
Chat-first spawn flow, a native conversation surface, the existing live terminal, and a
preview browser. Chat sessions expose durable history,
streaming activity, approvals, provider controls, attachments, voice input, and a plain
worktree-shell escape hatch. It is a **thin client**: it talks to the AO daemon running on your
computer through the endpoints advertised by the desktop pairing offer. It never runs agents itself.
Expand Down Expand Up @@ -418,7 +419,8 @@ Play Store** checks on demand.

```
app/ expo-router routes
(tabs)/ Kanban (index), PRs, Orchestrator, Settings
(tabs)/ NativeTabs; one group per tab, each a stack for its native header:
(workers)/index, (projects)/projects, (prs)/prs
session/[id].tsx persisted-mode router (native Chat or Terminal UI)
shell/[handleId] session-scoped worktree shell over the existing mux
preview/[id] unified live browser and generated app preview
Expand Down
11 changes: 11 additions & 0 deletions packages/mobile/app/(tabs)/(preferences)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { boardTitle } from "../../../lib/board-tabs";
import { TabStack } from "../../../lib/TabStack";

/**
* Android's Settings tab. iOS pushes Settings as a page from the board's bar
* instead. Its own pages (Machines, Appearance, a machine) still open on the
* root stack, over the tabs, so back returns here.
*/
export default function PreferencesTabLayout() {
return <TabStack screen="preferences" title={boardTitle("(preferences)")} />;
}
9 changes: 9 additions & 0 deletions packages/mobile/app/(tabs)/(preferences)/preferences.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { TabPage } from "../../../lib/TabPage";
import SettingsScreen from "../../settings/index";

// The Settings list itself, as a tab; see the group's layout.
export default function PreferencesTab() {
return <TabPage><SettingsScreen /></TabPage>;
}

export { RouteErrorBoundary as ErrorBoundary } from "../../../lib/RouteErrorBoundary";
6 changes: 6 additions & 0 deletions packages/mobile/app/(tabs)/(projects)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { boardTitle } from "../../../lib/board-tabs";
import { TabStack } from "../../../lib/TabStack";

export default function ProjectsTabLayout() {
return <TabStack screen="projects" title={boardTitle("(projects)")} />;
}
154 changes: 154 additions & 0 deletions packages/mobile/app/(tabs)/(projects)/projects.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import { useRouter } from "expo-router";
import { useMemo, useState } from "react";
import { FlatList, RefreshControl, StyleSheet, View } from "react-native";
import { BoardHeaderItems } from "../../../lib/BoardHeaderItems";
import { boardTitle } from "../../../lib/board-tabs";
import { hostedProjectKey, hostedProjectSections } from "../../../lib/hostedRows";
import { useLargeTitle } from "../../../lib/largeTitle";
import { useTabBarFrost } from "../../../lib/frost";
import type { OrchestratorProjectRow } from "../../../lib/orchestratorView";
import { ProjectCard } from "../../../lib/project-card";
import { refreshControlColors } from "../../../lib/refreshControlColors";
import { Spinner } from "../../../lib/Spinner";
import { StaleBanner } from "../../../lib/StaleBanner";
import { useApp } from "../../../lib/store";
import { UnpairedState } from "../../../lib/UnpairedState";
import type { Theme } from "../../../lib/theme";
import { useTheme, useThemedStyles } from "../../../lib/ThemeProvider";
import { useOrchestratorLauncher } from "../../../lib/useOrchestratorLauncher";
import { useBoardFailure } from "../../../lib/useBoardFailure";
import { TabPageScroll } from "../../../lib/TabPageScroll";
import { space } from "../../../lib/tokens";
import { Button, EmptyState } from "../../../lib/ui";

export { RouteErrorBoundary as ErrorBoundary } from "../../../lib/RouteErrorBoundary";

export default function ProjectsScreen() {
const t = useTheme();
const styles = useThemedStyles(makeStyles);
const router = useRouter();
const {
configured,
loading,
error,
allProjects,
hostStates,
notificationsUnread,
refreshAll,
} = useApp();
const largeTitle = useLargeTitle(boardTitle("(projects)"));
const tabBar = useTabBarFrost();
const fleetLoading = hostStates.length ? hostStates.some((host) => host.loading) : loading;
const fleetError = hostStates.length > 1
? hostStates.every((host) => host.connection === "closed" && !host.loading)
: Boolean(error);
const unreadCount = hostStates.length > 1
? hostStates.reduce((count, host) => count + host.notificationsUnread, 0)
: notificationsUnread;
const [refreshing, setRefreshing] = useState(false);
const { busyProjects, openOrchestrator } = useOrchestratorLauncher();
// One list of rows, no status headers: each row already says how its
// orchestrator is doing. The sections' order is kept, so projects that need
// attention still come first.
const rows = useMemo(
() => hostedProjectSections(hostStates).flatMap((section) => section.data),
[hostStates],
);
const failure = useBoardFailure();

// No haptic of its own: each platform's refresh control gives the feedback
// it gives everywhere, and the Retry buttons that also call this buzz once.
const onRefresh = async () => {
setRefreshing(true);
try {
await refreshAll();
} finally {
setRefreshing(false);
}
};

const openProject = (row: OrchestratorProjectRow) => {
const hostId = "hostId" in row.project && typeof row.project.hostId === "string" ? row.project.hostId : undefined;
if (!hostId) return;
router.push({ pathname: "/project/[id]", params: { id: row.project.id, hostId } });
};

if (!configured && hostStates.length === 0) {
return (
<View style={styles.screen}>
<TabPageScroll>
{largeTitle.header}
<UnpairedState />
</TabPageScroll>
<BoardHeaderItems unread={0} notifications={false} />
{largeTitle.edge}
{tabBar.frost}
</View>
);
}

// In the list, not above it: the list has to be the page's first view under
// the translucent header.
const staleBanner = hostStates.length <= 1 ? <StaleBanner error={!!error} onRetry={onRefresh} /> : <StaleBanner networkOnly />;

return (
<View style={styles.screen}>
{fleetLoading && allProjects.length === 0 ? (
<TabPageScroll>
{largeTitle.header}
{staleBanner}
<View style={styles.center}>
<Spinner color={t.accent} accessibilityLabel="Loading projects" />
</View>
</TabPageScroll>
) : (
<FlatList
data={rows}
keyExtractor={(row) => hostedProjectKey(row.project)}
contentInsetAdjustmentBehavior="automatic"
// Android's tab bar is clear and the list runs on under it.
contentContainerStyle={{ flexGrow: 1, paddingBottom: space.xxl + tabBar.inset }}
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} progressViewOffset={largeTitle.topInset} {...refreshControlColors(t)} />}
ListHeaderComponent={<>{largeTitle.header}{staleBanner}</>}
onScroll={largeTitle.onScroll}
scrollEventThrottle={largeTitle.onScroll ? 16 : undefined}
renderItem={({ item }) => (
<ProjectCard
row={item}
busy={busyProjects.has(hostedProjectKey(item.project))}
showMachine={hostStates.length > 1}
onOpenProject={openProject}
onOrchestrator={openOrchestrator}
/>
)}
ListEmptyComponent={
fleetError ? (
<EmptyState
icon={hostStates.length > 1 ? "unplug" : failure.icon}
title={hostStates.length > 1 ? "No machines connected" : failure.title}
message={hostStates.length > 1 ? undefined : failure.hint}
action={<Button title="Retry" icon="refresh-cw" variant="secondary" onPress={onRefresh} />}
/>
) : (
<EmptyState icon="folder" title="No projects" message="Add a project in Orchestrator to get started." />
)
}
/>
)}
<BoardHeaderItems unread={unreadCount} />
{largeTitle.edge}
{tabBar.frost}
</View>
);
}

const makeStyles = (t: Theme) =>
StyleSheet.create({
// No background of its own: the stack's contentStyle paints the page. A
// coloured view that is not a stacking context is mounted empty with its
// children hoisted after it, which put it ahead of the list as the page's
// first native view, so the large title and the tab bar found no scroll
// view to follow and stayed expanded over the rows.
screen: { flex: 1 },
center: { flex: 1, alignItems: "center", justifyContent: "center", paddingVertical: 60 },
});
7 changes: 7 additions & 0 deletions packages/mobile/app/(tabs)/(pull-requests)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { boardTitle } from "../../../lib/board-tabs";
import { TabStack } from "../../../lib/TabStack";

/** Android's Pull Requests tab. iOS opens the page as a sheet from the board's bar instead. */
export default function PullRequestsTabLayout() {
return <TabStack screen="pull-requests" title={boardTitle("(pull-requests)")} />;
}
10 changes: 10 additions & 0 deletions packages/mobile/app/(tabs)/(pull-requests)/pull-requests.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { TabPage } from "../../../lib/TabPage";
import PRsScreen from "../../prs/index";

// The Pull Requests page itself, as a tab: the same screen the board's bar and
// a notification open over the board, here with no machine or project chosen.
export default function PullRequestsTab() {
return <TabPage><PRsScreen /></TabPage>;
}

export { RouteErrorBoundary as ErrorBoundary } from "../../../lib/RouteErrorBoundary";
6 changes: 6 additions & 0 deletions packages/mobile/app/(tabs)/(workers)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { boardTitle } from "../../../lib/board-tabs";
import { TabStack } from "../../../lib/TabStack";

export default function WorkersTabLayout() {
return <TabStack screen="index" title={boardTitle("(workers)")} />;
}
Loading
Loading