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

Function eventually

packages/core/test/plugin/provider-opencode.test.ts:33–45  ·  view source on GitHub ↗
(
  effect: Effect.Effect<A>,
  predicate: (value: A) => boolean,
  remaining = 1000,
)

Source from the content-addressed store, hash-verified

31}
32
33function eventually<A>(
34 effect: Effect.Effect<A>,
35 predicate: (value: A) => boolean,
36 remaining = 1000,
37): Effect.Effect<A, Error> {
38 return Effect.gen(function* () {
39 const value = yield* effect
40 if (predicate(value)) return value
41 if (remaining === 0) return yield* Effect.fail(new Error("Timed out waiting for value"))
42 yield* Effect.promise(() => Bun.sleep(1))
43 return yield* eventually(effect, predicate, remaining - 1)
44 })
45}
46
47function withEnv<A, E, R>(vars: Record<string, string | undefined>, effect: () => Effect.Effect<A, E, R>) {
48 return Effect.acquireUseRelease(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected