@zyro-sec/session-ui 0.0.0-stage → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/AGENTS.md +25 -0
  2. package/bunfig.toml +2 -0
  3. package/component-tests/basic-tool.fixture.tsx +46 -0
  4. package/component-tests/basic-tool.spec.ts +63 -0
  5. package/component-tests/file-media.fixture.tsx +39 -0
  6. package/component-tests/file-media.spec.ts +13 -0
  7. package/component-tests/file-tool.spec.ts +62 -0
  8. package/component-tests/file-viewer.fixture.tsx +109 -0
  9. package/component-tests/file-viewer.spec.ts +134 -0
  10. package/component-tests/file.spec.ts +33 -0
  11. package/component-tests/line-comment-v2.spec.ts +15 -0
  12. package/component-tests/markdown-code-wrap.spec.ts +94 -0
  13. package/component-tests/markdown-readiness.spec.ts +95 -0
  14. package/component-tests/markdown.fixture.tsx +104 -0
  15. package/component-tests/markdown.spec.ts +1564 -0
  16. package/component-tests/mermaid-preview.spec.ts +43 -0
  17. package/component-tests/patch-group.spec.ts +79 -0
  18. package/component-tests/read-group.spec.ts +72 -0
  19. package/component-tests/read-image.fixture.tsx +66 -0
  20. package/component-tests/read-image.spec.ts +154 -0
  21. package/component-tests/session-compaction.spec.ts +254 -0
  22. package/component-tests/session-lifecycle.spec.ts +190 -0
  23. package/component-tests/session-message-projection.spec.ts +639 -0
  24. package/component-tests/session-notice-projection.spec.ts +20 -0
  25. package/component-tests/session-review-comments.spec.ts +179 -0
  26. package/component-tests/session-shell.spec.ts +93 -0
  27. package/component-tests/session-timeline-mobile.spec.ts +201 -0
  28. package/component-tests/session-timeline-notices.spec.ts +38 -0
  29. package/component-tests/session-timeline-reasoning.spec.ts +107 -0
  30. package/component-tests/session-timeline.spec.ts +157 -0
  31. package/component-tests/session-tool-projection.spec.ts +323 -0
  32. package/component-tests/text-lifecycle.fixture.tsx +26 -0
  33. package/component-tests/text-lifecycle.spec.ts +42 -0
  34. package/component-tests/timeline-subagent-rows.spec.ts +33 -0
  35. package/component-tests/tool-disclosure.spec.ts +48 -0
  36. package/component-tests/tool-group-sticky.spec.ts +37 -0
  37. package/component-tests/tool-group.spec.ts +290 -0
  38. package/component-tests/tool-status-title.fixture.tsx +22 -0
  39. package/component-tests/tool-status-title.spec.ts +30 -0
  40. package/component-tests/user-message-quotes.spec.ts +111 -0
  41. package/package.json +91 -4
  42. package/playwright.components.config.ts +4 -0
  43. package/playwright.local.config.ts +2 -0
  44. package/src/actions.ts +54 -0
  45. package/src/components/apply-patch-file.ts +122 -0
  46. package/src/components/basic-tool.css +487 -0
  47. package/src/components/basic-tool.tsx +258 -0
  48. package/src/components/copy-machine.ts +78 -0
  49. package/src/components/copy.ts +85 -0
  50. package/src/components/diagram-preview.tsx +28 -0
  51. package/src/components/disclosure-machine.ts +188 -0
  52. package/src/components/disclosure.ts +129 -0
  53. package/src/components/dock-prompt.stories.tsx +73 -0
  54. package/src/components/dock-prompt.tsx +29 -0
  55. package/src/components/file-comment-selection.tsx +146 -0
  56. package/src/components/file-media-machine.ts +165 -0
  57. package/src/components/file-media.stories.tsx +112 -0
  58. package/src/components/file-media.tsx +323 -0
  59. package/src/components/file-search.tsx +73 -0
  60. package/src/components/file.css +59 -0
  61. package/src/components/file.tsx +1300 -0
  62. package/src/components/image-preview.tsx +35 -0
  63. package/src/components/line-comment-annotations.tsx +580 -0
  64. package/src/components/line-comment-machine.ts +262 -0
  65. package/src/components/line-comment-styles.ts +293 -0
  66. package/src/components/line-comment.stories.tsx +152 -0
  67. package/src/components/line-comment.tsx +448 -0
  68. package/src/components/link-segments.ts +20 -0
  69. package/src/components/linked-text.tsx +21 -0
  70. package/src/components/markdown-cache-machine.ts +257 -0
  71. package/src/components/markdown-cache.tsx +556 -0
  72. package/src/components/markdown-clipboard.ts +101 -0
  73. package/src/components/markdown-code-machine.ts +200 -0
  74. package/src/components/markdown-code-state.ts +22 -0
  75. package/src/components/markdown-fragment-links.ts +74 -0
  76. package/src/components/markdown-github.svg +3 -0
  77. package/src/components/markdown-globe.svg +5 -0
  78. package/src/components/markdown-image-machine.ts +170 -0
  79. package/src/components/markdown-image.ts +156 -0
  80. package/src/components/markdown-inline-code-kind.ts +39 -0
  81. package/src/components/markdown-mermaid.ts +18 -0
  82. package/src/components/markdown-phase-machine.ts +102 -0
  83. package/src/components/markdown-projection.ts +13 -0
  84. package/src/components/markdown-session-links.ts +183 -0
  85. package/src/components/markdown-solid.test.tsx +92 -0
  86. package/src/components/markdown-solid.tsx +113 -0
  87. package/src/components/markdown-stream.ts +95 -0
  88. package/src/components/markdown-worker-machine.ts +516 -0
  89. package/src/components/markdown-worker-protocol.ts +73 -0
  90. package/src/components/markdown-worker.ts +250 -0
  91. package/src/components/markdown.css +672 -0
  92. package/src/components/markdown.stories.tsx +199 -0
  93. package/src/components/markdown.tsx +1612 -0
  94. package/src/components/markdown.worker.ts +188 -0
  95. package/src/components/message-file.ts +102 -0
  96. package/src/components/message-nav.css +134 -0
  97. package/src/components/message-nav.tsx +159 -0
  98. package/src/components/message-part.css +2109 -0
  99. package/src/components/message-part.tsx +3 -0
  100. package/src/components/question-prompt-experimental.css +576 -0
  101. package/src/components/question-prompt.css +527 -0
  102. package/src/components/quote-highlight.css +59 -0
  103. package/src/components/review-focus-driver.ts +142 -0
  104. package/src/components/review-focus-machine.ts +95 -0
  105. package/src/components/session-compaction.css +270 -0
  106. package/src/components/session-diff.ts +358 -0
  107. package/src/components/session-error.tsx +41 -0
  108. package/src/components/session-retry.tsx +92 -0
  109. package/src/components/session-review-machine.ts +241 -0
  110. package/src/components/session-review.css +264 -0
  111. package/src/components/session-review.stories.tsx +232 -0
  112. package/src/components/session-review.tsx +733 -0
  113. package/src/components/session-turn.css +282 -0
  114. package/src/components/shell-submessage.css +24 -0
  115. package/src/components/timeline-separator.tsx +69 -0
  116. package/src/components/tool-count-label.css +57 -0
  117. package/src/components/tool-count-label.tsx +76 -0
  118. package/src/components/tool-count-summary.css +102 -0
  119. package/src/components/tool-count-summary.stories.tsx +99 -0
  120. package/src/components/tool-count-summary.tsx +44 -0
  121. package/src/components/tool-error-card.css +178 -0
  122. package/src/components/tool-error-card.stories.tsx +113 -0
  123. package/src/components/tool-error-card.tsx +202 -0
  124. package/src/components/tool-status-title-machine.ts +128 -0
  125. package/src/components/tool-status-title.css +89 -0
  126. package/src/components/tool-status-title.tsx +163 -0
  127. package/src/context/data.tsx +107 -0
  128. package/src/context/index.ts +1 -0
  129. package/src/context/markdown.tsx +129 -0
  130. package/src/context/sources.tsx +34 -0
  131. package/src/document.ts +8 -0
  132. package/src/file-presentation.ts +34 -0
  133. package/src/message/action-machine.ts +72 -0
  134. package/src/message/agent-label.ts +3 -0
  135. package/src/message/attachment-card.css +119 -0
  136. package/src/message/attachment-card.tsx +40 -0
  137. package/src/message/attachment-media-machine.ts +213 -0
  138. package/src/message/comment-card.tsx +155 -0
  139. package/src/message/compaction-entrance-machine.ts +93 -0
  140. package/src/message/current-message.tsx +157 -0
  141. package/src/message/current-tool-state.ts +161 -0
  142. package/src/message/message-content.tsx +1391 -0
  143. package/src/message/paced-text-machine.ts +73 -0
  144. package/src/message/prompt-message.stories.tsx +149 -0
  145. package/src/message/relative-time.ts +45 -0
  146. package/src/message/user-message-quote-parts.ts +16 -0
  147. package/src/message/user-message-quotes.stories.tsx +797 -0
  148. package/src/message/user-message-quotes.tsx +135 -0
  149. package/src/pierre/comment-hover-machine.ts +53 -0
  150. package/src/pierre/comment-hover.ts +131 -0
  151. package/src/pierre/comment-selection-machine.ts +257 -0
  152. package/src/pierre/commented-lines.ts +106 -0
  153. package/src/pierre/diff-selection.ts +91 -0
  154. package/src/pierre/file-find-machine.ts +323 -0
  155. package/src/pierre/file-find.ts +537 -0
  156. package/src/pierre/file-runtime.ts +42 -0
  157. package/src/pierre/file-selection.ts +140 -0
  158. package/src/pierre/index.ts +344 -0
  159. package/src/pierre/media.ts +140 -0
  160. package/src/pierre/render-machine.ts +381 -0
  161. package/src/pierre/selection-bridge.ts +82 -0
  162. package/src/pierre/selection-machine.ts +198 -0
  163. package/src/pierre/virtualizer.ts +114 -0
  164. package/src/pierre/worker.ts +46 -0
  165. package/src/sources/experiment.ts +59 -0
  166. package/src/sources/site-icon.tsx +53 -0
  167. package/src/sources/sources-chip.tsx +57 -0
  168. package/src/sources/sources-expand-machine.ts +101 -0
  169. package/src/sources/sources-panel.tsx +249 -0
  170. package/src/sources/sources-title.tsx +21 -0
  171. package/src/sources/sources.css +266 -0
  172. package/src/sources/sources.ts +141 -0
  173. package/src/storybook/current-session-fixtures.ts +1492 -0
  174. package/src/storybook/current-session-scenarios.ts +76 -0
  175. package/src/storybook/current-session-story.tsx +154 -0
  176. package/src/storybook/index.ts +43 -0
  177. package/src/styles/index.css +19 -0
  178. package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
  179. package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
  180. package/src/timeline/code-blocks.stories.tsx +105 -0
  181. package/src/timeline/commentary.stories.tsx +70 -0
  182. package/src/timeline/commentary.ts +38 -0
  183. package/src/timeline/detail.ts +111 -0
  184. package/src/timeline/error-card.stories.tsx +134 -0
  185. package/src/timeline/error-spacing.stories.tsx +71 -0
  186. package/src/timeline/facts.ts +493 -0
  187. package/src/timeline/file-changes.stories.tsx +436 -0
  188. package/src/timeline/group-label-fixtures.ts +97 -0
  189. package/src/timeline/mermaid.stories.tsx +131 -0
  190. package/src/timeline/place.ts +280 -0
  191. package/src/timeline/placement-fixtures.ts +365 -0
  192. package/src/timeline/placement-reactivity.ts +133 -0
  193. package/src/timeline/projection.ts +1261 -0
  194. package/src/timeline/research-and-agents.stories.tsx +461 -0
  195. package/src/timeline/session-timeline-row.tsx +1675 -0
  196. package/src/timeline/session-timeline.tsx +68 -0
  197. package/src/timeline/steer-arrival-machine.ts +134 -0
  198. package/src/timeline/terminal-work.stories.tsx +464 -0
  199. package/src/timeline/timeline-row.stories.tsx +1069 -0
  200. package/src/timeline/timeline-row.ts +238 -0
  201. package/src/timeline/turn-phase-machine.ts +112 -0
  202. package/src/timeline/user-message-fold.stories.tsx +194 -0
  203. package/src/timeline/user-runs.ts +87 -0
  204. package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
  205. package/src/timeline-next/compaction.tsx +236 -0
  206. package/src/timeline-next/errors.ts +101 -0
  207. package/src/timeline-next/event-row.tsx +168 -0
  208. package/src/timeline-next/events.ts +103 -0
  209. package/src/timeline-next/index.ts +10 -0
  210. package/src/timeline-next/nested-rail.ts +125 -0
  211. package/src/timeline-next/projection.ts +1028 -0
  212. package/src/timeline-next/row.tsx +1728 -0
  213. package/src/timeline-next/rules.ts +89 -0
  214. package/src/timeline-next/separator.tsx +73 -0
  215. package/src/timeline-next/spacing.ts +127 -0
  216. package/src/timeline-next/status-line.tsx +41 -0
  217. package/src/timeline-next/status.ts +33 -0
  218. package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
  219. package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
  220. package/src/timeline-next/stories/compare.stories.tsx +486 -0
  221. package/src/timeline-next/stories/playground.stories.tsx +297 -0
  222. package/src/timeline-next/stories/session-replay.ts +1156 -0
  223. package/src/timeline-next/stories/session-timeline.tsx +50 -0
  224. package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
  225. package/src/timeline-next/timeline-next.css +649 -0
  226. package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
  227. package/src/timeline-next/tools/activity-label.ts +166 -0
  228. package/src/timeline-next/tools/assistant-content.tsx +84 -0
  229. package/src/timeline-next/tools/context-group.tsx +619 -0
  230. package/src/timeline-next/tools/error-card.tsx +147 -0
  231. package/src/timeline-next/tools/explore.tsx +119 -0
  232. package/src/timeline-next/tools/file-group.tsx +128 -0
  233. package/src/timeline-next/tools/patch.tsx +174 -0
  234. package/src/timeline-next/tools/shell.tsx +186 -0
  235. package/src/timeline-next/tools/thought.tsx +87 -0
  236. package/src/timeline-next/tools/tool-display.tsx +119 -0
  237. package/src/tools/ansi.ts +8 -0
  238. package/src/tools/context-group-label.ts +123 -0
  239. package/src/tools/file-runs.ts +35 -0
  240. package/src/tools/project-path.ts +18 -0
  241. package/src/tools/read-group.stories.tsx +159 -0
  242. package/src/tools/run-machine.ts +185 -0
  243. package/src/tools/shell-output-machine.ts +233 -0
  244. package/src/tools/shell-output.ts +91 -0
  245. package/src/tools/subagent-row-variants.stories.tsx +129 -0
  246. package/src/tools/tool-group.stories.tsx +345 -0
  247. package/src/tools/tool-renderer.tsx +2876 -0
  248. package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
  249. package/src/v2/components/session-file-panel-v2.tsx +149 -0
  250. package/src/v2/components/session-progress-indicator-v2.css +5 -0
  251. package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
  252. package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
  253. package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
  254. package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
  255. package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
  256. package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
  257. package/src/v2/components/session-review-v2.css +653 -0
  258. package/src/v2/components/session-review-v2.tsx +422 -0
  259. package/src/v2/components/sidebar-presence-machine.ts +69 -0
  260. package/tsconfig.json +20 -0
  261. package/README.md +0 -3
@@ -0,0 +1,639 @@
1
+ import { expect, story } from "../../stories/playwright/story"
2
+
3
+ story("reveals turn speed with the response footer", async ({ mount, page }) => {
4
+ const timeline = await mount("current-session-timeline-rows--response-speed", { args: { steered: true } })
5
+
6
+ const footer = timeline.locator('[data-slot="text-part-copy-wrapper"]').last()
7
+
8
+ const meta = footer.locator('[data-slot="text-part-meta"]')
9
+
10
+ const speed = meta.locator('[data-slot="text-part-meta-speed"]')
11
+
12
+ await page.evaluate(() => document.fonts.ready.then(() => undefined))
13
+ await expect(meta.locator('[data-slot="text-part-meta-item"]').last()).toHaveText("5m 2s")
14
+ await expect(speed).toHaveText("·60.0 tok/s")
15
+ await timeline.getByText("The timeline checks passed.", { exact: false }).hover()
16
+ await expect(footer).toHaveCSS("opacity", "1")
17
+ await expect(speed).toBeVisible()
18
+
19
+ for (const width of [1000, 390]) {
20
+ await page.setViewportSize({ width, height: 844 })
21
+ await timeline.getByText("The timeline checks passed.", { exact: false }).hover()
22
+ await expect(speed).toBeVisible()
23
+ expect(
24
+ await speed.evaluate((element) => {
25
+ const box = element.getBoundingClientRect()
26
+
27
+ const parent = element.parentElement!.getBoundingClientRect()
28
+
29
+ return box.left >= parent.left && box.right <= parent.right + 1
30
+ }),
31
+ ).toBe(true)
32
+ await footer.getByRole("button", { name: "Copy response", exact: true }).hover()
33
+ await expect(speed).toBeVisible()
34
+ }
35
+ })
36
+
37
+ story("omits turn speed when a model step has no streaming time", async ({ mount }) => {
38
+ const timeline = await mount("current-session-timeline-rows--response-speed", { args: { measured: false } })
39
+
40
+ const meta = timeline.locator('[data-slot="text-part-meta"]')
41
+
42
+ await timeline.getByText("The timeline checks passed.", { exact: false }).hover()
43
+ await meta.hover()
44
+ await expect(meta).toContainText("5m 2s")
45
+ await expect(meta.locator('[data-slot="text-part-meta-speed"]')).toHaveCount(0)
46
+ })
47
+
48
+ story("keeps quote attachment icons fixed while long text truncates", async ({ mount, page }) => {
49
+ const gallery = await mount("current-session-timeline-rows--quote-attachments")
50
+
51
+ await page.evaluate(() => document.fonts.ready.then(() => undefined))
52
+
53
+ for (const title of ["Remove this", "Can we make this smaller?"]) {
54
+ const icon = gallery
55
+ .locator('[data-component="attachment-card"]')
56
+ .filter({ hasText: title })
57
+ .locator('[data-slot="icon-svg"]')
58
+
59
+ await expect(icon).toHaveCSS("width", "12px")
60
+ await expect(icon).toHaveCSS("height", "12px")
61
+ }
62
+
63
+ const label = gallery.locator('[data-slot="attachment-card-label"]').filter({ hasText: "It has a 32px minimum" })
64
+
65
+ expect(await label.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true)
66
+ await expect(label).toHaveCSS("text-overflow", "ellipsis")
67
+ })
68
+
69
+ story.describe("message actions menu", () => {
70
+ story.use({ timezoneId: "UTC" })
71
+
72
+ story(
73
+ "opens from a chevron in the bubble with the send time and the actions the message can take",
74
+ async ({ mount, page }) => {
75
+ const timeline = await mount("current-prompt-message--pending")
76
+ const chevron = timeline.locator('[data-slot="user-message-menu"]')
77
+ const more = timeline.getByRole("button", { name: "More actions", exact: true })
78
+ const fork = page.getByRole("menuitem", { name: "Fork from here", exact: true })
79
+ const copy = page.getByRole("menuitem", { name: "Copy message", exact: true })
80
+ const revert = page.getByRole("menuitem", { name: "Revert to here", exact: true })
81
+ const remove = page.getByRole("menuitem", { name: "Delete", exact: true })
82
+
83
+ // The meta line keeps agent and model; the time lives in the menu.
84
+ await expect(timeline.locator('[data-slot="user-message-meta"] time')).toHaveCount(0)
85
+
86
+ const bubble = timeline.locator('[data-slot="user-message-text"]')
87
+ await timeline.getByLabel("Delivery state").selectOption("delivered")
88
+ await page.mouse.move(0, 0)
89
+ await expect(chevron).toHaveCSS("opacity", "0")
90
+ await bubble.hover()
91
+ await expect(chevron).toHaveCSS("opacity", "1")
92
+ await more.click()
93
+ const menu = page.getByRole("menu")
94
+ await expect(menu.locator("time")).toHaveText("Jan 1, 2025, 12:00 AM")
95
+ await expect(fork).toBeEnabled()
96
+ await expect(copy).toBeEnabled()
97
+ await expect(revert).toBeEnabled()
98
+ // An open menu keeps its chevron in view after the pointer leaves the message.
99
+ await page.mouse.move(0, 0)
100
+ await expect(chevron).toHaveCSS("opacity", "1")
101
+ await page.keyboard.press("Escape")
102
+ await expect(menu).toBeHidden()
103
+ // The menu hands focus back without a ring, so the chevron hides once the pointer is away.
104
+ await expect(more).toBeFocused()
105
+ await expect(chevron).toHaveCSS("opacity", "0")
106
+
107
+ // A pending steer is queued or deleted rather than reverted, and has no history to fork; a message without text has
108
+ // nothing to copy.
109
+ await timeline.getByLabel("Delivery state").selectOption("steering")
110
+ await timeline.getByLabel("Prompt text", { exact: true }).uncheck()
111
+ // Without a bubble, the chevron sits in the footer and shows while the message is hovered.
112
+ await timeline.locator('[data-component="user-message"]').hover()
113
+ await more.click()
114
+ await expect(page.getByRole("menuitem", { name: "Move to queue", exact: true })).toBeEnabled()
115
+ await expect(fork).toHaveCount(0)
116
+ await expect(copy).toHaveAttribute("aria-disabled", "true")
117
+ await expect(revert).toHaveCount(0)
118
+ await expect(remove).toBeEnabled()
119
+ await page.keyboard.press("Escape")
120
+
121
+ await timeline.getByLabel("Prompt text", { exact: true }).check()
122
+ await timeline.getByLabel("Delivery state").selectOption("delivered")
123
+ await page.evaluate(() => document.fonts.ready.then(() => undefined))
124
+
125
+ for (const width of [1000, 390]) {
126
+ await page.setViewportSize({ width, height: 844 })
127
+ await bubble.hover()
128
+ const box = await bubble.boundingBox()
129
+ const trigger = await more.boundingBox()
130
+ const lineHeight = await bubble.evaluate((element) => parseFloat(getComputedStyle(element).lineHeight))
131
+
132
+ if (!box || !trigger) throw new Error("Message geometry is unavailable")
133
+ // Pinned to the bubble's top trailing corner, centered on its first line, as far from the side as from the top.
134
+ expect(Math.abs(box.y + 8 + lineHeight / 2 - trigger.y - trigger.height / 2)).toBeLessThan(1)
135
+ expect(Math.abs(box.x + box.width - trigger.x - trigger.width - (trigger.y - box.y))).toBeLessThan(1)
136
+ }
137
+ },
138
+ )
139
+
140
+ story("opens upward, 4px from the chevron, with its trailing edge on the chevron's", async ({ mount, page }) => {
141
+ const timeline = await mount("current-session-timeline-rows--prompt-runs")
142
+ await timeline.getByRole("button", { name: "Send next", exact: true }).click()
143
+ const message = timeline.locator('[data-component="user-message"]').first()
144
+ await message.locator('[data-slot="user-message-text"]').hover()
145
+ const more = message.getByRole("button", { name: "More actions", exact: true })
146
+ // An open menu hides the rest of the page from the accessibility tree, so measure the trigger first.
147
+ const trigger = await more.boundingBox()
148
+ await more.click()
149
+ const menu = page.locator('[data-component="menu-v2-content"]')
150
+ await expect(menu).toBeVisible()
151
+ const box = await menu.boundingBox()
152
+
153
+ if (!trigger || !box) throw new Error("Menu geometry is unavailable")
154
+ expect(Math.abs(trigger.y - box.y - box.height - 4)).toBeLessThan(1)
155
+ expect(Math.abs(trigger.x + trigger.width - box.x - box.width)).toBeLessThan(1)
156
+ })
157
+ })
158
+
159
+ story(
160
+ "fades the footer and chevron out once, without flicker, as an outside click closes the menu",
161
+ async ({ mount, page }) => {
162
+ // The timeline keeps a run's meta line shown while one of its menus is open, so mount it rather than a bare message.
163
+ const timeline = await mount("current-session-timeline-rows--prompt-runs")
164
+ const message = timeline.locator('[data-component="user-message"]').first()
165
+
166
+ await message.locator('[data-slot="user-message-text"]').hover()
167
+ await message.getByRole("button", { name: "More actions", exact: true }).click()
168
+ await expect(page.getByRole("menu")).toBeVisible()
169
+ await page.mouse.move(0, 0)
170
+
171
+ // Kobalte drops the expanded state a task before it returns focus to the trigger, so record every frame from the
172
+ // click until well after the menu has gone rather than the settled state. The first sample is taken now: the click
173
+ // can land and close the menu before the next frame.
174
+ const frames = await message.evaluateHandle((element) => {
175
+ const slots = ["user-message-copy-wrapper", "user-message-menu"]
176
+ const samples = slots.map((): number[] => [])
177
+ const closed = { frames: 0 }
178
+
179
+ const done = new Promise<number[][]>((resolve) => {
180
+ const tick = () => {
181
+ slots.forEach((slot, index) => {
182
+ const target = element.querySelector(`[data-slot="${slot}"]`)
183
+ samples[index]!.push(target ? parseFloat(getComputedStyle(target).opacity) : 0)
184
+ })
185
+
186
+ if (!document.querySelector('[role="menu"]')) closed.frames += 1
187
+
188
+ if (closed.frames < 30) return requestAnimationFrame(tick)
189
+
190
+ resolve(samples)
191
+ }
192
+
193
+ tick()
194
+ })
195
+
196
+ return { done }
197
+ })
198
+
199
+ await page.mouse.click(0, 0)
200
+ const samples = await frames.evaluate((sampler) => sampler.done)
201
+
202
+ // Each starts shown and only ever fades: no frame comes back up after a lower one.
203
+ samples.forEach((opacities) => {
204
+ expect(opacities[0]).toBe(1)
205
+ expect(opacities.every((value, index) => index === 0 || value <= opacities[index - 1]!)).toBe(true)
206
+ })
207
+ },
208
+ )
209
+
210
+ story("keeps pending steer actions usable after a request fails", async ({ mount, page }) => {
211
+ const timeline = await mount("current-prompt-message--pending")
212
+ const more = timeline.getByRole("button", { name: "More actions", exact: true })
213
+ const queue = page.getByRole("menuitem", { name: "Move to queue", exact: true })
214
+ const remove = page.getByRole("menuitem", { name: "Delete", exact: true })
215
+ const failures = timeline.getByLabel("Failed actions")
216
+ const bubble = timeline.locator('[data-slot="user-message-text"]')
217
+
218
+ // The chevron shows only while its bubble is hovered, and a closing menu leaves the pointer over the menu's place.
219
+ const open = async () => {
220
+ await bubble.hover()
221
+ await more.click()
222
+ }
223
+
224
+ await timeline.getByLabel("Actions fail").check()
225
+ await open()
226
+ await queue.click()
227
+ await expect(failures).toHaveText("1")
228
+ await open()
229
+ await expect(queue).toBeEnabled()
230
+ await expect(remove).toBeEnabled()
231
+ await remove.click()
232
+ await expect(failures).toHaveText("2")
233
+ await open()
234
+ await expect(remove).toBeEnabled()
235
+ })
236
+
237
+ story("shows a run's meta line while the pointer is anywhere in the run, gaps included", async ({ mount, page }) => {
238
+ const timeline = await mount("current-session-timeline-rows--prompt-runs")
239
+ const send = timeline.getByRole("button", { name: "Send next", exact: true })
240
+ await send.click()
241
+ await send.click()
242
+ const bubbles = timeline.locator('[data-slot="user-message-text"]')
243
+ await expect(bubbles).toHaveCount(3)
244
+
245
+ const footer = timeline
246
+ .locator('[data-component="user-message"]')
247
+ .last()
248
+ .locator('[data-slot="user-message-copy-wrapper"]')
249
+
250
+ await page.mouse.move(0, 0)
251
+ await expect(footer).toHaveCSS("opacity", "0")
252
+ await bubbles.first().hover()
253
+ await expect(footer).toHaveCSS("opacity", "1")
254
+
255
+ // The 4px gap between two bubbles belongs to the run, so crossing it keeps the line.
256
+ const above = await bubbles.nth(0).boundingBox()
257
+ const below = await bubbles.nth(1).boundingBox()
258
+
259
+ if (!above || !below) throw new Error("Run geometry is unavailable")
260
+ await page.mouse.move(below.x + below.width / 2, (above.y + above.height + below.y) / 2)
261
+ await expect(footer).toHaveCSS("opacity", "1")
262
+ await page.mouse.move(0, 0)
263
+ await expect(footer).toHaveCSS("opacity", "0")
264
+ })
265
+
266
+ story("names the newest prompt's revert Undo and earlier ones Revert to here", async ({ mount, page }) => {
267
+ const timeline = await mount("current-session-timeline-rows--prompt-runs")
268
+ await timeline.getByRole("button", { name: "Send next", exact: true }).click()
269
+ const messages = timeline.locator('[data-component="user-message"]')
270
+ await expect(messages).toHaveCount(2)
271
+
272
+ for (const [index, label] of [
273
+ [1, "Undo"],
274
+ [0, "Revert to here"],
275
+ ] as const) {
276
+ await messages.nth(index).locator('[data-slot="user-message-text"]').hover()
277
+ await messages.nth(index).getByRole("button", { name: "More actions", exact: true }).click()
278
+ await expect(page.getByRole("menuitem", { name: label, exact: true })).toBeVisible()
279
+ await expect(page.getByRole("menuitem", { name: index ? "Revert to here" : "Undo", exact: true })).toHaveCount(0)
280
+ await page.keyboard.press("Escape")
281
+ }
282
+ })
283
+
284
+ story("drops a pending footer at once on delivery with and without hover", async ({ mount, page }) => {
285
+ const timeline = await mount("current-prompt-message--pending")
286
+ const message = timeline.locator('[data-component="user-message"]')
287
+ const footer = timeline.locator('[data-slot="user-message-copy-wrapper"]')
288
+ const pending = timeline.locator('[data-slot="user-message-transition"]:has([data-slot="user-message-pending"])')
289
+
290
+ await page.mouse.move(0, 0)
291
+ await expect(footer).toHaveCSS("height", "20px")
292
+ await expect(footer).toHaveCSS("margin-top", "8px")
293
+ const bubble = timeline.locator('[data-slot="user-message-text"]')
294
+ const labels = timeline.locator('[data-slot="user-message-meta-label"]')
295
+
296
+ for (const hover of [true, false]) {
297
+ await timeline.getByLabel("Delivery state").selectOption("steering")
298
+ await expect(footer).toHaveCSS("opacity", "1")
299
+ await expect(pending).toHaveCSS("opacity", "1")
300
+ const before = await pending.boundingBox()
301
+
302
+ if (!before) throw new Error("Pending footer geometry is unavailable")
303
+
304
+ if (hover) await bubble.hover()
305
+
306
+ if (!hover) await page.mouse.move(0, 0)
307
+ // Pending closes the line, and the agent and model before it show only on hover.
308
+ await expect(labels).toHaveCSS("opacity", hover ? "1" : "0")
309
+ const line = await footer.boundingBox()
310
+
311
+ if (!line) throw new Error("Pending footer geometry is unavailable")
312
+ expect(Math.abs(before.x + before.width - line.x - line.width)).toBeLessThan(1)
313
+ await timeline.getByLabel("Delivery state").selectOption("delivered")
314
+
315
+ // The first frame after delivery already shows the delivered footer: nothing shrinks or fades out.
316
+ const after = await message.evaluate((element) => {
317
+ const pending = element.querySelector(
318
+ '[data-slot="user-message-transition"]:has([data-slot="user-message-pending"])',
319
+ )!
320
+
321
+ const footer = element.querySelector('[data-slot="user-message-copy-wrapper"]')!
322
+
323
+ return {
324
+ animations: [...pending.getAnimations(), ...footer.getAnimations()].length,
325
+ width: pending.getBoundingClientRect().width,
326
+ opacity: Number(getComputedStyle(pending).opacity),
327
+ footer: Number(getComputedStyle(footer).opacity),
328
+ }
329
+ })
330
+
331
+ expect(after).toEqual({ animations: 0, width: 0, opacity: 0, footer: hover ? 1 : 0 })
332
+ expect(before.width).toBeGreaterThan(0)
333
+
334
+ await expect(pending).toBeHidden()
335
+ await expect(footer).toHaveCSS("opacity", hover ? "1" : "0")
336
+ }
337
+
338
+ await page.emulateMedia({ reducedMotion: "reduce" })
339
+ await expect(page.locator("html")).toHaveAttribute("data-motion", "reduce")
340
+ await timeline.getByLabel("Delivery state").selectOption("steering")
341
+ await timeline.getByLabel("Delivery state").selectOption("delivered")
342
+ await expect(footer).toHaveCSS("transition-duration", "0s")
343
+ await expect(pending).toBeHidden()
344
+ await expect(footer).toHaveCSS("opacity", "0")
345
+ })
346
+
347
+ story("marks pending metadata without badging delivered, starting, or queued prompts", async ({ mount, page }) => {
348
+ const timeline = await mount("current-prompt-message--pending")
349
+ const indicator = timeline.locator('[data-slot="user-message-meta"] [data-slot="user-message-pending"]')
350
+ const text = timeline.locator('[data-slot="user-message-text"]')
351
+
352
+ for (const status of ["steering", "stranded", "sending", "starting", "queued", "delivered"]) {
353
+ await timeline.getByLabel("Delivery state").selectOption(status)
354
+ const pending = status === "steering" || status === "stranded" || status === "sending"
355
+
356
+ if (pending) await expect(indicator).toBeVisible()
357
+
358
+ if (!pending) await expect(indicator).toBeHidden()
359
+
360
+ // A prompt still sending has no server row, so it offers no action until the server has it.
361
+ await expect(timeline.locator('[data-slot="user-message-menu"]')).toHaveCount(status === "sending" ? 0 : 1)
362
+
363
+ const colors = await timeline.evaluate((element, pending) => {
364
+ const probe = document.createElement("span")
365
+ probe.style.color = `var(--v2-text-text-${pending ? "muted" : "base"})`
366
+ probe.style.backgroundColor = `var(--v2-background-bg-layer-${pending ? "01" : "02"})`
367
+ element.append(probe)
368
+ const result = { color: getComputedStyle(probe).color, background: getComputedStyle(probe).backgroundColor }
369
+ probe.remove()
370
+
371
+ return result
372
+ }, pending)
373
+
374
+ await expect(text).toHaveCSS("color", colors.color)
375
+ await expect(text).toHaveCSS("background-color", colors.background)
376
+ }
377
+
378
+ await text.hover()
379
+ await expect(timeline.locator('[data-slot="user-message-meta-item"]')).toHaveText([
380
+ "Build",
381
+ "Claude Sonnet 4",
382
+ "Balanced",
383
+ ])
384
+ const separator = timeline.locator('[data-slot="user-message-meta-label"] [data-slot="user-message-meta-separator"]')
385
+ await expect(separator).toHaveText("\u00B7")
386
+ await expect(timeline.locator('[data-slot="user-message-meta-label"]')).toHaveCSS("gap", "4px")
387
+
388
+ // A steer reads agent · model · Pending. Pending stays in view; the agent and model show on hover, as on any message.
389
+ await timeline.getByLabel("Delivery state").selectOption("steering")
390
+ await expect(timeline.locator('[data-slot="user-message-meta"]')).toHaveText(
391
+ /^Build\s*·\s*Claude Sonnet 4\s*Balanced\s*·\s*Pending$/,
392
+ { useInnerText: true },
393
+ )
394
+ await expect(timeline.locator('[data-slot="user-message-meta-label"]')).toHaveCSS("opacity", "1")
395
+ await page.mouse.move(0, 0)
396
+ await expect(timeline.locator('[data-slot="user-message-meta-label"]')).toHaveCSS("opacity", "0")
397
+ await expect(indicator).toBeVisible()
398
+ await timeline.getByLabel("Voice message", { exact: true }).check()
399
+ const voice = timeline.getByRole("img", { name: "Voice", exact: true })
400
+ await expect(voice).toBeVisible()
401
+ await expect(indicator).toBeVisible()
402
+ // The faded bubble already marks a steer as waiting, so Pending is plain text with no icon.
403
+ await expect(indicator).toHaveText("Pending")
404
+ await expect(indicator.locator("svg")).toHaveCount(0)
405
+
406
+ await expect(voice.locator("use")).toHaveAttribute("href", "#opencode-v2-icon-outline-wave-audio")
407
+ await expect(voice).toHaveCSS("width", "20px")
408
+ await expect(voice).toHaveCSS("height", "20px")
409
+ await expect(voice.locator('[data-slot="icon-svg"]')).toHaveCSS("width", "14px")
410
+ await expect(voice.locator('[data-slot="icon-svg"]')).toHaveCSS("height", "14px")
411
+
412
+ await expect(timeline.locator('[data-slot="user-message-meta"]')).toHaveText(/Pending$/)
413
+ await timeline.getByLabel("Grouped prompts", { exact: true }).check()
414
+ await expect(timeline.locator('[data-run-folded] [data-slot="user-message-copy-wrapper"]')).toBeHidden()
415
+ await expect(
416
+ timeline.locator('[data-component="user-message"]:not([data-run-folded]) [data-slot="user-message-pending"]'),
417
+ ).toBeVisible()
418
+ await expect(timeline.getByRole("img", { name: "Pending", exact: true })).toHaveCount(0)
419
+ await timeline.getByLabel("Grouped prompts", { exact: true }).uncheck()
420
+ await page.setViewportSize({ width: 390, height: 844 })
421
+ await expect(indicator).toBeVisible()
422
+ await expect(timeline.locator('[data-slot="user-message-meta-item"]')).toHaveCount(0)
423
+ await timeline.getByLabel("Prompt text", { exact: true }).uncheck()
424
+ await expect(timeline.getByText("notes.json", { exact: true })).toBeVisible()
425
+ await expect(indicator).toBeVisible()
426
+ // A steer without text offers its actions from a chevron in its footer.
427
+ await timeline.locator('[data-component="user-message"]').hover()
428
+ await timeline.getByRole("button", { name: "More actions", exact: true }).click()
429
+ await page.getByRole("menuitem", { name: "Move to queue", exact: true }).click()
430
+ await expect(indicator).toBeHidden()
431
+ })
432
+
433
+ // Moved from packages/app/e2e/regression/session-timeline-collapse-state.spec.ts
434
+ story("keeps a manually collapsed tool collapsed when later assistant content streams", async ({ mount }) => {
435
+ const timeline = await mount("current-session-file-changes--changing-files", { args: { scenario: "streaming" } })
436
+ const tool = timeline.locator('[data-timeline-part-id="tool_edit_status"]')
437
+ const trigger = tool.locator('[data-scope="apply-patch"] button')
438
+ await expect(trigger).toHaveAttribute("aria-expanded", "true")
439
+ // SAFETY: the locator targets a rendered DOM element, which is always an HTMLElement in the story.
440
+ await tool.evaluate((element) => ((element as HTMLElement).dataset.regressionMarker = "before-stream"))
441
+ await trigger.click()
442
+ await expect(trigger).toHaveAttribute("aria-expanded", "false")
443
+ await timeline.getByRole("button", { name: "Stream sibling content" }).click()
444
+ await expect(timeline.getByText("Streaming added a later assistant text part.", { exact: true })).toBeVisible()
445
+ await expect(tool).toHaveAttribute("data-regression-marker", "before-stream")
446
+ await expect(trigger).toHaveAttribute("aria-expanded", "false")
447
+ await expect(tool.locator("xpath=ancestor::*[@data-timeline-row]")).toHaveAttribute(
448
+ "data-timeline-row",
449
+ "AssistantPart",
450
+ )
451
+ })
452
+
453
+ // Moved from packages/app/e2e/regression/session-timeline-projection.spec.ts
454
+ story("renders interruption independently when the turn is not compacted", async ({ mount }) => {
455
+ const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "interruption" } })
456
+ await expect(timeline.getByText("Interrupted", { exact: true })).toBeVisible()
457
+ await expect(timeline.getByText("Before", { exact: true })).toBeVisible()
458
+ await expect(timeline.getByText("After", { exact: true })).toBeVisible()
459
+
460
+ const rows = await timeline
461
+ .locator('[data-timeline-row="AssistantPart"], [data-timeline-row="TurnDivider"]')
462
+ .evaluateAll((elements) => elements.map((element) => element.getAttribute("data-timeline-row")))
463
+
464
+ expect(rows).toEqual(["AssistantPart", "TurnDivider", "AssistantPart"])
465
+ })
466
+
467
+ // Moved from packages/app/e2e/regression/session-timeline-projection.spec.ts
468
+ story("renders aliased and long custom model notices", async ({ mount, page }) => {
469
+ await page.setViewportSize({ width: 420, height: 700 })
470
+ const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "models" } })
471
+ const shortName = "GPT-5.4 nano"
472
+ const longName = "Company Gateway Extra Long Context Model for Narrow Timeline Layouts"
473
+
474
+ const short = timeline
475
+ .locator('[data-slot="session-timeline-notice"]')
476
+ .filter({ hasText: shortName })
477
+ .filter({ hasText: "xhigh" })
478
+
479
+ const long = timeline.locator('[data-slot="session-timeline-notice"]').filter({ hasText: longName })
480
+ await expect(short).toBeVisible()
481
+ await expect(short.getByText(`Switched to ${shortName}`, { exact: true })).toBeVisible()
482
+ await expect(short.locator('[data-slot="session-timeline-notice-variant"]')).toHaveText("xhigh")
483
+ await expect(timeline.getByText("fast-nano", { exact: true })).toHaveCount(0)
484
+ await expect(short.locator('[data-component="provider-icon"]')).toBeVisible()
485
+
486
+ const variantDefault = timeline
487
+ .locator('[data-slot="session-timeline-notice"]')
488
+ .filter({ hasText: "Switched variant to Default" })
489
+
490
+ const variantHigh = timeline
491
+ .locator('[data-slot="session-timeline-notice"]')
492
+ .filter({ hasText: "Switched variant to high" })
493
+
494
+ await expect(variantDefault.getByText("Switched variant to Default", { exact: true })).toBeVisible()
495
+ await expect(variantHigh.getByText("Switched variant to high", { exact: true })).toBeVisible()
496
+ await expect(variantDefault.locator('[data-slot="session-timeline-notice-variant"]')).toHaveCount(0)
497
+ await expect(variantHigh.locator('[data-slot="session-timeline-notice-variant"]')).toHaveCount(0)
498
+ await expect(long).toBeVisible()
499
+ await expect(long.locator('[data-component="provider-icon"]')).toBeVisible()
500
+ await expect(long.locator('[data-slot="session-timeline-notice-variant"]')).toHaveCount(0)
501
+ await expect(long.locator("[title]")).toHaveAttribute("title", `Switched to ${longName}`)
502
+ await expect.poll(() => long.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true)
503
+ })
504
+
505
+ // Moved from packages/app/e2e/regression/session-timeline-projection.spec.ts
506
+ story("renders user image, file attachment, file reference, and agent reference", async ({ mount }) => {
507
+ const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "attachments" } })
508
+ await expect(timeline.getByAltText("pixel.png")).toBeVisible()
509
+ await expect(timeline.getByText("tsconfig.json")).toBeVisible()
510
+ await expect(timeline.getByText("@src/a.ts", { exact: true })).toBeVisible()
511
+ await expect(timeline.getByText("@explore", { exact: true })).toBeVisible()
512
+
513
+ const accent = await timeline.evaluate((element) => {
514
+ const probe = document.createElement("span")
515
+ probe.style.color = "var(--v2-text-text-accent)"
516
+ element.append(probe)
517
+ const color = getComputedStyle(probe).color
518
+ probe.remove()
519
+
520
+ return color
521
+ })
522
+
523
+ for (const mention of await timeline.locator("[data-highlight]").all()) {
524
+ await expect(mention).toHaveCSS("color", accent)
525
+ await expect(mention).toHaveCSS("font-weight", "440")
526
+ }
527
+
528
+ for (const prefix of await timeline.locator('[data-slot="user-message-mention-prefix"]').all()) {
529
+ await expect(prefix).toHaveCSS("color", accent)
530
+ }
531
+
532
+ const attachments = timeline.locator('[data-slot="user-message-attachments"]')
533
+ const body = timeline.locator('[data-slot="user-message-body"]')
534
+ const [attachmentsBox, bodyBox] = await Promise.all([attachments.boundingBox(), body.boundingBox()])
535
+ expect(attachmentsBox).not.toBeNull()
536
+ expect(bodyBox).not.toBeNull()
537
+ expect(bodyBox!.y - (attachmentsBox!.y + attachmentsBox!.height)).toBe(8)
538
+ })
539
+
540
+ story("a stored image that fails to load shows a failed tile that retries", async ({ mount }) => {
541
+ const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "media" } })
542
+ const tiles = timeline.locator('[data-slot="user-message-attachment"]')
543
+
544
+ await expect(timeline.getByAltText("ready.svg")).toBeVisible()
545
+ // A failed read used to keep the loading placeholder forever.
546
+ const failed = tiles.first()
547
+ await expect(failed.getByRole("img", { name: "Unable to load image." })).toBeVisible()
548
+ await expect(failed).not.toHaveAttribute("data-placeholder")
549
+
550
+ const tileSize = { width: 132, height: 88 }
551
+ expect(await failed.boundingBox()).toMatchObject(tileSize)
552
+
553
+ await failed.click()
554
+ await expect(timeline.getByAltText("flaky.svg")).toBeVisible()
555
+ expect(await failed.boundingBox()).toMatchObject(tileSize)
556
+ })
557
+
558
+ story("shows note selectors and keeps annotation subtitles with or without comments", async ({ mount, page }) => {
559
+ const gallery = await mount("current-session-timeline-rows--note-attachments")
560
+
561
+ const cases = [
562
+ { name: "Named", heading: "button#save", secondary: "Browser annotation" },
563
+ { name: "Unnamed", heading: "button.icon-only", secondary: "Browser annotation" },
564
+ { name: "Legacy", heading: "Legacy element", secondary: "Legacy element" },
565
+ { name: "Whitespace", heading: "Fallback element", secondary: "Fallback element" },
566
+ { name: "Title only", heading: "button#save", secondary: "Original label" },
567
+ { name: "Commented", heading: "Fix this", secondary: "Browser annotation" },
568
+ { name: "RTL subtitle", heading: "button#save", secondary: "تعليق المتصفح" },
569
+ { name: "RTL legacy", heading: "العنصر الأصلي", secondary: "العنصر الأصلي" },
570
+ {
571
+ name: "Long selector",
572
+ heading: 'main > section.settings-panel > form > button[data-action="save-all-account-preferences"]',
573
+ secondary: "Browser annotation",
574
+ },
575
+ ]
576
+
577
+ await page.evaluate(() => document.fonts.ready.then(() => undefined))
578
+
579
+ for (const item of cases) {
580
+ const section = gallery.getByRole("region", { name: item.name, exact: true })
581
+ const card = section.getByRole("button")
582
+ const heading = card.locator('[data-slot="attachment-card-title"]')
583
+ const label = card.locator('[data-slot="attachment-card-label"]')
584
+ await expect(heading).toHaveText(item.heading)
585
+ await expect(label).toHaveText(item.secondary)
586
+ }
587
+
588
+ const long = gallery.getByRole("region", { name: "Long selector", exact: true }).getByRole("button")
589
+ await expect(long).toHaveCSS("width", "160px")
590
+ await expect(long).toHaveCSS("height", "52px")
591
+ await expect(long.locator('[data-slot="attachment-card-title"]')).toHaveCSS("white-space", "nowrap")
592
+ await expect(long.locator('[data-slot="attachment-card-title"]')).toHaveCSS("text-overflow", "ellipsis")
593
+ const rtl = gallery.getByRole("region", { name: "RTL subtitle", exact: true }).getByRole("button")
594
+ const label = rtl.locator('[data-slot="attachment-card-label"]')
595
+ await expect(label).toHaveCSS("white-space", "nowrap")
596
+ await expect(label).toHaveCSS("text-overflow", "ellipsis")
597
+ await expect(label).toHaveAttribute("dir", "ltr")
598
+ await expect(label).toHaveCSS("unicode-bidi", "isolate")
599
+ expect(
600
+ await long
601
+ .locator('[data-slot="attachment-card-title"]')
602
+ .evaluate((element) => element.scrollWidth > element.clientWidth),
603
+ ).toBe(true)
604
+
605
+ const named = gallery.getByRole("region", { name: "Named", exact: true }).getByRole("button")
606
+ await page.clock.install()
607
+ await named.hover()
608
+ await page.clock.runFor(1000)
609
+ await expect(page.getByRole("tooltip")).toHaveText("button#save\nBrowser annotation")
610
+ await long.hover()
611
+ await page.clock.runFor(1000)
612
+ await expect(page.getByRole("tooltip", { name: /^main > section/ })).toHaveText(
613
+ 'main > section.settings-panel > form > button[data-action="save-all-account-preferences"]\nBrowser annotation',
614
+ )
615
+ await page.clock.resume()
616
+ await named.click()
617
+ await expect(gallery.getByLabel("Selected attachment")).toHaveText("Named")
618
+ await rtl.focus()
619
+ await page.keyboard.press("Enter")
620
+ await expect(gallery.getByLabel("Selected attachment")).toHaveText("RTL subtitle")
621
+ await named.focus()
622
+ await page.keyboard.press("Space")
623
+ await expect(gallery.getByLabel("Selected attachment")).toHaveText("Named")
624
+ })
625
+
626
+ story("links URLs in user messages without swallowing punctuation or mentions", async ({ mount }) => {
627
+ const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "links" } })
628
+ const links = timeline.locator('[data-slot="user-message-text"] a[data-slot="user-message-link"]')
629
+ await expect(links).toHaveCount(2)
630
+ await expect(links.nth(0)).toHaveText("https://github.com/Hona/mesh")
631
+ await expect(links.nth(0)).toHaveAttribute("href", "https://github.com/Hona/mesh")
632
+ await expect(links.nth(0)).toHaveAttribute("target", "_blank")
633
+ await expect(links.nth(0)).toHaveCSS("cursor", "pointer")
634
+ await expect(links.nth(1)).toHaveText("https://opencode.ai/docs")
635
+ await expect(timeline.getByText("@src/a.ts", { exact: true })).toBeVisible()
636
+ await expect(timeline.locator('[data-slot="user-message-text"]')).toHaveText(
637
+ "set it up on this pc https://github.com/Hona/mesh, then compare @src/a.ts with (https://opencode.ai/docs).",
638
+ )
639
+ })
@@ -0,0 +1,20 @@
1
+ import { expect, story } from "../../stories/playwright/story"
2
+
3
+ // Moved from packages/app/e2e/regression/session-timeline-notices.spec.ts
4
+ story("shows a delegating row while subagent input streams", async ({ mount }) => {
5
+ const timeline = await mount("current-session-research-agents--agent-research", { args: { scenario: "delegation" } })
6
+ const delegating = timeline.locator('[data-component="task-tool-delegating"]')
7
+ await expect(delegating).toBeVisible()
8
+ await expect(delegating).toHaveText("Delegating agent…")
9
+ await expect(delegating).toHaveCSS("line-height", "16px")
10
+ await expect(delegating.locator('[data-component="session-progress-indicator-v2"]')).toBeVisible()
11
+ await expect(timeline.locator('[data-component="task-tool-card"]')).toHaveCount(0)
12
+ await expect(timeline.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
13
+ })
14
+
15
+ // Moved from packages/app/e2e/regression/session-timeline-notices.spec.ts
16
+ story("waits for completion before labeling requested background work", async ({ mount }) => {
17
+ const timeline = await mount("current-session-research-agents--agent-research", { args: { scenario: "background" } })
18
+ await expect(timeline.locator('[data-component="task-tool-card"]')).toContainText("Inspect code")
19
+ await expect(timeline.locator('[data-component="task-tool-card"]')).not.toContainText("(background)")
20
+ })