text
stringlengths
0
1.47k
return None
cov = _cov_span_m(pts[0], pts[-1]) if len(pts) >= 2 else 0.0
return cov / diag, diag
def _unseen(rows: list[dict], lv: str) -> list[str]:
"""Non-excluded candidates at fine levels (area/road/point) without a single piece of evidence. Coarse levels are scanned in share/pages order, where no evidence is normal, so they don't count."""
if lv not in ("area", "road", "point"):
return []
return [r["name"] for r in rows if r["n_ev"] == 0 and not r["excluded"]]
def _center_of(c: dict) -> tuple[float, float] | None:
if c.get("center"):
return float(c["center"][0]), float(c["center"][1])
bb = c.get("bbox")
return ((bb[0] + bb[2]) / 2, (bb[1] + bb[3]) / 2) if bb else None
def _inside(c: dict, lat: float, lon: float, pad_m: float = 30) -> bool | None:
"""Is (lat, lon) inside the candidate's bbox (padded)? None when the candidate has no bbox."""
bb = c.get("bbox")
if not bb:
return None
dy, dx = pad_m / 110574, pad_m / (111320 * math.cos(math.radians(lat)))
return bb[0] - dy <= lat <= bb[2] + dy and bb[1] - dx <= lon <= bb[3] + dx
def _skipped_level(b: dict, name: str) -> tuple[str, list[str], str | None] | None:
"""A candidate that skips a level its siblings use: a point added under a city that also has road candidates.
Its evidence then never reaches that level's ranking, which goes on ranking the other roads.
Returns (skipped level, the siblings at that level, the one whose bbox contains it or None)."""
c = b["candidates"][name]
li = LEVELS.index(c["level"])
for lv in reversed(LEVELS[:li]):
sibs = [n for n, s in b["candidates"].items() if s["level"] == lv and s.get("parent") == c.get("parent")
and n != c.get("parent") and s.get("status") != "excluded"]
if not sibs:
continue
at = _center_of(c)
home = next((n for n in sibs if at and _inside(b["candidates"][n], *at)), None)
return lv, sibs, home
return None
def _skip_hint(b: dict, name: str) -> str | None:
gap = _skipped_level(b, name)
if not gap:
return None
lv, sibs, home = gap
c = b["candidates"][name]
where = (f"it lies inside {home} → `board.py move '{name}' --parent '{home}'`" if home else
f"none of them contains it, so that ranking leaves the answer out → `board.py add <its {lv}> --level {lv} --parent '{c.get('parent')}' --bbox s,w,n,e`, "
f"then `board.py move '{name}' --parent <it>`")
return (f"{name} ({c['level']}) sits directly under {c.get('parent')}, which also has {len(sibs)} {lv} candidates; "
f"its evidence never reaches the {lv} ranking: {where}")
def cmd_check(args, p: Path) -> None:
b = _load(p)
ok = True
print("Pre-conclusion check:")
for name
# ===== file: blacklight-scout/native/ai_path_scout_bof.c =====
/*
* Blacklight Scout - Windows BOF wrapper for AI path scout
*
* Snapshot BOF for Windows AI tooling artifacts. Reports bounded filesystem
* metadata without reading file contents.
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define BLACKLIGHT_SCOUT_WINDOWS 1
#include <stddef.h>
#include <stdint.h>
#include "../catalog/static_targets_generated.h"
#include "ai_path_scout_core.h"
#include "beacon.h"
#define MAX_BOF_TRIAGE_TARGETS 256
#define BOF_SESSION_SCAN_LIMIT 10000
#define BOF_SESSION_SCAN_MAX_DEPTH 32
#define BOF_SESSION_TOOL_COUNT 5
#define BOF_TOP_SESSIONS_PER_TOOL 3
#define BOF_TOP_SESSION_COUNT (BOF_SESSION_TOOL_COUNT * BOF_TOP_SESSIONS_PER_TOOL)
#define BOF_DYNAMIC_DISCOVERY_LIMIT 5000
#define BOF_DYNAMIC_ROOT_LIMIT (BOF_DYNAMIC_DISCOVERY_LIMIT / 4)
#define BOF_DYNAMIC_DISCOVERY_MAX_DEPTH 6
#define BOF_CHILD_ENTRY_SCAN_LIMIT 10000
DECLSPEC_IMPORT DWORD WINAPI KERNEL32$ExpandEnvironmentStringsW(LPCWSTR, wchar_t *, DWORD);
DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetFileAttributesW(LPCWSTR);
DECLSPEC_IMPORT HANDLE WINAPI KERNEL32$FindFirstFileW(LPCWSTR, LPWIN32_FIND_DATAW);
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$FindNextFileW(HANDLE, LPWIN32_FIND_DATAW);
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$FindClose(HANDLE);