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
2 changes: 1 addition & 1 deletion FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ migrations after upstream migrations.

98. Mobile reads artifacts ([#833](https://github.com/Jacksondr5/j5code/issues/833)), landing two reserved mobile seams. Route registration: `apps/mobile/src/Stack.tsx` imports J5-owned `j5ThreadArtifactRoutes` (`apps/mobile/src/j5/artifacts/routes.ts`) and spreads it after `ThreadFile`, adding the thread-scoped `ThreadArtifacts` list and `ThreadArtifact` viewer (`apps/mobile/src/j5/artifacts/ThreadArtifactsScreen.tsx`), read-only, with no delete. Link resolver: `onMarkdownLinkPress` in `apps/mobile/src/features/threads/ThreadFeed.tsx` makes one call to J5-owned `openArtifactLink` before its thread, media and file branches, so an `artifacts/…` link opens the viewer instead of a missing workspace file; its `fileContextMenu` and `onFileContextMenuAction` each make one call first (`artifactLinkContextMenu`, `onArtifactLinkMenuAction`), so an artifact link's long press offers Open artifact and Copy path instead of workspace-file actions. Links inside a Markdown artifact go through the same helpers in the J5 viewer. Recognition, preview kind and the HTTP read are shared with web in `packages/client-runtime/src/j5/artifacts.ts`. No upstream entry point reaches the list yet; it is one tap from any opened artifact.

99. Mobile's shared conversations show who wrote each message and who answered each prompt, the mobile half of case 80 ([#832](https://github.com/Jacksondr5/j5code/issues/832), register D33, Shared conversations AC9 to AC11, AC14 and AC16). The record and its change feed are `threadAuthors` and `threadAuthorsChanges` in `packages/client-runtime/src/j5/sharing.ts`, beside who reaches the thread (`scopePeople` and `scopePeopleChanges`), which says the thread is shared before any author is recorded (`mayBeSharedConversation`, [#871](https://github.com/Jacksondr5/j5code/issues/871)); and the reading of it (`sharedMessageView`, the typed text, the answers without their mark, the search label) is `packages/client-runtime/src/j5/sharedConversation.ts`, both shared with web. `apps/mobile/src/features/threads/ThreadRouteScreen.tsx` imports `useSharedConversationFeed` from J5-owned `apps/mobile/src/j5/sharing/sharedConversation.tsx` and passes its answer as `ThreadDetailScreen`'s `selectedThreadFeed` in place of `composer.selectedThreadFeed`: an authored message shows as typed, after its note to the agent as a muted line that opens (drawn by case 97's `renderJ5TimelineNotice`), a message whose author is not read yet is held back or shown as this client typed it, and a question's answers lose the platform's `[Answer from …]` mark. Case 97's `useJ5Timeline` also reads the record, so `resolveJ5FeedMessage` puts another person's message on the left and `J5MessageAuthorLine` names them, or says who edited the reader's own. `apps/mobile/src/features/threads/thread-work-log.tsx` mounts `PromptAnsweredBy` after a work row's label (" · answered by Priya" on a settled question or approval). `apps/mobile/src/features/threads/ThreadQueueControl.tsx` reads its rows through `useSharedQueuedRuns`, so a queued message's row and the text an edit loads are the words typed. `apps/mobile/src/features/threads/thread-search-match.tsx` labels a hit with `threadSearchMatchLabel` instead of "You:" for every user-role hit. `apps/mobile/src/lib/filePreview.test.ts` mocks `sharedConversation.tsx` as it mocks case 97's `timelineState.ts`. Proofs: `apps/mobile/src/j5/sharing/sharedConversationFeed.test.ts`, `apps/mobile/src/j5/a2a/timelinePresentation.test.ts`, `packages/client-runtime/src/j5/sharedConversation.test.ts`, `packages/client-runtime/src/j5/threadSearchMatchLabel.test.ts`, and the four files' rows in `apps/mobile/src/j5/upstreamSeams.test.ts`. On every rebase, keep the calls that test lists.
99. Mobile's shared conversations show who wrote each message and who answered each prompt, the mobile half of case 80 ([#832](https://github.com/Jacksondr5/j5code/issues/832), register D33, Shared conversations AC9 to AC11, AC14 and AC16). The record and its change feed are `threadAuthors` and `threadAuthorsChanges` in `packages/client-runtime/src/j5/sharing.ts`, beside who reaches the thread (`scopePeople` and `scopePeopleChanges`), which says the thread is shared before any author is recorded (`mayBeSharedConversation`, [#871](https://github.com/Jacksondr5/j5code/issues/871)); and the reading of it (`sharedMessageView`, the typed text, the answers without their mark, the search label) is `packages/client-runtime/src/j5/sharedConversation.ts`, both shared with web. `apps/mobile/src/features/threads/ThreadRouteScreen.tsx` imports `useSharedConversationFeed` from J5-owned `apps/mobile/src/j5/sharing/sharedConversation.tsx` and passes its answer as `ThreadDetailScreen`'s `selectedThreadFeed` in place of `composer.selectedThreadFeed`: an authored message shows as typed, after its note to the agent as a muted line that opens (drawn by case 97's `renderJ5TimelineNotice`), a message whose author is not read yet is held back or shown as this client typed it, and a question's answers lose the platform's `[Answer from …]` mark. Case 97's `useJ5Timeline` also reads the record, so `resolveJ5FeedMessage` puts another person's message on the left and `J5MessageAuthorLine` names them, or says who edited the reader's own. `apps/mobile/src/features/threads/thread-work-log.tsx` mounts `PromptAnswerTail` after a work row's label: a question's answer and who gave it (" · answered by Priya", on an approval too), outside the label so the question truncates first. An answered question's opened row no longer draws the raw item JSON beneath its question and answer, as web draws neither ([#891](https://github.com/Jacksondr5/j5code/issues/891)). `apps/mobile/src/features/threads/ThreadQueueControl.tsx` reads its rows through `useSharedQueuedRuns`, so a queued message's row and the text an edit loads are the words typed. `apps/mobile/src/features/threads/thread-search-match.tsx` labels a hit with `threadSearchMatchLabel` instead of "You:" for every user-role hit. `apps/mobile/src/lib/filePreview.test.ts` mocks `sharedConversation.tsx` as it mocks case 97's `timelineState.ts`. Proofs: `apps/mobile/src/j5/sharing/sharedConversationFeed.test.ts`, `apps/mobile/src/j5/a2a/timelinePresentation.test.ts`, `packages/client-runtime/src/j5/sharedConversation.test.ts`, `packages/client-runtime/src/j5/threadSearchMatchLabel.test.ts`, and the four files' rows in `apps/mobile/src/j5/upstreamSeams.test.ts`. On every rebase, keep the calls that test lists.

100. The mobile new-task composer gives a saved agent its own row and lets the slash menu cover the draft rows ([#866](https://github.com/Jacksondr5/j5code/issues/866), Jackson's direction at Checkpoint 1, 2026-11-01; register entry in the wave-2 docs PR). Upstream's composer shows the model in its input row and opens the slash menu above everything stacked over the input. In `apps/mobile/src/features/threads/NewTaskDraftScreen.tsx`, the draft controls render J5-owned `j5/agents/DraftAgentRow.tsx` under the checkout row: the saved-agent picker, then the chosen agent's persona, route and remove action. `apps/mobile/src/features/threads/ThreadComposer.tsx` renders the persona lock control only when `!props.isDraft`, so a draft's input row stays the editor, and wraps `ComposerPopoverAnchor` in a zero-height `relative` view placed after `draftControls`. The anchor's `bottom-full` (and the Android anchor's measured frame) then starts at the top of the input, so the menu draws over the checkout and agent rows instead of above them. A started thread has no draft controls, so its menu opens where it did.

Expand Down
27 changes: 13 additions & 14 deletions apps/mobile/src/features/threads/thread-work-log.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { useMarkdownCodeHighlight } from "./markdownCodeHighlightState";

import { AppText as Text } from "../../components/ui/AppText";
import { J5Wordmark } from "../../j5/branding/J5Wordmark";
import { PromptAnsweredBy } from "../../j5/sharing/sharedConversation";
import { PromptAnswerTail } from "../../j5/sharing/sharedConversation";
import { BrowserAppIcon } from "./BrowserAppIcon";
import { useAppActive, useReduceMotionEnabled } from "../../lib/appState";
import { cn } from "../../lib/cn";
Expand Down Expand Up @@ -975,8 +975,9 @@ const ThreadWorkLogRow = function ThreadWorkLogRow(
call && shownItem.type === "command_execution" && shownItem.exitCode
? shownItem.exitCode
: null;
// J5 (case 99): an answered question reads as its question and answer, not as its raw item.
const fullDetail =
expanded && !reasoning && !call
expanded && !reasoning && !call && !row.workEntry.questionAnswer
? fetchedItem && !isRead
? formatItemFullDetail(row.projectedItem, fetchedItem)
: row.getFullDetail()
Expand Down Expand Up @@ -1009,6 +1010,8 @@ const ThreadWorkLogRow = function ThreadWorkLogRow(
const answerPreview = row.workEntry.questionAnswer
? getQuestionAnswerPreview(row.workEntry.questionAnswer)
: null;
const answered =
row.workEntry.questionAnswer !== undefined && hasQuestionAnswer(row.workEntry.questionAnswer);
const accessiblePreview = [previewText, answerPreview].filter(Boolean).join(": ");
const displayText = row.groupStandIn?.label ?? workEntryRowLabel(row.workEntry, expanded);
const isSystemNotice = row.projectedItem.item.type === "system_notice";
Expand Down Expand Up @@ -1097,20 +1100,16 @@ const ThreadWorkLogRow = function ThreadWorkLogRow(
tone={isUsageLimit ? "warning" : iconIsDestructive ? "danger" : "default"}
>
{displayText}
{answerPreview ? (
<Text
className={
!expanded &&
row.workEntry.questionAnswer &&
hasQuestionAnswer(row.workEntry.questionAnswer)
? "text-foreground"
: "text-foreground-subtle"
}
>{` ${answerPreview}`}</Text>
{answerPreview && !answered ? (
<Text className="text-foreground-subtle">{` ${answerPreview}`}</Text>
) : null}
</WorkLogLabel>
{/* J5 (case 99): who answered a settled prompt; outside the label so it never truncates. */}
<PromptAnsweredBy environmentId={props.environmentId} item={row.projectedItem.item} />
{/* J5 (case 99): the answer and who gave it, outside the label so the question truncates first. */}
<PromptAnswerTail
environmentId={props.environmentId}
item={row.projectedItem.item}
answer={answered && !expanded ? answerPreview : null}
/>
</>
)}

Expand Down
25 changes: 17 additions & 8 deletions apps/mobile/src/j5/sharing/sharedConversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,28 @@ export function useSharedConversationFeed(
}

/**
* Who answered one of the agent's prompts, after the prompt's own line: " · answered by Priya".
* Nothing for a prompt nobody is recorded as answering, or one still open (AC10).
* The end of a work row for one of the agent's prompts: the answer, then who gave it (AC10). The
* question truncates before either. Who is drawn only for a prompt someone is recorded as answering.
*/
export function PromptAnsweredBy(props: {
export function PromptAnswerTail(props: {
readonly environmentId: EnvironmentId;
readonly item: { readonly threadId: ThreadId };
readonly answer: string | null;
}) {
const { answers } = useThreadAuthorIndex(props.environmentId, props.item.threadId);
const answer = isSettledPrompt(props.item) ? answers.get(props.item.requestId) : undefined;
if (answer === undefined) return null;
const by = isSettledPrompt(props.item) ? answers.get(props.item.requestId) : undefined;
return (
<Text numberOfLines={1} className="shrink-0 pl-1 text-sm text-foreground-subtle">
· answered by {answer.you ? "you" : (answer.name ?? "someone")}
</Text>
<>
{props.answer === null ? null : (
<Text numberOfLines={1} className="max-w-[45%] shrink pl-1 text-sm text-foreground">
{props.answer}
</Text>
)}
{by === undefined ? null : (
<Text numberOfLines={1} className="shrink-0 pl-1 text-sm text-foreground-subtle">
· answered by {by.you ? "you" : (by.name ?? "someone")}
</Text>
)}
</>
);
}
4 changes: 1 addition & 3 deletions apps/mobile/src/j5/upstreamSeams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ const SEAMS: ReadonlyArray<Seam> = [
file: "features/threads/thread-work-log.tsx",
record: "case 99: answered by",
from: "../../j5/sharing/sharedConversation",
reaches: [
"<PromptAnsweredBy environmentId={props.environmentId} item={row.projectedItem.item} />",
],
reaches: ["<PromptAnswerTail", "!row.workEntry.questionAnswer"],
},
{
file: "features/threads/thread-search-match.tsx",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/lib/filePreview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ vi.mock("../j5/a2a/timelineState", () => ({
sharedAuthors: new Map(),
}),
}));
vi.mock("../j5/sharing/sharedConversation", () => ({ PromptAnsweredBy: () => null }));
vi.mock("../j5/sharing/sharedConversation", () => ({ PromptAnswerTail: () => null }));
vi.mock("../j5/sharing/startAccess", () => ({ useCanForkThread: () => true }));
vi.mock("../state/threads", () => ({ environmentThreadShells: {}, threadEnvironment: {} }));
vi.mock("../state/entities", () => ({
Expand Down
Loading