diff --git a/README.md b/README.md index a14a94e..aa365f9 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ > **Gitea Commit & Release Telemetry (`v2.17.0` • Namespace `urn:io:hyperstitionstud`)** > - **Repository Role & Public Route:** Shared PEP 420 Python core library (`hyperstitionstud_io.*`), MCP/REST server, `/quant/`, `/learn/`, `/engineering/`, `/math/`, & `/donate/` webroots → [`https://hyperstitionstud.io/`](https://hyperstitionstud.io/) -> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.0 release state across 9 tracked module/artifact surface(s) -> - **Touched Files / Surfaces:** `site/assets/closeups/ui-elements-manifest.json`, `site/engineering/engineering-manifest-data.js`, `site/engineering/engineering-manifest.json`, `site/engineering/index.html`, `site/engineering/mcp-chatbot-rest-and-ipld/index.html`, `site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md`, `site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf`, `src/hyperstitionstud_io/publishing/engineering_docs.py` (+1 more) +> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.0 release state across 23 tracked module/artifact surface(s) +> - **Touched Files / Surfaces:** `deploy/push-all-to-git-libre-audio.sh`, `deploy/sync-vps-repos.sh`, `site/assets/closeups/quadrant-1-cybermemetics-calc-graph.png`, `site/assets/closeups/quadrant-4-tab-3-ci-gates.png`, `site/assets/closeups/ui-elements-manifest.json`, `site/engineering/engineering-manifest-data.js`, `site/engineering/engineering-manifest.json`, `site/engineering/index.html` (+15 more) > - **Live Verified Ecosystem Metrics (`v2.17.0`):** `6` Repositories • `17` CLI Entrypoints • `20` MCP/REST Tools • `14` URN Resources • `63` Verified Web Routes • `388` KG Nodes / `1,282` Edges • `282` Glossary Entries • `4,943` Offline CMUdict Phonetics • `0` Synthetic Data @@ -60,16 +60,20 @@ python3 hyperstitionstudio-core/tests/test_core_suite.py - `/` (Portal Home), `/learn/` (6-Module Interactive Track), `/quant/` (3-Pane Closing-Bell & FRED Macro Time-Series + 25-Scene Guided Tour), `/engineering/` (`E0-E5` Software Engineering Hub), `/math/` (`M0-M5` Applied Mathematics Hub), and `/donate/` (Signal Patronage). 4. **4,943-Entry Offline `CMUdict` Phonetics Lookup (`cmudict_fallback.json`):** - Translates `Gen 0` English tokens to `Gen 1` Ingglish 100% offline with zero network calls. -5. **One-Shot `900×1260` Ticker Stats Cards (`.png` + `.json`) via CLI, Chatbot REST API & MCP:** +5. **One-Shot `900×1260` Ticker Stats Cards (`.png` + `.json`) via cURL, CLI, Chatbot REST API & MCP:** ```bash - # (a) Direct CLI entrypoint (writes /tmp/hyperstition-cards/NVDA-stats-card.{png,json}): + # (a) cURL quickstart (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): + curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false" -o /tmp/NVDA-stats-card.json + curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=true" | jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png + + # (b) Direct CLI entrypoint (writes /tmp/hyperstition-cards/NVDA-stats-card.{png,json}): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards - # (b) Chatbot OpenAPI 3.1 REST API client (GET or POST /api/v1/tools/hs_generate_ticker_stats_card): + # (c) Chatbot OpenAPI 3.1 REST API client (GET or POST /api/v1/tools/hs_generate_ticker_stats_card): curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false" | jq . curl -sS "https://hyperstitionstud.io/api/v1/zoology/pokedex/NVDA?include_card=true" | jq '.data.stats_card.card_identity' - # (c) MCP JSON-RPC 2.0 client (Streamable HTTP POST /mcp or hs-mcp --transport stdio): + # (d) MCP JSON-RPC 2.0 client (Streamable HTTP POST /mcp or hs-mcp --transport stdio): curl -sS -X POST "https://hyperstitionstud.io/mcp" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hs_generate_ticker_stats_card","arguments":{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}' | jq . ``` diff --git a/deploy/push-all-to-git-libre-audio.sh b/deploy/push-all-to-git-libre-audio.sh index 5edc87c..2b63bdb 100755 --- a/deploy/push-all-to-git-libre-audio.sh +++ b/deploy/push-all-to-git-libre-audio.sh @@ -135,6 +135,10 @@ push_head_tag "${WORKSPACE_DIR}/hyperdope-ci-build" origin if [[ -d "${WORKSPACE_DIR}/haiperdohp-jemaytreeah/.git" ]]; then echo " -> (6/6) haiperdohp-jemaytreeah (downstream main, feat/ingglish-aq-corpus, feat/ingglish-priority-toggle + HEAD tag)" ensure_remote_url "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream "${FORGE_SSH}/haiperdohp-jemaytreeah.git" + git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" fetch downstream || true + git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream main || true + git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-aq-corpus || true + git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-priority-toggle || true git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" push downstream main feat/ingglish-aq-corpus feat/ingglish-priority-toggle push_head_tag "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream fi diff --git a/deploy/sync-vps-repos.sh b/deploy/sync-vps-repos.sh index ebd2226..a9e44f2 100755 --- a/deploy/sync-vps-repos.sh +++ b/deploy/sync-vps-repos.sh @@ -117,6 +117,10 @@ if [[ "${DO_PULL}" -eq 1 ]]; then if ! git -C "${REPOS_ROOT}/${repo}" diff --quiet -- README.md 2>&1; then git -C "${REPOS_ROOT}/${repo}" checkout -- README.md || true fi + git -C "${REPOS_ROOT}/${repo}" checkout -- financial-aq-harvest-latest.json || true + if [[ "${repo}" == "${CI_REPO_DIR}" || "${repo}" == "ingglish-hyperdope-gematria" ]] && ! git -C "${REPOS_ROOT}/${repo}" diff --quiet 2>&1; then + git -C "${REPOS_ROOT}/${repo}" checkout -- . || true + fi run_checked "git merge ${repo}" git -C "${REPOS_ROOT}/${repo}" merge --ff-only "${remote_name}/${branch}" new_head="$(git -C "${REPOS_ROOT}/${repo}" rev-parse HEAD)" if [[ "${repo}" == "hyperstitionstudio-core" && "${prev_head}" != "${new_head}" && -z "${HYPERSTITION_SYNC_REEXEC:-}" ]]; then diff --git a/site/assets/closeups/quadrant-1-cybermemetics-calc-graph.png b/site/assets/closeups/quadrant-1-cybermemetics-calc-graph.png index 077bf0a..a5f66c4 100644 Binary files a/site/assets/closeups/quadrant-1-cybermemetics-calc-graph.png and b/site/assets/closeups/quadrant-1-cybermemetics-calc-graph.png differ diff --git a/site/assets/closeups/quadrant-4-tab-3-ci-gates.png b/site/assets/closeups/quadrant-4-tab-3-ci-gates.png index f3e928b..71f0620 100644 Binary files a/site/assets/closeups/quadrant-4-tab-3-ci-gates.png and b/site/assets/closeups/quadrant-4-tab-3-ci-gates.png differ diff --git a/site/assets/closeups/ui-elements-manifest.json b/site/assets/closeups/ui-elements-manifest.json index d2b3077..35c1e73 100644 --- a/site/assets/closeups/ui-elements-manifest.json +++ b/site/assets/closeups/ui-elements-manifest.json @@ -1,6 +1,6 @@ { "$id": "urn:io:hyperstitionstud:closeups-ui-manifest", - "ui_elements_fingerprint_sha256": "e62f107407574752ad8d4b3bf2574326bc0b06fdbbf37b743b2c711a09caaa9f", + "ui_elements_fingerprint_sha256": "55133af5b8662fcd4db68781d8002a6f931891143123e7f3e8c9b7e91faf9103", "closeup_images": [ "quadrant-1-cybermemetics-calc-graph.png", "quadrant-1-tab-2-graph.png", @@ -15,7 +15,7 @@ "quadrant-4-tab-3-ci-gates.png" ], "live_metrics": { - "calc_db_entries": 231061, + "calc_db_entries": 233815, "quant_total_real_bars": 472, "quant_bayesian_posteriors": { "R1_BULL_RISK_ON": 0.0, @@ -332,7 +332,7 @@ ] }, "engineering_e4": { - "ui_structure_sha256": "b86e97644a9c1252028540bd83b2a8b19c379fd0d2961d352491e83b277d4995", + "ui_structure_sha256": "091da2701d8030d78b2c33614c62974e0b90cce8ddefecb748dffd19f42e0f67", "id_count": 15, "button_count": 17, "option_count": 16, @@ -388,7 +388,7 @@ "Unit E4: Stateless MCP Server (:8095), Chatbot OpenAPI 3.1.0 REST Adapter, .png+.json Cards & IPLD CIDv1", "1. Unified Stateless MCP (/mcp) & Chatbot OpenAPI 3.1.0 REST Adapter (/api/v1/*)", "2. One-Shot .png + .json Ticker Stats Cards (quant/cards.py) & Canonical IPLD dag-json (0x0129)", - "3. Command-Line Usage Examples: CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", + "3. Command-Line Usage Examples: cURL, CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", "⚛ Live API & IPLD CIDv1 ETag 304 Conditional Cache Probe (#live-smoke-probe)" ] }, @@ -804,7 +804,7 @@ } }, "ipld_dag_json_cidv1": { - "/": "baguqeeraqs64csybqg243ag5ad6r75z26sgj6fn7zdxfeppdxjxm2jjkebpq" + "/": "baguqeerakt6axr7t6xup2i6zp6xqdpwn3m4yzhidockgwzw3nyvqu3rqf4lq" }, "geometry_audit": { "all_clean": true, diff --git a/site/engineering/engineering-manifest-data.js b/site/engineering/engineering-manifest-data.js index 2b3d1cc..fad856c 100644 --- a/site/engineering/engineering-manifest-data.js +++ b/site/engineering/engineering-manifest-data.js @@ -1 +1 @@ -window.HYPERSTITION_ENGINEERING_MANIFEST = {"$id": "urn:io:hyperstitionstud:engineering-manifest", "version": "2.17.0", "enabled_subpages": ["ciphers-and-phonetics", "knowledge-graph-and-sqlite", "quant-macro-and-bayesian-brief", "mcp-chatbot-rest-and-ipld", "cicd-vps-tmpfs-and-regression"], "disabled_subpages": [], "enabled_routes": ["/engineering/index.html", "/engineering/ciphers-and-phonetics/index.html", "/engineering/knowledge-graph-and-sqlite/index.html", "/engineering/quant-macro-and-bayesian-brief/index.html", "/engineering/mcp-chatbot-rest-and-ipld/index.html", "/engineering/cicd-vps-tmpfs-and-regression/index.html"], "introspected_counts": {"repositories": 6, "cli_entrypoints": 20, "mcp_tools": 20, "rest_domain_aliases": 12, "enabled_lenses": 6, "watchlist_instruments": 24, "fred_macro_series": 14, "json_schemas_v1": 12}, "cli_scripts": {"hs-doctor": "hyperstitionstud_io.ci.doctor:main", "hs-citations": "hyperstitionstud_io.ci.citation_sources:main", "hs-pdf-build": "hyperstitionstud_io.publishing.pdf_compiler:main", "hs-kg-build": "hyperstitionstud_io.graph.cli:main", "hs-quant-harvest": "hyperstitionstud_io.quant.collector:main", "hs-mcp": "hyperstitionstud_io.mcp.server:main", "hs-sync-version": "hyperstitionstud_io.version_sync:main", "hs-db-build": "hyperstitionstud_io.db.sqlite_meta:main", "hs-macro-harvest": "hyperstitionstud_io.quant.macro:main", "hs-daily-brief": "hyperstitionstud_io.quant.daily_brief:main", "hs-ticker-card": "hyperstitionstud_io.quant.cards:main", "hs-archive-rotate": "hyperstitionstud_io.publishing.archive_rotator:main", "hs-public-smoke": "hyperstitionstud_io.ci.public_regression:main", "hs-eng-docs": "hyperstitionstud_io.publishing.engineering_docs:main", "hs-math-docs": "hyperstitionstud_io.publishing.math_docs:main", "hs-highlights": "hyperstitionstud_io.publishing.highlights:main", "hs-readme-sync": "hyperstitionstud_io.publishing.readme_sync:main", "hs-closeups-sync": "hyperstitionstud_io.publishing.closeups_sync:main", "hs-quant-voice-build": "hyperstitionstud_io.publishing.quant_voice:main", "hs-deploy-scripts-sync": "hyperstitionstud_io.ci.deploy_scripts_sync:main"}, "mcp_tool_names": ["hs_evaluate_aq_and_ingglish", "hs_classify_singularity", "hs_query_knowledge_graph", "hs_search_glossary_encyclopedia", "hs_inspect_eti_tier_list", "hs_simulate_anchor_revision", "hs_search_archive_equations", "hs_verify_grounded_citations", "hs_compute_ipld_dag_json_cid", "hs_run_doctor_and_audit", "hs_scan_financial_quant_harvest", "hs_inspect_quant_timeseries", "hs_generate_ticker_stats_card", "hs_inspect_macro_indicators", "hs_generate_daily_portfolio_brief", "hs_inspect_engineering_and_math_docs", "hs_inspect_documentation_and_manuals", "hs_evaluate_guile_scheme_z_calculus", "hs_query_workspace_catalog_and_release_state", "hs_generate_highlights_summary"], "rest_domain_aliases": {"/api/v1/doctor": "hs_run_doctor_and_audit", "/api/v1/ciphers/evaluate": "hs_evaluate_aq_and_ingglish", "/api/v1/zoology/classify": "hs_classify_singularity", "/api/v1/zoology/tier-list": "hs_inspect_eti_tier_list", "/api/v1/zoology/anchor-revision": "hs_simulate_anchor_revision", "/api/v1/graph/query": "hs_query_knowledge_graph", "/api/v1/glossary/search": "hs_search_glossary_encyclopedia", "/api/v1/archive/equations": "hs_search_archive_equations", "/api/v1/quant/harvest": "hs_scan_financial_quant_harvest", "/api/v1/quant/timeseries": "hs_inspect_quant_timeseries", "/api/v1/ipld/cid": "hs_compute_ipld_dag_json_cid", "/api/v1/citations/verify": "hs_verify_grounded_citations"}, "schemas_v1": ["assemblage-builds-tier-list.schema.json", "citations-ledger.schema.json", "encyclopedia-graph.schema.json", "encyclopedia-manifest.schema.json", "financial-aq-harvest.schema.json", "glossary-registry.schema.json", "learn-progress-state.schema.json", "memetic-superclass-registry.schema.json", "quant-timeseries.schema.json", "quantitative-economic-anchors.schema.json", "singularity-zoology-matrix.schema.json", "ticker-stats-card.schema.json"], "flow_diagrams": {"cross_repo_dependency_png": "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.png", "periodic_harvest_cicd_vps_png": "/graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png"}, "hub_prereq_ladder": {"unit_id": "E0", "expertise_level": "Level 1-2 (Novice to Advanced Beginner • 4-8 hrs study)", "summary": "New to command-line shells, Git repositories, or client-server web architecture? Start with these free foundational resources before diving into the engineering subpages:", "links": [{"label": "Internal: Self-Paced Learning Track (/learn/ Modules 1-6)", "url": "/learn/index.html", "external": false}, {"label": "MIT Missing Semester of Your CS Education (Shell, Git, CLI)", "url": "https://missing.csail.mit.edu/", "external": true}, {"label": "MDN Web Docs — How the Web Works (HTTP, HTML, Servers)", "url": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/How_the_Web_works", "external": true}]}, "subpages": {"ciphers-and-phonetics": {"unit_id": "E1", "slug": "ciphers-and-phonetics", "title": "Unit E1: Base-36 AQ Ciphers, Offline CMUdict Phonetics & Bidirectional Lock Evaluation", "short_title": "E1: Ciphers & Phonetics", "pip_class": "plate-lock-gold", "expertise_level": "Level 2: Introductory Python & Text Processing (10-15 hrs study)", "prerequisites": ["Python 3 functions, dictionaries (dict), frozenset, and regular expressions (re.sub)", "ASCII & Unicode character codepoints (ord(), UTF-8)", "Dictionary lookup vs. deterministic grapheme-to-phoneme fallback rules"], "public_resources": [{"label": "Internal: /learn/ Module 1 & 2 (Base-36 & Ingglish)", "url": "/learn/index.html", "external": false}, {"label": "Official Python 3 Tutorial (Sections 3-5 & 7)", "url": "https://docs.python.org/3/tutorial/", "external": true}, {"label": "Harvard CS50P (Intro to Programming with Python)", "url": "https://cs50.harvard.edu/python/", "external": true}, {"label": "CMU Pronouncing Dictionary (CMUdict) Specification", "url": "http://www.speech.cs.cmu.edu/cgi-bin/cmudict", "external": true}, {"label": "RegexOne Interactive Regular Expression Tutorial", "url": "https://regexone.com/", "external": true}], "sections": [{"heading": "1. PEP 420 Namespace & Quantization Modes (hyperstitionstud_io.ciphers)", "body": "The cipher engine maps digits 0-9 to 0..9 (ord(c)-48) and ASCII letters A-Z to 10..35 (ord(c)-87) across three quantization modes: digit (default), off (qualitative lexical only), and spoken (number-word expansion via int_to_spoken_words()), evaluating prime index ranks, 37×3k repdigit attractors, and 12-field bidirectional locks."}, {"heading": "2. Three-Tier Offline Phonemic Transducer (hyperstitionstud_io.phonetics)", "body": "translate_batch() resolves English phrases into Gen 1 Ingglish with zero external network calls and zero hardcoded /workspace dependencies: Tier 1 delegates to local Node/CLI translators when present; Tier 2 looks up the 4,943-entry bundled cmudict_fallback.json; Tier 3 applies deterministic English digraph-to-phoneme rules so arbitrary OOV strings always resolve."}]}, "knowledge-graph-and-sqlite": {"unit_id": "E2", "slug": "knowledge-graph-and-sqlite", "title": "Unit E2: 6-Gate 388-Node Knowledge Graph Compiler, ReadOnlyIsolationGuard & Quiescent SQLite + FTS5 Engine", "short_title": "E2: Knowledge Graph & SQLite", "pip_class": "plate-lock-emerald", "expertise_level": "Level 3-4: Databases, Cryptographic Hashing & OS Concurrency (15-25 hrs study)", "prerequisites": ["Cryptographic hash functions (SHA-256) and Python context managers (with / __exit__)", "Relational schemas, inverted full-text search indices (SQLite FTS5), and graph representations", "ACID transactions, Write-Ahead Logging (WAL), and BEGIN EXCLUSIVE file locking"], "public_resources": [{"label": "SQLite Write-Ahead Logging (WAL) Architecture", "url": "https://www.sqlite.org/wal.html", "external": true}, {"label": "SQLite FTS5 Full-Text Search Extension Docs", "url": "https://www.sqlite.org/fts5.html", "external": true}, {"label": "CMU 15-445/645 (Intro to Database Systems — Andy Pavlo)", "url": "https://15445.courses.cs.cmu.edu/", "external": true}, {"label": "Python contextlib & Context Manager Documentation", "url": "https://docs.python.org/3/library/contextlib.html", "external": true}], "sections": [{"heading": "1. ReadOnlyIsolationGuard Context Manager (hyperstitionstud_io.glossary)", "body": "Every compiler, MCP tool, and REST v1 handler executes inside with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:. Before and after the block runs, SHA-256 digests of taxonomy/glossary-registry.json and encyclopedia/encyclopedia-manifest.json are verified against baseline constants, raising RuntimeError immediately on any byte mutation."}, {"heading": "2. 6-Gate Multi-Format Graph Compiler & Quiescent 100M SQLite Logrotate (db/sqlite_meta.py)", "body": "build_encyclopedia_knowledge_graph.py compiles 388 nodes and 1,282 edges into JSON, JS, GraphML, GEXF, Obsidian Canvas, and 3 1600x1060 PNG atlases. sqlite_meta.py hydrates hyperstition-catalog.db (FTS5) and records /api/v1/* and /mcp telemetry in /var/lib/hyperstitionstud.io/api-telemetry.db, while deploy/logrotate.d/hyperstition-sqlite-meta acquires BEGIN EXCLUSIVE at 100M, snapshots .1.gz, and runs PRAGMA wal_checkpoint(TRUNCATE); VACUUM;."}]}, "quant-macro-and-bayesian-brief": {"unit_id": "E3", "slug": "quant-macro-and-bayesian-brief", "title": "Unit E3: Zero-Synthetic-Data Quant Engine, 14-Point Bidirectional Census, Dose 0..3+, FRED Macro & Bayesian Brief", "short_title": "E3: Quant, Macro & Bayesian", "pip_class": "plate-lock-gold", "expertise_level": "Level 3: Data Engineering, Time-Series Ingestion & Strategy Registries (10-15 hrs study)", "prerequisites": ["HTTP JSON/CSV client ingestion (urllib.request) and resilient fallback chains", "Missing-data domain representation (None / null vs. silent 0.0 corruption)", "Pluggable projection registries (LENS_REGISTRY) and state-machine persistence"], "public_resources": [{"label": "Internal: /quant/ Interactive Guided Canvas Tour (5 Episodes)", "url": "/quant/index.html", "external": false}, {"label": "Python urllib.request & json Standard Library Documentation", "url": "https://docs.python.org/3/library/urllib.request.html", "external": true}, {"label": "St. Louis Federal Reserve (FRED) Series & CSV Documentation", "url": "https://fredhelp.stlouisfed.org/", "external": true}, {"label": "Refactoring.Guru — Strategy & Adapter Design Patterns in Python", "url": "https://refactoring.guru/design-patterns/python", "external": true}], "sections": [{"heading": "1. Strict Zero-Synthetic-Data Collector & Native-Cadence FRED Macro Engine (collector.py, macro.py)", "body": "collector.py and timeseries.py eliminate all synthetic bar interpolation: 23 public tickers load 440 verified daily exchange bars (site/quant/real-market-history.json), while private entity ANTHR-PVT and closed weekend/holiday sessions serialize strictly as null ('No data available'). macro.py ingests 14 keyless St. Louis Fed (FRED) CSV series at native 1d, 1mo, and 1q cadences without forward-fill."}, {"heading": "2. 14-Point Bidirectional Census, Confluence Dose (D in {0..4}) & 5-Agenda Bayesian Brief (daily_brief.py)", "body": "timeseries.py evaluates all 14 data points in Gen 0 (eng_aq) and Gen 1 (ing_aq) and classifies each bar by its 4-species Confluence Dose (Dose 2 isometric pinning vs. Dose 3+ breakout). daily_brief.py updates the append-only Bayesian state ledger (daily-brief-state.json) across R1 Bull, R2 Pinned Isometric, and R3 Tail Drawdown and grades each day's testable macro question Q_t."}]}, "mcp-chatbot-rest-and-ipld": {"unit_id": "E4", "slug": "mcp-chatbot-rest-and-ipld", "title": "Unit E4: Stateless MCP Server (:8095), Chatbot OpenAPI 3.1.0 REST Adapter, .png+.json Cards & IPLD CIDv1", "short_title": "E4: MCP, REST & IPLD CIDv1", "pip_class": "plate-lock-emerald", "expertise_level": "Level 4: Network Protocols, OpenAPI 3.1 & Content-Addressed Storage (15-20 hrs study)", "prerequisites": ["HTTP/1.1 request/response lifecycles, status codes (200, 404, 422, 500, 502), and reverse proxies", "JSON-RPC 2.0, OpenAPI 3.1.0 schema generation, and Model Context Protocol (MCP)", "Canonical JSON serialization, SHA-256 multihashes, and IPLD dag-json (0x0129) CIDv1"], "public_resources": [{"label": "MDN Web Docs — HTTP Protocol & Status Codes", "url": "https://developer.mozilla.org/en-US/docs/Web/HTTP", "external": true}, {"label": "JSON-RPC 2.0 Official Specification", "url": "https://www.jsonrpc.org/specification", "external": true}, {"label": "Model Context Protocol (MCP) Architecture Introduction", "url": "https://modelcontextprotocol.io/introduction", "external": true}, {"label": "ProtoSchool — Content Identifiers (CIDs) & IPLD Merkle DAGs", "url": "https://proto.school/", "external": true}], "sections": [{"heading": "1. Unified Stateless MCP (/mcp) & Chatbot OpenAPI 3.1.0 REST Adapter (/api/v1/*)", "body": "mcp/server.py and mcp/rest.py expose all 15 tools in MCP_TOOLS_SCHEMA over stdio, Streamable HTTP POST/GET /mcp, and /api/v1/tools/{tool_name} on 127.0.0.1:8095. Top-level exception guards in _MCPHTTPHandler and record_api_telemetry() ensure sqlite3.OperationalError or read-only filesystem states never drop connections or trigger 502 Bad Gateway."}, {"heading": "2. One-Shot .png + .json Ticker Stats Cards (quant/cards.py) & Canonical IPLD dag-json (0x0129)", "body": "hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...')."}, {"heading": "3. Command-Line Usage Examples: CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", "body": "Command-line invocations across all three client interfaces: (1) CLI: hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (2) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (3) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"hs_generate_ticker_stats_card\",\"arguments\":{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":false}}}' | jq ."}]}, "cicd-vps-tmpfs-and-regression": {"unit_id": "E5", "slug": "cicd-vps-tmpfs-and-regression", "title": "Unit E5: Topological Git Push, Self-Re-Executing tmpfs VPS Hydration, Dark-Mode hs-pdf-build & hs-public-smoke", "short_title": "E5: CI/CD, VPS & Regression", "pip_class": "plate-lock-rose", "expertise_level": "Level 4: Linux Systems Administration, Bash Traps, systemd & DevOps (20-30 hrs study)", "prerequisites": ["POSIX Bash error handling (set -euo pipefail, trap ERR, run_checked(), exec, flock)", "Git fast-forward merges, annotated tags, and git pull --rebase --autostash", "Linux tmpfs RAM mounts, systemd services/timers, Caddy HTTP/3 QUIC, and TrueType cmap tables"], "public_resources": [{"label": "Pro Git Book (Chacon & Straub — Free Complete Online Text)", "url": "https://git-scm.com/book/en/v2", "external": true}, {"label": "Wooledge BashGuide & BashFAQ (Error Handling & Process Exec)", "url": "https://mywiki.wooledge.org/BashGuide", "external": true}, {"label": "freedesktop.org systemd.service & systemd.timer Manuals", "url": "https://www.freedesktop.org/software/systemd/man/systemd.service.html", "external": true}, {"label": "Caddy Server Official Documentation (HTTP/3 & Reverse Proxy)", "url": "https://caddyserver.com/docs/", "external": true}], "sections": [{"heading": "1. Zero-/dev/null CI/CD Scripts, Self-Re-Exec & Autonomous VPS Harvest Timers", "body": "push-all-to-git-libre-audio.sh, deploy/sync-vps-repos.sh, and deploy/run-vps-data-production.sh contain 0 /dev/null redirections and capture exact exit codes via run_checked(). When sync-vps-repos.sh updates hyperstitionstudio-core on disk, HYPERSTITION_SYNC_REEXEC=1 immediately execs the new script image before hydrating /var/www/hyperstitionstud.io/repos (tmpfs RAM + Brotli-11/Gzip-9)."}, {"heading": "2. Dark-Mode hs-pdf-build, Cold-Archive Rotator (hs-archive-rotate) & 6-Gate Public Regression (hs-public-smoke)", "body": "pdf_compiler.py transpiles LaTeX math, preserves
, filters every character against DejaVu TrueType cmap tables, sets rl_config.defaultGraphicsFontName='DejaVu' (0 /Helvetica leaks), and prioritizes web-linked PDFs (--refresh-all-web-pdfs). archive_rotator.py rotates completed docs/archive/ pairs into completed-plans-archive.tar.gz, while public_regression.py audits live HTTP responses against .cache/internal-test-baseline-latest.json across Gates P1-P6."}]}}, "ipld_dag_json_cidv1": {"/": "baguqeera6i4yxvvbgajhh5okqpdncevdsfrkutt6js6kiktmnfvirw4cvnkq"}}; +window.HYPERSTITION_ENGINEERING_MANIFEST = {"$id": "urn:io:hyperstitionstud:engineering-manifest", "version": "2.17.0", "enabled_subpages": ["ciphers-and-phonetics", "knowledge-graph-and-sqlite", "quant-macro-and-bayesian-brief", "mcp-chatbot-rest-and-ipld", "cicd-vps-tmpfs-and-regression"], "disabled_subpages": [], "enabled_routes": ["/engineering/index.html", "/engineering/ciphers-and-phonetics/index.html", "/engineering/knowledge-graph-and-sqlite/index.html", "/engineering/quant-macro-and-bayesian-brief/index.html", "/engineering/mcp-chatbot-rest-and-ipld/index.html", "/engineering/cicd-vps-tmpfs-and-regression/index.html"], "introspected_counts": {"repositories": 6, "cli_entrypoints": 20, "mcp_tools": 20, "rest_domain_aliases": 12, "enabled_lenses": 6, "watchlist_instruments": 24, "fred_macro_series": 14, "json_schemas_v1": 12}, "cli_scripts": {"hs-doctor": "hyperstitionstud_io.ci.doctor:main", "hs-citations": "hyperstitionstud_io.ci.citation_sources:main", "hs-pdf-build": "hyperstitionstud_io.publishing.pdf_compiler:main", "hs-kg-build": "hyperstitionstud_io.graph.cli:main", "hs-quant-harvest": "hyperstitionstud_io.quant.collector:main", "hs-mcp": "hyperstitionstud_io.mcp.server:main", "hs-sync-version": "hyperstitionstud_io.version_sync:main", "hs-db-build": "hyperstitionstud_io.db.sqlite_meta:main", "hs-macro-harvest": "hyperstitionstud_io.quant.macro:main", "hs-daily-brief": "hyperstitionstud_io.quant.daily_brief:main", "hs-ticker-card": "hyperstitionstud_io.quant.cards:main", "hs-archive-rotate": "hyperstitionstud_io.publishing.archive_rotator:main", "hs-public-smoke": "hyperstitionstud_io.ci.public_regression:main", "hs-eng-docs": "hyperstitionstud_io.publishing.engineering_docs:main", "hs-math-docs": "hyperstitionstud_io.publishing.math_docs:main", "hs-highlights": "hyperstitionstud_io.publishing.highlights:main", "hs-readme-sync": "hyperstitionstud_io.publishing.readme_sync:main", "hs-closeups-sync": "hyperstitionstud_io.publishing.closeups_sync:main", "hs-quant-voice-build": "hyperstitionstud_io.publishing.quant_voice:main", "hs-deploy-scripts-sync": "hyperstitionstud_io.ci.deploy_scripts_sync:main"}, "mcp_tool_names": ["hs_evaluate_aq_and_ingglish", "hs_classify_singularity", "hs_query_knowledge_graph", "hs_search_glossary_encyclopedia", "hs_inspect_eti_tier_list", "hs_simulate_anchor_revision", "hs_search_archive_equations", "hs_verify_grounded_citations", "hs_compute_ipld_dag_json_cid", "hs_run_doctor_and_audit", "hs_scan_financial_quant_harvest", "hs_inspect_quant_timeseries", "hs_generate_ticker_stats_card", "hs_inspect_macro_indicators", "hs_generate_daily_portfolio_brief", "hs_inspect_engineering_and_math_docs", "hs_inspect_documentation_and_manuals", "hs_evaluate_guile_scheme_z_calculus", "hs_query_workspace_catalog_and_release_state", "hs_generate_highlights_summary"], "rest_domain_aliases": {"/api/v1/doctor": "hs_run_doctor_and_audit", "/api/v1/ciphers/evaluate": "hs_evaluate_aq_and_ingglish", "/api/v1/zoology/classify": "hs_classify_singularity", "/api/v1/zoology/tier-list": "hs_inspect_eti_tier_list", "/api/v1/zoology/anchor-revision": "hs_simulate_anchor_revision", "/api/v1/graph/query": "hs_query_knowledge_graph", "/api/v1/glossary/search": "hs_search_glossary_encyclopedia", "/api/v1/archive/equations": "hs_search_archive_equations", "/api/v1/quant/harvest": "hs_scan_financial_quant_harvest", "/api/v1/quant/timeseries": "hs_inspect_quant_timeseries", "/api/v1/ipld/cid": "hs_compute_ipld_dag_json_cid", "/api/v1/citations/verify": "hs_verify_grounded_citations"}, "schemas_v1": ["assemblage-builds-tier-list.schema.json", "citations-ledger.schema.json", "encyclopedia-graph.schema.json", "encyclopedia-manifest.schema.json", "financial-aq-harvest.schema.json", "glossary-registry.schema.json", "learn-progress-state.schema.json", "memetic-superclass-registry.schema.json", "quant-timeseries.schema.json", "quantitative-economic-anchors.schema.json", "singularity-zoology-matrix.schema.json", "ticker-stats-card.schema.json"], "flow_diagrams": {"cross_repo_dependency_png": "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.png", "periodic_harvest_cicd_vps_png": "/graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png"}, "hub_prereq_ladder": {"unit_id": "E0", "expertise_level": "Level 1-2 (Novice to Advanced Beginner • 4-8 hrs study)", "summary": "New to command-line shells, Git repositories, or client-server web architecture? Start with these free foundational resources before diving into the engineering subpages:", "links": [{"label": "Internal: Self-Paced Learning Track (/learn/ Modules 1-6)", "url": "/learn/index.html", "external": false}, {"label": "MIT Missing Semester of Your CS Education (Shell, Git, CLI)", "url": "https://missing.csail.mit.edu/", "external": true}, {"label": "MDN Web Docs — How the Web Works (HTTP, HTML, Servers)", "url": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/How_the_Web_works", "external": true}]}, "subpages": {"ciphers-and-phonetics": {"unit_id": "E1", "slug": "ciphers-and-phonetics", "title": "Unit E1: Base-36 AQ Ciphers, Offline CMUdict Phonetics & Bidirectional Lock Evaluation", "short_title": "E1: Ciphers & Phonetics", "pip_class": "plate-lock-gold", "expertise_level": "Level 2: Introductory Python & Text Processing (10-15 hrs study)", "prerequisites": ["Python 3 functions, dictionaries (dict), frozenset, and regular expressions (re.sub)", "ASCII & Unicode character codepoints (ord(), UTF-8)", "Dictionary lookup vs. deterministic grapheme-to-phoneme fallback rules"], "public_resources": [{"label": "Internal: /learn/ Module 1 & 2 (Base-36 & Ingglish)", "url": "/learn/index.html", "external": false}, {"label": "Official Python 3 Tutorial (Sections 3-5 & 7)", "url": "https://docs.python.org/3/tutorial/", "external": true}, {"label": "Harvard CS50P (Intro to Programming with Python)", "url": "https://cs50.harvard.edu/python/", "external": true}, {"label": "CMU Pronouncing Dictionary (CMUdict) Specification", "url": "http://www.speech.cs.cmu.edu/cgi-bin/cmudict", "external": true}, {"label": "RegexOne Interactive Regular Expression Tutorial", "url": "https://regexone.com/", "external": true}], "sections": [{"heading": "1. PEP 420 Namespace & Quantization Modes (hyperstitionstud_io.ciphers)", "body": "The cipher engine maps digits 0-9 to 0..9 (ord(c)-48) and ASCII letters A-Z to 10..35 (ord(c)-87) across three quantization modes: digit (default), off (qualitative lexical only), and spoken (number-word expansion via int_to_spoken_words()), evaluating prime index ranks, 37×3k repdigit attractors, and 12-field bidirectional locks."}, {"heading": "2. Three-Tier Offline Phonemic Transducer (hyperstitionstud_io.phonetics)", "body": "translate_batch() resolves English phrases into Gen 1 Ingglish with zero external network calls and zero hardcoded /workspace dependencies: Tier 1 delegates to local Node/CLI translators when present; Tier 2 looks up the 4,943-entry bundled cmudict_fallback.json; Tier 3 applies deterministic English digraph-to-phoneme rules so arbitrary OOV strings always resolve."}]}, "knowledge-graph-and-sqlite": {"unit_id": "E2", "slug": "knowledge-graph-and-sqlite", "title": "Unit E2: 6-Gate 388-Node Knowledge Graph Compiler, ReadOnlyIsolationGuard & Quiescent SQLite + FTS5 Engine", "short_title": "E2: Knowledge Graph & SQLite", "pip_class": "plate-lock-emerald", "expertise_level": "Level 3-4: Databases, Cryptographic Hashing & OS Concurrency (15-25 hrs study)", "prerequisites": ["Cryptographic hash functions (SHA-256) and Python context managers (with / __exit__)", "Relational schemas, inverted full-text search indices (SQLite FTS5), and graph representations", "ACID transactions, Write-Ahead Logging (WAL), and BEGIN EXCLUSIVE file locking"], "public_resources": [{"label": "SQLite Write-Ahead Logging (WAL) Architecture", "url": "https://www.sqlite.org/wal.html", "external": true}, {"label": "SQLite FTS5 Full-Text Search Extension Docs", "url": "https://www.sqlite.org/fts5.html", "external": true}, {"label": "CMU 15-445/645 (Intro to Database Systems — Andy Pavlo)", "url": "https://15445.courses.cs.cmu.edu/", "external": true}, {"label": "Python contextlib & Context Manager Documentation", "url": "https://docs.python.org/3/library/contextlib.html", "external": true}], "sections": [{"heading": "1. ReadOnlyIsolationGuard Context Manager (hyperstitionstud_io.glossary)", "body": "Every compiler, MCP tool, and REST v1 handler executes inside with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:. Before and after the block runs, SHA-256 digests of taxonomy/glossary-registry.json and encyclopedia/encyclopedia-manifest.json are verified against baseline constants, raising RuntimeError immediately on any byte mutation."}, {"heading": "2. 6-Gate Multi-Format Graph Compiler & Quiescent 100M SQLite Logrotate (db/sqlite_meta.py)", "body": "build_encyclopedia_knowledge_graph.py compiles 388 nodes and 1,282 edges into JSON, JS, GraphML, GEXF, Obsidian Canvas, and 3 1600x1060 PNG atlases. sqlite_meta.py hydrates hyperstition-catalog.db (FTS5) and records /api/v1/* and /mcp telemetry in /var/lib/hyperstitionstud.io/api-telemetry.db, while deploy/logrotate.d/hyperstition-sqlite-meta acquires BEGIN EXCLUSIVE at 100M, snapshots .1.gz, and runs PRAGMA wal_checkpoint(TRUNCATE); VACUUM;."}]}, "quant-macro-and-bayesian-brief": {"unit_id": "E3", "slug": "quant-macro-and-bayesian-brief", "title": "Unit E3: Zero-Synthetic-Data Quant Engine, 14-Point Bidirectional Census, Dose 0..3+, FRED Macro & Bayesian Brief", "short_title": "E3: Quant, Macro & Bayesian", "pip_class": "plate-lock-gold", "expertise_level": "Level 3: Data Engineering, Time-Series Ingestion & Strategy Registries (10-15 hrs study)", "prerequisites": ["HTTP JSON/CSV client ingestion (urllib.request) and resilient fallback chains", "Missing-data domain representation (None / null vs. silent 0.0 corruption)", "Pluggable projection registries (LENS_REGISTRY) and state-machine persistence"], "public_resources": [{"label": "Internal: /quant/ Interactive Guided Canvas Tour (5 Episodes)", "url": "/quant/index.html", "external": false}, {"label": "Python urllib.request & json Standard Library Documentation", "url": "https://docs.python.org/3/library/urllib.request.html", "external": true}, {"label": "St. Louis Federal Reserve (FRED) Series & CSV Documentation", "url": "https://fredhelp.stlouisfed.org/", "external": true}, {"label": "Refactoring.Guru — Strategy & Adapter Design Patterns in Python", "url": "https://refactoring.guru/design-patterns/python", "external": true}], "sections": [{"heading": "1. Strict Zero-Synthetic-Data Collector & Native-Cadence FRED Macro Engine (collector.py, macro.py)", "body": "collector.py and timeseries.py eliminate all synthetic bar interpolation: 23 public tickers load 440 verified daily exchange bars (site/quant/real-market-history.json), while private entity ANTHR-PVT and closed weekend/holiday sessions serialize strictly as null ('No data available'). macro.py ingests 14 keyless St. Louis Fed (FRED) CSV series at native 1d, 1mo, and 1q cadences without forward-fill."}, {"heading": "2. 14-Point Bidirectional Census, Confluence Dose (D in {0..4}) & 5-Agenda Bayesian Brief (daily_brief.py)", "body": "timeseries.py evaluates all 14 data points in Gen 0 (eng_aq) and Gen 1 (ing_aq) and classifies each bar by its 4-species Confluence Dose (Dose 2 isometric pinning vs. Dose 3+ breakout). daily_brief.py updates the append-only Bayesian state ledger (daily-brief-state.json) across R1 Bull, R2 Pinned Isometric, and R3 Tail Drawdown and grades each day's testable macro question Q_t."}]}, "mcp-chatbot-rest-and-ipld": {"unit_id": "E4", "slug": "mcp-chatbot-rest-and-ipld", "title": "Unit E4: Stateless MCP Server (:8095), Chatbot OpenAPI 3.1.0 REST Adapter, .png+.json Cards & IPLD CIDv1", "short_title": "E4: MCP, REST & IPLD CIDv1", "pip_class": "plate-lock-emerald", "expertise_level": "Level 4: Network Protocols, OpenAPI 3.1 & Content-Addressed Storage (15-20 hrs study)", "prerequisites": ["HTTP/1.1 request/response lifecycles, status codes (200, 404, 422, 500, 502), and reverse proxies", "JSON-RPC 2.0, OpenAPI 3.1.0 schema generation, and Model Context Protocol (MCP)", "Canonical JSON serialization, SHA-256 multihashes, and IPLD dag-json (0x0129) CIDv1"], "public_resources": [{"label": "MDN Web Docs — HTTP Protocol & Status Codes", "url": "https://developer.mozilla.org/en-US/docs/Web/HTTP", "external": true}, {"label": "JSON-RPC 2.0 Official Specification", "url": "https://www.jsonrpc.org/specification", "external": true}, {"label": "Model Context Protocol (MCP) Architecture Introduction", "url": "https://modelcontextprotocol.io/introduction", "external": true}, {"label": "ProtoSchool — Content Identifiers (CIDs) & IPLD Merkle DAGs", "url": "https://proto.school/", "external": true}], "sections": [{"heading": "1. Unified Stateless MCP (/mcp) & Chatbot OpenAPI 3.1.0 REST Adapter (/api/v1/*)", "body": "mcp/server.py and mcp/rest.py expose all 15 tools in MCP_TOOLS_SCHEMA over stdio, Streamable HTTP POST/GET /mcp, and /api/v1/tools/{tool_name} on 127.0.0.1:8095. Top-level exception guards in _MCPHTTPHandler and record_api_telemetry() ensure sqlite3.OperationalError or read-only filesystem states never drop connections or trigger 502 Bad Gateway."}, {"heading": "2. One-Shot .png + .json Ticker Stats Cards (quant/cards.py) & Canonical IPLD dag-json (0x0129)", "body": "hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...')."}, {"heading": "3. Command-Line Usage Examples: cURL, CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", "body": "Command-line invocations across all four client interfaces: (1) cURL (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' -o /tmp/NVDA-stats-card.json (or include_base64_png=true piped through jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png); (2) CLI (hs-ticker-card): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (3) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (4) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"hs_generate_ticker_stats_card\",\"arguments\":{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":false}}}' | jq ."}]}, "cicd-vps-tmpfs-and-regression": {"unit_id": "E5", "slug": "cicd-vps-tmpfs-and-regression", "title": "Unit E5: Topological Git Push, Self-Re-Executing tmpfs VPS Hydration, Dark-Mode hs-pdf-build & hs-public-smoke", "short_title": "E5: CI/CD, VPS & Regression", "pip_class": "plate-lock-rose", "expertise_level": "Level 4: Linux Systems Administration, Bash Traps, systemd & DevOps (20-30 hrs study)", "prerequisites": ["POSIX Bash error handling (set -euo pipefail, trap ERR, run_checked(), exec, flock)", "Git fast-forward merges, annotated tags, and git pull --rebase --autostash", "Linux tmpfs RAM mounts, systemd services/timers, Caddy HTTP/3 QUIC, and TrueType cmap tables"], "public_resources": [{"label": "Pro Git Book (Chacon & Straub — Free Complete Online Text)", "url": "https://git-scm.com/book/en/v2", "external": true}, {"label": "Wooledge BashGuide & BashFAQ (Error Handling & Process Exec)", "url": "https://mywiki.wooledge.org/BashGuide", "external": true}, {"label": "freedesktop.org systemd.service & systemd.timer Manuals", "url": "https://www.freedesktop.org/software/systemd/man/systemd.service.html", "external": true}, {"label": "Caddy Server Official Documentation (HTTP/3 & Reverse Proxy)", "url": "https://caddyserver.com/docs/", "external": true}], "sections": [{"heading": "1. Zero-/dev/null CI/CD Scripts, Self-Re-Exec & Autonomous VPS Harvest Timers", "body": "push-all-to-git-libre-audio.sh, deploy/sync-vps-repos.sh, and deploy/run-vps-data-production.sh contain 0 /dev/null redirections and capture exact exit codes via run_checked(). When sync-vps-repos.sh updates hyperstitionstudio-core on disk, HYPERSTITION_SYNC_REEXEC=1 immediately execs the new script image before hydrating /var/www/hyperstitionstud.io/repos (tmpfs RAM + Brotli-11/Gzip-9)."}, {"heading": "2. Dark-Mode hs-pdf-build, Cold-Archive Rotator (hs-archive-rotate) & 6-Gate Public Regression (hs-public-smoke)", "body": "pdf_compiler.py transpiles LaTeX math, preserves
, filters every character against DejaVu TrueType cmap tables, sets rl_config.defaultGraphicsFontName='DejaVu' (0 /Helvetica leaks), and prioritizes web-linked PDFs (--refresh-all-web-pdfs). archive_rotator.py rotates completed docs/archive/ pairs into completed-plans-archive.tar.gz, while public_regression.py audits live HTTP responses against .cache/internal-test-baseline-latest.json across Gates P1-P6."}]}}, "ipld_dag_json_cidv1": {"/": "baguqeera22rwawy2hsayigq75jzsg5nevhhuppkhlr6z3msi5jbepgulzspa"}}; diff --git a/site/engineering/engineering-manifest.json b/site/engineering/engineering-manifest.json index b12beb6..c3e9027 100644 --- a/site/engineering/engineering-manifest.json +++ b/site/engineering/engineering-manifest.json @@ -310,8 +310,8 @@ "body": "hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...')." }, { - "heading": "3. Command-Line Usage Examples: CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", - "body": "Command-line invocations across all three client interfaces: (1) CLI: hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (2) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (3) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"hs_generate_ticker_stats_card\",\"arguments\":{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":false}}}' | jq ." + "heading": "3. Command-Line Usage Examples: cURL, CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", + "body": "Command-line invocations across all four client interfaces: (1) cURL (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' -o /tmp/NVDA-stats-card.json (or include_base64_png=true piped through jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png); (2) CLI (hs-ticker-card): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (3) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (4) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"hs_generate_ticker_stats_card\",\"arguments\":{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":false}}}' | jq ." } ] }, @@ -362,6 +362,6 @@ } }, "ipld_dag_json_cidv1": { - "/": "baguqeera6i4yxvvbgajhh5okqpdncevdsfrkutt6js6kiktmnfvirw4cvnkq" + "/": "baguqeera22rwawy2hsayigq75jzsg5nevhhuppkhlr6z3msi5jbepgulzspa" } } diff --git a/site/engineering/index.html b/site/engineering/index.html index 0b760de..548fecf 100644 --- a/site/engineering/index.html +++ b/site/engineering/index.html @@ -107,7 +107,7 @@ cid = compute_dag_json_cidv1(manifest) diff --git a/site/engineering/mcp-chatbot-rest-and-ipld/index.html b/site/engineering/mcp-chatbot-rest-and-ipld/index.html index 133f545..3e2183e 100644 --- a/site/engineering/mcp-chatbot-rest-and-ipld/index.html +++ b/site/engineering/mcp-chatbot-rest-and-ipld/index.html @@ -55,7 +55,7 @@
Prerequisite Track for Novices • Required Expertise: Level 4: Network Protocols, OpenAPI 3.1 & Content-Addressed Storage (15-20 hrs study)

If any concepts on this page are unfamiliar, occupy your study time with these free foundational resources first:

Core Concepts Required:
  • HTTP/1.1 request/response lifecycles, status codes (200, 404, 422, 500, 502), and reverse proxies
  • JSON-RPC 2.0, OpenAPI 3.1.0 schema generation, and Model Context Protocol (MCP)
  • Canonical JSON serialization, SHA-256 multihashes, and IPLD dag-json (0x0129) CIDv1
Curated Free Public Study Resources:
λ Polyglot Foil (E4): JSON-RPC 2.0 Tool Dispatch & 'envideea' = 137 (33rd Prime)
1. Formal Specification & Python:Dispatch(name, args) → ToolTable[name](args)
res = call_mcp_tool(target_tool, t_args)
λ Guile Scheme (Z-Combinator):
(list 'jsonrpc-2.0 'tool "hs_evaluate_aq_and_ingglish" (aq-base36 "envideea"))
=> [Select Lens to evaluate]
TS TypeScript (Strict AST):
aqBase36("envideea")
=> [Select Lens to evaluate]
Rs Rust (Option/Iterator AST):
mcp_dispatch_aq("envideea")
=> [Select Lens to evaluate]
Guided Micro-Challenge (4-Ring Zero-Escape Sandbox): Evaluate "envideea" => 137 across Guile, TypeScript, and Rust.
-

1. Unified Stateless MCP (/mcp) & Chatbot OpenAPI 3.1.0 REST Adapter (/api/v1/*)

mcp/server.py and mcp/rest.py expose all 15 tools in MCP_TOOLS_SCHEMA over stdio, Streamable HTTP POST/GET /mcp, and /api/v1/tools/{tool_name} on 127.0.0.1:8095. Top-level exception guards in _MCPHTTPHandler and record_api_telemetry() ensure sqlite3.OperationalError or read-only filesystem states never drop connections or trigger 502 Bad Gateway.

2. One-Shot .png + .json Ticker Stats Cards (quant/cards.py) & Canonical IPLD dag-json (0x0129)

hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...').

3. Command-Line Usage Examples: CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)

Command-line invocations across all three client interfaces: (1) CLI: hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (2) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (3) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hs_generate_ticker_stats_card","arguments":{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}' | jq .

⚛ Live API & IPLD CIDv1 ETag 304 Conditional Cache Probe (#live-smoke-probe)

Fetches /api/v1/status twice (sending If-None-Match: <ETag> on the second request) to verify deterministic RFC 8785 JCS + IPLD dag-json CIDv1 HTTP caching and ReadOnlyIsolationGuard status.

Click "Run Live /api/v1/status & ETag 304 Probe" to inspect live HTTP ETag & ReadOnlyIsolationGuard headers.
+

1. Unified Stateless MCP (/mcp) & Chatbot OpenAPI 3.1.0 REST Adapter (/api/v1/*)

mcp/server.py and mcp/rest.py expose all 15 tools in MCP_TOOLS_SCHEMA over stdio, Streamable HTTP POST/GET /mcp, and /api/v1/tools/{tool_name} on 127.0.0.1:8095. Top-level exception guards in _MCPHTTPHandler and record_api_telemetry() ensure sqlite3.OperationalError or read-only filesystem states never drop connections or trigger 502 Bad Gateway.

2. One-Shot .png + .json Ticker Stats Cards (quant/cards.py) & Canonical IPLD dag-json (0x0129)

hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...').

3. Command-Line Usage Examples: cURL, CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)

Command-line invocations across all four client interfaces: (1) cURL (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' -o /tmp/NVDA-stats-card.json (or include_base64_png=true piped through jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png); (2) CLI (hs-ticker-card): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (3) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (4) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hs_generate_ticker_stats_card","arguments":{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}' | jq .

⚛ Live API & IPLD CIDv1 ETag 304 Conditional Cache Probe (#live-smoke-probe)

Fetches /api/v1/status twice (sending If-None-Match: <ETag> on the second request) to verify deterministic RFC 8785 JCS + IPLD dag-json CIDv1 HTTP caching and ReadOnlyIsolationGuard status.

Click "Run Live /api/v1/status & ETag 304 Probe" to inspect live HTTP ETag & ReadOnlyIsolationGuard headers.
← Prev: E3: Quant, Macro & Bayesian diff --git a/site/gallery/media/demos/meme_2_memegen_awkward_moment_seal_id_ams.png b/site/gallery/media/demos/meme_2_memegen_awkward_moment_seal_id_ams.png deleted file mode 100644 index 1bcbae5..0000000 Binary files a/site/gallery/media/demos/meme_2_memegen_awkward_moment_seal_id_ams.png and /dev/null differ diff --git a/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md b/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md index db9457a..df669a1 100644 --- a/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md +++ b/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md @@ -54,11 +54,25 @@ Only data sources that emit discrete, timestamp-indexed periodic observations ($ --- -## 4. Command-Line Examples: One-Shot Ticker Stats Card (`.png` + `.json`) across CLI, Chatbot REST Client & MCP Client +## 4. Command-Line Examples: One-Shot Ticker Stats Card (`.png` + `.json`) across cURL, CLI, Chatbot REST Client & MCP Client The 5-zone `900 × 1260` (`5:7` TCG Portrait) Group 3 Stealth Basalt Ticker Stats Card generator (`hyperstitionstud_io.quant.cards`) supports any of the `24` watchlist tickers (`NVDA`, `PLTR`, `ASML`, `ANTHR-PVT`, `BTC-USD`, etc.) or DEX integer coordinates (`137`, `159`, `193`), `6` projection lenses (`tierzoo_ecology`, `fund_manager`, `neutral_math`, `corporate_board`, `fantasy_sabermetrics`, `pokedex_scanner`), and optional `YYYY-MM-DD` historical UTC dates. -### 4.1 Direct CLI Entrypoint (`hs-ticker-card`) +### 4.1 cURL Quickstart (Zero Local Dependencies — Direct HTTP API Call) + +Fetch the JSON card or decode a `-stats-card.png` directly over HTTPS (`https://hyperstitionstud.io`) or a local daemon (`http://127.0.0.1:8095`) without installing local Python packages or an MCP client: + +```bash +# 1. Fetch and save the 5-zone Ticker Stats Card JSON directly (swap NVDA for PLTR, ASML, ANTHR-PVT, etc.) +curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false" \ + -o /tmp/NVDA-stats-card.json + +# 2. Fetch the embedded PNG payload and decode directly to /tmp/NVDA-stats-card.png (works with http://127.0.0.1:8095 too) +curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=true" \ + | jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png +``` + +### 4.2 Direct CLI Entrypoint (`hs-ticker-card`) Generates `/tmp/hyperstition-cards/-stats-card.png` and `/tmp/hyperstition-cards/-stats-card.json` locally in one shot and prints the SHA-256 and IPLD `dag-json` `CIDv1` receipt: @@ -71,7 +85,7 @@ PYTHONPATH=/workspace/hyperstitionstudio-core/src python3 -m hyperstitionstud_io --symbol NVDA --lens fund_manager --date 2026-11-27 --out-dir /tmp/hyperstition-cards ``` -### 4.2 Chatbot / OpenAPI 3.1 REST API Client (`GET` / `POST /api/v1/tools/hs_generate_ticker_stats_card`) +### 4.3 Chatbot / OpenAPI 3.1 REST API Client (`GET` / `POST /api/v1/tools/hs_generate_ticker_stats_card`) Chatbot clients and HTTP consumers can invoke `hs_generate_ticker_stats_card` (or `/api/v1/zoology/pokedex/{symbol}?include_card=true`) against either production `https://hyperstitionstud.io` or local `http://127.0.0.1:8095`: @@ -89,7 +103,7 @@ curl -sS -X POST "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_st curl -sS "https://hyperstitionstud.io/api/v1/zoology/pokedex/NVDA?include_card=true" | jq '.data.stats_card.card_identity' ``` -### 4.3 MCP API Client (`JSON-RPC 2.0` `tools/call` over Streamable HTTP `/mcp` & `stdio`) +### 4.4 MCP API Client (`JSON-RPC 2.0` `tools/call` over Streamable HTTP `/mcp` & `stdio`) MCP clients (Hermes Agent, Claude Desktop, Cursor, or command-line JSON-RPC scripts) invoke `hs_generate_ticker_stats_card` via `tools/call`: diff --git a/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf b/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf index de3bce4..8af7e53 100644 Binary files a/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf and b/site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf differ diff --git a/site/quant/daily-brief-state.json b/site/quant/daily-brief-state.json new file mode 100644 index 0000000..6542920 --- /dev/null +++ b/site/quant/daily-brief-state.json @@ -0,0 +1,216 @@ +{ + "version": "2.4.0", + "run_number": 18, + "updated_at_utc": "2026-12-01T03:15:46Z", + "latest_posteriors": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "active_daily_question": { + "question_id": "Q-RUN-0018", + "question_text": "Will the synchronous -91 bps (kampyoot / kleenroom) Dose 2 pinning wave across BTC-USD and ETH-USD and NVDA's +80 bps ('eighty' = 128 [S3]) lock hold inside the P50 <= 150 bps isometric corridor, or will US10Y yields near 4.85%-4.94% and SOFR-EFFR (+10 bps) trigger a Dose 3+ high-volume (>1.5x Vol20d) breakout?", + "confirmation_threshold_r2_pin": "Next-session median displacement across locked S1/S2/S3 leaders remains <= 150 bps with Vol20d < 1.15x.", + "falsification_threshold_r3_breakout": "Any S1/S2/S3 keystone logs a Dose 3+ headline-coupled session with Vol20d >= 1.50x or change_bps <= -300 bps." + }, + "run_history": [ + { + "run_number": 1, + "generated_at_utc": "2026-11-30T21:24:53Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.1333, + "R2_PINNED_ISOMETRIC": 0.2534, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.6133 + }, + "question_id": "Q-RUN-0001", + "cidv1": "baguqeerafa7hr4rphngheuichlekmt7lk7ueriuvjvbjykvor7wtt6gc6brq" + }, + { + "run_number": 2, + "generated_at_utc": "2026-11-30T21:36:47Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0347, + "R2_PINNED_ISOMETRIC": 0.0836, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.8817 + }, + "question_id": "Q-RUN-0002", + "cidv1": "baguqeerammpyhkufyxlbvlmatxuqqaatm47z3cmvntz6lrtuhmfldpvtg72a" + }, + { + "run_number": 3, + "generated_at_utc": "2026-11-30T21:46:33Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0069, + "R2_PINNED_ISOMETRIC": 0.0212, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.9719 + }, + "question_id": "Q-RUN-0003", + "cidv1": "baguqeeravy3kf7zluqt37v5ziasdekgeape66ncfpzqxi6zbicra2hipbzba" + }, + { + "run_number": 4, + "generated_at_utc": "2026-11-30T21:49:59Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0013, + "R2_PINNED_ISOMETRIC": 0.005, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.9937 + }, + "question_id": "Q-RUN-0004", + "cidv1": "baguqeera4mp76nopwns7rfqrvz36iu5egl5h3iqkmxdemarhind3ukahiswa" + }, + { + "run_number": 5, + "generated_at_utc": "2026-11-30T21:50:55Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0002, + "R2_PINNED_ISOMETRIC": 0.0012, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.9986 + }, + "question_id": "Q-RUN-0005", + "cidv1": "baguqeeraqoxkqwmzrcr63uu37pzowusuoqtlqcy4ikgsr6ax6vcg7a5hds4q" + }, + { + "run_number": 6, + "generated_at_utc": "2026-11-30T22:13:42Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0003, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.9997 + }, + "question_id": "Q-RUN-0006", + "cidv1": "baguqeeraq3gweokji6vipw5h4cgtwdjdwvjwnxsl3zbmqq67hvirhsfa2iwq" + }, + { + "run_number": 7, + "generated_at_utc": "2026-11-30T22:18:58Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0001, + "R3_TAIL_DRAWDOWN_RISK_OFF": 0.9999 + }, + "question_id": "Q-RUN-0007", + "cidv1": "baguqeeraxmhxqiw2kgdpswaa5owcwc5jykfxmtfbhhihfg62kc24giu6mieq" + }, + { + "run_number": 8, + "generated_at_utc": "2026-12-01T00:05:55Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0008", + "cidv1": "baguqeerautuzfnmivmbc2fzxbwrc5sgftzcct22n4mezvac4ggjyrbvg5g5a" + }, + { + "run_number": 9, + "generated_at_utc": "2026-12-01T00:19:28Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0009", + "cidv1": "baguqeerawfns3y6ytluwupzkepk35hrnvxj4jvjsphebjkr4ssl5alsq7ubq" + }, + { + "run_number": 10, + "generated_at_utc": "2026-12-01T00:20:26Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0010", + "cidv1": "baguqeeranwkmzt6gli6f4i4c2uoelda4edgwqajimr65cz7t3bfj4bat3fta" + }, + { + "run_number": 11, + "generated_at_utc": "2026-12-01T00:34:19Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0011", + "cidv1": "baguqeeral24w6gneqk7n4ule4pu2kknmdxrja46iz5dujnbabjv6cng6ttua" + }, + { + "run_number": 12, + "generated_at_utc": "2026-12-01T01:01:54Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0012", + "cidv1": "baguqeeratalw7a3v4wps5vffanzkikbrk32tgjlrkyx3d64jfivp3raku4oq" + }, + { + "run_number": 13, + "generated_at_utc": "2026-12-01T01:07:49Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0013", + "cidv1": "baguqeerazwuha42cyefdtfljfycwsv34nsmhowvcfnhk7uxall2y7od5wbjq" + }, + { + "run_number": 14, + "generated_at_utc": "2026-12-01T01:15:27Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0014", + "cidv1": "baguqeeragj7pkqauxnfhazh3xufyvsj5m7glzt5ey74tf7e2opl4mrw5k46a" + }, + { + "run_number": 15, + "generated_at_utc": "2026-12-01T02:24:09Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0015", + "cidv1": "baguqeerad3auisgfth3tuuqkaljf65huof765uwocq7vxxkbp3an46rpjcva" + }, + { + "run_number": 16, + "generated_at_utc": "2026-12-01T02:45:08Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0016", + "cidv1": "baguqeeradofb4vbejhjmvqzdbk3ej6maztsvpzh374uog267wj3x3sni7nxa" + }, + { + "run_number": 17, + "generated_at_utc": "2026-12-01T03:12:39Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0017", + "cidv1": "baguqeeralanwxvgzcp2vr6mjezengwreiqnszi6pqs27pxyll6ydg244chna" + }, + { + "run_number": 18, + "generated_at_utc": "2026-12-01T03:15:46Z", + "posterior_probabilities": { + "R1_BULL_RISK_ON": 0.0, + "R2_PINNED_ISOMETRIC": 0.0, + "R3_TAIL_DRAWDOWN_RISK_OFF": 1.0 + }, + "question_id": "Q-RUN-0018", + "cidv1": "baguqeera6yv3xbdw7lqkus3jrvykxl67ayxmbhsuy6oimpu6e722rbp6zweq" + } + ] +} diff --git a/site/quant/financial-aq-harvest-latest.json b/site/quant/financial-aq-harvest-latest.json new file mode 100644 index 0000000..1d2dba5 --- /dev/null +++ b/site/quant/financial-aq-harvest-latest.json @@ -0,0 +1,1166 @@ +{ + "$id": "urn:io:hyperstitionstud:schema:v1:financial-aq-harvest", + "$schema": "./schemas/v1/financial-aq-harvest.schema.json", + "anchor_revisions_detected": [], + "harvest_mode": "us-closing-bell", + "instruments": [ + { + "co_present_in_news_wire": false, + "contingent_locks": [ + { + "coordinate": 128, + "metric_mode": "bps_spoken_eng_aq", + "ring_partners": [ + "S3: nik land / masheen / serkat" + ], + "scope": "SCOPE2_S1_S6_RING_MIGRATION", + "verified_equations": [] + } + ], + "data_available": true, + "entity_eng": "Nvidia", + "entity_eng_aq": 113, + "entity_ing": "envideea", + "entity_ing_aq": 137, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S1", + "S3" + ], + "metrics": { + "change_bps": 80, + "change_pct": 0.8, + "close_usd": 150.49, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.53 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 8, + "bps_spoken_eng": "eighty", + "bps_spoken_eng_aq": 128, + "bps_spoken_ing": "aytee", + "bps_spoken_ing_aq": 101, + "close_digit_aq": 6, + "close_spoken_eng": "one hundred fifty", + "close_spoken_eng_aq": 309, + "close_spoken_ing": "wuhn huhndrad fiftee", + "close_spoken_ing_aq": 357, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "NVDA", + "symbol_clean": "NVDA", + "symbol_eng_aq": 77, + "symbol_ing": "nvda", + "symbol_ing_aq": 77 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "ASML", + "entity_eng_aq": 81, + "entity_ing": "asml", + "entity_ing_aq": 81, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S6" + ], + "metrics": { + "change_bps": 175, + "change_pct": 1.75, + "close_usd": 1325.82, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.53 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 13, + "bps_spoken_eng": "one hundred seventy five", + "bps_spoken_eng_aq": 449, + "bps_spoken_ing": "wuhn huhndrad sevantee faiv", + "bps_spoken_ing_aq": 489, + "close_digit_aq": 12, + "close_spoken_eng": "one thousand three hundred twenty six", + "close_spoken_eng_aq": 713, + "close_spoken_ing": "wuhn thouzand three huhndrad twentee siks", + "close_spoken_ing_aq": 783, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "ASML", + "symbol_clean": "ASML", + "symbol_eng_aq": 81, + "symbol_ing": "asml", + "symbol_ing_aq": 81 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "TSMC", + "entity_eng_aq": 91, + "entity_ing": "tsmc", + "entity_ing_aq": 91, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S6" + ], + "metrics": { + "change_bps": 321, + "change_pct": 3.21, + "close_usd": 353.34, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.49 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 6, + "bps_spoken_eng": "three hundred twenty one", + "bps_spoken_eng_aq": 460, + "bps_spoken_ing": "three huhndrad twentee wuhn", + "bps_spoken_ing_aq": 508, + "close_digit_aq": 11, + "close_spoken_eng": "three hundred fifty three", + "close_spoken_eng_aq": 450, + "close_spoken_ing": "three huhndrad fiftee three", + "close_spoken_ing_aq": 457, + "close_spoken_prime_rank": 88, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "TSM", + "symbol_clean": "TSM", + "symbol_eng_aq": 79, + "symbol_ing": "tsm", + "symbol_ing_aq": 79 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": false, + "entity_eng": "Anthropic", + "entity_eng_aq": 185, + "entity_ing": "anthropik", + "entity_ing_aq": 193, + "feed_source": null, + "guilds": [ + "S1", + "S2" + ], + "metrics": { + "change_bps": null, + "change_pct": null, + "close_usd": null, + "market_cap_str": "No data available", + "volume_ratio_20d": null + }, + "observation_date_utc": null, + "quant_encodings": { + "bps_digit_aq": null, + "bps_spoken_eng": "No data available", + "bps_spoken_eng_aq": null, + "bps_spoken_ing": "No data available", + "bps_spoken_ing_aq": null, + "close_digit_aq": null, + "close_spoken_eng": "No data available", + "close_spoken_eng_aq": null, + "close_spoken_ing": "No data available", + "close_spoken_ing_aq": null, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "No data available" + }, + "status": "No data available (private entity — not publicly traded)", + "symbol": "ANTHR-PVT", + "symbol_clean": "ANTHR", + "symbol_eng_aq": 106, + "symbol_ing": "anthr", + "symbol_ing_aq": 106 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Microsoft", + "entity_eng_aq": 199, + "entity_ing": "maikrohsawft", + "entity_ing_aq": 252, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S1", + "S6" + ], + "metrics": { + "change_bps": 60, + "change_pct": 0.6, + "close_usd": 492.85, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.41 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 6, + "bps_spoken_eng": "sixty", + "bps_spoken_eng_aq": 142, + "bps_spoken_ing": "sikstee", + "bps_spoken_ing_aq": 151, + "close_digit_aq": 16, + "close_spoken_eng": "four hundred ninety three", + "close_spoken_eng_aq": 475, + "close_spoken_ing": "for huhndrad naintee three", + "close_spoken_ing_aq": 448, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "MSFT", + "symbol_clean": "MSFT", + "symbol_eng_aq": 94, + "symbol_ing": "msft", + "symbol_ing_aq": 94 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Alphabet", + "entity_eng_aq": 137, + "entity_ing": "alfabet", + "entity_ing_aq": 110, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S1", + "S6" + ], + "metrics": { + "change_bps": 68, + "change_pct": 0.68, + "close_usd": 274.96, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.5 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 14, + "bps_spoken_eng": "sixty eight", + "bps_spoken_eng_aq": 236, + "bps_spoken_ing": "sikstee ayt", + "bps_spoken_ing_aq": 224, + "close_digit_aq": 14, + "close_spoken_eng": "two hundred seventy five", + "close_spoken_eng_aq": 473, + "close_spoken_ing": "too huhndrad sevantee faiv", + "close_spoken_ing_aq": 464, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "GOOGL", + "symbol_clean": "GOOGL", + "symbol_eng_aq": 101, + "symbol_ing": "googl", + "symbol_ing_aq": 101 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Meta", + "entity_eng_aq": 75, + "entity_ing": "meeta", + "entity_ing_aq": 89, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S1", + "S6" + ], + "metrics": { + "change_bps": 313, + "change_pct": 3.13, + "close_usd": 628.96, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.61 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 7, + "bps_spoken_eng": "three hundred thirteen", + "bps_spoken_eng_aq": 409, + "bps_spoken_ing": "three huhndrad therteen", + "bps_spoken_ing_aq": 418, + "close_digit_aq": 17, + "close_spoken_eng": "six hundred twenty nine", + "close_spoken_eng_aq": 455, + "close_spoken_ing": "siks huhndrad twentee nain", + "close_spoken_ing_aq": 473, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "META", + "symbol_clean": "META", + "symbol_eng_aq": 75, + "symbol_ing": "meta", + "symbol_ing_aq": 75 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Oracle", + "entity_eng_aq": 108, + "entity_ing": "orakal", + "entity_ing_aq": 112, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S1", + "S6" + ], + "metrics": { + "change_bps": 313, + "change_pct": 3.13, + "close_usd": 107.13, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.38 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 7, + "bps_spoken_eng": "three hundred thirteen", + "bps_spoken_eng_aq": 409, + "bps_spoken_ing": "three huhndrad therteen", + "bps_spoken_ing_aq": 418, + "close_digit_aq": 8, + "close_spoken_eng": "one hundred seven", + "close_spoken_eng_aq": 308, + "close_spoken_ing": "wuhn huhndrad sevan", + "close_spoken_ing_aq": 358, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "ORCL", + "symbol_clean": "ORCL", + "symbol_eng_aq": 84, + "symbol_ing": "orcl", + "symbol_ing_aq": 84 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Broadcom", + "entity_eng_aq": 143, + "entity_ing": "brawdkom", + "entity_ing_aq": 159, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S6" + ], + "metrics": { + "change_bps": 382, + "change_pct": 3.82, + "close_usd": 312.34, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.53 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 13, + "bps_spoken_eng": "three hundred eighty two", + "bps_spoken_eng_aq": 451, + "bps_spoken_ing": "three huhndrad aytee too", + "bps_spoken_ing_aq": 429, + "close_digit_aq": 6, + "close_spoken_eng": "three hundred twelve", + "close_spoken_eng_aq": 379, + "close_spoken_ing": "three huhndrad twelv", + "close_spoken_ing_aq": 378, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "AVGO", + "symbol_clean": "AVGO", + "symbol_eng_aq": 81, + "symbol_ing": "avgo", + "symbol_ing_aq": 81 + }, + { + "co_present_in_news_wire": true, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Arm", + "entity_eng_aq": 59, + "entity_ing": "arm", + "entity_ing_aq": 59, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S1" + ], + "metrics": { + "change_bps": 622, + "change_pct": 6.22, + "close_usd": 171.55, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.44 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 10, + "bps_spoken_eng": "six hundred twenty two", + "bps_spoken_eng_aq": 462, + "bps_spoken_ing": "siks huhndrad twentee too", + "bps_spoken_ing_aq": 476, + "close_digit_aq": 10, + "close_spoken_eng": "one hundred seventy two", + "close_spoken_eng_aq": 456, + "close_spoken_ing": "wuhn huhndrad sevantee too", + "close_spoken_ing_aq": 492, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "ARM", + "symbol_clean": "ARM", + "symbol_eng_aq": 59, + "symbol_ing": "arm", + "symbol_ing_aq": 59 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "AMD", + "entity_eng_aq": 45, + "entity_ing": "ayemdee", + "entity_ing_aq": 121, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S1" + ], + "metrics": { + "change_bps": 456, + "change_pct": 4.56, + "close_usd": 424.54, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.47 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 15, + "bps_spoken_eng": "four hundred fifty six", + "bps_spoken_eng_aq": 423, + "bps_spoken_ing": "for huhndrad fiftee siks", + "bps_spoken_ing_aq": 415, + "close_digit_aq": 11, + "close_spoken_eng": "four hundred twenty five", + "close_spoken_eng_aq": 472, + "close_spoken_ing": "for huhndrad twentee faiv", + "close_spoken_ing_aq": 445, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "AMD", + "symbol_clean": "AMD", + "symbol_eng_aq": 45, + "symbol_ing": "ayemdee", + "symbol_ing_aq": 121 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Palantir", + "entity_eng_aq": 163, + "entity_ing": "palanter", + "entity_ing_aq": 159, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S6" + ], + "metrics": { + "change_bps": 524, + "change_pct": 5.24, + "close_usd": 172.17, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.58 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 11, + "bps_spoken_eng": "five hundred twenty four", + "bps_spoken_eng_aq": 472, + "bps_spoken_ing": "faiv huhndrad twentee for", + "bps_spoken_ing_aq": 445, + "close_digit_aq": 10, + "close_spoken_eng": "one hundred seventy two", + "close_spoken_eng_aq": 456, + "close_spoken_ing": "wuhn huhndrad sevantee too", + "close_spoken_ing_aq": 492, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "PLTR", + "symbol_clean": "PLTR", + "symbol_eng_aq": 102, + "symbol_ing": "pltr", + "symbol_ing_aq": 102 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Lockheed", + "entity_eng_aq": 135, + "entity_ing": "lokheed", + "entity_ing_aq": 123, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3" + ], + "metrics": { + "change_bps": 111, + "change_pct": 1.11, + "close_usd": 605.88, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.39 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 3, + "bps_spoken_eng": "one hundred eleven", + "bps_spoken_eng_aq": 315, + "bps_spoken_ing": "wuhn huhndrad ilevan", + "bps_spoken_ing_aq": 369, + "close_digit_aq": 12, + "close_spoken_eng": "six hundred six", + "close_spoken_eng_aq": 295, + "close_spoken_ing": "siks huhndrad siks", + "close_spoken_ing_aq": 338, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "LMT", + "symbol_clean": "LMT", + "symbol_eng_aq": 72, + "symbol_ing": "lmt", + "symbol_ing_aq": 72 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Raytheon", + "entity_eng_aq": 178, + "entity_ing": "raytheeon", + "entity_ing_aq": 192, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3" + ], + "metrics": { + "change_bps": 117, + "change_pct": 1.17, + "close_usd": 198.48, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.32 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 9, + "bps_spoken_eng": "one hundred seventeen", + "bps_spoken_eng_aq": 388, + "bps_spoken_ing": "wuhn huhndrad sevanteen", + "bps_spoken_ing_aq": 438, + "close_digit_aq": 18, + "close_spoken_eng": "one hundred ninety eight", + "close_spoken_eng_aq": 433, + "close_spoken_ing": "wuhn huhndrad naintee ayt", + "close_spoken_ing_aq": 456, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "RTX", + "symbol_clean": "RTX", + "symbol_eng_aq": 89, + "symbol_ing": "rtx", + "symbol_ing_aq": 89 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Copper", + "entity_eng_aq": 127, + "entity_ing": "koper", + "entity_ing_aq": 110, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S3", + "S2" + ], + "metrics": { + "change_bps": 181, + "change_pct": 1.81, + "close_usd": 5.62, + "market_cap_str": "No data available", + "volume_ratio_20d": 3.71 + }, + "observation_date_utc": "2026-11-30", + "quant_encodings": { + "bps_digit_aq": 10, + "bps_spoken_eng": "one hundred eighty one", + "bps_spoken_eng_aq": 387, + "bps_spoken_ing": "wuhn huhndrad aytee wuhn", + "bps_spoken_ing_aq": 455, + "close_digit_aq": 6, + "close_spoken_eng": "six", + "close_spoken_eng_aq": 79, + "close_spoken_ing": "siks", + "close_spoken_ing_aq": 94, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "HG=F", + "symbol_clean": "HG", + "symbol_eng_aq": 33, + "symbol_ing": "hg", + "symbol_ing_aq": 33 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "VIX", + "entity_eng_aq": 82, + "entity_ing": "viks", + "entity_ing_aq": 97, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S2" + ], + "metrics": { + "change_bps": -1116, + "change_pct": -11.16, + "close_usd": 23.81, + "market_cap_str": "No data available", + "volume_ratio_20d": null + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 9, + "bps_spoken_eng": "one thousand one hundred sixteen", + "bps_spoken_eng_aq": 592, + "bps_spoken_ing": "wuhn thouzand wuhn huhndrad siksteen", + "bps_spoken_ing_aq": 709, + "close_digit_aq": 6, + "close_spoken_eng": "twenty four", + "close_spoken_eng_aq": 257, + "close_spoken_ing": "twentee for", + "close_spoken_ing_aq": 221, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "^VIX", + "symbol_clean": "VIX", + "symbol_eng_aq": 82, + "symbol_ing": "viks", + "symbol_ing_aq": 97 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [ + { + "coordinate": 189, + "metric_mode": "bps_spoken_ing_aq", + "ring_partners": [ + "S2: likwidatee / hangkerchif / imerjansee" + ], + "scope": "SCOPE2_S1_S6_RING_MIGRATION", + "verified_equations": [] + } + ], + "data_available": true, + "entity_eng": "Bitcoin", + "entity_eng_aq": 135, + "entity_ing": "bitkoin", + "entity_ing_aq": 143, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S2", + "S6" + ], + "metrics": { + "change_bps": -44, + "change_pct": -0.44, + "close_usd": 59696.43, + "market_cap_str": "$1.20T", + "volume_ratio_20d": 0.77 + }, + "observation_date_utc": "2026-11-30", + "quant_encodings": { + "bps_digit_aq": 8, + "bps_spoken_eng": "forty four", + "bps_spoken_eng_aq": 225, + "bps_spoken_ing": "fortee for", + "bps_spoken_ing_aq": 189, + "close_digit_aq": 35, + "close_spoken_eng": "fifty nine thousand six hundred ninety six", + "close_spoken_eng_aq": 799, + "close_spoken_ing": "fiftee nain thouzand siks huhndrad naintee siks", + "close_spoken_ing_aq": 829, + "close_spoken_prime_rank": 145, + "scaled_cap_spoken_eng": "one point two zero trillion", + "scaled_cap_spoken_eng_aq": 546, + "scaled_cap_spoken_ing": "wuhn point too zeeroh trilyan", + "scaled_cap_spoken_ing_aq": 591, + "status": "ok" + }, + "status": "ok", + "symbol": "BTC-USD", + "symbol_clean": "BTC", + "symbol_eng_aq": 52, + "symbol_ing": "btc", + "symbol_ing_aq": 52 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Ethereum", + "entity_eng_aq": 167, + "entity_ing": "edheroom", + "entity_ing_aq": 155, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S2" + ], + "metrics": { + "change_bps": 51, + "change_pct": 0.51, + "close_usd": 1663.03, + "market_cap_str": "$203B", + "volume_ratio_20d": 0.78 + }, + "observation_date_utc": "2026-11-30", + "quant_encodings": { + "bps_digit_aq": 6, + "bps_spoken_eng": "fifty one", + "bps_spoken_eng_aq": 172, + "bps_spoken_ing": "fiftee wuhn", + "bps_spoken_ing_aq": 207, + "close_digit_aq": 16, + "close_spoken_eng": "one thousand six hundred sixty three", + "close_spoken_eng_aq": 694, + "close_spoken_ing": "wuhn thouzand siks huhndrad sikstee three", + "close_spoken_ing_aq": 779, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "two hundred three billion", + "scaled_cap_spoken_eng_aq": 459, + "scaled_cap_spoken_ing": "too huhndrad three bilyan", + "scaled_cap_spoken_ing_aq": 445, + "status": "ok" + }, + "status": "ok", + "symbol": "ETH-USD", + "symbol_clean": "ETH", + "symbol_eng_aq": 60, + "symbol_ing": "eth", + "symbol_ing_aq": 60 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Solana", + "entity_eng_aq": 116, + "entity_ing": "sohlana", + "entity_ing_aq": 133, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S2" + ], + "metrics": { + "change_bps": 52, + "change_pct": 0.52, + "close_usd": 71.71, + "market_cap_str": "$43B", + "volume_ratio_20d": 0.76 + }, + "observation_date_utc": "2026-11-30", + "quant_encodings": { + "bps_digit_aq": 7, + "bps_spoken_eng": "fifty two", + "bps_spoken_eng_aq": 196, + "bps_spoken_ing": "fiftee too", + "bps_spoken_ing_aq": 182, + "close_digit_aq": 9, + "close_spoken_eng": "seventy two", + "close_spoken_eng_aq": 258, + "close_spoken_ing": "sevantee too", + "close_spoken_ing_aq": 240, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "forty three billion", + "scaled_cap_spoken_eng_aq": 366, + "scaled_cap_spoken_ing": "fortee three bilyan", + "scaled_cap_spoken_ing_aq": 341, + "status": "ok" + }, + "status": "ok", + "symbol": "SOL-USD", + "symbol_clean": "SOL", + "symbol_eng_aq": 73, + "symbol_ing": "sol", + "symbol_ing_aq": 73 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Coinbase", + "entity_eng_aq": 140, + "entity_ing": "koinbays", + "entity_ing_aq": 168, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S2", + "S6" + ], + "metrics": { + "change_bps": 320, + "change_pct": 3.2, + "close_usd": 107.04, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.53 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 5, + "bps_spoken_eng": "three hundred twenty", + "bps_spoken_eng_aq": 399, + "bps_spoken_ing": "three huhndrad twentee", + "bps_spoken_ing_aq": 406, + "close_digit_aq": 8, + "close_spoken_eng": "one hundred seven", + "close_spoken_eng_aq": 308, + "close_spoken_ing": "wuhn huhndrad sevan", + "close_spoken_ing_aq": 358, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "COIN", + "symbol_clean": "COIN", + "symbol_eng_aq": 77, + "symbol_ing": "coin", + "symbol_ing_aq": 77 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Constellation", + "entity_eng_aq": 276, + "entity_ing": "konstalayshan", + "entity_ing_aq": 277, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S4", + "S3" + ], + "metrics": { + "change_bps": 120, + "change_pct": 1.2, + "close_usd": 238.1, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.62 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 3, + "bps_spoken_eng": "one hundred twenty", + "bps_spoken_eng_aq": 359, + "bps_spoken_ing": "wuhn huhndrad twentee", + "bps_spoken_ing_aq": 407, + "close_digit_aq": 13, + "close_spoken_eng": "two hundred thirty eight", + "close_spoken_eng_aq": 470, + "close_spoken_ing": "too huhndrad therdee ayt", + "close_spoken_ing_aq": 428, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "CEG", + "symbol_clean": "CEG", + "symbol_eng_aq": 42, + "symbol_ing": "ceg", + "symbol_ing_aq": 42 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Eli Lilly", + "entity_eng_aq": 168, + "entity_ing": "eelai lilee", + "entity_ing_aq": 165, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S5", + "S6" + ], + "metrics": { + "change_bps": 1, + "change_pct": 0.01, + "close_usd": 1392.38, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.53 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 1, + "bps_spoken_eng": "one", + "bps_spoken_eng_aq": 61, + "bps_spoken_ing": "wuhn", + "bps_spoken_ing_aq": 102, + "close_digit_aq": 15, + "close_spoken_eng": "one thousand three hundred ninety two", + "close_spoken_eng_aq": 699, + "close_spoken_ing": "wuhn thouzand three huhndrad naintee too", + "close_spoken_ing_aq": 742, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "LLY", + "symbol_clean": "LLY", + "symbol_eng_aq": 76, + "symbol_ing": "lly", + "symbol_ing_aq": 76 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "Treasury", + "entity_eng_aq": 199, + "entity_ing": "trezheree", + "entity_ing_aq": 191, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S6", + "S2" + ], + "metrics": { + "change_bps": 186, + "change_pct": 1.86, + "close_usd": 4.94, + "market_cap_str": "No data available", + "volume_ratio_20d": null + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 15, + "bps_spoken_eng": "one hundred eighty six", + "bps_spoken_eng_aq": 405, + "bps_spoken_ing": "wuhn huhndrad aytee siks", + "bps_spoken_ing_aq": 447, + "close_digit_aq": 5, + "close_spoken_eng": "five", + "close_spoken_eng_aq": 78, + "close_spoken_ing": "faiv", + "close_spoken_ing_aq": 74, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "^TNX", + "symbol_clean": "TNX", + "symbol_eng_aq": 85, + "symbol_ing": "tnx", + "symbol_ing_aq": 85 + }, + { + "co_present_in_news_wire": false, + "contingent_locks": [], + "data_available": true, + "entity_eng": "BlackRock", + "entity_eng_aq": 157, + "entity_ing": "blakrok", + "entity_ing_aq": 133, + "feed_source": "yahoo_v8_json", + "guilds": [ + "S6" + ], + "metrics": { + "change_bps": 220, + "change_pct": 2.2, + "close_usd": 1166.96, + "market_cap_str": "No data available", + "volume_ratio_20d": 0.55 + }, + "observation_date_utc": "2026-11-27", + "quant_encodings": { + "bps_digit_aq": 4, + "bps_spoken_eng": "two hundred twenty", + "bps_spoken_eng_aq": 383, + "bps_spoken_ing": "too huhndrad twentee", + "bps_spoken_ing_aq": 382, + "close_digit_aq": 15, + "close_spoken_eng": "one thousand one hundred sixty seven", + "close_spoken_eng_aq": 685, + "close_spoken_ing": "wuhn thouzand wuhn huhndrad sikstee sevan", + "close_spoken_ing_aq": 792, + "close_spoken_prime_rank": null, + "scaled_cap_spoken_eng": "No data available", + "scaled_cap_spoken_eng_aq": null, + "scaled_cap_spoken_ing": "No data available", + "scaled_cap_spoken_ing_aq": null, + "status": "ok" + }, + "status": "ok", + "symbol": "BLK", + "symbol_clean": "BLK", + "symbol_eng_aq": 52, + "symbol_ing": "blk", + "symbol_ing_aq": 52 + } + ], + "ipld_dag_json_cidv1": { + "/": "baguqeeratug7e6hkerd2la66fshj7r3v53mtr7ovuo32wll2uue2qqg4nz6a" + }, + "isolation_receipt": { + "all_unchanged": true, + "files": { + "/workspace/technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json": { + "post_sha256": "0d7ce833bb0aa0eea069bf764b2e3b0b36ac2631821c42f3d6bcb897335f8a7d", + "pre_sha256": "0d7ce833bb0aa0eea069bf764b2e3b0b36ac2631821c42f3d6bcb897335f8a7d", + "unchanged": true + }, + "/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json": { + "post_sha256": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d", + "pre_sha256": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d", + "unchanged": true + } + }, + "namespace_urn": "urn:io:hyperstitionstud:isolation-receipt:v1" + }, + "regime_summary": { + "active_memetic_states": [ + "M2_FLASH_CRASH_TEMPLEX_SURGE", + "M3_LEVIATHAN_TRILLION_CAP_CONCENTRATION" + ], + "emergent_m7_quant_triggers": [], + "instrument_count": 24, + "instruments_with_data_count": 23, + "instruments_without_data": [ + "ANTHR-PVT" + ], + "news_wire_co_present_symbols": [ + "ARM" + ], + "total_contingent_locks": 2, + "us10y_yield_pct": 4.94, + "vix_close": 23.81 + }, + "synthetic_data_eliminated": true, + "target_date_utc": "2026-12-01", + "version": "2.4.0" +} diff --git a/src/hyperstitionstud_io/config/__init__.py b/src/hyperstitionstud_io/config/__init__.py index 06246da..900396d 100644 --- a/src/hyperstitionstud_io/config/__init__.py +++ b/src/hyperstitionstud_io/config/__init__.py @@ -11,6 +11,7 @@ import copy import functools import json import os +import subprocess import tomllib from dataclasses import dataclass, field from pathlib import Path @@ -20,6 +21,138 @@ CORE_REPO_ROOT = Path(__file__).resolve().parents[3] WORKSPACE_ROOT = CORE_REPO_ROOT.parent USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspace.toml" +CANONICAL_SIX_REPOS: tuple[dict[str, Any], ...] = ( + { + "key": "hyperstitionstudio-core", + "aliases": ("hyperstitionstudio-core",), + "gitea_slug": "hyperstitionstudio-core", + "default_branch": "main", + "public_route": "https://hyperstitionstud.io/", + }, + { + "key": "ingglish-hyperdope-gematria", + "aliases": ("ingglish-hyperdope-gematria",), + "gitea_slug": "ingglish-hyperdope-gematria", + "default_branch": "main", + "public_route": "https://hyperstitionstud.io/archive/00-index-and-methodology.md", + }, + { + "key": "technocapital-singularity-zoology", + "aliases": ("technocapital-singularity-zoology",), + "gitea_slug": "technocapital-singularity-zoology", + "default_branch": "main", + "public_route": "https://hyperstitionstud.io/zoology/encyclopedia-of-technocapital-singularity-zoology-overview-and-manifest.pdf", + }, + { + "key": "encyclopedia-knowledge-graph", + "aliases": ("encyclopedia-knowledge-graph",), + "gitea_slug": "encyclopedia-knowledge-graph", + "default_branch": "main", + "public_route": "https://hyperstitionstud.io/graph/index.html", + }, + { + "key": "haiperdohp-jemaytreeah", + "aliases": ("haiperdohp-jemaytreeah",), + "gitea_slug": "haiperdohp-jemaytreeah", + "default_branch": "main", + "public_route": "https://hyperstitionstud.io/calc/index.html", + }, + { + "key": "hyperdope-ci-build", + "aliases": ("hyperdope-ci-build", "ingglish-hyperdope-ci"), + "gitea_slug": "ingglish-hyperdope-ci", + "default_branch": "feat/ingglish-aq-corpus", + "public_route": "https://hyperstitionstud.io/ci/ONBOARDING-INGGLISH-AQ.pdf", + }, +) + + +def resolve_workspace_repo_dir(ws_root: Path | str, repo_key: str) -> Path: + """ + Resolve a canonical repository directory under `ws_root`, transparently handling + aliases (`hyperdope-ci-build` vs `ingglish-hyperdope-ci`) and Gitea slugs. + """ + root = Path(ws_root) + cand = root / repo_key + if cand.is_dir(): + return cand + for spec in CANONICAL_SIX_REPOS: + if repo_key == spec["key"] or repo_key == spec["gitea_slug"] or repo_key in spec["aliases"]: + for name in (spec["key"], *spec["aliases"], spec["gitea_slug"]): + alt = root / name + if alt.is_dir(): + return alt + return root / spec["key"] + return cand + + +def normalize_workspace_relpath(p: Path | str, workspace_root: str | Path | None = None) -> str: + """ + Normalize a workspace path so paths under `workspace_root` serialize deterministically + as `/workspace/...` regardless of host checkout directory. + """ + if workspace_root is not None: + ws_res = str(Path(workspace_root).resolve()) + else: + cfg = load_workspace_config(workspace_root=None) + ws_res = str(cfg.workspace_root.resolve()) + s = str(Path(p).resolve()) + if s == ws_res: + return "/workspace" + if s.startswith(ws_res + "/"): + return "/workspace" + s[len(ws_res) :] + return str(p) + + +def run_git_stdout( + repo_dir: Path, + args: list[str], + *, + strip_leading: bool = True, + timeout: float = 5.0, +) -> str: + """ + Execute `git -C ...` and return stdout cleanly (or `""` on non-repo/error). + When `strip_leading=False`, preserves leading whitespace (e.g., for `git status --porcelain`). + """ + rdir = Path(repo_dir) + if not (rdir / ".git").exists(): + return "" + try: + res = subprocess.run( + ["git", "-C", str(rdir), *args], + capture_output=True, + text=True, + timeout=timeout, + check=False, + ) + if res.returncode == 0: + return res.stdout.strip() if strip_leading else res.stdout.rstrip("\r\n") + except Exception: + pass + return "" + + +@functools.lru_cache(maxsize=64) +def _count_lines_by_stat(resolved_path_str: str, st_mtime_ns: int, st_size: int) -> int: + _ = (st_mtime_ns, st_size) + with Path(resolved_path_str).open("rb") as fh: + data = fh.read() + if not data: + return 0 + nl_count = data.count(b"\n") + return nl_count if data.endswith(b"\n") else nl_count + 1 + + +def count_file_lines_cached(path: str | Path) -> int: + """ + Count lines in a file cached by `(str(resolved_path), st_mtime_ns, st_size)`. + Automatically invalidates when `st_mtime_ns` or `st_size` changes on disk. + """ + p = Path(path).resolve() + st = p.stat() + return _count_lines_by_stat(str(p), st.st_mtime_ns, st.st_size) + @functools.lru_cache(maxsize=64) def _parse_json_by_stat(resolved_path_str: str, st_mtime_ns: int, st_size: int) -> Any: @@ -50,23 +183,26 @@ class WorkspaceConfig: @property def core_dir(self) -> Path: - return self.paths.get("core_dir", self.workspace_root / "hyperstitionstudio-core") + return self.paths.get("core_dir", resolve_workspace_repo_dir(self.workspace_root, "hyperstitionstudio-core")) @property def archive_dir(self) -> Path: - return self.paths.get("archive_dir", self.workspace_root / "ingglish-hyperdope-gematria") + return self.paths.get("archive_dir", resolve_workspace_repo_dir(self.workspace_root, "ingglish-hyperdope-gematria")) @property def zoology_dir(self) -> Path: - return self.paths.get("zoology_dir", self.workspace_root / "technocapital-singularity-zoology") + return self.paths.get("zoology_dir", resolve_workspace_repo_dir(self.workspace_root, "technocapital-singularity-zoology")) @property def knowledge_graph_dir(self) -> Path: - return self.paths.get("knowledge_graph_dir", self.workspace_root / "encyclopedia-knowledge-graph") + return self.paths.get("knowledge_graph_dir", resolve_workspace_repo_dir(self.workspace_root, "encyclopedia-knowledge-graph")) @property def ci_build_dir(self) -> Path: - return self.paths.get("ci_build_dir", self.workspace_root / "hyperstition-ci-build") + cand = self.paths.get("ci_build_dir") or self.paths.get("ci_repo_dir") + if cand is not None and cand.is_dir(): + return cand + return resolve_workspace_repo_dir(self.workspace_root, "hyperdope-ci-build") def _rebase_path(raw_path: str | Path, ws_root: Path) -> Path: @@ -105,20 +241,23 @@ def load_workspace_config( chosen: Path | None = None for c in candidates: - if c.is_file(): - chosen = c - break + try: + if c.is_file(): + chosen = c + break + except OSError: + continue if chosen is not None and workspace_root is None: ws_root = chosen.resolve().parent default_paths = { - "core_dir": ws_root / "hyperstitionstudio-core", - "archive_dir": ws_root / "ingglish-hyperdope-gematria", - "zoology_dir": ws_root / "technocapital-singularity-zoology", - "knowledge_graph_dir": ws_root / "encyclopedia-knowledge-graph", - "ci_build_dir": ws_root / "hyperdope-ci-build", - "gematria_js_dir": ws_root / "haiperdohp-jemaytreeah", + "core_dir": resolve_workspace_repo_dir(ws_root, "hyperstitionstudio-core"), + "archive_dir": resolve_workspace_repo_dir(ws_root, "ingglish-hyperdope-gematria"), + "zoology_dir": resolve_workspace_repo_dir(ws_root, "technocapital-singularity-zoology"), + "knowledge_graph_dir": resolve_workspace_repo_dir(ws_root, "encyclopedia-knowledge-graph"), + "ci_build_dir": resolve_workspace_repo_dir(ws_root, "hyperdope-ci-build"), + "gematria_js_dir": resolve_workspace_repo_dir(ws_root, "haiperdohp-jemaytreeah"), "memes_dir": ws_root / "memes", } default_ro = [ @@ -143,6 +282,8 @@ def load_workspace_config( raw_cit = raw.get("citations", {}).get("path_mounts", {}) resolved_paths = {k: _rebase_path(v, ws_root) for k, v in raw_paths.items()} if raw_paths else default_paths + if "ci_build_dir" in resolved_paths and not resolved_paths["ci_build_dir"].is_dir(): + resolved_paths["ci_build_dir"] = resolve_workspace_repo_dir(ws_root, "hyperdope-ci-build") resolved_ro = [_rebase_path(p, ws_root) for p in raw_iso.get("read_only_files", [])] if raw_iso.get("read_only_files") else default_ro resolved_mounts = {str(_rebase_path(k, ws_root)): str(v) for k, v in raw_cit.items()} diff --git a/src/hyperstitionstud_io/publishing/engineering_docs.py b/src/hyperstitionstud_io/publishing/engineering_docs.py index 0b7f36f..3770533 100644 --- a/src/hyperstitionstud_io/publishing/engineering_docs.py +++ b/src/hyperstitionstud_io/publishing/engineering_docs.py @@ -12,20 +12,28 @@ Provides: from __future__ import annotations -import argparse -import json -import re -import shutil from pathlib import Path from typing import Any 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 from hyperstitionstud_io.lenses import ENABLED_LENSES from hyperstitionstud_io.mcp.rest import REST_DOMAIN_ALIASES from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA +from hyperstitionstud_io.publishing.explication_template import ( + _render_global_nav_html, + _render_guile_repl_drawer_html, + _render_polyglot_selector_html, + _render_prereq_box_html, + render_explication_cartridge_html, + render_explication_hub_page_html, + render_explication_nav_html, + render_explication_subpage_html, + render_polyglot_cartridge_html, + run_explication_cli_main, + write_explication_site_bundle, +) from hyperstitionstud_io.quant.collector import CANONICAL_WATCHLIST_24 from hyperstitionstud_io.quant.macro import FRED_SERIES_SPEC @@ -98,104 +106,14 @@ ENGINEERING_GUILE_CARTRIDGES: dict[str, dict[str, str]] = { } -def _render_polyglot_selector_html() -> str: - return ( - '
' - 'LENS:' - '' - '' - '' - '' - '' - '' - '
' - ) - - -def render_polyglot_cartridge_html( - cartridge: dict[str, str], - spec_label: str = "1. Formal Specification & Python:", -) -> str: - import html - - esc_scm = html.escape(cartridge["scm_expr"], quote=True) - esc_ts = html.escape(cartridge["ts_expr"], quote=True) - esc_rs = html.escape(cartridge["rust_expr"], quote=True) - esc_math = html.escape(cartridge["math_view"], quote=True) - esc_py = html.escape(cartridge["py_view"], quote=True) - esc_title = html.escape(cartridge["title"], quote=True) - esc_chal = html.escape(cartridge["challenge"], quote=True) - return ( - '
' - '
' - f'
λ {esc_title}
' - '
' - '' - '' - '' - '' - '' - '
' - '
' - '
' - f'
{spec_label}{esc_math}
{esc_py}
' - f'
λ Guile Scheme (Z-Combinator):
{esc_scm}
=> [Select Lens to evaluate]
' - f'
TS TypeScript (Strict AST):
{esc_ts}
=> [Select Lens to evaluate]
' - f'
Rs Rust (Option/Iterator AST):
{esc_rs}
=> [Select Lens to evaluate]
' - '
' - f'
Guided Micro-Challenge (4-Ring Zero-Escape Sandbox): {esc_chal}
' - '
' - ) - - def _render_guile_cartridge_html(key: str) -> str: - return render_polyglot_cartridge_html( - ENGINEERING_GUILE_CARTRIDGES[key], + return render_explication_cartridge_html( + ENGINEERING_GUILE_CARTRIDGES, + key, spec_label="1. Formal Specification & Python:", ) -def _render_guile_repl_drawer_html(rel_prefix: str) -> str: - return f""" - - """ - HUB_PREREQ_LADDER: dict[str, Any] = { "unit_id": "E0", "expertise_level": "Level 1-2 (Novice to Advanced Beginner • 4-8 hrs study)", @@ -324,8 +242,8 @@ ENGINEERING_SUBPAGE_SPECS: dict[str, dict[str, Any]] = { "body": "hs_generate_ticker_stats_card compiles a 5-zone 900x1260 Group 3 Stealth Basalt PNG card and companion JSON payload in one shot (with draw_fitted_text() width clamping and ink-bbox midpoint centering). ipld/__init__.py serializes canonical UTF-8 dag-json and prefixes SHA-256 digests with [0x01, 0xA9, 0x02, 0x12, 0x20] to form Base32 CIDv1 ('baguqeera...').", }, { - "heading": "3. Command-Line Usage Examples: CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", - "body": "Command-line invocations across all three client interfaces: (1) CLI: hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (2) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (3) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1," + '"method":"tools/call","params":{"name":"hs_generate_ticker_stats_card","arguments":{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}\' | jq .', + "heading": "3. Command-Line Usage Examples: cURL, CLI (hs-ticker-card), Chatbot REST Client (/api/v1/tools/*) & MCP Client (/mcp)", + "body": "Command-line invocations across all four client interfaces: (1) cURL (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' -o /tmp/NVDA-stats-card.json (or include_base64_png=true piped through jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png); (2) CLI (hs-ticker-card): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards; (3) Chatbot REST API Client: curl -sS 'https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false' | jq . (or POST JSON '{\"symbol\":\"NVDA\",\"lens\":\"tierzoo_ecology\",\"include_base64_png\":true}' to /api/v1/tools/hs_generate_ticker_stats_card, or GET /api/v1/zoology/pokedex/NVDA?include_card=true); (4) MCP JSON-RPC 2.0 Client: curl -sS -X POST 'https://hyperstitionstud.io/mcp' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1," + '"method":"tools/call","params":{"name":"hs_generate_ticker_stats_card","arguments":{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}\' | jq .', }, ], }, @@ -416,76 +334,13 @@ def introspect_engineering_manifest( return manifest -def _render_global_nav_html(rel_prefix: str, active_surface: str = "engineering") -> str: - eng_cls = 'btn primary' if active_surface == "engineering" else 'btn' - eng_cur = ' aria-current="page"' if active_surface == "engineering" else '' - math_cls = 'btn primary' if active_surface == "math" else 'btn' - math_cur = ' aria-current="page"' if active_surface == "math" else '' - links = [ - f'Portal Home (/)', - 'Calculator', - 'Quant', - 'Graph', - f'Learn', - f'Engineering', - f'Math', - '', - f'' - 'DONATE', - ] - return "\n ".join(links) - - def _render_nav_html(active_slug: str | None, enabled_subpages: list[str], rel_prefix: str) -> str: - links = [ - f'Engineering Hub (E0)', - ] - direct_pages = enabled_subpages[:6] - overflow_pages = enabled_subpages[6:] - for s in direct_pages: - spec = ENGINEERING_SUBPAGE_SPECS[s] - is_act = (s == active_slug) - href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if not is_act else "index.html") - style = "border-color:var(--gold);color:var(--gold);" if is_act else "" - links.append(f'{spec["short_title"]}') - if overflow_pages: - opts = [''] - for s in overflow_pages: - spec = ENGINEERING_SUBPAGE_SPECS[s] - href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if s != active_slug else "index.html") - opts.append(f'') - links.append(f'') - unit_links_html = "\n ".join(links) - return ( - f'\n' - f' {_render_polyglot_selector_html()}' - ) - - -def _render_prereq_box_html( - level_str: str, - prereqs: list[str], - resources: list[dict[str, Any]], - rel_prefix: str, - intro_prompt: str = "If any concepts on this page are unfamiliar, occupy your study time with these free foundational resources first:", - prereq_heading: str = "Core Concepts Required:", -) -> str: - p_items = "".join(f"
  • {p}
  • " for p in prereqs) - r_items = [] - for r in resources: - url = r["url"] - if not r.get("external") and url.startswith("/"): - url = f"{rel_prefix}..{url}" - ext_attr = ' target="_blank" rel="noopener noreferrer"' if r.get("external") else "" - r_items.append(f'
  • {r["label"]} ↗
  • ') - return ( - '
    ' - f'
    Prerequisite Track for Novices • Required Expertise: {level_str}
    ' - f'

    {intro_prompt}

    ' - '
    ' - f'
    {prereq_heading}
      {p_items}
    ' - f'
    Curated Free Public Study Resources:
      {"".join(r_items)}
    ' - '
    ' + return render_explication_nav_html( + hub_label="Engineering Hub (E0)", + active_slug=active_slug, + enabled_subpages=enabled_subpages, + specs=ENGINEERING_SUBPAGE_SPECS, + rel_prefix=rel_prefix, ) @@ -507,91 +362,21 @@ def _render_hub_html(manifest: dict[str, Any], include_guile_lens: bool = True) guile_hub_html = _render_guile_cartridge_html("E0") if include_guile_lens else "" guile_drawer_html = _render_guile_repl_drawer_html("") if include_guile_lens else "" - cards_html = "" - sigil_map = { - "E1": "☿", - "E2": "☉", - "E3": "♄ ☍", - "E4": "⚚", - "E5": "⚛", - } - for s in enabled: - sp = ENGINEERING_SUBPAGE_SPECS[s] - sig = sigil_map.get(sp["unit_id"], "⚛") - cards_html += ( - f'' - ) + stat_tiles_html = ( + f'
    Repositories
    {counts["repositories"]}
    \n' + f'
    CLI Entrypoints
    {counts["cli_entrypoints"]}
    \n' + f'
    MCP & REST Tools
    {counts["mcp_tools"]}
    \n' + f'
    Pluggable Lenses
    {counts["enabled_lenses"]}
    \n' + f'
    Watchlist / FRED
    {counts["watchlist_instruments"]} / {counts["fred_macro_series"]}
    \n' + f'
    Enabled Subpages
    {len(enabled)} / {len(ALL_ENGINEERING_SUBPAGES)}
    ' + ) cli_rows = "".join( f"{k}{v}" for k, v in sorted(manifest["cli_scripts"].items()) ) - return f""" - - - - - Software Engineering Explication Hub — hyperstitionstud.io/engineering (v{CURRENT_VERSION}) - - - - -
    -
    -
    -
    - -

    HYPERSTITION STUDIO // SOFTWARE ENGINEERING EXPLICATION HUB (UNIT E0)

    -
    -

    Commutative Live-Introspected Architecture • Piecewise & Non-Sequentially Revertible Cartridges • urn:io:hyperstitionstud:engineering:v{CURRENT_VERSION}

    -
    - -
    - - - - {prereq_html} - {guile_hub_html} - -
    -
    Repositories
    {counts["repositories"]}
    -
    CLI Entrypoints
    {counts["cli_entrypoints"]}
    -
    MCP & REST Tools
    {counts["mcp_tools"]}
    -
    Pluggable Lenses
    {counts["enabled_lenses"]}
    -
    Watchlist / FRED
    {counts["watchlist_instruments"]} / {counts["fred_macro_series"]}
    -
    Enabled Subpages
    {len(enabled)} / {len(ALL_ENGINEERING_SUBPAGES)}
    -
    - -
    - {cards_html} -
    - -
    + extra_panels_html = f"""

    End-to-End Periodic Data Harvest → CI/CD → Deployed VPS Infrastructure Flow Diagram

    Generated & verified deterministically by hyperstitionstud_io.publishing.flow_diagram during push-all-to-git-libre-audio.sh and tests/test_core_suite.py:

    @@ -620,19 +405,39 @@ def _render_hub_html(manifest: dict[str, Any], include_guile_lens: bool = True) }}); }})(); -
    +
    """ -
    - hyperstitionstud.io/engineering v{CURRENT_VERSION} • CIDv1: {manifest["ipld_dag_json_cidv1"]["/"][:36]}... • • Made with ♥ by Lemurs. -
    -
    - - - - {guile_drawer_html} - - -""" + return render_explication_hub_page_html( + surface_slug="engineering", + page_title=f"Software Engineering Explication Hub — hyperstitionstud.io/engineering (v{CURRENT_VERSION})", + header_h1="HYPERSTITION STUDIO // SOFTWARE ENGINEERING EXPLICATION HUB (UNIT E0)", + header_subtitle_html=f'Commutative Live-Introspected Architecture • Piecewise & Non-Sequentially Revertible Cartridges • urn:io:hyperstitionstud:engineering:v{CURRENT_VERSION} ', + global_nav_html=global_nav_html, + subnav_html=subnav_html, + prereq_html=prereq_html, + guile_hub_html=guile_hub_html, + guile_drawer_html=guile_drawer_html, + stat_tiles_html=stat_tiles_html, + enabled_subpages=enabled, + specs=ENGINEERING_SUBPAGE_SPECS, + sigil_map={ + "E1": "☿", + "E2": "☉", + "E3": "♄ ☍", + "E4": "⚚", + "E5": "⚛", + }, + default_sigil="⚛", + cidv1_prefix=manifest["ipld_dag_json_cidv1"]["/"][:36], + manifest_js_filename="engineering-manifest-data.js", + app_js_filename="engineering-app.js", + stats_min_col_px=150, + extra_css_html=( + "\n table { width: 100%; font-size: 0.73rem; margin-top: 0.4rem; }" + "\n th, td { padding: 0.4rem 0.6rem; text-align: left; border: 1px solid var(--border); }" + ), + extra_panels_html=extra_panels_html, + ) def _render_subpage_html(slug: str, manifest: dict[str, Any], include_guile_lens: bool = True) -> str: @@ -644,20 +449,9 @@ def _render_subpage_html(slug: str, manifest: dict[str, Any], include_guile_lens guile_sub_html = _render_guile_cartridge_html(slug) if include_guile_lens else "" guile_drawer_html = _render_guile_repl_drawer_html("../") if include_guile_lens else "" - idx = enabled.index(slug) - prev_link = f'← Prev: {ENGINEERING_SUBPAGE_SPECS[enabled[idx - 1]]["short_title"]}' if idx > 0 else '← Back to Engineering Hub (E0)' - next_link = f'Next: {ENGINEERING_SUBPAGE_SPECS[enabled[idx + 1]]["short_title"]} →' if idx + 1 < len(enabled) else 'Return to Engineering Hub (E0) ↑' - - secs_html = "" - for sec in spec["sections"]: - secs_html += ( - '
    ' - f'

    {sec["heading"]}

    ' - f'

    {sec["body"]}

    ' - '
    ' - ) + extra_after_sections_html = "" if slug == "mcp-chatbot-rest-and-ipld": - secs_html += ( + extra_after_sections_html = ( '
    ' '
    ' '

    ⚛ Live API & IPLD CIDv1 ETag 304 Conditional Cache Probe (#live-smoke-probe)

    ' @@ -692,65 +486,22 @@ def _render_subpage_html(slug: str, manifest: dict[str, Any], include_guile_lens '
    ' ) - return f""" - - - - - {spec["title"]} — hyperstitionstud.io/engineering (v{CURRENT_VERSION}) - - - - -
    -
    -
    -
    - -

    {spec["title"]}

    -
    -

    Cartridge {spec["unit_id"]} • Non-Sequentially Revertible via hs-eng-docs --disable {slug} • v{CURRENT_VERSION}

    -
    - -
    - - - - {prereq_html} - {guile_sub_html} - {secs_html} - -
    - {prev_link} - {next_link} -
    - -
    - hyperstitionstud.io/engineering/{slug} v{CURRENT_VERSION} • • Made with ♥ by Lemurs. -
    -
    - - - - {guile_drawer_html} - - -""" + return render_explication_subpage_html( + slug=slug, + surface_slug="engineering", + hub_label="Engineering Hub (E0)", + cli_prog="hs-eng-docs", + manifest=manifest, + specs=ENGINEERING_SUBPAGE_SPECS, + global_nav_html=global_nav_html, + subnav_html=subnav_html, + prereq_html=prereq_html, + guile_sub_html=guile_sub_html, + guile_drawer_html=guile_drawer_html, + manifest_js_filename="engineering-manifest-data.js", + app_js_filename="engineering-app.js", + extra_after_sections_html=extra_after_sections_html, + ) def build_engineering_site( @@ -760,81 +511,39 @@ def build_engineering_site( include_guile_lens: bool = ENABLE_GUILE_SCHEME_LENS, workspace_root: str | Path | None = None, ) -> dict[str, Any]: - cfg = load_workspace_config(workspace_root=workspace_root) - target_dir = Path(out_dir).resolve() if out_dir else (cfg.core_dir / "site" / "engineering").resolve() - - with ReadOnlyIsolationGuard(cfg.read_only_files) as guard: - if disable_all: - if target_dir.is_dir(): - shutil.rmtree(target_dir) - return {"ok": True, "disabled_all": True, "enabled_routes": []} - - target_dir.mkdir(parents=True, exist_ok=True) - active_tuple = tuple(s for s in ALL_ENGINEERING_SUBPAGES if s in enabled_subpages) - manifest = introspect_engineering_manifest(enabled_subpages=active_tuple, workspace_root=workspace_root) - - # Write manifest JSON & JS - (target_dir / "engineering-manifest.json").write_text(json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") - (target_dir / "engineering-manifest-data.js").write_text( - "window.HYPERSTITION_ENGINEERING_MANIFEST = " + json.dumps(manifest, ensure_ascii=False) + ";\n", - encoding="utf-8", - ) - (target_dir / "engineering-app.js").write_text( - "(function(){ 'use strict'; if (window.location.protocol !== 'file:') { document.querySelectorAll('img[data-http-src]').forEach(function(im){ im.src = im.getAttribute('data-http-src'); }); } })();\n", - encoding="utf-8", - ) - - # Write Hub E0 - (target_dir / "index.html").write_text(_render_hub_html(manifest, include_guile_lens=include_guile_lens), encoding="utf-8") - - # Write enabled subpages and remove any disabled subpage directories - for s in ALL_ENGINEERING_SUBPAGES: - sub_d = target_dir / s - if s in active_tuple: - sub_d.mkdir(parents=True, exist_ok=True) - (sub_d / "index.html").write_text(_render_subpage_html(s, manifest, include_guile_lens=include_guile_lens), encoding="utf-8") - elif sub_d.is_dir(): - shutil.rmtree(sub_d) - - return { - "ok": True, - "version": CURRENT_VERSION, - "output_dir": str(target_dir), - "guile_scheme_lens_enabled": include_guile_lens, - "enabled_subpages": list(active_tuple), - "enabled_routes": manifest["enabled_routes"], - "cidv1": manifest["ipld_dag_json_cidv1"]["/"], - "isolation_receipt": guard.audit_receipt(), - } + return write_explication_site_bundle( + surface_slug="engineering", + all_subpages=ALL_ENGINEERING_SUBPAGES, + enabled_subpages=enabled_subpages, + out_dir=out_dir, + disable_all=disable_all, + include_guile_lens=include_guile_lens, + workspace_root=workspace_root, + introspect_fn=introspect_engineering_manifest, + render_hub_fn=_render_hub_html, + render_subpage_fn=_render_subpage_html, + manifest_json_filename="engineering-manifest.json", + manifest_js_filename="engineering-manifest-data.js", + manifest_window_var="HYPERSTITION_ENGINEERING_MANIFEST", + app_js_filename="engineering-app.js", + app_js_source="(function(){ 'use strict'; if (window.location.protocol !== 'file:') { document.querySelectorAll('img[data-http-src]').forEach(function(im){ im.src = im.getAttribute('data-http-src'); }); } })();\n", + ) def main(argv: list[str] | None = None) -> int: - ap = argparse.ArgumentParser(prog="hs-eng-docs", description="Build or toggle the /engineering/ Hub & modular subpages (E0-E5).") - ap.add_argument("--sync", action="store_true", help="Rebuild all enabled /engineering/ pages from live codebase introspection.") - ap.add_argument("--disable", default="", help="Comma-separated subpage slugs or unit IDs (e.g. quant-macro-and-bayesian-brief or E3) to disable.") - ap.add_argument("--only", default="", help="Comma-separated subpage slugs or unit IDs (e.g. E1,E4) to enable exclusively.") - ap.add_argument("--disable-all", action="store_true", help="Unmount all /engineering/ pages.") - ap.add_argument("--disable-guile-lens", action="store_true", help="Omit additive Guile Scheme cartridges without touching E0-E5 content.") - ap.add_argument("--out-dir", default=None) - args = ap.parse_args(argv) - - unit_map = {spec["unit_id"].upper(): slug for slug, spec in ENGINEERING_SUBPAGE_SPECS.items()} - enabled = list(ALL_ENGINEERING_SUBPAGES) - if args.only: - req = {unit_map.get(x.strip().upper(), x.strip()) for x in args.only.split(",") if x.strip()} - enabled = [s for s in ALL_ENGINEERING_SUBPAGES if s in req] - if args.disable: - dis = {unit_map.get(x.strip().upper(), x.strip()) for x in args.disable.split(",") if x.strip()} - enabled = [s for s in enabled if s not in dis] - - res = build_engineering_site( - out_dir=args.out_dir, - enabled_subpages=tuple(enabled), - disable_all=args.disable_all, - include_guile_lens=not args.disable_guile_lens, + return run_explication_cli_main( + prog="hs-eng-docs", + description="Build or toggle the /engineering/ Hub & modular subpages (E0-E5).", + all_subpages=ALL_ENGINEERING_SUBPAGES, + specs=ENGINEERING_SUBPAGE_SPECS, + build_fn=build_engineering_site, + argv=argv, + sync_help="Rebuild all enabled /engineering/ pages from live codebase introspection.", + disable_help="Comma-separated subpage slugs or unit IDs (e.g. quant-macro-and-bayesian-brief or E3) to disable.", + only_help="Comma-separated subpage slugs or unit IDs (e.g. E1,E4) to enable exclusively.", + disable_all_help="Unmount all /engineering/ pages.", + disable_guile_help="Omit additive Guile Scheme cartridges without touching E0-E5 content.", ) - print(json.dumps(res, indent=2)) - return 0 if __name__ == "__main__": diff --git a/src/hyperstitionstud_io/publishing/explication_template.py b/src/hyperstitionstud_io/publishing/explication_template.py new file mode 100644 index 0000000..8fc093b --- /dev/null +++ b/src/hyperstitionstud_io/publishing/explication_template.py @@ -0,0 +1,514 @@ +#!/usr/bin/env python3 +""" +hyperstitionstud_io.publishing.explication_template +Shared Group 3 Stealth Basalt Explication Hub & Orthogonal Subpage Cartridge Template Engine +for `/engineering/` (`Units E0-E5`, `hs-eng-docs`) and `/math/` (`Units M0-M5`, `hs-math-docs`). +""" + +from __future__ import annotations + +import argparse +import html +import json +import shutil +from pathlib import Path +from typing import Any, Callable + +from hyperstitionstud_io import __version__ as CURRENT_VERSION +from hyperstitionstud_io.config import load_workspace_config +from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard + + +def _render_polyglot_selector_html() -> str: + return ( + '
    ' + 'LENS:' + '' + '' + '' + '' + '' + '' + '
    ' + ) + + +def render_polyglot_cartridge_html( + cartridge: dict[str, str], + spec_label: str = "1. Formal Specification & Python:", +) -> str: + esc_scm = html.escape(cartridge["scm_expr"], quote=True) + esc_ts = html.escape(cartridge["ts_expr"], quote=True) + esc_rs = html.escape(cartridge["rust_expr"], quote=True) + esc_math = html.escape(cartridge["math_view"], quote=True) + esc_py = html.escape(cartridge["py_view"], quote=True) + esc_title = html.escape(cartridge["title"], quote=True) + esc_chal = html.escape(cartridge["challenge"], quote=True) + return ( + '
    ' + '
    ' + f'
    λ {esc_title}
    ' + '
    ' + '' + '' + '' + '' + '' + '
    ' + '
    ' + '
    ' + f'
    {spec_label}{esc_math}
    {esc_py}
    ' + f'
    λ Guile Scheme (Z-Combinator):
    {esc_scm}
    => [Select Lens to evaluate]
    ' + f'
    TS TypeScript (Strict AST):
    {esc_ts}
    => [Select Lens to evaluate]
    ' + f'
    Rs Rust (Option/Iterator AST):
    {esc_rs}
    => [Select Lens to evaluate]
    ' + '
    ' + f'
    Guided Micro-Challenge (4-Ring Zero-Escape Sandbox): {esc_chal}
    ' + '
    ' + ) + + +def render_explication_cartridge_html( + cartridges: dict[str, dict[str, str]], + key: str, + spec_label: str = "1. Formal Specification & Python:", +) -> str: + return render_polyglot_cartridge_html( + cartridges[key], + spec_label=spec_label, + ) + + +def _render_guile_repl_drawer_html(rel_prefix: str) -> str: + return f""" + + """ + + +def _render_global_nav_html(rel_prefix: str, active_surface: str = "engineering") -> str: + eng_cls = 'btn primary' if active_surface == "engineering" else 'btn' + eng_cur = ' aria-current="page"' if active_surface == "engineering" else '' + math_cls = 'btn primary' if active_surface == "math" else 'btn' + math_cur = ' aria-current="page"' if active_surface == "math" else '' + links = [ + f'Portal Home (/)', + 'Calculator', + 'Quant', + 'Graph', + f'Learn', + f'Engineering', + f'Math', + '', + f'' + 'DONATE', + ] + return "\n ".join(links) + + +def render_explication_nav_html( + hub_label: str, + active_slug: str | None, + enabled_subpages: list[str], + specs: dict[str, dict[str, Any]], + rel_prefix: str, +) -> str: + links = [ + f'{hub_label}', + ] + direct_pages = enabled_subpages[:6] + overflow_pages = enabled_subpages[6:] + for s in direct_pages: + spec = specs[s] + is_act = (s == active_slug) + href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if not is_act else "index.html") + style = "border-color:var(--gold);color:var(--gold);" if is_act else "" + links.append(f'{spec["short_title"]}') + if overflow_pages: + opts = [''] + for s in overflow_pages: + spec = specs[s] + href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if s != active_slug else "index.html") + opts.append(f'') + links.append(f'') + unit_links_html = "\n ".join(links) + return ( + f'\n' + f' {_render_polyglot_selector_html()}' + ) + + +def _render_prereq_box_html( + level_str: str, + prereqs: list[str], + resources: list[dict[str, Any]], + rel_prefix: str, + intro_prompt: str = "If any concepts on this page are unfamiliar, occupy your study time with these free foundational resources first:", + prereq_heading: str = "Core Concepts Required:", +) -> str: + p_items = "".join(f"
  • {p}
  • " for p in prereqs) + r_items = [] + for r in resources: + url = r["url"] + if not r.get("external") and url.startswith("/"): + url = f"{rel_prefix}..{url}" + ext_attr = ' target="_blank" rel="noopener noreferrer"' if r.get("external") else "" + r_items.append(f'
  • {r["label"]} ↗
  • ') + return ( + '
    ' + f'
    Prerequisite Track for Novices • Required Expertise: {level_str}
    ' + f'

    {intro_prompt}

    ' + '
    ' + f'
    {prereq_heading}
      {p_items}
    ' + f'
    Curated Free Public Study Resources:
      {"".join(r_items)}
    ' + '
    ' + ) + + +def render_explication_hub_page_html( + *, + surface_slug: str, + page_title: str, + header_h1: str, + header_subtitle_html: str, + global_nav_html: str, + subnav_html: str, + prereq_html: str, + guile_hub_html: str, + guile_drawer_html: str, + stat_tiles_html: str, + enabled_subpages: list[str], + specs: dict[str, dict[str, Any]], + sigil_map: dict[str, str], + default_sigil: str, + cidv1_prefix: str, + manifest_js_filename: str, + app_js_filename: str, + stats_min_col_px: int = 150, + extra_css_html: str = "", + extra_panels_html: str = "", +) -> str: + cards_html = "" + for s in enabled_subpages: + sp = specs[s] + sig = sigil_map.get(sp["unit_id"], default_sigil) + cards_html += ( + f'' + ) + + extra_panels_block = f"\n\n{extra_panels_html}\n" if extra_panels_html else "\n" + + return f""" + + + + + {page_title} + + + + +
    +
    +
    +
    + +

    {header_h1}

    +
    +

    {header_subtitle_html}

    +
    + +
    + + + + {prereq_html} + {guile_hub_html} + +
    +{stat_tiles_html} +
    + +
    + {cards_html} +
    {extra_panels_block} +
    + hyperstitionstud.io/{surface_slug} v{CURRENT_VERSION} • CIDv1: {cidv1_prefix}... • • Made with ♥ by Lemurs. +
    +
    + + + + {guile_drawer_html} + + +""" + + +def render_explication_subpage_html( + *, + slug: str, + surface_slug: str, + hub_label: str, + cli_prog: str, + manifest: dict[str, Any], + specs: dict[str, dict[str, Any]], + global_nav_html: str, + subnav_html: str, + prereq_html: str, + guile_sub_html: str, + guile_drawer_html: str, + manifest_js_filename: str, + app_js_filename: str, + extra_after_sections_html: str = "", +) -> str: + enabled = manifest["enabled_subpages"] + spec = specs[slug] + idx = enabled.index(slug) + prev_link = ( + f'← Prev: {specs[enabled[idx - 1]]["short_title"]}' + if idx > 0 + else f'← Back to {hub_label}' + ) + next_link = ( + f'Next: {specs[enabled[idx + 1]]["short_title"]} →' + if idx + 1 < len(enabled) + else f'Return to {hub_label} ↑' + ) + + secs_html = "" + for sec in spec["sections"]: + secs_html += ( + '
    ' + f'

    {sec["heading"]}

    ' + f'

    {sec["body"]}

    ' + '
    ' + ) + if extra_after_sections_html: + secs_html += extra_after_sections_html + + return f""" + + + + + {spec["title"]} — hyperstitionstud.io/{surface_slug} (v{CURRENT_VERSION}) + + + + +
    +
    +
    +
    + +

    {spec["title"]}

    +
    +

    Cartridge {spec["unit_id"]} • Non-Sequentially Revertible via {cli_prog} --disable {slug} • v{CURRENT_VERSION}

    +
    + +
    + + + + {prereq_html} + {guile_sub_html} + {secs_html} + +
    + {prev_link} + {next_link} +
    + +
    + hyperstitionstud.io/{surface_slug}/{slug} v{CURRENT_VERSION} • • Made with ♥ by Lemurs. +
    +
    + + + + {guile_drawer_html} + + +""" + + +def write_explication_site_bundle( + *, + surface_slug: str, + all_subpages: tuple[str, ...], + enabled_subpages: tuple[str, ...] | list[str], + out_dir: str | Path | None, + disable_all: bool, + include_guile_lens: bool, + workspace_root: str | Path | None, + introspect_fn: Callable[..., dict[str, Any]], + render_hub_fn: Callable[..., str], + render_subpage_fn: Callable[..., str], + manifest_json_filename: str, + manifest_js_filename: str, + manifest_window_var: str, + app_js_filename: str, + app_js_source: str, +) -> dict[str, Any]: + cfg = load_workspace_config(workspace_root=workspace_root) + target_dir = Path(out_dir).resolve() if out_dir else (cfg.core_dir / "site" / surface_slug).resolve() + + with ReadOnlyIsolationGuard(cfg.read_only_files) as guard: + if disable_all: + if target_dir.is_dir(): + shutil.rmtree(target_dir) + return {"ok": True, "disabled_all": True, "enabled_routes": []} + + target_dir.mkdir(parents=True, exist_ok=True) + active_tuple = tuple(s for s in all_subpages if s in enabled_subpages) + manifest = introspect_fn(enabled_subpages=active_tuple, workspace_root=workspace_root) + + (target_dir / manifest_json_filename).write_text( + json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", + encoding="utf-8", + ) + (target_dir / manifest_js_filename).write_text( + f"window.{manifest_window_var} = " + json.dumps(manifest, ensure_ascii=False) + ";\n", + encoding="utf-8", + ) + (target_dir / app_js_filename).write_text(app_js_source, encoding="utf-8") + (target_dir / "index.html").write_text( + render_hub_fn(manifest, include_guile_lens=include_guile_lens), + encoding="utf-8", + ) + + for s in all_subpages: + sub_d = target_dir / s + if s in active_tuple: + sub_d.mkdir(parents=True, exist_ok=True) + (sub_d / "index.html").write_text( + render_subpage_fn(s, manifest, include_guile_lens=include_guile_lens), + encoding="utf-8", + ) + elif sub_d.is_dir(): + shutil.rmtree(sub_d) + + return { + "ok": True, + "version": CURRENT_VERSION, + "output_dir": str(target_dir), + "guile_scheme_lens_enabled": include_guile_lens, + "enabled_subpages": list(active_tuple), + "enabled_routes": manifest["enabled_routes"], + "cidv1": manifest["ipld_dag_json_cidv1"]["/"], + "isolation_receipt": guard.audit_receipt(), + } + + +def run_explication_cli_main( + *, + prog: str, + description: str, + all_subpages: tuple[str, ...], + specs: dict[str, dict[str, Any]], + build_fn: Callable[..., dict[str, Any]], + argv: list[str] | None = None, + sync_help: str | None = None, + disable_help: str = "", + only_help: str = "", + disable_all_help: str | None = None, + disable_guile_help: str = "", +) -> int: + ap = argparse.ArgumentParser(prog=prog, description=description) + ap.add_argument("--sync", action="store_true", help=sync_help) + ap.add_argument("--disable", default="", help=disable_help) + ap.add_argument("--only", default="", help=only_help) + ap.add_argument("--disable-all", action="store_true", help=disable_all_help) + ap.add_argument("--disable-guile-lens", action="store_true", help=disable_guile_help) + ap.add_argument("--out-dir", default=None) + args = ap.parse_args(argv) + + unit_map = {spec["unit_id"].upper(): slug for slug, spec in specs.items()} + enabled = list(all_subpages) + if args.only: + req = {unit_map.get(x.strip().upper(), x.strip()) for x in args.only.split(",") if x.strip()} + enabled = [s for s in all_subpages if s in req] + if args.disable: + dis = {unit_map.get(x.strip().upper(), x.strip()) for x in args.disable.split(",") if x.strip()} + enabled = [s for s in enabled if s not in dis] + + res = build_fn( + out_dir=args.out_dir, + enabled_subpages=tuple(enabled), + disable_all=args.disable_all, + include_guile_lens=not args.disable_guile_lens, + ) + print(json.dumps(res, indent=2)) + return 0 diff --git a/src/hyperstitionstud_io/publishing/fonts.py b/src/hyperstitionstud_io/publishing/fonts.py index fe9f842..0a47d28 100644 --- a/src/hyperstitionstud_io/publishing/fonts.py +++ b/src/hyperstitionstud_io/publishing/fonts.py @@ -8,6 +8,7 @@ PNG rendering never crashes on OS-specific font paths. from __future__ import annotations import functools +import os from pathlib import Path from typing import Any @@ -109,6 +110,28 @@ def _reportlab_vera_fallback(filename: str) -> Path | None: return None +@functools.lru_cache(maxsize=1) +def _system_font_index() -> dict[str, Path]: + """ + Walk `/usr/share/fonts` at most once per process and build a filename -> Path map. + """ + idx: dict[str, Path] = {} + sys_fonts = Path("/usr/share/fonts") + if not sys_fonts.is_dir(): + return idx + try: + for root, _, files in os.walk(sys_fonts): + root_p = Path(root) + for fn in files: + if fn not in idx: + cand = root_p / fn + if cand.is_file(): + idx[fn] = cand + except OSError: + pass + return idx + + @functools.lru_cache(maxsize=64) def resolve_font_path(filename: str, fallback_filename: str | None = None) -> Path | None: cand_direct = Path(filename) @@ -118,20 +141,16 @@ def resolve_font_path(filename: str, fallback_filename: str | None = None) -> Pa cand = d / filename if cand.is_file(): return cand - sys_fonts = Path("/usr/share/fonts") - if sys_fonts.is_dir(): - for match in sys_fonts.rglob(filename): - if match.is_file(): - return match + sys_idx = _system_font_index() + if filename in sys_idx: + return sys_idx[filename] if fallback_filename: for d in FONT_SEARCH_DIRS: cand = d / fallback_filename if cand.is_file(): return cand - if sys_fonts.is_dir(): - for match in sys_fonts.rglob(fallback_filename): - if match.is_file(): - return match + if fallback_filename in sys_idx: + return sys_idx[fallback_filename] return _reportlab_vera_fallback(filename) @@ -146,3 +165,129 @@ def load_pillow_font(filename: str, size: int) -> Any: return ImageFont.load_default(size=size) except TypeError: return ImageFont.load_default() + + +def fit_pillow_text_to_width( + draw: Any, + text: str, + max_width: int, + *, + preferred_size: int = 12, + min_size: int = 8, + bold: bool = False, + font_filename: str | None = None, +) -> tuple[Any, int, int]: + """ + Step down a monospace/TrueType font size ladder from `preferred_size` down to `min_size` + until `text` fits within `max_width` pixels with zero mid-word `[:N]` string slicing. + Returns `(font, text_width, text_height)`. + """ + font_file = font_filename or ("DejaVuSansMono-Bold.ttf" if bold else "DejaVuSansMono.ttf") + for sz in range(preferred_size, min_size - 1, -1): + f = load_pillow_font(font_file, sz) + tb = draw.textbbox((0, 0), text, font=f) + w = int(tb[2] - tb[0]) + h = int(tb[3] - tb[1]) + if w <= max_width: + return f, w, h + f = load_pillow_font(font_file, min_size) + tb = draw.textbbox((0, 0), text, font=f) + return f, int(tb[2] - tb[0]), int(tb[3] - tb[1]) + + +def draw_bounded_box_text( + draw: Any, + box: tuple[int, int, int, int], + text: str, + fill: tuple[int, int, int], + *, + pad_x: int = 6, + align: str = "left", + preferred_size: int = 12, + min_size: int = 8, + bold: bool = False, + y_pos: int | None = None, + font_filename: str | None = None, +) -> tuple[int, int, int, int]: + """ + Render `text` strictly inside `box` (`(bx1, by1, bx2, by2)`) with horizontal padding `pad_x`, + dynamic font-ladder fitting, and zero mid-word slicing. Returns the rendered `(tx1, ty1, tx2, ty2)` bbox. + """ + bx1, by1, bx2, by2 = box + avail_w = max(16, (bx2 - bx1) - 2 * pad_x) + f, tw, th = fit_pillow_text_to_width( + draw, + text, + avail_w, + preferred_size=preferred_size, + min_size=min_size, + bold=bold, + font_filename=font_filename, + ) + if align == "center": + tx = bx1 + max(pad_x, ((bx2 - bx1) - tw) // 2) + elif align == "right": + tx = max(bx1 + pad_x, bx2 - pad_x - tw) + else: + tx = bx1 + pad_x + ty = y_pos if y_pos is not None else (by1 + max(2, ((by2 - by1) - th) // 2 - 1)) + draw.text((tx, ty), text, font=f, fill=fill) + if hasattr(draw, "texts") and draw.texts: + return draw.texts[-1][2] + tb = draw.textbbox((tx, ty), text, font=f) + return (int(tb[0]), int(tb[1]), int(tb[2]), int(tb[3])) + + +def draw_bounded_kv_row( + draw: Any, + box: tuple[int, int, int, int], + key_text: str, + val_text: str, + *, + fill_bg: tuple[int, int, int] = GROUP3_PALETTE["BG_ODD"], + outline: tuple[int, int, int] = GROUP3_PALETTE["BORDER_MUTED"], + key_fill: tuple[int, int, int] = (245, 198, 48), + val_fill: tuple[int, int, int] = GROUP3_PALETTE["TXT_PRI"], + key_size: int = 11, + val_size: int = 11, + val_bold: bool = False, + min_val_x: int | None = None, +) -> None: + """ + Render a bounded key-value row container inside `box` (`(bx1, by1, bx2, by2)`) with + dynamic font-ladder fitting and guaranteed non-overlapping key and value bounding boxes. + """ + bx1, by1, bx2, by2 = box + draw.rectangle([bx1, by1, bx2, by2], fill=fill_bg, outline=outline) + total_inner = (bx2 - bx1) - 16 + kf, kw, kh = fit_pillow_text_to_width( + draw, + key_text, + max(40, int(total_inner * 0.52)), + preferred_size=key_size, + min_size=8, + bold=True, + ) + ky = by1 + max(2, ((by2 - by1) - kh) // 2 - 1) + kx = bx1 + 8 + draw.text((kx, ky), key_text, font=kf, fill=key_fill) + if hasattr(draw, "texts") and draw.texts: + key_tb = draw.texts[-1][2] + else: + tb = draw.textbbox((kx, ky), key_text, font=kf) + key_tb = (int(tb[0]), int(tb[1]), int(tb[2]), int(tb[3])) + + vx_start = max(key_tb[2] + 8, min_val_x if min_val_x is not None else (key_tb[2] + 10)) + avail_val_w = max(24, (bx2 - 6) - vx_start) + vf, vw, vh = fit_pillow_text_to_width( + draw, + val_text, + avail_val_w, + preferred_size=val_size, + min_size=8, + bold=val_bold, + ) + if vx_start + vw > bx2 - 6: + vx_start = max(key_tb[2] + 6, (bx2 - 6) - vw) + vy = by1 + max(2, ((by2 - by1) - vh) // 2 - 1) + draw.text((vx_start, vy), val_text, font=vf, fill=val_fill) diff --git a/src/hyperstitionstud_io/publishing/math_docs.py b/src/hyperstitionstud_io/publishing/math_docs.py index bf4ddeb..3734548 100644 --- a/src/hyperstitionstud_io/publishing/math_docs.py +++ b/src/hyperstitionstud_io/publishing/math_docs.py @@ -3,7 +3,7 @@ hyperstitionstud_io.publishing.math_docs Introspective Mathematical Foundations & Quantitative Semiotics Explication Hub (`/math/` Unit M0) & Orthogonal Subpage Cartridge Compiler (`Units M1-M5`, `hs-math-docs`). -Reuses the Introspective Cartridge Architecture from `engineering_docs.py` with: +Reuses the Introspective Cartridge Architecture from `explication_template.py` / `engineering_docs.py` with: - Zero external KaTeX/MathJax CDNs (`100%` native ``/``/`` + DejaVu Sans Mono Unicode glyphs), - Embedded Novice Prerequisite Ladders (`.hs-prereq-ladder`) with curated free public math courses/textbooks, - Time-invariant algebraic conservation-law verification + live empirical constant introspection (`math-manifest.json`), @@ -12,9 +12,6 @@ Reuses the Introspective Cartridge Architecture from `engineering_docs.py` with: from __future__ import annotations -import argparse -import json -import shutil from pathlib import Path from typing import Any @@ -25,9 +22,19 @@ from hyperstitionstud_io.ciphers import ( compute_aq, compute_variance, ) -from hyperstitionstud_io.config import load_workspace_config -from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard +from hyperstitionstud_io.config import load_json_cached, load_workspace_config from hyperstitionstud_io.ipld import compute_dag_json_cidv1 +from hyperstitionstud_io.publishing.explication_template import ( + _render_global_nav_html, + _render_guile_repl_drawer_html, + _render_prereq_box_html, + render_explication_cartridge_html, + render_explication_hub_page_html, + render_explication_nav_html, + render_explication_subpage_html, + run_explication_cli_main, + write_explication_site_bundle, +) ALL_MATH_SUBPAGES: tuple[str, ...] = ( "base36-algebra-and-primes", @@ -99,13 +106,13 @@ MATH_GUILE_CARTRIDGES: dict[str, dict[str, str]] = { def _render_math_guile_cartridge_html(key: str) -> str: - from hyperstitionstud_io.publishing.engineering_docs import render_polyglot_cartridge_html - - return render_polyglot_cartridge_html( - MATH_GUILE_CARTRIDGES[key], + return render_explication_cartridge_html( + MATH_GUILE_CARTRIDGES, + key, spec_label="1. Mathematical Identity & Python:", ) + MATH_HUB_PREREQ_LADDER: dict[str, Any] = { "unit_id": "M0", "expertise_level": "Level 1-2 (High-School Algebra & Sigma Notation • 3-6 hrs study)", @@ -268,11 +275,11 @@ def introspect_math_manifest( workspace_root: str | Path | None = None, ) -> dict[str, Any]: cfg = load_workspace_config(workspace_root=workspace_root) - gl_obj = json.loads((cfg.zoology_dir / "taxonomy" / "glossary-registry.json").read_text(encoding="utf-8")) - kg_obj = json.loads((cfg.knowledge_graph_dir / "encyclopedia-graph.json").read_text(encoding="utf-8")) - ts_obj = json.loads((cfg.core_dir / "site" / "quant" / "quant-timeseries.json").read_text(encoding="utf-8")) - mac_obj = json.loads((cfg.core_dir / "site" / "quant" / "real-macro-indicators.json").read_text(encoding="utf-8")) - brf_obj = json.loads((cfg.core_dir / "site" / "quant" / "daily-brief-latest.json").read_text(encoding="utf-8")) + gl_obj = load_json_cached(cfg.zoology_dir / "taxonomy" / "glossary-registry.json", copy_result=False) + kg_obj = load_json_cached(cfg.knowledge_graph_dir / "encyclopedia-graph.json", copy_result=False) + ts_obj = load_json_cached(cfg.core_dir / "site" / "quant" / "quant-timeseries.json", copy_result=False) + mac_obj = load_json_cached(cfg.core_dir / "site" / "quant" / "real-macro-indicators.json", copy_result=False) + brf_obj = load_json_cached(cfg.core_dir / "site" / "quant" / "daily-brief-latest.json", copy_result=False) # Verify algebraic invariants dynamically eti_weights = [0.20, 0.18, 0.18, 0.16, 0.14, 0.14] @@ -328,36 +335,16 @@ def introspect_math_manifest( def _render_math_nav_html(active_slug: str | None, enabled_subpages: list[str], rel_prefix: str) -> str: - links = [ - f'Math Hub (M0)', - ] - direct_pages = enabled_subpages[:6] - overflow_pages = enabled_subpages[6:] - for s in direct_pages: - spec = MATH_SUBPAGE_SPECS[s] - is_act = (s == active_slug) - href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if not is_act else "index.html") - style = "border-color:var(--gold);color:var(--gold);" if is_act else "" - links.append(f'{spec["short_title"]}') - if overflow_pages: - opts = [''] - for s in overflow_pages: - spec = MATH_SUBPAGE_SPECS[s] - href = f"{s}/index.html" if active_slug is None else (f"../{s}/index.html" if s != active_slug else "index.html") - opts.append(f'') - links.append(f'') - from hyperstitionstud_io.publishing.engineering_docs import _render_polyglot_selector_html - - unit_links_html = "\n ".join(links) - return ( - f'\n' - f' {_render_polyglot_selector_html()}' + return render_explication_nav_html( + hub_label="Math Hub (M0)", + active_slug=active_slug, + enabled_subpages=enabled_subpages, + specs=MATH_SUBPAGE_SPECS, + rel_prefix=rel_prefix, ) def _render_math_prereq_html(level_str: str, prereqs: list[str], resources: list[dict[str, Any]], rel_prefix: str) -> str: - from hyperstitionstud_io.publishing.engineering_docs import _render_prereq_box_html - return _render_prereq_box_html( level_str=level_str, prereqs=prereqs, @@ -369,11 +356,6 @@ def _render_math_prereq_html(level_str: str, prereqs: list[str], resources: list def _render_math_hub_html(manifest: dict[str, Any], include_guile_lens: bool = True) -> str: - from hyperstitionstud_io.publishing.engineering_docs import ( - _render_global_nav_html, - _render_guile_repl_drawer_html, - ) - enabled = manifest["enabled_subpages"] inv = manifest["algebraic_invariants"] emp = manifest["empirical_counts"] @@ -392,101 +374,43 @@ def _render_math_hub_html(manifest: dict[str, Any], include_guile_lens: bool = T guile_hub_html = _render_math_guile_cartridge_html("M0") if include_guile_lens else "" guile_drawer_html = _render_guile_repl_drawer_html("") if include_guile_lens else "" - cards_html = "" - sigil_map = { - "M1": "☿", - "M2": "∆ ◈", - "M3": "☉", - "M4": "♄ ☍", - "M5": "⊗ λ", - } - for s in enabled: - sp = MATH_SUBPAGE_SPECS[s] - sig = sigil_map.get(sp["unit_id"], "λ") - cards_html += ( - f'' - ) + stat_tiles_html = ( + f'
    ETI Convex Sum (∑w_k)
    {inv["eti_weights_sum"]:.2f}
    \n' + f'
    Bayesian Simplex (∑P_m)
    {inv["bayesian_posterior_simplex_sum"]:.4f}
    \n' + f'
    292 G1 Collapse (σ²_0 → σ²_1)
    {inv["cluster_292_gen0_variance"]} → {inv["cluster_292_gen1_variance"]}
    \n' + f'
    G4 Fixed Points (Δ=0)
    {inv["g4_isometric_fixed_point_count"]}
    \n' + f'
    Real Bars / FRED Series
    {emp["total_real_bars_n"]} / {emp["fred_macro_series_n"]}
    ' + ) - return f""" - - - - - Mathematical Foundations & Quantitative Semiotics Hub — hyperstitionstud.io/math (v{CURRENT_VERSION}) - - - - -
    -
    -
    -
    - -

    HYPERSTITION STUDIO // MATHEMATICAL FOUNDATIONS & QUANTITATIVE SEMIOTICS HUB (UNIT M0)

    -
    -

    Zero-CDN Native Unicode Math • Commutative Empirical Introspection • Piecewise & Non-Sequentially Revertible • urn:io:hyperstitionstud:math:v{CURRENT_VERSION}

    -
    - -
    - - - - {prereq_html} - {guile_hub_html} - -
    -
    ETI Convex Sum (∑w_k)
    {inv["eti_weights_sum"]:.2f}
    -
    Bayesian Simplex (∑P_m)
    {inv["bayesian_posterior_simplex_sum"]:.4f}
    -
    292 G1 Collapse (σ²_0 → σ²_1)
    {inv["cluster_292_gen0_variance"]} → {inv["cluster_292_gen1_variance"]}
    -
    G4 Fixed Points (Δ=0)
    {inv["g4_isometric_fixed_point_count"]}
    -
    Real Bars / FRED Series
    {emp["total_real_bars_n"]} / {emp["fred_macro_series_n"]}
    -
    - -
    - {cards_html} -
    - -
    - hyperstitionstud.io/math v{CURRENT_VERSION} • CIDv1: {manifest["ipld_dag_json_cidv1"]["/"][:36]}... • • Made with ♥ by Lemurs. -
    -
    - - - - {guile_drawer_html} - - -""" + return render_explication_hub_page_html( + surface_slug="math", + page_title=f"Mathematical Foundations & Quantitative Semiotics Hub — hyperstitionstud.io/math (v{CURRENT_VERSION})", + header_h1="HYPERSTITION STUDIO // MATHEMATICAL FOUNDATIONS & QUANTITATIVE SEMIOTICS HUB (UNIT M0)", + header_subtitle_html=f'Zero-CDN Native Unicode Math • Commutative Empirical Introspection • Piecewise & Non-Sequentially Revertible • urn:io:hyperstitionstud:math:v{CURRENT_VERSION} ', + global_nav_html=global_nav_html, + subnav_html=subnav_html, + prereq_html=prereq_html, + guile_hub_html=guile_hub_html, + guile_drawer_html=guile_drawer_html, + stat_tiles_html=stat_tiles_html, + enabled_subpages=enabled, + specs=MATH_SUBPAGE_SPECS, + sigil_map={ + "M1": "☿", + "M2": "∆ ◈", + "M3": "☉", + "M4": "♄ ☍", + "M5": "⊗ λ", + }, + default_sigil="λ", + cidv1_prefix=manifest["ipld_dag_json_cidv1"]["/"][:36], + manifest_js_filename="math-manifest-data.js", + app_js_filename="math-app.js", + stats_min_col_px=175, + ) def _render_math_subpage_html(slug: str, manifest: dict[str, Any], include_guile_lens: bool = True) -> str: - from hyperstitionstud_io.publishing.engineering_docs import ( - _render_global_nav_html, - _render_guile_repl_drawer_html, - ) - enabled = manifest["enabled_subpages"] spec = MATH_SUBPAGE_SPECS[slug] global_nav_html = _render_global_nav_html("../", "math") @@ -495,78 +419,21 @@ def _render_math_subpage_html(slug: str, manifest: dict[str, Any], include_guile guile_sub_html = _render_math_guile_cartridge_html(slug) if include_guile_lens else "" guile_drawer_html = _render_guile_repl_drawer_html("../") if include_guile_lens else "" - idx = enabled.index(slug) - prev_link = f'← Prev: {MATH_SUBPAGE_SPECS[enabled[idx - 1]]["short_title"]}' if idx > 0 else '← Back to Math Hub (M0)' - next_link = f'Next: {MATH_SUBPAGE_SPECS[enabled[idx + 1]]["short_title"]} →' if idx + 1 < len(enabled) else 'Return to Math Hub (M0) ↑' - - secs_html = "" - for sec in spec["sections"]: - secs_html += ( - '
    ' - f'

    {sec["heading"]}

    ' - f'

    {sec["body"]}

    ' - '
    ' - ) - - return f""" - - - - - {spec["title"]} — hyperstitionstud.io/math (v{CURRENT_VERSION}) - - - - -
    -
    -
    -
    - -

    {spec["title"]}

    -
    -

    Cartridge {spec["unit_id"]} • Non-Sequentially Revertible via hs-math-docs --disable {slug} • v{CURRENT_VERSION}

    -
    - -
    - - - - {prereq_html} - {guile_sub_html} - {secs_html} - -
    - {prev_link} - {next_link} -
    - -
    - hyperstitionstud.io/math/{slug} v{CURRENT_VERSION} • • Made with ♥ by Lemurs. -
    -
    - - - - {guile_drawer_html} - - -""" + return render_explication_subpage_html( + slug=slug, + surface_slug="math", + hub_label="Math Hub (M0)", + cli_prog="hs-math-docs", + manifest=manifest, + specs=MATH_SUBPAGE_SPECS, + global_nav_html=global_nav_html, + subnav_html=subnav_html, + prereq_html=prereq_html, + guile_sub_html=guile_sub_html, + guile_drawer_html=guile_drawer_html, + manifest_js_filename="math-manifest-data.js", + app_js_filename="math-app.js", + ) def build_math_site( @@ -576,74 +443,37 @@ def build_math_site( include_guile_lens: bool = ENABLE_GUILE_SCHEME_LENS, workspace_root: str | Path | None = None, ) -> dict[str, Any]: - cfg = load_workspace_config(workspace_root=workspace_root) - target_dir = Path(out_dir).resolve() if out_dir else (cfg.core_dir / "site" / "math").resolve() - - with ReadOnlyIsolationGuard(cfg.read_only_files) as guard: - if disable_all: - if target_dir.is_dir(): - shutil.rmtree(target_dir) - return {"ok": True, "disabled_all": True, "enabled_routes": []} - - target_dir.mkdir(parents=True, exist_ok=True) - active_tuple = tuple(s for s in ALL_MATH_SUBPAGES if s in enabled_subpages) - manifest = introspect_math_manifest(enabled_subpages=active_tuple, workspace_root=workspace_root) - - (target_dir / "math-manifest.json").write_text(json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") - (target_dir / "math-manifest-data.js").write_text( - "window.HYPERSTITION_MATH_MANIFEST = " + json.dumps(manifest, ensure_ascii=False) + ";\n", - encoding="utf-8", - ) - (target_dir / "math-app.js").write_text("(function(){ 'use strict'; })();\n", encoding="utf-8") - (target_dir / "index.html").write_text(_render_math_hub_html(manifest, include_guile_lens=include_guile_lens), encoding="utf-8") - - for s in ALL_MATH_SUBPAGES: - sub_d = target_dir / s - if s in active_tuple: - sub_d.mkdir(parents=True, exist_ok=True) - (sub_d / "index.html").write_text(_render_math_subpage_html(s, manifest, include_guile_lens=include_guile_lens), encoding="utf-8") - elif sub_d.is_dir(): - shutil.rmtree(sub_d) - - return { - "ok": True, - "version": CURRENT_VERSION, - "output_dir": str(target_dir), - "guile_scheme_lens_enabled": include_guile_lens, - "enabled_subpages": list(active_tuple), - "enabled_routes": manifest["enabled_routes"], - "cidv1": manifest["ipld_dag_json_cidv1"]["/"], - "isolation_receipt": guard.audit_receipt(), - } + return write_explication_site_bundle( + surface_slug="math", + all_subpages=ALL_MATH_SUBPAGES, + enabled_subpages=enabled_subpages, + out_dir=out_dir, + disable_all=disable_all, + include_guile_lens=include_guile_lens, + workspace_root=workspace_root, + introspect_fn=introspect_math_manifest, + render_hub_fn=_render_math_hub_html, + render_subpage_fn=_render_math_subpage_html, + manifest_json_filename="math-manifest.json", + manifest_js_filename="math-manifest-data.js", + manifest_window_var="HYPERSTITION_MATH_MANIFEST", + app_js_filename="math-app.js", + app_js_source="(function(){ 'use strict'; })();\n", + ) def main(argv: list[str] | None = None) -> int: - ap = argparse.ArgumentParser(prog="hs-math-docs", description="Build or toggle the /math/ Hub & modular subpages (M0-M5).") - ap.add_argument("--sync", action="store_true") - ap.add_argument("--disable", default="", help="Comma-separated subpage slugs or unit IDs (e.g. M3) to disable.") - ap.add_argument("--only", default="", help="Comma-separated subpage slugs or unit IDs (e.g. M1,M4) to enable exclusively.") - ap.add_argument("--disable-all", action="store_true") - ap.add_argument("--disable-guile-lens", action="store_true", help="Omit additive Guile Scheme cartridges without touching M0-M5 content.") - ap.add_argument("--out-dir", default=None) - args = ap.parse_args(argv) - - unit_map = {spec["unit_id"].upper(): slug for slug, spec in MATH_SUBPAGE_SPECS.items()} - enabled = list(ALL_MATH_SUBPAGES) - if args.only: - req = {unit_map.get(x.strip().upper(), x.strip()) for x in args.only.split(",") if x.strip()} - enabled = [s for s in ALL_MATH_SUBPAGES if s in req] - if args.disable: - dis = {unit_map.get(x.strip().upper(), x.strip()) for x in args.disable.split(",") if x.strip()} - enabled = [s for s in enabled if s not in dis] - - res = build_math_site( - out_dir=args.out_dir, - enabled_subpages=tuple(enabled), - disable_all=args.disable_all, - include_guile_lens=not args.disable_guile_lens, + return run_explication_cli_main( + prog="hs-math-docs", + description="Build or toggle the /math/ Hub & modular subpages (M0-M5).", + all_subpages=ALL_MATH_SUBPAGES, + specs=MATH_SUBPAGE_SPECS, + build_fn=build_math_site, + argv=argv, + disable_help="Comma-separated subpage slugs or unit IDs (e.g. M3) to disable.", + only_help="Comma-separated subpage slugs or unit IDs (e.g. M1,M4) to enable exclusively.", + disable_guile_help="Omit additive Guile Scheme cartridges without touching M0-M5 content.", ) - print(json.dumps(res, indent=2)) - return 0 if __name__ == "__main__": diff --git a/src/hyperstitionstud_io/publishing/readme_sync.py b/src/hyperstitionstud_io/publishing/readme_sync.py index 69e6079..bd38e62 100644 --- a/src/hyperstitionstud_io/publishing/readme_sync.py +++ b/src/hyperstitionstud_io/publishing/readme_sync.py @@ -222,16 +222,20 @@ python3 hyperstitionstudio-core/tests/test_core_suite.py - `/` (Portal Home), `/learn/` (6-Module Interactive Track), `/quant/` (3-Pane Closing-Bell & FRED Macro Time-Series + 25-Scene Guided Tour), `/engineering/` (`E0-E5` Software Engineering Hub), `/math/` (`M0-M5` Applied Mathematics Hub), and `/donate/` (Signal Patronage). 4. **4,943-Entry Offline `CMUdict` Phonetics Lookup (`cmudict_fallback.json`):** - Translates `Gen 0` English tokens to `Gen 1` Ingglish 100% offline with zero network calls. -5. **One-Shot `900×1260` Ticker Stats Cards (`.png` + `.json`) via CLI, Chatbot REST API & MCP:** +5. **One-Shot `900×1260` Ticker Stats Cards (`.png` + `.json`) via cURL, CLI, Chatbot REST API & MCP:** ```bash - # (a) Direct CLI entrypoint (writes /tmp/hyperstition-cards/NVDA-stats-card.{{png,json}}): + # (a) cURL quickstart (zero local dependencies; works against https://hyperstitionstud.io or http://127.0.0.1:8095): + curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false" -o /tmp/NVDA-stats-card.json + curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=true" | jq -r '.data.artifacts.png_base64' | base64 -d > /tmp/NVDA-stats-card.png + + # (b) Direct CLI entrypoint (writes /tmp/hyperstition-cards/NVDA-stats-card.{{png,json}}): hs-ticker-card --symbol NVDA --lens tierzoo_ecology --out-dir /tmp/hyperstition-cards - # (b) Chatbot OpenAPI 3.1 REST API client (GET or POST /api/v1/tools/hs_generate_ticker_stats_card): + # (c) Chatbot OpenAPI 3.1 REST API client (GET or POST /api/v1/tools/hs_generate_ticker_stats_card): curl -sS "https://hyperstitionstud.io/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA&lens=tierzoo_ecology&include_base64_png=false" | jq . curl -sS "https://hyperstitionstud.io/api/v1/zoology/pokedex/NVDA?include_card=true" | jq '.data.stats_card.card_identity' - # (c) MCP JSON-RPC 2.0 client (Streamable HTTP POST /mcp or hs-mcp --transport stdio): + # (d) MCP JSON-RPC 2.0 client (Streamable HTTP POST /mcp or hs-mcp --transport stdio): curl -sS -X POST "https://hyperstitionstud.io/mcp" -H "Content-Type: application/json" \\ -d '{{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{{"name":"hs_generate_ticker_stats_card","arguments":{{"symbol":"NVDA","lens":"tierzoo_ecology","include_base64_png":false}}}}}}' | jq . ``` @@ -589,9 +593,10 @@ def main(argv: list[str] | None = None) -> int: ap.add_argument("--install-hooks", action="store_true", help="Install idempotent .git/hooks/pre-commit and commit-msg hooks across all 6 repositories.") ap.add_argument("--hooks-only", action="store_true", help="Install git hooks without modifying tracked README.md files on disk.") ap.add_argument("--version", default=None, help="Override target semantic version.") + ap.add_argument("--workspace-root", default=None, help="Optional workspace root directory.") args = ap.parse_args(argv) - cfg = load_workspace_config() + cfg = load_workspace_config(workspace_root=args.workspace_root) root = cfg.workspace_root if args.hooks_only: diff --git a/src/hyperstitionstud_io/quant/collector.py b/src/hyperstitionstud_io/quant/collector.py index 336f419..2bbda1d 100755 --- a/src/hyperstitionstud_io/quant/collector.py +++ b/src/hyperstitionstud_io/quant/collector.py @@ -815,13 +815,13 @@ def main(argv: list[str] | None = None) -> int: ap.add_argument("--append-history", action="store_true", help="Merge newly fetched real exchange bars into site/quant/real-market-history.json.") ap.add_argument("--join-news", default=None, help="Optional path to news-aq-harvest-latest.json.") ap.add_argument("--write-dossier", default=None, help="Optional path to emit Markdown quant report.") - ap.add_argument("--out", default=None, help="Output JSON path (default: /financial-aq-harvest-latest.json).") + ap.add_argument("--out", default=None, help="Output JSON path (default: /site/quant/financial-aq-harvest-latest.json).") args = ap.parse_args(argv) cfg = load_workspace_config() if args.append_history: update_real_market_history_cache(allow_live_network=args.live) - out_path = Path(args.out) if args.out else (cfg.archive_dir / "financial-aq-harvest-latest.json") + out_path = Path(args.out) if args.out else (cfg.core_dir / "site" / "quant" / "financial-aq-harvest-latest.json") join_news = args.join_news or str(cfg.archive_dir / "news-aq-harvest-latest.json") payload = build_financial_quant_harvest( diff --git a/src/hyperstitionstud_io/quant/daily_brief.py b/src/hyperstitionstud_io/quant/daily_brief.py index 30e3c2b..eaa362b 100644 --- a/src/hyperstitionstud_io/quant/daily_brief.py +++ b/src/hyperstitionstud_io/quant/daily_brief.py @@ -148,16 +148,21 @@ def build_daily_portfolio_brief( ts_bundle = build_quant_timeseries_bundle(write_files=False) macro_bundle = build_macro_indicators_bundle(allow_live_network=allow_live_network, write_files=False) - state_path = cfg.archive_dir.parent / "daily-brief-state.json" + state_path = cfg.core_dir / "site" / "quant" / "daily-brief-state.json" + legacy_state_paths = ( + cfg.archive_dir / "daily-brief-state.json", + cfg.archive_dir.parent / "daily-brief-state.json", + ) out_json_path = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json" out_js_path = cfg.core_dir / "site" / "quant" / "daily-brief-data.js" with ReadOnlyIsolationGuard(cfg.read_only_files) as guard: - # Load extant prior state if present + # Load extant prior state if present (falling back to legacy path if needed) prior_state: dict[str, Any] = {} - if state_path.is_file(): + active_read_state_path = state_path if state_path.is_file() else next((p for p in legacy_state_paths if p.is_file()), state_path) + if active_read_state_path.is_file(): try: - prior_state = json.loads(state_path.read_text(encoding="utf-8")) + prior_state = json.loads(active_read_state_path.read_text(encoding="utf-8")) except Exception: prior_state = {} diff --git a/tests/test_core_suite.py b/tests/test_core_suite.py index 9b8cfdf..79c7e11 100644 --- a/tests/test_core_suite.py +++ b/tests/test_core_suite.py @@ -1324,6 +1324,15 @@ def test_ipld_quant_and_mcp_server() -> None: ): assert pkg_f.is_file(), f"Missing Fedora 41 packaging file {pkg_f}" assert "/dev/null" not in pkg_f.read_text(encoding="utf-8") + ci_prov_canonical = cfg.archive_dir / "ingglish-aq-archive" / "scripts" / "ci_provision_ingglish.py" + ci_prov_txt = ci_prov_canonical.read_text(encoding="utf-8") + assert 'Path("/workspace/ingglish-hyperdope-gematria/ONBOARDING-INGGLISH-AQ.md")' not in ci_prov_txt + assert "_resolve_archive_repo_dir(" in ci_prov_txt + for ci_prov_mirror in ( + cfg.archive_dir / "packaging" / "bundle" / "scripts" / "ci_provision_ingglish.py", + cfg.archive_dir / "packaging" / "bundle" / "skills" / "hyperdope-ingglish-ci" / "scripts" / "ci_provision_ingglish.py", + ): + assert ci_prov_mirror.read_text(encoding="utf-8") == ci_prov_txt, f"Out-of-sync ci_provision_ingglish.py mirror: {ci_prov_mirror}" # Verify Plan #58: Pre-Commit Preparation & Gates D1-D8 for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh from hyperstitionstud_io.ci.deploy_scripts_sync import prepare_and_verify_deploy_scripts