@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.
- package/README.md +682 -168
- package/dist/assembly/index.d.cts +2 -2
- package/dist/assembly/index.d.ts +2 -2
- package/dist/{chunk-TYXSJUQU.mjs → chunk-2OGNQUXC.mjs} +81 -32
- package/dist/chunk-2OGNQUXC.mjs.map +1 -0
- package/dist/{chunk-G7HLFMD2.mjs → chunk-5OMSYKQP.mjs} +43 -23
- package/dist/chunk-5OMSYKQP.mjs.map +1 -0
- package/dist/{chunk-BL5NBKPH.mjs → chunk-67GXK3ZE.mjs} +18 -8
- package/dist/chunk-67GXK3ZE.mjs.map +1 -0
- package/dist/{chunk-E4GCCWJO.mjs → chunk-CGNXGVHV.mjs} +37 -4
- package/dist/chunk-CGNXGVHV.mjs.map +1 -0
- package/dist/{chunk-VCPIWJ7R.mjs → chunk-ERDTHXQA.mjs} +21 -3
- package/dist/chunk-ERDTHXQA.mjs.map +1 -0
- package/dist/chunk-OYSZQVPY.mjs +10 -0
- package/dist/chunk-OYSZQVPY.mjs.map +1 -0
- package/dist/{chunk-TWKIVUTQ.mjs → chunk-WKTH3JPA.mjs} +197 -36
- package/dist/chunk-WKTH3JPA.mjs.map +1 -0
- package/dist/{conceptEscalator-YfMKIKCZ.d.ts → conceptEscalator-BCsw0ys_.d.ts} +10 -1
- package/dist/{conceptEscalator-ltRLtPhf.d.cts → conceptEscalator-DPrs4PwC.d.cts} +10 -1
- package/dist/concepts/index.d.cts +1 -1
- package/dist/concepts/index.d.ts +1 -1
- package/dist/{curriculumFeedSchema-DUFwFyr2.d.ts → curriculumFeedSchema-DYayelAA.d.cts} +156 -1
- package/dist/{curriculumFeedSchema-DUFwFyr2.d.cts → curriculumFeedSchema-DYayelAA.d.ts} +156 -1
- package/dist/detector/index.cjs +21 -6
- package/dist/detector/index.cjs.map +1 -1
- package/dist/detector/index.mjs +2 -1
- package/dist/feed/index.cjs +229 -33
- package/dist/feed/index.cjs.map +1 -1
- package/dist/feed/index.d.cts +32 -2
- package/dist/feed/index.d.ts +32 -2
- package/dist/feed/index.mjs +2 -2
- package/dist/graph/index.cjs +73 -29
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +14 -5
- package/dist/graph/index.d.ts +14 -5
- package/dist/graph/index.mjs +2 -1
- package/dist/{hybridGraphPipeline-DXQDbBEj.d.ts → hybridGraphPipeline-9dRKJj7r.d.ts} +6 -2
- package/dist/{hybridGraphPipeline-dT-bio-3.d.cts → hybridGraphPipeline-CocfYe4d.d.cts} +6 -2
- package/dist/{hybridGraphSchema-nrUeSwpU.d.ts → hybridGraphSchema-C37qxdTM.d.cts} +16 -3
- package/dist/{hybridGraphSchema-nrUeSwpU.d.cts → hybridGraphSchema-C37qxdTM.d.ts} +16 -3
- package/dist/index.cjs +2634 -2359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -6
- package/dist/llmClient-CX5uUiQ1.d.cts +60 -0
- package/dist/llmClient-CX5uUiQ1.d.ts +60 -0
- package/dist/pipeline/index.cjs +2207 -1958
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +13 -5
- package/dist/pipeline/index.d.ts +13 -5
- package/dist/pipeline/index.mjs +6 -5
- package/dist/schemas/index.cjs +55 -2
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2 -2
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.mjs +2 -2
- package/package.json +10 -9
- package/LICENSE +0 -21
- package/dist/chunk-BL5NBKPH.mjs.map +0 -1
- package/dist/chunk-E4GCCWJO.mjs.map +0 -1
- package/dist/chunk-G7HLFMD2.mjs.map +0 -1
- package/dist/chunk-TWKIVUTQ.mjs.map +0 -1
- package/dist/chunk-TYXSJUQU.mjs.map +0 -1
- package/dist/chunk-VCPIWJ7R.mjs.map +0 -1
- package/dist/curriculumFeedEmitter-T7NUBLAM.mjs +0 -4
- package/dist/curriculumFeedEmitter-T7NUBLAM.mjs.map +0 -1
- package/dist/llmClient-ysPhLjcH.d.cts +0 -16
- package/dist/llmClient-ysPhLjcH.d.ts +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LlmClientConfig } from './llmClient-
|
|
1
|
+
import { L as LlmClientConfig, a as LlmClient } from './llmClient-CX5uUiQ1.cjs';
|
|
2
2
|
import { u as ProjectGraph } from './projectGraphSchema-DnD7orZV.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -19,6 +19,12 @@ interface ConceptMapping {
|
|
|
19
19
|
keyword: string;
|
|
20
20
|
depth: 'ulo' | 'cio' | 'sio';
|
|
21
21
|
depth_rationale: string;
|
|
22
|
+
/**
|
|
23
|
+
* Who decided `depth`. The regex fallback (comment → ulo, import → sio) has no
|
|
24
|
+
* pedagogical basis — without this marker a degraded run is indistinguishable
|
|
25
|
+
* from a considered one, because both write the same field.
|
|
26
|
+
*/
|
|
27
|
+
depth_source: 'llm' | 'heuristic' | 'override';
|
|
22
28
|
evidence_files: string[];
|
|
23
29
|
}
|
|
24
30
|
interface EscalateOptions {
|
|
@@ -31,6 +37,9 @@ interface EscalateOptions {
|
|
|
31
37
|
depth?: string;
|
|
32
38
|
}>;
|
|
33
39
|
llmConfig?: LlmClientConfig;
|
|
40
|
+
/** Pre-built client from the calling pipeline — reused so every step of one run
|
|
41
|
+
* lands in ONE callLog and the feed can report real provenance. */
|
|
42
|
+
sharedClient?: LlmClient;
|
|
34
43
|
}
|
|
35
44
|
/**
|
|
36
45
|
* Escalate keywords/api_usage to neutral concepts with ULO/CIO/SIO depth and join evidence files.
|
package/dist/concepts/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -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>;
|
|
@@ -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: {
|
|
@@ -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
|
|
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 };
|
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -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>;
|
|
@@ -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: {
|
|
@@ -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
|
|
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 };
|
package/dist/detector/index.cjs
CHANGED
|
@@ -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(" ")
|
|
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
|
-
|
|
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
|
|
681
|
-
|
|
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")) {
|