@thanh01.pmt/domain-kit 0.3.0 → 0.4.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/README.md +42 -11
- package/dist/{chunk-Y7MRFFDJ.mjs → chunk-HILSUZOF.mjs} +3 -3
- package/dist/{chunk-Y7MRFFDJ.mjs.map → chunk-HILSUZOF.mjs.map} +1 -1
- package/dist/{chunk-MCHHEBH3.mjs → chunk-LZQLLAYP.mjs} +5 -5
- package/dist/{chunk-MCHHEBH3.mjs.map → chunk-LZQLLAYP.mjs.map} +1 -1
- package/dist/{chunk-MSRKUZLY.mjs → chunk-PKUEOSZ3.mjs} +23 -2
- package/dist/chunk-PKUEOSZ3.mjs.map +1 -0
- package/dist/{chunk-LKSVTRQE.mjs → chunk-QJF4QCBJ.mjs} +28 -3
- package/dist/chunk-QJF4QCBJ.mjs.map +1 -0
- package/dist/curriculumFeedEmitter-6IK6PFDH.mjs +4 -0
- package/dist/{curriculumFeedEmitter-FYAWMPE6.mjs.map → curriculumFeedEmitter-6IK6PFDH.mjs.map} +1 -1
- package/dist/{curriculumFeedSchema-C8ZP3XMi.d.ts → curriculumFeedSchema-B66H3gEV.d.cts} +140 -0
- package/dist/{curriculumFeedSchema-C8ZP3XMi.d.cts → curriculumFeedSchema-B66H3gEV.d.ts} +140 -0
- package/dist/feed/index.cjs +46 -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 +1 -0
- 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 +47 -0
- 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 +46 -0
- 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 +21 -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 +1 -1
- package/dist/chunk-LKSVTRQE.mjs.map +0 -1
- package/dist/chunk-MSRKUZLY.mjs.map +0 -1
- package/dist/curriculumFeedEmitter-FYAWMPE6.mjs +0 -4
package/README.md
CHANGED
|
@@ -151,7 +151,8 @@ const feed = emitCurriculumFeed(result.projectGraph); // or knowledgeGraph or h
|
|
|
151
151
|
console.log(feed.learning_nodes.length); // unified nodes ready for planner
|
|
152
152
|
console.log(feed.dependency_edges.length); // knowledge + task edges
|
|
153
153
|
console.log(feed.suggested_groupings); // feature/category groupings
|
|
154
|
-
//
|
|
154
|
+
console.log(feed.phases.length); // non-empty ⇒ learning_nodes are in teaching order (phases define units)
|
|
155
|
+
// Each node has: bloom_hint, depth_hint, keywords.new/.prerequisite, introduce_aspect, user_visible_deliverable
|
|
155
156
|
```
|
|
156
157
|
|
|
157
158
|
---
|
|
@@ -399,10 +400,11 @@ All schemas are Zod-validated TypeScript types.
|
|
|
399
400
|
| `DomainProfileSchema` | `domainProfileSchema.ts` | Domain detection output |
|
|
400
401
|
| `HardwareFeatureExtension` | `domainExtensions.ts` | Hardware overlay (wiring, materials) |
|
|
401
402
|
| `ThreeDesignFeatureExtension` | `domainExtensions.ts` | 3D Design overlay (shapes, dimensions) |
|
|
402
|
-
| `CurriculumFeedSchema` | `curriculumFeedSchema.ts` | Planner-ready normalized feed (nodes, edges, groupings) |
|
|
403
|
+
| `CurriculumFeedSchema` | `curriculumFeedSchema.ts` | Planner-ready normalized feed (nodes, edges, groupings, phases) |
|
|
403
404
|
| `FeedNodeSchema` | `curriculumFeedSchema.ts` | Individual learning node (concept, skill, or product step) |
|
|
404
405
|
| `FeedEdgeSchema` | `curriculumFeedSchema.ts` | Dependency edge (knowledge or task) |
|
|
405
406
|
| `FeedGroupingSchema` | `curriculumFeedSchema.ts` | Suggested grouping of nodes (feature or category) |
|
|
407
|
+
| `FeedPhaseSchema` | `curriculumFeedSchema.ts` | Development phase — when non-empty, defines teaching sequence and unit structure |
|
|
406
408
|
|
|
407
409
|
### Key Types
|
|
408
410
|
|
|
@@ -486,9 +488,10 @@ type AssembledRoadmap = {
|
|
|
486
488
|
type CurriculumFeed = {
|
|
487
489
|
schema_version: 2;
|
|
488
490
|
source: { graph_type: 'project_graph' | 'knowledge_graph' | 'hybrid_graph'; warnings: string[]; hallucination_count: number };
|
|
489
|
-
learning_nodes: FeedNode[];
|
|
491
|
+
learning_nodes: FeedNode[]; // in TEACHING ORDER when phases[] is non-empty
|
|
490
492
|
dependency_edges: FeedEdge[];
|
|
491
493
|
suggested_groupings: FeedGrouping[];
|
|
494
|
+
phases: FeedPhase[]; // when non-empty, THESE — not suggested_groupings — define the teaching sequence and unit structure
|
|
492
495
|
}
|
|
493
496
|
|
|
494
497
|
type FeedNode = {
|
|
@@ -505,6 +508,20 @@ type FeedNode = {
|
|
|
505
508
|
references: { file: string; evidence: string }[];
|
|
506
509
|
feature_id: string | null;
|
|
507
510
|
concept_ref: string | null;
|
|
511
|
+
phase_id: string; // development phase that introduces/uses this node ('' on legacy feeds)
|
|
512
|
+
introduce_aspect: 'new' | 'advanced' | 'preview' | null; // first intro / advanced revisit / preview priming
|
|
513
|
+
user_visible_deliverable: string; // step's outcome.user_visible — checkpoint candidate for session cutting ('' on concept nodes)
|
|
514
|
+
depth_variants?: { ulo: number; cio: number; sio: number }; // minutes per depth level — reconciler price list (ULO ≤ CIO ≤ SIO)
|
|
515
|
+
depth_scaffold_candidates?: { from_depth: 'ulo' | 'cio' | 'sio'; to_depth: 'ulo' | 'cio' | 'sio'; minutes_saved: number; reason: string }[]; // DEPTH downgrades (SIO→CIO, CIO→ULO) — parallel to scaffold_candidates
|
|
516
|
+
is_core: boolean; // Master-Tree core concept — never depth-downgraded; escalate instead
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
type FeedPhase = {
|
|
520
|
+
id: string;
|
|
521
|
+
order: number; // 1-based teaching order
|
|
522
|
+
name: string;
|
|
523
|
+
product_completion: string;
|
|
524
|
+
node_ids: string[]; // nodes of this phase, already in teaching order
|
|
508
525
|
}
|
|
509
526
|
|
|
510
527
|
type FeedEdge = {
|
|
@@ -640,19 +657,26 @@ const feed = emitCurriculumFeed(graph, {
|
|
|
640
657
|
});
|
|
641
658
|
|
|
642
659
|
// Returns CurriculumFeed with:
|
|
643
|
-
// - learning_nodes[] — unified node format (concept | skill | product_step)
|
|
660
|
+
// - learning_nodes[] — unified node format (concept | skill | product_step), in teaching order when phases[] is non-empty
|
|
644
661
|
// - dependency_edges[] — knowledge (prerequisite) or task (build order) edges
|
|
645
|
-
// - suggested_groupings[] — feature or category groupings
|
|
646
|
-
// -
|
|
662
|
+
// - suggested_groupings[] — feature or category groupings (layout hint only)
|
|
663
|
+
// - phases[] — development phases; when non-empty, the teaching sequence + unit structure
|
|
664
|
+
// - Each node has: bloom_hint, depth_hint (ulo/cio/sio), keywords.new vs .prerequisite,
|
|
665
|
+
// introduce_aspect (new/advanced/preview), user_visible_deliverable,
|
|
666
|
+
// depth_variants + depth_scaffold_candidates + is_core (depth-reconcile inputs)
|
|
647
667
|
```
|
|
648
668
|
|
|
649
669
|
**Key behaviors:**
|
|
650
|
-
- **
|
|
670
|
+
- **Teaching-order emission (contract, 2026-09-18):** when a hybrid graph carries `phases[]`, the `nodes` array follows the **phase teaching sequence** — the order in the file IS the order in the classroom. The former "concepts emitted first, then steps" array layout is ABOLISHED: it contradicted phase order, fabricated backwards prerequisite edges, and caused the planner's "Teaching-order violation" failure (see postmortem 2026-09-17 §9)
|
|
671
|
+
- **No fabricated backwards edges:** when a keyword consumer sits in an EARLIER phase than the concept's anchor teach (and no preview covers it), the emitter does NOT invent a dependency edge — it records a drift **warning** instead (`hybrid link drift: …`); the host decides, the emitter reports
|
|
672
|
+
- **Overtake guard:** a product step must never become the introducer of a concept's vocabulary; the first appearance of a keyword belongs to the concept (or its preview node) that teaches it
|
|
673
|
+
- **Preview priming (aspect `preview`, kit ≥0.3.0):** a phase may declare a light awareness pass for a concept whose anchor teach lives in a LATER phase — emitted as node `<cid>__PREVxx` with depth `ulo`, bloom `Understand`, ~25% minutes (min 5), `keywords.all` (making it the legitimate vocabulary introducer), no prerequisite edges, no scaffolding. Five fail-closed emission rules: unknown concept, already-introduced concept, duplicate preview, no anchor anywhere, anchor not in a later phase
|
|
651
674
|
- **Knowledge graphs**: concepts + prerequisite edges + category groupings
|
|
652
675
|
- **Project graphs**: features → steps + depends_on edges + feature groupings
|
|
653
676
|
- **Pass-through**: if input already has `learning_nodes[]`, validates and returns as-is
|
|
654
677
|
- **Legacy rejection**: throws descriptive error if graph has `implementation.tasks` but no `features[].steps` (old knowledge-tree format)
|
|
655
|
-
- **New/prerequisite keywords**: computed in
|
|
678
|
+
- **New/prerequisite keywords**: computed in **teaching order** (phase sequence when phases exist, array order otherwise) — first appearance = new, seen before = prerequisite. Anchoring keywords to array position instead of teaching order is the exact assumption that caused the 2026-09-17 incident
|
|
679
|
+
- **Fail-closed validation**: output is validated before return — duplicate IDs, unresolvable edges, self-loops, non-empty, **and the teaching-order invariant**: when phases define the sequence, a prerequisite must live in the same or an EARLIER phase than its consumer (a violation throws at emission, never defers to the planner)
|
|
656
680
|
|
|
657
681
|
### Parsers
|
|
658
682
|
|
|
@@ -723,8 +747,15 @@ STEP 9: Feed Emission
|
|
|
723
747
|
→ Convert project_graph → FeedNode[] (kind: product_step) + FeatureGroupings
|
|
724
748
|
→ Convert knowledge_graph → FeedNode[] (kind: concept) + CategoryGroupings
|
|
725
749
|
→ Convert hybrid_graph → combined nodes + knowledge/task edges + hybrid link depth hints
|
|
726
|
-
→
|
|
727
|
-
→
|
|
750
|
+
→ Project steps: project outcome.user_visible onto user_visible_deliverable (checkpoint candidate)
|
|
751
|
+
→ Concept nodes: emit depth_variants (ULO ≤ CIO ≤ SIO minutes) + depth_scaffold_candidates + is_core
|
|
752
|
+
→ Teaching order: when phases[] exist, nodes are emitted in phase sequence; new/prerequisite
|
|
753
|
+
keywords computed in TEACHING order (first appearance = new), never array position
|
|
754
|
+
→ Preview priming: phase-declared __PREVxx awareness nodes carry keywords.all (legitimate
|
|
755
|
+
vocabulary introducer) without fabricating prerequisite edges
|
|
756
|
+
→ Validate: fail-closed (duplicate IDs, edge resolution, self-loops, non-empty, duplicate
|
|
757
|
+
phase ids, and the teaching-order invariant: a prerequisite must live in the same or an
|
|
758
|
+
EARLIER phase than its consumer — a backwards edge throws at emission, never in the planner)
|
|
728
759
|
```
|
|
729
760
|
|
|
730
761
|
### Knowledge Graph Pipeline (Concept-Driven)
|
|
@@ -949,7 +980,7 @@ import {
|
|
|
949
980
|
ProjectGraphSchema, KnowledgeGraphSchema, HybridGraphSchema,
|
|
950
981
|
DomainProfileSchema, ConceptMappingSchema, AssembledRoadmapSchema,
|
|
951
982
|
KnowledgeConceptSchema, KnowledgeLearningPathStepSchema,
|
|
952
|
-
CurriculumFeedSchema, FeedNodeSchema, FeedEdgeSchema, FeedGroupingSchema,
|
|
983
|
+
CurriculumFeedSchema, FeedNodeSchema, FeedEdgeSchema, FeedGroupingSchema, FeedPhaseSchema,
|
|
953
984
|
} from '@thanh01.pmt/domain-kit';
|
|
954
985
|
|
|
955
986
|
// Roadmap assembly
|
|
@@ -2280,6 +2280,6 @@ async function decomposePhases(args) {
|
|
|
2280
2280
|
return phases;
|
|
2281
2281
|
}
|
|
2282
2282
|
|
|
2283
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, createLlmClient, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, llmChatJson, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph };
|
|
2284
|
-
//# sourceMappingURL=chunk-
|
|
2285
|
-
//# sourceMappingURL=chunk-
|
|
2283
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditPhasePlan, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, createLlmClient, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, llmChatJson, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph };
|
|
2284
|
+
//# sourceMappingURL=chunk-HILSUZOF.mjs.map
|
|
2285
|
+
//# sourceMappingURL=chunk-HILSUZOF.mjs.map
|