@plasius/learning 0.2.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/README.md +39 -7
- package/dist/index.cjs +723 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -1
- package/dist/index.d.ts +112 -1
- package/dist/index.js +716 -59
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -20,13 +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,
|
|
23
24
|
JUNIOR_CODER_MODULE_PRICE_V1_1: () => JUNIOR_CODER_MODULE_PRICE_V1_1,
|
|
24
25
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT: () => JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT,
|
|
25
26
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1: () => JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
|
|
26
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,
|
|
27
30
|
assertValidLearningPath: () => assertValidLearningPath,
|
|
31
|
+
assertValidMissionAuthoringBundle: () => assertValidMissionAuthoringBundle,
|
|
28
32
|
calculateAssessment: () => calculateAssessment,
|
|
29
|
-
|
|
33
|
+
validateAssessmentRubric: () => validateAssessmentRubric,
|
|
34
|
+
validateLearningPath: () => validateLearningPath,
|
|
35
|
+
validateMissionAuthoringBundle: () => validateMissionAuthoringBundle
|
|
30
36
|
});
|
|
31
37
|
module.exports = __toCommonJS(index_exports);
|
|
32
38
|
|
|
@@ -600,13 +606,718 @@ var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1 = {
|
|
|
600
606
|
};
|
|
601
607
|
var JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT = JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1;
|
|
602
608
|
|
|
603
|
-
// src/
|
|
609
|
+
// src/contracts.ts
|
|
610
|
+
var MISSION_AUTHORING_CONTRACT_VERSION_V1 = "1.0.0";
|
|
611
|
+
|
|
612
|
+
// src/rubric-validation.ts
|
|
604
613
|
var DIMENSION_TOTALS = {
|
|
605
614
|
structure: 20,
|
|
606
615
|
behaviour: 50,
|
|
607
616
|
resilience: 20,
|
|
608
617
|
safety: 10
|
|
609
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
|
|
610
1321
|
var CANONICAL_TOKEN_SUBUNITS = /^(0|[1-9][0-9]*)$/u;
|
|
611
1322
|
function issue(code, message, path, moduleId) {
|
|
612
1323
|
return { code, message, path, ...moduleId ? { moduleId } : {} };
|
|
@@ -687,63 +1398,9 @@ function validateModule(module3, moduleIndex) {
|
|
|
687
1398
|
)
|
|
688
1399
|
);
|
|
689
1400
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
behaviour: 0,
|
|
694
|
-
resilience: 0,
|
|
695
|
-
safety: 0
|
|
696
|
-
};
|
|
697
|
-
let rubricTotal = 0;
|
|
698
|
-
for (const criterion of module3.assessment.criteria) {
|
|
699
|
-
rubricTotal += criterion.points;
|
|
700
|
-
dimensionTotals[criterion.dimension] += criterion.points;
|
|
701
|
-
if (criterionIds.has(criterion.id)) {
|
|
702
|
-
issues.push(
|
|
703
|
-
issue(
|
|
704
|
-
"duplicate-criterion-id",
|
|
705
|
-
`Duplicate assessment criterion ${criterion.id}.`,
|
|
706
|
-
`${base}.assessment.criteria`,
|
|
707
|
-
module3.id
|
|
708
|
-
)
|
|
709
|
-
);
|
|
710
|
-
}
|
|
711
|
-
criterionIds.add(criterion.id);
|
|
712
|
-
}
|
|
713
|
-
if (rubricTotal !== 100) {
|
|
714
|
-
issues.push(
|
|
715
|
-
issue(
|
|
716
|
-
"rubric-total",
|
|
717
|
-
`Assessment rubric totals ${rubricTotal}; expected 100.`,
|
|
718
|
-
`${base}.assessment.criteria`,
|
|
719
|
-
module3.id
|
|
720
|
-
)
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
for (const [dimension, expected] of Object.entries(DIMENSION_TOTALS)) {
|
|
724
|
-
if (dimensionTotals[dimension] !== expected) {
|
|
725
|
-
issues.push(
|
|
726
|
-
issue(
|
|
727
|
-
"rubric-dimension-total",
|
|
728
|
-
`${dimension} criteria total ${dimensionTotals[dimension]}; expected ${expected}.`,
|
|
729
|
-
`${base}.assessment.criteria`,
|
|
730
|
-
module3.id
|
|
731
|
-
)
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
if (!module3.assessment.criteria.some(
|
|
736
|
-
(criterion) => criterion.dimension === "safety" && criterion.mandatory
|
|
737
|
-
)) {
|
|
738
|
-
issues.push(
|
|
739
|
-
issue(
|
|
740
|
-
"missing-mandatory-safety",
|
|
741
|
-
"Every module requires a mandatory safety criterion.",
|
|
742
|
-
`${base}.assessment.criteria`,
|
|
743
|
-
module3.id
|
|
744
|
-
)
|
|
745
|
-
);
|
|
746
|
-
}
|
|
1401
|
+
issues.push(
|
|
1402
|
+
...validateAssessmentRubric(module3.assessment, `${base}.assessment`, module3.id)
|
|
1403
|
+
);
|
|
747
1404
|
if (module3.hardware.mode === "physical-first" && module3.hardware.items.length === 0) {
|
|
748
1405
|
issues.push(
|
|
749
1406
|
issue(
|
|
@@ -818,12 +1475,18 @@ ${summary}`);
|
|
|
818
1475
|
}
|
|
819
1476
|
// Annotate the CommonJS export names for ESM import in node:
|
|
820
1477
|
0 && (module.exports = {
|
|
1478
|
+
JUNIOR_CODER_MISSION_STAGE_ORDER_V1,
|
|
821
1479
|
JUNIOR_CODER_MODULE_PRICE_V1_1,
|
|
822
1480
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT,
|
|
823
1481
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
|
|
824
1482
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1,
|
|
1483
|
+
MISSION_AUTHORING_CONTRACT_VERSION_V1,
|
|
1484
|
+
ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1,
|
|
825
1485
|
assertValidLearningPath,
|
|
1486
|
+
assertValidMissionAuthoringBundle,
|
|
826
1487
|
calculateAssessment,
|
|
827
|
-
|
|
1488
|
+
validateAssessmentRubric,
|
|
1489
|
+
validateLearningPath,
|
|
1490
|
+
validateMissionAuthoringBundle
|
|
828
1491
|
});
|
|
829
1492
|
//# sourceMappingURL=index.cjs.map
|