Skip to content

Commit c48006f

Browse files
tellahonpub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6wnpub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f
authored
fix(profile): consolidate agent profile runtime metadata (#1451)
Signed-off-by: Taylor Ho <[email protected]> Co-authored-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@sprout-oss.stage.blox.sqprod.co>
1 parent e42dae3 commit c48006f

17 files changed

Lines changed: 1009 additions & 753 deletions

‎desktop/src-tauri/src/managed_agents/config_bridge/reader.rs‎

Lines changed: 39 additions & 483 deletions
Large diffs are not rendered by default.

‎desktop/src-tauri/src/managed_agents/config_bridge/reader_tests.rs‎

Lines changed: 497 additions & 0 deletions
Large diffs are not rendered by default.

‎desktop/src/features/agents/ui/AgentConfigPanel.tsx‎

Lines changed: 251 additions & 58 deletions
Large diffs are not rendered by default.

‎desktop/src/features/agents/ui/CopyButton.tsx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Copy } from "lucide-react";
2-
import { toast } from "sonner";
32

3+
import { copyTextToClipboard } from "@/shared/lib/clipboard";
44
import { Button, type ButtonProps } from "@/shared/ui/button";
55

66
export function CopyButton({
@@ -23,10 +23,7 @@ export function CopyButton({
2323
return (
2424
<Button
2525
className={className}
26-
onClick={async () => {
27-
await navigator.clipboard.writeText(value);
28-
toast.success("Copied to clipboard");
29-
}}
26+
onClick={() => copyTextToClipboard(value)}
3027
size={size}
3128
type="button"
3229
variant={variant}

‎desktop/src/features/messages/ui/MessageActionBar.tsx‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Trash2,
1414
} from "lucide-react";
1515
import * as React from "react";
16-
import { toast } from "sonner";
1716

1817
import { buildMessageLink } from "@/features/messages/lib/messageLink";
1918
import { EmojiPicker } from "@/features/custom-emoji/ui/EmojiPicker";
@@ -29,6 +28,7 @@ import {
2928
} from "@/features/messages/ui/useQuickReactionEmojis";
3029
import { reactionEmojiUrl } from "@/shared/api/customEmoji";
3130
import { cn } from "@/shared/lib/cn";
31+
import { copyTextToClipboard } from "@/shared/lib/clipboard";
3232
import { emojiDisplayName } from "@/shared/lib/emojiName";
3333
import { rewriteRelayUrl } from "@/shared/lib/mediaUrl";
3434
import { KIND_HUDDLE_STARTED } from "@/shared/constants/kinds";
@@ -57,17 +57,6 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
5757
const ACTION_BUTTON_CLASS = "h-8 w-8 rounded-full p-0";
5858
const ACTION_ICON_CLASS = "!h-4 !w-4";
5959

60-
function copyToClipboard(text: string, successMessage: string) {
61-
void navigator.clipboard
62-
.writeText(text)
63-
.then(() => {
64-
toast.success(successMessage);
65-
})
66-
.catch(() => {
67-
toast.error("Failed to copy to clipboard");
68-
});
69-
}
70-
7160
function MoreActionsMenu({
7261
channelId,
7362
message,
@@ -199,7 +188,10 @@ function MoreActionsMenu({
199188
{hasCopyActions ? (
200189
<DropdownMenuItem
201190
onClick={() => {
202-
copyToClipboard(message.body, "Message copied to clipboard");
191+
copyTextToClipboard(
192+
message.body,
193+
"Message copied to clipboard",
194+
);
203195
}}
204196
>
205197
<Copy className="h-4 w-4" />
@@ -228,7 +220,7 @@ function MoreActionsMenu({
228220
messageId: message.id,
229221
threadRootId: rootId,
230222
});
231-
copyToClipboard(link, "Link copied to clipboard");
223+
copyTextToClipboard(link, "Link copied to clipboard");
232224
}}
233225
>
234226
<Link2 className="h-4 w-4" />

‎desktop/src/features/profile/ui/UserProfilePanel.tsx‎

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -768,28 +768,24 @@ export function UserProfilePanel({
768768
viewerIsOwner={viewerIsOwner}
769769
/>
770770
);
771-
const {
772-
agentInfoFields,
773-
agentSettingsFields,
774-
diagnosticsFields,
775-
modelLabel,
776-
} = useProfileFieldBuckets({
777-
isBot,
778-
isOwner,
779-
managedAgent,
780-
onOpenProfile,
781-
ownerAvatarUrl: ownerAvatarProfile?.avatarUrl ?? null,
782-
ownerDisplayName,
783-
ownerHandle,
784-
ownerProfilePubkey,
785-
ownerPubkey,
786-
persona: resolvedPersona,
787-
presenceLoaded: presenceQuery.isSuccess,
788-
presenceStatus,
789-
profile,
790-
pubkey: effectivePubkey,
791-
relayAgent,
792-
});
771+
const { agentInfoFields, agentSettingsFields, diagnosticsFields } =
772+
useProfileFieldBuckets({
773+
isBot,
774+
isOwner: viewerIsOwner,
775+
managedAgent,
776+
onOpenProfile,
777+
ownerAvatarUrl: ownerAvatarProfile?.avatarUrl ?? null,
778+
ownerDisplayName,
779+
ownerHandle,
780+
ownerProfilePubkey,
781+
ownerPubkey,
782+
persona: resolvedPersona,
783+
presenceLoaded: presenceQuery.isSuccess,
784+
presenceStatus,
785+
profile,
786+
pubkey: effectivePubkey,
787+
relayAgent,
788+
});
793789
const isDiagnosticsLikeView = view === "diagnostics" || view === "logs";
794790
const managedAgentLogContent = managedAgentLogQuery.data?.content ?? null;
795791
const logHeaderSubtitle =
@@ -846,7 +842,6 @@ export function UserProfilePanel({
846842
managedAgent={managedAgent}
847843
memoriesLoading={memoryQuery.isLoading}
848844
memoryCount={memoryCount}
849-
modelLabel={modelLabel}
850845
agentInfoFields={agentInfoFields}
851846
agentSettingsFields={agentSettingsFields}
852847
diagnosticsFields={diagnosticsFields}
@@ -876,11 +871,7 @@ export function UserProfilePanel({
876871
<AgentInfoFocusedView metadataFields={agentInfoFields} />
877872
) : null}
878873
{view === "configuration" ? (
879-
<AgentConfigurationFocusedView
880-
fields={agentSettingsFields}
881-
managedAgent={managedAgent}
882-
modelLabel={modelLabel}
883-
/>
874+
<AgentConfigurationFocusedView fields={agentSettingsFields} />
884875
) : null}
885876
{view === "instructions" ? (
886877
<AgentInstructionsFocusedView instruction={agentInstruction} />

‎desktop/src/features/profile/ui/UserProfilePanelAgentDetails.tsx‎

Lines changed: 3 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { ChevronRight, Cpu, MessageSquare } from "lucide-react";
1+
import { ChevronRight, MessageSquare } from "lucide-react";
22

3-
import type { ManagedAgent } from "@/shared/api/types";
43
import { Markdown } from "@/shared/ui/markdown";
54
import {
65
type ProfileField,
@@ -15,51 +14,33 @@ export const AGENT_DETAILS_FIELD_LABELS = new Set([
1514

1615
export function AgentConfigurationFocusedView({
1716
fields,
18-
managedAgent,
19-
modelLabel,
2017
}: {
2118
fields: ProfileField[];
22-
managedAgent: ManagedAgent | undefined;
23-
modelLabel: string;
2419
}) {
2520
const runtimeConfigurationFields = fields.filter((field) =>
2621
AGENT_DETAILS_FIELD_LABELS.has(field.label),
2722
);
2823

2924
return (
3025
<div className="pt-4">
31-
<AgentConfigurationRows
32-
fields={runtimeConfigurationFields}
33-
managedAgent={managedAgent}
34-
modelLabel={modelLabel}
35-
showModel={true}
36-
/>
26+
<AgentConfigurationRows fields={runtimeConfigurationFields} />
3727
</div>
3828
);
3929
}
4030

4131
function AgentConfigurationRows({
4232
fields,
4333
instruction,
44-
managedAgent,
45-
modelLabel,
4634
showInstructionPlaceholder,
47-
showModel,
4835
}: {
4936
fields: ProfileField[];
5037
instruction?: string | null;
51-
managedAgent: ManagedAgent | undefined;
52-
modelLabel: string;
5338
showInstructionPlaceholder?: boolean;
54-
showModel: boolean;
5539
}) {
5640
const hasRows = hasAgentConfigurationRows({
5741
fields,
5842
instruction,
59-
managedAgent,
60-
modelLabel,
6143
showInstructionPlaceholder,
62-
showModel,
6344
});
6445

6546
if (!hasRows) {
@@ -71,10 +52,7 @@ function AgentConfigurationRows({
7152
<AgentDetailsRows
7253
fields={fields}
7354
instruction={instruction}
74-
managedAgent={managedAgent}
75-
modelLabel={modelLabel}
7655
showInstructionPlaceholder={showInstructionPlaceholder}
77-
showModel={showModel}
7856
/>
7957
</div>
8058
);
@@ -83,26 +61,17 @@ function AgentConfigurationRows({
8361
export function AgentDetailsRows({
8462
fields,
8563
instruction,
86-
managedAgent,
87-
modelLabel,
8864
showInstructionPlaceholder,
89-
showModel = false,
9065
}: {
9166
fields: ProfileField[];
9267
instruction?: string | null;
93-
managedAgent?: ManagedAgent | undefined;
94-
modelLabel?: string;
9568
showInstructionPlaceholder?: boolean;
96-
showModel?: boolean;
9769
}) {
9870
const trimmedInstruction = instruction?.trim() ?? "";
9971
const showInstructions =
10072
trimmedInstruction.length > 0 || showInstructionPlaceholder === true;
101-
const showModelRow =
102-
showModel === true &&
103-
(managedAgent !== undefined || (modelLabel?.trim().length ?? 0) > 0);
10473

105-
if (!showInstructions && !showModelRow && fields.length === 0) {
74+
if (!showInstructions && fields.length === 0) {
10675
return null;
10776
}
10877

@@ -112,10 +81,6 @@ export function AgentDetailsRows({
11281
<AgentInstructionRow instruction={instruction ?? null} />
11382
) : null}
11483

115-
{showModelRow ? (
116-
<AgentModelRow modelLabel={modelLabel ?? "Auto"} />
117-
) : null}
118-
11984
{fields.length > 0 ? <ProfileFieldRows fields={fields} /> : null}
12085
</>
12186
);
@@ -124,25 +89,17 @@ export function AgentDetailsRows({
12489
function hasAgentConfigurationRows({
12590
fields,
12691
instruction,
127-
managedAgent,
128-
modelLabel,
12992
showInstructionPlaceholder,
130-
showModel,
13193
}: {
13294
fields: ProfileField[];
13395
instruction?: string | null;
134-
managedAgent: ManagedAgent | undefined;
135-
modelLabel: string;
13696
showInstructionPlaceholder?: boolean;
137-
showModel: boolean;
13897
}) {
13998
const trimmedInstruction = instruction?.trim() ?? "";
14099

141100
return (
142101
trimmedInstruction.length > 0 ||
143102
showInstructionPlaceholder === true ||
144-
(showModel === true &&
145-
(managedAgent !== undefined || modelLabel.trim().length > 0)) ||
146103
fields.length > 0
147104
);
148105
}
@@ -243,22 +200,3 @@ export function AgentInstructionsFocusedView({
243200
</div>
244201
);
245202
}
246-
247-
function AgentModelRow({ modelLabel }: { modelLabel: string }) {
248-
return (
249-
<div
250-
className="flex items-center gap-3 px-4 py-3"
251-
data-testid="user-profile-model"
252-
>
253-
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted/60">
254-
<Cpu className="h-4 w-4 text-muted-foreground" />
255-
</span>
256-
<span className="min-w-0 flex-1">
257-
<span className="block text-xs font-medium text-foreground">Model</span>
258-
<span className="mt-0.5 block truncate text-sm text-muted-foreground">
259-
{modelLabel}
260-
</span>
261-
</span>
262-
</div>
263-
);
264-
}

0 commit comments

Comments
 (0)