Repository navigation
feat(desktop): show agent owners in messages #2080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import * as React from "react"; | ||
|
|
||
| import { useUsersBatchQuery } from "@/features/profile/hooks"; | ||
| import type { UserProfileLookup } from "@/features/profile/lib/identity"; | ||
|
|
||
| /** Fetches verified agent-owner profiles in one batch for message surfaces. */ | ||
| export function useMessageOwnerProfiles(profiles: UserProfileLookup) { | ||
| const ownerPubkeys = React.useMemo( | ||
| () => [ | ||
| ...new Set( | ||
| Object.values(profiles) | ||
| .map((profile) => profile.ownerPubkey) | ||
| .filter((pubkey): pubkey is string => Boolean(pubkey)), | ||
| ), | ||
| ], | ||
| [profiles], | ||
| ); | ||
| const ownerProfilesQuery = useUsersBatchQuery(ownerPubkeys, { | ||
| enabled: ownerPubkeys.length > 0, | ||
| }); | ||
| return ownerProfilesQuery.data?.profiles; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { Bot } from "lucide-react"; | ||
|
|
||
| import { UserProfilePopover } from "@/features/profile/ui/UserProfilePopover"; | ||
|
|
||
| export function MessageAgentOwner({ | ||
| ownerLabel, | ||
| ownerPubkey, | ||
| }: { | ||
| ownerLabel?: string | null; | ||
| ownerPubkey?: string | null; | ||
| }) { | ||
| return ( | ||
| <span | ||
| className="inline-flex min-w-0 max-w-56 items-baseline gap-1 text-xs leading-4 text-muted-foreground/65" | ||
| data-testid="message-agent-owner" | ||
| > | ||
| <span className="sr-only"> | ||
| {ownerLabel | ||
| ? `Agent owned by ${ownerLabel}` | ||
| : "Agent; owner unavailable"} | ||
| </span> | ||
| {ownerPubkey && ownerLabel ? ( | ||
| <> | ||
| <span | ||
| aria-hidden="true" | ||
| className="inline-flex shrink-0 items-baseline gap-1 leading-4" | ||
| > | ||
| <Bot className="relative -top-px h-3.5 w-3.5 self-center" /> | ||
| <span>owned by</span> | ||
| </span> | ||
| <UserProfilePopover pubkey={ownerPubkey} triggerElement="span"> | ||
| <span | ||
| aria-hidden="true" | ||
| className="min-w-0 truncate rounded font-semibold text-foreground/85 hover:text-foreground hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" | ||
| > | ||
| {ownerLabel} | ||
| </span> | ||
| </UserProfilePopover> | ||
| </> | ||
| ) : ( | ||
| <span | ||
| aria-hidden="true" | ||
| className="inline-flex min-w-0 items-center gap-1" | ||
| > | ||
| <Bot className="h-3.5 w-3.5 shrink-0" /> | ||
| <span className="truncate">owner unavailable</span> | ||
| </span> | ||
| )} | ||
| </span> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an agent has a known owner,
UserProfilePopoverwraps this child in a focusablespantrigger (role button/tabIndex when the profile panel can open), but the only text inside that trigger is markedaria-hidden; thesr-onlytext above is a sibling, so screen-reader users tabbing to the owner link get an unlabeled control. Remove thearia-hiddenfrom the owner label or otherwise label the popover trigger so the interactive owner link has an accessible name.Useful? React with 👍 / 👎.