@thanh01.pmt/domain-kit 0.4.0 → 0.6.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 (68) hide show
  1. package/README.md +682 -168
  2. package/dist/assembly/index.d.cts +2 -2
  3. package/dist/assembly/index.d.ts +2 -2
  4. package/dist/{chunk-HILSUZOF.mjs → chunk-2OGNQUXC.mjs} +171 -31
  5. package/dist/chunk-2OGNQUXC.mjs.map +1 -0
  6. package/dist/{chunk-LZQLLAYP.mjs → chunk-5OMSYKQP.mjs} +43 -23
  7. package/dist/chunk-5OMSYKQP.mjs.map +1 -0
  8. package/dist/{chunk-BL5NBKPH.mjs → chunk-67GXK3ZE.mjs} +18 -8
  9. package/dist/chunk-67GXK3ZE.mjs.map +1 -0
  10. package/dist/{chunk-PKUEOSZ3.mjs → chunk-CGNXGVHV.mjs} +46 -4
  11. package/dist/chunk-CGNXGVHV.mjs.map +1 -0
  12. package/dist/{chunk-VCPIWJ7R.mjs → chunk-ERDTHXQA.mjs} +21 -3
  13. package/dist/chunk-ERDTHXQA.mjs.map +1 -0
  14. package/dist/chunk-OYSZQVPY.mjs +10 -0
  15. package/dist/chunk-OYSZQVPY.mjs.map +1 -0
  16. package/dist/{chunk-QJF4QCBJ.mjs → chunk-WKTH3JPA.mjs} +202 -36
  17. package/dist/chunk-WKTH3JPA.mjs.map +1 -0
  18. package/dist/{conceptEscalator-YfMKIKCZ.d.ts → conceptEscalator-BCsw0ys_.d.ts} +10 -1
  19. package/dist/{conceptEscalator-ltRLtPhf.d.cts → conceptEscalator-DPrs4PwC.d.cts} +10 -1
  20. package/dist/concepts/index.d.cts +1 -1
  21. package/dist/concepts/index.d.ts +1 -1
  22. package/dist/{curriculumFeedSchema-B66H3gEV.d.ts → curriculumFeedSchema-DYayelAA.d.cts} +212 -1
  23. package/dist/{curriculumFeedSchema-B66H3gEV.d.cts → curriculumFeedSchema-DYayelAA.d.ts} +212 -1
  24. package/dist/detector/index.cjs +21 -6
  25. package/dist/detector/index.cjs.map +1 -1
  26. package/dist/detector/index.mjs +2 -1
  27. package/dist/feed/index.cjs +243 -33
  28. package/dist/feed/index.cjs.map +1 -1
  29. package/dist/feed/index.d.cts +32 -2
  30. package/dist/feed/index.d.ts +32 -2
  31. package/dist/feed/index.mjs +2 -2
  32. package/dist/graph/index.cjs +163 -28
  33. package/dist/graph/index.cjs.map +1 -1
  34. package/dist/graph/index.d.cts +14 -5
  35. package/dist/graph/index.d.ts +14 -5
  36. package/dist/graph/index.mjs +2 -1
  37. package/dist/{hybridGraphPipeline-DXQDbBEj.d.ts → hybridGraphPipeline-9dRKJj7r.d.ts} +6 -2
  38. package/dist/{hybridGraphPipeline-dT-bio-3.d.cts → hybridGraphPipeline-CocfYe4d.d.cts} +6 -2
  39. package/dist/{hybridGraphSchema-nrUeSwpU.d.ts → hybridGraphSchema-C37qxdTM.d.cts} +16 -3
  40. package/dist/{hybridGraphSchema-nrUeSwpU.d.cts → hybridGraphSchema-C37qxdTM.d.ts} +16 -3
  41. package/dist/index.cjs +3742 -3362
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +6 -6
  44. package/dist/index.d.ts +6 -6
  45. package/dist/index.mjs +7 -6
  46. package/dist/llmClient-CX5uUiQ1.d.cts +60 -0
  47. package/dist/llmClient-CX5uUiQ1.d.ts +60 -0
  48. package/dist/pipeline/index.cjs +1556 -1202
  49. package/dist/pipeline/index.cjs.map +1 -1
  50. package/dist/pipeline/index.d.cts +13 -5
  51. package/dist/pipeline/index.d.ts +13 -5
  52. package/dist/pipeline/index.mjs +6 -5
  53. package/dist/schemas/index.cjs +64 -2
  54. package/dist/schemas/index.cjs.map +1 -1
  55. package/dist/schemas/index.d.cts +2 -2
  56. package/dist/schemas/index.d.ts +2 -2
  57. package/dist/schemas/index.mjs +2 -2
  58. package/package.json +1 -1
  59. package/dist/chunk-BL5NBKPH.mjs.map +0 -1
  60. package/dist/chunk-HILSUZOF.mjs.map +0 -1
  61. package/dist/chunk-LZQLLAYP.mjs.map +0 -1
  62. package/dist/chunk-PKUEOSZ3.mjs.map +0 -1
  63. package/dist/chunk-QJF4QCBJ.mjs.map +0 -1
  64. package/dist/chunk-VCPIWJ7R.mjs.map +0 -1
  65. package/dist/curriculumFeedEmitter-6IK6PFDH.mjs +0 -4
  66. package/dist/curriculumFeedEmitter-6IK6PFDH.mjs.map +0 -1
  67. package/dist/llmClient-ysPhLjcH.d.cts +0 -16
  68. package/dist/llmClient-ysPhLjcH.d.ts +0 -16
@@ -1,13 +1,13 @@
1
1
  import { u as ProjectGraph } from '../projectGraphSchema-DnD7orZV.cjs';
2
2
  import { K as Keyword } from '../keywordExtractor-BxlGRMHC.cjs';
3
- import { H as Hallucination, K as KnowledgeGraphPipelineOptions, f as KnowledgeGraphVerificationReport, j as HybridGraphPipelineOptions } from '../hybridGraphPipeline-dT-bio-3.cjs';
4
- import { C as ConceptMapping } from '../conceptEscalator-ltRLtPhf.cjs';
3
+ import { H as Hallucination, K as KnowledgeGraphPipelineOptions, f as KnowledgeGraphVerificationReport, j as HybridGraphPipelineOptions } from '../hybridGraphPipeline-CocfYe4d.cjs';
4
+ import { C as ConceptMapping } from '../conceptEscalator-DPrs4PwC.cjs';
5
5
  import { ResolveConceptsResult } from '../concepts/index.cjs';
6
6
  import { AssembledRoadmap } from '../assembly/index.cjs';
7
- import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.cjs';
7
+ import { L as LlmClientConfig, b as LlmCallRecord } from '../llmClient-CX5uUiQ1.cjs';
8
8
  import { P as ParsedSyllabus } from '../syllabusParser-MSX1fEzW.cjs';
9
- import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-nrUeSwpU.cjs';
10
- import { g as CurriculumFeed } from '../curriculumFeedSchema-B66H3gEV.cjs';
9
+ import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-C37qxdTM.cjs';
10
+ import { k as CurriculumFeed } from '../curriculumFeedSchema-DYayelAA.cjs';
11
11
  import { D as DetectDomainProfileOptions } from '../domainProfileDetector-bzugdQmS.cjs';
12
12
  import { c as DomainProfile, g as GraphType } from '../domainProfileSchema-CwT3Ffsw.cjs';
13
13
  import 'zod';
@@ -41,6 +41,8 @@ interface PipelineResult {
41
41
  hallucinations: Hallucination[];
42
42
  keywords: Keyword[];
43
43
  featureConcepts: Map<string, ConceptMapping[]>;
44
+ /** Which providers served this graph, and whether any call fell over. */
45
+ provenance: LlmCallRecord[];
44
46
  }
45
47
  /**
46
48
  * Run the full project graph generation pipeline.
@@ -119,6 +121,12 @@ interface DomainPipelineResult {
119
121
  knowledgeResult?: KnowledgePipelineResult;
120
122
  hybridResult?: HybridPipelineResult;
121
123
  warnings: string[];
124
+ /** Present only when the AUTO-detected learning mode could not run and the router ran a weaker pipeline instead. An explicit forcedLearningMode request fails closed instead of downgrading. */
125
+ modeDowngrade?: {
126
+ from: GraphType;
127
+ to: GraphType;
128
+ reason: string;
129
+ };
122
130
  }
123
131
  /**
124
132
  * Route and execute the appropriate domain pipeline based on input context.
@@ -1,13 +1,13 @@
1
1
  import { u as ProjectGraph } from '../projectGraphSchema-DnD7orZV.js';
2
2
  import { K as Keyword } from '../keywordExtractor-DU5XRN8-.js';
3
- import { H as Hallucination, K as KnowledgeGraphPipelineOptions, f as KnowledgeGraphVerificationReport, j as HybridGraphPipelineOptions } from '../hybridGraphPipeline-DXQDbBEj.js';
4
- import { C as ConceptMapping } from '../conceptEscalator-YfMKIKCZ.js';
3
+ import { H as Hallucination, K as KnowledgeGraphPipelineOptions, f as KnowledgeGraphVerificationReport, j as HybridGraphPipelineOptions } from '../hybridGraphPipeline-9dRKJj7r.js';
4
+ import { C as ConceptMapping } from '../conceptEscalator-BCsw0ys_.js';
5
5
  import { ResolveConceptsResult } from '../concepts/index.js';
6
6
  import { AssembledRoadmap } from '../assembly/index.js';
7
- import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.js';
7
+ import { L as LlmClientConfig, b as LlmCallRecord } from '../llmClient-CX5uUiQ1.js';
8
8
  import { P as ParsedSyllabus } from '../syllabusParser-MSX1fEzW.js';
9
- import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-nrUeSwpU.js';
10
- import { g as CurriculumFeed } from '../curriculumFeedSchema-B66H3gEV.js';
9
+ import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-C37qxdTM.js';
10
+ import { k as CurriculumFeed } from '../curriculumFeedSchema-DYayelAA.js';
11
11
  import { D as DetectDomainProfileOptions } from '../domainProfileDetector-DHb1T0zB.js';
12
12
  import { c as DomainProfile, g as GraphType } from '../domainProfileSchema-CwT3Ffsw.js';
13
13
  import 'zod';
@@ -41,6 +41,8 @@ interface PipelineResult {
41
41
  hallucinations: Hallucination[];
42
42
  keywords: Keyword[];
43
43
  featureConcepts: Map<string, ConceptMapping[]>;
44
+ /** Which providers served this graph, and whether any call fell over. */
45
+ provenance: LlmCallRecord[];
44
46
  }
45
47
  /**
46
48
  * Run the full project graph generation pipeline.
@@ -119,6 +121,12 @@ interface DomainPipelineResult {
119
121
  knowledgeResult?: KnowledgePipelineResult;
120
122
  hybridResult?: HybridPipelineResult;
121
123
  warnings: string[];
124
+ /** Present only when the AUTO-detected learning mode could not run and the router ran a weaker pipeline instead. An explicit forcedLearningMode request fails closed instead of downgrading. */
125
+ modeDowngrade?: {
126
+ from: GraphType;
127
+ to: GraphType;
128
+ reason: string;
129
+ };
122
130
  }
123
131
  /**
124
132
  * Route and execute the appropriate domain pipeline based on input context.
@@ -1,11 +1,12 @@
1
- export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from '../chunk-LZQLLAYP.mjs';
2
- import '../chunk-QJF4QCBJ.mjs';
3
- import '../chunk-PKUEOSZ3.mjs';
1
+ export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from '../chunk-5OMSYKQP.mjs';
2
+ import '../chunk-WKTH3JPA.mjs';
3
+ import '../chunk-CGNXGVHV.mjs';
4
4
  import '../chunk-DRVOV5ZD.mjs';
5
5
  import '../chunk-XMHKWHVK.mjs';
6
- import '../chunk-BL5NBKPH.mjs';
7
- import '../chunk-HILSUZOF.mjs';
6
+ import '../chunk-67GXK3ZE.mjs';
7
+ import '../chunk-2OGNQUXC.mjs';
8
8
  import '../chunk-T4Y2DE2W.mjs';
9
+ import '../chunk-OYSZQVPY.mjs';
9
10
  import '../chunk-KNDBODUQ.mjs';
10
11
  import '../chunk-ONQHJ4OH.mjs';
11
12
  //# sourceMappingURL=index.mjs.map
@@ -477,9 +477,27 @@ var HybridGraphSchema = zod.z.object({
477
477
  phases: zod.z.array(DevelopmentPhaseSchema).optional().default([]),
478
478
  // Metadata
479
479
  description: zod.z.string().optional().default(""),
480
+ // ── Minute totals (HG-1, 2026-10-05) ────────────────────────────────────
481
+ // These three used to sit side by side with near-identical names and NO
482
+ // documentation. Two measured DIFFERENT quantities, which is why the field
483
+ // below was renamed: it does not measure "the total". Read before trusting
484
+ // any of them.
485
+ /** Minutes of PRODUCT work: sum over every feature step. */
480
486
  total_project_minutes: zod.z.number().optional().default(0),
487
+ /** Minutes of CONCEPT work: sum over EVERY concept in the graph. */
481
488
  total_concept_minutes: zod.z.number().optional().default(0),
482
- estimated_total_minutes: zod.z.number().optional().default(0)
489
+ /**
490
+ * Renamed from `estimated_total_minutes` (2026-10-05) — the old name read
491
+ * like "the course total" but the number is narrower:
492
+ * total_project_minutes + (minutes of concepts that HAVE a feature link)
493
+ * unlinked concepts are deliberately excluded, and per concept the MAXIMUM
494
+ * link estimate wins, not the sum. Expect this to sit well BELOW
495
+ * total_project_minutes + total_concept_minutes.
496
+ *
497
+ * The figure the phase planner actually commits to is
498
+ * total_project_minutes + total_concept_minutes (see decomposePhases).
499
+ */
500
+ linked_prereq_minutes: zod.z.number().optional().default(0)
483
501
  });
484
502
  var InputTypeSchema = zod.z.enum([
485
503
  "repository",
@@ -606,6 +624,23 @@ var FeedNodeSchema = zod.z.object({
606
624
  reason: zod.z.string().default("")
607
625
  })).optional(),
608
626
  is_core: zod.z.boolean().default(false),
627
+ /**
628
+ * Prerequisite concept ids this node needs that NO node in this feed provides —
629
+ * i.e. the learner must already know them before starting. Previously these were
630
+ * silently dropped (knowledge path) or crashed emission (both hybrid paths), so a
631
+ * course silently lost its entry requirements. Kept on the node so the mapping
632
+ * "concept X needs prior knowledge Y" survives; a course-level roll-up is derivable.
633
+ */
634
+ external_prerequisites: zod.z.array(zod.z.string()).default([]),
635
+ // Depth layer text (optional, additive — old feeds validate unchanged).
636
+ // Carries the ULO/CIO/SIO authored text from the KnowledgeGraph concept
637
+ // so downstream consumers (KX generator) can inject depth-appropriate
638
+ // material into their prompts without a second LLM call.
639
+ depth_context: zod.z.object({
640
+ ulo: zod.z.string().default(""),
641
+ cio: zod.z.string().default(""),
642
+ sio: zod.z.array(zod.z.string()).default([])
643
+ }).optional(),
609
644
  // Progressive-completion bookkeeping (feed v2, additive):
610
645
  // phase_id = development phase that introduces/uses this node;
611
646
  // introduce_aspect = how the phase teaches a concept node (first intro, advanced
@@ -632,12 +667,28 @@ var FeedPhaseSchema = zod.z.object({
632
667
  product_completion: zod.z.string().min(1),
633
668
  node_ids: zod.z.array(zod.z.string()).min(1)
634
669
  });
670
+ var FeedDiagnosticSchema = zod.z.object({
671
+ code: zod.z.string().min(1),
672
+ severity: zod.z.enum(["info", "warning", "error"]),
673
+ message: zod.z.string(),
674
+ node_ids: zod.z.array(zod.z.string()).default([])
675
+ });
676
+ var FeedProvenanceSchema = zod.z.object({
677
+ providers: zod.z.array(zod.z.string()).default([]),
678
+ models: zod.z.array(zod.z.string()).default([]),
679
+ calls: zod.z.number().int().nonnegative().default(0),
680
+ failed_calls: zod.z.number().int().nonnegative().default(0),
681
+ degraded: zod.z.boolean().default(false)
682
+ });
635
683
  var CurriculumFeedSchema = zod.z.object({
636
684
  schema_version: zod.z.literal(2),
637
685
  source: zod.z.object({
638
686
  graph_type: zod.z.enum(["project_graph", "knowledge_graph", "hybrid_graph"]),
687
+ /** DERIVED from diagnostics — do not write to it directly. */
639
688
  warnings: zod.z.array(zod.z.string()).default([]),
640
- hallucination_count: zod.z.number().int().nonnegative().default(0)
689
+ hallucination_count: zod.z.number().int().nonnegative().default(0),
690
+ diagnostics: zod.z.array(FeedDiagnosticSchema).default([]),
691
+ provenance: FeedProvenanceSchema.optional()
641
692
  }),
642
693
  learning_nodes: zod.z.array(FeedNodeSchema).min(1, "curriculum feed must contain at least one learning node"),
643
694
  dependency_edges: zod.z.array(FeedEdgeSchema).default([]),
@@ -670,6 +721,15 @@ function validateCurriculumFeed(feed) {
670
721
  }
671
722
  const phaseIds = parsed.phases.map((p) => p.id);
672
723
  if (new Set(phaseIds).size !== phaseIds.length) throw new Error("curriculum feed contains duplicate phase ids");
724
+ const phaseOrders = parsed.phases.map((p) => p.order);
725
+ if (new Set(phaseOrders).size !== phaseOrders.length) {
726
+ throw new Error("curriculum feed contains duplicate phase orders: " + phaseOrders.join(", "));
727
+ }
728
+ for (let i = 1; i < phaseOrders.length; i++) {
729
+ if (phaseOrders[i] <= phaseOrders[i - 1]) {
730
+ throw new Error("curriculum feed phase orders are not ascending: " + phaseOrders.join(", "));
731
+ }
732
+ }
673
733
  if (parsed.phases.length > 0) {
674
734
  const phaseIndexOf = /* @__PURE__ */ new Map();
675
735
  parsed.phases.forEach((p, i) => {
@@ -708,11 +768,13 @@ exports.ExperienceComponentSchema = ExperienceComponentSchema;
708
768
  exports.ExperienceSchema = ExperienceSchema;
709
769
  exports.ExperimentProcedureSchema = ExperimentProcedureSchema;
710
770
  exports.FeatureSchema = FeatureSchema;
771
+ exports.FeedDiagnosticSchema = FeedDiagnosticSchema;
711
772
  exports.FeedEdgeSchema = FeedEdgeSchema;
712
773
  exports.FeedGroupingSchema = FeedGroupingSchema;
713
774
  exports.FeedKeywordsSchema = FeedKeywordsSchema;
714
775
  exports.FeedNodeSchema = FeedNodeSchema;
715
776
  exports.FeedPhaseSchema = FeedPhaseSchema;
777
+ exports.FeedProvenanceSchema = FeedProvenanceSchema;
716
778
  exports.FeedScaffoldCandidateSchema = FeedScaffoldCandidateSchema;
717
779
  exports.GrammarRuleSchema = GrammarRuleSchema;
718
780
  exports.GraphTypeSchema = GraphTypeSchema;