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

Function complete

packages/llm/src/schema/events.ts:594–602  ·  view source on GitHub ↗
(state: State)

Source from the content-addressed store, hash-verified

592
593 /** Return a completed response only after a terminal finish or provider error. */
594 export const complete = (state: State): LLMResponse | undefined =>
595 state.finishReason === undefined
596 ? undefined
597 : new LLMResponse({
598 message: state.message,
599 events: [...state.events],
600 usage: state.usage,
601 finishReason: state.finishReason,
602 })
603
604 /** Convenience reducer for callers that already have a collected event list. */
605 export const fromEvents = (events: ReadonlyArray<LLMEvent>) => complete(events.reduce(reduce, empty()))

Callers 1

fromEventsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected