diff --git a/packages/app/src/session/timeline/cache.ts b/packages/app/src/session/timeline/cache.ts index d729039d6b0..70422378c4a 100644 --- a/packages/app/src/session/timeline/cache.ts +++ b/packages/app/src/session/timeline/cache.ts @@ -131,6 +131,9 @@ export function createTimelineCache( get agents() { return agents() }, + get copyAlwaysVisible() { + return data.copyAlwaysVisible + }, get backgroundCompaction() { return backgroundCompaction() }, diff --git a/packages/app/src/shell/routes/session-ui-provider.tsx b/packages/app/src/shell/routes/session-ui-provider.tsx index 588b041e270..58feb2fa724 100644 --- a/packages/app/src/shell/routes/session-ui-provider.tsx +++ b/packages/app/src/shell/routes/session-ui-provider.tsx @@ -39,6 +39,8 @@ export function SessionUIProvider( const language = useLanguage() const settings = useSettings() const directory = () => props.directory + const releaseChannel = import.meta.env.VITE_OPENCODE_CHANNEL ?? "local" + const copyAlwaysVisible = releaseChannel === "dev" || releaseChannel === "local" const readImage = createMemo(() => { const dir = directory() @@ -208,6 +210,7 @@ export function SessionUIProvider( directory={directory()} sessionID={params.id} agents={settings.visibility.customAgents()} + copyAlwaysVisible={copyAlwaysVisible} shellRunning={(id) => !!data.shell.get(id)} shellOutput={(input) => serverSDK.api.shell.output(input)} readMedia={(uri, mime, signal) => serverSDK.media.load(uri, mime, signal)} diff --git a/packages/session-ui/src/components/message-part.css b/packages/session-ui/src/components/message-part.css index 09825d29d9d..0458f237a75 100644 --- a/packages/session-ui/src/components/message-part.css +++ b/packages/session-ui/src/components/message-part.css @@ -582,10 +582,20 @@ justify-content: flex-start; gap: 4px; - /* Hover actions show and hide at once, without a fade. */ + /* Production keeps the whole footer hover-only. Dev channels keep the copy control visible and + hide only the metadata. Keeping the metadata in flow means the copy control does not move. */ @media (hover: hover) { - opacity: 0; - pointer-events: none; + &:not([data-copy-always-visible]) { + opacity: 0; + pointer-events: none; + } + } + + &[data-copy-always-visible] [data-slot="text-part-meta"] { + @media (hover: hover) { + opacity: 0; + pointer-events: none; + } } [data-component="tooltip-v2-trigger"] { @@ -663,6 +673,12 @@ opacity: 1; pointer-events: auto; } + + &:hover [data-slot="text-part-copy-wrapper"][data-copy-always-visible] [data-slot="text-part-meta"], + &:focus-within [data-slot="text-part-copy-wrapper"][data-copy-always-visible] [data-slot="text-part-meta"] { + opacity: 1; + pointer-events: auto; + } } [data-timeline-row="AssistantPart"][data-timeline-spacing="content"] [data-component="text-part"] { diff --git a/packages/session-ui/src/context/data.tsx b/packages/session-ui/src/context/data.tsx index 4398bcd1291..c1ba20b9097 100644 --- a/packages/session-ui/src/context/data.tsx +++ b/packages/session-ui/src/context/data.tsx @@ -72,6 +72,8 @@ export const { sessionID?: string /** Whether message meta names the agent; the app follows its Show agent setting. Defaults to true. */ agents?: boolean + /** Whether the assistant copy control stays visible at rest; the app enables this on dev/local builds. */ + copyAlwaysVisible?: boolean shellRunning?: (id: string) => boolean shellOutput?: (input: ShellOutputInput) => Promise turnDiff?: TurnDiffSource @@ -95,6 +97,9 @@ export const { get agents() { return props.agents ?? true }, + get copyAlwaysVisible() { + return props.copyAlwaysVisible === true + }, get backgroundCompaction() { return props.backgroundCompaction === true }, diff --git a/packages/session-ui/src/message/message-content.tsx b/packages/session-ui/src/message/message-content.tsx index f85eb16fb17..dc5fff005c3 100644 --- a/packages/session-ui/src/message/message-content.tsx +++ b/packages/session-ui/src/message/message-content.tsx @@ -1213,7 +1213,11 @@ export function AssistantTextContent(props: { function copyFooter() { return ( -
+