@joplo-app/core 0.4.1 → 0.6.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.
Files changed (65) hide show
  1. package/dist/agent-skill.d.ts +7 -7
  2. package/dist/agent-skill.js +28 -25
  3. package/dist/authoring-works.d.ts +8 -0
  4. package/dist/authoring-works.js +46 -0
  5. package/dist/catalog.d.ts +2 -0
  6. package/dist/compile.d.ts +6 -3
  7. package/dist/compile.js +415 -327
  8. package/dist/content-i18n.js +9 -9
  9. package/dist/embed.d.ts +5 -5
  10. package/dist/embed.js +7 -7
  11. package/dist/entries.d.ts +63 -0
  12. package/dist/entries.js +78 -0
  13. package/dist/feature-diff.d.ts +7 -7
  14. package/dist/feature-diff.js +18 -17
  15. package/dist/features.d.ts +3 -3
  16. package/dist/features.js +3 -3
  17. package/dist/focus-check.js +2 -2
  18. package/dist/focus.d.ts +1 -5
  19. package/dist/focus.js +13 -35
  20. package/dist/guide.js +171 -67
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.js +2 -0
  23. package/dist/load.js +42 -11
  24. package/dist/local-review-files.js +17 -4
  25. package/dist/local-review.d.ts +8 -7
  26. package/dist/local-review.js +7 -6
  27. package/dist/outline.d.ts +21 -13
  28. package/dist/outline.js +27 -31
  29. package/dist/pace.d.ts +10 -5
  30. package/dist/pace.js +12 -5
  31. package/dist/playback.d.ts +57 -0
  32. package/dist/playback.js +317 -0
  33. package/dist/player.d.ts +9 -180
  34. package/dist/player.js +8 -618
  35. package/dist/playground.d.ts +1 -1
  36. package/dist/playground.js +4 -4
  37. package/dist/plugins/compiler.d.ts +16 -0
  38. package/dist/plugins/compiler.js +48 -9
  39. package/dist/presentation.d.ts +73 -0
  40. package/dist/presentation.js +163 -0
  41. package/dist/publication.d.ts +8 -0
  42. package/dist/publication.js +45 -0
  43. package/dist/result.d.ts +1 -1
  44. package/dist/review.d.ts +18 -10
  45. package/dist/review.js +62 -23
  46. package/dist/runtime.d.ts +2 -0
  47. package/dist/runtime.js +2 -0
  48. package/dist/scene-query.d.ts +77 -0
  49. package/dist/scene-query.js +246 -0
  50. package/dist/schema-issues.js +1 -1
  51. package/dist/schema.d.ts +118 -76
  52. package/dist/schema.js +52 -37
  53. package/dist/scope.d.ts +9 -9
  54. package/dist/scope.js +82 -49
  55. package/dist/selection.d.ts +1 -1
  56. package/dist/sequencing.d.ts +6 -0
  57. package/dist/sequencing.js +21 -0
  58. package/dist/step-plan.d.ts +55 -0
  59. package/dist/step-plan.js +90 -0
  60. package/dist/traits.d.ts +10 -0
  61. package/dist/traits.js +3 -0
  62. package/dist/validate.d.ts +1 -1
  63. package/dist/validate.js +75 -65
  64. package/dist/voice.js +4 -0
  65. package/package.json +15 -3
package/dist/schema.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ElementTraits } from '@joplo-app/kit/plugin';
2
2
  /**
3
- * Joplo IR(schemaVersion 2):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
3
+ * Joplo IR(schemaVersion 3):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
4
4
  * 权威源是项目文件夹里的 TSX/TS 文件(ADR-0002);渲染器、播放器、校验器、构建只消费这里的 IR。
5
5
  *
6
6
  * 带 `source` 的对象记录其来源 `相对路径:行:列`,用于选中元素、诊断定位,让 Agent 只读写那一处。
@@ -9,7 +9,7 @@ import { z } from 'zod';
9
9
  /** 层级标签的预设图标(标签压窄时靠它认出是哪一层)。不写时:手机视口 mobile,其余 window。 */
10
10
  export declare const LAYER_ICONS: readonly ["window", "browser", "mobile", "desktop", "terminal", "chat", "agent", "server", "data", "email", "doc", "flow"];
11
11
  export type LayerIcon = (typeof LAYER_ICONS)[number];
12
- export declare const SCHEMA_VERSION: 2;
12
+ export declare const SCHEMA_VERSION: 3;
13
13
  /** 作者可写的 ID(对象键、元素 id)。 */
14
14
  export declare const Id: z.ZodString;
15
15
  /** 编译器生成的限定 ID,例如 `invite.happy`、`invite.a-modal@/members`。 */
@@ -69,7 +69,7 @@ export declare const SceneNode: z.ZodType<SceneNode>;
69
69
  /** 一个画面 = 某个方案上下文中的一个路径:布局 + 页面 + 堆叠进来的功能元素。 */
70
70
  export declare const Scene: z.ZodObject<{
71
71
  id: z.ZodString;
72
- optionId: z.ZodNullable<z.ZodString>;
72
+ workId: z.ZodNullable<z.ZodString>;
73
73
  route: z.ZodString;
74
74
  name: z.ZodString;
75
75
  viewport: z.ZodDefault<z.ZodEnum<{
@@ -179,6 +179,7 @@ export declare const Effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
179
  type: z.ZodLiteral<"stream">;
180
180
  path: z.ZodString;
181
181
  value: z.ZodString;
182
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
182
183
  }, z.core.$strict>], "type">;
183
184
  /** 镜头(D43):这一步在某个层级里对准哪些元素;targets 为空 = 这一层的整体。 */
184
185
  export declare const Shot: z.ZodObject<{
@@ -357,6 +358,7 @@ export declare const Step: z.ZodObject<{
357
358
  type: z.ZodLiteral<"stream">;
358
359
  path: z.ZodString;
359
360
  value: z.ZodString;
361
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
360
362
  }, z.core.$strict>], "type">>>;
361
363
  ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
362
364
  shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -404,6 +406,7 @@ export declare const Step: z.ZodObject<{
404
406
  hold: z.ZodOptional<z.ZodNumber>;
405
407
  effectHold: z.ZodOptional<z.ZodNumber>;
406
408
  say: z.ZodOptional<z.ZodString>;
409
+ sayRole: z.ZodOptional<z.ZodString>;
407
410
  narrate: z.ZodOptional<z.ZodString>;
408
411
  source: z.ZodOptional<z.ZodString>;
409
412
  }, z.core.$strict>;
@@ -426,7 +429,7 @@ export declare const Scenario: z.ZodObject<{
426
429
  }, z.core.$strict>>>;
427
430
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
428
431
  id: z.ZodString;
429
- optionId: z.ZodString;
432
+ workId: z.ZodString;
430
433
  name: z.ZodString;
431
434
  description: z.ZodDefault<z.ZodString>;
432
435
  caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -569,6 +572,7 @@ export declare const Scenario: z.ZodObject<{
569
572
  type: z.ZodLiteral<"stream">;
570
573
  path: z.ZodString;
571
574
  value: z.ZodString;
575
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
572
576
  }, z.core.$strict>], "type">>>;
573
577
  ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
574
578
  shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -616,6 +620,7 @@ export declare const Scenario: z.ZodObject<{
616
620
  hold: z.ZodOptional<z.ZodNumber>;
617
621
  effectHold: z.ZodOptional<z.ZodNumber>;
618
622
  say: z.ZodOptional<z.ZodString>;
623
+ sayRole: z.ZodOptional<z.ZodString>;
619
624
  narrate: z.ZodOptional<z.ZodString>;
620
625
  source: z.ZodOptional<z.ZodString>;
621
626
  }, z.core.$strict>>>;
@@ -631,26 +636,6 @@ export declare const Route: z.ZodObject<{
631
636
  slots: z.ZodDefault<z.ZodArray<z.ZodString>>;
632
637
  source: z.ZodOptional<z.ZodString>;
633
638
  }, z.core.$strict>;
634
- export declare const Feature: z.ZodObject<{
635
- id: z.ZodString;
636
- name: z.ZodString;
637
- goal: z.ZodString;
638
- roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
639
- id: z.ZodOptional<z.ZodString>;
640
- name: z.ZodString;
641
- desc: z.ZodDefault<z.ZodString>;
642
- color: z.ZodString;
643
- }, z.core.$strict>>>;
644
- constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
645
- id: z.ZodString;
646
- text: z.ZodString;
647
- hard: z.ZodDefault<z.ZodBoolean>;
648
- }, z.core.$strict>>>;
649
- caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
650
- optionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
651
- pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
652
- source: z.ZodOptional<z.ZodString>;
653
- }, z.core.$strict>;
654
639
  export declare const Case: z.ZodObject<{
655
640
  id: z.ZodString;
656
641
  featureId: z.ZodString;
@@ -689,6 +674,46 @@ export declare const Coverage: z.ZodObject<{
689
674
  declared: "declared";
690
675
  }>>;
691
676
  }, z.core.$strict>;
677
+ /** 功能是作品之上的评审层;评审信息按作品 id 存放。 */
678
+ export declare const Feature: z.ZodObject<{
679
+ id: z.ZodString;
680
+ name: z.ZodString;
681
+ goal: z.ZodString;
682
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
683
+ id: z.ZodOptional<z.ZodString>;
684
+ name: z.ZodString;
685
+ desc: z.ZodDefault<z.ZodString>;
686
+ color: z.ZodString;
687
+ }, z.core.$strict>>>;
688
+ constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
689
+ id: z.ZodString;
690
+ text: z.ZodString;
691
+ hard: z.ZodDefault<z.ZodBoolean>;
692
+ }, z.core.$strict>>>;
693
+ caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
694
+ workIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
695
+ pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
696
+ alternatives: z.ZodRecord<z.ZodString, z.ZodObject<{
697
+ decisionFocus: z.ZodString;
698
+ tradeoffs: z.ZodArray<z.ZodString>;
699
+ coverage: z.ZodRecord<z.ZodString, z.ZodObject<{
700
+ status: z.ZodEnum<{
701
+ undecided: "undecided";
702
+ missing: "missing";
703
+ not_applicable: "not_applicable";
704
+ excluded: "excluded";
705
+ expressed: "expressed";
706
+ }>;
707
+ scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
708
+ reason: z.ZodOptional<z.ZodString>;
709
+ basis: z.ZodDefault<z.ZodEnum<{
710
+ derived: "derived";
711
+ declared: "declared";
712
+ }>>;
713
+ }, z.core.$strict>>;
714
+ }, z.core.$strict>>;
715
+ source: z.ZodOptional<z.ZodString>;
716
+ }, z.core.$strict>;
692
717
  export declare const FreeReaction: z.ZodObject<{
693
718
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
694
719
  type: z.ZodLiteral<"click">;
@@ -774,10 +799,12 @@ export declare const FreeReaction: z.ZodObject<{
774
799
  type: z.ZodLiteral<"stream">;
775
800
  path: z.ZodString;
776
801
  value: z.ZodString;
802
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
777
803
  }, z.core.$strict>], "type">>>;
778
804
  source: z.ZodOptional<z.ZodString>;
779
805
  }, z.core.$strict>;
780
- export declare const Option: z.ZodObject<{
806
+ export declare const Work: z.ZodObject<{
807
+ sequencing: z.ZodOptional<z.ZodLiteral<"linear">>;
781
808
  free: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
782
809
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
783
810
  type: z.ZodLiteral<"click">;
@@ -863,32 +890,24 @@ export declare const Option: z.ZodObject<{
863
890
  type: z.ZodLiteral<"stream">;
864
891
  path: z.ZodString;
865
892
  value: z.ZodString;
893
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
866
894
  }, z.core.$strict>], "type">>>;
867
895
  source: z.ZodOptional<z.ZodString>;
868
896
  }, z.core.$strict>>>;
869
897
  id: z.ZodString;
870
- featureId: z.ZodString;
898
+ featureId: z.ZodOptional<z.ZodString>;
871
899
  key: z.ZodString;
872
- name: z.ZodString;
873
- idea: z.ZodString;
874
- decisionFocus: z.ZodDefault<z.ZodString>;
875
- tradeoffs: z.ZodDefault<z.ZodArray<z.ZodString>>;
876
- routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
877
- coverage: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
878
- status: z.ZodEnum<{
879
- undecided: "undecided";
880
- missing: "missing";
881
- not_applicable: "not_applicable";
882
- excluded: "excluded";
883
- expressed: "expressed";
884
- }>;
885
- scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
886
- reason: z.ZodOptional<z.ZodString>;
887
- basis: z.ZodDefault<z.ZodEnum<{
888
- derived: "derived";
889
- declared: "declared";
890
- }>>;
900
+ title: z.ZodString;
901
+ summary: z.ZodString;
902
+ audience: z.ZodOptional<z.ZodString>;
903
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
904
+ id: z.ZodOptional<z.ZodString>;
905
+ name: z.ZodString;
906
+ desc: z.ZodDefault<z.ZodString>;
907
+ color: z.ZodString;
891
908
  }, z.core.$strict>>>;
909
+ draft: z.ZodOptional<z.ZodLiteral<true>>;
910
+ routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
892
911
  layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
893
912
  title: z.ZodString;
894
913
  sceneId: z.ZodString;
@@ -915,7 +934,7 @@ export declare const RULE_CONFIRMATIONS: readonly ["pending", "confirmed", "conf
915
934
  export declare const Rule: z.ZodObject<{
916
935
  id: z.ZodString;
917
936
  featureId: z.ZodString;
918
- optionId: z.ZodOptional<z.ZodString>;
937
+ workId: z.ZodOptional<z.ZodString>;
919
938
  text: z.ZodString;
920
939
  origin: z.ZodEnum<{
921
940
  user: "user";
@@ -938,7 +957,7 @@ export declare const Rule: z.ZodObject<{
938
957
  export declare const Issue: z.ZodObject<{
939
958
  id: z.ZodString;
940
959
  featureId: z.ZodString;
941
- optionId: z.ZodOptional<z.ZodString>;
960
+ workId: z.ZodOptional<z.ZodString>;
942
961
  text: z.ZodString;
943
962
  severity: z.ZodDefault<z.ZodEnum<{
944
963
  blocker: "blocker";
@@ -991,7 +1010,7 @@ export declare const AudioRegionSchema: z.ZodObject<{
991
1010
  channels: z.ZodNumber;
992
1011
  }, z.core.$strict>;
993
1012
  export declare const Project: z.ZodObject<{
994
- schemaVersion: z.ZodLiteral<2>;
1013
+ schemaVersion: z.ZodLiteral<3>;
995
1014
  name: z.ZodString;
996
1015
  description: z.ZodDefault<z.ZodString>;
997
1016
  theme: z.ZodDefault<z.ZodString>;
@@ -1077,6 +1096,15 @@ export declare const Project: z.ZodObject<{
1077
1096
  title: z.ZodString;
1078
1097
  version: z.ZodOptional<z.ZodString>;
1079
1098
  components: z.ZodRecord<z.ZodString, z.ZodObject<{
1099
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
1100
+ inspect: z.ZodOptional<z.ZodArray<z.ZodObject<{
1101
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
1102
+ props: z.ZodArray<z.ZodString>;
1103
+ join: z.ZodOptional<z.ZodString>;
1104
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
1105
+ flags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
1106
+ fallback: z.ZodOptional<z.ZodString>;
1107
+ }, z.core.$strict>>>;
1080
1108
  interactive: z.ZodOptional<z.ZodBoolean>;
1081
1109
  parent: z.ZodOptional<z.ZodString>;
1082
1110
  needsId: z.ZodOptional<z.ZodBoolean>;
@@ -1114,11 +1142,30 @@ export declare const Project: z.ZodObject<{
1114
1142
  hard: z.ZodDefault<z.ZodBoolean>;
1115
1143
  }, z.core.$strict>>>;
1116
1144
  caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1117
- optionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1145
+ workIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1118
1146
  pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1147
+ alternatives: z.ZodRecord<z.ZodString, z.ZodObject<{
1148
+ decisionFocus: z.ZodString;
1149
+ tradeoffs: z.ZodArray<z.ZodString>;
1150
+ coverage: z.ZodRecord<z.ZodString, z.ZodObject<{
1151
+ status: z.ZodEnum<{
1152
+ undecided: "undecided";
1153
+ missing: "missing";
1154
+ not_applicable: "not_applicable";
1155
+ excluded: "excluded";
1156
+ expressed: "expressed";
1157
+ }>;
1158
+ scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1159
+ reason: z.ZodOptional<z.ZodString>;
1160
+ basis: z.ZodDefault<z.ZodEnum<{
1161
+ derived: "derived";
1162
+ declared: "declared";
1163
+ }>>;
1164
+ }, z.core.$strict>>;
1165
+ }, z.core.$strict>>;
1119
1166
  source: z.ZodOptional<z.ZodString>;
1120
1167
  }, z.core.$strict>>>;
1121
- featureIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1168
+ entryIds: z.ZodArray<z.ZodString>;
1122
1169
  cases: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1123
1170
  id: z.ZodString;
1124
1171
  featureId: z.ZodString;
@@ -1141,7 +1188,8 @@ export declare const Project: z.ZodObject<{
1141
1188
  }>>;
1142
1189
  source: z.ZodOptional<z.ZodString>;
1143
1190
  }, z.core.$strict>>>;
1144
- options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1191
+ works: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1192
+ sequencing: z.ZodOptional<z.ZodLiteral<"linear">>;
1145
1193
  free: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1146
1194
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
1147
1195
  type: z.ZodLiteral<"click">;
@@ -1227,32 +1275,24 @@ export declare const Project: z.ZodObject<{
1227
1275
  type: z.ZodLiteral<"stream">;
1228
1276
  path: z.ZodString;
1229
1277
  value: z.ZodString;
1278
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
1230
1279
  }, z.core.$strict>], "type">>>;
1231
1280
  source: z.ZodOptional<z.ZodString>;
1232
1281
  }, z.core.$strict>>>;
1233
1282
  id: z.ZodString;
1234
- featureId: z.ZodString;
1283
+ featureId: z.ZodOptional<z.ZodString>;
1235
1284
  key: z.ZodString;
1236
- name: z.ZodString;
1237
- idea: z.ZodString;
1238
- decisionFocus: z.ZodDefault<z.ZodString>;
1239
- tradeoffs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1240
- routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
1241
- coverage: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1242
- status: z.ZodEnum<{
1243
- undecided: "undecided";
1244
- missing: "missing";
1245
- not_applicable: "not_applicable";
1246
- excluded: "excluded";
1247
- expressed: "expressed";
1248
- }>;
1249
- scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1250
- reason: z.ZodOptional<z.ZodString>;
1251
- basis: z.ZodDefault<z.ZodEnum<{
1252
- derived: "derived";
1253
- declared: "declared";
1254
- }>>;
1285
+ title: z.ZodString;
1286
+ summary: z.ZodString;
1287
+ audience: z.ZodOptional<z.ZodString>;
1288
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
1289
+ id: z.ZodOptional<z.ZodString>;
1290
+ name: z.ZodString;
1291
+ desc: z.ZodDefault<z.ZodString>;
1292
+ color: z.ZodString;
1255
1293
  }, z.core.$strict>>>;
1294
+ draft: z.ZodOptional<z.ZodLiteral<true>>;
1295
+ routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
1256
1296
  layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1257
1297
  title: z.ZodString;
1258
1298
  sceneId: z.ZodString;
@@ -1277,7 +1317,7 @@ export declare const Project: z.ZodObject<{
1277
1317
  rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1278
1318
  id: z.ZodString;
1279
1319
  featureId: z.ZodString;
1280
- optionId: z.ZodOptional<z.ZodString>;
1320
+ workId: z.ZodOptional<z.ZodString>;
1281
1321
  text: z.ZodString;
1282
1322
  origin: z.ZodEnum<{
1283
1323
  user: "user";
@@ -1298,7 +1338,7 @@ export declare const Project: z.ZodObject<{
1298
1338
  }, z.core.$strict>>>;
1299
1339
  scenes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1300
1340
  id: z.ZodString;
1301
- optionId: z.ZodNullable<z.ZodString>;
1341
+ workId: z.ZodNullable<z.ZodString>;
1302
1342
  route: z.ZodString;
1303
1343
  name: z.ZodString;
1304
1344
  viewport: z.ZodDefault<z.ZodEnum<{
@@ -1327,7 +1367,7 @@ export declare const Project: z.ZodObject<{
1327
1367
  }, z.core.$strict>>>;
1328
1368
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
1329
1369
  id: z.ZodString;
1330
- optionId: z.ZodString;
1370
+ workId: z.ZodString;
1331
1371
  name: z.ZodString;
1332
1372
  description: z.ZodDefault<z.ZodString>;
1333
1373
  caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -1470,6 +1510,7 @@ export declare const Project: z.ZodObject<{
1470
1510
  type: z.ZodLiteral<"stream">;
1471
1511
  path: z.ZodString;
1472
1512
  value: z.ZodString;
1513
+ pace: z.ZodOptional<z.ZodLiteral<"voice">>;
1473
1514
  }, z.core.$strict>], "type">>>;
1474
1515
  ruleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1475
1516
  shots: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1517,6 +1558,7 @@ export declare const Project: z.ZodObject<{
1517
1558
  hold: z.ZodOptional<z.ZodNumber>;
1518
1559
  effectHold: z.ZodOptional<z.ZodNumber>;
1519
1560
  say: z.ZodOptional<z.ZodString>;
1561
+ sayRole: z.ZodOptional<z.ZodString>;
1520
1562
  narrate: z.ZodOptional<z.ZodString>;
1521
1563
  source: z.ZodOptional<z.ZodString>;
1522
1564
  }, z.core.$strict>>>;
@@ -1526,7 +1568,7 @@ export declare const Project: z.ZodObject<{
1526
1568
  issues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1527
1569
  id: z.ZodString;
1528
1570
  featureId: z.ZodString;
1529
- optionId: z.ZodOptional<z.ZodString>;
1571
+ workId: z.ZodOptional<z.ZodString>;
1530
1572
  text: z.ZodString;
1531
1573
  severity: z.ZodDefault<z.ZodEnum<{
1532
1574
  blocker: "blocker";
@@ -1541,7 +1583,7 @@ export type Project = z.infer<typeof Project>;
1541
1583
  export type Route = z.infer<typeof Route>;
1542
1584
  export type Feature = z.infer<typeof Feature>;
1543
1585
  export type Case = z.infer<typeof Case>;
1544
- export type Option = z.infer<typeof Option>;
1586
+ export type Work = z.infer<typeof Work>;
1545
1587
  export type Coverage = z.infer<typeof Coverage>;
1546
1588
  export type Rule = z.infer<typeof Rule>;
1547
1589
  export type Issue = z.infer<typeof Issue>;
package/dist/schema.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ElementTraitsSchema } from "./traits.js";
1
+ import { ElementTraitsSchema, PluginInspectFieldSchema, PluginTextSchema } from "./traits.js";
2
2
  /**
3
- * Joplo IR(schemaVersion 2):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
3
+ * Joplo IR(schemaVersion 3):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
4
4
  * 权威源是项目文件夹里的 TSX/TS 文件(ADR-0002);渲染器、播放器、校验器、构建只消费这里的 IR。
5
5
  *
6
6
  * 带 `source` 的对象记录其来源 `相对路径:行:列`,用于选中元素、诊断定位,让 Agent 只读写那一处。
@@ -16,7 +16,7 @@ const ScopeRule = z.lazy(() => z.strictObject({
16
16
  }));
17
17
  const SlotSpec = z.strictObject({ text: z.array(DataPath).optional(), scope: z.union([z.literal('global'), z.array(ScopeRule)]).optional() });
18
18
  const DataSpec = z.strictObject({ node: SlotSpec.optional(), step: SlotSpec.optional() });
19
- export const SCHEMA_VERSION = 2;
19
+ export const SCHEMA_VERSION = 3;
20
20
  /** 作者可写的 ID(对象键、元素 id)。 */
21
21
  export const Id = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/, 'ID must start with a letter and contain only letters, digits, underscores, and hyphens');
22
22
  /** 编译器生成的限定 ID,例如 `invite.happy`、`invite.a-modal@/members`。 */
@@ -58,7 +58,7 @@ export const SceneNode = z.lazy(() => z.strictObject({
58
58
  export const Scene = z.strictObject({
59
59
  id: Qid,
60
60
  /** 方案上下文;`null` 表示发布视图(所有功能都取选定方案)。 */
61
- optionId: Qid.nullable(),
61
+ workId: Qid.nullable(),
62
62
  route: z.string().regex(/^\/[^\s]*$/),
63
63
  name: z.string().min(1),
64
64
  viewport: z.enum(['desktop', 'mobile']).default('desktop'),
@@ -95,7 +95,8 @@ export const Effect = z.discriminatedUnion('type', [
95
95
  z.strictObject({ type: z.literal('navigate'), sceneId: Qid }),
96
96
  z.strictObject({ type: z.literal('complete'), text: z.string().min(1), outcome: z.enum(['success', 'failure', 'cancelled']) }),
97
97
  /** 流式输出(D56):状态上等同 set;播放到这一步时绑定它的文字逐字出现。 */
98
- z.strictObject({ type: z.literal('stream'), path: StatePath, value: z.string() }),
98
+ /** pace: 'voice'(D100):新加的字跟着这一步的朗读出;没有时按模型输出的速度。 */
99
+ z.strictObject({ type: z.literal('stream'), path: StatePath, value: z.string(), pace: z.literal('voice').optional() }),
99
100
  ]);
100
101
  /** 镜头(D43):这一步在某个层级里对准哪些元素;targets 为空 = 这一层的整体。 */
101
102
  export const Shot = z.strictObject({ layer: z.string().min(1), targets: z.array(z.string().min(1)) });
@@ -156,6 +157,8 @@ export const Step = z.strictObject({
156
157
  effectHold: z.number().int().positive().max(60_000).optional(),
157
158
  /** 角色台词(D74,来自 say(),多个按空格连接):用这一步角色的声音读;没有时省略。发布站保留。 */
158
159
  say: z.string().min(1).optional(),
160
+ /** 台词是谁说的(D100,来自 say(…, { role }),feature.roles 的键):优先于“操作步骤取导演层的角色”;没有时省略。 */
161
+ sayRole: z.string().min(1).optional(),
159
162
  /** 旁白(D74,来自 narrate()):用旁白的声音读,优先于台词和字幕;没有时省略。发布站保留。 */
160
163
  narrate: z.string().min(1).optional(),
161
164
  source: Source,
@@ -170,7 +173,7 @@ export const Scenario = z.strictObject({
170
173
  media: MediaSnapshot.optional(),
171
174
  ext: z.record(z.string(), Json).optional(),
172
175
  id: Qid,
173
- optionId: Qid,
176
+ workId: Qid,
174
177
  name: z.string().min(1),
175
178
  description: z.string().default(''),
176
179
  caseIds: z.array(Qid).default([]),
@@ -199,19 +202,6 @@ export const Route = z.strictObject({
199
202
  slots: z.array(z.string()).default([]),
200
203
  source: Source,
201
204
  });
202
- export const Feature = z.strictObject({
203
- id: Id,
204
- name: z.string().min(1),
205
- goal: z.string().min(1),
206
- /** 角色(D56):id 来自 { 键: role('名字') } 写法,可被层级和过渡卡引用;旧的名字数组没有 id。color 已按顺序补齐。 */
207
- roles: z.array(z.strictObject({ id: Id.optional(), name: z.string().min(1), desc: z.string().default(''), color: z.string().min(1) })).default([]),
208
- constraints: z.array(z.strictObject({ id: Id, text: z.string().min(1), hard: z.boolean().default(false) })).default([]),
209
- caseIds: z.array(Qid).default([]),
210
- optionIds: z.array(Qid).default([]),
211
- /** 选定的方案;build 只发布它。 */
212
- pick: Qid.nullable().default(null),
213
- source: Source,
214
- });
215
205
  export const Case = z.strictObject({
216
206
  id: Qid,
217
207
  featureId: Id,
@@ -229,20 +219,46 @@ export const Coverage = z.strictObject({
229
219
  /** derived = 编译器根据场景推导;declared = 作者在源文件中声明。 */
230
220
  basis: z.enum(['derived', 'declared']).default('declared'),
231
221
  });
222
+ /** 功能是作品之上的评审层;评审信息按作品 id 存放。 */
223
+ export const Feature = z.strictObject({
224
+ id: Id,
225
+ name: z.string().min(1),
226
+ goal: z.string().min(1),
227
+ /** 角色(D56):id 来自 { 键: role('名字') } 写法,可被层级和过渡卡引用;旧的名字数组没有 id。color 已按顺序补齐。 */
228
+ roles: z.array(z.strictObject({ id: Id.optional(), name: z.string().min(1), desc: z.string().default(''), color: z.string().min(1) })).default([]),
229
+ constraints: z.array(z.strictObject({ id: Id, text: z.string().min(1), hard: z.boolean().default(false) })).default([]),
230
+ caseIds: z.array(Qid).default([]),
231
+ workIds: z.array(Qid).default([]),
232
+ /** 选定的方案;build 只发布它。 */
233
+ pick: Qid.nullable().default(null),
234
+ alternatives: z.record(Qid, z.strictObject({
235
+ decisionFocus: z.string(),
236
+ tradeoffs: z.array(z.string()),
237
+ coverage: z.record(Qid, Coverage),
238
+ })),
239
+ source: Source,
240
+ }).superRefine((f, ctx) => {
241
+ const keys = Object.keys(f.alternatives);
242
+ if (new Set(f.workIds).size !== f.workIds.length || keys.length !== f.workIds.length || keys.some(id => !f.workIds.includes(id)))
243
+ ctx.addIssue({ code: 'custom', path: ['alternatives'], message: 'alternatives must list every workId exactly once' });
244
+ });
232
245
  export const FreeReaction = z.strictObject({ action: Action, effects: z.array(Effect).default([]), source: Source });
233
- export const Option = z.strictObject({
246
+ export const Work = z.strictObject({
247
+ /** 共享切片解析器在全部切片使用 chapter() 时写入;Entry.sequencing 消费,公开保留;缺省 independent。 */
248
+ sequencing: z.literal('linear').optional(),
234
249
  free: z.record(Id, FreeReaction).optional(),
235
250
  id: Qid,
236
- featureId: Id,
251
+ featureId: Id.optional(),
237
252
  /** 文件名,例如 `a-modal`。 */
238
253
  key: Id,
239
- name: z.string().min(1),
240
- idea: z.string().min(1),
241
- decisionFocus: z.string().default(''),
242
- tradeoffs: z.array(z.string()).default([]),
254
+ title: z.string().min(1),
255
+ summary: z.string().min(1),
256
+ audience: z.string().min(1).optional(),
257
+ /** 独立作品声明角色;功能下面的作品保持为空,通过 rolesOf 继承功能角色。 */
258
+ roles: Feature.shape.roles,
259
+ draft: z.literal(true).optional(),
243
260
  /** 该方案触及的路径(堆叠或新增)。 */
244
261
  routes: z.array(z.string()).default([]),
245
- coverage: z.record(Qid, Coverage).default({}),
246
262
  /** 层级(视角):键 → 标题与这一层自己的画面(完全独立的页面)。演示信息,发布站保留。 */
247
263
  /** icon:作者显式选的预设图标(层级标签用);不写时由 layersOf 按视口补默认。 */
248
264
  layers: z.record(Id, z.strictObject({ title: z.string().min(1), sceneId: Qid, role: Id.optional(), icon: z.enum(LAYER_ICONS).optional() })).default({}),
@@ -253,7 +269,7 @@ export const RULE_CONFIRMATIONS = ['pending', 'confirmed', 'conflict', 'out_of_s
253
269
  export const Rule = z.strictObject({
254
270
  id: Qid,
255
271
  featureId: Id,
256
- optionId: Qid.optional(),
272
+ workId: Qid.optional(),
257
273
  text: z.string().min(1),
258
274
  origin: z.enum(RULE_ORIGINS),
259
275
  confirmation: z.enum(RULE_CONFIRMATIONS).default('pending'),
@@ -266,7 +282,7 @@ export const Rule = z.strictObject({
266
282
  export const Issue = z.strictObject({
267
283
  id: Qid,
268
284
  featureId: Id,
269
- optionId: Qid.optional(),
285
+ workId: Qid.optional(),
270
286
  text: z.string().min(1),
271
287
  severity: z.enum(['blocker', 'major', 'minor']).default('major'),
272
288
  refs: z.array(z.string()).default([]),
@@ -330,7 +346,7 @@ export const Project = z.strictObject({
330
346
  id: z.string().min(1),
331
347
  title: z.string(),
332
348
  version: z.string().optional(),
333
- components: z.record(z.string(), z.strictObject({ interactive: z.boolean().optional(), parent: z.string().optional(), needsId: z.boolean().optional(), selfEvident: z.boolean().optional(), traits: ElementTraitsSchema.optional() })),
349
+ components: z.record(z.string(), z.strictObject({ label: PluginTextSchema.optional(), inspect: z.array(PluginInspectFieldSchema).optional(), interactive: z.boolean().optional(), parent: z.string().optional(), needsId: z.boolean().optional(), selfEvident: z.boolean().optional(), traits: ElementTraitsSchema.optional() })),
334
350
  })).optional(),
335
351
  /** 作者主题(D51):主题名 → CSS 原文(themes/<name>.css);渲染时自动限定在舞台范围内。发布站同样打包。 */
336
352
  themes: z.record(z.string(), z.string()).default({}),
@@ -338,18 +354,17 @@ export const Project = z.strictObject({
338
354
  mode: z.enum(['dev', 'publish', 'review']),
339
355
  routes: z.record(z.string(), Route).default({}),
340
356
  features: z.record(Id, Feature).default({}),
341
- /** 编译器决定的演示顺序,发布时保留。旧 IR 可省略,读取时沿用其已有顺序。 */
342
- featureIds: z.array(Id).optional(),
357
+ /** 编译器决定的条目顺序,发布时保留;每个条目恰好一次。 */
358
+ entryIds: z.array(Id),
343
359
  cases: z.record(Qid, Case).default({}),
344
- options: z.record(Qid, Option).default({}),
360
+ works: z.record(Qid, Work).default({}),
345
361
  rules: z.record(Qid, Rule).default({}),
346
362
  scenes: z.record(Qid, Scene).default({}),
347
363
  scenarios: z.record(Qid, Scenario).default({}),
348
364
  issues: z.record(Qid, Issue).default({}),
349
365
  }).superRefine((p, ctx) => {
350
- if (!p.featureIds)
351
- return;
352
- const ids = new Set(p.featureIds);
353
- if (ids.size !== p.featureIds.length || ids.size !== Object.keys(p.features).length || p.featureIds.some(id => !p.features[id]))
354
- ctx.addIssue({ code: 'custom', path: ['featureIds'], message: 'featureIds must list every feature exactly once' });
366
+ const entries = [...Object.keys(p.features), ...Object.values(p.works).filter(w => !w.featureId).map(w => w.id)];
367
+ const ids = new Set(p.entryIds);
368
+ if (ids.size !== p.entryIds.length || ids.size !== entries.length || entries.some(id => !ids.has(id)))
369
+ ctx.addIssue({ code: 'custom', path: ['entryIds'], message: 'entryIds must list every entry exactly once' });
355
370
  });
package/dist/scope.d.ts CHANGED
@@ -1,26 +1,26 @@
1
1
  import type { Project, Step } from './schema.js';
2
- /** 作者要分享的范围:场景 id 与功能 id(功能 = 这个功能选定方案的全部场景;评审版是全部方案的场景)。 */
2
+ /** 作者要分享的范围:场景 id 与首页条目 id(功能取选定作品;评审版取全部作品;独立作品取自身)。 */
3
3
  export type ScopeRequest = {
4
4
  scenarios?: readonly string[];
5
- features?: readonly string[];
5
+ entryIds?: readonly string[];
6
6
  };
7
7
  /** publish = 只发布选定方案;review = 评审版(全部方案)。 */
8
8
  export type ScopeMode = 'publish' | 'review';
9
9
  /** 因为被范围内步骤引用而带上的别的功能的内容(只给作者看:终端输出、看板浮层,不进分享)。 */
10
10
  export type ScopeBorrowed = {
11
11
  kind: 'element';
12
- featureId: string;
13
- featureName: string;
14
- optionId: string;
12
+ entryId: string;
13
+ entryTitle: string;
14
+ workId: string;
15
15
  elementId: string;
16
16
  route: string;
17
17
  refs: string[];
18
18
  scenarios: string[];
19
19
  } | {
20
20
  kind: 'page';
21
- featureId: string;
22
- featureName: string;
23
- optionId: string;
21
+ entryId: string;
22
+ entryTitle: string;
23
+ workId: string;
24
24
  route: string;
25
25
  scenarios: string[];
26
26
  };
@@ -28,7 +28,7 @@ export type ScopeInfo = {
28
28
  /** `.joplo/cloud.json` 里这个范围的键:排序后的场景 id,用逗号连接;评审版前缀 `review:`。 */
29
29
  key: string;
30
30
  scenarios: string[];
31
- features: string[];
31
+ entryIds: string[];
32
32
  borrowed: ScopeBorrowed[];
33
33
  };
34
34
  export declare const hasScope: (r: ScopeRequest | undefined) => r is ScopeRequest;