@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
|
@@ -1104,11 +1104,16 @@ function excerpt(text, max) {
|
|
|
1104
1104
|
const t = (text || "").trim();
|
|
1105
1105
|
return t.length > max ? t.slice(0, max) + "..." : t;
|
|
1106
1106
|
}
|
|
1107
|
-
async function chatJson(client, system, user,
|
|
1107
|
+
async function chatJson(client, system, user, onTransport) {
|
|
1108
1108
|
const r = await client.chat(
|
|
1109
1109
|
[{ role: "system", content: system }, { role: "user", content: user }],
|
|
1110
|
-
{
|
|
1110
|
+
{
|
|
1111
|
+
temperature: 0.1,
|
|
1112
|
+
maxTokens: Math.min(parseInt(process.env.KG_MAX_TOKENS || "16384", 10), 32768)
|
|
1113
|
+
}
|
|
1111
1114
|
);
|
|
1115
|
+
const t = r._transport ?? transportResultFrom("9router", client.model, { framingStripped: true });
|
|
1116
|
+
onTransport?.(t);
|
|
1112
1117
|
return parseJsonFromLlm(r.content);
|
|
1113
1118
|
}
|
|
1114
1119
|
var LO_BATCH_SIZE = 10;
|
|
@@ -1122,6 +1127,10 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1122
1127
|
const uloByConcept = {};
|
|
1123
1128
|
const cioByConcept = {};
|
|
1124
1129
|
const sioByConcept = {};
|
|
1130
|
+
let lastTransport;
|
|
1131
|
+
const setTransport = (t) => {
|
|
1132
|
+
lastTransport = t;
|
|
1133
|
+
};
|
|
1125
1134
|
concepts.map((c) => "- " + c.id + ": " + c.name + (c.description ? " \u2014 " + excerpt(c.description, 160) : "")).join("\n");
|
|
1126
1135
|
const uloSystem = [
|
|
1127
1136
|
"You are a Curriculum Design Expert writing Universal Learning Objectives (ULO).",
|
|
@@ -1150,7 +1159,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1150
1159
|
for (const batch of chunkConcepts(concepts, LO_BATCH_SIZE)) {
|
|
1151
1160
|
const batchList = batch.map((c) => "- " + c.id + " (" + c.name + ")" + (c.description ? ": " + excerpt(c.description, 160) : "")).join("\n");
|
|
1152
1161
|
const batchUser = "Concepts:\n" + batchList + '\n\nReturn JSON:\n{"ulos":[{"concept_id":"C1","ulo":"..."}]}';
|
|
1153
|
-
const uloRes = await chatJson(client, uloSystem, batchUser,
|
|
1162
|
+
const uloRes = await chatJson(client, uloSystem, batchUser, setTransport);
|
|
1154
1163
|
for (const u of uloRes.ulos ?? []) {
|
|
1155
1164
|
if (u.concept_id && u.ulo) uloByConcept[u.concept_id] = standardStatement(u.ulo);
|
|
1156
1165
|
}
|
|
@@ -1189,7 +1198,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1189
1198
|
new Set(batch.map((c) => c.id));
|
|
1190
1199
|
const batchUloContext = batch.map((c) => "- " + c.id + " (" + c.name + "): " + (uloByConcept[c.id] || "(missing)")).join("\n");
|
|
1191
1200
|
const batchCioUser = "Approved ULOs:\n" + batchUloContext + '\n\nReturn JSON:\n{"cios":[{"concept_id":"C1","cio":"..."}]}';
|
|
1192
|
-
const cioRes = await chatJson(client, cioSystem, batchCioUser,
|
|
1201
|
+
const cioRes = await chatJson(client, cioSystem, batchCioUser, setTransport);
|
|
1193
1202
|
for (const x of cioRes.cios ?? []) {
|
|
1194
1203
|
if (x.concept_id && x.cio) cioByConcept[x.concept_id] = standardStatement(x.cio);
|
|
1195
1204
|
}
|
|
@@ -1242,7 +1251,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1242
1251
|
"Return JSON:",
|
|
1243
1252
|
'{"sios":[{"concept_id":"C1","sio":["...","..."]}]}'
|
|
1244
1253
|
].join("\n");
|
|
1245
|
-
const sioRes = await chatJson(client, sioSystem, batchSioUser,
|
|
1254
|
+
const sioRes = await chatJson(client, sioSystem, batchSioUser, setTransport);
|
|
1246
1255
|
for (const x of sioRes.sios ?? []) {
|
|
1247
1256
|
if (x.concept_id && Array.isArray(x.sio)) sioByConcept[x.concept_id] = x.sio.map((item) => standardStatement(String(item)));
|
|
1248
1257
|
}
|
|
@@ -1254,14 +1263,17 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1254
1263
|
}
|
|
1255
1264
|
}
|
|
1256
1265
|
concepts.map((c) => c.id);
|
|
1257
|
-
const auditOnce = () => auditDepthLayers(
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1266
|
+
const auditOnce = () => auditDepthLayers(
|
|
1267
|
+
concepts.map((c) => ({
|
|
1268
|
+
id: c.id,
|
|
1269
|
+
name: c.name,
|
|
1270
|
+
keywords: c.keywords ?? [],
|
|
1271
|
+
ulo: uloByConcept[c.id],
|
|
1272
|
+
cio: cioByConcept[c.id],
|
|
1273
|
+
sio: sioByConcept[c.id]
|
|
1274
|
+
})),
|
|
1275
|
+
lastTransport
|
|
1276
|
+
);
|
|
1265
1277
|
let audits = auditOnce();
|
|
1266
1278
|
const repairRound = async (round) => {
|
|
1267
1279
|
const failingNow = audits.filter((a) => !a.passed);
|
|
@@ -1307,7 +1319,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1307
1319
|
'{"repairs":[{"concept_id":"C1","ulo":"...","cio":"...","sio":["..."]}]}'
|
|
1308
1320
|
].join("\n");
|
|
1309
1321
|
try {
|
|
1310
|
-
const repairRes = await chatJson(client, repairSystem, repairUser);
|
|
1322
|
+
const repairRes = await chatJson(client, repairSystem, repairUser, setTransport);
|
|
1311
1323
|
for (const r of repairRes.repairs ?? []) {
|
|
1312
1324
|
if (!r.concept_id) continue;
|
|
1313
1325
|
if (r.ulo) uloByConcept[r.concept_id] = standardStatement(r.ulo);
|
|
@@ -1343,7 +1355,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
1343
1355
|
"Depth-layer contract audit failed after repair for: " + detail + " \u2014 regenerate or fix the prompt contract (fail-closed, no silent fallback)"
|
|
1344
1356
|
);
|
|
1345
1357
|
}
|
|
1346
|
-
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: audits[0]?.transport };
|
|
1358
|
+
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: lastTransport ?? audits[0]?.transport };
|
|
1347
1359
|
}
|
|
1348
1360
|
function cell(v) {
|
|
1349
1361
|
return (v || "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -2270,5 +2282,5 @@ async function decomposePhases(args) {
|
|
|
2270
2282
|
}
|
|
2271
2283
|
|
|
2272
2284
|
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 };
|
|
2273
|
-
//# sourceMappingURL=chunk-
|
|
2274
|
-
//# sourceMappingURL=chunk-
|
|
2285
|
+
//# sourceMappingURL=chunk-6MM3MVQ5.mjs.map
|
|
2286
|
+
//# sourceMappingURL=chunk-6MM3MVQ5.mjs.map
|