feat(v2.0.8): implement ipld dag-json/CIDv1, quant financial collector, MCP server (hs-mcp), /learn/ sub-page, /gallery/ sub-page, and global Lemurs footer
This commit is contained in:
1 parent
b767f8a4e9
commit
c17f74097b
55 files changed
+3974
-10
No files matched your search
@@ -44,12 +44,17 @@ def test_offline_urn_namespaces_and_no_external_https_fonts() -> None:
|
||||
cfg = load_workspace_config()
|
||||
for html_p in (
|
||||
cfg.core_dir / "site" / "index.html",
|
||||
cfg.core_dir / "site" / "learn" / "index.html",
|
||||
cfg.core_dir / "site" / "gallery" / "index.html",
|
||||
cfg.knowledge_graph_dir / "index.html",
|
||||
cfg.knowledge_graph_dir / "docs" / "cross-repo-dependency-and-audit-flow-diagram.html",
|
||||
cfg.paths["gematria_js_dir"] / "index.html",
|
||||
):
|
||||
txt = html_p.read_text(encoding="utf-8")
|
||||
assert "fonts.googleapis.com" not in txt
|
||||
assert "https://hyperstitionstud.io" not in txt
|
||||
assert "by Lemurs." in txt, f"Missing global Lemurs footer in {html_p}"
|
||||
assert ("♥" in txt or "♥" in txt), f"Missing Unicode heart in {html_p}"
|
||||
|
||||
schemas_dir = cfg.core_dir / "schemas" / "v1"
|
||||
for sp in schemas_dir.glob("*.schema.json"):
|
||||
@@ -138,6 +143,69 @@ def test_doctor_all_checks_pass() -> None:
|
||||
assert diag["all_checks_passed"] is True
|
||||
|
||||
|
||||
def test_ipld_quant_and_mcp_server() -> None:
|
||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1, encode_dag_json
|
||||
from hyperstitionstud_io.mcp.server import dispatch_jsonrpc
|
||||
from hyperstitionstud_io.quant.collector import build_financial_quant_harvest
|
||||
|
||||
# 1. IPLD dag-json & CIDv1 deterministic parity
|
||||
b1 = encode_dag_json({"b": 2, "a": 1})
|
||||
b2 = encode_dag_json({"a": 1, "b": 2})
|
||||
assert b1 == b2 == b'{"a":1,"b":2}'
|
||||
cid = compute_dag_json_cidv1({"a": 1, "b": 2})
|
||||
assert cid.startswith("baguqeera")
|
||||
|
||||
# 2. Quantitative Financial Telemetry Collector
|
||||
q_harvest = build_financial_quant_harvest()
|
||||
assert q_harvest["regime_summary"]["instrument_count"] == 24
|
||||
assert q_harvest["regime_summary"]["total_contingent_locks"] >= 20
|
||||
assert q_harvest["isolation_receipt"]["all_unchanged"] is True
|
||||
assert q_harvest["ipld_dag_json_cidv1"]["/"].startswith("baguqeera")
|
||||
|
||||
# 3. MCP Server JSON-RPC 2.0 Dispatch (initialize, tools/list, tools/call, resources/read, prompts/get)
|
||||
init_resp = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-03-26"}})
|
||||
assert init_resp and init_resp["result"]["serverInfo"]["name"] == "hyperstitionstudio-mcp"
|
||||
|
||||
t_list = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 2, "method": "tools/list"})
|
||||
assert t_list and len(t_list["result"]["tools"]) == 11
|
||||
|
||||
t_call = dispatch_jsonrpc({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 3,
|
||||
"method": "tools/call",
|
||||
"params": {"name": "hs_evaluate_aq_and_ingglish", "arguments": {"terms": ["schizoanalysis", "abstract machine", "synthetic data"]}},
|
||||
})
|
||||
assert t_call and t_call["result"]["isError"] is False
|
||||
parsed_tool = json.loads(t_call["result"]["content"][0]["text"])
|
||||
assert parsed_tool["exact_gen1_singularity"] is True
|
||||
|
||||
q_call = dispatch_jsonrpc({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 4,
|
||||
"method": "tools/call",
|
||||
"params": {"name": "hs_scan_financial_quant_harvest", "arguments": {"symbol_filter": "NVDA"}},
|
||||
})
|
||||
assert q_call and q_call["result"]["isError"] is False
|
||||
parsed_q = json.loads(q_call["result"]["content"][0]["text"])
|
||||
assert len(parsed_q["instruments"]) == 1 and parsed_q["instruments"][0]["symbol"] == "NVDA"
|
||||
|
||||
r_read = dispatch_jsonrpc({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 5,
|
||||
"method": "resources/read",
|
||||
"params": {"uri": "urn:io:hyperstitionstud:dossier:65"},
|
||||
})
|
||||
assert r_read and "292" in r_read["result"]["contents"][0]["text"]
|
||||
|
||||
p_get = dispatch_jsonrpc({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 6,
|
||||
"method": "prompts/get",
|
||||
"params": {"name": "analyze_headline_zoology", "arguments": {"headline": "Nvidia Blackwell halts"}},
|
||||
})
|
||||
assert p_get and len(p_get["result"]["messages"]) == 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_offline_urn_namespaces_and_no_external_https_fonts()
|
||||
print("[PASS] test_offline_urn_namespaces_and_no_external_https_fonts")
|
||||
@@ -151,4 +219,6 @@ if __name__ == "__main__":
|
||||
print("[PASS] test_local_config_citation_resolution_and_proposals")
|
||||
test_doctor_all_checks_pass()
|
||||
print("[PASS] test_doctor_all_checks_pass")
|
||||
print("ALL 6 TEST SUITES PASSED.")
|
||||
test_ipld_quant_and_mcp_server()
|
||||
print("[PASS] test_ipld_quant_and_mcp_server")
|
||||
print("ALL 7 TEST SUITES PASSED.")
|
||||
Reference in new issue
Block a user