Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
91 lines
2.3 KiB
TypeScript
91 lines
2.3 KiB
TypeScript
import type { JSX } from "react";
|
|
import { Avatar } from "@tutti-os/ui-system";
|
|
import type { AgentMessageRowVM } from "../contracts/agentMessageRowVM";
|
|
import type {
|
|
AgentConversationParticipantIdentity,
|
|
AgentConversationParticipantPresentation
|
|
} from "../contracts/agentConversationParticipantPresentation";
|
|
import styles from "../../../agent-gui/agentGuiNode/AgentGUIConversation.styles";
|
|
|
|
export function AgentConversationParticipantHeader({
|
|
presentation,
|
|
speaker
|
|
}: {
|
|
presentation: Extract<
|
|
AgentConversationParticipantPresentation,
|
|
{ enabled: true }
|
|
>;
|
|
speaker: AgentMessageRowVM["speaker"];
|
|
}): JSX.Element {
|
|
const participant: AgentConversationParticipantIdentity | null =
|
|
presentation.status === "loading"
|
|
? null
|
|
: speaker === "user"
|
|
? presentation.user
|
|
: presentation.agent;
|
|
const nameContent = participant ? (
|
|
<span className={styles.participantName}>{participant.name}</span>
|
|
) : null;
|
|
const avatarContent = (
|
|
<AgentConversationParticipantAvatar
|
|
presentation={presentation}
|
|
speaker={speaker}
|
|
/>
|
|
);
|
|
return (
|
|
<div
|
|
className={styles.participantMessageHeader}
|
|
data-agent-conversation-participant-header={speaker}
|
|
>
|
|
{speaker === "user" ? (
|
|
<>
|
|
{nameContent}
|
|
{avatarContent}
|
|
</>
|
|
) : (
|
|
<>
|
|
{avatarContent}
|
|
{nameContent}
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function AgentConversationParticipantAvatar({
|
|
presentation,
|
|
speaker
|
|
}: {
|
|
presentation: Extract<
|
|
AgentConversationParticipantPresentation,
|
|
{ enabled: true }
|
|
>;
|
|
speaker: AgentMessageRowVM["speaker"];
|
|
}): JSX.Element {
|
|
if (presentation.status === "loading") {
|
|
return (
|
|
<Avatar
|
|
aria-hidden="true"
|
|
className={styles.participantAvatar}
|
|
data-agent-conversation-participant-avatar={speaker}
|
|
label=""
|
|
loading
|
|
size={28}
|
|
/>
|
|
);
|
|
}
|
|
|
|
const participant: AgentConversationParticipantIdentity =
|
|
speaker === "user" ? presentation.user : presentation.agent;
|
|
return (
|
|
<Avatar
|
|
aria-label={participant.name}
|
|
className={styles.participantAvatar}
|
|
data-agent-conversation-participant-avatar={speaker}
|
|
label={participant.name}
|
|
size={28}
|
|
src={participant.avatarUrl}
|
|
/>
|
|
);
|
|
}
|