:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(desktop): show a run's artifacts in the thread and point at the panel (#83157)
Adam Leithbb4e9e31bd97
diff --git a/products/desktop/apps/code/.storybook/mocks/renderer-storage.ts b/products/desktop/apps/code/.storybook/mocks/renderer-storage.tsnew file mode 100644index 000000000000..3c388fe69523--- /dev/null+++ b/products/desktop/apps/code/.storybook/mocks/renderer-storage.ts@@ -0,0 +1,23 @@+import { registerRendererStateStorage } from "@posthog/ui/shell/rendererStorage";++/**+ * Persistence for stories. The desktop host registers this seam at boot and+ * apps/web registers localStorage; nothing registers it here, so a persisted+ * store's first read never settles and anything gated on rehydration (a+ * teaching tip that must not flash before it knows it was retired) stays+ * invisible in Storybook.+ *+ * In-memory rather than localStorage, so a story never inherits what an earlier+ * story wrote.+ */+const values = new Map<string, string>();++registerRendererStateStorage({+ getItem: (name) => values.get(name) ?? null,+ setItem: (name, value) => {+ values.set(name, value);+ },+ removeItem: (name) => {+ values.delete(name);+ },+});diff --git a/products/desktop/apps/code/.storybook/preview.tsx b/products/desktop/apps/code/.storybook/preview.tsxindex 22780d47201c..aca1d6470b82 100644--- a/products/desktop/apps/code/.storybook/preview.tsx+++ b/products/desktop/apps/code/.storybook/preview.tsx@@ -1,4 +1,5 @@import "./mocks/electron-trpc";+import "./mocks/renderer-storage";import { Theme } from "@radix-ui/themes";import "@radix-ui/themes/styles.css";import type { Preview } from "@storybook/react-vite";@@ -39,6 +40,11 @@ const preview: Preview = {withAppProviders,(Story, context) => {const isDark = context.globals.theme !== "light";+ // The app's themeStore puts this on the document, and quill's tokens hang+ // off it. Anything portaled out of the story root (a popover, a dropdown)+ // reads the document rather than the Theme below it, so without this a+ // dark story opens a light popup.+ document.documentElement.classList.toggle("dark", isDark);// Mirror the app's ThemeWrapper (packages/ui/src/primitives/ThemeWrapper.tsx)// so stories render with the shipped radius and accent colors.return (diff --git a/products/desktop/apps/code/.storybook/withAppProviders.tsx b/products/desktop/apps/code/.storybook/withAppProviders.tsxindex 2f1d65fac9fe..74f8879f853a 100644--- a/products/desktop/apps/code/.storybook/withAppProviders.tsx+++ b/products/desktop/apps/code/.storybook/withAppProviders.tsx@@ -7,12 +7,14 @@ import {} from "@posthog/host-router/client";import { HostTRPCProvider } from "@posthog/host-router/react";import type { HostRouter } from "@posthog/host-router/router";+import { ToastProvider } from "@posthog/quill";import {FEATURE_FLAGS,type FeatureFlags,} from "@posthog/ui/features/feature-flags/identifiers";import { DIFF_WORKER_FACTORY } from "@posthog/ui/shell/diffWorkerHost";import { IMPERATIVE_QUERY_CLIENT } from "@posthog/ui/shell/queryClient";+import { registerRendererStateStorage } from "@posthog/ui/shell/rendererStorage";import type { Decorator } from "@storybook/react-vite";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import {@@ -161,6 +163,20 @@ function createProviderStack(): ProviderStack {return { queryClient, hostTrpcClient, container };}+// Persisted stores wait for a host persistence backend before they hydrate, and+// anything gated on hydration (teaching tips) stays hidden until one arrives.+// Per-session and empty, so a story never inherits another story's answers.+const storyState = new Map<string, string>();+registerRendererStateStorage({+ getItem: (name) => storyState.get(name) ?? null,+ setItem: (name, value) => {+ storyState.set(name, value);+ },+ removeItem: (name) => {+ storyState.delete(name);+ },+});+export const withAppProviders: Decorator = (Story) => {// The provider singletons don't depend on the story; build them once per// mount. Lazy ref rather than useMemo: setRootContainer mutates a global, and@@ -187,7 +203,9 @@ export const withAppProviders: Decorator = (Story) => {<QueryClientProvider client={queryClient}><HostTRPCProvider trpcClient={hostTrpcClient} queryClient={queryClient}><ServiceProvider container={container}>- <RouterProvider router={router} />+ <ToastProvider>+ <RouterProvider router={router} />+ </ToastProvider></ServiceProvider></HostTRPCProvider></QueryClientProvider>diff --git a/products/desktop/packages/ui/package.json b/products/desktop/packages/ui/package.jsonindex 0f4a0397348c..d1acb1a39106 100644--- a/products/desktop/packages/ui/package.json+++ b/products/desktop/packages/ui/package.json@@ -60,7 +60,7 @@"@posthog/git": "workspace:*","@posthog/host-router": "workspace:*","@posthog/platform": "workspace:*",- "@posthog/quill-charts": "0.3.0-beta.19",+ "@posthog/quill-charts": "0.3.0-beta.28","@posthog/shared": "workspace:*","@posthog/workspace-client": "workspace:*","@radix-ui/react-collapsible": "^1.1.12",diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsxindex e3da827a9134..e38705ea8b1a 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx@@ -399,6 +399,7 @@ export function ActivityTimeline({<ArtifactEventDetailpayload={row.event.payload}onOpen={openArtifact(row.event.payload)}+ taskId={canOpenInPlace ? task.id : undefined}/>) : undefined}diff --git a/products/desktop/packages/ui/src/features/canvas/components/TaskArtifactsList.tsx b/products/desktop/packages/ui/src/features/canvas/components/TaskArtifactsList.tsxindex 2b17dbabaa99..f72dc50ece1f 100644--- a/products/desktop/packages/ui/src/features/canvas/components/TaskArtifactsList.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/TaskArtifactsList.tsx@@ -49,10 +49,14 @@ import { useCompletedArtifactUploads } from "@posthog/ui/features/sessions/compoimport { useCommentsForTargetsQuery } from "@posthog/ui/features/sessions/components/useComments";import { useSessionSelector } from "@posthog/ui/features/sessions/sessionStore";import { useArtifactDownload } from "@posthog/ui/features/sessions/useArtifactDownload";+import {+ ArtifactCard,+ stopCardOpen,+} from "@posthog/ui/primitives/ArtifactCard";import { FileIcon } from "@posthog/ui/primitives/FileIcon";import { openExternalUrl } from "@posthog/ui/shell/openExternal";import { formatFileSize } from "@posthog/ui/utils/formatFileSize";-import { type MouseEvent, type ReactNode, useMemo, useState } from "react";+import { useMemo, useState } from "react";const EMPTY_COMMENTS: ResourceComment[] = [];@@ -71,81 +75,6 @@ function CommentCountBadge({ count }: { count: number }) {);}-/**- * One artifact card. The whole card is the open control - a `role="button"`- * div rather than a `<button>`, because the version picker and the trailing- * actions are real buttons and HTML forbids nesting those (see NestedButton- * for the same call). Inner controls stop propagation so they don't open it.- */-function ArtifactCard({- icon,- title,- meta,- onOpen,- onHoverStart,- actions,-}: {- icon: ReactNode;- title: string;- meta?: ReactNode;- onOpen?: () => void;- onHoverStart?: () => void;- /** Always-visible trailing cluster: comment badge, download, open externally. */- actions?: ReactNode;-}) {- return (- // biome-ignore lint/a11y/useSemanticElements: nested real buttons forbid a <button> card- <div- data-artifact-card- role="button"- tabIndex={onOpen ? 0 : undefined}- aria-disabled={onOpen ? undefined : true}- aria-label={`View ${title}`}- className={`flex w-full items-center gap-2.5 rounded-lg border border-border bg-muted py-2 pr-1.5 pl-2 text-[13px] transition-colors ${- onOpen ? "cursor-pointer hover:border-gray-6 hover:bg-gray-3" : ""- }`}- onClick={onOpen}- onKeyDown={(event) => {- // Only the card itself: inner controls' key presses bubble up here.- if (event.target !== event.currentTarget) return;- if (onOpen && (event.key === "Enter" || event.key === " ")) {- event.preventDefault();- onOpen();- }- }}- onPointerEnter={onHoverStart}- onFocus={onHoverStart}- >- <div className="relative flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-md bg-gray-4">- {/* The icon again, blown up and blurred: the tile tints itself with- the icon's own colors, so new icons never need a color mapping. */}- <div- aria-hidden- className="absolute inset-0 flex scale-[2.4] items-center justify-center opacity-40 blur-[9px] saturate-[1.8] dark:opacity-70"- >- {icon}- </div>- <div className="relative flex items-center justify-center">{icon}</div>- </div>- <div className="min-w-0 flex-1">- <div className="truncate font-medium">{title}</div>- {meta && (- <div className="flex items-center gap-1 whitespace-nowrap text-[12px] text-muted-foreground">- {meta}- </div>- )}- </div>- {actions && (- <div className="flex shrink-0 items-center gap-1">{actions}</div>- )}- </div>- );-}--function stopCardOpen(event: MouseEvent) {- event.stopPropagation();-}-function PrRow({url,ts,diff --git a/products/desktop/packages/ui/src/features/canvas/components/activityRows.tsx b/products/desktop/packages/ui/src/features/canvas/components/activityRows.tsxindex 91d21da0a559..9d04001d22da 100644--- a/products/desktop/packages/ui/src/features/canvas/components/activityRows.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/activityRows.tsx@@ -49,6 +49,8 @@ import { userDisplayName } from "@posthog/ui/features/canvas/utils/userDisplay";import { useCommitChangedFiles } from "@posthog/ui/features/git-interaction/useGitQueries";import { ChatMarkdown } from "@posthog/ui/features/sessions/components/chat-thread/ChatMarkdown";import { useCommentsQuery } from "@posthog/ui/features/sessions/components/useComments";+import { useArtifactDownload } from "@posthog/ui/features/sessions/useArtifactDownload";+import { ArtifactChip } from "@posthog/ui/primitives/ArtifactChip";import { openExternalUrl } from "@posthog/ui/shell/openExternal";import { parseHttpsUrl } from "@posthog/ui/utils/posthogLinks";import { type ReactNode, useMemo, useState } from "react";@@ -469,7 +471,12 @@ export function MessageBubble({ content }: { content: string }) {);}-/** No radius, so the left edge reads as a rule rather than the outline of a box. */+/**+ * The same surface an artifact chip wears in the transcript+ * (`ArtifactChip`), so a file named in a message and a file named in the+ * activity feed read as one thing. Only the padding differs: this is block+ * copy, not a run of inline text.+ */export function DetailBlock({children,className,@@ -480,7 +487,7 @@ export function DetailBlock({return (<divclassName={cn(- "break-words border-gray-6 border-l-2 bg-gray-2 px-2.5 py-1.5 text-[12.5px]",+ "break-words rounded-md border border-border bg-muted px-2.5 py-1.5 text-[12.5px]",className,)}>@@ -489,34 +496,45 @@ export function DetailBlock({);}-/** Clickable when the artifact can open in the panel's artifact tab. */+/**+ * The same chip a message names a file with, so the file reads the same on a+ * row as it does mid-sentence. Openable and downloadable only where the task's+ * own view is mounted to open it in.+ */export function ArtifactEventDetail({payload,+ taskId,onOpen,}: {payload: ArtifactPayload;+ /** The task to fetch the file from, set only where the row can act at all. */+ taskId?: string;onOpen?: () => void;}) {- const body = (- <>- {payload.name}- <span className="text-muted-foreground"> · v{payload.version}</span>- </>- );- if (!onOpen) {- return <DetailBlock>{body}</DetailBlock>;- }+ const { download, downloadingId } = useArtifactDownload();+ const runId = payload.runId;+ const canDownload = Boolean(taskId && runId && payload.artifactId);+return (- <button- type="button"- onClick={onOpen}- className="block w-full cursor-pointer text-left"- aria-label={`Open ${payload.name}`}- >- <DetailBlock className="transition-colors hover:border-gray-7 hover:bg-gray-3">- {body}- </DetailBlock>- </button>+ <ArtifactChip+ label={payload.name}+ name={payload.name}+ meta={`v${payload.version}`}+ onOpen={onOpen}+ onDownload={+ canDownload && taskId && runId+ ? () => {+ void download({+ taskId,+ runId,+ artifactId: payload.artifactId,+ name: payload.name,+ });+ }+ : undefined+ }+ downloading={downloadingId === payload.artifactId}+ />);}diff --git a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.stories.tsx b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.stories.tsxindex f46c38085122..463f8c71a054 100644--- a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.stories.tsx+++ b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.stories.tsx@@ -1,10 +1,10 @@-import { ArtifactChipShell } from "@posthog/ui/features/editor/components/ArtifactRefChip";+import { ArtifactChip } from "@posthog/ui/primitives/ArtifactChip";import type { Meta, StoryObj } from "@storybook/react-vite";const meta = {title: "Editor/ArtifactRefChip",- component: ArtifactChipShell,-} satisfies Meta<typeof ArtifactChipShell>;+ component: ArtifactChip,+} satisfies Meta<typeof ArtifactChip>;export default meta;type Story = StoryObj<typeof meta>;@@ -14,10 +14,10 @@ export const InAMessage: Story = {render: () => (<p className="max-w-lg text-[13px] leading-[1.9]">I've put the findings in{" "}- <ArtifactChipShell+ <ArtifactChiplabel="report.md"name="report.md"- sizeLabel="12 KB"+ meta="12 KB"onOpen={() => {}}onDownload={() => {}}/>{" "}@@ -29,29 +29,47 @@ export const InAMessage: Story = {export const States: Story = {render: () => (<div className="flex max-w-lg flex-col items-start gap-3 text-[13px]">- <ArtifactChipShell+ <ArtifactChiplabel="report.md"name="report.md"- sizeLabel="12 KB"+ meta="12 KB"onOpen={() => {}}onDownload={() => {}}/>- <ArtifactChipShell+ <ArtifactChiplabel="quarterly-revenue-breakdown-by-region-and-plan.csv"name="quarterly-revenue-breakdown-by-region-and-plan.csv"- sizeLabel="1.4 MB"+ meta="1.4 MB"onOpen={() => {}}onDownload={() => {}}/>- <ArtifactChipShell+ <ArtifactChiplabel="report.md"name="report.md"- sizeLabel="12 KB"+ meta="12 KB"onOpen={() => {}}onDownload={() => {}}downloading/>- <ArtifactChipShell label="report.md" name="report.md" disabled />+ <ArtifactChip label="report.md" name="report.md" disabled />+ </div>+ ),+};++/**+ * A long name in a narrow column, the way an activity row reads in the side+ * panel. The name truncates so the download half stays in reach.+ */+export const NarrowContainer: Story = {+ render: () => (+ <div className="flex w-56 flex-col items-start gap-3 border border-dashed p-2 text-[13px]">+ <ArtifactChip+ label="quarterly-revenue-breakdown-by-region-2026-08.csv"+ name="quarterly-revenue-breakdown-by-region-2026-08.csv"+ meta="2.4 MB"+ onOpen={() => {}}+ onDownload={() => {}}+ /></div>),};diff --git a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.test.tsx b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.test.tsxindex c8a24d42dffd..4eec3a0c0555 100644--- a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.test.tsx+++ b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.test.tsx@@ -110,9 +110,11 @@ describe.each(SURFACES)("artifact links in messages (%s)", (_name, Surface) => {renderMessage(`Here it is: [report.md](${LEGACY_LINK})`);expect(screen.queryByRole("link")).toBeNull();+ // quill keeps a disabled button focusable, so `aria-disabled` is where it+ // says so rather than the native attribute.expect(await screen.findByRole("button", { name: "Open report.md" }),- ).toBeDisabled();+ ).toHaveAttribute("aria-disabled", "true");});it.each([diff --git a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.tsx b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.tsxindex 686a04d33666..c00cad0bd64c 100644--- a/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.tsx+++ b/products/desktop/packages/ui/src/features/editor/components/ArtifactRefChip.tsx@@ -1,10 +1,8 @@-import { DownloadSimpleIcon } from "@phosphor-icons/react";import { usePanelLayoutStore } from "@posthog/ui/features/panels/panelLayoutStore";import { useArtifactDownload } from "@posthog/ui/features/sessions/useArtifactDownload";import { useRunArtifacts } from "@posthog/ui/features/sessions/useRunArtifacts";import { useSessionTaskId } from "@posthog/ui/features/sessions/useSessionTaskId";-import { FileIcon } from "@posthog/ui/primitives/FileIcon";-import { Tooltip } from "@posthog/ui/primitives/Tooltip";+import { ArtifactChip } from "@posthog/ui/primitives/ArtifactChip";import type { ArtifactLinkTarget } from "@posthog/ui/utils/artifactLinks";import { findArtifactForLink } from "@posthog/ui/utils/artifactLinks";import { formatFileSize } from "@posthog/ui/utils/formatFileSize";@@ -66,7 +64,7 @@ export function ArtifactRefChip({// Resolving: hold the chip's shape so the line doesn't reflow once the// manifest lands, but keep it inert until there is something to open.if (isLoading || (isFetching && !artifact)) {- return <ArtifactChipShell label={label} name={displayName} disabled />;+ return <ArtifactChip label={label} name={displayName} disabled />;}const artifactId = artifact?.id;if (!artifactId) return <>{fallback}</>;@@ -75,10 +73,10 @@ export function ArtifactRefChip({const sizeLabel = formatFileSize(artifact.size);return (- <ArtifactChipShell+ <ArtifactChiplabel={label}name={name}- sizeLabel={sizeLabel}+ meta={sizeLabel}onOpen={() =>openArtifactTab(target.taskId, {runId: target.runId,@@ -98,55 +96,3 @@ export function ArtifactRefChip({/>);}--/** Presentation only, exported for stories. */-export function ArtifactChipShell({- label,- name,- sizeLabel,- onOpen,- onDownload,- downloading,- disabled,-}: {- label: ReactNode;- name?: string;- sizeLabel?: string | null;- onOpen?: () => void;- onDownload?: () => void;- downloading?: boolean;- disabled?: boolean;-}) {- return (- // A span, not a button: this renders inside a paragraph, so the two halves- // have to be siblings rather than a button nested in a button.- <span className="mx-0.5 inline-flex max-w-full cursor-default items-stretch overflow-hidden rounded-md border border-border bg-muted align-middle text-[0.95em] leading-normal">- <button- type="button"- onClick={onOpen}- disabled={disabled || !onOpen}- aria-label={name ? `Open ${name}` : undefined}- className="flex min-w-0 items-center gap-1 px-1.5 py-0.5 text-left transition-colors enabled:cursor-pointer enabled:hover:bg-gray-3"- >- {typeof name === "string" && <FileIcon filename={name} size={12} />}- <span className="min-w-0 truncate">{label}</span>- {sizeLabel && (- <span className="shrink-0 text-muted-foreground">{sizeLabel}</span>- )}- </button>- {onDownload && (- <Tooltip content={downloading ? "Downloading…" : "Download"}>- <button- type="button"- onClick={onDownload}- disabled={downloading}- aria-label={name ? `Download ${name}` : "Download"}- className="flex shrink-0 items-center self-stretch border-border border-l px-1.5 text-muted-foreground transition-colors enabled:cursor-pointer enabled:hover:bg-gray-3 enabled:hover:text-foreground disabled:opacity-60"- >- <DownloadSimpleIcon size={12} />- </button>- </Tooltip>- )}- </span>- );-}diff --git a/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts b/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.tsindex 914160e7ea0d..99ff528bfe07 100644--- a/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts+++ b/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts@@ -24,13 +24,12 @@ import {formatHotkey,SHORTCUTS,} from "@posthog/ui/features/command/keyboard-shortcuts";-import {- PROMPT_RECALL_HINT_KEY,- type PromptRecallHandler,-} from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";+import type { PromptRecallHandler } from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";import { sessionStoreSetters } from "@posthog/ui/features/sessions/sessionStore";import { useSettingsStore as useFeatureSettingsStore } from "@posthog/ui/features/settings/settingsStore";-import { type ToastOptions, toast } from "@posthog/ui/primitives/toast";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";+import { hintToast } from "@posthog/ui/primitives/hintToast";+import { toast } from "@posthog/ui/primitives/toast";import { isSendMessageSubmitKey } from "@posthog/ui/utils/sendMessageKey";import type { Node as ProseMirrorNode } from "@tiptap/pm/model";import { TextSelection } from "@tiptap/pm/state";@@ -216,20 +215,9 @@ function hasVisibleSuggestionPopup(sessionId: string): boolean {);}-function showHintOnce(- key: string,- title: string,- detail: string | ToastOptions,-): void {- const store = useFeatureSettingsStore.getState();- if (!store.shouldShowHint(key)) return;- store.recordHintShown(key);- toast.info(title, detail);-}-function showMessageNavHint(): void {- showHintOnce(- PROMPT_RECALL_HINT_KEY,+ hintToast(+ TIP_KEYS.recallMessageNav,"Recalled a sent prompt",`Use ${formatHotkey(SHORTCUTS.MESSAGE_PREV)} and ${formatHotkey(SHORTCUTS.MESSAGE_NEXT)} to jump between your messages in the conversation.`,);@@ -237,14 +225,10 @@ function showMessageNavHint(): void {function showPasteHint(message: string, description: string): void {const key =- message === "Pasted as file attachment" ? "paste-as-file" : "paste-inline";- showHintOnce(key, message, {- description,- action: {- label: "Got it",- onClick: () => useFeatureSettingsStore.getState().markHintLearned(key),- },- });+ message === "Pasted as file attachment"+ ? TIP_KEYS.pasteAsFile+ : TIP_KEYS.pasteInline;+ hintToast(key, message, description);}export function useTiptapEditor(options: UseTiptapEditorOptions) {@@ -383,7 +367,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {if (!text?.trim()) return;useFeatureSettingsStore.getState()- .markHintLearned("paste-inline");+ .markHintLearned(TIP_KEYS.pasteInline);await pasteTextAsFile(view, text, pasteCountRef);} catch (_error) {toast.error("Failed to paste as file attachment");@@ -568,7 +552,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {if (lastConverted.kind === "file") {useFeatureSettingsStore.getState()- .markHintLearned("paste-as-file");+ .markHintLearned(TIP_KEYS.pasteAsFile);}return true;}@@ -577,7 +561,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {lastConverted.status = "canceled";useFeatureSettingsStore.getState()- .markHintLearned("paste-as-file");+ .markHintLearned(TIP_KEYS.pasteAsFile);view.dispatch(view.state.tr.insertText(lastConverted.insertText));return true;}diff --git a/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx b/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsxindex ab6a9951a043..88ab49f76506 100644--- a/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx+++ b/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx@@ -22,6 +22,11 @@ import { preloadReviewPages } from "@posthog/ui/features/code-review/components/import { useReviewNavigationStore } from "@posthog/ui/features/code-review/reviewNavigationStore";import { openRightPanelSide } from "@posthog/ui/features/navigation/rightPanelSide";import { useCommentFocusRequest } from "@posthog/ui/features/sessions/useCommentFocusRequest";+import {+ useSessionArtifactCount,+ useSessionIsWorking,+} from "@posthog/ui/features/sessions/useSessionArtifactCount";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";import { taskDetailQuery } from "@posthog/ui/features/tasks/queries";import { useTasks } from "@posthog/ui/features/tasks/useTasks";import { useIsCloudTask } from "@posthog/ui/features/workspace/useWorkspace";@@ -29,6 +34,7 @@ import {ResizableSidebar,SLIDE_MS,} from "@posthog/ui/primitives/ResizableSidebar";+import { TeachingTip } from "@posthog/ui/primitives/TeachingTip";import { useQuery } from "@tanstack/react-query";import { useParams } from "@tanstack/react-router";import { useCallback, useEffect, useState } from "react";@@ -36,6 +42,7 @@ import {DEFAULT_RIGHT_PANEL_SIDE,RIGHT_PANEL_MIN_WIDTH,type RightPanelSide,+ resolveArtifactMark,resolveRightPanelSide,useRightPanelStore,} from "../rightPanelStore";@@ -62,6 +69,9 @@ const SIDE_ORDER: readonly RightPanelSide[] = [*/export const SWITCHER_WIDTH_PX = 112;+/** The one lesson this switcher teaches: where a run's deliverables land. */+const ARTIFACTS_PANEL_TIP = TIP_KEYS.sessionArtifactsLocation;+/** The task the right panel talks about: the one on the current route. */function useRightPanelTask(taskId: string): Task | null {const { data: tasks } = useTasks();@@ -86,51 +96,144 @@ function useActiveSide(taskId: string): RightPanelSide | null {});}+/** One side's button: opens that panel, or closes it when it is the one open. */+function SideButton({+ side,+ active,+ taskId,+ marked = false,+}: {+ side: RightPanelSide;+ active: RightPanelSide | null;+ taskId: string;+ /** Something has arrived on this side that the panel hasn't shown yet. */+ marked?: boolean;+}) {+ const { label, Icon } = SIDES[side];+ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="default"+ size="icon-sm"+ aria-label={marked ? `${label} (new)` : label}+ data-selected={active === side || undefined}+ onClick={() =>+ openRightPanelSide(active === side ? null : side, taskId)+ }+ className="relative text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground"+ >+ <Icon size={16} />+ {marked && (+ // Ringed in the row's own background so the dot still reads+ // where it overlaps the icon's strokes.+ <span+ aria-hidden+ className="absolute top-0.5 right-0.5 size-1.5 rounded-full bg-primary ring-2 ring-background"+ />+ )}+ </Button>+ }+ />+ <TooltipContent side="bottom">{label}</TooltipContent>+ </Tooltip>+ );+}+/*** The panel's own switcher: one button per side, the active one toggling the* panel closed. It sits a row below the header band, pinned to the right edge,* and stays there whether the panel is open or closed, because the panel slides* out from under it.*/-function RightPanelButtons({+export function RightPanelButtons({active,taskId,+ hasNewArtifacts,+ offerArtifactsTip = false,+ artifactCount,}: {active: RightPanelSide | null;taskId: string;+ /** Artifacts have arrived that this session's panel hasn't shown yet. */+ hasNewArtifacts: boolean;+ /** The turn that produced them has ended, so the tip can point at where they went. */+ offerArtifactsTip?: boolean;+ /** How many the session has, so each new one is a fresh chance to teach. */+ artifactCount?: number;}) {return (<TooltipProvider delay={400}><div className="pointer-events-auto flex shrink-0 items-center gap-0.5">- {SIDE_ORDER.map((side) => {- const { label, Icon } = SIDES[side];- return (- <Tooltip key={side}>- <TooltipTrigger- render={- <Button- variant="default"- size="icon-sm"- aria-label={label}- data-selected={active === side || undefined}- onClick={() =>- openRightPanelSide(active === side ? null : side, taskId)- }- className="text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground"- >- <Icon size={16} />- </Button>- }+ {SIDE_ORDER.map((side) =>+ side === "artifacts" ? (+ <TeachingTip+ key={side}+ id={ARTIFACTS_PANEL_TIP}+ open={offerArtifactsTip}+ // The mark stays up until the panel is opened, so `open` can hold+ // across several runs. The count is what separates them, and it+ // is why asking for more artifacts offers the tip again.+ moment={artifactCount}+ message="New artifacts show up here"+ >+ <SideButton+ side={side}+ active={active}+ taskId={taskId}+ marked={hasNewArtifacts}/>- <TooltipContent side="bottom">{label}</TooltipContent>- </Tooltip>- );- })}+ </TeachingTip>+ ) : (+ <SideButton+ key={side}+ side={side}+ active={active}+ taskId={taskId}+ />+ ),+ )}</div></TooltipProvider>);}+/**+ * Whether a session has artifacts its panel hasn't shown yet. The first count a+ * session reports is taken as seen, so a session opened long after its run+ * doesn't announce work the reader already knows about; from there the mark+ * clears whenever the panel is on Artifacts.+ */+function useNewArtifacts(+ taskId: string,+ task: Task | null,+ active: RightPanelSide | null,+): { hasNew: boolean; count: number } {+ const count = useSessionArtifactCount(task);+ // The count covers the latest run only, so the baseline is keyed per run too.+ // A resume run replaces `latest_run` with a fresh, smaller manifest; a+ // per-task baseline would then hold the old run's higher total and swallow the+ // new run's first deliverables until they passed it.+ const seenKey = `${taskId}:${task?.latest_run?.id ?? ""}`;+ const seen = useRightPanelStore((s) => s.seenArtifactCountByKey[seenKey]);+ const markArtifactsSeen = useRightPanelStore((s) => s.markArtifactsSeen);+ const { markSeen, hasNew } = resolveArtifactMark({+ count,+ seen,+ isShowingArtifacts: active === "artifacts",+ // The count reads zero until the task resolves and a manifest source lands.+ // Not ready yet means don't take that zero as the seen baseline.+ ready: task !== null,+ });++ useEffect(() => {+ if (markSeen) markArtifactsSeen(seenKey, count);+ }, [count, markArtifactsSeen, markSeen, seenKey]);++ return { hasNew, count };+}+function ChangesPanelContent({ task }: { task: Task }) {return useIsCloudTask(task) ? (<CloudReviewPage task={task} />@@ -192,6 +295,14 @@ export function RightPanel() {function SessionRightPanel({ taskId }: { taskId: string }) {const task = useRightPanelTask(taskId);const active = useActiveSide(taskId);+ const { hasNew: hasNewArtifacts, count: artifactCount } = useNewArtifacts(+ taskId,+ task,+ active,+ );+ // Only once the agent has stopped: a tip that lands mid-turn points at a+ // list that is still filling.+ const isWorking = useSessionIsWorking(task);useCommentFocusRequest(taskId, () => openRightPanelSide("comments", taskId));const width = useRightPanelStore((s) => s.width);@@ -268,7 +379,13 @@ function SessionRightPanel({ taskId }: { taskId: string }) {className="pointer-events-none absolute top-0 right-0 z-60 flex h-[32px] items-center justify-end pr-2"style={{ width: SWITCHER_WIDTH_PX }}>- <RightPanelButtons active={active} taskId={taskId} />+ <RightPanelButtons+ active={active}+ taskId={taskId}+ hasNewArtifacts={hasNewArtifacts}+ offerArtifactsTip={hasNewArtifacts && !isWorking}+ artifactCount={artifactCount}+ /></div></>);diff --git a/products/desktop/packages/ui/src/features/navigation/components/RightPanelButtons.stories.tsx b/products/desktop/packages/ui/src/features/navigation/components/RightPanelButtons.stories.tsxnew file mode 100644index 000000000000..69221b684bce--- /dev/null+++ b/products/desktop/packages/ui/src/features/navigation/components/RightPanelButtons.stories.tsx@@ -0,0 +1,28 @@+import { RightPanelButtons } from "@posthog/ui/features/navigation/components/RightPanel";+import type { Meta, StoryObj } from "@storybook/react-vite";++const meta: Meta<typeof RightPanelButtons> = {+ title: "Navigation/RightPanelButtons",+ component: RightPanelButtons,+ parameters: { layout: "padded" },+ args: { taskId: "task-1", active: "timeline", hasNewArtifacts: false },+};++export default meta;+type Story = StoryObj<typeof RightPanelButtons>;++export const Resting: Story = {};++/** An artifact has landed since this session's panel last showed them. */+export const NewArtifacts: Story = {+ args: { hasNewArtifacts: true },+};++export const NewArtifactsWhileOnAnotherPanel: Story = {+ args: { hasNewArtifacts: true, active: "comments" },+};++/** What a reader sees the first time a run hands them a file. */+export const TeachingTheArtifactsPanel: Story = {+ args: { hasNewArtifacts: true, offerArtifactsTip: true },+};diff --git a/products/desktop/packages/ui/src/features/navigation/rightPanelStore.test.ts b/products/desktop/packages/ui/src/features/navigation/rightPanelStore.test.tsindex 3a8289cfdffa..17a3e00c9521 100644--- a/products/desktop/packages/ui/src/features/navigation/rightPanelStore.test.ts+++ b/products/desktop/packages/ui/src/features/navigation/rightPanelStore.test.ts@@ -1,5 +1,9 @@import { describe, expect, it } from "vitest";-import { type RightPanelSide, resolveRightPanelSide } from "./rightPanelStore";+import {+ type RightPanelSide,+ resolveArtifactMark,+ resolveRightPanelSide,+} from "./rightPanelStore";describe("resolveRightPanelSide", () => {it.each<{@@ -48,3 +52,73 @@ describe("resolveRightPanelSide", () => {expect(resolveRightPanelSide({ stored, isReviewOpen })).toBe(expected);});});++describe("resolveArtifactMark", () => {+ it.each<{+ name: string;+ count: number;+ seen: number | undefined;+ isShowingArtifacts: boolean;+ ready: boolean;+ markSeen: boolean;+ hasNew: boolean;+ }>([+ {+ name: "a session drawn for the first time takes what it has as seen",+ count: 3,+ seen: undefined,+ isShowingArtifacts: false,+ ready: true,+ markSeen: true,+ hasNew: false,+ },+ {+ name: "an artifact arriving after that marks the button",+ count: 4,+ seen: 3,+ isShowingArtifacts: false,+ ready: true,+ markSeen: false,+ hasNew: true,+ },+ {+ name: "an open artifacts panel keeps up with what arrives",+ count: 4,+ seen: 3,+ isShowingArtifacts: true,+ ready: true,+ markSeen: true,+ hasNew: false,+ },+ {+ name: "a dismissed file leaves nothing to announce",+ count: 2,+ seen: 3,+ isShowingArtifacts: false,+ ready: true,+ markSeen: false,+ hasNew: false,+ },+ {+ // The count reads zero before a manifest source loads; taking it as seen+ // would make the real files look new once they arrive.+ name: "a count still loading is not taken as seen",+ count: 0,+ seen: undefined,+ isShowingArtifacts: false,+ ready: false,+ markSeen: false,+ hasNew: false,+ },+ ])(+ "$name",+ ({ count, seen, isShowingArtifacts, ready, markSeen, hasNew }) => {+ expect(+ resolveArtifactMark({ count, seen, isShowingArtifacts, ready }),+ ).toEqual({+ markSeen,+ hasNew,+ });+ },+ );+});diff --git a/products/desktop/packages/ui/src/features/navigation/rightPanelStore.ts b/products/desktop/packages/ui/src/features/navigation/rightPanelStore.tsindex e2b028f7a556..55a72778cf91 100644--- a/products/desktop/packages/ui/src/features/navigation/rightPanelStore.ts+++ b/products/desktop/packages/ui/src/features/navigation/rightPanelStore.ts@@ -24,9 +24,18 @@ interface RightPanelStore {* default. Not persisted, because this is within-run memory.*/sideByKey: Record<string, RightPanelSide | null | undefined>;+ /**+ * How many artifacts a session had the last time its panel showed them, so+ * the switcher can mark the ones that arrived since. A missing entry is a+ * session nobody has drawn yet, which takes whatever it already has as seen:+ * opening an old session is not news. Not persisted, for the same reason+ * `sideByKey` isn't - this is within-run memory.+ */+ seenArtifactCountByKey: Record<string, number | undefined>;setWidth: (width: number) => void;setIsResizing: (isResizing: boolean) => void;setSideForKey: (key: string, side: RightPanelSide | null) => void;+ markArtifactsSeen: (key: string, count: number) => void;}/**@@ -54,17 +63,60 @@ export function resolveRightPanelSide({return DEFAULT_RIGHT_PANEL_SIDE;}+/**+ * What a session's switcher does with the artifact count it just read: whether+ * to take this count as seen, and whether to mark the button.+ *+ * A session nobody has drawn yet (`seen` undefined) takes its whole count as+ * seen, so opening a run that finished last week doesn't announce its files as+ * new. A panel already showing artifacts keeps up with them, so the mark can+ * never appear behind an open list.+ *+ * Until `ready`, the count has no manifest source behind it and reads as zero.+ * Taking that zero as seen would make the real files look new the moment they+ * load, so an unready count is neither taken as seen nor allowed to mark.+ */+export function resolveArtifactMark({+ count,+ seen,+ isShowingArtifacts,+ ready,+}: {+ count: number;+ seen: number | undefined;+ isShowingArtifacts: boolean;+ ready: boolean;+}): { markSeen: boolean; hasNew: boolean } {+ if (!ready) return { markSeen: false, hasNew: false };+ if (seen === undefined || isShowingArtifacts) {+ return { markSeen: true, hasNew: false };+ }+ return { markSeen: false, hasNew: count > seen };+}+export const useRightPanelStore = create<RightPanelStore>()(persist((set) => ({width: RIGHT_PANEL_DEFAULT_WIDTH,isResizing: false,sideByKey: {},+ seenArtifactCountByKey: {},setWidth: (width) =>set({ width: Math.max(RIGHT_PANEL_MIN_WIDTH, width) }),setIsResizing: (isResizing) => set({ isResizing }),setSideForKey: (key, side) =>set((state) => ({ sideByKey: { ...state.sideByKey, [key]: side } })),+ markArtifactsSeen: (key, count) =>+ set((state) =>+ state.seenArtifactCountByKey[key] === count+ ? state+ : {+ seenArtifactCountByKey: {+ ...state.seenArtifactCountByKey,+ [key]: count,+ },+ },+ ),}),{name: "right-panel",diff --git a/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.test.tsx b/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.test.tsxdeleted file mode 100644index 27c6616f1a5e..000000000000--- a/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.test.tsx+++ /dev/null@@ -1,548 +0,0 @@-import { Theme } from "@radix-ui/themes";-import { fireEvent, render, screen, waitFor } from "@testing-library/react";-import { beforeEach, describe, expect, it, vi } from "vitest";-import { CloudArtifactDownloads } from "./CloudArtifactDownloads";--const getCloudAttachmentPreviewUrl = vi.fn();-const setCloudRunArtifactsDismissed = vi.fn();-const openArtifactTab = vi.fn();-const refetch = vi.fn();-const queryOptions = vi.fn();-let fetchedArtifacts: unknown[] | undefined = [];-let session: {- cloudArtifacts?: unknown[];- cloudStatus?: string;- events?: unknown[];-} = {};--const UPLOAD_TOOL = "mcp__posthog-code-tools__upload_artifact";--function uploadEvent(update: Record<string, unknown>) {- return {- type: "acp_message",- ts: 0,- message: { jsonrpc: "2.0", method: "session/update", params: { update } },- };-}--vi.mock("@posthog/core/sessions/sessionService", () => ({- SESSION_SERVICE: Symbol("SESSION_SERVICE"),-}));--vi.mock("@posthog/di/react", () => ({- useService: () => ({- getCloudAttachmentPreviewUrl,- setCloudRunArtifactsDismissed,- }),-}));--vi.mock("@posthog/ui/features/sessions/sessionStore", () => ({- useSessionSelector: (_taskId: string, select: (s: unknown) => unknown) =>- select(session),-}));--vi.mock("@posthog/ui/features/auth/store", () => ({- getAuthIdentity: () => "auth-1",- useAuthStateValue: () => "auth-1",-}));--vi.mock("@posthog/ui/features/auth/useMeQuery", () => ({- useMeQuery: () => ({ data: { id: 42 } }),-}));--vi.mock("@tanstack/react-query", () => ({- useQuery: (options: unknown) => {- queryOptions(options);- return { data: fetchedArtifacts, refetch };- },- useMutation: ({- mutationFn,- onSuccess,- }: {- mutationFn: (variables: unknown) => Promise<unknown>;- onSuccess: (result: unknown) => Promise<void> | void;- }) => ({- isPending: false,- mutate: (variables: unknown) =>- void mutationFn(variables).then((result) => onSuccess(result)),- }),-}));--vi.mock("@posthog/ui/features/panels/panelLayoutStore", () => ({- usePanelLayoutStore: () => openArtifactTab,-}));--const task = {- id: "task-1",- latest_run: {- id: "run-1",- status: "completed",- },-} as never;--function renderDownloads() {- return render(- <Theme>- <CloudArtifactDownloads taskId="task-1" task={task} />- </Theme>,- );-}--// Rows render inside a popover, so every row assertion opens it first.-function openFiles() {- fireEvent.click(screen.getByRole("button", { name: /^Artifacts \(/ }));-}--describe("CloudArtifactDownloads", () => {- beforeEach(() => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.pdf",- type: "output",- size: 12_000,- storage_path: "tasks/run-1/report.pdf",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- {- id: "internal-1",- name: "handoff.pack",- type: "artifact",- storage_path: "tasks/run-1/handoff.pack",- },- ];- session = {};- refetch.mockReset();- refetch.mockResolvedValue({ data: undefined });- queryOptions.mockReset();- getCloudAttachmentPreviewUrl.mockReset();- setCloudRunArtifactsDismissed.mockReset();- openArtifactTab.mockReset();- vi.restoreAllMocks();- });-- it("shows output artifacts and opens their download URL", async () => {- getCloudAttachmentPreviewUrl.mockResolvedValue(- "https://files.example/report.pdf",- );- const fetchArtifact = vi- .spyOn(window, "fetch")- .mockResolvedValue(new Response("file contents"));- const createObjectURL = vi- .spyOn(URL, "createObjectURL")- .mockReturnValue("blob:artifact");- const revokeObjectURL = vi- .spyOn(URL, "revokeObjectURL")- .mockImplementation(() => undefined);- const click = vi- .spyOn(HTMLAnchorElement.prototype, "click")- .mockImplementation(() => undefined);-- renderDownloads();- openFiles();-- expect(screen.getByText("report.pdf")).toBeInTheDocument();- expect(screen.getByText(/12 KB/)).toBeInTheDocument();- expect(screen.queryByText("handoff.pack")).not.toBeInTheDocument();-- fireEvent.click(screen.getByLabelText("Download report.pdf"));-- await waitFor(() => expect(click).toHaveBeenCalledOnce());- expect(fetchArtifact).toHaveBeenCalledWith(- "https://files.example/report.pdf",- );- expect(createObjectURL).toHaveBeenCalledOnce();- expect(revokeObjectURL).toHaveBeenCalledWith("blob:artifact");- expect(getCloudAttachmentPreviewUrl).toHaveBeenCalledWith(- "task-1",- "run-1",- "output-1",- );- });-- it("disables every download while a shared request is in progress", async () => {- if (!fetchedArtifacts) throw new Error("artifact fixture must be loaded");- const artifacts = fetchedArtifacts;- artifacts.push({- id: "output-2",- name: "summary.txt",- type: "output",- size: 100,- storage_path: "tasks/run-1/summary.txt",- });- let finishPreviewRequest: (url: null) => void = () => undefined;- getCloudAttachmentPreviewUrl.mockReturnValue(- new Promise<null>((resolve) => {- finishPreviewRequest = resolve;- }),- );-- try {- render(- <Theme>- <CloudArtifactDownloads taskId="task-1" task={task} />- </Theme>,- );- openFiles();-- const downloadButtons = screen.getAllByRole("button", {- name: /^Download /,- });- fireEvent.click(downloadButtons[0]);-- await waitFor(() =>- expect(downloadButtons[1]).toHaveAttribute("aria-disabled", "true"),- );- finishPreviewRequest(null);- await waitFor(() =>- expect(downloadButtons[1]).toHaveAttribute("aria-disabled", "false"),- );- } finally {- artifacts.pop();- }- });-- it("labels versions edited by the current user", () => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.md",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- uploaded_by: "user",- uploaded_by_user_id: 42,- },- {- id: "output-2",- name: "report.md",- type: "output",- uploaded_at: "2026-07-27T09:00:00+00:00",- },- ];-- renderDownloads();- openFiles();-- fireEvent.click(screen.getByLabelText("Choose a version of report.md"));- expect(screen.getByText(/^v1 · You ·/)).toBeInTheDocument();- expect(screen.getByText(/^v2 · Agent ·/)).toBeInTheDocument();- });-- it("opens an artifact preview in a new tab", () => {- renderDownloads();- openFiles();-- fireEvent.click(screen.getByText("report.pdf"));-- expect(openArtifactTab).toHaveBeenCalledWith("task-1", {- runId: "run-1",- artifactId: "output-1",- name: "report.pdf",- });- });-- // A re-upload replaces the file rather than adding a second row for it.- it("opens the newest upload of a repeated name", () => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- {- id: "output-2",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T09:00:00+00:00",- },- ];-- renderDownloads();-- expect(- screen.getByRole("button", { name: "Artifacts (1)" }),- ).toBeInTheDocument();- openFiles();- expect(screen.getAllByText("report.pdf")).toHaveLength(1);-- fireEvent.click(screen.getByText("report.pdf"));-- expect(openArtifactTab).toHaveBeenCalledWith("task-1", {- runId: "run-1",- artifactId: "output-2",- name: "report.pdf",- });- });-- it("defaults to the newest undismissed version", () => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.pdf",- type: "output",- size: 1_000,- uploaded_at: "2026-07-27T08:00:00+00:00",- },- {- id: "output-2",- name: "report.pdf",- type: "output",- size: 2_000,- uploaded_at: "2026-07-27T09:00:00+00:00",- dismissed_at: "2026-07-27T10:00:00+00:00",- },- ];-- renderDownloads();- openFiles();-- expect(screen.getByText(/1 KB$/)).toBeInTheDocument();- fireEvent.click(screen.getByText("report.pdf"));- expect(openArtifactTab).toHaveBeenCalledWith("task-1", {- runId: "run-1",- artifactId: "output-1",- name: "report.pdf",- });- });-- // A manifest entry carries an id only once the upload is finalized, and a- // version the picker cannot switch to is worse than no picker at all.- it("switches to a version that has no id", () => {- fetchedArtifacts = [- {- name: "report.pdf",- type: "output",- size: 1_000,- storage_path: "tasks/run-1/report-v1.pdf",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- {- name: "report.pdf",- type: "output",- size: 2_000,- storage_path: "tasks/run-1/report-v2.pdf",- uploaded_at: "2026-07-27T09:00:00+00:00",- },- ];-- renderDownloads();- openFiles();-- expect(screen.getByText(/2 KB$/)).toBeInTheDocument();-- fireEvent.click(screen.getByLabelText("Choose a version of report.pdf"));- fireEvent.click(screen.getByText(/^v1 ·/));-- expect(screen.getByText(/1 KB$/)).toBeInTheDocument();- });-- it("disables dismissal until every version has an id", () => {- fetchedArtifacts = [- {- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T09:00:00+00:00",- },- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- ];-- renderDownloads();- openFiles();-- const dismiss = screen.getByLabelText("Dismiss report.pdf");- expect(dismiss).toHaveAttribute("aria-disabled", "true");- fireEvent.click(dismiss);- expect(setCloudRunArtifactsDismissed).not.toHaveBeenCalled();- });-- // Dismissing the row a user sees has to take the versions behind it too,- // otherwise the file reappears as its own older upload.- it("dismisses every version of a file", async () => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- {- id: "output-2",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T09:00:00+00:00",- },- ];- const dismissedManifest = fetchedArtifacts.map((artifact) => ({- ...(artifact as object),- dismissed_at: "2026-07-27T10:00:00+00:00",- }));- setCloudRunArtifactsDismissed.mockResolvedValue(dismissedManifest);- refetch.mockImplementation(async () => {- fetchedArtifacts = dismissedManifest;- return { data: dismissedManifest };- });-- renderDownloads();- openFiles();-- fireEvent.click(screen.getByLabelText("Dismiss report.pdf"));-- await waitFor(() =>- expect(setCloudRunArtifactsDismissed).toHaveBeenCalledWith(- "task-1",- "run-1",- ["output-2", "output-1"],- true,- ),- );- await waitFor(() =>- expect(screen.getByText("Show 1 dismissed")).toBeInTheDocument(),- );- expect(screen.queryByText("report.pdf")).not.toBeInTheDocument();- });-- // A dismissal must not park a snapshot anywhere that outranks the live session store, which is- // what the box renders from before the first fetch resolves.- it("still shows files uploaded after a mid-run dismissal", async () => {- fetchedArtifacts = undefined;- session = {- cloudStatus: "in_progress",- cloudArtifacts: [- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- },- ],- };- setCloudRunArtifactsDismissed.mockResolvedValue([- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- dismissed_at: "2026-07-27T09:00:00+00:00",- },- ]);-- const { rerender } = renderDownloads();- openFiles();-- fireEvent.click(screen.getByLabelText("Dismiss report.pdf"));- await waitFor(() =>- expect(screen.queryByText("report.pdf")).not.toBeInTheDocument(),- );-- session.cloudArtifacts = [- ...(session.cloudArtifacts as unknown[]),- {- id: "output-2",- name: "notes.md",- type: "output",- uploaded_at: "2026-07-27T10:00:00+00:00",- },- ];- rerender(- <Theme>- <CloudArtifactDownloads taskId="task-1" task={task} />- </Theme>,- );-- expect(screen.getByText("notes.md")).toBeInTheDocument();- expect(screen.queryByText("report.pdf")).not.toBeInTheDocument();- });-- it("hides a dismissed file until the toggle brings it back", () => {- fetchedArtifacts = [- {- id: "output-1",- name: "report.pdf",- type: "output",- uploaded_at: "2026-07-27T08:00:00+00:00",- dismissed_at: "2026-07-27T10:00:00+00:00",- },- ];-- renderDownloads();- openFiles();-- expect(screen.queryByText("report.pdf")).not.toBeInTheDocument();-- fireEvent.click(screen.getByText("Show 1 dismissed"));-- expect(screen.getByText("report.pdf")).toBeInTheDocument();- expect(screen.getByText("Restore")).toBeInTheDocument();- });-- // Nothing pushes the run's manifest to this client, so without the tool call as a trigger a- // freshly delivered file waits for the backstop poll.- it("changes the manifest query key as soon as an upload finishes", () => {- session = { cloudStatus: "in_progress", events: [] };-- const { rerender } = renderDownloads();- refetch.mockClear();-- session.events = [- uploadEvent({- sessionUpdate: "tool_call",- toolCallId: "call-1",- _meta: { posthog: { toolName: UPLOAD_TOOL } },- }),- uploadEvent({- sessionUpdate: "tool_call_update",- toolCallId: "call-1",- status: "completed",- }),- ];- rerender(- <Theme>- <CloudArtifactDownloads taskId="task-1" task={task} />- </Theme>,- );-- expect(queryOptions).toHaveBeenLastCalledWith(- expect.objectContaining({- queryKey: ["cloudRunArtifacts", "auth-1", "task-1", "run-1", 1],- }),- );- expect(refetch).not.toHaveBeenCalled();- });-- it.each([- { status: "in_progress", interval: 120_000 },- { status: "completed", interval: false },- { status: undefined, interval: false },- ])("uses the backstop poll for $status runs", ({ status, interval }) => {- session = { cloudStatus: status };-- renderDownloads();-- expect(queryOptions).toHaveBeenCalledWith(- expect.objectContaining({ refetchInterval: interval }),- );- });-- it("treats a successful empty refresh as authoritative", () => {- const { rerender } = renderDownloads();-- expect(- screen.getByRole("button", { name: "Artifacts (1)" }),- ).toBeInTheDocument();-- fetchedArtifacts = [];- rerender(- <Theme>- <CloudArtifactDownloads taskId="task-1" task={task} />- </Theme>,- );-- expect(screen.queryByRole("button", { name: /^Artifacts \(/ })).toBeNull();- });-});diff --git a/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.tsx b/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.tsxdeleted file mode 100644index 00226a266d8b..000000000000--- a/products/desktop/packages/ui/src/features/sessions/components/CloudArtifactDownloads.tsx+++ /dev/null@@ -1,431 +0,0 @@-import { CaretDown, DownloadSimple, Package, X } from "@phosphor-icons/react";-import {- groupRunArtifactVersions,- type RunArtifactVersions,- runArtifactVersionKey,-} from "@posthog/core/canvas/runArtifactSchemas";-import {- SESSION_SERVICE,- type SessionService,-} from "@posthog/core/sessions/sessionService";-import { useService } from "@posthog/di/react";-import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- Popover,- PopoverContent,- PopoverTrigger,-} from "@posthog/quill";-import { formatRelativeTimeLong, type TaskRunArtifact } from "@posthog/shared";-import type { Task } from "@posthog/shared/domain-types";-import {- getAuthIdentity,- useAuthStateValue,-} from "@posthog/ui/features/auth/store";-import { useMeQuery } from "@posthog/ui/features/auth/useMeQuery";-import { usePanelLayoutStore } from "@posthog/ui/features/panels/panelLayoutStore";-import { useSessionSelector } from "@posthog/ui/features/sessions/sessionStore";-import { useArtifactDownload } from "@posthog/ui/features/sessions/useArtifactDownload";-import { FileIcon } from "@posthog/ui/primitives/FileIcon";-import { toast } from "@posthog/ui/primitives/toast";-import { formatFileSize } from "@posthog/ui/utils/formatFileSize";-import { useMutation, useQuery } from "@tanstack/react-query";-import { useMemo, useState } from "react";-import { useCompletedArtifactUploads } from "./countArtifactUploads";--type ArtifactGroup = RunArtifactVersions<TaskRunArtifact>;--interface CurrentUser {- id?: number;- first_name?: string | null;-}--// Labels mirror the artifact pane (TaskArtifactsList) so the same file reads-// the same way on both surfaces.-function uploaderLabel(- artifact: TaskRunArtifact,- currentUser: CurrentUser | undefined,-): string {- if (artifact.uploaded_by !== "user") return "Agent";- if (- currentUser?.id !== undefined &&- artifact.uploaded_by_user_id === currentUser.id- ) {- return currentUser.first_name?.trim() || "You";- }- return "Teammate";-}--/** Compact one-based version label: v1 is oldest, v{total} is newest. */-function versionShortLabel(index: number, total: number): string {- return `v${total - index}`;-}--function versionMenuLabel(- artifact: TaskRunArtifact,- index: number,- total: number,- currentUser: CurrentUser | undefined,-): string {- return [- versionShortLabel(index, total),- uploaderLabel(artifact, currentUser),- artifact.uploaded_at ? formatRelativeTimeLong(artifact.uploaded_at) : null,- ]- .filter(Boolean)- .join(" · ");-}--export function CloudArtifactDownloads({- taskId,- task,-}: {- taskId: string | undefined;- task: Task | undefined;-}) {- const sessionService = useService<SessionService>(SESSION_SERVICE);- const openArtifactTab = usePanelLayoutStore((state) => state.openArtifactTab);- const sessionArtifacts = useSessionSelector(- taskId,- (session) => session?.cloudArtifacts,- );- const cloudStatus = useSessionSelector(- taskId,- (session) => session?.cloudStatus,- );- const authIdentity = useAuthStateValue(getAuthIdentity);- const { download, downloadingId } = useArtifactDownload();- const { data: currentUser } = useMeQuery();- const [selectedVersionByName, setSelectedVersionByName] = useState<- Record<string, string>- >({});- const [dismissalOverrides, setDismissalOverrides] = useState<- Record<string, string | null>- >({});- const [showDismissed, setShowDismissed] = useState(false);- const runId = task?.latest_run?.id;- const runStatus = cloudStatus ?? task?.latest_run?.status;- const isLive = runStatus === "queued" || runStatus === "in_progress";- const events = useSessionSelector(taskId, (session) => session?.events);- const completedUploads = useCompletedArtifactUploads(events ?? []);- const { data: fetchedArtifacts, refetch } = useQuery({- queryKey: [- "cloudRunArtifacts",- authIdentity,- taskId,- runId,- completedUploads,- ],- queryFn: () =>- sessionService.getCloudRunArtifacts(taskId ?? "", runId ?? ""),- enabled:- authIdentity !== null && taskId !== undefined && runId !== undefined,- retry: false,- staleTime: 15_000,- // Tool completion triggers an immediate refresh; this only covers missing tool events.- refetchInterval: isLive ? 120_000 : false,- });-- const artifactManifest =- fetchedArtifacts ?? sessionArtifacts ?? task?.latest_run?.artifacts;- const groups = useMemo(- () =>- groupRunArtifactVersions(- (artifactManifest ?? []).flatMap((artifact) => {- if (artifact.type !== "output") return [];- return [- artifact.id && artifact.id in dismissalOverrides- ? { ...artifact, dismissed_at: dismissalOverrides[artifact.id] }- : artifact,- ];- }),- ),- [artifactManifest, dismissalOverrides],- );- const visibleGroups = groups.filter((group) => !group.dismissed);- const dismissedGroups = groups.filter((group) => group.dismissed);-- const dismissal = useMutation({- mutationFn: ({- group,- dismissed,- }: {- group: ArtifactGroup;- dismissed: boolean;- }) => {- const artifactIds = group.versions.flatMap((version) =>- version.id ? [version.id] : [],- );- if (artifactIds.length !== group.versions.length) {- throw new Error("Artifact versions are still uploading");- }- return sessionService.setCloudRunArtifactsDismissed(- taskId ?? "",- runId ?? "",- artifactIds,- dismissed,- );- },- // Overlay just the dismissal stamps from the response, so the row updates at once without- // parking a whole-manifest snapshot over a source that keeps refreshing behind it.- onSuccess: async (manifest) => {- setDismissalOverrides((current) => ({- ...current,- ...Object.fromEntries(- manifest.flatMap((entry) =>- entry.id ? [[entry.id, entry.dismissed_at ?? null]] : [],- ),- ),- }));- const refreshed = await refetch();- if (refreshed?.data) setDismissalOverrides({});- },- onError: () => toast.error("Couldn't update this file"),- });-- if (!runId || groups.length === 0) return null;-- const renderRow = (group: ArtifactGroup) => {- const pickedIndex = group.versions.findIndex(- (version) =>- runArtifactVersionKey(version) === selectedVersionByName[group.name],- );- const newestVisibleIndex = group.versions.findIndex(- (version) => !version.dismissed_at,- );- const selectedIndex =- pickedIndex >= 0 ? pickedIndex : Math.max(newestVisibleIndex, 0);- const selected = group.versions[selectedIndex] as TaskRunArtifact;- const size = formatFileSize(selected.size);- const canDownload = Boolean(selected.id);- const canChangeDismissal = group.versions.every((version) => version.id);-- const metaText = [- uploaderLabel(selected, currentUser),- selected.uploaded_at- ? formatRelativeTimeLong(selected.uploaded_at)- : null,- size,- ]- .filter(Boolean)- .join(" · ");-- return (- // Compact take on the artifact pane's ArtifactCard (TaskArtifactsList):- // role="button" because the version picker and trailing actions are real- // buttons and HTML forbids nesting those.- // biome-ignore lint/a11y/useSemanticElements: nested real buttons forbid a <button> card- <div- key={group.name}- role="button"- tabIndex={canDownload ? 0 : undefined}- aria-disabled={canDownload ? undefined : true}- aria-label={`View ${group.name}`}- className={`flex w-full items-center gap-2.5 rounded-lg border border-border bg-muted py-1.5 pr-1.5 pl-2 text-[13px] transition-colors ${- canDownload- ? "cursor-pointer hover:border-gray-6 hover:bg-gray-3"- : ""- }`}- onClick={() => {- if (!taskId || !selected.id) return;- openArtifactTab(taskId, {- runId,- artifactId: selected.id,- name: selected.name,- });- }}- onKeyDown={(event) => {- if (event.target !== event.currentTarget) return;- if (- canDownload &&- taskId &&- selected.id &&- (event.key === "Enter" || event.key === " ")- ) {- event.preventDefault();- openArtifactTab(taskId, {- runId,- artifactId: selected.id,- name: selected.name,- });- }- }}- >- <div className="relative flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-gray-4">- {/* The icon again, blown up and blurred: the tile tints itself with- the icon's own colors, so new icons never need a color mapping. */}- <div- aria-hidden- className="absolute inset-0 flex scale-[2.4] items-center justify-center opacity-40 blur-[9px] saturate-[1.8] dark:opacity-70"- >- <FileIcon filename={group.name} size={16} />- </div>- <div className="relative flex items-center justify-center">- <FileIcon filename={group.name} size={16} />- </div>- </div>- <div className="min-w-0 flex-1">- <div className="truncate font-medium">{group.name}</div>- <div className="flex items-center gap-1 whitespace-nowrap text-[12px] text-muted-foreground">- {metaText && <span className="truncate">{metaText}</span>}- {group.versions.length > 1 && (- <>- {metaText && <span>·</span>}- <DropdownMenu>- <DropdownMenuTrigger- render={- <button- type="button"- aria-label={`Choose a version of ${group.name}`}- onClick={(event) => event.stopPropagation()}- className="flex shrink-0 cursor-pointer items-center gap-0.5 text-foreground"- >- {versionShortLabel(- selectedIndex,- group.versions.length,- )}- <CaretDown size={10} />- </button>- }- />- {/* w-max: the default popup width tracks the anchor, and this- trigger is a couple of characters wide, so version labels- would be cut off. */}- <DropdownMenuContent align="start" className="w-max">- {group.versions.map((version, index) => (- <DropdownMenuItem- key={runArtifactVersionKey(version)}- onClick={() =>- setSelectedVersionByName((current) => ({- ...current,- [group.name]: runArtifactVersionKey(version),- }))- }- >- {versionMenuLabel(- version,- index,- group.versions.length,- currentUser,- )}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- </>- )}- </div>- </div>- <div className="flex shrink-0 items-center gap-1">- {group.dismissed ? (- <Button- size="sm"- variant="outline"- disabled={dismissal.isPending || !canChangeDismissal}- onClick={(event) => {- event.stopPropagation();- dismissal.mutate({ group, dismissed: false });- }}- >- Restore- </Button>- ) : (- <>- <Button- size="icon-sm"- variant="default"- aria-label={`Download ${group.name}`}- disabled={!canDownload || downloadingId !== null}- onClick={(event) => {- event.stopPropagation();- if (!taskId || !selected.id) return;- void download({- taskId,- runId,- artifactId: selected.id,- name: selected.name,- });- }}- >- <DownloadSimple size={14} />- </Button>- <Button- size="icon-sm"- variant="default"- aria-label={`Dismiss ${group.name}`}- disabled={dismissal.isPending || !canChangeDismissal}- onClick={(event) => {- event.stopPropagation();- dismissal.mutate({ group, dismissed: true });- }}- >- <X size={14} />- </Button>- </>- )}- </div>- </div>- );- };-- return (- <Popover>- <PopoverTrigger- render={- <Button- type="button"- variant="default"- size="icon-sm"- className="relative"- aria-label={`Artifacts (${visibleGroups.length})`}- >- <Package size={16} />- {visibleGroups.length > 0 && (- <span className="-top-1 -right-1 absolute flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-0.5 font-semibold text-[9px] text-primary-foreground">- {visibleGroups.length}- </span>- )}- </Button>- }- />- {/* quill's popup is a fixed 18rem; the rows carry name, size, age, and- actions, which need the width the old inline card had. */}- <PopoverContent- side="top"- align="end"- sideOffset={6}- className="w-[400px] max-w-[calc(100vw-2rem)] gap-2"- >- <div className="flex items-center justify-between">- <span className="font-medium text-[13px] text-foreground">- Artifacts- </span>- <span className="text-[12px] text-muted-foreground tabular-nums">- {visibleGroups.length === 1- ? "1 artifact"- : `${visibleGroups.length} artifacts`}- </span>- </div>- <div className="flex max-h-72 flex-col gap-1 overflow-y-auto">- {visibleGroups.map(renderRow)}- {showDismissed && dismissedGroups.map(renderRow)}- </div>- {dismissedGroups.length > 0 && (- <Button- size="sm"- variant="link-muted"- className="self-start"- onClick={() => setShowDismissed((current) => !current)}- >- {showDismissed- ? "Hide dismissed"- : `Show ${dismissedGroups.length} dismissed`}- </Button>- )}- </PopoverContent>- </Popover>- );-}diff --git a/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx b/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsxindex 68d5311a70a8..76acb6f94114 100644--- a/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx@@ -16,10 +16,7 @@ import type {TurnContext,} from "@posthog/ui/features/sessions/components/buildConversationItems";import { ConversationSearchBar } from "@posthog/ui/features/sessions/components/ConversationSearchBar";-import {- PROMPT_RECALL_HINT_KEY,- type PromptRecallHandler,-} from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";+import type { PromptRecallHandler } from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";import { MessageJumpPicker } from "@posthog/ui/features/sessions/components/chat-thread/MessageJumpPicker";import { THREAD_HOTKEY_OPTIONS } from "@posthog/ui/features/sessions/components/chat-thread/threadHotkeys";import { usePromptRecallSource } from "@posthog/ui/features/sessions/components/chat-thread/usePromptRecallSource";@@ -64,6 +61,7 @@ import {import { useThreadScrollRequest } from "@posthog/ui/features/sessions/threadNavigationStore";import { SessionTaskIdProvider } from "@posthog/ui/features/sessions/useSessionTaskId";import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";import { SkillButtonActionMessage } from "@posthog/ui/features/skill-buttons/components/SkillButtonActionMessage";import {DIFF_WORKER_FACTORY,@@ -295,7 +293,7 @@ export function ConversationView({const nextMessage = userMessages[nextIndex];if (!nextMessage) return;- useSettingsStore.getState().markHintLearned(PROMPT_RECALL_HINT_KEY);+ useSettingsStore.getState().markHintLearned(TIP_KEYS.recallMessageNav);setKeyboardFocusedMessageId(nextMessage.id);scrollToUserMessage(nextMessage.id, nextMessage.index);},diff --git a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsxindex fa506f024725..b0a674c5bf8a 100644--- a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx@@ -23,7 +23,6 @@ import { useDraftStore } from "@posthog/ui/features/message-editor/draftStore";import { useAutoFocusOnTyping } from "@posthog/ui/features/message-editor/useAutoFocusOnTyping";import { resolveAndAttachDroppedFiles } from "@posthog/ui/features/message-editor/utils/persistFile";import { PermissionSelector } from "@posthog/ui/features/permissions/PermissionSelector";-import { CloudArtifactDownloads } from "@posthog/ui/features/sessions/components/CloudArtifactDownloads";import {CloudStreamDisconnectedBanner,ConnectingToAgent,@@ -853,13 +852,7 @@ export function SessionView({) : undefined}toolbarEndSlot={- <>- <CloudArtifactDownloads- taskId={taskId}- task={task}- />- <ContextUsageIndicator usage={contextUsage} />- </>+ <ContextUsageIndicator usage={contextUsage} />}onToggleMessagingMode={toggleMessagingMode}onAttachmentsChange={handleAttachmentsChange}diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsxindex 93313098cbf0..e7de2631a307 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx@@ -60,10 +60,7 @@ import {} from "@posthog/ui/features/sessions/components/chat-thread/ChatMarkdown";import { ChatThreadFooter } from "@posthog/ui/features/sessions/components/chat-thread/ChatThreadFooter";import { ChatThreadChromeProvider } from "@posthog/ui/features/sessions/components/chat-thread/chatThreadChrome";-import {- PROMPT_RECALL_HINT_KEY,- type PromptRecallHandler,-} from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";+import type { PromptRecallHandler } from "@posthog/ui/features/sessions/components/chat-thread/composerPromptRecall";import { MessageJumpPicker } from "@posthog/ui/features/sessions/components/chat-thread/MessageJumpPicker";import { MessageMinimap } from "@posthog/ui/features/sessions/components/chat-thread/MessageMinimap";import { ToolGroup } from "@posthog/ui/features/sessions/components/chat-thread/ToolGroup";@@ -132,6 +129,7 @@ import {useSessionTaskId,} from "@posthog/ui/features/sessions/useSessionTaskId";import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";import { SkillButtonActionMessage } from "@posthog/ui/features/skill-buttons/components/SkillButtonActionMessage";import { toast } from "@posthog/ui/primitives/toast";import { useCopy } from "@posthog/ui/primitives/useCopy";@@ -1018,7 +1016,7 @@ function ThreadKeyboardNav({const nextId = userMessageIds[nextIndex];if (!nextId) return;- useSettingsStore.getState().markHintLearned(PROMPT_RECALL_HINT_KEY);+ useSettingsStore.getState().markHintLearned(TIP_KEYS.recallMessageNav);setKeyboardFocusedMessageId(nextId);jump(nextId);},diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/composerPromptRecall.ts b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/composerPromptRecall.tsindex c29e6d4d6805..5bb8827fd3d8 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/composerPromptRecall.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/composerPromptRecall.ts@@ -3,8 +3,6 @@ import { extractCanvasInstructions } from "@posthog/ui/features/sessions/componeimport { extractChannelContext } from "@posthog/ui/features/sessions/components/session-update/channelContext";import { extractCustomInstructions } from "@posthog/ui/features/sessions/components/session-update/customInstructions";-export const PROMPT_RECALL_HINT_KEY = "recall-message-nav";-export interface RecallableMessage {id: string;content: string;diff --git a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.test.ts b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.test.tsindex d542bd7ad6b9..27b861420c63 100644--- a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.test.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.test.ts@@ -32,6 +32,16 @@ function toolCallItem(} as unknown as ConversationItem;}+/** Put the settled call (the one carrying output) in the turn's map, as a+ * tool_call_update does. */+function resolveToolCall(item: ConversationItem, resolved: unknown): void {+ if (item.type !== "session_update") return;+ item.turnContext.toolCalls.set(+ (resolved as { toolCallId: string }).toolCallId,+ resolved as never,+ );+}+describe("buildThreadGroups MCP detection", () => {it("keeps a tool call with only the posthog meta channel standalone (codex adapters)", () => {const mcpItem = toolCallItem("t1", {@@ -97,6 +107,45 @@ describe("buildThreadGroups MCP detection", () => {});});+describe("buildThreadGroups artifact detection", () => {+ // A PR's url arrives on the tool_call_update, which lands in the turn's tool+ // call map rather than on the item grouping walks. Reading only the item folds+ // the call into a collapsed group and hides the card the run just earned.+ it("keeps a pull request the run opened as its own row", () => {+ const bash = toolCallItem(+ "bash",+ { posthog: { toolName: "Bash" } },+ { kind: "execute" },+ );+ const create = toolCallItem(+ "create-pr",+ { posthog: { toolName: "Bash" } },+ { kind: "execute", rawInput: { command: "gh pr create --fill" } },+ );+ resolveToolCall(create, {+ toolCallId: "create-pr",+ kind: "execute",+ status: "completed",+ rawInput: { command: "gh pr create --fill" },+ content: [+ {+ type: "content",+ content: {+ type: "text",+ text: "https://github.com/PostHog/posthog/pull/82584",+ },+ },+ ],+ });++ expect(isGroupableItem(create)).toBe(false);++ const grouping = buildThreadGroups([bash, create], {});+ expect(grouping.rows.map((r) => r.kind)).toEqual(["tool_group", "item"]);+ expect(grouping.idToRowIndex.get("create-pr")).toBe(1);+ });+});+describe("buildThreadGroups plan detection", () => {// The plan tool call is emitted from the model's raw input, and its plan text// and switch_mode kind are backfilled by the permission handler. Grouping bydiff --git a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.tsindex 6b750577fb9b..2b5fc9215907 100644--- a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts@@ -12,6 +12,8 @@ import {SUBAGENT_ICON,} from "@posthog/ui/features/sessions/components/new-thread/conversationThreadConfig";import { isPlanApprovalTool } from "@posthog/ui/features/sessions/components/session-update/collaborationTools";+import { hasInlineArtifact } from "@posthog/ui/features/sessions/components/session-update/inlineArtifacts";+import type { ToolCall } from "@posthog/ui/features/sessions/types";export interface GroupIconEntry {Icon: Icon;@@ -108,6 +110,23 @@ function isPlanItem(item: ConversationItem): boolean {);}+/**+ * A tool call that hands the user a deliverable (an uploaded file, a pull+ * request it just opened). The card belongs in the thread, so the run that+ * produced it must not fold away behind a "ran 12 commands" summary.+ */+function isArtifactItem(item: ConversationItem): boolean {+ if (item.type !== "session_update") return false;+ if (item.update.sessionUpdate !== "tool_call") return false;+ const { toolCallId } = item.update;+ // The output a PR is read from arrives on the tool_call_update, which lands+ // in the turn's map rather than on the item this grouping walks.+ const resolved = toolCallId+ ? item.turnContext.toolCalls.get(toolCallId)+ : undefined;+ return hasInlineArtifact(resolved ?? (item.update as unknown as ToolCall));+}+/*** Whether an item folds into a tool-call group rather than getting its own row.* A group is a maximal run of these; anything else flushes the run. Grouping is@@ -120,7 +139,8 @@ export function isGroupableItem(item: ConversationItem): boolean {if (isAlwaysVisibleItem(item) ||isDirectMessageItem(item) ||- isPlanItem(item)+ isPlanItem(item) ||+ isArtifactItem(item))return false;return true;diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.stories.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.stories.tsxnew file mode 100644index 000000000000..0207bd590617--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.stories.tsx@@ -0,0 +1,60 @@+import { posthogToolMeta } from "@posthog/shared";+import {+ CreatedPrCard,+ UploadedArtifactCard,+} from "@posthog/ui/features/sessions/components/session-update/InlineArtifactCard";+import type { ToolCall } from "@posthog/ui/features/sessions/types";+import { SessionTaskIdProvider } from "@posthog/ui/features/sessions/useSessionTaskId";+import type { Meta, StoryObj } from "@storybook/react-vite";++const meta: Meta<typeof UploadedArtifactCard> = {+ title: "Sessions/InlineArtifactCard",+ component: UploadedArtifactCard,+ parameters: { layout: "padded" },+ // The cards read the session they are drawn in: without one they have no+ // artifacts panel to send anyone to, and drop the action.+ decorators: [+ (Story) => (+ <SessionTaskIdProvider taskId="task-1">+ <Story />+ </SessionTaskIdProvider>+ ),+ ],+};++export default meta;+type Story = StoryObj<typeof UploadedArtifactCard>;++function uploadCall(status: ToolCall["status"]): ToolCall {+ return {+ toolCallId: "tc-upload",+ kind: "other",+ status,+ title: "upload_artifact",+ rawInput: { path: "/workspace/out/churn-report.csv" },+ _meta: posthogToolMeta({+ toolName: "mcp__posthog-code-tools__upload_artifact",+ mcp: { server: "posthog-code-tools", tool: "upload_artifact" },+ }),+ } as ToolCall;+}++/** The file mid-delivery: the card stands in for it before it exists anywhere. */+export const Uploading: Story = {+ args: { toolCall: uploadCall("in_progress"), turnComplete: false },+ parameters: { testOptions: { waitForLoadersToDisappear: false } },+};++export const Uploaded: Story = {+ args: { toolCall: uploadCall("completed"), turnComplete: true },+};++export const UploadFailed: Story = {+ args: { toolCall: uploadCall("failed"), turnComplete: true },+};++export const PullRequest: StoryObj<typeof CreatedPrCard> = {+ render: () => (+ <CreatedPrCard url="https://github.com/PostHog/posthog/pull/82584" />+ ),+};diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.tsxnew file mode 100644index 000000000000..d759c185dde1--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/InlineArtifactCard.tsx@@ -0,0 +1,175 @@+import { ArrowSquareOutIcon } from "@phosphor-icons/react";+import { groupRunArtifactVersions } from "@posthog/core/canvas/runArtifactSchemas";+import { Button, Spinner } from "@posthog/quill";+import { openPrInReview } from "@posthog/ui/features/code-review/openPrInReview";+import { usePrArtifact } from "@posthog/ui/features/git-interaction/usePrArtifact";+import { openRightPanelSide } from "@posthog/ui/features/navigation/rightPanelSide";+import { usePanelLayoutStore } from "@posthog/ui/features/panels/panelLayoutStore";+import { readUploadedArtifactName } from "@posthog/ui/features/sessions/components/session-update/inlineArtifacts";+import {+ type ToolViewProps,+ useToolCallStatus,+} from "@posthog/ui/features/sessions/components/session-update/toolCallUtils";+import { useSessionSelector } from "@posthog/ui/features/sessions/sessionStore";+import { useRunArtifacts } from "@posthog/ui/features/sessions/useRunArtifacts";+import { useSessionTaskId } from "@posthog/ui/features/sessions/useSessionTaskId";+import {+ ArtifactCard,+ stopCardOpen,+} from "@posthog/ui/primitives/ArtifactCard";+import { FileIcon } from "@posthog/ui/primitives/FileIcon";+import { openExternalUrl } from "@posthog/ui/shell/openExternal";+import { formatFileSize } from "@posthog/ui/utils/formatFileSize";+import { useMemo } from "react";++/** Opens the session's artifacts panel, where the run's other deliverables are. */+function SeeAllArtifactsButton({ taskId }: { taskId: string }) {+ return (+ <Button+ variant="default"+ size="sm"+ onClick={(event) => {+ stopCardOpen(event);+ openRightPanelSide("artifacts", taskId);+ }}+ >+ See all+ </Button>+ );+}++/** What kind of file this is, in the terms its name already gives: "CSV", "PDF". */+function fileKindLabel(name: string): string {+ const extension = name.includes(".") ? name.split(".").pop() : undefined;+ return extension && extension.length <= 4 ? extension.toUpperCase() : "File";+}++/** The uploaded file's id, once the run's manifest carries the name the tool sent. */+function useUploadedArtifact(+ taskId: string | null,+ name: string | null,+): { runId: string; artifactId: string; size: number | undefined } | null {+ const runId = useSessionSelector(taskId ?? undefined, (s) => s?.taskRunId);+ const { data: artifacts } = useRunArtifacts(taskId ?? undefined, runId, {+ staleTime: 15_000,+ });++ return useMemo(() => {+ if (!runId || !name || !artifacts) return null;+ const group = groupRunArtifactVersions(+ artifacts.filter((artifact) => artifact.type === "output"),+ ).find((candidate) => candidate.name === name);+ const id = group?.latest.id;+ return id ? { runId, artifactId: id, size: group?.latest.size } : null;+ }, [artifacts, name, runId]);+}++/**+ * The file an `upload_artifact` call delivers, drawn where the agent produced it+ * rather than only in the panel it lands in. It stands in for the file while the+ * upload runs, then opens it once the run's manifest carries it.+ */+export function UploadedArtifactCard({+ toolCall,+ turnCancelled,+ turnComplete,+}: ToolViewProps) {+ const taskId = useSessionTaskId();+ const openArtifactTab = usePanelLayoutStore((state) => state.openArtifactTab);+ const name = readUploadedArtifactName(toolCall.rawInput);+ const { isLoading, isFailed, wasCancelled } = useToolCallStatus(+ toolCall.status,+ turnCancelled,+ turnComplete,+ );+ // A file is matched by name, so a re-upload under an existing name would+ // match the version it is about to replace. Resolving by the id the upload+ // returns is the real fix, and waits on that id reaching the tool result.+ const uploaded = useUploadedArtifact(taskId, isLoading ? null : name);+ const title = name ?? "File";++ const delivered = [+ fileKindLabel(title),+ uploaded?.size === undefined ? null : formatFileSize(uploaded.size),+ ]+ .filter(Boolean)+ .join(" · ");+ const meta = isLoading ? (+ <span className="shimmer">Uploading…</span>+ ) : isFailed ? (+ "Upload failed"+ ) : wasCancelled ? (+ "Canceled"+ ) : (+ delivered+ );++ // Until the manifest carries the file there is nothing to preview, so the+ // card falls back to the panel, which lists it as soon as it lands.+ const onOpen = !taskId+ ? undefined+ : uploaded+ ? () =>+ openArtifactTab(taskId, {+ runId: uploaded.runId,+ artifactId: uploaded.artifactId,+ name: title,+ })+ : isLoading || isFailed || wasCancelled+ ? undefined+ : () => openRightPanelSide("artifacts", taskId);++ return (+ <ArtifactCard+ icon={isLoading ? <Spinner /> : <FileIcon filename={title} size={18} />}+ title={title}+ meta={meta}+ onOpen={onOpen}+ actions={taskId ? <SeeAllArtifactsButton taskId={taskId} /> : undefined}+ />+ );+}++/**+ * The pull request a run just opened, drawn in the thread where it happened.+ * Opening it puts the review in the session's own panel, the way every other+ * PR link in the app does.+ */+export function CreatedPrCard({ url }: { url: string }) {+ const taskId = useSessionTaskId();+ const { safeUrl, title, stateLabel, Icon, iconColor } = usePrArtifact(url);++ return (+ <ArtifactCard+ icon={<Icon size={16} weight="bold" style={{ color: iconColor }} />}+ title={title}+ meta={stateLabel ?? undefined}+ onOpen={+ safeUrl+ ? () =>+ taskId+ ? openPrInReview(taskId, safeUrl)+ : openExternalUrl(safeUrl)+ : undefined+ }+ actions={+ <>+ {safeUrl && (+ <Button+ variant="default"+ size="icon-sm"+ aria-label={`Open ${title} on GitHub`}+ onClick={(event) => {+ stopCardOpen(event);+ openExternalUrl(safeUrl);+ }}+ >+ <ArrowSquareOutIcon size={14} />+ </Button>+ )}+ {taskId && <SeeAllArtifactsButton taskId={taskId} />}+ </>+ }+ />+ );+}diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolCallBlock.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolCallBlock.tsxindex 56a4463b3749..a3d9a7f7a02b 100644--- a/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolCallBlock.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolCallBlock.tsx@@ -17,10 +17,12 @@ import { Box } from "@radix-ui/themes";import type { ConversationItem, TurnContext } from "../buildConversationItems";import { useChatThreadChrome } from "../chat-thread/chatThreadChrome";import { isPlanApprovalTool, isSubagentSpawnTool } from "./collaborationTools";+import { CreatedPrCard, UploadedArtifactCard } from "./InlineArtifactCard";import {MCP_TOOL_BLOCK_COMPONENT,type McpToolBlockComponent,} from "./identifiers";+import { isUploadArtifactCall, readCreatedPrUrl } from "./inlineArtifacts";import { SubagentToolView } from "./SubagentToolView";interface ToolCallBlockProps extends ToolViewProps {@@ -48,6 +50,18 @@ export function ToolCallBlock({const props = { toolCall, turnCancelled, turnComplete };+ // An artifact is a deliverable, not a step: it takes the row rather than the+ // tool's own header, from the moment the agent starts handing it over.+ if (isUploadArtifactCall(toolCall._meta)) {+ return (+ <Box className={chatChrome ? "" : "pl-3"}>+ <UploadedArtifactCard {...props} />+ </Box>+ );+ }++ const createdPrUrl = readCreatedPrUrl(toolCall);+if (isSubagentSpawnTool(toolName)) {const subagentChildItems = childItems ?? [];const turnContext: TurnContext = {@@ -75,6 +89,7 @@ export function ToolCallBlock({) : (<ToolCallView {...props} agentToolName={mcpToolName} />)}+ {createdPrUrl && <CreatedPrCard url={createdPrUrl} />}</Box>);}@@ -114,7 +129,12 @@ export function ToolCallBlock({}})();- return <Box>{content}</Box>;+ return (+ <Box>+ {content}+ {createdPrUrl && <CreatedPrCard url={createdPrUrl} />}+ </Box>+ );}function buildChildToolCallsMap(diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.test.ts b/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.test.tsnew file mode 100644index 000000000000..ab641852fe28--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.test.ts@@ -0,0 +1,110 @@+import { posthogToolMeta } from "@posthog/shared";+import type { ToolCall } from "@posthog/ui/features/sessions/types";+import { describe, expect, it } from "vitest";+import { readCreatedPrUrl, readUploadedArtifactName } from "./inlineArtifacts";++const PR_URL = "https://github.com/PostHog/posthog/pull/82584";++function bashCall(+ command: string,+ output: string,+ overrides?: Partial<ToolCall>,+): ToolCall {+ return {+ toolCallId: "tc",+ kind: "execute",+ status: "completed",+ rawInput: { command },+ content: [{ type: "content", content: { type: "text", text: output } }],+ _meta: posthogToolMeta({ toolName: "Bash" }),+ ...overrides,+ } as ToolCall;+}++describe("inlineArtifacts", () => {+ it.each([+ {+ name: "an explicit download name",+ input: { path: "/w/out/r.csv", name: "Report.csv" },+ expected: "Report.csv",+ },+ {+ name: "the file's own name",+ input: { path: "/w/out/report.csv" },+ expected: "report.csv",+ },+ {+ name: "a windows path",+ input: { path: "C:\\work\\report.csv" },+ expected: "report.csv",+ },+ { name: "nothing usable", input: { path: " " }, expected: null },+ { name: "a non-object input", input: "report.csv", expected: null },+ ])("titles an upload from $name", ({ input, expected }) => {+ expect(readUploadedArtifactName(input)).toBe(expected);+ });++ it.each([+ {+ name: "gh pr create",+ call: bashCall("gh pr create --fill", `Creating pull request\n${PR_URL}`),+ expected: PR_URL,+ },+ {+ name: "an MCP create-pull-request tool",+ call: bashCall("", `{"html_url":"${PR_URL}"}`, {+ rawInput: { title: "Fix" },+ _meta: posthogToolMeta({+ toolName: "mcp__github__create_pull_request",+ mcp: { server: "github", tool: "create_pull_request" },+ }),+ }),+ expected: PR_URL,+ },+ // A run that reads, reviews or comments on a PR prints the same URL, and+ // that PR is not something the run produced, so it gets no card.+ {+ name: "reading someone else's pull request",+ call: bashCall("gh pr view 82584 --json url", PR_URL),+ expected: null,+ },+ {+ // `create_pull_request_review` contains the creation tool's whole name+ // and answers with the url of the PR it reviewed.+ name: "reviewing someone else's pull request over MCP",+ call: bashCall("", `{"html_url":"${PR_URL}"}`, {+ rawInput: { pullNumber: 82584, event: "COMMENT" },+ _meta: posthogToolMeta({+ toolName: "mcp__github__create_pull_request_review",+ mcp: { server: "github", tool: "create_pull_request_review" },+ }),+ }),+ expected: null,+ },+ {+ name: "a command that only talks about creating one",+ call: bashCall(+ `gh pr comment 82584 --body "next time run gh pr create"`,+ PR_URL,+ ),+ expected: null,+ },+ {+ name: "a creation chained after a push",+ call: bashCall("git push -u origin work && gh pr create --fill", PR_URL),+ expected: PR_URL,+ },+ {+ name: "a creation still in flight",+ call: bashCall("gh pr create --fill", "", { status: "in_progress" }),+ expected: null,+ },+ {+ name: "a creation that printed no url",+ call: bashCall("gh pr create --fill", "pull request create failed"),+ expected: null,+ },+ ])("reads a created pull request from $name", ({ call, expected }) => {+ expect(readCreatedPrUrl(call)).toBe(expected);+ });+});diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.ts b/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.tsnew file mode 100644index 000000000000..d805013800c1--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/inlineArtifacts.ts@@ -0,0 +1,86 @@+import { readMcpToolDescriptor } from "@posthog/shared";+import { getContentText } from "@posthog/ui/features/sessions/components/session-update/toolCallUtils";+import type { ToolCall } from "@posthog/ui/features/sessions/types";++const UPLOAD_ARTIFACT_TOOL = "upload_artifact";++/** The agent's `upload_artifact` call, which delivers a file to the artifacts panel. */+export function isUploadArtifactCall(meta: unknown): boolean {+ return readMcpToolDescriptor(meta)?.tool === UPLOAD_ARTIFACT_TOOL;+}++/** The download name the upload will land under: the given name, else the file's own. */+export function readUploadedArtifactName(rawInput: unknown): string | null {+ if (!rawInput || typeof rawInput !== "object") return null;+ const input = rawInput as { name?: unknown; path?: unknown };+ if (typeof input.name === "string" && input.name.trim()) {+ return input.name.trim();+ }+ if (typeof input.path === "string" && input.path.trim()) {+ const segments = input.path.trim().split(/[\\/]/).filter(Boolean);+ return segments.at(-1) ?? null;+ }+ return null;+}++const PR_URL_PATTERN =+ /https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/pull\/\d+(?![\w/])/;++/**+ * The whole MCP tool name, not a substring of it. `create_pull_request_review`+ * both contains this name and returns the url of the pull request it reviewed,+ * so a loose match reads someone else's PR back as this run's deliverable.+ */+const PR_CREATION_TOOL = /^create[_-]?pull[_-]?request$/i;++/**+ * `gh pr create` where a command can start: the beginning of the line, or after+ * a separator. Anywhere else it is being talked about rather than run, and the+ * body of a `gh pr comment` is the likeliest place for that.+ */+const GH_PR_CREATE_PATTERN = /(?:^|[\n;|&]\s*)gh\s+pr\s+create\b/;++/** The shell command a tool call ran, for the tools that carry one. */+function readCommand(rawInput: unknown): string {+ if (!rawInput || typeof rawInput !== "object") return "";+ const { command } = rawInput as { command?: unknown };+ if (typeof command === "string") return command;+ return Array.isArray(command) ? command.join(" ") : "";+}++function toolCallOutputText(toolCall: ToolCall): string {+ const content = getContentText(toolCall.content) ?? "";+ const raw = toolCall.rawOutput;+ return typeof raw === "string" ? `${content}\n${raw}` : content;+}++/**+ * Whether the call set out to open a pull request. Two ways in, because a shell+ * that opens one may itself be an MCP tool.+ */+function looksLikePrCreation(toolCall: ToolCall): boolean {+ const mcp = readMcpToolDescriptor(toolCall._meta);+ if (mcp && PR_CREATION_TOOL.test(mcp.tool)) return true;+ return GH_PR_CREATE_PATTERN.test(readCommand(toolCall.rawInput));+}++/**+ * The pull request a tool call just opened, or null.+ *+ * Gated on the call setting out to create one rather than on the url alone: a+ * run that reads, reviews or comments on someone else's PR prints the same url,+ * and that PR is not this run's deliverable.+ */+export function readCreatedPrUrl(toolCall: ToolCall): string | null {+ if (toolCall.status !== "completed") return null;+ if (!looksLikePrCreation(toolCall)) return null;++ return PR_URL_PATTERN.exec(toolCallOutputText(toolCall))?.[0] ?? null;+}++/** Whether a tool call draws an artifact card, which never folds into a tool group. */+export function hasInlineArtifact(toolCall: ToolCall): boolean {+ return (+ isUploadArtifactCall(toolCall._meta) || readCreatedPrUrl(toolCall) !== null+ );+}diff --git a/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.test.tsx b/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.test.tsxnew file mode 100644index 000000000000..0f978ed99734--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.test.tsx@@ -0,0 +1,118 @@+import { SESSION_SERVICE } from "@posthog/core/sessions/sessionService";+import { ServiceProvider } from "@posthog/di/react";+import type { TaskRunArtifact } from "@posthog/shared";+import { useAuthStore } from "@posthog/ui/features/auth/store";+import { useSessionStore } from "@posthog/ui/features/sessions/sessionStore";+import { useRunArtifacts } from "@posthog/ui/features/sessions/useRunArtifacts";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { renderHook, waitFor } from "@testing-library/react";+import { Container } from "inversify";+import type { ReactNode } from "react";+import { beforeEach, describe, expect, it } from "vitest";++const TASK_ID = "task-1";+const RUN_ID = "run-1";++function artifact(name: string): TaskRunArtifact {+ return { id: name, name, type: "output" } as TaskRunArtifact;+}++/** One event per finished upload, which is what re-keys the query. */+function uploadEvents(count: number) {+ return Array.from({ length: count }).flatMap((_, index) => [+ {+ type: "acp_message" as const,+ ts: index * 2,+ message: {+ jsonrpc: "2.0",+ method: "session/update",+ params: {+ update: {+ sessionUpdate: "tool_call",+ toolCallId: `call-${index}`,+ _meta: {+ posthog: {+ toolName: "mcp__posthog-code-tools__upload_artifact",+ },+ },+ },+ },+ },+ },+ {+ type: "acp_message" as const,+ ts: index * 2 + 1,+ message: {+ jsonrpc: "2.0",+ method: "session/update",+ params: {+ update: {+ sessionUpdate: "tool_call_update",+ toolCallId: `call-${index}`,+ status: "completed",+ },+ },+ },+ },+ ]);+}++function setUploads(count: number) {+ useSessionStore.setState({+ taskIdIndex: { [TASK_ID]: RUN_ID },+ sessions: {+ [RUN_ID]: { taskRunId: RUN_ID, events: uploadEvents(count) },+ },+ // biome-ignore lint/suspicious/noExplicitAny: the store's full shape isn't needed to drive this hook+ } as any);+}++// Built once: a wrapper that rebuilds these per render restarts the query on+// every render and never resolves.+const container = new Container();+container.bind(SESSION_SERVICE).toConstantValue({+ getCloudRunArtifacts: async () => [artifact("report.csv")],+});+const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false } },+});++function wrapper({ children }: { children: ReactNode }) {+ return (+ <ServiceProvider container={container}>+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>+ </ServiceProvider>+ );+}++describe("useRunArtifacts", () => {+ beforeEach(() => {+ useAuthStore.setState({+ authState: {+ status: "authenticated",+ cloudRegion: "us",+ bootstrapComplete: true,+ // biome-ignore lint/suspicious/noExplicitAny: only the identity fields matter here+ } as any,+ });+ setUploads(0);+ });++ // A finished upload re-keys the query, which lands every caller on a cache+ // entry with nothing in it. Without carrying the last answer over, every+ // artifact already drawn in the transcript blinks back to unresolved on each+ // upload, which is what a person sees as a flicker.+ it("keeps the manifest on screen while a new upload re-keys the query", async () => {+ const { result, rerender } = renderHook(+ () => useRunArtifacts(TASK_ID, RUN_ID, { staleTime: 0 }),+ { wrapper },+ );+ await waitFor(() => expect(result.current.data).toHaveLength(1));++ setUploads(1);+ rerender();++ expect(result.current.data).toHaveLength(1);+ expect(result.current.isLoading).toBe(false);+ });+});diff --git a/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.ts b/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.tsindex 6bb9f401d62c..817070eac94b 100644--- a/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.ts+++ b/products/desktop/packages/ui/src/features/sessions/useRunArtifacts.ts@@ -8,22 +8,47 @@ import {getAuthIdentity,useAuthStateValue,} from "@posthog/ui/features/auth/store";-import { type UseQueryResult, useQuery } from "@tanstack/react-query";+import { useCompletedArtifactUploads } from "@posthog/ui/features/sessions/components/countArtifactUploads";+import { useSessionSelector } from "@posthog/ui/features/sessions/sessionStore";+import {+ keepPreviousData,+ type UseQueryResult,+ useQuery,+} from "@tanstack/react-query";/*** A run's artifact manifest. The query key is shared across every caller, so a* message referencing several artifacts — or a message rendered next to the* Files list — costs one fetch rather than one per reference.+ *+ * The endpoint isn't pushed to, so the session's own count of finished+ * `upload_artifact` calls rides in the key: a file the agent just delivered+ * shows up now rather than on the next poll. It is derived here rather than+ * passed in, because a key one caller re-derives and another doesn't would+ * split the shared entry in two.*/export function useRunArtifacts(taskId: string | undefined,runId: string | undefined,- options?: { enabled?: boolean; staleTime?: number },+ options?: {+ enabled?: boolean;+ staleTime?: number;+ /** Poll interval while the run is still going; off by default. */+ refetchInterval?: number | false;+ },): UseQueryResult<TaskRunArtifact[]> {const sessionService = useService<SessionService>(SESSION_SERVICE);const authIdentity = useAuthStateValue(getAuthIdentity);+ const events = useSessionSelector(taskId, (session) => session?.events);+ const completedUploads = useCompletedArtifactUploads(events ?? []);return useQuery({- queryKey: ["cloudRunArtifacts", authIdentity, taskId, runId],+ queryKey: [+ "cloudRunArtifacts",+ authIdentity,+ taskId,+ runId,+ completedUploads,+ ],queryFn: () =>sessionService.getCloudRunArtifacts(taskId ?? "", runId ?? ""),enabled:@@ -33,5 +58,10 @@ export function useRunArtifacts((options?.enabled ?? true),retry: false,staleTime: options?.staleTime ?? Infinity,+ refetchInterval: options?.refetchInterval ?? false,+ // The upload count in the key means a finished upload lands every caller on+ // an empty cache entry. Carry the last manifest over it, or every artifact+ // already drawn blinks back to unresolved each time another one arrives.+ placeholderData: keepPreviousData,});}diff --git a/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.test.ts b/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.test.tsnew file mode 100644index 000000000000..830a63c14ee1--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.test.ts@@ -0,0 +1,96 @@+import type { TaskRunArtifact } from "@posthog/shared";+import {+ countArtifacts,+ isAgentWorking,+} from "@posthog/ui/features/sessions/useSessionArtifactCount";+import { describe, expect, it } from "vitest";++describe("isAgentWorking", () => {+ it.each([+ {+ name: "a turn in flight in this window",+ hasSession: true,+ isPromptPending: true,+ runStatus: "in_progress",+ expected: true,+ },+ // The one that bit: a cloud run stays in_progress across every turn until+ // the whole run ends, so reading its status kept the between-turns moment+ // shut for the length of the session.+ {+ name: "between turns of a cloud run that is still alive",+ hasSession: true,+ isPromptPending: false,+ runStatus: "in_progress",+ expected: false,+ },+ {+ name: "a run this window only watches",+ hasSession: false,+ isPromptPending: false,+ runStatus: "in_progress",+ expected: true,+ },+ {+ name: "a finished run nobody is driving",+ hasSession: false,+ isPromptPending: false,+ runStatus: "completed",+ expected: false,+ },+ ])("$name", ({ hasSession, isPromptPending, runStatus, expected }) => {+ expect(isAgentWorking({ hasSession, isPromptPending, runStatus })).toBe(+ expected,+ );+ });+});++describe("countArtifacts", () => {+ const file = (name: string): TaskRunArtifact => ({ name, type: "output" });+ const pr = (n: number): string => `https://github.com/acme/app/pull/${n}`;++ it.each([+ {+ // The regression: a PR the run just opened is in the session's live+ // output before the task query refetches, so counting the task alone+ // misses it at the turn boundary.+ name: "counts a PR only present in the session's live output",+ manifest: [] as TaskRunArtifact[],+ taskOutput: null,+ cloudOutput: { pr_urls: [pr(1)] },+ expected: 1,+ },+ {+ name: "counts a PR only present in the task output",+ manifest: [] as TaskRunArtifact[],+ taskOutput: { pr_urls: [pr(1)] },+ cloudOutput: null,+ expected: 1,+ },+ {+ name: "counts a PR in both outputs once",+ manifest: [] as TaskRunArtifact[],+ taskOutput: { pr_urls: [pr(1)] },+ cloudOutput: { pr_url: pr(1) },+ expected: 1,+ },+ {+ name: "counts distinct PRs across both outputs",+ manifest: [] as TaskRunArtifact[],+ taskOutput: { pr_urls: [pr(1)] },+ cloudOutput: { pr_urls: [pr(2)] },+ expected: 2,+ },+ {+ name: "adds undismissed output files to the PR count",+ manifest: [file("report.csv")],+ taskOutput: { pr_urls: [pr(1)] },+ cloudOutput: null,+ expected: 2,+ },+ ])("$name", ({ manifest, taskOutput, cloudOutput, expected }) => {+ expect(countArtifacts({ manifest, taskOutput, cloudOutput })).toBe(+ expected,+ );+ });+});diff --git a/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.ts b/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.tsnew file mode 100644index 000000000000..56a210d7c55a--- /dev/null+++ b/products/desktop/packages/ui/src/features/sessions/useSessionArtifactCount.ts@@ -0,0 +1,109 @@+import { groupRunArtifactVersions } from "@posthog/core/canvas/runArtifactSchemas";+import { mergePrUrls, readPrUrls, type TaskRunArtifact } from "@posthog/shared";+import type { Task } from "@posthog/shared/domain-types";+import { useSessionSelector } from "@posthog/ui/features/sessions/sessionStore";+import { useRunArtifacts } from "@posthog/ui/features/sessions/useRunArtifacts";++const NO_ARTIFACTS: TaskRunArtifact[] = [];++function isRunActive(status: string | null | undefined): boolean {+ return status === "queued" || status === "in_progress";+}++/**+ * Whether the agent still has the floor. Callers wait on its falling edge for+ * the moment a turn ends.+ *+ * A session this window is driving answers per turn, through the prompt it has+ * in flight. Run status cannot answer that: a cloud run stays `in_progress`+ * across every turn until the whole run ends, so reading it would hold a+ * between-turns moment open for the length of the session.+ *+ * A run this window is only watching has no turn of its own to read, and there+ * the run's status is the closest thing to one.+ */+export function isAgentWorking({+ hasSession,+ isPromptPending,+ runStatus,+}: {+ /** Whether this window is driving the session, rather than watching a run. */+ hasSession: boolean;+ isPromptPending: boolean;+ runStatus: string | null | undefined;+}): boolean {+ return hasSession ? isPromptPending : isRunActive(runStatus);+}++export function useSessionIsWorking(task: Task | null): boolean {+ const taskId = task?.id;+ const hasSession = useSessionSelector(taskId, (s) => s !== undefined);+ const isPromptPending = useSessionSelector(+ taskId,+ (s) => s?.isPromptPending ?? false,+ );+ const cloudStatus = useSessionSelector(taskId, (s) => s?.cloudStatus);+ return isAgentWorking({+ hasSession,+ isPromptPending,+ runStatus: cloudStatus ?? task?.latest_run?.status,+ });+}++/**+ * The deliverable count from already-resolved sources: undismissed output files+ * in the manifest plus the run's pull requests.+ */+export function countArtifacts({+ manifest,+ taskOutput,+ cloudOutput,+}: {+ manifest: TaskRunArtifact[];+ taskOutput: Record<string, unknown> | null | undefined;+ cloudOutput: Record<string, unknown> | null | undefined;+}): number {+ const files = groupRunArtifactVersions(+ manifest.filter((artifact) => artifact.type === "output"),+ ).filter((group) => !group.dismissed).length;+ // A PR the run just opened lands in the session's live output before the task+ // query refetches, so read both sources and dedupe rather than the task alone,+ // or the count misses the PR at the turn boundary the tip waits on.+ const prs = mergePrUrls(+ readPrUrls(taskOutput),+ readPrUrls(cloudOutput),+ ).length;+ return files + prs;+}++/**+ * How many deliverables a session has produced: the files it uploaded plus the+ * pull requests it opened. What the artifacts panel lists, minus the canvases+ * and the Slack thread, which only the task's thread messages carry - a query+ * this is not worth firing for a count.+ */+export function useSessionArtifactCount(task: Task | null): number {+ const taskId = task?.id;+ const runId = task?.latest_run?.id;+ const cloudStatus = useSessionSelector(taskId, (s) => s?.cloudStatus);+ const sessionArtifacts = useSessionSelector(taskId, (s) => s?.cloudArtifacts);+ const cloudOutput = useSessionSelector(taskId, (s) => s?.cloudOutput);+ const runStatus = cloudStatus ?? task?.latest_run?.status;+ const { data } = useRunArtifacts(taskId, runId, {+ staleTime: 15_000,+ // A finished upload re-keys the query on its own; this only covers a run+ // whose tool events this window never saw.+ refetchInterval: isRunActive(runStatus) ? 120_000 : false,+ });++ // Same order the footer's popover read them in: the fetch is freshest, the+ // session's own copy arrives with the run-status poll, and the task carries+ // the last thing the list said.+ const manifest =+ data ?? sessionArtifacts ?? task?.latest_run?.artifacts ?? NO_ARTIFACTS;+ return countArtifacts({+ manifest,+ taskOutput: task?.latest_run?.output,+ cloudOutput,+ });+}diff --git a/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsxindex 71c666ab1884..100193143784 100644--- a/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx@@ -37,6 +37,7 @@ import {} from "@posthog/ui/features/settings/components/SettingsCard";import { SettingsSelect } from "@posthog/ui/features/settings/components/SettingsSelect";import { AddCustomSoundDialog } from "@posthog/ui/features/settings/sections/AddCustomSoundDialog";+import { TipsSection } from "@posthog/ui/features/settings/sections/TipsSettings";import {type CompletionSound,type CustomSound,@@ -430,6 +431,8 @@ export function NotificationsSettings() {{spokenNarrationEnabled && <VoiceSection />}+ <TipsSection />+<TestSectionbus={bus}notifications={notifications}diff --git a/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.stories.tsx b/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.stories.tsxnew file mode 100644index 000000000000..b28316975189--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.stories.tsx@@ -0,0 +1,27 @@+import { TipsSection } from "@posthog/ui/features/settings/sections/TipsSettings";+import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";+import type { Meta, StoryObj } from "@storybook/react-vite";++const meta: Meta<typeof TipsSection> = {+ title: "Settings/Tips",+ component: TipsSection,+ parameters: { layout: "padded" },+};++export default meta;+type Story = StoryObj<typeof TipsSection>;++/** Nothing dismissed for good yet, so there is nothing to put back. */+export const Default: Story = {};++export const SomethingDismissedForGood: Story = {+ decorators: [+ (Story) => {+ useSettingsStore+ .getState()+ .markHintLearned(TIP_KEYS.sessionArtifactsLocation);+ return <Story />;+ },+ ],+};diff --git a/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.tsxnew file mode 100644index 000000000000..7e09b29b1912--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/sections/TipsSettings.tsx@@ -0,0 +1,76 @@+import { Button, Switch } from "@posthog/quill";+import { ANALYTICS_EVENTS } from "@posthog/shared";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";+import {+ countRetiredHints,+ useSettingsStore,+} from "@posthog/ui/features/settings/settingsStore";+import { toast } from "@posthog/ui/primitives/toast";+import { track } from "@posthog/ui/shell/analytics";++/**+ * The switch over every tip, and a way back from the ones already hidden.+ *+ * It sits with notifications rather than with appearance: both are the app+ * interrupting someone, and notifications is the page a person opens to stop+ * that.+ */+export function TipsSection() {+ const enabled = useSettingsStore((state) => state.tipsEnabled);+ const setTipsEnabled = useSettingsStore((state) => state.setTipsEnabled);+ const resetHints = useSettingsStore((state) => state.resetHints);+ const retiredCount = useSettingsStore((state) =>+ countRetiredHints(state.hints),+ );++ return (+ <SettingsSection label="Tips">+ <SettingsCard>+ <SettingsCardRow+ label="Tips"+ description="Point out a part of the app the first time it matters"+ >+ <Switch+ size="sm"+ checked={enabled}+ onCheckedChange={(checked) => {+ track(ANALYTICS_EVENTS.SETTING_CHANGED, {+ setting_name: "teaching_tips",+ new_value: checked,+ old_value: enabled,+ });+ setTipsEnabled(checked);+ }}+ />+ </SettingsCardRow>++ <SettingsCardRow+ label="Reset tips"+ description={+ retiredCount === 0+ ? "Every tip is still showing"+ : retiredCount === 1+ ? "One tip has stopped showing"+ : `${retiredCount} tips have stopped showing`+ }+ >+ <Button+ size="sm"+ variant="outline"+ disabled={retiredCount === 0}+ onClick={() => {+ resetHints();+ toast.success("Tips are back");+ }}+ >+ Reset+ </Button>+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>+ );+}diff --git a/products/desktop/packages/ui/src/features/settings/settingsStore.test.ts b/products/desktop/packages/ui/src/features/settings/settingsStore.test.tsindex 917bf24fa740..5a8e4338678e 100644--- a/products/desktop/packages/ui/src/features/settings/settingsStore.test.ts+++ b/products/desktop/packages/ui/src/features/settings/settingsStore.test.ts@@ -1,3 +1,4 @@+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";import {flushRendererStateWrites,registerRendererStateStorage,@@ -5,6 +6,8 @@ import {import { beforeEach, describe, expect, it, vi } from "vitest";import {type CompletionSound,+ countRetiredHints,+ DEFAULT_HINT_MAX,DEFAULT_WORKSPACE_MODE,getEffectiveCustomInstructions,useSettingsStore,@@ -576,6 +579,77 @@ describe("feature settingsStore terminal font", () => {});});+describe("feature settingsStore hints", () => {+ beforeEach(async () => {+ await resetPersistenceMocks();++ useSettingsStore.setState({ hints: {}, tipsEnabled: true });+ });++ it.each([+ { label: "a lesson nobody has met", hint: undefined, expected: true },+ {+ label: "a lesson part-way through its showings",+ hint: { count: DEFAULT_HINT_MAX - 1, learned: false },+ expected: true,+ },+ {+ label: "a lesson that has run out of showings",+ hint: { count: DEFAULT_HINT_MAX, learned: false },+ expected: false,+ },+ {+ label: "a lesson already answered",+ hint: { count: 0, learned: true },+ expected: false,+ },+ ])("shouldShowHint is $expected for $label", ({ hint, expected }) => {+ if (hint) useSettingsStore.setState({ hints: { "a-lesson": hint } });++ expect(useSettingsStore.getState().shouldShowHint("a-lesson")).toBe(+ expected,+ );+ });++ // The switch has to reach the toast hints too, not only the anchored tips —+ // they are the same lessons, and it is the only way to stop being taught.+ it("shows no hint at all while tips are switched off", () => {+ useSettingsStore.getState().setTipsEnabled(false);++ expect(useSettingsStore.getState().shouldShowHint("a-lesson")).toBe(false);+ });++ // Reset clears both, so the count that gates it has to see both.+ it.each([+ { label: "answered", hint: { count: 0, learned: true }, expected: 1 },+ {+ label: "out of showings",+ hint: { count: 1, learned: false },+ expected: 1,+ },+ {+ label: "part-way through its showings",+ hint: { count: 0, learned: false },+ expected: 0,+ },+ ])("counts a $label tip as retired: $expected", ({ hint, expected }) => {+ // The steer lesson gets one showing, so a single offer retires it.+ expect(countRetiredHints({ [TIP_KEYS.steerSafeBoundary]: hint })).toBe(+ expected,+ );+ });++ it("brings back a hint that had run out of showings", () => {+ useSettingsStore.setState({+ hints: { "a-lesson": { count: DEFAULT_HINT_MAX, learned: false } },+ });++ useSettingsStore.getState().resetHints();++ expect(useSettingsStore.getState().shouldShowHint("a-lesson")).toBe(true);+ });+});+describe("feature settingsStore hydration", () => {beforeEach(async () => {await resetPersistenceMocks();diff --git a/products/desktop/packages/ui/src/features/settings/settingsStore.ts b/products/desktop/packages/ui/src/features/settings/settingsStore.tsindex ac247c2c7935..d5094be18405 100644--- a/products/desktop/packages/ui/src/features/settings/settingsStore.ts+++ b/products/desktop/packages/ui/src/features/settings/settingsStore.ts@@ -6,6 +6,10 @@ import type {WorkspaceMode,} from "@posthog/shared";import type { EffortLevel } from "@posthog/shared/domain-types";+import {+ TIP_SHOWINGS,+ type TipKey,+} from "@posthog/ui/features/settings/tipKeys";import { electronStorage } from "@posthog/ui/shell/rendererStorage";import { create } from "zustand";import { persist } from "zustand/middleware";@@ -73,11 +77,37 @@ export type TerminalFont =| "system"| "custom";+/**+ * One lesson's history. `count` is how many times it has been offered, for the+ * hints that fade on their own after a few showings; `learned` is the person+ * answering it, which ends it for good.+ */export interface HintState {count: number;learned: boolean;}+/** How many showings a hint gets under a key no longer in `TIP_SHOWINGS`. */+export const DEFAULT_HINT_MAX = 3;++/**+ * Whether a lesson has stopped offering itself: someone answered it, or it ran+ * out of showings. Reset is what brings either back.+ */+function isHintRetired(key: string, hint: HintState | undefined): boolean {+ if (!hint) return false;+ if (hint.learned) return true;+ const showings = TIP_SHOWINGS[key as TipKey];+ if (showings?.kind === "answered-only") return false;+ return hint.count >= (showings?.max ?? DEFAULT_HINT_MAX);+}++/** How many of a person's saved lessons have stopped offering themselves. */+export function countRetiredHints(hints: Record<string, HintState>): number {+ return Object.entries(hints).filter(([key, hint]) => isHintRetired(key, hint))+ .length;+}+/*** Snapshot of the user-level AGENTS.md/CLAUDE.md that personalization syncs* from. Runtime-only: the sync contribution re-reads the file on boot and@@ -255,11 +285,17 @@ interface SettingsStore {setDownloadUpdatesAutomatically: (enabled: boolean) => void;setDismissibleUpdateBanners: (enabled: boolean) => void;- // Onboarding hints+ // Onboarding hints, both the toasts and the anchored tipshints: Record<string, HintState>;- shouldShowHint: (key: string, max?: number) => boolean;+ // One switch over every lesson, separate from the per-lesson answers in+ // `hints`, so turning it back on restores whatever was left unanswered+ // rather than everything.+ tipsEnabled: boolean;+ shouldShowHint: (key: string) => boolean;recordHintShown: (key: string) => void;markHintLearned: (key: string) => void;+ resetHints: () => void;+ setTipsEnabled: (enabled: boolean) => void;_hasHydrated: boolean;setHasHydrated: (hydrated: boolean) => void;@@ -486,11 +522,9 @@ export const useSettingsStore = create<SettingsStore>()(// Onboarding hintshints: {},- shouldShowHint: (key, max = 3) => {- const hint = get().hints[key];- if (!hint) return true;- return !hint.learned && hint.count < max;- },+ tipsEnabled: true,+ shouldShowHint: (key) =>+ get().tipsEnabled && !isHintRetired(key, get().hints[key]),recordHintShown: (key) =>set((state) => {const current = state.hints[key] ?? { count: 0, learned: false };@@ -511,6 +545,11 @@ export const useSettingsStore = create<SettingsStore>()(},};}),+ // Answering a lesson is otherwise a one-way door, and the lessons point+ // at parts of the app a person may well come back to. Clears the offer+ // counts too, so a hint that ran out of showings comes back as well.+ resetHints: () => set({ hints: {} }),+ setTipsEnabled: (enabled) => set({ tipsEnabled: enabled }),_hasHydrated: false,setHasHydrated: (hydrated) => set({ _hasHydrated: hydrated }),@@ -609,6 +648,7 @@ export const useSettingsStore = create<SettingsStore>()(// Onboarding hintshints: state.hints,+ tipsEnabled: state.tipsEnabled,}),onRehydrateStorage: () => (state, error) => {if (error) {diff --git a/products/desktop/packages/ui/src/features/settings/tipKeys.ts b/products/desktop/packages/ui/src/features/settings/tipKeys.tsnew file mode 100644index 000000000000..f0ef058d67ff--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/tipKeys.ts@@ -0,0 +1,46 @@+/**+ * Every lesson the app teaches, keyed. The key is what `settingsStore.hints`+ * remembers an answer against, so a key names the lesson rather than the place+ * it is taught from: when the thing it points at moves, change the key here and+ * everyone is offered the lesson once more in its new home.+ *+ * Changing a key is the whole migration. The old key is left behind in a+ * person's saved hints, unread; people who switched tips off stay quiet either+ * way, which is what they asked for.+ */+export const TIP_KEYS = {+ /** Where a session's artifacts land. */+ sessionArtifactsLocation: "session-artifacts-location",+ /** Long pasted text became an inline block. */+ pasteInline: "paste-inline",+ /** Long pasted text became a file attachment. */+ pasteAsFile: "paste-as-file",+ /** Arrow keys walk back through your sent messages. */+ recallMessageNav: "recall-message-nav",+ /** A steered message waits for the run to reach a safe boundary. */+ steerSafeBoundary: "steer-safe-boundary",+} as const;++export type TipKey = (typeof TIP_KEYS)[keyof typeof TIP_KEYS];++/**+ * How a lesson stops offering itself. The toast hints fade after a few+ * showings; the anchored tips never count showings at all, and only the person+ * answering ends them, so a limit would mean nothing to them.+ */+export type TipShowings =+ | { kind: "counted"; max: number }+ | { kind: "answered-only" };++/**+ * Every lesson's stopping rule, keyed the same way, so it is readable from+ * anywhere rather than only from the call site that teaches it. Settings needs+ * it to tell a tip that has stopped showing from one still waiting to be seen.+ */+export const TIP_SHOWINGS: Record<TipKey, TipShowings> = {+ [TIP_KEYS.sessionArtifactsLocation]: { kind: "answered-only" },+ [TIP_KEYS.pasteInline]: { kind: "counted", max: 3 },+ [TIP_KEYS.pasteAsFile]: { kind: "counted", max: 3 },+ [TIP_KEYS.recallMessageNav]: { kind: "counted", max: 3 },+ [TIP_KEYS.steerSafeBoundary]: { kind: "counted", max: 1 },+};diff --git a/products/desktop/packages/ui/src/primitives/ArtifactCard.test.tsx b/products/desktop/packages/ui/src/primitives/ArtifactCard.test.tsxnew file mode 100644index 000000000000..914a0e6ef2a4--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/ArtifactCard.test.tsx@@ -0,0 +1,37 @@+import { render, screen } from "@testing-library/react";+import { describe, expect, it } from "vitest";+import { ArtifactCard } from "./ArtifactCard";++describe("ArtifactCard", () => {+ it("is an interactive button when it can open", () => {+ render(<ArtifactCard icon={null} title="report.csv" onOpen={() => {}} />);++ const card = screen.getByRole("button", { name: "View report.csv" });+ expect(card).toHaveAttribute("tabindex", "0");+ expect(card).not.toHaveAttribute("aria-disabled");+ });++ it("stays a plain container with active actions when it cannot open", () => {+ render(+ <ArtifactCard+ icon={null}+ title="report.csv"+ actions={+ <button type="button" onClick={() => {}}>+ See all+ </button>+ }+ />,+ );++ // No button role or disabled state on the inert card, so the action inside+ // it is not inherited as disabled by assistive technology.+ expect(+ screen.queryByRole("button", { name: "View report.csv" }),+ ).toBeNull();+ const card = screen.getByText("report.csv").closest("[data-artifact-card]");+ expect(card).not.toHaveAttribute("role");+ expect(card).not.toHaveAttribute("aria-disabled");+ expect(screen.getByRole("button", { name: "See all" })).toBeEnabled();+ });+});diff --git a/products/desktop/packages/ui/src/primitives/ArtifactCard.tsx b/products/desktop/packages/ui/src/primitives/ArtifactCard.tsxnew file mode 100644index 000000000000..6bd14cb75342--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/ArtifactCard.tsx@@ -0,0 +1,105 @@+import { cn } from "@posthog/quill";+import type { ReactNode } from "react";++/**+ * One artifact card. When it can open, the whole card is the open control: a+ * `role="button"` div rather than a `<button>`, because the version picker and+ * the trailing actions are real buttons and HTML forbids nesting those (see+ * NestedButton for the same call). With no open action it is a plain container,+ * so an active button inside it (like "See all") is not announced as disabled.+ * Inner controls stop propagation so they don't open it.+ *+ * Shared by the artifacts panel and the cards the thread draws inline, so a+ * file reads the same wherever it is shown.+ */+export function ArtifactCard({+ icon,+ title,+ meta,+ onOpen,+ onHoverStart,+ actions,+ className,+}: {+ icon: ReactNode;+ title: string;+ meta?: ReactNode;+ onOpen?: () => void;+ onHoverStart?: () => void;+ /** Always-visible trailing cluster: comment badge, download, open externally. */+ actions?: ReactNode;+ className?: string;+}) {+ const body = (+ <>+ <div className="relative flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-md bg-gray-4">+ {/* The icon again, blown up and blurred: the tile tints itself with+ the icon's own colors, so new icons never need a color mapping. */}+ <div+ aria-hidden+ className="absolute inset-0 flex scale-[2.4] items-center justify-center opacity-40 blur-[9px] saturate-[1.8] dark:opacity-70"+ >+ {icon}+ </div>+ <div className="relative flex items-center justify-center">{icon}</div>+ </div>+ <div className="min-w-0 flex-1">+ <div className="truncate font-medium">{title}</div>+ {meta && (+ <div className="flex items-center gap-1 whitespace-nowrap text-[12px] text-muted-foreground">+ {meta}+ </div>+ )}+ </div>+ {actions && (+ <div className="flex shrink-0 items-center gap-1">{actions}</div>+ )}+ </>+ );++ const baseClass =+ "flex w-full items-center gap-2.5 rounded-lg border border-border bg-muted py-2 pr-1.5 pl-2 text-[13px] transition-colors";++ // With no open action the card is inert, so it stays a plain container: no+ // button role or disabled state for the actions inside it to inherit.+ if (!onOpen) {+ return (+ <div data-artifact-card className={cn(baseClass, className)}>+ {body}+ </div>+ );+ }++ return (+ // biome-ignore lint/a11y/useSemanticElements: nested real buttons forbid a <button> card+ <div+ data-artifact-card+ role="button"+ tabIndex={0}+ aria-label={`View ${title}`}+ className={cn(+ baseClass,+ "cursor-pointer hover:border-gray-6 hover:bg-gray-3",+ className,+ )}+ onClick={onOpen}+ onKeyDown={(event) => {+ // Only the card itself: inner controls' key presses bubble up here.+ if (event.target !== event.currentTarget) return;+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ onOpen();+ }+ }}+ onPointerEnter={onHoverStart}+ onFocus={onHoverStart}+ >+ {body}+ </div>+ );+}++/** Inner controls of a card: their clicks must not open the card behind them. */+export function stopCardOpen(event: { stopPropagation: () => void }): void {+ event.stopPropagation();+}diff --git a/products/desktop/packages/ui/src/primitives/ArtifactChip.tsx b/products/desktop/packages/ui/src/primitives/ArtifactChip.tsxnew file mode 100644index 000000000000..1c21410461d3--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/ArtifactChip.tsx@@ -0,0 +1,76 @@+import { DownloadSimpleIcon } from "@phosphor-icons/react";+import { Button, buttonGroupVariants, cn } from "@posthog/quill";+import { FileIcon } from "@posthog/ui/primitives/FileIcon";+import { Tooltip } from "@posthog/ui/primitives/Tooltip";+import type { ReactNode } from "react";++/**+ * A file, wherever it is named: in a message, on an activity row. Opens in an+ * artifact tab, with a joined half for saving it to disk.+ *+ * Presentation only, so both surfaces can hand it their own handlers - and so+ * a file reads the same in both places.+ */+export function ArtifactChip({+ label,+ name,+ meta,+ onOpen,+ onDownload,+ downloading,+ disabled,+}: {+ label: ReactNode;+ name?: string;+ /** Trailing muted detail: a size in a message, a version on an activity row. */+ meta?: ReactNode;+ onOpen?: () => void;+ onDownload?: () => void;+ downloading?: boolean;+ disabled?: boolean;+}) {+ return (+ // quill's ButtonGroup is a div, and this renders inside a message's+ // paragraph, so the group's own contract is spelled out on a span instead.+ // The halves stay siblings for the same reason: no button within a button.+ // biome-ignore lint/a11y/useSemanticElements: <fieldset> is block-level and this sits in a paragraph+ <span+ role="group"+ data-quill+ data-slot="button-group"+ data-orientation="horizontal"+ className={cn(+ buttonGroupVariants(),+ "mx-0.5 inline-flex max-w-full align-middle",+ )}+ >+ <Button+ onClick={onOpen}+ disabled={disabled || !onOpen}+ aria-label={name ? `Open ${name}` : undefined}+ // Quill's base button is `shrink-0`; restore shrinking so a long name+ // truncates inside a narrow message or activity row instead of pushing+ // the download half out of reach.+ className="min-w-0 shrink"+ variant="outline"+ >+ {typeof name === "string" && <FileIcon filename={name} size={12} />}+ <span className="min-w-0 truncate">{label}</span>+ {meta && <span className="shrink-0 text-muted-foreground">{meta}</span>}+ </Button>+ {onDownload && (+ <Tooltip content={downloading ? "Downloading…" : "Download"}>+ <Button+ size="icon"+ variant="outline"+ onClick={onDownload}+ disabled={downloading}+ aria-label={name ? `Download ${name}` : "Download"}+ >+ <DownloadSimpleIcon size={12} />+ </Button>+ </Tooltip>+ )}+ </span>+ );+}diff --git a/products/desktop/packages/ui/src/primitives/TeachingTip.test.tsx b/products/desktop/packages/ui/src/primitives/TeachingTip.test.tsxnew file mode 100644index 000000000000..351ac93a96a6--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/TeachingTip.test.tsx@@ -0,0 +1,118 @@+import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { Theme } from "@radix-ui/themes";+import {+ act,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";+import { beforeEach, describe, expect, it } from "vitest";+import { TeachingTip } from "./TeachingTip";++const settings = () => useSettingsStore.getState();++beforeEach(() => {+ // The persisted answers are shared with the toast hints and with every other+ // test in the run, and nothing is taught until they have landed.+ useSettingsStore.setState({+ hints: {},+ tipsEnabled: true,+ _hasHydrated: true,+ });+});++function tip(id: string, open: boolean, moment?: number) {+ return (+ <Theme>+ <TeachingTip+ id={id}+ open={open}+ moment={moment}+ message="New artifacts show up here"+ >+ <button type="button">Artifacts</button>+ </TeachingTip>+ </Theme>+ );+}++const findTip = () => screen.findByText("New artifacts show up here");+const expectNoTip = () =>+ waitFor(() =>+ expect(screen.queryByText("New artifacts show up here")).toBeNull(),+ );++describe("TeachingTip", () => {+ // The caller's `open` can hold across several occasions (the artifacts mark+ // stays up until the panel is opened), so closing the tip without answering+ // it used to end the lesson for good with no way back.+ it("comes back for the next occasion after being closed unanswered", async () => {+ const { rerender } = render(tip("tip-closed", true, 1));+ await findTip();++ fireEvent.keyDown(document.body, { key: "Escape" });+ await expectNoTip();++ rerender(tip("tip-closed", true, 2));++ await findTip();+ });++ it("stays away for the next occasion once hidden", async () => {+ const { rerender } = render(tip("tip-hidden", true, 1));+ await findTip();++ fireEvent.click(screen.getByText("Hide"));+ await expectNoTip();++ rerender(tip("tip-hidden", true, 2));++ await expectNoTip();+ });++ // "Hide" writes the same `hints` entry the toast hints answer, so a lesson+ // learned from either surface ends for both.+ it("stays away once learned from outside the tip", async () => {+ act(() => settings().markHintLearned("tip-learned"));+ render(tip("tip-learned", true));++ await expectNoTip();+ });++ // Otherwise every restart flashes the tips someone has already hidden,+ // between the first render and the persisted answers landing.+ it("teaches nothing before the persisted answers have landed", async () => {+ act(() => useSettingsStore.setState({ _hasHydrated: false }));+ render(tip("tip-unhydrated", true));++ await expectNoTip();+ });++ // The switch is one answer over every lesson, and turning it back on must+ // leave the per-lesson answers alone.+ it("teaches nothing while tips are switched off", async () => {+ const { rerender } = render(tip("tip-switched-off", true));+ await findTip();++ act(() => settings().setTipsEnabled(false));+ await expectNoTip();++ act(() => settings().setTipsEnabled(true));+ rerender(tip("tip-switched-off", true));++ await findTip();+ });++ // Hiding is otherwise a one-way door, which is what settings offers a way+ // back from.+ it("offers a hidden tip again after a reset", async () => {+ act(() => settings().markHintLearned("tip-reset"));+ render(tip("tip-reset", true));+ await expectNoTip();++ act(() => settings().resetHints());++ await findTip();+ });+});diff --git a/products/desktop/packages/ui/src/primitives/TeachingTip.tsx b/products/desktop/packages/ui/src/primitives/TeachingTip.tsxnew file mode 100644index 000000000000..68c8ffb6fdfb--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/TeachingTip.tsx@@ -0,0 +1,107 @@+import { Popover as BaseUIPopover } from "@base-ui/react/popover";+import {+ Button,+ cn,+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@posthog/quill";+import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import type { ReactNode } from "react";+import { useState } from "react";++function ArrowGlyph() {+ return (+ <svg width="14" height="8" viewBox="0 0 14 8" aria-hidden>+ <title>Arrow</title>+ <path d="M0 0 L7 7 L14 0" fill="var(--card)" />+ <path+ d="M0 0 L7 7 L14 0"+ fill="none"+ stroke="currentColor"+ strokeWidth="1"+ />+ </svg>+ );+}++/**+ * A one-off callout anchored to the control it teaches. The caller decides when+ * the moment is right; the tip decides whether it has already been answered.+ */+export function TeachingTip({+ id,+ open,+ moment,+ message,+ side = "bottom",+ align = "end",+ className,+ children,+}: {+ /** Stable key for this lesson, from `TIP_KEYS`. Answered permanently, per person. */+ id: string;+ open: boolean;+ /**+ * Distinguishes occasions when `open` stays true across several of them, so a+ * tip put away for one comes back for the next.+ */+ moment?: string | number;+ message: ReactNode;+ side?: "top" | "bottom" | "left" | "right";+ align?: "start" | "center" | "end";+ className?: string;+ children: ReactNode;+}) {+ const offerable = useSettingsStore((state) => state.shouldShowHint(id));+ // Wait for persisted answers, or a restart would flash already-hidden tips.+ const hydrated = useSettingsStore((state) => state._hasHydrated);+ const markLearned = useSettingsStore((state) => state.markHintLearned);+ // Dismissing without answering (click outside, Escape) hides for this occasion+ // only; the next occasion lifts it. Only "Hide" ends the lesson.+ const [hidden, setHidden] = useState(false);+ const [offered, setOffered] = useState({ open, moment });+ if (offered.open !== open || offered.moment !== moment) {+ setOffered({ open, moment });+ if (open) setHidden(false);+ }+ const showing = open && offerable && hydrated && !hidden;++ return (+ <Popover+ open={showing}+ onOpenChange={(next) => {+ if (!next) setHidden(true);+ }}+ >+ {/* Wrap the control instead of making it the trigger: it may already be a+ trigger for something else. tabIndex={-1} keeps the wrapper out of the+ tab order in front of the real control. */}+ <PopoverTrigger+ tabIndex={-1}+ nativeButton={false}+ render={<span className={cn("inline-flex", className)} />}+ >+ {children}+ </PopoverTrigger>+ {/* Opens on its own when a turn ends, so it must not steal focus from a+ reader who may be typing. */}+ <PopoverContent+ side={side}+ align={align}+ initialFocus={false}+ className="w-56 gap-2 border-primary"+ >+ <BaseUIPopover.Arrow className="data-[side=bottom]:-top-[6px] data-[side=left]:-right-[6px] data-[side=right]:-left-[6px] data-[side=top]:-bottom-[6px] data-[side=right]:-rotate-90 text-primary data-[side=bottom]:rotate-180 data-[side=left]:rotate-90">+ <ArrowGlyph />+ </BaseUIPopover.Arrow>+ <p className="text-[13px]">{message}</p>+ <div className="flex justify-start gap-1">+ <Button size="sm" variant="primary" onClick={() => markLearned(id)}>+ Hide+ </Button>+ </div>+ </PopoverContent>+ </Popover>+ );+}diff --git a/products/desktop/packages/ui/src/primitives/hintToast.test.ts b/products/desktop/packages/ui/src/primitives/hintToast.test.tsnew file mode 100644index 000000000000..b3fd904d1619--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/hintToast.test.ts@@ -0,0 +1,57 @@+import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { TIP_KEYS } from "@posthog/ui/features/settings/tipKeys";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { hintToast } from "./hintToast";++/** One showing in `TIP_SHOWINGS`; the paste lesson gets three. */+const STEER = TIP_KEYS.steerSafeBoundary;+const PASTE = TIP_KEYS.pasteAsFile;++const quillToast = vi.hoisted(() => ({ info: vi.fn() }));+vi.mock("@posthog/ui/primitives/toast", () => ({ toast: quillToast }));++beforeEach(() => {+ vi.clearAllMocks();+ useSettingsStore.setState({+ hints: {},+ tipsEnabled: true,+ toastNotifications: true,+ });+});++describe("hintToast", () => {+ // A plain toast.info fires every time the thing it explains happens, so the+ // twentieth steer still gets told what steering does.+ it("stops offering a lesson after its last showing", () => {+ hintToast(STEER, "Steering waits", "It applies later");+ hintToast(STEER, "Steering waits", "It applies later");++ expect(quillToast.info).toHaveBeenCalledTimes(1);+ });++ it("stops offering a lesson once hidden, before its showings run out", () => {+ hintToast(PASTE, "Pasted as a file", "It uploads with the message");+ const options = quillToast.info.mock.calls[0][1];+ options.action.onClick();++ hintToast(PASTE, "Pasted as a file", "It uploads with the message");++ expect(quillToast.info).toHaveBeenCalledTimes(1);+ expect(useSettingsStore.getState().hints[PASTE]?.learned).toBe(true);+ });++ // With toasts off the tip never reaches the screen, so the steer lesson must not+ // burn its one offer; it comes back once toasts are on again.+ it("does not spend a showing while toast notifications are off", () => {+ useSettingsStore.setState({ toastNotifications: false });+ hintToast(STEER, "Steering waits", "It applies later");++ expect(quillToast.info).not.toHaveBeenCalled();+ expect(useSettingsStore.getState().hints[STEER]).toBeUndefined();++ useSettingsStore.setState({ toastNotifications: true });+ hintToast(STEER, "Steering waits", "It applies later");++ expect(quillToast.info).toHaveBeenCalledTimes(1);+ });+});diff --git a/products/desktop/packages/ui/src/primitives/hintToast.ts b/products/desktop/packages/ui/src/primitives/hintToast.tsnew file mode 100644index 000000000000..5e04c13df694--- /dev/null+++ b/products/desktop/packages/ui/src/primitives/hintToast.ts@@ -0,0 +1,38 @@+import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";+import { type ToastOptions, toast } from "@posthog/ui/primitives/toast";++/**+ * A toast that teaches something, keyed so it stops once the lesson has landed.+ *+ * The alternative is a plain `toast.info`, which fires every single time the+ * thing it explains happens: the twentieth steer does not need to be told what+ * steering does. Same keyed `hints` the anchored tips answer to, so both stop+ * together from the tips switch in settings, and both come back from its reset.+ *+ * Reach for `TeachingTip` instead when the lesson is "this is where that went":+ * a toast in the corner cannot point at anything.+ */+export function hintToast(+ /** Stable key for this lesson, from `TIP_KEYS`. */+ key: string,+ title: string,+ detail?: string | ToastOptions,+): void {+ const store = useSettingsStore.getState();+ if (!store.shouldShowHint(key)) return;+ // Toasts off means this never reaches the screen, so don't spend the hint's+ // offer count on it; it is offered again once toasts come back on.+ if (!store.toastNotifications) return;+ store.recordHintShown(key);+ const options: ToastOptions =+ typeof detail === "string" ? { description: detail } : (detail ?? {});+ toast.info(title, {+ ...options,+ // A way to end the lesson now rather than sitting through its remaining+ // showings. Settings puts back anything hidden here.+ action: options.action ?? {+ label: "Hide",+ onClick: () => useSettingsStore.getState().markHintLearned(key),+ },+ });+}diff --git a/products/desktop/pnpm-lock.yaml b/products/desktop/pnpm-lock.yamlindex 93a7eed9327a..5fea1ac6282c 100644--- a/products/desktop/pnpm-lock.yaml+++ b/products/desktop/pnpm-lock.yaml@@ -28,8 +28,8 @@ catalogs:specifier: ^2.1.10version: 2.1.10'@posthog/quill':- specifier: 0.3.0-beta.26- version: 0.3.0-beta.26+ specifier: 0.3.0-beta.28+ version: 0.3.0-beta.28'@radix-ui/themes':specifier: ^3.2.1version: 3.3.0@@ -215,7 +215,7 @@ importers:version: link:../../packages/quick-ask'@posthog/quill':specifier: 'catalog:'- version: 0.3.0-beta.26(@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 0.3.0-beta.28(@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])'@posthog/shared':specifier: workspace:*version: link:../../packages/shared@@ -1389,8 +1389,8 @@ importers:specifier: workspace:*version: link:../platform'@posthog/quill-charts':- specifier: 0.3.0-beta.19+ specifier: 0.3.0-beta.28'@posthog/shared':specifier: workspace:*version: link:../shared@@ -1544,7 +1544,7 @@ importers:'@posthog/quill':specifier: 'catalog:'- version: 0.3.0-beta.26(@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 0.3.0-beta.28(@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])'@posthog/tsconfig':specifier: workspace:*version: link:../../tooling/typescript@@ -6302,14 +6302,14 @@ packages:'@posthog/[email protected]':resolution: {integrity: sha512-vCbaFeuwf9Pc0gI5bkCGvkOn2Bxru2KbZJtOa6loTJjanCNoMsjECEPijr7X5oln1IIg+VKnGiwV4tKY2b7NuQ==}- '@posthog/[email protected]':- resolution: {integrity: sha512-SqZQr+zclHTjdCeZQh+mrH9nzZk1dFDPC9++1QYh0IdMa/dEFzxCkQgIuY7BpRsPv4YIB5WlTIB4XT/BujR2xA==}+ '@posthog/[email protected]':+ resolution: {integrity: sha512-6C0MDyfmbPuxusWflJ2NPD9DpDGJBKSjMUnp6wn7GxRsXnnxGMGhAxjU9Vl2EpvM1QxL7IsargJj74GQAWEjsQ==}peerDependencies:react: 19.2.6react-dom: 19.2.6- '@posthog/[email protected]':- resolution: {integrity: sha512-ZRMrY38pfdpB9hIJZ3yQI0XhXsovpE7c25ULnzZFI3jnj3lsYselt0SHvViuI2OdX/BDX0GePxk0uXfD3WusJg==}+ '@posthog/[email protected]':+ resolution: {integrity: sha512-FFKyvNecHq+EU1KC3s8wEH0yuRdT/9mmMosvrUXnHP9RVIvscoS/DGBifUa0I1aI+I9HI2lVFp8GUUj1T+Q9mQ==}engines: {node: '>=20'}peerDependencies:'@base-ui/react': ^1.3.0@@ -21028,7 +21028,7 @@ snapshots:dependencies:cross-spawn: 7.0.6dependencies:d3-array: 3.2.4@@ -21040,7 +21040,7 @@ snapshots:react-dom: 19.2.6([email protected])simple-statistics: 7.8.9- '@posthog/[email protected](@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])':+ '@posthog/[email protected](@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])':dependencies:'@base-ui/react': 1.3.0(@types/[email protected])([email protected]([email protected]))([email protected])class-variance-authority: 0.7.1@@ -21052,7 +21052,7 @@ snapshots:tailwind-merge: 2.6.1tailwindcss: 4.2.2- '@posthog/[email protected](@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])':+ '@posthog/[email protected](@base-ui/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected])':dependencies:'@base-ui/react': 1.3.0(@types/[email protected])([email protected]([email protected]))([email protected])class-variance-authority: 0.7.1diff --git a/products/desktop/pnpm-workspace.yaml b/products/desktop/pnpm-workspace.yamlindex 84048a5db52c..0c7f81c3c581 100644--- a/products/desktop/pnpm-workspace.yaml+++ b/products/desktop/pnpm-workspace.yaml@@ -13,7 +13,7 @@ catalog:'@earendil-works/pi-tui': 0.84.1'@parcel/watcher': ^2.5.6'@phosphor-icons/react': ^2.1.10- '@posthog/quill': 0.3.0-beta.26+ '@posthog/quill': 0.3.0-beta.28'@radix-ui/themes': ^3.2.1'@tanstack/react-query': ^5.100.14'@tanstack/react-router': ^1.170.10