@thanh01.pmt/domain-kit 0.5.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 (69) 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-TYXSJUQU.mjs → chunk-2OGNQUXC.mjs} +81 -32
  5. package/dist/chunk-2OGNQUXC.mjs.map +1 -0
  6. package/dist/{chunk-G7HLFMD2.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-E4GCCWJO.mjs → chunk-CGNXGVHV.mjs} +37 -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-TWKIVUTQ.mjs → chunk-WKTH3JPA.mjs} +197 -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-DUFwFyr2.d.ts → curriculumFeedSchema-DYayelAA.d.cts} +156 -1
  23. package/dist/{curriculumFeedSchema-DUFwFyr2.d.cts → curriculumFeedSchema-DYayelAA.d.ts} +156 -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 +229 -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 +73 -29
  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 +2634 -2359
  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 +2207 -1958
  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 +55 -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 +10 -9
  59. package/LICENSE +0 -21
  60. package/dist/chunk-BL5NBKPH.mjs.map +0 -1
  61. package/dist/chunk-E4GCCWJO.mjs.map +0 -1
  62. package/dist/chunk-G7HLFMD2.mjs.map +0 -1
  63. package/dist/chunk-TWKIVUTQ.mjs.map +0 -1
  64. package/dist/chunk-TYXSJUQU.mjs.map +0 -1
  65. package/dist/chunk-VCPIWJ7R.mjs.map +0 -1
  66. package/dist/curriculumFeedEmitter-T7NUBLAM.mjs +0 -4
  67. package/dist/curriculumFeedEmitter-T7NUBLAM.mjs.map +0 -1
  68. package/dist/llmClient-ysPhLjcH.d.cts +0 -16
  69. 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-DUFwFyr2.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-DUFwFyr2.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-G7HLFMD2.mjs';
2
- import '../chunk-TWKIVUTQ.mjs';
3
- import '../chunk-E4GCCWJO.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-TYXSJUQU.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,14 @@ 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([]),
609
635
  // Depth layer text (optional, additive — old feeds validate unchanged).
610
636
  // Carries the ULO/CIO/SIO authored text from the KnowledgeGraph concept
611
637
  // so downstream consumers (KX generator) can inject depth-appropriate
@@ -641,12 +667,28 @@ var FeedPhaseSchema = zod.z.object({
641
667
  product_completion: zod.z.string().min(1),
642
668
  node_ids: zod.z.array(zod.z.string()).min(1)
643
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
+ });
644
683
  var CurriculumFeedSchema = zod.z.object({
645
684
  schema_version: zod.z.literal(2),
646
685
  source: zod.z.object({
647
686
  graph_type: zod.z.enum(["project_graph", "knowledge_graph", "hybrid_graph"]),
687
+ /** DERIVED from diagnostics — do not write to it directly. */
648
688
  warnings: zod.z.array(zod.z.string()).default([]),
649
- 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()
650
692
  }),
651
693
  learning_nodes: zod.z.array(FeedNodeSchema).min(1, "curriculum feed must contain at least one learning node"),
652
694
  dependency_edges: zod.z.array(FeedEdgeSchema).default([]),
@@ -679,6 +721,15 @@ function validateCurriculumFeed(feed) {
679
721
  }
680
722
  const phaseIds = parsed.phases.map((p) => p.id);
681
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
+ }
682
733
  if (parsed.phases.length > 0) {
683
734
  const phaseIndexOf = /* @__PURE__ */ new Map();
684
735
  parsed.phases.forEach((p, i) => {
@@ -717,11 +768,13 @@ exports.ExperienceComponentSchema = ExperienceComponentSchema;
717
768
  exports.ExperienceSchema = ExperienceSchema;
718
769
  exports.ExperimentProcedureSchema = ExperimentProcedureSchema;
719
770
  exports.FeatureSchema = FeatureSchema;
771
+ exports.FeedDiagnosticSchema = FeedDiagnosticSchema;
720
772
  exports.FeedEdgeSchema = FeedEdgeSchema;
721
773
  exports.FeedGroupingSchema = FeedGroupingSchema;
722
774
  exports.FeedKeywordsSchema = FeedKeywordsSchema;
723
775
  exports.FeedNodeSchema = FeedNodeSchema;
724
776
  exports.FeedPhaseSchema = FeedPhaseSchema;
777
+ exports.FeedProvenanceSchema = FeedProvenanceSchema;
725
778
  exports.FeedScaffoldCandidateSchema = FeedScaffoldCandidateSchema;
726
779
  exports.GrammarRuleSchema = GrammarRuleSchema;
727
780
  exports.GraphTypeSchema = GraphTypeSchema;