English
Architecture
The design decision that matters most is that core is a standalone module. The CLI and the dev server share one parser, one rule set, and one project resolver. Two parsers would drift.
┌─────────────────┐
│ core (parser) │ project → Deck[]
│ + rules │ Deck + slides/ → Diagnostic[]
└────────┬────────┘
┌───────┴───────┐
│ │
┌────┴────┐ ┌─────┴─────┐
│ CLI │ │ dev server│
└────┬────┘ └─────┬─────┘
└──── HTTP ─────┘ goto / currentThe CLI works on files directly. Only the two commands that need to know or change what a browser is showing, goto and current, talk to a running dev server over HTTP, and they fail with a hint when none is running. Two commands reach the network. dekc ref fetches a pinned commit from GitHub; ls, show, theme, and shot fetch it again when a ref's snapshot is missing. dekc pub talks to dek.pub, or the server --server or DEK_PUB_SERVER names, over HTTPS, or plain HTTP to this machine only, and follows no redirect, so the key goes to that origin alone. The API key dekc pub login gets is kept per server, in the OS keychain through Bun.secrets (service dek.pub, the server's origin as the name), or, where there is no keychain, in $XDG_CONFIG_HOME/dek/credentials.json (~/.config/dek/ by default), which only its owner may read; DEK_TOKEN is a key no store holds, for CI, sent only to https://dek.pub or the server DEK_TOKEN_SERVER names. A credentials file another account owns, or one others may read or write, is refused. Lint, build, and sync never reach the network.
A built file never reaches for a server either. The player is compiled twice: the one a build, a video, or a shot embeds has no position socket, no live updates, no marks, and no rehearsal, which only the dev server's pages carry, as they alone carry annotate mode.
Voice and video
Voice and video sit on the same core as separate drivers. Core knows about Cues, Timelines, and schedules; the speech engine, ffmpeg, and the browser are adapters.
script.md → Deck → Cue → Synth → Timeline → schedule
├→ RehearseDriver → player.go()
└→ VideoDriver → player.go() + frames → muxVideo capture does not replay the talk at wall-clock speed. The worker starts each go, pauses the Web Animations, and screenshots at currentTime stops from frameStops. One hold frame covers the rest of the beat, so rendering time follows the amount of motion rather than the length of the talk. Slide scripts share that clock: in video mode the player holds each script at t = 0, and the worker seeks it at the same stops through window.dekMotion.
Optional dependencies
Playwright, ffmpeg, and the speech engine are optional. When one is missing, only the command that needs it fails, and its hint says what to install. The CLI itself always starts.
Playwright runs in a separate worker process, resolved from node_modules at run time, because Bun's Node compatibility is partial. DEK_PLAYWRIGHT can point at an alternative worker, which is also how the tests run without a browser. rumdl is found on PATH, in the node_modules/.bin beside dek's install, or at DEK_RUMDL. Neither is looked up from the current directory, which a cloned repository controls.
A project you did not write
dek builds a project, but the project does not configure the Bun that runs dek. The dekc bin runs Bun with --no-env-file --config=/dev/null, and every bun dek starts gets the same flags, so a .env or a bunfig.toml in the working directory sets no variable and preloads no code. The package ships its own tsconfig.json, so a project's paths cannot redirect dek's imports. dekc ref sends a token only to api.github.com, and only one set in GITHUB_TOKEN or GH_TOKEN; dek never asks gh for one. A ref's title goes into AGENTS.md as one line of at most 80 characters, each character a person cannot see shown by its code point, so it cannot add a heading or an instruction there, seen or unseen. A hint is dek's own words and never quotes a ref; text output carries no color code a deck or a ref wrote; dekc show says when a slide is a ref's, and no file can start one of its parts; and the commands that read a ref report the characters in it a person cannot see. A ref's slide scripts run when dekc shot draws it, in Chromium with its sandbox on and the network off.
Where Chromium's sandbox does not start
Where Chromium's sandbox does not start, as in a container running as root, on Ubuntu 23.10 and later, whose AppArmor rule keeps Chromium from making user namespaces (GitHub Actions' ubuntu-24.04 runners included), or under Docker's default seccomp profile, dek draws the project's own decks without it and says so every run: warning: Chromium drew without its sandbox, which did not start here, with what Chromium said, and unsandboxed in --json. Their scripts are the deck author's, and run in your browser in any case. A ref's are someone else's, so dekc shot <ref> refuses there. To have the sandbox, run dekc as a user other than root; on Ubuntu, allow user namespaces with sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0, or give Chromium an AppArmor profile; in a container, use a seccomp profile that allows them. To accept drawing without it, set DEK_ALLOW_UNSANDBOXED=1 in the environment, such as the container's image: refs then draw too, still with the warning, and the project's own decks no longer warn; --json still says unsandboxed. dek asks for the sandbox first wherever it runs. For the project's own decks, a launch with it that fails for any reason is tried once without it, and said; when Chromium starts neither way, dek reports both failures.
How dek is started
How dek is started is outside what it can check. bun ./node_modules/.bin/dekc skips the bin's flags, so Bun reads the project's bunfig.toml before dek starts; dek still ignores the DEK_ variables a .env sets. A project's package.json scripts and anything it commits under node_modules are the project's own code. Before running dekc in a project you did not write, check that the dekc you run is one you installed. SECURITY.md says which reports are in scope.
Where agents plug in
At the CLI. Every result command takes --json, diagnostics are SARIF, and dekc help --agent is the compact reference. See Working with AI Agents and the CLI reference.