Skip to content

The agent that grows with you

fix(desktop): theme inline code at the markdown renderer root

teknium15f1e6a8278d9
diff --git a/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx b/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx
index 5ee1206fa66..aab8867ad2a 100644
--- a/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx
@@ -1,3 +1,7 @@
+import { readFileSync } from 'node:fs'
+import { dirname, resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
import { AssistantRuntimeProvider, type ThreadMessage, useExternalStoreRuntime } from '@assistant-ui/react'
import { cleanup, fireEvent, render } from '@testing-library/react'
import { afterEach, describe, expect, it } from 'vitest'
@@ -46,6 +50,31 @@ function expectTimestampSeparated(container: HTMLElement, precedingText: string)
afterEach(cleanup)
+describe('background report inline code', () => {
+ // The report body is the same `aui-md prose` markdown renderer the
+ // assistant turn uses, rendered with no assistant/room slot ancestor. The
+ // real stylesheet's cascade must still reach its `<code>`, or Tailwind
+ // Typography's fixed near-black ink wins on every dark theme (#107486).
+ const stylesheet = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../../styles.css'), 'utf8')
+
+ it('themes inline code in an opened report with the chat inline-code tokens', () => {
+ const { container, getByRole } = render(
+ <>
+ <style>{stylesheet}</style>
+ <Harness asyncResult="run `discover_models` first" text="1 background agent finished" />
+ </>
+ )
+
+ fireEvent.click(getByRole('button', { name: '1 background agent finished' }))
+ const code = container.querySelector('[data-role="system"] :not(pre) > code')
+ expect(code).toBeTruthy()
+ const style = getComputedStyle(code as Element)
+
+ expect(style.color).toBe('var(--ui-inline-code-foreground)')
+ expect(style.background).toBe('var(--ui-inline-code-background)')
+ })
+})
+
describe('background report disclosure', () => {
it('keeps result bodies out of the transcript until opened and removes them when collapsed', () => {
const report = '{"blockers":[{"title":"Local-model readiness uses the wrong endpoint"}]}'
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 3778c25e82e..6e033f39ec4 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -1995,7 +1995,10 @@ body.guest-pointer-lock :is(webview, iframe) {
mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 1.5rem), rgb(0 0 0 / 64%) 100%);
}
-[data-slot='aui_assistant-message-content'] .aui-md :not(pre) > code,
+/* Themed at the renderer root so every `aui-md` consumer (assistant turns,
+ system-message reports, session-import previews) inherits it; the room
+ selector covers the plugin's raw-Streamdown fallback, which has no `.aui-md`. */
+.aui-md :not(pre) > code,
[data-slot='group-chat-message-content'] :not(pre) > code {
background: var(--ui-inline-code-background);
color: var(--ui-inline-code-foreground);