Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/mobile/src/components/AppSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import IconChevronUp from "@tabler/icons-react-native/IconChevronUp";
import IconCircle from "@tabler/icons-react-native/IconCircle";
import IconCircleFilled from "@tabler/icons-react-native/IconCircleFilled";
import IconCircleCheck from "@tabler/icons-react-native/IconCircleCheck";
import IconCircleDashed from "@tabler/icons-react-native/IconCircleDashed";
import IconCircleXFilled from "@tabler/icons-react-native/IconCircleXFilled";
import IconTicket from "@tabler/icons-react-native/IconTicket";
import IconClock from "@tabler/icons-react-native/IconClock";
Expand Down Expand Up @@ -74,6 +75,7 @@ import IconMicrophone from "@tabler/icons-react-native/IconMicrophone";
import IconLink from "@tabler/icons-react-native/IconLink";
import IconMenu2 from "@tabler/icons-react-native/IconMenu2";
import IconMessage from "@tabler/icons-react-native/IconMessage";
import IconMessageQuestion from "@tabler/icons-react-native/IconMessageQuestion";
import IconMinus from "@tabler/icons-react-native/IconMinus";
import IconMoon from "@tabler/icons-react-native/IconMoon";
import IconNetwork from "@tabler/icons-react-native/IconNetwork";
Expand All @@ -83,7 +85,9 @@ import IconPhoto from "@tabler/icons-react-native/IconPhoto";
import IconPin from "@tabler/icons-react-native/IconPin";
import IconPinnedOff from "@tabler/icons-react-native/IconPinnedOff";
import IconPlayerPlay from "@tabler/icons-react-native/IconPlayerPlay";
import IconPlayerStop from "@tabler/icons-react-native/IconPlayerStop";
import IconPlayerStopFilled from "@tabler/icons-react-native/IconPlayerStopFilled";
import IconShieldQuestion from "@tabler/icons-react-native/IconShieldQuestion";
import IconPlus from "@tabler/icons-react-native/IconPlus";
import IconQrcode from "@tabler/icons-react-native/IconQrcode";
import IconRefresh from "@tabler/icons-react-native/IconRefresh";
Expand Down Expand Up @@ -140,6 +144,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
checkmark: IconCheck,
"checkmark.circle": IconCircleCheck,
circle: IconCircle,
"circle.dashed": IconCircleDashed,
"circle.fill": IconCircleFilled,
clock: IconClock,
timer: IconClock,
Expand All @@ -159,6 +164,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
"ellipsis.circle": IconDotsCircleHorizontal,
"exclamationmark.triangle": IconAlertTriangle,
"exclamationmark.circle": IconAlertCircle,
"exclamationmark.shield": IconShieldQuestion,
eye: IconEye,
folder: IconFolder,
"folder.badge.plus": IconFolderPlus,
Expand Down Expand Up @@ -206,10 +212,12 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
star: IconStar,
"star.fill": IconStarFilled,
"sun.max": IconSun,
"stop.circle": IconPlayerStop,
"stop.fill": IconPlayerStopFilled,
terminal: IconTerminal2,
"text.alignleft": IconAlignLeft,
"text.bubble": IconMessage,
"questionmark.bubble": IconMessageQuestion,
"text.word.spacing": IconLetterSpacing,
"textformat.size": IconTypography,
"textformat.size.larger": IconTextIncrease,
Expand Down
12 changes: 12 additions & 0 deletions apps/mobile/src/features/home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import type { PendingNewTask } from "../../state/use-pending-new-tasks";
import { useQueuedThreadKeys } from "../../state/use-thread-outbox";
import {
ThreadListV2PendingRow,
ThreadListV2ChildRow,
ThreadListV2Row,
ThreadListV2SettledShelfHeader,
ThreadListV2ShowMoreRow,
Expand Down Expand Up @@ -778,6 +779,17 @@ export function HomeScreen(props: HomeScreenProps) {
/>
);
}
if (item.type === "v2-child") {
return (
<ThreadListV2ChildRow
thread={item.thread}
timeLabel={item.timeLabel}
providerInstance={resolveProviderInstance(item.thread)}
showTrailingDivider={item.showTrailingDivider}
onSelectThread={props.onSelectThread}
/>
);
}
const thread = item.item.thread;
return (
<ThreadListV2Row
Expand Down
15 changes: 15 additions & 0 deletions apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { createSidebarHeaderItems } from "./sidebar-native-header-items";
import { SidebarNavigationShell } from "./sidebar-navigation-shell";
import {
ThreadListV2PendingRow,
ThreadListV2ChildRow,
ThreadListV2Row,
ThreadListV2SettledShelfHeader,
ThreadListV2ShowMoreRow,
Expand Down Expand Up @@ -760,6 +761,20 @@ function ThreadNavigationSidebarPane(
/>
);
}
case "v2-child":
return (
<ThreadListV2ChildRow
thread={item.thread}
timeLabel={item.timeLabel}
providerInstance={resolveProviderInstance(item.thread)}
pane="sidebar"
selected={
scopedThreadKey(item.thread.environmentId, item.thread.id) ===
props.selectedThreadKey
}
onSelectThread={handleSelectThread}
/>
);
case "v2-thread": {
const thread = item.item.thread;
const scopeKey = scopedProjectKey(thread.environmentId, thread.projectId);
Expand Down
120 changes: 119 additions & 1 deletion apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { memo, useCallback, useEffect, useMemo, useState, type ComponentProps }
import { Alert, Pressable, useWindowDimensions, View } from "react-native";
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";

import { SymbolView } from "../../components/AppSymbol";
import { SymbolView, type AppSymbolName } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { ControlPillMenu } from "../../components/ControlPill";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
Expand Down Expand Up @@ -1232,3 +1232,121 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
</View>
);
});

// Same hues as the status labels; a settled child reads as a quiet check.
const CHILD_STATUS_SYMBOL: Record<
ThreadListV2Status,
{ readonly name: AppSymbolName; readonly label: string; readonly tintClassName?: string }
> = {
approval: {
name: "exclamationmark.shield",
label: "Approval",
tintClassName: "accent-warning-foreground",
},
input: {
name: "questionmark.bubble",
label: "Input",
tintClassName: "accent-adaptive-indigo-600-300",
},
working: {
name: "circle.dashed",
label: "Working",
tintClassName: "accent-adaptive-sky-600-400",
},
failed: {
name: "exclamationmark.circle",
label: "Failed",
tintClassName: "accent-danger-foreground",
},
ready: { name: "checkmark.circle", label: "Done" },
};

/**
* One-line row for a thread another thread delegated work to, drawn under
* its parent's card. Tap opens it; actions live on the thread screen.
*/
export const ThreadListV2ChildRow = memo(function ThreadListV2ChildRow(props: {
readonly thread: EnvironmentThreadShell;
readonly timeLabel: string;
readonly providerInstance: ThreadRowProviderInstance | null;
readonly pane?: "screen" | "sidebar";
readonly selected?: boolean;
readonly showTrailingDivider?: boolean;
readonly onSelectThread: (thread: EnvironmentThreadShell) => void;
}) {
const { thread, onSelectThread } = props;
const theme = useUniwindTheme();
const sidebarPane = props.pane === "sidebar";
const selected = props.selected === true;
const rowAppearance = getThreadListV2RowAppearance(theme, sidebarPane, selected);
const status = resolveThreadListV2Status(thread);
const symbol = CHILD_STATUS_SYMBOL[status];
const statusLabel = STATUS_LABEL_BY_STATUS[status];

return (
<RowPressable
interactionClassName={rowAppearance.interactionClassName}
interactionOpacity={rowAppearance.interactionOpacity}
className={rowAppearance.className}
accessibilityLabel={`${thread.title}, delegated task, ${symbol.label}`}
accessibilityRole="button"
accessibilityState={{ selected }}
onPress={() => onSelectThread(thread)}
style={rowAppearance.style}
>
<View
className={cn(
"min-h-[36px] flex-row items-center gap-2 py-1.5",
sidebarPane ? "pl-6 pr-3" : "pl-9 pr-5",
)}
>
<SymbolView
name={symbol.name}
size={14}
tintColorClassName={
selected
? selectedThreadRowColors.mutedIconTintClassName
: (symbol.tintClassName ?? rowAppearance.tertiaryIconTintClassName)
}
type="monochrome"
/>
{props.providerInstance ? (
<ProviderInstanceIcon
provider={props.providerInstance.driverKind}
size={13}
displayName={props.providerInstance.displayName}
accentColor={props.providerInstance.accentColor}
showBadge={false}
surfaceColor={rowAppearance.providerIconSurfaceColor}
/>
) : null}
<Text
className={cn(
"flex-1 text-sm",
selected
? selectedThreadRowColors.foregroundClassName
: status === "input" || status === "approval"
? rowAppearance.foregroundClassName
: rowAppearance.mutedForegroundClassName,
)}
numberOfLines={1}
>
{thread.title}
</Text>
<Text
className={cn(
"text-xs tabular-nums",
selected
? selectedThreadRowColors.mutedForegroundClassName
: (statusLabel?.className ?? rowAppearance.tertiaryForegroundClassName),
)}
>
{statusLabel?.label ?? props.timeLabel}
</Text>
</View>
{!sidebarPane && THREAD_LIST_V2_ROW_DIVIDERS && props.showTrailingDivider === true ? (
<View className="ml-5 h-px bg-border-subtle" />
) : null}
</RowPressable>
);
});
65 changes: 65 additions & 0 deletions apps/mobile/src/features/threads/threadListV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,71 @@ describe("queued messages keep a settled thread active", () => {
});
});

describe("delegated threads", () => {
// Newest first in the active block, so the parent leads.
const parent = makeThread({
id: ThreadId.make("parent"),
title: "Parent",
createdAt: "2026-06-01T02:00:00.000Z",
});
const child = makeThread({
id: ThreadId.make("child"),
title: "Child",
parentThreadId: ThreadId.make("parent"),
hasPendingUserInput: true,
});
const settledParent = makeThread({
id: ThreadId.make("settled-parent"),
title: "Settled parent",
settledOverride: "settled",
});
const orphan = makeThread({
id: ThreadId.make("orphan"),
title: "Orphan",
parentThreadId: ThreadId.make("settled-parent"),
createdAt: "2026-06-01T01:00:00.000Z",
});
const threads = [parent, child, settledParent, orphan];

it("render under an active parent, and on their own under a settled one", () => {
const layout = buildThreadListV2Items({
threads,
environmentId: null,
searchQuery: "",
now: NOW,
});
const listItems = buildThreadListV2ListItems({
items: layout.items,
pendingTasks: [],
settledCount: layout.settledCount,
settledShelfHeaderIndex: layout.settledShelfHeaderIndex,
});
expect(
listItems.map((item) =>
item.type === "v2-thread"
? `thread:${item.item.thread.id}`
: item.type === "v2-child"
? `child:${item.thread.id}`
: item.type,
),
).toEqual([
"thread:parent",
"child:child",
"thread:orphan",
"v2-settled-shelf",
"thread:settled-parent",
]);
});

it("never move on their own", () => {
expect(
getThreadListV2OrderedSection({ threads, section: "active", now: NOW }).map(
(thread) => thread.id,
),
).toEqual(["parent", "orphan"]);
});
});

describe("resolveThreadListV2SwipeActions", () => {
it("offers settle and snooze for an active snoozable thread", () => {
expect(
Expand Down
Loading
Loading