Skip to content

Commit dbad796

Browse files
committed
fix(desktop): enable all agent profile ingress views
- Use the shared profile panel view parser for channel and Pulse URL search state so every focused profile subview survives navigation and reloads. - Replace the old memories/channels-only profileView whitelist in channel and Pulse route validation. - Expand the profile Playwright coverage to exercise agent instruction, model, settings, diagnostics/logs, channels, and memories ingress rows from a mock managed agent profile. Co-authored-by: Taylor Ho <[email protected]> Signed-off-by: Taylor Ho <[email protected]>
1 parent 309889d commit dbad796

5 files changed

Lines changed: 68 additions & 22 deletions

File tree

‎desktop/src/app/routes/channels.$channelId.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import {
5+
parseProfilePanelView,
6+
type ProfilePanelView,
7+
} from "@/features/profile/ui/UserProfilePanelUtils";
48
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
59

610
type ChannelRouteSearch = {
711
agentSession?: string;
812
messageId?: string;
913
profile?: string;
10-
profileView?: "memories" | "channels";
14+
profileView?: ProfilePanelView;
1115
thread?: string;
1216
threadRootId?: string;
1317
};
@@ -16,18 +20,14 @@ function nonEmptyString(value: unknown): string | undefined {
1620
return typeof value === "string" && value.length > 0 ? value : undefined;
1721
}
1822

19-
function profileViewValue(value: unknown): "memories" | "channels" | undefined {
20-
return value === "memories" || value === "channels" ? value : undefined;
21-
}
22-
2323
function validateChannelSearch(
2424
search: Record<string, unknown>,
2525
): ChannelRouteSearch {
2626
return {
2727
agentSession: nonEmptyString(search.agentSession),
2828
messageId: nonEmptyString(search.messageId),
2929
profile: nonEmptyString(search.profile),
30-
profileView: profileViewValue(search.profileView),
30+
profileView: parseProfilePanelView(search.profileView) ?? undefined,
3131
thread: nonEmptyString(search.thread),
3232
threadRootId: nonEmptyString(search.threadRootId),
3333
};

‎desktop/src/app/routes/pulse.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import {
5+
parseProfilePanelView,
6+
type ProfilePanelView,
7+
} from "@/features/profile/ui/UserProfilePanelUtils";
48
import { usePreviewFeatureWarning } from "@/shared/features";
59
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
610

@@ -11,7 +15,7 @@ const PulseScreen = React.lazy(async () => {
1115

1216
type PulseRouteSearch = {
1317
profile?: string;
14-
profileView?: "memories" | "channels";
18+
profileView?: ProfilePanelView;
1519
};
1620

1721
function validatePulseSearch(
@@ -22,10 +26,7 @@ function validatePulseSearch(
2226
typeof search.profile === "string" && search.profile.length > 0
2327
? search.profile
2428
: undefined,
25-
profileView:
26-
search.profileView === "memories" || search.profileView === "channels"
27-
? search.profileView
28-
: undefined,
29+
profileView: parseProfilePanelView(search.profileView) ?? undefined,
2930
};
3031
}
3132

‎desktop/src/features/channels/ui/useChannelPanelHistoryState.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as React from "react";
22

3-
import type { ProfilePanelView } from "@/features/profile/ui/UserProfilePanel";
3+
import {
4+
profilePanelViewFromSearch,
5+
type ProfilePanelView,
6+
} from "@/features/profile/ui/UserProfilePanelUtils";
47
import {
58
type HistorySearchSetterOptions,
69
useHistorySearchState,
@@ -32,10 +35,6 @@ const CHANNEL_SEARCH_KEYS = [
3235
"threadRootId",
3336
] as const;
3437

35-
function asProfilePanelView(value: string | null): ProfilePanelView {
36-
return value === "memories" || value === "channels" ? value : "summary";
37-
}
38-
3938
export function useChannelPanelHistoryState() {
4039
const { applyPatch, values } = useHistorySearchState(CHANNEL_SEARCH_KEYS);
4140

@@ -74,7 +73,7 @@ export function useChannelPanelHistoryState() {
7473
openAgentSessionPubkey: values.agentSession,
7574
openThreadHeadId: values.thread,
7675
profilePanelPubkey: values.profile,
77-
profilePanelView: asProfilePanelView(values.profileView),
76+
profilePanelView: profilePanelViewFromSearch(values.profileView),
7877
setOpenAgentSessionPubkey,
7978
setOpenThreadHeadId,
8079
setProfilePanelPubkey,

‎desktop/src/features/pulse/ui/PulseScreen.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type ProfilePanelView,
77
UserProfilePanel,
88
} from "@/features/profile/ui/UserProfilePanel";
9+
import { profilePanelViewFromSearch } from "@/features/profile/ui/UserProfilePanelUtils";
910
import { PulseView } from "@/features/pulse/ui/PulseView";
1011
import { useIdentityQuery } from "@/shared/api/hooks";
1112
import { ProfilePanelProvider } from "@/shared/context/ProfilePanelContext";
@@ -18,10 +19,7 @@ export function PulseScreen() {
1819
const identityQuery = useIdentityQuery();
1920
const { applyPatch, values } = useHistorySearchState(PULSE_PANEL_SEARCH_KEYS);
2021
const profilePanelPubkey = values.profile;
21-
const profilePanelView: ProfilePanelView =
22-
values.profileView === "memories" || values.profileView === "channels"
23-
? values.profileView
24-
: "summary";
22+
const profilePanelView = profilePanelViewFromSearch(values.profileView);
2523
const handleOpenProfilePanel = React.useCallback(
2624
(pubkey: string) => applyPatch({ profile: pubkey, profileView: null }),
2725
[applyPatch],

‎desktop/tests/e2e/profile.spec.ts‎

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ test("updates presence from the profile menu", async ({ page }) => {
627627
).toContainText("Offline");
628628
});
629629

630-
test("renders agent memories seeded through the Playwright mock bridge", async ({
630+
test("renders agent profile ingress subviews from the Playwright mock bridge", async ({
631631
page,
632632
}) => {
633633
await installMockBridge(page, {
@@ -671,6 +671,54 @@ test("renders agent memories seeded through the Playwright mock bridge", async (
671671
await messageRow.locator("button").first().click();
672672

673673
await expect(page.getByTestId("user-profile-panel")).toBeVisible();
674+
const openSubview = async (testId: string, title: string) => {
675+
await page.getByTestId(testId).click();
676+
await expect(
677+
page.getByRole("heading", { level: 2, name: title }),
678+
).toBeVisible();
679+
};
680+
const backToProfile = async () => {
681+
await page.getByTestId("user-profile-panel-back").click();
682+
await expect(
683+
page.getByRole("heading", { level: 2, name: "Profile" }),
684+
).toBeVisible();
685+
};
686+
687+
await openSubview(
688+
"user-profile-agent-instruction-ingress",
689+
"Agent instruction",
690+
);
691+
await expect(
692+
page.getByTestId("user-profile-agent-instruction"),
693+
).toContainText("Watch the channel and help when asked.");
694+
await backToProfile();
695+
696+
await openSubview("user-profile-model-ingress", "Model");
697+
await expect(
698+
page.getByRole("heading", { level: 2, name: "Model" }),
699+
).toBeVisible();
700+
await backToProfile();
701+
702+
await openSubview("user-profile-agent-settings-ingress", "Agent settings");
703+
await expect(
704+
page.getByTestId(`user-profile-agent-auto-start-${agentPubkey}`),
705+
).toBeVisible();
706+
await backToProfile();
707+
708+
await openSubview("user-profile-diagnostics-ingress", "Diagnostics");
709+
await page.getByTestId(`user-profile-agent-logs-${agentPubkey}`).click();
710+
await expect(
711+
page.getByRole("heading", { level: 2, name: "Harness log" }),
712+
).toBeVisible();
713+
await expect(page.getByTestId("managed-agent-log-content")).toBeVisible();
714+
await backToProfile();
715+
716+
await openSubview("user-profile-channels-ingress", "Channels");
717+
await expect(page.getByTestId("user-profile-channels-list")).toContainText(
718+
"#general",
719+
);
720+
await backToProfile();
721+
674722
const memoriesIngress = page.getByTestId("user-profile-memories-ingress");
675723
await expect(memoriesIngress).toContainText("Memories");
676724
await expect(memoriesIngress).toContainText("9");

0 commit comments

Comments
 (0)