MCPcopy Create free account
hub / github.com/pingdotgg/t3code / toOpenCodeQuestionAnswers

Function toOpenCodeQuestionAnswers

apps/server/src/provider/opencodeRuntime.ts:249–266  ·  view source on GitHub ↗
(
  request: QuestionRequest,
  answers: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

247}
248
249export function toOpenCodeQuestionAnswers(
250 request: QuestionRequest,
251 answers: Record<string, unknown>,
252): Array<QuestionAnswer> {
253 return request.questions.map((question, index) => {
254 const raw =
255 answers[openCodeQuestionId(index, question)] ??
256 answers[question.header] ??
257 answers[question.question];
258 if (Array.isArray(raw)) {
259 return raw.filter((value): value is string => typeof value === "string");
260 }
261 if (typeof raw === "string") {
262 return raw.trim().length > 0 ? [raw] : [];
263 }
264 return [];
265 });
266}
267
268function ensureRuntimeError(
269 operation: OpenCodeRuntimeError["operation"],

Callers 1

makeOpenCodeAdapterFunction · 0.90

Calls 1

openCodeQuestionIdFunction · 0.85

Tested by

no test coverage detected