import {explanation} from './text.ts'; import type {GenerationEvent, GenerationRecords, MetricUnits, Target} from './contract.ts'; import {metric} from './format.ts'; import type {ReviewClock} from './clock.ts'; const labels = {waiting: '等待', detour: '绕路', retargeting: '换目标', discard: '丢弃', proposal_failure: '提案失败', token: '令牌'}; const outcome: Record = {time_conflict: '排时未通过', same_route: '仍是同一条路线', route_geometry_failed: '路线几何失败', accepted: '已接受'}; function target(value: Target | null) { if (!value) return '未提供'; return (value.stop_id || value.region_id || '目标') + (value.position_uv ? `(${value.position_uv.map(v => v.toFixed(2)).join(', ')} m)` : ''); } export function GenerationRows({records, actorId, clock, units}: {units: MetricUnits; records: GenerationRecords; actorId: string; clock: ReviewClock}) { const events = records.events.filter(e => e.actor_id === actorId && e.kind !== 'token'); function render(e: GenerationEvent, index: number) { return ; } return
等待、绕路、换目标和丢弃记录

全段记录 · {Object.entries(records.event_counts).map(([kind, count]) => {labels[kind as keyof typeof labels]} {metric(count, kind, units)} 次 )}

点击跳到记录时刻;换目标和提案失败为瞬时事件。

{events.map(render)} {records.budgets.filter(b => b.actor_id === actorId).map(b =>

意图 {b.intent_index}:已用 {b.used} / {b.limit} 次 · 每意图独立额度

)} {!events.length &&

该主体没有这些记录。

}
; }