@thanh01.pmt/domain-kit 0.1.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 +1101 -0
- package/dist/assembly/index.cjs +213 -0
- package/dist/assembly/index.cjs.map +1 -0
- package/dist/assembly/index.d.cts +66 -0
- package/dist/assembly/index.d.ts +66 -0
- package/dist/assembly/index.mjs +4 -0
- package/dist/assembly/index.mjs.map +1 -0
- package/dist/chunk-3H2HX7PR.mjs +324 -0
- package/dist/chunk-3H2HX7PR.mjs.map +1 -0
- package/dist/chunk-3VVPSRAM.mjs +1297 -0
- package/dist/chunk-3VVPSRAM.mjs.map +1 -0
- package/dist/chunk-DRVOV5ZD.mjs +314 -0
- package/dist/chunk-DRVOV5ZD.mjs.map +1 -0
- package/dist/chunk-F4RZNBOE.mjs +3 -0
- package/dist/chunk-F4RZNBOE.mjs.map +1 -0
- package/dist/chunk-GEUDHZE7.mjs +446 -0
- package/dist/chunk-GEUDHZE7.mjs.map +1 -0
- package/dist/chunk-HH4UX65C.mjs +100 -0
- package/dist/chunk-HH4UX65C.mjs.map +1 -0
- package/dist/chunk-KMYENICQ.mjs +3 -0
- package/dist/chunk-KMYENICQ.mjs.map +1 -0
- package/dist/chunk-KNDBODUQ.mjs +153 -0
- package/dist/chunk-KNDBODUQ.mjs.map +1 -0
- package/dist/chunk-MM2RWYNW.mjs +3 -0
- package/dist/chunk-MM2RWYNW.mjs.map +1 -0
- package/dist/chunk-MOKNFLUD.mjs +851 -0
- package/dist/chunk-MOKNFLUD.mjs.map +1 -0
- package/dist/chunk-ONQHJ4OH.mjs +211 -0
- package/dist/chunk-ONQHJ4OH.mjs.map +1 -0
- package/dist/chunk-PM42MMDJ.mjs +516 -0
- package/dist/chunk-PM42MMDJ.mjs.map +1 -0
- package/dist/chunk-RKRNOVKO.mjs +166 -0
- package/dist/chunk-RKRNOVKO.mjs.map +1 -0
- package/dist/chunk-VFART56O.mjs +884 -0
- package/dist/chunk-VFART56O.mjs.map +1 -0
- package/dist/chunk-XMHKWHVK.mjs +218 -0
- package/dist/chunk-XMHKWHVK.mjs.map +1 -0
- package/dist/conceptEscalator-YfMKIKCZ.d.ts +40 -0
- package/dist/conceptEscalator-ltRLtPhf.d.cts +40 -0
- package/dist/concepts/index.cjs +155 -0
- package/dist/concepts/index.cjs.map +1 -0
- package/dist/concepts/index.d.cts +79 -0
- package/dist/concepts/index.d.ts +79 -0
- package/dist/concepts/index.mjs +4 -0
- package/dist/concepts/index.mjs.map +1 -0
- package/dist/curriculumFeedSchema-TEeQg2bY.d.cts +549 -0
- package/dist/curriculumFeedSchema-TEeQg2bY.d.ts +549 -0
- package/dist/detector/index.cjs +889 -0
- package/dist/detector/index.cjs.map +1 -0
- package/dist/detector/index.d.cts +112 -0
- package/dist/detector/index.d.ts +112 -0
- package/dist/detector/index.mjs +3 -0
- package/dist/detector/index.mjs.map +1 -0
- package/dist/domainProfileSchema-CwT3Ffsw.d.cts +105 -0
- package/dist/domainProfileSchema-CwT3Ffsw.d.ts +105 -0
- package/dist/extractors/index.cjs +387 -0
- package/dist/extractors/index.cjs.map +1 -0
- package/dist/extractors/index.d.cts +46 -0
- package/dist/extractors/index.d.ts +46 -0
- package/dist/extractors/index.mjs +4 -0
- package/dist/extractors/index.mjs.map +1 -0
- package/dist/feed/index.cjs +421 -0
- package/dist/feed/index.cjs.map +1 -0
- package/dist/feed/index.d.cts +23 -0
- package/dist/feed/index.d.ts +23 -0
- package/dist/feed/index.mjs +4 -0
- package/dist/feed/index.mjs.map +1 -0
- package/dist/graph/index.cjs +2167 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +226 -0
- package/dist/graph/index.d.ts +226 -0
- package/dist/graph/index.mjs +4 -0
- package/dist/graph/index.mjs.map +1 -0
- package/dist/graphVerifier-DsTP9uAN.d.ts +37 -0
- package/dist/graphVerifier-QjgDAJce.d.cts +37 -0
- package/dist/hybridGraphSchema-BCgXicgA.d.cts +2840 -0
- package/dist/hybridGraphSchema-BCgXicgA.d.ts +2840 -0
- package/dist/index.cjs +5539 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -0
- package/dist/keywordExtractor-CKaXqSku.d.ts +34 -0
- package/dist/keywordExtractor-zPAz2isq.d.cts +34 -0
- package/dist/llmClient-ysPhLjcH.d.cts +16 -0
- package/dist/llmClient-ysPhLjcH.d.ts +16 -0
- package/dist/parsers/index.cjs +323 -0
- package/dist/parsers/index.cjs.map +1 -0
- package/dist/parsers/index.d.cts +98 -0
- package/dist/parsers/index.d.ts +98 -0
- package/dist/parsers/index.mjs +4 -0
- package/dist/parsers/index.mjs.map +1 -0
- package/dist/pipeline/index.cjs +2166 -0
- package/dist/pipeline/index.cjs.map +1 -0
- package/dist/pipeline/index.d.cts +45 -0
- package/dist/pipeline/index.d.ts +45 -0
- package/dist/pipeline/index.mjs +8 -0
- package/dist/pipeline/index.mjs.map +1 -0
- package/dist/projectGraphSchema-DnD7orZV.d.cts +2581 -0
- package/dist/projectGraphSchema-DnD7orZV.d.ts +2581 -0
- package/dist/schemas/index.cjs +675 -0
- package/dist/schemas/index.cjs.map +1 -0
- package/dist/schemas/index.d.cts +253 -0
- package/dist/schemas/index.d.ts +253 -0
- package/dist/schemas/index.mjs +4 -0
- package/dist/schemas/index.mjs.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.cjs';
|
|
2
|
+
import { d as Feature, c as Step, u as ProjectGraph } from '../projectGraphSchema-DnD7orZV.cjs';
|
|
3
|
+
import { K as Keyword } from '../keywordExtractor-zPAz2isq.cjs';
|
|
4
|
+
export { H as Hallucination, V as VerifyOptions, v as verifyProjectGraph } from '../graphVerifier-QjgDAJce.cjs';
|
|
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
|
+
import 'zod';
|
|
8
|
+
import '../parsers/index.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* STEP C0: Extract FOUNDATION & SETUP feature (F0) via LLM.
|
|
12
|
+
*
|
|
13
|
+
* Ported from knowledge-tree/llm_project_graph.py extract_scaffold_llm()
|
|
14
|
+
* The F0 feature covers MUST-KNOW steps before the first feature:
|
|
15
|
+
* tools, project creation, minimal programming knowledge, repo map, dev loop.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface ExtractScaffoldOptions {
|
|
19
|
+
goal: string;
|
|
20
|
+
techStack: string;
|
|
21
|
+
fileList: string[];
|
|
22
|
+
llmConfig?: LlmClientConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extract the FOUNDATION & SETUP feature (F0) via LLM.
|
|
26
|
+
* Returns a Feature with steps covering tool setup, project creation,
|
|
27
|
+
* minimal programming knowledge, repo map, and dev loop.
|
|
28
|
+
*/
|
|
29
|
+
declare function extractScaffold(options: ExtractScaffoldOptions): Promise<Feature | null>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* STEP C1: Extract PROJECT OVERVIEW via LLM (features meta — NO steps).
|
|
33
|
+
*
|
|
34
|
+
* Ported from knowledge-tree/llm_project_graph.py extract_project_overview_llm()
|
|
35
|
+
* Output: project, product, features[], user_journeys, architecture, decomposition.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface ExtractOverviewOptions {
|
|
39
|
+
goal: string;
|
|
40
|
+
techStack: string;
|
|
41
|
+
sdkApiIndex: {
|
|
42
|
+
sdk_apis: Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
used_in_demo: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
fileContentsMap: Map<string, string>;
|
|
49
|
+
astKeywords?: Keyword[];
|
|
50
|
+
llmConfig?: LlmClientConfig;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Extract project overview (features meta) via LLM.
|
|
54
|
+
* Does NOT include steps — those are extracted per-feature in STEP C2.
|
|
55
|
+
*/
|
|
56
|
+
declare function extractProjectOverview(options: ExtractOverviewOptions): Promise<Record<string, unknown>>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* STEP C2: Extract feature STEPS via LLM.
|
|
60
|
+
*
|
|
61
|
+
* Ported from knowledge-tree/llm_project_graph.py
|
|
62
|
+
* - extract_feature_steps_llm() — single feature
|
|
63
|
+
* - extract_feature_steps_batched() — batch of features
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
interface ExtractStepsOptions {
|
|
67
|
+
goal: string;
|
|
68
|
+
techStack: string;
|
|
69
|
+
sdkApiIndex: {
|
|
70
|
+
sdk_apis: Array<{
|
|
71
|
+
name: string;
|
|
72
|
+
kind: string;
|
|
73
|
+
used_in_demo: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
fileContentsMap: Map<string, string>;
|
|
77
|
+
feature: Feature;
|
|
78
|
+
llmConfig?: LlmClientConfig;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract steps for a SINGLE feature via LLM.
|
|
82
|
+
*/
|
|
83
|
+
declare function extractFeatureSteps(options: ExtractStepsOptions): Promise<Step[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Extract steps for MULTIPLE features in a single LLM call.
|
|
86
|
+
*/
|
|
87
|
+
declare function extractFeatureStepsBatched(goal: string, techStack: string, sdkApiIndex: {
|
|
88
|
+
sdk_apis: Array<{
|
|
89
|
+
name: string;
|
|
90
|
+
kind: string;
|
|
91
|
+
used_in_demo: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
}, fileContentsMap: Map<string, string>, featuresMeta: Feature[], llmConfig?: LlmClientConfig): Promise<Map<string, Step[]>>;
|
|
94
|
+
|
|
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
|
+
interface DepthLayerAudit {
|
|
133
|
+
conceptId: string;
|
|
134
|
+
uloHasTechSignals: boolean;
|
|
135
|
+
uloTechSignals: string[];
|
|
136
|
+
uloHasImplementationVerbs: boolean;
|
|
137
|
+
sioAllKeywordBound: boolean;
|
|
138
|
+
sioUnboundItems: string[];
|
|
139
|
+
sioConceptKeywordBound: boolean;
|
|
140
|
+
sioOffConceptItems: string[];
|
|
141
|
+
sioAllCompletable: boolean;
|
|
142
|
+
sioNotCompletable: string[];
|
|
143
|
+
concretenessIncreases: boolean;
|
|
144
|
+
clauseOk: boolean;
|
|
145
|
+
codesOk: boolean;
|
|
146
|
+
codeIssues: string[];
|
|
147
|
+
passed: boolean;
|
|
148
|
+
}
|
|
149
|
+
declare function auditDepthLayers(concepts: Array<{
|
|
150
|
+
id: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
ulo?: string;
|
|
153
|
+
cio?: string;
|
|
154
|
+
sio?: string[];
|
|
155
|
+
code?: string;
|
|
156
|
+
ulo_code?: string;
|
|
157
|
+
cio_code?: string;
|
|
158
|
+
sio_codes?: string[];
|
|
159
|
+
keywords?: string[];
|
|
160
|
+
}>): DepthLayerAudit[];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* LO code + statement standard — calibrated against the production
|
|
164
|
+
* learning_objectives table (6,693 live rows) and the knowledge-tree
|
|
165
|
+
* Naming Conventions v2.2 (Appendix C of adaptive-learning-platform.md).
|
|
166
|
+
*
|
|
167
|
+
* Codes (deterministic, never LLM-generated):
|
|
168
|
+
* concept CONCEPT_CODE UPPER_SNAKE_CASE, technology-neutral
|
|
169
|
+
* ULO ULO-[CONCEPT]-NN one primary ULO per concept (NN = 01)
|
|
170
|
+
* CIO CIO-[CONCEPT]-NN-[ACTION] parent = ULO, ACTION = SNAKE verb phrase
|
|
171
|
+
* SIO SIO-[TECH]-[CONCEPT]-NN only tier carrying a tech tag (PY, SW, TS...)
|
|
172
|
+
*
|
|
173
|
+
* Statements: every LO description uses the normalized clause
|
|
174
|
+
* "The learner will be able to ..." (production Supabase style).
|
|
175
|
+
*/
|
|
176
|
+
/** Map a tech stack string to the production SIO tech tag (PY, SW, TS...). */
|
|
177
|
+
declare function techTagFor(techStack: string): string;
|
|
178
|
+
/** Derive a neutral UPPER_SNAKE_CASE concept code from a human concept name. */
|
|
179
|
+
declare function conceptCodeFromName(name: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* Assign unique concept codes to every concept (first occurrence keeps the
|
|
182
|
+
* plain code, later collisions get a _2.._N suffix) — mirrors the DB where
|
|
183
|
+
* concept_codes are unique neutral UPPER_SNAKE keys.
|
|
184
|
+
*/
|
|
185
|
+
declare function assignConceptCodes(concepts: Array<{
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
}>): Record<string, string>;
|
|
189
|
+
declare function uloCode(conceptCode: string, seq?: number): string;
|
|
190
|
+
/** Extract a short SNAKE_CASE action phrase (2-4 content words) for a CIO code. */
|
|
191
|
+
declare function cioActionSlug(cioText: string): string;
|
|
192
|
+
declare function cioCode(conceptCode: string, uloSeq: number, actionSlug: string): string;
|
|
193
|
+
declare function sioCode(techTag: string, conceptCode: string, seq: number): string;
|
|
194
|
+
declare const LEARNER_CLAUSE = "The learner will be able to ";
|
|
195
|
+
/** Normalize any LO text into the production statement form with the standard clause. */
|
|
196
|
+
declare function standardStatement(text: string): string;
|
|
197
|
+
declare const CONCEPT_CODE_RE: RegExp;
|
|
198
|
+
declare const ULO_CODE_RE: RegExp;
|
|
199
|
+
declare const CIO_CODE_RE: RegExp;
|
|
200
|
+
declare const SIO_CODE_RE: RegExp;
|
|
201
|
+
|
|
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 };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { L as LlmClientConfig } from '../llmClient-ysPhLjcH.js';
|
|
2
|
+
import { d as Feature, c as Step, u as ProjectGraph } from '../projectGraphSchema-DnD7orZV.js';
|
|
3
|
+
import { K as Keyword } from '../keywordExtractor-CKaXqSku.js';
|
|
4
|
+
export { H as Hallucination, V as VerifyOptions, v as verifyProjectGraph } from '../graphVerifier-DsTP9uAN.js';
|
|
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
|
+
import 'zod';
|
|
8
|
+
import '../parsers/index.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* STEP C0: Extract FOUNDATION & SETUP feature (F0) via LLM.
|
|
12
|
+
*
|
|
13
|
+
* Ported from knowledge-tree/llm_project_graph.py extract_scaffold_llm()
|
|
14
|
+
* The F0 feature covers MUST-KNOW steps before the first feature:
|
|
15
|
+
* tools, project creation, minimal programming knowledge, repo map, dev loop.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface ExtractScaffoldOptions {
|
|
19
|
+
goal: string;
|
|
20
|
+
techStack: string;
|
|
21
|
+
fileList: string[];
|
|
22
|
+
llmConfig?: LlmClientConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extract the FOUNDATION & SETUP feature (F0) via LLM.
|
|
26
|
+
* Returns a Feature with steps covering tool setup, project creation,
|
|
27
|
+
* minimal programming knowledge, repo map, and dev loop.
|
|
28
|
+
*/
|
|
29
|
+
declare function extractScaffold(options: ExtractScaffoldOptions): Promise<Feature | null>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* STEP C1: Extract PROJECT OVERVIEW via LLM (features meta — NO steps).
|
|
33
|
+
*
|
|
34
|
+
* Ported from knowledge-tree/llm_project_graph.py extract_project_overview_llm()
|
|
35
|
+
* Output: project, product, features[], user_journeys, architecture, decomposition.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface ExtractOverviewOptions {
|
|
39
|
+
goal: string;
|
|
40
|
+
techStack: string;
|
|
41
|
+
sdkApiIndex: {
|
|
42
|
+
sdk_apis: Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
used_in_demo: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
fileContentsMap: Map<string, string>;
|
|
49
|
+
astKeywords?: Keyword[];
|
|
50
|
+
llmConfig?: LlmClientConfig;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Extract project overview (features meta) via LLM.
|
|
54
|
+
* Does NOT include steps — those are extracted per-feature in STEP C2.
|
|
55
|
+
*/
|
|
56
|
+
declare function extractProjectOverview(options: ExtractOverviewOptions): Promise<Record<string, unknown>>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* STEP C2: Extract feature STEPS via LLM.
|
|
60
|
+
*
|
|
61
|
+
* Ported from knowledge-tree/llm_project_graph.py
|
|
62
|
+
* - extract_feature_steps_llm() — single feature
|
|
63
|
+
* - extract_feature_steps_batched() — batch of features
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
interface ExtractStepsOptions {
|
|
67
|
+
goal: string;
|
|
68
|
+
techStack: string;
|
|
69
|
+
sdkApiIndex: {
|
|
70
|
+
sdk_apis: Array<{
|
|
71
|
+
name: string;
|
|
72
|
+
kind: string;
|
|
73
|
+
used_in_demo: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
fileContentsMap: Map<string, string>;
|
|
77
|
+
feature: Feature;
|
|
78
|
+
llmConfig?: LlmClientConfig;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract steps for a SINGLE feature via LLM.
|
|
82
|
+
*/
|
|
83
|
+
declare function extractFeatureSteps(options: ExtractStepsOptions): Promise<Step[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Extract steps for MULTIPLE features in a single LLM call.
|
|
86
|
+
*/
|
|
87
|
+
declare function extractFeatureStepsBatched(goal: string, techStack: string, sdkApiIndex: {
|
|
88
|
+
sdk_apis: Array<{
|
|
89
|
+
name: string;
|
|
90
|
+
kind: string;
|
|
91
|
+
used_in_demo: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
}, fileContentsMap: Map<string, string>, featuresMeta: Feature[], llmConfig?: LlmClientConfig): Promise<Map<string, Step[]>>;
|
|
94
|
+
|
|
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
|
+
interface DepthLayerAudit {
|
|
133
|
+
conceptId: string;
|
|
134
|
+
uloHasTechSignals: boolean;
|
|
135
|
+
uloTechSignals: string[];
|
|
136
|
+
uloHasImplementationVerbs: boolean;
|
|
137
|
+
sioAllKeywordBound: boolean;
|
|
138
|
+
sioUnboundItems: string[];
|
|
139
|
+
sioConceptKeywordBound: boolean;
|
|
140
|
+
sioOffConceptItems: string[];
|
|
141
|
+
sioAllCompletable: boolean;
|
|
142
|
+
sioNotCompletable: string[];
|
|
143
|
+
concretenessIncreases: boolean;
|
|
144
|
+
clauseOk: boolean;
|
|
145
|
+
codesOk: boolean;
|
|
146
|
+
codeIssues: string[];
|
|
147
|
+
passed: boolean;
|
|
148
|
+
}
|
|
149
|
+
declare function auditDepthLayers(concepts: Array<{
|
|
150
|
+
id: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
ulo?: string;
|
|
153
|
+
cio?: string;
|
|
154
|
+
sio?: string[];
|
|
155
|
+
code?: string;
|
|
156
|
+
ulo_code?: string;
|
|
157
|
+
cio_code?: string;
|
|
158
|
+
sio_codes?: string[];
|
|
159
|
+
keywords?: string[];
|
|
160
|
+
}>): DepthLayerAudit[];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* LO code + statement standard — calibrated against the production
|
|
164
|
+
* learning_objectives table (6,693 live rows) and the knowledge-tree
|
|
165
|
+
* Naming Conventions v2.2 (Appendix C of adaptive-learning-platform.md).
|
|
166
|
+
*
|
|
167
|
+
* Codes (deterministic, never LLM-generated):
|
|
168
|
+
* concept CONCEPT_CODE UPPER_SNAKE_CASE, technology-neutral
|
|
169
|
+
* ULO ULO-[CONCEPT]-NN one primary ULO per concept (NN = 01)
|
|
170
|
+
* CIO CIO-[CONCEPT]-NN-[ACTION] parent = ULO, ACTION = SNAKE verb phrase
|
|
171
|
+
* SIO SIO-[TECH]-[CONCEPT]-NN only tier carrying a tech tag (PY, SW, TS...)
|
|
172
|
+
*
|
|
173
|
+
* Statements: every LO description uses the normalized clause
|
|
174
|
+
* "The learner will be able to ..." (production Supabase style).
|
|
175
|
+
*/
|
|
176
|
+
/** Map a tech stack string to the production SIO tech tag (PY, SW, TS...). */
|
|
177
|
+
declare function techTagFor(techStack: string): string;
|
|
178
|
+
/** Derive a neutral UPPER_SNAKE_CASE concept code from a human concept name. */
|
|
179
|
+
declare function conceptCodeFromName(name: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* Assign unique concept codes to every concept (first occurrence keeps the
|
|
182
|
+
* plain code, later collisions get a _2.._N suffix) — mirrors the DB where
|
|
183
|
+
* concept_codes are unique neutral UPPER_SNAKE keys.
|
|
184
|
+
*/
|
|
185
|
+
declare function assignConceptCodes(concepts: Array<{
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
}>): Record<string, string>;
|
|
189
|
+
declare function uloCode(conceptCode: string, seq?: number): string;
|
|
190
|
+
/** Extract a short SNAKE_CASE action phrase (2-4 content words) for a CIO code. */
|
|
191
|
+
declare function cioActionSlug(cioText: string): string;
|
|
192
|
+
declare function cioCode(conceptCode: string, uloSeq: number, actionSlug: string): string;
|
|
193
|
+
declare function sioCode(techTag: string, conceptCode: string, seq: number): string;
|
|
194
|
+
declare const LEARNER_CLAUSE = "The learner will be able to ";
|
|
195
|
+
/** Normalize any LO text into the production statement form with the standard clause. */
|
|
196
|
+
declare function standardStatement(text: string): string;
|
|
197
|
+
declare const CONCEPT_CODE_RE: RegExp;
|
|
198
|
+
declare const ULO_CODE_RE: RegExp;
|
|
199
|
+
declare const CIO_CODE_RE: RegExp;
|
|
200
|
+
declare const SIO_CODE_RE: RegExp;
|
|
201
|
+
|
|
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 };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, cioActionSlug, cioCode, conceptCodeFromName, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode } from '../chunk-3VVPSRAM.mjs';
|
|
2
|
+
export { escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, verifyProjectGraph } from '../chunk-MOKNFLUD.mjs';
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { u as ProjectGraph } from './projectGraphSchema-DnD7orZV.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* STEP D: Ground-truth verification of project graph against code and SDK API index.
|
|
5
|
+
*
|
|
6
|
+
* Ported from knowledge-tree/llm_project_graph.py verify_project_graph()
|
|
7
|
+
* Removes invalid files, APIs, keywords and logs hallucinations.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface Hallucination {
|
|
11
|
+
type: string;
|
|
12
|
+
item: string;
|
|
13
|
+
feature_id: string;
|
|
14
|
+
step_id: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
interface VerifyOptions {
|
|
18
|
+
repoDir: string;
|
|
19
|
+
sdkApiIndex: {
|
|
20
|
+
sdk_apis: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
used_in_demo: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
fileContentsMap: Map<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Verify project graph against actual code. Remove hallucinated files, APIs, keywords.
|
|
30
|
+
* F0 (foundation) keywords are kept as-is since they are pedagogical terms.
|
|
31
|
+
*/
|
|
32
|
+
declare function verifyProjectGraph(projectGraph: ProjectGraph, options: VerifyOptions): {
|
|
33
|
+
graph: ProjectGraph;
|
|
34
|
+
hallucinations: Hallucination[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { type Hallucination as H, type VerifyOptions as V, verifyProjectGraph as v };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { u as ProjectGraph } from './projectGraphSchema-DnD7orZV.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* STEP D: Ground-truth verification of project graph against code and SDK API index.
|
|
5
|
+
*
|
|
6
|
+
* Ported from knowledge-tree/llm_project_graph.py verify_project_graph()
|
|
7
|
+
* Removes invalid files, APIs, keywords and logs hallucinations.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface Hallucination {
|
|
11
|
+
type: string;
|
|
12
|
+
item: string;
|
|
13
|
+
feature_id: string;
|
|
14
|
+
step_id: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
interface VerifyOptions {
|
|
18
|
+
repoDir: string;
|
|
19
|
+
sdkApiIndex: {
|
|
20
|
+
sdk_apis: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
used_in_demo: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
fileContentsMap: Map<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Verify project graph against actual code. Remove hallucinated files, APIs, keywords.
|
|
30
|
+
* F0 (foundation) keywords are kept as-is since they are pedagogical terms.
|
|
31
|
+
*/
|
|
32
|
+
declare function verifyProjectGraph(projectGraph: ProjectGraph, options: VerifyOptions): {
|
|
33
|
+
graph: ProjectGraph;
|
|
34
|
+
hallucinations: Hallucination[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { type Hallucination as H, type VerifyOptions as V, verifyProjectGraph as v };
|