@thanh01.pmt/curriculum-kit 1.4.28 → 1.4.30
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/ai/index.cjs +19 -2
- package/dist/ai/index.cjs.map +1 -1
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.mjs +19 -2
- package/dist/ai/index.mjs.map +1 -1
- package/dist/index.cjs +49 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +49 -3
- package/dist/index.mjs.map +1 -1
- package/dist/media/index.cjs +19 -2
- package/dist/media/index.cjs.map +1 -1
- package/dist/media/index.d.cts +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.mjs +19 -2
- package/dist/media/index.mjs.map +1 -1
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +1 -1
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.mjs.map +1 -1
- package/dist/publishers/index.d.cts +1 -1
- package/dist/publishers/index.d.ts +1 -1
- package/dist/storage/index.cjs +27 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +11 -2
- package/dist/storage/index.d.ts +11 -2
- package/dist/storage/index.mjs +27 -0
- package/dist/storage/index.mjs.map +1 -1
- package/dist/{streamRunner-kpS4MZP1.d.cts → streamRunner-DYHFhNUr.d.cts} +1 -1
- package/dist/{streamRunner-kpS4MZP1.d.ts → streamRunner-DYHFhNUr.d.ts} +1 -1
- package/dist/{types-BUJGYiep.d.cts → types-Bgk-C4K2.d.cts} +11 -0
- package/dist/{types-BUJGYiep.d.ts → types-Bgk-C4K2.d.ts} +11 -0
- package/dist/workflow/index.cjs +21 -3
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +21 -3
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -516,6 +516,13 @@ Guidelines:
|
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
+
if (!options.customInference && resolveApiKey("CURRICULUM_KIT_REQUIRE_CUSTOM_INFERENCE") === "1") {
|
|
520
|
+
throw createAiInferenceError({
|
|
521
|
+
errorCode: "ERR_CUSTOM_INFERENCE_REQUIRED",
|
|
522
|
+
message: "customInference is REQUIRED (CURRICULUM_KIT_REQUIRE_CUSTOM_INFERENCE=1): pass buildKitCustomInference(...) so every LLM call flows through the host AI SDK gateway and its unified Langfuse tracing. Raw-fetch provider routes are disabled by mandate.",
|
|
523
|
+
rawError: { mandate: "CURRICULUM_KIT_REQUIRE_CUSTOM_INFERENCE", hasCustomInference: false }
|
|
524
|
+
});
|
|
525
|
+
}
|
|
519
526
|
const formattedMessages = [
|
|
520
527
|
{ role: "system", content: systemInstruction },
|
|
521
528
|
...messages.map((m) => ({
|
|
@@ -539,7 +546,12 @@ Guidelines:
|
|
|
539
546
|
const unique9RouterModels = Array.from(new Set(candidateModels));
|
|
540
547
|
for (const model of unique9RouterModels) {
|
|
541
548
|
try {
|
|
542
|
-
const
|
|
549
|
+
const r9Idle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
550
|
+
const r9Total = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
551
|
+
const idle = createStreamAbortController({
|
|
552
|
+
idleMs: r9Idle > 0 ? r9Idle : 9e4,
|
|
553
|
+
totalMs: r9Total > 0 ? r9Total : 3e5
|
|
554
|
+
});
|
|
543
555
|
const res = await fetch(`${ninerouterBaseUrl}/chat/completions`, {
|
|
544
556
|
method: "POST",
|
|
545
557
|
headers: {
|
|
@@ -782,7 +794,12 @@ Guidelines:
|
|
|
782
794
|
try {
|
|
783
795
|
const rawUrl = resolveApiKey("NINEROUTER_BASE_URL") || resolveApiKey("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
|
|
784
796
|
const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
|
|
785
|
-
const
|
|
797
|
+
const fbIdle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
798
|
+
const fbTotal = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
799
|
+
const idle = createStreamAbortController({
|
|
800
|
+
idleMs: fbIdle > 0 ? fbIdle : 9e4,
|
|
801
|
+
totalMs: fbTotal > 0 ? fbTotal : 3e5
|
|
802
|
+
});
|
|
786
803
|
const res = await fetch(`${fbBaseUrl}/chat/completions`, {
|
|
787
804
|
method: "POST",
|
|
788
805
|
headers: {
|
|
@@ -9718,6 +9735,16 @@ ${lessonTable}
|
|
|
9718
9735
|
await this.savePipelineState(projectId, current);
|
|
9719
9736
|
return current;
|
|
9720
9737
|
}
|
|
9738
|
+
/** Disk adapter: purge = rm the file (best-effort, mirrors cloud deleteArtifact). */
|
|
9739
|
+
async deleteArtifact(projectId, relPath) {
|
|
9740
|
+
try {
|
|
9741
|
+
const projectDir = this.getProjectDir(projectId);
|
|
9742
|
+
const targetPath = path3__default.default.join(projectDir, relPath);
|
|
9743
|
+
this.assertInsideProject(projectDir, targetPath);
|
|
9744
|
+
if (fs2__default.default.existsSync(targetPath)) fs2__default.default.rmSync(targetPath, { force: true });
|
|
9745
|
+
} catch {
|
|
9746
|
+
}
|
|
9747
|
+
}
|
|
9721
9748
|
};
|
|
9722
9749
|
var SupabaseCurriculumAdapter = class {
|
|
9723
9750
|
client;
|
|
@@ -9883,6 +9910,23 @@ var SupabaseCurriculumAdapter = class {
|
|
|
9883
9910
|
} catch {
|
|
9884
9911
|
}
|
|
9885
9912
|
}
|
|
9913
|
+
/**
|
|
9914
|
+
* Split-brain root-cause fix (2026-09-14): purge must reach the cloud copy
|
|
9915
|
+
* too. Removes the storage object AND the indexed `curriculum_artifacts`
|
|
9916
|
+
* row (the row is what `readArtifact`-style indexed readers resolve first).
|
|
9917
|
+
* Best-effort / no-throw per the interface contract.
|
|
9918
|
+
*/
|
|
9919
|
+
async deleteArtifact(projectId, relPath) {
|
|
9920
|
+
const fullPath = `${projectId}/${relPath.replace(/^\//, "")}`;
|
|
9921
|
+
try {
|
|
9922
|
+
await this.client.storage.from(this.bucketName).remove([fullPath]);
|
|
9923
|
+
} catch {
|
|
9924
|
+
}
|
|
9925
|
+
try {
|
|
9926
|
+
await this.client.from("curriculum_artifacts").delete().match({ project_id: projectId, rel_path: relPath });
|
|
9927
|
+
} catch {
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9886
9930
|
async listLessons(projectId) {
|
|
9887
9931
|
const summaries = [];
|
|
9888
9932
|
const processedLessons = /* @__PURE__ */ new Set();
|
|
@@ -10901,7 +10945,8 @@ function buildLanguageDirective(targetLanguage) {
|
|
|
10901
10945
|
- All section titles, table headers, table cells, lesson names, learning objectives, pedagogical narratives, and cognitive analyses MUST be written in natural, fluent, academic ${name}.
|
|
10902
10946
|
- Technical identifiers, code keywords (e.g. setup(), loop(), pinMode()), standard protocols (I2C, SPI, UART, GPIO), and component model numbers (ESP32, Arduino Uno) remain in standard technical notation, but all surrounding explanations MUST be in ${name}.
|
|
10903
10947
|
- DO NOT mix in paragraphs, tables, or titles written in any other language. Strict adherence is required.${exampleLine ? `
|
|
10904
|
-
${exampleLine}` : ""}
|
|
10948
|
+
${exampleLine}` : ""}
|
|
10949
|
+
- CJK / NON-LATIN SCRIPT BAN (ABSOLUTE): NEVER output characters from Chinese (\u6C49\u5B57), Japanese (\u304B\u306A/\u6F22\u5B57), or Korean (\uD55C\uAE00) scripts ANYWHERE in the document \u2014 not even a single glyph spliced inside a ${name} sentence. Observed past violations that are STRICTLY forbidden: \u6392\u67E5, \u5305\u542B, \u5BFC\u81F4, \u662F\u591A\u5C11, \u6280\u672F, \u771F\u673A, \u4F11\u606F, \u7EB8\u8D28. To express such meaning write it fully in ${name} or keep the ENGLISH technical term (e.g. write "t\u1EF1 ki\u1EC3m tra l\u1ED7i" / "self-debugging", "bao g\u1ED3m" / "includes"). A mechanical scanner rejects any document containing even one CJK character.`;
|
|
10905
10950
|
}
|
|
10906
10951
|
function matchesArtifactType(candidate, target) {
|
|
10907
10952
|
const c = candidate.trim().toUpperCase();
|
|
@@ -29668,6 +29713,7 @@ ${targetLayer === 1 ? `
|
|
|
29668
29713
|
|
|
29669
29714
|
- EVERY text/textarea field MUST have a complete, professional, ready-to-use pre-filled text in ${textLangMandate} adhering strictly to standard pedagogical terminology. NO placeholders, NO empty strings.
|
|
29670
29715
|
- EVERY choice field MUST have realistic concrete options ${choiceLangMandate} with EXACTLY ONE recommended option (selected: true).
|
|
29716
|
+
- SCRIPT POLICY (CJK/non-Latin ban): Write ALL output STRICTLY in the ${textLangMandate} using the Latin alphabet. NEVER insert characters from CJK scripts (Chinese \u6C49\u5B57, Japanese \u304B\u306A/\u6F22\u5B57, Korean \uD55C\uAE00) or any other non-Latin script ANYWHERE in the output \u2014 not even a single character inside an otherwise Vietnamese/English sentence. If a technical term has no natural translation, keep the ENGLISH term (e.g. write "t\u1EF1 ki\u1EC3m tra l\u1ED7i" or "self-debugging", NEVER \u6392\u67E5 l\u1ED7i; write "bao g\u1ED3m", NEVER \u5305\u542B). This ban includes partial words spliced into Vietnamese text like \u6392\u67E5, \u5305\u542B, \u5BFC\u81F4, \u662F\u591A\u5C11.
|
|
29671
29717
|
|
|
29672
29718
|
RETURN STRICT VALID JSON ONLY adhering exactly to this format:
|
|
29673
29719
|
{
|