@joplo-app/core 0.2.16 → 0.2.18

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.
@@ -26,18 +26,18 @@ export declare const DiffStep: z.ZodObject<{
26
26
  uncertain: "uncertain";
27
27
  }>;
28
28
  match: z.ZodEnum<{
29
- action: "action";
29
+ content: "content";
30
30
  key: "key";
31
+ action: "action";
31
32
  none: "none";
32
33
  uncertain: "uncertain";
33
- content: "content";
34
34
  }>;
35
35
  reasons: z.ZodArray<z.ZodString>;
36
36
  results: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
37
  kind: z.ZodEnum<{
38
38
  state: "state";
39
- outcome: "outcome";
40
39
  message: "message";
40
+ outcome: "outcome";
41
41
  }>;
42
42
  label: z.ZodString;
43
43
  before: z.ZodNullable<z.ZodString>;
@@ -79,18 +79,18 @@ export declare const DiffScenario: z.ZodObject<{
79
79
  uncertain: "uncertain";
80
80
  }>;
81
81
  match: z.ZodEnum<{
82
- action: "action";
82
+ content: "content";
83
83
  key: "key";
84
+ action: "action";
84
85
  none: "none";
85
86
  uncertain: "uncertain";
86
- content: "content";
87
87
  }>;
88
88
  reasons: z.ZodArray<z.ZodString>;
89
89
  results: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
90
  kind: z.ZodEnum<{
91
91
  state: "state";
92
- outcome: "outcome";
93
92
  message: "message";
93
+ outcome: "outcome";
94
94
  }>;
95
95
  label: z.ZodString;
96
96
  before: z.ZodNullable<z.ZodString>;
@@ -154,18 +154,18 @@ export declare const FeatureDiffManifest: z.ZodObject<{
154
154
  uncertain: "uncertain";
155
155
  }>;
156
156
  match: z.ZodEnum<{
157
- action: "action";
157
+ content: "content";
158
158
  key: "key";
159
+ action: "action";
159
160
  none: "none";
160
161
  uncertain: "uncertain";
161
- content: "content";
162
162
  }>;
163
163
  reasons: z.ZodArray<z.ZodString>;
164
164
  results: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
165
  kind: z.ZodEnum<{
166
166
  state: "state";
167
- outcome: "outcome";
168
167
  message: "message";
168
+ outcome: "outcome";
169
169
  }>;
170
170
  label: z.ZodString;
171
171
  before: z.ZodNullable<z.ZodString>;
package/dist/guide.js CHANGED
@@ -6,9 +6,10 @@ import { DIAGRAM_GROUP_ICONS, DIAGRAM_NODE_KINDS, DIAGRAM_TONES, SEQUENCE_BLOCK_
6
6
  export { SKILL_TOPICS };
7
7
  const related = {
8
8
  authoring: ['story', 'demo', 'focus', 'diagram', 'components', 'cases', 'check', 'selection', 'review', 'publish', 'diff'],
9
- story: ['authoring', 'cases', 'demo', 'focus', 'check'],
10
- demo: ['story', 'focus', 'authoring', 'diagram', 'components', 'check', 'review', 'publish'],
11
- focus: ['demo', 'diagram', 'check', 'authoring'],
9
+ story: ['authoring', 'cases', 'content', 'demo', 'focus', 'check'],
10
+ content: ['story', 'demo', 'focus', 'components', 'check', 'publish'],
11
+ demo: ['story', 'content', 'focus', 'authoring', 'diagram', 'components', 'check', 'review', 'publish'],
12
+ focus: ['demo', 'content', 'diagram', 'check', 'authoring'],
12
13
  diagram: ['demo', 'focus', 'components', 'check'],
13
14
  components: ['authoring', 'demo', 'focus', 'diagram', 'check'],
14
15
  cases: ['story', 'authoring', 'check'],
@@ -28,7 +29,7 @@ export function skillIndex(version, docs) {
28
29
  'Start here:',
29
30
  ...START_ORDER.map((s, i) => ` ${i + 1}. ${s}`),
30
31
  '',
31
- 'Topics (suggested order: authoring, story, cases, components, demo, focus, check; review before user testing; diagram, selection and publish when needed):',
32
+ 'Topics (suggested order: authoring, story, cases, components, demo, focus, check; review before user testing; content for explainers and video-like pieces; diagram, selection and publish when needed):',
32
33
  ...SKILL_TOPICS.map(t => ` ${t.name.padEnd(11)} ${t.description} ${skillTopic(t.name, docs).trimEnd().split('\n').length} lines`),
33
34
  'Usage: npx joplo skill <topic> Install for agents: npx joplo skill install',
34
35
  '',
@@ -123,6 +124,79 @@ function componentTopic(docs = {}) {
123
124
  ].join('\n');
124
125
  }
125
126
  const CONTENT = {
127
+ content: `# Joplo content production: content
128
+
129
+ For explainers, tutorials, science and news-explainer pieces that should feel like a good video, not a deck: the viewer watches a world change while a voice explains it.
130
+ Same machinery as demos: a feature is the episode, each case a chapter, each scenario plays one chapter (the published site plays them back to back), narrate() is the voice-over. Research and sources: docs/research/content-production.md. Full example: examples/llm-explainer.
131
+
132
+ ## 1. Required before TSX: package and plan (show it to the user)
133
+ - One thing the viewer should be able to repeat afterwards, in one sentence.
134
+ - Package first: the title asks the question; a thumbnail line of at most five words gives the surprising answer (complement the title, never repeat it); flow({ description }) is the cover sentence. The share preview is the first scenario's first frame, so design that frame as a thumbnail: one big line, one focal object, high contrast.
135
+ - Offer two or three framings that differ in device (one running example, misconception then correction, a number made tangible, before and after); put your recommendation first with a reason; build after the user picks.
136
+ - Chapters: one question per chapter. Case titles are numbered questions ('01 What does it actually read?'); expected is what the viewer can now say. List every point from the source material and map each to a chapter or drop it on purpose.
137
+ - One running example through every chapter (the same prompt, person, or data set), so each chapter builds on what the viewer already saw.
138
+ - Write the script as one line per step: ears (narrate), eyes (what changes on stage), source. Adjacent steps should connect with 'but' or 'so'; a chain of 'and then' is flat.
139
+ - Budget: narration reads about 4.5 CJK characters (2.5 English words) per second; 45–90 s per chapter. npx joplo outline counts narration in its estimates.
140
+
141
+ ## 2. Hook (first chapter, 20–35 s)
142
+ - Beat 1: a familiar scene that pays off the thumbnail. Never a logo, an agenda, or a definition first.
143
+ - Beat 2: the twist, shown on stage (the answer splits into pieces with probabilities, a name changes on the second try).
144
+ - Beat 3: pull back and name the questions the episode answers. Pin each question where it will be answered, and close every loop later.
145
+
146
+ ## 3. Not slides: one world, continuous objects, a moving camera (the core)
147
+ Failure mode, even with nice graphics: one board per chapter (big title, panels, footer), chapter title cards, cards of bullets, things fading in and out. Viewers read it as a deck. Instead:
148
+ - One layer holding one <Canvas w={2560} h={1600}> world (the default view is 1280×800, scaled to fit, never re-laid out; in a container without a height it sizes itself from the view ratio, and render warns 'Canvas has no size' if it still has none). Place a few containers absolutely in design pixels; lay out inside them with flex.
149
+ - Objects keep their identity: give each one motion="key". Write each arrangement as static JSX switched with when, reusing the same key; between steps Joplo flies the object from its old place and size to the new one, also across containers. Morph, never replace: the question's words split into tokens, flip into ids, then fly onto a tape; bars rearrange into a lottery strip.
150
+ - Camera: camera('id', …) frames those elements (Joplo measures them, adds pad, caps zoom); camera() shows the whole canvas. Establish wide, push in on detail, pull back for the payoff. Object flights in the same step follow the camera's timing, so both land together.
151
+ - Chapters continue: flow({ from: 'previousKey' }) starts from the previous chapter's last frame (state, camera, director layer). patch($.ui, { … }) changes several values in one step.
152
+ - screen children of the Canvas stay fixed on screen: chapter label, source line, poster, end card.
153
+ - Takeaways land on objects (a pinned question flips to '✓ answer'); the recap is a pull back to the whole world. Use .card() only when nothing on stage can carry the moment.
154
+ \`\`\`tsx
155
+ <Canvas w={2560} h={1600}>
156
+ <div id="tape" style={{ position: 'absolute', left: 120, top: 960, display: 'flex', gap: 8 }}>
157
+ {IDS.map((t, i) => <span when={eq($.ui.at, 'tape')} motion={\`tok_\${i}\`} style={{ background: COLORS[i] }}>{t}</span>)}
158
+ </div>
159
+ <div screen style={{ position: 'absolute', left: 20, top: 16 }}>{$.ui.chapter}</div>
160
+ </Canvas>
161
+ flow('What does it read?', { from: 'hook' })
162
+ .system('Split', 'Nine characters, seven pieces', patch($.ui, { mode: 'split' }), camera('bubble', { pad: 160 }))
163
+ .system('To the tape', 'It reads these numbers', patch($.ui, { at: 'tape' }), camera('tape', 'meter'))
164
+ \`\`\`
165
+ - Anti-deck test: three or more steps that only show or hide whole panels, or a frame that is mostly text, means rebuild those steps as objects that move or change.
166
+
167
+ ## 4. Choose the information shape, then the picture
168
+ - A number landing; before and after; ranking (bars from zero, length proportional); part of a whole (a strip whose segment widths are the shares); a process (one object going around a loop); misconception then fact; a timeline; a place (tiles or a simple map).
169
+ - Similar sentences get different pictures. Labels sit on the thing they name; no legends when a direct label fits.
170
+ - Compute numbers in TS from one source (for example probabilities from one set of scores) so every number on screen agrees. Label illustrative numbers on screen ('illustrative'), separate from sourced facts.
171
+
172
+ ## 5. Motion and layout numbers
173
+ - Camera moves 1–1.5 s, ease in-out. Object flights 0.9 s ease-out; stagger 60–120 ms (motionDelay); slow a landing pointer to 1.5–2 s (motionMs).
174
+ - One primary motion per step; text that is being read does not move.
175
+ - Entrances: put @keyframes and classes in themes/<name>.css and use className (staggered with animationDelay). Screenshots, thumbnails, and jumps show the end state. For a typewriter reveal give each character a short linear fade (about 80 ms) with its own delay; a 1 ms steps(1) animation can stay stuck invisible in Chromium.
176
+ - One accent color with a fixed meaning; color means the same thing in every chapter.
177
+ - Size text for the frame you show: about 28 design px is the floor at 1× zoom; a wide shot at 0.5× needs 40 or more, or enlarge the labels for that shot (a bigger variant under the same motion key).
178
+ - Frame by content (camera ids), not by guessed coordinates. Lay the world out as shot-sized clusters of roughly 16:10 (a machine with its output bars and strip, a chat with its bubbles); a cluster much wider than that leaves half the frame empty however you aim.
179
+ - Same subject, same frame: keep one camera for consecutive steps about the same cluster; frame what stays on stage (not a container that has just emptied).
180
+
181
+ ## 6. Narration, captions, numbers
182
+ - Caption: what the eye needs, ideally at most 16 CJK characters (24 is the hard limit). narrate(): what a presenter says, one or two sentences (rules: story section 6).
183
+ - One number per step, rounded and written as spoken; translate numbers ('one chance in 365'). Pointing words are fine ('look at the dashed line').
184
+ - When narration is on, keep on-stage text to labels; do not put the narrated sentence on screen too.
185
+
186
+ ## 7. Facts and sources
187
+ - All facts in one data module with source and date; a source line (screen element) per chapter; name studies in narration ('OpenAI, in a 2025 paper, explains …').
188
+ - Say only what the source says. Bars start at zero. Separate illustrative values from facts on screen.
189
+ - Images: licensed or public domain, credited, CREDITS file next to them (story section 7).
190
+
191
+ ## 8. Ending
192
+ - Pull back to the whole world: every pinned question now shows its answer. Then one concrete action the viewer can take right away, as a screen element. Stop once the value lands; no 'thanks for watching'.
193
+
194
+ ## 9. Required: review before handing over
195
+ - npx joplo check until 0 errors. HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it.
196
+ - Storyboard every chapter: npx joplo render --scenario-id <id> --sheet --out board.png prints every step in one image with its caption and narration. Read it frame by frame and assume the first one has problems: half-empty frames, objects cut at the edge, labels overlapping, text too small in wide shots, the chapter label covering content. Fix, then storyboard again.
197
+ - Play each chapter in the board with Voice on: flights and camera land together, nothing leaves the frame mid-flight, narration finishes before the next step.
198
+ - Evidence, not belief: 'it plays' needs check 0 errors plus a run in the board; 'it looks right' needs the rendered frames; 'it is clear' needs captions-only and frames-only passes that both tell the story.
199
+ - Tell the user what you could not verify (a real voice on a phone, other window sizes).`,
126
200
  story: `# Joplo storytelling and planning: story
127
201
 
128
202
  A demo is a short story a viewer follows without you: who wants what, what gets in the way, what the product does, and the visible result.
@@ -210,7 +284,7 @@ A character speaking: .click('can_go', 'Ajie replies: I can go', say('Count me i
210
284
  Check: read every line aloud in order without looking at the screen. It should sound like one person telling one story, briskly.
211
285
 
212
286
  ## 7. Explainers and news-style demos (a topic, not a product)
213
- When the demo explains a topic (an election, a policy, a market move) instead of a product, the rules above still hold: every claim becomes a graphic that changes on screen, never a slide of bullets.
287
+ When the demo explains a topic (an election, a policy, a market move) instead of a product, the rules above still hold: every claim becomes a graphic that changes on screen, never a slide of bullets. The full method (package, hook, one Canvas world, camera, morphing objects, chapters with from, review): npx joplo skill content.
214
288
  - Arc: a hook naming what happened and who it happened to → the rule in about 30 seconds → the reveal (numbers change on screen) → a twist or context (history, base rates) → why it matters to the viewer → a short closing card. One chapter per scenario, one case per chapter; the published site plays them back to back with an Up next countdown, like one video.
215
289
  - Case titles are what viewers read in the board sidebar: for an explainer write them as numbered chapter headlines ('01 What is on the ballot?'), not acceptance criteria; name the option after the style ('Dark quick-cut'), not 'A'.
216
290
  - Graphics that carry the story: a seat chart filling up, a tile map recoloring, bars growing or flipping, a document flying between two sides and getting stamped. Build them from divs with style bound to state (demo: Custom motion) and real photos (components: Real images).
@@ -264,7 +338,8 @@ Use the actual source and decisions as evidence. Label reconstructed history and
264
338
  - routes: { '/members/new': page({ title: 'New member' }, <Stack>…</Stack>) }: add a route for this option.
265
339
  - state: { ui: { ready: false }, data: {}, inputs: {} }: initial option state.
266
340
  - scenarios: { happy: flow('Success', { cases: ['happy'], start: '/members' }).click('invite', done('Completed')) }.
267
- - flow(name, { cases?, start?, state?, description?, expected?, mock?, outcome? }): state overrides the option's initial state; description and expected describe the scenario.
341
+ - flow(name, { cases?, start?, state?, from?, layer?, description?, expected?, mock?, outcome? }): state overrides the option's initial state; description and expected describe the scenario.
342
+ - from: 'otherKey' starts from the end of another scenario of the same option (its route, state, canvas camera, and director layer), then applies state on top: chapters of one story, long flows in parts. Its steps are checked against that ending page and layer, so do not also write start. layer: 'key' sets the starting layer.
268
343
  - outcome: 'success' | 'failure' | 'denied' | 'other' is the board's result badge ("Mock failure"). Without it, the badge follows done's second argument, else success. mock: 'Mock: link expired' replaces the badge text.
269
344
  - See cases for case and coverage declarations; publish for pick and publishing.
270
345
 
@@ -273,7 +348,8 @@ Use the actual source and decisions as evidence. Label reconstructed history and
273
348
  - .toggle(id, boolean, ...args); .back(...args); .system('Mock event', ...args).
274
349
  - .press('⌘K', ...args) / .press('Enter'): a targetless user keyboard step. The default caption describes pressing ⌘K; effects work like ordinary steps.
275
350
  - String args are optional captions; other args are effects. All methods are chainable.
276
- - set($.ui.ready, true): replace state; push($.data.rows, row): append an array item.
351
+ - set($.ui.ready, true): replace state; push($.data.rows, row): append an array item; patch($.ui, { ready: true, mode: 'code' }): several set()s in one argument.
352
+ - camera('id', …, { pad?, zoom?, ms? }): move the camera of a <Canvas> to frame those elements (camera() = whole canvas); see content.
277
353
  - toast('Message') / toast.success/error/info('Message'): a message for the current step.
278
354
  - go('/members'): change route within the current option; back returns to the previous route.
279
355
  - done('Result', 'success'|'failure'|'cancelled'): end the scenario; default is success. It also sets the result badge (cancelled shows as other) unless flow({ outcome }) is written; if both are written they must agree, otherwise check warns OUTCOME_MISMATCH.
@@ -339,6 +415,7 @@ After editing, run npx joplo check. View the board; use npx joplo selection to r
339
415
  See check for diagnostic fixes and selection for editing only the selected location.`,
340
416
  demo: `# Joplo demos: demo
341
417
 
418
+ For demos of secrets or gated access, use masked placeholders as the sample input; real secrets must never enter source, IR or exports. Show setting, keeping and removing protection as distinct states; a demo gate is not real access control.
342
419
  Tell one thing per step: separate viewpoints with independent layers, zoom into details with shots, and describe what happened with short captions.
343
420
  See authoring for directories, state, and flow syntax. Import layer, shot, trace, explain from @joplo-app/kit.
344
421
  What viewers look at in each step, and the lighter forms (spotlight, highlight, callout, numbered, hold, redact): npx joplo skill focus.
@@ -371,7 +448,7 @@ What viewers look at in each step, and the lighter forms (spotlight, highlight,
371
448
  - Captions and explain notes appear below the stage, never over it. Tell one thing per step; move long content to an explanation layer. How to write them, and how to plan openings and endings: story.
372
449
  - Narration (D74): the board and published site can read each step aloud during autoplay (on the board viewers turn it on with the speaker button; a published site or embed that carries generated audio starts with narration on, and viewers can turn it off). Without say() the caption is read (cards read title and sub; explain is not read), which sounds like a screen reader. narrate('…') gives a step the narrator's spoken line and say('…') a character's own words, both kept apart from the caption (the caption is for the eye and stays short). How to write them: npx joplo skill story (section 6). Autoplay waits for the voice to finish plus a short breath before the next step.
373
450
  Example: .type('email', 'ana@example.com', 'Ana enters the email', narrate('She invites Leo as an editor; the role can change later.')).
374
- Voices are set up in the board (Voice → Manage providers; keys stay on this machine). config({ voice: { narrator: 'nova', roles: { leo: 'echo' } } }) picks voices per role; generated audio is bundled by build and share.
451
+ Voice sources (D85): the browser voice, Joplo Cloud narration (no key; the default once the user is signed in with npx joplo login), and official OpenAI or ElevenLabs with the user's own key (Voice → Manage keys; keys stay on this machine). Generate audio in the board (Voice → Generate missing audio) or with npx joplo voice; generated audio is bundled by build and share. config({ voice: { profile: 'cloud', narrator: 'narrator-warm-f', roles: { leo: 'deep-m' } } }) pins the source and voices per role (Joplo Cloud voices: narrator-warm-f, narrator-calm-m, bright-f, friendly-m, clear-f, deep-m; all speak every language). Costs, limits and errors: npx joplo skill publish (Narration).
375
452
  - Autoplay reading time: CJK 8 chars/s (125ms each), Latin 15 non-whitespace chars/s; clamp to 3–7 seconds before 0.5× / 1× / 1.5× scaling. Streams, shots and edge waits can exceed 7 seconds. Shots use 700ms ease-out without overshoot.
376
453
  - Do not make viewers scroll through a long page. Fit one screen and zoom into details with shots.
377
454
  - Each page has one device, desktop by default. page({ viewport: 'mobile' }, tree) uses a Phone frame at a fixed width of 390.
@@ -397,6 +474,7 @@ What viewers look at in each step, and the lighter forms (spotlight, highlight,
397
474
  - Ids are qualified: option invite.a-modal, case invite.no_permission, scenario invite.a-modal.happy. step=n is the state after n steps (0 = initial). l is the layer key from layers: { … }; it pins that layer and turns Follow director off, so later steps do not switch layers. Omit l to follow the director.
398
475
  - Other parameters (layer=, option=, scenario= in the hash) are ignored; the board logs a console warning naming them.
399
476
  - Screenshot one step: npx joplo render --scenario-id invite.a-modal.happy --step-id 'invite.a-modal.happy#2' --out shot.png. It waits for fonts, layout, and the camera.
477
+ - Storyboard a whole scenario: npx joplo render --scenario-id invite.a-modal.happy --sheet --out board.png (every step in one image with captions and narration; --columns 1–6).
400
478
  - render needs the Joplo export component (Playwright + Chromium, about 100 MB, installed once under ~/.joplo, never into the project). Without it render exits 4 with EXPORT_COMPONENT_MISSING and downloads nothing. It is a large download, so confirm with the user, then run npx joplo setup export (npx joplo setup export --status checks without installing). Writing demos, dev, check, build, and share do not need it.
401
479
  - In a browser, open the deep link, wait for [data-jcamera][data-camera-settled="1"] plus two animation frames, then capture. During autoplay or typing animations the DOM can be ahead of the pixels; pause first.
402
480
 
@@ -423,6 +501,9 @@ What viewers look at in each step, and the lighter forms (spotlight, highlight,
423
501
  - Keyboard history: type reuses character-by-character preview during playback; press shows keycaps. Static views show only the latest input/keypress; other steps clear it. Empty keys are hidden.
424
502
  Example: .type('prompt', 'Plan a weekend camping trip').press('Enter', set($.ui.asked, true)). Chords such as '⌘K' split into two keycaps automatically.
425
503
 
504
+ ## Canvas: one world, a free camera, morphing objects
505
+ - For explainers and motion graphics, put one <Canvas w={2560} h={1600}> in a layer: a 1280×800 design view scaled to fit, children in design pixels. camera('id', …) frames elements by their size (no focus ring, zoom up to 3× by default); elements with the same motion="key" fly between arrangements and containers; screen children stay fixed on screen. Recipe and review: npx joplo skill content.
506
+
426
507
  ## Custom motion with style bindings
427
508
  - For news-style graphics (a seat chart filling up, a bar growing, a document flying across), bind style values to state and give them a CSS transition: <div id="paper" style={{ left: $.data.paperX, transition: 'left 1.2s ease' }}/>. A step that set()s a new value animates the element.
428
509
  - Keep the element mounted across steps (do not swap it with when), so the browser can animate between the two values. Stagger many elements with transition-delay.
@@ -431,6 +512,7 @@ What viewers look at in each step, and the lighter forms (spotlight, highlight,
431
512
  - Props that shape a Diagram's layout (tone, label, kind) are fixed at compile time and cannot bind state. To recolor per step, draw that part with your own elements and a bound style.
432
513
  - Ids inside reusable graphics must be unique across layers: prefix them with the instance id (map_TX, not TX). A cue resolves an id to the first layer that has it, so the same id on two layers sends the director to the wrong layer, and check cannot tell which one you meant.
433
514
  - Let a missing asset() fail loudly. Do not wrap it in try/catch with a drawn fallback: a stale dev process or a wrong path then shows a substitute without any error.
515
+ - One screen in several variants (languages, brands, plans): bind every visible string to $.ui, keep the variants in one table, and write a helper that returns the set() effects for a whole variant (...variant('ja')). Include breadcrumbs, badges, button labels, status text and captions; render one key frame per variant to catch strings left in the old variant.
434
516
 
435
517
  ## Write a theme
436
518
  - A theme is a CSS file at themes/<name>.css in the project root. Set theme: '<name>' in joplo.config.ts as the default. A custom theme overrides a built-in with the same name.
@@ -501,6 +583,7 @@ Choose by the question: "what is where" → Diagram; "what happens in what order
501
583
  - Leave out direction: Joplo tries top → bottom and left → right and keeps the one that fills the stage with the largest text (domain groups end up side by side). direction="right" / "down" forces one; aspect={1.6} sets the wanted width / height; h="100%" fills a layer.
502
584
  - Source order is the order within a layer: write nodes, groups, and edges in reading order. Write the request edge before its reply (api → kernel before kernel → api): the later one is drawn as a return edge.
503
585
  - Mark secondary flows async (usage events, audit logs): they may stop pushing their target a layer down, so domains sit side by side instead of in a tall column.
586
+ - When two chains feed one node (author → storage → player, and viewer → player), write the upstream chain's groups and edges first, in the direction data flows. An edge written before its upstream chain is drawn as a loop back across the stage.
504
587
  - pin="start" / pin="end" puts a node or group in the first / last layer of its group. The layout covers every element, including ones hidden with when: nodes never move between steps.
505
588
  - In each step only the traced call is bold, colored, with a moving dot and its label outlined; other edges turn thin and light. One call per step reads best.
506
589
 
@@ -603,6 +686,7 @@ With layers, a cue switches the director to its target's layer when the step has
603
686
  - shot() on a layer whose next step clicks outside the framed area → the click target is off screen (render warns "Outside frame"). When the whole layer fits one screen, use highlight / spotlight instead of shot.
604
687
  - numbered() on items that already print their own numbers → two sets of badges; spotlight the group instead.
605
688
  - Rings everywhere: if everything is highlighted, nothing is.
689
+ - shot() to travel around an explainer → a pulsing ring around each target and at most 1.25× on UI; inside a <Canvas> use camera('id', …), which frames by content without a ring (see content).
606
690
 
607
691
  ## Example
608
692
  \`\`\`tsx
@@ -719,11 +803,13 @@ Example: features/invite/options/a.tsx:12:5 warning UNBOUND_INTERACTIVE Inter
719
803
  - EXPLAIN_TOO_LONG: Shorten the explain note to about 48 units, using the same CJK 1 / other 0.5 calculation. Put detailed rationale in a separate explanation layer. See demo.
720
804
  - SAY_TOO_LONG / NARRATE_TOO_LONG (warning): a say() or narrate() line over about 80 units (about 10 seconds aloud). Autoplay waits until it is read; say less or split the step.
721
805
  - SAY_EMPTY / NARRATE_EMPTY: say() needs the character's words, narrate() the narrator's. Remove it to fall back to the caption.
722
- - VOICE_CONFIG_INVALID: config({ voice }) takes { profile?, narrator?, roles?: { roleKey: 'voice' } } with non-empty strings. API keys never go in the config.
806
+ - VOICE_CONFIG_INVALID: config({ voice }) takes { profile?, narrator?, roles?: { roleKey: 'voice' }, locales?: { ja: { narrator?, roles? } } } with non-empty strings. API keys never go in the config.
807
+ - LOCALES_INVALID / LOCALES_UNDECLARED: config({ locales }) lists supported languages once each, source language first; every locales/<lang>.json must be listed there and must not be the source language. LOCALE_FILE_INVALID: the file must be one JSON object of "source text": "translation" strings.
808
+ - I18N_MISSING / I18N_STALE / I18N_UNUSED (warnings): texts with no translation (viewers see the source text), a source text that changed (the closest old entry is shown: rename the key and update the translation), entries nothing uses. npx joplo i18n add <lang> adds the missing keys.
723
809
  - DESCRIPTION_TOO_LONG: flow({ description }) is the scenario cover sentence; keep it within 30 units, one sentence saying what this scenario shows. See story.
724
810
  - CARD_TEXT_TOO_LONG (info): a transition card's sub is over 48 units, a point over 24, or more than 4 points. Keep one sentence and a few short points; move details into steps.
725
811
  - SCENARIO_TOO_LONG (info): the scenario plays over 90 s at 1×. One scenario tells one thing: split it (happy path, then each recovery) or branch with fork(). npx joplo outline shows the pacing.
726
- - HAPPY_PATH_ONLY (info): every case is a main-flow case and every scenario succeeds. Ask about input, permission, async, and lifecycle cases (see cases), then add an error-and-recovery scenario. Do not invent behavior.
812
+ - HAPPY_PATH_ONLY (info): every case is a main-flow case and every scenario succeeds. Ask about input, permission, async, and lifecycle cases (see cases), then add an error-and-recovery scenario. Do not invent behavior. Explainers and other content whose chapters are all main-flow can ignore it (see content).
727
813
  - ROLE_UNKNOWN: A layer or card role is not in feature.roles. Declare roles as { key: role('Name') }; see demo.
728
814
  - ICON_UNKNOWN: A layer icon is not a preset. Use one of ${LAYER_ICONS.join(', ')}; see demo.
729
815
  - FORK_UNKNOWN: fork must target another scenario key in the same option; it cannot reference itself.
@@ -735,7 +821,10 @@ Example: features/invite/options/a.tsx:12:5 warning UNBOUND_INTERACTIVE Inter
735
821
  - CALLOUT_TOO_LONG (warning): callout text over about 24 units (same count as captions). Say the reason in a few words; move the rest to explain().
736
822
  - FOCUS_IDLE (info): three or more system steps in a row change nothing on stage. Merge them, or show what happens (set() visible state, highlight, callout, shot).
737
823
  - INVALID_REDACT / AUTOFOCUS_INVALID: redact takes true/false or a condition (redact={not($.ui.revealed)}); config({ autoFocus }) takes true or false.
738
- - LAYER_UNKNOWN: Invalid layer key or missing content. Use letters/digits/underscores/hyphens, do not start with @, and provide nonempty JSX.
824
+ - LAYER_UNKNOWN: Invalid layer key or missing content, or flow({ layer }) names a layer the option does not declare. Use letters/digits/underscores/hyphens, do not start with @, and provide nonempty JSX.
825
+ - CAMERA_UNKNOWN / CAMERA_INVALID: camera() targets must exist in a layer (put them inside a <Canvas>); pad 0–2000, zoom 0.1–10, ms 0–10000. See content.
826
+ - FROM_UNKNOWN / FROM_CYCLE / FROM_FAILED: flow({ from }) must name another scenario key of the same option, must not loop back, and that scenario must replay without errors (fix it first).
827
+ - FROM_WITH_START: a scenario with from starts where the other one ended (its route and layer); remove start, or remove from to start fresh. Step checks and auto captions already use that ending page.
739
828
  - TRACE_UNKNOWN: Empty trace, unknown id, ids from different diagrams, or a disconnected path. Use connected ids in one Diagram / StateMachine / Sequence.
740
829
  - TRACE_AMBIGUOUS: Multiple candidate edges or messages between two nodes. Use the specific edge / message id in trace.
741
830
  - THEME_UNKNOWN: config({ theme }) names neither a built-in nor themes/<name>.css. Use a built-in or add that CSS file; see Write a theme in demo.
@@ -778,7 +867,7 @@ When the user points to a stage element, read selection first for its exact loca
778
867
  Use for an active review, a receipt test, resuming a listener, or applying review conclusions. Local reviews do not require Cloud login or a share. The joplo-feedback skill covers the full receive-and-apply workflow.
779
868
 
780
869
  ## Local quick start
781
- Run dev and the follower in separate long-running shell sessions. joplo dev prints the board URL on stdout and this exact follow command on stderr:
870
+ Required after every round of development: start the follower before handing the board URL to the user, even for small changes; never end your response without a running watcher (use --once). Run dev and the follower in separate long-running shell sessions. joplo dev prints the board URL on stdout and this exact follow command on stderr:
782
871
 
783
872
  npx joplo dev ./demo
784
873
  npx joplo feedback watch ./demo --local --follow --json
@@ -943,25 +1032,58 @@ Provide the site name and compatibility date through Wrangler project configurat
943
1032
  Deploy only dist output, not author source files. MCP, comments, and collaboration are planned separately.
944
1033
 
945
1034
  ## Cloud sharing
1035
+ - Required: before EVERY publication ask the user “public or private?” and “also publish a review version?”. Never decide either for them, infer from project settings, or reuse last time. Only publish within the authorized scope; the examples below assume the user explicitly chose those flags. CI must pin both choices in the workflow.
1036
+ - Pass --public or --private AND --review or --no-review on every share. Missing choices fail with CHOICE_REQUIRED (exit 2) before login, check, build, or network in non-TTY, CI, --json, or --format json. An interactive terminal asks for each missing choice; public and no-review are highlighted but require a keypress.
1037
+ - Public shares enter show.joplo.app/@username and search engines. Write project names, descriptions and feature goals as you want them to appear in search results; never include unpublished information. Private means only people holding the link can view; it is not password protection.
1038
+ - --pr and scoped --scenario / --feature are always private: visibility flags may be omitted, --public is rejected (exit 2), but the review choice remains required. Comparisons (diff publish) are always private and do not support review versions, so neither choice is required there.
1039
+ - --review publishes picked options at data.url AND a separate private review version at data.review.url. Give reviewers the latter. It includes every option, is commentable, and never becomes a public portfolio entry. If the second publication fails, the main link may already be live: read stderr and retry with the same choices without --new.
1040
+ - Success JSON may include visibility and portfolio { workUrl, profileUrl, needsUsername, setupPath }. With a username, use workUrl; with needsUsername, tell the user to set a username at <server><setupPath>. Old servers may omit these fields: do not dereference absent portfolio or null URLs.
946
1041
  - Run npx joplo login and verify the code in your browser before authorizing. Use --no-browser to open the URL manually over SSH or without a local browser.
947
- - Agents publish with npx joplo share --format json. It checks, builds, and uploads only the published output.
1042
+ - Agents publish with npx joplo share --private --no-review --format json. It checks, builds, and uploads only the published output.
948
1043
  - AUTH_REQUIRED exits 3: ask the user to run npx joplo login in their own terminal, then retry share. Agents must not authorize on their behalf.
949
1044
  - On AUTH_REQUIRED, ask the user to sign in. Do not run \`joplo logout\` on the user's behalf.
950
1045
  - AUTH_EXPIRED also exits 3: ask the user to sign in again. Read error.code / message / details for other failures.
951
- - Free links expire after 7 days; read data.expiresAt for the exact time. Pro permanent links have expiresAt: null.
1046
+ - Links do not expire (expiresAt: null), for free accounts too. What is limited is account storage: the raw size of the current version of every live share, not deduplicated (free 100 MB, Pro 5 GB; the exact numbers come from the cloud). After publishing, data.storage is { usedBytes, quotaBytes, shareBytes }; text output prints "Storage: … of … used (this share: …)".
1047
+ - When a share does not fit, share fails with QUOTA_EXCEEDED, error.details.kind = "storage", and exit code 6. Nothing was uploaded and existing links keep working. Pass on the message: how much this share needs, how much is left, and error.details.manageUrl (free up space) and upgradeUrl. Never delete the user's shares to make room unless they ask; updating the same link only counts the difference.
952
1048
  - Free shares and sites from joplo build carry a small, faint Joplo icon in the stage's top-right corner (it opens joplo.app in a new tab); keep that corner free of important content. Only Joplo Cloud removes it, for Pro creators' shares (embeds too); local exports have none.
953
- - Successful share JSON includes data.embed: { iframe, markdown, badge, preview }. To add the demo to a README, write data.embed.markdown as is; do not build badge links yourself. For a free link, tell the user the badge shows "expired" after data.expiresAt.
1049
+ - Successful share JSON includes data.embed: { iframe, markdown, badge, preview }. To add the demo to a README, write data.embed.markdown as is; do not build badge links yourself. Only a non-null data.expiresAt from an old or PR share can expire; new free links are permanent.
954
1050
  - data.embed.iframe embeds a player for blogs and docs: it shows a cover first; append &scenario=<scenario id> to pick the start or &autoplay=1 to skip the cover.
955
1051
  - share also uploads a 1200x630 preview image of the default scenario when the export component is installed (npx joplo setup export, or Playwright already in the project); without it, share still succeeds, prints one "Skipped the preview image" line, and never downloads anything.
956
- - Pro share updates the same-server link in .joplo/cloud.json; --new creates another link and --title sets its title.
1052
+ - Re-sharing updates the same-server link in .joplo/cloud.json, for free and Pro accounts alike; --new creates another link and --title sets its title.
957
1053
  - The review version is a separate share (review: { shareId, url } in .joplo/cloud.json); it never replaces the main link. If the cloud rejects the review manifest, plain share retries once without it and still publishes.
958
1054
 
1055
+ ## Narration (Joplo Cloud and your own keys)
1056
+ - Voice sources are only: browser voice (free, local), Joplo Cloud narration (signed in, no key, billed in characters), and official OpenAI / ElevenLabs (the user's own key; the API address is fixed). AiHubMix, OpenAI-compatible gateways with a custom Base URL and custom HTTP providers were removed: an old one shows "No longer supported" in the board. Audio it already generated still plays and is still bundled by build and share; it cannot make new audio. Ask the user to switch sources; do not edit ~/.joplo/voice/profiles.json yourself. An old OpenAI / ElevenLabs entry pointed at another address (a proxy), headers or response format is also "No longer supported": its key was for that proxy and is never sent to the official API; deleting it in Manage keys restores the official provider.
1057
+ - Default: a project that never chose a source and has no config voice.profile uses Joplo Cloud narration when the user is signed in, otherwise the browser voice. Choosing Browser voice in the board sticks. Re-sharing a project that never chose a source prefers valid audio already generated for the current default, then reuses matching text from the previous share. Different voices can coexist per language, role and text; the published playback index preserves their real fingerprints, including on a later update from another machine. Do not regenerate everything or explicitly change sources just to make an update include new clips; an explicit source change deliberately stops inheriting the old source.
1058
+ - After changing an automatic caption's label, input/selected value or keys, rebuild before sharing: audio is eligible only if its text matches the current caption in that clip's language. Valid local audio takes priority over reusable published audio only after this check. Stale text, unknown languages or mismatched cache keys are excluded from the site files and playback index; a step with no valid clip counts as missing and uses the browser voice. Do not treat matching step IDs or a previous successful generation as proof that a clip is current; preserve valid clips in the other interface languages instead of deleting the whole cache.
1059
+ - Joplo Cloud narration is requested only when the user clicks Generate missing audio or runs npx joplo voice: playback never generates or prefetches it (that would spend characters). Steps without audio use the browser voice, marked "Browser voice" in the caption area. OpenAI / ElevenLabs with the user's own key still generate the step being played and prefetch the next few.
1060
+ - An old custom provider whose id was cloud keeps its original fingerprint and No longer supported state, including existing board/config references. To deliberately switch, choose Joplo Cloud in the board; when voice.profile is in config, set it to the unambiguous official name 'Joplo Cloud' (config still takes priority over the board). This does not send the old provider's key to the official service.
1061
+ - Per-language voices are pinned: the first successful clip in a non-default content language records the Joplo Cloud voice picked for it (the cloud's recommended voice for that language: the current voice stays if it is recommended, otherwise the first recommended one of the same gender) in .joplo/voice/index.json (pins). Later builds, shares and machines use the pinned voice, so recommendation changes never invalidate audio or charge again; config({ voice: { locales } }) still overrides. Invalid pin languages, maps or voice IDs are ignored individually and valid entries remain; a missing/invalid entry uses the normal recommendation rule and is saved after successful generation. Do not delete the whole voice index or edit it by hand to recover pins, because it also indexes the audio cache.
1062
+ - Cloud unreachable, or an older cloud without narration: audio already generated still plays and ships, generation is unavailable (the board says so; npx joplo voice exits with NETWORK and sends nothing); --dry-run still estimates.
1063
+ - Characters: each clip costs Array.from(text).length characters, charged only when generation succeeds. Regenerating the same text and voice is served from cache for free, and audio already in .joplo/voice/ is never requested again. Previewing voices in the board (▶ Preview) plays prepared samples and costs nothing. Free accounts get a one-time trial; Pro gets a monthly allowance; top-up packs add more (bought in the console, <server>/usage).
1064
+ - Generating spends the user's characters. Before a large batch run npx joplo voice --dry-run (prints the steps and characters it would use and what would be left) and tell the user; generate when they asked for narration or agree. npx joplo voice --format json generates the missing clips for every picked option and content language; data.quota.totalRemainingChars is the cloud's own count after the last clip (never compute it yourself).
1065
+ - npx joplo whoami (text and --format json data.voice) shows what is left: totalRemainingChars, period trial or month, resetsAt.
1066
+ - TTS_QUOTA_EXCEEDED exits 7: generation stopped; clips already made are kept and the remaining steps use the browser voice (the demo still plays; the board marks those steps "Browser voice"). Pass on error.details (neededChars, remainingChars, usageUrl for a top-up pack). Do not retry in a loop, switch providers, or buy anything on the user's behalf.
1067
+ - VOICE_NO_SOURCE: nothing can generate (signed out and nothing chosen, a missing OpenAI / ElevenLabs key, or config names a profile this machine lacks); ask the user to run npx joplo login in their own terminal or add a key in the board. VOICE_UNSUPPORTED: the chosen source is an old, removed one; ask the user to switch. EMAIL_UNVERIFIED: the user must verify their email (or sign in with GitHub) first. AUTH_REQUIRED / AUTH_EXPIRED exit 3 as for share.
1068
+ - With JOPLO_API_KEY, narration needs a key that has the voice:generate scope; otherwise generation fails with AUTH_EXPIRED / FORBIDDEN naming the scope.
1069
+ - Temporary cloud errors (503, 429, network) are retried; steps that still fail are listed and the next run retries only them.
1070
+
1071
+ ## Password protection (Pro)
1072
+ - Only for private ordinary/scoped shares. Ask whether the user wants a password; NEVER invent, select, or set one for them. Ask the user to enter it in their own terminal or set JOPLO_SHARE_PASSWORD themselves. Never write a password into shell history, files, source, or conversation summaries.
1073
+ - In a terminal: npx joplo share --private --no-review --password prompts with hidden input and asks once to confirm. Non-interactive: the user sets JOPLO_SHARE_PASSWORD securely, then runs the same command; an explicit --password <value> also works but risks shell history. An environment variable alone does nothing: --password must be present. Use 8–128 Unicode characters (code points), without trimming.
1074
+ - Omit --password / --no-password to keep existing protection. --no-password removes it, including after a downgrade to free; setting/changing needs Pro (founding members included). --public, --pr and diff publish cannot use either password flag (exit 2, no network); the two flags conflict.
1075
+ - When changing an existing public share without local records, use --update <share link> --private with the chosen password action. Setting or removing a password explicitly sends visibility: private, including from the board; it never relies on cached visibility. Omitting both password flags preserves the existing request compatibility rules and protection.
1076
+ - With --password and --review, both publications use the same password; the CLI says so. Success reports password protection and data.passwordProtected (old Cloud missing it = false), never the password. Main/review are still independent publications: if review fails after main succeeds, retry with the same choices and ask the user to supply the password again.
1077
+ - The board reveals Set access password (Pro) only for private shares. Free accounts get an upgrade link, Pro gets masked input with Show/Hide; an already protected link says Password protected and defaults to keeping it. First remove protection in a private update before changing visibility to public. Drafts clear on close, scope changes, or publication; after a failure the user must re-enter a new password.
1078
+ - HTTP 403 PLAN_REQUIRED exits 1: give the user error.details.upgradeUrl (<server><upgradePath>), never retry with --new to bypass Pro. HTTP 400 mentioning password reports that Cloud does not support password viewing yet (exit 1): wait for Cloud rollout; ordinary private shares without either flag still use the old strict request schema.
1079
+ - The password goes only through browser POST → server → cloud-bridge → CLI → Cloud create request, in memory. Local records contain only passwordProtected; task snapshots/GET/WebSocket, logs, stdout/JSON, IR and build files never contain it. Cloud enforces the viewer gate for pages/resources/audio/Agent/embeds and generic preview cards; a local static build is not protected. Do not claim a local overlay provides access control.
1080
+
959
1081
  ## Share part of the project
960
1082
  - To share only some scenarios, add --scenario <scenario id> (repeatable); --feature <feature id> shares that feature's picked-option scenarios (every option with --review). They combine. Scenario ids look like invite.a-modal.success; npx joplo outline lists them.
961
1083
  - Everything outside the scope is cut at build time, not hidden: other features, options, scenarios, their pages and stacked elements, and the project description never reach the uploaded files or the review manifest. A deep link (#/f/<feature>?s=<scenario>) or embed &scenario= only picks where viewing starts and is not private.
962
1084
  - If a scoped step uses an element another feature stacked onto the page (action target, shot, mark, cue, callout, trace) or navigates to a page another feature added, only that element or page is kept. share prints "Borrowed from another feature: …" and lists them in data.scope.borrowed; tell the user and ask whether that is acceptable. To leave one out, change the scenario so it no longer uses it.
963
- - A wrong scenario or feature id fails with NOT_FOUND and suggestions; a scenario of an option that is not picked, or a feature without pick, fails with USAGE (exit 2). Nothing is built or uploaded.
964
- - Each scope is its own share, stored under scoped in .joplo/cloud.json (key: sorted scenario ids joined by commas, prefixed review: for --review). It never replaces the main or review link; Pro re-sharing the same scope updates that link.
1085
+ - A wrong scenario or feature id fails with NOT_FOUND and suggestions. Without --review, a scenario of an option that is not picked, or a feature without pick, fails with USAGE (exit 2) before build/upload. With --review, the ordinary share contains only picked scenarios in the requested scope, while the private review includes all requested options. If that scope has no picked scenarios, only the private review is published: data.mode is review and data.url is the review link (no data.review); the ordinary share and --update target stay unchanged.
1086
+ - Each scope is its own share, stored under scoped in .joplo/cloud.json (key: sorted scenario ids joined by commas, prefixed review: for --review). It never replaces the main or review link; re-sharing the same scope updates that link for free and Pro accounts.
965
1087
  - Check the result locally first with npx joplo build --scenario <id> (same scope rules).
966
1088
  - The author can also publish from the board: Export ▾ → Publish to Joplo Cloud (blue item) offers this scenario, this feature, or the whole project, and shows a copyable login command when signed out.
967
1089
  - npx joplo whoami --format json shows the account, plan, and limits; npx joplo logout signs out.
@@ -971,13 +1093,30 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
971
1093
  - Cloud commands accept --server <url>, overriding JOPLO_CLOUD_URL; the default is https://cloud.joplo.app.
972
1094
  - Local check / build / dev remain free and do not connect to the cloud.
973
1095
  - CI: set JOPLO_API_KEY (jpk_..., created in Settings → API keys) instead of logging in. Every cloud command then uses it; credentials.json and browser login are never touched. An invalid or revoked key returns AUTH_EXPIRED: ask the user for a new key.
974
- - PR previews: in GitHub Actions run npx joplo share --new --pr <number> --format json; repo, commit, and run URL come from the Actions environment. Outside Actions pass --repo owner/name. data.pr.comment "skipped" means the Joplo GitHub App is not installed; tell the user, the share itself succeeded.
1096
+ - PR previews: in GitHub Actions run npx joplo share --private --no-review --new --pr <number> --format json; repo, commit, and run URL come from the Actions environment. Outside Actions pass --repo owner/name. data.pr.comment "skipped" means the Joplo GitHub App is not installed; tell the user, the share itself succeeded.
1097
+
1098
+ ## Viewers in several languages
1099
+ - Write the source files in one language. To add another: npx joplo i18n add <lang> (first time also --source <source lang>). It adds the language to config({ locales }) (the first entry is the source language) and writes locales/<lang>.json as "source text": "" for every text viewers see: screens, captions, narrate / say, cards, toasts, done, feature and scenario names, displayed sample data, and board-only texts (case titles and expected results, rules, questions, element notes).
1100
+ - Translate every "" yourself, whole sentences, keeping on-screen names consistent where captions quote them; narration as people say it in that language. Do not put t() calls or per-language objects in the TSX. Then npx joplo check: I18N_MISSING lists what is left, I18N_STALE means a source text changed (it shows the closest old entry: rename the key and update the translation).
1101
+ - After editing source texts, run npx joplo i18n add <lang> again for each language: it adds new keys and keeps existing translations (--prune drops unused ones).
1102
+ - One link serves everyone: viewers get their browser language, ?lang=<lang> picks one, and languages the project lacks fall back to the source language. The board's content-language menu previews each language; npx joplo render --content <lang> screenshots one.
1103
+ - Narration: generate audio per language in the board, or npx joplo voice (every content language; --locale <lang> for one). Joplo Cloud narration sends the content language with each clip and picks the cloud's recommended voice for that language (a voice already in the recommendation stays); other providers pick a native preset voice when they have one. config({ voice: { locales: { ja: { narrator } } } }) overrides both. Languages without audio use the viewer's browser voice. Re-sharing reuses the audio already in the previous share (same text and voice). On another computer (no .joplo/cloud.json) run npx joplo share --private --no-review --update <share link>: it updates that share (free and Pro alike) and reuses its audio instead of regenerating it.
1104
+
1105
+ ## Common publishing pitfalls
1106
+ - Do not patch CHOICE_REQUIRED by silently adding --private --no-review: ask both questions first; an agent choosing flags would violate the user decision even if no prompt appears.
1107
+ - --public and --private conflict, as do --review and --no-review (exit 2). A main public share can accompany a private review link; do not send public visibility to the review publication itself.
1108
+ - An old Cloud may reject visibility with HTTP 400 (BAD_REQUEST, exit 1): tell the user that Cloud does not support public sharing yet and to choose --private or retry after the rollout. Public requests always send visibility: public. With no password action, private requests omit visibility for new shares, old records without visibility, records marked private, and --update links absent from same-server local records; they remain compatible with old strict servers. Such updates explicitly send private only when the target is recorded as public. Setting or removing a password always sends private regardless of local history. This record lookup affects the request field, never the required choice for this invocation.
1109
+ - When demonstrating publication, show the exposure explanation beside the choice and show main and review links separately in the result. A disabled public control must explain the scope restriction; never imply that a hidden feature is private.
1110
+ - The board preselects public for a new whole-project share; existing links retain their current visibility (missing = private). Scoped/PR shares disable public. This UI prefill is never a CLI default. If reading existing links fails, publishing stays disabled: use Try again to reload the links; do not treat that error as a new public share.
1111
+ - “Author · More works” only comes from Cloud-injected metadata on official public shares. Local builds, exports and embeds never show it; adding meta to an author project is not a supported customization.
1112
+
1113
+ - For scoped reviews, read data.mode before choosing a link: data.mode = review means only the private review was published, at data.url. Otherwise give reviewers data.review.url. Never widen the scope or pick an option merely to make review publication succeed.
975
1114
 
976
1115
  ## Feature changes across versions
977
1116
  For local comparisons and PR CI, read npx joplo skill diff. It compares two real publish builds and creates one immutable bundle; ordinary share --pr remains a single preview.
978
1117
 
979
1118
  ## Review and feedback (the joplo-feedback skill has the same steps)
980
- - npx joplo share --review publishes the review version: every option of every feature, so reviewers can compare A/B. Rules, questions, cases, and AI assumptions still never appear in uploaded files; they go only to the review page through the request body. Plain share publishes only picked options.
1119
+ - npx joplo share --private --review also publishes the review version at data.review.url: every option of every feature, so reviewers can compare A/B. Rules, questions, cases, and AI assumptions still never appear in uploaded files; they go only to the review page through the request body. Plain share publishes only picked options.
981
1120
  - After reviewers comment and the owner decides on the review page, run npx joplo feedback --format json (uses the review share in .joplo/cloud.json, else the main share, or --share <id>). data.decisions are decisions not yet applied; data.comments are unresolved viewer comments with scenario, step, stepId, and element.
982
1121
  - Apply each decision to the source, then run npx joplo check:
983
1122
  - pick: set feature.pick in features/<f>/feature.ts to the option file name (the part after "<feature>.").
@@ -986,7 +1125,7 @@ For local comparisons and PR CI, read npx joplo skill diff. It compares two real
986
1125
  - answer: delete the question and add a rule with origin: 'user' (status: 'confirmed') stating the answer.
987
1126
  - Comments are input for discussion only; do not change the source from a comment unless the user asks.
988
1127
  - When check passes, mark what you applied: npx joplo feedback --applied <decision ids, comma-separated> [--ref <commit or source version>]. Mark only decisions you actually wrote back.
989
- - Full loop: npx joplo share --review --format json (data.mode is "review"; give the user data.url) → reviewers comment, the owner decides → npx joplo feedback --format json → edit source → npx joplo check → commit → npx joplo share --review --format json to refresh the review link → npx joplo feedback --applied d1,d2 --ref "$(git rev-parse HEAD)".
1128
+ - Full loop: npx joplo share --private --review --format json (give reviewers data.review.url; data.url is the main share) → reviewers comment, the owner decides → npx joplo feedback --format json → edit source → npx joplo check → commit → npx joplo share --private --review --format json to refresh the review link → npx joplo feedback --applied d1,d2 --ref "$(git rev-parse HEAD)".
990
1129
  - data.decisions items: { id, kind: pick|confirm_rule|reject_rule|answer, featureId, targetId, note, decidedAt, version }. targetId is the option id (pick), rule id (confirm_rule, reject_rule), or question id (answer); for answer, note is the answer.
991
1130
  - --ref works only together with --applied. --applied is idempotent; text output without --format json ends with a Next: line listing the ids.`,
992
1131
  };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export * from './pace.js';
18
18
  export * from './outline.js';
19
19
  export * from './diagram/index.js';
20
20
  export * from './voice.js';
21
+ export * from './content-i18n.js';
21
22
  export * from './local-review.js';
22
23
  export * from './feature-diff.js';
23
24
  export * from './step-identity.js';
25
+ export * from './auto-caption.js';
package/dist/index.js CHANGED
@@ -18,6 +18,8 @@ export * from "./pace.js";
18
18
  export * from "./outline.js";
19
19
  export * from "./diagram/index.js";
20
20
  export * from "./voice.js";
21
+ export * from "./content-i18n.js";
21
22
  export * from "./local-review.js";
22
23
  export * from "./feature-diff.js";
23
24
  export * from "./step-identity.js";
25
+ export * from "./auto-caption.js";
package/dist/load.d.ts CHANGED
@@ -5,6 +5,15 @@ export type Importer = (absPath: string) => Promise<Record<string, unknown>>;
5
5
  export declare function discoverFiles(root: string): string[];
6
6
  /** 作者主题:themes/<name>.css(文件名就是主题名)。 */
7
7
  export declare function loadThemes(root: string): Record<string, string>;
8
+ /**
9
+ * 作者内容译文(D84):locales/<语言>.json,一个扁平对象(原文 → 译文,值是字符串)。
10
+ * 文件名不是语言标签、JSON 写错、值不是字符串时报 LOCALE_FILE_INVALID,这个文件不参与编译。
11
+ */
12
+ export declare function loadLocales(root: string): {
13
+ locales: Record<string, Record<string, string>>;
14
+ files: Record<string, string>;
15
+ diagnostics: Diagnostic[];
16
+ };
8
17
  export declare function loadAuthoring(root: string, importer: Importer): Promise<{
9
18
  authoring: AuthoringProject | null;
10
19
  diagnostics: Diagnostic[];
package/dist/load.js CHANGED
@@ -8,6 +8,7 @@
8
8
  * features/<f>/feature.ts
9
9
  * features/<f>/options/<o>.tsx
10
10
  * themes/<name>.css 作者主题(D51),按原文读取
11
+ * locales/<语言>.json 作者内容译文(D84):原文 → 译文
11
12
  */
12
13
  import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
13
14
  import { join, relative, resolve, sep } from 'node:path';
@@ -50,6 +51,9 @@ export function discoverFiles(root) {
50
51
  for (const f of list(join(r, 'themes')))
51
52
  if (/\.css$/.test(f))
52
53
  files.push(join(r, 'themes', f));
54
+ for (const f of list(join(r, 'locales')))
55
+ if (/\.json$/.test(f))
56
+ files.push(join(r, 'locales', f));
53
57
  return files;
54
58
  }
55
59
  /** 作者主题:themes/<name>.css(文件名就是主题名)。 */
@@ -63,6 +67,47 @@ export function loadThemes(root) {
63
67
  }
64
68
  return out;
65
69
  }
70
+ /**
71
+ * 作者内容译文(D84):locales/<语言>.json,一个扁平对象(原文 → 译文,值是字符串)。
72
+ * 文件名不是语言标签、JSON 写错、值不是字符串时报 LOCALE_FILE_INVALID,这个文件不参与编译。
73
+ */
74
+ export function loadLocales(root) {
75
+ const r = resolve(root);
76
+ const locales = {};
77
+ const files = {};
78
+ const diagnostics = [];
79
+ for (const f of list(join(r, 'locales'))) {
80
+ if (!/\.json$/.test(f))
81
+ continue;
82
+ const rel = `locales/${f}`;
83
+ const bad = (message) => diagnostics.push({ severity: 'error', code: 'LOCALE_FILE_INVALID', message: `${rel}: ${message}`, source: 'schema', at: `${rel}:1:1` });
84
+ const tag = f.slice(0, -5);
85
+ if (!/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(tag)) {
86
+ bad('the file name must be a language tag such as ja.json or zh-CN.json');
87
+ continue;
88
+ }
89
+ let raw;
90
+ try {
91
+ raw = JSON.parse(readFileSync(join(r, 'locales', f), 'utf8'));
92
+ }
93
+ catch (e) {
94
+ bad(`not valid JSON (${e instanceof Error ? e.message : String(e)})`);
95
+ continue;
96
+ }
97
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
98
+ bad('must be one object of "source text": "translation"');
99
+ continue;
100
+ }
101
+ const nonString = Object.entries(raw).find(([, v]) => typeof v !== 'string');
102
+ if (nonString) {
103
+ bad(`the value of ${JSON.stringify(nonString[0])} must be a string (write "" while it is not translated yet)`);
104
+ continue;
105
+ }
106
+ locales[tag] = raw;
107
+ files[tag] = rel;
108
+ }
109
+ return { locales, files, diagnostics };
110
+ }
66
111
  export async function loadAuthoring(root, importer) {
67
112
  // 步骤和规则的源位置来自调用栈;开启原生 source map,保证行号指向 TSX 源码而不是转译产物。
68
113
  process.setSourceMapsEnabled?.(true);
@@ -142,5 +187,7 @@ export async function loadAuthoring(root, importer) {
142
187
  }
143
188
  if (!config)
144
189
  return { authoring: null, diagnostics: diags };
145
- return { authoring: { root: r, config, layouts, routes, features, themes: loadThemes(r) }, diagnostics: diags };
190
+ const loc = loadLocales(r);
191
+ diags.push(...loc.diagnostics);
192
+ return { authoring: { root: r, config, layouts, routes, features, themes: loadThemes(r), ...(Object.keys(loc.files).length ? { locales: loc.locales, localeFiles: loc.files } : {}) }, diagnostics: diags };
146
193
  }
package/dist/outline.d.ts CHANGED
@@ -51,7 +51,7 @@ export type Outline = {
51
51
  };
52
52
  /** 一步停留时要读的文字:说明、explain,过渡卡再加副标题与要点(与看板封面的估算同一口径)。 */
53
53
  export declare function stepTexts(step: Step): (string | undefined)[];
54
- /** 一个场景按 1× 自动播放大约多久(毫秒):每一步 stepDwell 之和。 */
54
+ /** 一个场景按 1× 自动播放大约多久(毫秒):每一步取 hold、阅读停留(stepDwell)与旁白朗读估算(narrate / say)中最长的,再求和。 */
55
55
  export declare function scenarioEstimateMs(scenario: Pick<Scenario, 'steps'>): number;
56
56
  export declare function outline(project: Project, opts?: {
57
57
  optionId?: string;
package/dist/outline.js CHANGED
@@ -6,15 +6,15 @@
6
6
  */
7
7
  import { orderedFeatures } from "./features.js";
8
8
  import { holdMsOf } from "./focus.js";
9
- import { stepDwell } from "./pace.js";
9
+ import { stepDwell, voiceMs } from "./pace.js";
10
10
  import { JoploError } from "./result.js";
11
11
  /** 一步停留时要读的文字:说明、explain,过渡卡再加副标题与要点(与看板封面的估算同一口径)。 */
12
12
  export function stepTexts(step) {
13
13
  return [step.caption, step.explain, ...(step.action.type === 'card' ? [step.action.sub, ...(step.action.points ?? [])] : [])];
14
14
  }
15
- /** 一个场景按 1× 自动播放大约多久(毫秒):每一步 stepDwell 之和。 */
15
+ /** 一个场景按 1× 自动播放大约多久(毫秒):每一步取 hold、阅读停留(stepDwell)与旁白朗读估算(narrate / say)中最长的,再求和。 */
16
16
  export function scenarioEstimateMs(scenario) {
17
- return scenario.steps.reduce((sum, step) => sum + Math.max(holdMsOf(step), stepDwell({ texts: stepTexts(step), cameraMoved: step.shots.length > 0 || !!step.directorLayer, streams: step.effects.flatMap((e) => (e.type === 'stream' ? [e.value] : [])) })), 0);
17
+ return scenario.steps.reduce((sum, step) => sum + Math.max(holdMsOf(step), voiceMs(step.narrate ?? step.say), stepDwell({ texts: stepTexts(step), cameraMoved: step.shots.length > 0 || !!step.directorLayer, streams: step.effects.flatMap((e) => (e.type === 'stream' ? [e.value] : [])) })), 0);
18
18
  }
19
19
  export function outline(project, opts = {}) {
20
20
  if (opts.optionId && !Object.hasOwn(project.options, opts.optionId))
package/dist/pace.d.ts CHANGED
@@ -31,3 +31,8 @@ export declare function stepDwell(o: {
31
31
  dotMs?: number; /** 本步流式输出的文字(D56):等它们出完再加阅读时间。 */
32
32
  streams?: string[];
33
33
  }): number;
34
+ /** 朗读估算(旁白 / 台词):中日韩约每秒 4.5 字、拉丁文字约每秒 13 个非空白字符(约 2.5 词),读完再留 0.45 秒换气。 */
35
+ export declare const VOICE_CJK_MS = 220;
36
+ export declare const VOICE_LATIN_MS = 75;
37
+ /** 一段旁白大约读多久(毫秒,1×);没有文字时为 0。自动播放以真实读完为准,这个只用于封面、outline 与 check 的估算。 */
38
+ export declare function voiceMs(text: string | null | undefined, speed?: number): number;