MCPcopy Create free account
hub / github.com/anomalyco/opencode / trackPartChange

Function trackPartChange

packages/app/src/context/server-session.ts:334–347  ·  view source on GitHub ↗
(sessionID: string, messageID: string, partID: string)

Source from the content-addressed store, hash-verified

332 }
333
334 const trackPartChange = (sessionID: string, messageID: string, partID: string) => {
335 const load = messageLoads.get(sessionID)
336 if (!load) return
337 // A part event keeps an existing parent when the fetched page omits it without overriding fetched metadata.
338 const messages = data.message[sessionID]
339 if (messages && Binary.search(messages, messageID, (message) => message.id).found)
340 load.retainedMessages.add(messageID)
341 const parts = load.touchedParts.get(messageID)
342 if (parts) {
343 parts.add(partID)
344 return
345 }
346 load.touchedParts.set(messageID, new Set([partID]))
347 }
348
349 const resetMessageLoad = (sessionID: string, load: MessageLoadState) => {
350 load.touchedMessages.clear()

Callers 1

applyFunction · 0.85

Calls 3

getMethod · 0.65
addMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected