@joplo-app/core 0.6.2 → 0.7.1

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.
@@ -9,13 +9,13 @@
9
9
  /** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
10
10
  export declare const SKILL_TOPICS: readonly [{
11
11
  readonly name: "authoring";
12
- readonly description: "Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions";
12
+ readonly description: "Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions; read-only asset usage reports";
13
13
  }, {
14
14
  readonly name: "story";
15
15
  readonly description: "Plan a show before coding; for feature review start from needs, roles, goals and cases; for explainers and histories plan openings, continuity and captions";
16
16
  }, {
17
17
  readonly name: "demo";
18
- readonly description: "Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots";
18
+ readonly description: "Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots; real-browser layout audits and evidence";
19
19
  }, {
20
20
  readonly name: "focus";
21
21
  readonly description: "Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact";
@@ -46,7 +46,7 @@ export declare const MENTAL_MODEL: readonly ["Joplo shows are playable, interact
46
46
  /** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
47
47
  export declare const START_ORDER: readonly ["Choose the starting template: compare feature options with npx joplo init <dir> (or --template starter); make one show people can play, pause and try with npx joplo init <dir> --template work. Bare names select built-ins, never a same-named local directory; use --template ./work for a local folder. Names matching [a-z0-9][a-z0-9-]* select directories in the template repository default branch, without version tags. Init installs engine skills and AGENTS.md, preserving any bundled plugin guides; after installing dependencies run skill install.", "Read npx joplo skill authoring and choose the capabilities; for feature review read cases before asking the user about edge cases; demo and installed plugin skills as needed.", "Plan before coding (npx joplo skill story): audience, one to three points, one line per scenario (Given → When → Then, how it opens and ends; a case's expected is its Then); show the plan to the user. A demo is a story, not a feature tour.", "With minimal code, write one chapter for a standalone work, or one happy path and one error-and-recovery scenario for feature review.", "Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.", "Extend to every option and every case agreed with the user for feature review, or to the agreed chapters for a standalone work; run check until 0 errors.", "Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill."];
48
48
  /** 最常见的坑:一句话 + 详细主题。 */
49
- export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals and work summaries as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["HAPPY_PATH_ONLY applies only to feature review: for a standalone explainer use work() + chapter(), with no cases or uses(); do not invent failure scenarios", "check"], readonly ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over (render --video takes --width/--height, --voice, --clean and --srt for publishing; see joplo skill demo)", "demo"], readonly ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"], readonly ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"], readonly ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"], readonly ["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"], readonly ["For audience exploration, use native UI controls or work.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"], readonly ["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"]];
49
+ export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals and work summaries as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --work <work-id> --dry-run (omit --work for all; --scenario follows continuing predecessors), inspect per-step details, use narrate(false) for silent steps, and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["HAPPY_PATH_ONLY applies only to feature review: for a standalone explainer use work() + chapter(), with no cases or uses(); do not invent failure scenarios", "check"], readonly ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over (render supports --viewport/--no-frame, --crop and public --frames-out/--timeline; --video takes --width/--height, --voice, --clean and --srt for publishing; see joplo skill demo)", "demo"], readonly ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"], readonly ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"], readonly ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"], readonly ["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"], readonly ["For audience exploration, use native UI controls or work.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"], readonly ["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"]];
50
50
  export type AgentSkill = {
51
51
  name: string;
52
52
  description: string;
@@ -8,9 +8,9 @@
8
8
  */
9
9
  /** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
10
10
  export const SKILL_TOPICS = [
11
- { name: 'authoring', description: 'Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions' },
11
+ { name: 'authoring', description: 'Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions; read-only asset usage reports' },
12
12
  { name: 'story', description: 'Plan a show before coding; for feature review start from needs, roles, goals and cases; for explainers and histories plan openings, continuity and captions' },
13
- { name: 'demo', description: 'Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots' },
13
+ { name: 'demo', description: 'Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots; real-browser layout audits and evidence' },
14
14
  { name: 'focus', description: 'Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact' },
15
15
  { name: 'cases', description: 'Feature-attached works only: cases and coverage; ask the user before starting' },
16
16
  { name: 'check', description: 'Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
@@ -53,12 +53,12 @@ export const PITFALLS = [
53
53
  ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals and work summaries as search-result content; exclude unpublished information", "publish"],
54
54
  ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"],
55
55
  ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"],
56
- ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"],
56
+ ["Joplo Cloud narration spends the user's characters: run npx joplo voice --work <work-id> --dry-run (omit --work for all; --scenario follows continuing predecessors), inspect per-step details, use narrate(false) for silent steps, and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"],
57
57
  ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"],
58
58
  ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"],
59
59
  ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"],
60
60
  ["HAPPY_PATH_ONLY applies only to feature review: for a standalone explainer use work() + chapter(), with no cases or uses(); do not invent failure scenarios", "check"],
61
- ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over (render --video takes --width/--height, --voice, --clean and --srt for publishing; see joplo skill demo)", "demo"],
61
+ ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over (render supports --viewport/--no-frame, --crop and public --frames-out/--timeline; --video takes --width/--height, --voice, --clean and --srt for publishing; see joplo skill demo)", "demo"],
62
62
  ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"],
63
63
  ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"],
64
64
  ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"],
package/dist/compile.js CHANGED
@@ -116,6 +116,8 @@ export function compile(src, mode, opts = {}) {
116
116
  const definitions = f ? sortedEntries(f.works) : [[id, works.get(id)]];
117
117
  for (const [key, raw] of definitions) {
118
118
  const qid = f ? `${id}.${key}` : key;
119
+ if (raw.pace !== undefined && (!raw.pace || typeof raw.pace !== 'object' || Array.isArray(raw.pace) || Object.keys(raw.pace).some(k => k !== 'systemLead') || (raw.pace.systemLead !== undefined && (typeof raw.pace.systemLead !== 'number' || !Number.isFinite(raw.pace.systemLead) || raw.pace.systemLead < 0 || raw.pace.systemLead > 30))))
120
+ err('PACE_INVALID', 'work pace.systemLead must be a finite number of seconds from 0 to 30; omit it for the default 0.9 seconds', raw.source);
119
121
  const slices = resolveSlices(raw.scenarios, `Work ${qid}`, err);
120
122
  if (slices.linear)
121
123
  linearWorks.add(qid);
@@ -715,6 +717,7 @@ function lowerStep(c, st, i) {
715
717
  const says = [];
716
718
  let sayRole = null;
717
719
  const narrates = [];
720
+ let mute = false;
718
721
  /** 插件效果声明的最短停留(D98):同一步取最大值。 */
719
722
  let effectHoldMs = 0;
720
723
  const ext = {};
@@ -764,7 +767,9 @@ function lowerStep(c, st, i) {
764
767
  err('SAY_EMPTY', 'say() needs the line the character speaks, for example say(\'I can make it!\'). Remove it to read the caption instead', st.source);
765
768
  }
766
769
  else if (e.type === 'narrate') {
767
- if (typeof e.text === 'string' && e.text.trim())
770
+ if (e.text === false)
771
+ mute = true;
772
+ else if (typeof e.text === 'string' && e.text.trim())
768
773
  narrates.push(e.text.trim());
769
774
  else
770
775
  err('NARRATE_EMPTY', 'narrate() needs the narrator\'s words, for example narrate(\'She sends Ajie the plan as a link, so he needs no app.\'). Remove it to read say() or the caption instead', st.source);
@@ -962,6 +967,8 @@ function lowerStep(c, st, i) {
962
967
  ...(says.length ? { say: says.join(' ') } : {}),
963
968
  ...(says.length && sayRole ? { sayRole } : {}),
964
969
  ...(narrates.length ? { narrate: narrates.join(' ') } : {}),
970
+ ...(mute ? { mute: true } : {}),
971
+ ...(st.kind === 'system' && typeof def.pace?.systemLead === 'number' && Number.isFinite(def.pace.systemLead) && def.pace.systemLead >= 0 && def.pace.systemLead <= 30 ? { systemLead: Math.round(def.pace.systemLead * 1000) } : {}),
965
972
  ...(st.source ? { source: rel(st.source) } : {}),
966
973
  };
967
974
  }
package/dist/guide.js CHANGED
@@ -152,11 +152,16 @@ Success: check reports 0 errors; outline --work explainer shows the intended sli
152
152
 
153
153
  ## Binary assets
154
154
  - asset('./file.glb') embeds a self-contained GLB; MP3/WAV/OGG/M4A/FLAC are supported too. Paths are relative to the calling source file. Images retain a 2 MB limit; binary files have a 50 MB limit. Dev serves binary bytes by content hash; npx joplo build writes every asset as its own file (assets/<hash>.<ext>), so the built site must be opened over HTTP: npx joplo preview, a share, or any static server. Double-clicking index.html (file://) is not supported.
155
+ - Before reviewing a material folder, run npx joplo assets . --usage --scan photos --format json (repeat --scan for explicit project-relative folders; optional --work <exact work id> or --scenario <id> includes continuing predecessors). This is read-only: it loads author modules, observes actual asset() evaluations and declared plugin resources, and hashes explicitly scanned files; it does not build, render, generate resources, spend, upload or delete. As with check/build, trusted author modules execute while loading.
156
+ - Read asset reports as evidence, not cleanup advice. scope.authorReferences is whole-loaded-project, including drafts; contextual references have workId/scenarioId/layer/elementId/source and inSelectedScope. A scene-level reference is not proof of a particular step. Declared binaries are matched across dev/publish compiles by plugin/compiler/input identity, never by coincidental sequential IDs or ordinary prose strings; a draft-only selection has no packaged assets. publication=included-in-selected-ir means the selected publish IR contains its bytes/resource id, not that a completed build has packed it. Draft-only or excluded content can still have author references. sampledVisibility is always unknown: no frames are sampled and conditions/camera/plugin internals are not resolved.
157
+ - not-found-in-loaded-model only means no observed reference in that evaluation; never rename it unused. Dynamic paths, imported helpers, unexecuted branches, cached modules or unevaluated plugin compilers remain unknown. Identical-byte files share content matches, so contentMatch marks ambiguous provenance rather than choosing one file. No author/source/year/license metadata is inferred, and a report is not a copyright decision. Symlinks are skipped and scans cannot escape the project; only scan folders the user intended. If loading/compilation fails, fix check errors and rerun; never generate missing paid resources merely to fill a report.
158
+
155
159
  - Prefer existing CC0 assets and public-domain reference images, then use a generation plugin to fill gaps in an original style. Read the enabled plugin's skill before generation. Commit persistent artifacts and metadata; never put API keys in project source.
156
160
  - npx joplo resources --dry-run lists missing persistent resources and estimated credits. Interactive resources confirms each item; unattended generation requires --allow-spend. check/build/render remain offline for these artifacts. Missing or corrupt output gives diagnostics, not an implicit paid retry. Keep large GLB files below 5 MB where possible and inspect MODEL_SIZE warnings before sharing.
157
161
 
158
162
  ## Structure and files
159
- - joplo.config.ts exports config({ name, plugins, layout?, home?, theme?, autoFocus?, voice?, locales? }). plugins is explicit; installation alone does not enable a plugin.
163
+ - joplo.config.ts exports config({ name, plugins, layout?, home?, theme?, autoFocus?, voice?, locales?, watch? }). plugins is explicit; installation alone does not enable a plugin.
164
+ - Dev watch exclusions: config({ watch: { ignore: ['exports/frames', '.coord'] } }) excludes project-relative output files/directories and their descendants from recompilation and review invalidation. Paths are literal, not globs; do not exclude real source or referenced assets. Existing .joplo/dist/node_modules/.git exclusions remain. Restart the dev board after changing this configuration; each project has its own exclusions. Ordinary image assets still trigger updates.
160
165
  - layouts/<id>.tsx exports layout(tree). Outlet places the current page; Slot declares a named insertion point. Those are engine composition primitives.
161
166
  - routes/**/page.tsx exports page({ title, layout?, viewport? }, tree). The directory determines its route. Set layout: false to opt out of the shared layout.
162
167
  - works/<key>.tsx (or .ts) exports work({ title, summary, scenarios, stage? | layers?, viewport?, on?, routes?, audience?, roles?, state?, free?, draft?, order? }). The filename is the entry key and must not collide with a feature folder.
@@ -294,7 +299,7 @@ Joplo already has the parts of a user story; fill them in that spirit.
294
299
  - Rhythm: every short step waits 3 s, so a run of trivial steps feels like a metronome. Merge trivial steps (type, then click) and give key results an explain.
295
300
 
296
301
  ## 6. Narration: narrate() is a presenter talking, not the caption read aloud
297
- When the board or the published site reads a demo aloud, each step reads, in order of preference: narrate() in the narrator's voice; else say(), the character's own line in that role's voice; else the caption in the narrator's voice (cards read title and sub). A caption read aloud sounds like a screen reader, so give the steps that will be heard a narrate() line, written the way a person walks a colleague through a feature. It may later be recorded by a real voice, so write how people speak.
302
+ When the board or the published site reads a demo aloud, each step reads, in order of preference: narrate() in the narrator's voice; else say(), the character's own line in that role's voice; else the caption in the narrator's voice (cards read title and sub). Use narrate(false) on a deliberately silent step: it suppresses narration, say(), caption/card fallback and the spoken subtitle; the step title stays visible and voice-paced streams use their normal text speed. narrate('') remains an error, not a silence marker. Without narrate(false), the existing fallback is unchanged. A caption read aloud sounds like a screen reader, so give the steps that will be heard a narrate() line, written the way a person walks a colleague through a feature. It may later be recorded by a real voice, so write how people speak.
298
303
  - Short first: one sentence, two at most, mostly 3–8 seconds. Cut every word the screen already shows; the viewer is watching.
299
304
  - Each line does one job: orient (who, where, what we are about to see), point (what to look at now and why it matters), connect (carry the viewer from the last step: 'Now over to Ajie'), or conclude (what this proved).
300
305
  - Say what the caption cannot: the intent, the reason, the consequence. Never repeat the caption word for word; name an on-screen label only when the viewer must find it.
@@ -377,16 +382,19 @@ Start playback before testing stage gestures: covers and transition cards intent
377
382
  - A step's hold controls dwell; narration may extend waiting. The engine estimates spoken time and sequences chapters. Keep a long story in smaller scenarios with from, retaining the previous final state.
378
383
  - Transition cards mark a real opening/ending/time shift. Most information should change on the view, not arrive as a text deck. Read story and the installed visual plugins' recipes.
379
384
  - Media is provided by an explicitly configured plugin. A viewer gesture unlocks sound; pause/resume/speed share the clock and narration ducks background audio. Static frames stay silent. Read the plugin skill for resources and production limits.
385
+ - Audio resource failures are exposed by the playback host; video recording fails instead of silently delivering missing audio. MEDIA_DECODE_BUDGET warns when simultaneous resources exceed the shared PCM budget at 48 kHz; MEDIA_DECODE_HEADROOM warns about 96 kHz devices. Check can estimate from inspected durations, while build uses decoded metadata when available; unknown resources and other device rates still need playback verification. Read the media plugin guide for concrete authoring remedies.
380
386
  - Media continuity is engine behavior for every media plugin: a track keeps playing across steps on the engine clock (it only re-seeks on a jump, reset or non-relay chapter change); playing the same resource again continues it; playing a different one with fadeMs crossfades (old out, new in, no silence); a continuing chapter starts with the music its previous chapter ended with. Explicit marker seeks reposition that track (even at 0ms) and start its fade from the marker, while ordinary steps/relay chapters preserve its driver. Overlapping outgoing/incoming audio both count toward the decoded-memory budget; the host applies fade/volume/narration ducking once. Video chain export records that same mix; film strips skip audio.
381
387
 
382
388
  ## Make it play like a film, not slides (Required for video-like pieces)
383
389
  Viewers call a piece "a slide deck" when pictures swap in one frame and then sit still. The static storyboard cannot show either problem, so it never proves the piece moves well.
384
390
  - No hard cuts. Every chapter/era/scene seam needs a transition the viewer can follow: carry one object across (a match cut through the subject: push in until it fills the frame, swap the world behind it, pull back), morph a shared object, crossfade layers, or move the camera over the swap. One deliberate cut is a signature move; more than that is a deck. A scene change must not reset all visual context.
385
391
  - No dead frames. Nothing on screen may be completely still for more than about 1.5 s; a still composition lasts at most about 3.5 s, and something changes at element level every 2–2.5 s. During reading holds keep a slow, eased camera drift with an end point (constant-speed motion reads as a screensaver). Use the installed visual plugin's drift and enter/exit transitions; read its recipes.
386
- - One main motion per beat; most beats 2–3 s. hold(seconds) is the author's pacing: a step with hold no longer gets the 3 s reading floor (caption reading time per character and narration still extend it). System steps show their event for about 0.9 s before committing; narration waits keep the engine clock (and therefore drift and transitions) running.
392
+ - Verify real layout after fonts and transforms, not only check: npx joplo render . --scenario-id film.open --out still.png --audit-layout --audit-content '[data-jid="frame"]' --audit-important '[data-jid="quote"]' --audit-safe-area '0,920,1920,160' --audit-exclude '[data-jid="stamp"]'. Areas use actual page CSS pixels relative to the export root, or a selector inside it; importance and intentional decoration are explicit, never guessed from text meaning. The sibling .layout.json reports Range text-line bounds, clipping/safe-area warnings, source/element/work/scenario/step and evidence. A static result is final-state only (atMs:null), not animation proof.
393
+ - For motion use --film --audit-layout (fresh run; --sample-ms at most 50). The audit consumes the same export clock and JPEG frames: post-commit, entry finish and plugin-declared camera/drift/waypoint deadlines are sampled within the report's sampleToleranceMs; intervening intervals are sampled with --audit-every-ms (20–1000, default 250). A later step may interrupt a motion phase. Inspect evidence before editing: overlap is a geometry heuristic warning, masks/rotation/nonrectangular clipping or hidden importance remain unknown, and unmeasured intervals can contain issues. --audit-layout supports static or film, not sheet/video/frames/resume. It never changes layout or generates paid narration/resources.
394
+ - One main motion per beat; most beats 2–3 s. hold(seconds) is the author's pacing: a step with hold no longer gets the 3 s reading floor (caption reading time per character and narration still extend it). A step takes its pre-commit lead plus its post-commit dwell (the larger of visual dwell and narration). hold(seconds) only sets post-commit dwell, so summing holds alone underestimates runtime. System steps default to a 0.9 s pre-commit lead; use work({ pace: { systemLead: 0 }, ... }) for narration-led films or a finite 0–30 seconds to choose it. The work setting applies to every system step, including continuing chapters, and preserves explicit timing in reduced-motion mode. Cards still commit directly; narration waits keep the engine clock (and therefore drift and transitions) running.
387
395
  - Anti-deck gate: before building, write one line per beat — the main moving object, its start → end state, and the verb (push, morph, rise, swap…). If most beats are only fades or panels appearing, redesign them. A contact sheet that reads like slide thumbnails fails.
388
396
  - Chapters: use chapter() default continuation; sequential playback of a continuing chapter continues in the same shot (no countdown, no reset, music keeps playing). Bring the next chapter's music in on the beat before the visual swap (play the next score with fadeMs; the old track fades out under it — a J-cut). Play the same score again to keep it going. Stop music only at the real ending.
389
- - Film sampling freezes the browser clock before loading, advances on a fixed 16 ms loading grid and waits for DOM commits to settle before each sample. Loading time does not become playback time. Repeat the same command when checking timing; compare scenario/position timelines separately from pixel differences (fonts, browser and platform can still affect rasterization).
397
+ - Film sampling has a 50 ms default observation tolerance: identical source can cross a step/chapter boundary one sample apart; pixel equality across browsers is not guaranteed. It freezes the browser clock before loading, advances on a fixed 16 ms loading grid and waits for DOM commits to settle before each sample. Loading time does not become playback time. Repeat the same command when checking timing; compare scenario/position timelines separately from pixel differences (fonts, browser and platform can still affect rasterization).
390
398
  - Required review: run npx joplo render <dir> --scenario-id <first chapter> --film --chain --out film.png and read every page (one per chapter; red = one-frame full-screen change, grey = nothing visible changed for ≥ 1.5 s). The CLI prints every CUT and STILL with time and step; film.json beside it has the largest adjacent-frame change around every step. Fix every CUT that is not a deliberate signature and every STILL, then film again. Also record --video (real time) and watch it once start to end. Cells are samples on the engine clock; check a suspicious moment with --frames <dir> at full size before changing code — fine textures (1-px checkers, hairlines) shimmer as moiré under zoom or drift and show up as cuts. The opposite also happens: in a product-recording piece the real change is a few characters, a caret or a timer, below the STILL threshold, so a typing sequence can be reported as one long STILL. Crop the changing area across consecutive --frames before adding motion only to satisfy the detector.
391
399
  - Review as a picky viewer, not the author: list issues with time code, evidence (frame/metric), impact, severity (blocker / major / minor / note) and verdict (APPROVE / APPROVE_WITH_NOTES / REVISE). Check mechanics first (cuts, stills, overlaps, cropped text), then meaning, then taste; "not cinematic enough" without evidence is not a finding. Do at least two rounds of film → issues → fix, and finish one chapter seam to delivery quality before copying the technique to the others.
392
400
  - Static frames (render, --sheet, thumbnails, deep links) show settled pictures: no drift, no half-finished transitions. That is deliberate and is why the film strip is the motion check.
@@ -406,8 +414,13 @@ The host can draw an input/keyboard record after a type/press step, and toasts c
406
414
  - outline lists scenario and step ids. Use those ids in render/export; a deep link chooses where viewing starts and is not an access boundary. render takes qualified ids: --scenario-id <feature>.<option>.<scenario> and --step-id '<feature>.<option>.<scenario>#<n>' (the NOT_FOUND message lists the available scenario ids).
407
415
  - joplo render --scenario-id <id> --step-id <id> --out frame.png renders timeline state. --sheet --columns 3 renders every step with captions/narration (settled frames only). --film [--chain] [--every 250] samples real playback on the engine clock for motion review; --video records a webm. Both need the export component (npx joplo setup).
408
416
  - Exporting a video to publish elsewhere: render --video [--chain] starts at the cover fading out (loading and audio preparation are not recorded). --width 1920 --height 1080 (or --width 1080 --height 1920) sets the video resolution: the stage keeps its own aspect, is scaled sharply and centered on the theme background, so portrait output suits phone pages. The audio track is the media plugins' music plus generated narration: --voice real (default) mixes the clips npx joplo voice made for the current voice and holds each step for the real audio; lines without a clip use estimated timing silently and the CLI lists them, so generate voice first and record again (browser speech is never captured). --clean (or --hide cover,cursor,title,subtitles) leaves out player chrome; --srt <file> writes the subtitles timed to the video for the platform's own captions. Watch the result once; trust the listed missing lines, not the absence of an error.
417
+ - Direct composition geometry: --viewport 720x1280 sets the logical stage used by layout, camera, screen overlays and hit areas; --width 1080 --height 1920 sets output pixels. --no-frame removes the device bezel. Without --viewport, existing page geometry and desktop/mobile defaults remain unchanged. Use the same geometry for screenshots, --sheet, --film and --video before comparing them. --crop '[data-jid="picture"]' or --crop 0,0,450,800 crops screenshots, sheets, film analysis and frame files; numeric coordinates are CSS pixels relative to the export canvas, and selectors must resolve to one visible rectangle entirely inside it. CUT/STILL fractions use the cropped image. A sampled crop must keep a fixed CSS width and height: changing dimensions raises a timestamped error rather than mixing incomparable pixel arrays; crop a stable outer frame when the subject moves. Video cropping uses logical geometry instead; --crop with --video is rejected.
418
+ - Public offline frames: npx joplo render <dir> --scenario-id <first> --chain --frames-out output/frames --fps 30 --viewport 720x1280 --no-frame exports JPEG files named by engine milliseconds and timeline.json. The supported library entry is renderFrames from @joplo-app/server; do not import dist/dev.js, private routes or __JOPLO_RECORD__. Targets use round(frameIndex * 1000 / fps), not repeated fractional runFor calls. Frames use cached clip durations silently and never call paid TTS; absent clips use estimated timing. Clean frames omit cover/cursor/title/subtitles by default. This is sampled replay with a 50 ms observation tolerance, not a promise of byte-identical scheduling or font rasterization.
419
+ - --timeline output/timeline.json accompanies --film and --video too. Schema version 1 includes actual observed step commits/ends, chapter boundaries, generic media snapshots and committed play/seek/stop/volume changes, camera cues and narration events (text, cached clip id/file/duration when present). engineMs is engine time; outputMs is recording/frame time. Narration endAt is observed relative to playback start and outputEndMs is already aligned to the output; do not infer a clip's start from stepPlan. Film defaults to estimated narration, while frames and video default to cached real duration; choose the matching path when aligning alternate audio or subtitles. Continuing chapters retain the whole-chain clock; completion explicitly names the final scenario and actual engine/output end time. Referenced cached narration and media bytes are copied beside the timeline into <name>.assets/; file paths are relative to the JSON and remain usable after the temporary server closes. Media assets include audioInfo when the compiler measured an AudioRegion: sourceSampleRate, contentStartFrame, contentFrames and cycleFrames describe decoded samples, not encoded bytes. Rescale those frame counts to the decoder sample rate, trim to the content start and loop only cycleFrames; starting an encoded file at byte/sample zero can expose encoder delay, calibration audio or guard padding. Asset failures are explicit errors; no TTS is generated.
420
+ - WebM needs only the export component. An output ending in .mp4 additionally uses local ffmpeg with H.264/AAC; missing ffmpeg or encoding failure is an explicit error. Encoding writes a private temporary file and commits only a complete result; failure preserves an existing output. Audio assets are content-validated and atomically written; use --overwrite to repair a corrupt cached export asset. --voice estimate is silent estimated narration and --voice off skips narration; background media remains independent. --silent omits every audio track while keeping cached narration timing. Video results expose measured calibration offset and audio/video end points. Review a decoded audio signal against early and late narration events before accepting a long alternate mix; calibration offsets are not proof every external encoder preserves sync.
421
+ - Film cost: --every changes saved cells only; --sample-ms changes image-analysis frequency (20–250 ms, default 50). Use 100–250 ms for a fast exploratory pass, then 50 ms for final CUT/STILL review: brief transitions can fall between coarse samples. The JSON includes wall time, baseline/end RSS, a 5-second RSS trace and process-lifetime peak RSS (Node only, not Chromium). Compare speed at the same sample interval, geometry and quality; coarse-mode wall times do not establish an equivalent-quality speedup, and concurrent load affects measurements. --checkpoint output/checkpoint.json commits progress at chapter boundaries; --resume replays the engine to restore state while reusing verified pixel analysis. Content hashes include project source/CSS/assets, voice cache bytes plus prepared clip duration/voice identity, host and enabled plugin runtime/build identities, browser/platform and every rendering option. Changes invalidate the checkpoint. Resume validates identical step identities and commit offsets within 50 ms, requires the same stable scenario/step/active state and recomputes the short chapter seam; larger divergence asks for a fresh render; never substitute an initial chapter state. --chapter-timeout 180000 limits wall processing per chapter and preserves the last committed checkpoint on failure. Keep output paths separate when running concurrent exports.
409
422
  - A full-size render can pass while a shorter board clips the input area. Check the actual visible hitbox with real pointer input in the board and the built site; DOM text existing is not proof it can be used.
410
- - Fixed render dimensions are a capture size; viewport belongs to page/layer. In a browser wait for fonts and [data-jcamera][data-camera-settled="1"] plus two animation frames. Do not mistake DOM progress for painted pixels.
423
+ - Fixed --width/--height dimensions are a capture size; --viewport explicitly overrides the logical page/layer geometry for export. In a browser wait for fonts and [data-jcamera][data-camera-settled="1"] plus two animation frames. Do not mistake DOM progress for painted pixels.
411
424
  - Test first input, drag, wheel, hover, keyboard, confirmation cancel/confirm, reset and resumed playback. Compare restored frames and direct jumps with pristine script frames. Explain unverified devices or audio behavior.
412
425
  - For layout, visual motion, shapes, charts and component APIs use the installed plugin skills. The engine has no built-in component vocabulary.
413
426
 
@@ -613,6 +626,7 @@ Example: features/invite/works/a.tsx:12:5 warning UNBOUND_INTERACTIVE Interac
613
626
  - 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.
614
627
  - SAY_EMPTY / NARRATE_EMPTY: say() needs the character's words, narrate() the narrator's. Remove it to fall back to the caption.
615
628
  - SAY_ROLE_CONFLICT: one step has say(…, { role }) lines from two different roles. A step reads one speaker; split the lines into consecutive steps.
629
+ - PACE_INVALID: work({ pace: { systemLead } }) accepts a finite 0–30 seconds (0 removes system pre-commit lead); omit it to preserve the default 0.9 seconds. hold() only controls post-commit dwell.
616
630
  - STREAM_PACE_INVALID: stream()'s pace is only 'voice' (follow this step's spoken line); omit it for model-output speed.
617
631
  - 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.
618
632
  - 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.
@@ -877,6 +891,8 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
877
891
  - 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.
878
892
 
879
893
  ## Narration (Joplo Cloud and your own keys)
894
+ - Limit narration generation before spending characters: npx joplo voice . --work short --dry-run --format json (standalone entry key or qualified feature work id). --scenario <exact scenario id> (alias --scenario-id) selects one chapter and follows its from predecessors; combining it with --work requires the chapter to belong to that work. Inspect data.locales[].details: workId, scenarioId, stepId, text, chars, missing and estimatedBillableChars. These are upper-bound estimates from the local cache, not a promise of actual charges: a remote Cloud cache hit is free. Shared text/voice is estimated once; silent steps show zero and valid cached clips show no billable characters. Then run the same command without --dry-run. Generation uses the existing cache and voice pins and never deletes clips outside this scope. Unknown/draft scopes fail before speech requests; omitted scope keeps all non-draft standalone works and picked feature works. Generate each required scope before build/share; scoping generation does not change what the later build selects.
895
+ - Declare the source language even for a single-language project: config({ locales: ['zh-CN'], ... }). The interface language is not the content language. Without config locales the clip metadata uses und (undetermined), and speech follows the text naturally; the tool does not infer a language from Chinese characters or label it English. Declared languages use their content locale in metadata and speech requests; existing clip keys remain text/voice based and do not require regeneration just to correct metadata.
880
896
  - 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.
881
897
  - 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.
882
898
  - 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.
@@ -886,7 +902,7 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
886
902
  - 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.
887
903
  - 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.
888
904
  - 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).
889
- - 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).
905
+ - Generating spends the user's characters. Before a large batch run npx joplo voice --work short --dry-run (omit --work for the whole project; 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).
890
906
  - npx joplo whoami (text and --format json data.voice) shows what is left: totalRemainingChars, period trial or month, resetsAt.
891
907
  - 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.
892
908
  - 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.
@@ -928,7 +944,7 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
928
944
  - A sentence assembled from several state values (the words before the cursor + new words + the words after it, a label + a value) is joined with no separator. Chinese and Japanese need none; in languages that separate words with spaces, put the space inside the translations at the seams (a 'before' ending in a space, an 'after' starting with one). Successive stream() values must stay prefix-consistent in every language (each step's value = the previous one + the new words). Check both with a small script over locales/<lang>.json, then render --content <lang> the steps where pieces meet.
929
945
  - Longer languages overflow layouts written for the source: let headlines wrap instead of white-space: nowrap, and break long words with overflow-wrap: anywhere rather than word-break: break-all.
930
946
  - 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.
931
- - 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.
947
+ - 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), including older project schema versions. The previous share is fetched explicitly as HTML; failure to read it stops publication instead of silently replacing generated audio with browser speech. If an update unexpectedly reports missing narration, stop and recover the previous audio before publishing; a change of worktree or project schema is not a reason to regenerate or spend characters. 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.
932
948
 
933
949
  ## Common publishing pitfalls
934
950
  - 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.
@@ -975,7 +991,7 @@ The engine supplies authoring, compilation, state, scheduling and host services.
975
991
  6. joplo components inspects only the enabled manifests; a named query gives that component's declarations and example. For full recipes/behavior read its plugin skill.
976
992
 
977
993
  ## Optional 3D
978
- The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.6.2; default-import scene3d from that package in joplo.config.ts, add scene3d to config.plugins, then run npx joplo skill install. Read npx joplo skill scene3d, scene3d/models and scene3d/generation for rendering, existing assets and optional local generation. A key is unnecessary for existing assets; dry-run before approving any generation.
994
+ The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.7.1; default-import scene3d from that package in joplo.config.ts, add scene3d to config.plugins, then run npx joplo skill install. Read npx joplo skill scene3d, scene3d/models and scene3d/generation for rendering, existing assets and optional local generation. A key is unnecessary for existing assets; dry-run before approving any generation.
979
995
 
980
996
  ## Errors and trust
981
997
  - UNKNOWN_PLUGIN: the element's author package is not enabled. Use its package provenance in the diagnostic to install/import it and add it to config.plugins. UNKNOWN_COMPONENT: no enabled manifest declares that element or intrinsic tag; read the installed catalogs.
package/dist/media.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /** Pure clock projection. Neither resource compilation nor plugin semantics run here. */
2
2
  export function advanceMedia(snapshot, elapsedMs) {
3
3
  const elapsed = Math.max(0, elapsedMs);
4
- return Object.fromEntries(Object.entries(snapshot).flatMap(([id, t]) => t.stopAfterMs !== undefined && elapsed >= t.stopAfterMs ? [] : [[id, { ...t, offsetMs: t.offsetMs + elapsed, ...(t.stopAfterMs !== undefined ? { stopAfterMs: t.stopAfterMs - elapsed, volume: t.volume * (1 - elapsed / t.stopAfterMs) } : {}) }]]));
4
+ return Object.fromEntries(Object.entries(snapshot).flatMap(([id, t]) => (t.stopAfterMs !== undefined && elapsed >= t.stopAfterMs || t.endAfterMs !== undefined && elapsed >= t.endAfterMs) ? [] : [[id, { ...t, offsetMs: t.offsetMs + elapsed, ...(t.endAfterMs !== undefined ? { endAfterMs: t.endAfterMs - elapsed } : {}), ...(t.stopAfterMs !== undefined ? { stopAfterMs: t.stopAfterMs - elapsed, volume: t.volume * (1 - elapsed / t.stopAfterMs) } : {}) }]]));
5
5
  }
6
6
  export function mediaAt(project, scenarioId, position, elapsedMs = 0) {
7
7
  const sc = project.scenarios[scenarioId];
@@ -62,6 +62,8 @@ export declare class PluginCompiler {
62
62
  track: string;
63
63
  action: "play";
64
64
  resource: string;
65
+ oneShot?: boolean;
66
+ durationMs?: number;
65
67
  offsetMs?: number;
66
68
  volume?: number;
67
69
  loop?: boolean;
@@ -19,7 +19,10 @@ function validMediaCommand(value, plugin, owners) {
19
19
  return Object.keys(value).every(k => ['track', 'action', 'fadeMs'].includes(k));
20
20
  if (value.action !== 'play' || typeof value.resource !== 'string' || owners.get(value.resource) !== plugin)
21
21
  return false;
22
- return Object.keys(value).every(k => ['track', 'action', 'resource', 'volume', 'loop', 'fadeMs', 'offsetMs'].includes(k))
22
+ return Object.keys(value).every(k => ['track', 'action', 'resource', 'volume', 'loop', 'fadeMs', 'offsetMs', 'oneShot', 'durationMs'].includes(k))
23
+ && (value.oneShot === undefined || typeof value.oneShot === 'boolean')
24
+ && (value.durationMs === undefined || typeof value.durationMs === 'number' && Number.isFinite(value.durationMs) && value.durationMs > 0)
25
+ && (!value.oneShot || value.loop !== true && typeof value.durationMs === 'number' && value.durationMs > (typeof value.offsetMs === 'number' ? value.offsetMs : 0))
23
26
  && (value.offsetMs === undefined || typeof value.offsetMs === 'number' && Number.isFinite(value.offsetMs) && value.offsetMs >= 0)
24
27
  && (value.volume === undefined || typeof value.volume === 'number' && value.volume >= 0 && value.volume <= 1)
25
28
  && (value.loop === undefined || typeof value.loop === 'boolean');
@@ -387,8 +390,8 @@ export class PluginCompiler {
387
390
  if (i) {
388
391
  // 配乐锚点:上一次提交(i = 1 时是场景开始)到这一步提交之间的计划时长(stepPlan:停留 / 朗读估算 + 这一步的操作演示)
389
392
  media = advanceMedia(media, commitGapMs(project, sc.steps, i - 2));
390
- for (const c of this.mediaCommands.get(sc.steps[i - 1].id) ?? []) {
391
- const key = `${c.plugin}:${c.track}`;
393
+ for (const [eventIndex, c] of (this.mediaCommands.get(sc.steps[i - 1].id) ?? []).entries()) {
394
+ const key = `${c.plugin}:${c.track}${c.action === 'play' && c.oneShot ? `@${sc.steps[i - 1].id}:${eventIndex}` : ''}`;
392
395
  const current = media[key];
393
396
  if (c.action === 'play' && current?.resource === c.resource && c.offsetMs === undefined) {
394
397
  // 同一首再 play:继续播放(含取消正在进行的淡出),只更新音量与循环
@@ -399,7 +402,7 @@ export class PluginCompiler {
399
402
  // 换曲:有 fadeMs 时旧曲换到「轨道>旧资源」键上同时淡出,与新曲交叉,中间没有静音
400
403
  if (current && c.fadeMs)
401
404
  media[`${key}>${current.resource}`] = { ...current, stopAfterMs: Math.min(current.stopAfterMs ?? c.fadeMs, c.fadeMs) };
402
- media[key] = { plugin: c.plugin, resource: c.resource, offsetMs: c.offsetMs ?? 0, ...(c.offsetMs !== undefined ? { startOffsetMs: c.offsetMs } : {}), volume: c.volume ?? 1, loop: c.loop ?? false, fadeInMs: c.fadeMs ?? 0 };
405
+ media[key] = { plugin: c.plugin, resource: c.resource, offsetMs: c.offsetMs ?? 0, ...(c.offsetMs !== undefined ? { startOffsetMs: c.offsetMs } : {}), volume: c.volume ?? 1, loop: c.loop ?? false, fadeInMs: c.fadeMs ?? 0, ...(c.oneShot ? { endAfterMs: c.durationMs - (c.offsetMs ?? 0) } : {}) };
403
406
  }
404
407
  else {
405
408
  for (const k of Object.keys(media))
@@ -99,7 +99,7 @@ export function streamPlan(step, prev) {
99
99
  const before = prev ? readPath(prev, s.path) : undefined;
100
100
  const keep = typeof before === 'string' && before && s.value.startsWith(before) ? [...before].length : 0;
101
101
  const fresh = [...s.value].slice(keep).join('');
102
- const voiced = s.pace === 'voice' ? voicePacedMs(step?.narrate ?? step?.say) : 0;
102
+ const voiced = s.pace === 'voice' && !step?.mute ? voicePacedMs(step?.narrate ?? step?.say) : 0;
103
103
  return { path: s.path, value: s.value, keep, ms: fresh ? (voiced || streamMs(fresh)) : 0, ...(s.pace ? { pace: s.pace } : {}) };
104
104
  });
105
105
  }
package/dist/schema.d.ts CHANGED
@@ -235,6 +235,7 @@ export declare const MediaSnapshot: z.ZodRecord<z.ZodString, z.ZodObject<{
235
235
  loop: z.ZodBoolean;
236
236
  fadeInMs: z.ZodNumber;
237
237
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
238
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
238
239
  }, z.core.$strict>>;
239
240
  export declare const Step: z.ZodObject<{
240
241
  media: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -246,6 +247,7 @@ export declare const Step: z.ZodObject<{
246
247
  loop: z.ZodBoolean;
247
248
  fadeInMs: z.ZodNumber;
248
249
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
250
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
249
251
  }, z.core.$strict>>>;
250
252
  id: z.ZodString;
251
253
  key: z.ZodOptional<z.ZodString>;
@@ -408,6 +410,8 @@ export declare const Step: z.ZodObject<{
408
410
  say: z.ZodOptional<z.ZodString>;
409
411
  sayRole: z.ZodOptional<z.ZodString>;
410
412
  narrate: z.ZodOptional<z.ZodString>;
413
+ mute: z.ZodOptional<z.ZodLiteral<true>>;
414
+ systemLead: z.ZodOptional<z.ZodNumber>;
411
415
  source: z.ZodOptional<z.ZodString>;
412
416
  }, z.core.$strict>;
413
417
  export declare const Scenario: z.ZodObject<{
@@ -426,6 +430,7 @@ export declare const Scenario: z.ZodObject<{
426
430
  loop: z.ZodBoolean;
427
431
  fadeInMs: z.ZodNumber;
428
432
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
433
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
429
434
  }, z.core.$strict>>>;
430
435
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
431
436
  id: z.ZodString;
@@ -460,6 +465,7 @@ export declare const Scenario: z.ZodObject<{
460
465
  loop: z.ZodBoolean;
461
466
  fadeInMs: z.ZodNumber;
462
467
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
468
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
463
469
  }, z.core.$strict>>>;
464
470
  id: z.ZodString;
465
471
  key: z.ZodOptional<z.ZodString>;
@@ -622,6 +628,8 @@ export declare const Scenario: z.ZodObject<{
622
628
  say: z.ZodOptional<z.ZodString>;
623
629
  sayRole: z.ZodOptional<z.ZodString>;
624
630
  narrate: z.ZodOptional<z.ZodString>;
631
+ mute: z.ZodOptional<z.ZodLiteral<true>>;
632
+ systemLead: z.ZodOptional<z.ZodNumber>;
625
633
  source: z.ZodOptional<z.ZodString>;
626
634
  }, z.core.$strict>>>;
627
635
  expected: z.ZodDefault<z.ZodString>;
@@ -1364,6 +1372,7 @@ export declare const Project: z.ZodObject<{
1364
1372
  loop: z.ZodBoolean;
1365
1373
  fadeInMs: z.ZodNumber;
1366
1374
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
1375
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
1367
1376
  }, z.core.$strict>>>;
1368
1377
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
1369
1378
  id: z.ZodString;
@@ -1398,6 +1407,7 @@ export declare const Project: z.ZodObject<{
1398
1407
  loop: z.ZodBoolean;
1399
1408
  fadeInMs: z.ZodNumber;
1400
1409
  stopAfterMs: z.ZodOptional<z.ZodNumber>;
1410
+ endAfterMs: z.ZodOptional<z.ZodNumber>;
1401
1411
  }, z.core.$strict>>>;
1402
1412
  id: z.ZodString;
1403
1413
  key: z.ZodOptional<z.ZodString>;
@@ -1560,6 +1570,8 @@ export declare const Project: z.ZodObject<{
1560
1570
  say: z.ZodOptional<z.ZodString>;
1561
1571
  sayRole: z.ZodOptional<z.ZodString>;
1562
1572
  narrate: z.ZodOptional<z.ZodString>;
1573
+ mute: z.ZodOptional<z.ZodLiteral<true>>;
1574
+ systemLead: z.ZodOptional<z.ZodNumber>;
1563
1575
  source: z.ZodOptional<z.ZodString>;
1564
1576
  }, z.core.$strict>>>;
1565
1577
  expected: z.ZodDefault<z.ZodString>;
package/dist/schema.js CHANGED
@@ -113,7 +113,7 @@ export const CALLOUT_SIDES = ['top', 'right', 'bottom', 'left'];
113
113
  export const Callout = z.strictObject({ target: z.string().min(1), text: z.string().min(1), side: z.enum(CALLOUT_SIDES).optional() });
114
114
  export const MediaSnapshot = z.record(z.string(), z.strictObject({
115
115
  plugin: z.string().min(1), resource: z.string().min(1), offsetMs: z.number().nonnegative(), startOffsetMs: z.number().nonnegative().optional(),
116
- volume: z.number().min(0).max(1), loop: z.boolean(), fadeInMs: z.number().nonnegative(), stopAfterMs: z.number().nonnegative().optional(),
116
+ volume: z.number().min(0).max(1), loop: z.boolean(), fadeInMs: z.number().nonnegative(), stopAfterMs: z.number().nonnegative().optional(), endAfterMs: z.number().nonnegative().optional(),
117
117
  }));
118
118
  export const Step = z.strictObject({
119
119
  media: MediaSnapshot.optional(),
@@ -161,6 +161,10 @@ export const Step = z.strictObject({
161
161
  sayRole: z.string().min(1).optional(),
162
162
  /** 旁白(D74,来自 narrate()):用旁白的声音读,优先于台词和字幕;没有时省略。发布站保留。 */
163
163
  narrate: z.string().min(1).optional(),
164
+ /** Explicit silence from narrate(false); suppresses narration, dialogue and caption fallback. */
165
+ mute: z.literal(true).optional(),
166
+ /** System-step lead before commit, in milliseconds. */
167
+ systemLead: z.number().int().min(0).max(30_000).optional(),
164
168
  source: Source,
165
169
  });
166
170
  export const Scenario = z.strictObject({
package/dist/step-plan.js CHANGED
@@ -42,7 +42,7 @@ export function stepPlan(project, step, o = {}) {
42
42
  else if (a.type === 'press')
43
43
  gestureMs = reduced ? T.reducedStep : T.selectHold;
44
44
  else if (step.kind === 'system' || a.type === 'event')
45
- gestureMs = reduced ? T.reducedStep : T.systemHold;
45
+ gestureMs = step.systemLead ?? (reduced ? T.reducedStep : T.systemHold);
46
46
  else if (reduced)
47
47
  gestureMs = T.reducedStep;
48
48
  else if ('target' in a) {
@@ -70,7 +70,7 @@ export function stepPlan(project, step, o = {}) {
70
70
  : stepDwell({ texts: o.texts ?? stepTexts(step), paced: step.hold !== undefined, cameraMoved: step.shots.length > 0 || !!step.directorLayer, streamMs });
71
71
  // hold 是看的时间,不是动画:减少动态效果时同样保留
72
72
  const dwellMs = Math.max(step.hold ?? 0, step.effectHold ?? 0, read, settleMs);
73
- const voice = voiceMs(step.narrate ?? step.say);
73
+ const voice = voiceMs(step.mute ? undefined : step.narrate ?? step.say);
74
74
  const leadMs = cursorMs + rippleMs + gestureMs;
75
75
  return { cursorMs, rippleMs, gestureMs, leadMs, settleMs, dwellMs, voiceMs: voice, totalMs: leadMs + Math.max(dwellMs, voice) };
76
76
  }
package/dist/voice.js CHANGED
@@ -35,6 +35,8 @@ export function joinSpoken(parts) {
35
35
  * speaker 是这一步的说话角色(speakerRoleAt)。text 为空串表示这一步不读;role 为 null 表示旁白。
36
36
  */
37
37
  export function spokenLine(step, caption, speaker) {
38
+ if (step.mute)
39
+ return { text: '', role: null };
38
40
  if (step.narrate?.trim())
39
41
  return { text: step.narrate.trim(), role: null };
40
42
  if (step.say?.trim())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joplo-app/core",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "description": "Joplo 作品引擎:编译、校验与确定性播放,支持独立作品和功能方案评审",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "dist"
36
36
  ],
37
37
  "dependencies": {
38
- "@joplo-app/kit": "0.6.2",
38
+ "@joplo-app/kit": "0.7.1",
39
39
  "zod": "4.6.7"
40
40
  },
41
41
  "engines": {