5.8 KiB
ScaenaPublic
The pure core of Scaena, Domi's video studio: canon parser and claim checker, hook templates and (later) the timeline model, ffmpeg argument compiler, ASS subtitle builder, audits, similarity scoring, hook evolution and Thompson sampling. Pure Rust, no I/O. Used by Praeco Domi by git tag.
What's in v0
Crate scaena-core (crates/scaena-core), tag core-v0.1.0. Pure Rust, #![forbid(unsafe_code)], no I/O;
dependencies are serde, thiserror and unicode-segmentation only. Builds for Windows, Android
(aarch64-linux-android) and the web (wasm32-unknown-unknown). If you redistribute it, alone or inside your own
app, show the Exhibit B credit (see Licence).
scaena-core = { git = "https://gitea.marek-novak.cz/mnovak/ScaenaPublic.git", tag = "core-v0.1.0" }
scaena_core::canon: canon files
pub fn parse(file_stem: &str, text: &str) -> Result<CanonFile, CanonError>; // CanonError { line, code }
pub struct CanonFile { pub id: String, pub front: FrontMatter, pub facts: Vec<Fact> }
pub struct FrontMatter { pub name, one_liner, audience, price, clicks: String, pub status: Status,
pub aula: Option<String>, pub site: Option<String> }
pub enum Status { Released, Beta, Planned }
pub struct Fact { pub id: u32, pub text: String, pub assumption: bool, pub line: usize }
impl CanonFile { fn fact(&self, id: u32) -> Option<&Fact>; fn urls(&self) -> Vec<String>;
fn adhoc(id: &str, name: &str, facts: Vec<(u32, String)>) -> CanonFile; }
pub struct Canon; // new, insert (duplicate id = error), get, apps, fact, allowed_urls
pub fn is_valid_app_id(id: &str) -> bool;
pub fn is_assumption_value(value: &str) -> bool;
The format of apps/<id>.md (UTF-8, at most 64 KiB):
---
id: tabula
name: Tabula
one_liner: Notes that stay on your own computer.
audience: People who want notes without an account.
price: (assumption) one-time purchase
clicks: New note in 1 click.
status: released
aula: https://aula.marek-novak.cz/tabula/
---
## What it does
- [F1] Tabula keeps notes on your own computer.
- [F2] It syncs between your devices without a cloud account. (assumption)
- Front matter: flat
key: valuelines between two---lines. Required:id name one_liner audience price clicks status; optional:aula,site(each a singlehttps://URL). Unknown, duplicate, missing or empty keys are errors.idequals the file stem: 1–32 of[a-z0-9-], no leading or trailing-.statusisreleased,betaorplanned. - Facts:
- [F<n>] <text>,n1–9999 without leading zeros, unique, under any heading. Any bullet line starting[Fthat does not match exactly is an error. A fact ending in(assumption)is unconfirmed; the marker is removed fromtextandassumptionis set (a marker elsewhere in the text also sets it). - Hostile input: a leading BOM and CRLF line endings are accepted; a lone CR, control characters other than tab, bidi controls, zero-width space, word joiner, BOM inside the text and tag characters are errors.
- Allowed URLs:
aula,siteand everyhttps://URL in a fact's text.
scaena_core::claims: the claim checker
pub fn check(text: &str, canon: &Canon) -> Report;
pub struct Report { pub refs: Vec<Ref> /* sorted, unique */, pub problems: Vec<Problem> } // ok() = no problems
pub struct Ref { pub app: String, pub fact: u32 }
pub enum Problem { Unsourced { sentence }, MissingFact { r }, UnknownApp { r }, Unconfirmed { r },
MalformedRef { text }, UrlNotInCanon { url }, HiddenCharacter { codepoint } } // non_exhaustive
impl Problem { pub fn reason(&self) -> String } // plain English
pub fn strip_refs(text: &str) -> String;
pub fn sentences(text: &str) -> Vec<String>;
pub fn states_fact(sentence: &str, canon: &Canon) -> bool;
- References look like
[tabula#F3]; several may be adjacent ([tabula#F3][tabula#F7]), at the end of the sentence they support (before or after its full stop). A sentence ends at.,!,?or…followed by whitespace, and at every line break;1.2and URLs do not end one. The checker cannot tell whether a fact really supports its sentence: a valid reference anywhere in a sentence sources the whole sentence. - Fail closed: every sentence needs a reference to a confirmed fact unless it is one of a short list of plain phrases ("Here's what's new.", "Try it today.", "Try Tabula today.", "Learn more.", "Thanks for reading."…). So numbers, prices, platforms and feature claims always need one.
- Rejected: unsourced sentences, references to unknown apps or missing facts, references to
(assumption)facts ("unconfirmed fact"), malformed references ([F3],[Tabula#F3],tabula#F3…), URLs not inCanon::allowed_urls(scheme://,www.and barehost.tld/pathforms), hidden or direction-changing characters.
scaena_core::hooks: hook templates
pub fn parse(md: &str) -> Result<Vec<HookTemplate>, HookError>; // brand/hooks.md: "- [H<n>] <template>"
pub struct HookTemplate { pub id: String /* "H3" */, pub text: String, pub slots: Vec<String>, pub genome: Genome }
impl HookTemplate { pub fn fill(&self, values: &BTreeMap<String, String>) -> Result<String, HookError>; }
pub struct Genome { pub opening: Opening, pub words: usize, pub has_number: bool, pub lead_verb: Option<String> }
pub enum Opening { Question, Statement, Number, Command }
pub const SLOTS: [&str; 7] = ["app", "feature", "pain", "number", "platform", "clicks", "audience"];
Any slot outside SLOTS and any unbalanced brace is an error. fill fails on a missing value and never expands
braces inside values.
Licence
Common Public Attribution License 1.0 (CPAL-1.0), see LICENSE.
Anyone who redistributes this code, or a larger work built with it, must show the Exhibit B credit: Built on Domi · https://aula.marek-novak.cz · Copyright (c) 2026 Marek Novák.