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

Function mergeSession

packages/app/src/context/global-sync/bootstrap.ts:147–159  ·  view source on GitHub ↗
(setStore: SetStoreFunction<State>, session: Session)

Source from the content-addressed store, hash-verified

145}
146
147function mergeSession(setStore: SetStoreFunction<State>, session: Session) {
148 setStore("session", (list) => {
149 const next = list.slice()
150 const idx = next.findIndex((item) => item.id >= session.id)
151 if (idx === -1) return [...next, session]
152 if (next[idx]?.id === session.id) {
153 next[idx] = session
154 return next
155 }
156 next.splice(idx, 0, session)
157 return next
158 })
159}
160
161function warmSessions(input: {
162 ids: string[]

Callers 1

warmSessionsFunction · 0.85

Calls 1

setStoreFunction · 0.85

Tested by

no test coverage detected