@thanh01.pmt/domain-kit 0.6.1 → 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-HRSBIVAW.mjs +3 -0
- package/dist/{chunk-ZKLT27T4.mjs.map → chunk-HRSBIVAW.mjs.map} +1 -1
- package/dist/{chunk-4UCXYRM3.mjs → chunk-O6Z7F7XI.mjs} +26 -17
- package/dist/chunk-O6Z7F7XI.mjs.map +1 -0
- package/dist/{chunk-KHCZYLKM.mjs → chunk-YXCHAR6R.mjs} +3 -3
- package/dist/{chunk-KHCZYLKM.mjs.map → chunk-YXCHAR6R.mjs.map} +1 -1
- package/dist/graph/index.cjs +24 -14
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +18 -1
- package/dist/graph/index.d.ts +18 -1
- package/dist/graph/index.mjs +2 -2
- package/dist/index.cjs +24 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- 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-4UCXYRM3.mjs.map +0 -1
- package/dist/chunk-ZKLT27T4.mjs +0 -3
package/dist/graph/index.d.cts
CHANGED
|
@@ -135,6 +135,23 @@ declare function auditDepthLayers(concepts: Array<{
|
|
|
135
135
|
keywords?: string[];
|
|
136
136
|
}>, transport?: LlmTransportResult): DepthLayerAudit[];
|
|
137
137
|
|
|
138
|
+
interface HierarchicalLoConceptInput {
|
|
139
|
+
keywords?: string[];
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
}
|
|
144
|
+
interface HierarchicalLoResult {
|
|
145
|
+
uloByConcept: Record<string, string>;
|
|
146
|
+
cioByConcept: Record<string, string>;
|
|
147
|
+
sioByConcept: Record<string, string[]>;
|
|
148
|
+
audits: DepthLayerAudit[];
|
|
149
|
+
warnings: string[];
|
|
150
|
+
/** Transport provenance attached to the last layer-generation call. */
|
|
151
|
+
lastTransport?: LlmTransportResult;
|
|
152
|
+
}
|
|
153
|
+
declare function authorDepthLayersHierarchically(client: LlmClient, concepts: Array<HierarchicalLoConceptInput>, techStack: string, warnings: string[]): Promise<HierarchicalLoResult>;
|
|
154
|
+
|
|
138
155
|
/**
|
|
139
156
|
* LO code + statement standard — calibrated against the production
|
|
140
157
|
* learning_objectives table (6,693 live rows) and the knowledge-tree
|
|
@@ -175,4 +192,4 @@ declare const ULO_CODE_RE: RegExp;
|
|
|
175
192
|
declare const CIO_CODE_RE: RegExp;
|
|
176
193
|
declare const SIO_CODE_RE: RegExp;
|
|
177
194
|
|
|
178
|
-
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 };
|
|
195
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, type HierarchicalLoConceptInput, type HierarchicalLoResult, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, authorDepthLayersHierarchically, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode };
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -135,6 +135,23 @@ declare function auditDepthLayers(concepts: Array<{
|
|
|
135
135
|
keywords?: string[];
|
|
136
136
|
}>, transport?: LlmTransportResult): DepthLayerAudit[];
|
|
137
137
|
|
|
138
|
+
interface HierarchicalLoConceptInput {
|
|
139
|
+
keywords?: string[];
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
}
|
|
144
|
+
interface HierarchicalLoResult {
|
|
145
|
+
uloByConcept: Record<string, string>;
|
|
146
|
+
cioByConcept: Record<string, string>;
|
|
147
|
+
sioByConcept: Record<string, string[]>;
|
|
148
|
+
audits: DepthLayerAudit[];
|
|
149
|
+
warnings: string[];
|
|
150
|
+
/** Transport provenance attached to the last layer-generation call. */
|
|
151
|
+
lastTransport?: LlmTransportResult;
|
|
152
|
+
}
|
|
153
|
+
declare function authorDepthLayersHierarchically(client: LlmClient, concepts: Array<HierarchicalLoConceptInput>, techStack: string, warnings: string[]): Promise<HierarchicalLoResult>;
|
|
154
|
+
|
|
138
155
|
/**
|
|
139
156
|
* LO code + statement standard — calibrated against the production
|
|
140
157
|
* learning_objectives table (6,693 live rows) and the knowledge-tree
|
|
@@ -175,4 +192,4 @@ declare const ULO_CODE_RE: RegExp;
|
|
|
175
192
|
declare const CIO_CODE_RE: RegExp;
|
|
176
193
|
declare const SIO_CODE_RE: RegExp;
|
|
177
194
|
|
|
178
|
-
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 };
|
|
195
|
+
export { CIO_CODE_RE, CONCEPT_CODE_RE, type DepthLayerAudit, type ExtractOverviewOptions, type ExtractScaffoldOptions, type ExtractStepsOptions, type HierarchicalLoConceptInput, type HierarchicalLoResult, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, authorDepthLayersHierarchically, cioActionSlug, cioCode, conceptCodeFromName, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, sioCode, standardStatement, techTagFor, uloCode };
|
package/dist/graph/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../chunk-
|
|
2
|
-
export { CIO_CODE_RE, CONCEPT_CODE_RE, LEARNER_CLAUSE, SIO_CODE_RE, ULO_CODE_RE, assignConceptCodes, auditDepthLayers, auditPhasePlan, auditSyllabusCoverage, breakPrerequisiteCycles, cioActionSlug, cioCode, conceptCodeFromName, detectPrerequisiteCycles, escalateAndMapConcepts, extractFeatureSteps, extractFeatureStepsBatched, extractProjectOverview, extractScaffold, generateHybridGraph, generateKnowledgeGraph, sioCode, standardStatement, techTagFor, uloCode, verifyKnowledgeGraph, verifyProjectGraph } from '../chunk-
|
|
1
|
+
import '../chunk-HRSBIVAW.mjs';
|
|
2
|
+
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';
|
|
3
3
|
import '../chunk-7A2SG466.mjs';
|
|
4
4
|
import '../chunk-IBVXXVGE.mjs';
|
|
5
5
|
import '../chunk-T4Y2DE2W.mjs';
|
package/dist/index.cjs
CHANGED
|
@@ -3963,11 +3963,13 @@ function excerpt(text, max) {
|
|
|
3963
3963
|
const t = (text || "").trim();
|
|
3964
3964
|
return t.length > max ? t.slice(0, max) + "..." : t;
|
|
3965
3965
|
}
|
|
3966
|
-
async function chatJson(client, system, user,
|
|
3966
|
+
async function chatJson(client, system, user, onTransport) {
|
|
3967
3967
|
const r = await client.chat(
|
|
3968
3968
|
[{ role: "system", content: system }, { role: "user", content: user }],
|
|
3969
3969
|
{ temperature: 0.1, maxTokens: parseInt(process.env.KG_MAX_TOKENS || "65536", 10) }
|
|
3970
3970
|
);
|
|
3971
|
+
const t = r._transport ?? transportResultFrom("9router", client.model, { framingStripped: true });
|
|
3972
|
+
onTransport?.(t);
|
|
3971
3973
|
return parseJsonFromLlm(r.content);
|
|
3972
3974
|
}
|
|
3973
3975
|
var LO_BATCH_SIZE = 10;
|
|
@@ -3981,6 +3983,10 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
3981
3983
|
const uloByConcept = {};
|
|
3982
3984
|
const cioByConcept = {};
|
|
3983
3985
|
const sioByConcept = {};
|
|
3986
|
+
let lastTransport;
|
|
3987
|
+
const setTransport = (t) => {
|
|
3988
|
+
lastTransport = t;
|
|
3989
|
+
};
|
|
3984
3990
|
concepts.map((c) => "- " + c.id + ": " + c.name + (c.description ? " \u2014 " + excerpt(c.description, 160) : "")).join("\n");
|
|
3985
3991
|
const uloSystem = [
|
|
3986
3992
|
"You are a Curriculum Design Expert writing Universal Learning Objectives (ULO).",
|
|
@@ -4009,7 +4015,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4009
4015
|
for (const batch of chunkConcepts(concepts, LO_BATCH_SIZE)) {
|
|
4010
4016
|
const batchList = batch.map((c) => "- " + c.id + " (" + c.name + ")" + (c.description ? ": " + excerpt(c.description, 160) : "")).join("\n");
|
|
4011
4017
|
const batchUser = "Concepts:\n" + batchList + '\n\nReturn JSON:\n{"ulos":[{"concept_id":"C1","ulo":"..."}]}';
|
|
4012
|
-
const uloRes = await chatJson(client, uloSystem, batchUser,
|
|
4018
|
+
const uloRes = await chatJson(client, uloSystem, batchUser, setTransport);
|
|
4013
4019
|
for (const u of uloRes.ulos ?? []) {
|
|
4014
4020
|
if (u.concept_id && u.ulo) uloByConcept[u.concept_id] = standardStatement(u.ulo);
|
|
4015
4021
|
}
|
|
@@ -4048,7 +4054,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4048
4054
|
new Set(batch.map((c) => c.id));
|
|
4049
4055
|
const batchUloContext = batch.map((c) => "- " + c.id + " (" + c.name + "): " + (uloByConcept[c.id] || "(missing)")).join("\n");
|
|
4050
4056
|
const batchCioUser = "Approved ULOs:\n" + batchUloContext + '\n\nReturn JSON:\n{"cios":[{"concept_id":"C1","cio":"..."}]}';
|
|
4051
|
-
const cioRes = await chatJson(client, cioSystem, batchCioUser,
|
|
4057
|
+
const cioRes = await chatJson(client, cioSystem, batchCioUser, setTransport);
|
|
4052
4058
|
for (const x of cioRes.cios ?? []) {
|
|
4053
4059
|
if (x.concept_id && x.cio) cioByConcept[x.concept_id] = standardStatement(x.cio);
|
|
4054
4060
|
}
|
|
@@ -4101,7 +4107,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4101
4107
|
"Return JSON:",
|
|
4102
4108
|
'{"sios":[{"concept_id":"C1","sio":["...","..."]}]}'
|
|
4103
4109
|
].join("\n");
|
|
4104
|
-
const sioRes = await chatJson(client, sioSystem, batchSioUser,
|
|
4110
|
+
const sioRes = await chatJson(client, sioSystem, batchSioUser, setTransport);
|
|
4105
4111
|
for (const x of sioRes.sios ?? []) {
|
|
4106
4112
|
if (x.concept_id && Array.isArray(x.sio)) sioByConcept[x.concept_id] = x.sio.map((item) => standardStatement(String(item)));
|
|
4107
4113
|
}
|
|
@@ -4113,14 +4119,17 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4113
4119
|
}
|
|
4114
4120
|
}
|
|
4115
4121
|
concepts.map((c) => c.id);
|
|
4116
|
-
const auditOnce = () => auditDepthLayers(
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4122
|
+
const auditOnce = () => auditDepthLayers(
|
|
4123
|
+
concepts.map((c) => ({
|
|
4124
|
+
id: c.id,
|
|
4125
|
+
name: c.name,
|
|
4126
|
+
keywords: c.keywords ?? [],
|
|
4127
|
+
ulo: uloByConcept[c.id],
|
|
4128
|
+
cio: cioByConcept[c.id],
|
|
4129
|
+
sio: sioByConcept[c.id]
|
|
4130
|
+
})),
|
|
4131
|
+
lastTransport
|
|
4132
|
+
);
|
|
4124
4133
|
let audits = auditOnce();
|
|
4125
4134
|
const repairRound = async (round) => {
|
|
4126
4135
|
const failingNow = audits.filter((a) => !a.passed);
|
|
@@ -4166,7 +4175,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4166
4175
|
'{"repairs":[{"concept_id":"C1","ulo":"...","cio":"...","sio":["..."]}]}'
|
|
4167
4176
|
].join("\n");
|
|
4168
4177
|
try {
|
|
4169
|
-
const repairRes = await chatJson(client, repairSystem, repairUser);
|
|
4178
|
+
const repairRes = await chatJson(client, repairSystem, repairUser, setTransport);
|
|
4170
4179
|
for (const r of repairRes.repairs ?? []) {
|
|
4171
4180
|
if (!r.concept_id) continue;
|
|
4172
4181
|
if (r.ulo) uloByConcept[r.concept_id] = standardStatement(r.ulo);
|
|
@@ -4202,7 +4211,7 @@ async function authorDepthLayersHierarchically(client, concepts, techStack, warn
|
|
|
4202
4211
|
"Depth-layer contract audit failed after repair for: " + detail + " \u2014 regenerate or fix the prompt contract (fail-closed, no silent fallback)"
|
|
4203
4212
|
);
|
|
4204
4213
|
}
|
|
4205
|
-
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: audits[0]?.transport };
|
|
4214
|
+
return { uloByConcept, cioByConcept, sioByConcept, audits, warnings, lastTransport: lastTransport ?? audits[0]?.transport };
|
|
4206
4215
|
}
|
|
4207
4216
|
function cell(v) {
|
|
4208
4217
|
return (v || "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -6835,6 +6844,7 @@ exports.assignConceptCodes = assignConceptCodes;
|
|
|
6835
6844
|
exports.auditDepthLayers = auditDepthLayers;
|
|
6836
6845
|
exports.auditPhasePlan = auditPhasePlan;
|
|
6837
6846
|
exports.auditSyllabusCoverage = auditSyllabusCoverage;
|
|
6847
|
+
exports.authorDepthLayersHierarchically = authorDepthLayersHierarchically;
|
|
6838
6848
|
exports.breakPrerequisiteCycles = breakPrerequisiteCycles;
|
|
6839
6849
|
exports.build9routerProvider = build9routerProvider;
|
|
6840
6850
|
exports.cioActionSlug = cioActionSlug;
|