Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Docs: version agents.md against the shell + anticipate the suite; document media

nyblneta585af095c93
diff --git a/CLAUDE.md b/CLAUDE.md
index bfa343c1..afe55f9e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -180,6 +180,22 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.
first numeric column = series). Morphs as a BOX (cell content does not
morph); under collab `rows` is a whole-value LWW register (concurrent
different-cell edits are last-writer-wins — documented limitation).
+- **Media (v0.9.16)**: `media` element (`kind` video|audio) mirrors image.
+ HYBRID storage — `src` is a data: URI (embedded, self-contained), an external
+ URL/relative path (referenced, small file), or `asset:`; the editor embeds
+ picked files and `confirm()`s above `MEDIA_EMBED_BUDGET` (8MB, model.ts),
+ offering a URL instead (browser file-pickers give bytes not a path, so
+ "reference a local file" isn't possible — the URL field is the escape hatch).
+ render.ts: real `<video>`/`<audio>` on canvas+present, a cheap poster/icon
+ still in thumbnails (`svgAsImage`). Media is `pointer-events:none` on the
+ canvas (gated by the `liveMedia` RenderOpt, present-only) so its native
+ controls don't swallow Selecto selection. **Autoplay is NEVER set at render
+ time** (would fire on the canvas and in every thumbnail) — present.ts
+ `startMediaIn`/`pauseMediaIn` play flagged clips (`data-autoplay="1"`) on
+ slide-enter and pause on exit/teardown; browsers need `muted` for video
+ autoplay so `defaultMedia` mutes video. Panel 'Source & playback'
+ (buildMediaProps): embedded/linked status+size, Choose/Replace file, URL,
+ controls/autoplay/loop/muted, and (video) fit/corner/poster.
- **Diagram philosophy**: complex diagrams are ordinary Bento elements (rects, texts,
`path` shapes) with groups — interactivity = linked state slides + morph (filters,
era sequences), hover = focus-group, motion = fx.loop. Opaque `svg` elements are
diff --git a/docs/agents.md b/docs/agents.md
index f6f12825..5e8825de 100644
--- a/docs/agents.md
+++ b/docs/agents.md
@@ -1,4 +1,16 @@
-# Bento for AI agents
+# Bento Slides — for AI agents
+
+**Guide version `__APP_VERSION__`** · document format `bento/slides` (v1). This
+guide matches the Bento Slides shell of the same version. A deck's `#bento-doc`
+JSON is always the source of truth — if it was written by a newer shell it may
+carry features beyond this guide; unknown keys are ignored, never fatal.
+
+> **Bento is a suite.** Slides is the first app. **Docs** (`bento/docs`) and
+> **Sheets** (`bento/sheets`) follow, each shipping as its own self-contained
+> distributable — `Bento_Slides.bento.html`, `Bento_Docs.bento.html`,
+> `Bento_Sheets.bento.html` — with its own agent guide at
+> `bento.page/<app>/agents.md`. **This guide covers Slides only.** Before you
+> edit a file, check its `"format"` and use the matching guide.
*Drop this file into your context (or point your harness at it) and you can
author and edit Bento presentations directly. Also published at
@@ -48,6 +60,7 @@ each kind of content to the feature built for it:
| a **headline number** | big text + `fx:{countUp:true}` | the count-up earns attention |
| **every cover / section divider** | at least **one ambient motion** (ken-burns, an orbiting accent) | a still cover is a missed first impression |
| **repeated chrome / a logo** | keep its `id` stable across slides | it morphs in place instead of popping on every slide |
+| a **demo clip / recording / soundbite** | a **media** element (embed short, link long) | a live video/audio beats a screenshot of one |
### Copy-paste recipes
@@ -104,6 +117,14 @@ each kind of content to the feature built for it:
```
(Embed the image as a data URI in `doc.assets` under key `hero`, then reference `"asset:hero"` — the file must stay self-contained.)
+**Video — embed a short clip, or link a big one** (autoplay is present-only; `muted` required to autoplay):
+```json
+// embedded — self-contained, keep it small (a few MB at most):
+{ "id":"clip","type":"media","kind":"video","src":"data:video/mp4;base64,AAAA…","x":220,"y":120,"w":840,"h":472,"rotation":0,"opacity":1,"controls":true,"muted":true,"autoplay":true,"loop":true,"fit":"cover","radius":8 }
+// linked — deck stays tiny; needs the URL at play time (give it a poster):
+{ "id":"clip","type":"media","kind":"video","src":"https://cdn.example.com/demo.mp4","poster":"asset:demo-poster","x":220,"y":120,"w":840,"h":472,"rotation":0,"opacity":1,"controls":true }
+```
+
### Before you finish — self-audit
- [ ] Any numbers rendered as text that should be a **chart**?
@@ -166,6 +187,14 @@ each kind of content to the feature built for it:
grids — NOT for numeric trends (use a chart).
- **svg**: `asset` or `markup` for static artwork. Prefer composing rects/
texts/paths — those stay editable and can morph.
+- **media**: `kind: video|audio`, `src` = data URI (embedded — travels in the
+ file), an external URL / relative path (referenced — keeps the file small,
+ needs the network at play time), or `"asset:<key>"`. Video also takes
+ `poster`, `fit: cover|contain|fill`, `radius`. Playback flags: `controls`,
+ `autoplay`, `loop`, `muted`. **Autoplay fires only in present mode**, and
+ browsers require `muted:true` for a video to autoplay. **Embed only SHORT
+ clips** — a big data URI bloats the file and makes it slow to open/save;
+ host large media and reference its URL instead.
## The rules that make decks feel designed
@@ -208,6 +237,9 @@ each kind of content to the feature built for it:
distributable templates; remove it for a personal deck).
- Charts degrade gracefully but exotic ECharts config is ignored — keep
options minimal.
+- **Media size**: embedding a large video as a data URI can push the file into
+ the tens of MB and make it slow to open and save. Embed only short clips;
+ otherwise host the file and put its URL in `media.src`.
Working examples of everything above: the template decks at
[bento.page](https://bento.page) — open one and read its JSON block.
diff --git a/scripts/release.mjs b/scripts/release.mjs
index 5580283c..6ac14294 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -92,7 +92,12 @@ execFileSync('node', [join(root, 'scripts/build-landing.mjs'), join(site, 'index
execFileSync('node', [join(root, 'scripts/build-example-decks.mjs'), join(site, 'gallery')], { stdio: 'inherit' })
// The agent guide — the runnable version of the "designed for AI" claim.
-cpSync(join(root, 'docs/agents.md'), join(site, 'agents.md'))
+// Stamp the current shell version so the guide declares which feature set it
+// matches (agents can compare it to a deck written by a newer shell).
+writeFileSync(
+ join(site, 'agents.md'),
+ readFileSync(join(root, 'docs/agents.md'), 'utf8').replace(/__APP_VERSION__/g, version),
+)
// The harness skill (Cowork / Claude Code), fetchable + droppable.
mkdirSync(join(site, 'skills/bento-deck'), { recursive: true })
cpSync(join(root, 'skills/bento-deck/SKILL.md'), join(site, 'skills/bento-deck/SKILL.md'))
diff --git a/skills/bento-deck/SKILL.md b/skills/bento-deck/SKILL.md
index 310707ab..e4a8f176 100644
--- a/skills/bento-deck/SKILL.md
+++ b/skills/bento-deck/SKILL.md
@@ -49,6 +49,9 @@ the console.
- **every cover / divider** → at least one ambient motion
- **repeated chrome / logo** → keep its `id` stable across slides so it
morphs in place
+ - a **demo clip / recording / soundbite** → a **media** element
+ (`kind: video|audio`); embed short clips as a data URI, link big ones by
+ URL to keep the file small
4. **Author** using the schema. Keep the full schema and copy-paste recipes
open: **fetch https://bento.page/agents.md** (it has the element shapes,
the morph/chart/state/ken-burns snippets, and the gotchas). Respect one
@@ -74,6 +77,10 @@ the console.
should animate together. Different ids = no morph (elements just cut).
- **Images/fonts must be embedded** as data URIs in `doc.assets` and
referenced by `"asset:<key>"` — the file stays self-contained.
+- **Media:** a `media` element (`kind: video|audio`) embeds short clips as a
+ data URI in `src` (self-contained) or references a URL for big files (keeps
+ the deck small). `autoplay` runs only in present mode and needs `muted:true`
+ for video. Don't embed large videos — they bloat the file.
- **Never regenerate `docId`** when editing; it is the document's identity.
- `template:true` → every open mints a fresh deck; `readonly:true` → the
file boots straight into the show with no editor.