Expand description
Static-site assembly: turn a course into a browser-deployable lesson site.
core::site owns assembly only (ADR-0008, §4.1): it decides which files a
site contains and their contents, and commits them to disk. It does not
call LLMs or execute learner code — that happens in the browser at learner
time, via the runtime the emitted assets boot (webR / Pyodide).
The split (§2.1, §2.3): plan_site is pure — given the loaded lessons and a
BuildTarget it returns the SiteFiles (relative paths + contents), with
no filesystem touch, so a whole site is snapshot-testable. write_site is
the single effectful step. The SiteLesson JSON is the contract between Rust
(author side) and the JS runtime (learner side): a Rust-side change that keeps
the JSON shape leaves the runtime untouched (§3.2).
Structs§
- Embedded
Key - An API key embedded in an encrypted site payload (§1.2 — a represented
state, not a loose string). When present, the key rides inside the
AES-256-GCM-encrypted
index.htmlpayload as a JSON object{"html":"...","embeddedKey":{"provider":"...","key":"..."}}. The decrypt shell extracts it and setswindow.__btEmbeddedKeybefore the page renders, sofeedback.js’sapplyEmbeddedKeycan pre-load it into sessionStorage — skipping the key-entry prompt. - Site
File - One file in a planned site: a path relative to the output root and its
contents — the unit
write_sitecommits to disk. - Site
Files - A fully planned site: every file it comprises, in a deterministic order.
- Site
Lesson - One lesson as the in-browser runner consumes it: the Rust↔JS JSON contract (ADR-0008, §3.2).
Enums§
- Build
Target - Which browser runtime a built site targets, and so which language it serves.
- Eval
Report Error - A course’s bundled eval report could not be read as the Slice-13 JSON artifact.
- Eval
Summary - Whether a built site’s lessons carry eval validation, and at what accuracy.
- Plan
Error - Why a site could not be planned.
Functions§
- encrypt_
site_ files - Encrypt all content files in a planned site, replacing them with decrypt shells (for HTML pages) or base64-encoded encrypted payloads (for JSON files).
- eval_
summary_ from_ report_ json - Fold a Slice-13 eval report’s JSON into the page model, taking its accuracy
as-is (§3.2) — the figure the
evalcommand recorded, never recomputed here. - plan_
site - Plan the static site for
lessons, targetingtarget, folding in the eval validationevalcarries. - write_
site - Write a planned site to
out_dir, creating parent directories as needed.