@joplo-app/core 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-skill.d.ts +1 -1
- package/dist/agent-skill.js +6 -3
- package/dist/compile.js +94 -19
- package/dist/guide.js +48 -15
- package/package.json +2 -2
package/dist/agent-skill.d.ts
CHANGED
|
@@ -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
|
|
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 = {
|
|
51
51
|
name: string;
|
|
52
52
|
description: string;
|
package/dist/agent-skill.js
CHANGED
|
@@ -52,7 +52,8 @@ export const PITFALLS = [
|
|
|
52
52
|
["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"],
|
|
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
|
-
["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward
|
|
55
|
+
["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"],
|
|
56
|
+
["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"],
|
|
56
57
|
["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"],
|
|
57
58
|
["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"],
|
|
58
59
|
["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"],
|
|
@@ -179,14 +180,16 @@ function feedbackBody() {
|
|
|
179
180
|
'```',
|
|
180
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.',
|
|
181
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
|
+
'- 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.',
|
|
182
184
|
'',
|
|
183
|
-
'## Share review: poll
|
|
185
|
+
'## Share review: poll with a recoverable cursor',
|
|
184
186
|
'```sh',
|
|
185
187
|
'npx joplo feedback watch --share <share-id> --work <feature.option> --interval 15 --json',
|
|
186
188
|
'```',
|
|
187
189
|
'- Polling defaults to 15 seconds; --interval accepts 10–30. Pin --version <n> when the version is known; otherwise the first response sets it.',
|
|
188
190
|
'- Only the target version\'s owner pick ends this watcher. Votes, rule confirmations, other options, and older versions do not. A replaced share version emits closed and exits 1.',
|
|
189
|
-
'- Cloud returns
|
|
191
|
+
'- Cursor-capable Cloud returns persistent event pages. The CLI drains them before judging approval, so resolved comments and applied decisions are recovered and retracted picks do not approve. Each event carries cursor; resume with --cursor <last fully handled cursor> and deduplicate by eventId. Older Cloud falls back to snapshots and warns that resolved/applied records may be missed. Cloud never confirms a local session.',
|
|
192
|
+
'- Cloud writes need feedback:write: feedback comment/resolve, decide/retract, and vote (not approval). Always preserve expectedVersion; comments/votes also need the /review/<id> link id. On 409 reread instead of replaying blindly.',
|
|
190
193
|
'- To apply existing Cloud conclusions without watching, use npx joplo feedback --format json. It selects the review share from .joplo/cloud.json, else the main share; --share <id> selects another, including scoped shares. data.decisions and data.comments are separate.',
|
|
191
194
|
'',
|
|
192
195
|
'## Apply conclusions when requested',
|
package/dist/compile.js
CHANGED
|
@@ -379,6 +379,10 @@ export function compile(src, mode, opts = {}) {
|
|
|
379
379
|
const viewScenes = hasLayers ? layerScenes.map(l => l.scene) : [...ctxRoutes].map(path => sceneFor.get(sceneOf(path))).filter((x) => !!x);
|
|
380
380
|
/** 某一步(所在路径 route)点到的元素自带的 onClick。 */
|
|
381
381
|
const eventOf = (route, target) => hasLayers ? sceneEvents.get(layerSceneWith(target)?.id ?? '')?.get(target) : sceneEvents.get(sceneOf(route))?.get(target);
|
|
382
|
+
/** 写法 v2 第二步:这件作品用到的模拟请求(按名字),以及剧本实际演到的结果(name:outcome)。 */
|
|
383
|
+
const mocks = new Map();
|
|
384
|
+
const usedOutcomes = new Set();
|
|
385
|
+
const registerMock = (m, at) => registerMockIn(mocks, m, at, err);
|
|
382
386
|
const scenarioIds = {};
|
|
383
387
|
// flow({ from }) 接力:按依赖顺序编译,被接的场景先编译,记下它结尾的路径与导演层;
|
|
384
388
|
// 接力场景的逐步校验(页面里找目标、焦点提示、镜头、自动字幕)都从那里开始,而不是默认起点
|
|
@@ -413,7 +417,7 @@ export function compile(src, mode, opts = {}) {
|
|
|
413
417
|
continue;
|
|
414
418
|
}
|
|
415
419
|
// 写法 v2:点击步骤先执行被点元素的 onClick,再执行步骤自己写的效果。页面跟踪(go / back)看得到合并后的效果。
|
|
416
|
-
const fl = Object.assign(Object.create(Object.getPrototypeOf(authored)), authored, { steps:
|
|
420
|
+
const fl = Object.assign(Object.create(Object.getPrototypeOf(authored)), authored, { steps: expandSteps(authored, start, { eventOf, warn, err, registerMock, usedOutcomes }) });
|
|
417
421
|
for (const c of fl.opts.cases ?? []) {
|
|
418
422
|
if (!fdef?.cases?.[c])
|
|
419
423
|
err('UNKNOWN_CASE', `Scenario ${sid} covers case "${c}", which is not in feature.cases`, fl.source);
|
|
@@ -540,11 +544,11 @@ export function compile(src, mode, opts = {}) {
|
|
|
540
544
|
for (const scene of viewScenes)
|
|
541
545
|
for (const [target, ev] of sceneEvents.get(scene.id) ?? []) {
|
|
542
546
|
const effects = [];
|
|
543
|
-
|
|
547
|
+
const local = (e, at) => {
|
|
544
548
|
if (e.type === 'go') {
|
|
545
549
|
if (!ctxRoutes.has(e.route)) {
|
|
546
|
-
err('UNKNOWN_ROUTE', `
|
|
547
|
-
|
|
550
|
+
err('UNKNOWN_ROUTE', `go("${e.route}") reached by clicking ${target} navigates to an unknown route`, at);
|
|
551
|
+
return;
|
|
548
552
|
}
|
|
549
553
|
effects.push({ type: 'navigate', sceneId: sceneOf(e.route) });
|
|
550
554
|
}
|
|
@@ -552,6 +556,16 @@ export function compile(src, mode, opts = {}) {
|
|
|
552
556
|
effects.push({ type: e.type, path: e.path, value: e.value });
|
|
553
557
|
else if (e.type === 'toast')
|
|
554
558
|
effects.push({ type: 'toast', text: e.text, tone: e.tone });
|
|
559
|
+
};
|
|
560
|
+
for (const e of ev.effects) {
|
|
561
|
+
// 观众接管时,模拟请求用第一个结果;只取本地效果(完成、旁白、镜头属于剧本)
|
|
562
|
+
if (e.type === 'call') {
|
|
563
|
+
if (registerMock(e.mock, ev.at))
|
|
564
|
+
for (const r of Object.values(e.mock.outcomes)[0].effects)
|
|
565
|
+
local(r, Object.values(e.mock.outcomes)[0].source ?? ev.at);
|
|
566
|
+
}
|
|
567
|
+
else
|
|
568
|
+
local(e, ev.at);
|
|
555
569
|
}
|
|
556
570
|
const parsed = effects.map(e => Effect.safeParse(e));
|
|
557
571
|
if (parsed.some(r => !r.success)) {
|
|
@@ -577,6 +591,10 @@ export function compile(src, mode, opts = {}) {
|
|
|
577
591
|
free[key] = { action: { type: 'click', target }, effects: parsed.map(r => r.data), ...(ev.at && rel(ev.at) ? { source: rel(ev.at) } : {}) };
|
|
578
592
|
}
|
|
579
593
|
}
|
|
594
|
+
for (const m of mocks.values())
|
|
595
|
+
for (const [k, r] of Object.entries(m.outcomes))
|
|
596
|
+
if (!usedOutcomes.has(`${m.name}:${k}`))
|
|
597
|
+
warn('MOCK_OUTCOME_UNUSED', `Outcome ${k} of mock ${m.name} is not shown by any slice of work ${qid}; add a slice that picks it with flow(…, { api: { ${m.name}: ['${k}'] } }), or delete the outcome`, r.source ?? m.source);
|
|
580
598
|
if (fdef)
|
|
581
599
|
out.features[fid].alternatives[qid] = { decisionFocus: strip ? '' : def.focus ?? '', tradeoffs: strip ? [] : def.tradeoffs ?? [], coverage };
|
|
582
600
|
out.works[qid] = {
|
|
@@ -1127,7 +1145,7 @@ function tagFrom(n, from) {
|
|
|
1127
1145
|
return { ...n, props: { ...n.props, __from: from } };
|
|
1128
1146
|
}
|
|
1129
1147
|
/** 元素事件里允许的效果:会改变画面状态的本地效果,加上规则关联。完成、镜头、朗读、插件效果属于剧本步骤。 */
|
|
1130
|
-
const EVENT_EFFECTS = new Set(['set', 'append', 'toast', 'go', 'uses']);
|
|
1148
|
+
const EVENT_EFFECTS = new Set(['set', 'append', 'toast', 'go', 'uses', 'call']);
|
|
1131
1149
|
/** onClick={effect} 或 onClick={[effect, [effect]]};不是效果时返回 null。 */
|
|
1132
1150
|
function eventEffects(v) {
|
|
1133
1151
|
const out = [];
|
|
@@ -1336,32 +1354,89 @@ function stepRouteBefore(steps, i, start) {
|
|
|
1336
1354
|
return route;
|
|
1337
1355
|
}
|
|
1338
1356
|
/**
|
|
1339
|
-
* 写法 v2
|
|
1340
|
-
*
|
|
1357
|
+
* 写法 v2:展开作者写的步骤。
|
|
1358
|
+
* 1. 点击步骤先执行被点元素的 onClick,再执行步骤自己的效果。
|
|
1359
|
+
* 2. 效果里的模拟请求(mock)从这一步取出,在它后面接一个系统步骤:结果按 flow({ api }) 依次取,缺省第一个;每次调用恰好用掉一个。
|
|
1360
|
+
* 路径跟踪与 stepRouteBefore 同一顺序,看得到合并进来的 go() 和结果里的 go()。
|
|
1341
1361
|
*/
|
|
1342
|
-
function
|
|
1362
|
+
function expandSteps(fl, start, c) {
|
|
1363
|
+
const queue = new Map();
|
|
1364
|
+
const api = fl.opts.api;
|
|
1365
|
+
if (api !== undefined) {
|
|
1366
|
+
if (!api || typeof api !== 'object' || Array.isArray(api) || Object.values(api).some(v => !Array.isArray(v) || v.some(x => typeof x !== 'string')))
|
|
1367
|
+
c.err('FLOW_API_INVALID', `flow({ api }) maps a mock name to the outcomes this slice uses in order, for example api: { sendInvite: ['timeout', 'ok'] }; got ${JSON.stringify(api)}`, fl.source);
|
|
1368
|
+
else
|
|
1369
|
+
for (const [k, v] of Object.entries(api))
|
|
1370
|
+
queue.set(k, [...v]);
|
|
1371
|
+
}
|
|
1343
1372
|
let route = start;
|
|
1344
1373
|
const stack = [];
|
|
1345
|
-
|
|
1374
|
+
const out = [];
|
|
1375
|
+
const emit = (st) => {
|
|
1376
|
+
out.push(st);
|
|
1377
|
+
for (const e of st.effects)
|
|
1378
|
+
if (e.type === 'go') {
|
|
1379
|
+
stack.push(route);
|
|
1380
|
+
route = e.route;
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
for (const st of fl.steps) {
|
|
1346
1384
|
if (st.action.type === 'back')
|
|
1347
1385
|
route = stack.pop() ?? route;
|
|
1348
|
-
let
|
|
1386
|
+
let effects = st.effects;
|
|
1349
1387
|
const target = st.action.type === 'click' ? st.action.target : null;
|
|
1350
|
-
const ev = target ? eventOf(route, target) : undefined;
|
|
1388
|
+
const ev = target ? c.eventOf(route, target) : undefined;
|
|
1351
1389
|
if (target && ev) {
|
|
1352
1390
|
const writes = new Set(ev.effects.flatMap(e => e.type === 'set' || e.type === 'append' ? [e.path] : []));
|
|
1353
1391
|
const repeated = st.effects.find((e) => (e.type === 'set' || e.type === 'append') && writes.has(e.path));
|
|
1354
1392
|
if (repeated)
|
|
1355
|
-
warn('STEP_REPEATS_EVENT', `This click on ${target} writes ${repeated.path}, which its onClick already writes; delete the write from the step (onClick runs first, then the step's own effects)`, st.source);
|
|
1356
|
-
|
|
1393
|
+
c.warn('STEP_REPEATS_EVENT', `This click on ${target} writes ${repeated.path}, which its onClick already writes; delete the write from the step (onClick runs first, then the step's own effects)`, st.source);
|
|
1394
|
+
effects = [...ev.effects, ...st.effects];
|
|
1357
1395
|
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1396
|
+
const calls = effects.filter((e) => e.type === 'call');
|
|
1397
|
+
emit(effects === st.effects && !calls.length ? st : { ...st, effects: effects.filter(e => e.type !== 'call') });
|
|
1398
|
+
for (const { mock: m } of calls) {
|
|
1399
|
+
if (!c.registerMock(m, st.source))
|
|
1400
|
+
continue;
|
|
1401
|
+
const q = queue.get(m.name);
|
|
1402
|
+
const pick = q ? q.shift() : Object.keys(m.outcomes)[0];
|
|
1403
|
+
if (pick === undefined) {
|
|
1404
|
+
c.err('MOCK_OUTCOMES_EXHAUSTED', `This step calls ${m.name} again, but flow({ api: { ${m.name}: [...] } }) has no outcome left; list one outcome per call, in order`, st.source);
|
|
1405
|
+
continue;
|
|
1362
1406
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1407
|
+
if (!Object.hasOwn(m.outcomes, pick)) {
|
|
1408
|
+
c.err('MOCK_OUTCOME_UNKNOWN', `${m.name} has no outcome "${pick}" (outcomes: ${Object.keys(m.outcomes).join(', ')})`, fl.source ?? st.source);
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
const r = m.outcomes[pick];
|
|
1412
|
+
c.usedOutcomes.add(`${m.name}:${pick}`);
|
|
1413
|
+
const at = r.source ?? st.source;
|
|
1414
|
+
emit({ kind: 'system', action: { type: 'event', name: r.name }, ...(r.caption ? { caption: r.caption } : {}), effects: [...r.effects], ...(at ? { source: at } : {}) });
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
for (const [name, q] of queue)
|
|
1418
|
+
if (q.length)
|
|
1419
|
+
c.err('MOCK_OUTCOMES_LEFTOVER', `flow({ api: { ${name}: [...] } }) lists ${q.length} more outcome(s) (${q.join(', ')}) than this slice calls ${name}; each call uses exactly one`, fl.source);
|
|
1420
|
+
return out;
|
|
1421
|
+
}
|
|
1422
|
+
const canonicalMock = (m) => JSON.stringify(m.outcomes, (k, v) => (k === 'source' ? undefined : v));
|
|
1423
|
+
/** 登记一件作品里的模拟请求:校验形状;同名但内容不同的两个请求报冲突。 */
|
|
1424
|
+
function registerMockIn(mocks, m, at, err) {
|
|
1425
|
+
const outcomes = m && typeof m.outcomes === 'object' && m.outcomes ? Object.values(m.outcomes) : [];
|
|
1426
|
+
const valid = !!m && typeof m.name === 'string' && /^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(m.name) && outcomes.length > 0
|
|
1427
|
+
&& outcomes.every(r => !!r && r.kind === 'response' && typeof r.name === 'string' && !!r.name.trim() && Array.isArray(r.effects) && !r.effects.some(e => e.type === 'call'));
|
|
1428
|
+
if (!valid) {
|
|
1429
|
+
err('MOCK_INVALID', `mock(${JSON.stringify(m?.name)}, …) needs an id-like name and at least one outcome written as response('Event name', ...effects); a response cannot call another mock`, m?.source ?? at);
|
|
1430
|
+
return false;
|
|
1431
|
+
}
|
|
1432
|
+
const prev = mocks.get(m.name);
|
|
1433
|
+
if (prev && prev !== m && canonicalMock(prev) !== canonicalMock(m)) {
|
|
1434
|
+
err('MOCK_CONFLICT', `Two different mocks are named ${m.name} in this work (other: ${prev.source ?? 'unknown'}); give each request its own name`, m.source ?? at);
|
|
1435
|
+
return false;
|
|
1436
|
+
}
|
|
1437
|
+
if (!prev)
|
|
1438
|
+
mocks.set(m.name, m);
|
|
1439
|
+
return true;
|
|
1365
1440
|
}
|
|
1366
1441
|
/** 元素事件生成的本地反应用 on-<id> 作键;与作者写的 free 键重名时加序号。 */
|
|
1367
1442
|
function eventFreeKey(target, taken) {
|
package/dist/guide.js
CHANGED
|
@@ -178,21 +178,25 @@ Success: check reports 0 errors; outline --work explainer shows the intended sli
|
|
|
178
178
|
For tools reading IR from @joplo-app/core, use entriesOf/entryOf for entries, featuresOf for real features in entryIds order, rolesOf(project, workId) for shared or standalone roles, sliceKey(scenario) for its author key, and visibleRoutes(project) for paths without the internal blank page. Follow scenario.workId and the projection; never split ids to infer ownership.
|
|
179
179
|
|
|
180
180
|
## Engine-only example
|
|
181
|
-
In features/<f>/works/<key>.tsx, buildScreen is project code using the installed plugins' components. It must return enabled elements with ids email, send and result; read those plugin skills for the actual view code.
|
|
181
|
+
In features/<f>/works/<key>.tsx, buildScreen is project code using the installed plugins' components. It must return enabled elements with ids email, send and result, and put the onClick it receives on send; read those plugin skills for the actual view code.
|
|
182
182
|
\`\`\`ts
|
|
183
|
-
import { $, work, flow, page, set, done } from '@joplo-app/kit';
|
|
183
|
+
import { $, work, flow, page, set, done, mock, response } from '@joplo-app/kit';
|
|
184
184
|
import { buildScreen } from './screen';
|
|
185
|
+
// The request and its possible results, written once
|
|
186
|
+
const sendLink = mock('sendLink', {
|
|
187
|
+
accepted: response('Accepted', set($.ui.sending, false), set($.ui.sent, true), done('Link sent')),
|
|
188
|
+
unknown: response('No account', set($.ui.sending, false), set($.ui.error, 'Check the address')),
|
|
189
|
+
});
|
|
185
190
|
export default work({
|
|
186
191
|
title: 'A · Recover access', summary: 'A retry keeps the entered address',
|
|
187
|
-
routes: { '/reset': page({ title: 'Reset password' }, buildScreen()) },
|
|
192
|
+
routes: { '/reset': page({ title: 'Reset password' }, buildScreen({ onSend: [set($.ui.sending, true), sendLink] })) },
|
|
188
193
|
state: { ui: { sending: false, error: '', sent: false } },
|
|
189
194
|
scenarios: {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
.
|
|
195
|
+
// The first send finds no account, the retry is accepted
|
|
196
|
+
retry: flow('Correct an address and retry', { cases: ['unknown_email'], start: '/reset', api: { sendLink: ['unknown', 'accepted'] } })
|
|
197
|
+
.type('email', 'ana@example.invalid').click('send', 'Send the link')
|
|
193
198
|
.type('email', 'ana@example.com', set($.ui.error, ''))
|
|
194
|
-
.click('send',
|
|
195
|
-
.system('Accepted', set($.ui.sending, false), set($.ui.sent, true), done('Link sent')),
|
|
199
|
+
.click('send', 'Send again'),
|
|
196
200
|
},
|
|
197
201
|
});
|
|
198
202
|
\`\`\`
|
|
@@ -200,11 +204,11 @@ Declare both success and recovery cases in the feature. View code belongs to the
|
|
|
200
204
|
|
|
201
205
|
## Steps and effects
|
|
202
206
|
- chapter(name, options) uses the same slice options as flow(); its default predecessor is the previous chapter, with from: null to restart. Use all chapter() or all flow() in one work.
|
|
203
|
-
- flow(name, { cases?, start?, state?, from?, autoplay?, layer?, description?, expected?, mock?, outcome?, actionEntry? }). state overrides work state. description is the cover sentence; expected describes what the viewer should observe.
|
|
207
|
+
- flow(name, { cases?, start?, state?, from?, autoplay?, layer?, description?, expected?, mock?, outcome?, actionEntry?, api? }). The mock option is only the badge label (for example 'Mocked failure'); api picks mock() outcomes (System responses below). state overrides work state. description is the cover sentence; expected describes what the viewer should observe.
|
|
204
208
|
- autoplay: false keeps an optional scenario selectable through a fork, chapter list or deep link, but skips it in sequential published-site playback. Playing that scenario manually stops at its end. Default/true preserves declaration order.
|
|
205
209
|
- from: 'previousKey' continues that scenario's final route, ui/data/inputs and director layer. Validate steps and automatic captions against that ending page; dependency order does not change chapter order. Do not combine from with start. layer overrides the initial director layer.
|
|
206
210
|
- .click(id), .type(id, value), .select(id, value), .toggle(id, boolean), .press(keys), .back(), .drag(id, destination), .hover(id, ms), .scroll(id, destination), .act(pluginAction, id, data). Read demo and the action-owning plugin skill for recognition requirements.
|
|
207
|
-
- .system('event', ...effects) models a response, not a real request. .card() creates a transition. Strings are captions; other arguments are effects. Step arguments and card accept effect arrays.
|
|
211
|
+
- .system('event', ...effects) models a response, not a real request. For the response to something the viewer triggers (send, save, load), write a mock() instead so the viewer gets it after taking over; keep .system() for story events (time passes, another person acts). .card() creates a transition. Strings are captions; other arguments are effects. Step arguments and card accept effect arrays.
|
|
208
212
|
- set(path, value) replaces; push(path, value) appends; patch(path, object) expands to sets (nested objects replace, not deep-merge). go(route) navigates in this work; back returns to the prior route.
|
|
209
213
|
- stream(path, text, { pace? }) writes like set, but during playback the bound text appears character by character (a model answering, speech being transcribed); jumps, screenshots and deep links show the full text. When the new value starts with the old one, only the added characters stream, so write each step's full value (previous text + the new words) rather than juggling separate fragments. pace: 'voice' spreads the new characters over this step's narrate()/say() line, so the words land as they are spoken; the default pace is model-output speed. Only a plain text child bound to the path streams ({$.ui.reply}); stream values are translated like other on-screen text, so keep every language's successive values prefix-consistent.
|
|
210
214
|
- toast(text), toast.success/error/info(text) show an engine message. done(result, outcome?) ends a scenario; outcomes success/failure/cancelled must agree with flow's badge. uses(ruleKey, ...) links rules; it is an effect, not a flow method.
|
|
@@ -220,13 +224,30 @@ id="nav_settings" onClick={go('/settings')}
|
|
|
220
224
|
// the step only says what the viewer does and why
|
|
221
225
|
flow('Invite a teammate').click('btn_invite', 'The admin opens the invite dialog')
|
|
222
226
|
\`\`\`
|
|
223
|
-
- onClick takes one effect or an array: set, push, toast, go and
|
|
227
|
+
- onClick takes one effect or an array: set, push, toast, go, uses and a mock() request. A scripted .click(id) runs the element's onClick first, then the step's own effects. Keep captions, narrate(), say(), camera and focus cues and done() in the steps; the request's result goes in mock().
|
|
224
228
|
- Do not repeat the element's writes in the step (STEP_REPEATS_EVENT). Step effects stay available for what only this moment of the story does.
|
|
225
229
|
- After the viewer pauses, every element with onClick works as a local reaction: go() changes page locally, uses() only links rules. Play, jump, scenario change and reset discard the local layer. A page reached only locally never advances the script; the next step still belongs to the timeline's page.
|
|
226
230
|
- One id has one behavior per work: an id that appears on several pages (a layout nav link) needs the same onClick everywhere (EVENT_CONFLICT). Do not also declare work.free for that click (FREE_EVENT_CONFLICT).
|
|
227
231
|
- Only onClick takes effects for now (EVENT_UNSUPPORTED). Inputs keep value={$.ui.name} and the typed value; put follow-up reactions in the step.
|
|
228
232
|
- Give the controls a viewer will try (cancel, close, back, navigation) an onClick instead of marking them unmodeled; keep unmodeled for what this work deliberately leaves out.
|
|
229
233
|
|
|
234
|
+
## System responses (mock / response)
|
|
235
|
+
Write each request and its possible results once, then let each slice pick the result it shows:
|
|
236
|
+
\`\`\`tsx
|
|
237
|
+
const sendInvite = mock('sendInvite', {
|
|
238
|
+
ok: response('Request succeeded (mock)', 'Sent', set($.ui.sending, false), set($.ui.open, false), done('Invite sent')),
|
|
239
|
+
timeout: response('Request timed out (mock)', 'Input kept', set($.ui.sending, false), set($.ui.error, 'Timeout')),
|
|
240
|
+
});
|
|
241
|
+
// on the element: onClick={[set($.ui.sending, true), sendInvite]}
|
|
242
|
+
success: flow('Send').click('send', 'Send the invite'), // first outcome (ok)
|
|
243
|
+
retry: flow('Retry', { api: { sendInvite: ['timeout', 'ok'] } }).click('send').click('send', 'Retry'),
|
|
244
|
+
\`\`\`
|
|
245
|
+
- response(name, ...args) takes the same arguments as .system(name, ...args): the first string is its caption, the rest are effects, including done(), narrate() and camera.
|
|
246
|
+
- In the script, every call to a mock (in an element's onClick or a step's effects) adds one system step right after that step. flow({ api: { name: [outcomes] } }) uses one outcome per call, in order; a mock the slice does not list uses its first outcome.
|
|
247
|
+
- After the viewer takes over, clicking the element applies the first outcome's local effects (set, push, toast, go) at once; done(), narration and camera stay in the script.
|
|
248
|
+
- The mock name is unique within a work; outcomes are the cases the design must show. Every outcome should appear in some slice (MOCK_OUTCOME_UNUSED).
|
|
249
|
+
- A response cannot call another mock. Use .system() for an event nobody triggers on stage.
|
|
250
|
+
|
|
230
251
|
## Reusable effect factories
|
|
231
252
|
Step arguments and card effects accept nested arrays, flattened in order. Compose helpers that return patch() plus other effects instead of copying transition state. Only done() completes a scenario; unknown effect objects report EFFECT_INVALID.
|
|
232
253
|
\`\`\`ts
|
|
@@ -638,6 +659,13 @@ Example: features/invite/works/a.tsx:12:5 warning UNBOUND_INTERACTIVE Interac
|
|
|
638
659
|
- EVENT_CONFLICT: the same id has different onClick on two stages of one work; give the elements different ids, or make the behavior identical (shared layout links).
|
|
639
660
|
- FREE_EVENT_CONFLICT: a work.free click reaction duplicates an element's onClick; move its effects into onClick and delete the free entry.
|
|
640
661
|
- STEP_REPEATS_EVENT (warning): the step writes a path its target's onClick already writes; delete the write from the step.
|
|
662
|
+
- MOCK_INVALID: mock(name, outcomes) needs an id-like name and at least one response('Event name', ...effects); a response cannot call another mock.
|
|
663
|
+
- MOCK_CONFLICT: two different mocks share one name in a work; give each request its own name, or reuse the same mock object.
|
|
664
|
+
- MOCK_OUTCOME_UNKNOWN: flow({ api }) names an outcome the mock does not have; copy one from the outcomes listed in the message.
|
|
665
|
+
- MOCK_OUTCOMES_EXHAUSTED: the slice calls the mock more times than flow({ api }) lists outcomes; list one outcome per call, in order.
|
|
666
|
+
- MOCK_OUTCOMES_LEFTOVER: flow({ api }) lists more outcomes than the slice calls that mock (or names a mock the slice never calls); remove the extra entries.
|
|
667
|
+
- MOCK_OUTCOME_UNUSED (warning): no slice of the work shows this outcome; add a slice that picks it with flow({ api }), or delete the outcome.
|
|
668
|
+
- FLOW_API_INVALID: flow({ api }) maps mock names to arrays of outcome names, for example api: { sendInvite: ['timeout', 'ok'] }.
|
|
641
669
|
- ACTION_INVALID / ACTION_UNKNOWN / ACTION_DATA_INVALID / ACTION_TARGET_INVALID / ACTION_DESTINATION_MISSING / ACTION_DESTINATION_INVALID / PLUGIN_ACTION_INVALID: check the action shape, enabled plugin declaration, exact payload fields/ranges, allowed target type, and drag/scroll endpoint. Read the plugin skill; keep endpoints in the current stage, then rerun check.
|
|
642
670
|
- UNKNOWN_COMPONENT: Choose a supported name from components; do not invent components.
|
|
643
671
|
- UNKNOWN_PLUGIN / PLUGIN_PARENT / PLUGIN_INVALID / PLUGIN_DUPLICATE / PLUGIN_RUNTIME_MISSING: plugin components need their package in config({ plugins: [...] }) once, written inside the parent named in the message; a missing runtime means reinstall the package (npx joplo skill plugins).
|
|
@@ -770,6 +798,8 @@ A successful initial compilation registers local review rounds before dev return
|
|
|
770
798
|
- approved is a confirmation for that exact option version. An exact-session watch prints it and exits 0; the follower prints it and keeps going. This records the user's review decision, not that feedback has been implemented. Update pick/source only as authorized by the user's task; approval does not authorize publishing.
|
|
771
799
|
- 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.
|
|
772
800
|
- 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
|
+
- 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.
|
|
802
|
+
- 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.
|
|
773
803
|
|
|
774
804
|
## Before a video-like piece goes to reviewers
|
|
775
805
|
Required: run the film strip check from npx joplo skill demo ("Make it play like a film, not slides") — npx joplo render <dir> --scenario-id <first chapter> --film --chain — and fix every unexplained CUT and STILL first. Reviewers judge motion; a storyboard that looks fine can still play like a slide deck. Report the remaining cuts/stills you kept on purpose and what you could not verify (sound, real devices).
|
|
@@ -802,9 +832,10 @@ Never carry an old seq to a new session, delete review records to reset one, or
|
|
|
802
832
|
- npx joplo feedback watch --share <id> --work <feature.option> --json [--interval 15] [--version <n>] [--server <url>]. Requires the owner's login or an API key with feedback:read. The target option is required; public viewing does not make the owner's feedback API anonymous.
|
|
803
833
|
- Poll immediately, then every 15 seconds by default; --interval accepts integer seconds from 10 to 30. Requests are sequential; transient network errors back off up to 30 seconds, and Ctrl+C cancels requests as well as waits.
|
|
804
834
|
- Pin the first returned share version unless --version is given. A replacement version emits closed and exits 1; it never silently switches versions. Only a matching current-version owner pick becomes approved and exits 0; votes, rule confirmations, other options, and older decisions cannot end this watch.
|
|
805
|
-
- source=cloud events share the feedback/approved/decision/closed vocabulary. Deduplicate by eventId (stable across restarts); Cloud has no local seq
|
|
806
|
-
-
|
|
807
|
-
- The existing npx joplo feedback [dir] and --applied commands keep their pull/write-back behavior. Watching never marks decisions applied or copies remote confirmation into local source/session state.
|
|
835
|
+
- source=cloud events share the feedback/approved/decision/closed vocabulary. Deduplicate by eventId (stable across restarts); Cloud has no local seq. Missing route/source data stays null rather than being guessed.
|
|
836
|
+
- Cursor-capable Cloud uses GET /api/v1/shares/{id}/feedback?cursor=<cursor>&limit=200. The CLI drains every page before emitting and judging approval, so resolved comments and applied decisions are still recovered, while a retracted pick never approves. Each event carries cursor and stderr reports Cloud cursor; resume with --cursor <last fully handled cursor>. A failed multi-page batch restarts from its uncommitted cursor. Older Cloud falls back to lossy snapshots and warns that resolved/applied records can disappear between polls.
|
|
837
|
+
- The existing npx joplo feedback [dir] and --applied commands keep their pull/write-back behavior; --applied also accepts --expected-version. Watching never marks decisions applied or copies remote confirmation into local source/session state.
|
|
838
|
+
- Explicit Cloud writes: feedback comment requires share/review-id/version/work/scenario/position/body (step-id after position 0); feedback resolve <comment-id> [--reopen]; feedback decide requires kind/target/expected-version (answer/reject_rule also need note); feedback retract <decision-id>; feedback vote is not approval. These need feedback:write. Comments/votes need the review link id from /review/<id>, not the share id. Decisions/comments carry expectedVersion; on 409 reread rather than blindly replaying.
|
|
808
839
|
|
|
809
840
|
Example, scoped to one known option:
|
|
810
841
|
|
|
@@ -927,11 +958,13 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
|
|
|
927
958
|
- share also uploads a 1200x630 preview image of the default scenario when the export component is installed (npx joplo setup export, or Playwright already in the project); without it, share still succeeds, prints one "Skipped the preview image" line, and never downloads anything.
|
|
928
959
|
- Re-sharing updates the same-server link in .joplo/cloud.json, for free and Pro accounts alike; --new creates another link and --title sets its title.
|
|
929
960
|
- 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.
|
|
961
|
+
- Existing-share reads do not publish or change visibility: share list and share show <id> (share embed <id> is the embed-focused alias) use shares:read and return metadata plus the same iframe/Markdown/badge/preview snippets. share delete <id> uses shares:write and permanently deletes that share. It asks by default; non-interactive/JSON requires --yes before any request. Never delete shares just to make room without the user's explicit instruction.
|
|
930
962
|
|
|
931
963
|
## Narration (Joplo Cloud and your own keys)
|
|
932
964
|
- 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.
|
|
933
965
|
- 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.
|
|
934
966
|
- 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.
|
|
967
|
+
- With the board running, voice profiles lists sources/narrators and non-secret key status; voice select [dir] --profile <id> (or --browser) chooses the project source, and voice narrator <profile> <voice-id> changes its default narrator. voice key set <openai|elevenlabs> reads hidden input or JOPLO_VOICE_KEY; voice key test uses the saved key or that environment value without saving; voice key delete resets the preset and requires confirmation/--yes. Full keys and test audio are never printed. These commands do not bypass a config voice.profile and do not generate narration or spend characters (except the explicitly requested key test's provider sample).
|
|
935
968
|
- 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.
|
|
936
969
|
- 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.
|
|
937
970
|
- Roles need their own voice: a feature role without config({ voice: { roles: { key: '<voice id>' } } }) speaks in the narrator's voice, so a person talking and the presenter sound identical. Pick a contrasting voice (another gender or register) from the board's voice panel; with Joplo Cloud the ids are multilingual and apply to every content language unless voice.locales overrides them. Set this before generating, because changing a voice regenerates its clips.
|
|
@@ -1029,7 +1062,7 @@ The engine supplies authoring, compilation, state, scheduling and host services.
|
|
|
1029
1062
|
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.
|
|
1030
1063
|
|
|
1031
1064
|
## Optional 3D
|
|
1032
|
-
The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.
|
|
1065
|
+
The starter does not include 3D or its large browser dependency. To add it: npm install @joplo-app/plugin-3d@0.8.0; 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.
|
|
1033
1066
|
|
|
1034
1067
|
## Errors and trust
|
|
1035
1068
|
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joplo-app/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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.
|
|
38
|
+
"@joplo-app/kit": "0.8.0",
|
|
39
39
|
"zod": "4.6.7"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|