Release v2.12.0: Implement single-layer compression enforcement, 256KB plan archive cap with git.libre.audio citations, cold-archived inactive plans, codebase modularity/security/economization (Strategies 1A/2B/3A/4A/5A/6A/7A), and /quant/ spoken voice narration & #lensSelect UI element indicators (Strategies 1B/2A/3A/4A)
This commit is contained in:
1 parent
cc73a57bd8
commit
a066a0d03d
69 files changed
+2334
-619
No files matched your search
@@ -19,10 +19,11 @@ from hyperstitionstud_io.ciphers import (
|
||||
is_repdigit_37,
|
||||
prime_rank,
|
||||
)
|
||||
from hyperstitionstud_io.config import load_workspace_config
|
||||
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||
from hyperstitionstud_io.ipld import inspect_dag_json_payload
|
||||
from hyperstitionstud_io.phonetics import translate_batch
|
||||
from hyperstitionstud_io.quant.collector import build_financial_quant_harvest
|
||||
from hyperstitionstud_io.security import safe_tar_members
|
||||
|
||||
REGISTER_STAT_LABELS = {
|
||||
"academic": {
|
||||
@@ -355,8 +356,8 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
if name == "hs_classify_singularity":
|
||||
terms = [str(t) for t in arguments.get("terms", [])]
|
||||
headline = str(arguments.get("headline_text", "")).lower()
|
||||
mat = json.loads((cfg.zoology_dir / "taxonomy" / "singularity-zoology-matrix.json").read_text(encoding="utf-8"))
|
||||
mem = json.loads((cfg.zoology_dir / "taxonomy" / "memetic-superclass-registry.json").read_text(encoding="utf-8"))
|
||||
mat = load_json_cached(cfg.zoology_dir / "taxonomy" / "singularity-zoology-matrix.json", copy_result=False)
|
||||
mem = load_json_cached(cfg.zoology_dir / "taxonomy" / "memetic-superclass-registry.json", copy_result=False)
|
||||
ing_map = translate_batch(terms)
|
||||
|
||||
classified = []
|
||||
@@ -393,7 +394,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
q = str(arguments.get("query", "")).strip().lower()
|
||||
inc_nbr = bool(arguments.get("include_neighbors", True))
|
||||
kg_path = cfg.knowledge_graph_dir / "encyclopedia-graph.json"
|
||||
kg = json.loads(kg_path.read_text(encoding="utf-8"))
|
||||
kg = load_json_cached(kg_path, copy_result=False)
|
||||
matches = []
|
||||
for n in kg["nodes"]:
|
||||
if (
|
||||
@@ -429,7 +430,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
q = str(arguments.get("query", "")).strip().lower()
|
||||
g_filt = str(arguments.get("guild_filter", "")).strip().upper()
|
||||
limit = int(arguments.get("limit", 15))
|
||||
gl = json.loads((cfg.zoology_dir / "taxonomy" / "glossary-registry.json").read_text(encoding="utf-8"))
|
||||
gl = load_json_cached(cfg.zoology_dir / "taxonomy" / "glossary-registry.json", copy_result=False)
|
||||
hits = []
|
||||
for sec in gl.get("sections", []):
|
||||
for ent in sec.get("entries", []):
|
||||
@@ -454,7 +455,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
if name == "hs_inspect_eti_tier_list":
|
||||
b_filt = str(arguments.get("build_filter", "all")).strip().upper()
|
||||
reg = str(arguments.get("register", "academic")).strip().lower()
|
||||
tl = json.loads((cfg.zoology_dir / "taxonomy" / "assemblage-builds-tier-list.json").read_text(encoding="utf-8"))
|
||||
tl = load_json_cached(cfg.zoology_dir / "taxonomy" / "assemblage-builds-tier-list.json", copy_result=False)
|
||||
labels = REGISTER_STAT_LABELS.get(reg, REGISTER_STAT_LABELS["academic"])
|
||||
rows = []
|
||||
for r in tl.get("rows", []):
|
||||
@@ -486,7 +487,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
aid = str(arguments.get("anchor_id", "")).strip()
|
||||
new_dig = str(arguments.get("new_digit_str", "")).strip()
|
||||
new_sp_eng = str(arguments.get("new_spoken_eng", "")).strip()
|
||||
anc_data = json.loads((cfg.zoology_dir / "taxonomy" / "quantitative-economic-anchors.json").read_text(encoding="utf-8"))
|
||||
anc_data = load_json_cached(cfg.zoology_dir / "taxonomy" / "quantitative-economic-anchors.json", copy_result=False)
|
||||
anchor = next((a for a in anc_data.get("anchors", []) if a["anchor_id"] == aid), None)
|
||||
if anchor is None:
|
||||
return {"error": f"Unknown anchor_id '{aid}'", "available_anchors": [a["anchor_id"] for a in anc_data.get("anchors", [])]}
|
||||
@@ -573,6 +574,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
"engineering-manifest": cfg.core_dir / "site" / "engineering" / "engineering-manifest.json",
|
||||
"math-manifest": cfg.core_dir / "site" / "math" / "math-manifest.json",
|
||||
"archive-manifest": cfg.knowledge_graph_dir / "docs" / "archive" / "archive-manifest.json",
|
||||
"inactive-archive-manifest": cfg.knowledge_graph_dir / "docs" / "plans" / "inactive" / "inactive-archive-manifest.json",
|
||||
}
|
||||
p = reg_map.get(str(reg_name))
|
||||
if p is None or not p.is_file():
|
||||
@@ -604,7 +606,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
lens_q = str(arguments.get("lens", "fund_manager")).strip()
|
||||
ts_json_path = cfg.core_dir / "site" / "quant" / "quant-timeseries.json"
|
||||
if ts_json_path.is_file():
|
||||
bundle = json.loads(ts_json_path.read_text(encoding="utf-8"))
|
||||
bundle = load_json_cached(ts_json_path, copy_result=False)
|
||||
else:
|
||||
bundle = build_quant_timeseries_bundle(write_files=False)
|
||||
if sym_q:
|
||||
@@ -662,7 +664,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
slug_f = str(arguments.get("indicator_slug", "")).strip().lower()
|
||||
m_path = cfg.core_dir / "site" / "quant" / "real-macro-indicators.json"
|
||||
if m_path.is_file():
|
||||
m_bundle = json.loads(m_path.read_text(encoding="utf-8"))
|
||||
m_bundle = load_json_cached(m_path, copy_result=False)
|
||||
else:
|
||||
m_bundle = build_macro_indicators_bundle(allow_live_network=False, write_files=False)
|
||||
if slug_f and slug_f in (m_bundle.get("series") or {}):
|
||||
@@ -681,7 +683,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
b_path = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json"
|
||||
if bool(arguments.get("refresh")) or not b_path.is_file():
|
||||
return build_daily_portfolio_brief(allow_live_network=False, write_files=False)
|
||||
return json.loads(b_path.read_text(encoding="utf-8"))
|
||||
return load_json_cached(b_path)
|
||||
|
||||
if name == "hs_inspect_engineering_and_math_docs":
|
||||
from hyperstitionstud_io.publishing.engineering_docs import (
|
||||
@@ -699,8 +701,8 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
eng_p = cfg.core_dir / "site" / "engineering" / "engineering-manifest.json"
|
||||
math_p = cfg.core_dir / "site" / "math" / "math-manifest.json"
|
||||
eng_m = json.loads(eng_p.read_text(encoding="utf-8")) if eng_p.is_file() else introspect_engineering_manifest()
|
||||
math_m = json.loads(math_p.read_text(encoding="utf-8")) if math_p.is_file() else introspect_math_manifest()
|
||||
eng_m = load_json_cached(eng_p, copy_result=False) if eng_p.is_file() else introspect_engineering_manifest()
|
||||
math_m = load_json_cached(math_p, copy_result=False) if math_p.is_file() else introspect_math_manifest()
|
||||
|
||||
out_docs: dict[str, Any] = {"version": eng_m["version"], "domain": dom}
|
||||
if dom in ("all", "engineering"):
|
||||
@@ -832,35 +834,116 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
archived_out: list[dict[str, Any]] = []
|
||||
if cat in ("all", "archived_plans"):
|
||||
for arc_dir in (cfg.knowledge_graph_dir / "docs" / "archive", cfg.zoology_dir / "docs" / "archive"):
|
||||
tgz_p = arc_dir / "completed-plans-archive.tar.gz"
|
||||
if not tgz_p.is_file():
|
||||
continue
|
||||
with tarfile.open(tgz_p, "r:gz") as tf:
|
||||
for m in tf.getmembers():
|
||||
if not m.name.endswith(".md"):
|
||||
continue
|
||||
stem = Path(m.name).stem
|
||||
if doc_id and doc_id.lower() not in stem.lower():
|
||||
continue
|
||||
f_obj = tf.extractfile(m)
|
||||
if f_obj is None:
|
||||
continue
|
||||
m_txt = f_obj.read().decode("utf-8", errors="replace")
|
||||
if sq and sq not in m_txt.lower() and sq not in stem.lower():
|
||||
continue
|
||||
arc_item: dict[str, Any] = {
|
||||
"id": stem,
|
||||
"category": "archived_plans",
|
||||
"bundle": str(tgz_p.name),
|
||||
"member_name": m.name,
|
||||
"char_count": len(m_txt),
|
||||
}
|
||||
if sq:
|
||||
arc_item["matched_lines"] = [ln for ln in m_txt.splitlines() if sq in ln.lower()][:10]
|
||||
if inc_md:
|
||||
arc_item["markdown"] = m_txt
|
||||
archived_out.append(arc_item)
|
||||
from hyperstitionstud_io.publishing.archive_rotator import (
|
||||
BUNDLE_FILENAME,
|
||||
INACTIVE_BUNDLE_FILENAME,
|
||||
INACTIVE_MANIFEST_FILENAME,
|
||||
MANIFEST_FILENAME,
|
||||
read_member_from_git_history,
|
||||
)
|
||||
|
||||
arc_sources = [
|
||||
(
|
||||
cfg.knowledge_graph_dir / "docs" / "archive",
|
||||
BUNDLE_FILENAME,
|
||||
MANIFEST_FILENAME,
|
||||
"archived_completed",
|
||||
),
|
||||
(
|
||||
cfg.zoology_dir / "docs" / "archive",
|
||||
BUNDLE_FILENAME,
|
||||
MANIFEST_FILENAME,
|
||||
"archived_completed",
|
||||
),
|
||||
(
|
||||
cfg.knowledge_graph_dir / "docs" / "plans" / "inactive",
|
||||
INACTIVE_BUNDLE_FILENAME,
|
||||
INACTIVE_MANIFEST_FILENAME,
|
||||
"archived_inactive",
|
||||
),
|
||||
]
|
||||
for arc_dir, b_fname, m_fname, cls_tag in arc_sources:
|
||||
tgz_p = arc_dir / b_fname
|
||||
man_p = arc_dir / m_fname
|
||||
man_obj: dict[str, Any] = {}
|
||||
if man_p.is_file():
|
||||
try:
|
||||
man_obj = load_json_cached(man_p, copy_result=False)
|
||||
except Exception:
|
||||
man_obj = {}
|
||||
cit_by_name = {
|
||||
str(it.get("name")): it
|
||||
for it in (man_obj.get("members") or []) + (man_obj.get("long_term_git_storage_citations") or [])
|
||||
if it.get("name")
|
||||
}
|
||||
|
||||
seen_names: set[str] = set()
|
||||
if tgz_p.is_file():
|
||||
with tarfile.open(tgz_p, "r:gz") as tf:
|
||||
for m in safe_tar_members(tf):
|
||||
if not m.name.endswith(".md"):
|
||||
continue
|
||||
seen_names.add(m.name)
|
||||
stem = Path(m.name).stem
|
||||
if doc_id and doc_id.lower() not in stem.lower():
|
||||
continue
|
||||
f_obj = tf.extractfile(m)
|
||||
if f_obj is None:
|
||||
continue
|
||||
m_txt = f_obj.read().decode("utf-8", errors="replace")
|
||||
if sq and sq not in m_txt.lower() and sq not in stem.lower():
|
||||
continue
|
||||
cit_info = cit_by_name.get(m.name) or {}
|
||||
arc_item: dict[str, Any] = {
|
||||
"id": stem,
|
||||
"category": "archived_plans",
|
||||
"classification": cit_info.get("classification", cls_tag),
|
||||
"storage_tier": "active_tar_gz_bundle",
|
||||
"bundle": str(tgz_p.name),
|
||||
"member_name": m.name,
|
||||
"char_count": len(m_txt),
|
||||
"git_citation_url": cit_info.get("git_citation_url"),
|
||||
}
|
||||
if sq:
|
||||
arc_item["matched_lines"] = [ln for ln in m_txt.splitlines() if sq in ln.lower()][:10]
|
||||
if inc_md:
|
||||
arc_item["markdown"] = m_txt
|
||||
archived_out.append(arc_item)
|
||||
|
||||
# Also search long_term_git_storage_citations via local .git fallback
|
||||
for lt in man_obj.get("long_term_git_storage_citations") or []:
|
||||
lt_name = str(lt.get("name") or "")
|
||||
if not lt_name.endswith(".md") or lt_name in seen_names:
|
||||
continue
|
||||
stem = Path(lt_name).stem
|
||||
if doc_id and doc_id.lower() not in stem.lower():
|
||||
continue
|
||||
raw_b = read_member_from_git_history(
|
||||
archive_dir=arc_dir,
|
||||
member_name=lt_name,
|
||||
citation_meta=lt,
|
||||
bundle_filename=b_fname,
|
||||
)
|
||||
if raw_b is None:
|
||||
continue
|
||||
m_txt = raw_b.decode("utf-8", errors="replace")
|
||||
if sq and sq not in m_txt.lower() and sq not in stem.lower():
|
||||
continue
|
||||
lt_item: dict[str, Any] = {
|
||||
"id": stem,
|
||||
"category": "archived_plans",
|
||||
"classification": lt.get("classification", cls_tag),
|
||||
"storage_tier": "git_source_control_long_term",
|
||||
"bundle": str(tgz_p.name),
|
||||
"member_name": lt_name,
|
||||
"char_count": len(m_txt),
|
||||
"git_citation_url": lt.get("git_citation_url"),
|
||||
}
|
||||
if sq:
|
||||
lt_item["matched_lines"] = [ln for ln in m_txt.splitlines() if sq in ln.lower()][:10]
|
||||
if inc_md:
|
||||
lt_item["markdown"] = m_txt
|
||||
archived_out.append(lt_item)
|
||||
|
||||
res_doc: dict[str, Any] = {
|
||||
"category_filter": cat,
|
||||
|
||||
Reference in new issue
Block a user