@thanh01.pmt/domain-kit 0.6.2 → 0.6.3
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-O6Z7F7XI.mjs} +25 -16
- package/dist/chunk-O6Z7F7XI.mjs.map +1 -0
- package/dist/{chunk-ZHMIJEMA.mjs → chunk-YXCHAR6R.mjs} +3 -3
- package/dist/{chunk-ZHMIJEMA.mjs.map → chunk-YXCHAR6R.mjs.map} +1 -1
- package/dist/graph/index.cjs +23 -14
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.mjs +1 -1
- package/dist/index.cjs +23 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/pipeline/index.cjs +23 -14
- 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-YXCHAR6R.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-O6Z7F7XI.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,13 @@ 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
|
{ temperature: 0.1, maxTokens: parseInt(process.env.KG_MAX_TOKENS || "65536", 10) }
|
|
2950
2950
|
);
|
|
2951
|
+
const t = r._transport ?? transportResultFrom("9router", client.model, { framingStripped: true });
|
|
2952
|
+
onTransport?.(t);
|
|
2951
2953
|
return parseJsonFromLlm(r.content);
|
|
2952
2954
|
}
|
|
2953
2955
|
var LO_BATCH_SIZE = 10;
|
|
@@ -2961,6 +2963,10 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
2961
2963
|
const uloByConcept = {};
|
|
2962
2964
|
const cioByConcept = {};
|
|
2963
2965
|
const sioByConcept = {};
|
|
2966
|
+
let lastTransport;
|
|
2967
|
+
const setTransport = (t) => {
|
|
2968
|
+
lastTransport = t;
|
|
2969
|
+
};
|
|
2964
2970
|
concepts.map((c) => "- " + c.id + ": " + c.name + (c.description ? " \u2014 " + excerpt(c.description, 160) : "")).join("\n");
|
|
2965
2971
|
const uloSystem = [
|
|
2966
2972
|
"You are a Curriculum Design Expert writing Universal Learning Objectives (ULO).",
|
|
@@ -2989,7 +2995,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
2989
2995
|
for (const batch of chunkConcepts(concepts, LO_BATCH_SIZE)) {
|
|
2990
2996
|
const batchList = batch.map((c) => "- " + c.id + " (" + c.name + ")" + (c.description ? ": " + excerpt(c.description, 160) : "")).join("\n");
|
|
2991
2997
|
const batchUser = "Concepts:\n" + batchList + '\n\nReturn JSON:\n{"ulos":[{"concept_id":"C1","ulo":"..."}]}';
|
|
2992
|
-
const uloRes = await chatJson(client, uloSystem, batchUser,
|
|
2998
|
+
const uloRes = await chatJson(client, uloSystem, batchUser, setTransport);
|
|
2993
2999
|
for (const u of uloRes.ulos ?? []) {
|
|
2994
3000
|
if (u.concept_id && u.ulo) uloByConcept[u.concept_id] = standardStatement(u.ulo);
|
|
2995
3001
|
}
|
|
@@ -3028,7 +3034,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3028
3034
|
new Set(batch.map((c) => c.id));
|
|
3029
3035
|
const batchUloContext = batch.map((c) => "- " + c.id + " (" + c.name + "): " + (uloByConcept[c.id] || "(missing)")).join("\n");
|
|
3030
3036
|
const batchCioUser = "Approved ULOs:\n" + batchUloContext + '\n\nReturn JSON:\n{"cios":[{"concept_id":"C1","cio":"..."}]}';
|
|
3031
|
-
const cioRes = await chatJson(client, cioSystem, batchCioUser,
|
|
3037
|
+
const cioRes = await chatJson(client, cioSystem, batchCioUser, setTransport);
|
|
3032
3038
|
for (const x of cioRes.cios ?? []) {
|
|
3033
3039
|
if (x.concept_id && x.cio) cioByConcept[x.concept_id] = standardStatement(x.cio);
|
|
3034
3040
|
}
|
|
@@ -3081,7 +3087,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3081
3087
|
"Return JSON:",
|
|
3082
3088
|
'{"sios":[{"concept_id":"C1","sio":["...","..."]}]}'
|
|
3083
3089
|
].join("\n");
|
|
3084
|
-
const sioRes = await chatJson(client, sioSystem, batchSioUser,
|
|
3090
|
+
const sioRes = await chatJson(client, sioSystem, batchSioUser, setTransport);
|
|
3085
3091
|
for (const x of sioRes.sios ?? []) {
|
|
3086
3092
|
if (x.concept_id && Array.isArray(x.sio)) sioByConcept[x.concept_id] = x.sio.map((item) => standardStatement(String(item)));
|
|
3087
3093
|
}
|
|
@@ -3093,14 +3099,17 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3093
3099
|
}
|
|
3094
3100
|
}
|
|
3095
3101
|
concepts.map((c) => c.id);
|
|
3096
|
-
const auditOnce = () => auditDepthLayers(
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3102
|
+
const auditOnce = () => auditDepthLayers(
|
|
3103
|
+
concepts.map((c) => ({
|
|
3104
|
+
id: c.id,
|
|
3105
|
+
name: c.name,
|
|
3106
|
+
keywords: c.keywords ?? [],
|
|
3107
|
+
ulo: uloByConcept[c.id],
|
|
3108
|
+
cio: cioByConcept[c.id],
|
|
3109
|
+
sio: sioByConcept[c.id]
|
|
3110
|
+
})),
|
|
3111
|
+
lastTransport
|
|
3112
|
+
);
|
|
3104
3113
|
let audits = auditOnce();
|
|
3105
3114
|
const repairRound = async (round) => {
|
|
3106
3115
|
const failingNow = audits.filter((a) => !a.passed);
|
|
@@ -3146,7 +3155,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3146
3155
|
'{"repairs":[{"concept_id":"C1","ulo":"...","cio":"...","sio":["..."]}]}'
|
|
3147
3156
|
].join("\n");
|
|
3148
3157
|
try {
|
|
3149
|
-
const repairRes = await chatJson(client, repairSystem, repairUser);
|
|
3158
|
+
const repairRes = await chatJson(client, repairSystem, repairUser, setTransport);
|
|
3150
3159
|
for (const r of repairRes.repairs ?? []) {
|
|
3151
3160
|
if (!r.concept_id) continue;
|
|
3152
3161
|
if (r.ulo) uloByConcept[r.concept_id] = standardStatement(r.ulo);
|
|
@@ -3182,7 +3191,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3182
3191
|
"Depth-layer contract audit failed after repair for: " + detail + " \u2014 regenerate or fix the prompt contract (fail-closed, no silent fallback)"
|
|
3183
3192
|
);
|
|
3184
3193
|
}
|
|
3185
|
-
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: audits[0]?.transport };
|
|
3194
|
+
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: lastTransport ?? audits[0]?.transport };
|
|
3186
3195
|
}
|
|
3187
3196
|
function cell(v) {
|
|
3188
3197
|
return (v || "").split(",").map((s) => s.trim()).filter(Boolean);
|