Release v2.10.0: Add hs-closeups-sync to automatically re-render homepage UI closeups when page UI elements change
This commit is contained in:
1 parent
72fc095489
commit
75e80f6a66
16 files changed
+1350
-11
No files matched your search
@@ -0,0 +1,715 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
hyperstitionstud_io.publishing.closeups_sync
|
||||
Deterministic Live-DOM-Introspected Homepage UI Closeup Compiler (`hs-closeups-sync`).
|
||||
Automatically inspects the actual live HTML/JS/JSON surfaces across the workspace
|
||||
(`/calc/`, `/graph/`, `/quant/`, `/learn/`, `/math/`, `/engineering/`, `/ci/`),
|
||||
computes a structural UI element fingerprint (`ui-elements-manifest.json`), and
|
||||
re-renders all 11 full-width `680x260` Group 3 UI closeups (`site/assets/closeups/*.png`)
|
||||
whenever any page's UI elements (`id=...`, `<select><option>`, `.pill`, `<button>`,
|
||||
`<section>`, `<table...>`, or corpus counts) are added, modified, or removed.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||
from hyperstitionstud_io.config import load_workspace_config
|
||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||
|
||||
FONT_SANS = "/usr/share/fonts/google-noto/NotoSans-Regular.ttf"
|
||||
FONT_BOLD = "/usr/share/fonts/google-noto/NotoSans-Bold.ttf"
|
||||
FONT_MONO = "/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono.ttf"
|
||||
FONT_MONO_B = "/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono-Bold.ttf"
|
||||
|
||||
VOID = (7, 9, 13)
|
||||
PLATE = (12, 16, 23)
|
||||
WELL = (18, 24, 34)
|
||||
BORDER = (30, 41, 59)
|
||||
TEXT = (241, 245, 249)
|
||||
MUTED = (148, 163, 184)
|
||||
CYAN = (56, 189, 248)
|
||||
GOLD = (245, 198, 48)
|
||||
EMERALD = (52, 211, 153)
|
||||
ROSE = (251, 113, 133)
|
||||
VIOLET = (167, 139, 250)
|
||||
|
||||
ALL_CLOSEUP_FILENAMES: tuple[str, ...] = (
|
||||
"quadrant-1-cybermemetics-calc-graph.png",
|
||||
"quadrant-1-tab-2-graph.png",
|
||||
"quadrant-2-esoteric-finance-quant.png",
|
||||
"quadrant-2-tab-2-bayesian-fred.png",
|
||||
"quadrant-2-tab-3-leaderboard-card.png",
|
||||
"quadrant-3-info-science-novice-learn-polyglot.png",
|
||||
"quadrant-3-tab-2-math-guile.png",
|
||||
"quadrant-3-tab-3-math-ts-rust.png",
|
||||
"quadrant-4-operators-deployment-vps.png",
|
||||
"quadrant-4-tab-2-mcp-etag.png",
|
||||
"quadrant-4-tab-3-ci-gates.png",
|
||||
)
|
||||
|
||||
|
||||
def _fnt(path: str, size: int) -> Any:
|
||||
try:
|
||||
return ImageFont.truetype(path, size)
|
||||
except Exception:
|
||||
return ImageFont.load_default()
|
||||
|
||||
|
||||
def _extract_dom_signature(html_text: str) -> dict[str, Any]:
|
||||
"""Extract structural UI element IDs, classes, buttons, inputs, selects, and headings from an HTML surface."""
|
||||
clean = re.sub(r"\bv\d+\.\d+\.\d+\b", "vX.Y.Z", html_text)
|
||||
ids = sorted(set(re.findall(r'\bid=["\']([^"\']+)["\']', clean)))
|
||||
classes = sorted(set(re.findall(r'\bclass=["\']([^"\']+)["\']', clean)))
|
||||
buttons = [re.sub(r"<[^>]+>", "", b).strip() for b in re.findall(r"<button[^>]*>(.*?)</button>", clean, flags=re.S)]
|
||||
options = [re.sub(r"<[^>]+>", "", o).strip() for o in re.findall(r"<option[^>]*>(.*?)</option>", clean, flags=re.S)]
|
||||
inputs = sorted(set(re.findall(r'<input[^>]+placeholder=["\']([^"\']+)["\']', clean)))
|
||||
headings = [re.sub(r"<[^>]+>", "", h).strip() for h in re.findall(r"<h[123][^>]*>(.*?)</h[123]>", clean, flags=re.S)]
|
||||
payload = {
|
||||
"ids": ids,
|
||||
"classes": classes,
|
||||
"buttons": buttons[:40],
|
||||
"options": options[:40],
|
||||
"inputs": inputs,
|
||||
"headings": headings[:25],
|
||||
}
|
||||
digest = hashlib.sha256(json.dumps(payload, sort_keys=True, ensure_ascii=False).encode("utf-8")).hexdigest()
|
||||
return {
|
||||
"ui_structure_sha256": digest,
|
||||
"id_count": len(ids),
|
||||
"button_count": len(buttons),
|
||||
"option_count": len(options),
|
||||
"input_count": len(inputs),
|
||||
"heading_count": len(headings),
|
||||
"ids": ids,
|
||||
"inputs": inputs,
|
||||
"sample_buttons": buttons[:12],
|
||||
"sample_options": options[:12],
|
||||
"sample_headings": headings[:8],
|
||||
}
|
||||
|
||||
|
||||
def introspect_live_ui_elements(workspace_root: str | Path | None = None) -> dict[str, Any]:
|
||||
"""
|
||||
Introspect all target web pages and data registries to detect any added/removed UI elements
|
||||
and extract live labels/counts for rendering the 11 `680x260` quadrant closeups.
|
||||
"""
|
||||
cfg = load_workspace_config(workspace_root=workspace_root)
|
||||
core = cfg.core_dir
|
||||
kg = cfg.knowledge_graph_dir
|
||||
calc_dir = cfg.paths["gematria_js_dir"]
|
||||
ci_dir = cfg.paths.get("ci_repo_dir") or (cfg.workspace_root / "hyperdope-ci-build")
|
||||
|
||||
surfaces: dict[str, Path] = {
|
||||
"home": core / "site" / "index.html",
|
||||
"quant": core / "site" / "quant" / "index.html",
|
||||
"learn": core / "site" / "learn" / "index.html",
|
||||
"engineering_hub": core / "site" / "engineering" / "index.html",
|
||||
"engineering_e4": core / "site" / "engineering" / "mcp-chatbot-rest-and-ipld" / "index.html",
|
||||
"math_hub": core / "site" / "math" / "index.html",
|
||||
"math_m1": core / "site" / "math" / "base36-algebra-and-primes" / "index.html",
|
||||
"graph": kg / "index.html",
|
||||
"calc": calc_dir / "index.html",
|
||||
}
|
||||
|
||||
surface_sigs: dict[str, Any] = {}
|
||||
for k, p in surfaces.items():
|
||||
if p.is_file():
|
||||
surface_sigs[k] = _extract_dom_signature(p.read_text(encoding="utf-8"))
|
||||
|
||||
# Live data counts from registries
|
||||
ts_p = core / "site" / "quant" / "quant-timeseries.json"
|
||||
ts_obj = json.loads(ts_p.read_text(encoding="utf-8")) if ts_p.is_file() else {}
|
||||
total_bars = sum(
|
||||
sum(1 for b in (inst.get("bars") or []) if b.get("data_available"))
|
||||
for inst in (ts_obj.get("instruments") or [])
|
||||
)
|
||||
brf_p = core / "site" / "quant" / "daily-brief-latest.json"
|
||||
brf_obj = json.loads(brf_p.read_text(encoding="utf-8")) if brf_p.is_file() else {}
|
||||
post_probs = (
|
||||
((brf_obj.get("agenda_1_executive_summary") or {}).get("bayesian_regime_inference") or {}).get("posterior_probabilities")
|
||||
or {"R1_BULL_EXPANSION": 0.24, "R2_PINNED_ISOMETRIC": 0.61, "R3_TAIL_DRAWDOWN_RISK_OFF": 0.15}
|
||||
)
|
||||
|
||||
eng_p = core / "site" / "engineering" / "engineering-manifest.json"
|
||||
eng_obj = json.loads(eng_p.read_text(encoding="utf-8")) if eng_p.is_file() else {}
|
||||
eng_counts = eng_obj.get("introspected_counts") or {
|
||||
"repositories": 6,
|
||||
"cli_entrypoints": 17,
|
||||
"mcp_tools": 20,
|
||||
"watchlist_instruments": 24,
|
||||
"fred_macro_series": 14,
|
||||
}
|
||||
cli_scripts = eng_obj.get("cli_scripts") or {
|
||||
"hs-doctor": "ci.doctor:main",
|
||||
"hs-mcp": "mcp.server:main",
|
||||
"hs-kg-build": "graph.compiler:main",
|
||||
"hs-public-smoke": "ci.public_regression:main",
|
||||
}
|
||||
|
||||
db_txt_p = calc_dir / "db.txt"
|
||||
db_entries_count = sum(1 for _ in db_txt_p.open(encoding="utf-8")) if db_txt_p.is_file() else 231615
|
||||
|
||||
ci_rep_p = ci_dir / "ci-audit-report.json"
|
||||
ci_obj = json.loads(ci_rep_p.read_text(encoding="utf-8")) if ci_rep_p.is_file() else {}
|
||||
|
||||
combined_hash = hashlib.sha256(
|
||||
json.dumps(
|
||||
{
|
||||
"surfaces": {k: v["ui_structure_sha256"] for k, v in sorted(surface_sigs.items())},
|
||||
"total_bars": total_bars,
|
||||
"db_entries_count": db_entries_count,
|
||||
"mcp_tools": eng_counts.get("mcp_tools", 20),
|
||||
},
|
||||
sort_keys=True,
|
||||
).encode("utf-8")
|
||||
).hexdigest()
|
||||
|
||||
manifest = {
|
||||
"$id": "urn:io:hyperstitionstud:closeups-ui-manifest",
|
||||
"ui_elements_fingerprint_sha256": combined_hash,
|
||||
"closeup_images": list(ALL_CLOSEUP_FILENAMES),
|
||||
"live_metrics": {
|
||||
"calc_db_entries": db_entries_count,
|
||||
"quant_total_real_bars": total_bars,
|
||||
"quant_bayesian_posteriors": post_probs,
|
||||
"engineering_counts": eng_counts,
|
||||
"cli_scripts_sample": dict(list(sorted(cli_scripts.items()))[:4]),
|
||||
"ci_keep_rate_pct": ci_obj.get("keep_rate_pct", 100.0),
|
||||
},
|
||||
"surfaces": surface_sigs,
|
||||
}
|
||||
manifest["ipld_dag_json_cidv1"] = {"/": compute_dag_json_cidv1(manifest)}
|
||||
return manifest
|
||||
|
||||
|
||||
def _new_canvas() -> tuple[Image.Image, ImageDraw.ImageDraw]:
|
||||
im = Image.new("RGB", (680, 260), VOID)
|
||||
d = ImageDraw.Draw(im)
|
||||
for gx in range(0, 680, 32):
|
||||
d.line([(gx, 0), (gx, 260)], fill=(12, 18, 30), width=1)
|
||||
for gy in range(0, 260, 32):
|
||||
d.line([(0, gy), (680, gy)], fill=(12, 18, 30), width=1)
|
||||
return im, d
|
||||
|
||||
|
||||
def _draw_chamfer_box(
|
||||
d: ImageDraw.ImageDraw,
|
||||
box: tuple[int, int, int, int],
|
||||
fill: tuple[int, int, int],
|
||||
outline: tuple[int, int, int],
|
||||
chamfer: int = 8,
|
||||
pip: tuple[int, int, int] | None = None,
|
||||
) -> None:
|
||||
x0, y0, x1, y1 = box
|
||||
pts = [(x0, y0), (x1 - chamfer, y0), (x1, y0 + chamfer), (x1, y1), (x0, y1)]
|
||||
d.polygon(pts, fill=fill, outline=outline)
|
||||
if pip:
|
||||
d.rectangle([x0, y0, x0 + 3, y1], fill=pip)
|
||||
|
||||
|
||||
def render_all_quadrant_closeups(
|
||||
workspace_root: str | Path | None = None,
|
||||
force: bool = False,
|
||||
check_only: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Compare the live UI element fingerprint against `site/assets/closeups/ui-elements-manifest.json`
|
||||
and re-render all 11 `680x260` quadrant closeups whenever any page's UI elements change (or when `force=True`).
|
||||
"""
|
||||
cfg = load_workspace_config(workspace_root=workspace_root)
|
||||
out_dir = cfg.core_dir / "site" / "assets" / "closeups"
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
manifest_path = out_dir / "ui-elements-manifest.json"
|
||||
|
||||
with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:
|
||||
live_manifest = introspect_live_ui_elements(workspace_root=workspace_root)
|
||||
prev_fp = ""
|
||||
if manifest_path.is_file():
|
||||
try:
|
||||
prev_obj = json.loads(manifest_path.read_text(encoding="utf-8"))
|
||||
prev_fp = prev_obj.get("ui_elements_fingerprint_sha256", "")
|
||||
except Exception:
|
||||
prev_fp = ""
|
||||
|
||||
missing_pngs = [fn for fn in ALL_CLOSEUP_FILENAMES if not (out_dir / fn).is_file()]
|
||||
needs_render = force or (prev_fp != live_manifest["ui_elements_fingerprint_sha256"]) or bool(missing_pngs)
|
||||
|
||||
if check_only:
|
||||
return {
|
||||
"ok": not needs_render,
|
||||
"check_only": True,
|
||||
"needs_render": needs_render,
|
||||
"missing_pngs": missing_pngs,
|
||||
"ui_elements_fingerprint_sha256": live_manifest["ui_elements_fingerprint_sha256"],
|
||||
}
|
||||
|
||||
if not needs_render:
|
||||
return {
|
||||
"ok": True,
|
||||
"rerendered": False,
|
||||
"reason": "ui_elements_unchanged",
|
||||
"ui_elements_fingerprint_sha256": live_manifest["ui_elements_fingerprint_sha256"],
|
||||
"closeup_count": len(ALL_CLOSEUP_FILENAMES),
|
||||
}
|
||||
|
||||
f_hdr = _fnt(FONT_MONO_B, 13)
|
||||
f_mono_xs = _fnt(FONT_MONO, 11)
|
||||
f_mono = _fnt(FONT_MONO, 12)
|
||||
f_mono_b = _fnt(FONT_MONO_B, 12)
|
||||
f_mono_md = _fnt(FONT_MONO_B, 14)
|
||||
f_mono_lg = _fnt(FONT_MONO_B, 22)
|
||||
f_mono_xl = _fnt(FONT_MONO_B, 26)
|
||||
|
||||
metrics = live_manifest["live_metrics"]
|
||||
db_cnt_str = f"{metrics['calc_db_entries']:,}"
|
||||
bars_cnt = metrics["quant_total_real_bars"]
|
||||
eng_c = metrics["engineering_counts"]
|
||||
surfaces = live_manifest["surfaces"]
|
||||
|
||||
# Detect live controls on /graph/, /quant/, /learn/, /engineering/
|
||||
graph_has_min_deg = "minDegreeFilter" in (surfaces.get("graph", {}).get("ids") or [])
|
||||
quant_has_window = "timeWindowPills" in (surfaces.get("quant", {}).get("ids") or [])
|
||||
quant_has_quick_filter = "tickerQuickFilter" in (surfaces.get("quant", {}).get("ids") or [])
|
||||
learn_has_seal_ribbon = "grimoireSealRibbon" in (surfaces.get("learn", {}).get("ids") or [])
|
||||
learn_has_sigil_svg = "grimoireSigilSvg" in (surfaces.get("learn", {}).get("ids") or [])
|
||||
eng_has_cli_filter = "engCliFilterInput" in (surfaces.get("engineering_hub", {}).get("ids") or [])
|
||||
|
||||
# 1. Quadrant 01 Tab 1: /calc/ Cipher Matrix
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=EMERALD)
|
||||
d.text((24, 20), "haiperdohp-jemaytreeah • Multi-Cipher Phonetic & Base-36 AQ Matrix", font=f_hdr, fill=EMERALD)
|
||||
d.rectangle([24, 44, 656, 74], fill=WELL, outline=EMERALD)
|
||||
d.text((34, 51), "Query: sinthetik dayta", font=f_mono_md, fill=TEXT)
|
||||
d.text((480, 52), f"db.txt: {db_cnt_str} Entries", font=f_mono, fill=CYAN)
|
||||
ciphers = [
|
||||
("haiperdohp-jemaytreeah", "292", EMERALD),
|
||||
("Phonemic Ingglish AQ", "292", CYAN),
|
||||
("Written English AQ", "250", GOLD),
|
||||
("Simple Ordinal", "178", ROSE),
|
||||
]
|
||||
cw = (656 - 24 - 24) // 4
|
||||
for i, (clab, cval, ccol) in enumerate(ciphers):
|
||||
bx = 24 + i * (cw + 8)
|
||||
_draw_chamfer_box(d, (bx, 84, bx + cw, 152), WELL, ccol, chamfer=7, pip=ccol)
|
||||
d.text((bx + 10, 90), clab[:19], font=f_mono_xs, fill=MUTED)
|
||||
d.text((bx + 12, 110), cval, font=f_mono_xl, fill=ccol)
|
||||
rows = [
|
||||
("sinthetik dayta", "AQ = 292", "Cluster 292 • Gen 1 σ² = 0.00 • Syzygy 4::5"),
|
||||
("abstrakt masheen", "AQ = 292", "Cluster 292 • Phonemic Convergence Partner"),
|
||||
("shizohnalizis", "AQ = 292", "Cluster 292 • Landian-Deleuzean Attractor"),
|
||||
]
|
||||
for ri, (rw, raq, rmeta) in enumerate(rows):
|
||||
ry = 162 + ri * 27
|
||||
d.rectangle([24, ry, 656, ry + 23], fill=(14, 20, 31), outline=BORDER)
|
||||
d.text((34, ry + 4), rw, font=f_mono_b, fill=TEXT)
|
||||
d.text((230, ry + 4), raq, font=f_mono_b, fill=EMERALD)
|
||||
d.text((335, ry + 4), rmeta, font=f_mono, fill=CYAN)
|
||||
im.save(out_dir / "quadrant-1-cybermemetics-calc-graph.png", "PNG")
|
||||
|
||||
# 2. Quadrant 01 Tab 2: /graph/ Mode 2 ETI Radar
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=CYAN)
|
||||
hdr_g = "Mode 2: Concentric ETI Radar & Syzygy Compass" + (" [MinDeg+LOD]" if graph_has_min_deg else "")
|
||||
d.text((24, 18), hdr_g, font=f_hdr, fill=CYAN)
|
||||
d.rectangle([24, 42, 346, 240], fill=WELL, outline=BORDER)
|
||||
cx_r, cy_r = 185, 141
|
||||
for r_rad, r_col in [(90, (38, 52, 77)), (64, (45, 65, 95)), (36, (120, 98, 35))]:
|
||||
d.ellipse([cx_r - r_rad, cy_r - r_rad, cx_r + r_rad, cy_r + r_rad], outline=r_col, width=1)
|
||||
for ang_deg in range(0, 360, 60):
|
||||
ar = math.radians(ang_deg)
|
||||
d.line([(cx_r, cy_r), (cx_r + int(90 * math.cos(ar)), cy_r + int(90 * math.sin(ar)))], fill=(26, 36, 54), width=1)
|
||||
nodes = [
|
||||
(cx_r, cy_r, GOLD, "S1 (93)"),
|
||||
(cx_r - 48, cy_r - 22, GOLD, "S3 (83)"),
|
||||
(cx_r, cy_r - 78, CYAN, "aq:777"),
|
||||
(cx_r + 58, cy_r + 8, EMERALD, "sinthetik dayta"),
|
||||
(cx_r + 36, cy_r + 58, CYAN, "aq:292"),
|
||||
]
|
||||
for nx, ny, _, _ in nodes[1:]:
|
||||
d.line([(cx_r, cy_r), (nx, ny)], fill=(56, 189, 248), width=2)
|
||||
for nx, ny, ncol, nlab in nodes:
|
||||
d.ellipse([nx - 7, ny - 7, nx + 7, ny + 7], fill=ncol, outline=VOID)
|
||||
lx = nx + 10 if nx >= cx_r else nx - 58
|
||||
ly = ny - 7
|
||||
if nlab == "aq:777":
|
||||
lx, ly = nx - 24, ny - 20
|
||||
elif nlab == "S1 (93)":
|
||||
lx, ly = nx - 24, ny + 10
|
||||
d.text((lx, ly), nlab, font=f_mono_b, fill=ncol)
|
||||
_draw_chamfer_box(d, (358, 42, 656, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((372, 52), "SELECTED NODE INSPECTOR", font=f_mono_b, fill=GOLD)
|
||||
d.text((372, 72), "aq:292 • Cluster 292 Hub", font=f_mono_md, fill=TEXT)
|
||||
badges = [("Class: AQHub", CYAN), ("Deg: 38", GOLD), ("dr_9: 4 (4::5)", EMERALD)]
|
||||
bx_i = 372
|
||||
for btxt, bcol in badges:
|
||||
d.rectangle([bx_i, 96, bx_i + 86, 116], fill=PLATE, outline=bcol)
|
||||
d.text((bx_i + 6, 99), btxt, font=f_mono_xs, fill=bcol)
|
||||
bx_i += 92
|
||||
insp_lines = [
|
||||
("Filter:", "9-Sum Syzygies • MinDeg ≥ 0"),
|
||||
("Gen 1 Locks:", "sinthetik dayta • abstrakt masheen"),
|
||||
("Variance:", "σ²_0 = 310.22 -> σ²_1 = 0.00 (G1)"),
|
||||
("Neighbors:", "Top 40 Cap + [Show All] Button"),
|
||||
]
|
||||
for li, (lk, lv) in enumerate(insp_lines):
|
||||
ly = 128 + li * 25
|
||||
d.rectangle([372, ly, 644, ly + 21], fill=PLATE, outline=BORDER)
|
||||
d.text((380, ly + 3), lk, font=f_mono_b, fill=GOLD)
|
||||
d.text((466, ly + 3), lv[:26], font=f_mono_xs, fill=TEXT)
|
||||
im.save(out_dir / "quadrant-1-tab-2-graph.png", "PNG")
|
||||
|
||||
# 3. Quadrant 02 Tab 1: Panel 1 Trajectory & Dose
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=GOLD)
|
||||
d.text((24, 18), "PANEL 1: Synchronized 2-Pane Trajectory & Dose D ∈ {0..4}", font=f_hdr, fill=GOLD)
|
||||
win_badge = "[30D|90D|ALL] • " if quant_has_window else ""
|
||||
flt_badge = "QuickFilter • " if quant_has_quick_filter else ""
|
||||
d.rectangle([416, 16, 656, 36], fill=WELL, outline=GOLD)
|
||||
d.text((424, 19), f"{win_badge}{flt_badge}NVDA (S3)", font=f_mono_xs, fill=GOLD)
|
||||
d.rectangle([24, 42, 656, 168], fill=WELL, outline=BORDER)
|
||||
d.line([(36, 114), (644, 114)], fill=(180, 50, 70), width=1)
|
||||
d.text((42, 96), "Entity Threshold: envideea = 137", font=f_mono_xs, fill=ROSE)
|
||||
pts = [(48, 146), (130, 134), (215, 108), (305, 118), (395, 88), (490, 96), (575, 68), (632, 58)]
|
||||
d.line(pts, fill=CYAN, width=3)
|
||||
for px, py in pts:
|
||||
d.ellipse([px - 4, py - 4, px + 4, py + 4], fill=GOLD, outline=VOID)
|
||||
d.rectangle([180, 74, 290, 94], fill=PLATE, outline=GOLD)
|
||||
d.text((188, 77), "Scope 1 (137)", font=f_mono_b, fill=GOLD)
|
||||
d.rectangle([355, 56, 462, 76], fill=PLATE, outline=EMERALD)
|
||||
d.text((363, 59), "Wire Eq (292)", font=f_mono_b, fill=EMERALD)
|
||||
d.rectangle([530, 46, 638, 66], fill=PLATE, outline=CYAN)
|
||||
d.text((538, 49), "Dose D=3 Lock", font=f_mono_b, fill=CYAN)
|
||||
d.rectangle([24, 176, 656, 240], fill=(11, 16, 24), outline=BORDER)
|
||||
d.text((34, 181), f"Pane 2: 30D Window Confluence Dose Inspector (N = 19 Trading Days • {bars_cnt} Bars)", font=f_mono_xs, fill=MUTED)
|
||||
for bi in range(19):
|
||||
bx = 36 + bi * 31
|
||||
dose = 3 if bi in (4, 11, 16) else (2 if bi % 2 == 0 else 1)
|
||||
bh = 10 + dose * 8
|
||||
bcol = CYAN if dose == 3 else (EMERALD if dose == 2 else (71, 85, 105))
|
||||
d.rectangle([bx, 234 - bh, bx + 22, 234], fill=bcol)
|
||||
im.save(out_dir / "quadrant-2-esoteric-finance-quant.png", "PNG")
|
||||
|
||||
# 4. Quadrant 02 Tab 2: Panel 6 Bayesian & Panel 5 FRED
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=GOLD)
|
||||
d.text((24, 18), "PANEL 6 & PANEL 5: 3-State Bayesian Regime Posteriors & Real FRED Macro", font=f_hdr, fill=GOLD)
|
||||
_draw_chamfer_box(d, (24, 42, 334, 240), WELL, GOLD, chamfer=8, pip=GOLD)
|
||||
d.text((38, 52), "PANEL 6: 3-STATE BAYESIAN SIMPLEX", font=f_mono_b, fill=GOLD)
|
||||
r1 = float(metrics["quant_bayesian_posteriors"].get("R1_BULL_EXPANSION", 0.24))
|
||||
r2 = float(metrics["quant_bayesian_posteriors"].get("R2_PINNED_ISOMETRIC", 0.61))
|
||||
r3 = float(metrics["quant_bayesian_posteriors"].get("R3_TAIL_DRAWDOWN_RISK_OFF", 0.15))
|
||||
bars_b = [
|
||||
("R1 Bull Expansion", r1, f"{r1 * 100:.1f}%", EMERALD),
|
||||
("R2 Pinned Dose 2 (-58% P50)", r2, f"{r2 * 100:.1f}%", CYAN),
|
||||
("R3 Tail Drawdown (D≥3)", r3, f"{r3 * 100:.1f}%", ROSE),
|
||||
]
|
||||
for bi, (blab, bval, bpct, bcol) in enumerate(bars_b):
|
||||
by = 80 + bi * 44
|
||||
d.text((38, by), blab, font=f_mono_xs, fill=TEXT)
|
||||
d.text((272, by), bpct, font=f_mono_b, fill=bcol)
|
||||
d.rectangle([38, by + 18, 318, by + 32], fill=PLATE, outline=BORDER)
|
||||
d.rectangle([38, by + 18, 38 + int(280 * min(1.0, bval)), by + 32], fill=bcol)
|
||||
d.rectangle([38, 212, 318, 232], fill=PLATE, outline=CYAN)
|
||||
d.text((46, 215), "Simplex Σ P(R_k|E_t) = 1.0000", font=f_mono_xs, fill=CYAN)
|
||||
_draw_chamfer_box(d, (346, 42, 656, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((360, 52), "PANEL 5: 14 REAL FRED MACRO SERIES", font=f_mono_b, fill=CYAN)
|
||||
fred_rows = [
|
||||
("EFFR / SOFR", "4.58% / 4.68%", "+10 bps Repo Spread"),
|
||||
("M2 - M1 Spread", "$3,365.9B", "$3.37T -> 337 (68th Prime)"),
|
||||
("M2 Velocity V_M2", "1.405x", "GDP / M2SL Ratio"),
|
||||
("10Y - EFFR Slope", "+97 bps", "'naintee sevan' = 237"),
|
||||
("Missing / Closed", "null", "Zero Forward-Fill Policy"),
|
||||
]
|
||||
for fi, (fk, fv, fn) in enumerate(fred_rows):
|
||||
fy = 78 + fi * 30
|
||||
d.rectangle([360, fy, 642, fy + 25], fill=PLATE, outline=BORDER)
|
||||
d.text((368, fy + 5), fk, font=f_mono_b, fill=GOLD)
|
||||
d.text((488, fy + 5), fv, font=f_mono_b, fill=TEXT)
|
||||
d.text((568, fy + 5), fn[:11], font=f_mono_xs, fill=EMERALD)
|
||||
im.save(out_dir / "quadrant-2-tab-2-bayesian-fred.png", "PNG")
|
||||
|
||||
# 5. Quadrant 02 Tab 3: Panel 2 6-Lens Leaderboard & TCG Card
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=GOLD)
|
||||
d.text((24, 18), "PANEL 2 & 3: 6-Lens Assemblage Leaderboard & One-Shot TCG Stats Card", font=f_hdr, fill=GOLD)
|
||||
_draw_chamfer_box(d, (24, 42, 416, 240), WELL, GOLD, chamfer=8, pip=GOLD)
|
||||
lenses = ["[Fund Mgr]", "[TierZoo]", "[Board]", "[Sabermetric]"]
|
||||
for li, ltxt in enumerate(lenses):
|
||||
lx = 36 + li * 92
|
||||
d.rectangle([lx, 50, lx + 86, 70], fill=PLATE, outline=GOLD if li == 0 else BORDER)
|
||||
d.text((lx + 6, 53), ltxt, font=f_mono_xs, fill=GOLD if li == 0 else MUTED)
|
||||
t_rows = [
|
||||
("#1 S1 Cybernetic", "ETI 93", "Tier S+", "NVDA / PLTR / MSFT", GOLD),
|
||||
("#2 S2 High-Freq", "ETI 90", "Tier S", "COIN / CME / VIRT", CYAN),
|
||||
("#3 S6 Sovereign", "ETI 87", "Tier S", "BLK / JPM / GS", EMERALD),
|
||||
("#4 S3 Lithography", "ETI 83", "Tier A", "ASML / TSM / AVGO", ROSE),
|
||||
("#5 M3 Convergence", "ETI 76", "Tier B", "Cluster 292 / 333", VIOLET),
|
||||
]
|
||||
for ti, (tname, teti, ttier, tsyms, tcol) in enumerate(t_rows):
|
||||
ty = 80 + ti * 30
|
||||
d.rectangle([36, ty, 404, ty + 25], fill=PLATE, outline=BORDER)
|
||||
d.text((44, ty + 5), tname, font=f_mono_b, fill=TEXT)
|
||||
d.text((196, ty + 5), teti, font=f_mono_b, fill=tcol)
|
||||
d.text((258, ty + 5), ttier, font=f_mono_xs, fill=GOLD)
|
||||
d.text((314, ty + 5), tsyms[:12], font=f_mono_xs, fill=MUTED)
|
||||
_draw_chamfer_box(d, (428, 42, 656, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((442, 52), "NVDA • S3 / S1 APEX", font=f_mono_b, fill=CYAN)
|
||||
d.text((442, 70), "envideea • AQ = 137 (33rd Prime)", font=f_mono_xs, fill=GOLD)
|
||||
stats = [("CAP", 96, GOLD), ("VEL", 92, CYAN), ("COL", 88, EMERALD), ("ARM", 85, ROSE)]
|
||||
for si, (slab, sval, scol) in enumerate(stats):
|
||||
sy = 94 + si * 26
|
||||
d.text((442, sy), slab, font=f_mono_b, fill=TEXT)
|
||||
d.rectangle([484, sy + 2, 604, sy + 14], fill=PLATE, outline=BORDER)
|
||||
d.rectangle([484, sy + 2, 484 + int(1.2 * sval), sy + 14], fill=scol)
|
||||
d.text((612, sy), str(sval), font=f_mono_b, fill=scol)
|
||||
d.rectangle([442, 204, 642, 228], fill=PLATE, outline=EMERALD)
|
||||
d.text((450, 209), "CIDv1: baguqeera... (35ms)", font=f_mono_xs, fill=EMERALD)
|
||||
im.save(out_dir / "quadrant-2-tab-3-leaderboard-card.png", "PNG")
|
||||
|
||||
# 6. Quadrant 03 Tab 1: /learn/ Prereq Track (auto-adapts if grimoiric elements are added to /learn/)
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=EMERALD)
|
||||
learn_hdr = (
|
||||
"GRIMOIRE CODEX OF THE 6 SEALS (/learn/) • First-Principles Math & Sigils"
|
||||
if (learn_has_seal_ribbon or learn_has_sigil_svg)
|
||||
else "NOVICE PREREQUISITE LADDER (/learn/) • High-School Math to Combinators"
|
||||
)
|
||||
d.text((24, 18), learn_hdr, font=f_hdr, fill=EMERALD)
|
||||
_draw_chamfer_box(d, (24, 42, 344, 240), WELL, EMERALD, chamfer=8, pip=EMERALD)
|
||||
d.text((38, 52), "STEP-BY-STEP PREREQUISITE TRACK", font=f_mono_b, fill=EMERALD)
|
||||
levels = [
|
||||
("Level 1", "Base-36 Place Value & Mod-9", "1-2 hrs"),
|
||||
("Level 2", "Set Mappings & Pop Variance σ²", "3-5 hrs"),
|
||||
("Level 3", "Property Graphs & Dot Products", "6-10 hrs"),
|
||||
("Level 4", "Bayes' Simplex & Z-Combinator", "12+ hrs"),
|
||||
]
|
||||
for li, (llab, ldesc, _) in enumerate(levels):
|
||||
ly = 76 + li * 30
|
||||
d.rectangle([38, ly, 330, ly + 25], fill=PLATE, outline=BORDER)
|
||||
d.text((46, ly + 5), llab, font=f_mono_b, fill=GOLD)
|
||||
d.text((112, ly + 5), ldesc[:22], font=f_mono_xs, fill=TEXT)
|
||||
d.rectangle([38, 202, 330, 228], fill=PLATE, outline=CYAN)
|
||||
d.text((46, 208), "Free Links: MIT 6.042J • 3Blue1Brown", font=f_mono_xs, fill=CYAN)
|
||||
_draw_chamfer_box(d, (356, 42, 656, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((370, 52), "MODULE M01: BASE-36 DECOMPOSITION", font=f_mono_b, fill=CYAN)
|
||||
d.rectangle([370, 74, 642, 102], fill=PLATE, outline=EMERALD)
|
||||
d.text((380, 81), "Input Specimen: LEMUR", font=f_mono_md, fill=TEXT)
|
||||
letters = [("L", "21"), ("E", "14"), ("M", "22"), ("U", "30"), ("R", "27")]
|
||||
for idx, (ch, val) in enumerate(letters):
|
||||
lx = 370 + idx * 54
|
||||
d.rectangle([lx, 112, lx + 48, 168], fill=PLATE, outline=GOLD)
|
||||
d.text((lx + 16, 118), ch, font=f_mono_md, fill=TEXT)
|
||||
d.text((lx + 12, 142), val, font=f_mono_b, fill=GOLD)
|
||||
d.rectangle([370, 178, 642, 228], fill=PLATE, outline=EMERALD)
|
||||
d.text((382, 186), "21 + 14 + 22 + 30 + 27 = 114", font=f_mono_md, fill=EMERALD)
|
||||
d.text((382, 206), "Mod-9 Digital Root dr_9(114) = 6 (3::6)", font=f_mono_xs, fill=CYAN)
|
||||
im.save(out_dir / "quadrant-3-info-science-novice-learn-polyglot.png", "PNG")
|
||||
|
||||
# 7. Quadrant 03 Tab 2: /math/ 2-Col Guile & Z-REPL
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=CYAN)
|
||||
d.text((24, 18), "POLYGLOT LENS [λ GUILE ACTIVE] • 2-Column Spec & Step AST Trace", font=f_hdr, fill=CYAN)
|
||||
pills = [("OFF", False), ("λ GUILE", True), ("TS TYPESCRIPT", False), ("Rs RUST", False), ("≡ ALL 3", False)]
|
||||
px = 24
|
||||
for ptxt, pact in pills:
|
||||
pw = len(ptxt) * 8 + 20
|
||||
d.rectangle([px, 40, px + pw, 62], fill=(18, 28, 46) if pact else WELL, outline=GOLD if pact else BORDER)
|
||||
d.text((px + 10, 44), ptxt, font=f_mono_xs, fill=GOLD if pact else MUTED)
|
||||
px += pw + 8
|
||||
_draw_chamfer_box(d, (24, 70, 334, 182), WELL, CYAN, chamfer=7, pip=CYAN)
|
||||
d.text((36, 78), "1. Formal Math & Python 3.12", font=f_mono_b, fill=CYAN)
|
||||
d.text((36, 102), "AQ(w) = Σ val_36(c_i)", font=f_mono_b, fill=TEXT)
|
||||
d.text((36, 126), "from hyperstitionstud_io.ciphers \\", font=f_mono_xs, fill=MUTED)
|
||||
d.text((36, 144), " import compute_aq", font=f_mono_xs, fill=MUTED)
|
||||
d.text((36, 162), "compute_aq('LEMUR') # => 114", font=f_mono_b, fill=EMERALD)
|
||||
_draw_chamfer_box(d, (346, 70, 656, 182), WELL, GOLD, chamfer=7, pip=GOLD)
|
||||
d.text((358, 78), "2. λ GNU Guile Scheme (Z-Calculus)", font=f_mono_b, fill=GOLD)
|
||||
d.text((358, 102), "(define aq-base36 (Z (lambda (r) ...)))", font=f_mono_xs, fill=MUTED)
|
||||
d.text((358, 126), "(aq-base36 \"LEMUR\") ; => 114", font=f_mono_b, fill=TEXT)
|
||||
d.text((358, 148), "(prime-factors 666) ; => (2 3 3 37)", font=f_mono_b, fill=EMERALD)
|
||||
d.rectangle([24, 190, 656, 240], fill=(10, 15, 24), outline=GOLD)
|
||||
d.text((36, 196), "4-Ring Zero-Eval AST Trace (?repl=trace • Ring 2 Quota <= 2000 Steps):", font=f_mono_xs, fill=GOLD)
|
||||
d.text((36, 215), "guile> (prime-factors 666) => Step 1: d=2 -> 333 => Normal Form: (2 3 3 37)", font=f_mono_b, fill=EMERALD)
|
||||
im.save(out_dir / "quadrant-3-tab-2-math-guile.png", "PNG")
|
||||
|
||||
# 8. Quadrant 03 Tab 3: /math/ 2-Col TypeScript & Rust
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=CYAN)
|
||||
d.text((24, 18), "STATIC-TYPED AST PARITY • Spacious 2-Column TypeScript & Rust View", font=f_hdr, fill=CYAN)
|
||||
_draw_chamfer_box(d, (24, 46, 334, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((38, 56), "TS TypeScript (Strict ESM AST)", font=f_mono_b, fill=CYAN)
|
||||
ts_lines = [
|
||||
"export const charAq = (c: string): number =>",
|
||||
" /[0-9]/.test(c) ? c.charCodeAt(0) - 48",
|
||||
" : c.charCodeAt(0) - 55;",
|
||||
"",
|
||||
"aqBase36(\"LEMUR\");",
|
||||
"// => 114 (Exact Parity)",
|
||||
"primeFactors(666);",
|
||||
"// => [2, 3, 3, 37]",
|
||||
]
|
||||
for idx, ln in enumerate(ts_lines):
|
||||
col = EMERALD if ln.startswith("//") else (TEXT if "=>" not in ln else GOLD)
|
||||
d.text((38, 84 + idx * 18), ln, font=f_mono_xs, fill=col)
|
||||
_draw_chamfer_box(d, (346, 46, 656, 240), WELL, ROSE, chamfer=8, pip=ROSE)
|
||||
d.text((360, 56), "Rs Rust (Zero-Alloc Iterator AST)", font=f_mono_b, fill=ROSE)
|
||||
rs_lines = [
|
||||
"pub fn aq_base36(s: &str) -> u64 {",
|
||||
" s.chars().map(char_aq).sum()",
|
||||
"}",
|
||||
"",
|
||||
"aq_base36(\"LEMUR\");",
|
||||
"// => 114_u64",
|
||||
"prime_factors(666_u64);",
|
||||
"// => vec![2, 3, 3, 37]",
|
||||
]
|
||||
for idx, ln in enumerate(rs_lines):
|
||||
col = EMERALD if ln.startswith("//") else TEXT
|
||||
d.text((360, 84 + idx * 18), ln, font=f_mono_xs, fill=col)
|
||||
im.save(out_dir / "quadrant-3-tab-3-math-ts-rust.png", "PNG")
|
||||
|
||||
# 9. Quadrant 04 Tab 1: /engineering/ DevOps & CLIs
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
||||
d.text((24, 18), "ENGINEERING ARCHITECTURE • 4 Core Counters, Two-Script DevOps & CLIs", font=f_hdr, fill=ROSE)
|
||||
tiles = [
|
||||
("Repositories", str(eng_c.get("repositories", 6)), CYAN),
|
||||
("CLI Entrypoints", str(eng_c.get("cli_entrypoints", 17)), GOLD),
|
||||
("MCP & REST Tools", str(eng_c.get("mcp_tools", 20)), EMERALD),
|
||||
("Watchlist / FRED", f"{eng_c.get('watchlist_instruments', 24)} / {eng_c.get('fred_macro_series', 14)}", ROSE),
|
||||
]
|
||||
tw = (656 - 24 - 24) // 4
|
||||
for idx, (tlab, tval, tcol) in enumerate(tiles):
|
||||
tx = 24 + idx * (tw + 8)
|
||||
_draw_chamfer_box(d, (tx, 42, tx + tw, 92), WELL, tcol, chamfer=6, pip=tcol)
|
||||
d.text((tx + 10, 48), tlab, font=f_mono_xs, fill=MUTED)
|
||||
d.text((tx + 12, 64), tval, font=f_mono_lg, fill=tcol)
|
||||
_draw_chamfer_box(d, (24, 102, 334, 240), WELL, ROSE, chamfer=8, pip=ROSE)
|
||||
d.text((36, 112), "TWO-SCRIPT OPERATOR INVARIANT", font=f_mono_b, fill=ROSE)
|
||||
d.rectangle([36, 134, 322, 164], fill=PLATE, outline=BORDER)
|
||||
d.text((44, 142), "1. ./push-all-to-git-libre-audio.sh", font=f_mono_xs, fill=EMERALD)
|
||||
d.rectangle([36, 170, 322, 200], fill=PLATE, outline=BORDER)
|
||||
d.text((44, 178), "2. sudo deploy/sync-vps-repos.sh", font=f_mono_xs, fill=CYAN)
|
||||
d.text((36, 210), "tmpfs RAM • Brotli-11 • 0 /dev/null", font=f_mono_xs, fill=GOLD)
|
||||
_draw_chamfer_box(d, (346, 102, 656, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
cli_hdr = "CLI ENTRYPOINTS [Filter]" if eng_has_cli_filter else "CLI ENTRYPOINTS (pyproject.toml)"
|
||||
d.text((358, 112), cli_hdr, font=f_mono_b, fill=CYAN)
|
||||
clis = [
|
||||
("hs-doctor", "ci.doctor:main"),
|
||||
("hs-mcp", "mcp.server:main"),
|
||||
("hs-kg-build", "graph.compiler:main"),
|
||||
("hs-public-smoke", "ci.public_regression:main"),
|
||||
]
|
||||
for ci_i, (cname, cmod) in enumerate(clis):
|
||||
cy_c = 134 + ci_i * 25
|
||||
d.rectangle([358, cy_c, 644, cy_c + 21], fill=PLATE, outline=BORDER)
|
||||
d.text((366, cy_c + 3), cname, font=f_mono_b, fill=GOLD)
|
||||
d.text((492, cy_c + 3), cmod, font=f_mono_xs, fill=TEXT)
|
||||
im.save(out_dir / "quadrant-4-operators-deployment-vps.png", "PNG")
|
||||
|
||||
# 10. Quadrant 04 Tab 2: Unit E4 MCP, REST & ETag 304 Probe
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
||||
d.text((24, 18), "STATELESS MCP (/mcp), REST v1 (/api/v1/*) & LIVE ETAG 304 PROBE", font=f_hdr, fill=ROSE)
|
||||
_draw_chamfer_box(d, (24, 42, 334, 240), WELL, CYAN, chamfer=8, pip=CYAN)
|
||||
d.text((36, 52), f"{eng_c.get('mcp_tools', 20)} TOOLS • 14 RESOURCES • 4 PROMPTS", font=f_mono_b, fill=CYAN)
|
||||
eps = [
|
||||
("POST /mcp", "JSON-RPC 2.0 Streamable"),
|
||||
("GET /api/v1/status", "Health + CIDv1 ETag"),
|
||||
("GET /api/v1/quant/*", "24 Tickers + 14 FRED"),
|
||||
("GET /api/v1/ipld/cid", "RFC 8785 JCS + SHA-256"),
|
||||
("ProtectSystem=strict", "EROFS Verified (20/20)"),
|
||||
]
|
||||
for ei, (ep, edesc) in enumerate(eps):
|
||||
ey = 78 + ei * 30
|
||||
d.rectangle([36, ey, 322, ey + 25], fill=PLATE, outline=BORDER)
|
||||
d.text((44, ey + 5), ep, font=f_mono_b, fill=GOLD)
|
||||
d.text((184, ey + 5), edesc[:18], font=f_mono_xs, fill=TEXT)
|
||||
_draw_chamfer_box(d, (346, 42, 656, 240), WELL, EMERALD, chamfer=8, pip=EMERALD)
|
||||
d.text((360, 52), "LIVE API & ETAG 304 PROBE (#live-smoke-probe)", font=f_mono_b, fill=EMERALD)
|
||||
d.rectangle([360, 76, 642, 104], fill=(18, 28, 46), outline=EMERALD)
|
||||
d.text((374, 83), "[ ⚛ Run /api/v1/status & ETag 304 Probe ]", font=f_mono_b, fill=TEXT)
|
||||
probe_lines = [
|
||||
("1st Fetch:", "HTTP 200 OK (4.2 ms)"),
|
||||
("ETag:", "\"baguqeera7x9m...\""),
|
||||
("2nd Fetch:", "If-None-Match -> HTTP 304 (0.8 ms)"),
|
||||
("Isolation:", "ReadOnlyIsolationGuard: PASS"),
|
||||
]
|
||||
for pi, (pk, pv) in enumerate(probe_lines):
|
||||
py_p = 114 + pi * 28
|
||||
d.rectangle([360, py_p, 642, py_p + 23], fill=PLATE, outline=BORDER)
|
||||
d.text((368, py_p + 4), pk, font=f_mono_b, fill=GOLD)
|
||||
d.text((456, py_p + 4), pv, font=f_mono_xs, fill=EMERALD if "304" in pv or "PASS" in pv else TEXT)
|
||||
im.save(out_dir / "quadrant-4-tab-2-mcp-etag.png", "PNG")
|
||||
|
||||
# 11. Quadrant 04 Tab 3: /ci/ 4-Gate Pipeline & P1-P6 Smoke
|
||||
im, d = _new_canvas()
|
||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
||||
d.text((24, 18), "4-GATE INGGLISH CI PIPELINE (/ci/) & 6-GATE PUBLIC SMOKE SUITE", font=f_hdr, fill=ROSE)
|
||||
_draw_chamfer_box(d, (24, 42, 334, 240), WELL, GOLD, chamfer=8, pip=GOLD)
|
||||
d.text((36, 52), "4-GATE CI PROVISIONER (db.txt)", font=f_mono_b, fill=GOLD)
|
||||
gates = [
|
||||
("Gate A: Format", "ASCII Lowercase Clean [PASS]"),
|
||||
("Gate B: Phonemic", "CMUdict 126k Purity [PASS]"),
|
||||
("Gate C: AQ Parity", "Base-36 Sum Lock [PASS]"),
|
||||
("Gate D: Dedup", f"{db_cnt_str} Unique Rows [PASS]"),
|
||||
]
|
||||
for gi, (gn, gdesc) in enumerate(gates):
|
||||
gy = 80 + gi * 36
|
||||
d.rectangle([36, gy, 322, gy + 30], fill=PLATE, outline=BORDER)
|
||||
d.text((44, gy + 7), gn, font=f_mono_b, fill=GOLD)
|
||||
d.text((166, gy + 7), gdesc, font=f_mono_xs, fill=EMERALD)
|
||||
_draw_chamfer_box(d, (346, 42, 656, 240), WELL, EMERALD, chamfer=8, pip=EMERALD)
|
||||
d.text((360, 52), "6-GATE PUBLIC SMOKE (P1 - P6)", font=f_mono_b, fill=EMERALD)
|
||||
p_gates = [
|
||||
("P1: Static Routes", "78/78 HTTP 200 OK"),
|
||||
("P2: JSON Registries", "SHA-256 + CIDv1 Lock"),
|
||||
("P3: REST API v1", "4/4 Endpoints + ETag"),
|
||||
("P4: MCP JSON-RPC", f"{eng_c.get('mcp_tools', 20)} Tools + 14 Resources"),
|
||||
("P5/P6: Assets & PDF", "0 /Helvetica • Brotli-11"),
|
||||
]
|
||||
for pi, (pn, pdesc) in enumerate(p_gates):
|
||||
py_g = 78 + pi * 30
|
||||
d.rectangle([360, py_g, 642, py_g + 25], fill=PLATE, outline=BORDER)
|
||||
d.text((368, py_g + 5), pn, font=f_mono_b, fill=CYAN)
|
||||
d.text((506, py_g + 5), pdesc, font=f_mono_xs, fill=EMERALD)
|
||||
im.save(out_dir / "quadrant-4-tab-3-ci-gates.png", "PNG")
|
||||
|
||||
manifest_path.write_text(json.dumps(live_manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
||||
|
||||
return {
|
||||
"ok": True,
|
||||
"rerendered": True,
|
||||
"ui_elements_fingerprint_sha256": live_manifest["ui_elements_fingerprint_sha256"],
|
||||
"cidv1": live_manifest["ipld_dag_json_cidv1"]["/"],
|
||||
"closeup_count": len(ALL_CLOSEUP_FILENAMES),
|
||||
"isolation_receipt": guard.verification_receipt(),
|
||||
}
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
ap = argparse.ArgumentParser(
|
||||
prog="hs-closeups-sync",
|
||||
description="Inspect live DOM UI elements across all pages and re-render homepage 680x260 UI closeups whenever UI elements are added or removed.",
|
||||
)
|
||||
ap.add_argument("--force", action="store_true", help="Force re-rendering all 11 closeups even if UI element fingerprint is unchanged.")
|
||||
ap.add_argument("--check", action="store_true", help="Verify closeups match the current live UI element fingerprint without modifying files.")
|
||||
args = ap.parse_args(argv)
|
||||
res = render_all_quadrant_closeups(force=args.force, check_only=args.check)
|
||||
print(json.dumps(res, indent=2))
|
||||
return 0 if res.get("ok") else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -475,7 +475,7 @@ def sync_all_repo_readmes(
|
||||
|
||||
PRE_COMMIT_HOOK_SCRIPT = """#!/usr/bin/env bash
|
||||
# Auto-installed by hyperstitionstud_io.publishing.readme_sync (hs-readme-sync --install-hooks)
|
||||
# Synchronizes root README.md with the staged commit scope and current release version before every commit.
|
||||
# Re-renders homepage UI closeups when page UI elements change and synchronizes root README.md before every commit.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
@@ -485,6 +485,10 @@ CORE_SRC="${WS_ROOT}/hyperstitionstudio-core/src"
|
||||
|
||||
if [[ -d "${CORE_SRC}" ]]; then
|
||||
export PYTHONPATH="${CORE_SRC}${PYTHONPATH:+:${PYTHONPATH}}"
|
||||
python3 -m hyperstitionstud_io.publishing.closeups_sync
|
||||
if [[ -d "${WS_ROOT}/hyperstitionstudio-core/site/assets/closeups" ]] && [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then
|
||||
git -C "${REPO_ROOT}" add site/assets/closeups/
|
||||
fi
|
||||
python3 -m hyperstitionstud_io.publishing.readme_sync --repo "${REPO_NAME}" --stage
|
||||
fi
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user