@thanh01.pmt/domain-kit 0.5.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 (101) hide show
  1. package/README.md +682 -168
  2. package/dist/assembly/index.d.cts +3 -2
  3. package/dist/assembly/index.d.ts +3 -2
  4. package/dist/{chunk-TYXSJUQU.mjs → chunk-4UCXYRM3.mjs} +208 -310
  5. package/dist/chunk-4UCXYRM3.mjs.map +1 -0
  6. package/dist/chunk-7A2SG466.mjs +325 -0
  7. package/dist/chunk-7A2SG466.mjs.map +1 -0
  8. package/dist/{chunk-E4GCCWJO.mjs → chunk-CGNXGVHV.mjs} +37 -4
  9. package/dist/chunk-CGNXGVHV.mjs.map +1 -0
  10. package/dist/{chunk-DRVOV5ZD.mjs → chunk-DSEJLTUO.mjs} +2 -2
  11. package/dist/chunk-DSEJLTUO.mjs.map +1 -0
  12. package/dist/{chunk-VCPIWJ7R.mjs → chunk-H4W3YJLK.mjs} +29 -4
  13. package/dist/chunk-H4W3YJLK.mjs.map +1 -0
  14. package/dist/chunk-IBVXXVGE.mjs +14 -0
  15. package/dist/chunk-IBVXXVGE.mjs.map +1 -0
  16. package/dist/{chunk-G7HLFMD2.mjs → chunk-KHCZYLKM.mjs} +68 -33
  17. package/dist/chunk-KHCZYLKM.mjs.map +1 -0
  18. package/dist/chunk-OYSZQVPY.mjs +10 -0
  19. package/dist/chunk-OYSZQVPY.mjs.map +1 -0
  20. package/dist/{chunk-BL5NBKPH.mjs → chunk-WD3P5V3B.mjs} +19 -8
  21. package/dist/chunk-WD3P5V3B.mjs.map +1 -0
  22. package/dist/{chunk-TWKIVUTQ.mjs → chunk-WKTH3JPA.mjs} +197 -36
  23. package/dist/chunk-WKTH3JPA.mjs.map +1 -0
  24. package/dist/{conceptEscalator-ltRLtPhf.d.cts → conceptEscalator-BmMJD8C5.d.cts} +10 -1
  25. package/dist/{conceptEscalator-YfMKIKCZ.d.ts → conceptEscalator-DMsehscs.d.ts} +10 -1
  26. package/dist/concepts/index.d.cts +4 -3
  27. package/dist/concepts/index.d.ts +4 -3
  28. package/dist/{cpp-CZUPqJt9.d.cts → cpp-vlDl6pCL.d.cts} +4 -4
  29. package/dist/{cpp-CZUPqJt9.d.ts → cpp-vlDl6pCL.d.ts} +4 -4
  30. package/dist/{curriculumFeedSchema-DUFwFyr2.d.ts → curriculumFeedSchema-DK-TUAJZ.d.cts} +164 -9
  31. package/dist/{curriculumFeedSchema-DUFwFyr2.d.cts → curriculumFeedSchema-DK-TUAJZ.d.ts} +164 -9
  32. package/dist/detector/index.cjs +22 -6
  33. package/dist/detector/index.cjs.map +1 -1
  34. package/dist/detector/index.d.cts +2 -2
  35. package/dist/detector/index.d.ts +2 -2
  36. package/dist/detector/index.mjs +2 -1
  37. package/dist/{domainProfileDetector-DHb1T0zB.d.ts → domainProfileDetector-6pjgL-6_.d.ts} +1 -1
  38. package/dist/{domainProfileDetector-bzugdQmS.d.cts → domainProfileDetector-BsADsuRV.d.cts} +1 -1
  39. package/dist/{domainProfileSchema-CwT3Ffsw.d.ts → domainProfileSchema-779FGk14.d.cts} +38 -1
  40. package/dist/{domainProfileSchema-CwT3Ffsw.d.cts → domainProfileSchema-779FGk14.d.ts} +38 -1
  41. package/dist/extractors/index.d.cts +3 -3
  42. package/dist/extractors/index.d.ts +3 -3
  43. package/dist/feed/index.cjs +229 -33
  44. package/dist/feed/index.cjs.map +1 -1
  45. package/dist/feed/index.d.cts +32 -2
  46. package/dist/feed/index.d.ts +32 -2
  47. package/dist/feed/index.mjs +2 -2
  48. package/dist/graph/index.cjs +308 -86
  49. package/dist/graph/index.cjs.map +1 -1
  50. package/dist/graph/index.d.cts +20 -8
  51. package/dist/graph/index.d.ts +20 -8
  52. package/dist/graph/index.mjs +4 -1
  53. package/dist/{hybridGraphPipeline-dT-bio-3.d.cts → hybridGraphPipeline-B4mamLim.d.cts} +6 -2
  54. package/dist/{hybridGraphPipeline-DXQDbBEj.d.ts → hybridGraphPipeline-D2_1GUva.d.ts} +6 -2
  55. package/dist/{hybridGraphSchema-nrUeSwpU.d.ts → hybridGraphSchema-C37qxdTM.d.cts} +16 -3
  56. package/dist/{hybridGraphSchema-nrUeSwpU.d.cts → hybridGraphSchema-C37qxdTM.d.ts} +16 -3
  57. package/dist/index.cjs +3948 -3464
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.d.cts +11 -10
  60. package/dist/index.d.ts +11 -10
  61. package/dist/index.mjs +14 -11
  62. package/dist/{keywordExtractor-BxlGRMHC.d.cts → keywordExtractor-1YAFntsn.d.cts} +1 -1
  63. package/dist/{keywordExtractor-DU5XRN8-.d.ts → keywordExtractor-DWw8z_AF.d.ts} +1 -1
  64. package/dist/parsers/index.cjs.map +1 -1
  65. package/dist/parsers/index.d.cts +1 -1
  66. package/dist/parsers/index.d.ts +1 -1
  67. package/dist/parsers/index.mjs +1 -1
  68. package/dist/pipeline/index.cjs +2436 -1994
  69. package/dist/pipeline/index.cjs.map +1 -1
  70. package/dist/pipeline/index.d.cts +19 -10
  71. package/dist/pipeline/index.d.ts +19 -10
  72. package/dist/pipeline/index.mjs +11 -8
  73. package/dist/schemas/index.cjs +63 -2
  74. package/dist/schemas/index.cjs.map +1 -1
  75. package/dist/schemas/index.d.cts +3 -3
  76. package/dist/schemas/index.d.ts +3 -3
  77. package/dist/schemas/index.mjs +2 -2
  78. package/dist/utils/llmClient.cjs +344 -0
  79. package/dist/utils/llmClient.cjs.map +1 -0
  80. package/dist/utils/llmClient.d.cts +118 -0
  81. package/dist/utils/llmClient.d.ts +118 -0
  82. package/dist/utils/llmClient.mjs +4 -0
  83. package/dist/utils/llmClient.mjs.map +1 -0
  84. package/dist/utils/llmTransportResult.cjs +16 -0
  85. package/dist/utils/llmTransportResult.cjs.map +1 -0
  86. package/dist/utils/llmTransportResult.d.cts +36 -0
  87. package/dist/utils/llmTransportResult.d.ts +36 -0
  88. package/dist/utils/llmTransportResult.mjs +3 -0
  89. package/dist/utils/llmTransportResult.mjs.map +1 -0
  90. package/package.json +1 -1
  91. package/dist/chunk-BL5NBKPH.mjs.map +0 -1
  92. package/dist/chunk-DRVOV5ZD.mjs.map +0 -1
  93. package/dist/chunk-E4GCCWJO.mjs.map +0 -1
  94. package/dist/chunk-G7HLFMD2.mjs.map +0 -1
  95. package/dist/chunk-TWKIVUTQ.mjs.map +0 -1
  96. package/dist/chunk-TYXSJUQU.mjs.map +0 -1
  97. package/dist/chunk-VCPIWJ7R.mjs.map +0 -1
  98. package/dist/curriculumFeedEmitter-T7NUBLAM.mjs +0 -4
  99. package/dist/curriculumFeedEmitter-T7NUBLAM.mjs.map +0 -1
  100. package/dist/llmClient-ysPhLjcH.d.cts +0 -16
  101. package/dist/llmClient-ysPhLjcH.d.ts +0 -16
@@ -26,8 +26,8 @@ declare const FeedScaffoldCandidateSchema: z.ZodObject<{
26
26
  minutes_saved: z.ZodDefault<z.ZodNumber>;
27
27
  suggest: z.ZodDefault<z.ZodEnum<["provide_full", "provide_partial", "provide_reference"]>>;
28
28
  }, "strip", z.ZodTypeAny, {
29
- item: string;
30
29
  reason: string;
30
+ item: string;
31
31
  minutes_saved: number;
32
32
  suggest: "provide_full" | "provide_partial" | "provide_reference";
33
33
  }, {
@@ -65,8 +65,8 @@ declare const FeedNodeSchema: z.ZodObject<{
65
65
  minutes_saved: z.ZodDefault<z.ZodNumber>;
66
66
  suggest: z.ZodDefault<z.ZodEnum<["provide_full", "provide_partial", "provide_reference"]>>;
67
67
  }, "strip", z.ZodTypeAny, {
68
- item: string;
69
68
  reason: string;
69
+ item: string;
70
70
  minutes_saved: number;
71
71
  suggest: "provide_full" | "provide_partial" | "provide_reference";
72
72
  }, {
@@ -78,8 +78,8 @@ declare const FeedNodeSchema: z.ZodObject<{
78
78
  core_value_minutes: z.ZodDefault<z.ZodNumber>;
79
79
  }, "strip", z.ZodTypeAny, {
80
80
  scaffold_candidates: {
81
- item: string;
82
81
  reason: string;
82
+ item: string;
83
83
  minutes_saved: number;
84
84
  suggest: "provide_full" | "provide_partial" | "provide_reference";
85
85
  }[];
@@ -136,6 +136,14 @@ declare const FeedNodeSchema: z.ZodObject<{
136
136
  reason?: string | undefined;
137
137
  }>, "many">>;
138
138
  is_core: z.ZodDefault<z.ZodBoolean>;
139
+ /**
140
+ * Prerequisite concept ids this node needs that NO node in this feed provides —
141
+ * i.e. the learner must already know them before starting. Previously these were
142
+ * silently dropped (knowledge path) or crashed emission (both hybrid paths), so a
143
+ * course silently lost its entry requirements. Kept on the node so the mapping
144
+ * "concept X needs prior knowledge Y" survives; a course-level roll-up is derivable.
145
+ */
146
+ external_prerequisites: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
139
147
  depth_context: z.ZodOptional<z.ZodObject<{
140
148
  ulo: z.ZodDefault<z.ZodString>;
141
149
  cio: z.ZodDefault<z.ZodString>;
@@ -169,8 +177,8 @@ declare const FeedNodeSchema: z.ZodObject<{
169
177
  depth_hint: "ulo" | "cio" | "sio" | null;
170
178
  scaffolding: {
171
179
  scaffold_candidates: {
172
- item: string;
173
180
  reason: string;
181
+ item: string;
174
182
  minutes_saved: number;
175
183
  suggest: "provide_full" | "provide_partial" | "provide_reference";
176
184
  }[];
@@ -183,6 +191,7 @@ declare const FeedNodeSchema: z.ZodObject<{
183
191
  concept_ref: string | null;
184
192
  user_visible_deliverable: string;
185
193
  is_core: boolean;
194
+ external_prerequisites: string[];
186
195
  introduce_aspect: "new" | "advanced" | "preview" | null;
187
196
  depth_variants?: {
188
197
  ulo: number;
@@ -243,6 +252,7 @@ declare const FeedNodeSchema: z.ZodObject<{
243
252
  reason?: string | undefined;
244
253
  }[] | undefined;
245
254
  is_core?: boolean | undefined;
255
+ external_prerequisites?: string[] | undefined;
246
256
  depth_context?: {
247
257
  ulo?: string | undefined;
248
258
  cio?: string | undefined;
@@ -302,20 +312,127 @@ declare const FeedPhaseSchema: z.ZodObject<{
302
312
  node_ids: string[];
303
313
  }>;
304
314
  type FeedPhase = z.infer<typeof FeedPhaseSchema>;
315
+ /**
316
+ * Machine-readable diagnostic. `warnings` in `source` is the DERIVED text view of
317
+ * these (every diagnostic whose severity is not 'info'), so there is exactly one
318
+ * source of truth and the host can gate on `code`/`severity` instead of substring
319
+ * matching free text — the 2026-09-17 class of incident was a drift that was only
320
+ * ever a warning string.
321
+ */
322
+ declare const FeedDiagnosticSchema: z.ZodObject<{
323
+ code: z.ZodString;
324
+ severity: z.ZodEnum<["info", "warning", "error"]>;
325
+ message: z.ZodString;
326
+ node_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ code: string;
329
+ message: string;
330
+ severity: "info" | "warning" | "error";
331
+ node_ids: string[];
332
+ }, {
333
+ code: string;
334
+ message: string;
335
+ severity: "info" | "warning" | "error";
336
+ node_ids?: string[] | undefined;
337
+ }>;
338
+ type FeedDiagnostic = z.infer<typeof FeedDiagnosticSchema>;
339
+ /** Which LLM providers actually served this graph, and whether any call fell over. */
340
+ declare const FeedProvenanceSchema: z.ZodObject<{
341
+ providers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
342
+ models: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
343
+ calls: z.ZodDefault<z.ZodNumber>;
344
+ failed_calls: z.ZodDefault<z.ZodNumber>;
345
+ degraded: z.ZodDefault<z.ZodBoolean>;
346
+ }, "strip", z.ZodTypeAny, {
347
+ models: string[];
348
+ providers: string[];
349
+ calls: number;
350
+ failed_calls: number;
351
+ degraded: boolean;
352
+ }, {
353
+ models?: string[] | undefined;
354
+ providers?: string[] | undefined;
355
+ calls?: number | undefined;
356
+ failed_calls?: number | undefined;
357
+ degraded?: boolean | undefined;
358
+ }>;
359
+ type FeedProvenance = z.infer<typeof FeedProvenanceSchema>;
305
360
  declare const CurriculumFeedSchema: z.ZodObject<{
306
361
  schema_version: z.ZodLiteral<2>;
307
362
  source: z.ZodObject<{
308
363
  graph_type: z.ZodEnum<["project_graph", "knowledge_graph", "hybrid_graph"]>;
364
+ /** DERIVED from diagnostics — do not write to it directly. */
309
365
  warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
310
366
  hallucination_count: z.ZodDefault<z.ZodNumber>;
367
+ diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
368
+ code: z.ZodString;
369
+ severity: z.ZodEnum<["info", "warning", "error"]>;
370
+ message: z.ZodString;
371
+ node_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
372
+ }, "strip", z.ZodTypeAny, {
373
+ code: string;
374
+ message: string;
375
+ severity: "info" | "warning" | "error";
376
+ node_ids: string[];
377
+ }, {
378
+ code: string;
379
+ message: string;
380
+ severity: "info" | "warning" | "error";
381
+ node_ids?: string[] | undefined;
382
+ }>, "many">>;
383
+ provenance: z.ZodOptional<z.ZodObject<{
384
+ providers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
385
+ models: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
386
+ calls: z.ZodDefault<z.ZodNumber>;
387
+ failed_calls: z.ZodDefault<z.ZodNumber>;
388
+ degraded: z.ZodDefault<z.ZodBoolean>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ models: string[];
391
+ providers: string[];
392
+ calls: number;
393
+ failed_calls: number;
394
+ degraded: boolean;
395
+ }, {
396
+ models?: string[] | undefined;
397
+ providers?: string[] | undefined;
398
+ calls?: number | undefined;
399
+ failed_calls?: number | undefined;
400
+ degraded?: boolean | undefined;
401
+ }>>;
311
402
  }, "strip", z.ZodTypeAny, {
312
403
  graph_type: "knowledge_graph" | "hybrid_graph" | "project_graph";
313
404
  warnings: string[];
314
405
  hallucination_count: number;
406
+ diagnostics: {
407
+ code: string;
408
+ message: string;
409
+ severity: "info" | "warning" | "error";
410
+ node_ids: string[];
411
+ }[];
412
+ provenance?: {
413
+ models: string[];
414
+ providers: string[];
415
+ calls: number;
416
+ failed_calls: number;
417
+ degraded: boolean;
418
+ } | undefined;
315
419
  }, {
316
420
  graph_type: "knowledge_graph" | "hybrid_graph" | "project_graph";
317
421
  warnings?: string[] | undefined;
318
422
  hallucination_count?: number | undefined;
423
+ diagnostics?: {
424
+ code: string;
425
+ message: string;
426
+ severity: "info" | "warning" | "error";
427
+ node_ids?: string[] | undefined;
428
+ }[] | undefined;
429
+ provenance?: {
430
+ models?: string[] | undefined;
431
+ providers?: string[] | undefined;
432
+ calls?: number | undefined;
433
+ failed_calls?: number | undefined;
434
+ degraded?: boolean | undefined;
435
+ } | undefined;
319
436
  }>;
320
437
  learning_nodes: z.ZodArray<z.ZodObject<{
321
438
  id: z.ZodString;
@@ -346,8 +463,8 @@ declare const CurriculumFeedSchema: z.ZodObject<{
346
463
  minutes_saved: z.ZodDefault<z.ZodNumber>;
347
464
  suggest: z.ZodDefault<z.ZodEnum<["provide_full", "provide_partial", "provide_reference"]>>;
348
465
  }, "strip", z.ZodTypeAny, {
349
- item: string;
350
466
  reason: string;
467
+ item: string;
351
468
  minutes_saved: number;
352
469
  suggest: "provide_full" | "provide_partial" | "provide_reference";
353
470
  }, {
@@ -359,8 +476,8 @@ declare const CurriculumFeedSchema: z.ZodObject<{
359
476
  core_value_minutes: z.ZodDefault<z.ZodNumber>;
360
477
  }, "strip", z.ZodTypeAny, {
361
478
  scaffold_candidates: {
362
- item: string;
363
479
  reason: string;
480
+ item: string;
364
481
  minutes_saved: number;
365
482
  suggest: "provide_full" | "provide_partial" | "provide_reference";
366
483
  }[];
@@ -417,6 +534,14 @@ declare const CurriculumFeedSchema: z.ZodObject<{
417
534
  reason?: string | undefined;
418
535
  }>, "many">>;
419
536
  is_core: z.ZodDefault<z.ZodBoolean>;
537
+ /**
538
+ * Prerequisite concept ids this node needs that NO node in this feed provides —
539
+ * i.e. the learner must already know them before starting. Previously these were
540
+ * silently dropped (knowledge path) or crashed emission (both hybrid paths), so a
541
+ * course silently lost its entry requirements. Kept on the node so the mapping
542
+ * "concept X needs prior knowledge Y" survives; a course-level roll-up is derivable.
543
+ */
544
+ external_prerequisites: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
420
545
  depth_context: z.ZodOptional<z.ZodObject<{
421
546
  ulo: z.ZodDefault<z.ZodString>;
422
547
  cio: z.ZodDefault<z.ZodString>;
@@ -450,8 +575,8 @@ declare const CurriculumFeedSchema: z.ZodObject<{
450
575
  depth_hint: "ulo" | "cio" | "sio" | null;
451
576
  scaffolding: {
452
577
  scaffold_candidates: {
453
- item: string;
454
578
  reason: string;
579
+ item: string;
455
580
  minutes_saved: number;
456
581
  suggest: "provide_full" | "provide_partial" | "provide_reference";
457
582
  }[];
@@ -464,6 +589,7 @@ declare const CurriculumFeedSchema: z.ZodObject<{
464
589
  concept_ref: string | null;
465
590
  user_visible_deliverable: string;
466
591
  is_core: boolean;
592
+ external_prerequisites: string[];
467
593
  introduce_aspect: "new" | "advanced" | "preview" | null;
468
594
  depth_variants?: {
469
595
  ulo: number;
@@ -524,6 +650,7 @@ declare const CurriculumFeedSchema: z.ZodObject<{
524
650
  reason?: string | undefined;
525
651
  }[] | undefined;
526
652
  is_core?: boolean | undefined;
653
+ external_prerequisites?: string[] | undefined;
527
654
  depth_context?: {
528
655
  ulo?: string | undefined;
529
656
  cio?: string | undefined;
@@ -587,6 +714,19 @@ declare const CurriculumFeedSchema: z.ZodObject<{
587
714
  graph_type: "knowledge_graph" | "hybrid_graph" | "project_graph";
588
715
  warnings: string[];
589
716
  hallucination_count: number;
717
+ diagnostics: {
718
+ code: string;
719
+ message: string;
720
+ severity: "info" | "warning" | "error";
721
+ node_ids: string[];
722
+ }[];
723
+ provenance?: {
724
+ models: string[];
725
+ providers: string[];
726
+ calls: number;
727
+ failed_calls: number;
728
+ degraded: boolean;
729
+ } | undefined;
590
730
  };
591
731
  schema_version: 2;
592
732
  phases: {
@@ -614,8 +754,8 @@ declare const CurriculumFeedSchema: z.ZodObject<{
614
754
  depth_hint: "ulo" | "cio" | "sio" | null;
615
755
  scaffolding: {
616
756
  scaffold_candidates: {
617
- item: string;
618
757
  reason: string;
758
+ item: string;
619
759
  minutes_saved: number;
620
760
  suggest: "provide_full" | "provide_partial" | "provide_reference";
621
761
  }[];
@@ -628,6 +768,7 @@ declare const CurriculumFeedSchema: z.ZodObject<{
628
768
  concept_ref: string | null;
629
769
  user_visible_deliverable: string;
630
770
  is_core: boolean;
771
+ external_prerequisites: string[];
631
772
  introduce_aspect: "new" | "advanced" | "preview" | null;
632
773
  depth_variants?: {
633
774
  ulo: number;
@@ -663,6 +804,19 @@ declare const CurriculumFeedSchema: z.ZodObject<{
663
804
  graph_type: "knowledge_graph" | "hybrid_graph" | "project_graph";
664
805
  warnings?: string[] | undefined;
665
806
  hallucination_count?: number | undefined;
807
+ diagnostics?: {
808
+ code: string;
809
+ message: string;
810
+ severity: "info" | "warning" | "error";
811
+ node_ids?: string[] | undefined;
812
+ }[] | undefined;
813
+ provenance?: {
814
+ models?: string[] | undefined;
815
+ providers?: string[] | undefined;
816
+ calls?: number | undefined;
817
+ failed_calls?: number | undefined;
818
+ degraded?: boolean | undefined;
819
+ } | undefined;
666
820
  };
667
821
  schema_version: 2;
668
822
  learning_nodes: {
@@ -708,6 +862,7 @@ declare const CurriculumFeedSchema: z.ZodObject<{
708
862
  reason?: string | undefined;
709
863
  }[] | undefined;
710
864
  is_core?: boolean | undefined;
865
+ external_prerequisites?: string[] | undefined;
711
866
  depth_context?: {
712
867
  ulo?: string | undefined;
713
868
  cio?: string | undefined;
@@ -742,4 +897,4 @@ type FeedGrouping = z.infer<typeof FeedGroupingSchema>;
742
897
  /** Strict pre-save resolution validation — fail-closed, no defaulted-empty graphs. */
743
898
  declare function validateCurriculumFeed(feed: unknown): CurriculumFeed;
744
899
 
745
- export { CurriculumFeedSchema as C, FeedKeywordsSchema as F, FeedScaffoldCandidateSchema as a, FeedNodeSchema as b, FeedEdgeSchema as c, FeedGroupingSchema as d, FeedPhaseSchema as e, type FeedPhase as f, type CurriculumFeed as g, type FeedNode as h, type FeedEdge as i, type FeedGrouping as j, validateCurriculumFeed as v };
900
+ export { CurriculumFeedSchema as C, FeedKeywordsSchema as F, FeedScaffoldCandidateSchema as a, FeedNodeSchema as b, FeedEdgeSchema as c, FeedGroupingSchema as d, FeedPhaseSchema as e, type FeedPhase as f, FeedDiagnosticSchema as g, type FeedDiagnostic as h, FeedProvenanceSchema as i, type FeedProvenance as j, type CurriculumFeed as k, type FeedNode as l, type FeedEdge as m, type FeedGrouping as n, validateCurriculumFeed as v };
@@ -130,6 +130,13 @@ function detectInputType(options) {
130
130
  };
131
131
  }
132
132
 
133
+ // src/utils/diacritics.ts
134
+ var COMBINING_MARKS = /[\u0300-\u036f]/g;
135
+ var D_WITH_STROKE = /đ/gi;
136
+ function stripDiacritics(s) {
137
+ return s.normalize("NFD").replace(COMBINING_MARKS, "").replace(D_WITH_STROKE, "d").toLowerCase();
138
+ }
139
+
133
140
  // src/detector/domainDetector.ts
134
141
  var DOMAIN_KEYWORDS = {
135
142
  software: [
@@ -574,6 +581,9 @@ function detectSyllabusLanguage(text) {
574
581
  }
575
582
  return "en";
576
583
  }
584
+ function normalizeText(s) {
585
+ return s.normalize("NFC").toLowerCase();
586
+ }
577
587
  function detectDomain(options) {
578
588
  const evidence = [];
579
589
  const detectedTechStack = [];
@@ -630,15 +640,19 @@ function detectDomain(options) {
630
640
  }
631
641
  }
632
642
  }
633
- const textContent = [
643
+ const textContent = normalizeText([
634
644
  options.description || "",
635
645
  options.goal || "",
636
646
  options.syllabusText || ""
637
- ].join(" ").toLowerCase();
647
+ ].join(" "));
648
+ const textNoMarks = stripDiacritics(textContent);
638
649
  for (const [domain, keywords] of Object.entries(DOMAIN_KEYWORDS)) {
639
650
  const cat = domain;
640
651
  for (const kw of keywords) {
641
- if (textContent.includes(kw.toLowerCase())) {
652
+ const kwNorm = normalizeText(kw);
653
+ const kwPlain = stripDiacritics(kw);
654
+ const matched = textContent.includes(kwNorm) || kwPlain !== kwNorm && textNoMarks.includes(kwPlain);
655
+ if (matched) {
642
656
  scores[cat] += 0.1;
643
657
  if (!evidence.some((e) => e.includes(`"${kw}"`))) {
644
658
  evidence.push(`Keyword "${kw}" \u2192 ${cat}`);
@@ -677,11 +691,12 @@ function detectDomain(options) {
677
691
  }
678
692
  if (options.syllabusText) {
679
693
  const syllabusLang = detectSyllabusLanguage(options.syllabusText);
680
- const syllabusLower = options.syllabusText.toLowerCase();
681
- if (syllabusLower.includes("h\xECnh h\u1ECDc") || syllabusLower.includes("\u0111\u1EA1i s\u1ED1") || syllabusLower.includes("geometry") || syllabusLower.includes("algebra") || syllabusLower.includes("\u51E0\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("\u5E7E\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("g\xE9om\xE9trie") || syllabusLower.includes("alg\xE8bre")) {
694
+ const syllabusLower = normalizeText(options.syllabusText);
695
+ const syllabusPlain = stripDiacritics(options.syllabusText);
696
+ if (syllabusLower.includes("h\xECnh h\u1ECDc") || syllabusLower.includes("\u0111\u1EA1i s\u1ED1") || syllabusPlain.includes("hinh hoc") || syllabusPlain.includes("dai so") || syllabusLower.includes("geometry") || syllabusLower.includes("algebra") || syllabusLower.includes("\u51E0\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("\u5E7E\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("g\xE9om\xE9trie") || syllabusLower.includes("alg\xE8bre")) {
682
697
  scores.math += 0.5;
683
698
  detectedSubject = "Mathematics";
684
- } else if (syllabusLower.includes("v\u1EADt l\xFD") || syllabusLower.includes("h\xF3a") || syllabusLower.includes("sinh") || syllabusLower.includes("physics") || syllabusLower.includes("chemistry") || syllabusLower.includes("biology") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("physique") || syllabusLower.includes("chimie")) {
699
+ } else if (syllabusLower.includes("v\u1EADt l\xFD") || syllabusLower.includes("h\xF3a") || syllabusPlain.includes("vat ly") || syllabusPlain.includes("hoa") || syllabusLower.includes("sinh") || syllabusLower.includes("physics") || syllabusLower.includes("chemistry") || syllabusLower.includes("biology") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("physique") || syllabusLower.includes("chimie")) {
685
700
  scores.science += 0.5;
686
701
  detectedSubject = "Natural Science";
687
702
  } else if (syllabusLower.includes("ti\u1EBFng anh") || syllabusLower.includes("english") || syllabusLower.includes("grammar") || syllabusLower.includes("\u82F1\u8BED") || syllabusLower.includes("\u82F1\u8A9E") || syllabusLower.includes("anglais")) {
@@ -862,6 +877,7 @@ function detectDomainProfile(options) {
862
877
  learningMode: modeResult.confidence
863
878
  },
864
879
  evidence: [...inputResult.evidence, ...domainResult.evidence, ...modeResult.evidence],
880
+ ambiguous: domainResult.ambiguous,
865
881
  detectedTechStack: domainResult.detectedTechStack,
866
882
  detectedSubject: options.parsedSyllabus?.subject.title || domainResult.detectedSubject,
867
883
  detectedDomain: domainResult.domainCategory,