decklight 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +36 -10
- package/cli/agents.mjs +3 -1
- package/cli/associate.mjs +12 -5
- package/cli/edit.mjs +17 -4
- package/cli/marketplace.mjs +258 -77
- package/cli/plugin.mjs +9 -1
- package/cli/present.mjs +11 -7
- package/cli/theme.mjs +32 -14
- package/cli/units.mjs +19 -7
- package/dist/decklight.js +2 -2
- package/dist/decklight.js.map +1 -1
- package/package.json +4 -3
- package/tools/chrome.mjs +42 -16
- package/tools/theme-check.mjs +6 -1
- package/tools/video.mjs +157 -33
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ The whole loop is agent-friendly and stays in one file end to end:
|
|
|
112
112
|
| `decklight pdf deck.html` | one slide per page, at its own size, in its theme — no print dialog |
|
|
113
113
|
| `decklight video deck.html` | render to one narrated mp4 (`--voiceover` synthesizes the narration first) |
|
|
114
114
|
| `decklight theme check\|add` | validate a theme against the token contract, or install one into a deck |
|
|
115
|
-
| `decklight marketplace add owner/repo` | register a catalog —
|
|
115
|
+
| `decklight marketplace add owner/repo` | register a catalog — cloned once with **your** git credentials (so a private one works), then read from disk |
|
|
116
116
|
| `decklight plugin add timer` | presenter chrome into **your** library: `present` loads it, `bundle` never does |
|
|
117
117
|
| `decklight template\|importer\|transform\|engine\|voice\|agent add …` | the rest of the unit library — deck templates, import adapters, build-time transforms, speech engines, voices, agent descriptors |
|
|
118
118
|
| `decklight extension check t.mjs` | the marketplace admission gate for a transform: lint, then a headless load of its output |
|
package/SPEC.md
CHANGED
|
@@ -474,7 +474,7 @@ Authorship is **structural, not detected**: the server spawns the agent itself a
|
|
|
474
474
|
- **Speaker view**: `S` opens a popup (synced via BroadcastChannel): current + next slide thumbnails, notes (with `⟨CLICK⟩` markers highlighted as the matching build lands), elapsed timer, build step list (provider labels). **Rehearse mode**: pressing `S` again (in the deck or in the popup; the header badge also toggles) swaps the prose notes for the slide's `aside.rehearse` cue cards (DECK_ANATOMY) — rendered large and bold, one cue per segment, same said/now/next highlighting. Slides without rehearse notes fall back to the full prose. `S` in the deck only opens a new popup when none is connected; while one is open it toggles the mode. **Phone remote**: when the deck is being played by `decklight present --remote` (below), the speaker view also shows a QR of the controller URL — click it to enlarge for scanning across a lectern. It appears only when a remote is actually on, since without it there is no LAN URL to encode.
|
|
475
475
|
- **Phone remote** (`decklight present <deck.html> --remote`): the presenting server also listens on the LAN and serves `GET /remote` — a self-contained controller page with prev/next and a live "slide x/N" readout, no external asset of any kind (a phone is off-loopback, so anything it fetched from elsewhere would be a hole). A tap is relayed as a named `remote` event on the SSE stream the deck already holds, and the deck POSTs its position back, so the readout tracks the deck however it moved (phone, keyboard, or click). `POST /remote/pos` is the deck→phones direction and **accepts only loopback callers**: the deck is the one thing that knows the position, it reports from this machine, and a phone — or anyone who obtained the QR token — posting a fabricated `{i,n}` would desync the readout every other phone shows. `--remote` widens the **listener** and nothing else: off this machine **only** `/remote/*` answers, and only with the per-run random token the printed URL and its QR embed — the deck itself and every file beside it stay unreachable from the LAN either way. One exported classifier decides it, `allowRemote(req, token)`, and `PRESENT#REMOTE` is why it lives on this server: the remote used to sit on the **author** server, so a clicker meant running `/edit/notes`, `/edit/layout` and `/edit/agent` on the LAN during a talk you were not watching. The QR is generated server-side with no dependencies, and a deck that never uses a remote grows by zero bytes.
|
|
476
476
|
- **Print/PDF**: `?print` renders all slides sequentially, every build complete, terminal casts fully expanded, one slide per page (`@media print` CSS). No JS needed after layout. Background media (DECK_ANATOMY) prints as a still: no `<video>` element is ever created in print — the slide's `data-background-poster` renders as the background image instead. Two handout variants restructure the same fully-built render onto portrait pages (one `.print-page` per sheet): `?print=handout` groups slides three to a page, each scaled slide beside a column of ruled note-taking lines (page count = ⌈N/3⌉); `?print=notes` gives one page per slide with that slide's speaker notes rendered underneath — slides without notes keep their page with an empty notes block. **Page count equals slide count** (⌈N/3⌉ for handout): the page box has no margin, so the document has none either — the UA's default body margin would push the last slide's final pixels past the last page box and emit a blank final sheet. **`decklight pdf <deck.html>`** writes that render to a file without a print dialog: headless Chrome over the deck's own `?print`, one slide per 1280×720 page (960×540 pt), `-o` for the path, `--theme` to export in another theme (it rides `?theme=`), `--wait` for decks that need longer to settle. Slides the overflow guardrail flagged are named on stderr by slide number — the PDF is still written, because a clipped slide is worth knowing about, not worth refusing. No Chrome, or no file produced, exits non-zero rather than leaving a silent empty PDF.
|
|
477
|
-
- **Video export**: `decklight video deck.html -o deck.mp4` (tools/video.mjs) renders the deck to one narrated mp4 — a full-resolution still per
|
|
477
|
+
- **Video export**: `decklight video deck.html -o deck.mp4` (tools/video.mjs) renders the deck to one narrated mp4 — a full-resolution still per FRAME (each a one-shot headless Chrome against `#/<n>/<step>`, the shot.mjs mechanism), muxed with the audio into a single file. A **narrated** slide is one still, fully built, held for the duration of its audio plus a 0.4s tail. A **silent** slide BUILDS as it goes: one still per build step, then the finished slide. How far each slide builds is asked of the deck itself in one extra load — the grouping is the runtime's (`src/core/builds.js`), and a second counter written in Node would be a copy that drifts; a deck that does not answer falls back to one fully-built still per slide, and every slide's final frame is captured at the oversized `#/<n>/999` regardless, so a miscount can shorten a build-up but can never lose the finished slide. Both render tools (video and `tools/shot.mjs`) capture the deck **served over `http://127.0.0.1` under the `PRESENT` CSP** — the same loopback core `present` uses (`serveForRender`) — never over `file://` with `--allow-file-access-from-files`: that flag lets an unvetted deck's own JavaScript read any local file it can name and exfiltrate it, and these tools run on decks nobody has audited (a repro deck off an issue, or one screenshot before it is presented). As with `present`, the served root is the current directory and the deck must sit inside it, so its relative assets resolve as URLs and a read cannot escape the served tree. Narration resolves `--narration <dir>` → `<deckdir>/voiceover/manifest.json` (the artifact tools/voiceover.mjs writes) → a fully silent deck; slides without narration hold `--hold` seconds (default 5, per-slide override `data-video-hold="8"` on the section) over a silent audio segment (anullsrc), so the concatenated audio track stays continuous. **Every frame of a silent slide holds that long, builds included**, so a build lands at the pace the rest of the deck moves at and a deck gets longer the more it builds; `--build-hold <s>` paces the build-up frames alone, for builds quicker (or slower) than the slides around them. Splitting the hold across a slide's frames instead — fixing the deck's length — reads far too fast: the more a slide has to say, the less time each beat of it gets, which is backwards. Flags: `-o/--out`, `--narration`, `--size 1280x720`, `--fps 30`, `--hold`, `--build-hold`, `--theme <name>`, `--slides a-b`, `--voiceover` (runs the voiceover batch first). Needs ffmpeg + ffprobe — missing tools are a hard, friendly error naming what to install (the voiceover encoder-detection policy). Honest MVP limits: frames are stills, so the **character overlay appears but frozen** and terminals render fully expanded rather than typing (animated capture needs a CDP screencast — a named Node ≥22 follow-up), and a build **cuts rather than animating** (the frame is a still of each step, not a capture of the transition between them). **Narrated** slides are still timed per-slide rather than per-build-step — splitting audio across builds needs the `⟨CLICK⟩` markers mapped to real timestamps, which is its own feature; guessing would put words under the wrong build.
|
|
478
478
|
- **Overflow guardrail**: content that exceeds the slide flex-shrinks into a scroll box and reads as clipped. The engine warns (`console.warn`) and marks the section with a `data-overflow` attribute — on each slide activation, and for the whole deck in `?print`. The mark is **live, not latched**: layout is not final when a slide activates (a webfont resolves, an image decodes, a chart or terminal mounts), so the active slide is watched and the check re-runs whenever its content changes size or shape. It never waits on a frame — headless renders run out of frames once the page goes idle, and an unmeasured slide is indistinguishable from a clean one. The warning fires on the way in only, so one clipped slide is one line, not one per re-check — so authoring agents can assert `[data-overflow]` is absent in their headless verification (`decklight pdf` does this for a whole deck in one pass and names the offending slides). Overflow always goes **down**, never up: a slide centers its content with `safe center`, so content taller than the slide falls back to top alignment instead of overflowing symmetrically. Plain centering would push half the excess out of the top of the box, through the padding a pinned title reserves for itself, and render the first content element on top of the title.
|
|
479
479
|
- **Pinned titles**: `pinTitles: true | false | <px>` keeps slide titles at one vertical position instead of drifting with content height. **On by default** (`true`); `pinTitles: false` restores the drift-with-content centering deck-wide. `true` pins at **99px** from the stage top (design coordinates — the natural title position of the course's "The Single-Agent Limit" diagram slide, the chosen reference); a number pins at that Y. The leading `h1`/`h2` of each **pinnable** section is absolutely positioned at the pin Y; the section reserves `pin Y + measured title height + 18px` of top padding so the remaining content centers below. Pinnable = has a leading `h1`/`h2` AND content beyond it (`ul, ol, svg, pre, table, .terminal, img, .columns` outside the notes) — title cards and quote/statement slides stay centered. Per-slide: `data-pin` forces a pin (even when the config is off), `data-pin="none"` opts out, `data-pin="<px>"` overrides the Y. Titles are re-measured on `sync()` and when webfonts finish loading; print uses the same layout. A detected **subtitle** (DECK_ANATOMY) joins the pinned header block — absolutely positioned directly beneath the title (6px gap) and included in the reserved padding, so content centers below title + subtitle.
|
|
480
480
|
- **Terminal footprint**: a terminal's screen area has a stable size — a **16:9 aspect floor** (width-driven) clamped by the `data-rows` cap as the max — so the box arrives full-size before anything plays and never resizes as steps stream in (output beyond the box scrolls). Real print expands casts fully.
|
|
@@ -589,8 +589,27 @@ reads as "not yet" rather than as a typo — the two must never look alike.
|
|
|
589
589
|
the source's root and registers the catalog; `list`, `update <name>` and
|
|
590
590
|
`remove <name>` complete the roster. State lives under `~/.decklight/`
|
|
591
591
|
(`DECKLIGHT_HOME` overrides): one registry file, `marketplaces.json`, plus a
|
|
592
|
-
`marketplaces/` directory
|
|
593
|
-
|
|
592
|
+
`marketplaces/` directory holding, per marketplace, its cached manifest
|
|
593
|
+
(`<name>.json`) and the checkout that manifest came with (`<name>/`) — the
|
|
594
|
+
config home the engine wizard (MARKETPLACE.md ENGINES) shares.
|
|
595
|
+
|
|
596
|
+
**A remote marketplace is read by cloning it** (MARKETPLACE.md
|
|
597
|
+
`MARKETPLACES#CLONE`), never by fetching one file at a time off a raw-content
|
|
598
|
+
host, and `owner/repo` is shorthand for that clone rather than for a URL. Three
|
|
599
|
+
things follow, and each was a bug before it did. A clone uses **the caller's own
|
|
600
|
+
git credentials**, so a marketplace in a private repo works exactly as `git
|
|
601
|
+
clone` does in that terminal — a credential helper for HTTPS (`gh auth
|
|
602
|
+
setup-git`, the macOS Keychain), or the SSH form of the URL; an anonymous fetch
|
|
603
|
+
had none, so a private catalog could register and then 404 on every install.
|
|
604
|
+
The manifest and every entry's bytes come from **one commit**, recorded in the
|
|
605
|
+
registry and printed by `list`, where fetching each artifact separately at
|
|
606
|
+
`HEAD` could produce an install matching no single commit of the marketplace.
|
|
607
|
+
And because the clone is kept — `~/.decklight/marketplaces/<name>/`, its `.git`
|
|
608
|
+
dropped, replaced wholesale by the next `update` and removed by `remove` —
|
|
609
|
+
**installing an entry reads the disk**, not the network. A local-path
|
|
610
|
+
marketplace keeps no checkout: its own directory already is one. An entry whose
|
|
611
|
+
`source` is an absolute `https://` URL (a gist, a release asset) is still
|
|
612
|
+
fetched as written.
|
|
594
613
|
|
|
595
614
|
**The invariant everything above serves: registering is not fetching.** The
|
|
596
615
|
network is touched only by an explicit `add` or `update` of a remote source —
|
|
@@ -673,10 +692,13 @@ bytes — lowercase hex, exactly as `sha256sum` prints it:
|
|
|
673
692
|
```
|
|
674
693
|
|
|
675
694
|
**Why the pin exists.** An entry's relative `source` resolves against the
|
|
676
|
-
marketplace's
|
|
677
|
-
branch name is guessed at)
|
|
678
|
-
|
|
679
|
-
|
|
695
|
+
marketplace's checkout, cloned at whatever the default branch pointed to when
|
|
696
|
+
`add`/`update` ran (`resolveSource`; no branch name is guessed at) — so the
|
|
697
|
+
bytes an install writes are whatever the file said at that moment, not
|
|
698
|
+
whatever it said when the marketplace admitted the entry (`EXTENSIONS_CHECK`).
|
|
699
|
+
Cloning closed the narrower gap of manifest and artifact disagreeing with each
|
|
700
|
+
other; it cannot close this one, which is between the admission and the
|
|
701
|
+
install. For a theme that gap is closed by `theme add` re-running
|
|
680
702
|
the entire THEMING contract at install; for Node code the loader runs
|
|
681
703
|
unsandboxed at author privilege (`EXTENSIONS_TRANSFORMS`,
|
|
682
704
|
`EXTENSIONS_ADAPTERS`) there is no equivalent re-check — the digest is what
|
|
@@ -1142,13 +1164,17 @@ decklight/
|
|
|
1142
1164
|
demo/ smoke.html (the render harnesses' deck — every feature, including deliberate regression
|
|
1143
1165
|
fixtures) + intro.html, features.html, pitch.html, showcase.html + assets/
|
|
1144
1166
|
test/ node:test units (ansi, builds, math, cast format, the CLI, the marketplace, the pieces lifted out
|
|
1145
|
-
of engine.js) + 15 headless-Chrome harnesses (render,
|
|
1146
|
-
overflow, split, strict, shot, plugin, extension-check,
|
|
1147
|
-
palette-rules.mjs (every shipped theme through
|
|
1167
|
+
of engine.js), found by run.mjs rather than a shell glob + 15 headless-Chrome harnesses (render,
|
|
1168
|
+
player, narration, character, engine, pin, overflow, split, strict, shot, plugin, extension-check,
|
|
1169
|
+
deckfile, pdf, import) + contrast.mjs and palette-rules.mjs (every shipped theme through
|
|
1170
|
+
tools/theme-check.mjs, and the house palette bar) + the two manual end-to-end scripts neither
|
|
1171
|
+
blessed suite runs: soak.mjs (pack, install, walk the journey — the release gate) with its
|
|
1172
|
+
soak-platform.mjs, and video-e2e.mjs (a real ffmpeg render)
|
|
1148
1173
|
```
|
|
1149
1174
|
|
|
1150
1175
|
- Build: `npm run build` = esbuild bundle (`src/index.js` → `dist/decklight.js`, minified + sourcemap) + CSS copy. Node ≥ 20. Runtime has **zero** runtime dependencies (highlight.js + temml are bundled at build time; Temml's stylesheet is appended to `decklight.css` with its optional woff2 `@font-face` stripped); `node-pty`, `js-yaml` are CLI-only deps.
|
|
1151
1176
|
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all 17 harnesses** — the 15 headless-Chrome ones against `demo/smoke.html` and the decks each covers, plus the two theme graders — reporting every harness rather than stopping at the first failure. A feature is verified against a real render, not only unit-tested.
|
|
1177
|
+
- Release gate: **`npm run soak`** packs this repo, installs the tarball into an empty project whose path contains a space, and drives the INSTALLED `decklight` through one user journey — create, import, marketplace, author, present, bundle, transform, pdf, publish, validate, open, record, film — plus a cross-version `upgrade` of a deck scaffolded by a decklight that actually shipped. Manual, in neither blessed suite (it runs a real `npm install`, and skipping inside them would let "green" mean "not actually run"); anything it cannot do here — no Chrome, no network, no ffmpeg, no toolchain — skips **by name**, so a green run with skips is never mistaken for a complete one.
|
|
1152
1178
|
|
|
1153
1179
|
## NON_GOALS — Non-goals (v1)
|
|
1154
1180
|
|
package/cli/agents.mjs
CHANGED
|
@@ -120,7 +120,9 @@ export function installedAgents(home = configHome()) {
|
|
|
120
120
|
/** Is `bin` runnable — an explicit path that exists, or a name on $PATH? */
|
|
121
121
|
export function onPath(bin, env = process.env) {
|
|
122
122
|
if (!bin) return false;
|
|
123
|
-
|
|
123
|
+
// An explicit path, spelled either way — a Windows one carries backslashes,
|
|
124
|
+
// and treating it as a bare name would send it looking down $PATH instead.
|
|
125
|
+
if (bin.includes('/') || bin.includes('\\')) return existsSync(bin);
|
|
124
126
|
const exts = process.platform === 'win32' ? ['.exe', '.cmd', '.bat', ''] : [''];
|
|
125
127
|
for (const dir of (env.PATH || '').split(delimiter)) {
|
|
126
128
|
if (!dir) continue;
|
package/cli/associate.mjs
CHANGED
|
@@ -74,9 +74,15 @@ const USAGE = `usage: decklight associate [--uninstall] [--print]
|
|
|
74
74
|
* opens two windows.
|
|
75
75
|
*/
|
|
76
76
|
export function linuxFiles(home = homedir(), node = process.execPath, cli = CLI) {
|
|
77
|
+
// posix.join, not join: these are LINUX filesystem paths. Built with the
|
|
78
|
+
// host's separator they come out as `C:\Users\x\.local\share\…` when the
|
|
79
|
+
// host is Windows — a path no Linux desktop would ever read, produced by a
|
|
80
|
+
// function whose whole job is to describe one. The same argument as
|
|
81
|
+
// `darwinFiles` below; both are pure text about somebody else's OS.
|
|
82
|
+
const join = path.posix.join;
|
|
77
83
|
return [
|
|
78
84
|
{
|
|
79
|
-
path:
|
|
85
|
+
path: join(home, '.local/share/applications/decklight.desktop'),
|
|
80
86
|
text: `[Desktop Entry]
|
|
81
87
|
Type=Application
|
|
82
88
|
Name=Decklight
|
|
@@ -89,7 +95,7 @@ Categories=Office;Presentation;
|
|
|
89
95
|
`,
|
|
90
96
|
},
|
|
91
97
|
{
|
|
92
|
-
path:
|
|
98
|
+
path: join(home, '.local/share/mime/packages/decklight.xml'),
|
|
93
99
|
text: `<?xml version="1.0" encoding="UTF-8"?>
|
|
94
100
|
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
|
95
101
|
<mime-type type="${MIME_TYPE}">
|
|
@@ -108,10 +114,11 @@ Categories=Office;Presentation;
|
|
|
108
114
|
// ── macOS ──────────────────────────────────────────────────────────────────
|
|
109
115
|
|
|
110
116
|
export function darwinFiles(home = homedir(), node = process.execPath, cli = CLI) {
|
|
111
|
-
const
|
|
117
|
+
const join = path.posix.join; // macOS paths, whatever host is spelling them
|
|
118
|
+
const app = join(home, 'Applications/Decklight.app');
|
|
112
119
|
return [
|
|
113
120
|
{
|
|
114
|
-
path:
|
|
121
|
+
path: join(app, 'Contents/Info.plist'),
|
|
115
122
|
text: `<?xml version="1.0" encoding="UTF-8"?>
|
|
116
123
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
117
124
|
<plist version="1.0">
|
|
@@ -144,7 +151,7 @@ export function darwinFiles(home = homedir(), node = process.execPath, cli = CLI
|
|
|
144
151
|
`,
|
|
145
152
|
},
|
|
146
153
|
{
|
|
147
|
-
path:
|
|
154
|
+
path: join(app, 'Contents/MacOS/decklight'),
|
|
148
155
|
mode: 0o755,
|
|
149
156
|
// Through Terminal, because present is a server that prints the label and
|
|
150
157
|
// then keeps running: launching it with no visible output would leave
|
package/cli/edit.mjs
CHANGED
|
@@ -324,18 +324,26 @@ export async function editMain(args) {
|
|
|
324
324
|
};
|
|
325
325
|
/** Every theme entry a registered marketplace offers, qualified. */
|
|
326
326
|
const browsableThemes = async () => {
|
|
327
|
-
const { loadRegistry, loadCatalog } = await import('./marketplace.mjs');
|
|
328
|
-
const
|
|
327
|
+
const { loadRegistry, loadCatalog, checkoutPath, classifySource, configHome } = await import('./marketplace.mjs');
|
|
328
|
+
const registry = loadRegistry().marketplaces ?? {};
|
|
329
329
|
const themes = [];
|
|
330
330
|
// Registered-but-never-fetched is the FIRST-RUN state, not an error — the
|
|
331
331
|
// first-party marketplace is deliberately in it — so it is reported as
|
|
332
332
|
// something the presenter can act on (`marketplace update <name>`) rather
|
|
333
333
|
// than as an empty list that looks like an empty marketplace.
|
|
334
334
|
const stale = [];
|
|
335
|
-
for (const market of
|
|
335
|
+
for (const [market, m] of Object.entries(registry)) {
|
|
336
336
|
const loaded = loadCatalog(market);
|
|
337
337
|
if (!loaded) { stale.push(market); continue; }
|
|
338
338
|
if (!loaded.ok) { stale.push(market); continue; }
|
|
339
|
+
// A cached catalog whose FILES are not on disk is the same actionable
|
|
340
|
+
// state wearing a different face: since MARKETPLACES#CLONE an entry
|
|
341
|
+
// installs from the marketplace's checkout, so listing its themes would
|
|
342
|
+
// be offering rows that can only fail. `marketplace update` fixes both.
|
|
343
|
+
if (classifySource(m.source ?? '').kind !== 'local' && !existsSync(checkoutPath(configHome(), market))) {
|
|
344
|
+
stale.push(market);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
339
347
|
for (const e of loaded.manifest.entries ?? []) {
|
|
340
348
|
if (e.type !== 'theme') continue;
|
|
341
349
|
themes.push({
|
|
@@ -645,7 +653,12 @@ export async function editMain(args) {
|
|
|
645
653
|
// different permissions on this path.
|
|
646
654
|
const { loadRegistry } = await import('./marketplace.mjs');
|
|
647
655
|
const market = loadRegistry().marketplaces?.[hit.marketplace];
|
|
648
|
-
|
|
656
|
+
let src;
|
|
657
|
+
try { src = resolveSource(hit.entry.source, { name: hit.marketplace, source: market?.source }); }
|
|
658
|
+
catch (e) {
|
|
659
|
+
if (e instanceof MarketplaceError) return json(409, { ok: false, error: e.message });
|
|
660
|
+
throw e;
|
|
661
|
+
}
|
|
649
662
|
let css;
|
|
650
663
|
try { css = await fetchTheme(src); }
|
|
651
664
|
catch (e) { return json(502, { ok: false, error: `could not read ${src}: ${oneline(e)}` }); }
|