diff --git a/FORK.md b/FORK.md index 713a313a99ea5..1f0faede116fa 100644 --- a/FORK.md +++ b/FORK.md @@ -428,6 +428,7 @@ migrations after upstream migrations. 72. Settings › People, and a project's Sharing section ([#535](https://github.com/Jacksondr5/j5code/issues/535), [#541](https://github.com/Jacksondr5/j5code/issues/541), register D33, Jackson's 2026-10-12 design and approval of the Settings navigation and route registration). The page (`apps/web/src/j5/sharing/PeoplePage.tsx`) and everything it draws are J5-owned; `apps/web/src/routes/settings.people.tsx` is a J5-owned route file in upstream's routes folder, the shape of `settings.skills.tsx` (case 42), and `routeTree.gen.ts` regenerates with it. Registering a settings section takes upstream's own tables, each one entry: in `apps/web/src/components/settings/settingsSearch.ts` the `SettingsPath` union, `SETTINGS_SECTION_LABELS` (after Connections, which sets the sidebar order), `SETTINGS_CATEGORY_SCOPES` (`"connections"`, the page is about the primary server as Connections is) and one search item, `people`; in `SettingsSidebarNav.tsx` the icon map (`UsersIcon`) and one more condition in the nav filter, `item.to !== "/settings/people" || canSeePeople`, with `useCanSeePeople()` from J5-owned `j5/sharing/peopleAccess.ts` (the primary connection holds `access:read`, which a guest's never does); in `SettingsScopeSentence.tsx` one line adding the path to `SETTINGS_DEVICE_ONLY_PATHS`, so the page shows no project-and-environment picker, as Connections shows none. `apps/web/src/components/settings/ProjectSettingsPanel.tsx` gains one import and one mount, ``, above the Danger section; `ProjectSettingsPanel.test.tsx` mocks that one module (two lines), because the test replaces the connection runtime with `undefined` and J5's sharing commands are made from it when their module loads. The palette entry "Open People" joins case 71's hook with no further upstream edit. On a pin advance: if upstream reshapes how a settings section is declared, re-register People after Connections; if upstream adds a settings page of its own for people or access, read D33 before keeping J5's. 73. A shared thread says who is on it, and a guest's client fits what a guest can do ([#535](https://github.com/Jacksondr5/j5code/issues/535), [#541](https://github.com/Jacksondr5/j5code/issues/541), register D33, Jackson's 2026-10-12 design and approval of one mount or item in each of these files). All of it is J5-owned code under `apps/web/src/j5/sharing/`, mounted once in each upstream file. `apps/web/src/components/chat/ChatHeader.tsx`: one import and `` after the breadcrumb, for a server thread; it draws nothing unless a guest holds a grant on the thread or its project. `apps/web/src/components/chat/ThreadDetailsPanel.tsx`: one import and `` after `ThreadRelationshipsPanel`, under the same `density === "full" && !props.draftId` condition as its neighbours; it uses upstream's exported `ThreadDetailsSection`. `apps/web/src/components/chat/ChatComposer.tsx`: one import, one hook call after the props are read (`useViewOnlyComposerProps(environmentId, canOperateThread)`), and one spread, `{...viewOnlyComposerProps}`, placed after upstream's `placeholder={…}` prop so that it replaces the placeholder for a guest whose level on the thread is View and is empty for everyone else; a first branch in upstream's nested ternary would have re-indented all of it. The composer collapsed to one line on a narrow window has its own fallback text, `"Ask anything..."`, a few hundred lines above; that literal becomes `(viewOnlyComposerProps.placeholder ?? "Ask anything...")` (one line and a comment). A guest's thread menu needs no further upstream line: case 71's two calls in `useThreadActionMenu.ts` and `Sidebar.tsx` now drop Archive, Delete, "Project settings" and "Share thread…" for a guest and put "Leave thread" where Archive was (`j5/sharing/sharingMenu.ts`, told who is a guest by `guestAccess.ts` so that it still imports nothing of the connection runtime). The chip and the section ask the server who reaches the thread (`j5.sharing.listThreadPeople`) and ask again when its counter moves (`j5.sharing.subscribeThreadPeopleChanges`); that stream joins `EnvironmentSubscriptionRpcTag` in `packages/client-runtime/src/rpc/client.ts`, one more line beside case 69's `subscribeThreadAccess`. Two route files carry the guest's way in (Jackson's 2026-10-13 approval). `apps/web/src/routes/pair.tsx`: the import of upstream's `PairingRouteSurface` becomes an import of J5's `GuestAwarePairingSurface`, and the JSX tag changes with it (three lines; the props are the same and upstream's `components/auth/PairingRouteSurface.tsx` is not edited). J5's surface asks `POST /api/j5/sharing/describe` what the link opens, without spending it, only for a link that carries J5's mark, and waits up to five seconds for the answer. Everything else gets upstream's surface with the props it was given: no token, and any link without the mark, at once and with no request made about it (an ordinary pairing token is sent nowhere but upstream's own exchange); a marked link when the server cannot be asked or does not answer in time. Case 71's link step puts that mark, `j5share=1`, in the fragment beside upstream's `token`; upstream reads the fragment as parameters and takes only `token`, in the direct and the hosted form. `apps/web/src/routes/_chat.index.tsx`: one import, and `` is wrapped in ``. For a member the wrapper renders its child at once, with the sharing answer pending or failed; it holds the frame only for a browser that remembers being paired through a share link (one `localStorage` key, written by the pairing surface and overwritten by the server's answer), and for a guest it shows their thread, a list, or that nothing is shared with them. Upstream's hosted pairing surface is left alone, so a named link opened through the hosted app pairs as upstream has it, and a join link is never offered in the hosted form. Two edits quiet what a guest could only see fail (the build lead under Jackson's 2026-10-13 standing permission for one import and one or two lines). `ThreadDetailsPanel.tsx`, beside the People mount: one more import, `const isGuest = useIsGuest(props.environmentId)` at the top of the component, and `&& !isGuest` on the condition that mounts upstream's `ThreadAutomationsPanel`, which asks for the server's scheduled tasks. `apps/web/src/components/settings/SettingsSidebarNav.tsx`: case 72's nav-filter condition becomes one call into J5, `shownForConnection(item.to)` from `useSettingsNavShown()` (the file gains two lines over case 72), which also leaves Scheduled Tasks, Source Control and Archive, and J5's own Personas and Skills, out of the Settings sidebar of a person who is a guest on every connected server (someone who is also a member of another keeps them; People follows the primary server's own answer); those pages still show upstream's own error to a guest who types their address. `apps/web/src/routes/__root.tsx` (Jackson approved it on 2026-10-13 with one rule: a client is changed only for a person who is a guest on every server they are connected to, never because one of several is a guest one): one import, one hook call beside `primaryEnvironmentAuthenticated`, `useFirstRunSetupOffered(primaryEnvironmentAuthenticated)`, and `FirstRunGate`'s `enabled` reads its answer. For a browser never paired through a share link the answer is upstream's own; a browser that remembers being paired through one is not sent to the setup wizard, which asks a guest to connect computers and import projects, and is offered it again when the server's answer says member and the key clears, or as soon as any other connected server says this person is a member of it (the hook lives in J5's `j5/sharing/firstRunSetup.ts`). `apps/web/src/components/Sidebar.tsx` (approved the same day, under the same rule): one import, `const isGuest = useIsGuestEverywhere()` beside the primary environment's id, and `&& !isGuest` on the empty list's `projects.length === 0` condition, so a guest with nothing shared reads upstream's own "No threads yet" in place of "No projects yet" over an "Add project" button that could only fail. `apps/web/src/j5/artifacts/ArtifactsPage.tsx` is J5's own file. On a pin advance: if upstream moves the composer's `placeholder` prop, keep the spread after it, or a View guest reads upstream's "Ask anything…" over a composer that cannot send; if upstream renames the menu's `archive` or `delete` items, a guest sees them again, disabled, and `sharingMenu.test.ts` still passes, so check a guest's menu in a browser; if upstream reorders the details panel, keep People after Lineage and the guest condition on the Automations mount; if upstream adds a Settings page that asks a guest for what it is not given, add its path to `HIDDEN_FROM_A_GUEST` in `j5/sharing/peopleAccess.ts`; if upstream changes how a pairing address carries its token, or starts to refuse a fragment it does not know, reread `SHARE_LINK_MARK` in J5-owned `packages/contracts/src/j5/sharing.ts` (the web client and the live-test rig's `guest` both mark a link there), whose test in `apps/web/src/j5/sharing/shareLink.logic.test.ts` reads a marked address with upstream's own `getPairingTokenFromUrl`; if upstream renames `PairingRouteSurface` or changes its props, J5's surface fails to compile; if upstream's index route stops rendering `IndexDraftLanding`, re-wrap whatever it renders, or a guest's first screen is a draft they cannot send; if upstream renames `FirstRunGate`'s `enabled` or gates first run elsewhere, a guest with nothing shared lands on the setup wizard again. 74. An agent's browser tab is private unless it names a profile (register D34, Jackson's 2026-10-13 decision). Upstream's `resolveOpenProfile` in `apps/server/src/preview/ServerBrowser.ts` gives a `preview_open` call without a `profileId` the person's default profile, whose stored state every agent tab on the server shares. J5 changes that one return to `INCOGNITO_BROWSER_PROFILE_ID`, which the file already imports, so the tab gets its own throwaway storage through upstream's existing incognito path. A named profile resolves as upstream's does. The `preview_open` description in `apps/server/src/mcp/toolkits/preview/tools.ts` changes one clause to say what omitting `profileId` now means. `ServerBrowser.test.ts` changes two expectations and their test titles. On a pin advance, keep the return and the description clause; if upstream makes agent tabs private by default, take upstream's and retire this case and D34. +75. Highlights, a client's "What's new" ([#624](https://github.com/Jacksondr5/j5code/issues/624), register D35, Jackson's 2026-10-17 decision and design). The entries, the client filter and the rule for what is new are J5-owned `packages/client-runtime/src/j5/highlights.ts`, reached through the `./j5/highlights` export this case appends to upstream-owned `packages/client-runtime/package.json`; the web button, list, art, seen record and palette entry are J5-owned files under `apps/web/src/j5/highlights/`. Four upstream files are touched. `apps/web/src/components/sidebar/SidebarChrome.tsx`: `SidebarUtilityMenu`'s `SidebarMenu` gains the class `@container/utility`, which the button's container query reads to hide itself where the row is too narrow, and `` is mounted immediately before `` (one import, one line). The button's item carries `ms-auto` and cancels the update button's own `ms-auto` with `[&+li]:ms-0`, so the two sit together at the end of the row. `apps/web/src/components/AppSidebarLayout.tsx` mounts `` after upstream's `` (one import, one line): the palette sits outside the sidebar provider, and this helper leaves a utility page and opens a collapsed sidebar when the palette asks for the list. `apps/web/src/components/CommandPalette.tsx` gains one import, one hook call (`useHighlightsPaletteItems()`, beside case 71's) and appends its items to case 71's `actionItems.push(...)`. `apps/web/src/onboarding/firstRun.ts`: `useCompleteOnboarding`, which every path that finishes first run calls (the wizard, the gate's silent completion for a client on an existing workspace, and hosted mode), calls `markAllHighlightsSeen()` before it writes `onboardingCompletedAt` (one import, one call). A finished client with no record is then an existing one, and the order makes that hold whenever the highlights code first reads it. On a pin advance: if upstream moves the utility row, the update button or `MainAppLocationTracker`, re-apply the mounts where they went; if upstream adds another writer of `onboardingCompletedAt`, it needs the same call before it; if upstream's palette `actionItems` moves, re-apply the append as in case 71. ## Pin and upstream advance runbook @@ -759,11 +760,12 @@ explicitly marked. | `packages/client-runtime/src/rpc/client.ts` | A | 45, 64, 69, 73 | | `apps/web/src/composer-logic.ts` | A | 45, 49 | | `apps/server/src/auth/RpcAuthorization.ts` | A | 42, 44, 45, 64 | +| `apps/web/src/components/AppSidebarLayout.tsx` | N | 75 | | `apps/web/src/components/ChatView.tsx` | A | 19, 24, 45, 49, 69 | | `apps/web/src/environments/primary/auth.ts` | N | 70 | | `apps/web/src/components/CommandPalette.logic.test.ts` | R | 34 | | `apps/web/src/components/CommandPalette.logic.ts` | R | 34 | -| `apps/web/src/components/CommandPalette.tsx` | A | 42, 71 | +| `apps/web/src/components/CommandPalette.tsx` | A | 42, 71, 75 | | `apps/web/src/components/ConfirmDialogHost.tsx` | R | 22 | | `apps/web/src/components/LegacySidebar.tsx` | R | 21, 22 | | `apps/web/src/components/Sidebar.logic.test.ts` | R | 21 | @@ -774,7 +776,8 @@ explicitly marked. | `apps/web/src/components/chat/timelineMinimapItems.ts` | A | 24 | | `apps/web/src/components/chat/MessagesTimeline.tsx` | A | B, 7, 24 | | `apps/web/src/components/chat/QueuedRunsControl.tsx` | A | 24 | -| `apps/web/src/components/sidebar/SidebarChrome.tsx` | A | 6, 33, B | +| `apps/web/src/components/sidebar/SidebarChrome.tsx` | A | 6, 33, 75, B | +| `apps/web/src/onboarding/firstRun.ts` | N | 75 | | `apps/web/src/confirmDialog.test.ts` | R | 22 | | `apps/web/src/confirmDialog.ts` | R | 22 | | `apps/web/src/contextMenuFallback.ts` | N | 71 | @@ -792,7 +795,7 @@ explicitly marked. | `apps/web/src/routeTree.gen.ts` | R | generated route registrations for 6/9 | | `apps/web/src/components/onboarding/WelcomeWizard.tsx` | R | 39, B | | `apps/web/tsconfig.json` | R | B | -| `packages/client-runtime/package.json` | R | 23, 34, 45, 69 | +| `packages/client-runtime/package.json` | R | 23, 34, 45, 69, 75 | | `packages/client-runtime/src/connection/compatibility.ts` | A | 56 | | `packages/client-runtime/src/operations/commands.ts` | R | Saved-agent mentions | | `packages/contracts/package.json` | N | 34 | diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx index 00d5c05ef0890..1402a9ac75560 100644 --- a/apps/web/src/components/AppSidebarLayout.tsx +++ b/apps/web/src/components/AppSidebarLayout.tsx @@ -56,6 +56,7 @@ import { useSidebarVisibility, } from "./ui/sidebar"; import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; +import { HighlightsSidebarReveal } from "../j5/highlights/highlightsPalette"; const MACOS_TRAFFIC_LIGHTS_LEFT_INSET = "var(--desktop-window-controls-inset, 90px)"; @@ -346,6 +347,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { + ); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 967e99dd41afc..6a6b821e51128 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -1,5 +1,6 @@ "use client"; +import { useHighlightsPaletteItems } from "../j5/highlights/highlightsPalette"; import { useSharingPaletteItems } from "../j5/sharing/sharingPalette"; import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility"; import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests"; @@ -1935,6 +1936,7 @@ function OpenCommandPaletteDialog(props: { activeThread, projectRef: contextualProjectRef, }); + const highlightsPaletteItems = useHighlightsPaletteItems(); const actionItems: Array = []; if (projects.length > 0) { const activeProjectTitle = @@ -2324,7 +2326,7 @@ function OpenCommandPaletteDialog(props: { }, }); - actionItems.push(...sharingPaletteItems); + actionItems.push(...sharingPaletteItems, ...highlightsPaletteItems); // Target the active thread or draft's project, falling back to the first sidebar group. const contextualProjectGroup = diff --git a/apps/web/src/components/sidebar/SidebarChrome.tsx b/apps/web/src/components/sidebar/SidebarChrome.tsx index 7d31a3a5f8bdb..cb93131aa4914 100644 --- a/apps/web/src/components/sidebar/SidebarChrome.tsx +++ b/apps/web/src/components/sidebar/SidebarChrome.tsx @@ -13,6 +13,7 @@ import { useEnvironmentIdentificationMode } from "../../hooks/useSettings"; import { HumanInboxBell } from "../../j5/a2a/HumanInboxBell"; import { J5Wordmark } from "../../j5/branding/J5Wordmark"; import { FleetRailEntry } from "../../j5/fleet/FleetRailEntry"; +import { SidebarHighlightsButton } from "../../j5/highlights/SidebarHighlightsButton"; import { cn } from "../../lib/utils"; import { usePullRequestsSupported } from "../../state/environments"; import { useThreadShells } from "../../state/entities"; @@ -241,7 +242,7 @@ export const SidebarUtilityMenu = memo(function SidebarUtilityMenu() { }, [closeMobileSidebar, navigateToMainApp]); return ( - + {isOnUtilityPage ? ( @@ -275,6 +276,7 @@ export const SidebarUtilityMenu = memo(function SidebarUtilityMenu() { /> )} + ); diff --git a/apps/web/src/j5/highlights/HighlightArt.tsx b/apps/web/src/j5/highlights/HighlightArt.tsx new file mode 100644 index 0000000000000..39b82c14948b4 --- /dev/null +++ b/apps/web/src/j5/highlights/HighlightArt.tsx @@ -0,0 +1,237 @@ +import type { CSSProperties, ReactNode } from "react"; + +/** + * Shared art kit for highlight tiles. A highlight's PR adds its scene beside PeeringTile.tsx and + * names it in HighlightArt (client-runtime) and HighlightsList's table. + * + * The marketing site's paper boats, drawn + * once as a sprite and reused with . Colours come from --hl-* custom + * properties set on the tile container (see highlightArtThemeClassName), so + * one sprite serves both themes. Still images only: nothing here animates. + */ + +/** Theme tokens for a tile, as Tailwind arbitrary properties. Put this on the tile container. */ +export const highlightArtThemeClassName = [ + // chart paper (light) + "[--hl-bg:#f4efe4] [--hl-bg2:#ebe3d1] [--hl-region:rgb(18_32_47/4.5%)] [--hl-line:rgb(18_32_47/14%)]", + "[--hl-sea:#3b8fae] [--hl-dim:#5f6a76] [--hl-ink:#12202f] [--hl-hull:#fbf7ee] [--hl-sail-l:#e5ddc8] [--hl-sail-r:#fbf7ee]", + "[--hl-ask:#e08a3c] [--hl-receive:#3b8fae] [--hl-reply:#2f7d5b] [--hl-brass:#c9a24d] [--hl-porthole:#12202f]", + // navy (dark) + "dark:[--hl-bg:#0a1c30] dark:[--hl-bg2:#102a47] dark:[--hl-region:rgb(223_233_238/5%)] dark:[--hl-line:rgb(223_233_238/14%)]", + "dark:[--hl-dim:rgb(223_233_238/60%)] dark:[--hl-ink:#dfe9ee] dark:[--hl-hull:#f4efe4] dark:[--hl-sail-l:#cfd9df] dark:[--hl-sail-r:#f4efe4]", + "dark:[--hl-reply:#6fcf9a]", +].join(" "); + +/** The tile's own background: paper or navy with a soft radial lift at the top right. */ +export const HIGHLIGHT_ART_BACKGROUND_STYLE: CSSProperties = { + backgroundColor: "var(--hl-bg)", + backgroundImage: "radial-gradient(120% 90% at 80% 20%, var(--hl-bg2) 0%, transparent 60%)", +}; + +const HIGHLIGHT_BOAT_ID = "j5-highlight-boat"; +const HIGHLIGHT_CAPTAIN_ID = "j5-highlight-captain"; + +/** + * Render once per document (the highlights popover is enough). Every tile's + * points at these ids. + */ +export function HighlightArtSprite() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} + +type Pennant = "ask" | "receive" | "reply" | "brass"; + +function pennantStyle(pennant: Pennant): CSSProperties { + const colour = `var(--hl-${pennant})`; + return { "--hl-pennant": colour, "--hl-pennant-fill": colour } as CSSProperties; +} + +/** One boat, 64 x 52 user units at scale 1, with its deck at y 30 and pennant at y 0. */ +export function Boat({ + x, + y, + scale = 1, + pennant = "reply", + captain = false, +}: { + x: number; + y: number; + scale?: number; + pennant?: Pennant; + captain?: boolean; +}) { + return ( + + + + ); +} + +/** A wave line from x0 to x1 at height y, in the sea colour. */ +export function Water({ + x0, + x1, + y, + faint = false, +}: { + x0: number; + x1: number; + y: number; + faint?: boolean; +}) { + const step = 10; + let d = `M${x0} ${y} Q ${x0 + step} ${y - 5} ${x0 + 2 * step} ${y}`; + for (let x = x0 + 4 * step; x <= x1; x += 2 * step) d += ` T ${x} ${y}`; + return ( + + ); +} + +/** A dashed message route between two points, arched through a control point. */ +export function Route({ d }: { d: string }) { + return ( + + ); +} + +/** A message in flight. */ +export function Message({ + x, + y, + kind, +}: { + x: number; + y: number; + kind: "ask" | "receive" | "reply"; +}) { + return ; +} + +/** A device: the rounded region a boat sits in on the peering page. */ +export function Device({ + x, + y, + width, + height, +}: { + x: number; + y: number; + width: number; + height: number; +}) { + return ( + + ); +} + +/** + * The art column of a highlight entry: 150 x 124 CSS px in the 384px popover. + * The container owns the background; the scene is centred inside it and keeps + * its aspect, so a taller entry shows more background rather than a stretched scene. + */ +export function HighlightArtTile({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} diff --git a/apps/web/src/j5/highlights/HighlightsList.tsx b/apps/web/src/j5/highlights/HighlightsList.tsx new file mode 100644 index 0000000000000..a9d35ed9a6a62 --- /dev/null +++ b/apps/web/src/j5/highlights/HighlightsList.tsx @@ -0,0 +1,123 @@ +import type { + Highlight, + HighlightArt as HighlightArtName, +} from "@t3tools/client-runtime/j5/highlights"; +import { ExternalLinkIcon, XIcon } from "lucide-react"; +import { Fragment } from "react"; + +import { APP_BASE_NAME, APP_VERSION } from "../../branding"; +import { Button } from "../../components/ui/button"; +import { toastManager } from "../../components/ui/toast"; +import { ensureLocalApi } from "../../localApi"; +import { + HIGHLIGHT_ART_BACKGROUND_STYLE, + HighlightArtSprite, + highlightArtThemeClassName, +} from "./HighlightArt"; +import { PeeringTile } from "./PeeringTile"; + +const ART: Record React.ReactNode> = { + peering: PeeringTile, +}; + +function openLearnMore(url: string) { + ensureLocalApi() + .shell.openExternal(url) + .catch(() => toastManager.add({ type: "error", title: "Unable to open the page" })); +} + +/** The 150-wide art column; only it carries the art palette, and its edge fades into the text. */ +function HighlightTile({ art }: { readonly art: HighlightArtName }) { + const Scene = ART[art]; + return ( +
+ +
+ ); +} + +function HighlightEntry({ + entry, + onDismiss, +}: { + readonly entry: Highlight; + readonly onDismiss: ((id: string) => void) | null; +}) { + return ( +
+
+

{entry.title}

+

{entry.description}

+ {entry.learnMoreUrl ? ( + + ) : null} +
+ {entry.art ? : null} + {onDismiss ? ( + + ) : null} +
+ ); +} + +/** + * The list in the highlights popover, newest first. "New in J5 Code" lists the unseen entries + * with a dismiss on each; "What's new" lists every entry and dismisses nothing. + */ +export function HighlightsList({ + title, + entries, + onDismiss, +}: { + readonly title: string; + readonly entries: ReadonlyArray; + readonly onDismiss: ((id: string) => void) | null; +}) { + return ( +
+
+

{title}

+ + {APP_BASE_NAME} {APP_VERSION} + +
+ +
+ {entries.length === 0 ? ( +

Nothing yet.

+ ) : ( + entries.map((entry, index) => ( + + {index > 0 ?
: null} + + + )) + )} +
+
+ ); +} diff --git a/apps/web/src/j5/highlights/PeeringTile.tsx b/apps/web/src/j5/highlights/PeeringTile.tsx new file mode 100644 index 0000000000000..391ea60457108 --- /dev/null +++ b/apps/web/src/j5/highlights/PeeringTile.tsx @@ -0,0 +1,33 @@ +import { Boat, Device, HighlightArtTile, Message, Route, Water } from "./HighlightArt"; + +/** + * The Peering highlight: two devices, an agent on each, an ask crossing the + * network and a reply coming back. Same subject as the peering page's first scene. + */ +export function PeeringTile() { + return ( + + + + {/* the network between them */} + + + + + + + + + + + + + ); +} diff --git a/apps/web/src/j5/highlights/SidebarHighlightsButton.tsx b/apps/web/src/j5/highlights/SidebarHighlightsButton.tsx new file mode 100644 index 0000000000000..5028d240129ea --- /dev/null +++ b/apps/web/src/j5/highlights/SidebarHighlightsButton.tsx @@ -0,0 +1,106 @@ +import { unseenHighlights } from "@t3tools/client-runtime/j5/highlights"; +import { GiftIcon } from "lucide-react"; +import { useEffect } from "react"; + +import { Popover, PopoverPopup, PopoverTrigger } from "../../components/ui/popover"; +import { SidebarMenuItem } from "../../components/ui/sidebar"; +import { Tooltip, TooltipPopup, TooltipTrigger } from "../../components/ui/tooltip"; +import { useClientSettings, useClientSettingsHydrationStatus } from "../../hooks/useSettings"; +import { isElectron } from "../../env"; +import { cn } from "../../lib/utils"; +import { closeHighlights, openHighlights, useHighlightsPopover } from "./highlightsPopover"; +import { HighlightsList } from "./HighlightsList"; +import { clientHighlights, dismissHighlight, useSeenHighlights } from "./seenHighlights"; + +// The row's icons, highlights and update button are 32px with 4px between; below this width the +// row cannot hold the button, so it hides until the palette opens it. Desktop has the update +// button too. +const HIDE_BELOW_CLASS_NAME = isElectron + ? "@max-[13.25rem]/utility:hidden" + : "@max-[11rem]/utility:hidden"; + +/** + * The highlights button in the sidebar's utility row (#624): shown while this client has unseen + * highlights, or while the palette's "What's new" has the list open. Opens on click only, since + * the update button beside it opens on hover. + */ +export function SidebarHighlightsButton() { + const seen = useSeenHighlights(); + const hydrated = useClientSettingsHydrationStatus() === "ready"; + const onboardingCompletedAt = useClientSettings((settings) => settings.onboardingCompletedAt); + const unseen = unseenHighlights({ + entries: clientHighlights, + seen, + firstRunComplete: hydrated && onboardingCompletedAt !== null, + }); + const popover = useHighlightsPopover(); + const showingNew = popover.open && popover.mode === "new"; + + // Dismissing the last unseen entry removes the button, and with it the list. + useEffect(() => { + if (showingNew && unseen.length === 0) closeHighlights(); + }, [showingNew, unseen.length]); + + if (unseen.length === 0 && !popover.open) return null; + + const label = unseen.length > 0 ? `What's new, ${unseen.length} new` : "What's new"; + + return ( + + { + if (open) openHighlights("new"); + else closeHighlights(); + }} + > + + + + {unseen.length > 0 ? ( + + {unseen.length} + + ) : null} + + } + /> + } + /> + {label} + + {popover.open ? ( + + {popover.mode === "new" ? ( + + ) : ( + + )} + + ) : null} + + + ); +} diff --git a/apps/web/src/j5/highlights/highlightsPalette.tsx b/apps/web/src/j5/highlights/highlightsPalette.tsx new file mode 100644 index 0000000000000..967432176b42c --- /dev/null +++ b/apps/web/src/j5/highlights/highlightsPalette.tsx @@ -0,0 +1,61 @@ +import { useLocation } from "@tanstack/react-router"; +import { GiftIcon } from "lucide-react"; +import { useEffect } from "react"; + +import { + ITEM_ICON_CLASS, + type CommandPaletteActionItem, +} from "../../components/CommandPalette.logic"; +import { + isSidebarUtilityPage, + useNavigateToMainApp, +} from "../../components/sidebar/mainAppLocation"; +import { useSidebar } from "../../components/ui/sidebar"; +import { openHighlights, useHighlightsPopover } from "./highlightsPopover"; + +const WHATS_NEW_ITEM: CommandPaletteActionItem = { + kind: "action", + value: "action:j5-whats-new", + searchTerms: ["what's new", "whats new", "highlights", "new features", "release", "changelog"], + title: "What's new", + icon: , + run: async () => openHighlights("all"), +}; + +/** The palette's "What's new": every highlight in the sidebar's popover, nothing to dismiss. */ +export function useHighlightsPaletteItems(): ReadonlyArray { + return [WHATS_NEW_ITEM]; +} + +/** + * The list opens from the sidebar's utility row, which a utility page replaces with Back and a + * collapsed sidebar hides. Mounted inside the sidebar provider, this leaves the page and opens + * the sidebar so the button is there to anchor it. + */ +export function HighlightsSidebarReveal() { + const popover = useHighlightsPopover(); + const onUtilityPage = useLocation({ + select: (location) => isSidebarUtilityPage(location.pathname), + }); + const navigateToMainApp = useNavigateToMainApp(); + const { isMobile, open, openMobile, setOpen, setOpenMobile } = useSidebar(); + const requested = popover.open && popover.mode === "all"; + + useEffect(() => { + if (!requested) return; + if (onUtilityPage) void navigateToMainApp(); + if (isMobile && !openMobile) setOpenMobile(true); + if (!isMobile && !open) setOpen(true); + }, [ + requested, + onUtilityPage, + navigateToMainApp, + isMobile, + open, + openMobile, + setOpen, + setOpenMobile, + ]); + + return null; +} diff --git a/apps/web/src/j5/highlights/highlightsPopover.ts b/apps/web/src/j5/highlights/highlightsPopover.ts new file mode 100644 index 0000000000000..dafe3e859f5b0 --- /dev/null +++ b/apps/web/src/j5/highlights/highlightsPopover.ts @@ -0,0 +1,36 @@ +import { useSyncExternalStore } from "react"; + +// Whether the highlights popover is open, and which list it shows: "new" is the unseen entries +// with a dismiss on each, opened from the sidebar button; "all" is every entry, opened from the +// palette's "What's new". The palette and the button are far apart in the tree, so they share +// this instead of React state. +export type HighlightsPopoverState = + | { readonly open: false } + | { readonly open: true; readonly mode: "new" | "all" }; + +const CLOSED: HighlightsPopoverState = { open: false }; + +let state: HighlightsPopoverState = CLOSED; +const listeners = new Set<() => void>(); + +function set(next: HighlightsPopoverState): void { + state = next; + for (const listener of listeners) listener(); +} + +function subscribe(listener: () => void): () => void { + listeners.add(listener); + return () => listeners.delete(listener); +} + +export function useHighlightsPopover(): HighlightsPopoverState { + return useSyncExternalStore( + subscribe, + () => state, + () => CLOSED, + ); +} + +export const openHighlights = (mode: "new" | "all") => set({ open: true, mode }); + +export const closeHighlights = () => set(CLOSED); diff --git a/apps/web/src/j5/highlights/seenHighlights.ts b/apps/web/src/j5/highlights/seenHighlights.ts new file mode 100644 index 0000000000000..407e8620c781f --- /dev/null +++ b/apps/web/src/j5/highlights/seenHighlights.ts @@ -0,0 +1,75 @@ +import { useMemo, useSyncExternalStore } from "react"; +import { + HIGHLIGHTS, + highlightsForClient, + withHighlightSeen, +} from "@t3tools/client-runtime/j5/highlights"; + +import { isElectron } from "../../env"; + +// The ids this client has seen, in its own storage: per browser origin, and per install on +// desktop (whose renderer has one fixed origin). A missing record means none written yet; +// unseenHighlights reads that as "show everything" once first run is finished. +const KEY = "j5:highlights:seen"; + +export const highlightClient = isElectron ? "desktop" : "web"; +export const clientHighlights = highlightsForClient(HIGHLIGHTS, highlightClient); + +const listeners = new Set<() => void>(); + +function readRaw(): string | null { + try { + return window.localStorage.getItem(KEY); + } catch { + return null; + } +} + +function parse(raw: string | null): ReadonlyArray | null { + if (raw === null) return null; + try { + const value: unknown = JSON.parse(raw); + return Array.isArray(value) && value.every((id) => typeof id === "string") ? value : null; + } catch { + return null; + } +} + +function write(ids: ReadonlyArray): void { + try { + window.localStorage.setItem(KEY, JSON.stringify(ids)); + } catch { + // Storage that cannot be written shows the entry again next time. + } + for (const listener of listeners) listener(); +} + +function subscribe(listener: () => void): () => void { + listeners.add(listener); + const onStorage = (event: StorageEvent) => { + if (event.key === KEY) listener(); + }; + window.addEventListener("storage", onStorage); + return () => { + listeners.delete(listener); + window.removeEventListener("storage", onStorage); + }; +} + +/** The seen record. Snapshots are the raw string, so an unchanged record never re-renders. */ +export function useSeenHighlights(): ReadonlyArray | null { + const raw = useSyncExternalStore(subscribe, readRaw, () => null); + return useMemo(() => parse(raw), [raw]); +} + +export function dismissHighlight(id: string): void { + write(withHighlightSeen(parse(readRaw()), id)); +} + +/** + * First run calls this before it marks itself finished, so a new client never meets the entries + * it shipped with as new. + */ +export function markAllHighlightsSeen(): void { + write(clientHighlights.map((entry) => entry.id)); +} diff --git a/apps/web/src/onboarding/firstRun.ts b/apps/web/src/onboarding/firstRun.ts index 4daafc7cc924c..e3299161f8653 100644 --- a/apps/web/src/onboarding/firstRun.ts +++ b/apps/web/src/onboarding/firstRun.ts @@ -1,6 +1,7 @@ import { useCallback } from "react"; import { ensureClientSettingsHydrated, persistClientSettingsUpdate } from "../hooks/useSettings"; +import { markAllHighlightsSeen } from "../j5/highlights/seenHighlights"; /** * Marks first-run onboarding finished (or skipped) so FirstRunGate never @@ -10,6 +11,8 @@ import { ensureClientSettingsHydrated, persistClientSettingsUpdate } from "../ho export function useCompleteOnboarding(): () => Promise { return useCallback(async () => { await ensureClientSettingsHydrated(); + // J5: a new client's highlights are recorded as seen before the flag that shows them. + markAllHighlightsSeen(); const onboardingCompletedAt = new Date().toISOString(); await persistClientSettingsUpdate((current) => ({ ...current, onboardingCompletedAt })); }, []); diff --git a/docs/j5/product/features/highlights.md b/docs/j5/product/features/highlights.md new file mode 100644 index 0000000000000..1e177bbde66aa --- /dev/null +++ b/docs/j5/product/features/highlights.md @@ -0,0 +1,35 @@ +--- +title: "Highlights" +kind: definition +--- + +# Highlights + +## Problem + +Nothing in a client says what changed after it updates. Release notes reach the person only before an update, only on desktop, and only as a list of changes. A substantial new feature goes unnoticed unless someone reads GitHub. + +## Definition + +A highlight is a short entry about one substantial feature: a title, a line or two, an optional "Learn more" page on the marketing site, an optional illustration, and the clients it shows on (web, desktop, mobile). It is committed with the feature's own pull request, and whether a feature deserves one is decided in that pull request's review. Release notes are unchanged. + +A client keeps its own record of the highlights it has seen. A browser keeps one per address, and the desktop app one per install. A highlight is new to a client until it is dismissed there, so updating several devices shows it on each. + +A client that has never finished first run shows nothing. Finishing first run marks every highlight the client ships with as seen, before it records that first run is done, so a new client starts with nothing new. A client that finished first run before highlights existed has no record, and sees every highlight once. + +A highlight follows the client's own build. The server it connects to may be older. + +Mobile shows no highlights yet. Entries already say which clients they are for, so mobile can have its own set. + +## Acceptance criteria + +1. While a client has unseen highlights, the sidebar's row of utility buttons has a button beside the update button with a count of them. It is gone otherwise. +2. The button opens a list on click, newest first, headed "New in J5 Code" with the client's version. Each entry can be dismissed on its own, which drops the count. Dismissing the last one removes the button. +3. The command palette's "What's new" opens the same list with every highlight and nothing to dismiss, from any page and with the sidebar collapsed. +4. "Learn more" opens the marketing page in the person's browser. +5. A new client never shows the highlights it shipped with. An existing client shows each new highlight once. +6. Where the sidebar is too narrow for the button, it is hidden until the palette opens the list. + +## History + +- 2026-10-17 — defined, designed and built; launched with Peering ([#624](https://github.com/Jacksondr5/j5code/issues/624)). diff --git a/docs/j5/product/overview.md b/docs/j5/product/overview.md index 5680b375b5a7d..7a6433c845782 100644 --- a/docs/j5/product/overview.md +++ b/docs/j5/product/overview.md @@ -27,6 +27,7 @@ These areas are J5's. Their definitions are the source of truth; build within th | Fleet page and sidebar roster | Measured status for every agent and Crew: the Fleet page and the sidebar's spawned-children expander. | [Fleet page](features/fleet-page.md) | | Shared server and cross-device | Several people on one server, as members or as guests with grants, and messages crossing between servers. Authority never replicates. | [Shared server](features/shared-server.md), [shared conversations](features/shared-conversations.md), [cross-device](cross-device.md) | | Skills | A skill catalog and links that make one skill available across providers. | user guide `docs/user/skills.md` | +| Highlights | A short "What's new" a client shows once after it updates to a build with a substantial new feature. | [Highlights](features/highlights.md) | ## Everything else is upstream's diff --git a/docs/j5/product/upstream.md b/docs/j5/product/upstream.md index cb7374e944c8c..046d9c95c29b0 100644 --- a/docs/j5/product/upstream.md +++ b/docs/j5/product/upstream.md @@ -422,6 +422,20 @@ A guest is brought in with one of upstream's own single-use pairing links, which **Decided:** Jackson, 2026-10-09 ([multi-player session](../worklog/2026-10-09-multi-player-session.md)) and 2026-10-11 ([#531](https://github.com/Jacksondr5/j5code/issues/531), [#532](https://github.com/Jacksondr5/j5code/issues/532): folder-keyed requests refused, a reduced configuration, the preview browser set aside). Per-thread levels in the client: Jackson, 2026-10-12 ([#532](https://github.com/Jacksondr5/j5code/issues/532)); reporting a View guest as lacking "Operate tasks" was dropped because it cannot express View on one thread and Collaborate on another. Recorded in FORK.md case 69. +### Clients + +#### D35. A client says what is new after it updates + +**Upstream:** a client tells the person about an update only before it installs: the desktop update button's release notes on the nightly track, and the "Update downloaded" toast's link to the GitHub release. After the update, nothing in any client says what changed. + +**J5:** a substantial new feature can ship a highlight, a short entry committed with the feature. A client that has a highlight its person hasn't seen shows a button with a count in the sidebar's row of utility buttons, beside the update button. The button opens the list, and each entry is dismissed on its own. The command palette's "What's new" reopens every entry. A new client marks the entries it ships with as seen when first run finishes, so it starts with nothing to show. See [Highlights](features/highlights.md). + +**Why:** headline features went unnoticed unless someone read GitHub, and the release notes upstream shows are a list of changes, not an introduction. + +**Consequences:** the button sits in upstream's sidebar row, the reopen command in upstream's palette, a helper that brings the sidebar back in upstream's sidebar layout, and the first-run mark in upstream's onboarding hook, which is the one place first run finishes (`FORK.md` case 75). What a client has seen is kept in its own storage, so a browser keeps one record per address. A client's highlights follow its own build, which can be newer than the server it is connected to. Upstream won't take this as a new feature, so it stays J5's. + +**Decided:** Jackson, 2026-10-17 ([#624](https://github.com/Jacksondr5/j5code/issues/624)). Recorded in FORK.md case 75. + ### Awaiting a decision These already diverge on `j5/main`, but no human ruling is on record. Each landed as an implementer's call inside a merged PR. The person rules on each one; an approved entry moves up into its section, and a rejected one becomes a fix. @@ -521,3 +535,4 @@ J5 kept a run from resuming after a usage-limit reset when the person had presse - 2026-10-13 — D33: a guest is not shown the Automations section or three Settings pages that could only fail for them (the build lead, under Jackson's 2026-10-13 standing permission; [#535](https://github.com/Jacksondr5/j5code/issues/535)). - 2026-10-13 — D33: the first-run gate and the sidebar's empty state approved, for a guest on every connected server only; the Settings pages left out for a guest follow the same rule (Jackson; [#535](https://github.com/Jacksondr5/j5code/issues/535)). - 2026-10-13 — D34 added: an agent's browser tab is private unless it names a profile (Jackson). +- 2026-10-17 — D35 added: a client says what is new after it updates (Jackson, [#624](https://github.com/Jacksondr5/j5code/issues/624)). diff --git a/packages/client-runtime/package.json b/packages/client-runtime/package.json index 9ce72be81a126..e2aa280016a18 100644 --- a/packages/client-runtime/package.json +++ b/packages/client-runtime/package.json @@ -387,6 +387,10 @@ "types": "./src/j5/sharing.ts", "default": "./src/j5/sharing.ts" }, + "./j5/highlights": { + "types": "./src/j5/highlights.ts", + "default": "./src/j5/highlights.ts" + }, "./thread-pull-request-compatibility": { "types": "./src/threadPullRequestCompatibility.ts", "default": "./src/threadPullRequestCompatibility.ts" diff --git a/packages/client-runtime/src/j5/highlights.test.ts b/packages/client-runtime/src/j5/highlights.test.ts new file mode 100644 index 0000000000000..aae6194c47113 --- /dev/null +++ b/packages/client-runtime/src/j5/highlights.test.ts @@ -0,0 +1,77 @@ +import { describe, expect, it } from "vite-plus/test"; + +import { + HIGHLIGHTS, + highlightsForClient, + unseenHighlights, + withHighlightSeen, + type Highlight, +} from "./highlights.ts"; + +const entry = (id: string, clients: Highlight["clients"] = ["web", "desktop"]): Highlight => ({ + id, + title: id, + description: id, + clients, +}); + +const entries = [entry("c"), entry("b"), entry("a")]; + +describe("unseenHighlights", () => { + it("shows nothing while first run is unfinished", () => { + expect(unseenHighlights({ entries, seen: null, firstRunComplete: false })).toEqual([]); + expect(unseenHighlights({ entries, seen: [], firstRunComplete: false })).toEqual([]); + }); + + it("shows every entry to a finished client with no record", () => { + expect(unseenHighlights({ entries, seen: null, firstRunComplete: true })).toEqual(entries); + }); + + it("shows only entries missing from the record, newest first", () => { + expect( + unseenHighlights({ entries, seen: ["b"], firstRunComplete: true }).map((e) => e.id), + ).toEqual(["c", "a"]); + }); + + it("shows nothing to a new client whose first run recorded every entry", () => { + const seen = entries.map((e) => e.id); + expect(unseenHighlights({ entries, seen, firstRunComplete: true })).toEqual([]); + }); + + it("shows an entry added after first run", () => { + const seen = entries.map((e) => e.id); + const next = [entry("d"), ...entries]; + expect( + unseenHighlights({ entries: next, seen, firstRunComplete: true }).map((e) => e.id), + ).toEqual(["d"]); + }); +}); + +describe("withHighlightSeen", () => { + it("dismissing from no record keeps the others unseen", () => { + const seen = withHighlightSeen(null, "b"); + expect(unseenHighlights({ entries, seen, firstRunComplete: true }).map((e) => e.id)).toEqual([ + "c", + "a", + ]); + }); + + it("does not repeat an id", () => { + expect(withHighlightSeen(["a"], "a")).toEqual(["a"]); + }); +}); + +describe("highlightsForClient", () => { + it("keeps entries meant for the client", () => { + const mixed = [entry("w", ["web"]), entry("m", ["mobile"]), entry("d", ["desktop", "web"])]; + expect(highlightsForClient(mixed, "desktop").map((e) => e.id)).toEqual(["d"]); + expect(highlightsForClient(mixed, "mobile").map((e) => e.id)).toEqual(["m"]); + }); +}); + +describe("HIGHLIGHTS", () => { + it("has unique ids", () => { + const ids = HIGHLIGHTS.map((e) => e.id); + expect(new Set(ids).size).toBe(ids.length); + }); +}); diff --git a/packages/client-runtime/src/j5/highlights.ts b/packages/client-runtime/src/j5/highlights.ts new file mode 100644 index 0000000000000..f82746241ffd6 --- /dev/null +++ b/packages/client-runtime/src/j5/highlights.ts @@ -0,0 +1,66 @@ +/** + * Highlights: the short "What's new" entries a client shows once after it has a build with a + * substantial new feature (#624). An entry is committed with its feature's PR; whether a feature + * deserves one is decided in that PR's review. Seen-tracking is per client, so this module is pure: + * each client passes in what it has stored. + */ + +export type HighlightClient = "web" | "desktop" | "mobile"; + +/** Names an illustration each client draws for itself; an entry without one is a plain text row. */ +export type HighlightArt = "peering"; + +export interface Highlight { + /** Stable for the life of the entry: the seen record stores it. */ + readonly id: string; + readonly title: string; + /** One or two lines. */ + readonly description: string; + /** A page on the marketing site, live before the build that links to it ships. */ + readonly learnMoreUrl?: string; + readonly art?: HighlightArt; + readonly clients: ReadonlyArray; +} + +/** Newest first. Add an entry at the top. */ +export const HIGHLIGHTS: ReadonlyArray = [ + { + id: "2026-10-peering", + title: "Agents across your machines", + description: + "Peer J5 on more than one machine, and agents on each can message the others as easily as the one next to them.", + learnMoreUrl: "https://j5.codes/peering", + art: "peering", + clients: ["web", "desktop"], + }, +]; + +export const highlightsForClient = ( + entries: ReadonlyArray, + client: HighlightClient, +): ReadonlyArray => entries.filter((entry) => entry.clients.includes(client)); + +/** + * What the client shows as new. First run writes a record of every entry as seen before it marks + * itself finished, so a finished client with no record is an existing one meeting highlights for + * the first time, and sees everything. An unfinished first run shows nothing. + */ +export function unseenHighlights(input: { + readonly entries: ReadonlyArray; + readonly seen: ReadonlyArray | null; + readonly firstRunComplete: boolean; +}): ReadonlyArray { + if (!input.firstRunComplete) return []; + if (input.seen === null) return input.entries; + const seen = new Set(input.seen); + return input.entries.filter((entry) => !seen.has(entry.id)); +} + +/** + * The record after dismissing one entry. A client with no record yet starts from nothing, since + * it was showing every entry. + */ +export const withHighlightSeen = ( + seen: ReadonlyArray | null, + id: string, +): ReadonlyArray => (seen === null ? [id] : seen.includes(id) ? seen : [...seen, id]);