@thanh01.pmt/domain-kit 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -11
- package/dist/{chunk-MSRKUZLY.mjs → chunk-E4GCCWJO.mjs} +32 -2
- package/dist/chunk-E4GCCWJO.mjs.map +1 -0
- package/dist/{chunk-MCHHEBH3.mjs → chunk-G7HLFMD2.mjs} +5 -5
- package/dist/{chunk-MCHHEBH3.mjs.map → chunk-G7HLFMD2.mjs.map} +1 -1
- package/dist/{chunk-LKSVTRQE.mjs → chunk-TWKIVUTQ.mjs} +33 -3
- package/dist/chunk-TWKIVUTQ.mjs.map +1 -0
- package/dist/{chunk-Y7MRFFDJ.mjs → chunk-TYXSJUQU.mjs} +100 -9
- package/dist/chunk-TYXSJUQU.mjs.map +1 -0
- package/dist/curriculumFeedEmitter-T7NUBLAM.mjs +4 -0
- package/dist/{curriculumFeedEmitter-FYAWMPE6.mjs.map → curriculumFeedEmitter-T7NUBLAM.mjs.map} +1 -1
- package/dist/{curriculumFeedSchema-C8ZP3XMi.d.ts → curriculumFeedSchema-DUFwFyr2.d.cts} +196 -0
- package/dist/{curriculumFeedSchema-C8ZP3XMi.d.cts → curriculumFeedSchema-DUFwFyr2.d.ts} +196 -0
- package/dist/feed/index.cjs +60 -0
- package/dist/feed/index.cjs.map +1 -1
- package/dist/feed/index.d.cts +1 -1
- package/dist/feed/index.d.ts +1 -1
- package/dist/feed/index.mjs +2 -2
- package/dist/graph/index.cjs +98 -6
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.mjs +1 -1
- package/dist/{hybridGraphPipeline-NZAWAPt_.d.ts → hybridGraphPipeline-DXQDbBEj.d.ts} +14 -2
- package/dist/{hybridGraphPipeline-BhFyh3cm.d.cts → hybridGraphPipeline-dT-bio-3.d.cts} +14 -2
- package/dist/index.cjs +158 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/pipeline/index.cjs +157 -6
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +2 -2
- package/dist/pipeline/index.d.ts +2 -2
- package/dist/pipeline/index.mjs +4 -4
- package/dist/schemas/index.cjs +30 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.mjs +1 -1
- package/package.json +9 -10
- package/dist/chunk-LKSVTRQE.mjs.map +0 -1
- package/dist/chunk-MSRKUZLY.mjs.map +0 -1
- package/dist/chunk-Y7MRFFDJ.mjs.map +0 -1
- package/dist/curriculumFeedEmitter-FYAWMPE6.mjs +0 -4
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ export { i as ArchEdgeSchema, A as ArchNodeSchema, x as ArchitectureDetail, j as
|
|
|
2
2
|
export { b as Concept, d as ConceptCategory, c as ConceptCategorySchema, m as ConceptIntroduction, i as ConceptIntroductionSchema, C as ConceptSchema, l as DevelopmentPhase, D as DevelopmentPhaseSchema, j as HybridGraph, H as HybridGraphSchema, g as KnowledgeGraph, K as KnowledgeGraphSchema, f as LearningPathStep, L as LearningPathStepSchema, a as ProblemType, P as ProblemTypeSchema, k as ProjectConceptLink, h as ProjectConceptLinkSchema, e as SubjectInfo, S as SubjectInfoSchema } from './hybridGraphSchema-nrUeSwpU.cjs';
|
|
3
3
|
export { ExperimentProcedureSchema, GrammarRuleSchema, HardwareFeatureExtensionSchema, HardwareStepSchema, HardwareTaskExtensionSchema, HardwareTechStackExtensionSchema, LanguageConceptExtension, LanguageConceptExtensionSchema, MathConceptExtension, MathConceptExtensionSchema, MathTheoremSchema, ScienceConceptExtension, ScienceConceptExtensionSchema, ShapeSchema, ThreeDesignFeatureExtensionSchema, ThreeDesignTaskExtensionSchema, ThreeDesignTechStackExtensionSchema, WiringSchema } from './schemas/index.cjs';
|
|
4
4
|
export { a as DetectionConfidenceSchema, e as DomainCategory, D as DomainCategorySchema, c as DomainProfile, b as DomainProfileSchema, g as GraphType, G as GraphTypeSchema, d as InputType, I as InputTypeSchema, f as LearningMode, L as LearningModeSchema } from './domainProfileSchema-CwT3Ffsw.cjs';
|
|
5
|
-
export { g as CurriculumFeed, C as CurriculumFeedSchema, i as FeedEdge, c as FeedEdgeSchema, j as FeedGrouping, d as FeedGroupingSchema, F as FeedKeywordsSchema, h as FeedNode, b as FeedNodeSchema, f as FeedPhase, e as FeedPhaseSchema, a as FeedScaffoldCandidateSchema, v as validateCurriculumFeed } from './curriculumFeedSchema-
|
|
5
|
+
export { g as CurriculumFeed, C as CurriculumFeedSchema, i as FeedEdge, c as FeedEdgeSchema, j as FeedGrouping, d as FeedGroupingSchema, F as FeedKeywordsSchema, h as FeedNode, b as FeedNodeSchema, f as FeedPhase, e as FeedPhaseSchema, a as FeedScaffoldCandidateSchema, v as validateCurriculumFeed } from './curriculumFeedSchema-DUFwFyr2.cjs';
|
|
6
6
|
export { C as CppParseResult, P as PythonParseResult, S as SwiftParseResult, T as TsParseResult, f as mergeCppResults, d as mergePythonResults, m as mergeSwiftResults, b as mergeTsResults, e as parseCppFile, c as parsePythonFile, p as parseSwiftFile, a as parseTsFile } from './cpp-CZUPqJt9.cjs';
|
|
7
7
|
export { P as ParsedSyllabus, a as SyllabusTopic, S as SyllabusUnit, p as parseSyllabus } from './syllabusParser-MSX1fEzW.cjs';
|
|
8
8
|
export { K as Keyword, S as SourceContext, e as extractKeywords } from './keywordExtractor-BxlGRMHC.cjs';
|
|
@@ -10,7 +10,7 @@ export { FileRelevanceScore, scoreByContent, scoreByPath, scoreFiles, selectRele
|
|
|
10
10
|
export { DetectDomainOptions, DetectInputTypeOptions, DetectLearningModeOptions, DomainDetectionResult, InputTypeDetectionResult, LearningModeDetectionResult, detectDomain, detectInputType, detectLearningMode } from './detector/index.cjs';
|
|
11
11
|
export { D as DetectDomainProfileOptions, d as detectDomainProfile } from './domainProfileDetector-bzugdQmS.cjs';
|
|
12
12
|
export { CIO_CODE_RE, CONCEPT_CODE_RE, DepthLayerAudit, ExtractOverviewOptions, ExtractScaffoldOptions, ExtractStepsOptions, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode } from './graph/index.cjs';
|
|
13
|
-
export { H as Hallucination,
|
|
13
|
+
export { H as Hallucination, j as HybridGraphPipelineOptions, k as HybridGraphPipelineResult, K as KnowledgeGraphPipelineOptions, a as KnowledgeGraphPipelineResult, f as KnowledgeGraphVerificationReport, V as VerifyOptions, i as auditPhasePlan, e as auditSyllabusCoverage, c as breakPrerequisiteCycles, d as detectPrerequisiteCycles, h as generateHybridGraph, g as generateKnowledgeGraph, b as verifyKnowledgeGraph, v as verifyProjectGraph } from './hybridGraphPipeline-dT-bio-3.cjs';
|
|
14
14
|
export { C as ConceptMapping, E as EscalateOptions, e as escalateAndMapConcepts } from './conceptEscalator-ltRLtPhf.cjs';
|
|
15
15
|
export { ConceptMatch, ProposedConcept, ResolveConceptsOptions, ResolveConceptsResult, ResolvedConcept, resolveConcepts } from './concepts/index.cjs';
|
|
16
16
|
export { AssembleOptions, AssembledMilestone, AssembledPhase, AssembledRoadmap, assembleRoadmap } from './assembly/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { i as ArchEdgeSchema, A as ArchNodeSchema, x as ArchitectureDetail, j as
|
|
|
2
2
|
export { b as Concept, d as ConceptCategory, c as ConceptCategorySchema, m as ConceptIntroduction, i as ConceptIntroductionSchema, C as ConceptSchema, l as DevelopmentPhase, D as DevelopmentPhaseSchema, j as HybridGraph, H as HybridGraphSchema, g as KnowledgeGraph, K as KnowledgeGraphSchema, f as LearningPathStep, L as LearningPathStepSchema, a as ProblemType, P as ProblemTypeSchema, k as ProjectConceptLink, h as ProjectConceptLinkSchema, e as SubjectInfo, S as SubjectInfoSchema } from './hybridGraphSchema-nrUeSwpU.js';
|
|
3
3
|
export { ExperimentProcedureSchema, GrammarRuleSchema, HardwareFeatureExtensionSchema, HardwareStepSchema, HardwareTaskExtensionSchema, HardwareTechStackExtensionSchema, LanguageConceptExtension, LanguageConceptExtensionSchema, MathConceptExtension, MathConceptExtensionSchema, MathTheoremSchema, ScienceConceptExtension, ScienceConceptExtensionSchema, ShapeSchema, ThreeDesignFeatureExtensionSchema, ThreeDesignTaskExtensionSchema, ThreeDesignTechStackExtensionSchema, WiringSchema } from './schemas/index.js';
|
|
4
4
|
export { a as DetectionConfidenceSchema, e as DomainCategory, D as DomainCategorySchema, c as DomainProfile, b as DomainProfileSchema, g as GraphType, G as GraphTypeSchema, d as InputType, I as InputTypeSchema, f as LearningMode, L as LearningModeSchema } from './domainProfileSchema-CwT3Ffsw.js';
|
|
5
|
-
export { g as CurriculumFeed, C as CurriculumFeedSchema, i as FeedEdge, c as FeedEdgeSchema, j as FeedGrouping, d as FeedGroupingSchema, F as FeedKeywordsSchema, h as FeedNode, b as FeedNodeSchema, f as FeedPhase, e as FeedPhaseSchema, a as FeedScaffoldCandidateSchema, v as validateCurriculumFeed } from './curriculumFeedSchema-
|
|
5
|
+
export { g as CurriculumFeed, C as CurriculumFeedSchema, i as FeedEdge, c as FeedEdgeSchema, j as FeedGrouping, d as FeedGroupingSchema, F as FeedKeywordsSchema, h as FeedNode, b as FeedNodeSchema, f as FeedPhase, e as FeedPhaseSchema, a as FeedScaffoldCandidateSchema, v as validateCurriculumFeed } from './curriculumFeedSchema-DUFwFyr2.js';
|
|
6
6
|
export { C as CppParseResult, P as PythonParseResult, S as SwiftParseResult, T as TsParseResult, f as mergeCppResults, d as mergePythonResults, m as mergeSwiftResults, b as mergeTsResults, e as parseCppFile, c as parsePythonFile, p as parseSwiftFile, a as parseTsFile } from './cpp-CZUPqJt9.js';
|
|
7
7
|
export { P as ParsedSyllabus, a as SyllabusTopic, S as SyllabusUnit, p as parseSyllabus } from './syllabusParser-MSX1fEzW.js';
|
|
8
8
|
export { K as Keyword, S as SourceContext, e as extractKeywords } from './keywordExtractor-DU5XRN8-.js';
|
|
@@ -10,7 +10,7 @@ export { FileRelevanceScore, scoreByContent, scoreByPath, scoreFiles, selectRele
|
|
|
10
10
|
export { DetectDomainOptions, DetectInputTypeOptions, DetectLearningModeOptions, DomainDetectionResult, InputTypeDetectionResult, LearningModeDetectionResult, detectDomain, detectInputType, detectLearningMode } from './detector/index.js';
|
|
11
11
|
export { D as DetectDomainProfileOptions, d as detectDomainProfile } from './domainProfileDetector-DHb1T0zB.js';
|
|
12
12
|
export { CIO_CODE_RE, CONCEPT_CODE_RE, DepthLayerAudit, ExtractOverviewOptions, ExtractScaffoldOptions, ExtractStepsOptions, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode } from './graph/index.js';
|
|
13
|
-
export { H as Hallucination,
|
|
13
|
+
export { H as Hallucination, j as HybridGraphPipelineOptions, k as HybridGraphPipelineResult, K as KnowledgeGraphPipelineOptions, a as KnowledgeGraphPipelineResult, f as KnowledgeGraphVerificationReport, V as VerifyOptions, i as auditPhasePlan, e as auditSyllabusCoverage, c as breakPrerequisiteCycles, d as detectPrerequisiteCycles, h as generateHybridGraph, g as generateKnowledgeGraph, b as verifyKnowledgeGraph, v as verifyProjectGraph } from './hybridGraphPipeline-DXQDbBEj.js';
|
|
14
14
|
export { C as ConceptMapping, E as EscalateOptions, e as escalateAndMapConcepts } from './conceptEscalator-YfMKIKCZ.js';
|
|
15
15
|
export { ConceptMatch, ProposedConcept, ResolveConceptsOptions, ResolveConceptsResult, ResolvedConcept, resolveConcepts } from './concepts/index.js';
|
|
16
16
|
export { AssembleOptions, AssembledMilestone, AssembledPhase, AssembledRoadmap, assembleRoadmap } from './assembly/index.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './chunk-R57WTNXW.mjs';
|
|
2
|
-
export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from './chunk-
|
|
3
|
-
export { emitCurriculumFeed } from './chunk-
|
|
2
|
+
export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from './chunk-G7HLFMD2.mjs';
|
|
3
|
+
export { emitCurriculumFeed } from './chunk-TWKIVUTQ.mjs';
|
|
4
4
|
export { ArchEdgeSchema, ArchNodeSchema, ArchitectureDetailSchema, CapabilitySchema, ConceptCategorySchema, ConceptIntroductionSchema, ConceptSchema, DataIntegrationSchema, DecompositionSchema, DetectionConfidenceSchema, DevelopmentPhaseSchema, DevelopmentStageSchema, DomainCategorySchema, DomainProfileSchema, ExperienceComponentSchema, ExperienceSchema, ExperimentProcedureSchema, FeatureSchema, GrammarRuleSchema, GraphTypeSchema, HardwareFeatureExtensionSchema, HardwareStepSchema, HardwareTaskExtensionSchema, HardwareTechStackExtensionSchema, HybridGraphSchema, ImplementationSchema, InputTypeSchema, JourneySchema, JourneyStepSchema, KnowledgeGraphSchema, LanguageConceptExtensionSchema, LearningModeSchema, LearningPathStepSchema, MathConceptExtensionSchema, MathTheoremSchema, MilestoneDecompositionSchema, MissingGapSchema, NavigationSchema, ProblemTypeSchema, ProductGoalSchema, ProductSchema, ProductUserSchema, ProjectConceptLinkSchema, ProjectGraphSchema, ProjectInfoSchema, RequirementSchema, ScienceConceptExtensionSchema, ScreenSchema, ShapeSchema, StepEffortSchema, StepOutcomeSchema, StepSchema, SubjectInfoSchema, TaskEffortSchema, TaskOutcomeSchema, TaskSchema, TechDebtSchema, TechStackSchema, ThreeDesignFeatureExtensionSchema, ThreeDesignTaskExtensionSchema, ThreeDesignTechStackExtensionSchema, UiStateSchema, WiringSchema } from './chunk-VCPIWJ7R.mjs';
|
|
5
|
-
export { CurriculumFeedSchema, FeedEdgeSchema, FeedGroupingSchema, FeedKeywordsSchema, FeedNodeSchema, FeedPhaseSchema, FeedScaffoldCandidateSchema, validateCurriculumFeed } from './chunk-
|
|
5
|
+
export { CurriculumFeedSchema, FeedEdgeSchema, FeedGroupingSchema, FeedKeywordsSchema, FeedNodeSchema, FeedPhaseSchema, FeedScaffoldCandidateSchema, validateCurriculumFeed } from './chunk-E4GCCWJO.mjs';
|
|
6
6
|
import './chunk-IJZUV7N3.mjs';
|
|
7
7
|
export { mergeCppResults, mergePythonResults, mergeSwiftResults, mergeTsResults, parseCppFile, parsePythonFile, parseSwiftFile, parseTsFile } from './chunk-DRVOV5ZD.mjs';
|
|
8
8
|
export { scoreByContent, scoreByPath, scoreFiles, selectRelevantFiles } from './chunk-RKRNOVKO.mjs';
|
|
@@ -10,7 +10,7 @@ export { extractKeywords } from './chunk-XMHKWHVK.mjs';
|
|
|
10
10
|
import './chunk-7XGWW6CB.mjs';
|
|
11
11
|
export { detectDomain, detectDomainProfile, detectInputType, detectLearningMode } from './chunk-BL5NBKPH.mjs';
|
|
12
12
|
import './chunk-ZKLT27T4.mjs';
|
|
13
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from './chunk-
|
|
13
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditPhasePlan, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from './chunk-TYXSJUQU.mjs';
|
|
14
14
|
export { parseSyllabus } from './chunk-T4Y2DE2W.mjs';
|
|
15
15
|
import './chunk-KMYENICQ.mjs';
|
|
16
16
|
export { resolveConcepts } from './chunk-KNDBODUQ.mjs';
|
package/dist/pipeline/index.cjs
CHANGED
|
@@ -88,6 +88,36 @@ var init_curriculumFeedSchema = __esm({
|
|
|
88
88
|
references: zod.z.array(zod.z.object({ file: zod.z.string().min(1), evidence: zod.z.string().default("") })).default([]),
|
|
89
89
|
feature_id: zod.z.string().nullable().default(null),
|
|
90
90
|
concept_ref: zod.z.string().nullable().default(null),
|
|
91
|
+
// P52/T2.1: outcome.user_visible projected from the ProjectGraph step — the
|
|
92
|
+
// tangible checkpoint the session-cutting planner aims for (empty when the
|
|
93
|
+
// step declares no user-visible result). Concepts carry '' by default.
|
|
94
|
+
user_visible_deliverable: zod.z.string().default(""),
|
|
95
|
+
// P52/T3.1 — depth-reconcile inputs (optional/defaulted so old feeds
|
|
96
|
+
// validate unchanged):
|
|
97
|
+
// • depth_variants: minutes to teach this node at each depth level.
|
|
98
|
+
// ULO (know-it-exists) ≤ CIO (mechanism) ≤ SIO (implementation). All 3
|
|
99
|
+
// required so a downgrade never turns an anchor teach into a zero.
|
|
100
|
+
// • depth_scaffold_candidates: parallel to scaffold_candidates but
|
|
101
|
+
// acts on DEPTH (e.g. SIO→CIO) instead of lesson time.
|
|
102
|
+
// • is_core: concept is a Master-Tree core concept — reconciler must
|
|
103
|
+
// never downgrade it; escalate instead.
|
|
104
|
+
depth_variants: zod.z.object({ ulo: zod.z.number().int().nonnegative(), cio: zod.z.number().int().nonnegative(), sio: zod.z.number().int().nonnegative() }).optional(),
|
|
105
|
+
depth_scaffold_candidates: zod.z.array(zod.z.object({
|
|
106
|
+
from_depth: zod.z.enum(["ulo", "cio", "sio"]),
|
|
107
|
+
to_depth: zod.z.enum(["ulo", "cio", "sio"]),
|
|
108
|
+
minutes_saved: zod.z.number().int().nonnegative(),
|
|
109
|
+
reason: zod.z.string().default("")
|
|
110
|
+
})).optional(),
|
|
111
|
+
is_core: zod.z.boolean().default(false),
|
|
112
|
+
// Depth layer text (optional, additive — old feeds validate unchanged).
|
|
113
|
+
// Carries the ULO/CIO/SIO authored text from the KnowledgeGraph concept
|
|
114
|
+
// so downstream consumers (KX generator) can inject depth-appropriate
|
|
115
|
+
// material into their prompts without a second LLM call.
|
|
116
|
+
depth_context: zod.z.object({
|
|
117
|
+
ulo: zod.z.string().default(""),
|
|
118
|
+
cio: zod.z.string().default(""),
|
|
119
|
+
sio: zod.z.array(zod.z.string()).default([])
|
|
120
|
+
}).optional(),
|
|
91
121
|
// Progressive-completion bookkeeping (feed v2, additive):
|
|
92
122
|
// phase_id = development phase that introduces/uses this node;
|
|
93
123
|
// introduce_aspect = how the phase teaches a concept node (first intro, advanced
|
|
@@ -172,6 +202,10 @@ function feedNodeFromStep(step, featureId) {
|
|
|
172
202
|
references: arr(step.files).map((f) => ({ file: str(f), evidence: "step file" })).filter((f) => f.file),
|
|
173
203
|
feature_id: featureId,
|
|
174
204
|
concept_ref: null,
|
|
205
|
+
// P52/T2.1: carry the step's tangible outcome so the planner can cut
|
|
206
|
+
// sessions at user-visible checkpoints instead of raw minute counts.
|
|
207
|
+
user_visible_deliverable: str(step.outcome?.user_visible),
|
|
208
|
+
is_core: false,
|
|
175
209
|
phase_id: "",
|
|
176
210
|
introduce_aspect: null
|
|
177
211
|
};
|
|
@@ -190,6 +224,20 @@ function deriveConceptDepthHint(concept) {
|
|
|
190
224
|
if (str(concept.cio) || prereqs.length >= 1) return "cio";
|
|
191
225
|
return "ulo";
|
|
192
226
|
}
|
|
227
|
+
function deriveDepthInputs(minutes, depth) {
|
|
228
|
+
const ulo = Math.max(5, Math.round(minutes * 0.35));
|
|
229
|
+
const cio = Math.max(ulo + 5, Math.round(minutes * 0.65));
|
|
230
|
+
const sio = Math.max(cio + 5, minutes);
|
|
231
|
+
const variants = { ulo, cio, sio };
|
|
232
|
+
const candidates = [];
|
|
233
|
+
if (depth === "sio") {
|
|
234
|
+
candidates.push({ from_depth: "sio", to_depth: "cio", minutes_saved: sio - cio, reason: "SIO implementation practice deferred \u2014 CIO mechanism suffices for downstream consumers" });
|
|
235
|
+
}
|
|
236
|
+
if (depth === "cio" || depth === "sio") {
|
|
237
|
+
candidates.push({ from_depth: depth, to_depth: "ulo", minutes_saved: (depth === "sio" ? sio : cio) - ulo, reason: "Mechanism deferred \u2014 ULO awareness suffices (know-it-exists); never below the ULO floor" });
|
|
238
|
+
}
|
|
239
|
+
return { depth_variants: variants, depth_scaffold_candidates: candidates };
|
|
240
|
+
}
|
|
193
241
|
function feedNodeFromConcept(concept) {
|
|
194
242
|
const id = str(concept.id);
|
|
195
243
|
const pts = arr(concept.problem_types).map((p) => str(p.bloom_level, "Understand")).filter((b) => b in BLOOM_RANK).sort((a, b) => BLOOM_RANK[a] - BLOOM_RANK[b]);
|
|
@@ -219,6 +267,15 @@ function feedNodeFromConcept(concept) {
|
|
|
219
267
|
references,
|
|
220
268
|
feature_id: null,
|
|
221
269
|
concept_ref: id,
|
|
270
|
+
user_visible_deliverable: "",
|
|
271
|
+
// concepts are taught, not shipped — checkpoints live on product steps
|
|
272
|
+
...deriveDepthInputs(Math.max(0, Math.round(num(concept.estimated_minutes, 15))), deriveConceptDepthHint(concept)),
|
|
273
|
+
is_core: false,
|
|
274
|
+
depth_context: {
|
|
275
|
+
ulo: str(concept.ulo),
|
|
276
|
+
cio: str(concept.cio),
|
|
277
|
+
sio: strs(concept.sio)
|
|
278
|
+
},
|
|
222
279
|
phase_id: "",
|
|
223
280
|
introduce_aspect: null
|
|
224
281
|
};
|
|
@@ -325,6 +382,8 @@ function emitFromHybrid(hybrid, opts) {
|
|
|
325
382
|
prevNode.concept_codes = [str(c.code) || cid];
|
|
326
383
|
prevNode.keywords = { all: strs(c.keywords), new: [], prerequisite: [] };
|
|
327
384
|
prevNode.scaffolding = { scaffold_candidates: [], core_value_minutes: 0 };
|
|
385
|
+
prevNode.depth_variants = { ulo: prevNode.estimated_minutes, cio: prevNode.estimated_minutes, sio: prevNode.estimated_minutes };
|
|
386
|
+
prevNode.depth_scaffold_candidates = [];
|
|
328
387
|
nodes.push(prevNode);
|
|
329
388
|
conceptOrder.push(prevNode.id);
|
|
330
389
|
continue;
|
|
@@ -349,6 +408,7 @@ function emitFromHybrid(hybrid, opts) {
|
|
|
349
408
|
node.name = str(c.name, cid) + " (advanced)";
|
|
350
409
|
node.phase_id = pid;
|
|
351
410
|
node.introduce_aspect = "advanced";
|
|
411
|
+
node.depth_scaffold_candidates = [{ from_depth: "sio", to_depth: "cio", minutes_saved: Math.round(node.estimated_minutes * 0.3), reason: "advanced revisit may drop to CIO recap without breaking first-teach chain" }];
|
|
352
412
|
node.estimated_minutes = Math.max(15, Math.round(node.estimated_minutes * 0.5));
|
|
353
413
|
node.concept_codes = [str(c.code) || cid];
|
|
354
414
|
edges.push({ from: cid, to: revisitId, kind: "knowledge", reason: "advanced revisit of " + cid + " at phase " + pid });
|
|
@@ -3848,7 +3908,42 @@ async function generateKnowledgeGraph(options) {
|
|
|
3848
3908
|
const structuredTopicsGuide = parsedSyllabus && parsedSyllabus.allTopics.length > 0 ? `
|
|
3849
3909
|
STRUCTURED SYLLABUS TOPICS (Every topic MUST map to at least one concept to ensure 100% syllabus coverage):
|
|
3850
3910
|
` + parsedSyllabus.allTopics.map((t) => `- [${t.unitTitle}] ${t.id}: ${t.title} (Keywords: ${t.keywords.join(", ")})`).join("\n") + "\n" : "";
|
|
3851
|
-
const systemPrompt =
|
|
3911
|
+
const systemPrompt = `You are an expert curriculum designer. Decompose the given subject into a structured knowledge graph with concepts, prerequisites, and problem types.
|
|
3912
|
+
|
|
3913
|
+
CRITICAL RULES:
|
|
3914
|
+
1. Each concept MUST have the three depth layers, authored against this CONTRACT:
|
|
3915
|
+
- ulo (WHAT + WHY): bound to the CONCEPT's intrinsic NATURE. It explains what the
|
|
3916
|
+
concept is and why it exists \u2014 the problem it solves in principle. It must be
|
|
3917
|
+
TECHNOLOGY-AGNOSTIC: never name a concrete library, API, function, file format,
|
|
3918
|
+
tool or language feature. Typical assessment level: Remember / Understand.
|
|
3919
|
+
- cio (HOW): the MECHANISM \u2014 how the concept works and solves that problem, step
|
|
3920
|
+
by step. Still bound to the concept's nature: more concrete than the ULO, but
|
|
3921
|
+
NOT tied to one specific technology (no concrete API names). CIO capability is
|
|
3922
|
+
assessed INDIRECTLY, through completing contextual work, not in isolation.
|
|
3923
|
+
- sio (IMPLEMENTATION): an array of 2-4 items. EVERY item MUST reference concrete
|
|
3924
|
+
KEYWORDS/technologies (a real API, function, module, file, or named pattern) and
|
|
3925
|
+
describe a completable, context-specific implementation task. Application,
|
|
3926
|
+
Analysis and Creation skills are assessed INDIRECTLY through completing these
|
|
3927
|
+
items. There is NO fixed Bloom ceiling for a layer \u2014 but concreteness MUST
|
|
3928
|
+
strictly increase: SIO more technology-bound than CIO, CIO more concrete than ULO.
|
|
3929
|
+
- prerequisites: concept IDs that must be learned first (MUST NOT create cycles)
|
|
3930
|
+
- problem_types: 2-4 problem types with bloom_level and difficulty. Remember and
|
|
3931
|
+
Understand problem types test the ULO/CIO directly; Apply-and-above types are
|
|
3932
|
+
proxies for SIO completion in context.
|
|
3933
|
+
- techniques: methods, formulas, tools
|
|
3934
|
+
2. Prerequisite chains MUST be acyclic (no concept can depend on itself or create a loop)
|
|
3935
|
+
3. Concepts should be ordered by prerequisite dependency (topological sort)
|
|
3936
|
+
4. Problem types should range from Remember to Apply (not all at same level)
|
|
3937
|
+
5. Group concepts into categories (chapters/sections)
|
|
3938
|
+
6. ALL text in ENGLISH (even if input is Vietnamese)
|
|
3939
|
+
7. NEVER invent concepts not present in the syllabus
|
|
3940
|
+
8. KEYWORDS: Each concept MUST include 5-10 domain-specific keywords that:
|
|
3941
|
+
- Are concrete terms a student encounters when studying THIS concept
|
|
3942
|
+
- Include at least 2 technology-specific terms (APIs, functions, types, tools)
|
|
3943
|
+
- Are DISTINCT from keywords of other concepts (minimal overlap)
|
|
3944
|
+
- NEVER generic English words (e.g. "view", "data", "code" are TOO generic)
|
|
3945
|
+
- Example for "SwiftUI Layout": ["VStack", "HStack", "ZStack", ".padding()", ".frame()", "alignment", "Spacer", "LazyVGrid"]
|
|
3946
|
+
9. Return JSON matching the KnowledgeGraphSchema`;
|
|
3852
3947
|
const userPrompt = `Subject: ${subject}
|
|
3853
3948
|
${description ? `Description: ${description}` : ""}
|
|
3854
3949
|
${structuredTopicsGuide}${truncatedSyllabus ? `Syllabus:
|
|
@@ -3869,8 +3964,9 @@ Return JSON:
|
|
|
3869
3964
|
{
|
|
3870
3965
|
"id": "C1",
|
|
3871
3966
|
"name": "Concept name",
|
|
3872
|
-
"description": "
|
|
3967
|
+
"description": "2-3 sentence description: what this concept covers, why a learner encounters it, and what mastering it enables. Must be specific enough that a student reading only this description understands the concept's scope.",
|
|
3873
3968
|
"category": "category_id",
|
|
3969
|
+
"keywords": ["specific_term_1", "concrete_api_2", "method_call_3", "tool_or_type_4", "syntax_keyword_5", "concept_term_6"],
|
|
3874
3970
|
"ulo": "WHAT + WHY in technology-agnostic language: what the concept is and the problem it exists to solve. No library/API/tool names.",
|
|
3875
3971
|
"cio": "HOW the mechanism works, still technology-agnostic but more concrete than the ULO.",
|
|
3876
3972
|
"sio": ["Concrete task naming a REAL API/function/module/file from the target technology, completable end to end", "Another technology-bound task using a different concrete keyword"],
|
|
@@ -3911,18 +4007,23 @@ Return JSON:
|
|
|
3911
4007
|
log("STEP_2", "Validating and cleaning knowledge graph...");
|
|
3912
4008
|
const concepts = result.concepts || [];
|
|
3913
4009
|
const categories = result.categories || [];
|
|
4010
|
+
for (const c of concepts) {
|
|
4011
|
+
if ((c.description || "").length < 50) {
|
|
4012
|
+
warnings.push("Concept " + c.id + ": description too short (" + (c.description || "").length + " chars) \u2014 may produce shallow KX narratives");
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
3914
4015
|
{
|
|
3915
4016
|
const STOP = /* @__PURE__ */ new Set(["and", "the", "for", "with", "from", "that", "this", "into", "when", "while", "using", "their", "your", "each", "how", "why", "what", "between", "through", "about"]);
|
|
3916
4017
|
const tokensFrom = (text) => text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length >= 4 && !STOP.has(w));
|
|
3917
4018
|
for (const c of concepts) {
|
|
3918
4019
|
const existing = (c.keywords || []).map((k) => String(k).trim()).filter(Boolean);
|
|
3919
4020
|
if (existing.length === 0) {
|
|
3920
|
-
const derived = [.../* @__PURE__ */ new Set([...tokensFrom(c.name), ...tokensFrom(c.description || "")])].slice(0,
|
|
4021
|
+
const derived = [.../* @__PURE__ */ new Set([...tokensFrom(c.name), ...tokensFrom(c.description || "")])].slice(0, 8);
|
|
3921
4022
|
if (derived.length === 0) {
|
|
3922
4023
|
throw new Error("Concept " + c.id + " (" + c.name + ") has no keywords and none could be derived from name/description \u2014 fail-closed");
|
|
3923
4024
|
}
|
|
3924
4025
|
c.keywords = derived;
|
|
3925
|
-
warnings.push("Concept " + c.id + ": empty keyword set - derived " + derived.join(", ") + " from name/description");
|
|
4026
|
+
warnings.push("Concept " + c.id + ": empty keyword set - derived " + derived.join(", ") + " from name/description (WARNING: LLM returned no keywords)");
|
|
3926
4027
|
} else {
|
|
3927
4028
|
c.keywords = existing;
|
|
3928
4029
|
}
|
|
@@ -4047,6 +4148,52 @@ Return JSON:
|
|
|
4047
4148
|
}
|
|
4048
4149
|
log("STEP_5", "Depth layers authored: " + concepts.length + " concepts, audit " + lo.audits.filter((a) => a.passed).length + "/" + concepts.length + " passed");
|
|
4049
4150
|
}
|
|
4151
|
+
{
|
|
4152
|
+
for (const concept of concepts) {
|
|
4153
|
+
const sioText = (concept.sio || []).join(" ");
|
|
4154
|
+
const techTokens = [];
|
|
4155
|
+
let m;
|
|
4156
|
+
const techTokenRe = /`([^`]+)`/g;
|
|
4157
|
+
while ((m = techTokenRe.exec(sioText)) !== null) {
|
|
4158
|
+
if (m[1].length >= 3 && m[1].length <= 40) techTokens.push(m[1]);
|
|
4159
|
+
}
|
|
4160
|
+
const annotationRe = /(?:^|[\s(])(@[A-Za-z]\w*)/g;
|
|
4161
|
+
while ((m = annotationRe.exec(sioText)) !== null) techTokens.push(m[1]);
|
|
4162
|
+
const dotRe = /\b\w+\.\w+\(/g;
|
|
4163
|
+
while ((m = dotRe.exec(sioText)) !== null) techTokens.push(m[0].replace("(", ""));
|
|
4164
|
+
const modifierRe = /(?:^|[\s(])(\.[a-z]\w*)\b/g;
|
|
4165
|
+
while ((m = modifierRe.exec(sioText)) !== null) techTokens.push(m[1]);
|
|
4166
|
+
const camelRe = /\b[a-z]+[A-Z][A-Za-z]+\b/g;
|
|
4167
|
+
while ((m = camelRe.exec(sioText)) !== null) techTokens.push(m[0]);
|
|
4168
|
+
const existing = new Set((concept.keywords || []).map((k) => k.toLowerCase()));
|
|
4169
|
+
const newTokens = [...new Set(techTokens)].filter((t) => !existing.has(t.toLowerCase())).slice(0, 8);
|
|
4170
|
+
if (newTokens.length > 0) {
|
|
4171
|
+
concept.keywords = [...concept.keywords || [], ...newTokens];
|
|
4172
|
+
warnings.push("Concept " + concept.id + ": enriched keywords with " + newTokens.length + " SIO-derived tokens");
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
log("STEP_5b", "SIO-keyword enrichment complete");
|
|
4176
|
+
}
|
|
4177
|
+
{
|
|
4178
|
+
for (const concept of concepts) {
|
|
4179
|
+
const sioCount = (concept.sio || []).length;
|
|
4180
|
+
const ptCount = (concept.problem_types || []).length;
|
|
4181
|
+
const prereqCount = (concept.prerequisites || []).length;
|
|
4182
|
+
const hasHighBloom = (concept.problem_types || []).some(
|
|
4183
|
+
(pt) => ["Analyze", "Evaluate", "Create"].includes(pt.bloom_level || "")
|
|
4184
|
+
);
|
|
4185
|
+
const score = Math.min(1, sioCount * 0.2 + ptCount * 0.15 + prereqCount * 0.15 + (hasHighBloom ? 0.2 : 0));
|
|
4186
|
+
const calibrated = Math.round(15 + score * 45);
|
|
4187
|
+
const llmEstimate = concept.estimated_minutes || 30;
|
|
4188
|
+
if (llmEstimate === 30 || Math.abs(calibrated - llmEstimate) / llmEstimate > 0.5) {
|
|
4189
|
+
concept.estimated_minutes = calibrated;
|
|
4190
|
+
if (llmEstimate !== calibrated) {
|
|
4191
|
+
warnings.push("Concept " + concept.id + ": minutes calibrated " + llmEstimate + "m \u2192 " + calibrated + "m (score=" + score.toFixed(2) + ")");
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
log("STEP_5c", "Minute calibration complete");
|
|
4196
|
+
}
|
|
4050
4197
|
for (const step of learningPath) {
|
|
4051
4198
|
if (!conceptIds.has(step.concept_id)) {
|
|
4052
4199
|
warnings.push(`Learning path references non-existent concept ${step.concept_id}`);
|
|
@@ -4345,8 +4492,12 @@ async function decomposePhases(args) {
|
|
|
4345
4492
|
const linkList = links.map(
|
|
4346
4493
|
(l) => "- " + l.feature_id + " -> " + l.concept_id + " (" + l.depth + ")"
|
|
4347
4494
|
).join("\n") || "(none)";
|
|
4348
|
-
const systemPrompt = 'You decompose a software project build into PROGRESSIVE COMPLETION PHASES for learning purposes.\n\nA phase is NOT a feature and NOT a milestone list: it is a cross-feature slice of the\nproduct whose completion yields a DEMONSTRABLY more complete product. Build up gradually:\nthe product grows feature by feature across phases, and each phase adds its features to\nwhat previous phases already built.\n\nRULES:\n1. Every feature must be assigned to EXACTLY ONE phase (no feature reused, none skipped).\n2. Phases are ordered; later phases depend on earlier ones and yield a more complete product.\n3. product_completion describes concretely what the product can DO once the phase is done.\n4. introduces lists which concepts the phase must teach BEFORE its feature work starts:\n - aspect new: first time the concept appears in the course\n - aspect advanced: a concept introduced in an EARLIER phase, revisited here at a\n higher depth (an advanced aspect of the same concept, e.g. validation rules on top\n of basic data modeling). Use the note field to say which aspect.\n - aspect preview: a light awareness pass ("know it exists", ULO depth only, ~5 min)\n placed in an EARLIER phase when its feature work needs the vocabulary before the\n full teach. The anchor phase still owns the full new introduction.\n5. A concept MUST be introduced (new) no later than the first phase that consumes it.\n6. A concept must not be introduced before its own prerequisites are introduced.\n7. Typically 3-6 phases for a small project; keep phases balanced.\n8. Phase 1 usually covers project setup/foundation features plus the first minimal slice.\
|
|
4349
|
-
const
|
|
4495
|
+
const systemPrompt = 'You decompose a software project build into PROGRESSIVE COMPLETION PHASES for learning purposes.\n\nA phase is NOT a feature and NOT a milestone list: it is a cross-feature slice of the\nproduct whose completion yields a DEMONSTRABLY more complete product. Build up gradually:\nthe product grows feature by feature across phases, and each phase adds its features to\nwhat previous phases already built.\n\nRULES:\n1. Every feature must be assigned to EXACTLY ONE phase (no feature reused, none skipped).\n2. Phases are ordered; later phases depend on earlier ones and yield a more complete product.\n3. product_completion describes concretely what the product can DO once the phase is done.\n4. introduces lists which concepts the phase must teach BEFORE its feature work starts:\n - aspect new: first time the concept appears in the course\n - aspect advanced: a concept introduced in an EARLIER phase, revisited here at a\n higher depth (an advanced aspect of the same concept, e.g. validation rules on top\n of basic data modeling). Use the note field to say which aspect.\n - aspect preview: a light awareness pass ("know it exists", ULO depth only, ~5 min)\n placed in an EARLIER phase when its feature work needs the vocabulary before the\n full teach. The anchor phase still owns the full new introduction.\n5. A concept MUST be introduced (new) no later than the first phase that consumes it.\n6. A concept must not be introduced before its own prerequisites are introduced.\n7. Typically 3-6 phases for a small project; keep phases balanced.\n8. MINUTE BALANCE: Each phase should contain approximately 120-240 total minutes of\n concept + feature work (about 3-5 sessions of 90 minutes each). If a phase\n would contain < 60 minutes (too thin) or > 400 minutes (too heavy), rebalance.\n9. Phase 1 usually covers project setup/foundation features plus the first minimal slice.\n10. Return JSON only.';
|
|
4496
|
+
const totalFeatureMinutes = features.reduce((s, f) => s + (f.steps || []).reduce((ss, st) => ss + (st.effort?.estimated_minutes || 15), 0), 0);
|
|
4497
|
+
const totalConceptMinutes = concepts.reduce((s, c) => s + (c.estimated_minutes || 30), 0);
|
|
4498
|
+
const totalMinutes = totalFeatureMinutes + totalConceptMinutes;
|
|
4499
|
+
const targetPhaseCount = Math.max(3, Math.round(totalMinutes / 180));
|
|
4500
|
+
const baseUserPrompt = "FEATURES:\n" + featureList + "\n\nCONCEPTS:\n" + conceptList + "\n\nFEATURE-CONCEPT LINKS:\n" + linkList + "\n\nTOTAL MINUTES: ~" + totalMinutes + "m (" + totalFeatureMinutes + "m features + " + totalConceptMinutes + "m concepts)\nTARGET: ~" + targetPhaseCount + " phases of ~180m each\n\nReturn JSON with a phases array. Each phase: { id: PH1, name, product_completion, feature_ids: [F0, F1], introduces: [{ concept_id: C1, aspect: new or advanced, note }] }.\n";
|
|
4350
4501
|
const MAX_DECOMPOSE_ATTEMPTS = 3;
|
|
4351
4502
|
let auditErrors = [];
|
|
4352
4503
|
let phases = [];
|