MCPcopy Create free account
hub / github.com/diillson/chatcli / append

Method append

cli/hub_sync.go:126–145  ·  view source on GitHub ↗
(ctx context.Context, convID, role, content string)

Source from the content-addressed store, hash-verified

124}
125
126func (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.

Callers 1

mirrorTurnMethod · 0.95

Calls 6

WarnMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
AppendEventMethod · 0.65
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected