Show persistent timestamps for operation and teacher messages
This commit is contained in:
@@ -142,6 +142,8 @@ export type ConversationContentBlock =
|
||||
export interface ConversationMessageNode {
|
||||
kind: 'message';
|
||||
id: string;
|
||||
/** Epoch ms: user send time / assistant completion time. Absent for undated history. */
|
||||
timestamp?: number;
|
||||
sourceEntryId?: string;
|
||||
clientRequestId?: string;
|
||||
role: 'user' | 'assistant';
|
||||
|
||||
@@ -96,6 +96,8 @@ export interface TeacherRequest {
|
||||
text: string;
|
||||
references: TeacherReference[];
|
||||
createdAt: string;
|
||||
/** Actual terminal time, absent in older history; never inferred from topic.updatedAt. */
|
||||
finishedAt?: string;
|
||||
sourceCursor: TeacherSourceContext['cursor'];
|
||||
sourceCapturedAt: string;
|
||||
includedSourceMessageIds: string[];
|
||||
|
||||
7
shared/message-timestamp.ts
Normal file
7
shared/message-timestamp.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/** Read only real, valid epoch milliseconds / ISO dates; never invent a history time. */
|
||||
export function messageTimestamp(value: unknown): number | undefined {
|
||||
const timestamp = typeof value === 'number' ? value
|
||||
: typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(value) ? Date.parse(value) : NaN;
|
||||
return Number.isFinite(timestamp) && timestamp >= 0 && !Number.isNaN(new Date(timestamp).getTime())
|
||||
? timestamp : undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user