@plasius/learning 0.2.20 → 0.2.22
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 +71 -7
- package/dist/index.cjs +457 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -2
- package/dist/index.d.ts +147 -2
- package/dist/index.js +439 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -566,11 +566,410 @@ var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1 = {
|
|
|
566
566
|
}
|
|
567
567
|
}))
|
|
568
568
|
};
|
|
569
|
-
var
|
|
569
|
+
var ROAD_HOPPER_RALLY_EXTERNAL_CONTENT_V1 = Object.freeze({
|
|
570
|
+
packageName: "@plasius/learning-road-hopper-rally",
|
|
571
|
+
packageVersion: "1.0.0",
|
|
572
|
+
exportName: "ROAD_HOPPER_RALLY_COURSE_V2",
|
|
573
|
+
schemaVersion: "2",
|
|
574
|
+
sha256: "1a20741beba028004e0be527d05aae2b2881082d3b578e0d62308a59bf1323f0"
|
|
575
|
+
});
|
|
576
|
+
var roadHopperV1_1 = JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1.modules.find(
|
|
577
|
+
(entry) => entry.id === "junior-coder.road-hopper-rally"
|
|
578
|
+
);
|
|
579
|
+
var ROAD_HOPPER_RALLY_V2_MISSIONS = [
|
|
580
|
+
{
|
|
581
|
+
id: "board",
|
|
582
|
+
title: "Build the Rally Board",
|
|
583
|
+
concepts: ["coordinate grids", "arrays", "entity state", "rendering"],
|
|
584
|
+
statement: "Create the road, median, river and five distinct home bays in board.js.",
|
|
585
|
+
sideAdventure: "Design an original high-contrast board palette without changing its mechanics."
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
id: "hopper",
|
|
589
|
+
title: "Move the Hopper",
|
|
590
|
+
concepts: ["events", "bounded movement", "keyboard input", "touch input", "respawning"],
|
|
591
|
+
statement: "Implement four-direction tile movement, bounds, equivalent inputs and respawning in hopper.js.",
|
|
592
|
+
sideAdventure: "Add an accessible movement status phrase for every successful hop."
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
id: "traffic",
|
|
596
|
+
title: "Create Rally Traffic",
|
|
597
|
+
concepts: ["spawning", "fixed-step updates", "wrapping", "collision detection", "difficulty"],
|
|
598
|
+
statement: "Implement five deterministic traffic lanes, collisions, lives and difficulty in traffic.js.",
|
|
599
|
+
sideAdventure: "Invent an original vehicle type while preserving the entity and collision limits."
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
id: "river",
|
|
603
|
+
title: "Cross the Moving River",
|
|
604
|
+
concepts: ["moving platforms", "carrying", "hazards", "state machines", "off-screen bounds"],
|
|
605
|
+
statement: "Implement logs, carrying, water deaths, diving platforms and edge hazards in river.js.",
|
|
606
|
+
sideAdventure: "Create an original visual warning for a platform that is about to dive."
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
id: "rules",
|
|
610
|
+
title: "Add Rally Rules",
|
|
611
|
+
concepts: ["timers", "lives", "scoring", "bonuses", "levels", "game over"],
|
|
612
|
+
statement: "Implement homes, occupied and blocked bays, timer, scoring, bonuses and level progression in rules.js.",
|
|
613
|
+
sideAdventure: "Tune a practice-speed preset that keeps every rule deterministic."
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
id: "game",
|
|
617
|
+
title: "Complete Road Hopper Rally",
|
|
618
|
+
concepts: ["system assembly", "pause and restart", "alternating players", "audio", "accessibility", "testing"],
|
|
619
|
+
statement: "Assemble the systems, accessibility modes and alternating-player finale in game.js, then pass the protected challenge.",
|
|
620
|
+
sideAdventure: "Polish the finished game with original captions, visual cues and reduced-motion feedback."
|
|
621
|
+
}
|
|
622
|
+
];
|
|
623
|
+
var JUNIOR_CODER_ROAD_HOPPER_RALLY_V2 = {
|
|
624
|
+
...roadHopperV1_1,
|
|
625
|
+
version: "2.0.0",
|
|
626
|
+
contentRevision: "2026-08-11.1",
|
|
627
|
+
summary: "Recreate the systems behind a classic road-and-river crossing game using original Road Hopper Rally code, art, audio and presentation.",
|
|
628
|
+
estimatedMinutes: 450,
|
|
629
|
+
tools: [
|
|
630
|
+
"JavaScript",
|
|
631
|
+
"QuickJS sandbox",
|
|
632
|
+
"Deterministic 30 Hz engine",
|
|
633
|
+
"Road Hopper renderer"
|
|
634
|
+
],
|
|
635
|
+
concepts: [
|
|
636
|
+
"coordinates",
|
|
637
|
+
"arrays and entity state",
|
|
638
|
+
"events and input",
|
|
639
|
+
"fixed-step update and render",
|
|
640
|
+
"spawning and movement",
|
|
641
|
+
"collision detection",
|
|
642
|
+
"state machines",
|
|
643
|
+
"timers, lives and scoring",
|
|
644
|
+
"difficulty progression",
|
|
645
|
+
"audio integration",
|
|
646
|
+
"debugging",
|
|
647
|
+
"deterministic testing"
|
|
648
|
+
],
|
|
649
|
+
missions: ROAD_HOPPER_RALLY_V2_MISSIONS.map((missionDefinition, index) => ({
|
|
650
|
+
id: `road-hopper-rally-mission-${index + 1}-${missionDefinition.id}`,
|
|
651
|
+
title: missionDefinition.title,
|
|
652
|
+
estimatedMinutes: 75,
|
|
653
|
+
concepts: [...missionDefinition.concepts],
|
|
654
|
+
goals: [
|
|
655
|
+
{
|
|
656
|
+
id: `road-hopper-rally-v2-${missionDefinition.id}`,
|
|
657
|
+
statement: missionDefinition.statement,
|
|
658
|
+
evidence: "assessment"
|
|
659
|
+
}
|
|
660
|
+
],
|
|
661
|
+
sideAdventure: missionDefinition.sideAdventure
|
|
662
|
+
})),
|
|
663
|
+
assessment: {
|
|
664
|
+
version: "2.0.0",
|
|
665
|
+
completionScore: 80,
|
|
666
|
+
criteria: [
|
|
667
|
+
{ id: "road-hopper-v2-structure", label: "All six bounded JavaScript files compile and assemble.", dimension: "structure", points: 20, mandatory: true, visibility: "visible" },
|
|
668
|
+
{ id: "road-hopper-v2-road", label: "Board, input and traffic behaviours pass deterministic scenarios.", dimension: "behaviour", points: 15, mandatory: true, visibility: "visible" },
|
|
669
|
+
{ id: "road-hopper-v2-river", label: "River platforms, carrying and hazards pass deterministic scenarios.", dimension: "behaviour", points: 15, mandatory: true, visibility: "visible" },
|
|
670
|
+
{ id: "road-hopper-v2-rules", label: "Homes, timer, lives, scoring, bonuses and levels behave correctly.", dimension: "behaviour", points: 20, mandatory: true, visibility: "visible" },
|
|
671
|
+
{ id: "road-hopper-v2-final", label: "The complete game passes the server-only protected final challenge.", dimension: "resilience", points: 20, mandatory: true, visibility: "protected" },
|
|
672
|
+
{ id: "road-hopper-v2-safety", label: "The project stays within the sandbox, resource and privacy boundaries.", dimension: "safety", points: 10, mandatory: true, visibility: "visible" }
|
|
673
|
+
]
|
|
674
|
+
},
|
|
675
|
+
badges: [
|
|
676
|
+
{
|
|
677
|
+
id: "road-hopper-rally-v2-complete",
|
|
678
|
+
title: "Road Hopper Rally Champion",
|
|
679
|
+
evidence: "module-score",
|
|
680
|
+
tradeable: false,
|
|
681
|
+
tokenConvertible: false
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
externalContent: ROAD_HOPPER_RALLY_EXTERNAL_CONTENT_V1
|
|
685
|
+
};
|
|
686
|
+
var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_2 = {
|
|
687
|
+
...JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1,
|
|
688
|
+
version: "1.2.0",
|
|
689
|
+
modules: JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1.modules.map((entry) => entry.id === JUNIOR_CODER_ROAD_HOPPER_RALLY_V2.id ? JUNIOR_CODER_ROAD_HOPPER_RALLY_V2 : entry)
|
|
690
|
+
};
|
|
691
|
+
var PADDLE_PULSE_EXTERNAL_CONTENT_V1 = Object.freeze({
|
|
692
|
+
packageName: "@plasius/learning-paddle-pulse",
|
|
693
|
+
packageVersion: "0.1.0",
|
|
694
|
+
exportName: "PADDLE_PULSE_MODULE_V2",
|
|
695
|
+
schemaVersion: "2",
|
|
696
|
+
sha256: "19f3666bdb523a3faf069341b0bc748996b3db282f89171e3c9f0a373a8c8f7e"
|
|
697
|
+
});
|
|
698
|
+
var paddlePulseV1_1 = JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1.modules.find(
|
|
699
|
+
(entry) => entry.id === "junior-coder.paddle-pulse"
|
|
700
|
+
);
|
|
701
|
+
var PADDLE_PULSE_V2_MISSIONS = [
|
|
702
|
+
{
|
|
703
|
+
id: "court-coordinates",
|
|
704
|
+
title: "Court & Coordinates",
|
|
705
|
+
concepts: ["coordinates", "canvas primitives", "game loops", "bounds"],
|
|
706
|
+
statement: "Build a responsive 640 \xD7 480 logical court with a bounded paddle and ball.",
|
|
707
|
+
sideAdventure: "Create an original high-contrast court palette without changing its geometry."
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
id: "paddle-controls",
|
|
711
|
+
title: "Paddle Controls",
|
|
712
|
+
concepts: ["input state", "Pointer Events", "keyboard input", "clamping"],
|
|
713
|
+
statement: "Implement equivalent Arrow/A/D and direct horizontal pointer-drag controls.",
|
|
714
|
+
sideAdventure: "Add a semantic movement trace that does not rely on animation."
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
id: "ball-motion",
|
|
718
|
+
title: "Ball Motion & Bounces",
|
|
719
|
+
concepts: ["velocity", "fixed timesteps", "reflection", "contact normals", "paddle angles"],
|
|
720
|
+
statement: "Implement deterministic ball motion plus controlled wall and paddle reflections.",
|
|
721
|
+
sideAdventure: "Design a reduced-motion trajectory inspector for one rally."
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
id: "bricks-collisions",
|
|
725
|
+
title: "Bricks & Collisions",
|
|
726
|
+
concepts: ["arrays", "loops", "brick grids", "AABB collision", "resolution"],
|
|
727
|
+
statement: "Create an original brick grid whose bricks score once and disappear on impact.",
|
|
728
|
+
sideAdventure: "Invent a new visual brick pattern using the same bounded collision rules."
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
id: "score-lives-states",
|
|
732
|
+
title: "Score, Lives & States",
|
|
733
|
+
concepts: ["state machines", "invariants", "scoring", "lives", "HUD state"],
|
|
734
|
+
statement: "Implement serve, pause, life loss, level clear, game over, score and HUD states.",
|
|
735
|
+
sideAdventure: "Add a printable state-transition table for a facilitator or screen-reader user."
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: "levels-final-game",
|
|
739
|
+
title: "Levels, Sound & Final Game",
|
|
740
|
+
concepts: ["level data", "difficulty", "responsive rendering", "accessible audio", "testing"],
|
|
741
|
+
statement: "Assemble multiple original levels, optional generated cues and the integrated final game.",
|
|
742
|
+
sideAdventure: "After completion, add an optional original power-up without changing core assessment."
|
|
743
|
+
}
|
|
744
|
+
];
|
|
745
|
+
var JUNIOR_CODER_PADDLE_PULSE_V2 = {
|
|
746
|
+
...paddlePulseV1_1,
|
|
747
|
+
version: "2.0.0",
|
|
748
|
+
contentRevision: "2026-08-11.1",
|
|
749
|
+
summary: "Build an original Plasius brick-breaker while learning rendering, equivalent input, deterministic physics, collisions, score, lives, states, levels, accessible sound and testing.",
|
|
750
|
+
estimatedMinutes: 360,
|
|
751
|
+
tools: [
|
|
752
|
+
"JavaScript",
|
|
753
|
+
"QuickJS sandbox",
|
|
754
|
+
"Deterministic 60 Hz engine",
|
|
755
|
+
"Responsive Paddle Pulse renderer"
|
|
756
|
+
],
|
|
757
|
+
concepts: [
|
|
758
|
+
"coordinates and rendering",
|
|
759
|
+
"game loops and fixed timesteps",
|
|
760
|
+
"keyboard and pointer input",
|
|
761
|
+
"velocity and reflection",
|
|
762
|
+
"collision detection and resolution",
|
|
763
|
+
"arrays and brick grids",
|
|
764
|
+
"scoring, lives and state machines",
|
|
765
|
+
"level data and difficulty",
|
|
766
|
+
"accessible generated audio",
|
|
767
|
+
"debugging and deterministic testing"
|
|
768
|
+
],
|
|
769
|
+
missions: PADDLE_PULSE_V2_MISSIONS.map((missionDefinition, index) => ({
|
|
770
|
+
id: `paddle-pulse-mission-${index + 1}-${missionDefinition.id}`,
|
|
771
|
+
title: missionDefinition.title,
|
|
772
|
+
estimatedMinutes: 60,
|
|
773
|
+
concepts: [...missionDefinition.concepts],
|
|
774
|
+
goals: [{
|
|
775
|
+
id: `paddle-pulse-v2-${missionDefinition.id}`,
|
|
776
|
+
statement: missionDefinition.statement,
|
|
777
|
+
evidence: "assessment"
|
|
778
|
+
}],
|
|
779
|
+
sideAdventure: missionDefinition.sideAdventure
|
|
780
|
+
})),
|
|
781
|
+
assessment: {
|
|
782
|
+
version: "2.0.0",
|
|
783
|
+
completionScore: 80,
|
|
784
|
+
criteria: [
|
|
785
|
+
{ id: "paddle-pulse-v2-court", label: "The logical court, paddle and initial scene are finite, responsive and bounded.", dimension: "structure", points: 20, mandatory: false, visibility: "visible" },
|
|
786
|
+
{ id: "paddle-pulse-v2-controls", label: "Keyboard and pointer paths produce equivalent clamped paddle input.", dimension: "behaviour", points: 15, mandatory: false, visibility: "visible" },
|
|
787
|
+
{ id: "paddle-pulse-v2-motion", label: "Ball motion and wall/paddle reflections pass deterministic trajectories.", dimension: "behaviour", points: 15, mandatory: false, visibility: "visible" },
|
|
788
|
+
{ id: "paddle-pulse-v2-bricks", label: "Brick face, corner and adjacent impacts resolve without double-scoring.", dimension: "behaviour", points: 20, mandatory: false, visibility: "visible" },
|
|
789
|
+
{ id: "paddle-pulse-v2-states", label: "Score, lives, serve, pause, level-clear and game-over transitions preserve invariants.", dimension: "resilience", points: 10, mandatory: false, visibility: "visible" },
|
|
790
|
+
{ id: "paddle-pulse-v2-final", label: "Multiple original levels and the integrated game pass protected deterministic scenarios.", dimension: "resilience", points: 10, mandatory: false, visibility: "protected" },
|
|
791
|
+
{ id: "paddle-pulse-v2-safety", label: "Source, commands, runtime resources and assessment remain inside sandbox limits.", dimension: "safety", points: 10, mandatory: true, visibility: "visible" }
|
|
792
|
+
]
|
|
793
|
+
},
|
|
794
|
+
badges: [
|
|
795
|
+
{ id: "paddle-pulse-v2-court-builder", title: "Court Builder", evidence: "mission-score", tradeable: false, tokenConvertible: false },
|
|
796
|
+
{ id: "paddle-pulse-v2-paddle-pilot", title: "Paddle Pilot", evidence: "mission-score", tradeable: false, tokenConvertible: false },
|
|
797
|
+
{ id: "paddle-pulse-v2-rally-master", title: "Rally Master", evidence: "mission-score", tradeable: false, tokenConvertible: false },
|
|
798
|
+
{ id: "paddle-pulse-v2-brick-breaker", title: "Brick Breaker", evidence: "mission-score", tradeable: false, tokenConvertible: false },
|
|
799
|
+
{ id: "paddle-pulse-v2-game-keeper", title: "Game Keeper", evidence: "mission-score", tradeable: false, tokenConvertible: false },
|
|
800
|
+
{ id: "paddle-pulse-v2-complete", title: "Paddle Pulse Champion", evidence: "module-score", tradeable: false, tokenConvertible: false }
|
|
801
|
+
],
|
|
802
|
+
externalContent: PADDLE_PULSE_EXTERNAL_CONTENT_V1
|
|
803
|
+
};
|
|
804
|
+
var JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_3 = {
|
|
805
|
+
...JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_2,
|
|
806
|
+
version: "1.3.0",
|
|
807
|
+
modules: JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_2.modules.map((entry) => entry.id === JUNIOR_CODER_PADDLE_PULSE_V2.id ? JUNIOR_CODER_PADDLE_PULSE_V2 : entry)
|
|
808
|
+
};
|
|
809
|
+
var JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT = JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_3;
|
|
570
810
|
|
|
571
811
|
// src/contracts.ts
|
|
812
|
+
var EXTERNAL_LEARNING_CONTENT_REFERENCE_VERSION_V1 = "1";
|
|
572
813
|
var MISSION_AUTHORING_CONTRACT_VERSION_V1 = "1.0.0";
|
|
573
814
|
|
|
815
|
+
// src/contextual-help.ts
|
|
816
|
+
var CONTEXTUAL_HELP_CONTRACT_VERSION_V1 = "1.0.0";
|
|
817
|
+
var CONTEXTUAL_HELP_KINDS_V1 = Object.freeze([
|
|
818
|
+
"command",
|
|
819
|
+
"visual-block",
|
|
820
|
+
"generated-code",
|
|
821
|
+
"assessment-diagnostic"
|
|
822
|
+
]);
|
|
823
|
+
var CONTEXTUAL_VOICE_INTENTS_V1 = Object.freeze([
|
|
824
|
+
"describe-command",
|
|
825
|
+
"describe-inputs",
|
|
826
|
+
"show-example",
|
|
827
|
+
"explain-assessment-failure",
|
|
828
|
+
"suggest-next-experiment",
|
|
829
|
+
"repeat",
|
|
830
|
+
"stop",
|
|
831
|
+
"unresolved"
|
|
832
|
+
]);
|
|
833
|
+
var CONTEXTUAL_VOICE_SUGGESTED_ACTIONS_V1 = Object.freeze([
|
|
834
|
+
"open-help",
|
|
835
|
+
"insert-example",
|
|
836
|
+
"show-inputs",
|
|
837
|
+
"show-assessment-evidence",
|
|
838
|
+
"try-next-experiment",
|
|
839
|
+
"repeat",
|
|
840
|
+
"stop",
|
|
841
|
+
"type-question"
|
|
842
|
+
]);
|
|
843
|
+
var OPAQUE_ID = /^[a-z0-9]+(?:[._:-][a-z0-9]+)*$/u;
|
|
844
|
+
var SEMVER = /^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?$/u;
|
|
845
|
+
var SHA_256 = /^sha256:[a-f0-9]{64}$/u;
|
|
846
|
+
var LOCALE = /^[a-z]{2,3}(?:-[A-Z]{2})?$/u;
|
|
847
|
+
var MEDIA_TYPE = /^audio\/[a-z0-9.+-]+$/u;
|
|
848
|
+
function containsDisallowedControlCharacter(value) {
|
|
849
|
+
return [...value].some((character) => {
|
|
850
|
+
const code = character.codePointAt(0) ?? 0;
|
|
851
|
+
return code <= 8 || code === 11 || code === 12 || code >= 14 && code <= 31 || code === 127;
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
function requireOpaqueId(value, label, maximum = 160) {
|
|
855
|
+
if (value.length === 0 || value.length > maximum || !OPAQUE_ID.test(value)) {
|
|
856
|
+
throw new Error(`${label} must be a bounded opaque identifier.`);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function requireSemver(value, label) {
|
|
860
|
+
if (!SEMVER.test(value)) {
|
|
861
|
+
throw new Error(`${label} must be an immutable semantic version.`);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function requireIsoTimestamp(value, label) {
|
|
865
|
+
if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(Date.parse(value))) {
|
|
866
|
+
throw new Error(`${label} must be an ISO-8601 timestamp.`);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function assertValidContextualHelpIdentifier(value) {
|
|
870
|
+
if (value.schemaVersion !== "1") {
|
|
871
|
+
throw new Error("schemaVersion must be 1.");
|
|
872
|
+
}
|
|
873
|
+
if (value.contractVersion !== CONTEXTUAL_HELP_CONTRACT_VERSION_V1) {
|
|
874
|
+
throw new Error("contractVersion is unsupported.");
|
|
875
|
+
}
|
|
876
|
+
if (!CONTEXTUAL_HELP_KINDS_V1.includes(value.kind)) {
|
|
877
|
+
throw new Error("kind is unsupported.");
|
|
878
|
+
}
|
|
879
|
+
requireOpaqueId(value.moduleId, "moduleId");
|
|
880
|
+
requireSemver(value.moduleVersion, "moduleVersion");
|
|
881
|
+
requireSemver(value.manifestVersion, "manifestVersion");
|
|
882
|
+
requireOpaqueId(value.helpId, "helpId");
|
|
883
|
+
}
|
|
884
|
+
function assertValidGuardianVoiceConsent(value) {
|
|
885
|
+
if (value.schemaVersion !== "1") {
|
|
886
|
+
throw new Error("schemaVersion must be 1.");
|
|
887
|
+
}
|
|
888
|
+
requireOpaqueId(value.actorAccountId, "actorAccountId");
|
|
889
|
+
requireOpaqueId(value.subjectAccountId, "subjectAccountId");
|
|
890
|
+
requireSemver(value.policyVersion, "policyVersion");
|
|
891
|
+
if (value.state !== "granted" && value.state !== "withdrawn") {
|
|
892
|
+
throw new Error("state must be granted or withdrawn.");
|
|
893
|
+
}
|
|
894
|
+
if (value.permittedProcessingRoute !== "private-edge-only") {
|
|
895
|
+
throw new Error("permittedProcessingRoute must be private-edge-only.");
|
|
896
|
+
}
|
|
897
|
+
requireIsoTimestamp(value.recordedAt, "recordedAt");
|
|
898
|
+
}
|
|
899
|
+
function assertValidContextualVoiceQuestionMetadata(value) {
|
|
900
|
+
assertValidContextualHelpIdentifier(value.help);
|
|
901
|
+
if (!LOCALE.test(value.locale)) throw new Error("locale is invalid.");
|
|
902
|
+
if (!MEDIA_TYPE.test(value.mediaType)) throw new Error("mediaType is invalid.");
|
|
903
|
+
if (!Number.isInteger(value.durationMs) || value.durationMs < 1 || value.durationMs > 1e4) {
|
|
904
|
+
throw new Error("durationMs must be between 1 and 10000.");
|
|
905
|
+
}
|
|
906
|
+
if (!Number.isInteger(value.audioBytes) || value.audioBytes < 1 || value.audioBytes > 2097152) {
|
|
907
|
+
throw new Error("audioBytes must be between 1 and 2097152.");
|
|
908
|
+
}
|
|
909
|
+
if (value.assessmentEvidenceId !== void 0) {
|
|
910
|
+
requireOpaqueId(value.assessmentEvidenceId, "assessmentEvidenceId");
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function assertValidVoiceHelpAvailability(value) {
|
|
914
|
+
if (value.schemaVersion !== "1") throw new Error("schemaVersion must be 1.");
|
|
915
|
+
if (value.questionProcessingRoute !== "private-edge-only") {
|
|
916
|
+
throw new Error("questionProcessingRoute must be private-edge-only.");
|
|
917
|
+
}
|
|
918
|
+
if (value.guardianVoiceConsentRequired !== true) {
|
|
919
|
+
throw new Error("guardianVoiceConsentRequired must remain true.");
|
|
920
|
+
}
|
|
921
|
+
if (value.maximumRecordingDurationMs !== 1e4 || value.maximumAudioBytes !== 2097152 || value.rawAudioRetention !== "request-memory-only" || value.transcriptRetention !== "request-memory-only") {
|
|
922
|
+
throw new Error("Voice limits and transient retention are immutable in version one.");
|
|
923
|
+
}
|
|
924
|
+
if (value.microphoneAvailable !== (value.microphoneReason === "available")) {
|
|
925
|
+
throw new Error("microphoneReason must match microphone availability.");
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
function assertValidCanonicalSpokenHelpDescriptor(value) {
|
|
929
|
+
if (value.schemaVersion !== "1") throw new Error("schemaVersion must be 1.");
|
|
930
|
+
assertValidContextualHelpIdentifier(value.help);
|
|
931
|
+
requireOpaqueId(value.canonicalTextId, "canonicalTextId");
|
|
932
|
+
if (!SHA_256.test(value.authoritativeTextDigest)) {
|
|
933
|
+
throw new Error("authoritativeTextDigest must be a SHA-256 digest.");
|
|
934
|
+
}
|
|
935
|
+
if (!LOCALE.test(value.locale)) throw new Error("locale is invalid.");
|
|
936
|
+
requireOpaqueId(value.voiceProfile, "voiceProfile");
|
|
937
|
+
requireSemver(value.pronunciationVersion, "pronunciationVersion");
|
|
938
|
+
if (value.utteranceClass !== "system-generic" || value.sharingScope !== "global" || value.reuse !== "exact-only" || value.containsPersonalData !== false || value.containsLearnerContent !== false) {
|
|
939
|
+
throw new Error("Canonical spoken help must use global system-generic exact-only reuse.");
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function assertValidContextualVoiceQuestionResult(value) {
|
|
943
|
+
if (value.schemaVersion !== "1") throw new Error("schemaVersion must be 1.");
|
|
944
|
+
assertValidContextualHelpIdentifier(value.help);
|
|
945
|
+
if (!CONTEXTUAL_VOICE_INTENTS_V1.includes(value.intent)) {
|
|
946
|
+
throw new Error("intent is unsupported.");
|
|
947
|
+
}
|
|
948
|
+
if (value.transcriptRetention !== "request-memory-only") {
|
|
949
|
+
throw new Error("transcriptRetention must be request-memory-only.");
|
|
950
|
+
}
|
|
951
|
+
if (value.status !== "resolved" && value.status !== "suggestions" && value.status !== "stopped") {
|
|
952
|
+
throw new Error("status is unsupported.");
|
|
953
|
+
}
|
|
954
|
+
if (value.transientTranscript.length > 500 || containsDisallowedControlCharacter(value.transientTranscript)) {
|
|
955
|
+
throw new Error("transientTranscript is invalid.");
|
|
956
|
+
}
|
|
957
|
+
if (value.answer) {
|
|
958
|
+
requireOpaqueId(value.answer.helpId, "answer.helpId");
|
|
959
|
+
if (value.answer.source !== "module-documentation" && value.answer.source !== "assessment-evidence" && value.answer.source !== "authored-fallback" || value.answer.text.length === 0 || value.answer.text.length > 800 || containsDisallowedControlCharacter(value.answer.text)) {
|
|
960
|
+
throw new Error("answer.text is invalid.");
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
if (value.suggestedActions.some(
|
|
964
|
+
(action) => !CONTEXTUAL_VOICE_SUGGESTED_ACTIONS_V1.includes(action)
|
|
965
|
+
)) {
|
|
966
|
+
throw new Error("suggestedActions contains an unsupported action.");
|
|
967
|
+
}
|
|
968
|
+
if (value.mayAssignScore !== false || value.mayAwardReward !== false || value.mayPublish !== false || value.mayControlHardware !== false) {
|
|
969
|
+
throw new Error("mayAssignScore, reward, publish and hardware authority must remain false.");
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
574
973
|
// src/publishing.ts
|
|
575
974
|
var STATIC_PROJECT_PUBLISHING_CONTRACT_VERSION_V1 = "1.0.0";
|
|
576
975
|
var STATIC_PROJECT_SCANNER_VERSION_V1 = "junior-coder-static-scan-v1";
|
|
@@ -6602,6 +7001,16 @@ var ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1 = {
|
|
|
6602
7001
|
|
|
6603
7002
|
// src/validation.ts
|
|
6604
7003
|
var CANONICAL_TOKEN_SUBUNITS = /^(0|[1-9][0-9]*)$/u;
|
|
7004
|
+
var EXACT_PACKAGE_NAME = /^@plasius\/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/u;
|
|
7005
|
+
var EXACT_SEMVER = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u;
|
|
7006
|
+
var EXPORT_NAME = /^[A-Za-z_$][A-Za-z0-9_$]*$/u;
|
|
7007
|
+
var CONTENT_SCHEMA_VERSION = /^(0|[1-9][0-9]*)$/u;
|
|
7008
|
+
var SHA256 = /^[a-f0-9]{64}$/u;
|
|
7009
|
+
function isExternalLearningContentReferenceV1(value) {
|
|
7010
|
+
if (typeof value !== "object" || value === null) return false;
|
|
7011
|
+
const candidate = value;
|
|
7012
|
+
return Object.keys(value).length === 5 && typeof candidate.packageName === "string" && EXACT_PACKAGE_NAME.test(candidate.packageName) && typeof candidate.packageVersion === "string" && EXACT_SEMVER.test(candidate.packageVersion) && typeof candidate.exportName === "string" && EXPORT_NAME.test(candidate.exportName) && typeof candidate.schemaVersion === "string" && CONTENT_SCHEMA_VERSION.test(candidate.schemaVersion) && typeof candidate.sha256 === "string" && SHA256.test(candidate.sha256);
|
|
7013
|
+
}
|
|
6605
7014
|
function issue(code, message, path, moduleId) {
|
|
6606
7015
|
return { code, message, path, ...moduleId ? { moduleId } : {} };
|
|
6607
7016
|
}
|
|
@@ -6716,6 +7125,17 @@ function validateModule(module2, moduleIndex) {
|
|
|
6716
7125
|
)
|
|
6717
7126
|
);
|
|
6718
7127
|
}
|
|
7128
|
+
const externalContent = module2.externalContent;
|
|
7129
|
+
if (externalContent && !isExternalLearningContentReferenceV1(externalContent)) {
|
|
7130
|
+
issues.push(
|
|
7131
|
+
issue(
|
|
7132
|
+
"invalid-external-content-reference",
|
|
7133
|
+
"External content must use an exact @plasius package, stable semantic version, named export, schema version and lower-case SHA-256 digest.",
|
|
7134
|
+
`${base}.externalContent`,
|
|
7135
|
+
module2.id
|
|
7136
|
+
)
|
|
7137
|
+
);
|
|
7138
|
+
}
|
|
6719
7139
|
return issues;
|
|
6720
7140
|
}
|
|
6721
7141
|
function validateLearningPath(path) {
|
|
@@ -6759,20 +7179,31 @@ ${summary}`);
|
|
|
6759
7179
|
export {
|
|
6760
7180
|
ADVENTURE_MISSION_PLANNER_MISSION_ONE_AUTHORING_V1,
|
|
6761
7181
|
BEACON_BOT_MISSION_ONE_AUTHORING_V1,
|
|
7182
|
+
CONTEXTUAL_HELP_CONTRACT_VERSION_V1,
|
|
7183
|
+
CONTEXTUAL_HELP_KINDS_V1,
|
|
7184
|
+
CONTEXTUAL_VOICE_INTENTS_V1,
|
|
7185
|
+
CONTEXTUAL_VOICE_SUGGESTED_ACTIONS_V1,
|
|
6762
7186
|
CREATURE_CARE_DASHBOARD_MISSION_ONE_AUTHORING_V1,
|
|
6763
7187
|
DANCE_ROVER_MISSION_ONE_AUTHORING_V1,
|
|
7188
|
+
EXTERNAL_LEARNING_CONTENT_REFERENCE_VERSION_V1,
|
|
6764
7189
|
JUNIOR_CODER_MISSION_STAGE_ORDER_V1,
|
|
6765
7190
|
JUNIOR_CODER_MODULE_PRICE_V1_1,
|
|
7191
|
+
JUNIOR_CODER_PADDLE_PULSE_V2,
|
|
7192
|
+
JUNIOR_CODER_ROAD_HOPPER_RALLY_V2,
|
|
6766
7193
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_CURRENT,
|
|
6767
7194
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1,
|
|
6768
7195
|
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_1,
|
|
7196
|
+
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_2,
|
|
7197
|
+
JUNIOR_CODER_ROBOT_RESCUE_PATH_V1_3,
|
|
6769
7198
|
METEOR_SHIELD_MISSION_ONE_AUTHORING_V1,
|
|
6770
7199
|
MISSION_AUTHORING_CONTRACT_VERSION_V1,
|
|
6771
7200
|
OBSTACLE_EXPLORER_MISSION_ONE_AUTHORING_V1,
|
|
7201
|
+
PADDLE_PULSE_EXTERNAL_CONTENT_V1,
|
|
6772
7202
|
PADDLE_PULSE_MISSION_ONE_AUTHORING_V1,
|
|
6773
7203
|
PIXEL_TRAIL_CHALLENGE_MISSION_ONE_AUTHORING_V1,
|
|
6774
7204
|
RAINBOW_RESCUE_ROVER_MISSION_ONE_AUTHORING_V1,
|
|
6775
7205
|
RESCUE_CREW_COMMANDER_MISSION_ONE_AUTHORING_V1,
|
|
7206
|
+
ROAD_HOPPER_RALLY_EXTERNAL_CONTENT_V1,
|
|
6776
7207
|
ROAD_HOPPER_RALLY_MISSION_ONE_AUTHORING_V1,
|
|
6777
7208
|
ROBOT_MAZE_DASH_MISSION_ONE_AUTHORING_V1,
|
|
6778
7209
|
ROBOT_MISSION_CONTROL_MISSION_ONE_AUTHORING_V1,
|
|
@@ -6788,12 +7219,19 @@ export {
|
|
|
6788
7219
|
VIBE_BUG_DETECTIVE_MISSION_ONE_AUTHORING_V1,
|
|
6789
7220
|
VIBE_GAME_REMIX_LAB_MISSION_ONE_AUTHORING_V1,
|
|
6790
7221
|
VIBE_IDEA_STUDIO_MISSION_ONE_AUTHORING_V1,
|
|
7222
|
+
assertValidCanonicalSpokenHelpDescriptor,
|
|
7223
|
+
assertValidContextualHelpIdentifier,
|
|
7224
|
+
assertValidContextualVoiceQuestionMetadata,
|
|
7225
|
+
assertValidContextualVoiceQuestionResult,
|
|
7226
|
+
assertValidGuardianVoiceConsent,
|
|
6791
7227
|
assertValidLearningPath,
|
|
6792
7228
|
assertValidMissionAuthoringBundle,
|
|
6793
7229
|
assertValidStaticProjectGuardianApproval,
|
|
6794
7230
|
assertValidStaticProjectPublication,
|
|
6795
7231
|
assertValidStaticProjectSnapshot,
|
|
7232
|
+
assertValidVoiceHelpAvailability,
|
|
6796
7233
|
calculateAssessment,
|
|
7234
|
+
isExternalLearningContentReferenceV1,
|
|
6797
7235
|
validateAssessmentRubric,
|
|
6798
7236
|
validateLearningPath,
|
|
6799
7237
|
validateMissionAuthoringBundle,
|