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
Binary file added apps/mobile/assets/context-chip-icons/users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/mobile/scripts/sync-context-chip-icons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const lucideIcons = [
"mouse-pointer-click",
"server",
"terminal",
"users",
];

async function lucideSvg(name) {
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/components/ComposerEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ComposerContextId } from "@t3tools/contracts";
import { useAtomValue } from "@effect/atom-react";
import { AsyncResult } from "effect/reactivity";
import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { groupMentionOccurrences } from "@t3tools/client-runtime/state/thread-group";
import { useEffect, useState } from "react";
import type { EnvironmentId } from "@t3tools/contracts";
import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
Expand Down Expand Up @@ -196,6 +197,10 @@ export function ComposerEditor({
onInertChipPress?.();
return;
}
const member = groupMentionOccurrences(selection.source, props.group, {
seatedOnly: true,
})[0];
if (member?.source === selection.source) return;
const path = composerMentionPath(selection.source, draft.context);
if (path && onOpenMention) {
onOpenMention(path);
Expand Down
9 changes: 4 additions & 5 deletions apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { groupParticipants, isGroupActive } from "@t3tools/client-runtime/state/thread-group";
import { isGroupActive } from "@t3tools/client-runtime/state/thread-group";
import { orchestrationEnvironment } from "../../state/orchestration";
import { ProjectKnowledgeEntry } from "../../components/ProjectKnowledgeEntry";
import { useSidebarWorkspaceTabs } from "../layout/workspace/useSystemWorkspaceTabBar";
Expand Down Expand Up @@ -1043,10 +1043,9 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
// The save uses a draft snapshot; further typing would be discarded on success.
readOnly={isSubmissionLocked}
skills={composerMenu.skills}
groupHandles={(isGroupActive(props.selectedThread.group)
? groupParticipants(props.selectedThread.group)
: []
).map((participant) => participant.handle.toLowerCase())}
group={
isGroupActive(props.selectedThread.group) ? props.selectedThread.group : null
}
selection={composerMenu.selection}
onChangeText={(text) => {
if (!isSubmissionLocked) props.onChangeDraftMessage(text);
Expand Down
58 changes: 57 additions & 1 deletion apps/mobile/src/features/threads/ThreadFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
groupMentionOccurrences,
groupRowSpeaker,
sameThreadGroup,
isQuietPass,
quietPassLine,
type ThreadGroup,
Expand Down Expand Up @@ -1236,8 +1238,14 @@ function ArtifactTemplateCard(props: {
);
}

function exactGroupMention(text: string, group: ThreadGroup | null | undefined) {
const mention = groupMentionOccurrences(text, group)[0];
return mention !== undefined && mention.source === text ? mention : undefined;
}

const AssistantMarkdownContent = memo(function AssistantMarkdownContent(props: {
readonly markdown: string;
readonly group?: ThreadGroup | null;
readonly environmentId: EnvironmentId;
readonly markdownStyles: MarkdownStyleSet;
readonly linkHandlers: MarkdownLinkHandlers;
Expand Down Expand Up @@ -1273,13 +1281,15 @@ const AssistantMarkdownContent = memo(function AssistantMarkdownContent(props: {
renderImage={props.renderImage}
skills={props.skills}
models={models}
group={props.group}
/>
);
});

// Folds split first, so an artifact card inside a fold stays inside it.
function AssistantMarkdownBlocks(props: {
readonly markdown: string;
readonly group?: ThreadGroup | null;
/** The reply's reference definitions, passed down by the enclosing fold. */
readonly definitions?: ReadonlyArray<string> | undefined;
readonly markdownStyles: MarkdownStyleSet;
Expand Down Expand Up @@ -1335,6 +1345,7 @@ function AssistantMarkdownBlocks(props: {
)}
skills={props.skills}
models={props.models}
group={props.group}
textStyle={props.markdownStyles.nativeTextStyle}
{...props.linkHandlers}
renderImage={props.renderImage}
Expand Down Expand Up @@ -1534,6 +1545,7 @@ function OpenSenderThreadButton(props: {
/** Automation prompts are long, repeated runbooks; a folded bubble keeps them out of the way. */
function ThreadAutomationMessageRow(props: {
readonly environmentId: EnvironmentId;
readonly group?: ThreadGroup | null;
readonly text: string;
readonly context?: OrchestrationMessageContext;
readonly scheduledTaskId: ScheduledTaskId | undefined;
Expand Down Expand Up @@ -1606,6 +1618,7 @@ function ThreadAutomationMessageRow(props: {
<MarkdownImageAvailableWidthContext value={props.contentMaxWidth}>
<UserMessageContent
text={renderAssistantCitationsAsText(props.text)}
group={props.group}
environmentId={props.environmentId}
context={props.context}
markdownStyles={props.markdownStyles}
Expand Down Expand Up @@ -1863,6 +1876,7 @@ function renderFeedEntry(
<MarkdownImageAvailableWidthContext value={props.markdownContentWidth}>
<AssistantMarkdownContent
markdown={entry.text}
group={props.group}
environmentId={props.environmentId}
markdownStyles={markdownStyles.assistant}
linkHandlers={props.markdownLinkHandlers}
Expand Down Expand Up @@ -2065,6 +2079,7 @@ function renderFeedEntry(
return (
<ThreadAutomationMessageRow
environmentId={props.environmentId}
group={props.group}
text={presentation.text}
context={message.context}
scheduledTaskId={presentation.scheduledTaskId}
Expand Down Expand Up @@ -2306,6 +2321,7 @@ function renderFeedEntry(
>
<UserMessageContent
text={renderedText}
group={props.group}
sent={{ threadId: message.sourceThreadId, messageId: message.id }}
environmentId={props.environmentId}
context={message.context}
Expand Down Expand Up @@ -2430,6 +2446,7 @@ function renderFeedEntry(
<MarkdownImageAvailableWidthContext value={props.markdownContentWidth}>
<AssistantMarkdownContent
markdown={renderedText}
group={props.group}
environmentId={props.environmentId}
markdownStyles={styles}
linkHandlers={props.markdownLinkHandlers}
Expand Down Expand Up @@ -2553,6 +2570,7 @@ function TurnDiffStat(props: {

type UserMessageContentProps = {
readonly text: string;
readonly group?: ThreadGroup | null;
readonly sent?: { readonly threadId: ThreadId; readonly messageId: MessageId };
readonly environmentId: EnvironmentId;
readonly context?: OrchestrationMessageContext;
Expand Down Expand Up @@ -2693,6 +2711,7 @@ function UserMessageMarkdownContent(props: UserMessageContentProps) {
contextClipboardFragment={contextClipboardFragment}
skills={props.skills}
models={models}
group={props.group}
textStyle={props.markdownStyles.nativeTextStyle}
preserveSoftBreaks
{...props.linkHandlers}
Expand Down Expand Up @@ -2726,6 +2745,7 @@ function UserMessageMarkdownContent(props: UserMessageContentProps) {
contextClipboardFragment={contextClipboardFragment}
skills={props.skills}
models={models}
group={props.group}
textStyle={props.markdownStyles.nativeTextStyle}
preserveSoftBreaks
{...props.linkHandlers}
Expand Down Expand Up @@ -2886,6 +2906,8 @@ const THREAD_FEED_MAINTAIN_SCROLL_AT_END = {
} as const;

export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
const [group, setGroup] = useState(props.group);
if (!sameThreadGroup(group, props.group)) setGroup(props.group);
const formatMessageTime = useMessageTimeFormatter();
const { listRef, onIsAtEndChange, onHeaderMaterialVisibilityChange } = props;
const workflowOpening = useWorkflowOpening(props.detailRef);
Expand Down Expand Up @@ -3164,6 +3186,16 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
reply?: MarkdownLinkReply,
withGallery?: (source: FilePreviewSource) => FilePreviewSource,
) => {
const mention = exactGroupMention(href, group);
if (mention) {
if (mention.member !== "primary") {
openLinkedThread({
environmentId: String(props.environmentId),
threadId: String(mention.member),
});
}
return;
}
markdownLinkRequest.current?.abort();
const request = new AbortController();
markdownLinkRequest.current = request;
Expand Down Expand Up @@ -3276,6 +3308,19 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
onImagePress: (href, withGallery) => onMarkdownLinkPress(href, true, undefined, withGallery),
resolveImageSource,
fileContextMenu: (href) => {
const mention = exactGroupMention(href, group);
if (mention) {
return {
title: mention.label,
actions:
mention.member === "primary"
? [{ id: "copy-mention", title: "Copy" }]
: [
{ id: "open-member", title: "Open work" },
{ id: "copy-mention", title: "Copy" },
],
};
}
const skill = enrichedSkillReference(href, props.skills);
if (skill) {
return {
Expand Down Expand Up @@ -3305,6 +3350,16 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
return target ? fileChipMenu(target) : undefined;
},
onFileContextMenuAction: (href, actionId, reply) => {
const mention = exactGroupMention(href, group);
if (mention) {
if (actionId === "open-member" && mention.member !== "primary") {
openLinkedThread({
environmentId: String(props.environmentId),
threadId: String(mention.member),
});
} else if (actionId === "copy-mention") copyTextWithHaptic(mention.source);
return;
}
const skill = enrichedSkillReference(href, props.skills);
if (skill) {
const instructionsPath = enrichedSkillInstructionsPath(skill);
Expand Down Expand Up @@ -3499,6 +3554,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
// Include turn completion so unchanged message rows reveal their footer and spacing
// even when the final message update arrives before the turn settles.
const listAppearanceData = {
group,
disclosureLayout,
reduceMotion,
formatMessageTime,
Expand Down Expand Up @@ -3914,7 +3970,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
/>
) : null}
{renderFeedEntry(info, {
group: props.group,
group,
runs: structure?.projection.runs ?? [],
userMessageGrouping: info.item.userMessageGrouping,
formatMessageTime,
Expand Down
Loading
Loading