Multiplayer agent harness for work.
Improve chat Markdown tables, links, and spacing (#1181)
Regan Belled615e4df43b
diff --git a/docs/screenshots/markdown/after-dark.png b/docs/screenshots/markdown/after-dark.pngnew file mode 100644index 000000000..a5d9e7fbaBinary files /dev/null and b/docs/screenshots/markdown/after-dark.png differdiff --git a/docs/screenshots/markdown/after-light.png b/docs/screenshots/markdown/after-light.pngnew file mode 100644index 000000000..cb526b8ebBinary files /dev/null and b/docs/screenshots/markdown/after-light.png differdiff --git a/docs/screenshots/markdown/after-mobile.png b/docs/screenshots/markdown/after-mobile.pngnew file mode 100644index 000000000..4612f826fBinary files /dev/null and b/docs/screenshots/markdown/after-mobile.png differdiff --git a/docs/screenshots/markdown/before-dark.png b/docs/screenshots/markdown/before-dark.pngnew file mode 100644index 000000000..2d473371fBinary files /dev/null and b/docs/screenshots/markdown/before-dark.png differdiff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.cssindex 73a6c74d1..da51ae2ad 100644--- a/plugins/web-ui/src/shell.css+++ b/plugins/web-ui/src/shell.css@@ -17,6 +17,7 @@--meta-lane: 24px;--brand-accent: #4f46e5;--dev-accent: #8a5a00;+ --markdown-link: #2563b8;--brand-mark: none;--cta: oklch(0.27 0.062 250);--cta-hover: oklch(0.33 0.07 250);@@ -27,6 +28,7 @@}.dark {+ --markdown-link: #4c8edb;--cta: oklch(0.42 0.085 250);--cta-hover: oklch(0.48 0.09 250);--cta-foreground: oklch(0.99 0 0);@@ -1738,6 +1740,58 @@ a.chat-row-open {.user-bubble markdown-block {display: block;}+:is(.assistant-body, .user-bubble) markdown-block a {+ color: var(--markdown-link);+ text-decoration: underline;+ text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);+ text-underline-offset: 0.2em;+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td) a {+ text-decoration: none;+}+:is(.assistant-body, .user-bubble) markdown-block a:is(:hover, :focus-visible) {+ text-decoration: underline;+ text-decoration-color: currentColor;+}+:is(.assistant-body, .user-bubble) markdown-block a:focus-visible {+ outline: 2px solid currentColor;+ outline-offset: 3px;+ border-radius: 2px;+}+:is(.assistant-body, .user-bubble) markdown-block .overflow-x-auto:has(> table) {+ margin-block: 1.5em;+ border: 0;+ border-radius: 0;+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td) {+ padding: 0.8em 1em;+ border: 0;+ border-bottom: 1px solid color-mix(in srgb, var(--foreground) 9%, transparent);+ background: transparent;+ vertical-align: top;+ font-variant-numeric: tabular-nums;+}+:is(.assistant-body, .user-bubble) markdown-block th {+ border-bottom-color: color-mix(in srgb, var(--foreground) 20%, transparent);+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td):first-child {+ padding-inline-start: 0;+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td):last-child {+ padding-inline-end: 0;+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td)[align="center"] {+ text-align: center;+}+:is(.assistant-body, .user-bubble) markdown-block :is(th, td)[align="right"] {+ text-align: right;+}+:is(.assistant-body, .user-bubble) markdown-block tr:last-child td {+ border-bottom: 0;+}+:is(.assistant-body, .user-bubble) markdown-block :is(h1, h2, h3, h4, h5, h6) {+ margin-block: 1.5em 0.6em;+}.streaming-text {position: relative;}@@ -1767,14 +1821,14 @@ a.chat-row-open {.user-bubble markdown-block > *:last-child {margin-bottom: 0;}-/* A streaming reply renders as two stacked blocks (committed prefix + live tail). Restore the- paragraph gap at their seam that the edge-trim rules above would otherwise remove; `revert`- is the UA-default margin, which is what an uncut paragraph boundary gets. */-.assistant-body .streaming-text markdown-block:not(:first-of-type) > *:first-child {- margin-top: revert;+.assistant-body .streaming-text markdown-block + markdown-block {+ margin-top: 1rem;+}+.assistant-body .streaming-text markdown-block:has(> div > .overflow-x-auto:last-child) + markdown-block {+ margin-top: 1.5em;}-.assistant-body .streaming-text markdown-block:not(:last-of-type) > *:last-child {- margin-bottom: revert;+:is(.assistant-body, .user-bubble) markdown-block:first-of-type > div > :is(h1, h2, h3, h4, h5, h6):first-child {+ margin-top: 0;}.message-bubble {min-width: 0;diff --git a/plugins/web-ui/src/theme-import.ts b/plugins/web-ui/src/theme-import.tsindex d2f5a07a1..a4c46c174 100644--- a/plugins/web-ui/src/theme-import.ts+++ b/plugins/web-ui/src/theme-import.ts@@ -338,6 +338,7 @@ export function themeTokens(palette: Palette): ThemeTokens {"--card-foreground": fg,"--popover": step(0.1, 0),"--popover-foreground": fg,+ "--markdown-link": link,"--primary": action,"--primary-foreground": textOn(action),"--secondary": step(0.09, 0.04),diff --git a/plugins/web-ui/test/fixtures/markdown.html b/plugins/web-ui/test/fixtures/markdown.htmlnew file mode 100644index 000000000..f9fd8cc63--- /dev/null+++ b/plugins/web-ui/test/fixtures/markdown.html@@ -0,0 +1,53 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Markdown rendering</title>+ <style>+ main {+ max-width: 820px;+ margin: 40px auto;+ padding: 0 24px 40px;+ }+ nav {+ display: flex;+ gap: 16px;+ margin-bottom: 32px;+ }+ button {+ cursor: pointer;+ }+ </style>+ </head>+ <body>+ <main>+ <nav><button id="theme">Toggle theme</button><button id="stream">Toggle streaming</button></nav>+ <article class="assistant-body" id="response"></article>+ </main>+ <script type="module">+ import "../../src/shell.css";+ import { html, render } from "lit";+ import { markdown } from "../../src/message-markdown";+ import { splitStreamingMarkdown } from "../../src/streaming-markdown";+ import text from "./markdown.md?raw";+ let streaming = false;+ const response = document.querySelector("#response");+ function draw() {+ const parts = streaming ? splitStreamingMarkdown(text, 240) : null;+ render(+ parts+ ? html`<div class="streaming-text">${parts.segments.map(markdown)}${markdown(parts.tail)}</div>`+ : markdown(text),+ response,+ );+ }+ document.querySelector("#theme").onclick = () => document.documentElement.classList.toggle("dark");+ document.querySelector("#stream").onclick = () => {+ streaming = !streaming;+ draw();+ };+ draw();+ </script>+ </body>+</html>diff --git a/plugins/web-ui/test/fixtures/markdown.md b/plugins/web-ui/test/fixtures/markdown.mdnew file mode 100644index 000000000..31f426fcc--- /dev/null+++ b/plugins/web-ui/test/fixtures/markdown.md@@ -0,0 +1,41 @@+The full results are ready. I ranked the options by **meeting conversion rate** and **volume of investments**. Everything below is in the highest conversion bucket, so this is the busiest slice of that group.++**Funds — most active, very high conversion**++| Fund | Investments |+| ---------------------------------------------------- | ----------- |+| [Northstar Fund](https://example.com/northstar) | 1,047 |+| [Birch Ventures](https://example.com/birch) | 680 |+| [River Partners](https://example.com/river) | 666 |+| [Scout Fund](https://example.com/scout) | 415 |+| [Orchard Fund](https://example.com/orchard) | 386 |+| [Harbor Capital](https://example.com/harbor) | 385 |+| [Summit Platform](https://example.com/summit) | 380 |+| [Clearwater Capital](https://example.com/clearwater) | 350 |+| [Field Ventures](https://example.com/field) | 266 |+| [Cedar Scout](https://example.com/cedar) | 225 |++Two of these also lead priced rounds: **Clearwater** (8 leads, ~$13.9M average check) and **Summit** (2 leads, ~$3.5M). [Horizon Partners](https://example.com/horizon) is the specialist of the group.++**Individual angels — most active, very high conversion** [Alex Morgan](https://example.com/alex) (606), [Sam Rivera](https://example.com/sam) (351), [Jordan Lee](https://example.com/jordan) (296), [Taylor Chen](https://example.com/taylor) (276).++One caveat: high conversion plus high volume means "reliably writes checks," not "best partner for a given company."++### Alignment and long values++| Label | Centered | Right aligned |+| :---------------------------------------------------------------- | :------: | ------------: |+| Short value | A | 1,047 |+| A longer label that wraps naturally on a narrow screen | B | 680 |+| [A long link label inside a table cell](https://example.com/long) | C | 7 |++### Lists and code++- Read the [overview](https://example.com/overview).+- Use `amount` for the numeric value.++> Values here are fictional sample data for checking rendering.++```text+A code block keeps its own spacing and background.+```