(ctx context.Context, convID, role, content string)
| 124 | } |
| 125 | |
| 126 | func (hs *HubSync) append(ctx context.Context, convID, role, content string) { |
| 127 | if content == "" { |
| 128 | return |
| 129 | } |
| 130 | stored, err := hs.client.AppendEvent(ctx, models.ConversationEvent{ |
| 131 | ConvID: convID, |
| 132 | Channel: hubChannelLocal, |
| 133 | Role: role, |
| 134 | Content: content, |
| 135 | }) |
| 136 | if err != nil { |
| 137 | hs.logger.Warn("hub sync: append failed", zap.String("role", role), zap.Error(err)) |
| 138 | return |
| 139 | } |
| 140 | hs.mu.Lock() |
| 141 | if stored.Seq > hs.lastSeq { |
| 142 | hs.lastSeq = stored.Seq |
| 143 | } |
| 144 | hs.mu.Unlock() |
| 145 | } |
| 146 | |
| 147 | // newSession rotates the shared conversation to a fresh thread, propagated to |
| 148 | // every channel resolving the same principal on their next turn. |
no test coverage detected