@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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -11
  3. package/dist/{chunk-MSRKUZLY.mjs → chunk-E4GCCWJO.mjs} +32 -2
  4. package/dist/chunk-E4GCCWJO.mjs.map +1 -0
  5. package/dist/{chunk-MCHHEBH3.mjs → chunk-G7HLFMD2.mjs} +5 -5
  6. package/dist/{chunk-MCHHEBH3.mjs.map → chunk-G7HLFMD2.mjs.map} +1 -1
  7. package/dist/{chunk-LKSVTRQE.mjs → chunk-TWKIVUTQ.mjs} +33 -3
  8. package/dist/chunk-TWKIVUTQ.mjs.map +1 -0
  9. package/dist/{chunk-Y7MRFFDJ.mjs → chunk-TYXSJUQU.mjs} +100 -9
  10. package/dist/chunk-TYXSJUQU.mjs.map +1 -0
  11. package/dist/curriculumFeedEmitter-T7NUBLAM.mjs +4 -0
  12. package/dist/{curriculumFeedEmitter-FYAWMPE6.mjs.map → curriculumFeedEmitter-T7NUBLAM.mjs.map} +1 -1
  13. package/dist/{curriculumFeedSchema-C8ZP3XMi.d.ts → curriculumFeedSchema-DUFwFyr2.d.cts} +196 -0
  14. package/dist/{curriculumFeedSchema-C8ZP3XMi.d.cts → curriculumFeedSchema-DUFwFyr2.d.ts} +196 -0
  15. package/dist/feed/index.cjs +60 -0
  16. package/dist/feed/index.cjs.map +1 -1
  17. package/dist/feed/index.d.cts +1 -1
  18. package/dist/feed/index.d.ts +1 -1
  19. package/dist/feed/index.mjs +2 -2
  20. package/dist/graph/index.cjs +98 -6
  21. package/dist/graph/index.cjs.map +1 -1
  22. package/dist/graph/index.d.cts +1 -1
  23. package/dist/graph/index.d.ts +1 -1
  24. package/dist/graph/index.mjs +1 -1
  25. package/dist/{hybridGraphPipeline-NZAWAPt_.d.ts → hybridGraphPipeline-DXQDbBEj.d.ts} +14 -2
  26. package/dist/{hybridGraphPipeline-BhFyh3cm.d.cts → hybridGraphPipeline-dT-bio-3.d.cts} +14 -2
  27. package/dist/index.cjs +158 -6
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.mjs +4 -4
  32. package/dist/pipeline/index.cjs +157 -6
  33. package/dist/pipeline/index.cjs.map +1 -1
  34. package/dist/pipeline/index.d.cts +2 -2
  35. package/dist/pipeline/index.d.ts +2 -2
  36. package/dist/pipeline/index.mjs +4 -4
  37. package/dist/schemas/index.cjs +30 -0
  38. package/dist/schemas/index.cjs.map +1 -1
  39. package/dist/schemas/index.d.cts +1 -1
  40. package/dist/schemas/index.d.ts +1 -1
  41. package/dist/schemas/index.mjs +1 -1
  42. package/package.json +9 -10
  43. package/dist/chunk-LKSVTRQE.mjs.map +0 -1
  44. package/dist/chunk-MSRKUZLY.mjs.map +0 -1
  45. package/dist/chunk-Y7MRFFDJ.mjs.map +0 -1
  46. package/dist/curriculumFeedEmitter-FYAWMPE6.mjs +0 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schemas/curriculumFeedSchema.ts","../../src/feed/curriculumFeedEmitter.ts"],"names":["z"],"mappings":";;;;;AAUO,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,GAAA,EAAKA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EACnC,GAAA,EAAKA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EACnC,YAAA,EAAcA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE;AAC9C,CAAC,CAAA;AAEM,IAAM,2BAAA,GAA8BA,MAAE,MAAA,CAAO;AAAA,EAClD,IAAA,EAAMA,MAAE,MAAA,EAAO;AAAA,EACf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uBAAuB,CAAC,CAAA;AAAA,EACjC;AACA,EAAA,IAAI,CAAA,CAAE,aAAA,IAAiB,CAAA,CAAE,eAAA,IAAmB,IAAI,CAAA,CAAE,KAAK,CAAA,CAAE,MAAA,GAAS,KAAK,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,CAAE,SAAS,CAAA,EAAG;AAC/F,IAAA,OAAO,cAAA,CAAe,GAAG,IAAI,CAAA;AAAA,EAC/B;AACA,EAAA,IAAI,GAAA,CAAI,CAAA,CAAE,QAAQ,CAAA,CAAE,SAAS,CAAA,IAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,KAAM,iBAAA,EAAmB,OAAO,iBAAA,CAAkB,GAAG,IAAI,CAAA;AACrG,EAAA,OAAO,eAAA,CAAgB,GAAG,IAAI,CAAA;AAChC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * CurriculumFeed v2 — normalized, planner-ready projection of a domain graph.\n * Consumers: curriculum-kit Curriculum Planner (see docs/ideas/2026-08-30-curriculum-feed-v2-output.md).\n * Guarantees enforced here: cycle-free is the CALLER's verifier job; the feed\n * itself guarantees resolution (edges/keywords reference emitted nodes) and\n * non-emptiness.\n */\n\nexport const FeedKeywordsSchema = z.object({\n all: z.array(z.string()).default([]),\n new: z.array(z.string()).default([]),\n prerequisite: z.array(z.string()).default([]),\n});\n\nexport const FeedScaffoldCandidateSchema = z.object({\n item: z.string(),\n reason: z.string().default(''),\n minutes_saved: z.number().int().nonnegative().default(0),\n suggest: z.enum(['provide_full', 'provide_partial', 'provide_reference']).default('provide_full'),\n});\n\nexport const FeedNodeSchema = z.object({\n id: z.string().min(1),\n kind: z.enum(['skill', 'concept', 'product_step']),\n name: z.string().min(1),\n concept_codes: z.array(z.string()).default([]),\n keywords: FeedKeywordsSchema,\n estimated_minutes: z.number().int().nonnegative(),\n bloom_hint: z.enum(['Remember', 'Understand', 'Apply', 'Analyze', 'Evaluate', 'Create']).nullable().default(null),\n depth_hint: z.enum(['ulo', 'cio', 'sio']).nullable().default(null),\n completion_level: z.enum(['mvp', 'standard', 'stretch']).default('standard'),\n scaffolding: z.object({\n scaffold_candidates: z.array(FeedScaffoldCandidateSchema).default([]),\n core_value_minutes: z.number().int().nonnegative().default(0),\n }).default({ scaffold_candidates: [], core_value_minutes: 0 }),\n references: z.array(z.object({ file: z.string().min(1), evidence: z.string().default('') })).default([]),\n feature_id: z.string().nullable().default(null),\n concept_ref: z.string().nullable().default(null),\n // Progressive-completion bookkeeping (feed v2, additive):\n // phase_id = development phase that introduces/uses this node;\n // introduce_aspect = how the phase teaches a concept node (first intro, advanced\n // revisit, or preview — a light ULO awareness pass that is NOT the introduction).\n phase_id: z.string().default(''),\n introduce_aspect: z.enum(['new', 'advanced', 'preview']).nullable().default(null),\n});\n\nexport const FeedEdgeSchema = z.object({\n from: z.string().min(1),\n to: z.string().min(1),\n kind: z.enum(['knowledge', 'task']),\n reason: z.string().default(''),\n});\n\nexport const FeedGroupingSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n node_ids: z.array(z.string()).min(1),\n rationale: z.string().default(''),\n});\n\nexport const FeedPhaseSchema = z.object({\n id: z.string().min(1),\n order: z.number().int().positive(),\n name: z.string().min(1),\n product_completion: z.string().min(1),\n node_ids: z.array(z.string()).min(1),\n});\nexport type FeedPhase = z.infer<typeof FeedPhaseSchema>;\n\nexport const CurriculumFeedSchema = z.object({\n schema_version: z.literal(2),\n source: z.object({\n graph_type: z.enum(['project_graph', 'knowledge_graph', 'hybrid_graph']),\n warnings: z.array(z.string()).default([]),\n hallucination_count: z.number().int().nonnegative().default(0),\n }),\n learning_nodes: z.array(FeedNodeSchema).min(1, 'curriculum feed must contain at least one learning node'),\n dependency_edges: z.array(FeedEdgeSchema).default([]),\n suggested_groupings: z.array(FeedGroupingSchema).default([]),\n // Progressive completion phases (cross-feature). When non-empty, these — not\n // suggested_groupings — define the teaching sequence and unit structure.\n phases: z.array(FeedPhaseSchema).default([]),\n});\n\nexport type CurriculumFeed = z.infer<typeof CurriculumFeedSchema>;\nexport type FeedNode = z.infer<typeof FeedNodeSchema>;\nexport type FeedEdge = z.infer<typeof FeedEdgeSchema>;\nexport type FeedGrouping = z.infer<typeof FeedGroupingSchema>;\n\n/** Strict pre-save resolution validation — fail-closed, no defaulted-empty graphs. */\nexport function validateCurriculumFeed(feed: unknown): CurriculumFeed {\n const parsed = CurriculumFeedSchema.parse(feed);\n const ids = new Set(parsed.learning_nodes.map((n) => n.id));\n if (ids.size !== parsed.learning_nodes.length) {\n throw new Error('curriculum feed contains duplicate node ids');\n }\n for (const e of parsed.dependency_edges) {\n if (!ids.has(e.from) || !ids.has(e.to)) {\n throw new Error('curriculum feed edge ' + e.from + ' -> ' + e.to + ' references unknown node');\n }\n if (e.from === e.to) throw new Error('curriculum feed self-loop edge on ' + e.from);\n }\n for (const g of parsed.suggested_groupings) {\n for (const id of g.node_ids) {\n if (!ids.has(id)) throw new Error('grouping ' + g.id + ' references unknown node ' + id);\n }\n }\n for (const ph of parsed.phases) {\n for (const id of ph.node_ids) {\n if (!ids.has(id)) throw new Error('phase ' + ph.id + ' references unknown node ' + id);\n }\n }\n const phaseIds = parsed.phases.map((p) => p.id);\n if (new Set(phaseIds).size !== phaseIds.length) throw new Error('curriculum feed contains duplicate phase ids');\n // Teaching-order invariant (2026-09-17 incident): when phases define the\n // teaching sequence, a prerequisite must live in the same or an EARLIER\n // phase than its consumer. Without this check a self-contradictory feed\n // (backwards phase-crossing edge) sailed through emission and only exploded\n // much later inside the planner as \"Teaching-order violation in session ...\"\n // — far from the constructor that produced the contradiction.\n if (parsed.phases.length > 0) {\n const phaseIndexOf = new Map<string, number>();\n parsed.phases.forEach((p, i) => {\n for (const id of p.node_ids) phaseIndexOf.set(id, i);\n });\n for (const e of parsed.dependency_edges) {\n const fromIdx = phaseIndexOf.get(e.from);\n const toIdx = phaseIndexOf.get(e.to);\n if (fromIdx === undefined || toIdx === undefined) continue; // node outside the phase sequence\n if (fromIdx > toIdx) {\n throw new Error(\n 'curriculum feed teaching-order violation: prerequisite ' + e.from +\n ' (phase ' + (fromIdx + 1) + ') is scheduled AFTER its consumer ' + e.to +\n ' (phase ' + (toIdx + 1) + ')',\n );\n }\n }\n }\n return parsed;\n}\n","import {\n validateCurriculumFeed, type CurriculumFeed, type FeedNode, type FeedEdge, type FeedGrouping,\n} from '../schemas/curriculumFeedSchema';\n\n/**\n * CurriculumFeed emitter - pure transformation from a VERIFIED domain graph\n * to the planner-ready feed. No LLM calls: hints derive from existing\n * annotations only. Validates its own output (fail-closed).\n *\n * Phase-driven emission (hybrid graphs with development phases): the teaching\n * sequence IS the phase sequence. Concepts are emitted at the phase that\n * introduces them (aspect new) or revisits them at higher depth (aspect\n * advanced) - never as a trailing knowledge appendix. Concept minutes stay\n * UNMERGED: no prerequisite-minute inflation (the planner schedules the\n * revisit, not the total).\n */\n\nexport interface EmitFeedOptions {\n hallucinationCount?: number;\n warnings?: string[];\n}\n\nconst BLOOM_RANK: Record<string, number> = { Remember: 0, Understand: 1, Apply: 2, Analyze: 3, Evaluate: 4, Create: 5 };\nconst pad2 = (n: number): string => String(n).padStart(2, '0');\n\ntype Rec = Record<string, unknown>;\nconst arr = (v: unknown): Rec[] => (Array.isArray(v) ? (v as Rec[]) : []);\nconst str = (v: unknown, d = ''): string => (typeof v === 'string' ? v : d);\nconst num = (v: unknown, d: number): number => (typeof v === 'number' && Number.isFinite(v) ? v : d);\nconst strs = (v: unknown): string[] => (Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : []);\n\nfunction stepMinutes(step: Rec): number {\n const effort = (step.effort ?? {}) as Rec;\n return Math.max(0, Math.round(num(effort.estimated_minutes, num(step.estimated_minutes, 45))));\n}\n\nfunction pushWarning(opts: EmitFeedOptions, message: string): void {\n (opts.warnings ?? (opts.warnings = [])).push(message);\n}\n\nfunction newKeywordsInOrder(nodes: FeedNode[]): void {\n // First appearance in emission order becomes 'new'; everything seen before is 'prerequisite'.\n const seen = new Set<string>();\n for (const n of nodes) {\n const all = n.keywords.all;\n n.keywords.new = [];\n n.keywords.prerequisite = [];\n for (const k of all) {\n if (seen.has(k)) n.keywords.prerequisite.push(k);\n else n.keywords.new.push(k);\n seen.add(k);\n }\n }\n}\n\nfunction feedNodeFromStep(step: Rec, featureId: string): FeedNode {\n const id = str(step.id);\n return {\n id,\n kind: 'product_step',\n name: str(step.name, id),\n concept_codes: strs(step.concept_codes),\n keywords: { all: strs(step.keywords), new: [], prerequisite: [] },\n estimated_minutes: stepMinutes(step),\n bloom_hint: 'Apply',\n depth_hint: null,\n completion_level: 'standard',\n scaffolding: { scaffold_candidates: [], core_value_minutes: stepMinutes(step) },\n references: arr(step.files).map((f) => ({ file: str(f), evidence: 'step file' })).filter((f) => f.file),\n feature_id: featureId,\n concept_ref: null,\n phase_id: '',\n introduce_aspect: null,\n };\n}\n\nfunction deriveConceptDepthHint(concept: Rec): FeedNode['depth_hint'] {\n const explicit = str(concept.depth_hint);\n if (explicit === 'ulo' || explicit === 'cio' || explicit === 'sio') return explicit;\n\n const sio = arr(concept.sio);\n const prereqs = strs(concept.prerequisites);\n const pts = arr(concept.problem_types);\n const hasHighBloom = pts.some((p) => {\n const b = str(p.bloom_level);\n return b === 'Apply' || b === 'Analyze' || b === 'Evaluate' || b === 'Create';\n });\n\n if (sio.length >= 2 || hasHighBloom) return 'sio';\n if (str(concept.cio) || prereqs.length >= 1) return 'cio';\n return 'ulo';\n}\n\nfunction feedNodeFromConcept(concept: Rec): FeedNode {\n const id = str(concept.id);\n const pts = arr(concept.problem_types)\n .map((p) => str(p.bloom_level, 'Understand'))\n .filter((b) => b in BLOOM_RANK)\n .sort((a, b) => BLOOM_RANK[a] - BLOOM_RANK[b]);\n const topBloom = pts[pts.length - 1] ?? 'Understand';\n\n const rawRefs = arr(concept.references);\n const references = rawRefs.length > 0\n ? rawRefs.map((r) => ({ file: str(r.file, 'syllabus.md'), evidence: str(r.evidence, str(concept.name)) })).filter((r) => r.file)\n : [{ file: 'syllabus.md', evidence: str(concept.category ? `Topic under category ${str(concept.category)}` : str(concept.name), id) }];\n\n const problemScaffolds = arr(concept.problem_types).map((pt) => ({\n item: str(pt.name, 'Problem type'),\n reason: str(pt.description, 'Formative practice check'),\n minutes_saved: num(pt.estimated_minutes, 10),\n suggest: 'provide_partial' as const,\n }));\n\n return {\n id,\n kind: 'concept',\n name: str(concept.name, id),\n concept_codes: [str(concept.code) || id].filter(Boolean),\n keywords: { all: strs(concept.keywords), new: [], prerequisite: [] },\n estimated_minutes: Math.max(0, Math.round(num(concept.estimated_minutes, 15))),\n bloom_hint: topBloom as FeedNode['bloom_hint'],\n depth_hint: deriveConceptDepthHint(concept),\n completion_level: 'standard',\n scaffolding: {\n scaffold_candidates: problemScaffolds,\n core_value_minutes: Math.max(0, Math.round(num(concept.estimated_minutes, 15))),\n },\n references,\n feature_id: null,\n concept_ref: id,\n phase_id: '',\n introduce_aspect: null,\n };\n}\n\nfunction addFeatureGroup(\n f: Rec, fid: string, nodes: FeedNode[], edges: FeedEdge[], groupings: FeedGrouping[],\n): string[] {\n const steps = arr(f.steps);\n const stepIds: string[] = [];\n let prev = '';\n for (let i = 0; i < steps.length; i++) {\n const stepNode = feedNodeFromStep(steps[i], fid);\n if (!stepNode.id) continue;\n stepIds.push(stepNode.id);\n nodes.push(stepNode);\n if (prev) edges.push({ from: prev, to: stepNode.id, kind: 'task', reason: 'feature build order' });\n prev = stepNode.id;\n }\n for (const dep of strs(f.depends_on)) {\n const depFirst = nodes.find((n) => n.feature_id === dep);\n if (depFirst && stepIds[0]) edges.push({ from: depFirst.id, to: stepIds[0], kind: 'task', reason: 'feature depends_on ' + dep });\n }\n if (stepIds.length > 0) groupings.push({ id: 'G-' + fid, name: str(f.name, fid), node_ids: stepIds, rationale: str(f.description, '') });\n return stepIds;\n}\n\ninterface EmitPhaseCtx {\n id: string;\n order: number;\n name: string;\n productCompletion: string;\n conceptOrder: string[]; // concept node ids in teaching order (new first, then advanced)\n featureIds: string[];\n}\n\n/**\n * Phase-driven hybrid emission:\n * - emit concepts per phase (aspect new first, then advanced) BEFORE the\n * phase's features; knowledge edges concept -> first step of consumer\n * features carry the JIT relation\n * - feature order inside a phase follows the project graph order\n * - phases and their node_ids go into feed.phases (teaching sequence)\n * - concept minutes stay UNMERGED (no prereq-minute accumulation)\n */\nfunction emitFromHybrid(hybrid: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n const pg = (hybrid.project_graph ?? {}) as Rec;\n const kg = (hybrid.knowledge_graph ?? {}) as Rec;\n const rawPhases = arr(hybrid.phases).filter((p) => str(p.id));\n\n const features = arr(pg.features);\n const conceptRecs = arr(kg.concepts);\n const conceptById = new Map(conceptRecs.map((c) => [str(c.id), c]));\n\n // --- no phases -> legacy path (concepts first, then features) -----------\n if (rawPhases.length === 0) {\n for (const c of conceptRecs) {\n const node = feedNodeFromConcept(c);\n nodes.push(node);\n for (const p of strs(c.prerequisites)) edges.push({ from: p, to: node.id, kind: 'knowledge', reason: 'concept prerequisite' });\n }\n features.forEach((f, fi) => addFeatureGroup(f, str(f.id, 'F' + pad2(fi + 1)), nodes, edges, groupings));\n linkHybridKnowledgeEdges(hybrid, nodes, edges, true);\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'hybrid_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n }\n\n // --- phase-driven emission ----------------------------------------------\n const featureOrder = new Map<string, number>();\n features.forEach((f, fi) => featureOrder.set(str(f.id, 'F' + pad2(fi + 1)), fi));\n const stepIdsByFeature = new Map<string, string[]>();\n for (const f of features) {\n const fid = str(f.id);\n stepIdsByFeature.set(fid, arr(f.steps).map((s) => str(s.id)).filter(Boolean));\n }\n\n const emitCtx: EmitPhaseCtx[] = [];\n const emittedConcepts = new Set<string>();\n const previewsEmitted = new Set<string>();\n const linkList = arr(hybrid.links);\n\n for (const rp of rawPhases) {\n const pid = str(rp.id);\n const order = num(rp.order, emitCtx.length + 1);\n const conceptOrder: string[] = [];\n const intros = arr(rp.introduces);\n // new introductions first, then advanced revisits, then previews\n // (awareness passes — never the introduction itself)\n const news = intros.filter((i) => str(i.aspect, 'new') === 'new');\n const advanced = intros.filter((i) => str(i.aspect) === 'advanced');\n const previews = intros.filter((i) => str(i.aspect) === 'preview');\n for (const intro of [...news, ...advanced, ...previews]) {\n const cid = str(intro.concept_id);\n const c = conceptById.get(cid);\n if (!c) {\n throw new Error('Phase ' + pid + ' introduces unknown concept ' + cid + ' - fail-closed');\n }\n if (str(intro.aspect, 'new') === 'advanced' && !emittedConcepts.has(cid)) {\n throw new Error('Phase ' + pid + ' advanced-revisits concept ' + cid + ' that was never emitted - fail-closed');\n }\n if (str(intro.aspect, 'new') === 'preview') {\n if (emittedConcepts.has(cid)) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' that was already introduced - preview must precede the anchor teach - fail-closed');\n }\n if (previewsEmitted.has(cid)) {\n throw new Error('Phase ' + pid + ' duplicate preview of concept ' + cid + ' - fail-closed');\n }\n const pidIdx = rawPhases.findIndex((rp2) => str(rp2.id) === pid);\n const anchorIdx = rawPhases.findIndex((rp2) => arr(rp2.introduces).some((i2) => str(i2.concept_id) === cid && str(i2.aspect, 'new') !== 'preview'));\n if (anchorIdx < 0) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' that is never fully introduced in any phase - fail-closed');\n }\n if (pidIdx >= anchorIdx) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' whose anchor introduction is not in a LATER phase - fail-closed');\n }\n previewsEmitted.add(cid);\n // ULO awareness node: \"know it exists\". Keeps the concept vocabulary\n // (keywords.all) so the emitter's in-order pass makes the PREVIEW the\n // legitimate introducer of those words — a product step must never be\n // the introducer (the overtake guard's whole point). Depth pinned to\n // ulo, bloom to Understand, ~25% minutes, no prerequisite edges, no\n // scaffolding (nothing to practice yet).\n const prevNode = feedNodeFromConcept(c);\n prevNode.id = cid + '__PREV' + pad2(order);\n prevNode.name = str(c.name, cid) + ' (preview)';\n prevNode.phase_id = pid;\n prevNode.introduce_aspect = 'preview';\n prevNode.estimated_minutes = Math.max(5, Math.round(prevNode.estimated_minutes * 0.25));\n prevNode.depth_hint = 'ulo';\n prevNode.bloom_hint = 'Understand';\n prevNode.concept_codes = [str(c.code) || cid];\n prevNode.keywords = { all: strs(c.keywords), new: [], prerequisite: [] };\n prevNode.scaffolding = { scaffold_candidates: [], core_value_minutes: 0 };\n nodes.push(prevNode);\n conceptOrder.push(prevNode.id);\n continue;\n }\n if (!emittedConcepts.has(cid)) {\n const node = feedNodeFromConcept(c);\n node.phase_id = pid;\n node.introduce_aspect = 'new';\n nodes.push(node);\n for (const p of strs(c.prerequisites)) {\n if (!emittedConcepts.has(p)) {\n throw new Error('Concept ' + cid + ' (phase ' + pid + ') has prerequisite ' + p + ' that is not introduced in an earlier phase - fail-closed');\n }\n edges.push({ from: p, to: cid, kind: 'knowledge', reason: 'concept prerequisite' });\n }\n emittedConcepts.add(cid);\n conceptOrder.push(cid);\n } else {\n // advanced revisit: re-emit as a NEW node with a revisit id so the\n // planner can schedule the higher-depth pass without double-counting\n // the first introduction\n const revisitId = cid + '__ADV' + pad2(order);\n const node = feedNodeFromConcept(c);\n node.id = revisitId;\n node.name = str(c.name, cid) + ' (advanced)';\n node.phase_id = pid;\n node.introduce_aspect = 'advanced';\n node.estimated_minutes = Math.max(15, Math.round(node.estimated_minutes * 0.5));\n node.concept_codes = [str(c.code) || cid];\n edges.push({ from: cid, to: revisitId, kind: 'knowledge', reason: 'advanced revisit of ' + cid + ' at phase ' + pid });\n nodes.push(node);\n conceptOrder.push(revisitId);\n }\n }\n const featureIds = strs(rp.feature_ids)\n .filter((fid) => featureOrder.has(fid))\n .sort((a, b) => featureOrder.get(a)! - featureOrder.get(b)!);\n emitCtx.push({ id: pid, order, name: str(rp.name, pid), productCompletion: str(rp.product_completion), conceptOrder, featureIds });\n }\n\n // Fail-closed: every concept consumed by a link must be emitted somewhere\n for (const l of linkList) {\n const cid = str(l.concept_id);\n if (cid && conceptById.has(cid) && !emittedConcepts.has(cid)) {\n throw new Error('Concept ' + cid + ' is consumed by links but never introduced in any phase - fail-closed');\n }\n }\n // Fail-closed: every feature must sit in exactly one emitted phase\n const seenFeatures = new Set(emitCtx.flatMap((e) => e.featureIds));\n const missingFeatures = features.map((f) => str(f.id)).filter((fid) => fid && !seenFeatures.has(fid));\n if (missingFeatures.length > 0) {\n throw new Error('Features not covered by any phase: ' + missingFeatures.join(', ') + ' - fail-closed');\n }\n\n // Emit feature steps phase by phase (teaching sequence)\n const phaseNodeIds: string[][] = [];\n for (const ctx of emitCtx) {\n const ids: string[] = [...ctx.conceptOrder];\n for (const fid of ctx.featureIds) {\n const f = features.find((x) => str(x.id) === fid)!;\n const stepIds = addFeatureGroup(f, fid, nodes, edges, groupings);\n for (const sid of stepIds) {\n const node = nodes.find((n) => n.id === sid)!;\n node.phase_id = ctx.id;\n }\n ids.push(...stepIds);\n }\n phaseNodeIds.push(ids);\n }\n\n // Teaching-order emission (2026-09-17 incident): the nodes array MUST\n // follow the phase sequence. Downstream consumers (planner unit grouping,\n // keyword new/prerequisite labeling, keyword-edge materialization) treat\n // array order as teaching order; emitting \"all concepts first, steps\n // after\" diverged from the phase order and manufactured backwards\n // prerequisite edges across phases (e.g. C8 in PH3 labeled before a PH2\n // step that consumes its keyword) — a self-contradictory feed.\n const placed = new Set<string>(phaseNodeIds.flat());\n const orderedNodes: FeedNode[] = [];\n for (const ids of phaseNodeIds) {\n for (const id of ids) {\n const n = nodes.find((x) => x.id === id);\n if (n) orderedNodes.push(n);\n }\n }\n for (const n of nodes) if (!placed.has(n.id)) orderedNodes.push(n);\n nodes.length = 0;\n nodes.push(...orderedNodes);\n\n // Knowledge edges: concept -> first step of each consumer feature (JIT).\n // Deduped by (from,to): several links may target the same feature.\n const edgeSeen = new Set(edges.map((e) => e.from + '>' + e.to));\n const pushEdge = (from: string, to: string, reason: string) => {\n const key = from + '>' + to;\n if (edgeSeen.has(key)) return;\n edgeSeen.add(key);\n edges.push({ from, to, kind: 'knowledge', reason });\n };\n for (const l of linkList) {\n const cid = str(l.concept_id);\n const fid = str(l.feature_id);\n if (!conceptById.has(cid)) continue;\n const firstStep = (stepIdsByFeature.get(fid) || [])[0];\n if (!firstStep) continue;\n const depth = str(l.depth, 'cio');\n // Preview-aware guard: when the concept's anchor teach sits in a LATER\n // phase than the consumer step, the consumer is served by its __PREV\n // awareness node — the anchor edge would cross phases backwards. Never\n // manufacture it; record the drift instead.\n const anchorNode = nodes.find((n2) => n2.kind === 'concept' && n2.concept_ref === cid && n2.introduce_aspect === 'new');\n const stepNode = nodes.find((n2) => n2.id === firstStep);\n const anchorPhaseIdx = anchorNode ? emitCtx.findIndex((c2) => c2.id === anchorNode.phase_id) : -1;\n const stepPhaseIdx = stepNode ? emitCtx.findIndex((c2) => c2.id === stepNode.phase_id) : -1;\n if (emitCtx.length > 0 && anchorPhaseIdx > stepPhaseIdx) {\n pushWarning(opts, 'hybrid link drift: concept ' + cid + ' is fully taught in a later phase than consumer ' + firstStep + ' (a preview covers the dependency)');\n continue;\n }\n pushEdge(cid, firstStep, str(l.relationship, 'hybrid link') + ' [' + depth + ']');\n // Advanced revisits feed only features of the revisit's OWN phase: a PH2\n // revisit must never become a prerequisite of a PH1 feature (teaching\n // order is phase-ordered).\n for (const n of nodes) {\n if (n.kind === 'concept' && n.concept_ref === cid && n.introduce_aspect === 'advanced' && n.phase_id === str(l.phase_id)) {\n pushEdge(n.id, firstStep, 'advanced application [' + depth + ']');\n }\n }\n }\n\n newKeywordsInOrder(nodes);\n\n // Deterministic keyword-prerequisite materialization: when a node declares a\n // keyword as PREREQUISITE, some other node must INTRODUCE it (new) EARLIER in\n // feed order. Missing edge = planner can schedule the consumer first while the\n // audit flags ordering it cannot fix. Edge kind 'keyword' — the planner\n // honors it for topological order; 'mastered_before_course' entries are exempt\n // (entry-level keywords need no introducer).\n const feedOrder = new Map(nodes.map((n, i) => [n.id, i]));\n const introducer = new Map<string, string>();\n for (const n of nodes) for (const k of n.keywords?.new ?? []) {\n const key = k.toLowerCase();\n if (!introducer.has(key)) introducer.set(key, n.id);\n }\n for (const n of nodes) {\n for (const k of n.keywords?.prerequisite ?? []) {\n const src = introducer.get(k.toLowerCase());\n if (!src || src === n.id) continue;\n const srcNode = nodes.find((x) => x.id === src);\n // Phase-aware guard: when phases define teaching order, a keyword edge\n // must never cross phases backwards, and a CONCEPT must never be\n // \"introduced\" by a product STEP that happens to run earlier (the\n // graph anchored the concept downstream of its consumer — teaching\n // order would then declare the step as the origin of foundational\n // knowledge). Do NOT manufacture such edges: record the drift for the\n // host to repair (move the introducer earlier) and let\n // validateCurriculumFeed's teaching-order invariant be the hard gate.\n const phaseOf = (id: string): number => {\n const n2 = nodes.find((x) => x.id === id);\n return n2 ? emitCtx.findIndex((c) => c.id === n2.phase_id) : -1;\n };\n const conceptOvertaken = n.kind === 'concept' && srcNode?.kind === 'product_step';\n const fromPhase = phaseOf(src);\n const toPhase = phaseOf(n.id);\n if (conceptOvertaken || (emitCtx.length > 0 && fromPhase > toPhase)) {\n pushWarning(opts,\n 'keyword-order drift: introducer ' + src + ' sits in a later phase than consumer ' + n.id +\n ' (keyword \"' + k + '\") — host should move the introducer earlier',\n );\n continue;\n }\n if (feedOrder.get(src)! < feedOrder.get(n.id)!) pushEdge(src, n.id, 'keyword prerequisite [' + k + ']');\n }\n }\n\n const phases = emitCtx.map((ctx, i) => ({\n id: ctx.id,\n order: ctx.order,\n name: ctx.name,\n product_completion: ctx.productCompletion || 'Phase ' + (i + 1) + ' deliverable',\n node_ids: phaseNodeIds[i],\n }));\n\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'hybrid_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases,\n });\n}\n\n/** Legacy helper: knowledge edges from hybrid links (used by the no-phase path). */\nfunction linkHybridKnowledgeEdges(hybrid: Rec, nodes: FeedNode[], edges: FeedEdge[], setStepHints: boolean): void {\n const conceptIds = new Set(nodes.filter((n) => n.kind === 'concept').map((n) => n.concept_ref || n.id));\n for (const l of arr(hybrid.links)) {\n const conceptId = str(l.concept_id);\n const featureId = str(l.feature_id);\n if (!conceptIds.has(conceptId)) continue;\n const depth = str(l.depth, 'cio');\n const firstStep = nodes.find((n) => n.feature_id === featureId);\n if (firstStep) {\n edges.push({ from: conceptId, to: firstStep.id, kind: 'knowledge', reason: str(l.relationship, 'hybrid link') + ' [' + depth + ']' });\n if (setStepHints && !firstStep.depth_hint) {\n firstStep.depth_hint = (['ulo', 'cio', 'sio'] as const).includes(depth as 'ulo') ? (depth as FeedNode['depth_hint']) : 'cio';\n }\n }\n }\n}\n\nfunction emitFromKnowledge(kg: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n const conceptIds = new Set(arr(kg.concepts).map((c) => str(c.id)));\n for (const c of arr(kg.concepts)) {\n const node = feedNodeFromConcept(c);\n nodes.push(node);\n for (const p of strs(c.prerequisites)) {\n if (p !== node.id && conceptIds.has(p)) {\n edges.push({\n from: p,\n to: node.id,\n kind: 'knowledge',\n reason: `concept prerequisite: ${p} must be understood before ${node.id}`,\n });\n }\n }\n }\n\n // Sort nodes by learning_path order if present\n if (arr(kg.learning_path).length > 0) {\n const orderMap = new Map<string, number>();\n arr(kg.learning_path).forEach((s, idx) => {\n const cid = str(s.concept_id);\n if (cid) orderMap.set(cid, num(s.order, idx + 1));\n });\n nodes.sort((a, b) => (orderMap.get(a.id) ?? 999) - (orderMap.get(b.id) ?? 999));\n }\n\n let ci = 0;\n for (const cat of arr(kg.categories)) {\n ci += 1;\n const ids = strs(cat.concept_ids).filter((id) => nodes.some((n) => n.id === id));\n if (ids.length > 0) {\n groupings.push({\n id: str(cat.id, 'cat' + ci),\n name: str(cat.name, 'Category ' + ci),\n node_ids: ids,\n rationale: str(cat.description, ''),\n });\n }\n }\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'knowledge_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n}\n\nfunction emitFromProject(pg: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n arr(pg.features).forEach((f, fi) => addFeatureGroup(f, str(f.id, 'F' + pad2(fi + 1)), nodes, edges, groupings));\n if (nodes.length === 0 && arr(pg.features).length > 0) {\n const hasTasks = arr((pg.implementation ?? {}) as Rec).length > 0 || arr((pg.implementation as Rec | undefined)?.tasks).length > 0;\n throw new Error(\n 'Project graph has ' + arr(pg.features).length + ' features but NO features[].steps - the curriculum feed cannot emit planning nodes.' +\n (hasTasks\n ? ' This looks like a legacy knowledge-tree graph (implementation.tasks). Regenerate it with the domain-kit v3 pipeline (runProjectGraphPipeline / hybridGraphPipeline), then re-run.'\n : ' Every feature must carry at least one step with id/name/keywords/effort for curriculum planning.'),\n );\n }\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'project_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n}\n\n/** Emit a CurriculumFeed from whichever graph shape is provided (already verified upstream). */\nexport function emitCurriculumFeed(\n graph: unknown,\n opts: EmitFeedOptions = {},\n): CurriculumFeed {\n const g = graph as Rec;\n if (arr(g.learning_nodes).length > 0) {\n return validateCurriculumFeed(g); // already a feed - pass-through validation\n }\n if (g.project_graph || g.knowledge_graph || arr(g.links).length > 0 || arr(g.phases).length > 0) {\n return emitFromHybrid(g, opts);\n }\n if (arr(g.concepts).length > 0 || str(g.type) === 'knowledge_graph') return emitFromKnowledge(g, opts);\n return emitFromProject(g, opts);\n}\n"]}
1
+ {"version":3,"sources":["../../src/schemas/curriculumFeedSchema.ts","../../src/feed/curriculumFeedEmitter.ts"],"names":["z"],"mappings":";;;;;AAUO,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,GAAA,EAAKA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EACnC,GAAA,EAAKA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EACnC,YAAA,EAAcA,MAAE,KAAA,CAAMA,KAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE;AAC9C,CAAC,CAAA;AAEM,IAAM,2BAAA,GAA8BA,MAAE,MAAA,CAAO;AAAA,EAClD,IAAA,EAAMA,MAAE,MAAA,EAAO;AAAA,EACf,MAAA,EAAQA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE,CAAA;AAAA,EAC7B,aAAA,EAAeA,MAAE,MAAA,EAAO,CAAE,KAAI,CAAE,WAAA,EAAY,CAAE,OAAA,CAAQ,CAAC,CAAA;AAAA,EACvD,OAAA,EAASA,KAAA,CAAE,IAAA,CAAK,CAAC,cAAA,EAAgB,mBAAmB,mBAAmB,CAAC,CAAA,CAAE,OAAA,CAAQ,cAAc;AAClG,CAAC,CAAA;AAEM,IAAM,cAAA,GAAiBA,MAAE,MAAA,CAAO;AAAA,EACrC,EAAA,EAAIA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,MAAMA,KAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,SAAA,EAAW,cAA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AAA,IAAsB,CAAA,EAAE;AAAA,IACxH,cAAA,EAAgB,KAAA;AAAA,IAChB,gBAAA,EAAkB,KAAA;AAAA,IAClB,mBAAA,EAAqB,SAAA;AAAA,IACrB,QAAQ;AAAC,GACV,CAAA;AACH;AAGO,SAAS,kBAAA,CACd,KAAA,EACA,IAAA,GAAwB,EAAC,EACT;AAChB,EAAA,MAAM,CAAA,GAAI,KAAA;AACV,EAAA,IAAI,GAAA,CAAI,CAAA,CAAE,cAAc,CAAA,CAAE,SAAS,CAAA,EAAG;AACpC,IAAA,OAAO,uBAAuB,CAAC,CAAA;AAAA,EACjC;AACA,EAAA,IAAI,CAAA,CAAE,aAAA,IAAiB,CAAA,CAAE,eAAA,IAAmB,IAAI,CAAA,CAAE,KAAK,CAAA,CAAE,MAAA,GAAS,KAAK,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,CAAE,SAAS,CAAA,EAAG;AAC/F,IAAA,OAAO,cAAA,CAAe,GAAG,IAAI,CAAA;AAAA,EAC/B;AACA,EAAA,IAAI,GAAA,CAAI,CAAA,CAAE,QAAQ,CAAA,CAAE,SAAS,CAAA,IAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,KAAM,iBAAA,EAAmB,OAAO,iBAAA,CAAkB,GAAG,IAAI,CAAA;AACrG,EAAA,OAAO,eAAA,CAAgB,GAAG,IAAI,CAAA;AAChC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * CurriculumFeed v2 — normalized, planner-ready projection of a domain graph.\n * Consumers: curriculum-kit Curriculum Planner (see docs/ideas/2026-08-30-curriculum-feed-v2-output.md).\n * Guarantees enforced here: cycle-free is the CALLER's verifier job; the feed\n * itself guarantees resolution (edges/keywords reference emitted nodes) and\n * non-emptiness.\n */\n\nexport const FeedKeywordsSchema = z.object({\n all: z.array(z.string()).default([]),\n new: z.array(z.string()).default([]),\n prerequisite: z.array(z.string()).default([]),\n});\n\nexport const FeedScaffoldCandidateSchema = z.object({\n item: z.string(),\n reason: z.string().default(''),\n minutes_saved: z.number().int().nonnegative().default(0),\n suggest: z.enum(['provide_full', 'provide_partial', 'provide_reference']).default('provide_full'),\n});\n\nexport const FeedNodeSchema = z.object({\n id: z.string().min(1),\n kind: z.enum(['skill', 'concept', 'product_step']),\n name: z.string().min(1),\n concept_codes: z.array(z.string()).default([]),\n keywords: FeedKeywordsSchema,\n estimated_minutes: z.number().int().nonnegative(),\n bloom_hint: z.enum(['Remember', 'Understand', 'Apply', 'Analyze', 'Evaluate', 'Create']).nullable().default(null),\n depth_hint: z.enum(['ulo', 'cio', 'sio']).nullable().default(null),\n completion_level: z.enum(['mvp', 'standard', 'stretch']).default('standard'),\n scaffolding: z.object({\n scaffold_candidates: z.array(FeedScaffoldCandidateSchema).default([]),\n core_value_minutes: z.number().int().nonnegative().default(0),\n }).default({ scaffold_candidates: [], core_value_minutes: 0 }),\n references: z.array(z.object({ file: z.string().min(1), evidence: z.string().default('') })).default([]),\n feature_id: z.string().nullable().default(null),\n concept_ref: z.string().nullable().default(null),\n // P52/T2.1: outcome.user_visible projected from the ProjectGraph step — the\n // tangible checkpoint the session-cutting planner aims for (empty when the\n // step declares no user-visible result). Concepts carry '' by default.\n user_visible_deliverable: z.string().default(''),\n // P52/T3.1 — depth-reconcile inputs (optional/defaulted so old feeds\n // validate unchanged):\n // • depth_variants: minutes to teach this node at each depth level.\n // ULO (know-it-exists) ≤ CIO (mechanism) ≤ SIO (implementation). All 3\n // required so a downgrade never turns an anchor teach into a zero.\n // • depth_scaffold_candidates: parallel to scaffold_candidates but\n // acts on DEPTH (e.g. SIO→CIO) instead of lesson time.\n // • is_core: concept is a Master-Tree core concept — reconciler must\n // never downgrade it; escalate instead.\n depth_variants: z.object({ ulo: z.number().int().nonnegative(), cio: z.number().int().nonnegative(), sio: z.number().int().nonnegative() }).optional(),\n depth_scaffold_candidates: z.array(z.object({\n from_depth: z.enum(['ulo', 'cio', 'sio']),\n to_depth: z.enum(['ulo', 'cio', 'sio']),\n minutes_saved: z.number().int().nonnegative(),\n reason: z.string().default(''),\n })).optional(),\n is_core: z.boolean().default(false),\n // Depth layer text (optional, additive — old feeds validate unchanged).\n // Carries the ULO/CIO/SIO authored text from the KnowledgeGraph concept\n // so downstream consumers (KX generator) can inject depth-appropriate\n // material into their prompts without a second LLM call.\n depth_context: z.object({\n ulo: z.string().default(''),\n cio: z.string().default(''),\n sio: z.array(z.string()).default([]),\n }).optional(),\n // Progressive-completion bookkeeping (feed v2, additive):\n // phase_id = development phase that introduces/uses this node;\n // introduce_aspect = how the phase teaches a concept node (first intro, advanced\n // revisit, or preview — a light ULO awareness pass that is NOT the introduction).\n phase_id: z.string().default(''),\n introduce_aspect: z.enum(['new', 'advanced', 'preview']).nullable().default(null),\n});\n\nexport const FeedEdgeSchema = z.object({\n from: z.string().min(1),\n to: z.string().min(1),\n kind: z.enum(['knowledge', 'task']),\n reason: z.string().default(''),\n});\n\nexport const FeedGroupingSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n node_ids: z.array(z.string()).min(1),\n rationale: z.string().default(''),\n});\n\nexport const FeedPhaseSchema = z.object({\n id: z.string().min(1),\n order: z.number().int().positive(),\n name: z.string().min(1),\n product_completion: z.string().min(1),\n node_ids: z.array(z.string()).min(1),\n});\nexport type FeedPhase = z.infer<typeof FeedPhaseSchema>;\n\nexport const CurriculumFeedSchema = z.object({\n schema_version: z.literal(2),\n source: z.object({\n graph_type: z.enum(['project_graph', 'knowledge_graph', 'hybrid_graph']),\n warnings: z.array(z.string()).default([]),\n hallucination_count: z.number().int().nonnegative().default(0),\n }),\n learning_nodes: z.array(FeedNodeSchema).min(1, 'curriculum feed must contain at least one learning node'),\n dependency_edges: z.array(FeedEdgeSchema).default([]),\n suggested_groupings: z.array(FeedGroupingSchema).default([]),\n // Progressive completion phases (cross-feature). When non-empty, these — not\n // suggested_groupings — define the teaching sequence and unit structure.\n phases: z.array(FeedPhaseSchema).default([]),\n});\n\nexport type CurriculumFeed = z.infer<typeof CurriculumFeedSchema>;\nexport type FeedNode = z.infer<typeof FeedNodeSchema>;\nexport type FeedEdge = z.infer<typeof FeedEdgeSchema>;\nexport type FeedGrouping = z.infer<typeof FeedGroupingSchema>;\n\n/** Strict pre-save resolution validation — fail-closed, no defaulted-empty graphs. */\nexport function validateCurriculumFeed(feed: unknown): CurriculumFeed {\n const parsed = CurriculumFeedSchema.parse(feed);\n const ids = new Set(parsed.learning_nodes.map((n) => n.id));\n if (ids.size !== parsed.learning_nodes.length) {\n throw new Error('curriculum feed contains duplicate node ids');\n }\n for (const e of parsed.dependency_edges) {\n if (!ids.has(e.from) || !ids.has(e.to)) {\n throw new Error('curriculum feed edge ' + e.from + ' -> ' + e.to + ' references unknown node');\n }\n if (e.from === e.to) throw new Error('curriculum feed self-loop edge on ' + e.from);\n }\n for (const g of parsed.suggested_groupings) {\n for (const id of g.node_ids) {\n if (!ids.has(id)) throw new Error('grouping ' + g.id + ' references unknown node ' + id);\n }\n }\n for (const ph of parsed.phases) {\n for (const id of ph.node_ids) {\n if (!ids.has(id)) throw new Error('phase ' + ph.id + ' references unknown node ' + id);\n }\n }\n const phaseIds = parsed.phases.map((p) => p.id);\n if (new Set(phaseIds).size !== phaseIds.length) throw new Error('curriculum feed contains duplicate phase ids');\n // Teaching-order invariant (2026-09-17 incident): when phases define the\n // teaching sequence, a prerequisite must live in the same or an EARLIER\n // phase than its consumer. Without this check a self-contradictory feed\n // (backwards phase-crossing edge) sailed through emission and only exploded\n // much later inside the planner as \"Teaching-order violation in session ...\"\n // — far from the constructor that produced the contradiction.\n if (parsed.phases.length > 0) {\n const phaseIndexOf = new Map<string, number>();\n parsed.phases.forEach((p, i) => {\n for (const id of p.node_ids) phaseIndexOf.set(id, i);\n });\n for (const e of parsed.dependency_edges) {\n const fromIdx = phaseIndexOf.get(e.from);\n const toIdx = phaseIndexOf.get(e.to);\n if (fromIdx === undefined || toIdx === undefined) continue; // node outside the phase sequence\n if (fromIdx > toIdx) {\n throw new Error(\n 'curriculum feed teaching-order violation: prerequisite ' + e.from +\n ' (phase ' + (fromIdx + 1) + ') is scheduled AFTER its consumer ' + e.to +\n ' (phase ' + (toIdx + 1) + ')',\n );\n }\n }\n }\n return parsed;\n}\n","import {\n validateCurriculumFeed, type CurriculumFeed, type FeedNode, type FeedEdge, type FeedGrouping,\n} from '../schemas/curriculumFeedSchema';\n\n/**\n * CurriculumFeed emitter - pure transformation from a VERIFIED domain graph\n * to the planner-ready feed. No LLM calls: hints derive from existing\n * annotations only. Validates its own output (fail-closed).\n *\n * Phase-driven emission (hybrid graphs with development phases): the teaching\n * sequence IS the phase sequence. Concepts are emitted at the phase that\n * introduces them (aspect new) or revisits them at higher depth (aspect\n * advanced) - never as a trailing knowledge appendix. Concept minutes stay\n * UNMERGED: no prerequisite-minute inflation (the planner schedules the\n * revisit, not the total).\n */\n\nexport interface EmitFeedOptions {\n hallucinationCount?: number;\n warnings?: string[];\n}\n\nconst BLOOM_RANK: Record<string, number> = { Remember: 0, Understand: 1, Apply: 2, Analyze: 3, Evaluate: 4, Create: 5 };\nconst pad2 = (n: number): string => String(n).padStart(2, '0');\n\ntype Rec = Record<string, unknown>;\nconst arr = (v: unknown): Rec[] => (Array.isArray(v) ? (v as Rec[]) : []);\nconst str = (v: unknown, d = ''): string => (typeof v === 'string' ? v : d);\nconst num = (v: unknown, d: number): number => (typeof v === 'number' && Number.isFinite(v) ? v : d);\nconst strs = (v: unknown): string[] => (Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : []);\n\nfunction stepMinutes(step: Rec): number {\n const effort = (step.effort ?? {}) as Rec;\n return Math.max(0, Math.round(num(effort.estimated_minutes, num(step.estimated_minutes, 45))));\n}\n\nfunction pushWarning(opts: EmitFeedOptions, message: string): void {\n (opts.warnings ?? (opts.warnings = [])).push(message);\n}\n\nfunction newKeywordsInOrder(nodes: FeedNode[]): void {\n // First appearance in emission order becomes 'new'; everything seen before is 'prerequisite'.\n const seen = new Set<string>();\n for (const n of nodes) {\n const all = n.keywords.all;\n n.keywords.new = [];\n n.keywords.prerequisite = [];\n for (const k of all) {\n if (seen.has(k)) n.keywords.prerequisite.push(k);\n else n.keywords.new.push(k);\n seen.add(k);\n }\n }\n}\n\nfunction feedNodeFromStep(step: Rec, featureId: string): FeedNode {\n const id = str(step.id);\n return {\n id,\n kind: 'product_step',\n name: str(step.name, id),\n concept_codes: strs(step.concept_codes),\n keywords: { all: strs(step.keywords), new: [], prerequisite: [] },\n estimated_minutes: stepMinutes(step),\n bloom_hint: 'Apply',\n depth_hint: null,\n completion_level: 'standard',\n scaffolding: { scaffold_candidates: [], core_value_minutes: stepMinutes(step) },\n references: arr(step.files).map((f) => ({ file: str(f), evidence: 'step file' })).filter((f) => f.file),\n feature_id: featureId,\n concept_ref: null,\n // P52/T2.1: carry the step's tangible outcome so the planner can cut\n // sessions at user-visible checkpoints instead of raw minute counts.\n user_visible_deliverable: str((step.outcome as Rec | undefined)?.user_visible),\n is_core: false,\n phase_id: '',\n introduce_aspect: null,\n };\n}\n\nfunction deriveConceptDepthHint(concept: Rec): FeedNode['depth_hint'] {\n const explicit = str(concept.depth_hint);\n if (explicit === 'ulo' || explicit === 'cio' || explicit === 'sio') return explicit;\n\n const sio = arr(concept.sio);\n const prereqs = strs(concept.prerequisites);\n const pts = arr(concept.problem_types);\n const hasHighBloom = pts.some((p) => {\n const b = str(p.bloom_level);\n return b === 'Apply' || b === 'Analyze' || b === 'Evaluate' || b === 'Create';\n });\n\n if (sio.length >= 2 || hasHighBloom) return 'sio';\n if (str(concept.cio) || prereqs.length >= 1) return 'cio';\n return 'ulo';\n}\n\n/**\n * P52/T3.1: minute estimates per depth level for one concept occurrence.\n * ULO (know-it-exists) is a fraction of the full teach; SIO (implementation)\n * equals the feed's estimated minutes. Only DOWNWARD candidates are offered\n * and the ULO floor is never crossed (planner filters is_core itself).\n */\nfunction deriveDepthInputs(minutes: number, depth: FeedNode['depth_hint']): Pick<FeedNode, 'depth_variants' | 'depth_scaffold_candidates'> {\n const ulo = Math.max(5, Math.round(minutes * 0.35));\n const cio = Math.max(ulo + 5, Math.round(minutes * 0.65));\n const sio = Math.max(cio + 5, minutes);\n const variants = { ulo, cio, sio };\n const candidates: NonNullable<FeedNode['depth_scaffold_candidates']> = [];\n if (depth === 'sio') {\n candidates.push({ from_depth: 'sio', to_depth: 'cio', minutes_saved: sio - cio, reason: 'SIO implementation practice deferred — CIO mechanism suffices for downstream consumers' });\n }\n if (depth === 'cio' || depth === 'sio') {\n candidates.push({ from_depth: depth, to_depth: 'ulo', minutes_saved: (depth === 'sio' ? sio : cio) - ulo, reason: 'Mechanism deferred — ULO awareness suffices (know-it-exists); never below the ULO floor' });\n }\n return { depth_variants: variants, depth_scaffold_candidates: candidates };\n}\n\nfunction feedNodeFromConcept(concept: Rec): FeedNode {\n const id = str(concept.id);\n const pts = arr(concept.problem_types)\n .map((p) => str(p.bloom_level, 'Understand'))\n .filter((b) => b in BLOOM_RANK)\n .sort((a, b) => BLOOM_RANK[a] - BLOOM_RANK[b]);\n const topBloom = pts[pts.length - 1] ?? 'Understand';\n\n const rawRefs = arr(concept.references);\n const references = rawRefs.length > 0\n ? rawRefs.map((r) => ({ file: str(r.file, 'syllabus.md'), evidence: str(r.evidence, str(concept.name)) })).filter((r) => r.file)\n : [{ file: 'syllabus.md', evidence: str(concept.category ? `Topic under category ${str(concept.category)}` : str(concept.name), id) }];\n\n const problemScaffolds = arr(concept.problem_types).map((pt) => ({\n item: str(pt.name, 'Problem type'),\n reason: str(pt.description, 'Formative practice check'),\n minutes_saved: num(pt.estimated_minutes, 10),\n suggest: 'provide_partial' as const,\n }));\n\n return {\n id,\n kind: 'concept',\n name: str(concept.name, id),\n concept_codes: [str(concept.code) || id].filter(Boolean),\n keywords: { all: strs(concept.keywords), new: [], prerequisite: [] },\n estimated_minutes: Math.max(0, Math.round(num(concept.estimated_minutes, 15))),\n bloom_hint: topBloom as FeedNode['bloom_hint'],\n depth_hint: deriveConceptDepthHint(concept),\n completion_level: 'standard',\n scaffolding: {\n scaffold_candidates: problemScaffolds,\n core_value_minutes: Math.max(0, Math.round(num(concept.estimated_minutes, 15))),\n },\n references,\n feature_id: null,\n concept_ref: id,\n user_visible_deliverable: '', // concepts are taught, not shipped — checkpoints live on product steps\n ...deriveDepthInputs(Math.max(0, Math.round(num(concept.estimated_minutes, 15))), deriveConceptDepthHint(concept)),\n is_core: false,\n depth_context: {\n ulo: str(concept.ulo),\n cio: str(concept.cio),\n sio: strs(concept.sio),\n },\n phase_id: '',\n introduce_aspect: null,\n };\n}\n\nfunction addFeatureGroup(\n f: Rec, fid: string, nodes: FeedNode[], edges: FeedEdge[], groupings: FeedGrouping[],\n): string[] {\n const steps = arr(f.steps);\n const stepIds: string[] = [];\n let prev = '';\n for (let i = 0; i < steps.length; i++) {\n const stepNode = feedNodeFromStep(steps[i], fid);\n if (!stepNode.id) continue;\n stepIds.push(stepNode.id);\n nodes.push(stepNode);\n if (prev) edges.push({ from: prev, to: stepNode.id, kind: 'task', reason: 'feature build order' });\n prev = stepNode.id;\n }\n for (const dep of strs(f.depends_on)) {\n const depFirst = nodes.find((n) => n.feature_id === dep);\n if (depFirst && stepIds[0]) edges.push({ from: depFirst.id, to: stepIds[0], kind: 'task', reason: 'feature depends_on ' + dep });\n }\n if (stepIds.length > 0) groupings.push({ id: 'G-' + fid, name: str(f.name, fid), node_ids: stepIds, rationale: str(f.description, '') });\n return stepIds;\n}\n\ninterface EmitPhaseCtx {\n id: string;\n order: number;\n name: string;\n productCompletion: string;\n conceptOrder: string[]; // concept node ids in teaching order (new first, then advanced)\n featureIds: string[];\n}\n\n/**\n * Phase-driven hybrid emission:\n * - emit concepts per phase (aspect new first, then advanced) BEFORE the\n * phase's features; knowledge edges concept -> first step of consumer\n * features carry the JIT relation\n * - feature order inside a phase follows the project graph order\n * - phases and their node_ids go into feed.phases (teaching sequence)\n * - concept minutes stay UNMERGED (no prereq-minute accumulation)\n */\nfunction emitFromHybrid(hybrid: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n const pg = (hybrid.project_graph ?? {}) as Rec;\n const kg = (hybrid.knowledge_graph ?? {}) as Rec;\n const rawPhases = arr(hybrid.phases).filter((p) => str(p.id));\n\n const features = arr(pg.features);\n const conceptRecs = arr(kg.concepts);\n const conceptById = new Map(conceptRecs.map((c) => [str(c.id), c]));\n\n // --- no phases -> legacy path (concepts first, then features) -----------\n if (rawPhases.length === 0) {\n for (const c of conceptRecs) {\n const node = feedNodeFromConcept(c);\n nodes.push(node);\n for (const p of strs(c.prerequisites)) edges.push({ from: p, to: node.id, kind: 'knowledge', reason: 'concept prerequisite' });\n }\n features.forEach((f, fi) => addFeatureGroup(f, str(f.id, 'F' + pad2(fi + 1)), nodes, edges, groupings));\n linkHybridKnowledgeEdges(hybrid, nodes, edges, true);\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'hybrid_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n }\n\n // --- phase-driven emission ----------------------------------------------\n const featureOrder = new Map<string, number>();\n features.forEach((f, fi) => featureOrder.set(str(f.id, 'F' + pad2(fi + 1)), fi));\n const stepIdsByFeature = new Map<string, string[]>();\n for (const f of features) {\n const fid = str(f.id);\n stepIdsByFeature.set(fid, arr(f.steps).map((s) => str(s.id)).filter(Boolean));\n }\n\n const emitCtx: EmitPhaseCtx[] = [];\n const emittedConcepts = new Set<string>();\n const previewsEmitted = new Set<string>();\n const linkList = arr(hybrid.links);\n\n for (const rp of rawPhases) {\n const pid = str(rp.id);\n const order = num(rp.order, emitCtx.length + 1);\n const conceptOrder: string[] = [];\n const intros = arr(rp.introduces);\n // new introductions first, then advanced revisits, then previews\n // (awareness passes — never the introduction itself)\n const news = intros.filter((i) => str(i.aspect, 'new') === 'new');\n const advanced = intros.filter((i) => str(i.aspect) === 'advanced');\n const previews = intros.filter((i) => str(i.aspect) === 'preview');\n for (const intro of [...news, ...advanced, ...previews]) {\n const cid = str(intro.concept_id);\n const c = conceptById.get(cid);\n if (!c) {\n throw new Error('Phase ' + pid + ' introduces unknown concept ' + cid + ' - fail-closed');\n }\n if (str(intro.aspect, 'new') === 'advanced' && !emittedConcepts.has(cid)) {\n throw new Error('Phase ' + pid + ' advanced-revisits concept ' + cid + ' that was never emitted - fail-closed');\n }\n if (str(intro.aspect, 'new') === 'preview') {\n if (emittedConcepts.has(cid)) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' that was already introduced - preview must precede the anchor teach - fail-closed');\n }\n if (previewsEmitted.has(cid)) {\n throw new Error('Phase ' + pid + ' duplicate preview of concept ' + cid + ' - fail-closed');\n }\n const pidIdx = rawPhases.findIndex((rp2) => str(rp2.id) === pid);\n const anchorIdx = rawPhases.findIndex((rp2) => arr(rp2.introduces).some((i2) => str(i2.concept_id) === cid && str(i2.aspect, 'new') !== 'preview'));\n if (anchorIdx < 0) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' that is never fully introduced in any phase - fail-closed');\n }\n if (pidIdx >= anchorIdx) {\n throw new Error('Phase ' + pid + ' previews concept ' + cid + ' whose anchor introduction is not in a LATER phase - fail-closed');\n }\n previewsEmitted.add(cid);\n // ULO awareness node: \"know it exists\". Keeps the concept vocabulary\n // (keywords.all) so the emitter's in-order pass makes the PREVIEW the\n // legitimate introducer of those words — a product step must never be\n // the introducer (the overtake guard's whole point). Depth pinned to\n // ulo, bloom to Understand, ~25% minutes, no prerequisite edges, no\n // scaffolding (nothing to practice yet).\n const prevNode = feedNodeFromConcept(c);\n prevNode.id = cid + '__PREV' + pad2(order);\n prevNode.name = str(c.name, cid) + ' (preview)';\n prevNode.phase_id = pid;\n prevNode.introduce_aspect = 'preview';\n prevNode.estimated_minutes = Math.max(5, Math.round(prevNode.estimated_minutes * 0.25));\n prevNode.depth_hint = 'ulo';\n prevNode.bloom_hint = 'Understand';\n prevNode.concept_codes = [str(c.code) || cid];\n prevNode.keywords = { all: strs(c.keywords), new: [], prerequisite: [] };\n prevNode.scaffolding = { scaffold_candidates: [], core_value_minutes: 0 };\n prevNode.depth_variants = { ulo: prevNode.estimated_minutes, cio: prevNode.estimated_minutes, sio: prevNode.estimated_minutes };\n prevNode.depth_scaffold_candidates = []; // nothing to downgrade — it IS the floor\n nodes.push(prevNode);\n conceptOrder.push(prevNode.id);\n continue;\n }\n if (!emittedConcepts.has(cid)) {\n const node = feedNodeFromConcept(c);\n node.phase_id = pid;\n node.introduce_aspect = 'new';\n nodes.push(node);\n for (const p of strs(c.prerequisites)) {\n if (!emittedConcepts.has(p)) {\n throw new Error('Concept ' + cid + ' (phase ' + pid + ') has prerequisite ' + p + ' that is not introduced in an earlier phase - fail-closed');\n }\n edges.push({ from: p, to: cid, kind: 'knowledge', reason: 'concept prerequisite' });\n }\n emittedConcepts.add(cid);\n conceptOrder.push(cid);\n } else {\n // advanced revisit: re-emit as a NEW node with a revisit id so the\n // planner can schedule the higher-depth pass without double-counting\n // the first introduction\n const revisitId = cid + '__ADV' + pad2(order);\n const node = feedNodeFromConcept(c);\n node.id = revisitId;\n node.name = str(c.name, cid) + ' (advanced)';\n node.phase_id = pid;\n node.introduce_aspect = 'advanced';\n 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' }];\n node.estimated_minutes = Math.max(15, Math.round(node.estimated_minutes * 0.5));\n node.concept_codes = [str(c.code) || cid];\n edges.push({ from: cid, to: revisitId, kind: 'knowledge', reason: 'advanced revisit of ' + cid + ' at phase ' + pid });\n nodes.push(node);\n conceptOrder.push(revisitId);\n }\n }\n const featureIds = strs(rp.feature_ids)\n .filter((fid) => featureOrder.has(fid))\n .sort((a, b) => featureOrder.get(a)! - featureOrder.get(b)!);\n emitCtx.push({ id: pid, order, name: str(rp.name, pid), productCompletion: str(rp.product_completion), conceptOrder, featureIds });\n }\n\n // Fail-closed: every concept consumed by a link must be emitted somewhere\n for (const l of linkList) {\n const cid = str(l.concept_id);\n if (cid && conceptById.has(cid) && !emittedConcepts.has(cid)) {\n throw new Error('Concept ' + cid + ' is consumed by links but never introduced in any phase - fail-closed');\n }\n }\n // Fail-closed: every feature must sit in exactly one emitted phase\n const seenFeatures = new Set(emitCtx.flatMap((e) => e.featureIds));\n const missingFeatures = features.map((f) => str(f.id)).filter((fid) => fid && !seenFeatures.has(fid));\n if (missingFeatures.length > 0) {\n throw new Error('Features not covered by any phase: ' + missingFeatures.join(', ') + ' - fail-closed');\n }\n\n // Emit feature steps phase by phase (teaching sequence)\n const phaseNodeIds: string[][] = [];\n for (const ctx of emitCtx) {\n const ids: string[] = [...ctx.conceptOrder];\n for (const fid of ctx.featureIds) {\n const f = features.find((x) => str(x.id) === fid)!;\n const stepIds = addFeatureGroup(f, fid, nodes, edges, groupings);\n for (const sid of stepIds) {\n const node = nodes.find((n) => n.id === sid)!;\n node.phase_id = ctx.id;\n }\n ids.push(...stepIds);\n }\n phaseNodeIds.push(ids);\n }\n\n // Teaching-order emission (2026-09-17 incident): the nodes array MUST\n // follow the phase sequence. Downstream consumers (planner unit grouping,\n // keyword new/prerequisite labeling, keyword-edge materialization) treat\n // array order as teaching order; emitting \"all concepts first, steps\n // after\" diverged from the phase order and manufactured backwards\n // prerequisite edges across phases (e.g. C8 in PH3 labeled before a PH2\n // step that consumes its keyword) — a self-contradictory feed.\n const placed = new Set<string>(phaseNodeIds.flat());\n const orderedNodes: FeedNode[] = [];\n for (const ids of phaseNodeIds) {\n for (const id of ids) {\n const n = nodes.find((x) => x.id === id);\n if (n) orderedNodes.push(n);\n }\n }\n for (const n of nodes) if (!placed.has(n.id)) orderedNodes.push(n);\n nodes.length = 0;\n nodes.push(...orderedNodes);\n\n // Knowledge edges: concept -> first step of each consumer feature (JIT).\n // Deduped by (from,to): several links may target the same feature.\n const edgeSeen = new Set(edges.map((e) => e.from + '>' + e.to));\n const pushEdge = (from: string, to: string, reason: string) => {\n const key = from + '>' + to;\n if (edgeSeen.has(key)) return;\n edgeSeen.add(key);\n edges.push({ from, to, kind: 'knowledge', reason });\n };\n for (const l of linkList) {\n const cid = str(l.concept_id);\n const fid = str(l.feature_id);\n if (!conceptById.has(cid)) continue;\n const firstStep = (stepIdsByFeature.get(fid) || [])[0];\n if (!firstStep) continue;\n const depth = str(l.depth, 'cio');\n // Preview-aware guard: when the concept's anchor teach sits in a LATER\n // phase than the consumer step, the consumer is served by its __PREV\n // awareness node — the anchor edge would cross phases backwards. Never\n // manufacture it; record the drift instead.\n const anchorNode = nodes.find((n2) => n2.kind === 'concept' && n2.concept_ref === cid && n2.introduce_aspect === 'new');\n const stepNode = nodes.find((n2) => n2.id === firstStep);\n const anchorPhaseIdx = anchorNode ? emitCtx.findIndex((c2) => c2.id === anchorNode.phase_id) : -1;\n const stepPhaseIdx = stepNode ? emitCtx.findIndex((c2) => c2.id === stepNode.phase_id) : -1;\n if (emitCtx.length > 0 && anchorPhaseIdx > stepPhaseIdx) {\n pushWarning(opts, 'hybrid link drift: concept ' + cid + ' is fully taught in a later phase than consumer ' + firstStep + ' (a preview covers the dependency)');\n continue;\n }\n pushEdge(cid, firstStep, str(l.relationship, 'hybrid link') + ' [' + depth + ']');\n // Advanced revisits feed only features of the revisit's OWN phase: a PH2\n // revisit must never become a prerequisite of a PH1 feature (teaching\n // order is phase-ordered).\n for (const n of nodes) {\n if (n.kind === 'concept' && n.concept_ref === cid && n.introduce_aspect === 'advanced' && n.phase_id === str(l.phase_id)) {\n pushEdge(n.id, firstStep, 'advanced application [' + depth + ']');\n }\n }\n }\n\n newKeywordsInOrder(nodes);\n\n // Deterministic keyword-prerequisite materialization: when a node declares a\n // keyword as PREREQUISITE, some other node must INTRODUCE it (new) EARLIER in\n // feed order. Missing edge = planner can schedule the consumer first while the\n // audit flags ordering it cannot fix. Edge kind 'keyword' — the planner\n // honors it for topological order; 'mastered_before_course' entries are exempt\n // (entry-level keywords need no introducer).\n const feedOrder = new Map(nodes.map((n, i) => [n.id, i]));\n const introducer = new Map<string, string>();\n for (const n of nodes) for (const k of n.keywords?.new ?? []) {\n const key = k.toLowerCase();\n if (!introducer.has(key)) introducer.set(key, n.id);\n }\n for (const n of nodes) {\n for (const k of n.keywords?.prerequisite ?? []) {\n const src = introducer.get(k.toLowerCase());\n if (!src || src === n.id) continue;\n const srcNode = nodes.find((x) => x.id === src);\n // Phase-aware guard: when phases define teaching order, a keyword edge\n // must never cross phases backwards, and a CONCEPT must never be\n // \"introduced\" by a product STEP that happens to run earlier (the\n // graph anchored the concept downstream of its consumer — teaching\n // order would then declare the step as the origin of foundational\n // knowledge). Do NOT manufacture such edges: record the drift for the\n // host to repair (move the introducer earlier) and let\n // validateCurriculumFeed's teaching-order invariant be the hard gate.\n const phaseOf = (id: string): number => {\n const n2 = nodes.find((x) => x.id === id);\n return n2 ? emitCtx.findIndex((c) => c.id === n2.phase_id) : -1;\n };\n const conceptOvertaken = n.kind === 'concept' && srcNode?.kind === 'product_step';\n const fromPhase = phaseOf(src);\n const toPhase = phaseOf(n.id);\n if (conceptOvertaken || (emitCtx.length > 0 && fromPhase > toPhase)) {\n pushWarning(opts,\n 'keyword-order drift: introducer ' + src + ' sits in a later phase than consumer ' + n.id +\n ' (keyword \"' + k + '\") — host should move the introducer earlier',\n );\n continue;\n }\n if (feedOrder.get(src)! < feedOrder.get(n.id)!) pushEdge(src, n.id, 'keyword prerequisite [' + k + ']');\n }\n }\n\n const phases = emitCtx.map((ctx, i) => ({\n id: ctx.id,\n order: ctx.order,\n name: ctx.name,\n product_completion: ctx.productCompletion || 'Phase ' + (i + 1) + ' deliverable',\n node_ids: phaseNodeIds[i],\n }));\n\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'hybrid_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases,\n });\n}\n\n/** Legacy helper: knowledge edges from hybrid links (used by the no-phase path). */\nfunction linkHybridKnowledgeEdges(hybrid: Rec, nodes: FeedNode[], edges: FeedEdge[], setStepHints: boolean): void {\n const conceptIds = new Set(nodes.filter((n) => n.kind === 'concept').map((n) => n.concept_ref || n.id));\n for (const l of arr(hybrid.links)) {\n const conceptId = str(l.concept_id);\n const featureId = str(l.feature_id);\n if (!conceptIds.has(conceptId)) continue;\n const depth = str(l.depth, 'cio');\n const firstStep = nodes.find((n) => n.feature_id === featureId);\n if (firstStep) {\n edges.push({ from: conceptId, to: firstStep.id, kind: 'knowledge', reason: str(l.relationship, 'hybrid link') + ' [' + depth + ']' });\n if (setStepHints && !firstStep.depth_hint) {\n firstStep.depth_hint = (['ulo', 'cio', 'sio'] as const).includes(depth as 'ulo') ? (depth as FeedNode['depth_hint']) : 'cio';\n }\n }\n }\n}\n\nfunction emitFromKnowledge(kg: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n const conceptIds = new Set(arr(kg.concepts).map((c) => str(c.id)));\n for (const c of arr(kg.concepts)) {\n const node = feedNodeFromConcept(c);\n nodes.push(node);\n for (const p of strs(c.prerequisites)) {\n if (p !== node.id && conceptIds.has(p)) {\n edges.push({\n from: p,\n to: node.id,\n kind: 'knowledge',\n reason: `concept prerequisite: ${p} must be understood before ${node.id}`,\n });\n }\n }\n }\n\n // Sort nodes by learning_path order if present\n if (arr(kg.learning_path).length > 0) {\n const orderMap = new Map<string, number>();\n arr(kg.learning_path).forEach((s, idx) => {\n const cid = str(s.concept_id);\n if (cid) orderMap.set(cid, num(s.order, idx + 1));\n });\n nodes.sort((a, b) => (orderMap.get(a.id) ?? 999) - (orderMap.get(b.id) ?? 999));\n }\n\n let ci = 0;\n for (const cat of arr(kg.categories)) {\n ci += 1;\n const ids = strs(cat.concept_ids).filter((id) => nodes.some((n) => n.id === id));\n if (ids.length > 0) {\n groupings.push({\n id: str(cat.id, 'cat' + ci),\n name: str(cat.name, 'Category ' + ci),\n node_ids: ids,\n rationale: str(cat.description, ''),\n });\n }\n }\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'knowledge_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n}\n\nfunction emitFromProject(pg: Rec, opts: EmitFeedOptions): CurriculumFeed {\n const nodes: FeedNode[] = [];\n const edges: FeedEdge[] = [];\n const groupings: FeedGrouping[] = [];\n arr(pg.features).forEach((f, fi) => addFeatureGroup(f, str(f.id, 'F' + pad2(fi + 1)), nodes, edges, groupings));\n if (nodes.length === 0 && arr(pg.features).length > 0) {\n const hasTasks = arr((pg.implementation ?? {}) as Rec).length > 0 || arr((pg.implementation as Rec | undefined)?.tasks).length > 0;\n throw new Error(\n 'Project graph has ' + arr(pg.features).length + ' features but NO features[].steps - the curriculum feed cannot emit planning nodes.' +\n (hasTasks\n ? ' This looks like a legacy knowledge-tree graph (implementation.tasks). Regenerate it with the domain-kit v3 pipeline (runProjectGraphPipeline / hybridGraphPipeline), then re-run.'\n : ' Every feature must carry at least one step with id/name/keywords/effort for curriculum planning.'),\n );\n }\n newKeywordsInOrder(nodes);\n return validateCurriculumFeed({\n schema_version: 2,\n source: { graph_type: 'project_graph', warnings: opts.warnings ?? [], hallucination_count: opts.hallucinationCount ?? 0 },\n learning_nodes: nodes,\n dependency_edges: edges,\n suggested_groupings: groupings,\n phases: [],\n });\n}\n\n/** Emit a CurriculumFeed from whichever graph shape is provided (already verified upstream). */\nexport function emitCurriculumFeed(\n graph: unknown,\n opts: EmitFeedOptions = {},\n): CurriculumFeed {\n const g = graph as Rec;\n if (arr(g.learning_nodes).length > 0) {\n return validateCurriculumFeed(g); // already a feed - pass-through validation\n }\n if (g.project_graph || g.knowledge_graph || arr(g.links).length > 0 || arr(g.phases).length > 0) {\n return emitFromHybrid(g, opts);\n }\n if (arr(g.concepts).length > 0 || str(g.type) === 'knowledge_graph') return emitFromKnowledge(g, opts);\n return emitFromProject(g, opts);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { g as CurriculumFeed } from '../curriculumFeedSchema-C8ZP3XMi.cjs';
1
+ import { g as CurriculumFeed } from '../curriculumFeedSchema-DUFwFyr2.cjs';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { g as CurriculumFeed } from '../curriculumFeedSchema-C8ZP3XMi.js';
1
+ import { g as CurriculumFeed } from '../curriculumFeedSchema-DUFwFyr2.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import '../chunk-R57WTNXW.mjs';
2
- export { emitCurriculumFeed } from '../chunk-LKSVTRQE.mjs';
3
- import '../chunk-MSRKUZLY.mjs';
2
+ export { emitCurriculumFeed } from '../chunk-TWKIVUTQ.mjs';
3
+ import '../chunk-E4GCCWJO.mjs';
4
4
  //# sourceMappingURL=index.mjs.map
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1963,7 +1963,42 @@ async function generateKnowledgeGraph(options) {
1963
1963
  const structuredTopicsGuide = parsedSyllabus && parsedSyllabus.allTopics.length > 0 ? `
1964
1964
  STRUCTURED SYLLABUS TOPICS (Every topic MUST map to at least one concept to ensure 100% syllabus coverage):
1965
1965
  ` + parsedSyllabus.allTopics.map((t) => `- [${t.unitTitle}] ${t.id}: ${t.title} (Keywords: ${t.keywords.join(", ")})`).join("\n") + "\n" : "";
1966
- const systemPrompt = "You are an expert curriculum designer. Decompose the given subject into a structured knowledge graph with concepts, prerequisites, and problem types.\n\nCRITICAL RULES:\n1. Each concept MUST have the three depth layers, authored against this CONTRACT:\n - ulo (WHAT + WHY): bound to the CONCEPT's intrinsic NATURE. It explains what the\n concept is and why it exists \u2014 the problem it solves in principle. It must be\n TECHNOLOGY-AGNOSTIC: never name a concrete library, API, function, file format,\n tool or language feature. Typical assessment level: Remember / Understand.\n - cio (HOW): the MECHANISM \u2014 how the concept works and solves that problem, step\n by step. Still bound to the concept's nature: more concrete than the ULO, but\n NOT tied to one specific technology (no concrete API names). CIO capability is\n assessed INDIRECTLY, through completing contextual work, not in isolation.\n - sio (IMPLEMENTATION): an array of 2-4 items. EVERY item MUST reference concrete\n KEYWORDS/technologies (a real API, function, module, file, or named pattern) and\n describe a completable, context-specific implementation task. Application,\n Analysis and Creation skills are assessed INDIRECTLY through completing these\n items. There is NO fixed Bloom ceiling for a layer \u2014 but concreteness MUST\n strictly increase: SIO more technology-bound than CIO, CIO more concrete than ULO.\n - prerequisites: concept IDs that must be learned first (MUST NOT create cycles)\n - problem_types: 2-4 problem types with bloom_level and difficulty. Remember and\n Understand problem types test the ULO/CIO directly; Apply-and-above types are\n proxies for SIO completion in context.\n - techniques: methods, formulas, tools\n2. Prerequisite chains MUST be acyclic (no concept can depend on itself or create a loop)\n3. Concepts should be ordered by prerequisite dependency (topological sort)\n4. Problem types should range from Remember to Apply (not all at same level)\n5. Group concepts into categories (chapters/sections)\n6. ALL text in ENGLISH (even if input is Vietnamese)\n7. NEVER invent concepts not present in the syllabus\n8. Return JSON matching the KnowledgeGraphSchema";
1966
+ const systemPrompt = `You are an expert curriculum designer. Decompose the given subject into a structured knowledge graph with concepts, prerequisites, and problem types.
1967
+
1968
+ CRITICAL RULES:
1969
+ 1. Each concept MUST have the three depth layers, authored against this CONTRACT:
1970
+ - ulo (WHAT + WHY): bound to the CONCEPT's intrinsic NATURE. It explains what the
1971
+ concept is and why it exists \u2014 the problem it solves in principle. It must be
1972
+ TECHNOLOGY-AGNOSTIC: never name a concrete library, API, function, file format,
1973
+ tool or language feature. Typical assessment level: Remember / Understand.
1974
+ - cio (HOW): the MECHANISM \u2014 how the concept works and solves that problem, step
1975
+ by step. Still bound to the concept's nature: more concrete than the ULO, but
1976
+ NOT tied to one specific technology (no concrete API names). CIO capability is
1977
+ assessed INDIRECTLY, through completing contextual work, not in isolation.
1978
+ - sio (IMPLEMENTATION): an array of 2-4 items. EVERY item MUST reference concrete
1979
+ KEYWORDS/technologies (a real API, function, module, file, or named pattern) and
1980
+ describe a completable, context-specific implementation task. Application,
1981
+ Analysis and Creation skills are assessed INDIRECTLY through completing these
1982
+ items. There is NO fixed Bloom ceiling for a layer \u2014 but concreteness MUST
1983
+ strictly increase: SIO more technology-bound than CIO, CIO more concrete than ULO.
1984
+ - prerequisites: concept IDs that must be learned first (MUST NOT create cycles)
1985
+ - problem_types: 2-4 problem types with bloom_level and difficulty. Remember and
1986
+ Understand problem types test the ULO/CIO directly; Apply-and-above types are
1987
+ proxies for SIO completion in context.
1988
+ - techniques: methods, formulas, tools
1989
+ 2. Prerequisite chains MUST be acyclic (no concept can depend on itself or create a loop)
1990
+ 3. Concepts should be ordered by prerequisite dependency (topological sort)
1991
+ 4. Problem types should range from Remember to Apply (not all at same level)
1992
+ 5. Group concepts into categories (chapters/sections)
1993
+ 6. ALL text in ENGLISH (even if input is Vietnamese)
1994
+ 7. NEVER invent concepts not present in the syllabus
1995
+ 8. KEYWORDS: Each concept MUST include 5-10 domain-specific keywords that:
1996
+ - Are concrete terms a student encounters when studying THIS concept
1997
+ - Include at least 2 technology-specific terms (APIs, functions, types, tools)
1998
+ - Are DISTINCT from keywords of other concepts (minimal overlap)
1999
+ - NEVER generic English words (e.g. "view", "data", "code" are TOO generic)
2000
+ - Example for "SwiftUI Layout": ["VStack", "HStack", "ZStack", ".padding()", ".frame()", "alignment", "Spacer", "LazyVGrid"]
2001
+ 9. Return JSON matching the KnowledgeGraphSchema`;
1967
2002
  const userPrompt = `Subject: ${subject}
1968
2003
  ${description ? `Description: ${description}` : ""}
1969
2004
  ${structuredTopicsGuide}${truncatedSyllabus ? `Syllabus:
@@ -1984,8 +2019,9 @@ Return JSON:
1984
2019
  {
1985
2020
  "id": "C1",
1986
2021
  "name": "Concept name",
1987
- "description": "Brief description",
2022
+ "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.",
1988
2023
  "category": "category_id",
2024
+ "keywords": ["specific_term_1", "concrete_api_2", "method_call_3", "tool_or_type_4", "syntax_keyword_5", "concept_term_6"],
1989
2025
  "ulo": "WHAT + WHY in technology-agnostic language: what the concept is and the problem it exists to solve. No library/API/tool names.",
1990
2026
  "cio": "HOW the mechanism works, still technology-agnostic but more concrete than the ULO.",
1991
2027
  "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"],
@@ -2026,18 +2062,23 @@ Return JSON:
2026
2062
  log("STEP_2", "Validating and cleaning knowledge graph...");
2027
2063
  const concepts = result.concepts || [];
2028
2064
  const categories = result.categories || [];
2065
+ for (const c of concepts) {
2066
+ if ((c.description || "").length < 50) {
2067
+ warnings.push("Concept " + c.id + ": description too short (" + (c.description || "").length + " chars) \u2014 may produce shallow KX narratives");
2068
+ }
2069
+ }
2029
2070
  {
2030
2071
  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"]);
2031
2072
  const tokensFrom = (text) => text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length >= 4 && !STOP.has(w));
2032
2073
  for (const c of concepts) {
2033
2074
  const existing = (c.keywords || []).map((k) => String(k).trim()).filter(Boolean);
2034
2075
  if (existing.length === 0) {
2035
- const derived = [.../* @__PURE__ */ new Set([...tokensFrom(c.name), ...tokensFrom(c.description || "")])].slice(0, 5);
2076
+ const derived = [.../* @__PURE__ */ new Set([...tokensFrom(c.name), ...tokensFrom(c.description || "")])].slice(0, 8);
2036
2077
  if (derived.length === 0) {
2037
2078
  throw new Error("Concept " + c.id + " (" + c.name + ") has no keywords and none could be derived from name/description \u2014 fail-closed");
2038
2079
  }
2039
2080
  c.keywords = derived;
2040
- warnings.push("Concept " + c.id + ": empty keyword set - derived " + derived.join(", ") + " from name/description");
2081
+ warnings.push("Concept " + c.id + ": empty keyword set - derived " + derived.join(", ") + " from name/description (WARNING: LLM returned no keywords)");
2041
2082
  } else {
2042
2083
  c.keywords = existing;
2043
2084
  }
@@ -2162,6 +2203,52 @@ Return JSON:
2162
2203
  }
2163
2204
  log("STEP_5", "Depth layers authored: " + concepts.length + " concepts, audit " + lo.audits.filter((a) => a.passed).length + "/" + concepts.length + " passed");
2164
2205
  }
2206
+ {
2207
+ for (const concept of concepts) {
2208
+ const sioText = (concept.sio || []).join(" ");
2209
+ const techTokens = [];
2210
+ let m;
2211
+ const techTokenRe = /`([^`]+)`/g;
2212
+ while ((m = techTokenRe.exec(sioText)) !== null) {
2213
+ if (m[1].length >= 3 && m[1].length <= 40) techTokens.push(m[1]);
2214
+ }
2215
+ const annotationRe = /(?:^|[\s(])(@[A-Za-z]\w*)/g;
2216
+ while ((m = annotationRe.exec(sioText)) !== null) techTokens.push(m[1]);
2217
+ const dotRe = /\b\w+\.\w+\(/g;
2218
+ while ((m = dotRe.exec(sioText)) !== null) techTokens.push(m[0].replace("(", ""));
2219
+ const modifierRe = /(?:^|[\s(])(\.[a-z]\w*)\b/g;
2220
+ while ((m = modifierRe.exec(sioText)) !== null) techTokens.push(m[1]);
2221
+ const camelRe = /\b[a-z]+[A-Z][A-Za-z]+\b/g;
2222
+ while ((m = camelRe.exec(sioText)) !== null) techTokens.push(m[0]);
2223
+ const existing = new Set((concept.keywords || []).map((k) => k.toLowerCase()));
2224
+ const newTokens = [...new Set(techTokens)].filter((t) => !existing.has(t.toLowerCase())).slice(0, 8);
2225
+ if (newTokens.length > 0) {
2226
+ concept.keywords = [...concept.keywords || [], ...newTokens];
2227
+ warnings.push("Concept " + concept.id + ": enriched keywords with " + newTokens.length + " SIO-derived tokens");
2228
+ }
2229
+ }
2230
+ log("STEP_5b", "SIO-keyword enrichment complete");
2231
+ }
2232
+ {
2233
+ for (const concept of concepts) {
2234
+ const sioCount = (concept.sio || []).length;
2235
+ const ptCount = (concept.problem_types || []).length;
2236
+ const prereqCount = (concept.prerequisites || []).length;
2237
+ const hasHighBloom = (concept.problem_types || []).some(
2238
+ (pt) => ["Analyze", "Evaluate", "Create"].includes(pt.bloom_level || "")
2239
+ );
2240
+ const score = Math.min(1, sioCount * 0.2 + ptCount * 0.15 + prereqCount * 0.15 + (hasHighBloom ? 0.2 : 0));
2241
+ const calibrated = Math.round(15 + score * 45);
2242
+ const llmEstimate = concept.estimated_minutes || 30;
2243
+ if (llmEstimate === 30 || Math.abs(calibrated - llmEstimate) / llmEstimate > 0.5) {
2244
+ concept.estimated_minutes = calibrated;
2245
+ if (llmEstimate !== calibrated) {
2246
+ warnings.push("Concept " + concept.id + ": minutes calibrated " + llmEstimate + "m \u2192 " + calibrated + "m (score=" + score.toFixed(2) + ")");
2247
+ }
2248
+ }
2249
+ }
2250
+ log("STEP_5c", "Minute calibration complete");
2251
+ }
2165
2252
  for (const step of learningPath) {
2166
2253
  if (!conceptIds.has(step.concept_id)) {
2167
2254
  warnings.push(`Learning path references non-existent concept ${step.concept_id}`);
@@ -2427,8 +2514,12 @@ async function decomposePhases(args) {
2427
2514
  const linkList = links.map(
2428
2515
  (l) => "- " + l.feature_id + " -> " + l.concept_id + " (" + l.depth + ")"
2429
2516
  ).join("\n") || "(none)";
2430
- 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.\n9. Return JSON only.';
2431
- const baseUserPrompt = "FEATURES:\n" + featureList + "\n\nCONCEPTS:\n" + conceptList + "\n\nFEATURE-CONCEPT LINKS:\n" + linkList + "\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";
2517
+ 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.';
2518
+ const totalFeatureMinutes = features.reduce((s, f) => s + (f.steps || []).reduce((ss, st) => ss + (st.effort?.estimated_minutes || 15), 0), 0);
2519
+ const totalConceptMinutes = concepts.reduce((s, c) => s + (c.estimated_minutes || 30), 0);
2520
+ const totalMinutes = totalFeatureMinutes + totalConceptMinutes;
2521
+ const targetPhaseCount = Math.max(3, Math.round(totalMinutes / 180));
2522
+ 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";
2432
2523
  const MAX_DECOMPOSE_ATTEMPTS = 3;
2433
2524
  let auditErrors = [];
2434
2525
  let phases = [];
@@ -2472,6 +2563,7 @@ exports.SIO_CODE_RE = SIO_CODE_RE;
2472
2563
  exports.ULO_CODE_RE = ULO_CODE_RE;
2473
2564
  exports.assignConceptCodes = assignConceptCodes;
2474
2565
  exports.auditDepthLayers = auditDepthLayers;
2566
+ exports.auditPhasePlan = auditPhasePlan;
2475
2567
  exports.auditSyllabusCoverage = auditSyllabusCoverage;
2476
2568
  exports.breakPrerequisiteCycles = breakPrerequisiteCycles;
2477
2569
  exports.cioActionSlug = cioActionSlug;