@apo-ai/sdk 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -284,7 +284,18 @@ async function callSecondJudge(args) {
284
284
  evidence.error = `Second judge API ${response.status}: ${body.slice(0, 200)}`;
285
285
  return evidence;
286
286
  }
287
- const data = await response.json();
287
+ const contentType = response.headers.get("content-type") ?? "";
288
+ if (contentType.includes("text/html")) {
289
+ evidence.error = "Second judge endpoint returned HTML, not the decisions API \u2014 APO_SECOND_JUDGE_BASE_URL likely points at the site root. Use the API root, e.g. https://openrouter.ai/api/v1";
290
+ return evidence;
291
+ }
292
+ let data;
293
+ try {
294
+ data = JSON.parse(await response.text());
295
+ } catch {
296
+ evidence.error = "Second judge endpoint returned a non-JSON body \u2014 check APO_SECOND_JUDGE_BASE_URL points at the decisions API root (e.g. https://openrouter.ai/api/v1)";
297
+ return evidence;
298
+ }
288
299
  const verdict = data.answers?.verdict;
289
300
  if (verdict?.choice !== "pass" && verdict?.choice !== "fail") {
290
301
  evidence.error = "Second judge returned no verdict choice";