|
@@ -1,7 +1,8 @@
|
|
|
import { parseCommentNote, readCommentMetadata } from "@/utils/comment-note"
|
|
import { parseCommentNote, readCommentMetadata } from "@/utils/comment-note"
|
|
|
-import { AssistantMessage, Part, SessionStatus, SnapshotFileDiff, UserMessage } from "@opencode-ai/sdk/v2"
|
|
|
|
|
|
|
+import { AssistantMessage, Part, SessionStatus, UserMessage } from "@opencode-ai/sdk/v2"
|
|
|
import { groupParts, renderable, type PartGroup } from "@opencode-ai/session-ui/message-part"
|
|
import { groupParts, renderable, type PartGroup } from "@opencode-ai/session-ui/message-part"
|
|
|
import { TimelineRow, type SummaryDiff } from "./timeline-row"
|
|
import { TimelineRow, type SummaryDiff } from "./timeline-row"
|
|
|
|
|
+import { uniqueSummaryDiffs } from "./summary-diffs"
|
|
|
|
|
|
|
|
export { TimelineRow, type SummaryDiff } from "./timeline-row"
|
|
export { TimelineRow, type SummaryDiff } from "./timeline-row"
|
|
|
|
|
|
|
@@ -137,14 +138,7 @@ export namespace Timeline {
|
|
|
|
|
|
|
|
if (isActive && status === "retry") rows.push(new TimelineRow.Retry({ userMessageID: userMessage.id }))
|
|
if (isActive && status === "retry") rows.push(new TimelineRow.Retry({ userMessageID: userMessage.id }))
|
|
|
|
|
|
|
|
- const diffs = (userMessage.summary?.diffs ?? [])
|
|
|
|
|
- .reduceRight<SummaryDiff[]>((result, diff) => {
|
|
|
|
|
- if (!isSummaryDiff(diff)) return result
|
|
|
|
|
- if (result.some((item) => item.file === diff.file)) return result
|
|
|
|
|
- result.push(diff)
|
|
|
|
|
- return result
|
|
|
|
|
- }, [])
|
|
|
|
|
- .reverse()
|
|
|
|
|
|
|
+ const diffs = uniqueSummaryDiffs(userMessage.summary?.diffs)
|
|
|
if (diffs.length > 0 && (status === "idle" || !isActive)) {
|
|
if (diffs.length > 0 && (status === "idle" || !isActive)) {
|
|
|
rows.push(
|
|
rows.push(
|
|
|
new TimelineRow.DiffSummary({
|
|
new TimelineRow.DiffSummary({
|
|
@@ -169,10 +163,6 @@ export namespace Timeline {
|
|
|
return rows
|
|
return rows
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function isSummaryDiff(value: SnapshotFileDiff): value is SummaryDiff {
|
|
|
|
|
- return typeof value.file === "string"
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function reasoningHeading(text: string) {
|
|
function reasoningHeading(text: string) {
|
|
|
const markdown = text.replace(/\r\n?/g, "\n")
|
|
const markdown = text.replace(/\r\n?/g, "\n")
|
|
|
const html = markdown.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i)
|
|
const html = markdown.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i)
|