WithClock injects the time source used for the session's CreatedAt, for timestamping messages it generates (summaries, compaction input), and for messages added through WithUserMessage/WithSystemMessage/ WithImplicitUserMessage. Because those message options read the clock when they run, WithClock m
(now func() time.Time)
| 889 | // ordering). Primarily for tests that need a deterministic clock; production |
| 890 | // code leaves it unset and falls back to time.Now. |
| 891 | func WithClock(now func() time.Time) Opt { |
| 892 | return func(s *Session) { |
| 893 | s.clock = now |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | // WithIDGen injects the generator used to mint the session ID when no explicit |
| 898 | // ID is provided. Primarily for tests that need deterministic IDs; production |
no outgoing calls