@joplo-app/core 0.1.2 → 0.2.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/catalog.d.ts +11 -1
- package/dist/catalog.js +120 -105
- package/dist/compile.d.ts +2 -0
- package/dist/compile.js +109 -50
- package/dist/guide.d.ts +7 -7
- package/dist/guide.js +347 -296
- package/dist/load.js +5 -5
- package/dist/player.d.ts +39 -1
- package/dist/player.js +104 -19
- package/dist/schema.d.ts +181 -2
- package/dist/schema.js +25 -6
- package/dist/validate.js +34 -34
- package/package.json +2 -2
package/dist/load.js
CHANGED
|
@@ -75,19 +75,19 @@ export async function loadAuthoring(root, importer) {
|
|
|
75
75
|
const mod = await importer(file);
|
|
76
76
|
const v = (mod.default ?? null);
|
|
77
77
|
if (!v || v.kind !== kind) {
|
|
78
|
-
fail(file,
|
|
78
|
+
fail(file, `Default export must be ${kind}(...); got ${v?.kind ?? typeof v}`, 'WRONG_EXPORT');
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
return { ...v, file: relp(file) };
|
|
82
82
|
}
|
|
83
83
|
catch (e) {
|
|
84
|
-
fail(file,
|
|
84
|
+
fail(file, `Load failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
const cfgFile = findFile(join(r, 'joplo.config'));
|
|
89
89
|
if (!cfgFile) {
|
|
90
|
-
diags.push({ severity: 'error', code: 'NOT_A_PROJECT', message: '
|
|
90
|
+
diags.push({ severity: 'error', code: 'NOT_A_PROJECT', message: 'Missing joplo.config.ts', source: 'schema', at: 'joplo.config.ts:1:1' });
|
|
91
91
|
return { authoring: null, diagnostics: diags };
|
|
92
92
|
}
|
|
93
93
|
const config = await load(cfgFile, 'config');
|
|
@@ -105,7 +105,7 @@ export async function loadAuthoring(root, importer) {
|
|
|
105
105
|
const p = join(d, f);
|
|
106
106
|
if (isDir(p)) {
|
|
107
107
|
if (/[\[\]]/.test(f))
|
|
108
|
-
fail(p,
|
|
108
|
+
fail(p, `Dynamic route segment "${f}" is not supported; use a concrete route such as /members/li-lei`, 'UNSUPPORTED_ROUTE');
|
|
109
109
|
else
|
|
110
110
|
await walk(p, `${prefix}/${f}`);
|
|
111
111
|
}
|
|
@@ -124,7 +124,7 @@ export async function loadAuthoring(root, importer) {
|
|
|
124
124
|
continue;
|
|
125
125
|
const ff = findFile(join(fd, 'feature'));
|
|
126
126
|
if (!ff) {
|
|
127
|
-
fail(fd,
|
|
127
|
+
fail(fd, `Feature directory ${fid} is missing feature.ts`, 'MISSING_FEATURE');
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
130
130
|
const def = await load(ff, 'feature');
|
package/dist/player.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export type ClickVerdict = {
|
|
|
107
107
|
kind: 'advance';
|
|
108
108
|
} | {
|
|
109
109
|
kind: 'disabled';
|
|
110
|
-
reason: string;
|
|
110
|
+
reason: string | null;
|
|
111
111
|
} | {
|
|
112
112
|
kind: 'unmodeled';
|
|
113
113
|
label: string;
|
|
@@ -170,3 +170,41 @@ export type DiagramStates = Record<string, {
|
|
|
170
170
|
* 节点或连线上显式写的 state 优先于推算结果(由渲染器处理)。
|
|
171
171
|
*/
|
|
172
172
|
export declare function diagramStateAt(project: Project, scenarioId: string | null | undefined, position: number): DiagramStates;
|
|
173
|
+
export type CardAction = Extract<Step['action'], {
|
|
174
|
+
type: 'card';
|
|
175
|
+
}>;
|
|
176
|
+
export type RoleInfo = {
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
desc: string;
|
|
180
|
+
color: string;
|
|
181
|
+
};
|
|
182
|
+
/** 第 position 步之后是否停在一张过渡卡上(最近执行的一步是过渡卡);是则返回卡片内容。 */
|
|
183
|
+
export declare function cardAt(project: Project, scenarioId: string | null | undefined, position: number): CardAction | null;
|
|
184
|
+
/** 方案所属功能里可引用的角色(有 id 的)。 */
|
|
185
|
+
export declare function roleOf(project: Project, optionId: string | null | undefined, roleId: string | null | undefined): RoleInfo | null;
|
|
186
|
+
/** 某个画面是谁的(层级声明了 role 时);路径页面与没有角色的层级返回 null。 */
|
|
187
|
+
export declare function roleOfScene(project: Project, sceneId: string | null | undefined): RoleInfo | null;
|
|
188
|
+
/** 第 index 步(0 起)流式输出的状态路径与文字。 */
|
|
189
|
+
export declare function streamsOf(step: Step | undefined): {
|
|
190
|
+
path: string;
|
|
191
|
+
value: string;
|
|
192
|
+
}[];
|
|
193
|
+
/** 动作和业务效果完全相同的公共前缀步数;字幕、镜头、分叉等展示信息不参与。 */
|
|
194
|
+
export declare function commonPrefix(a: readonly Pick<Step, 'action' | 'effects'>[], b: readonly Pick<Step, 'action' | 'effects'>[]): number;
|
|
195
|
+
export declare function forksAt(project: Project, scenarioId: string | null | undefined, position: number): Step['forks'];
|
|
196
|
+
/** 与 Toast 一样只显示最近一步,目标是否可见由当前显示画面决定。 */
|
|
197
|
+
export declare function marksAt(project: Project, scenarioId: string | null | undefined, position: number): Step['marks'];
|
|
198
|
+
export type StateChange = {
|
|
199
|
+
path: string;
|
|
200
|
+
before: unknown;
|
|
201
|
+
after: unknown;
|
|
202
|
+
};
|
|
203
|
+
/** 对比 core 回放产生的相邻状态:对象按叶子展开,数组作为一个值;不包含动画、Toast 等展示状态。 */
|
|
204
|
+
export declare function changedAt(project: Project, scenarioId: string | null | undefined, position: number): StateChange[];
|
|
205
|
+
/** 已定位的一步的路线;字幕也用这一个投影入口。 */
|
|
206
|
+
export declare function forksOf(step: Step | undefined): Step['forks'];
|
|
207
|
+
/** 按键记录的 IR 入口:静态取最近一步,动画预览与键帽分词由 web 负责。 */
|
|
208
|
+
export declare function keyboardActionOf(step: Step | undefined): Extract<Step['action'], {
|
|
209
|
+
type: 'type' | 'press';
|
|
210
|
+
}> | null;
|
package/dist/player.js
CHANGED
|
@@ -11,13 +11,13 @@ import { JoploError } from "./result.js";
|
|
|
11
11
|
export function getScenario(project, scenarioId) {
|
|
12
12
|
const sc = project.scenarios[scenarioId];
|
|
13
13
|
if (!sc)
|
|
14
|
-
throw new JoploError('NOT_FOUND',
|
|
14
|
+
throw new JoploError('NOT_FOUND', `Scenario does not exist: ${scenarioId}`);
|
|
15
15
|
return sc;
|
|
16
16
|
}
|
|
17
17
|
export function getScene(project, sceneId) {
|
|
18
18
|
const s = project.scenes[sceneId];
|
|
19
19
|
if (!s)
|
|
20
|
-
throw new JoploError('NOT_FOUND',
|
|
20
|
+
throw new JoploError('NOT_FOUND', `Stage does not exist: ${sceneId}`);
|
|
21
21
|
return s;
|
|
22
22
|
}
|
|
23
23
|
export function walkNodes(root, visit) {
|
|
@@ -267,7 +267,7 @@ function setPath(state, path, value, mode) {
|
|
|
267
267
|
const [root, ...rest] = path.split('.');
|
|
268
268
|
const base = (root === 'ui' ? state.ui : root === 'data' ? state.data : state.inputs);
|
|
269
269
|
if (rest.length === 0)
|
|
270
|
-
throw new Error(
|
|
270
|
+
throw new Error(`Cannot replace an entire state root: ${path}`);
|
|
271
271
|
let cur = base;
|
|
272
272
|
for (const key of rest.slice(0, -1)) {
|
|
273
273
|
const next = cur[key];
|
|
@@ -296,37 +296,37 @@ export function checkStep(project, scenario, state, step) {
|
|
|
296
296
|
function checkStepInner(project, scenario, state, step) {
|
|
297
297
|
const ref = { kind: 'step', id: step.id, optionId: scenario.optionId, scenarioId: scenario.id, stepId: step.id };
|
|
298
298
|
if (state.completed)
|
|
299
|
-
return { severity: 'error', code: 'ALREADY_COMPLETED', message:
|
|
299
|
+
return { severity: 'error', code: 'ALREADY_COMPLETED', message: `Scenario has ended; cannot execute step ${step.id}`, source: 'replay', ref };
|
|
300
300
|
const a = step.action;
|
|
301
|
-
if (a.type === 'event')
|
|
301
|
+
if (a.type === 'event' || a.type === 'card' || a.type === 'press')
|
|
302
302
|
return null;
|
|
303
303
|
if (a.type === 'back') {
|
|
304
304
|
return state.sceneStack.length === 0
|
|
305
|
-
? { severity: 'error', code: 'NOTHING_TO_GO_BACK', message:
|
|
305
|
+
? { severity: 'error', code: 'NOTHING_TO_GO_BACK', message: `Step ${step.id} goes back, but there is no previous stage`, source: 'replay', ref }
|
|
306
306
|
: null;
|
|
307
307
|
}
|
|
308
308
|
const scene = sceneOfTarget(project, scenario, state, a.target);
|
|
309
309
|
if (!scene)
|
|
310
|
-
return { severity: 'error', code: 'MISSING_SCENE', message:
|
|
310
|
+
return { severity: 'error', code: 'MISSING_SCENE', message: `Current stage ${state.sceneId} does not exist`, source: 'replay', ref };
|
|
311
311
|
const hit = findNode(scene, a.target);
|
|
312
312
|
if (!hit)
|
|
313
|
-
return { severity: 'error', code: 'MISSING_TARGET', message:
|
|
313
|
+
return { severity: 'error', code: 'MISSING_TARGET', message: `Step ${step.id} target ${a.target} is not in the current stage ${scene.id}`, source: 'replay', ref };
|
|
314
314
|
const { node } = hit;
|
|
315
315
|
if (!isNodeVisible(scene, a.target, state))
|
|
316
|
-
return { severity: 'error', code: 'TARGET_HIDDEN', message:
|
|
316
|
+
return { severity: 'error', code: 'TARGET_HIDDEN', message: `Step ${step.id} target "${nodeLabel(node)}" is currently hidden`, source: 'replay', ref };
|
|
317
317
|
if (isNodeDisabled(node, state))
|
|
318
|
-
return { severity: 'error', code: 'TARGET_DISABLED', message:
|
|
318
|
+
return { severity: 'error', code: 'TARGET_DISABLED', message: `Step ${step.id} target "${nodeLabel(node)}" is currently disabled`, source: 'replay', ref };
|
|
319
319
|
if (a.type === 'click' && !INTERACTIVE_TYPES.has(node.type))
|
|
320
|
-
return { severity: 'error', code: 'NOT_INTERACTIVE', message:
|
|
320
|
+
return { severity: 'error', code: 'NOT_INTERACTIVE', message: `Step ${step.id} clicks ${node.type} "${nodeLabel(node)}", which is not interactive`, source: 'replay', ref };
|
|
321
321
|
if (a.type !== 'click' && !VALUE_TYPES.has(node.type))
|
|
322
|
-
return { severity: 'error', code: 'NOT_A_FIELD', message:
|
|
322
|
+
return { severity: 'error', code: 'NOT_A_FIELD', message: `Step ${step.id} ${a.type} action target ${node.type} cannot accept input`, source: 'replay', ref };
|
|
323
323
|
if (a.type === 'select') {
|
|
324
324
|
const choices = choicesOf(node, state);
|
|
325
325
|
if (choices && !matchChoice(choices, a.value))
|
|
326
326
|
return {
|
|
327
327
|
severity: 'error',
|
|
328
328
|
code: 'UNKNOWN_CHOICE',
|
|
329
|
-
message:
|
|
329
|
+
message: `Step ${step.id} field "${nodeLabel(node)}" cannot select "${a.value}"; it is not an available option (available: ${choices.map((c) => (c.label === c.value ? c.value : `${c.label}/${c.value}`)).join(', ')})`,
|
|
330
330
|
source: 'replay',
|
|
331
331
|
ref,
|
|
332
332
|
};
|
|
@@ -352,7 +352,7 @@ function selectedValue(project, state, target, raw) {
|
|
|
352
352
|
export function applyStep(project, scenario, state) {
|
|
353
353
|
const step = scenario.steps[state.position];
|
|
354
354
|
if (!step)
|
|
355
|
-
throw new JoploError('PLAYBACK_FAILED',
|
|
355
|
+
throw new JoploError('PLAYBACK_FAILED', `Scenario ${scenario.id} has no step ${state.position + 1}`);
|
|
356
356
|
const problem = checkStep(project, scenario, state, step);
|
|
357
357
|
if (problem)
|
|
358
358
|
throw new PlaybackError(problem.message, problem);
|
|
@@ -374,16 +374,19 @@ export function applyStep(project, scenario, state) {
|
|
|
374
374
|
case 'append':
|
|
375
375
|
setPath(next, e.path, e.value, 'append');
|
|
376
376
|
break;
|
|
377
|
+
case 'stream':
|
|
378
|
+
setPath(next, e.path, e.value, 'set');
|
|
379
|
+
break;
|
|
377
380
|
case 'toast':
|
|
378
381
|
next.toasts.push({ id: `${step.id}_${i}`, text: e.text, tone: e.tone });
|
|
379
382
|
break;
|
|
380
383
|
case 'navigate': {
|
|
381
384
|
const target = project.scenes[e.sceneId];
|
|
382
385
|
if (!target || target.optionId !== scenario.optionId)
|
|
383
|
-
throw new PlaybackError(
|
|
386
|
+
throw new PlaybackError(`Step ${step.id} navigates to a stage that is missing or outside this option: ${e.sceneId}`, {
|
|
384
387
|
severity: 'error',
|
|
385
388
|
code: 'MISSING_SCENE',
|
|
386
|
-
message:
|
|
389
|
+
message: `Navigation target stage ${e.sceneId} is missing or outside option ${scenario.optionId}`,
|
|
387
390
|
source: 'replay',
|
|
388
391
|
ref,
|
|
389
392
|
});
|
|
@@ -403,7 +406,7 @@ export function applyStep(project, scenario, state) {
|
|
|
403
406
|
export function stateAt(project, scenarioId, position) {
|
|
404
407
|
const sc = getScenario(project, scenarioId);
|
|
405
408
|
if (!Number.isInteger(position) || position < 0 || position > sc.steps.length)
|
|
406
|
-
throw new JoploError('NOT_FOUND',
|
|
409
|
+
throw new JoploError('NOT_FOUND', `Position ${position} is outside scenario ${scenarioId} range 0..${sc.steps.length}`);
|
|
407
410
|
let s = initialState(project, scenarioId);
|
|
408
411
|
while (s.position < position)
|
|
409
412
|
s = applyStep(project, sc, s);
|
|
@@ -414,7 +417,7 @@ export function positionAfterStep(project, scenarioId, stepId) {
|
|
|
414
417
|
const sc = getScenario(project, scenarioId);
|
|
415
418
|
const i = sc.steps.findIndex((s) => s.id === stepId);
|
|
416
419
|
if (i < 0)
|
|
417
|
-
throw new JoploError('NOT_FOUND',
|
|
420
|
+
throw new JoploError('NOT_FOUND', `Step ${stepId} is not in scenario ${scenarioId}`);
|
|
418
421
|
return i + 1;
|
|
419
422
|
}
|
|
420
423
|
/** 完整回放一个场景,收集诊断而不抛出。供校验器使用。 */
|
|
@@ -457,7 +460,7 @@ export function explainClick(project, state, nodeId, sceneId) {
|
|
|
457
460
|
const { node } = hit;
|
|
458
461
|
const label = nodeLabel(node);
|
|
459
462
|
if (isNodeDisabled(node, state))
|
|
460
|
-
return { kind: 'disabled', reason: node.disabledReason ??
|
|
463
|
+
return { kind: 'disabled', reason: node.disabledReason ?? null };
|
|
461
464
|
const current = sc.steps[state.position];
|
|
462
465
|
const targetOf = (s) => ('target' in s.action ? s.action.target : null);
|
|
463
466
|
if (current && !state.completed && targetOf(current) === nodeId && checkStep(project, sc, state, current) === null)
|
|
@@ -580,3 +583,85 @@ export function diagramStateAt(project, scenarioId, position) {
|
|
|
580
583
|
}
|
|
581
584
|
return out;
|
|
582
585
|
}
|
|
586
|
+
/** 第 position 步之后是否停在一张过渡卡上(最近执行的一步是过渡卡);是则返回卡片内容。 */
|
|
587
|
+
export function cardAt(project, scenarioId, position) {
|
|
588
|
+
const st = scenarioId ? project.scenarios[scenarioId]?.steps[position - 1] : undefined;
|
|
589
|
+
return st && st.action.type === 'card' ? st.action : null;
|
|
590
|
+
}
|
|
591
|
+
/** 方案所属功能里可引用的角色(有 id 的)。 */
|
|
592
|
+
export function roleOf(project, optionId, roleId) {
|
|
593
|
+
if (!optionId || !roleId)
|
|
594
|
+
return null;
|
|
595
|
+
const opt = project.options[optionId];
|
|
596
|
+
const r = opt ? project.features[opt.featureId]?.roles.find((x) => x.id === roleId) : undefined;
|
|
597
|
+
return r && r.id ? { id: r.id, name: r.name, desc: r.desc, color: r.color } : null;
|
|
598
|
+
}
|
|
599
|
+
/** 某个画面是谁的(层级声明了 role 时);路径页面与没有角色的层级返回 null。 */
|
|
600
|
+
export function roleOfScene(project, sceneId) {
|
|
601
|
+
const scene = sceneId ? project.scenes[sceneId] : undefined;
|
|
602
|
+
if (!scene?.layer || !scene.optionId)
|
|
603
|
+
return null;
|
|
604
|
+
return roleOf(project, scene.optionId, project.options[scene.optionId]?.layers[scene.layer]?.role);
|
|
605
|
+
}
|
|
606
|
+
/** 第 index 步(0 起)流式输出的状态路径与文字。 */
|
|
607
|
+
export function streamsOf(step) {
|
|
608
|
+
return (step?.effects ?? []).flatMap((e) => (e.type === 'stream' ? [{ path: e.path, value: e.value }] : []));
|
|
609
|
+
}
|
|
610
|
+
// ---------- 分叉、标注与变化(D56 P1) ----------
|
|
611
|
+
/** 动作和业务效果完全相同的公共前缀步数;字幕、镜头、分叉等展示信息不参与。 */
|
|
612
|
+
export function commonPrefix(a, b) {
|
|
613
|
+
let n = 0;
|
|
614
|
+
while (n < Math.min(a.length, b.length) && sameValue(a[n].action, b[n].action) && sameValue(a[n].effects, b[n].effects))
|
|
615
|
+
n++;
|
|
616
|
+
return n;
|
|
617
|
+
}
|
|
618
|
+
function sameValue(a, b) {
|
|
619
|
+
if (Object.is(a, b))
|
|
620
|
+
return true;
|
|
621
|
+
if (!a || !b || typeof a !== 'object' || typeof b !== 'object')
|
|
622
|
+
return false;
|
|
623
|
+
if (Array.isArray(a) || Array.isArray(b))
|
|
624
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => sameValue(v, b[i]));
|
|
625
|
+
const ak = Object.keys(a), bk = Object.keys(b);
|
|
626
|
+
return ak.length === bk.length && ak.every(k => Object.hasOwn(b, k) && sameValue(a[k], b[k]));
|
|
627
|
+
}
|
|
628
|
+
export function forksAt(project, scenarioId, position) {
|
|
629
|
+
return forksOf(scenarioId ? project.scenarios[scenarioId]?.steps[position - 1] : undefined);
|
|
630
|
+
}
|
|
631
|
+
/** 与 Toast 一样只显示最近一步,目标是否可见由当前显示画面决定。 */
|
|
632
|
+
export function marksAt(project, scenarioId, position) {
|
|
633
|
+
return (scenarioId ? project.scenarios[scenarioId]?.steps[position - 1]?.marks : undefined) ?? [];
|
|
634
|
+
}
|
|
635
|
+
/** 对比 core 回放产生的相邻状态:对象按叶子展开,数组作为一个值;不包含动画、Toast 等展示状态。 */
|
|
636
|
+
export function changedAt(project, scenarioId, position) {
|
|
637
|
+
const sc = scenarioId ? project.scenarios[scenarioId] : undefined;
|
|
638
|
+
if (!sc || !Number.isInteger(position) || position <= 0 || position > sc.steps.length)
|
|
639
|
+
return [];
|
|
640
|
+
const before = stateAt(project, sc.id, position - 1);
|
|
641
|
+
const after = applyStep(project, sc, before);
|
|
642
|
+
const out = [];
|
|
643
|
+
const object = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
644
|
+
const diff = (path, a, b) => {
|
|
645
|
+
if (sameValue(a, b))
|
|
646
|
+
return;
|
|
647
|
+
if ((object(a) || a === undefined) && (object(b) || b === undefined) && (object(a) || object(b))) {
|
|
648
|
+
const keys = [...new Set([...Object.keys(a ?? {}), ...Object.keys(b ?? {})])].sort();
|
|
649
|
+
if (keys.length) {
|
|
650
|
+
for (const k of keys)
|
|
651
|
+
diff(`${path}.${k}`, a?.[k], b?.[k]);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
out.push({ path, before: structuredClone(a), after: structuredClone(b) });
|
|
656
|
+
};
|
|
657
|
+
for (const root of ['ui', 'data', 'inputs'])
|
|
658
|
+
diff(root, before[root], after[root]);
|
|
659
|
+
return out;
|
|
660
|
+
}
|
|
661
|
+
/** 已定位的一步的路线;字幕也用这一个投影入口。 */
|
|
662
|
+
export function forksOf(step) { return step?.forks ?? []; }
|
|
663
|
+
/** 按键记录的 IR 入口:静态取最近一步,动画预览与键帽分词由 web 负责。 */
|
|
664
|
+
export function keyboardActionOf(step) {
|
|
665
|
+
const a = step?.action;
|
|
666
|
+
return a?.type === 'type' || a?.type === 'press' ? a : null;
|
|
667
|
+
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -82,9 +82,18 @@ export declare const Action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
82
82
|
value: z.ZodBoolean;
|
|
83
83
|
}, z.core.$strict>, z.ZodObject<{
|
|
84
84
|
type: z.ZodLiteral<"back">;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"press">;
|
|
87
|
+
keys: z.ZodString;
|
|
85
88
|
}, z.core.$strict>, z.ZodObject<{
|
|
86
89
|
type: z.ZodLiteral<"event">;
|
|
87
90
|
name: z.ZodString;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"card">;
|
|
93
|
+
title: z.ZodString;
|
|
94
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
95
|
+
points: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
96
|
+
role: z.ZodOptional<z.ZodString>;
|
|
88
97
|
}, z.core.$strict>], "type">;
|
|
89
98
|
export declare const Effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
90
99
|
type: z.ZodLiteral<"set">;
|
|
@@ -113,6 +122,10 @@ export declare const Effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
113
122
|
failure: "failure";
|
|
114
123
|
cancelled: "cancelled";
|
|
115
124
|
}>;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"stream">;
|
|
127
|
+
path: z.ZodString;
|
|
128
|
+
value: z.ZodString;
|
|
116
129
|
}, z.core.$strict>], "type">;
|
|
117
130
|
/**
|
|
118
131
|
* 调用链(D48):这一步 trace 的一条路径。nodes 按路径顺序;edges 是路径上的连线,reverse = 沿连线的 to→from 方向走。
|
|
@@ -135,11 +148,27 @@ export declare const Shot: z.ZodObject<{
|
|
|
135
148
|
layer: z.ZodString;
|
|
136
149
|
targets: z.ZodArray<z.ZodString>;
|
|
137
150
|
}, z.core.$strict>;
|
|
151
|
+
export declare const Fork: z.ZodObject<{
|
|
152
|
+
label: z.ZodString;
|
|
153
|
+
scenarioId: z.ZodString;
|
|
154
|
+
at: z.ZodNumber;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export declare const Mark: z.ZodObject<{
|
|
157
|
+
target: z.ZodString;
|
|
158
|
+
kind: z.ZodEnum<{
|
|
159
|
+
circle: "circle";
|
|
160
|
+
underline: "underline";
|
|
161
|
+
box: "box";
|
|
162
|
+
arrow: "arrow";
|
|
163
|
+
}>;
|
|
164
|
+
note: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strict>;
|
|
138
166
|
export declare const Step: z.ZodObject<{
|
|
139
167
|
id: z.ZodString;
|
|
140
168
|
kind: z.ZodEnum<{
|
|
141
169
|
user: "user";
|
|
142
170
|
system: "system";
|
|
171
|
+
card: "card";
|
|
143
172
|
}>;
|
|
144
173
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
145
174
|
type: z.ZodLiteral<"click">;
|
|
@@ -158,11 +187,36 @@ export declare const Step: z.ZodObject<{
|
|
|
158
187
|
value: z.ZodBoolean;
|
|
159
188
|
}, z.core.$strict>, z.ZodObject<{
|
|
160
189
|
type: z.ZodLiteral<"back">;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"press">;
|
|
192
|
+
keys: z.ZodString;
|
|
161
193
|
}, z.core.$strict>, z.ZodObject<{
|
|
162
194
|
type: z.ZodLiteral<"event">;
|
|
163
195
|
name: z.ZodString;
|
|
196
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
197
|
+
type: z.ZodLiteral<"card">;
|
|
198
|
+
title: z.ZodString;
|
|
199
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
200
|
+
points: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
201
|
+
role: z.ZodOptional<z.ZodString>;
|
|
164
202
|
}, z.core.$strict>], "type">;
|
|
165
203
|
caption: z.ZodString;
|
|
204
|
+
captionAuto: z.ZodOptional<z.ZodObject<{
|
|
205
|
+
kind: z.ZodEnum<{
|
|
206
|
+
click: "click";
|
|
207
|
+
type: "type";
|
|
208
|
+
select: "select";
|
|
209
|
+
press: "press";
|
|
210
|
+
back: "back";
|
|
211
|
+
check: "check";
|
|
212
|
+
uncheck: "uncheck";
|
|
213
|
+
switch_on: "switch_on";
|
|
214
|
+
switch_off: "switch_off";
|
|
215
|
+
}>;
|
|
216
|
+
label: z.ZodString;
|
|
217
|
+
value: z.ZodOptional<z.ZodString>;
|
|
218
|
+
keys: z.ZodOptional<z.ZodString>;
|
|
219
|
+
}, z.core.$strict>>;
|
|
166
220
|
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
221
|
type: z.ZodLiteral<"set">;
|
|
168
222
|
path: z.ZodString;
|
|
@@ -190,6 +244,10 @@ export declare const Step: z.ZodObject<{
|
|
|
190
244
|
failure: "failure";
|
|
191
245
|
cancelled: "cancelled";
|
|
192
246
|
}>;
|
|
247
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
248
|
+
type: z.ZodLiteral<"stream">;
|
|
249
|
+
path: z.ZodString;
|
|
250
|
+
value: z.ZodString;
|
|
193
251
|
}, z.core.$strict>], "type">>>;
|
|
194
252
|
ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
195
253
|
shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -210,6 +268,21 @@ export declare const Step: z.ZodObject<{
|
|
|
210
268
|
reverse: z.ZodDefault<z.ZodBoolean>;
|
|
211
269
|
}, z.core.$strict>>;
|
|
212
270
|
}, z.core.$strict>>>;
|
|
271
|
+
forks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
272
|
+
label: z.ZodString;
|
|
273
|
+
scenarioId: z.ZodString;
|
|
274
|
+
at: z.ZodNumber;
|
|
275
|
+
}, z.core.$strict>>>;
|
|
276
|
+
marks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
277
|
+
target: z.ZodString;
|
|
278
|
+
kind: z.ZodEnum<{
|
|
279
|
+
circle: "circle";
|
|
280
|
+
underline: "underline";
|
|
281
|
+
box: "box";
|
|
282
|
+
arrow: "arrow";
|
|
283
|
+
}>;
|
|
284
|
+
note: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, z.core.$strict>>>;
|
|
213
286
|
source: z.ZodOptional<z.ZodString>;
|
|
214
287
|
}, z.core.$strict>;
|
|
215
288
|
export declare const Scenario: z.ZodObject<{
|
|
@@ -226,6 +299,7 @@ export declare const Scenario: z.ZodObject<{
|
|
|
226
299
|
denied: "denied";
|
|
227
300
|
other: "other";
|
|
228
301
|
}>;
|
|
302
|
+
auto: z.ZodOptional<z.ZodLiteral<true>>;
|
|
229
303
|
}, z.core.$strict>;
|
|
230
304
|
initial: z.ZodObject<{
|
|
231
305
|
sceneId: z.ZodString;
|
|
@@ -238,6 +312,7 @@ export declare const Scenario: z.ZodObject<{
|
|
|
238
312
|
kind: z.ZodEnum<{
|
|
239
313
|
user: "user";
|
|
240
314
|
system: "system";
|
|
315
|
+
card: "card";
|
|
241
316
|
}>;
|
|
242
317
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
243
318
|
type: z.ZodLiteral<"click">;
|
|
@@ -256,11 +331,36 @@ export declare const Scenario: z.ZodObject<{
|
|
|
256
331
|
value: z.ZodBoolean;
|
|
257
332
|
}, z.core.$strict>, z.ZodObject<{
|
|
258
333
|
type: z.ZodLiteral<"back">;
|
|
334
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
335
|
+
type: z.ZodLiteral<"press">;
|
|
336
|
+
keys: z.ZodString;
|
|
259
337
|
}, z.core.$strict>, z.ZodObject<{
|
|
260
338
|
type: z.ZodLiteral<"event">;
|
|
261
339
|
name: z.ZodString;
|
|
340
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
341
|
+
type: z.ZodLiteral<"card">;
|
|
342
|
+
title: z.ZodString;
|
|
343
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
344
|
+
points: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
345
|
+
role: z.ZodOptional<z.ZodString>;
|
|
262
346
|
}, z.core.$strict>], "type">;
|
|
263
347
|
caption: z.ZodString;
|
|
348
|
+
captionAuto: z.ZodOptional<z.ZodObject<{
|
|
349
|
+
kind: z.ZodEnum<{
|
|
350
|
+
click: "click";
|
|
351
|
+
type: "type";
|
|
352
|
+
select: "select";
|
|
353
|
+
press: "press";
|
|
354
|
+
back: "back";
|
|
355
|
+
check: "check";
|
|
356
|
+
uncheck: "uncheck";
|
|
357
|
+
switch_on: "switch_on";
|
|
358
|
+
switch_off: "switch_off";
|
|
359
|
+
}>;
|
|
360
|
+
label: z.ZodString;
|
|
361
|
+
value: z.ZodOptional<z.ZodString>;
|
|
362
|
+
keys: z.ZodOptional<z.ZodString>;
|
|
363
|
+
}, z.core.$strict>>;
|
|
264
364
|
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
265
365
|
type: z.ZodLiteral<"set">;
|
|
266
366
|
path: z.ZodString;
|
|
@@ -288,6 +388,10 @@ export declare const Scenario: z.ZodObject<{
|
|
|
288
388
|
failure: "failure";
|
|
289
389
|
cancelled: "cancelled";
|
|
290
390
|
}>;
|
|
391
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
392
|
+
type: z.ZodLiteral<"stream">;
|
|
393
|
+
path: z.ZodString;
|
|
394
|
+
value: z.ZodString;
|
|
291
395
|
}, z.core.$strict>], "type">>>;
|
|
292
396
|
ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
293
397
|
shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -308,6 +412,21 @@ export declare const Scenario: z.ZodObject<{
|
|
|
308
412
|
reverse: z.ZodDefault<z.ZodBoolean>;
|
|
309
413
|
}, z.core.$strict>>;
|
|
310
414
|
}, z.core.$strict>>>;
|
|
415
|
+
forks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
416
|
+
label: z.ZodString;
|
|
417
|
+
scenarioId: z.ZodString;
|
|
418
|
+
at: z.ZodNumber;
|
|
419
|
+
}, z.core.$strict>>>;
|
|
420
|
+
marks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
421
|
+
target: z.ZodString;
|
|
422
|
+
kind: z.ZodEnum<{
|
|
423
|
+
circle: "circle";
|
|
424
|
+
underline: "underline";
|
|
425
|
+
box: "box";
|
|
426
|
+
arrow: "arrow";
|
|
427
|
+
}>;
|
|
428
|
+
note: z.ZodOptional<z.ZodString>;
|
|
429
|
+
}, z.core.$strict>>>;
|
|
311
430
|
source: z.ZodOptional<z.ZodString>;
|
|
312
431
|
}, z.core.$strict>>>;
|
|
313
432
|
expected: z.ZodDefault<z.ZodString>;
|
|
@@ -326,7 +445,12 @@ export declare const Feature: z.ZodObject<{
|
|
|
326
445
|
id: z.ZodString;
|
|
327
446
|
name: z.ZodString;
|
|
328
447
|
goal: z.ZodString;
|
|
329
|
-
roles: z.ZodDefault<z.ZodArray<z.
|
|
448
|
+
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
449
|
+
id: z.ZodOptional<z.ZodString>;
|
|
450
|
+
name: z.ZodString;
|
|
451
|
+
desc: z.ZodDefault<z.ZodString>;
|
|
452
|
+
color: z.ZodString;
|
|
453
|
+
}, z.core.$strict>>>;
|
|
330
454
|
constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
331
455
|
id: z.ZodString;
|
|
332
456
|
text: z.ZodString;
|
|
@@ -402,6 +526,7 @@ export declare const Option: z.ZodObject<{
|
|
|
402
526
|
layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
403
527
|
title: z.ZodString;
|
|
404
528
|
sceneId: z.ZodString;
|
|
529
|
+
role: z.ZodOptional<z.ZodString>;
|
|
405
530
|
}, z.core.$strict>>>;
|
|
406
531
|
source: z.ZodOptional<z.ZodString>;
|
|
407
532
|
}, z.core.$strict>;
|
|
@@ -465,7 +590,12 @@ export declare const Project: z.ZodObject<{
|
|
|
465
590
|
id: z.ZodString;
|
|
466
591
|
name: z.ZodString;
|
|
467
592
|
goal: z.ZodString;
|
|
468
|
-
roles: z.ZodDefault<z.ZodArray<z.
|
|
593
|
+
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
594
|
+
id: z.ZodOptional<z.ZodString>;
|
|
595
|
+
name: z.ZodString;
|
|
596
|
+
desc: z.ZodDefault<z.ZodString>;
|
|
597
|
+
color: z.ZodString;
|
|
598
|
+
}, z.core.$strict>>>;
|
|
469
599
|
constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
470
600
|
id: z.ZodString;
|
|
471
601
|
text: z.ZodString;
|
|
@@ -525,6 +655,7 @@ export declare const Project: z.ZodObject<{
|
|
|
525
655
|
layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
526
656
|
title: z.ZodString;
|
|
527
657
|
sceneId: z.ZodString;
|
|
658
|
+
role: z.ZodOptional<z.ZodString>;
|
|
528
659
|
}, z.core.$strict>>>;
|
|
529
660
|
source: z.ZodOptional<z.ZodString>;
|
|
530
661
|
}, z.core.$strict>>>;
|
|
@@ -576,6 +707,7 @@ export declare const Project: z.ZodObject<{
|
|
|
576
707
|
denied: "denied";
|
|
577
708
|
other: "other";
|
|
578
709
|
}>;
|
|
710
|
+
auto: z.ZodOptional<z.ZodLiteral<true>>;
|
|
579
711
|
}, z.core.$strict>;
|
|
580
712
|
initial: z.ZodObject<{
|
|
581
713
|
sceneId: z.ZodString;
|
|
@@ -588,6 +720,7 @@ export declare const Project: z.ZodObject<{
|
|
|
588
720
|
kind: z.ZodEnum<{
|
|
589
721
|
user: "user";
|
|
590
722
|
system: "system";
|
|
723
|
+
card: "card";
|
|
591
724
|
}>;
|
|
592
725
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
593
726
|
type: z.ZodLiteral<"click">;
|
|
@@ -606,11 +739,36 @@ export declare const Project: z.ZodObject<{
|
|
|
606
739
|
value: z.ZodBoolean;
|
|
607
740
|
}, z.core.$strict>, z.ZodObject<{
|
|
608
741
|
type: z.ZodLiteral<"back">;
|
|
742
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
743
|
+
type: z.ZodLiteral<"press">;
|
|
744
|
+
keys: z.ZodString;
|
|
609
745
|
}, z.core.$strict>, z.ZodObject<{
|
|
610
746
|
type: z.ZodLiteral<"event">;
|
|
611
747
|
name: z.ZodString;
|
|
748
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
749
|
+
type: z.ZodLiteral<"card">;
|
|
750
|
+
title: z.ZodString;
|
|
751
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
752
|
+
points: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
753
|
+
role: z.ZodOptional<z.ZodString>;
|
|
612
754
|
}, z.core.$strict>], "type">;
|
|
613
755
|
caption: z.ZodString;
|
|
756
|
+
captionAuto: z.ZodOptional<z.ZodObject<{
|
|
757
|
+
kind: z.ZodEnum<{
|
|
758
|
+
click: "click";
|
|
759
|
+
type: "type";
|
|
760
|
+
select: "select";
|
|
761
|
+
press: "press";
|
|
762
|
+
back: "back";
|
|
763
|
+
check: "check";
|
|
764
|
+
uncheck: "uncheck";
|
|
765
|
+
switch_on: "switch_on";
|
|
766
|
+
switch_off: "switch_off";
|
|
767
|
+
}>;
|
|
768
|
+
label: z.ZodString;
|
|
769
|
+
value: z.ZodOptional<z.ZodString>;
|
|
770
|
+
keys: z.ZodOptional<z.ZodString>;
|
|
771
|
+
}, z.core.$strict>>;
|
|
614
772
|
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
615
773
|
type: z.ZodLiteral<"set">;
|
|
616
774
|
path: z.ZodString;
|
|
@@ -638,6 +796,10 @@ export declare const Project: z.ZodObject<{
|
|
|
638
796
|
failure: "failure";
|
|
639
797
|
cancelled: "cancelled";
|
|
640
798
|
}>;
|
|
799
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
800
|
+
type: z.ZodLiteral<"stream">;
|
|
801
|
+
path: z.ZodString;
|
|
802
|
+
value: z.ZodString;
|
|
641
803
|
}, z.core.$strict>], "type">>>;
|
|
642
804
|
ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
643
805
|
shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -658,6 +820,21 @@ export declare const Project: z.ZodObject<{
|
|
|
658
820
|
reverse: z.ZodDefault<z.ZodBoolean>;
|
|
659
821
|
}, z.core.$strict>>;
|
|
660
822
|
}, z.core.$strict>>>;
|
|
823
|
+
forks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
824
|
+
label: z.ZodString;
|
|
825
|
+
scenarioId: z.ZodString;
|
|
826
|
+
at: z.ZodNumber;
|
|
827
|
+
}, z.core.$strict>>>;
|
|
828
|
+
marks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
829
|
+
target: z.ZodString;
|
|
830
|
+
kind: z.ZodEnum<{
|
|
831
|
+
circle: "circle";
|
|
832
|
+
underline: "underline";
|
|
833
|
+
box: "box";
|
|
834
|
+
arrow: "arrow";
|
|
835
|
+
}>;
|
|
836
|
+
note: z.ZodOptional<z.ZodString>;
|
|
837
|
+
}, z.core.$strict>>>;
|
|
661
838
|
source: z.ZodOptional<z.ZodString>;
|
|
662
839
|
}, z.core.$strict>>>;
|
|
663
840
|
expected: z.ZodDefault<z.ZodString>;
|
|
@@ -692,3 +869,5 @@ export type Action = z.infer<typeof Action>;
|
|
|
692
869
|
export type Effect = z.infer<typeof Effect>;
|
|
693
870
|
export type Trace = z.infer<typeof Trace>;
|
|
694
871
|
export type Shot = z.infer<typeof Shot>;
|
|
872
|
+
export type Fork = z.infer<typeof Fork>;
|
|
873
|
+
export type Mark = z.infer<typeof Mark>;
|