@thanh01.pmt/curriculum-kit 1.4.16 → 1.4.17
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/LICENSE +21 -0
- package/dist/index.cjs +40 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +40 -0
- package/dist/index.mjs.map +1 -1
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +22 -23
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tony Pham
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -11469,6 +11469,17 @@ function packUnitSessions(group, nodeById, spec, warnings) {
|
|
|
11469
11469
|
const node = nodeById.get(id);
|
|
11470
11470
|
const isKnowledge = node.kind === "concept";
|
|
11471
11471
|
if (node.estimated_minutes > spec.contentBudget) {
|
|
11472
|
+
if (node.estimated_minutes <= spec.sessionDurationMinutes || node.estimated_minutes <= spec.contentBudget * 1.25) {
|
|
11473
|
+
if (current.entries.length > 0) flush();
|
|
11474
|
+
const entry = { id, minutes: spec.contentBudget, part: 1, totalParts: 1 };
|
|
11475
|
+
if (isKnowledge) current.knowledgeMinutes += entry.minutes;
|
|
11476
|
+
else current.practiceMinutes += entry.minutes;
|
|
11477
|
+
current.entries.push(entry);
|
|
11478
|
+
current.nodeIds.push(id);
|
|
11479
|
+
current.oversized = false;
|
|
11480
|
+
flush();
|
|
11481
|
+
continue;
|
|
11482
|
+
}
|
|
11472
11483
|
const parts = [];
|
|
11473
11484
|
let remaining = node.estimated_minutes;
|
|
11474
11485
|
while (remaining > 0) {
|
|
@@ -11637,6 +11648,35 @@ async function buildCurriculumPlan(rawGraph, options) {
|
|
|
11637
11648
|
const unitIndexByGroup = new Map(groups.map((g, i) => [g.key, i]));
|
|
11638
11649
|
const packed = [];
|
|
11639
11650
|
for (const g of groups) packed.push(...packUnitSessions(g, nodeById, spec, warnings));
|
|
11651
|
+
if (constraints.total_sessions && packed.length > constraints.total_sessions) {
|
|
11652
|
+
warnings.push(`Initial packing produced ${packed.length} sessions, coalescing to satisfy total_sessions constraint (${constraints.total_sessions})`);
|
|
11653
|
+
for (let i = 0; i < packed.length - 1 && packed.length > constraints.total_sessions; i++) {
|
|
11654
|
+
const curr = packed[i];
|
|
11655
|
+
const next = packed[i + 1];
|
|
11656
|
+
if (curr.groupId === next.groupId) {
|
|
11657
|
+
const currMins = curr.knowledgeMinutes + curr.practiceMinutes;
|
|
11658
|
+
const nextMins = next.knowledgeMinutes + next.practiceMinutes;
|
|
11659
|
+
const totalContent = currMins + nextMins;
|
|
11660
|
+
if (currMins <= 45 || nextMins <= 45 || totalContent <= spec.contentBudget * 1.5) {
|
|
11661
|
+
const scale = totalContent > spec.contentBudget ? spec.contentBudget / totalContent : 1;
|
|
11662
|
+
curr.nodeIds.push(...next.nodeIds);
|
|
11663
|
+
for (const e of next.entries) {
|
|
11664
|
+
e.minutes = Math.max(5, Math.round(e.minutes * scale));
|
|
11665
|
+
curr.entries.push(e);
|
|
11666
|
+
}
|
|
11667
|
+
for (const e of curr.entries) {
|
|
11668
|
+
e.minutes = Math.max(5, Math.round(e.minutes * scale));
|
|
11669
|
+
}
|
|
11670
|
+
const scaledKnowledge = Math.round((curr.knowledgeMinutes + next.knowledgeMinutes) * scale);
|
|
11671
|
+
curr.knowledgeMinutes = scaledKnowledge;
|
|
11672
|
+
curr.practiceMinutes = Math.max(0, spec.contentBudget - scaledKnowledge);
|
|
11673
|
+
curr.oversized = false;
|
|
11674
|
+
packed.splice(i + 1, 1);
|
|
11675
|
+
i--;
|
|
11676
|
+
}
|
|
11677
|
+
}
|
|
11678
|
+
}
|
|
11679
|
+
}
|
|
11640
11680
|
packed.map(
|
|
11641
11681
|
(_, i) => "U" + pad2(Math.min(units.length, 99)).replace("U", "U")
|
|
11642
11682
|
/* placeholder replaced below */
|