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

Function initialize

packages/core/src/system-context/index.ts:198–206  ·  view source on GitHub ↗
(value: SystemContext)

Source from the content-addressed store, hash-verified

196
197/** Creates the immutable baseline and durable snapshot for a new generation. */
198export function initialize(value: SystemContext): Effect.Effect<Generation, InitializationBlocked> {
199 return observe(value).pipe(
200 Effect.flatMap((entries) => {
201 const unavailable = entries.flatMap((entry) => (entry._tag === "Unavailable" ? [entry.key] : []))
202 if (unavailable.length > 0) return new InitializationBlocked({ keys: unavailable })
203 return Effect.succeed(initializeObservation(entries))
204 }),
205 )
206}
207
208function initializeObservation(entries: ReadonlyArray<Entry>): Generation {
209 const available = entries.filter((entry): entry is AvailableEntry => entry._tag === "Available")

Callers

nothing calls this directly

Calls 2

initializeObservationFunction · 0.85
observeFunction · 0.70

Tested by

no test coverage detected