fix(ui): reconcile trajectory ledger with current client contracts

This commit is contained in:
_Kerman
2026-07-28 10:23:44 +08:00
parent fb3e4effba
commit 92081094ae
12 changed files with 66 additions and 69 deletions

View File

@@ -58,7 +58,6 @@ function materializeNode(
return {
kind: 'user', seq: event.seq, time: event.time,
content: event.data.content, source: event.data.source,
meta: event.data.meta,
}
case 'assistant/message':
return {
@@ -76,7 +75,6 @@ function materializeNode(
return {
kind: 'steering', seq: event.seq, time: event.time, turn: event.data.turn,
content: event.data.content, source: event.data.source,
meta: event.data.meta,
}
case 'tool/result': {
const call = callIndex.get(String(event.data.callId))

View File

@@ -955,7 +955,7 @@ function deriveModelRequests(events: readonly SessionEvent[]): readonly ModelReq
const key = modelRequestKey(sourceEvent.data.turn, sourceEvent.data.step)
const index = byStep.get(key)
const request = index === undefined ? undefined : requests[index]
if (request !== undefined && request.status === 'running') {
if (index !== undefined && request !== undefined && request.status === 'running') {
requests[index] = {
...request,
completedAt: sourceEvent.time,

View File

@@ -88,6 +88,7 @@ function mount(
if (key === 'conversation.session') {
return (
<ConversationSession
composer={null}
sessionId={SID}
SessionProvider={({ children }) => children(SID)}
useSession={useSession}

View File

@@ -72,7 +72,10 @@ function previewPrimitive(value: unknown): ReactNode {
if (typeof value === 'symbol') {
return <span className={css.otherValue}>{value.description ?? 'Symbol'}</span>
}
return <span className={css.otherValue}>{value.name || 'Function'}</span>
if (typeof value === 'function') {
return <span className={css.otherValue}>{value.name || 'Function'}</span>
}
return null
}
function previewValue(value: unknown, depth: number): ReactNode {

View File

@@ -1147,7 +1147,7 @@ function RequestTiming({
}: {
assistant: TableRecord | undefined
anchor: TableRecord | undefined
request?: TrajectoryRequestNumber
request: TrajectoryRequestNumber | undefined
}) {
if (assistant !== undefined) return <RecordTiming record={assistant} />
if (request?.startedAt !== undefined) {
@@ -1746,8 +1746,9 @@ export function TrajectoryTable({
onPointerDown={(event) => {
if (event.button !== 0) return
const details = event.currentTarget.parentElement
const split = details?.parentElement
if (details === null || split === null) return
if (details === null) return
const split = details.parentElement
if (split === null) return
const splitWidth = split.getBoundingClientRect().width
detailsResizeDrag.current = {
pointerId: event.pointerId,
@@ -1785,8 +1786,9 @@ export function TrajectoryTable({
onKeyDown={(event) => {
if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return
const details = event.currentTarget.parentElement
const split = details?.parentElement
if (details === null || split === null) return
if (details === null) return
const split = details.parentElement
if (split === null) return
const direction = event.key === 'ArrowLeft' ? 1 : -1
const currentDetailsWidth = details.getBoundingClientRect().width
const splitWidth = split.getBoundingClientRect().width

View File

@@ -331,7 +331,6 @@ export function deriveTrajectoryLayout(input: TrajectoryLayoutInput): readonly T
text: summarizeContent(node.content),
sourceSeq: node.seq,
messageSource: node.source,
...(node.meta === undefined ? {} : { messageMeta: node.meta }),
inputDetail: detailContent(node.content),
sourceBlocks: node.content.map(block => sourceBlock(block)),
timeSeconds: 0,

View File

@@ -130,6 +130,7 @@ function mount(slots: SlotsService, nodes: ConversationSnapshot['nodes'] = NODES
}) as unknown as ConversationSessionProps['renderSlot']
return render(
<ConversationSession
composer={null}
sessionId={SID}
SessionProvider={({ children }) => children(SID)}
useSession={useSession}