feat(v2.0.8): implement ipld dag-json/CIDv1, quant financial collector, MCP server (hs-mcp), /learn/ sub-page, /gallery/ sub-page, and global Lemurs footer
This commit is contained in:
1 parent
b767f8a4e9
commit
c17f74097b
55 files changed
+3974
-10
No files matched your search
@@ -0,0 +1,748 @@
|
||||
/**
|
||||
* /workspace/hyperstitionstudio-core/site/learn/learn-app.js
|
||||
* Self-Paced 6-Module Interactive Onboarding Track & Anonymous Local State Engine (v2.0.0)
|
||||
* Supports:
|
||||
* - 6 interactive micro-sandboxes (M01..M06)
|
||||
* - Automatic localStorage checkpointing ("hs_learn_state_v2")
|
||||
* - State Download (.json) with canonical IPLD dag-json (0x0129) SHA-256 & CIDv1 ("baguqeera...")
|
||||
* - State Upload (.json) via file picker & drag-and-drop with Replace/Merge modes & zero-XSS rendering
|
||||
*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
const STORAGE_KEY = "hs_learn_state_v2";
|
||||
const SCHEMA_ID = "urn:io:hyperstitionstud:schema:v1:learn-progress-state";
|
||||
const VALID_MODULES = ["M01", "M02", "M03", "M04", "M05", "M06"];
|
||||
|
||||
const SAMPLE_VOCAB = {
|
||||
"asml": "asml",
|
||||
"asset": "aset",
|
||||
"tsmc": "tsmc",
|
||||
"loss": "laws",
|
||||
"gpu": "gpu",
|
||||
"capital": "kapatal",
|
||||
"capture": "kapcher",
|
||||
"folds": "fohldz",
|
||||
"charter": "charter",
|
||||
"portal": "portal",
|
||||
"knight": "nait",
|
||||
"night": "nait",
|
||||
"schizoanalysis": "shizohnalizis",
|
||||
"abstract machine": "abstrakt masheen",
|
||||
"synthetic data": "sinthetik dayta",
|
||||
"dario amodei": "daireeoh amodai",
|
||||
"anthropic": "anthropik",
|
||||
"flash crash": "flash krash",
|
||||
"blackwell": "blakwel",
|
||||
"russia": "ruhsha",
|
||||
"offline": "awflain",
|
||||
"nvidia": "envideea",
|
||||
"halts": "hawlts",
|
||||
"inertia": "inersha",
|
||||
"acceleration": "akselerayshan",
|
||||
"high-frequency": "hai-freekwansee",
|
||||
"sovereign wealth": "sovran welth",
|
||||
"technocapital": "teknohkapital",
|
||||
"killer robots": "kiler rohbots"
|
||||
};
|
||||
|
||||
const TRIAD_DATA = {
|
||||
"292": {
|
||||
label: "292 Triad (S1 Autoregressive AI × S6 Asset Management)",
|
||||
items: [
|
||||
{ eng: "schizoanalysis", eng_aq: 306, ing: "shizohnalizis", ing_aq: 292 },
|
||||
{ eng: "abstract machine", eng_aq: 272, ing: "abstrakt masheen", ing_aq: 292 },
|
||||
{ eng: "synthetic data", eng_aq: 266, ing: "sinthetik dayta", ing_aq: 292 }
|
||||
],
|
||||
gen0_var: 310.22,
|
||||
gen1_var: 0.0
|
||||
},
|
||||
"256": {
|
||||
label: "256 Triad (2^8 Byte Lock: S2 High-Frequency × S6 Sovereign Wealth)",
|
||||
items: [
|
||||
{ eng: "acceleration", eng_aq: 222, ing: "akselerayshan", ing_aq: 256 },
|
||||
{ eng: "high-frequency", eng_aq: 256, ing: "hai-freekwansee", ing_aq: 256 },
|
||||
{ eng: "sovereign wealth", eng_aq: 314, ing: "sovran welth", ing_aq: 256 }
|
||||
],
|
||||
gen0_var: 1442.67,
|
||||
gen1_var: 0.0
|
||||
},
|
||||
"125": {
|
||||
label: "125 Triad (5^3 Cube Lock: S6 Apparatus of Capture × S2 Folds)",
|
||||
items: [
|
||||
{ eng: "capital", eng_aq: 125, ing: "kapatal", ing_aq: 125 },
|
||||
{ eng: "capture", eng_aq: 137, ing: "kapcher", ing_aq: 125 },
|
||||
{ eng: "folds", eng_aq: 101, ing: "fohldz", ing_aq: 125 }
|
||||
],
|
||||
gen0_var: 221.33,
|
||||
gen1_var: 0.0
|
||||
}
|
||||
};
|
||||
|
||||
const ETI_BUILDS = {
|
||||
"S1": { rank: "#1", tier: "S+", eti: 93, title: "S1×S6×M4 Autoregressive AI Syndicate", stats: [85, 92, 96, 98, 88, 95], bridges: "292 (S1/S6), 193 (S1/S2), 137 (S1/S3/M1), 133 (S1/S6)" },
|
||||
"S2": { rank: "#2", tier: "S+", eti: 90, title: "S2×S6×M2 Flash-Crash Templex Swarm", stats: [82, 95, 94, 92, 84, 90], bridges: "256 (S2/S6), 193 (S2/S1), 183 (S2/S6/M1), 125 (S2/S6)" },
|
||||
"S6": { rank: "#3", tier: "S", eti: 87, title: "S6×S1-S3 Apparatus of Capture Guild", stats: [94, 80, 86, 96, 82, 88], bridges: "292 (S6/S1), 256 (S6/S2), 153 (S6/S2/M1), 125 (S6/S2), 81/91 (S6/S3)" },
|
||||
"S3": { rank: "#4", tier: "S", eti: 83, title: "S3×S6×M3 Silicon-Photonic War Machine", stats: [96, 78, 84, 82, 86, 80], bridges: "211 (S3/S2/Q0), 137 (S3/S1/M1), 129 (S3/M7+), 91 (TSMC), 81 (ASML)" },
|
||||
"M1": { rank: "#5", tier: "A", eti: 73, title: "M1×S6 Vampiric Entropic Stagnation Lock", stats: [78, 72, 70, 76, 74, 72], bridges: "183, 153, 137 (hawlts/envideea), 136 (slohth/charter), 133" },
|
||||
"M7+": { rank: "#8B", tier: "C", eti: 53, title: "M7_candidate_2026_11_28 Cyber-Swarm Stub", stats: [78, 88, 82, 68, 74, 64], bridges: "129 (awflain/ruhsha/blakwel), 125 (dounz/kapatal/kapcher)" },
|
||||
"Q0": { rank: "#9", tier: "D", eti: 49, title: "Q-Stub Episodic Quantitative Anchor (D Periphery)", stats: [52, 64, 48, 38, 54, 46], bridges: "211 (siks bilyan == wor masheen == koper waier)" }
|
||||
};
|
||||
|
||||
const REGISTER_VIEWS = {
|
||||
"academic": {
|
||||
label: "Landian-Deleuzean & Base-36 AQ Register",
|
||||
summary: "Focuses on pre-personal phase transitions, Vector G1 variance collapse (Gen 0 -> Gen 1), S[1-5]×S6 Double Articulation, and G4 Isometric Chokepoints (Δ = 0).",
|
||||
statNames: ["ARM (Isometric Armor)", "VEL (Teleoplexic Velocity)", "COL (G1 Variance Collapse)", "CAP (Trophic Capture)", "PRM (Twin-Prime IQ)", "RES (State-Gate Resilience)"],
|
||||
sampleLock: "shizohnalizis (292) == abstrakt masheen (292) == sinthetik dayta (292) [Gen 0 Var: 310.22 -> 0.0]"
|
||||
},
|
||||
"fund_manager": {
|
||||
label: "Out-of-Sample Fund Manager ('Uncaptured Gem' Screen)",
|
||||
summary: "Strips philosophy jargon; screens Tier B/C themes with high Convergence Power (COL) & Signal Velocity (VEL) but low Institutional Coupling (CAP < 68) before mega-cap crowding.",
|
||||
statNames: ["Chokepoint Moat", "Signal Velocity", "Convergence Power", "Institutional Coupling", "Idiosyncratic Asymmetry", "Regime Robustness"],
|
||||
sampleLock: "synthetic data == asset management = 292 | high-frequency == acceleration == sovereign wealth = 256"
|
||||
},
|
||||
"corporate_board": {
|
||||
label: "Corporate Management Board (Supply-Chain Moat & Allocation)",
|
||||
summary: "Maps Isometric Chokepoints (ASML = 81 == asset, TSMC = 91 == loss, GPU = 71) and cross-unit reallocation triggers when quantitative anchors reprice.",
|
||||
statNames: ["Supply-Chain Moat", "Execution Agility", "Cross-Unit Synergy", "Balance-Sheet Integration", "Proprietary IP", "Stress-Test Resilience"],
|
||||
sampleLock: "capital == capture = 125 (5^3) | halts == inertia == Nvidia = 137 | ASML == asset = 81"
|
||||
},
|
||||
"fantasy_football": {
|
||||
label: "Fantasy Football Roster & Multi-Position Flex Engine",
|
||||
summary: "Treats #1 S1 as QB1, #2 S2 as RB1/WR1, #3 S6 as OL/GM, #4 S3 as Edge Rusher, and the 13 shared coordinates (125, 137, 193, 256, 292) as Multi-Position Flex pivots.",
|
||||
statNames: ["Pass Protection", "Breakaway Speed", "Stack Power", "Front-Office Cap Reach", "Playbook IQ", "All-Weather Durability"],
|
||||
sampleLock: "Flex Pivot 193: Dario Amodei [QB1] == anthropik == flash krash [RB1] (44th PRIME)"
|
||||
}
|
||||
};
|
||||
|
||||
function computeAQ(text) {
|
||||
let total = 0;
|
||||
const s = String(text || "").toLowerCase();
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const c = s.charCodeAt(i);
|
||||
if (c >= 48 && c <= 57) total += (c - 48);
|
||||
else if (c >= 97 && c <= 122) total += (c - 87);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
function charBreakdown(text) {
|
||||
const out = [];
|
||||
const s = String(text || "");
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const ch = s[i];
|
||||
const low = ch.toLowerCase();
|
||||
const c = low.charCodeAt(0);
|
||||
if (c >= 48 && c <= 57) out.push(`${ch}=${c - 48}`);
|
||||
else if (c >= 97 && c <= 122) out.push(`${ch.toUpperCase()}=${c - 87}`);
|
||||
}
|
||||
return out.join(" + ") || "0";
|
||||
}
|
||||
|
||||
function isPrime(n) {
|
||||
if (n < 2) return false;
|
||||
if (n === 2 || n === 3) return true;
|
||||
if (n % 2 === 0 || n % 3 === 0) return false;
|
||||
for (let k = 5; k * k <= n; k += 6) {
|
||||
if (n % k === 0 || n % (k + 2) === 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pure-JS deterministic SHA-256 (works on file://, http://, and https:// without crypto.subtle restrictions)
|
||||
function sha256Hex(ascii) {
|
||||
function rightRotate(value, amount) {
|
||||
return (value >>> amount) | (value << (32 - amount));
|
||||
}
|
||||
const mathPow = Math.pow;
|
||||
const maxWord = mathPow(2, 32);
|
||||
let result = "";
|
||||
const words = [];
|
||||
const utf8 = unescape(encodeURIComponent(ascii));
|
||||
const asciiBitLength = utf8.length * 8;
|
||||
let hash = [];
|
||||
const k = [];
|
||||
let primeCounter = 0;
|
||||
const isComposite = {};
|
||||
for (let candidate = 2; primeCounter < 64; candidate++) {
|
||||
if (!isComposite[candidate]) {
|
||||
for (let i = 0; i < 313; i += candidate) isComposite[i] = candidate;
|
||||
hash[primeCounter] = (mathPow(candidate, 0.5) * maxWord) | 0;
|
||||
k[primeCounter++] = (mathPow(candidate, 1 / 3) * maxWord) | 0;
|
||||
}
|
||||
}
|
||||
let str = utf8 + "\x80";
|
||||
while ((str.length % 64) - 56) str += "\x00";
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const j = str.charCodeAt(i);
|
||||
words[i >> 2] |= j << ((3 - (i % 4)) * 8);
|
||||
}
|
||||
words[words.length] = (asciiBitLength / maxWord) | 0;
|
||||
words[words.length] = asciiBitLength;
|
||||
for (let j = 0; j < words.length; ) {
|
||||
const w = words.slice(j, (j += 16));
|
||||
const oldHash = hash.slice(0);
|
||||
for (let i = 0; i < 64; i++) {
|
||||
const w15 = w[i - 15], w2 = w[i - 2];
|
||||
const a = hash[0], e = hash[4];
|
||||
const temp1 =
|
||||
hash[7] +
|
||||
(rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) +
|
||||
((e & hash[5]) ^ (~e & hash[6])) +
|
||||
k[i] +
|
||||
(w[i] =
|
||||
i < 16
|
||||
? w[i]
|
||||
: (w[i - 16] +
|
||||
(rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15 >>> 3)) +
|
||||
w[i - 7] +
|
||||
(rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2 >>> 10))) |
|
||||
0);
|
||||
const temp2 =
|
||||
(rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) +
|
||||
((a & hash[1]) ^ (a & hash[2]) ^ (hash[1] & hash[2]));
|
||||
hash = [(temp1 + temp2) | 0].concat(hash);
|
||||
hash[4] = (hash[4] + temp1) | 0;
|
||||
hash.pop();
|
||||
}
|
||||
for (let i = 0; i < 8; i++) hash[i] = (hash[i] + oldHash[i]) | 0;
|
||||
}
|
||||
for (let i = 0; i < 8; i++) {
|
||||
for (let j = 3; j + 1; j--) {
|
||||
const b = (hash[i] >> (j * 8)) & 255;
|
||||
result += (b < 16 ? 0 : "") + b.toString(16);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function hexToBase32Lower(hexStr) {
|
||||
const alphabet = "abcdefghijklmnopqrstuvwxyz234567";
|
||||
const bytes = [];
|
||||
for (let i = 0; i < hexStr.length; i += 2) {
|
||||
bytes.push(parseInt(hexStr.slice(i, i + 2), 16));
|
||||
}
|
||||
let bits = 0, value = 0, output = "";
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
value = (value << 8) | bytes[i];
|
||||
bits += 8;
|
||||
while (bits >= 5) {
|
||||
output += alphabet[(value >>> (bits - 5)) & 31];
|
||||
bits -= 5;
|
||||
}
|
||||
}
|
||||
if (bits > 0) {
|
||||
output += alphabet[(value << (5 - bits)) & 31];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function canonicalDagJsonString(obj) {
|
||||
if (obj === null || typeof obj !== "object") {
|
||||
return JSON.stringify(obj);
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return "[" + obj.map(canonicalDagJsonString).join(",") + "]";
|
||||
}
|
||||
const keys = Object.keys(obj).sort();
|
||||
return "{" + keys.map(k => JSON.stringify(k) + ":" + canonicalDagJsonString(obj[k])).join(",") + "}";
|
||||
}
|
||||
|
||||
function computeIntegrity(stateWithoutIntegrity) {
|
||||
const canon = canonicalDagJsonString(stateWithoutIntegrity);
|
||||
const sha = sha256Hex(canon);
|
||||
// CIDv1 prefix for dag-json (0x01 0xa9 0x02 0x12 0x20) = "01a9021220"
|
||||
const cid = "b" + hexToBase32Lower("01a9021220" + sha);
|
||||
return {
|
||||
canonical_codec: "dag-json (0x0129)",
|
||||
payload_sha256: sha,
|
||||
payload_cidv1: cid
|
||||
};
|
||||
}
|
||||
|
||||
function defaultState() {
|
||||
const base = {
|
||||
$schema: "../schemas/v1/learn-progress-state.schema.json",
|
||||
$id: SCHEMA_ID,
|
||||
version: "2.0.0",
|
||||
updated_at_utc: new Date().toISOString(),
|
||||
preferred_register: "fund_manager",
|
||||
completed_modules: [],
|
||||
bookmarked_coordinates: [125, 193, 292],
|
||||
user_notes: {
|
||||
M01: "",
|
||||
M02: "",
|
||||
M03: "",
|
||||
M04: "",
|
||||
M05: "",
|
||||
M06: ""
|
||||
}
|
||||
};
|
||||
base.integrity = computeIntegrity(base);
|
||||
return base;
|
||||
}
|
||||
|
||||
let memoryState = defaultState();
|
||||
|
||||
function loadState() {
|
||||
try {
|
||||
const raw = window.localStorage.getItem(STORAGE_KEY);
|
||||
if (raw) {
|
||||
const parsed = JSON.parse(raw);
|
||||
if (parsed && parsed.$id === SCHEMA_ID) {
|
||||
memoryState = sanitizeState(parsed);
|
||||
return memoryState;
|
||||
}
|
||||
}
|
||||
} catch (_e) {}
|
||||
return memoryState;
|
||||
}
|
||||
|
||||
function sanitizeState(raw) {
|
||||
const clean = defaultState();
|
||||
if (raw && typeof raw === "object") {
|
||||
if (typeof raw.preferred_register === "string" && REGISTER_VIEWS[raw.preferred_register]) {
|
||||
clean.preferred_register = raw.preferred_register;
|
||||
}
|
||||
if (Array.isArray(raw.completed_modules)) {
|
||||
clean.completed_modules = Array.from(
|
||||
new Set(raw.completed_modules.filter(m => VALID_MODULES.includes(String(m))))
|
||||
).sort();
|
||||
}
|
||||
if (Array.isArray(raw.bookmarked_coordinates)) {
|
||||
clean.bookmarked_coordinates = Array.from(
|
||||
new Set(
|
||||
raw.bookmarked_coordinates
|
||||
.map(n => parseInt(n, 10))
|
||||
.filter(n => !isNaN(n) && n >= 0 && n <= 9999)
|
||||
)
|
||||
).sort((a, b) => b - a);
|
||||
}
|
||||
if (raw.user_notes && typeof raw.user_notes === "object") {
|
||||
VALID_MODULES.forEach(m => {
|
||||
if (typeof raw.user_notes[m] === "string") {
|
||||
clean.user_notes[m] = raw.user_notes[m].slice(0, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
clean.updated_at_utc = new Date().toISOString();
|
||||
const copyNoInt = Object.assign({}, clean);
|
||||
delete copyNoInt.integrity;
|
||||
clean.integrity = computeIntegrity(copyNoInt);
|
||||
return clean;
|
||||
}
|
||||
|
||||
function saveState(newState, statusMsg) {
|
||||
const copyNoInt = Object.assign({}, newState);
|
||||
delete copyNoInt.integrity;
|
||||
copyNoInt.updated_at_utc = new Date().toISOString();
|
||||
newState.updated_at_utc = copyNoInt.updated_at_utc;
|
||||
newState.integrity = computeIntegrity(copyNoInt);
|
||||
memoryState = newState;
|
||||
try {
|
||||
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(memoryState));
|
||||
} catch (_e) {}
|
||||
renderAll(statusMsg);
|
||||
}
|
||||
|
||||
function markModuleComplete(modId, msg) {
|
||||
if (!VALID_MODULES.includes(modId)) return;
|
||||
if (!memoryState.completed_modules.includes(modId)) {
|
||||
memoryState.completed_modules.push(modId);
|
||||
memoryState.completed_modules.sort();
|
||||
}
|
||||
saveState(memoryState, msg || `Completed Module ${modId}`);
|
||||
}
|
||||
|
||||
function toggleModuleComplete(modId) {
|
||||
if (memoryState.completed_modules.includes(modId)) {
|
||||
memoryState.completed_modules = memoryState.completed_modules.filter(m => m !== modId);
|
||||
saveState(memoryState, `Unmarked ${modId}`);
|
||||
} else {
|
||||
markModuleComplete(modId);
|
||||
}
|
||||
}
|
||||
|
||||
function exportLearnState() {
|
||||
const jsonStr = JSON.stringify(memoryState, null, 2) + "\n";
|
||||
const blob = new Blob([jsonStr], { type: "application/json" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
const dateStr = new Date().toISOString().slice(0, 10);
|
||||
a.href = url;
|
||||
a.download = `hyperstition-learn-state-${dateStr}.json`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
setTimeout(() => URL.revokeObjectURL(url), 500);
|
||||
setStatus(`Downloaded state JSON (${memoryState.integrity.payload_cidv1.slice(0, 18)}...)`);
|
||||
}
|
||||
|
||||
function importLearnStateText(rawText, mode) {
|
||||
if (!rawText || rawText.length > 1048576) {
|
||||
setStatus("Import rejected: file empty or exceeds 1 MB limit.", true);
|
||||
return;
|
||||
}
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(rawText);
|
||||
} catch (e) {
|
||||
setStatus("Import rejected: invalid JSON syntax.", true);
|
||||
return;
|
||||
}
|
||||
if (!parsed || parsed.$id !== SCHEMA_ID) {
|
||||
setStatus(`Import rejected: $id must equal ${SCHEMA_ID}`, true);
|
||||
return;
|
||||
}
|
||||
const incoming = sanitizeState(parsed);
|
||||
if (mode === "merge") {
|
||||
const mergedMods = Array.from(new Set([...memoryState.completed_modules, ...incoming.completed_modules])).sort();
|
||||
const mergedCoords = Array.from(new Set([...memoryState.bookmarked_coordinates, ...incoming.bookmarked_coordinates])).sort((a, b) => b - a);
|
||||
const mergedNotes = Object.assign({}, memoryState.user_notes);
|
||||
VALID_MODULES.forEach(m => {
|
||||
if (incoming.user_notes[m]) mergedNotes[m] = incoming.user_notes[m];
|
||||
});
|
||||
memoryState.completed_modules = mergedMods;
|
||||
memoryState.bookmarked_coordinates = mergedCoords;
|
||||
memoryState.user_notes = mergedNotes;
|
||||
memoryState.preferred_register = incoming.preferred_register || memoryState.preferred_register;
|
||||
saveState(memoryState, `Merged uploaded state (${mergedMods.length}/6 modules complete)`);
|
||||
} else {
|
||||
saveState(incoming, `Loaded uploaded state (${incoming.completed_modules.length}/6 modules complete)`);
|
||||
}
|
||||
}
|
||||
|
||||
function loadDemoCompletedState() {
|
||||
const demo = defaultState();
|
||||
demo.completed_modules = ["M01", "M02", "M03", "M04", "M05", "M06"];
|
||||
demo.bookmarked_coordinates = [777, 666, 333, 292, 260, 256, 211, 193, 137, 129, 125, 91, 81];
|
||||
demo.preferred_register = "fund_manager";
|
||||
demo.user_notes = {
|
||||
M01: "Verified ASML (81 = 3^4) == asset (81) and TSMC (91) == loss (91).",
|
||||
M02: "Isometric fixed points (Δ=0): kapatal=125, charter=136, asml=81, tsmc=91, gpu=71.",
|
||||
M03: "292 Triad collapses Gen 0 variance 310.22 -> 0.0 in Gen 1 Ingglish.",
|
||||
M04: "Two-Gate state rule verified: 129 (awflain == ruhsha == blakwel) and 137 (hawlts == inersha == envideea).",
|
||||
M05: "S+ Center (88-100 ETI) radiates outward to Tier D Periphery (44-51 ETI).",
|
||||
M06: "Fund Manager Uncaptured Gem screen: high COL/VEL + low CAP (<68) in Tiers B & C."
|
||||
};
|
||||
saveState(demo, "Loaded 6/6 Demo Completed State — click 'Download State (.json)' to test export!");
|
||||
}
|
||||
|
||||
function resetLearnState() {
|
||||
try {
|
||||
window.localStorage.removeItem(STORAGE_KEY);
|
||||
} catch (_e) {}
|
||||
saveState(defaultState(), "Reset local state to 0/6 modules.");
|
||||
}
|
||||
|
||||
function setStatus(msg, isError) {
|
||||
const el = document.getElementById("stateStatusMsg");
|
||||
if (!el) return;
|
||||
el.textContent = msg;
|
||||
el.style.color = isError ? "#fb7185" : "#34d399";
|
||||
}
|
||||
|
||||
function renderAll(statusMsg) {
|
||||
const done = memoryState.completed_modules;
|
||||
const pct = Math.round((done.length / VALID_MODULES.length) * 100);
|
||||
const bar = document.getElementById("progressFill");
|
||||
if (bar) bar.style.width = `${pct}%`;
|
||||
const pText = document.getElementById("progressText");
|
||||
if (pText) pText.textContent = `${done.length} / 6 Modules Completed (${pct}%)`;
|
||||
const cidEl = document.getElementById("stateCidBadge");
|
||||
if (cidEl && memoryState.integrity) {
|
||||
cidEl.textContent = `dag-json CIDv1: ${memoryState.integrity.payload_cidv1.slice(0, 20)}...`;
|
||||
cidEl.title = `Full CIDv1: ${memoryState.integrity.payload_cidv1}\nSHA-256: ${memoryState.integrity.payload_sha256}`;
|
||||
}
|
||||
|
||||
VALID_MODULES.forEach(m => {
|
||||
const card = document.getElementById(`card-${m}`);
|
||||
const btn = document.getElementById(`chk-${m}`);
|
||||
const noteEl = document.getElementById(`note-${m}`);
|
||||
const isDone = done.includes(m);
|
||||
if (card) card.classList.toggle("completed", isDone);
|
||||
if (btn) {
|
||||
btn.textContent = isDone ? "✓ Completed (Click to Toggle)" : "Mark Module Complete";
|
||||
btn.classList.toggle("done", isDone);
|
||||
}
|
||||
if (noteEl && document.activeElement !== noteEl) {
|
||||
noteEl.value = memoryState.user_notes[m] || "";
|
||||
}
|
||||
});
|
||||
|
||||
const regSel = document.getElementById("m06RegisterSelect");
|
||||
if (regSel) regSel.value = memoryState.preferred_register;
|
||||
updateM06RegisterView(memoryState.preferred_register);
|
||||
|
||||
const bmWrap = document.getElementById("bookmarkedCoordsList");
|
||||
if (bmWrap) {
|
||||
bmWrap.innerHTML = "";
|
||||
memoryState.bookmarked_coordinates.forEach(c => {
|
||||
const pill = document.createElement("span");
|
||||
pill.className = "coord-pill";
|
||||
pill.textContent = `AQ ${c} ×`;
|
||||
pill.title = "Click to remove bookmark";
|
||||
pill.addEventListener("click", () => {
|
||||
memoryState.bookmarked_coordinates = memoryState.bookmarked_coordinates.filter(x => x !== c);
|
||||
saveState(memoryState, `Removed AQ ${c} from bookmarks`);
|
||||
});
|
||||
bmWrap.appendChild(pill);
|
||||
});
|
||||
}
|
||||
|
||||
if (statusMsg) setStatus(statusMsg, false);
|
||||
}
|
||||
|
||||
function updateM01Sandbox() {
|
||||
const aEl = document.getElementById("m01InputA");
|
||||
const bEl = document.getElementById("m01InputB");
|
||||
const outEl = document.getElementById("m01Output");
|
||||
if (!aEl || !bEl || !outEl) return;
|
||||
const a = aEl.value.trim() || "ASML";
|
||||
const b = bEl.value.trim() || "asset";
|
||||
const aqA = computeAQ(a);
|
||||
const aqB = computeAQ(b);
|
||||
const match = aqA === aqB && aqA > 0;
|
||||
outEl.textContent =
|
||||
`Term A: "${a}" -> ${charBreakdown(a)} = ${aqA}${isPrime(aqA) ? " [PRIME]" : ""}\n` +
|
||||
`Term B: "${b}" -> ${charBreakdown(b)} = ${aqB}${isPrime(aqB) ? " [PRIME]" : ""}\n` +
|
||||
(match ? `✓ EXACT BASE-36 COLLISION: "${a}" (${aqA}) == "${b}" (${aqB})!` : `Difference: Δ = ${aqB - aqA}`);
|
||||
if (match && !memoryState.completed_modules.includes("M01")) {
|
||||
markModuleComplete("M01", "M01 Checkpoint Solved: Verified Base-36 AQ collision!");
|
||||
}
|
||||
}
|
||||
|
||||
function updateM02Sandbox() {
|
||||
const sel = document.getElementById("m02WordSelect");
|
||||
const outEl = document.getElementById("m02Output");
|
||||
if (!sel || !outEl) return;
|
||||
const eng = sel.value;
|
||||
const ing = SAMPLE_VOCAB[eng.toLowerCase()] || eng.toLowerCase();
|
||||
const eAq = computeAQ(eng);
|
||||
const iAq = computeAQ(ing);
|
||||
const d = iAq - eAq;
|
||||
const iso = d === 0;
|
||||
outEl.textContent =
|
||||
`Gen 0 Written English: "${eng}" = ${eAq}${isPrime(eAq) ? " [PRIME]" : ""}\n` +
|
||||
`Gen 1 CMUdict Ingglish: "${ing}" = ${iAq}${isPrime(iAq) ? " [PRIME]" : ""}\n` +
|
||||
`Orthographic Drift (Δ = Gen 1 - Gen 0): ${d >= 0 ? "+" + d : d}\n` +
|
||||
(iso ? `★ G4 ISOMETRIC FIXED POINT (Δ = 0): Sound and spelling lock at ${iAq}!` : `Phonemic compression strips/shifts ${Math.abs(d)} AQ units.`);
|
||||
if (iso && !memoryState.completed_modules.includes("M02")) {
|
||||
markModuleComplete("M02", `M02 Checkpoint Solved: Inspected Δ=0 Isometric Chokepoint (${eng}=${iAq})!`);
|
||||
}
|
||||
}
|
||||
|
||||
function updateM03Sandbox() {
|
||||
const sel = document.getElementById("m03TriadSelect");
|
||||
const modeSel = document.getElementById("m03ModeSelect");
|
||||
const outEl = document.getElementById("m03Output");
|
||||
if (!sel || !modeSel || !outEl) return;
|
||||
const t = TRIAD_DATA[sel.value];
|
||||
const mode = modeSel.value;
|
||||
if (!t) return;
|
||||
const lines = [t.label];
|
||||
t.items.forEach(it => {
|
||||
if (mode === "gen0") {
|
||||
lines.push(` • Gen 0 Written: "${it.eng}" = ${it.eng_aq}`);
|
||||
} else {
|
||||
lines.push(` • Gen 1 Ingglish: "${it.ing}" ("${it.eng}") = ${it.ing_aq}`);
|
||||
}
|
||||
});
|
||||
if (mode === "gen0") {
|
||||
lines.push(`Gen 0 Dispersion Variance: ${t.gen0_var} (Scattered in written English)`);
|
||||
} else {
|
||||
lines.push(`★ Gen 1 Variance: 0.0 (Collapsed from ${t.gen0_var} -> 0.0 exact singularity!)`);
|
||||
if (!memoryState.completed_modules.includes("M03")) {
|
||||
markModuleComplete("M03", `M03 Checkpoint Solved: Collapsed Triad ${sel.value} to Gen 1 Variance = 0.0!`);
|
||||
}
|
||||
}
|
||||
outEl.textContent = lines.join("\n");
|
||||
}
|
||||
|
||||
function updateM04Sandbox() {
|
||||
const sel = document.getElementById("m04HeadlineSelect");
|
||||
const outEl = document.getElementById("m04Output");
|
||||
if (!sel || !outEl) return;
|
||||
const v = sel.value;
|
||||
if (v === "h129") {
|
||||
outEl.textContent =
|
||||
`Headline State: OUTAGE / OFFLINE INFRASTRUCTURE (Unlocks M1 / M7+ Cyber-Swarm)\n` +
|
||||
`Double Articulation: S3 Hardware (blakwel=129) × S6 Capture (dounz == kapatal == kapcher = 125)\n` +
|
||||
`Zero-Variance Lock: awflain (129) == ruhsha (129) == blakwel (129) [Gen 0: 141 / 145 / 182 -> Var 339.56 -> 0.0]`;
|
||||
if (!memoryState.completed_modules.includes("M04")) {
|
||||
markModuleComplete("M04", "M04 Checkpoint Solved: Verified State-Gated M7+ / S3×S6 lock!");
|
||||
}
|
||||
} else if (v === "h137") {
|
||||
outEl.textContent =
|
||||
`Headline State: HALTED PRODUCTION / STAGNATION (Unlocks M1 Vampiric / Entropic Lock)\n` +
|
||||
`Guild Coupling: M1 Stagnation (hawlts == inersha = 137) × S1/S3 Compute (envideea == daireeoh = 137 [33rd PRIME])\n` +
|
||||
`Zero-Variance Lock: hawlts (137) == inersha (137) == envideea (137) == daireeoh (137)`;
|
||||
if (!memoryState.completed_modules.includes("M04")) {
|
||||
markModuleComplete("M04", "M04 Checkpoint Solved: Verified State-Gated M1×S3 137 lock!");
|
||||
}
|
||||
} else {
|
||||
outEl.textContent =
|
||||
`Headline State: FLASH-CRASH / HIGH-FREQUENCY LIQUIDITY SURGE (Unlocks M2 Templex Swarm)\n` +
|
||||
`Double-Script Twin: flash crash (185) == Anthropic (185) in Gen 0 -> flash krash (193) == anthropik (193) in Gen 1\n` +
|
||||
`S2 × S6 Capture Bridge: akselerayshan (256) == hai-freekwansee (256) == sovran welth (256 = 2^8)`;
|
||||
if (!memoryState.completed_modules.includes("M04")) {
|
||||
markModuleComplete("M04", "M04 Checkpoint Solved: Verified State-Gated M2×S2 193/256 lock!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateM05Sandbox() {
|
||||
const sel = document.getElementById("m05BuildSelect");
|
||||
const outEl = document.getElementById("m05Output");
|
||||
if (!sel || !outEl) return;
|
||||
const b = ETI_BUILDS[sel.value];
|
||||
if (!b) return;
|
||||
const rPx = Math.round(475 * (1 - (b.eti - 40) / 65));
|
||||
outEl.textContent =
|
||||
`${b.rank} ${b.title} — Tier ${b.tier} (${b.eti} ETI)\n` +
|
||||
`Concentric Radar Ring Position: R(ETI) ≈ ${rPx} px (${b.tier === "S+" ? "Inner Bullseye Core" : (b.tier === "D" ? "Outer D Periphery Ring" : "Mid-Trophic Ring")})\n` +
|
||||
`6 Base Stats [ARM, VEL, COL, CAP, PRM, RES]: [${b.stats.join(", ")}]\n` +
|
||||
`Multi-Build Flex Bridges: ${b.bridges}`;
|
||||
if (!memoryState.completed_modules.includes("M05")) {
|
||||
markModuleComplete("M05", `M05 Checkpoint Solved: Inspected ${b.rank} (${b.eti} ETI) on the Concentric Radar!`);
|
||||
}
|
||||
}
|
||||
|
||||
function updateM06RegisterView(regKey) {
|
||||
const rv = REGISTER_VIEWS[regKey] || REGISTER_VIEWS.fund_manager;
|
||||
const outEl = document.getElementById("m06Output");
|
||||
if (!outEl) return;
|
||||
outEl.textContent =
|
||||
`Active Register: ${rv.label}\n` +
|
||||
`Methodology: ${rv.summary}\n` +
|
||||
`Translated 6-Stat Labels: ${rv.statNames.join(" | ")}\n` +
|
||||
`Exemplar Register Lock: ${rv.sampleLock}`;
|
||||
}
|
||||
|
||||
function adaptFileProtocolLinks() {
|
||||
if (window.location.protocol !== "file:") return;
|
||||
const map = {
|
||||
"nav-home": "../index.html",
|
||||
"nav-gallery": "../gallery/index.html",
|
||||
"nav-graph": "../../../encyclopedia-knowledge-graph/index.html",
|
||||
"nav-calc": "../../../haiperdohp-jemaytreeah/index.html",
|
||||
"m01-link": "../../../haiperdohp-jemaytreeah/index.html",
|
||||
"m02-link": "../../../hyperdope-ci-build/ONBOARDING-INGGLISH-AQ.pdf",
|
||||
"m03-link": "../../../encyclopedia-knowledge-graph/index.html",
|
||||
"m04-link": "../../../technocapital-singularity-zoology/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf",
|
||||
"m05-link": "../../../technocapital-singularity-zoology/tier-list-technocapital-assemblage-builds.pdf",
|
||||
"m06-link": "../../../technocapital-singularity-zoology/proposal-fund-manager-novel-investment-discovery.pdf"
|
||||
};
|
||||
document.querySelectorAll("[data-learn-route]").forEach(a => {
|
||||
const k = a.getAttribute("data-learn-route");
|
||||
if (map[k]) a.setAttribute("href", map[k]);
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
adaptFileProtocolLinks();
|
||||
loadState();
|
||||
|
||||
VALID_MODULES.forEach(m => {
|
||||
const btn = document.getElementById(`chk-${m}`);
|
||||
if (btn) btn.addEventListener("click", () => toggleModuleComplete(m));
|
||||
const noteEl = document.getElementById(`note-${m}`);
|
||||
if (noteEl) {
|
||||
noteEl.addEventListener("input", e => {
|
||||
memoryState.user_notes[m] = e.target.value.slice(0, 2000);
|
||||
saveState(memoryState);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const dlBtn = document.getElementById("btnDownloadState");
|
||||
if (dlBtn) dlBtn.addEventListener("click", exportLearnState);
|
||||
|
||||
const fileIn = document.getElementById("inputUploadState");
|
||||
const upBtn = document.getElementById("btnUploadState");
|
||||
if (upBtn && fileIn) {
|
||||
upBtn.addEventListener("click", () => fileIn.click());
|
||||
fileIn.addEventListener("change", e => {
|
||||
const f = e.target.files && e.target.files[0];
|
||||
if (!f) return;
|
||||
const modeEl = document.getElementById("importModeSelect");
|
||||
const mode = modeEl ? modeEl.value : "replace";
|
||||
f.text().then(txt => importLearnStateText(txt, mode));
|
||||
fileIn.value = "";
|
||||
});
|
||||
}
|
||||
|
||||
const dropZone = document.getElementById("statePortabilityBar");
|
||||
if (dropZone) {
|
||||
dropZone.addEventListener("dragover", e => {
|
||||
e.preventDefault();
|
||||
dropZone.classList.add("drag-over");
|
||||
});
|
||||
dropZone.addEventListener("dragleave", () => dropZone.classList.remove("drag-over"));
|
||||
dropZone.addEventListener("drop", e => {
|
||||
e.preventDefault();
|
||||
dropZone.classList.remove("drag-over");
|
||||
const f = e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files[0];
|
||||
if (!f) return;
|
||||
const modeEl = document.getElementById("importModeSelect");
|
||||
const mode = modeEl ? modeEl.value : "replace";
|
||||
f.text().then(txt => importLearnStateText(txt, mode));
|
||||
});
|
||||
}
|
||||
|
||||
const demoBtn = document.getElementById("btnLoadDemoState");
|
||||
if (demoBtn) demoBtn.addEventListener("click", loadDemoCompletedState);
|
||||
|
||||
const rstBtn = document.getElementById("btnResetState");
|
||||
if (rstBtn) rstBtn.addEventListener("click", resetLearnState);
|
||||
|
||||
const addBmBtn = document.getElementById("btnAddBookmark");
|
||||
if (addBmBtn) {
|
||||
addBmBtn.addEventListener("click", () => {
|
||||
const inp = document.getElementById("inputBookmarkCoord");
|
||||
if (!inp) return;
|
||||
const val = parseInt(inp.value, 10);
|
||||
if (!isNaN(val) && val >= 0 && val <= 9999) {
|
||||
if (!memoryState.bookmarked_coordinates.includes(val)) {
|
||||
memoryState.bookmarked_coordinates.push(val);
|
||||
memoryState.bookmarked_coordinates.sort((a, b) => b - a);
|
||||
}
|
||||
inp.value = "";
|
||||
saveState(memoryState, `Bookmarked AQ Coordinate ${val}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Bind interactive sandboxes
|
||||
["m01InputA", "m01InputB"].forEach(id => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.addEventListener("input", updateM01Sandbox);
|
||||
});
|
||||
const m02Sel = document.getElementById("m02WordSelect");
|
||||
if (m02Sel) m02Sel.addEventListener("change", updateM02Sandbox);
|
||||
["m03TriadSelect", "m03ModeSelect"].forEach(id => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.addEventListener("change", updateM03Sandbox);
|
||||
});
|
||||
const m04Sel = document.getElementById("m04HeadlineSelect");
|
||||
if (m04Sel) m04Sel.addEventListener("change", updateM04Sandbox);
|
||||
const m05Sel = document.getElementById("m05BuildSelect");
|
||||
if (m05Sel) m05Sel.addEventListener("change", updateM05Sandbox);
|
||||
const m06Sel = document.getElementById("m06RegisterSelect");
|
||||
if (m06Sel) {
|
||||
m06Sel.addEventListener("change", e => {
|
||||
memoryState.preferred_register = e.target.value;
|
||||
markModuleComplete("M06", `M06 Checkpoint Solved: Switched register to ${e.target.value}!`);
|
||||
});
|
||||
}
|
||||
|
||||
updateM01Sandbox();
|
||||
updateM02Sandbox();
|
||||
updateM03Sandbox();
|
||||
updateM04Sandbox();
|
||||
updateM05Sandbox();
|
||||
renderAll("Local progress state ready.");
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user