@thanh01.pmt/curriculum-kit 1.3.0 → 1.4.0
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/index.cjs +68 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +68 -12
- package/dist/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +21 -4
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +21 -4
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -166,12 +166,27 @@ interface ProduceLessonOptions {
|
|
|
166
166
|
approvedArtifacts?: string[];
|
|
167
167
|
onProgress?: (agent: string, message: string, meta?: any) => void;
|
|
168
168
|
}
|
|
169
|
+
interface ContextInjectionMeta {
|
|
170
|
+
/** Which canonical source the excerpt came from (e.g. 'KNOWLEDGE_EXPOSITION', 'LESSON'). */
|
|
171
|
+
source: string;
|
|
172
|
+
/** True when the builder excerpt passed verify (priority resolution + sufficiency). */
|
|
173
|
+
verified: boolean;
|
|
174
|
+
/** True when canonical section resolution contributed to the excerpt. */
|
|
175
|
+
sectionAware: boolean;
|
|
176
|
+
/** Structured reasons when verified === false (empty otherwise). */
|
|
177
|
+
issues: string[];
|
|
178
|
+
}
|
|
169
179
|
interface ProduceLessonResult {
|
|
170
180
|
lessonId: string;
|
|
171
181
|
pedagogy: PedagogicalModel;
|
|
172
182
|
producedArtifacts: string[];
|
|
173
183
|
pausedForReview: boolean;
|
|
174
184
|
gateStatus?: string;
|
|
185
|
+
/** P43 Cụm 5: observability for context injection — surfaced by every path
|
|
186
|
+
* (queue, standalone, batch) so callers can record telemetry / execution
|
|
187
|
+
* history without re-parsing. */
|
|
188
|
+
contextInjection?: ContextInjectionMeta;
|
|
189
|
+
promptChars?: number;
|
|
175
190
|
}
|
|
176
191
|
/**
|
|
177
192
|
* Detects pedagogical model from SOT (Framework, Style Guide, or Brief)
|
|
@@ -587,6 +602,7 @@ declare function ensureExpositionForLesson(storage: ICurriculumStorage, projectI
|
|
|
587
602
|
relPath: string;
|
|
588
603
|
context: string;
|
|
589
604
|
reused: boolean;
|
|
605
|
+
rawContent?: string;
|
|
590
606
|
} | null>;
|
|
591
607
|
|
|
592
608
|
/**
|
|
@@ -1047,4 +1063,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
|
|
|
1047
1063
|
*/
|
|
1048
1064
|
declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
|
|
1049
1065
|
|
|
1050
|
-
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactDependencyRule, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, type ContextSourceKey, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, type ValidationOptions, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonExcerpt, buildSectionAwareExcerpt, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort, validateArtifactDependencies };
|
|
1066
|
+
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactDependencyRule, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextSourceKey, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, type ValidationOptions, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonExcerpt, buildSectionAwareExcerpt, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort, validateArtifactDependencies };
|
package/dist/index.d.ts
CHANGED
|
@@ -166,12 +166,27 @@ interface ProduceLessonOptions {
|
|
|
166
166
|
approvedArtifacts?: string[];
|
|
167
167
|
onProgress?: (agent: string, message: string, meta?: any) => void;
|
|
168
168
|
}
|
|
169
|
+
interface ContextInjectionMeta {
|
|
170
|
+
/** Which canonical source the excerpt came from (e.g. 'KNOWLEDGE_EXPOSITION', 'LESSON'). */
|
|
171
|
+
source: string;
|
|
172
|
+
/** True when the builder excerpt passed verify (priority resolution + sufficiency). */
|
|
173
|
+
verified: boolean;
|
|
174
|
+
/** True when canonical section resolution contributed to the excerpt. */
|
|
175
|
+
sectionAware: boolean;
|
|
176
|
+
/** Structured reasons when verified === false (empty otherwise). */
|
|
177
|
+
issues: string[];
|
|
178
|
+
}
|
|
169
179
|
interface ProduceLessonResult {
|
|
170
180
|
lessonId: string;
|
|
171
181
|
pedagogy: PedagogicalModel;
|
|
172
182
|
producedArtifacts: string[];
|
|
173
183
|
pausedForReview: boolean;
|
|
174
184
|
gateStatus?: string;
|
|
185
|
+
/** P43 Cụm 5: observability for context injection — surfaced by every path
|
|
186
|
+
* (queue, standalone, batch) so callers can record telemetry / execution
|
|
187
|
+
* history without re-parsing. */
|
|
188
|
+
contextInjection?: ContextInjectionMeta;
|
|
189
|
+
promptChars?: number;
|
|
175
190
|
}
|
|
176
191
|
/**
|
|
177
192
|
* Detects pedagogical model from SOT (Framework, Style Guide, or Brief)
|
|
@@ -587,6 +602,7 @@ declare function ensureExpositionForLesson(storage: ICurriculumStorage, projectI
|
|
|
587
602
|
relPath: string;
|
|
588
603
|
context: string;
|
|
589
604
|
reused: boolean;
|
|
605
|
+
rawContent?: string;
|
|
590
606
|
} | null>;
|
|
591
607
|
|
|
592
608
|
/**
|
|
@@ -1047,4 +1063,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
|
|
|
1047
1063
|
*/
|
|
1048
1064
|
declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
|
|
1049
1065
|
|
|
1050
|
-
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactDependencyRule, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, type ContextSourceKey, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, type ValidationOptions, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonExcerpt, buildSectionAwareExcerpt, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort, validateArtifactDependencies };
|
|
1066
|
+
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactDependencyRule, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextSourceKey, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, type ValidationOptions, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonExcerpt, buildSectionAwareExcerpt, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort, validateArtifactDependencies };
|
package/dist/index.mjs
CHANGED
|
@@ -9831,6 +9831,7 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
|
|
|
9831
9831
|
}
|
|
9832
9832
|
const slcMap = normalizeSlcContract(opts.sectionLanguageContract);
|
|
9833
9833
|
const sections = parseMarkdownSections(source, slcMap, opts.artifactType);
|
|
9834
|
+
const metaBlock = buildMetaBlock(source);
|
|
9834
9835
|
if (sections.length === 0) {
|
|
9835
9836
|
issues.push("parse:no-sections");
|
|
9836
9837
|
const excerpt2 = truncateByBudget(source, budget);
|
|
@@ -9864,12 +9865,13 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
|
|
|
9864
9865
|
const block = `## ${heading}
|
|
9865
9866
|
|
|
9866
9867
|
${trimmedBody}`;
|
|
9867
|
-
if (used + block.length > budget &&
|
|
9868
|
+
if (used + block.length > budget && used > 0) return false;
|
|
9868
9869
|
blocks.push(block);
|
|
9869
9870
|
used += block.length;
|
|
9870
9871
|
includedSections.push(key);
|
|
9871
9872
|
return true;
|
|
9872
9873
|
};
|
|
9874
|
+
blocks.push(metaBlock);
|
|
9873
9875
|
let sectionAware = false;
|
|
9874
9876
|
for (const key of priorities) {
|
|
9875
9877
|
const sec = byCanonical.get(key);
|
|
@@ -9886,6 +9888,9 @@ ${trimmedBody}`;
|
|
|
9886
9888
|
if (used >= budget) break;
|
|
9887
9889
|
if (!tryAdd(sec.cleanTitle, sec.body, sec.cleanTitle)) break;
|
|
9888
9890
|
}
|
|
9891
|
+
if (includedSections.length === 0 && unmatched.length > 0) {
|
|
9892
|
+
issues.push("parse:no-canonical-resolution");
|
|
9893
|
+
}
|
|
9889
9894
|
if (priorities.length > 0 && !priorities.some((k) => includedSections.includes(k))) {
|
|
9890
9895
|
issues.push("parse:no-priority-resolution");
|
|
9891
9896
|
}
|
|
@@ -9894,14 +9899,14 @@ ${trimmedBody}`;
|
|
|
9894
9899
|
excerpt = truncateByBudget(excerpt, budget);
|
|
9895
9900
|
}
|
|
9896
9901
|
const effectiveMinChars = Math.min(minContentChars, source.length);
|
|
9897
|
-
if (excerpt.length < effectiveMinChars) {
|
|
9902
|
+
if (excerpt.length - metaBlock.length < effectiveMinChars) {
|
|
9898
9903
|
issues.push("content:insufficient");
|
|
9899
9904
|
}
|
|
9900
|
-
const verified = !issues.includes("parse:no-priority-resolution") && excerpt.length >= effectiveMinChars;
|
|
9905
|
+
const verified = !issues.includes("parse:no-priority-resolution") && !issues.includes("parse:no-canonical-resolution") && excerpt.length - metaBlock.length >= effectiveMinChars;
|
|
9901
9906
|
return {
|
|
9902
9907
|
excerpt,
|
|
9903
9908
|
verified,
|
|
9904
|
-
sectionAware: sectionAware ||
|
|
9909
|
+
sectionAware: sectionAware || unmatched.length === 0,
|
|
9905
9910
|
includedSections,
|
|
9906
9911
|
issues,
|
|
9907
9912
|
tokenEstimate: Math.round(excerpt.length / 4)
|
|
@@ -10017,6 +10022,18 @@ function truncateByBudget(source, budget) {
|
|
|
10017
10022
|
if (fenceCount % 2 === 1) cut += "\n```";
|
|
10018
10023
|
return cut;
|
|
10019
10024
|
}
|
|
10025
|
+
function buildMetaBlock(source) {
|
|
10026
|
+
const fm = source.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
|
|
10027
|
+
const pick = (key) => {
|
|
10028
|
+
if (!fm) return "";
|
|
10029
|
+
const m = fm[1].match(new RegExp(`^${key}:\\s*"?([^"\\n]+)"?`, "m"));
|
|
10030
|
+
return (m?.[1] || "").trim();
|
|
10031
|
+
};
|
|
10032
|
+
const id = pick("id");
|
|
10033
|
+
const title = pick("title");
|
|
10034
|
+
const type = pick("type");
|
|
10035
|
+
return `<!-- SOURCE: ${type || "ARTIFACT"} | ${id || "unknown"}${title ? ` \u2014 ${title}` : ""} (section-aware excerpt; canonical knowledge, do not contradict) -->`;
|
|
10036
|
+
}
|
|
10020
10037
|
|
|
10021
10038
|
// src/services/knowledgeExpositionService.ts
|
|
10022
10039
|
var EXPOSITION_REL = (lessonCode) => "_sot/expositions/" + lessonCode + ".md";
|
|
@@ -10165,7 +10182,7 @@ async function ensureExpositionForLesson(storage, projectId, lessonCode, options
|
|
|
10165
10182
|
storage,
|
|
10166
10183
|
gates: options.gates
|
|
10167
10184
|
});
|
|
10168
|
-
return { relPath: result.relPath, context: buildExpositionContext(result.content), reused: result.reused };
|
|
10185
|
+
return { relPath: result.relPath, context: buildExpositionContext(result.content), reused: result.reused, rawContent: result.content };
|
|
10169
10186
|
}
|
|
10170
10187
|
init_errors();
|
|
10171
10188
|
var asArr = (v) => Array.isArray(v) ? v : [];
|
|
@@ -11876,6 +11893,8 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
|
|
|
11876
11893
|
targetLang = targetLang || "vi";
|
|
11877
11894
|
const languageDirective = buildLanguageDirective(targetLang);
|
|
11878
11895
|
let expositionContext = "";
|
|
11896
|
+
let expositionInjection;
|
|
11897
|
+
let lessonInjection;
|
|
11879
11898
|
let sessionSliceContext = "";
|
|
11880
11899
|
try {
|
|
11881
11900
|
const exposition = await ensureExpositionForLesson(storage, projectId, lessonCode, {
|
|
@@ -11883,7 +11902,18 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
|
|
|
11883
11902
|
force: options.force
|
|
11884
11903
|
});
|
|
11885
11904
|
if (exposition) {
|
|
11886
|
-
|
|
11905
|
+
const expoExcerpt = buildExpositionExcerpt(exposition.rawContent || exposition.context, {
|
|
11906
|
+
budget: 6e3,
|
|
11907
|
+
sectionLanguageContract: slcMarkdown,
|
|
11908
|
+
artifactType: "KNOWLEDGE_EXPOSITION"
|
|
11909
|
+
});
|
|
11910
|
+
expositionContext = expoExcerpt.excerpt || exposition.context;
|
|
11911
|
+
expositionInjection = {
|
|
11912
|
+
source: "KNOWLEDGE_EXPOSITION",
|
|
11913
|
+
verified: expoExcerpt.verified,
|
|
11914
|
+
sectionAware: expoExcerpt.sectionAware,
|
|
11915
|
+
issues: expoExcerpt.issues
|
|
11916
|
+
};
|
|
11887
11917
|
onProgress?.("@content", `[EXPOSITION] ${exposition.reused ? "Reused" : "Generated"} \`\${exposition.relPath}\` (plan-driven knowledge source)...`);
|
|
11888
11918
|
} else {
|
|
11889
11919
|
onProgress?.("@content", "[EXPOSITION] No CURRICULUM_PLAN.json \u2014 running legacy knowledge flow (no plan-driven exposition).");
|
|
@@ -12123,6 +12153,7 @@ ${yamlBlock.trim()}
|
|
|
12123
12153
|
};
|
|
12124
12154
|
var injectYamlReviewMetadata = injectYamlReviewMetadata2;
|
|
12125
12155
|
const judgeObjectives = parseLessonObjectives(lessonContent, concept, bloomLevel);
|
|
12156
|
+
const judgeExpositionExcerpt = expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3, sectionLanguageContract: slcMarkdown, artifactType: "KNOWLEDGE_EXPOSITION" }).excerpt : void 0;
|
|
12126
12157
|
const judgeResult = await LLMJudgeEngine.evaluateArtifactWithLLM({
|
|
12127
12158
|
targetArtifactType: "LESSON",
|
|
12128
12159
|
lessonId: lessonCode,
|
|
@@ -12134,7 +12165,7 @@ ${yamlBlock.trim()}
|
|
|
12134
12165
|
title: lessonTitle,
|
|
12135
12166
|
frameworkExcerpt: framework ? buildFrameworkExcerptForLesson(framework, lessonId) : void 0,
|
|
12136
12167
|
styleGuideExcerpt: effectiveStyleGuide || void 0,
|
|
12137
|
-
canonicalExposition:
|
|
12168
|
+
canonicalExposition: judgeExpositionExcerpt
|
|
12138
12169
|
}),
|
|
12139
12170
|
standardStatements: Object.keys(standardStatements).length > 0 ? standardStatements : void 0
|
|
12140
12171
|
});
|
|
@@ -12189,6 +12220,16 @@ ${currentContent}` }],
|
|
|
12189
12220
|
options.onProgress?.("@repair", chunk, { type: type || "content", artifactType: "LESSON" });
|
|
12190
12221
|
}
|
|
12191
12222
|
);
|
|
12223
|
+
const repairedExcerptCheck = buildSectionAwareExcerpt(repairedRaw, {
|
|
12224
|
+
priorities: DEFAULT_LESSON_PRIORITIES,
|
|
12225
|
+
budget: 12e3,
|
|
12226
|
+
sectionLanguageContract: slcMarkdown,
|
|
12227
|
+
artifactType: "LESSON"
|
|
12228
|
+
});
|
|
12229
|
+
if (repairedExcerptCheck.issues.includes("parse:no-priority-resolution")) {
|
|
12230
|
+
onProgress?.("@repair", `\u26A0\uFE0F Repair round ${round} lost mandatory section structure (no priority section resolved) \u2014 rejecting repaired draft, retaining previous`);
|
|
12231
|
+
break;
|
|
12232
|
+
}
|
|
12192
12233
|
if (!repairedRaw || repairedRaw.startsWith("\u26A0\uFE0F") || repairedRaw.length < 200) {
|
|
12193
12234
|
onProgress?.("@repair", `\u26A0\uFE0F Repair round ${round} produced invalid output \u2014 stopping repair loop`);
|
|
12194
12235
|
break;
|
|
@@ -12213,7 +12254,7 @@ ${currentContent}` }],
|
|
|
12213
12254
|
title: lessonTitle,
|
|
12214
12255
|
frameworkExcerpt: framework ? buildFrameworkExcerptForLesson(framework, lessonId) : void 0,
|
|
12215
12256
|
styleGuideExcerpt: effectiveStyleGuide || void 0,
|
|
12216
|
-
canonicalExposition: expositionContext ? expositionContext
|
|
12257
|
+
canonicalExposition: expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3, sectionLanguageContract: slcMarkdown, artifactType: "KNOWLEDGE_EXPOSITION" }).excerpt : void 0
|
|
12217
12258
|
}),
|
|
12218
12259
|
standardStatements: Object.keys(standardStatements).length > 0 ? standardStatements : void 0
|
|
12219
12260
|
});
|
|
@@ -12271,7 +12312,9 @@ ${currentContent}` }],
|
|
|
12271
12312
|
pedagogy,
|
|
12272
12313
|
producedArtifacts,
|
|
12273
12314
|
pausedForReview: true,
|
|
12274
|
-
gateStatus: "judge_needs_revision"
|
|
12315
|
+
gateStatus: "judge_needs_revision",
|
|
12316
|
+
contextInjection: expositionInjection || lessonInjection,
|
|
12317
|
+
promptChars: commonContext.length
|
|
12275
12318
|
};
|
|
12276
12319
|
}
|
|
12277
12320
|
}
|
|
@@ -12294,7 +12337,9 @@ ${currentContent}` }],
|
|
|
12294
12337
|
pedagogy,
|
|
12295
12338
|
producedArtifacts,
|
|
12296
12339
|
pausedForReview: true,
|
|
12297
|
-
gateStatus: "judge_error"
|
|
12340
|
+
gateStatus: "judge_error",
|
|
12341
|
+
contextInjection: expositionInjection,
|
|
12342
|
+
promptChars: commonContext.length
|
|
12298
12343
|
};
|
|
12299
12344
|
}
|
|
12300
12345
|
}
|
|
@@ -12324,7 +12369,9 @@ ${currentContent}` }],
|
|
|
12324
12369
|
pedagogy,
|
|
12325
12370
|
producedArtifacts,
|
|
12326
12371
|
pausedForReview: true,
|
|
12327
|
-
gateStatus: "awaiting_approval"
|
|
12372
|
+
gateStatus: "awaiting_approval",
|
|
12373
|
+
contextInjection: expositionInjection,
|
|
12374
|
+
promptChars: commonContext.length
|
|
12328
12375
|
};
|
|
12329
12376
|
}
|
|
12330
12377
|
if (isLessonApproved && currentLessonInfo?.state !== "approved") {
|
|
@@ -12341,6 +12388,13 @@ ${currentContent}` }],
|
|
|
12341
12388
|
artifactType: "LESSON"
|
|
12342
12389
|
});
|
|
12343
12390
|
const lessonExcerpt = lessonExcerptResult.excerpt;
|
|
12391
|
+
const lessonInjectionMeta = {
|
|
12392
|
+
source: "LESSON",
|
|
12393
|
+
verified: lessonExcerptResult.verified,
|
|
12394
|
+
sectionAware: lessonExcerptResult.sectionAware,
|
|
12395
|
+
issues: lessonExcerptResult.issues
|
|
12396
|
+
};
|
|
12397
|
+
lessonInjection = lessonInjectionMeta;
|
|
12344
12398
|
const satelliteContext = `${commonContext}
|
|
12345
12399
|
|
|
12346
12400
|
[CANONICAL LESSON PLAN (${pedagogyLabel})]:
|
|
@@ -12980,7 +13034,9 @@ ${buildHeadingDirective("EXT", slcMarkdown, targetLang)}`;
|
|
|
12980
13034
|
lessonId: lessonCode,
|
|
12981
13035
|
pedagogy,
|
|
12982
13036
|
producedArtifacts,
|
|
12983
|
-
pausedForReview: false
|
|
13037
|
+
pausedForReview: false,
|
|
13038
|
+
contextInjection: lessonInjection && lessonInjection.verified ? expositionInjection || lessonInjection : lessonInjection || expositionInjection,
|
|
13039
|
+
promptChars: commonContext.length
|
|
12984
13040
|
};
|
|
12985
13041
|
}
|
|
12986
13042
|
function parseLessonObjectives(lessonContent, concept, bloomLevel) {
|