@thanh01.pmt/curriculum-kit 1.0.7 → 1.0.9

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.
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-C7j5LKon.cjs';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-BTTzbb-l.cjs';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -116,6 +116,8 @@ interface MediaLedgerEntry {
116
116
  status: MediaLedgerStatus;
117
117
  /** Provider đã dùng (set khi done) */
118
118
  provider?: string;
119
+ /** Inline Markdown credit (tác giả + nguồn + license) — từ multimedia-kit AttributionBuilder */
120
+ attribution?: string;
119
121
  /** Path tương đối trong project sau khi done: _media/xxx.png */
120
122
  relPath?: string;
121
123
  /** Prompt cuối (đã enrich) — audit/debug */
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-C7j5LKon.js';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-BTTzbb-l.js';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -116,6 +116,8 @@ interface MediaLedgerEntry {
116
116
  status: MediaLedgerStatus;
117
117
  /** Provider đã dùng (set khi done) */
118
118
  provider?: string;
119
+ /** Inline Markdown credit (tác giả + nguồn + license) — từ multimedia-kit AttributionBuilder */
120
+ attribution?: string;
119
121
  /** Path tương đối trong project sau khi done: _media/xxx.png */
120
122
  relPath?: string;
121
123
  /** Prompt cuối (đã enrich) — audit/debug */
@@ -649,6 +649,32 @@ Guidelines:
649
649
  3. Keep technical terminology and official API symbols intact.
650
650
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
651
651
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
652
+ if (options.customInference) {
653
+ try {
654
+ const text = await options.customInference({
655
+ systemInstruction,
656
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
657
+ messages,
658
+ temperature,
659
+ maxTokens,
660
+ onChunk: onChunk ?? (() => {
661
+ })
662
+ });
663
+ if (text && text.trim()) return text;
664
+ throw createAiInferenceError({
665
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
666
+ message: "customInference returned empty output",
667
+ rawError: { customInference: "empty response" }
668
+ });
669
+ } catch (e) {
670
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
671
+ throw createAiInferenceError({
672
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
673
+ message: `customInference failed: ${e?.message || e}`,
674
+ rawError: { customInference: String(e?.message || e) }
675
+ });
676
+ }
677
+ }
652
678
  const formattedMessages = [
653
679
  { role: "system", content: systemInstruction },
654
680
  ...messages.map((m) => ({