feat(session): add per-message created_at timestamps

- Persistence layer (jsonl.go addMsg/SetHistory) normalizes CreatedAt
  when missing so the invariant is guaranteed at the storage boundary
- API layer (session.go) exposes created_at on all transcript message
  types with session.updated fallback for legacy messages
- Frontend uses per-message timestamps when available
- messagesContentEqual ignores CreatedAt for tail-matching after
  JSONL roundtrip

Fixes #2787
This commit is contained in:
LiusCraft
2026-05-11 00:45:01 +08:00
parent 2992eccbf0
commit 81bbef62b1
10 changed files with 206 additions and 14 deletions
+3
View File
@@ -1,5 +1,7 @@
package protocoltypes
import "time"
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type,omitempty"`
@@ -87,6 +89,7 @@ type Message struct {
Role string `json:"role"`
Content string `json:"content"`
ModelName string `json:"model_name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Media []string `json:"media,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
ReasoningContent string `json:"reasoning_content,omitempty"`