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

Function rootSession

packages/app/src/utils/session-route.ts:39–48  ·  view source on GitHub ↗
(session: T, get: (sessionID: string) => Promise<T>)

Source from the content-addressed store, hash-verified

37}
38
39export async function rootSession<T extends SessionParent>(session: T, get: (sessionID: string) => Promise<T>) {
40 const seen = new Set([session.id])
41 let current = session
42 while (current.parentID) {
43 if (seen.has(current.parentID)) throw new Error(`Session parent cycle: ${current.parentID}`)
44 seen.add(current.parentID)
45 current = await get(current.parentID)
46 }
47 return current
48}

Callers 2

resolveFunction · 0.90

Calls 2

getFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected