@joplo-app/core 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-skill.d.ts +2 -2
- package/dist/agent-skill.js +3 -2
- package/dist/guide.js +37 -17
- package/dist/local-review.d.ts +79 -0
- package/dist/local-review.js +5 -1
- package/dist/validate.js +48 -7
- package/package.json +2 -2
package/dist/agent-skill.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const SKILL_TOPICS: readonly [{
|
|
|
33
33
|
readonly description: "Local live feedback, Share polling, prompt acknowledgement, session/version isolation, and recovery";
|
|
34
34
|
}, {
|
|
35
35
|
readonly name: "diff";
|
|
36
|
-
readonly description: "
|
|
36
|
+
readonly description: "Diff public feature builds, stable step identity, uncertain matches, isolated PR CI publication";
|
|
37
37
|
}, {
|
|
38
38
|
readonly name: "publish";
|
|
39
39
|
readonly description: "Standalone works, drafts, --work scope, feature pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)";
|
|
@@ -44,7 +44,7 @@ export declare const SKILL_TOPICS: readonly [{
|
|
|
44
44
|
/** 心智模型:所有入口最先读到的几句话。 */
|
|
45
45
|
export declare const MENTAL_MODEL: readonly ["Joplo shows are playable, interactive pieces your agent writes in code: compare feature options, explain how a system runs, or show what happened. Share them by link or embed their player. It is a player for pre-declared scenarios, not a free-form app prototype with persistent data or real backend logic, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.", "Structure: a project is a portfolio of works; a work has slices (scenarios), and a slice has steps. Every work has a cover and enters the home page. Capabilities combine: feature review groups alternative works (options) with cases, coverage, rules and a pick; sequencing connects chapters; draft keeps a standalone work out of publication.", "A step is one user action (.click / .type / .select / .press / .drag / .hover / .scroll / .act) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.", "During playback, the first picture-changing stage input pauses and applies that same input. Hover does not pause; blank clicks only pause without an exploration notice. Matching the next action advances the script and stays stopped; another reachable scenario asks to switch (default before the action; actionEntry: 'after' consumes it on confirmation); native controls and declared free reactions change only a local playground. Play, jump, scenario change and reset discard exploration. Screenshots, video and deep links always use scripted state.", "work() is the only work entry point. Use work() + chapter() in works/<key>.tsx for a standalone show; compare feature options with feature() + work() in features/<f>/works/<key>.tsx. The UI calls these alternative works options. Both can coexist. Standalone works need no pick; draft: true excludes them from build and share. Publish one entry with --work <key>; feature publication still uses pick."];
|
|
46
46
|
/** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
|
|
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,
|
|
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, start with the Minimal Decision Recipe: for feature review build one happy path and one error-and-recovery scenario plus one contested boundary (add option B only when a real trade-off is open; defer extra pages, voice, and polish until after the first board check); for a standalone work start with one short chapter.", "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
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 account storage; on QUOTA_EXCEEDED (exit 6), report error.details and never auto-clean. share delete is only for an explicitly requested deletion: confirm interactively or require --yes in automation", "publish"], readonly ["Local board/voice management uses the running board's real API, not fake playback. Keep full provider keys out of output: voice key set reads hidden input or JOPLO_VOICE_KEY; key test may call the provider, and key delete/share delete/board remove need confirmation or --yes", "publish"], readonly ["Prepared narration/dialogue uses narrate(text, { audio: asset(...) }) or say(text, { role, audio: localResource(...) }); explicit audio never calls TTS or counts generation characters. Use hold('voice', { pad: 0.4 }) / hold('audio', ref) for measured-or-estimated audio dwell; check and outline identify the source; see demo before lining up tracks", "demo"], 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 = {
|
package/dist/agent-skill.js
CHANGED
|
@@ -16,7 +16,7 @@ export const SKILL_TOPICS = [
|
|
|
16
16
|
{ name: 'check', description: 'Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
|
|
17
17
|
{ name: 'selection', description: 'Edit only the element selected by the user in the board' },
|
|
18
18
|
{ name: 'review', description: 'Local live feedback, Share polling, prompt acknowledgement, session/version isolation, and recovery' },
|
|
19
|
-
{ name: 'diff', description: '
|
|
19
|
+
{ name: 'diff', description: 'Diff public feature builds, stable step identity, uncertain matches, isolated PR CI publication' },
|
|
20
20
|
{ name: 'publish', description: 'Standalone works, drafts, --work scope, feature pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)' },
|
|
21
21
|
{ name: 'plugins', description: 'Data-only action contracts, native local behavior, engine-clock presenters; Universal properties, plugin themes, state writes and director targets; Binary assets, explicit paid resource generation, persistent artifacts, media tracks and offline publishing; API v2 immutable hooks, scoped/localized snapshots, shared React and production-package checks' },
|
|
22
22
|
];
|
|
@@ -33,7 +33,7 @@ export const START_ORDER = [
|
|
|
33
33
|
'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.',
|
|
34
34
|
'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.',
|
|
35
35
|
'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.',
|
|
36
|
-
'With minimal code,
|
|
36
|
+
'With minimal code, start with the Minimal Decision Recipe: for feature review build one happy path and one error-and-recovery scenario plus one contested boundary (add option B only when a real trade-off is open; defer extra pages, voice, and polish until after the first board check); for a standalone work start with one short chapter.',
|
|
37
37
|
'Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.',
|
|
38
38
|
'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.',
|
|
39
39
|
'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.',
|
|
@@ -181,6 +181,7 @@ function feedbackBody() {
|
|
|
181
181
|
'- Use it to wait for one option version\'s approval (exit 0 only on approval, 1 if the round closes) or to resume a round from a cursor. Match projectDir, workId, instanceId and revision from list; if several match, choose explicitly instead of taking the newest.',
|
|
182
182
|
'- Source edits close that round: list again and attach to the new one with its own cursor. Never reuse an old cursor on a new session or delete review records to reset a round.',
|
|
183
183
|
'- For an explicitly requested scripted review action, feedback submit --local requires an exact work/scenario/position/body and feedback approve --local confirms that revision through the board API. The CLI does not pretend to know or control the reviewer\'s current browser position; approval never publishes.',
|
|
184
|
+
'- After editing source to address local feedback (which opens a fresh review round), record a receipt with npx joplo feedback reply ./demo --local --event <rv_...:seq> --status <addressed|deferred|declined> [--scenario <id> --position <n>] [--note <text>]. The board shows each handled item alongside a direct jump button to that step so the reviewer can re-check changes in seconds without replaying the whole demo. Receipts do not end --follow --once or carry over old approvals.',
|
|
184
185
|
'',
|
|
185
186
|
'## Share review: poll with a recoverable cursor',
|
|
186
187
|
'```sh',
|
package/dist/guide.js
CHANGED
|
@@ -116,8 +116,8 @@ export default work({
|
|
|
116
116
|
chapter() continues the previous chapter by declaration order; the first starts from the initial state. Only exceptions use from: null (restart) or from: 'sliceKey' (another predecessor). Do not mix flow() and chapter() in one work, write cases/uses() in standalone works, or number titles manually: the UI and outline number chapters automatically. Empty scenarios: {} is a valid local work in progress; it is skipped in publish/review, and explicit build --work selection fails until a slice is added.
|
|
117
117
|
|
|
118
118
|
### Migrating an existing piece
|
|
119
|
-
- A compiler migration does not update code blocks or paths inside strings: search displayed file trees, terminal examples and source snippets too. Keep each example on the current work API, identify historical reconstructions explicitly, and update locale keys with changed source text.
|
|
120
|
-
- Before changing files, freeze the old dev IR.
|
|
119
|
+
- A compiler migration does not update code blocks or paths inside strings: search displayed file trees, terminal examples and source snippets too. Keep each example on the current work API, identify historical reconstructions explicitly, and update locale keys with changed source text. Check diagnostic counts before and after; a text-only update should not add missing/stale translations.
|
|
120
|
+
- Before changing files, freeze the old dev IR. Diff every step, compiled plugin snapshot and every stateAt position against the migrated work. Renaming flow() to chapter() alone does not prove continuous state or audiovisual equivalence; review motion and sound as well.
|
|
121
121
|
- Preserve independent starts: if an old chapter began from the initial state, give the new chapter from: null. Otherwise chapter two onward inherits ui/data/inputs and music from its predecessor. Keep default continuation only where the story really continues.
|
|
122
122
|
- Move feature.roles audience descriptions into work.audience; preserve actual role() speakers. Keep say() role keys and config.voice.roles aligned so dialogue still uses the intended voices.
|
|
123
123
|
- Rename project helper functions already called chapter before importing the kit's chapter builder; a name collision is not a compiler-model problem.
|
|
@@ -275,8 +275,9 @@ It is not a feature tour. Plan it in a few lines before writing TSX, show the pl
|
|
|
275
275
|
|
|
276
276
|
## 1. Show the product working, not slides
|
|
277
277
|
Joplo exists to demonstrate product behavior with visuals and motion. It is not a PPT tool: a demo made of text cards and bullet lists has failed, however good the text.
|
|
278
|
-
- Every step =
|
|
279
|
-
-
|
|
278
|
+
- Every step = Action (a click, typing, an incoming message, a system event) → Reaction (a new row, a status, a toast, a trace, an object moving) → Meaning (why this change matters to the user's goal or mental model). Skipping Meaning leaves viewers watching clicks without knowing what was proved.
|
|
279
|
+
- Match the narrative spine to the job: product demos follow user state change (Context → Problem → target Outcome → Workflow → edge Behavior → open Decision); explainers build a mental model (shared premise AND → misconception or bottleneck BUT → mechanism & new trade-off THEREFORE, never a paper's Intro/Method/Results table of contents).
|
|
280
|
+
- Show, do not tell: a claim like 'invites are fast' becomes the invite happening on screen; 'the queue absorbs spikes' becomes animated flow packets or a trace through the queue while the UI stays responsive.
|
|
280
281
|
- On-screen writing has a supporting role: captions narrate what is on screen, explain() says why it matters, cards only open, close, jump in time, or switch roles.
|
|
281
282
|
- Pick the visual by what you prove: UI flow → the product screens; who calls whom → the diagram plugin; time order → sequence view; lifecycle → lifecycle view; two answers → options A/B on the same scenario.
|
|
282
283
|
Slide version (wrong): the same points as cards, nothing to operate, nothing changes.
|
|
@@ -296,13 +297,14 @@ flow('Invite a teammate', { start: '/members' })
|
|
|
296
297
|
.card('Now Leo', { role: 'leo' })
|
|
297
298
|
.click('mail_join', 'Leo opens the link and lands in the space', go('/space'), done('Leo joins the same day'))
|
|
298
299
|
\`\`\`
|
|
299
|
-
Backend behind the same feature: put a diagram
|
|
300
|
+
Backend behind the same feature: put a diagram layer alongside the UI (prefer intentional manual composition with edge flow pulses and node status updates; use opt-in auto-layout trace() for dense graphs or sequences — see npx joplo skill diagram), then drive it in .system('Send mail', 'The mail job runs in the background', ...) and show the failure plus the error the user sees. Full examples: examples/invite, examples/agent-arch.
|
|
300
301
|
|
|
301
302
|
## 2. Plan the demo first (write it in your reply; ask only questions that change it, each with a default)
|
|
302
303
|
- Audience: who watches (product review, design review, a customer, engineers) and what they must decide afterward.
|
|
303
304
|
- One to three points: what viewers must believe after watching. Each point becomes a scenario or an A/B comparison, never a single step.
|
|
304
305
|
- Scenario list, one line per scenario: Given (who, where, starting state) → When (the user's actions) → Then (the visible result), plus how it opens and how it ends.
|
|
305
306
|
- Length: a scenario is usually 5–12 steps, about 20–60 s at 1×. check flags one over 90 s; npx joplo outline prints every estimate. An estimate is the sum of each step's time plan: the action demonstration (cursor travel, press, typing or a 0.9 s system pause) plus the longer of its stay and its estimated narration, the same plan autoplay runs.
|
|
307
|
+
- Minimal Decision Recipe (first reviewable draft in minutes): for a feature decision, do not build every screen, edge case, or voice track up front. Start with **1 thin happy path + 1 failure/recovery path + 1 contested boundary** on the smallest screen that proves the state change; add Option B only when a genuine trade-off needs comparing, and expand the remaining cases only after the reviewer checks the first round in the board.
|
|
306
308
|
- Unsure how to frame it? Offer two or three one-line framings and let the user pick.
|
|
307
309
|
- Recreating an existing video, GIF or screen recording: read it before planning. Extract frames into contact sheets (for example ffmpeg -i ref.gif -vf "fps=1,tile=3x3" sheet%02d.png, written outside the project) and list its chapters, the states each chapter passes through and every on-screen sentence; those become slices, steps and narration (shared cases only for feature review). Map the reference's own chrome to the player's instead of redrawing it: its chapter label → chapter title (case title in feature review) and the player's step title, its bottom progress → the player's chapter list, its key badge → the host key record after .press(), its spoken captions → narrate()/say(). Ask about anything the reference does not show (chapters cut off, unseen states) instead of inventing it; replace third-party logos with neutral shapes.
|
|
308
310
|
|
|
@@ -338,6 +340,11 @@ Joplo already has the parts of a user story; fill them in that spirit.
|
|
|
338
340
|
- No filler ('Now let us…', 'a whole new experience'): every sentence does a job. Do not invent numbers or facts; record guesses as ai_assumption rules.
|
|
339
341
|
- Cover text: flow('Slice title', { description }) is the cover sentence, 30 units at most (DESCRIPTION_TOO_LONG). The cover falls back to the feature goal.
|
|
340
342
|
- 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.
|
|
343
|
+
- Titles, chapters and pacing targets:
|
|
344
|
+
- Internal review work title: 10–18 CJK chars (25–45 Latin chars); put the subject and decision in the first 10–12 CJK chars. External title: 14–22 CJK (35–55 Latin); GitHub README badges truncate at 28 Unicode code points (first 27 + ellipsis), so never open with a series prefix.
|
|
345
|
+
- Linear chapters (2–5 min shows): split into 3–6 chapters of ~25–60 s each (for YouTube chapters keep ≥ 3 chapters and ≥ 10 s each). Name chapters in 4–10 CJK chars (max 14) or 2–5 English words (max 32 chars) with the distinguishing noun first: Action-Outcome ('Retry hits original order') for feature reviews, Question-Hook ('Paid, yet timed out?') for explainers, or Stage-Milestone ('Ledger dedup') for architecture walkthroughs — never generic sets like 'Intro / Principles / Summary'.
|
|
346
|
+
- Step caption vs narration: keep top-left step captions to 4–10 CJK chars (visible state), and spoken narrate() lines to 12–30 CJK chars / 6–18 English words (3–8 s; split above 10 s) explaining *why* without repeating the caption.
|
|
347
|
+
- Six-beat framing grammar (shared across reviews and explainers): Establish wide context → Push in when detail needs magnification → Action → Reaction → Meaning → Silent observation window (reusable helper: const observe = (s = 2.2) => [narrate(false), hold(s)]) → Controlled A/B on identical inputs → Pull back to land the decision or open question.
|
|
341
348
|
|
|
342
349
|
## 6. Narration: narrate() is a presenter talking, not the caption read aloud
|
|
343
350
|
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.
|
|
@@ -346,6 +353,7 @@ When the board or the published site reads a demo aloud, each step reads, in ord
|
|
|
346
353
|
- 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.
|
|
347
354
|
- Spoken sentences: subject first, active voice, one idea each. Commas and periods are the breaths; no brackets, slashes, arrows, emoji, or markdown.
|
|
348
355
|
- Write numbers, money, times, and versions the way they are said in the demo's language ('four hundred sixty' rather than '¥460'; 'version two' rather than 'v2').
|
|
356
|
+
- Deliberate observation windows (know when to stop talking): when a step carries a complex visual transition — objects flying into new slots, a multi-hop trace, or coupled quantities shifting — point the viewer's eyes in the preceding beat, then run the visual step with narrate(false) and hold(1.8–3) so spoken words do not compete with visual working memory; resume narration on the next beat to land the takeaway.
|
|
349
357
|
- Transitions carry the story: role switches, time jumps, and closing cards need a line that tells the viewer why we moved.
|
|
350
358
|
- Plain and concrete, not flowery: no metaphors, slogans, or hype. Vivid means specific: real names, amounts, and times.
|
|
351
359
|
- Not every step needs its own line: a trivial step can keep its short caption, and a character's say() can carry a moment ('Count me in!').
|
|
@@ -465,10 +473,11 @@ The host can draw an input/keyboard record after a type/press step, and toasts c
|
|
|
465
473
|
- 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.
|
|
466
474
|
- --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.
|
|
467
475
|
- 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.
|
|
468
|
-
- 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).
|
|
476
|
+
- 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). Benchmark 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.
|
|
477
|
+
- Intentional stillness vs STILL warnings: before adding camera drift to clear a ≥ 1.5 s STILL span, ask whether stillness is conveying meaning (precision diffs, locked numbers, unchanged cache slots). Keep the frame still when viewers need a locked reference.
|
|
469
478
|
- 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.
|
|
470
479
|
- 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.
|
|
471
|
-
- Test first input, drag, wheel, hover, keyboard, confirmation cancel/confirm, reset and resumed playback.
|
|
480
|
+
- Test first input, drag, wheel, hover, keyboard, confirmation cancel/confirm, reset and resumed playback. Check restored frames and direct jumps against pristine script frames. Explain unverified devices or audio behavior.
|
|
472
481
|
- For layout, visual motion, shapes, charts and component APIs use the installed plugin skills. The engine has no built-in component vocabulary.
|
|
473
482
|
|
|
474
483
|
## Write a theme
|
|
@@ -477,7 +486,8 @@ A project theme is themes/<name>.css selected by config({ theme: '<name>' }). De
|
|
|
477
486
|
## Branches, annotations and appearance
|
|
478
487
|
- fork(label, scenarioKey) adds a labeled route to another scenario; it does not silently branch automatic playback. Feature diffs report action-entry and autoplay policy changes separately, even when their static pictures are identical. Mark the optional destination flow with autoplay:false so sequential playback skips it; fork alone is a navigation choice, not an autoplay exclusion. Return links to main chapters must not mark those chapters optional.
|
|
479
488
|
- Keep fork labels short and verify the last choice at the actual viewport width: the strip scrolls horizontally when crowded. Avoid hiding an important return path in unnoticeable overflow. A film can end on its final visible state without a done badge when that badge crowds the choices.
|
|
480
|
-
- mark(
|
|
489
|
+
- mark(target, { kind?, note? }) is a hand-drawn annotation ('circle' | 'underline' | 'box' | 'arrow') anchored to a stable element. Empty notes are omitted; targets are still validated. Use --jp-annot for annotation color in a theme.
|
|
490
|
+
- Empty-argument shot() resets framing to the whole current director layer; inside an explainer world plugin, its empty-argument camera resets to the entire canvas.
|
|
481
491
|
- .press('⌘K', ...effects) models a targetless keyboard step; keep editing keys inside editable elements. Keys and ids are not translated.
|
|
482
492
|
- Appearance changes host theme/font/stroke, not state. Follow director keeps framing in sync; a manually selected layer uses that layer until the viewer follows again.
|
|
483
493
|
- Custom themes live in themes/<name>.css and define --jp-* tokens; do not change authored data to recolor a view. For component-specific layout, motion and visual variables, read its installed plugin skill.
|
|
@@ -514,6 +524,12 @@ Cues do not zoom. If a cue's target is outside the current shot, the camera firs
|
|
|
514
524
|
In diagrams the frame always keeps the target's group (title at least) and a message's two participants: a cue on them stays in the shot; spotlight keeps the group title lit. Plugin components can declare that they show their own changes (fade-in, traces), so the reveal pulse skips them.
|
|
515
525
|
With layers, a cue switches the director to its target's layer when the step has no shot.
|
|
516
526
|
|
|
527
|
+
## Four-level attention ladder (escalate only as needed)
|
|
528
|
+
1. **Motion vs stillness**: when only one object changes and viewers already see it, add no cue at all.
|
|
529
|
+
2. **Default reveal pulse**: when an action on one side updates a small badge elsewhere, let autoFocus reveal pulse handle it.
|
|
530
|
+
3. **Local pointer**: when viewers need to know *which* field, *what order*, or *why*, pick one primary pointer — highlight(), callout(), mark(), or numbered().
|
|
531
|
+
4. **Isolation or zoom**: use spotlight() only when surrounding chrome competes visually, and shot() only when the target is too small to read. Keep one frame across consecutive steps on the same subject.
|
|
532
|
+
|
|
517
533
|
## Pacing rules
|
|
518
534
|
1. One subject per step. If the caption needs "and", split the step.
|
|
519
535
|
2. Context first: when a new screen appears, show the whole of it (or number its parts) before zooming into a corner.
|
|
@@ -606,7 +622,7 @@ Pick relevant cases to ask the user before starting. Do not include every preset
|
|
|
606
622
|
- Each option uses flow(..., { cases: ['happy'] }) to reference the shared cases for comparison.
|
|
607
623
|
- A case with a scenario is automatically \`expressed\`; one with neither a scenario nor a declaration is \`missing\`.
|
|
608
624
|
- After adding a case, run check: reconsider it in every option.
|
|
609
|
-
- Start with
|
|
625
|
+
- Start with the Minimal Decision Recipe: 1 thin happy path, 1 failure-and-recovery path, and 1 contested boundary case per work (add Option B only when a real trade-off needs comparing; skip extra screens, polish, and voice until after the first board check), then add remaining cases after the user has seen them in the board.
|
|
610
626
|
- A rule the user stated in this conversation is origin: 'user', status: 'confirmed'; a rule you inferred stays ai_assumption, pending.
|
|
611
627
|
|
|
612
628
|
## Declare coverage without a scenario
|
|
@@ -623,7 +639,7 @@ No mobile example yet; create a separate demo when mobile is needed (D44).`,
|
|
|
623
639
|
check: `# Joplo diagnostics: check
|
|
624
640
|
|
|
625
641
|
## Music checks
|
|
626
|
-
Referenced music is inspected by its enabled plugin on the author machine: duration, part note counts and marker times.
|
|
642
|
+
Referenced music is inspected by its enabled plugin on the author machine: duration, part note counts and marker times. Check these against chapter holds; short loops over long scenes and music ending early warn. Unknown start markers are errors when the local inspector is available. Missing local tools warn without blocking unrelated checks; this is not proof that sound was rendered. Build reports each audio asset's bytes/duration, aggregate raw and embedded bytes, and complete site size. Check publication and decoded-memory budgets in the enabled plugin guide; a compressed file's size does not represent PCM memory. Sound-library attribution is cached with the artifact; missing required attribution blocks publication even when score inspection is unavailable. Listen to playback/export; when only measurements were possible, report LUFS/peak and explicitly say not verified by human listening. Read the enabled music plugin's skill for composition and recovery.
|
|
627
643
|
|
|
628
644
|
|
|
629
645
|
STEP_KEY_INVALID: use a letter followed by up to 63 letters/digits/underscores/hyphens. STEP_KEY_DUPLICATE: each step key must be unique within its scenario; keep the same key only for the same action across versions. See diff for identity guidance.
|
|
@@ -678,13 +694,13 @@ Example: features/invite/works/a.tsx:12:5 warning UNBOUND_INTERACTIVE Interac
|
|
|
678
694
|
- UNKNOWN_SLOT / UNKNOWN_ROUTE / UNKNOWN_LAYOUT: Check routes, layouts, and Slot declarations; add elements only to existing locations.
|
|
679
695
|
- FEATURE_ORDER_INVALID: feature({ order }) must be a finite number; omit it for natural folder-name order. NaN, Infinity and strings are invalid.
|
|
680
696
|
- UNKNOWN_PICK: pick must be a work filename under this feature's works/.
|
|
681
|
-
- NOT_PICKED: The feature has no picked option and will not publish.
|
|
697
|
+
- NOT_PICKED: The feature has no picked option and will not publish. Review options, then set feature.pick to the chosen filename.
|
|
682
698
|
- ROUTE_EXISTS: An option route duplicates an existing route. Use on to add elements, or choose a new route.
|
|
683
699
|
- BAD_ROUTE: The route does not start with /. Use an absolute static product route.
|
|
684
700
|
- DUPLICATE_ELEMENT: Duplicate element ids within a stage. Change only conflicting ids and update references.
|
|
685
|
-
- CAPTION_TOO_LONG:
|
|
701
|
+
- CAPTION_TOO_LONG: Top-left step title or fallback subtitle exceeds 24 units (CJK 1, other 0.5, whitespace ignored). Keep one visible state per step; move rationale to explain() or narrate(). See demo.
|
|
686
702
|
- 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.
|
|
687
|
-
- SAY_TOO_LONG / NARRATE_TOO_LONG (warning):
|
|
703
|
+
- SAY_TOO_LONG / NARRATE_TOO_LONG (warning): spoken line exceeds 10 seconds (using measured prepared audio duration when available, else estimated speech duration — roughly 43 CJK chars or 127 Latin letters). Autoplay waits until it finishes; tighten or split the step.
|
|
688
704
|
- SAY_EMPTY / NARRATE_EMPTY: say() needs the character's words, narrate() the narrator's. Remove it to fall back to the caption.
|
|
689
705
|
- SAY_ROLE_CONFLICT: one step has say(…, { role }) lines from two different roles. A step reads one speaker; split the lines into consecutive steps.
|
|
690
706
|
- AUDIO_SOURCE_INVALID / AUDIO_INVALID: supply asset() audio bytes or an enabled localResource() reference, prepare a valid decodable audio artifact and check again. No remote URL fetching or provider fallback occurs for explicit audio.
|
|
@@ -697,6 +713,9 @@ Example: features/invite/works/a.tsx:12:5 warning UNBOUND_INTERACTIVE Interac
|
|
|
697
713
|
- 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.
|
|
698
714
|
- DESCRIPTION_TOO_LONG: flow('Slice title', { description }) is the scenario cover sentence; keep it within 30 units, one sentence saying what this scenario shows. See story.
|
|
699
715
|
- 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.
|
|
716
|
+
- READING_BUDGET_SHORT (info): the displayed card or step text needs noticeably longer to read than the step's visible dwell time. Shorten the copy, split into two steps, or add hold().
|
|
717
|
+
- CHAPTERS_TOO_FEW (info): a standalone linear work runs 2 minutes or longer with fewer than 3 main playable chapters. Break it into 3–6 chapters (~25–60 s each) so viewers can scan and jump back cleanly.
|
|
718
|
+
- CHAPTER_TITLE_GENERIC (info): two or more chapters in a linear work use bare placeholder titles ('Intro', 'Principles', 'Summary', or equivalent bare placeholders). Name each chapter after its concrete question, outcome, or stage.
|
|
700
719
|
- 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.
|
|
701
720
|
- 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. This applies only to feature review; standalone explainers use work()/chapter() and have no cases.
|
|
702
721
|
- ROLE_UNKNOWN: A layer, card or say() role is not in the work or feature roles. Declare roles as { key: role('Name') }; see demo.
|
|
@@ -713,7 +732,7 @@ Example: features/invite/works/a.tsx:12:5 warning UNBOUND_INTERACTIVE Interac
|
|
|
713
732
|
- FROM_UNKNOWN / FROM_CYCLE / FROM_FAILED: from must name another scenario key in the same work, the dependency must not loop, and the preceding scenario must replay successfully. Fix that scenario first.
|
|
714
733
|
- FROM_WITH_START: from already determines the starting route; remove start or start a separate story.
|
|
715
734
|
- LAYER_UNKNOWN: Invalid layer key, missing content, or flow('Slice title', { layer }) names no declared layer. Use letters/digits/underscores/hyphens, do not start with @, and provide nonempty JSX.
|
|
716
|
-
-
|
|
735
|
+
- In opt-in auto-layout diagrams, every node belongs to a domain group (2–6 groups; one group around everything reports PLUGIN_UNGROUPED). For curated 3–14 node architectures, prefer intentional manual composition and explicit connectors (see npx joplo skill diagram).
|
|
717
736
|
Read the relevant installed plugin skill for the visual component, its props and recovery rules.
|
|
718
737
|
- Node kind: client, service, model, database, queue, storage, external, tool, user. description says the responsibility in a few words; edge label says what flows.
|
|
719
738
|
Read the relevant installed plugin skill for the visual component, its props and recovery rules.
|
|
@@ -723,7 +742,7 @@ Read the relevant installed plugin skill for the visual component, its props and
|
|
|
723
742
|
- PLUGIN_EDGE_INTO_OWN_GROUP: An edge connects an element to a group that contains it. Connect to an element inside, or to another group.
|
|
724
743
|
Read the relevant installed plugin skill for the visual component, its props and recovery rules.
|
|
725
744
|
Read the relevant installed plugin skill for the visual component, its props and recovery rules.
|
|
726
|
-
- PLUGIN_LAYOUT_FAILED (warning):
|
|
745
|
+
- PLUGIN_LAYOUT_FAILED (warning): An opt-in automatic layout failed and fell back to a simple grid. Check its edges and groups, or switch to intentional manual composition.
|
|
727
746
|
- 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.
|
|
728
747
|
- ELEMENT_PROP: A component prop contains JSX. Use strings for icons, such as leftSection="+", and children for content.
|
|
729
748
|
- ASSUMPTION_CONFIRMED: Keep AI assumptions \`pending\`. After user confirmation, record the actual origin; do not change only status.
|
|
@@ -799,6 +818,7 @@ A successful initial compilation registers local review rounds before dev return
|
|
|
799
818
|
- Source changes close the old round (closed, source_changed) and start a new one after compilation. The follower moves on by itself; an exact-session watch exits 1, never 0, and you list again to select the new session. A stopped process without an approval also fails.
|
|
800
819
|
- Records live under the real project path in .joplo/reviews/ and remain local. Distinct instances and worktrees never share session identities. Local feedback is never uploaded automatically.
|
|
801
820
|
- Scripted writes use the same running-board API and revision checks: npx joplo feedback submit [dir] --local --work <qualified-id> --scenario <id> --position <n> --body <text>, and npx joplo feedback approve [dir] --local [--session <id>]. Supply an explicit reviewed position; the CLI does not know or pretend to control the reviewer's browser. --scene is optional, --request-id <uuid> makes retries idempotent, and approval never edits pick or publishes.
|
|
821
|
+
- Feedback receipts and jump-to-step re-review: after editing source for local feedback (which closes the old round with source_changed and opens a new round), record how each item was handled in the current open round: npx joplo feedback reply [dir] --local --event <rv_...:seq> --status <addressed|deferred|declined> [--scenario <id> --position <n>] [--note <text>] [--request-id <uuid>]. Omitting --work/--session infers the work from --event and targets its active round; --scenario and --position must be passed together when targeting a step. The board shows receipts (and unaddressed previous-round items) in the native review popover with a direct jump button to that step (pausing on arrival for quick verification). Receipts never wake --follow --once and never preserve approvals across source changes.
|
|
802
822
|
- Manage the board without simulating playback: board projects/add/remove, board appearance [dir], and board open [dir] --at <file:line[:column]>. Remove deletes only the registry entry, never project files; non-interactive removal requires --yes. Fullscreen, playback, clicks and drags remain native browser interactions.
|
|
803
823
|
|
|
804
824
|
## Before a video-like piece goes to reviewers
|
|
@@ -898,7 +918,7 @@ The bundle has root index.html, before/, after/ and feature-diff.json. Only publ
|
|
|
898
918
|
`,
|
|
899
919
|
publish: `# Joplo publishing: publish
|
|
900
920
|
|
|
901
|
-
|
|
921
|
+
Review cases and options in the board, then decide which option to publish for each feature.
|
|
902
922
|
|
|
903
923
|
## Standalone works and feature pick
|
|
904
924
|
- Standalone works in works/ publish without pick. Empty works stay local until they have a slice (WORK_EMPTY); explicit selection fails. draft: true excludes the whole work, its slices and views from both ordinary and review versions; WORK_DRAFT_SKIPPED lists what was skipped. Only drafts means nothing can publish: finish a work first.
|
|
@@ -1062,7 +1082,7 @@ The engine supplies authoring, compilation, state, scheduling and host services.
|
|
|
1062
1082
|
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.
|
|
1063
1083
|
|
|
1064
1084
|
## Optional 3D
|
|
1065
|
-
The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.8.
|
|
1085
|
+
The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.8.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.
|
|
1066
1086
|
|
|
1067
1087
|
## Errors and trust
|
|
1068
1088
|
- 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/local-review.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ export declare const LOCAL_REVIEW_MAX_BODY = 10000;
|
|
|
5
5
|
export declare const LOCAL_REVIEW_MAX_EVENTS = 1000;
|
|
6
6
|
export declare const LOCAL_REVIEW_MAX_FILE_BYTES: number;
|
|
7
7
|
export declare const LocalReviewId: z.ZodString;
|
|
8
|
+
export declare const LocalReviewEventId: z.ZodString;
|
|
9
|
+
export declare const LocalReviewReceiptStatus: z.ZodEnum<{
|
|
10
|
+
addressed: "addressed";
|
|
11
|
+
deferred: "deferred";
|
|
12
|
+
declined: "declined";
|
|
13
|
+
}>;
|
|
14
|
+
export type LocalReviewReceiptStatus = z.infer<typeof LocalReviewReceiptStatus>;
|
|
8
15
|
export declare const LocalReviewLocation: z.ZodObject<{
|
|
9
16
|
scenarioId: z.ZodNullable<z.ZodString>;
|
|
10
17
|
position: z.ZodNumber;
|
|
@@ -39,6 +46,30 @@ export declare const LocalReviewEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
39
46
|
seq: z.ZodNumber;
|
|
40
47
|
requestId: z.ZodString;
|
|
41
48
|
createdAt: z.ZodISODateTime;
|
|
49
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"receipt">;
|
|
51
|
+
targetEventId: z.ZodString;
|
|
52
|
+
targetBody: z.ZodString;
|
|
53
|
+
status: z.ZodEnum<{
|
|
54
|
+
addressed: "addressed";
|
|
55
|
+
deferred: "deferred";
|
|
56
|
+
declined: "declined";
|
|
57
|
+
}>;
|
|
58
|
+
note: z.ZodNullable<z.ZodString>;
|
|
59
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
60
|
+
scenarioId: z.ZodNullable<z.ZodString>;
|
|
61
|
+
position: z.ZodNumber;
|
|
62
|
+
sceneId: z.ZodString;
|
|
63
|
+
route: z.ZodString;
|
|
64
|
+
stepId: z.ZodNullable<z.ZodString>;
|
|
65
|
+
source: z.ZodNullable<z.ZodString>;
|
|
66
|
+
pageTitle: z.ZodString;
|
|
67
|
+
scenarioName: z.ZodNullable<z.ZodString>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
69
|
+
sessionId: z.ZodString;
|
|
70
|
+
seq: z.ZodNumber;
|
|
71
|
+
requestId: z.ZodString;
|
|
72
|
+
createdAt: z.ZodISODateTime;
|
|
42
73
|
}, z.core.$strict>, z.ZodObject<{
|
|
43
74
|
type: z.ZodLiteral<"approved">;
|
|
44
75
|
sessionId: z.ZodString;
|
|
@@ -91,6 +122,30 @@ export declare const LocalReviewSession: z.ZodObject<{
|
|
|
91
122
|
seq: z.ZodNumber;
|
|
92
123
|
requestId: z.ZodString;
|
|
93
124
|
createdAt: z.ZodISODateTime;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"receipt">;
|
|
127
|
+
targetEventId: z.ZodString;
|
|
128
|
+
targetBody: z.ZodString;
|
|
129
|
+
status: z.ZodEnum<{
|
|
130
|
+
addressed: "addressed";
|
|
131
|
+
deferred: "deferred";
|
|
132
|
+
declined: "declined";
|
|
133
|
+
}>;
|
|
134
|
+
note: z.ZodNullable<z.ZodString>;
|
|
135
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
136
|
+
scenarioId: z.ZodNullable<z.ZodString>;
|
|
137
|
+
position: z.ZodNumber;
|
|
138
|
+
sceneId: z.ZodString;
|
|
139
|
+
route: z.ZodString;
|
|
140
|
+
stepId: z.ZodNullable<z.ZodString>;
|
|
141
|
+
source: z.ZodNullable<z.ZodString>;
|
|
142
|
+
pageTitle: z.ZodString;
|
|
143
|
+
scenarioName: z.ZodNullable<z.ZodString>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
sessionId: z.ZodString;
|
|
146
|
+
seq: z.ZodNumber;
|
|
147
|
+
requestId: z.ZodString;
|
|
148
|
+
createdAt: z.ZodISODateTime;
|
|
94
149
|
}, z.core.$strict>, z.ZodObject<{
|
|
95
150
|
type: z.ZodLiteral<"approved">;
|
|
96
151
|
sessionId: z.ZodString;
|
|
@@ -122,6 +177,22 @@ export declare const LocalReviewWrite: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
122
177
|
position: z.ZodNumber;
|
|
123
178
|
sceneId: z.ZodString;
|
|
124
179
|
}, z.core.$strict>;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
sessionId: z.ZodString;
|
|
182
|
+
requestId: z.ZodString;
|
|
183
|
+
type: z.ZodLiteral<"receipt">;
|
|
184
|
+
targetEventId: z.ZodString;
|
|
185
|
+
status: z.ZodEnum<{
|
|
186
|
+
addressed: "addressed";
|
|
187
|
+
deferred: "deferred";
|
|
188
|
+
declined: "declined";
|
|
189
|
+
}>;
|
|
190
|
+
note: z.ZodOptional<z.ZodString>;
|
|
191
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
scenarioId: z.ZodNullable<z.ZodString>;
|
|
193
|
+
position: z.ZodNumber;
|
|
194
|
+
sceneId: z.ZodString;
|
|
195
|
+
}, z.core.$strict>>;
|
|
125
196
|
}, z.core.$strict>, z.ZodObject<{
|
|
126
197
|
sessionId: z.ZodString;
|
|
127
198
|
requestId: z.ZodString;
|
|
@@ -131,5 +202,13 @@ export type LocalReviewWrite = z.infer<typeof LocalReviewWrite>;
|
|
|
131
202
|
export type LocalReviewState = {
|
|
132
203
|
session: LocalReviewSession;
|
|
133
204
|
watchers: number;
|
|
205
|
+
previousFeedback?: Array<{
|
|
206
|
+
eventId: string;
|
|
207
|
+
sessionId: string;
|
|
208
|
+
seq: number;
|
|
209
|
+
body: string;
|
|
210
|
+
createdAt: string;
|
|
211
|
+
context: LocalReviewContext;
|
|
212
|
+
}>;
|
|
134
213
|
};
|
|
135
214
|
export declare function localReviewStatus(session: LocalReviewSession): 'open' | 'approved' | 'closed';
|
package/dist/local-review.js
CHANGED
|
@@ -5,6 +5,8 @@ export const LOCAL_REVIEW_MAX_BODY = 10_000;
|
|
|
5
5
|
export const LOCAL_REVIEW_MAX_EVENTS = 1000;
|
|
6
6
|
export const LOCAL_REVIEW_MAX_FILE_BYTES = 16 * 1024 * 1024;
|
|
7
7
|
export const LocalReviewId = z.string().regex(/^rv_[a-f0-9]{32}$/);
|
|
8
|
+
export const LocalReviewEventId = z.string().regex(/^rv_[a-f0-9]{32}:[1-9]\d*$/);
|
|
9
|
+
export const LocalReviewReceiptStatus = z.enum(['addressed', 'deferred', 'declined']);
|
|
8
10
|
const ref = z.string().min(1).max(300);
|
|
9
11
|
export const LocalReviewLocation = z.strictObject({
|
|
10
12
|
scenarioId: ref.nullable(),
|
|
@@ -26,6 +28,7 @@ const eventBase = {
|
|
|
26
28
|
};
|
|
27
29
|
export const LocalReviewEvent = z.discriminatedUnion('type', [
|
|
28
30
|
z.strictObject({ ...eventBase, type: z.literal('feedback'), body: z.string().trim().min(1).max(LOCAL_REVIEW_MAX_BODY), context: LocalReviewContext }),
|
|
31
|
+
z.strictObject({ ...eventBase, type: z.literal('receipt'), targetEventId: LocalReviewEventId, targetBody: z.string().trim().min(1).max(LOCAL_REVIEW_MAX_BODY), status: LocalReviewReceiptStatus, note: z.string().trim().max(LOCAL_REVIEW_MAX_BODY).nullable(), target: LocalReviewContext.nullable() }),
|
|
29
32
|
z.strictObject({ ...eventBase, type: z.literal('approved') }),
|
|
30
33
|
z.strictObject({ ...eventBase, type: z.literal('closed'), reason: z.enum(['source_changed', 'compile_error', 'work_removed', 'server_stopped']) }),
|
|
31
34
|
]);
|
|
@@ -48,13 +51,14 @@ export const LocalReviewSession = z.strictObject({
|
|
|
48
51
|
}).superRefine((s, ctx) => {
|
|
49
52
|
const requests = new Set();
|
|
50
53
|
s.events.forEach((e, i) => {
|
|
51
|
-
if (e.sessionId !== s.id || e.seq !== i + 1 || requests.has(e.requestId) || (e.type
|
|
54
|
+
if (e.sessionId !== s.id || e.seq !== i + 1 || requests.has(e.requestId) || ((e.type === 'approved' || e.type === 'closed') && i !== s.events.length - 1))
|
|
52
55
|
ctx.addIssue({ code: 'custom', message: 'Invalid review event order, session, or request id', path: ['events', i] });
|
|
53
56
|
requests.add(e.requestId);
|
|
54
57
|
});
|
|
55
58
|
});
|
|
56
59
|
export const LocalReviewWrite = z.discriminatedUnion('type', [
|
|
57
60
|
z.strictObject({ sessionId: LocalReviewId, requestId: z.string().uuid(), type: z.literal('feedback'), body: z.string().trim().min(1).max(LOCAL_REVIEW_MAX_BODY), context: LocalReviewLocation }),
|
|
61
|
+
z.strictObject({ sessionId: LocalReviewId, requestId: z.string().uuid(), type: z.literal('receipt'), targetEventId: LocalReviewEventId, status: LocalReviewReceiptStatus, note: z.string().trim().max(LOCAL_REVIEW_MAX_BODY).optional(), target: LocalReviewLocation.optional() }),
|
|
58
62
|
z.strictObject({ sessionId: LocalReviewId, requestId: z.string().uuid(), type: z.literal('approved') }),
|
|
59
63
|
]);
|
|
60
64
|
export function localReviewStatus(session) {
|
package/dist/validate.js
CHANGED
|
@@ -3,7 +3,9 @@ import { pluginSpec } from "./catalog.js";
|
|
|
3
3
|
import { entryOf, playSequence, scenariosOf } from "./entries.js";
|
|
4
4
|
import { featuresOf } from "./features.js";
|
|
5
5
|
import { Project } from "./schema.js";
|
|
6
|
-
import { CAPTION_MAX, CARD_POINTS_MAX, DESCRIPTION_MAX, EXPLAIN_MAX,
|
|
6
|
+
import { CAPTION_MAX, CARD_POINTS_MAX, DESCRIPTION_MAX, EXPLAIN_MAX, isInteractiveType, SCENARIO_MS_MAX, captionLength } from "./catalog.js";
|
|
7
|
+
import { LATIN_MS_PER_CHAR, MS_PER_CHAR, voiceMs } from "./pace.js";
|
|
8
|
+
import { narrationText } from "./voice.js";
|
|
7
9
|
import { scenarioEstimateMs } from "./outline.js";
|
|
8
10
|
import { walkNodes, findNode, replay } from "./player.js";
|
|
9
11
|
import { JoploError } from "./result.js";
|
|
@@ -79,6 +81,16 @@ export function validate(project, opts = { mode: 'all' }) {
|
|
|
79
81
|
const value = { ...o, workId: o.id };
|
|
80
82
|
if (o.featureId)
|
|
81
83
|
ref(p.features[o.featureId]?.workIds.includes(o.id), `Work feature does not exist or does not list the work: ${o.featureId}`, value, 'work');
|
|
84
|
+
if (!o.featureId && o.sequencing === 'linear') {
|
|
85
|
+
const chapters = playSequence(p, o.id);
|
|
86
|
+
const workRef = { kind: 'work', id: o.id, workId: o.id };
|
|
87
|
+
const ms = chapters.reduce((sum, sc) => sum + scenarioEstimateMs(p, sc), 0);
|
|
88
|
+
if (!o.draft && ms >= 120_000 && chapters.length < 3)
|
|
89
|
+
emit('info', 'CHAPTERS_TOO_FEW', `Work "${o.title}" plays about ${Math.round(ms / 1000)} s at 1× with ${chapters.length} mainline chapters. Split it into 3–6 chapters of 25–60 s each, so first-time viewers can follow and returning viewers can find a section`, o.source, workRef);
|
|
90
|
+
const generic = chapters.filter(sc => genericChapterTitle(sc.name));
|
|
91
|
+
if (chapters.length >= 2 && generic.length >= 2)
|
|
92
|
+
emit('info', 'CHAPTER_TITLE_GENERIC', `Work "${o.title}" has generic mainline chapter titles: ${generic.map(sc => `"${sc.name}"`).join(', ')}. Name the specific subject and takeaway, for example "Overview" -> "How the ledger blocks duplicate charges", "Summary" -> "Trade-offs of dedup"`, o.source, workRef);
|
|
93
|
+
}
|
|
82
94
|
const cases = Object.values(p.cases).filter(c => c.featureId === o.featureId);
|
|
83
95
|
for (const c of cases)
|
|
84
96
|
if (!(o.featureId ? p.features[o.featureId]?.alternatives[o.id]?.coverage ?? {} : {})[c.id])
|
|
@@ -196,8 +208,9 @@ export function validate(project, opts = { mode: 'all' }) {
|
|
|
196
208
|
if (ms > SCENARIO_MS_MAX)
|
|
197
209
|
emit('info', 'SCENARIO_TOO_LONG', `${chapter ?? 'Scenario'} "${sc.name}" plays about ${Math.round(ms / 1000)} s at 1× (${sc.steps.length} steps; recommended maximum: ${SCENARIO_MS_MAX / 1000} s). ${chapter ? 'One chapter tells one thing: split it into chapters' : 'One scenario tells one thing: split it into scenarios (for example the happy path and each recovery)'}, or branch with fork(); run npx joplo outline to see the pacing`, sc.source, sr);
|
|
198
210
|
for (const st of sc.steps) {
|
|
211
|
+
const timing = stepPlan(p, st);
|
|
212
|
+
const measuredVoiceMs = st.holdFor && (st.holdFor.kind === 'voice' || st.holdFor.audio === st.audio) ? st.holdFor.durationMs : undefined;
|
|
199
213
|
if (st.holdFor) {
|
|
200
|
-
const timing = stepPlan(p, st);
|
|
201
214
|
emit('info', timing.timingSource === 'measured' ? 'AUDIO_TIMING_MEASURED' : 'AUDIO_TIMING_ESTIMATED', `${st.id}: ${timing.timingSource} ${st.holdFor.kind} timing, ${((timing.audioMs ?? 0) / 1000).toFixed(3)} s including ${(st.holdFor.padMs / 1000).toFixed(3)} s pad; no audio is generated by check`, st.source, sr);
|
|
202
215
|
}
|
|
203
216
|
const value = { ...st, workId: sc.workId };
|
|
@@ -215,7 +228,11 @@ export function validate(project, opts = { mode: 'all' }) {
|
|
|
215
228
|
const at = st.source ?? sc.source;
|
|
216
229
|
const cl = captionLength(st.caption);
|
|
217
230
|
if (cl > CAPTION_MAX)
|
|
218
|
-
emit('warning', 'CAPTION_TOO_LONG', `Caption length is ${cl} units (recommended maximum: ${CAPTION_MAX}; CJK characters count as 1 each, all others as 0.5; whitespace is not counted): "${st.caption}".
|
|
231
|
+
emit('warning', 'CAPTION_TOO_LONG', `Caption length is ${cl} units (recommended maximum: ${CAPTION_MAX}; CJK characters count as 1 each, all others as 0.5; whitespace is not counted): "${st.caption}". This is the top-left step title, also used as the fallback subtitle when narrate()/say() is absent. Keep it to one point; move details to a separate explanation layer, for example layers: { why: layer('Design rationale', <Why />) }, then use shot('why_xxx') in this step to present it`, at, r);
|
|
232
|
+
const readingMs = readingDemandMs(st);
|
|
233
|
+
const visibleMs = Math.max(timing.dwellMs, timing.voiceMs);
|
|
234
|
+
if (readingMs > visibleMs + 1500)
|
|
235
|
+
emit('info', 'READING_BUDGET_SHORT', `Visible text needs about ${(readingMs / 1000).toFixed(1)} s to read, but this step is visible for about ${(visibleMs / 1000).toFixed(1)} s at 1×. Shorten the text, split the step, or add hold() to allow reading time`, at, r);
|
|
219
236
|
if (st.action.type === 'card') {
|
|
220
237
|
const sub = st.action.sub ? captionLength(st.action.sub) : 0;
|
|
221
238
|
const points = st.action.points ?? [];
|
|
@@ -233,11 +250,12 @@ export function validate(project, opts = { mode: 'all' }) {
|
|
|
233
250
|
if (el > EXPLAIN_MAX)
|
|
234
251
|
emit('warning', 'EXPLAIN_TOO_LONG', `explain note length is ${el} units (recommended maximum: ${EXPLAIN_MAX}; CJK characters count as 1 each, all others as 0.5; whitespace is not counted). Move long content to a separate explanation layer, for example layers: { why: layer('Design rationale', <Why />) }, then switch to it with shot`, at, r);
|
|
235
252
|
}
|
|
236
|
-
//
|
|
253
|
+
// 朗读预算按时长判断;已绑定的实长只属于当前朗读的那条文本,不含作者额外留的 pad。
|
|
237
254
|
for (const [fn, code, text] of [['say', 'SAY_TOO_LONG', st.say], ['narrate', 'NARRATE_TOO_LONG', st.narrate]]) {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
255
|
+
const measured = (fn === 'narrate' ? !!st.narrate : !st.narrate) ? measuredVoiceMs : undefined;
|
|
256
|
+
const ms = measured ?? voiceMs(text);
|
|
257
|
+
if (text && ms > 10_000)
|
|
258
|
+
emit('warning', code, `${fn}() is ${measured === undefined ? 'estimated' : 'measured'} at ~${(ms / 1000).toFixed(1)} s (recommended: ≤ 10 s). Autoplay waits until it is read, so say less or split the step`, at, r);
|
|
241
259
|
}
|
|
242
260
|
}
|
|
243
261
|
}
|
|
@@ -264,6 +282,29 @@ export function validate(project, opts = { mode: 'all' }) {
|
|
|
264
282
|
}
|
|
265
283
|
return report();
|
|
266
284
|
}
|
|
285
|
+
/** 阅读不足只作创作提示:沿用阅读速率,但不把需求封顶为播放器的 7 秒。 */
|
|
286
|
+
function readingDemandMs(step) {
|
|
287
|
+
const texts = step.action.type === 'card'
|
|
288
|
+
? [step.action.title, step.action.sub, ...(step.action.points ?? [])]
|
|
289
|
+
: [...new Set([step.caption, step.explain, narrationText(step, step.caption)].map(text => text?.trim()))];
|
|
290
|
+
let ms = 0;
|
|
291
|
+
for (const text of texts)
|
|
292
|
+
if (text)
|
|
293
|
+
for (const ch of text) {
|
|
294
|
+
if (/\s/.test(ch))
|
|
295
|
+
continue;
|
|
296
|
+
ms += (ch.codePointAt(0) ?? 0) > 0x2e80 ? MS_PER_CHAR : LATIN_MS_PER_CHAR;
|
|
297
|
+
}
|
|
298
|
+
return ms;
|
|
299
|
+
}
|
|
300
|
+
const GENERIC_CHAPTER_TITLES = new Set([
|
|
301
|
+
'\u7b80\u4ecb', '\u539f\u7406', '\u603b\u7ed3', '\u6982\u8ff0', '\u80cc\u666f', '\u5f15\u8a00', '\u7ed3\u8bed',
|
|
302
|
+
'intro', 'introduction', 'overview', 'summary', 'conclusion',
|
|
303
|
+
]);
|
|
304
|
+
function genericChapterTitle(title) {
|
|
305
|
+
const name = title.trim().replace(/^(?:\u7b2c\s*(?:\d+|[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u96f6\u3007\u4e24]+)\s*\u7ae0|\d+)[\s.\uff0e\u3001:\uff1a)\uff09/\uff0f\u2013\u2014-]*/u, '').trim().toLowerCase();
|
|
306
|
+
return GENERIC_CHAPTER_TITLES.has(name);
|
|
307
|
+
}
|
|
267
308
|
/** CASE_NOT_COVERED 的补充:高优先级与期望结果(PM 的 Then),帮 Agent 知道该补什么场景。 */
|
|
268
309
|
function caseHint(c) {
|
|
269
310
|
if (!c)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joplo-app/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
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.8.
|
|
38
|
+
"@joplo-app/kit": "0.8.2",
|
|
39
39
|
"zod": "4.6.7"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|