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
56 changes: 47 additions & 9 deletions apps/mobile/src/features/threads/ThreadFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import { classifyMarkdownImageSource } from "@t3tools/client-runtime/markdown-im
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace } from "@t3tools/shared/chatList";
import {
actionResultDetails,
actionResultPresentation,
type ActionResultDetail,
type ActionResultPresentationOutcome,
parseActionResumeFollowUp,
} from "@t3tools/shared/actionResume";
Expand Down Expand Up @@ -1177,6 +1179,7 @@ function renderFeedEntry(
message.role === "system" ? parseActionResumeFollowUp(message.text) : null;
if (actionFollowUp) {
const presentation = actionResultPresentation(actionFollowUp);
const details = actionResultDetails(actionFollowUp.report);
return (
<ActionFollowUpCard
actionName={actionFollowUp.actionName}
Expand All @@ -1185,6 +1188,7 @@ function renderFeedEntry(
summary={presentation.summary}
output={actionFollowUp.output}
detailedOutputAvailable={actionFollowUp.detailedOutputAvailable}
details={details}
iconColor={iconSubtleColor}
expanded={props.expandedActionRows[entry.id] ?? false}
onToggle={() => props.onToggleActionFollowUp(entry.id)}
Expand Down Expand Up @@ -1498,10 +1502,13 @@ const ActionFollowUpCard = memo(function ActionFollowUpCard(props: {
readonly summary: string;
readonly output: string;
readonly detailedOutputAvailable: boolean;
readonly details: ReadonlyArray<ActionResultDetail>;
readonly iconColor: string | ColorValue;
readonly expanded: boolean;
readonly onToggle: () => void;
}) {
const detailsAvailable = props.details.length > 0;
const expandable = !props.detailedOutputAvailable || detailsAvailable;
const tone =
props.outcome === "success"
? {
Expand Down Expand Up @@ -1548,14 +1555,7 @@ const ActionFollowUpCard = memo(function ActionFollowUpCard(props: {

return (
<View className={cn("mb-5 overflow-hidden rounded-xl border", tone.container)}>
{props.detailedOutputAvailable ? (
<View
accessibilityLabel={`${props.outcomeLabel}: ${props.actionName}. ${props.summary}`}
className="min-h-10 flex-row items-center gap-1.5 px-3 pt-2.5"
>
{heading}
</View>
) : (
{expandable ? (
<Pressable
accessibilityRole="button"
accessibilityState={{ expanded: props.expanded }}
Expand All @@ -1571,6 +1571,13 @@ const ActionFollowUpCard = memo(function ActionFollowUpCard(props: {
type="monochrome"
/>
</Pressable>
) : (
<View
accessibilityLabel={`${props.outcomeLabel}: ${props.actionName}. ${props.summary}`}
className="min-h-10 flex-row items-center gap-1.5 px-3 pt-2.5"
>
{heading}
</View>
)}
{!props.detailedOutputAvailable && props.expanded ? (
<ScrollView
Expand All @@ -1586,7 +1593,38 @@ const ActionFollowUpCard = memo(function ActionFollowUpCard(props: {
<Text className="text-sm text-foreground" numberOfLines={1}>
{props.summary}
</Text>
{props.detailedOutputAvailable ? (
{detailsAvailable && props.expanded ? (
<View className="mt-2 gap-1.5">
{props.details.map((detail) => {
const href = detail.href;
return (
<View key={detail.id} className="gap-0.5">
<Text className="font-t3-medium text-xs text-foreground-muted">
{detail.label}
</Text>
{href ? (
<Pressable
accessibilityRole="link"
accessibilityLabel={`${detail.label}: ${detail.value}`}
onPress={() => {
void tryOpenExternalUrl(href, "action-report");
}}
>
<Text selectable className="text-xs leading-4 text-primary underline">
{detail.value}
</Text>
</Pressable>
) : (
<Text selectable className="text-xs leading-4 text-foreground">
{detail.value}
</Text>
)}
</View>
);
})}
</View>
) : null}
{props.detailedOutputAvailable && !detailsAvailable ? (
<Text className="mt-0.5 text-xs text-foreground-muted">
Detailed output retained in the Action terminal.
</Text>
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/lib/openExternalUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ describe("tryOpenExternalUrl", () => {
openURL.mockResolvedValue(undefined);

await expect(
tryOpenExternalUrl("https://github.com/pingdotgg/t3code", "pull-request"),
tryOpenExternalUrl("https://github.com/pingdotgg/t3code/actions/runs/1", "action-report"),
).resolves.toBe(true);
expect(openURL).toHaveBeenCalledWith("https://github.com/pingdotgg/t3code/actions/runs/1");
});

it("logs stable URL context without exposing the opening failure", async () => {
Expand Down
7 changes: 6 additions & 1 deletion apps/mobile/src/lib/openExternalUrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as Schema from "effect/Schema";
import { Linking } from "react-native";

const ExternalUrlTarget = Schema.Literals(["file-preview", "markdown-link", "pull-request"]);
const ExternalUrlTarget = Schema.Literals([
"action-report",
"file-preview",
"markdown-link",
"pull-request",
]);

export type ExternalUrlTarget = typeof ExternalUrlTarget.Type;

Expand Down
Loading