MCPcopy Index your code
hub / github.com/anomalyco/opencode / index

Function index

packages/app/src/context/directory-sync.ts:46–59  ·  view source on GitHub ↗
(sessionID: string)

Source from the content-addressed store, hash-verified

44 }) as SetStoreFunction<State>
45
46 const index = (sessionID: string) => {
47 const session = serverSync.session.get(sessionID)
48 if (!session || session.directory !== directory) return
49 const [store, setStore] = current()
50 const result = Binary.search(store.session, session.id, (item) => item.id)
51 if (result.found) {
52 setStore("session", result.index, reconcile(session))
53 return
54 }
55 setStore(
56 "session",
57 produce((draft) => void draft.splice(result.index, 0, session)),
58 )
59 }
60
61 return {
62 data,

Callers 3

rememberFunction · 0.70
syncFunction · 0.70
NewHomeFunction · 0.50

Calls 4

setStoreFunction · 0.85
currentFunction · 0.70
getMethod · 0.65
reconcileFunction · 0.50

Tested by

no test coverage detected