MCPcopy
hub / github.com/anomalyco/opencode / selectSessionLineage

Function selectSessionLineage

packages/app/src/utils/session-route.ts:30–37  ·  view source on GitHub ↗
(
  sessionID: string,
  cached: T | undefined,
  resolved: T | undefined,
)

Source from the content-addressed store, hash-verified

28type SessionParent = { id: string; parentID?: string }
29
30export function selectSessionLineage<T extends { session: { id: string } }>(
31 sessionID: string,
32 cached: T | undefined,
33 resolved: T | undefined,
34) {
35 if (cached?.session.id === sessionID) return cached
36 if (resolved?.session.id === sessionID) return resolved
37}
38
39export async function rootSession<T extends SessionParent>(session: T, get: (sessionID: string) => Promise<T>) {
40 const seen = new Set([session.id])

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected