@thanh01.pmt/domain-kit 0.6.2 → 0.6.4
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/dist/{chunk-GVBDM746.mjs → chunk-6MM3MVQ5.mjs} +29 -17
- package/dist/chunk-6MM3MVQ5.mjs.map +1 -0
- package/dist/{chunk-ZHMIJEMA.mjs → chunk-NJQGIJ5A.mjs} +3 -3
- package/dist/{chunk-ZHMIJEMA.mjs.map → chunk-NJQGIJ5A.mjs.map} +1 -1
- package/dist/graph/index.cjs +27 -15
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.mjs +1 -1
- package/dist/index.cjs +27 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/pipeline/index.cjs +27 -15
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/package.json +10 -9
- package/LICENSE +0 -21
- package/dist/chunk-GVBDM746.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './chunk-KMYENICQ.mjs';
|
|
2
2
|
import './chunk-MM2RWYNW.mjs';
|
|
3
3
|
import './chunk-R57WTNXW.mjs';
|
|
4
|
-
export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from './chunk-
|
|
4
|
+
export { runDomainPipeline, runHybridGraphPipeline, runKnowledgeGraphPipeline, runProjectGraphPipeline } from './chunk-NJQGIJ5A.mjs';
|
|
5
5
|
export { resolveConcepts } from './chunk-KNDBODUQ.mjs';
|
|
6
6
|
export { assembleRoadmap } from './chunk-ONQHJ4OH.mjs';
|
|
7
7
|
export { DEFAULT_STEP_MINUTES, DEPTH_MINUTE_FRACTIONS, emitCurriculumFeed } from './chunk-WKTH3JPA.mjs';
|
|
@@ -14,7 +14,7 @@ export { extractKeywords } from './chunk-XMHKWHVK.mjs';
|
|
|
14
14
|
import './chunk-7XGWW6CB.mjs';
|
|
15
15
|
export { detectDomain, detectDomainProfile, detectInputType, detectLearningMode } from './chunk-WD3P5V3B.mjs';
|
|
16
16
|
import './chunk-HRSBIVAW.mjs';
|
|
17
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditPhasePlan, auditSyllabusCoverage, authorDepthLayersHierarchically, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from './chunk-
|
|
17
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditPhasePlan, auditSyllabusCoverage, authorDepthLayersHierarchically, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from './chunk-6MM3MVQ5.mjs';
|
|
18
18
|
export { LlmClientError, build9routerProvider, createLlmClient, parseJsonFromLlm, resolve9routerChain, responseJsonCompat, summarizeProvenance } from './chunk-7A2SG466.mjs';
|
|
19
19
|
export { transportResultFrom } from './chunk-IBVXXVGE.mjs';
|
|
20
20
|
export { parseSyllabus } from './chunk-T4Y2DE2W.mjs';
|
package/dist/pipeline/index.cjs
CHANGED
|
@@ -2943,11 +2943,16 @@ function excerpt(text, max) {
|
|
|
2943
2943
|
const t = (text || "").trim();
|
|
2944
2944
|
return t.length > max ? t.slice(0, max) + "..." : t;
|
|
2945
2945
|
}
|
|
2946
|
-
async function chatJson(client, system, user,
|
|
2946
|
+
async function chatJson(client, system, user, onTransport) {
|
|
2947
2947
|
const r = await client.chat(
|
|
2948
2948
|
[{ role: "system", content: system }, { role: "user", content: user }],
|
|
2949
|
-
{
|
|
2949
|
+
{
|
|
2950
|
+
temperature: 0.1,
|
|
2951
|
+
maxTokens: Math.min(parseInt(process.env.KG_MAX_TOKENS || "16384", 10), 32768)
|
|
2952
|
+
}
|
|
2950
2953
|
);
|
|
2954
|
+
const t = r._transport ?? transportResultFrom("9router", client.model, { framingStripped: true });
|
|
2955
|
+
onTransport?.(t);
|
|
2951
2956
|
return parseJsonFromLlm(r.content);
|
|
2952
2957
|
}
|
|
2953
2958
|
var LO_BATCH_SIZE = 10;
|
|
@@ -2961,6 +2966,10 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
2961
2966
|
const uloByConcept = {};
|
|
2962
2967
|
const cioByConcept = {};
|
|
2963
2968
|
const sioByConcept = {};
|
|
2969
|
+
let lastTransport;
|
|
2970
|
+
const setTransport = (t) => {
|
|
2971
|
+
lastTransport = t;
|
|
2972
|
+
};
|
|
2964
2973
|
concepts.map((c) => "- " + c.id + ": " + c.name + (c.description ? " \u2014 " + excerpt(c.description, 160) : "")).join("\n");
|
|
2965
2974
|
const uloSystem = [
|
|
2966
2975
|
"You are a Curriculum Design Expert writing Universal Learning Objectives (ULO).",
|
|
@@ -2989,7 +2998,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
2989
2998
|
for (const batch of chunkConcepts(concepts, LO_BATCH_SIZE)) {
|
|
2990
2999
|
const batchList = batch.map((c) => "- " + c.id + " (" + c.name + ")" + (c.description ? ": " + excerpt(c.description, 160) : "")).join("\n");
|
|
2991
3000
|
const batchUser = "Concepts:\n" + batchList + '\n\nReturn JSON:\n{"ulos":[{"concept_id":"C1","ulo":"..."}]}';
|
|
2992
|
-
const uloRes = await chatJson(client, uloSystem, batchUser,
|
|
3001
|
+
const uloRes = await chatJson(client, uloSystem, batchUser, setTransport);
|
|
2993
3002
|
for (const u of uloRes.ulos ?? []) {
|
|
2994
3003
|
if (u.concept_id && u.ulo) uloByConcept[u.concept_id] = standardStatement(u.ulo);
|
|
2995
3004
|
}
|
|
@@ -3028,7 +3037,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3028
3037
|
new Set(batch.map((c) => c.id));
|
|
3029
3038
|
const batchUloContext = batch.map((c) => "- " + c.id + " (" + c.name + "): " + (uloByConcept[c.id] || "(missing)")).join("\n");
|
|
3030
3039
|
const batchCioUser = "Approved ULOs:\n" + batchUloContext + '\n\nReturn JSON:\n{"cios":[{"concept_id":"C1","cio":"..."}]}';
|
|
3031
|
-
const cioRes = await chatJson(client, cioSystem, batchCioUser,
|
|
3040
|
+
const cioRes = await chatJson(client, cioSystem, batchCioUser, setTransport);
|
|
3032
3041
|
for (const x of cioRes.cios ?? []) {
|
|
3033
3042
|
if (x.concept_id && x.cio) cioByConcept[x.concept_id] = standardStatement(x.cio);
|
|
3034
3043
|
}
|
|
@@ -3081,7 +3090,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3081
3090
|
"Return JSON:",
|
|
3082
3091
|
'{"sios":[{"concept_id":"C1","sio":["...","..."]}]}'
|
|
3083
3092
|
].join("\n");
|
|
3084
|
-
const sioRes = await chatJson(client, sioSystem, batchSioUser,
|
|
3093
|
+
const sioRes = await chatJson(client, sioSystem, batchSioUser, setTransport);
|
|
3085
3094
|
for (const x of sioRes.sios ?? []) {
|
|
3086
3095
|
if (x.concept_id && Array.isArray(x.sio)) sioByConcept[x.concept_id] = x.sio.map((item) => standardStatement(String(item)));
|
|
3087
3096
|
}
|
|
@@ -3093,14 +3102,17 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3093
3102
|
}
|
|
3094
3103
|
}
|
|
3095
3104
|
concepts.map((c) => c.id);
|
|
3096
|
-
const auditOnce = () => auditDepthLayers(
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3105
|
+
const auditOnce = () => auditDepthLayers(
|
|
3106
|
+
concepts.map((c) => ({
|
|
3107
|
+
id: c.id,
|
|
3108
|
+
name: c.name,
|
|
3109
|
+
keywords: c.keywords ?? [],
|
|
3110
|
+
ulo: uloByConcept[c.id],
|
|
3111
|
+
cio: cioByConcept[c.id],
|
|
3112
|
+
sio: sioByConcept[c.id]
|
|
3113
|
+
})),
|
|
3114
|
+
lastTransport
|
|
3115
|
+
);
|
|
3104
3116
|
let audits = auditOnce();
|
|
3105
3117
|
const repairRound = async (round) => {
|
|
3106
3118
|
const failingNow = audits.filter((a) => !a.passed);
|
|
@@ -3146,7 +3158,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3146
3158
|
'{"repairs":[{"concept_id":"C1","ulo":"...","cio":"...","sio":["..."]}]}'
|
|
3147
3159
|
].join("\n");
|
|
3148
3160
|
try {
|
|
3149
|
-
const repairRes = await chatJson(client, repairSystem, repairUser);
|
|
3161
|
+
const repairRes = await chatJson(client, repairSystem, repairUser, setTransport);
|
|
3150
3162
|
for (const r of repairRes.repairs ?? []) {
|
|
3151
3163
|
if (!r.concept_id) continue;
|
|
3152
3164
|
if (r.ulo) uloByConcept[r.concept_id] = standardStatement(r.ulo);
|
|
@@ -3182,7 +3194,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3182
3194
|
"Depth-layer contract audit failed after repair for: " + detail + " \u2014 regenerate or fix the prompt contract (fail-closed, no silent fallback)"
|
|
3183
3195
|
);
|
|
3184
3196
|
}
|
|
3185
|
-
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: audits[0]?.transport };
|
|
3197
|
+
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: lastTransport ?? audits[0]?.transport };
|
|
3186
3198
|
}
|
|
3187
3199
|
function cell(v) {
|
|
3188
3200
|
return (v || "").split(",").map((s) => s.trim()).filter(Boolean);
|