MCPcopy
hub / github.com/openai/codex-plugin-cc / parseStructuredOutput

Function parseStructuredOutput

plugins/codex/scripts/lib/codex.mjs:1188–1213  ·  view source on GitHub ↗
(rawOutput, fallback = {})

Source from the content-addressed store, hash-verified

1186}
1187
1188export function parseStructuredOutput(rawOutput, fallback = {}) {
1189 if (!rawOutput) {
1190 return {
1191 parsed: null,
1192 parseError: fallback.failureMessage ?? "Codex did not return a final structured message.",
1193 rawOutput: rawOutput ?? "",
1194 ...fallback
1195 };
1196 }
1197
1198 try {
1199 return {
1200 parsed: JSON.parse(rawOutput),
1201 parseError: null,
1202 rawOutput,
1203 ...fallback
1204 };
1205 } catch (error) {
1206 return {
1207 parsed: null,
1208 parseError: error.message,
1209 rawOutput,
1210 ...fallback
1211 };
1212 }
1213}
1214
1215export function readOutputSchema(schemaPath) {
1216 return readJsonFile(schemaPath);

Callers 1

executeReviewRunFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected