@thanh01.pmt/domain-kit 0.6.0 → 0.6.1

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -10
  3. package/dist/assembly/index.d.cts +3 -2
  4. package/dist/assembly/index.d.ts +3 -2
  5. package/dist/{chunk-2OGNQUXC.mjs → chunk-4UCXYRM3.mjs} +152 -303
  6. package/dist/chunk-4UCXYRM3.mjs.map +1 -0
  7. package/dist/chunk-7A2SG466.mjs +325 -0
  8. package/dist/chunk-7A2SG466.mjs.map +1 -0
  9. package/dist/{chunk-DRVOV5ZD.mjs → chunk-DSEJLTUO.mjs} +2 -2
  10. package/dist/chunk-DSEJLTUO.mjs.map +1 -0
  11. package/dist/{chunk-ERDTHXQA.mjs → chunk-H4W3YJLK.mjs} +10 -3
  12. package/dist/chunk-H4W3YJLK.mjs.map +1 -0
  13. package/dist/chunk-IBVXXVGE.mjs +14 -0
  14. package/dist/chunk-IBVXXVGE.mjs.map +1 -0
  15. package/dist/{chunk-5OMSYKQP.mjs → chunk-KHCZYLKM.mjs} +33 -18
  16. package/dist/chunk-KHCZYLKM.mjs.map +1 -0
  17. package/dist/{chunk-67GXK3ZE.mjs → chunk-WD3P5V3B.mjs} +3 -2
  18. package/dist/chunk-WD3P5V3B.mjs.map +1 -0
  19. package/dist/{conceptEscalator-DPrs4PwC.d.cts → conceptEscalator-BmMJD8C5.d.cts} +1 -1
  20. package/dist/{conceptEscalator-BCsw0ys_.d.ts → conceptEscalator-DMsehscs.d.ts} +1 -1
  21. package/dist/concepts/index.d.cts +4 -3
  22. package/dist/concepts/index.d.ts +4 -3
  23. package/dist/{cpp-CZUPqJt9.d.cts → cpp-vlDl6pCL.d.cts} +4 -4
  24. package/dist/{cpp-CZUPqJt9.d.ts → cpp-vlDl6pCL.d.ts} +4 -4
  25. package/dist/detector/index.cjs +1 -0
  26. package/dist/detector/index.cjs.map +1 -1
  27. package/dist/detector/index.d.cts +2 -2
  28. package/dist/detector/index.d.ts +2 -2
  29. package/dist/detector/index.mjs +1 -1
  30. package/dist/{domainProfileDetector-DHb1T0zB.d.ts → domainProfileDetector-6pjgL-6_.d.ts} +1 -1
  31. package/dist/{domainProfileDetector-bzugdQmS.d.cts → domainProfileDetector-BsADsuRV.d.cts} +1 -1
  32. package/dist/{domainProfileSchema-CwT3Ffsw.d.cts → domainProfileSchema-779FGk14.d.cts} +38 -1
  33. package/dist/{domainProfileSchema-CwT3Ffsw.d.ts → domainProfileSchema-779FGk14.d.ts} +38 -1
  34. package/dist/extractors/index.d.cts +3 -3
  35. package/dist/extractors/index.d.ts +3 -3
  36. package/dist/feed/index.d.cts +1 -1
  37. package/dist/feed/index.d.ts +1 -1
  38. package/dist/graph/index.cjs +235 -57
  39. package/dist/graph/index.cjs.map +1 -1
  40. package/dist/graph/index.d.cts +9 -6
  41. package/dist/graph/index.d.ts +9 -6
  42. package/dist/graph/index.mjs +3 -1
  43. package/dist/{hybridGraphPipeline-CocfYe4d.d.cts → hybridGraphPipeline-B4mamLim.d.cts} +1 -1
  44. package/dist/{hybridGraphPipeline-9dRKJj7r.d.ts → hybridGraphPipeline-D2_1GUva.d.ts} +1 -1
  45. package/dist/index.cjs +277 -68
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +9 -8
  48. package/dist/index.d.ts +9 -8
  49. package/dist/index.mjs +11 -9
  50. package/dist/{keywordExtractor-BxlGRMHC.d.cts → keywordExtractor-1YAFntsn.d.cts} +1 -1
  51. package/dist/{keywordExtractor-DU5XRN8-.d.ts → keywordExtractor-DWw8z_AF.d.ts} +1 -1
  52. package/dist/parsers/index.cjs.map +1 -1
  53. package/dist/parsers/index.d.cts +1 -1
  54. package/dist/parsers/index.d.ts +1 -1
  55. package/dist/parsers/index.mjs +1 -1
  56. package/dist/pipeline/index.cjs +261 -68
  57. package/dist/pipeline/index.cjs.map +1 -1
  58. package/dist/pipeline/index.d.cts +10 -9
  59. package/dist/pipeline/index.d.ts +10 -9
  60. package/dist/pipeline/index.mjs +8 -6
  61. package/dist/schemas/index.cjs +8 -0
  62. package/dist/schemas/index.cjs.map +1 -1
  63. package/dist/schemas/index.d.cts +2 -2
  64. package/dist/schemas/index.d.ts +2 -2
  65. package/dist/schemas/index.mjs +1 -1
  66. package/dist/utils/llmClient.cjs +344 -0
  67. package/dist/utils/llmClient.cjs.map +1 -0
  68. package/dist/utils/llmClient.d.cts +118 -0
  69. package/dist/utils/llmClient.d.ts +118 -0
  70. package/dist/utils/llmClient.mjs +4 -0
  71. package/dist/utils/llmClient.mjs.map +1 -0
  72. package/dist/utils/llmTransportResult.cjs +16 -0
  73. package/dist/utils/llmTransportResult.cjs.map +1 -0
  74. package/dist/utils/llmTransportResult.d.cts +36 -0
  75. package/dist/utils/llmTransportResult.d.ts +36 -0
  76. package/dist/utils/llmTransportResult.mjs +3 -0
  77. package/dist/utils/llmTransportResult.mjs.map +1 -0
  78. package/package.json +9 -10
  79. package/dist/chunk-2OGNQUXC.mjs.map +0 -1
  80. package/dist/chunk-5OMSYKQP.mjs.map +0 -1
  81. package/dist/chunk-67GXK3ZE.mjs.map +0 -1
  82. package/dist/chunk-DRVOV5ZD.mjs.map +0 -1
  83. package/dist/chunk-ERDTHXQA.mjs.map +0 -1
  84. package/dist/llmClient-CX5uUiQ1.d.cts +0 -60
  85. package/dist/llmClient-CX5uUiQ1.d.ts +0 -60
  86. package/dist/{curriculumFeedSchema-DYayelAA.d.ts → curriculumFeedSchema-DK-TUAJZ.d.cts} +8 -8
  87. package/dist/{curriculumFeedSchema-DYayelAA.d.cts → curriculumFeedSchema-DK-TUAJZ.d.ts} +8 -8
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tony Pham
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -112,7 +112,7 @@ them, instead of surfacing as a broken lesson three packages later.
112
112
  runProjectGraph runKnowledgeGraph runProjectGraphPipeline + runKnowledgeGraphPipeline
113
113
  Pipeline Pipeline (two full graph runs), then:
114
114
  STEP_1 scan/ (parseSyllabus generateHybridGraph()
115
- select/AST first if raw STEP_1 feature-concept links
115
+ select/regex first if raw STEP_1 feature-concept links
116
116
  STEP_2 keyword syllabusText) STEP_2 decomposePhases
117
117
  extract generateKnowledge (auditPhasePlan fail-closed)
118
118
  STEP_3 SDK API Graph: STEP_3 totals
@@ -136,8 +136,8 @@ them, instead of surfacing as a broken lesson three packages later.
136
136
  v
137
137
  +------------------------------------------------------------------------------+
138
138
  | LAYER 3 - emitCurriculumFeed(graph) - pure projection, no LLM |
139
- | Called from THREE places (R3): router for the project branch |
140
- | (domainRouter.ts:171), knowledge orchestrator, hybrid orchestrator. |
139
+ | Options built in ONE shared helper (pipeline/emitFeed.ts, R3 fixed): |
140
+ | router (project), knowledge orchestrator, hybrid orchestrator. |
141
141
  | learning_nodes[] - dependency_edges[] - suggested_groupings[] - phases[] |
142
142
  | (phases[] is filled ONLY by the hybrid emitter - R1) |
143
143
  +------------------------------------+-----------------------------------------+
@@ -190,10 +190,10 @@ verified against. Full postmortems: deep review 2026-10-05 (app repo,
190
190
  |---|---|---|---|
191
191
  | R1 | **FIXED 2026-10-07.** Was: `hybrid` without `repoDir` silently degraded to a knowledge-graph feed (only a `warnings[]` entry). Now a FORCED hybrid throws (fail-closed); an auto-detected downgrade returns a structured `modeDowngrade { from, to, reason }`. | `src/pipeline/domainRouter.ts` | High |
192
192
  | R2 | **FIXED 2026-10-07.** Was: the hybrid branch's knowledge legs dropped `knowledgeTreePath`/`proposalsPath`, so STEP_2_5 ran in concept mode but not hybrid mode for the same subject. Now both hybrid legs pass them through. | `src/pipeline/domainRouter.ts` | High |
193
- | R3 | Feed emission is invoked from three different places, and emission options already diverge (`hallucinationCount` is only passed by the router). Drift risk with every emitter change. | `domainRouter.ts:171`, `pipeline/knowledgeGraphPipeline.ts:37`, `pipeline/hybridGraphPipeline.ts:22` | Medium |
194
- | R4 | Cycle breaking mutates `prerequisites` in place ("weakest edge" heuristic) and only warns. Which edge is dropped decides teaching order - a pedagogy-relevant decision hidden in a warning string. | `src/graph/knowledgeGraphPipeline.ts:383` | Medium |
195
- | R5 | STEP_2_5 only runs when `knowledgeTreePath` is provided. Without it, every concept stays `proposed_new` and nothing in the output flags the absence of tree anchoring. | `src/graph/knowledgeGraphPipeline.ts:322` | Medium |
196
- | R6 | Tree prerequisite edges are seeded only when the referenced tree concept is part of THIS analysis - partial graphs silently lose cross-analysis prerequisite edges. Matters for gold-set coverage measurement across runs. | `src/graph/knowledgeGraphPipeline.ts:363-375` | Medium |
193
+ | R3 | **FIXED 2026-10-07.** Was: feed emission invoked from three places with drifting options (`hallucinationCount` only from the router). Now ONE shared helper `emitNormalizedFeed()` in `src/pipeline/emitFeed.ts` builds options for all three call sites (lives in pipeline/ so feed/ keeps its no-llmClient invariant). | `src/pipeline/emitFeed.ts` | Medium |
194
+ | R4 | Cycle breaking removes the DFS back-edge positionally (mechanism verified 2026-10-07: NO "weakest edge"/link-counting weighting — that was the old misleading log text, now fixed) and only warns. Which edge is dropped decides teaching order. | `src/graph/knowledgeGraphVerifier.ts:69` | Medium |
195
+ | R5 | **FIXED 2026-10-07.** Was: STEP_2_5 only ran when `knowledgeTreePath` was provided and the absence of tree anchoring was silent. Now the pipeline pushes an explicit warning (all concepts then stay `proposed_new`). | `src/graph/knowledgeGraphPipeline.ts` | Medium |
196
+ | R6 | **FIXED 2026-10-07.** Was: tree prereq codes outside THIS analysis were dropped silently. Now one aggregated warning lists unmapped tree prereq codes (deduped, display capped at 10). | `src/graph/knowledgeGraphPipeline.ts` | Medium |
197
197
  | R7 | `emitCurriculumFeed` dispatches by shape (key presence) and pass-through-validates anything that "looks like a feed" (CF-8 in the deep review). | `src/feed/curriculumFeedEmitter.ts:833-839` | Low |
198
198
  | R8 | Non-fatal pedagogy issues funnel into a single lossy `warnings[]` string channel; some drops only hit `console.warn` (e.g. a concept falling out of `learning_path`, KG-3). Structured diagnostics per ADR-0002 should replace string warnings. | deep review KG-3 | Medium |
199
199
  | R9 | **FIXED 2026-10-07.** Was: ASCII-only regex assumptions broke on Vietnamese text (KG-1) - empty derived keywords threw, registries filled with fragments. Now a shared `stripDiacritics()` (NFD + combining-mark strip + `đ`→`d`, incl. the precomposed-base-letter case NFD cannot decompose) backs every tokenizer; regression tests in `src/__tests__/vietnamese-tokenization.test.ts`. | `src/utils/diacritics.ts` | Critical |
@@ -255,7 +255,7 @@ recomputed at the branch.
255
255
  STEP_1 parseSyllabus(syllabusText) → structured units/topics
256
256
  LLM decomposes the subject → concepts + prerequisites + problem_types
257
257
  + categories + techniques. The syllabus is truncated at
258
- KG_MAX_SYLLABUS_CHARS (default 16000) with a warning.
258
+ KG_MAX_SYLLABUS_CHARS (default 32000) with a warning.
259
259
 
260
260
  STEP_2 validate & clean
261
261
  · description shorter than 50 chars → warning
@@ -527,7 +527,7 @@ LLM_MAX_TOKENS=65536 # Max output tokens (default)
527
527
  LLM_MIN_REQUEST_INTERVAL_MS=2500 # process-wide pacing; 0 disables
528
528
 
529
529
  # Extra knobs the pipelines read directly:
530
- KG_MAX_SYLLABUS_CHARS=16000 # syllabus truncation before decomposition
530
+ KG_MAX_SYLLABUS_CHARS=32000 # syllabus truncation before decomposition
531
531
  KG_MAX_TOKENS=65536 # knowledge-graph generation budget
532
532
  LLM_REQUEST_TIMEOUT_MS=300000 # per-request cap
533
533
  ```
@@ -1278,7 +1278,7 @@ orchestrators call it for theirs.
1278
1278
 
1279
1279
  | Step | What happens | Fail mode |
1280
1280
  |---|---|---|
1281
- | `STEP_1` | parse the syllabus into structured units/topics, then LLM-decompose the subject into concepts, prerequisites, `problem_types`, categories | syllabus truncated at `KG_MAX_SYLLABUS_CHARS` (default 16000) + warning |
1281
+ | `STEP_1` | parse the syllabus into structured units/topics, then LLM-decompose the subject into concepts, prerequisites, `problem_types`, categories | syllabus truncated at `KG_MAX_SYLLABUS_CHARS` (default 32000) + warning |
1282
1282
  | `STEP_2` | validate & clean — description ≥ 50 chars; **keyword registry fail-closed** (empty keywords are derived from name/description; nothing derivable → `throw`); dangling prerequisite edges removed | `throw` when keywords cannot be derived |
1283
1283
  | `STEP_2_5` | *only when `knowledgeTreePath` is supplied* — standardize every concept against `mlo-knowlege-tree.tsv` into `standardized` or `proposed_new`; adopted tech-stack keywords merge into the registry; tree prerequisite codes seed internal edges | missing decision for a concept → `throw` |
1284
1284
  | `STEP_3` | `detectPrerequisiteCycles()` → `breakPrerequisiteCycles()` at the weakest edge | warnings; edges are removed |
@@ -1,7 +1,8 @@
1
1
  import { u as ProjectGraph, c as Step } from '../projectGraphSchema-DnD7orZV.cjs';
2
- import { C as ConceptMapping } from '../conceptEscalator-DPrs4PwC.cjs';
2
+ import { C as ConceptMapping } from '../conceptEscalator-BmMJD8C5.cjs';
3
3
  import 'zod';
4
- import '../llmClient-CX5uUiQ1.cjs';
4
+ import '../utils/llmClient.cjs';
5
+ import '../utils/llmTransportResult.cjs';
5
6
 
6
7
  /**
7
8
  * Roadmap assembly — assembles final roadmap with keyword tracking and time awareness.
@@ -1,7 +1,8 @@
1
1
  import { u as ProjectGraph, c as Step } from '../projectGraphSchema-DnD7orZV.js';
2
- import { C as ConceptMapping } from '../conceptEscalator-BCsw0ys_.js';
2
+ import { C as ConceptMapping } from '../conceptEscalator-DMsehscs.js';
3
3
  import 'zod';
4
- import '../llmClient-CX5uUiQ1.js';
4
+ import '../utils/llmClient.js';
5
+ import '../utils/llmTransportResult.js';
5
6
 
6
7
  /**
7
8
  * Roadmap assembly — assembles final roadmap with keyword tracking and time awareness.