Add ANSI rendering for bash tool output

This commit is contained in:
Shantur Rathore
2025-12-26 10:47:53 +00:00
parent 3606d9aa50
commit 71479a59a7
9 changed files with 171 additions and 20 deletions

View File

@@ -1,8 +1,10 @@
import type { ClientPart } from "../../types/message"
import type { MessageRecord } from "./types"
type ClientPartWithRevision = ClientPart & { revision?: number }
export interface RecordDisplayData {
orderedParts: ClientPart[]
orderedParts: ClientPartWithRevision[]
}
interface RecordDisplayCacheEntry {
@@ -23,12 +25,12 @@ export function buildRecordDisplayData(instanceId: string, record: MessageRecord
return cached.data
}
const orderedParts: ClientPart[] = []
const orderedParts: ClientPartWithRevision[] = []
for (const partId of record.partIds) {
const entry = record.parts[partId]
if (!entry?.data) continue
orderedParts.push(entry.data)
orderedParts.push({ ...(entry.data as ClientPart), revision: entry.revision })
}
const data: RecordDisplayData = { orderedParts }