@thanh01.pmt/curriculum-kit 1.0.12 → 1.0.14
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/gateSettings-DKXRztJy.d.cts +119 -0
- package/dist/gateSettings-DKXRztJy.d.ts +119 -0
- package/dist/index.cjs +1336 -1921
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -7
- package/dist/index.d.ts +63 -7
- package/dist/index.mjs +1331 -1898
- package/dist/index.mjs.map +1 -1
- package/dist/standards/index.d.cts +2 -2
- package/dist/standards/index.d.ts +2 -2
- package/dist/{standardsCoverageGate-BWAkXY76.d.cts → standardsCoverageGate-CsUNzv6C.d.cts} +1 -1
- package/dist/{standardsCoverageGate-BWAkXY76.d.ts → standardsCoverageGate-CsUNzv6C.d.ts} +1 -1
- package/dist/workflow/index.d.cts +298 -7
- package/dist/workflow/index.d.ts +298 -7
- package/package.json +1 -1
- package/dist/index-B8lOdFuz.d.ts +0 -414
- package/dist/index-DhxvfPoW.d.cts +0 -414
package/dist/index.d.cts
CHANGED
|
@@ -9,10 +9,10 @@ export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as Ge
|
|
|
9
9
|
import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-BUJGYiep.cjs';
|
|
10
10
|
export { b as ArtifactLifecycleInfo, A as ArtifactLifecycleState, L as LessonArtifactSummary, c as PipelineState, R as ReviewRecord, a as SotDocument, T as TaskLifecycleState } from './types-BUJGYiep.cjs';
|
|
11
11
|
export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FILES, StorageFactoryOptions, SupabaseCurriculumAdapter, SupabaseStorageConfig, computeContentHash, createCurriculumStorage } from './storage/index.cjs';
|
|
12
|
-
import { F as FrameworkPack } from './standardsCoverageGate-
|
|
13
|
-
export { B as BloomHintSchema,
|
|
14
|
-
import { R as ResolvedGateSettings } from './
|
|
15
|
-
export {
|
|
12
|
+
import { F as FrameworkPack } from './standardsCoverageGate-CsUNzv6C.cjs';
|
|
13
|
+
export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, C as CoverageGateReport, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, g as FrameworkStatement, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from './standardsCoverageGate-CsUNzv6C.cjs';
|
|
14
|
+
import { R as ResolvedGateSettings } from './gateSettings-DKXRztJy.cjs';
|
|
15
|
+
export { A as ArtifactType, b as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, G as GateSettings, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, p as parseGateSettings, r as resolveGateSettings } from './gateSettings-DKXRztJy.cjs';
|
|
16
16
|
export { DeliveryPackResult, JobManifest, LocalWorkspaceManager, ParsedQuizQuestion, buildDeliveryPackages, exportAllProjectQuizzes, formatQuizzesToCsv, parseQuizMarkdown } from './publishers/index.cjs';
|
|
17
17
|
export { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult, p as publishToGitHub, c as publishToSupabase, u as uploadAssetToBucket } from './supabasePublisher-C627qXFT.cjs';
|
|
18
18
|
export { BUNDLED_STANDARDS_PACK_IDS, HydratedPack, ImportPackResult, SelectedStatement, StandardStackOptions, StandardsRegistryAdapter, StandardsRegistryConfig, StandardsSelectionInput, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, resolveStandardsPacks, selectStatementsForLesson } from './standards/index.cjs';
|
|
@@ -20,7 +20,6 @@ export { CurateOptions, CurationDecision, FulfillOptions, FulfillResult, GenCand
|
|
|
20
20
|
import 'zod';
|
|
21
21
|
import 'ai';
|
|
22
22
|
import '@supabase/supabase-js';
|
|
23
|
-
import 'workflow';
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Service to generate high-level status, readiness reports, and resume guidance.
|
|
@@ -335,6 +334,10 @@ interface LayerPrefillOptions {
|
|
|
335
334
|
stream?: boolean;
|
|
336
335
|
model?: string;
|
|
337
336
|
provider?: AIProviderName;
|
|
337
|
+
/** Total wall-time budget override for this prefill run (ms). */
|
|
338
|
+
timeoutMs?: number;
|
|
339
|
+
/** Idle (no-data) budget override for this prefill run (ms). */
|
|
340
|
+
idleTimeoutMs?: number;
|
|
338
341
|
}
|
|
339
342
|
interface PreliminaryResearchResult {
|
|
340
343
|
groundTruthSummary: string;
|
|
@@ -351,6 +354,59 @@ interface LayerPrefillResult {
|
|
|
351
354
|
rawText?: string;
|
|
352
355
|
}
|
|
353
356
|
type LayerChunkCallback = (chunk: string, type: 'thought' | 'content') => void;
|
|
357
|
+
/** Budget knobs for a streamed inference (see createStreamAbortSignal). */
|
|
358
|
+
interface StreamBudget {
|
|
359
|
+
/** Abort when no data arrives for this long (ms). 0 disables. */
|
|
360
|
+
idleMs?: number;
|
|
361
|
+
/** Abort when the whole stream exceeds this total wall time (ms). 0 disables. */
|
|
362
|
+
totalMs?: number;
|
|
363
|
+
}
|
|
364
|
+
declare const DEFAULT_STREAM_IDLE_MS = 45000;
|
|
365
|
+
declare const DEFAULT_STREAM_TOTAL_MS = 300000;
|
|
366
|
+
/** Layer-aware total budget: Layer 2 is the largest prefill output (6 fields × options pros/cons). */
|
|
367
|
+
declare const LAYER_TOTAL_BUDGET_MS: Record<number, number>;
|
|
368
|
+
/**
|
|
369
|
+
* Resolve the abort budget for a prefill run. Precedence: explicit options >
|
|
370
|
+
* env (`WIZARD_PREFILL_IDLE_TIMEOUT_MS` / `WIZARD_PREFILL_TOTAL_TIMEOUT_MS`) >
|
|
371
|
+
* layer-aware defaults. Exposed as a pure function for decision-table tests.
|
|
372
|
+
*/
|
|
373
|
+
declare function resolveStreamBudget(layer?: number, opts?: StreamBudget): Required<StreamBudget>;
|
|
374
|
+
/**
|
|
375
|
+
* Abort signal combining an IDLE window with an optional TOTAL cap.
|
|
376
|
+
* RC-W1: `AbortSignal.timeout(60_000)` hard-killed Layer 2 mid-stream even while
|
|
377
|
+
* tokens were flowing (free-tier models think + stream slowly) — the aborted
|
|
378
|
+
* `fullContent` then failed `safeParseJson` (empty or truncated JSON).
|
|
379
|
+
* The idle window only fires when NO data arrives (hung connection), while a
|
|
380
|
+
* generous layer-aware total cap is the safety net.
|
|
381
|
+
*/
|
|
382
|
+
interface StreamAbortHandle {
|
|
383
|
+
signal: AbortSignal;
|
|
384
|
+
/** Reset the idle window — call on EVERY received stream part. */
|
|
385
|
+
kick: () => void;
|
|
386
|
+
/** Clear both timers once the stream lifecycle is over. */
|
|
387
|
+
dispose: () => void;
|
|
388
|
+
}
|
|
389
|
+
/** Chunks extracted from one raw Vercel AI SDK stream part. */
|
|
390
|
+
interface ExtractedStreamChunk {
|
|
391
|
+
/** Reasoning/thinking text to forward via onChunk(chunk, 'thought'). */
|
|
392
|
+
thought?: string;
|
|
393
|
+
/** Content text to forward via onChunk(chunk, 'content') and accumulate. */
|
|
394
|
+
content?: string;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* RC-W2: extract reasoning + content from a Vercel AI SDK fullStream part.
|
|
398
|
+
* Pure function so the extraction contract is unit-testable.
|
|
399
|
+
*
|
|
400
|
+
* Reasoning arrives through provider-specific shapes:
|
|
401
|
+
* - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers),
|
|
402
|
+
* - `raw` parts (emitted when `includeRawChunks: true`) whose `rawValue` is the
|
|
403
|
+
* provider's OpenAI-compatible SSE chunk: NVIDIA NIM & DeepSeek put thinking
|
|
404
|
+
* in `choices[0].delta.reasoning_content`, OpenRouter in `choices[0].delta.reasoning`.
|
|
405
|
+
* Without this extraction the entire thinking phase renders as a blank UI
|
|
406
|
+
* (only text-delta reaches the caller) — the observed ~30s silent wait.
|
|
407
|
+
*/
|
|
408
|
+
declare function extractStreamChunk(part: any): ExtractedStreamChunk;
|
|
409
|
+
declare function createStreamAbortSignal(budget: Required<StreamBudget>): StreamAbortHandle;
|
|
354
410
|
/**
|
|
355
411
|
* Robust JSON extraction and repair helper
|
|
356
412
|
*/
|
|
@@ -359,7 +415,7 @@ declare function safeParseJson<T = any>(rawText: string | null): T | null;
|
|
|
359
415
|
/**
|
|
360
416
|
* Multi-tiered resilient streaming inference helper using 100% Vercel AI SDK.
|
|
361
417
|
*/
|
|
362
|
-
declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName): Promise<string | null>;
|
|
418
|
+
declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName, budget?: StreamBudget): Promise<string | null>;
|
|
363
419
|
/**
|
|
364
420
|
* Conducts preliminary ecosystem research for a course project.
|
|
365
421
|
*/
|
|
@@ -858,4 +914,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
|
|
|
858
914
|
*/
|
|
859
915
|
declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
|
|
860
916
|
|
|
861
|
-
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, 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, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, 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, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
|
|
917
|
+
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, 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, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, 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, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as Ge
|
|
|
9
9
|
import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-BUJGYiep.js';
|
|
10
10
|
export { b as ArtifactLifecycleInfo, A as ArtifactLifecycleState, L as LessonArtifactSummary, c as PipelineState, R as ReviewRecord, a as SotDocument, T as TaskLifecycleState } from './types-BUJGYiep.js';
|
|
11
11
|
export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FILES, StorageFactoryOptions, SupabaseCurriculumAdapter, SupabaseStorageConfig, computeContentHash, createCurriculumStorage } from './storage/index.js';
|
|
12
|
-
import { F as FrameworkPack } from './standardsCoverageGate-
|
|
13
|
-
export { B as BloomHintSchema,
|
|
14
|
-
import { R as ResolvedGateSettings } from './
|
|
15
|
-
export {
|
|
12
|
+
import { F as FrameworkPack } from './standardsCoverageGate-CsUNzv6C.js';
|
|
13
|
+
export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, C as CoverageGateReport, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, g as FrameworkStatement, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from './standardsCoverageGate-CsUNzv6C.js';
|
|
14
|
+
import { R as ResolvedGateSettings } from './gateSettings-DKXRztJy.js';
|
|
15
|
+
export { A as ArtifactType, b as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, G as GateSettings, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, p as parseGateSettings, r as resolveGateSettings } from './gateSettings-DKXRztJy.js';
|
|
16
16
|
export { DeliveryPackResult, JobManifest, LocalWorkspaceManager, ParsedQuizQuestion, buildDeliveryPackages, exportAllProjectQuizzes, formatQuizzesToCsv, parseQuizMarkdown } from './publishers/index.js';
|
|
17
17
|
export { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult, p as publishToGitHub, c as publishToSupabase, u as uploadAssetToBucket } from './supabasePublisher-C627qXFT.js';
|
|
18
18
|
export { BUNDLED_STANDARDS_PACK_IDS, HydratedPack, ImportPackResult, SelectedStatement, StandardStackOptions, StandardsRegistryAdapter, StandardsRegistryConfig, StandardsSelectionInput, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, resolveStandardsPacks, selectStatementsForLesson } from './standards/index.js';
|
|
@@ -20,7 +20,6 @@ export { CurateOptions, CurationDecision, FulfillOptions, FulfillResult, GenCand
|
|
|
20
20
|
import 'zod';
|
|
21
21
|
import 'ai';
|
|
22
22
|
import '@supabase/supabase-js';
|
|
23
|
-
import 'workflow';
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Service to generate high-level status, readiness reports, and resume guidance.
|
|
@@ -335,6 +334,10 @@ interface LayerPrefillOptions {
|
|
|
335
334
|
stream?: boolean;
|
|
336
335
|
model?: string;
|
|
337
336
|
provider?: AIProviderName;
|
|
337
|
+
/** Total wall-time budget override for this prefill run (ms). */
|
|
338
|
+
timeoutMs?: number;
|
|
339
|
+
/** Idle (no-data) budget override for this prefill run (ms). */
|
|
340
|
+
idleTimeoutMs?: number;
|
|
338
341
|
}
|
|
339
342
|
interface PreliminaryResearchResult {
|
|
340
343
|
groundTruthSummary: string;
|
|
@@ -351,6 +354,59 @@ interface LayerPrefillResult {
|
|
|
351
354
|
rawText?: string;
|
|
352
355
|
}
|
|
353
356
|
type LayerChunkCallback = (chunk: string, type: 'thought' | 'content') => void;
|
|
357
|
+
/** Budget knobs for a streamed inference (see createStreamAbortSignal). */
|
|
358
|
+
interface StreamBudget {
|
|
359
|
+
/** Abort when no data arrives for this long (ms). 0 disables. */
|
|
360
|
+
idleMs?: number;
|
|
361
|
+
/** Abort when the whole stream exceeds this total wall time (ms). 0 disables. */
|
|
362
|
+
totalMs?: number;
|
|
363
|
+
}
|
|
364
|
+
declare const DEFAULT_STREAM_IDLE_MS = 45000;
|
|
365
|
+
declare const DEFAULT_STREAM_TOTAL_MS = 300000;
|
|
366
|
+
/** Layer-aware total budget: Layer 2 is the largest prefill output (6 fields × options pros/cons). */
|
|
367
|
+
declare const LAYER_TOTAL_BUDGET_MS: Record<number, number>;
|
|
368
|
+
/**
|
|
369
|
+
* Resolve the abort budget for a prefill run. Precedence: explicit options >
|
|
370
|
+
* env (`WIZARD_PREFILL_IDLE_TIMEOUT_MS` / `WIZARD_PREFILL_TOTAL_TIMEOUT_MS`) >
|
|
371
|
+
* layer-aware defaults. Exposed as a pure function for decision-table tests.
|
|
372
|
+
*/
|
|
373
|
+
declare function resolveStreamBudget(layer?: number, opts?: StreamBudget): Required<StreamBudget>;
|
|
374
|
+
/**
|
|
375
|
+
* Abort signal combining an IDLE window with an optional TOTAL cap.
|
|
376
|
+
* RC-W1: `AbortSignal.timeout(60_000)` hard-killed Layer 2 mid-stream even while
|
|
377
|
+
* tokens were flowing (free-tier models think + stream slowly) — the aborted
|
|
378
|
+
* `fullContent` then failed `safeParseJson` (empty or truncated JSON).
|
|
379
|
+
* The idle window only fires when NO data arrives (hung connection), while a
|
|
380
|
+
* generous layer-aware total cap is the safety net.
|
|
381
|
+
*/
|
|
382
|
+
interface StreamAbortHandle {
|
|
383
|
+
signal: AbortSignal;
|
|
384
|
+
/** Reset the idle window — call on EVERY received stream part. */
|
|
385
|
+
kick: () => void;
|
|
386
|
+
/** Clear both timers once the stream lifecycle is over. */
|
|
387
|
+
dispose: () => void;
|
|
388
|
+
}
|
|
389
|
+
/** Chunks extracted from one raw Vercel AI SDK stream part. */
|
|
390
|
+
interface ExtractedStreamChunk {
|
|
391
|
+
/** Reasoning/thinking text to forward via onChunk(chunk, 'thought'). */
|
|
392
|
+
thought?: string;
|
|
393
|
+
/** Content text to forward via onChunk(chunk, 'content') and accumulate. */
|
|
394
|
+
content?: string;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* RC-W2: extract reasoning + content from a Vercel AI SDK fullStream part.
|
|
398
|
+
* Pure function so the extraction contract is unit-testable.
|
|
399
|
+
*
|
|
400
|
+
* Reasoning arrives through provider-specific shapes:
|
|
401
|
+
* - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers),
|
|
402
|
+
* - `raw` parts (emitted when `includeRawChunks: true`) whose `rawValue` is the
|
|
403
|
+
* provider's OpenAI-compatible SSE chunk: NVIDIA NIM & DeepSeek put thinking
|
|
404
|
+
* in `choices[0].delta.reasoning_content`, OpenRouter in `choices[0].delta.reasoning`.
|
|
405
|
+
* Without this extraction the entire thinking phase renders as a blank UI
|
|
406
|
+
* (only text-delta reaches the caller) — the observed ~30s silent wait.
|
|
407
|
+
*/
|
|
408
|
+
declare function extractStreamChunk(part: any): ExtractedStreamChunk;
|
|
409
|
+
declare function createStreamAbortSignal(budget: Required<StreamBudget>): StreamAbortHandle;
|
|
354
410
|
/**
|
|
355
411
|
* Robust JSON extraction and repair helper
|
|
356
412
|
*/
|
|
@@ -359,7 +415,7 @@ declare function safeParseJson<T = any>(rawText: string | null): T | null;
|
|
|
359
415
|
/**
|
|
360
416
|
* Multi-tiered resilient streaming inference helper using 100% Vercel AI SDK.
|
|
361
417
|
*/
|
|
362
|
-
declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName): Promise<string | null>;
|
|
418
|
+
declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName, budget?: StreamBudget): Promise<string | null>;
|
|
363
419
|
/**
|
|
364
420
|
* Conducts preliminary ecosystem research for a course project.
|
|
365
421
|
*/
|
|
@@ -858,4 +914,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
|
|
|
858
914
|
*/
|
|
859
915
|
declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
|
|
860
916
|
|
|
861
|
-
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, 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, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, 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, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
|
|
917
|
+
export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, 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, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, 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, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
|