@thanh01.pmt/domain-kit 0.1.0 → 0.2.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/LICENSE +21 -0
- package/dist/chunk-7XGWW6CB.mjs +3 -0
- package/dist/{chunk-F4RZNBOE.mjs.map → chunk-7XGWW6CB.mjs.map} +1 -1
- package/dist/{chunk-VFART56O.mjs → chunk-BL5NBKPH.mjs} +12 -8
- package/dist/chunk-BL5NBKPH.mjs.map +1 -0
- package/dist/chunk-IJZUV7N3.mjs +3 -0
- package/dist/chunk-IJZUV7N3.mjs.map +1 -0
- package/dist/{chunk-3VVPSRAM.mjs → chunk-JE57VFWX.mjs} +1056 -92
- package/dist/chunk-JE57VFWX.mjs.map +1 -0
- package/dist/{chunk-GEUDHZE7.mjs → chunk-KPZKPNOJ.mjs} +173 -4
- package/dist/chunk-KPZKPNOJ.mjs.map +1 -0
- package/dist/chunk-R57WTNXW.mjs +3 -0
- package/dist/chunk-R57WTNXW.mjs.map +1 -0
- package/dist/{chunk-3H2HX7PR.mjs → chunk-RAR5MUUK.mjs} +57 -7
- package/dist/chunk-RAR5MUUK.mjs.map +1 -0
- package/dist/chunk-T4Y2DE2W.mjs +187 -0
- package/dist/chunk-T4Y2DE2W.mjs.map +1 -0
- package/dist/{chunk-PM42MMDJ.mjs → chunk-WHBAGJWN.mjs} +48 -3
- package/dist/chunk-WHBAGJWN.mjs.map +1 -0
- package/dist/chunk-ZKLT27T4.mjs +3 -0
- package/dist/chunk-ZKLT27T4.mjs.map +1 -0
- package/dist/concepts/index.d.cts +2 -2
- package/dist/concepts/index.d.ts +2 -2
- package/dist/cpp-CZUPqJt9.d.cts +98 -0
- package/dist/cpp-CZUPqJt9.d.ts +98 -0
- package/dist/curriculumFeedEmitter-UG664SWY.mjs +4 -0
- package/dist/curriculumFeedEmitter-UG664SWY.mjs.map +1 -0
- package/dist/detector/index.cjs +10 -6
- package/dist/detector/index.cjs.map +1 -1
- package/dist/detector/index.d.cts +4 -19
- package/dist/detector/index.d.ts +4 -19
- package/dist/detector/index.mjs +2 -1
- package/dist/domainProfileDetector-DHb1T0zB.d.ts +22 -0
- package/dist/domainProfileDetector-bzugdQmS.d.cts +22 -0
- package/dist/extractors/index.d.cts +3 -3
- package/dist/extractors/index.d.ts +3 -3
- package/dist/feed/index.cjs +55 -5
- package/dist/feed/index.cjs.map +1 -1
- package/dist/feed/index.mjs +2 -1
- package/dist/graph/index.cjs +368 -64
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +7 -67
- package/dist/graph/index.d.ts +7 -67
- package/dist/graph/index.mjs +3 -2
- package/dist/hybridGraphPipeline-DVZYLCAQ.d.ts +159 -0
- package/dist/hybridGraphPipeline-DmWRKYXf.d.cts +159 -0
- package/dist/index.cjs +1300 -697
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.mjs +10 -7
- package/dist/{keywordExtractor-zPAz2isq.d.cts → keywordExtractor-BxlGRMHC.d.cts} +1 -1
- package/dist/{keywordExtractor-CKaXqSku.d.ts → keywordExtractor-DU5XRN8-.d.ts} +1 -1
- package/dist/parsers/index.cjs +185 -0
- package/dist/parsers/index.cjs.map +1 -1
- package/dist/parsers/index.d.cts +2 -98
- package/dist/parsers/index.d.ts +2 -98
- package/dist/parsers/index.mjs +2 -1
- package/dist/pipeline/index.cjs +3140 -6
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +87 -4
- package/dist/pipeline/index.d.ts +87 -4
- package/dist/pipeline/index.mjs +6 -2
- package/dist/schemas/index.cjs +51 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +222 -3
- package/dist/schemas/index.d.ts +222 -3
- package/dist/schemas/index.mjs +1 -1
- package/dist/syllabusParser-MSX1fEzW.d.cts +40 -0
- package/dist/syllabusParser-MSX1fEzW.d.ts +40 -0
- package/package.json +9 -10
- package/dist/chunk-3H2HX7PR.mjs.map +0 -1
- package/dist/chunk-3VVPSRAM.mjs.map +0 -1
- package/dist/chunk-F4RZNBOE.mjs +0 -3
- package/dist/chunk-GEUDHZE7.mjs.map +0 -1
- package/dist/chunk-MOKNFLUD.mjs +0 -851
- package/dist/chunk-MOKNFLUD.mjs.map +0 -1
- package/dist/chunk-PM42MMDJ.mjs.map +0 -1
- package/dist/chunk-VFART56O.mjs.map +0 -1
- package/dist/graphVerifier-DsTP9uAN.d.ts +0 -37
- package/dist/graphVerifier-QjgDAJce.d.cts +0 -37
package/dist/graph/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.cjs';
|
|
2
|
-
import { d as Feature, c as Step
|
|
3
|
-
import { K as Keyword } from '../keywordExtractor-
|
|
4
|
-
export { H as Hallucination, V as VerifyOptions, v as verifyProjectGraph } from '../
|
|
2
|
+
import { d as Feature, c as Step } from '../projectGraphSchema-DnD7orZV.cjs';
|
|
3
|
+
import { K as Keyword } from '../keywordExtractor-BxlGRMHC.cjs';
|
|
4
|
+
export { H as Hallucination, i as HybridGraphPipelineOptions, j as HybridGraphPipelineResult, K as KnowledgeGraphPipelineOptions, a as KnowledgeGraphPipelineResult, f as KnowledgeGraphVerificationReport, V as VerifyOptions, e as auditSyllabusCoverage, c as breakPrerequisiteCycles, d as detectPrerequisiteCycles, h as generateHybridGraph, g as generateKnowledgeGraph, b as verifyKnowledgeGraph, v as verifyProjectGraph } from '../hybridGraphPipeline-DmWRKYXf.cjs';
|
|
5
5
|
export { C as ConceptMapping, E as EscalateOptions, e as escalateAndMapConcepts } from '../conceptEscalator-ltRLtPhf.cjs';
|
|
6
|
-
import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-BCgXicgA.cjs';
|
|
7
6
|
import 'zod';
|
|
8
|
-
import '../
|
|
7
|
+
import '../cpp-CZUPqJt9.cjs';
|
|
8
|
+
import '../hybridGraphSchema-BCgXicgA.cjs';
|
|
9
|
+
import '../syllabusParser-MSX1fEzW.cjs';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* STEP C0: Extract FOUNDATION & SETUP feature (F0) via LLM.
|
|
@@ -92,43 +93,6 @@ declare function extractFeatureStepsBatched(goal: string, techStack: string, sdk
|
|
|
92
93
|
}>;
|
|
93
94
|
}, fileContentsMap: Map<string, string>, featuresMeta: Feature[], llmConfig?: LlmClientConfig): Promise<Map<string, Step[]>>;
|
|
94
95
|
|
|
95
|
-
/**
|
|
96
|
-
* Knowledge Graph Pipeline — generates knowledge_graph for concept-driven learning.
|
|
97
|
-
*
|
|
98
|
-
* Input: syllabus text, subject description, grade band
|
|
99
|
-
* Output: KnowledgeGraph with concepts, problem_types, prerequisites, learning_path
|
|
100
|
-
*
|
|
101
|
-
* Includes:
|
|
102
|
-
* - Cycle detection in prerequisite chains
|
|
103
|
-
* - Topological sort for learning_path
|
|
104
|
-
* - Multi-language syllabus support
|
|
105
|
-
* - ULO/CIO/SIO depth control per concept
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
interface KnowledgeGraphPipelineOptions {
|
|
109
|
-
subject: string;
|
|
110
|
-
description?: string;
|
|
111
|
-
syllabusText?: string;
|
|
112
|
-
gradeBand?: [number, number];
|
|
113
|
-
domain?: string;
|
|
114
|
-
/** Target technology for SIO keyword binding (e.g. "python", "swift"); auto-detected fallback applies. */
|
|
115
|
-
techStack?: string;
|
|
116
|
-
llmConfig?: LlmClientConfig;
|
|
117
|
-
onProgress?: (step: string, message: string) => void;
|
|
118
|
-
/** Path to mlo-knowlege-tree.tsv. When provided, STEP_2_5 standardizes every concept against the tree (fail-closed). */
|
|
119
|
-
knowledgeTreePath?: string;
|
|
120
|
-
/** Where to persist proposed-new concepts for the later merge. Default: tmpdir/domain-kit-debug/concept-proposals.json */
|
|
121
|
-
proposalsPath?: string;
|
|
122
|
-
}
|
|
123
|
-
interface KnowledgeGraphPipelineResult {
|
|
124
|
-
knowledgeGraph: KnowledgeGraph;
|
|
125
|
-
warnings: string[];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Generate a KnowledgeGraph from syllabus/description via LLM.
|
|
129
|
-
*/
|
|
130
|
-
declare function generateKnowledgeGraph(options: KnowledgeGraphPipelineOptions): Promise<KnowledgeGraphPipelineResult>;
|
|
131
|
-
|
|
132
96
|
interface DepthLayerAudit {
|
|
133
97
|
conceptId: string;
|
|
134
98
|
uloHasTechSignals: boolean;
|
|
@@ -199,28 +163,4 @@ declare const ULO_CODE_RE: RegExp;
|
|
|
199
163
|
declare const CIO_CODE_RE: RegExp;
|
|
200
164
|
declare const SIO_CODE_RE: RegExp;
|
|
201
165
|
|
|
202
|
-
|
|
203
|
-
* Hybrid Graph Pipeline - generates hybrid_graph combining project + knowledge.
|
|
204
|
-
*
|
|
205
|
-
* STEP_1 generates feature-concept links. STEP_2 decomposes the build into
|
|
206
|
-
* PROGRESSIVE COMPLETION PHASES (cross-feature): each phase describes what the
|
|
207
|
-
* product can demonstrably do once complete, owns every feature built in it
|
|
208
|
-
* (each feature in EXACTLY one phase), and declares which concepts are
|
|
209
|
-
* introduced (new) or revisited at higher depth (advanced) at the phase start.
|
|
210
|
-
* Later phases depend on earlier ones and may only raise the knowledge level -
|
|
211
|
-
* verified against the concept prerequisite graph (fail-closed).
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
interface HybridGraphPipelineOptions {
|
|
215
|
-
projectGraph: ProjectGraph;
|
|
216
|
-
knowledgeGraph: KnowledgeGraph;
|
|
217
|
-
llmConfig?: LlmClientConfig;
|
|
218
|
-
onProgress?: (step: string, message: string) => void;
|
|
219
|
-
}
|
|
220
|
-
interface HybridGraphPipelineResult {
|
|
221
|
-
hybridGraph: HybridGraph;
|
|
222
|
-
warnings: string[];
|
|
223
|
-
}
|
|
224
|
-
declare function generateHybridGraph(options: HybridGraphPipelineOptions): Promise<HybridGraphPipelineResult>;
|
|
225
|
-
|
|
226
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, type HybridGraphPipelineOptions, type HybridGraphPipelineResult, type KnowledgeGraphPipelineOptions, type KnowledgeGraphPipelineResult, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode };
|
|
166
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode };
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.js';
|
|
2
|
-
import { d as Feature, c as Step
|
|
3
|
-
import { K as Keyword } from '../keywordExtractor-
|
|
4
|
-
export { H as Hallucination, V as VerifyOptions, v as verifyProjectGraph } from '../
|
|
2
|
+
import { d as Feature, c as Step } from '../projectGraphSchema-DnD7orZV.js';
|
|
3
|
+
import { K as Keyword } from '../keywordExtractor-DU5XRN8-.js';
|
|
4
|
+
export { H as Hallucination, i as HybridGraphPipelineOptions, j as HybridGraphPipelineResult, K as KnowledgeGraphPipelineOptions, a as KnowledgeGraphPipelineResult, f as KnowledgeGraphVerificationReport, V as VerifyOptions, e as auditSyllabusCoverage, c as breakPrerequisiteCycles, d as detectPrerequisiteCycles, h as generateHybridGraph, g as generateKnowledgeGraph, b as verifyKnowledgeGraph, v as verifyProjectGraph } from '../hybridGraphPipeline-DVZYLCAQ.js';
|
|
5
5
|
export { C as ConceptMapping, E as EscalateOptions, e as escalateAndMapConcepts } from '../conceptEscalator-YfMKIKCZ.js';
|
|
6
|
-
import { g as KnowledgeGraph, j as HybridGraph } from '../hybridGraphSchema-BCgXicgA.js';
|
|
7
6
|
import 'zod';
|
|
8
|
-
import '../
|
|
7
|
+
import '../cpp-CZUPqJt9.js';
|
|
8
|
+
import '../hybridGraphSchema-BCgXicgA.js';
|
|
9
|
+
import '../syllabusParser-MSX1fEzW.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* STEP C0: Extract FOUNDATION & SETUP feature (F0) via LLM.
|
|
@@ -92,43 +93,6 @@ declare function extractFeatureStepsBatched(goal: string, techStack: string, sdk
|
|
|
92
93
|
}>;
|
|
93
94
|
}, fileContentsMap: Map<string, string>, featuresMeta: Feature[], llmConfig?: LlmClientConfig): Promise<Map<string, Step[]>>;
|
|
94
95
|
|
|
95
|
-
/**
|
|
96
|
-
* Knowledge Graph Pipeline — generates knowledge_graph for concept-driven learning.
|
|
97
|
-
*
|
|
98
|
-
* Input: syllabus text, subject description, grade band
|
|
99
|
-
* Output: KnowledgeGraph with concepts, problem_types, prerequisites, learning_path
|
|
100
|
-
*
|
|
101
|
-
* Includes:
|
|
102
|
-
* - Cycle detection in prerequisite chains
|
|
103
|
-
* - Topological sort for learning_path
|
|
104
|
-
* - Multi-language syllabus support
|
|
105
|
-
* - ULO/CIO/SIO depth control per concept
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
interface KnowledgeGraphPipelineOptions {
|
|
109
|
-
subject: string;
|
|
110
|
-
description?: string;
|
|
111
|
-
syllabusText?: string;
|
|
112
|
-
gradeBand?: [number, number];
|
|
113
|
-
domain?: string;
|
|
114
|
-
/** Target technology for SIO keyword binding (e.g. "python", "swift"); auto-detected fallback applies. */
|
|
115
|
-
techStack?: string;
|
|
116
|
-
llmConfig?: LlmClientConfig;
|
|
117
|
-
onProgress?: (step: string, message: string) => void;
|
|
118
|
-
/** Path to mlo-knowlege-tree.tsv. When provided, STEP_2_5 standardizes every concept against the tree (fail-closed). */
|
|
119
|
-
knowledgeTreePath?: string;
|
|
120
|
-
/** Where to persist proposed-new concepts for the later merge. Default: tmpdir/domain-kit-debug/concept-proposals.json */
|
|
121
|
-
proposalsPath?: string;
|
|
122
|
-
}
|
|
123
|
-
interface KnowledgeGraphPipelineResult {
|
|
124
|
-
knowledgeGraph: KnowledgeGraph;
|
|
125
|
-
warnings: string[];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Generate a KnowledgeGraph from syllabus/description via LLM.
|
|
129
|
-
*/
|
|
130
|
-
declare function generateKnowledgeGraph(options: KnowledgeGraphPipelineOptions): Promise<KnowledgeGraphPipelineResult>;
|
|
131
|
-
|
|
132
96
|
interface DepthLayerAudit {
|
|
133
97
|
conceptId: string;
|
|
134
98
|
uloHasTechSignals: boolean;
|
|
@@ -199,28 +163,4 @@ declare const ULO_CODE_RE: RegExp;
|
|
|
199
163
|
declare const CIO_CODE_RE: RegExp;
|
|
200
164
|
declare const SIO_CODE_RE: RegExp;
|
|
201
165
|
|
|
202
|
-
|
|
203
|
-
* Hybrid Graph Pipeline - generates hybrid_graph combining project + knowledge.
|
|
204
|
-
*
|
|
205
|
-
* STEP_1 generates feature-concept links. STEP_2 decomposes the build into
|
|
206
|
-
* PROGRESSIVE COMPLETION PHASES (cross-feature): each phase describes what the
|
|
207
|
-
* product can demonstrably do once complete, owns every feature built in it
|
|
208
|
-
* (each feature in EXACTLY one phase), and declares which concepts are
|
|
209
|
-
* introduced (new) or revisited at higher depth (advanced) at the phase start.
|
|
210
|
-
* Later phases depend on earlier ones and may only raise the knowledge level -
|
|
211
|
-
* verified against the concept prerequisite graph (fail-closed).
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
interface HybridGraphPipelineOptions {
|
|
215
|
-
projectGraph: ProjectGraph;
|
|
216
|
-
knowledgeGraph: KnowledgeGraph;
|
|
217
|
-
llmConfig?: LlmClientConfig;
|
|
218
|
-
onProgress?: (step: string, message: string) => void;
|
|
219
|
-
}
|
|
220
|
-
interface HybridGraphPipelineResult {
|
|
221
|
-
hybridGraph: HybridGraph;
|
|
222
|
-
warnings: string[];
|
|
223
|
-
}
|
|
224
|
-
declare function generateHybridGraph(options: HybridGraphPipelineOptions): Promise<HybridGraphPipelineResult>;
|
|
225
|
-
|
|
226
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, type HybridGraphPipelineOptions, type HybridGraphPipelineResult, type KnowledgeGraphPipelineOptions, type KnowledgeGraphPipelineResult, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode };
|
|
166
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode };
|
package/dist/graph/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export { escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, verifyProjectGraph } from '../chunk-
|
|
1
|
+
import '../chunk-ZKLT27T4.mjs';
|
|
2
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from '../chunk-JE57VFWX.mjs';
|
|
3
|
+
import '../chunk-T4Y2DE2W.mjs';
|
|
3
4
|
//# sourceMappingURL=index.mjs.map
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { u as ProjectGraph } from './projectGraphSchema-DnD7orZV.js';
|
|
2
|
+
import { L as LlmClientConfig } from './llmClient-ysPhLjcH.js';
|
|
3
|
+
import { g as KnowledgeGraph, b as Concept, j as HybridGraph } from './hybridGraphSchema-BCgXicgA.js';
|
|
4
|
+
import { P as ParsedSyllabus } from './syllabusParser-MSX1fEzW.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* STEP D: Ground-truth verification of project graph against code and SDK API index.
|
|
8
|
+
*
|
|
9
|
+
* Ported from knowledge-tree/llm_project_graph.py verify_project_graph()
|
|
10
|
+
* Removes invalid files, APIs, keywords and logs hallucinations.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface Hallucination {
|
|
14
|
+
type: string;
|
|
15
|
+
item: string;
|
|
16
|
+
feature_id: string;
|
|
17
|
+
step_id: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
interface VerifyOptions {
|
|
21
|
+
repoDir: string;
|
|
22
|
+
sdkApiIndex: {
|
|
23
|
+
sdk_apis: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
kind: string;
|
|
26
|
+
used_in_demo: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
fileContentsMap: Map<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Verify project graph against actual code. Remove hallucinated files, APIs, keywords.
|
|
33
|
+
* F0 (foundation) keywords are kept as-is since they are pedagogical terms.
|
|
34
|
+
*/
|
|
35
|
+
declare function verifyProjectGraph(projectGraph: ProjectGraph, options: VerifyOptions): {
|
|
36
|
+
graph: ProjectGraph;
|
|
37
|
+
hallucinations: Hallucination[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Knowledge Graph Verifier — validates referential integrity, prerequisite DAG
|
|
42
|
+
* acyclicity, and reverse syllabus coverage for concept-driven graphs.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
interface KnowledgeGraphVerificationReport {
|
|
46
|
+
valid: boolean;
|
|
47
|
+
cycles: string[][];
|
|
48
|
+
removedEdges: Array<{
|
|
49
|
+
from: string;
|
|
50
|
+
to: string;
|
|
51
|
+
}>;
|
|
52
|
+
danglingPrerequisites: Array<{
|
|
53
|
+
conceptId: string;
|
|
54
|
+
missingPrereqId: string;
|
|
55
|
+
}>;
|
|
56
|
+
coverageRatio: number;
|
|
57
|
+
totalSyllabusTopics: number;
|
|
58
|
+
coveredSyllabusTopics: number;
|
|
59
|
+
uncoveredTopics: string[];
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Detect cycles in prerequisite graph using DFS.
|
|
64
|
+
*/
|
|
65
|
+
declare function detectPrerequisiteCycles(concepts: Concept[]): string[][];
|
|
66
|
+
/**
|
|
67
|
+
* Break cycles by removing back-edges.
|
|
68
|
+
*/
|
|
69
|
+
declare function breakPrerequisiteCycles(concepts: Concept[], cycles: string[][]): {
|
|
70
|
+
fixed: Concept[];
|
|
71
|
+
removed: Array<{
|
|
72
|
+
from: string;
|
|
73
|
+
to: string;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Audit reverse coverage: verify that every topic in ParsedSyllabus is mapped
|
|
78
|
+
* to at least one concept in KnowledgeGraph.
|
|
79
|
+
*/
|
|
80
|
+
declare function auditSyllabusCoverage(concepts: Concept[], syllabus?: ParsedSyllabus): {
|
|
81
|
+
coverageRatio: number;
|
|
82
|
+
totalTopics: number;
|
|
83
|
+
coveredTopics: number;
|
|
84
|
+
uncovered: string[];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Full knowledge graph verifier function.
|
|
88
|
+
*/
|
|
89
|
+
declare function verifyKnowledgeGraph(kg: KnowledgeGraph, syllabusOrOptions?: ParsedSyllabus | {
|
|
90
|
+
parsedSyllabus?: ParsedSyllabus;
|
|
91
|
+
}): {
|
|
92
|
+
verifiedGraph: KnowledgeGraph;
|
|
93
|
+
report: KnowledgeGraphVerificationReport;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Knowledge Graph Pipeline — generates knowledge_graph for concept-driven learning.
|
|
98
|
+
*
|
|
99
|
+
* Input: syllabus text, subject description, grade band
|
|
100
|
+
* Output: KnowledgeGraph with concepts, problem_types, prerequisites, learning_path
|
|
101
|
+
*
|
|
102
|
+
* Includes:
|
|
103
|
+
* - Cycle detection in prerequisite chains
|
|
104
|
+
* - Topological sort for learning_path
|
|
105
|
+
* - Multi-language syllabus support
|
|
106
|
+
* - ULO/CIO/SIO depth control per concept
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
interface KnowledgeGraphPipelineOptions {
|
|
110
|
+
subject: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
syllabusText?: string;
|
|
113
|
+
parsedSyllabus?: ParsedSyllabus;
|
|
114
|
+
gradeBand?: [number, number];
|
|
115
|
+
domain?: string;
|
|
116
|
+
/** Target technology for SIO keyword binding (e.g. "python", "swift"); auto-detected fallback applies. */
|
|
117
|
+
techStack?: string;
|
|
118
|
+
llmConfig?: LlmClientConfig;
|
|
119
|
+
onProgress?: (step: string, message: string) => void;
|
|
120
|
+
/** Path to mlo-knowlege-tree.tsv. When provided, STEP_2_5 standardizes every concept against the tree (fail-closed). */
|
|
121
|
+
knowledgeTreePath?: string;
|
|
122
|
+
/** Where to persist proposed-new concepts for the later merge. Default: tmpdir/domain-kit-debug/concept-proposals.json */
|
|
123
|
+
proposalsPath?: string;
|
|
124
|
+
}
|
|
125
|
+
interface KnowledgeGraphPipelineResult {
|
|
126
|
+
knowledgeGraph: KnowledgeGraph;
|
|
127
|
+
warnings: string[];
|
|
128
|
+
verificationReport?: KnowledgeGraphVerificationReport;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Generate a KnowledgeGraph from syllabus/description via LLM.
|
|
132
|
+
*/
|
|
133
|
+
declare function generateKnowledgeGraph(options: KnowledgeGraphPipelineOptions): Promise<KnowledgeGraphPipelineResult>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Hybrid Graph Pipeline - generates hybrid_graph combining project + knowledge.
|
|
137
|
+
*
|
|
138
|
+
* STEP_1 generates feature-concept links. STEP_2 decomposes the build into
|
|
139
|
+
* PROGRESSIVE COMPLETION PHASES (cross-feature): each phase describes what the
|
|
140
|
+
* product can demonstrably do once complete, owns every feature built in it
|
|
141
|
+
* (each feature in EXACTLY one phase), and declares which concepts are
|
|
142
|
+
* introduced (new) or revisited at higher depth (advanced) at the phase start.
|
|
143
|
+
* Later phases depend on earlier ones and may only raise the knowledge level -
|
|
144
|
+
* verified against the concept prerequisite graph (fail-closed).
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
interface HybridGraphPipelineOptions {
|
|
148
|
+
projectGraph: ProjectGraph;
|
|
149
|
+
knowledgeGraph: KnowledgeGraph;
|
|
150
|
+
llmConfig?: LlmClientConfig;
|
|
151
|
+
onProgress?: (step: string, message: string) => void;
|
|
152
|
+
}
|
|
153
|
+
interface HybridGraphPipelineResult {
|
|
154
|
+
hybridGraph: HybridGraph;
|
|
155
|
+
warnings: string[];
|
|
156
|
+
}
|
|
157
|
+
declare function generateHybridGraph(options: HybridGraphPipelineOptions): Promise<HybridGraphPipelineResult>;
|
|
158
|
+
|
|
159
|
+
export { type Hallucination as H, type KnowledgeGraphPipelineOptions as K, type VerifyOptions as V, type KnowledgeGraphPipelineResult as a, verifyKnowledgeGraph as b, breakPrerequisiteCycles as c, detectPrerequisiteCycles as d, auditSyllabusCoverage as e, type KnowledgeGraphVerificationReport as f, generateKnowledgeGraph as g, generateHybridGraph as h, type HybridGraphPipelineOptions as i, type HybridGraphPipelineResult as j, verifyProjectGraph as v };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { u as ProjectGraph } from './projectGraphSchema-DnD7orZV.cjs';
|
|
2
|
+
import { L as LlmClientConfig } from './llmClient-ysPhLjcH.cjs';
|
|
3
|
+
import { g as KnowledgeGraph, b as Concept, j as HybridGraph } from './hybridGraphSchema-BCgXicgA.cjs';
|
|
4
|
+
import { P as ParsedSyllabus } from './syllabusParser-MSX1fEzW.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* STEP D: Ground-truth verification of project graph against code and SDK API index.
|
|
8
|
+
*
|
|
9
|
+
* Ported from knowledge-tree/llm_project_graph.py verify_project_graph()
|
|
10
|
+
* Removes invalid files, APIs, keywords and logs hallucinations.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface Hallucination {
|
|
14
|
+
type: string;
|
|
15
|
+
item: string;
|
|
16
|
+
feature_id: string;
|
|
17
|
+
step_id: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
interface VerifyOptions {
|
|
21
|
+
repoDir: string;
|
|
22
|
+
sdkApiIndex: {
|
|
23
|
+
sdk_apis: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
kind: string;
|
|
26
|
+
used_in_demo: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
fileContentsMap: Map<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Verify project graph against actual code. Remove hallucinated files, APIs, keywords.
|
|
33
|
+
* F0 (foundation) keywords are kept as-is since they are pedagogical terms.
|
|
34
|
+
*/
|
|
35
|
+
declare function verifyProjectGraph(projectGraph: ProjectGraph, options: VerifyOptions): {
|
|
36
|
+
graph: ProjectGraph;
|
|
37
|
+
hallucinations: Hallucination[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Knowledge Graph Verifier — validates referential integrity, prerequisite DAG
|
|
42
|
+
* acyclicity, and reverse syllabus coverage for concept-driven graphs.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
interface KnowledgeGraphVerificationReport {
|
|
46
|
+
valid: boolean;
|
|
47
|
+
cycles: string[][];
|
|
48
|
+
removedEdges: Array<{
|
|
49
|
+
from: string;
|
|
50
|
+
to: string;
|
|
51
|
+
}>;
|
|
52
|
+
danglingPrerequisites: Array<{
|
|
53
|
+
conceptId: string;
|
|
54
|
+
missingPrereqId: string;
|
|
55
|
+
}>;
|
|
56
|
+
coverageRatio: number;
|
|
57
|
+
totalSyllabusTopics: number;
|
|
58
|
+
coveredSyllabusTopics: number;
|
|
59
|
+
uncoveredTopics: string[];
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Detect cycles in prerequisite graph using DFS.
|
|
64
|
+
*/
|
|
65
|
+
declare function detectPrerequisiteCycles(concepts: Concept[]): string[][];
|
|
66
|
+
/**
|
|
67
|
+
* Break cycles by removing back-edges.
|
|
68
|
+
*/
|
|
69
|
+
declare function breakPrerequisiteCycles(concepts: Concept[], cycles: string[][]): {
|
|
70
|
+
fixed: Concept[];
|
|
71
|
+
removed: Array<{
|
|
72
|
+
from: string;
|
|
73
|
+
to: string;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Audit reverse coverage: verify that every topic in ParsedSyllabus is mapped
|
|
78
|
+
* to at least one concept in KnowledgeGraph.
|
|
79
|
+
*/
|
|
80
|
+
declare function auditSyllabusCoverage(concepts: Concept[], syllabus?: ParsedSyllabus): {
|
|
81
|
+
coverageRatio: number;
|
|
82
|
+
totalTopics: number;
|
|
83
|
+
coveredTopics: number;
|
|
84
|
+
uncovered: string[];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Full knowledge graph verifier function.
|
|
88
|
+
*/
|
|
89
|
+
declare function verifyKnowledgeGraph(kg: KnowledgeGraph, syllabusOrOptions?: ParsedSyllabus | {
|
|
90
|
+
parsedSyllabus?: ParsedSyllabus;
|
|
91
|
+
}): {
|
|
92
|
+
verifiedGraph: KnowledgeGraph;
|
|
93
|
+
report: KnowledgeGraphVerificationReport;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Knowledge Graph Pipeline — generates knowledge_graph for concept-driven learning.
|
|
98
|
+
*
|
|
99
|
+
* Input: syllabus text, subject description, grade band
|
|
100
|
+
* Output: KnowledgeGraph with concepts, problem_types, prerequisites, learning_path
|
|
101
|
+
*
|
|
102
|
+
* Includes:
|
|
103
|
+
* - Cycle detection in prerequisite chains
|
|
104
|
+
* - Topological sort for learning_path
|
|
105
|
+
* - Multi-language syllabus support
|
|
106
|
+
* - ULO/CIO/SIO depth control per concept
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
interface KnowledgeGraphPipelineOptions {
|
|
110
|
+
subject: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
syllabusText?: string;
|
|
113
|
+
parsedSyllabus?: ParsedSyllabus;
|
|
114
|
+
gradeBand?: [number, number];
|
|
115
|
+
domain?: string;
|
|
116
|
+
/** Target technology for SIO keyword binding (e.g. "python", "swift"); auto-detected fallback applies. */
|
|
117
|
+
techStack?: string;
|
|
118
|
+
llmConfig?: LlmClientConfig;
|
|
119
|
+
onProgress?: (step: string, message: string) => void;
|
|
120
|
+
/** Path to mlo-knowlege-tree.tsv. When provided, STEP_2_5 standardizes every concept against the tree (fail-closed). */
|
|
121
|
+
knowledgeTreePath?: string;
|
|
122
|
+
/** Where to persist proposed-new concepts for the later merge. Default: tmpdir/domain-kit-debug/concept-proposals.json */
|
|
123
|
+
proposalsPath?: string;
|
|
124
|
+
}
|
|
125
|
+
interface KnowledgeGraphPipelineResult {
|
|
126
|
+
knowledgeGraph: KnowledgeGraph;
|
|
127
|
+
warnings: string[];
|
|
128
|
+
verificationReport?: KnowledgeGraphVerificationReport;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Generate a KnowledgeGraph from syllabus/description via LLM.
|
|
132
|
+
*/
|
|
133
|
+
declare function generateKnowledgeGraph(options: KnowledgeGraphPipelineOptions): Promise<KnowledgeGraphPipelineResult>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Hybrid Graph Pipeline - generates hybrid_graph combining project + knowledge.
|
|
137
|
+
*
|
|
138
|
+
* STEP_1 generates feature-concept links. STEP_2 decomposes the build into
|
|
139
|
+
* PROGRESSIVE COMPLETION PHASES (cross-feature): each phase describes what the
|
|
140
|
+
* product can demonstrably do once complete, owns every feature built in it
|
|
141
|
+
* (each feature in EXACTLY one phase), and declares which concepts are
|
|
142
|
+
* introduced (new) or revisited at higher depth (advanced) at the phase start.
|
|
143
|
+
* Later phases depend on earlier ones and may only raise the knowledge level -
|
|
144
|
+
* verified against the concept prerequisite graph (fail-closed).
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
interface HybridGraphPipelineOptions {
|
|
148
|
+
projectGraph: ProjectGraph;
|
|
149
|
+
knowledgeGraph: KnowledgeGraph;
|
|
150
|
+
llmConfig?: LlmClientConfig;
|
|
151
|
+
onProgress?: (step: string, message: string) => void;
|
|
152
|
+
}
|
|
153
|
+
interface HybridGraphPipelineResult {
|
|
154
|
+
hybridGraph: HybridGraph;
|
|
155
|
+
warnings: string[];
|
|
156
|
+
}
|
|
157
|
+
declare function generateHybridGraph(options: HybridGraphPipelineOptions): Promise<HybridGraphPipelineResult>;
|
|
158
|
+
|
|
159
|
+
export { type Hallucination as H, type KnowledgeGraphPipelineOptions as K, type VerifyOptions as V, type KnowledgeGraphPipelineResult as a, verifyKnowledgeGraph as b, breakPrerequisiteCycles as c, detectPrerequisiteCycles as d, auditSyllabusCoverage as e, type KnowledgeGraphVerificationReport as f, generateKnowledgeGraph as g, generateHybridGraph as h, type HybridGraphPipelineOptions as i, type HybridGraphPipelineResult as j, verifyProjectGraph as v };
|