trajectoryRecordId function
Resolves the identity that survives prepending older projected records.
Ported from the TS trajectoryRecordId: an explicit recordId wins,
then the owning tool callId, then the host sourceSeq, and finally the
index fixture fallback.
Implementation
String trajectoryRecordId({
required String kind,
String? recordId,
String? callId,
int? sourceSeq,
required int index,
}) {
if (recordId != null) return recordId;
if (callId != null) return '$kind\u0000call\u0000$callId';
if (sourceSeq != null) return '$kind\u0000seq\u0000$sourceSeq';
return '$kind\u0000index\u0000$index';
}