Skip to content

Commit 9c7de47

Browse files
chore: generate
1 parent f023c63 commit 9c7de47

8 files changed

Lines changed: 145 additions & 66 deletions

File tree

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/e2e/regression/session-timeline-collapse-state.spec.ts

Lines changed: 83 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ test.describe("regression: session timeline local row state", () => {
168168
},
169169
})
170170

171-
await expect(wrapper.locator('[data-slot="diff-changes-additions"]').filter({ hasText: "+2" }).first()).toBeVisible({ timeout: 10_000 })
171+
await expect(wrapper.locator('[data-slot="diff-changes-additions"]').filter({ hasText: "+2" }).first()).toBeVisible(
172+
{ timeout: 10_000 },
173+
)
172174
expect(await readDiffProbe(page)).toEqual({ fileMarker: "before", shadowRoots: 0, toolMarker: "before" })
173175
})
174176
})
@@ -194,23 +196,29 @@ async function expectExpanded(locator: Locator, expected: boolean) {
194196
}
195197

196198
async function readToolState(page: Page) {
197-
return page.locator(`[data-timeline-part-id="${editPartID}"]`).first().evaluate((element, textPartID) => ({
198-
expanded: (() => {
199-
const trigger = element.querySelector('[data-slot="collapsible-trigger"]')
200-
const aria = trigger?.getAttribute("aria-expanded")
201-
if (aria === "true") return true
202-
if (aria === "false") return false
203-
204-
const root = element.querySelector('[data-component="collapsible"]')
205-
if (root?.hasAttribute("data-expanded")) return true
206-
if (root?.hasAttribute("data-closed")) return false
207-
208-
const content = element.querySelector<HTMLElement>('[data-slot="collapsible-content"]')
209-
return !!content && content.getBoundingClientRect().height > 0
210-
})(),
211-
row: element.closest("[data-timeline-row]")?.getAttribute("data-timeline-row"),
212-
streamedTextVisible: !!document.querySelector(`[data-timeline-part-id="${textPartID}"]`),
213-
}), textPartID)
199+
return page
200+
.locator(`[data-timeline-part-id="${editPartID}"]`)
201+
.first()
202+
.evaluate(
203+
(element, textPartID) => ({
204+
expanded: (() => {
205+
const trigger = element.querySelector('[data-slot="collapsible-trigger"]')
206+
const aria = trigger?.getAttribute("aria-expanded")
207+
if (aria === "true") return true
208+
if (aria === "false") return false
209+
210+
const root = element.querySelector('[data-component="collapsible"]')
211+
if (root?.hasAttribute("data-expanded")) return true
212+
if (root?.hasAttribute("data-closed")) return false
213+
214+
const content = element.querySelector<HTMLElement>('[data-slot="collapsible-content"]')
215+
return !!content && content.getBoundingClientRect().height > 0
216+
})(),
217+
row: element.closest("[data-timeline-row]")?.getAttribute("data-timeline-row"),
218+
streamedTextVisible: !!document.querySelector(`[data-timeline-part-id="${textPartID}"]`),
219+
}),
220+
textPartID,
221+
)
214222
}
215223

216224
async function installDiffProbe(page: Page) {
@@ -231,27 +239,33 @@ async function installDiffProbe(page: Page) {
231239
}
232240

233241
async function markDiffProbe(page: Page) {
234-
await page.locator(`[data-timeline-part-id="${editPartID}"]`).first().evaluate((element) => {
235-
const tool = element as HTMLElement
236-
const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]')
237-
if (!file) throw new Error("missing edit diff file")
238-
239-
tool.dataset.timelineProbe = "before"
240-
file.dataset.timelineProbe = "before"
241-
window.__timelineDiffProbe.reset()
242-
})
242+
await page
243+
.locator(`[data-timeline-part-id="${editPartID}"]`)
244+
.first()
245+
.evaluate((element) => {
246+
const tool = element as HTMLElement
247+
const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]')
248+
if (!file) throw new Error("missing edit diff file")
249+
250+
tool.dataset.timelineProbe = "before"
251+
file.dataset.timelineProbe = "before"
252+
window.__timelineDiffProbe.reset()
253+
})
243254
}
244255

245256
async function readDiffProbe(page: Page) {
246-
return page.locator(`[data-timeline-part-id="${editPartID}"]`).first().evaluate((element) => {
247-
const tool = element as HTMLElement
248-
const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]')
249-
return {
250-
fileMarker: file?.dataset.timelineProbe,
251-
shadowRoots: window.__timelineDiffProbe.shadowRoots(),
252-
toolMarker: tool.dataset.timelineProbe,
253-
}
254-
})
257+
return page
258+
.locator(`[data-timeline-part-id="${editPartID}"]`)
259+
.first()
260+
.evaluate((element) => {
261+
const tool = element as HTMLElement
262+
const file = tool.querySelector<HTMLElement>('[data-component="file"][data-mode="diff"]')
263+
return {
264+
fileMarker: file?.dataset.timelineProbe,
265+
shadowRoots: window.__timelineDiffProbe.shadowRoots(),
266+
toolMarker: tool.dataset.timelineProbe,
267+
}
268+
})
255269
}
256270

257271
function editPartWithAdditions(additions: number) {
@@ -292,10 +306,23 @@ async function mockServer(page: Page, events: EventPayload[]) {
292306

293307
const path = url.pathname
294308
if (path === "/global/event") return sse(route, events.splice(0))
295-
if (path === "/global/config" || path === "/config" || path === "/provider/auth" || path === "/mcp" || path === "/session/status") return json(route, {})
296-
if (["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/status", "/vcs/diff"].includes(path)) return json(route, [])
309+
if (
310+
path === "/global/config" ||
311+
path === "/config" ||
312+
path === "/provider/auth" ||
313+
path === "/mcp" ||
314+
path === "/session/status"
315+
)
316+
return json(route, {})
317+
if (
318+
["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/status", "/vcs/diff"].includes(
319+
path,
320+
)
321+
)
322+
return json(route, [])
297323
if (path === "/provider") return json(route, provider())
298-
if (path === "/path") return json(route, { state: directory, config: directory, worktree: directory, directory, home: "C:/OpenCode" })
324+
if (path === "/path")
325+
return json(route, { state: directory, config: directory, worktree: directory, directory, home: "C:/OpenCode" })
299326
if (path === "/project") return json(route, [project()])
300327
if (path === "/project/current") return json(route, project())
301328
if (path === "/agent") return json(route, [{ name: "build", mode: "primary" }])
@@ -309,11 +336,26 @@ async function mockServer(page: Page, events: EventPayload[]) {
309336
}
310337

311338
function project() {
312-
return { id: projectID, worktree: directory, vcs: "git", name: "timeline-state-regression", time: { created: 1700000000000, updated: 1700000000000 }, sandboxes: [] }
339+
return {
340+
id: projectID,
341+
worktree: directory,
342+
vcs: "git",
343+
name: "timeline-state-regression",
344+
time: { created: 1700000000000, updated: 1700000000000 },
345+
sandboxes: [],
346+
}
313347
}
314348

315349
function session() {
316-
return { id: sessionID, slug: "timeline-state-regression", projectID, directory, title, version: "dev", time: { created: 1700000000000, updated: 1700000000000 } }
350+
return {
351+
id: sessionID,
352+
slug: "timeline-state-regression",
353+
projectID,
354+
directory,
355+
title,
356+
version: "dev",
357+
time: { created: 1700000000000, updated: 1700000000000 },
358+
}
317359
}
318360

319361
function provider() {

packages/app/e2e/regression/session-timeline-context-resize.spec.ts

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const model = { providerID: "opencode", modelID: "claude-opus-4-6", variant: "ma
88
const contextIDs = ["prt_0100_read", "prt_0101_glob", "prt_0102_grep", "prt_0103_list"]
99
const followingTextID = "prt_0104_text"
1010

11-
type Message = { info: Record<string, unknown> & { id: string; role: "user" | "assistant" }; parts: Record<string, unknown>[] }
11+
type Message = {
12+
info: Record<string, unknown> & { id: string; role: "user" | "assistant" }
13+
parts: Record<string, unknown>[]
14+
}
1215

13-
const messages = [
14-
...Array.from({ length: 8 }, (_, index) => turn(index, false)).flat(),
15-
...turn(10, true),
16-
]
16+
const messages = [...Array.from({ length: 8 }, (_, index) => turn(index, false)).flat(), ...turn(10, true)]
1717

1818
test.describe("regression: session timeline context group resize", () => {
1919
test("remeasures a recent explored context group before the next paint", async ({ page }) => {
@@ -76,7 +76,8 @@ async function sampleExpansion(page: Page) {
7676
const trigger = context?.querySelector<HTMLElement>('[data-slot="collapsible-trigger"]')
7777
const contextRow = context?.closest<HTMLElement>('[data-timeline-row="AssistantPart"]')
7878
const textRow = text?.closest<HTMLElement>('[data-timeline-row="AssistantPart"]')
79-
if (!context || !text || !scroller || !trigger || !contextRow || !textRow) throw new Error("missing regression nodes")
79+
if (!context || !text || !scroller || !trigger || !contextRow || !textRow)
80+
throw new Error("missing regression nodes")
8081

8182
scroller.scrollTop = scroller.scrollHeight
8283
const samples: {
@@ -213,10 +214,17 @@ async function mockServer(page: Page) {
213214

214215
const path = url.pathname
215216
if (path === "/global/event" || path === "/event") return sse(route)
216-
if (["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"].includes(path)) return json(route, {})
217-
if (["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/status", "/vcs/diff"].includes(path)) return json(route, [])
217+
if (["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"].includes(path))
218+
return json(route, {})
219+
if (
220+
["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/status", "/vcs/diff"].includes(
221+
path,
222+
)
223+
)
224+
return json(route, [])
218225
if (path === "/provider") return json(route, provider())
219-
if (path === "/path") return json(route, { state: directory, config: directory, worktree: directory, directory, home: "C:/OpenCode" })
226+
if (path === "/path")
227+
return json(route, { state: directory, config: directory, worktree: directory, directory, home: "C:/OpenCode" })
220228
if (path === "/project") return json(route, [project()])
221229
if (path === "/project/current") return json(route, project())
222230
if (path === "/agent") return json(route, [{ name: "build", mode: "primary" }])
@@ -238,11 +246,26 @@ function id(prefix: string, index: number) {
238246
}
239247

240248
function project() {
241-
return { id: projectID, worktree: directory, vcs: "git", name: "context-resize-regression", time: { created: 1700000000000, updated: 1700000000000 }, sandboxes: [] }
249+
return {
250+
id: projectID,
251+
worktree: directory,
252+
vcs: "git",
253+
name: "context-resize-regression",
254+
time: { created: 1700000000000, updated: 1700000000000 },
255+
sandboxes: [],
256+
}
242257
}
243258

244259
function session() {
245-
return { id: sessionID, slug: "context-resize-regression", projectID, directory, title, version: "dev", time: { created: 1700000000000, updated: 1700000000000 } }
260+
return {
261+
id: sessionID,
262+
slug: "context-resize-regression",
263+
projectID,
264+
directory,
265+
title,
266+
version: "dev",
267+
time: { created: 1700000000000, updated: 1700000000000 },
268+
}
246269
}
247270

248271
function provider() {

packages/app/src/pages/session/message-timeline.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,9 @@ export function MessageTimeline(props: {
10181018
return (
10191019
<ContextToolGroup
10201020
parts={parts()}
1021-
busy={workingTurn(row().userMessageID) && lastAssistantGroupKey().get(row().userMessageID) === row().group.key}
1021+
busy={
1022+
workingTurn(row().userMessageID) && lastAssistantGroupKey().get(row().userMessageID) === row().group.key
1023+
}
10221024
onSizeChange={measureTimeline}
10231025
/>
10241026
)
@@ -1149,7 +1151,11 @@ export function MessageTimeline(props: {
11491151
{(message) => (
11501152
<div data-slot="session-turn-message-container" class="w-full px-4 md:px-5">
11511153
<div data-slot="session-turn-message-content" aria-live="off">
1152-
<Message message={message()} parts={getMsgParts(userMessageRow().userMessageID)} actions={props.actions} />
1154+
<Message
1155+
message={message()}
1156+
parts={getMsgParts(userMessageRow().userMessageID)}
1157+
actions={props.actions}
1158+
/>
11531159
</div>
11541160
</div>
11551161
)}
@@ -1178,7 +1184,10 @@ export function MessageTimeline(props: {
11781184
return (
11791185
<TimelineRowFrame row={assistantPartRow}>
11801186
<div data-slot="session-turn-message-container" class="w-full px-4 md:px-5">
1181-
<div data-slot="session-turn-assistant-content" aria-hidden={workingTurn(assistantPartRow().userMessageID)}>
1187+
<div
1188+
data-slot="session-turn-assistant-content"
1189+
aria-hidden={workingTurn(assistantPartRow().userMessageID)}
1190+
>
11821191
{renderAssistantPartGroup(assistantPartRow)}
11831192
</div>
11841193
</div>

packages/ui/src/components/file.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,12 @@ function DiffViewer<T>(props: DiffFileProps<T>) {
10891089
return sampledChecksum(contents)
10901090
}
10911091

1092-
const before = local.before ? { ...local.before, contents: beforeContents, cacheKey: cacheKey(beforeContents) } : undefined
1093-
const after = local.after ? { ...local.after, contents: afterContents, cacheKey: cacheKey(afterContents) } : undefined
1092+
const before = local.before
1093+
? { ...local.before, contents: beforeContents, cacheKey: cacheKey(beforeContents) }
1094+
: undefined
1095+
const after = local.after
1096+
? { ...local.after, contents: afterContents, cacheKey: cacheKey(afterContents) }
1097+
: undefined
10941098
const targetChanged =
10951099
local.fileDiff !== undefined
10961100
? instanceFileDiff !== local.fileDiff

packages/ui/src/components/message-part.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2278,7 +2278,12 @@ ToolRegistry.register({
22782278
}
22792279
>
22802280
<div data-component="apply-patch-file-diff">
2281-
<Dynamic component={fileComponent} mode="diff" virtualize={props.virtualizeDiff} fileDiff={single()!.view.fileDiff} />
2281+
<Dynamic
2282+
component={fileComponent}
2283+
mode="diff"
2284+
virtualize={props.virtualizeDiff}
2285+
fileDiff={single()!.view.fileDiff}
2286+
/>
22822287
</div>
22832288
</ToolFileAccordion>
22842289
</BasicTool>

packages/ui/src/components/session-diff.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ describe("session diff", () => {
7171
test("keeps capped header-only patches partial", () => {
7272
const fileDiff = resolveFileDiff({
7373
file: "a.ts",
74-
patch: "Index: a.ts\n===================================================================\n--- a.ts\t\n+++ a.ts\t\n",
74+
patch:
75+
"Index: a.ts\n===================================================================\n--- a.ts\t\n+++ a.ts\t\n",
7576
})
7677

7778
expect(fileDiff.name).toBe("a.ts")

packages/ui/src/components/tool-error-card.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ export function ToolErrorCard(props: ToolErrorCardProps) {
9292

9393
return (
9494
<Card {...rest} data-kind="tool-error-card" data-open={open() ? "true" : "false"} variant="error">
95-
<Collapsible
96-
class="tool-collapsible"
97-
data-open={open() ? "true" : "false"}
98-
open={open()}
99-
onOpenChange={setOpen}
100-
>
95+
<Collapsible class="tool-collapsible" data-open={open() ? "true" : "false"} open={open()} onOpenChange={setOpen}>
10196
<Collapsible.Trigger>
10297
<div data-component="tool-trigger">
10398
<div data-slot="basic-tool-tool-trigger-content">

0 commit comments

Comments
 (0)