@thanh01.pmt/curriculum-kit 1.4.27 → 1.4.29
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 +46 -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 +46 -2
- package/dist/ai/index.mjs.map +1 -1
- package/dist/index.cjs +76 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +76 -3
- package/dist/index.mjs.map +1 -1
- package/dist/media/index.cjs +46 -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 +46 -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.ts → types-Bgk-C4K2.d.cts} +11 -0
- package/dist/{types-BUJGYiep.d.cts → types-Bgk-C4K2.d.ts} +11 -0
- package/dist/workflow/index.cjs +48 -3
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +48 -3
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +23 -22
- package/LICENSE +0 -21
package/dist/index.cjs
CHANGED
|
@@ -539,7 +539,12 @@ Guidelines:
|
|
|
539
539
|
const unique9RouterModels = Array.from(new Set(candidateModels));
|
|
540
540
|
for (const model of unique9RouterModels) {
|
|
541
541
|
try {
|
|
542
|
-
const
|
|
542
|
+
const r9Idle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
543
|
+
const r9Total = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
544
|
+
const idle = createStreamAbortController({
|
|
545
|
+
idleMs: r9Idle > 0 ? r9Idle : 9e4,
|
|
546
|
+
totalMs: r9Total > 0 ? r9Total : 3e5
|
|
547
|
+
});
|
|
543
548
|
const res = await fetch(`${ninerouterBaseUrl}/chat/completions`, {
|
|
544
549
|
method: "POST",
|
|
545
550
|
headers: {
|
|
@@ -778,7 +783,46 @@ Guidelines:
|
|
|
778
783
|
);
|
|
779
784
|
for (const target of fallbackChain) {
|
|
780
785
|
const { provider, model } = target;
|
|
781
|
-
if (provider === "
|
|
786
|
+
if ((provider === "9router" || provider === "ninerouter") && ninerouterKey && isProviderEnabled("9router")) {
|
|
787
|
+
try {
|
|
788
|
+
const rawUrl = resolveApiKey("NINEROUTER_BASE_URL") || resolveApiKey("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
|
|
789
|
+
const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
|
|
790
|
+
const fbIdle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
791
|
+
const fbTotal = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
792
|
+
const idle = createStreamAbortController({
|
|
793
|
+
idleMs: fbIdle > 0 ? fbIdle : 9e4,
|
|
794
|
+
totalMs: fbTotal > 0 ? fbTotal : 3e5
|
|
795
|
+
});
|
|
796
|
+
const res = await fetch(`${fbBaseUrl}/chat/completions`, {
|
|
797
|
+
method: "POST",
|
|
798
|
+
headers: {
|
|
799
|
+
"Authorization": `Bearer ${ninerouterKey}`,
|
|
800
|
+
"Content-Type": "application/json"
|
|
801
|
+
},
|
|
802
|
+
body: JSON.stringify({
|
|
803
|
+
model,
|
|
804
|
+
messages: formattedMessages,
|
|
805
|
+
max_tokens: maxTokens,
|
|
806
|
+
temperature,
|
|
807
|
+
stream: true,
|
|
808
|
+
stream_options: { include_usage: true }
|
|
809
|
+
}),
|
|
810
|
+
signal: idle.signal
|
|
811
|
+
});
|
|
812
|
+
if (res.ok) {
|
|
813
|
+
const text = await processOpenAISSEStream(res, onChunk, idle);
|
|
814
|
+
if (text && text.trim()) {
|
|
815
|
+
console.log(`[streamRunner] \u2705 Designated fallback 9Router (${model}) succeeded!`);
|
|
816
|
+
return text;
|
|
817
|
+
}
|
|
818
|
+
} else {
|
|
819
|
+
const errText = await res.text().catch(() => "");
|
|
820
|
+
providerErrors[`designated_fallback_9router_${model}`] = `HTTP ${res.status}: ${errText.slice(0, 120)}`;
|
|
821
|
+
}
|
|
822
|
+
} catch (e) {
|
|
823
|
+
providerErrors[`designated_fallback_9router_${model}`] = e?.message || "Network error";
|
|
824
|
+
}
|
|
825
|
+
} else if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
|
|
782
826
|
try {
|
|
783
827
|
const nvdIdle = options.idleTimeoutMs ?? 18e4;
|
|
784
828
|
const nvdTotal = options.timeoutMs ?? 6e5;
|
|
@@ -9684,6 +9728,16 @@ ${lessonTable}
|
|
|
9684
9728
|
await this.savePipelineState(projectId, current);
|
|
9685
9729
|
return current;
|
|
9686
9730
|
}
|
|
9731
|
+
/** Disk adapter: purge = rm the file (best-effort, mirrors cloud deleteArtifact). */
|
|
9732
|
+
async deleteArtifact(projectId, relPath) {
|
|
9733
|
+
try {
|
|
9734
|
+
const projectDir = this.getProjectDir(projectId);
|
|
9735
|
+
const targetPath = path3__default.default.join(projectDir, relPath);
|
|
9736
|
+
this.assertInsideProject(projectDir, targetPath);
|
|
9737
|
+
if (fs2__default.default.existsSync(targetPath)) fs2__default.default.rmSync(targetPath, { force: true });
|
|
9738
|
+
} catch {
|
|
9739
|
+
}
|
|
9740
|
+
}
|
|
9687
9741
|
};
|
|
9688
9742
|
var SupabaseCurriculumAdapter = class {
|
|
9689
9743
|
client;
|
|
@@ -9849,6 +9903,23 @@ var SupabaseCurriculumAdapter = class {
|
|
|
9849
9903
|
} catch {
|
|
9850
9904
|
}
|
|
9851
9905
|
}
|
|
9906
|
+
/**
|
|
9907
|
+
* Split-brain root-cause fix (2026-09-14): purge must reach the cloud copy
|
|
9908
|
+
* too. Removes the storage object AND the indexed `curriculum_artifacts`
|
|
9909
|
+
* row (the row is what `readArtifact`-style indexed readers resolve first).
|
|
9910
|
+
* Best-effort / no-throw per the interface contract.
|
|
9911
|
+
*/
|
|
9912
|
+
async deleteArtifact(projectId, relPath) {
|
|
9913
|
+
const fullPath = `${projectId}/${relPath.replace(/^\//, "")}`;
|
|
9914
|
+
try {
|
|
9915
|
+
await this.client.storage.from(this.bucketName).remove([fullPath]);
|
|
9916
|
+
} catch {
|
|
9917
|
+
}
|
|
9918
|
+
try {
|
|
9919
|
+
await this.client.from("curriculum_artifacts").delete().match({ project_id: projectId, rel_path: relPath });
|
|
9920
|
+
} catch {
|
|
9921
|
+
}
|
|
9922
|
+
}
|
|
9852
9923
|
async listLessons(projectId) {
|
|
9853
9924
|
const summaries = [];
|
|
9854
9925
|
const processedLessons = /* @__PURE__ */ new Set();
|
|
@@ -10867,7 +10938,8 @@ function buildLanguageDirective(targetLanguage) {
|
|
|
10867
10938
|
- All section titles, table headers, table cells, lesson names, learning objectives, pedagogical narratives, and cognitive analyses MUST be written in natural, fluent, academic ${name}.
|
|
10868
10939
|
- 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}.
|
|
10869
10940
|
- DO NOT mix in paragraphs, tables, or titles written in any other language. Strict adherence is required.${exampleLine ? `
|
|
10870
|
-
${exampleLine}` : ""}
|
|
10941
|
+
${exampleLine}` : ""}
|
|
10942
|
+
- 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.`;
|
|
10871
10943
|
}
|
|
10872
10944
|
function matchesArtifactType(candidate, target) {
|
|
10873
10945
|
const c = candidate.trim().toUpperCase();
|
|
@@ -29634,6 +29706,7 @@ ${targetLayer === 1 ? `
|
|
|
29634
29706
|
|
|
29635
29707
|
- 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.
|
|
29636
29708
|
- EVERY choice field MUST have realistic concrete options ${choiceLangMandate} with EXACTLY ONE recommended option (selected: true).
|
|
29709
|
+
- 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.
|
|
29637
29710
|
|
|
29638
29711
|
RETURN STRICT VALID JSON ONLY adhering exactly to this format:
|
|
29639
29712
|
{
|