UI API contract

Every route the browser workbench calls, with the request it sends, the answer the real server gave, and the refusals. The examples are captured from arena serve with the real CAD kernel on 2026-12-04, then cut to a readable size: lists keep their first items and objects below the third level read "...". tests/test_ui_api_contract.py checks that every route and every exported TypeScript type is named here and that each example keeps the top-level keys of a live answer, so the page cannot drift quietly.

The TypeScript side lives in three files: web/src/api/client.ts (transport, run status, findings, replay, the old pose evaluate), web/src/api/analyze.ts (catalog, assembly runs, run list) and web/src/api/adversary.ts (the AI adversary document). Each parser reads an answer as unknown, checks it and throws ApiError with code invalid_response when a field is missing. No component reads a raw answer.

Transport rules

  • The server listens on loopback only. A request whose Host is not this server is refused with 403 cross_origin; so is a request whose Origin is present and not this server.
  • JSON bodies are capped at 262144 bytes (413 body_too_large). A body that is not valid JSON is 400 invalid_json; one that is valid JSON but not an object is 422 invalid_request.
  • Every refusal has one shape: {"error": {"code": "...", "message": "..."}}. The message never holds a filesystem path. The client turns it into an ApiError with the HTTP status, the code and the message, and the page shows the code.
  • A known path with the wrong method is 405 method_not_allowed; an unknown path is 404 not_found.
  • A run lives in the run folder of the server. Starting a run answers 202 at once and the work continues in a thread; the page polls status every 400 ms until status is terminal (completed, cancelled, failed or interrupted).
  • Every number, verdict, scope sentence and artifact name on screen comes from these answers. The page computes no verdict and writes no scope sentence of its own.

Route table

Method and pathCalled byAnswer type
GET /api/v1/mechanismsgetCatalogCatalog
GET /api/v1/runslistRunsRunRow[]
POST /api/v1/runs (kind assembly)createAssemblyRun{run_id, status, status_url, findings_url}
POST /api/v1/runs (kind verify)createRun (Evidence panel)the same
GET /api/v1/runs/{id}/statusgetStatusRunStatus
GET /api/v1/runs/{id}/findingsgetFindingsFindings
POST /api/v1/runs/{id}/replayreplayRunReplayResult
POST /api/v1/runs/{id}/cancelcancelRun{run_id, status}
GET /api/v1/runs/{id}/artifacts/{name}artifactUrl (links), fetchRunManifestfile bytes
GET /api/v1/determinismDeterminismProvider{statements, observations}
GET /api/v1/adversarygetAdversaryAdversary (parsed from the document)
POST /api/v1/evaluateevaluatePose (Evidence panel)VerificationResult

The static files the page also reads are not API routes: data/lattice/lattice.json (the stored lattice of the built-in pin) and the recorded data/... manifests of the Evidence panel.

GET /api/v1/mechanisms

The catalog of what the engine can analyze, plus the limits the refusals enforce and the defaults the form starts from. The page fills the declared box (pair, requirement, joint, deviation, units) from mechanisms[], and the field limits from limits. A mechanism offers the analyses in its analyses list; kind is fixture, family or step-sample.

{
  "mechanisms": [
    {
      "id": "rotating-pin",
      "kind": "fixture",
      "title": "Rotating pin",
      "summary": "A pin turns on a hinge toward a fixed obstacle. This is the built-in fixture.",
      "checked_pair": [
        "pin"
      ],
      "requirement": {
        "id": "pin_obstacle_clearance",
        "type": "minimum_clearance",
        "parts": "...",
        "minimum_mm": 1.5,
        "text": "pin-obstacle gap >= 1.5 mm"
      },
      "joint": {
        "id": "arm_hinge",
        "kind": "revolute",
        "unit": "deg",
        "range": "..."
      },
      "deviation": {
        "id": "placement_error",
        "range_mm": "..."
      },
      "length_unit": "mm",
      "analyses": [
        "verify"
      ]
    }
  ],
  "limits": {
    "q_count": [
      2
    ],
    "delta_count": [
      1
    ],
    "max_grid_points": 40,
    "budget": [
      1
    ],
    "seed": [
      0
    ],
    "strategies": [
      "seeded"
    ],
    "defaults": {
      "budget": 100,
      "seed": 42,
      "strategy": "seeded",
      "q_count": 4,
      "delta_count": 3
    }
  }
}

GET /api/v1/runs

Every run in the run folder, newest first. conclusion is failure_found, no_failure_found or inconclusive once a run is completed. A run that was active when the server stopped reads interrupted.

{
  "runs": [
    {
      "run_id": "run-50d1657c1b60",
      "kind": "search",
      "mechanism": "rotating-pin",
      "analysis": "search",
      "status": "completed",
      "verdict": "violated",
      "conclusion": "failure_found",
      "search_status": "exhausted",
      "created_at": "2026-12-04T12:08:19.012575+00:00",
      "updated_at": "2026-12-04T12:08:19.234590+00:00",
      "progress": "...",
      "error": null
    },
    {
      "run_id": "run-585103fb2f49",
      "kind": "assembly",
      "mechanism": "hinged-flap-post",
      "analysis": "sweep",
      "status": "completed",
      "verdict": "satisfied",
      "conclusion": "no_failure_found",
      "search_status": null,
      "created_at": "2026-12-04T12:08:11.460589+00:00",
      "updated_at": "2026-12-04T12:08:18.708578+00:00",
      "progress": "...",
      "error": null
    }
  ]
}

POST /api/v1/runs

The body is a JSON object with kind and the fields of one analysis. Extra or missing fields are refused (422 invalid_request), so the page sends exactly these:

analysisFields besides kind, mechanism, analysisLimits
verifyq, delta_mmthe joint range and the deviation range of the mechanism
sweepq_count, delta_countlimits.q_count, limits.delta_count, limits.max_grid_points
searchbudget, seed, strategylimits.budget, limits.seed, limits.strategies

Request:

{
  "kind": "assembly",
  "mechanism": "rotating-pin",
  "analysis": "verify",
  "q": 45,
  "delta_mm": -1.2
}

Request:

{
  "kind": "assembly",
  "mechanism": "hinged-flap-post",
  "analysis": "sweep",
  "q_count": 4,
  "delta_count": 3
}

Request:

{
  "kind": "assembly",
  "mechanism": "rotating-pin",
  "analysis": "search",
  "budget": 6,
  "seed": 42,
  "strategy": "seeded"
}

Answer 202 (the same for every analysis):

{
  "run_id": "run-a8f45a29623a",
  "status": "running",
  "status_url": "/api/v1/runs/run-a8f45a29623a/status",
  "findings_url": "/api/v1/runs/run-a8f45a29623a/findings"
}

Only one catalog analysis (kind assembly on a mechanism other than the built-in pin) runs at a time: a second one is 409 busy. The built-in pin runs through its own fixture path and is not counted by that rule.

The Evidence panel (the old viewer) also sends {"kind": "verify", "angle_deg": 45, "offset_mm": -1.2} and POST /api/v1/evaluate with the same two fields. Both pin only. Their answers are the run answer above and the stored result below.

GET /api/v1/runs/{id}/status

The one object a page needs to draw a run. progress.measured counts kernel measurements so far; progress.planned is the pose count of a verify or sweep and null for a search, which reports progress.budget instead. summary, verdict, conclusion, scope and result_id are null until the run has a result. scope is the sentence the verdict header prints word for word.

summary.poses counts what the run asked for: one pose, the points of the grid, or the evaluation credits of a search. summary.measured counts the poses whose kernel query returned a gap, and summary.kernel_failures the queries that returned none (a worker that timed out, for one). A search also spends credits on confirmations and on repeats answered from the cache, so its poses can be larger than measured plus kernel_failures; the page says so instead of calling every credit a pose.

A running run:

{
  "run_id": "run-4fd134bbcac1",
  "kind": "assembly",
  "status": "running",
  "created_at": "2026-12-04T12:08:19.550719+00:00",
  "updated_at": "2026-12-04T12:08:19.554353+00:00",
  "request": {
    "mechanism": "hinged-flap-post",
    "analysis": "search",
    "budget": 500,
    "seed": 7,
    "strategy": "seeded"
  },
  "mechanism": "hinged-flap-post",
  "analysis": "search",
  "progress": {
    "measured": 0,
    "planned": null,
    "budget": 500
  },
  "summary": null,
  "fixture": null,
  "verdict": null,
  "result_id": null,
  "conclusion": null,
  "scope": null,
  "search_status": null,
  "artifacts": [
    "run.json"
  ],
  "error": null,
  "mesh_error": null
}

A completed run with a violation:

{
  "run_id": "run-a8f45a29623a",
  "kind": "verify",
  "status": "completed",
  "created_at": "2026-12-04T12:08:10.924251+00:00",
  "updated_at": "2026-12-04T12:08:10.953206+00:00",
  "request": {
    "angle_deg": 45.0,
    "offset_mm": -1.2
  },
  "mechanism": "rotating-pin",
  "analysis": "verify",
  "progress": {
    "measured": 1,
    "planned": 1,
    "budget": null
  },
  "summary": {
    "poses": 1,
    "measured": 1,
    "kernel_failures": 0,
    "violated": 1,
    "indeterminate": 0,
    "satisfied": 0,
    "minimum_gap_mm": 0.7999999999999959,
    "threshold_mm": 1.5,
    "native_error": null,
    "native_detail": null
  },
  "fixture": {
    "name": "rotating_pin_v1",
    "checked_pair": [
      "pin",
      "obstacle"
    ],
    "angle_bounds_deg": [
      0.0,
      90.0
    ],
    "offset_bounds_mm": [
      -1.2,
      1.2
    ],
    "minimum_clearance_mm": 1.5,
    "oracle_tolerance_mm": 1e-05,
    "ambiguity_band_mm": 1e-05,
    "length_unit": "mm",
    "angle_unit": "deg"
  },
  "verdict": "violated",
  "result_id": "3574ba9393f6b03cdc3be186cac5b45a2992b853414be43c140398e239c898d7",
  "conclusion": "failure_found",
  "scope": "Checked the pair pin/obstacle at this one pose only. Nothing else was checked: no other pairs, poses, offsets or assemblies.",
  "search_status": null,
  "artifacts": [
    "mesh-manifest.json",
    "obstacle.glb"
  ],
  "error": null,
  "mesh_error": null
}

A run cancelled after it had measured a violation keeps conclusion: "failure_found"; the page shows "Run cancelled, but it already found a violation". A cancelled run with no violation has verdict: null and conclusion: "inconclusive"; the page shows "Run cancelled: no verdict" and the scope sentence, which names how many candidates and credits the run had used.

{
  "run_id": "run-4fd134bbcac1",
  "kind": "assembly",
  "status": "cancelled",
  "created_at": "2026-12-04T12:08:19.550719+00:00",
  "updated_at": "2026-12-04T12:08:23.788425+00:00",
  "request": {
    "mechanism": "hinged-flap-post",
    "analysis": "search",
    "budget": 500,
    "seed": 7,
    "strategy": "seeded"
  },
  "mechanism": "hinged-flap-post",
  "analysis": "search",
  "progress": {
    "measured": 1,
    "planned": null,
    "budget": 500
  },
  "summary": {
    "poses": 1,
    "measured": 1,
    "kernel_failures": 0,
    "violated": 0,
    "indeterminate": null,
    "satisfied": null,
    "minimum_gap_mm": null,
    "threshold_mm": 1.5,
    "native_error": null,
    "native_detail": null
  },
  "fixture": null,
  "verdict": null,
  "result_id": null,
  "conclusion": "inconclusive",
  "scope": "Bounded search only: 1 candidate scenarios proposed by seeded (seed 7) with 1 of 500 evaluation credits for the pair flap/post. This says nothing about scenarios between or beyond the evaluated points, other occurrence pairs, or any assembly.",
  "search_status": "cancelled",
  "artifacts": [
    "ledger.json",
    "run.json"
  ],
  "error": null,
  "mesh_error": null
}

GET /api/v1/runs/{id}/findings

The poses the run measured as violated, with the numbers of each. A sweep fills grid, the full table the gap map draws, one cell per measured pose. A run with no violation has an empty findings list. scope repeats the status scope.

A verify run of a catalog mechanism. focus is the pose the 3D view shows; for a verify it is the pose itself and grid is null:

{
  "run_id": "run-9e436a7ea6d3",
  "status": "completed",
  "conclusion": "no_failure_found",
  "scope": "Checked the pair flap/post at this one pose only. Nothing else was checked: no other pairs, poses, deviations or assemblies.",
  "grid": null,
  "focus": {
    "scenario": {
      "q": 90.0,
      "delta_mm": 1.2,
      "joint_unit": "deg"
    },
    "verdict": "satisfied",
    "distance_mm": 30.199999999999996,
    "threshold_mm": 1.5,
    "witness_points_mm": [
      [
        1.000000000000007
      ]
    ],
    "reason_codes": [],
    "result_id": "c481b4689a8c7e65355bc106acdf48a73d8b40f737f3ff385dbed933ac837289"
  },
  "findings": []
}

A sweep fills grid and sets focus to the closest pose:

{
  "run_id": "run-585103fb2f49",
  "status": "completed",
  "conclusion": "no_failure_found",
  "scope": "Sampled grid only: 12 points (4 q values x 3 deviations), joint spacing 30, 30, 30 deg, deviation spacing 1.2, 1.2 mm for the pair flap/post. This says nothing about joint values or deviations between grid points, other pairs or any other assembly.",
  "grid": {
    "joint_unit": "deg",
    "q_values": [
      0.0,
      30.0
    ],
    "delta_values_mm": [
      -1.2,
      0.0
    ],
    "cells": [
      {
        "q": 0.0,
        "delta_mm": -1.2,
        "verdict": "satisfied",
        "distance_mm": 29.0
      },
      {
        "q": 0.0,
        "delta_mm": 0.0,
        "verdict": "satisfied",
        "distance_mm": 29.0
      }
    ]
  },
  "focus": {
    "scenario": {
      "q": 60.0,
      "delta_mm": -1.2,
      "joint_unit": "deg"
    },
    "verdict": "satisfied",
    "distance_mm": 7.80710776301604,
    "threshold_mm": 1.5,
    "witness_points_mm": [
      [
        21.61602540378444,
        35.4400542570542
      ],
      [
        28.927077866759127,
        32.7015430726737
      ]
    ],
    "reason_codes": [],
    "result_id": "53c88cbd23a8410e5b2d72b6f2bf4f35d70edcee68d8abd5c67c8c7f5d297127"
  },
  "findings": []
}

The built-in pin runs through its own fixture path, and its findings carry neither focus nor grid. The page then takes the pose from findings[0] or from the request in the status:

{
  "run_id": "run-a8f45a29623a",
  "status": "completed",
  "conclusion": "failure_found",
  "scope": "Checked the pair pin/obstacle at this one pose only. Nothing else was checked: no other pairs, poses, offsets or assemblies.",
  "findings": [
    {
      "scenario": {
        "angle_deg": 45.0,
        "offset_mm": -1.2
      },
      "verdict": "violated",
      "distance_mm": 0.7999999999999959,
      "threshold_mm": 1.5,
      "witness_points_mm": [
        "..."
      ],
      "reason_codes": [
        "clearance_below_minimum"
      ],
      "result_id": "3574ba9393f6b03cdc3be186cac5b45a2992b853414be43c140398e239c898d7"
    }
  ]
}

POST /api/v1/runs/{id}/replay

Measures the stored focus pose of a finished run again and compares it with the stored result. replay is match or mismatch. Nothing in the run folder changes. A run without a stored result is 409 not_replayable.

{
  "replay": "match",
  "matched": true,
  "result_id": "c481b4689a8c7e65355bc106acdf48a73d8b40f737f3ff385dbed933ac837289",
  "stored_verdict": "satisfied",
  "replayed_verdict": "satisfied",
  "stored_distance_mm": 30.199999999999996,
  "replayed_distance_mm": 30.199999999999996,
  "distance_difference_mm": 0.0,
  "distance_tolerance_mm": 1e-05,
  "checked_pair": [
    "flap",
    "post"
  ],
  "scope": "Replayed the stored scenario for the pair flap/post only. Nothing else was checked: no other pairs, poses, deviations or assemblies."
}

The built-in pin replays through its fixture path and adds scenario_id, verdict_match and numerical_match to the same object:

{
  "replay": "match",
  "matched": true,
  "scenario_id": "scenario-bddcb450a86a87761837efc7837bc40304a3d6944919096373918f7ba478e396",
  "result_id": "3574ba9393f6b03cdc3be186cac5b45a2992b853414be43c140398e239c898d7",
  "stored_verdict": "violated",
  "replayed_verdict": "violated",
  "verdict_match": true,
  "stored_distance_mm": 0.7999999999999959,
  "replayed_distance_mm": 0.7999999999999959,
  "distance_difference_mm": 0.0,
  "distance_tolerance_mm": 1e-05,
  "numerical_match": true,
  "checked_pair": [
    "pin",
    "obstacle"
  ],
  "scope": "Replayed the stored scenario for the pair pin/obstacle only. Nothing else was checked: no other pairs, poses, offsets or assemblies."
}

POST /api/v1/runs/{id}/cancel

Asks a running run to stop; the answer is 200 at once and the status becomes cancelled shortly after. A run that already finished is 409 run_terminal.

{
  "run_id": "run-4fd134bbcac1",
  "status": "cancelling"
}

GET /api/v1/runs/{id}/artifacts/

One evidence file of a run. name must be one of the artifacts the status lists; anything else is 404 or 400 invalid_artifact. The content type follows the extension: application/json for .json, text/markdown; charset=utf-8 for .md, model/gltf-binary for .glb. The page links these files for download and reads mesh-manifest.json for the 3D view.

Example names of the verify run above (from status.artifacts):

{
  "artifacts": [
    "mesh-manifest.json",
    "obstacle.glb"
  ]
}

GET /api/v1/determinism

One statement per step of the pipeline, each classed deterministic, depends_on_model or depends_on_environment, with the reason and the source file and snippet it was derived from. The badges and the "What is deterministic" panel print reason word for word.

{
  "statements": [
    {
      "id": "pose-measurement",
      "subject": "Kernel measurement of one pose",
      "class": "deterministic",
      "reason": "Every repeat of a pose in the recorded runs agrees to within 1e-14 mm, and the verifier accepts a gap only when it matches the analytic reference within 1e-05 mm.",
      "sources": [
        "...",
        "..."
      ]
    },
    {
      "id": "kernel-last-bits",
      "subject": "Last bits of a kernel gap",
      "class": "depends_on_environment",
      "reason": "32 of 5124 poses that more than one recorded run measured came back with gaps that differ in the last bits, by at most 7.1e-15 mm, and no record names the cause.",
      "sources": [
        "...",
        "..."
      ]
    }
  ],
  "observations": {
    "repeated_pose_gaps": {
      "records_scanned": 2383,
      "poses_measured": 10831,
      "poses_measured_more_than_once": 5124,
      "poses_with_different_gaps": 32,
      "largest_difference_mm": 7.105427357601002e-15,
      "oracle_tolerance_mm": 1e-05,
      "kernel_builds": [
        "0.13.0"
      ],
      "ocp_builds": [
        "8.0.1.1.0"
      ]
    },
    "first_call_variation": [
      {
        "rung": "v5",
        "arm": "S",
        "runs_with_a_first_call": 400,
        "boxes_compared": 80,
        "boxes_with_identical_first_call_in_all_runs": 80,
        "distinct_first_calls": 80,
        "runs_in_compared_boxes": 400
      },
      {
        "rung": "v5",
        "arm": "U",
        "runs_with_a_first_call": 396,
        "boxes_compared": 80,
        "boxes_with_identical_first_call_in_all_runs": 0,
        "distinct_first_calls": 352,
        "runs_in_compared_boxes": 396
      }
    ],
    "provider": {
      "records": 2383,
      "provider_error": 72,
      "provider_rate_limited": 0,
      "runner_error": 0
    },
    "wall_clock": {
      "elapsed_s_min": 3.142,
      "elapsed_s_median": 11.553,
      "elapsed_s_max": 33.828,
      "max_active_seconds_used": 33.609,
      "kernel_deadline_s": 10.0,
      "analyst_active_seconds_limit": 120.0
    }
  }
}

An install without the committed records (a wheel, not a checkout) answers 404 records_not_available.

GET /api/v1/adversary

The needle-first evidence of the AI adversary, built from the committed records. Counts carry a 95 percent Wilson interval the server recomputes. The page reads needle, baselines, rungs, limits, gateway, hybrid, recorded_run and records; web/src/api/adversary.ts holds the parser and the exact fields. The document is large, so the example is cut to the second level.

{
  "interval_method": {
    "name": "Wilson score interval, 95 percent, no continuity correction",
    "z": 1.96,
    "rounding": "the lower end is rounded and the upper end cut to three decimals; an upper end with k equal to n is 1",
    "source": "..."
  },
  "gateway": {
    "tools": "...",
    "not_admitted_tools": "...",
    "admitted_tools_recorded": "...",
    "verdict_field_in_tool_schema": false,
    "gap_field_in_tool_schema": false,
    "accepted_scenario_keys": "...",
    "accepted_scenario_keys_source": "...",
    "tool_schema_source": "...",
    "max_poses_per_call": "...",
    "budget": "...",
    "poses_per_run": "...",
    "cache": "...",
    "sampling": "...",
    "structured_answer": "...",
    "tool_result_row": "...",
    "ablations": "..."
  },
  "hybrid": {
    "design": "one_model_call_then_nelder_mead",
    "poses_per_run": 24,
    "model_calls": 1,
    "model_poses_max": 8,
    "optimiser": "...",
    "optimiser_poses_per_run": "...",
    "config_sha256": "e958e1fda0a5dabfeb91b66b800c5837b47f174618d499fda819a9514a93cc10",
    "records": "...",
    "model_written_summaries": 0,
    "sources": "..."
  },
  "needle": {
    "rung": "v7",
    "arm": "H",
    "role": "hybrid",
    "model": "qwen/qwen3.8-27b",
    "effort": "low",
    "boxes": "...",
    "hits": "...",
    "boxes_with_a_hit": "...",
    "not_scored": "...",
    "first_violated_pose_phase": "...",
    "best_registered_baseline": "...",
    "sequential_bayesian_optimizer": "...",
    "analyst_interval_above_best_baseline": true,
    "analyst_interval_above_best_baseline_interval": true,
    "near_miss": "...",
    "ordinary": "...",
    "comparison_arms": "..."
  },
  "rungs": [
    "..."
  ],
  "baselines": {
    "n1": "...",
    "e1": "...",
    "v4": "..."
  },
  "limits": {
    "quotes": "...",
    "counts": "...",
    "computed": "..."
  },
  "verdict_summary": [
    "..."
  ],
  "records": [
    "..."
  ],
  "recorded_run": {
    "source": "assets/recorded/analyst-2026-12-02-none-failure-found-14-poses.json",
    "identical_to": "web/public-demo/recorded/analyst-none-failure-found-14-poses.json",
    "label": "RECORDED LIVE RUN: measured on the date below with the provider and model named here. It is a recording, not a replay.",
    "model_id": "qwen/qwen3.8-27b",
    "reasoning_effort": "none",
    "temperature": 0.2,
    "started_at": "2026-12-02T17:19:40Z",
    "status": "completed",
    "calls": "...",
    "poses": "...",
    "box": "...",
    "requirement_mm": 1.5,
    "distinct_poses_measured": 14,
    "outcome": "failure_found",
    "outcome_scope": "Sampled: 14 poses measured in this run (14 completed). Nothing else was checked.",
    "analysis": "...",
    "budget": "...",
    "counters": "...",
    "comparison": "..."
  }
}

recorded_run.box holds the angle and offset bounds the recorded run searched (read from its record) and recorded_run.requirement_mm the minimum clearance (read from verify.py). The pose map of the recorded run draws exactly that box and reads each pose against that requirement.

The needle block at full depth, which the view leads with:

{
  "needle": {
    "rung": "v7",
    "arm": "H",
    "role": "hybrid",
    "model": "qwen/qwen3.8-27b",
    "effort": "low",
    "boxes": {
      "set": "n1",
      "count": 20,
      "ensemble": "assets/evaluation/v6/ensemble.json",
      "ensemble_sha256": "f6ad0b8d170bf971f0dff0d3f85cd1693625fbecffe3a7708b34d617a1b68215"
    },
    "hits": {
      "k": 186,
      "n": 199,
      "rate": 0.9346733668341709,
      "wilson95": [
        0.891
      ],
      "level": "run",
      "unit": "scored runs",
      "source": {
        "file": "docs/analyst-evaluation-v7.md",
        "snippet": "hits: 186 of 199 scored runs measured a violated pose (Wilson 95% [0.891, 0.961])",
        "found": true
      }
    },
    "boxes_with_a_hit": {
      "k": 20,
      "n": 20,
      "rate": 1.0,
      "wilson95": [
        0.839
      ],
      "level": "box",
      "unit": "scored boxes",
      "source": {
        "file": "docs/analyst-evaluation-v7.md",
        "snippet": "boxes: 20 of 20 scored boxes had at least one hit",
        "found": true
      }
    },
    "not_scored": {
      "zero_model_calls": 0,
      "provider_error": 1,
      "rate_limit": 0,
      "runner_error": 0
    },
    "first_violated_pose_phase": {
      "model": 42,
      "optimiser": 144,
      "unattributed": 0
    },
    "best_registered_baseline": {
      "name": "scripted_procedure",
      "key": "scripted_procedure",
      "group": "registered",
      "reads_own_results": false,
      "origin": "computed from assets/evaluation/v5/needle-ensemble.json with tolerance_arena.oracle",
      "k": 8,
      "n": 20,
      "rate": 0.4,
      "wilson95": [
        0.219
      ],
      "level": "box",
      "unit": "boxes",
      "source": {
        "file": "docs/analyst-evaluation-v7.md",
        "snippet": "scripted procedure baseline: 8 of 20 boxes found a violated pose (Wilson 95% [0.219, 0.613])",
        "found": true
      }
    },
    "sequential_bayesian_optimizer": {
      "name": "sequential_bayesian_optimizer",
      "key": "bo_seq",
      "group": "adaptive",
      "reads_own_results": true,
      "origin": "assets/evaluation/adaptive/results.json",
      "k": 5003,
      "n": 6000,
      "rate": 0.8338333333333333,
      "wilson95": [
        0.824
      ],
      "level": "attempt",
      "unit": "seeded attempts",
      "source": {
        "file": "docs/analyst-evaluation-v7.md",
        "snippet": "sequential Bayesian optimiser: 5003 of 6000 attempts (Wilson 95% [0.824, 0.843]), 24 poses each",
        "found": true
      }
    },
    "analyst_interval_above_best_baseline": true,
    "analyst_interval_above_best_baseline_interval": true,
    "near_miss": {
      "false_alarms": {
        "k": 0,
        "n": 100,
        "rate": 0.0,
        "wilson95": [
          0.0
        ],
        "level": "run",
        "unit": "scored runs",
        "measured_violated": 0,
        "unbacked_claims": 0,
        "source": {
          "file": "docs/analyst-evaluation-v7.md",
          "snippet": "false alarms: 0 of 100 scored runs (measured violated pose=0) (Wilson 95% [0.000, 0.036])",
          "found": true
        }
      },
      "definition": {
        "text": "A hit is a scored run with at least one measured `violated` verdict. On a negative box, a false alarm is a scored run with a measured `violated` verdict or a model-written summary that claims a violation no measured pose backs. The second test is a text screen (`claims_violation` in `scripts/analyst_eval.py`) and can miss a claim in words it does not match.",
        "source": {
          "file": "docs/adversarial-mechanism.md",
          "snippet": "A hit is a scored run with at least one measured `violated` verdict. On a negative box, a false alarm is a scored run with a measured `violated` verdict or a model-written summary that claims a violation no measured pose backs. The second test is a text screen (`claims_violation` in `scripts/analyst_eval.py`) and can miss a claim in words it does not match.",
          "found": true
        }
      },
      "best_registered_baseline": {
        "name": "grid",
        "key": "grid",
        "group": "registered",
        "reads_own_results": false,
        "origin": "computed from assets/evaluation/v5/needle-ensemble.json with tolerance_arena.oracle",
        "k": 0,
        "n": 20,
        "rate": 0.0,
        "wilson95": [
          0.0
        ],
        "level": "box",
        "unit": "boxes"
      }
    },
    "ordinary": {
      "hits": {
        "k": 87,
        "n": 100,
        "rate": 0.87,
        "wilson95": [
          0.79
        ],
        "level": "run",
        "unit": "scored runs",
        "source": {
          "file": "docs/analyst-evaluation-v7.md",
          "snippet": "hits: 87 of 100 scored runs measured a violated pose (Wilson 95% [0.790, 0.922])",
          "found": true
        }
      },
      "boxes_with_a_hit": {
        "k": 19,
        "n": 20,
        "rate": 0.95,
        "wilson95": [
          0.764
        ],
        "level": "box",
        "unit": "scored boxes",
        "source": {
          "file": "docs/analyst-evaluation-v7.md",
          "snippet": "boxes: 19 of 20 scored boxes had at least one hit",
          "found": true
        }
      },
      "first_violated_pose_phase": {
        "model": 29,
        "optimiser": 58,
        "unattributed": 0
      },
      "best_registered_baseline": {
        "name": "grid",
        "key": "grid",
        "group": "registered",
        "reads_own_results": false,
        "origin": "computed from assets/evaluation/v5/ensemble.json with tolerance_arena.oracle",
        "k": 18,
        "n": 20,
        "rate": 0.9,
        "wilson95": [
          0.699
        ],
        "level": "box",
        "unit": "boxes",
        "source": {
          "file": "docs/analyst-evaluation-v7.md",
          "snippet": "grid baseline: 18 of 20 boxes found a violated pose (Wilson 95% [0.699, 0.972])",
          "found": true
        }
      },
      "sequential_bayesian_optimizer": {
        "name": "sequential_bayesian_optimizer",
        "key": "bo_seq",
        "group": "adaptive",
        "reads_own_results": true,
        "origin": "assets/evaluation/adaptive/results.json",
        "k": 5803,
        "n": 6000,
        "rate": 0.9671666666666666,
        "wilson95": [
          0.962
        ],
        "level": "attempt",
        "unit": "seeded attempts",
        "source": {
          "file": "docs/analyst-evaluation-v7.md",
          "snippet": "sequential Bayesian optimiser: 5803 of 6000 attempts (Wilson 95% [0.962, 0.971]), 24 poses each",
          "found": true
        }
      },
      "analyst_interval_above_best_baseline": false,
      "analyst_interval_above_best_baseline_interval": false
    },
    "comparison_arms": [
      {
        "rung": "v6",
        "arm": "U",
        "ablation": "none",
        "hits": {
          "k": 139,
          "n": 196,
          "rate": 0.7091836734693877,
          "wilson95": "...",
          "level": "run",
          "unit": "scored runs",
          "source": "..."
        }
      }
    ]
  }
}

The same 404 records_not_available applies to an install without the records.

POST /api/v1/evaluate

The live pose of the Evidence panel (built-in pin only). The body is {"angle_deg", "offset_mm"}. The answer is the stored result document. At most one evaluate runs at a time, and a token bucket limits the rate: a second call while one is running is 429 query_in_flight, and a burst beyond the bucket is 429 rate_limited.

Request:

{
  "angle_deg": 45,
  "offset_mm": -1.2
}

Answer 200 (cut to the second level):

{
  "result": {
    "schema_version": "1.0",
    "result_id": "3574ba9393f6b03cdc3be186cac5b45a2992b853414be43c140398e239c898d7",
    "policy_hash": "8f4c6a21b438b3e6b382b637717d612a8e677c686b66adf37f85c6a45de516b9",
    "design_hash": "7e0f7ac186e4ed96ec36938bfc1036df692d6d6dab354addcfac05f36cb67053",
    "scenario": "...",
    "execution": "completed",
    "query": "...",
    "constraints": "...",
    "scope": "...",
    "verifier": "...",
    "warnings": "..."
  }
}

Refusals

Real answers of the server. A page shows code and message as they are.

StatusCodeWhenMessage the server gave
422unknown_mechanismthe mechanism id is not in the catalog (a path is never echoed)the mechanism is not in the catalog
422invalid_posea verify pose outside the declared joint or deviation rangethe joint value must be a number from 0 to 90 deg
422invalid_budgeta search budget outside limits.budgetbudget must be an integer from 1 to 500
422invalid_grida sweep count outside limits.q_count or limits.delta_countq_count must be an integer from 2 to 9
422invalid_requesta field the analysis does not takea verify run needs kind, mechanism, analysis and delta_mm, q
422invalid_requestthe body is valid JSON but not an objectthe body must be a JSON object
400invalid_jsonthe body is not valid JSONthe body is not valid JSON
413body_too_largethe body is over 262144 bytesthe body limit is 262144 bytes
404not_foundthe run id does not existno run run-000000000000
404not_foundthe artifact name is not one of the run's filesno artifact nope.json for run run-a8f45a29623a
404not_founda path that climbs out of the run folder never reaches a fileno route for /api/v1/runs/run-a8f45a29623a/artifacts/../../pyproject.toml
405method_not_alloweda known path with another methodDELETE is not allowed on /api/v1/runs
404not_founda path that is not a routeno route for /api/v1/nothing
403cross_originthe Host header is not this serverthe Host is not this server
403cross_originthe Origin header is not this serverthe Origin is not this server
409busya second catalog analysis while one runsanother analysis is running: wait for it or cancel it
409run_terminalcancel of a run that already finishedthe run is completed
422invalid_posean evaluate pose outside the declared rangeangle_deg: Input should be less than or equal to 90
429rate_limited, query_in_flightevaluate called faster than the bucket allows, or while one runsthe evaluate rate limit is exhausted; one evaluate query is already in flight
409not_replayablereplay of a run with no stored result or whose mechanism left the catalogthe run has no stored result

A replay of a sweep answers 200: it replays the focus pose, not the grid.

TypeScript types

All three files export plain interfaces; a parser turns an unknown answer into one of them.

FileExported names
web/src/api/client.tsFixtureInfo, RunProgress, RunSummary, RunStatus, JointUnit, Finding, GridCell, SweepGrid, Findings, ReplayResult, VerificationResult, ApiError, apiUrl, artifactUrl, isRecord, request, numberField, nullableNumber, stringField, stringArray, parseRunStatus, createRun, getStatus, getFindings, replayRun, evaluatePose, fetchRunManifest
web/src/api/analyze.tsMechanismKind, AnalysisKind, Strategy, MechanismParameter, Mechanism, Limits, Catalog, getCatalog, AnalysisRequest, createAssemblyRun, cancelRun, RunRow, listRuns
web/src/api/adversary.tsCounted, Baseline, Comparison, Claim, Quote, PhaseSplit, RunsPerBox, Stratum, Arm, Rung, RecordedPose, RecordedCall, RecordedRun, NeedleBlock, Gateway, Hybrid, Adversary, parseAdversary, getAdversary, relationWords

RunStatus and RunRow mirror the status and list examples above field for field; Findings, SweepGrid and ReplayResult mirror the findings and replay examples. Where the page needs a sentence (a verdict headline, a badge word), it is a fixed label in web/src/guide/copy.ts or web/src/lib/outcome.ts, and the number or the scope inside it is the API value.