MCPcopy Create free account
hub / github.com/anomalyco/opencode / llm

Function llm

packages/opencode/test/session/compaction.test.ts:295–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

293}
294
295function llm() {
296 const queue: Array<
297 Stream.Stream<LLMEvent, unknown> | ((input: LLM.StreamInput) => Stream.Stream<LLMEvent, unknown>)
298 > = []
299
300 return {
301 push(stream: Stream.Stream<LLMEvent, unknown> | ((input: LLM.StreamInput) => Stream.Stream<LLMEvent, unknown>)) {
302 queue.push(stream)
303 },
304 llmLayer: Layer.succeed(
305 LLM.Service,
306 LLM.Service.of({
307 stream: (input) => {
308 const item = queue.shift() ?? Stream.empty
309 const stream = typeof item === "function" ? item(input) : item
310 return stream.pipe(Stream.mapEffect((event) => Effect.succeed(event)))
311 },
312 }),
313 ),
314 }
315}
316
317function reply(
318 text: string,

Callers 1

compaction.test.tsFile · 0.70

Calls 1

itemFunction · 0.50

Tested by

no test coverage detected