@plasius/learning 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20,10 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ JUNIOR_CODER_MISSION_STAGE_ORDER_V1: () => JUNIOR_CODER_MISSION_STAGE_ORDER_V1,
24
+ JUNIOR_CODER_MODULE_PRICE_V1_1: () => JUNIOR_CODER_MODULE_PRICE_V1_1,
25
+ JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT: () => JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT,
23
26
  JUNIOR_CODER_ROBOT_RESCUE_PATH_V1: () => JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
27
+ JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1: () => JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1,
28
+ MISSION_AUTHORING_CONTRACT_VERSION_V1: () => MISSION_AUTHORING_CONTRACT_VERSION_V1,
29
+ ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1: () => ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1,
24
30
  assertValidLearningPath: () => assertValidLearningPath,
31
+ assertValidMissionAuthoringBundle: () => assertValidMissionAuthoringBundle,
25
32
  calculateAssessment: () => calculateAssessment,
26
- validateLearningPath: () => validateLearningPath
33
+ validateAssessmentRubric: () => validateAssessmentRubric,
34
+ validateLearningPath: () => validateLearningPath,
35
+ validateMissionAuthoringBundle: () => validateMissionAuthoringBundle
27
36
  });
28
37
  module.exports = __toCommonJS(index_exports);
29
38
 
@@ -561,6 +570,15 @@ var modules = [
561
570
  missionTitles: ["Build the Control Panel", "Simulate Telemetry", "Add Stop Confirmations", "Mission Control Challenge"]
562
571
  })
563
572
  ];
573
+ var JUNIOR_CODER_MODULE_PRICE_V1_1 = Object.freeze({
574
+ tokenSubunits: "50000",
575
+ referencePrice: Object.freeze({
576
+ currency: "GBP",
577
+ minorUnits: "500",
578
+ basis: "nominal-reference",
579
+ cashRedemptionAllowed: false
580
+ })
581
+ });
564
582
  var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1 = {
565
583
  id: "junior-coder.robot-rescue-arcade",
566
584
  slug: "robot-rescue-arcade",
@@ -572,14 +590,734 @@ var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1 = {
572
590
  featureFlag: "learning.junior-coder.catalog.enabled",
573
591
  modules
574
592
  };
593
+ var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1 = {
594
+ ...JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
595
+ version: "1.1.0",
596
+ modules: JUNIOR_CODER_ROBOT_RESCUE_PATH_V1.modules.map((entry) => ({
597
+ ...entry,
598
+ version: "1.1.0",
599
+ contentRevision: "2026-07-28.1",
600
+ pricing: {
601
+ ...entry.pricing,
602
+ tokenSubunits: JUNIOR_CODER_MODULE_PRICE_V1_1.tokenSubunits,
603
+ referencePrice: JUNIOR_CODER_MODULE_PRICE_V1_1.referencePrice
604
+ }
605
+ }))
606
+ };
607
+ var JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT = JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1;
575
608
 
576
- // src/validation.ts
609
+ // src/contracts.ts
610
+ var MISSION_AUTHORING_CONTRACT_VERSION_V1 = "1.0.0";
611
+
612
+ // src/rubric-validation.ts
577
613
  var DIMENSION_TOTALS = {
578
614
  structure: 20,
579
615
  behaviour: 50,
580
616
  resilience: 20,
581
617
  safety: 10
582
618
  };
619
+ function rubricIssue(code, message, path, moduleId) {
620
+ return { code, message, path, ...moduleId ? { moduleId } : {} };
621
+ }
622
+ function validateAssessmentRubric(rubric2, path = "assessment", moduleId) {
623
+ const issues = [];
624
+ const criterionIds = /* @__PURE__ */ new Set();
625
+ const dimensionTotals = {
626
+ structure: 0,
627
+ behaviour: 0,
628
+ resilience: 0,
629
+ safety: 0
630
+ };
631
+ let rubricTotal = 0;
632
+ for (const criterion of rubric2.criteria) {
633
+ rubricTotal += criterion.points;
634
+ dimensionTotals[criterion.dimension] += criterion.points;
635
+ if (criterionIds.has(criterion.id)) {
636
+ issues.push(
637
+ rubricIssue(
638
+ "duplicate-criterion-id",
639
+ `Duplicate assessment criterion ${criterion.id}.`,
640
+ `${path}.criteria`,
641
+ moduleId
642
+ )
643
+ );
644
+ }
645
+ criterionIds.add(criterion.id);
646
+ }
647
+ if (rubricTotal !== 100) {
648
+ issues.push(
649
+ rubricIssue(
650
+ "rubric-total",
651
+ `Assessment rubric totals ${rubricTotal}; expected 100.`,
652
+ `${path}.criteria`,
653
+ moduleId
654
+ )
655
+ );
656
+ }
657
+ for (const [dimension, expected] of Object.entries(DIMENSION_TOTALS)) {
658
+ if (dimensionTotals[dimension] !== expected) {
659
+ issues.push(
660
+ rubricIssue(
661
+ "rubric-dimension-total",
662
+ `${dimension} criteria total ${dimensionTotals[dimension]}; expected ${expected}.`,
663
+ `${path}.criteria`,
664
+ moduleId
665
+ )
666
+ );
667
+ }
668
+ }
669
+ if (!rubric2.criteria.some(
670
+ (criterion) => criterion.dimension === "safety" && criterion.mandatory
671
+ )) {
672
+ issues.push(
673
+ rubricIssue(
674
+ "missing-mandatory-safety",
675
+ "Every module requires a mandatory safety criterion.",
676
+ `${path}.criteria`,
677
+ moduleId
678
+ )
679
+ );
680
+ }
681
+ return issues;
682
+ }
683
+
684
+ // src/mission-authoring.ts
685
+ var JUNIOR_CODER_MISSION_STAGE_ORDER_V1 = [
686
+ "learn",
687
+ "predict",
688
+ "build",
689
+ "run",
690
+ "assess",
691
+ "inspect",
692
+ "fix",
693
+ "explain",
694
+ "reward"
695
+ ];
696
+ var LEARNER_STARTER_KINDS = /* @__PURE__ */ new Set([
697
+ "starter-code",
698
+ "starter-assets",
699
+ "sample-data"
700
+ ]);
701
+ var LEARNER_FORBIDDEN_KINDS = /* @__PURE__ */ new Set([
702
+ "facilitator-note",
703
+ "answer-key",
704
+ "protected-test"
705
+ ]);
706
+ var SINGLE_MODE_REQUIRES_ALTERNATIVE = /* @__PURE__ */ new Set([
707
+ "pointer",
708
+ "drag",
709
+ "audio",
710
+ "colour",
711
+ "motion"
712
+ ]);
713
+ function authoringIssue(code, message, path) {
714
+ return { code, message, path };
715
+ }
716
+ function reportDuplicateIds(ids, path) {
717
+ const seen = /* @__PURE__ */ new Set();
718
+ const issues = [];
719
+ for (const id of ids) {
720
+ if (seen.has(id)) {
721
+ issues.push(
722
+ authoringIssue("duplicate-id", `Duplicate authored ID ${id}.`, path)
723
+ );
724
+ }
725
+ seen.add(id);
726
+ }
727
+ return issues;
728
+ }
729
+ function validateMissionAuthoringBundle(bundle, module3) {
730
+ const issues = [];
731
+ if (bundle.version !== MISSION_AUTHORING_CONTRACT_VERSION_V1) {
732
+ issues.push(
733
+ authoringIssue(
734
+ "bundle-version-mismatch",
735
+ `Unsupported mission authoring version ${bundle.version}.`,
736
+ "version"
737
+ )
738
+ );
739
+ }
740
+ if (bundle.moduleId !== module3.id || bundle.moduleVersion !== module3.version) {
741
+ issues.push(
742
+ authoringIssue(
743
+ "module-reference-mismatch",
744
+ `Bundle ${bundle.moduleId}@${bundle.moduleVersion} does not match ${module3.id}@${module3.version}.`,
745
+ "moduleId"
746
+ )
747
+ );
748
+ }
749
+ if (!module3.missions.some((mission2) => mission2.id === bundle.missionId)) {
750
+ issues.push(
751
+ authoringIssue(
752
+ "mission-reference-mismatch",
753
+ `Mission ${bundle.missionId} does not exist in module ${module3.id}.`,
754
+ "missionId"
755
+ )
756
+ );
757
+ }
758
+ const learner = bundle.learner;
759
+ const facilitator = bundle.facilitator;
760
+ if (learner.estimatedMinutes < 15 || learner.estimatedMinutes > 25) {
761
+ issues.push(
762
+ authoringIssue(
763
+ "invalid-duration",
764
+ "A mission must last between 15 and 25 minutes.",
765
+ "learner.estimatedMinutes"
766
+ )
767
+ );
768
+ }
769
+ const stageKinds = learner.stages.map((stage) => stage.kind);
770
+ for (const requiredStage of JUNIOR_CODER_MISSION_STAGE_ORDER_V1) {
771
+ const count = stageKinds.filter((stage) => stage === requiredStage).length;
772
+ if (count === 0) {
773
+ issues.push(
774
+ authoringIssue(
775
+ "missing-stage",
776
+ `Mission stage ${requiredStage} is required.`,
777
+ "learner.stages"
778
+ )
779
+ );
780
+ } else if (count > 1) {
781
+ issues.push(
782
+ authoringIssue(
783
+ "duplicate-stage",
784
+ `Mission stage ${requiredStage} appears more than once.`,
785
+ "learner.stages"
786
+ )
787
+ );
788
+ }
789
+ }
790
+ if (stageKinds.length === JUNIOR_CODER_MISSION_STAGE_ORDER_V1.length && stageKinds.some(
791
+ (stage, index) => stage !== JUNIOR_CODER_MISSION_STAGE_ORDER_V1[index]
792
+ )) {
793
+ issues.push(
794
+ authoringIssue(
795
+ "stage-order",
796
+ "Mission stages must follow the canonical learner journey.",
797
+ "learner.stages"
798
+ )
799
+ );
800
+ }
801
+ if (learner.readinessChecks.length === 0) {
802
+ issues.push(
803
+ authoringIssue(
804
+ "missing-readiness-check",
805
+ "At least one unscored readiness check is required.",
806
+ "learner.readinessChecks"
807
+ )
808
+ );
809
+ }
810
+ if (learner.readinessChecks.some((check) => check.scored !== false)) {
811
+ issues.push(
812
+ authoringIssue(
813
+ "scored-readiness-check",
814
+ "Readiness checks must not affect the deterministic score.",
815
+ "learner.readinessChecks"
816
+ )
817
+ );
818
+ }
819
+ issues.push(
820
+ ...reportDuplicateIds(
821
+ learner.readinessChecks.map((check) => check.id),
822
+ "learner.readinessChecks"
823
+ )
824
+ );
825
+ const learnerArtifactIds = new Set(learner.artifacts.map((artifact) => artifact.id));
826
+ if (!learner.artifacts.some((artifact) => LEARNER_STARTER_KINDS.has(artifact.kind))) {
827
+ issues.push(
828
+ authoringIssue(
829
+ "missing-starter-artifact",
830
+ "At least one learner-safe starter artifact is required.",
831
+ "learner.artifacts"
832
+ )
833
+ );
834
+ }
835
+ if (learner.artifacts.some(
836
+ (artifact) => artifact.audience !== "learner" || artifact.solutionBearing || LEARNER_FORBIDDEN_KINDS.has(artifact.kind)
837
+ )) {
838
+ issues.push(
839
+ authoringIssue(
840
+ "learner-artifact-leak",
841
+ "Learner artifacts cannot contain facilitator or solution-bearing content.",
842
+ "learner.artifacts"
843
+ )
844
+ );
845
+ }
846
+ if (facilitator.artifacts.some((artifact) => artifact.audience !== "facilitator")) {
847
+ issues.push(
848
+ authoringIssue(
849
+ "facilitator-artifact-leak",
850
+ "Facilitator artifacts must remain in the facilitator projection.",
851
+ "facilitator.artifacts"
852
+ )
853
+ );
854
+ }
855
+ issues.push(
856
+ ...reportDuplicateIds(
857
+ [...learner.artifacts, ...facilitator.artifacts].map((artifact) => artifact.id),
858
+ "artifacts"
859
+ )
860
+ );
861
+ for (const [stageIndex, stage] of learner.stages.entries()) {
862
+ for (const artifactId of stage.artifactIds) {
863
+ if (!learnerArtifactIds.has(artifactId)) {
864
+ issues.push(
865
+ authoringIssue(
866
+ "unknown-artifact",
867
+ `Stage references unknown learner artifact ${artifactId}.`,
868
+ `learner.stages[${stageIndex}].artifactIds`
869
+ )
870
+ );
871
+ }
872
+ }
873
+ }
874
+ if (learner.goals.length === 0) {
875
+ issues.push(
876
+ authoringIssue(
877
+ "missing-visible-goal",
878
+ "At least one visible learner goal is required.",
879
+ "learner.goals"
880
+ )
881
+ );
882
+ }
883
+ if (facilitator.protectedGoals.length === 0) {
884
+ issues.push(
885
+ authoringIssue(
886
+ "missing-protected-goal",
887
+ "At least one protected facilitator goal is required.",
888
+ "facilitator.protectedGoals"
889
+ )
890
+ );
891
+ }
892
+ const allGoals = [...learner.goals, ...facilitator.protectedGoals];
893
+ const learnerGoalIds = new Set(learner.goals.map((goal) => goal.id));
894
+ const seenGoalIds = /* @__PURE__ */ new Set();
895
+ for (const goal of allGoals) {
896
+ if (seenGoalIds.has(goal.id)) {
897
+ issues.push(
898
+ authoringIssue(
899
+ "duplicate-goal-id",
900
+ `Duplicate goal ID ${goal.id}.`,
901
+ "goals"
902
+ )
903
+ );
904
+ }
905
+ seenGoalIds.add(goal.id);
906
+ }
907
+ if (learner.goals.some((goal) => goal.visibility !== "visible") || facilitator.protectedGoals.some(
908
+ (goal) => goal.visibility !== "protected" || goal.completionRequired
909
+ )) {
910
+ issues.push(
911
+ authoringIssue(
912
+ "invalid-goal-projection",
913
+ "Visible goals belong to learners and protected goals to facilitators.",
914
+ "goals"
915
+ )
916
+ );
917
+ }
918
+ const criterionById = new Map(
919
+ module3.assessment.criteria.map((criterion) => [criterion.id, criterion])
920
+ );
921
+ for (const goal of allGoals) {
922
+ if (goal.criterionIds.length === 0) {
923
+ issues.push(
924
+ authoringIssue(
925
+ "unknown-criterion",
926
+ `Goal ${goal.id} must reference a deterministic criterion.`,
927
+ "goals"
928
+ )
929
+ );
930
+ }
931
+ for (const criterionId of goal.criterionIds) {
932
+ const criterion = criterionById.get(criterionId);
933
+ if (!criterion) {
934
+ issues.push(
935
+ authoringIssue(
936
+ "unknown-criterion",
937
+ `Goal ${goal.id} references unknown criterion ${criterionId}.`,
938
+ "goals"
939
+ )
940
+ );
941
+ } else if (criterion.visibility !== goal.visibility) {
942
+ issues.push(
943
+ authoringIssue(
944
+ "criterion-visibility-mismatch",
945
+ `Goal ${goal.id} cannot expose a ${criterion.visibility} criterion as ${goal.visibility}.`,
946
+ "goals"
947
+ )
948
+ );
949
+ }
950
+ }
951
+ if (goal.completionRequired && goal.aiRequired) {
952
+ issues.push(
953
+ authoringIssue(
954
+ "ai-dependent-completion",
955
+ `Completion goal ${goal.id} cannot require AI.`,
956
+ "goals"
957
+ )
958
+ );
959
+ }
960
+ }
961
+ for (const rubricIssue2 of validateAssessmentRubric(module3.assessment)) {
962
+ if (rubricIssue2.code === "rubric-total" || rubricIssue2.code === "rubric-dimension-total" || rubricIssue2.code === "duplicate-criterion-id" || rubricIssue2.code === "missing-mandatory-safety") {
963
+ issues.push(
964
+ authoringIssue(rubricIssue2.code, rubricIssue2.message, rubricIssue2.path)
965
+ );
966
+ }
967
+ }
968
+ const alternativeById = new Map(
969
+ learner.accessibilityAlternatives.map((alternative) => [alternative.id, alternative])
970
+ );
971
+ issues.push(
972
+ ...reportDuplicateIds(
973
+ learner.interactions.map((interaction) => interaction.id),
974
+ "learner.interactions"
975
+ ),
976
+ ...reportDuplicateIds(
977
+ learner.accessibilityAlternatives.map((alternative) => alternative.id),
978
+ "learner.accessibilityAlternatives"
979
+ )
980
+ );
981
+ for (const [interactionIndex, interaction] of learner.interactions.entries()) {
982
+ if (SINGLE_MODE_REQUIRES_ALTERNATIVE.has(interaction.primaryMode) && interaction.alternativeIds.length === 0) {
983
+ issues.push(
984
+ authoringIssue(
985
+ "inaccessible-interaction",
986
+ `Interaction ${interaction.id} requires an equivalent alternative.`,
987
+ `learner.interactions[${interactionIndex}]`
988
+ )
989
+ );
990
+ }
991
+ for (const alternativeId of interaction.alternativeIds) {
992
+ const alternative = alternativeById.get(alternativeId);
993
+ if (!alternative) {
994
+ issues.push(
995
+ authoringIssue(
996
+ "unknown-accessibility-alternative",
997
+ `Interaction ${interaction.id} references unknown alternative ${alternativeId}.`,
998
+ `learner.interactions[${interactionIndex}].alternativeIds`
999
+ )
1000
+ );
1001
+ } else if (alternative.equivalentOutcome !== true || alternative.modes.length === 0 || alternative.modes.every((mode) => mode === interaction.primaryMode)) {
1002
+ issues.push(
1003
+ authoringIssue(
1004
+ "non-equivalent-accessibility-alternative",
1005
+ `Alternative ${alternativeId} must provide an equivalent outcome through another mode.`,
1006
+ "learner.accessibilityAlternatives"
1007
+ )
1008
+ );
1009
+ }
1010
+ }
1011
+ }
1012
+ if (learner.evidenceRequirements.length === 0) {
1013
+ issues.push(
1014
+ authoringIssue(
1015
+ "missing-evidence",
1016
+ "At least one evidence requirement is required.",
1017
+ "learner.evidenceRequirements"
1018
+ )
1019
+ );
1020
+ }
1021
+ issues.push(
1022
+ ...reportDuplicateIds(
1023
+ learner.evidenceRequirements.map((evidence) => evidence.id),
1024
+ "learner.evidenceRequirements"
1025
+ )
1026
+ );
1027
+ for (const [evidenceIndex, evidence] of learner.evidenceRequirements.entries()) {
1028
+ if (evidence.containsPersonalData !== false) {
1029
+ issues.push(
1030
+ authoringIssue(
1031
+ "personal-data-evidence",
1032
+ "Mission evidence cannot request personal data.",
1033
+ `learner.evidenceRequirements[${evidenceIndex}]`
1034
+ )
1035
+ );
1036
+ }
1037
+ for (const goalId of evidence.goalIds) {
1038
+ if (!learnerGoalIds.has(goalId)) {
1039
+ issues.push(
1040
+ authoringIssue(
1041
+ "unknown-evidence-goal",
1042
+ `Evidence references unknown goal ${goalId}.`,
1043
+ `learner.evidenceRequirements[${evidenceIndex}].goalIds`
1044
+ )
1045
+ );
1046
+ }
1047
+ }
1048
+ }
1049
+ for (const goal of learner.goals.filter((entry) => entry.completionRequired)) {
1050
+ if (!learner.evidenceRequirements.some((evidence) => evidence.goalIds.includes(goal.id))) {
1051
+ issues.push(
1052
+ authoringIssue(
1053
+ "missing-evidence",
1054
+ `Completion goal ${goal.id} requires deterministic evidence.`,
1055
+ "learner.evidenceRequirements"
1056
+ )
1057
+ );
1058
+ }
1059
+ }
1060
+ const mandatorySafetyGoals = learner.goals.filter(
1061
+ (goal) => goal.completionRequired && goal.criterionIds.some((criterionId) => {
1062
+ const criterion = criterionById.get(criterionId);
1063
+ return criterion?.dimension === "safety" && criterion.mandatory;
1064
+ })
1065
+ );
1066
+ if (mandatorySafetyGoals.length === 0 || !mandatorySafetyGoals.some(
1067
+ (goal) => learner.evidenceRequirements.some((evidence) => evidence.goalIds.includes(goal.id))
1068
+ )) {
1069
+ issues.push(
1070
+ authoringIssue(
1071
+ "missing-safety-evidence",
1072
+ "A completion-required goal must evidence a mandatory safety criterion.",
1073
+ "learner.evidenceRequirements"
1074
+ )
1075
+ );
1076
+ }
1077
+ issues.push(
1078
+ ...reportDuplicateIds(
1079
+ learner.sideAdventures.map((adventure) => adventure.id),
1080
+ "learner.sideAdventures"
1081
+ )
1082
+ );
1083
+ if (learner.sideAdventures.length === 0) {
1084
+ issues.push(
1085
+ authoringIssue(
1086
+ "missing-side-adventure",
1087
+ "At least one optional side adventure is required.",
1088
+ "learner.sideAdventures"
1089
+ )
1090
+ );
1091
+ }
1092
+ if (learner.sideAdventures.some((adventure) => adventure.completionRequired !== false)) {
1093
+ issues.push(
1094
+ authoringIssue(
1095
+ "mandatory-side-adventure",
1096
+ "Side adventures must remain optional.",
1097
+ "learner.sideAdventures"
1098
+ )
1099
+ );
1100
+ }
1101
+ const badgeIds = new Set(module3.badges.map((badge) => badge.id));
1102
+ issues.push(
1103
+ ...reportDuplicateIds(
1104
+ learner.rewardBindings.map((reward) => reward.id),
1105
+ "learner.rewardBindings"
1106
+ )
1107
+ );
1108
+ for (const [rewardIndex, reward] of learner.rewardBindings.entries()) {
1109
+ const rewardInvalid = reward.deterministic !== true || reward.random !== false || reward.tokenConvertible !== false || reward.goalIds.length === 0 || !badgeIds.has(reward.badgeId) || reward.goalIds.some((goalId) => !learnerGoalIds.has(goalId));
1110
+ if (rewardInvalid) {
1111
+ issues.push(
1112
+ authoringIssue(
1113
+ "invalid-reward",
1114
+ `Reward ${reward.id} must be deterministic, evidence-bound and non-convertible.`,
1115
+ `learner.rewardBindings[${rewardIndex}]`
1116
+ )
1117
+ );
1118
+ }
1119
+ }
1120
+ return issues;
1121
+ }
1122
+ function assertValidMissionAuthoringBundle(bundle, module3) {
1123
+ const issues = validateMissionAuthoringBundle(bundle, module3);
1124
+ if (issues.length === 0) return;
1125
+ const summary = issues.map((entry) => `${entry.code} at ${entry.path}: ${entry.message}`).join("\n");
1126
+ throw new Error(`Invalid mission authoring bundle:
1127
+ ${summary}`);
1128
+ }
1129
+ var ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1 = {
1130
+ version: MISSION_AUTHORING_CONTRACT_VERSION_V1,
1131
+ moduleId: "junior-coder.road-hopper-rally",
1132
+ moduleVersion: "1.1.0",
1133
+ missionId: "road-hopper-rally-mission-1",
1134
+ learner: {
1135
+ estimatedMinutes: 20,
1136
+ stages: [
1137
+ {
1138
+ kind: "learn",
1139
+ instruction: "Find the x and y coordinates that place a rescue marker on the road.",
1140
+ artifactIds: ["road-hopper-rally-m1-art"]
1141
+ },
1142
+ {
1143
+ kind: "predict",
1144
+ instruction: "Predict where the marker will appear before you run the starter project.",
1145
+ artifactIds: []
1146
+ },
1147
+ {
1148
+ kind: "build",
1149
+ instruction: "Complete the two road-lane drawing commands in the starter code.",
1150
+ artifactIds: ["road-hopper-rally-m1-code"]
1151
+ },
1152
+ {
1153
+ kind: "run",
1154
+ instruction: "Run the private preview and use the keyboard start control.",
1155
+ artifactIds: ["road-hopper-rally-m1-code"]
1156
+ },
1157
+ {
1158
+ kind: "assess",
1159
+ instruction: "Run the visible and protected deterministic mission checks.",
1160
+ artifactIds: []
1161
+ },
1162
+ {
1163
+ kind: "inspect",
1164
+ instruction: "Compare the highlighted line with the goal that did not pass.",
1165
+ artifactIds: []
1166
+ },
1167
+ {
1168
+ kind: "fix",
1169
+ instruction: "Change one coordinate or drawing command, then run the checks again.",
1170
+ artifactIds: ["road-hopper-rally-m1-code"]
1171
+ },
1172
+ {
1173
+ kind: "explain",
1174
+ instruction: "Explain how your coordinates changed the road on screen.",
1175
+ artifactIds: []
1176
+ },
1177
+ {
1178
+ kind: "reward",
1179
+ instruction: "Collect the evidence-bound badge when the mission score and safety check pass.",
1180
+ artifactIds: []
1181
+ }
1182
+ ],
1183
+ readinessChecks: [
1184
+ {
1185
+ id: "road-hopper-rally-m1-predict-coordinate",
1186
+ prompt: "Point to the pair of numbers that controls horizontal and vertical position.",
1187
+ scored: false
1188
+ }
1189
+ ],
1190
+ artifacts: [
1191
+ {
1192
+ id: "road-hopper-rally-m1-code",
1193
+ kind: "starter-code",
1194
+ audience: "learner",
1195
+ solutionBearing: false
1196
+ },
1197
+ {
1198
+ id: "road-hopper-rally-m1-art",
1199
+ kind: "starter-assets",
1200
+ audience: "learner",
1201
+ solutionBearing: false
1202
+ }
1203
+ ],
1204
+ goals: [
1205
+ {
1206
+ id: "road-hopper-rally-m1-starts",
1207
+ statement: "The starter project is structurally valid and starts.",
1208
+ visibility: "visible",
1209
+ criterionIds: ["road-hopper-rally-build"],
1210
+ completionRequired: true,
1211
+ aiRequired: false
1212
+ },
1213
+ {
1214
+ id: "road-hopper-rally-m1-draws-road",
1215
+ statement: "Two original road lanes appear at the expected coordinates.",
1216
+ visibility: "visible",
1217
+ criterionIds: ["road-hopper-rally-goal-one"],
1218
+ completionRequired: true,
1219
+ aiRequired: false
1220
+ },
1221
+ {
1222
+ id: "road-hopper-rally-m1-safe-preview",
1223
+ statement: "The project stays inside the private educational preview boundary.",
1224
+ visibility: "visible",
1225
+ criterionIds: ["road-hopper-rally-safety"],
1226
+ completionRequired: true,
1227
+ aiRequired: false
1228
+ }
1229
+ ],
1230
+ interactions: [
1231
+ {
1232
+ id: "road-hopper-rally-m1-start-control",
1233
+ description: "Start the private preview.",
1234
+ primaryMode: "pointer",
1235
+ alternativeIds: ["road-hopper-rally-m1-keyboard-start"]
1236
+ }
1237
+ ],
1238
+ accessibilityAlternatives: [
1239
+ {
1240
+ id: "road-hopper-rally-m1-keyboard-start",
1241
+ modes: ["keyboard"],
1242
+ equivalentOutcome: true,
1243
+ description: "Start the same preview with Enter while the control has focus."
1244
+ }
1245
+ ],
1246
+ evidenceRequirements: [
1247
+ {
1248
+ id: "road-hopper-rally-m1-assessment",
1249
+ goalIds: [
1250
+ "road-hopper-rally-m1-starts",
1251
+ "road-hopper-rally-m1-draws-road",
1252
+ "road-hopper-rally-m1-safe-preview"
1253
+ ],
1254
+ kind: "assessment-result",
1255
+ retention: "entitlement",
1256
+ containsPersonalData: false
1257
+ },
1258
+ {
1259
+ id: "road-hopper-rally-m1-explanation",
1260
+ goalIds: ["road-hopper-rally-m1-draws-road"],
1261
+ kind: "learner-explanation",
1262
+ retention: "attempt",
1263
+ containsPersonalData: false
1264
+ }
1265
+ ],
1266
+ sideAdventures: [
1267
+ {
1268
+ id: "road-hopper-rally-m1-remix",
1269
+ prompt: "Remix the lane colours while keeping text or shape cues available.",
1270
+ completionRequired: false
1271
+ }
1272
+ ],
1273
+ rewardBindings: [
1274
+ {
1275
+ id: "road-hopper-rally-m1-badge",
1276
+ badgeId: "road-hopper-rally-mission-complete",
1277
+ goalIds: [
1278
+ "road-hopper-rally-m1-starts",
1279
+ "road-hopper-rally-m1-draws-road",
1280
+ "road-hopper-rally-m1-safe-preview"
1281
+ ],
1282
+ deterministic: true,
1283
+ random: false,
1284
+ tokenConvertible: false
1285
+ }
1286
+ ]
1287
+ },
1288
+ facilitator: {
1289
+ artifacts: [
1290
+ {
1291
+ id: "road-hopper-rally-m1-answer-key",
1292
+ kind: "answer-key",
1293
+ audience: "facilitator",
1294
+ solutionBearing: true
1295
+ },
1296
+ {
1297
+ id: "road-hopper-rally-m1-protected-tests",
1298
+ kind: "protected-test",
1299
+ audience: "facilitator",
1300
+ solutionBearing: true
1301
+ }
1302
+ ],
1303
+ protectedGoals: [
1304
+ {
1305
+ id: "road-hopper-rally-m1-protected-edge",
1306
+ statement: "The drawing remains bounded when a protected coordinate edge case runs.",
1307
+ visibility: "protected",
1308
+ criterionIds: ["road-hopper-rally-edge-one"],
1309
+ completionRequired: false,
1310
+ aiRequired: false
1311
+ }
1312
+ ],
1313
+ prompts: [
1314
+ "Ask the learner to predict one coordinate before offering a hint.",
1315
+ "Do not reveal protected expected values; point back to the visible goal."
1316
+ ]
1317
+ }
1318
+ };
1319
+
1320
+ // src/validation.ts
583
1321
  var CANONICAL_TOKEN_SUBUNITS = /^(0|[1-9][0-9]*)$/u;
584
1322
  function issue(code, message, path, moduleId) {
585
1323
  return { code, message, path, ...moduleId ? { moduleId } : {} };
@@ -649,63 +1387,20 @@ function validateModule(module3, moduleIndex) {
649
1387
  )
650
1388
  );
651
1389
  }
652
- const criterionIds = /* @__PURE__ */ new Set();
653
- const dimensionTotals = {
654
- structure: 0,
655
- behaviour: 0,
656
- resilience: 0,
657
- safety: 0
658
- };
659
- let rubricTotal = 0;
660
- for (const criterion of module3.assessment.criteria) {
661
- rubricTotal += criterion.points;
662
- dimensionTotals[criterion.dimension] += criterion.points;
663
- if (criterionIds.has(criterion.id)) {
664
- issues.push(
665
- issue(
666
- "duplicate-criterion-id",
667
- `Duplicate assessment criterion ${criterion.id}.`,
668
- `${base}.assessment.criteria`,
669
- module3.id
670
- )
671
- );
672
- }
673
- criterionIds.add(criterion.id);
674
- }
675
- if (rubricTotal !== 100) {
676
- issues.push(
677
- issue(
678
- "rubric-total",
679
- `Assessment rubric totals ${rubricTotal}; expected 100.`,
680
- `${base}.assessment.criteria`,
681
- module3.id
682
- )
683
- );
684
- }
685
- for (const [dimension, expected] of Object.entries(DIMENSION_TOTALS)) {
686
- if (dimensionTotals[dimension] !== expected) {
687
- issues.push(
688
- issue(
689
- "rubric-dimension-total",
690
- `${dimension} criteria total ${dimensionTotals[dimension]}; expected ${expected}.`,
691
- `${base}.assessment.criteria`,
692
- module3.id
693
- )
694
- );
695
- }
696
- }
697
- if (!module3.assessment.criteria.some(
698
- (criterion) => criterion.dimension === "safety" && criterion.mandatory
699
- )) {
1390
+ const referencePrice = module3.pricing.referencePrice;
1391
+ if (referencePrice && (referencePrice.currency !== "GBP" || !CANONICAL_TOKEN_SUBUNITS.test(referencePrice.minorUnits) || referencePrice.basis !== "nominal-reference" || referencePrice.cashRedemptionAllowed !== false)) {
700
1392
  issues.push(
701
1393
  issue(
702
- "missing-mandatory-safety",
703
- "Every module requires a mandatory safety criterion.",
704
- `${base}.assessment.criteria`,
1394
+ "invalid-reference-price",
1395
+ "Reference prices must use canonical GBP minor units, the nominal reference basis and prohibit cash redemption.",
1396
+ `${base}.pricing.referencePrice`,
705
1397
  module3.id
706
1398
  )
707
1399
  );
708
1400
  }
1401
+ issues.push(
1402
+ ...validateAssessmentRubric(module3.assessment, `${base}.assessment`, module3.id)
1403
+ );
709
1404
  if (module3.hardware.mode === "physical-first" && module3.hardware.items.length === 0) {
710
1405
  issues.push(
711
1406
  issue(
@@ -780,9 +1475,18 @@ ${summary}`);
780
1475
  }
781
1476
  // Annotate the CommonJS export names for ESM import in node:
782
1477
  0 && (module.exports = {
1478
+ JUNIOR_CODER_MISSION_STAGE_ORDER_V1,
1479
+ JUNIOR_CODER_MODULE_PRICE_V1_1,
1480
+ JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT,
783
1481
  JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
1482
+ JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1,
1483
+ MISSION_AUTHORING_CONTRACT_VERSION_V1,
1484
+ ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1,
784
1485
  assertValidLearningPath,
1486
+ assertValidMissionAuthoringBundle,
785
1487
  calculateAssessment,
786
- validateLearningPath
1488
+ validateAssessmentRubric,
1489
+ validateLearningPath,
1490
+ validateMissionAuthoringBundle
787
1491
  });
788
1492
  //# sourceMappingURL=index.cjs.map