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

Function drainWith

packages/opencode/test/session/llm.test.ts:62–74  ·  view source on GitHub ↗
(layer: Layer.Layer<LLM.Service>, input: LLM.StreamInput)

Source from the content-addressed store, hash-verified

60// drainWith builds an isolated runtime so custom replacements fully own LLM and
61// its transitive deps.
62const drainWith = (layer: Layer.Layer<LLM.Service>, input: LLM.StreamInput) =>
63 Effect.gen(function* () {
64 const ctx = yield* InstanceRef
65 if (!ctx) return yield* Effect.die("InstanceRef not provided")
66 return yield* Effect.promise(() =>
67 Effect.runPromise(
68 LLM.Service.use((svc) => svc.stream(input).pipe(Stream.runDrain)).pipe(
69 Effect.provide(layer),
70 Effect.provideService(InstanceRef, ctx),
71 ),
72 ),
73 )
74 })
75
76function llmLayerWithExecutor(
77 options: {

Callers 1

llm.test.tsFile · 0.85

Calls 2

streamMethod · 0.80
useMethod · 0.45

Tested by

no test coverage detected