Dashboard › opencode-lore › Distillation
e1f880a8-2f41-4da0-9a42-50252c640f53["lore_tm_v1_-ap8uVnrgfRZbxX23Se2_r2jtju19Oxeosih1nfizfE"]
Date: Sep 16, 2026
packages/gateway/src/pipeline.ts excerpt (lines 9019–10008) shows Responses API stream completion and validation logic: it parses JSON stream data, validates terminal response structure and statuses including "cancelled", reconciles streamed output with response.output, and applies stricter output-index matching when opts.validation === "public".onSynthesizedDone?.(outputIndex, actual) when a missing done event must be synthesized, and tracks reference items through type ReferenceLifecycle = { id: string; done: boolean }.completionAttempted guard, calls opts.runFollowUp, logs failures as openai-responses recall-aware onComplete error:, and obtains a final-round reason from input.finalRecallRound ? recallBudget.stopReason() : undefined."response.output_item.done" events, aggregates usage with res.usage ?? ZERO_USAGE, preserves terminalResponse?.incomplete_details, emits an "incomplete" final status with an incomplete reason when applicable, and sorts output indices numerically with .sort((a, b) => a - b).${frame}\n\n to the output and removes the abort listener with signal.removeEventListener("abort", onStreamAbort) during cleanup.