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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .fork/customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10668,6 +10668,44 @@
- apps/mobile/fork/no3yHostSheet.test.ts
- apps/web/src/__fork_guards__/no3ySprintThreadsSheet.test.ts

- id: no3y-sprint-transcript-rows
intent: >
On the iPhone, a sprint's or coordinator's conversation (iOS sprints spec step 4, iOS kit Hook
row 31:311) draws the threads it started and its work reports as thread rows, as the Mac does
(fork-thread-launch-cards): an arm off the reply, the thread's provider mark wearing its status
as a corner badge, the title, its PR chip and a short activity line (background work, the
thinking word, the error of a failed thread, "Archived"), from the shell only. A tap pushes the
thread's full screen. A thread shows once, under the latest settled reply about it: a launch
under its turn's last reply once that settles (the live turn's launches wait), or under a later
reply that links it or answers one of its reports; a finished report of a thread not launched
here under its wake's settled reply. A question or approval report, a report whose wake has
not replied yet, and a launch whose settled turn never replied stand on their own in the feed.
Report notices leave the work rows in a host, so they no longer fold into "Worked for"; plain
threads keep no3y-notification-in-fold. Placement is web's placeThreadRowsUnderReplies ported
onto the mobile feed on the shared client-runtime readings; mobile shows quiet wakes, so a
report joins its own wake's reply.
tier: 4
files:
- apps/mobile/fork/no3yThreadRows.ts
- apps/mobile/fork/no3yThreadRows.test.ts
- apps/mobile/fork/No3yThreadHookRow.tsx
- apps/web/src/__fork_guards__/no3ySprintTranscriptRows.test.ts
shadows: []
watch:
# Places the rows in a host's presented feed and draws them under replies and standing.
- apps/mobile/src/features/threads/ThreadFeed.tsx
# The reply's rows field and the standing entry in the feed's row union.
- apps/mobile/src/features/threads/pending-thread-feed.ts
# Standing rows space as a tool row.
- apps/mobile/fork/no3yTranscriptSpacing.ts
# The Row PR chip the rows reuse.
- apps/mobile/fork/No3yHostThreadRow.tsx
# Stubs the row list and host hook, since it renders the feed with mocked state.
- apps/mobile/src/lib/filePreview.test.ts
verify:
- apps/mobile/fork/no3yThreadRows.test.ts
- apps/web/src/__fork_guards__/no3ySprintTranscriptRows.test.ts

- id: fork-own-checkout-child-settlement
intent: >
Upstream settles a subagent with its parent: the settlement store returns a subagent only once
Expand Down
9 changes: 6 additions & 3 deletions apps/mobile/fork/No3yHostThreadRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { NO3Y_PULL_REQUEST_GLYPHS } from "./No3yPullRequestMark";
import { no3yPullRequestTone, type No3yPullRequestTone } from "./no3yPullRequestTone";
import { No3yStatusMark } from "./No3yStatusMark";

interface RowChip {
export interface RowChip {
readonly key: string;
readonly number: number;
readonly tone: No3yPullRequestTone;
Expand All @@ -42,7 +42,7 @@ function toneOfChipState(state: ReturnType<typeof pullRequestChipStateOf>): No3y

/** The thread's own pull request (its state from its link, else the summary the home row reads),
then its other merged ones. */
function rowChips(
export function rowChips(
thread: EnvironmentThreadShell,
summary: ThreadPrPresentation | null,
): ReadonlyArray<RowChip> {
Expand Down Expand Up @@ -83,7 +83,10 @@ function checksColor(checks: PullRequestChecksState, palette: FlatGlassPalette):

/** Kit Row PR chip 28:279: 22pt, 8pt corners, the PR pill's tint and ink (a draft on the control
surface), and an open PR's checks in an inset pill with 5pt corners. */
function RowPullRequestChip(props: { readonly chip: RowChip; readonly palette: FlatGlassPalette }) {
export function RowPullRequestChip(props: {
readonly chip: RowChip;
readonly palette: FlatGlassPalette;
}) {
const { chip, palette } = props;
const pill = palette.prPill[chip.tone];
return (
Expand Down
222 changes: 222 additions & 0 deletions apps/mobile/fork/No3yThreadHookRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
/**
* A thread's row in a host's transcript — see `.fork/customizations.yaml#no3y-sprint-transcript-rows`
* (iOS kit Hook row 31:311, the Mac's ForkThreadHookRow). Shell data only, so no row opens a detail
* stream.
*/
import { useAtomValue } from "@effect/atom-react";
import { StackActions, useIsFocused, useNavigation } from "@react-navigation/native";
import { threadLaunchActivityLine } from "@t3tools/client-runtime/fork-thread-launches";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { Pressable, View } from "react-native";
import Svg, { Path } from "react-native-svg";

import { AppText as Text } from "../src/components/ui/AppText";
import { startOpeningDetail } from "../src/features/layout/workspace/useSelectWorkspaceDetail";
import { useAppearancePreferences } from "../src/features/settings/appearance/AppearancePreferencesProvider";
import { useEnvironmentServerConfig } from "../src/state/entities";
import { environmentThreadShells } from "../src/state/threads";
import { ThreadPrDemandProvider } from "../src/state/thread-pr-demand";
import { useThreadPr } from "../src/state/use-thread-pr";
import { flatGlassPalette, NO3Y_FONT, type FlatGlassPalette } from "./flatGlassTheme";
import type { SidebarV2CardStatusKind } from "./forkStatusGrouping";
import { resolveNo3yThreadCardStatusKind } from "./mobileStatusGrouping";
import { no3yHostRowActivity } from "./no3yHostSheet";
import { rowChips, RowPullRequestChip } from "./No3yHostThreadRow";
import { hasNo3yProviderMark, No3yProviderMark } from "./No3yProviderMark";
import { No3yStatusMark, statusAccessibilityLabel } from "./No3yStatusMark";
import type { No3yThreadRow } from "./no3yThreadRows";

const MARK = 16;

/** The arm from the reply above, turning into the row (kit Hook row 31:258). */
function Arm(props: { readonly color: string }) {
return (
<View style={{ width: 10, height: 22 }}>
<Svg
width={10.625}
height={36.625}
viewBox="0 0 10.625 36.625"
fill="none"
style={{ position: "absolute", left: 0, top: -6 }}
>
<Path
d="M1 0.625V13.625C1 15.8341 2.79086 17.625 5 17.625H10"
stroke={props.color}
strokeWidth={1.25}
strokeLinecap="round"
/>
</Svg>
</View>
);
}

/** The provider's mark with the status in a 12pt badge at its corner; the status alone until the
provider is known. */
function Mark(props: {
readonly environmentId: EnvironmentId;
readonly providerInstanceId: string | null;
readonly status: SidebarV2CardStatusKind | null;
readonly palette: FlatGlassPalette;
}) {
const { palette } = props;
const config = useEnvironmentServerConfig(props.environmentId);
const provider =
props.providerInstanceId === null
? undefined
: config?.providers.find((candidate) => candidate.instanceId === props.providerInstanceId);
if (
provider === undefined ||
(!hasNo3yProviderMark(provider.driver) && provider.iconUrl == null)
) {
return <No3yStatusMark kind={props.status} palette={palette} size={MARK} />;
}
return (
<View style={{ width: MARK, height: MARK }}>
<No3yProviderMark provider={provider.driver} iconUrl={provider.iconUrl} size={MARK} />
<View
style={{
position: "absolute",
left: 7,
top: 7,
width: 12,
height: 12,
borderRadius: 6,
alignItems: "center",
justifyContent: "center",
backgroundColor: palette.stageBackground,
}}
>
<No3yStatusMark kind={props.status} palette={palette} size={10} />
</View>
</View>
);
}

function useOpenThread() {
const navigation = useNavigation();
return (environmentId: EnvironmentId, threadId: ThreadId) => {
const params = { environmentId: String(environmentId), threadId: String(threadId) };
startOpeningDetail({ name: "Thread", params });
navigation.dispatch(StackActions.push("Thread", params));
};
}

/** The thread's own pull request, its state read as the Threads sheet reads it. */
function ThreadChip(props: {
readonly thread: EnvironmentThreadShell;
readonly palette: FlatGlassPalette;
}) {
const chip = rowChips(props.thread, useThreadPr(props.thread))[0];
return chip === undefined ? null : <RowPullRequestChip chip={chip} palette={props.palette} />;
}

function HookRow(props: {
readonly environmentId: EnvironmentId;
readonly threadId: ThreadId;
readonly fallbackTitle: string | null;
readonly palette: FlatGlassPalette;
}) {
const { palette } = props;
const openThread = useOpenThread();
const thread = useAtomValue(
environmentThreadShells.threadShellAtom(scopeThreadRef(props.environmentId, props.threadId)),
);
// Woke only moves a thread between Completed and Idle, so no clock is needed here.
const status =
thread === null ? null : resolveNo3yThreadCardStatusKind(thread, { now: "", wokeAt: null });
const title = thread?.title ?? props.fallbackTitle ?? "Thread";
const activity =
thread === null
? null
: thread.archivedAt !== null
? "Archived"
: status === "failed"
? threadLaunchActivityLine(thread.source.lastError)
: no3yHostRowActivity(thread, status);
return (
<Pressable
accessibilityRole="button"
accessibilityLabel={`${title}, ${statusAccessibilityLabel(status)}`}
onPress={() => openThread(props.environmentId, props.threadId)}
style={({ pressed }) => ({ gap: 2, opacity: pressed ? 0.6 : 1 })}
>
<View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
<Arm color={palette.metaInk} />
<Mark
environmentId={props.environmentId}
providerInstanceId={
thread === null
? null
: (thread.runtime?.providerInstanceId ?? thread.modelSelection.instanceId)
}
status={status}
palette={palette}
/>
<Text
numberOfLines={1}
style={{
flexShrink: 1,
...NO3Y_FONT.regular,
fontSize: 15,
lineHeight: 20,
color: palette.metaInk,
}}
>
{title}
</Text>
{thread === null ? null : <ThreadChip thread={thread} palette={palette} />}
</View>
{activity === null ? null : (
<Text
numberOfLines={1}
style={{
paddingLeft: 38,
...NO3Y_FONT.regular,
fontSize: 13,
lineHeight: 16,
color: palette.faintInk,
}}
>
{activity}
</Text>
)}
</Pressable>
);
}

/** A reply's thread rows, or a turn's rows standing on their own, one hooked row each. */
export function No3yThreadRowList(props: {
readonly rows: ReadonlyArray<No3yThreadRow>;
readonly standing?: boolean;
}) {
const { themeAppearance } = useAppearancePreferences();
const palette = flatGlassPalette(themeAppearance);
// PR reads poll; a host screen left under a child thread stops asking until it shows again.
const focused = useIsFocused();
return (
<ThreadPrDemandProvider visible={focused}>
<View style={{ gap: 6, marginTop: props.standing ? 0 : 8, marginBottom: 4 }}>
{props.rows.map((row) =>
"thread" in row ? (
<HookRow
key={row.id}
environmentId={row.thread.environmentId}
threadId={row.thread.threadId}
fallbackTitle={row.fallbackTitle}
palette={palette}
/>
) : (
<Text
key={row.id}
style={{ ...NO3Y_FONT.regular, fontSize: 15, lineHeight: 20, color: palette.metaInk }}
>
{row.label}
</Text>
),
)}
</View>
</ThreadPrDemandProvider>
);
}
Loading
Loading