@intellectif/lk-core 0.19.0 → 0.20.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/CHANGELOG.md +31 -0
- package/README.md +2 -1
- package/dist/index.cjs +133 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +130 -3
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/package.json +1 -1
- package/dist/{index-bpuDhvXV.d.cts → index-7S3-TLjT.d.cts} +3 -3
- package/dist/{index-DMCM3e3P.d.ts → index-BA9f2ydg.d.ts} +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z a
|
|
|
2
2
|
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-f0bgZSTP.cjs';
|
|
3
3
|
import { ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.cjs';
|
|
4
4
|
export { AssessmentSectionInput, Band, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, DictationAlignment, DictationCharOp, DictationReference, DictationWordAlignment, GradeReadAloudOptions, PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudWordAlignment, ReadAloudWordState, RoundingMode, SPEECH_ASSESSMENT_MAX_WORDS, ScoringOptions, SectionScore, SpeechAssessment, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment } from './scoring.cjs';
|
|
5
|
-
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-
|
|
6
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
5
|
+
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-7S3-TLjT.cjs';
|
|
6
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-7S3-TLjT.cjs';
|
|
7
7
|
import { z } from 'zod/v4';
|
|
8
8
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.cjs';
|
|
9
9
|
|
|
@@ -128,6 +128,80 @@ declare function checkAiHint(raw: unknown, request: AiHintRequest): {
|
|
|
128
128
|
*/
|
|
129
129
|
declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* How a paper is delivered: what a learner is shown around the questions, as
|
|
133
|
+
* the school running it decides — separately from the content, so that one
|
|
134
|
+
* item serves a practice lesson and a final exam without being authored twice.
|
|
135
|
+
*
|
|
136
|
+
* Every setting is a RESTRICTION on what the SDK does by default, and every
|
|
137
|
+
* one defaults to `true`: an empty policy is exactly the behaviour there was
|
|
138
|
+
* before policies existed. A policy can take something away; it can never make
|
|
139
|
+
* a mode show what that mode cannot — no policy makes an `exam` reveal a grade,
|
|
140
|
+
* because the client in an exam has no answer key to grade with.
|
|
141
|
+
*/
|
|
142
|
+
interface DeliveryPolicy {
|
|
143
|
+
/**
|
|
144
|
+
* Whether a graded answer shows as graded: right and wrong marks, the score,
|
|
145
|
+
* and the author's feedback. `false` leaves the learner with "Answer
|
|
146
|
+
* submitted." — a homework quiz marked on the client and shown to the
|
|
147
|
+
* learner at the end, or a review that shows what was answered and not how
|
|
148
|
+
* it was marked. Never on in `exam`.
|
|
149
|
+
*/
|
|
150
|
+
feedback?: boolean | null;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the right answer is shown beside a wrong one, wherever an activity
|
|
153
|
+
* would show it: the correct option of a multiple-choice question, the
|
|
154
|
+
* correct answers `showCorrectAnswers` puts in the blanks, a dictation's
|
|
155
|
+
* transcript. `false` still marks what the learner answered right or wrong.
|
|
156
|
+
* Use it on a paper that will be sat again, or before a retry.
|
|
157
|
+
*/
|
|
158
|
+
solutions?: boolean | null;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the learner can ask for hints: the author's hints on a
|
|
161
|
+
* fill-in-the-blanks blank, a dictation's word hints, and AI hints. `false`
|
|
162
|
+
* switches every kind off.
|
|
163
|
+
*
|
|
164
|
+
* **The author's fill-in-the-blanks hints are on in `exam` unless this says
|
|
165
|
+
* otherwise** — they are public content, and were designed to be. Set
|
|
166
|
+
* `hints: false` on a paper of record whose hints are not part of the test.
|
|
167
|
+
*/
|
|
168
|
+
hints?: boolean | null;
|
|
169
|
+
/**
|
|
170
|
+
* The deployment's switches for AI help, beside the author's switch on the
|
|
171
|
+
* item and the ports the host supplies: a feature appears only where all
|
|
172
|
+
* three allow it. `false` switches a feature off; nothing here can switch one
|
|
173
|
+
* on, and nothing switches AI help on in an `exam`.
|
|
174
|
+
*
|
|
175
|
+
* `ai: false` switches both off and `ai: true` leaves both as the other
|
|
176
|
+
* settings allow — the same as leaving `ai` out.
|
|
177
|
+
*/
|
|
178
|
+
ai?: boolean | {
|
|
179
|
+
hints?: boolean | null;
|
|
180
|
+
explanations?: boolean | null;
|
|
181
|
+
} | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A policy with every setting spelled out: what {@link resolveDeliveryPolicy}
|
|
185
|
+
* returns, and what an attempt plan records, so the record of the conditions
|
|
186
|
+
* a learner sat a paper under never depends on a default that may one day
|
|
187
|
+
* change.
|
|
188
|
+
*/
|
|
189
|
+
interface ResolvedDeliveryPolicy {
|
|
190
|
+
feedback: boolean;
|
|
191
|
+
solutions: boolean;
|
|
192
|
+
hints: boolean;
|
|
193
|
+
ai: {
|
|
194
|
+
hints: boolean;
|
|
195
|
+
explanations: boolean;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** One thing {@link validateDeliveryPolicy} found wrong with a policy. */
|
|
199
|
+
interface DeliveryPolicyIssue {
|
|
200
|
+
/** Where, as a dotted path: `hints`, `ai.explanations`, or `''` for the policy itself. */
|
|
201
|
+
path: string;
|
|
202
|
+
message: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
131
205
|
/**
|
|
132
206
|
* The frozen record of what one attempt was served.
|
|
133
207
|
*
|
|
@@ -140,6 +214,7 @@ declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
|
140
214
|
*
|
|
141
215
|
* This is the thing you persist next to the responses.
|
|
142
216
|
*/
|
|
217
|
+
|
|
143
218
|
/** One planned position: an item, its identity, its worth, and its fingerprint. */
|
|
144
219
|
interface AttemptPlanSlot {
|
|
145
220
|
/**
|
|
@@ -227,6 +302,12 @@ interface AttemptPlan {
|
|
|
227
302
|
* later; the per-slot hashes then say WHICH item moved.
|
|
228
303
|
*/
|
|
229
304
|
planHash: string;
|
|
305
|
+
/**
|
|
306
|
+
* The delivery policy the attempt was sat under, every setting spelled out:
|
|
307
|
+
* whether feedback, solutions and hints showed, and which AI help was on.
|
|
308
|
+
* Absent when `planAttempt` was given none. Part of `planHash` when present.
|
|
309
|
+
*/
|
|
310
|
+
delivery?: ResolvedDeliveryPolicy;
|
|
230
311
|
slots: AttemptPlanSlot[];
|
|
231
312
|
/** Sum of every slot's `points`, frozen. The denominator of the paper. */
|
|
232
313
|
totalPoints: number;
|
|
@@ -257,6 +338,16 @@ interface AttemptPlanDrift {
|
|
|
257
338
|
changedPointsSlotIds: string[];
|
|
258
339
|
/** Slots presented at a different position now than they were then. */
|
|
259
340
|
reorderedSlotIds: string[];
|
|
341
|
+
/**
|
|
342
|
+
* The delivery policy differs: one plan records a policy the other does not,
|
|
343
|
+
* or a setting differs. Not a change to any question, but a change to the
|
|
344
|
+
* conditions it was asked under — hints on in one, off in the other — so it
|
|
345
|
+
* breaks `matches` like any other difference.
|
|
346
|
+
*
|
|
347
|
+
* Present only when it is `true`, so a report between two plans without a
|
|
348
|
+
* policy has exactly the shape it had before policies existed.
|
|
349
|
+
*/
|
|
350
|
+
deliveryChanged?: true;
|
|
260
351
|
}
|
|
261
352
|
|
|
262
353
|
/** Options for {@link planAttempt}. */
|
|
@@ -281,6 +372,20 @@ interface PlanAttemptOptions<TItem> {
|
|
|
281
372
|
* number — a slot worth `NaN` points would poison the whole total.
|
|
282
373
|
*/
|
|
283
374
|
points?: (slot: SequenceSlot<TItem>) => number;
|
|
375
|
+
/**
|
|
376
|
+
* The delivery policy this attempt is sat under — whether hints were
|
|
377
|
+
* offered, whether AI help was, whether feedback and solutions showed.
|
|
378
|
+
* Frozen into the plan with every setting spelled out, so the record of the
|
|
379
|
+
* conditions a grade was earned under does not depend on today's defaults.
|
|
380
|
+
*
|
|
381
|
+
* Recorded only when given: a plan made without one is byte-identical to a
|
|
382
|
+
* plan made before policies existed, `planHash` included.
|
|
383
|
+
*
|
|
384
|
+
* @throws Error when the policy does not pass `validateDeliveryPolicy` —
|
|
385
|
+
* a misspelled restriction is no restriction, and a plan is the
|
|
386
|
+
* record an appeal reads.
|
|
387
|
+
*/
|
|
388
|
+
delivery?: DeliveryPolicy | null;
|
|
284
389
|
}
|
|
285
390
|
/**
|
|
286
391
|
* Freezes what an attempt is being served: the presented order, each slot's
|
|
@@ -676,6 +781,45 @@ declare function contentHash(value: unknown): string;
|
|
|
676
781
|
*/
|
|
677
782
|
declare function countWords(text: string): number;
|
|
678
783
|
|
|
784
|
+
/**
|
|
785
|
+
* The policy that restricts nothing: every setting `true`. It is what an absent
|
|
786
|
+
* policy resolves to, and it is exactly the behaviour the SDK had before
|
|
787
|
+
* delivery policies existed.
|
|
788
|
+
*/
|
|
789
|
+
declare const OPEN_DELIVERY_POLICY: ResolvedDeliveryPolicy;
|
|
790
|
+
/**
|
|
791
|
+
* A policy with every setting spelled out — see {@link DeliveryPolicy}.
|
|
792
|
+
*
|
|
793
|
+
* Tolerant, because it runs where a learner is waiting: nothing here throws.
|
|
794
|
+
* A value it cannot read restricts rather than allows (see above), and a
|
|
795
|
+
* policy that is not an object at all restricts everything. Check a policy
|
|
796
|
+
* before you store it with {@link validateDeliveryPolicy}; `planAttempt` does.
|
|
797
|
+
*/
|
|
798
|
+
declare function resolveDeliveryPolicy(policy: unknown): ResolvedDeliveryPolicy;
|
|
799
|
+
/**
|
|
800
|
+
* The strictest of several policies: a setting is on only where every one of
|
|
801
|
+
* them leaves it on. How a course's policy and an assessment's combine, and
|
|
802
|
+
* how a pager's policy wins over whatever a question it draws was handed.
|
|
803
|
+
*/
|
|
804
|
+
declare function combineDeliveryPolicies(...policies: unknown[]): ResolvedDeliveryPolicy;
|
|
805
|
+
/**
|
|
806
|
+
* Checks a policy before it is stored: each setting `true`, `false`, `null`
|
|
807
|
+
* or absent, and nothing else — no misspelled setting, no string standing in
|
|
808
|
+
* for a boolean.
|
|
809
|
+
*
|
|
810
|
+
* Stricter than {@link resolveDeliveryPolicy} on purpose. A misspelled
|
|
811
|
+
* restriction (`hint: false`) is silently no restriction at all, and a
|
|
812
|
+
* policy is a record of the conditions a paper was sat under: it is worth
|
|
813
|
+
* refusing before it is written down, rather than read charitably after.
|
|
814
|
+
*/
|
|
815
|
+
declare function validateDeliveryPolicy(policy: unknown): {
|
|
816
|
+
success: true;
|
|
817
|
+
data: DeliveryPolicy;
|
|
818
|
+
} | {
|
|
819
|
+
success: false;
|
|
820
|
+
issues: DeliveryPolicyIssue[];
|
|
821
|
+
};
|
|
822
|
+
|
|
679
823
|
/** Thrown when activity data fails schema validation at a component boundary. */
|
|
680
824
|
declare class ActivitySchemaError extends Error {
|
|
681
825
|
readonly activityType: string;
|
|
@@ -1468,4 +1612,4 @@ interface ThemeTokens {
|
|
|
1468
1612
|
'--lk-transition-base': string;
|
|
1469
1613
|
}
|
|
1470
1614
|
|
|
1471
|
-
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AssessmentScore, type AttemptPlan, type AttemptPlanDrift, type AttemptPlanSlot, type AttemptProgress, type AttemptState, CompositionPolicy, CriterionScore, DeferredScoringError, DeferredScoringPartial, DictationData, DictationLearnerResponse, type DraftComplete, type DraftContext, type DraftIssue, type DraftNotComplete, type DraftSeverity, type DraftValidationResult, type FieldPolicy, FillInTheBlanksData, FillInTheBlanksLearnerResponse, type FlattenSequenceOptions, GapSelectData, GapSelectLearnerResponse, type GradeFromRubricOptions, GradeRecord, INTERACTIVE_VIDEO_ITEM_TYPES, type InteractiveVideoItemType, ItemGroup, ItemOutcome, LearnerResponse, type MediaBudgetRef, type MediaPlayClaim, type MediaPlayGrant, type MediaPlayLedger, type MediaPlayLedgerEntry, MediaProgress, type MissingOutcomePolicy, MultipleChoiceData, MultipleChoiceLearnerResponse, NativeControlHint, type PartialScoringResult, type PlanAttemptOptions, type PlannableEntry, ReadAloudData, ReadAloudLearnerResponse, type RedactOptions, type RedactedActivityData, type RedactedItemGroup, RedactedScoringError, type RegisteredActivityTypeDescriptor, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, composeTimelineScore, contentHash, countWords, createDraft, createInteractiveVideoDraft, createItemGroupDraft, defineActivityType, dictationType, diffResponses, entryKeyOf, fillInTheBlanksType, fingerprint, flattenSequence, gapSelectType, getActivityTypeDescriptor, gradeFromRubric, hasGrade, hashSeed, hintRevealsAnswer, isInteractiveVideoItemType, isItemGroup, multipleChoiceType, outcomeFromGrade, planAttempt, planMediaBudgets, readAiTextResult, readAloudType, readMediaProgress, redact, redactItemGroup, registerActivityType, registeredActivityTypes, resolvePlaybackPolicy, restoreAttemptState, restoreMediaPlayLedger, scoredItemsFromPlan, seededShuffle, serializeAttemptState, serializeMediaPlayLedger, slotMediaKey, stimulusMediaKey, validateDraft, validateItemGroupDraft, verifyAttemptPlan, writtenResponseType };
|
|
1615
|
+
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AssessmentScore, type AttemptPlan, type AttemptPlanDrift, type AttemptPlanSlot, type AttemptProgress, type AttemptState, CompositionPolicy, CriterionScore, DeferredScoringError, DeferredScoringPartial, type DeliveryPolicy, type DeliveryPolicyIssue, DictationData, DictationLearnerResponse, type DraftComplete, type DraftContext, type DraftIssue, type DraftNotComplete, type DraftSeverity, type DraftValidationResult, type FieldPolicy, FillInTheBlanksData, FillInTheBlanksLearnerResponse, type FlattenSequenceOptions, GapSelectData, GapSelectLearnerResponse, type GradeFromRubricOptions, GradeRecord, INTERACTIVE_VIDEO_ITEM_TYPES, type InteractiveVideoItemType, ItemGroup, ItemOutcome, LearnerResponse, type MediaBudgetRef, type MediaPlayClaim, type MediaPlayGrant, type MediaPlayLedger, type MediaPlayLedgerEntry, MediaProgress, type MissingOutcomePolicy, MultipleChoiceData, MultipleChoiceLearnerResponse, NativeControlHint, OPEN_DELIVERY_POLICY, type PartialScoringResult, type PlanAttemptOptions, type PlannableEntry, ReadAloudData, ReadAloudLearnerResponse, type RedactOptions, type RedactedActivityData, type RedactedItemGroup, RedactedScoringError, type RegisteredActivityTypeDescriptor, type ResolvedDeliveryPolicy, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, combineDeliveryPolicies, composeTimelineScore, contentHash, countWords, createDraft, createInteractiveVideoDraft, createItemGroupDraft, defineActivityType, dictationType, diffResponses, entryKeyOf, fillInTheBlanksType, fingerprint, flattenSequence, gapSelectType, getActivityTypeDescriptor, gradeFromRubric, hasGrade, hashSeed, hintRevealsAnswer, isInteractiveVideoItemType, isItemGroup, multipleChoiceType, outcomeFromGrade, planAttempt, planMediaBudgets, readAiTextResult, readAloudType, readMediaProgress, redact, redactItemGroup, registerActivityType, registeredActivityTypes, resolveDeliveryPolicy, resolvePlaybackPolicy, restoreAttemptState, restoreMediaPlayLedger, scoredItemsFromPlan, seededShuffle, serializeAttemptState, serializeMediaPlayLedger, slotMediaKey, stimulusMediaKey, validateDeliveryPolicy, validateDraft, validateItemGroupDraft, verifyAttemptPlan, writtenResponseType };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z a
|
|
|
2
2
|
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-f0bgZSTP.js';
|
|
3
3
|
import { ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.js';
|
|
4
4
|
export { AssessmentSectionInput, Band, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, DictationAlignment, DictationCharOp, DictationReference, DictationWordAlignment, GradeReadAloudOptions, PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudWordAlignment, ReadAloudWordState, RoundingMode, SPEECH_ASSESSMENT_MAX_WORDS, ScoringOptions, SectionScore, SpeechAssessment, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment } from './scoring.js';
|
|
5
|
-
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-
|
|
6
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
5
|
+
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-BA9f2ydg.js';
|
|
6
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-BA9f2ydg.js';
|
|
7
7
|
import { z } from 'zod/v4';
|
|
8
8
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.js';
|
|
9
9
|
|
|
@@ -128,6 +128,80 @@ declare function checkAiHint(raw: unknown, request: AiHintRequest): {
|
|
|
128
128
|
*/
|
|
129
129
|
declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* How a paper is delivered: what a learner is shown around the questions, as
|
|
133
|
+
* the school running it decides — separately from the content, so that one
|
|
134
|
+
* item serves a practice lesson and a final exam without being authored twice.
|
|
135
|
+
*
|
|
136
|
+
* Every setting is a RESTRICTION on what the SDK does by default, and every
|
|
137
|
+
* one defaults to `true`: an empty policy is exactly the behaviour there was
|
|
138
|
+
* before policies existed. A policy can take something away; it can never make
|
|
139
|
+
* a mode show what that mode cannot — no policy makes an `exam` reveal a grade,
|
|
140
|
+
* because the client in an exam has no answer key to grade with.
|
|
141
|
+
*/
|
|
142
|
+
interface DeliveryPolicy {
|
|
143
|
+
/**
|
|
144
|
+
* Whether a graded answer shows as graded: right and wrong marks, the score,
|
|
145
|
+
* and the author's feedback. `false` leaves the learner with "Answer
|
|
146
|
+
* submitted." — a homework quiz marked on the client and shown to the
|
|
147
|
+
* learner at the end, or a review that shows what was answered and not how
|
|
148
|
+
* it was marked. Never on in `exam`.
|
|
149
|
+
*/
|
|
150
|
+
feedback?: boolean | null;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the right answer is shown beside a wrong one, wherever an activity
|
|
153
|
+
* would show it: the correct option of a multiple-choice question, the
|
|
154
|
+
* correct answers `showCorrectAnswers` puts in the blanks, a dictation's
|
|
155
|
+
* transcript. `false` still marks what the learner answered right or wrong.
|
|
156
|
+
* Use it on a paper that will be sat again, or before a retry.
|
|
157
|
+
*/
|
|
158
|
+
solutions?: boolean | null;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the learner can ask for hints: the author's hints on a
|
|
161
|
+
* fill-in-the-blanks blank, a dictation's word hints, and AI hints. `false`
|
|
162
|
+
* switches every kind off.
|
|
163
|
+
*
|
|
164
|
+
* **The author's fill-in-the-blanks hints are on in `exam` unless this says
|
|
165
|
+
* otherwise** — they are public content, and were designed to be. Set
|
|
166
|
+
* `hints: false` on a paper of record whose hints are not part of the test.
|
|
167
|
+
*/
|
|
168
|
+
hints?: boolean | null;
|
|
169
|
+
/**
|
|
170
|
+
* The deployment's switches for AI help, beside the author's switch on the
|
|
171
|
+
* item and the ports the host supplies: a feature appears only where all
|
|
172
|
+
* three allow it. `false` switches a feature off; nothing here can switch one
|
|
173
|
+
* on, and nothing switches AI help on in an `exam`.
|
|
174
|
+
*
|
|
175
|
+
* `ai: false` switches both off and `ai: true` leaves both as the other
|
|
176
|
+
* settings allow — the same as leaving `ai` out.
|
|
177
|
+
*/
|
|
178
|
+
ai?: boolean | {
|
|
179
|
+
hints?: boolean | null;
|
|
180
|
+
explanations?: boolean | null;
|
|
181
|
+
} | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A policy with every setting spelled out: what {@link resolveDeliveryPolicy}
|
|
185
|
+
* returns, and what an attempt plan records, so the record of the conditions
|
|
186
|
+
* a learner sat a paper under never depends on a default that may one day
|
|
187
|
+
* change.
|
|
188
|
+
*/
|
|
189
|
+
interface ResolvedDeliveryPolicy {
|
|
190
|
+
feedback: boolean;
|
|
191
|
+
solutions: boolean;
|
|
192
|
+
hints: boolean;
|
|
193
|
+
ai: {
|
|
194
|
+
hints: boolean;
|
|
195
|
+
explanations: boolean;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** One thing {@link validateDeliveryPolicy} found wrong with a policy. */
|
|
199
|
+
interface DeliveryPolicyIssue {
|
|
200
|
+
/** Where, as a dotted path: `hints`, `ai.explanations`, or `''` for the policy itself. */
|
|
201
|
+
path: string;
|
|
202
|
+
message: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
131
205
|
/**
|
|
132
206
|
* The frozen record of what one attempt was served.
|
|
133
207
|
*
|
|
@@ -140,6 +214,7 @@ declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
|
140
214
|
*
|
|
141
215
|
* This is the thing you persist next to the responses.
|
|
142
216
|
*/
|
|
217
|
+
|
|
143
218
|
/** One planned position: an item, its identity, its worth, and its fingerprint. */
|
|
144
219
|
interface AttemptPlanSlot {
|
|
145
220
|
/**
|
|
@@ -227,6 +302,12 @@ interface AttemptPlan {
|
|
|
227
302
|
* later; the per-slot hashes then say WHICH item moved.
|
|
228
303
|
*/
|
|
229
304
|
planHash: string;
|
|
305
|
+
/**
|
|
306
|
+
* The delivery policy the attempt was sat under, every setting spelled out:
|
|
307
|
+
* whether feedback, solutions and hints showed, and which AI help was on.
|
|
308
|
+
* Absent when `planAttempt` was given none. Part of `planHash` when present.
|
|
309
|
+
*/
|
|
310
|
+
delivery?: ResolvedDeliveryPolicy;
|
|
230
311
|
slots: AttemptPlanSlot[];
|
|
231
312
|
/** Sum of every slot's `points`, frozen. The denominator of the paper. */
|
|
232
313
|
totalPoints: number;
|
|
@@ -257,6 +338,16 @@ interface AttemptPlanDrift {
|
|
|
257
338
|
changedPointsSlotIds: string[];
|
|
258
339
|
/** Slots presented at a different position now than they were then. */
|
|
259
340
|
reorderedSlotIds: string[];
|
|
341
|
+
/**
|
|
342
|
+
* The delivery policy differs: one plan records a policy the other does not,
|
|
343
|
+
* or a setting differs. Not a change to any question, but a change to the
|
|
344
|
+
* conditions it was asked under — hints on in one, off in the other — so it
|
|
345
|
+
* breaks `matches` like any other difference.
|
|
346
|
+
*
|
|
347
|
+
* Present only when it is `true`, so a report between two plans without a
|
|
348
|
+
* policy has exactly the shape it had before policies existed.
|
|
349
|
+
*/
|
|
350
|
+
deliveryChanged?: true;
|
|
260
351
|
}
|
|
261
352
|
|
|
262
353
|
/** Options for {@link planAttempt}. */
|
|
@@ -281,6 +372,20 @@ interface PlanAttemptOptions<TItem> {
|
|
|
281
372
|
* number — a slot worth `NaN` points would poison the whole total.
|
|
282
373
|
*/
|
|
283
374
|
points?: (slot: SequenceSlot<TItem>) => number;
|
|
375
|
+
/**
|
|
376
|
+
* The delivery policy this attempt is sat under — whether hints were
|
|
377
|
+
* offered, whether AI help was, whether feedback and solutions showed.
|
|
378
|
+
* Frozen into the plan with every setting spelled out, so the record of the
|
|
379
|
+
* conditions a grade was earned under does not depend on today's defaults.
|
|
380
|
+
*
|
|
381
|
+
* Recorded only when given: a plan made without one is byte-identical to a
|
|
382
|
+
* plan made before policies existed, `planHash` included.
|
|
383
|
+
*
|
|
384
|
+
* @throws Error when the policy does not pass `validateDeliveryPolicy` —
|
|
385
|
+
* a misspelled restriction is no restriction, and a plan is the
|
|
386
|
+
* record an appeal reads.
|
|
387
|
+
*/
|
|
388
|
+
delivery?: DeliveryPolicy | null;
|
|
284
389
|
}
|
|
285
390
|
/**
|
|
286
391
|
* Freezes what an attempt is being served: the presented order, each slot's
|
|
@@ -676,6 +781,45 @@ declare function contentHash(value: unknown): string;
|
|
|
676
781
|
*/
|
|
677
782
|
declare function countWords(text: string): number;
|
|
678
783
|
|
|
784
|
+
/**
|
|
785
|
+
* The policy that restricts nothing: every setting `true`. It is what an absent
|
|
786
|
+
* policy resolves to, and it is exactly the behaviour the SDK had before
|
|
787
|
+
* delivery policies existed.
|
|
788
|
+
*/
|
|
789
|
+
declare const OPEN_DELIVERY_POLICY: ResolvedDeliveryPolicy;
|
|
790
|
+
/**
|
|
791
|
+
* A policy with every setting spelled out — see {@link DeliveryPolicy}.
|
|
792
|
+
*
|
|
793
|
+
* Tolerant, because it runs where a learner is waiting: nothing here throws.
|
|
794
|
+
* A value it cannot read restricts rather than allows (see above), and a
|
|
795
|
+
* policy that is not an object at all restricts everything. Check a policy
|
|
796
|
+
* before you store it with {@link validateDeliveryPolicy}; `planAttempt` does.
|
|
797
|
+
*/
|
|
798
|
+
declare function resolveDeliveryPolicy(policy: unknown): ResolvedDeliveryPolicy;
|
|
799
|
+
/**
|
|
800
|
+
* The strictest of several policies: a setting is on only where every one of
|
|
801
|
+
* them leaves it on. How a course's policy and an assessment's combine, and
|
|
802
|
+
* how a pager's policy wins over whatever a question it draws was handed.
|
|
803
|
+
*/
|
|
804
|
+
declare function combineDeliveryPolicies(...policies: unknown[]): ResolvedDeliveryPolicy;
|
|
805
|
+
/**
|
|
806
|
+
* Checks a policy before it is stored: each setting `true`, `false`, `null`
|
|
807
|
+
* or absent, and nothing else — no misspelled setting, no string standing in
|
|
808
|
+
* for a boolean.
|
|
809
|
+
*
|
|
810
|
+
* Stricter than {@link resolveDeliveryPolicy} on purpose. A misspelled
|
|
811
|
+
* restriction (`hint: false`) is silently no restriction at all, and a
|
|
812
|
+
* policy is a record of the conditions a paper was sat under: it is worth
|
|
813
|
+
* refusing before it is written down, rather than read charitably after.
|
|
814
|
+
*/
|
|
815
|
+
declare function validateDeliveryPolicy(policy: unknown): {
|
|
816
|
+
success: true;
|
|
817
|
+
data: DeliveryPolicy;
|
|
818
|
+
} | {
|
|
819
|
+
success: false;
|
|
820
|
+
issues: DeliveryPolicyIssue[];
|
|
821
|
+
};
|
|
822
|
+
|
|
679
823
|
/** Thrown when activity data fails schema validation at a component boundary. */
|
|
680
824
|
declare class ActivitySchemaError extends Error {
|
|
681
825
|
readonly activityType: string;
|
|
@@ -1468,4 +1612,4 @@ interface ThemeTokens {
|
|
|
1468
1612
|
'--lk-transition-base': string;
|
|
1469
1613
|
}
|
|
1470
1614
|
|
|
1471
|
-
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AssessmentScore, type AttemptPlan, type AttemptPlanDrift, type AttemptPlanSlot, type AttemptProgress, type AttemptState, CompositionPolicy, CriterionScore, DeferredScoringError, DeferredScoringPartial, DictationData, DictationLearnerResponse, type DraftComplete, type DraftContext, type DraftIssue, type DraftNotComplete, type DraftSeverity, type DraftValidationResult, type FieldPolicy, FillInTheBlanksData, FillInTheBlanksLearnerResponse, type FlattenSequenceOptions, GapSelectData, GapSelectLearnerResponse, type GradeFromRubricOptions, GradeRecord, INTERACTIVE_VIDEO_ITEM_TYPES, type InteractiveVideoItemType, ItemGroup, ItemOutcome, LearnerResponse, type MediaBudgetRef, type MediaPlayClaim, type MediaPlayGrant, type MediaPlayLedger, type MediaPlayLedgerEntry, MediaProgress, type MissingOutcomePolicy, MultipleChoiceData, MultipleChoiceLearnerResponse, NativeControlHint, type PartialScoringResult, type PlanAttemptOptions, type PlannableEntry, ReadAloudData, ReadAloudLearnerResponse, type RedactOptions, type RedactedActivityData, type RedactedItemGroup, RedactedScoringError, type RegisteredActivityTypeDescriptor, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, composeTimelineScore, contentHash, countWords, createDraft, createInteractiveVideoDraft, createItemGroupDraft, defineActivityType, dictationType, diffResponses, entryKeyOf, fillInTheBlanksType, fingerprint, flattenSequence, gapSelectType, getActivityTypeDescriptor, gradeFromRubric, hasGrade, hashSeed, hintRevealsAnswer, isInteractiveVideoItemType, isItemGroup, multipleChoiceType, outcomeFromGrade, planAttempt, planMediaBudgets, readAiTextResult, readAloudType, readMediaProgress, redact, redactItemGroup, registerActivityType, registeredActivityTypes, resolvePlaybackPolicy, restoreAttemptState, restoreMediaPlayLedger, scoredItemsFromPlan, seededShuffle, serializeAttemptState, serializeMediaPlayLedger, slotMediaKey, stimulusMediaKey, validateDraft, validateItemGroupDraft, verifyAttemptPlan, writtenResponseType };
|
|
1615
|
+
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AssessmentScore, type AttemptPlan, type AttemptPlanDrift, type AttemptPlanSlot, type AttemptProgress, type AttemptState, CompositionPolicy, CriterionScore, DeferredScoringError, DeferredScoringPartial, type DeliveryPolicy, type DeliveryPolicyIssue, DictationData, DictationLearnerResponse, type DraftComplete, type DraftContext, type DraftIssue, type DraftNotComplete, type DraftSeverity, type DraftValidationResult, type FieldPolicy, FillInTheBlanksData, FillInTheBlanksLearnerResponse, type FlattenSequenceOptions, GapSelectData, GapSelectLearnerResponse, type GradeFromRubricOptions, GradeRecord, INTERACTIVE_VIDEO_ITEM_TYPES, type InteractiveVideoItemType, ItemGroup, ItemOutcome, LearnerResponse, type MediaBudgetRef, type MediaPlayClaim, type MediaPlayGrant, type MediaPlayLedger, type MediaPlayLedgerEntry, MediaProgress, type MissingOutcomePolicy, MultipleChoiceData, MultipleChoiceLearnerResponse, NativeControlHint, OPEN_DELIVERY_POLICY, type PartialScoringResult, type PlanAttemptOptions, type PlannableEntry, ReadAloudData, ReadAloudLearnerResponse, type RedactOptions, type RedactedActivityData, type RedactedItemGroup, RedactedScoringError, type RegisteredActivityTypeDescriptor, type ResolvedDeliveryPolicy, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, combineDeliveryPolicies, composeTimelineScore, contentHash, countWords, createDraft, createInteractiveVideoDraft, createItemGroupDraft, defineActivityType, dictationType, diffResponses, entryKeyOf, fillInTheBlanksType, fingerprint, flattenSequence, gapSelectType, getActivityTypeDescriptor, gradeFromRubric, hasGrade, hashSeed, hintRevealsAnswer, isInteractiveVideoItemType, isItemGroup, multipleChoiceType, outcomeFromGrade, planAttempt, planMediaBudgets, readAiTextResult, readAloudType, readMediaProgress, redact, redactItemGroup, registerActivityType, registeredActivityTypes, resolveDeliveryPolicy, resolvePlaybackPolicy, restoreAttemptState, restoreMediaPlayLedger, scoredItemsFromPlan, seededShuffle, serializeAttemptState, serializeMediaPlayLedger, slotMediaKey, stimulusMediaKey, validateDeliveryPolicy, validateDraft, validateItemGroupDraft, verifyAttemptPlan, writtenResponseType };
|
package/dist/index.js
CHANGED
|
@@ -208,6 +208,106 @@ function contentHash(value) {
|
|
|
208
208
|
return fingerprint(canonicalJson(value));
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
// src/delivery.ts
|
|
212
|
+
var OPEN_DELIVERY_POLICY = Object.freeze({
|
|
213
|
+
feedback: true,
|
|
214
|
+
solutions: true,
|
|
215
|
+
hints: true,
|
|
216
|
+
ai: Object.freeze({ hints: true, explanations: true })
|
|
217
|
+
});
|
|
218
|
+
var SETTINGS = ["feedback", "solutions", "hints"];
|
|
219
|
+
var AI_SETTINGS = ["hints", "explanations"];
|
|
220
|
+
function allows(value) {
|
|
221
|
+
return value === void 0 || value === null || value === true;
|
|
222
|
+
}
|
|
223
|
+
function resolveDeliveryPolicy(policy) {
|
|
224
|
+
if (policy === void 0 || policy === null) {
|
|
225
|
+
return OPEN_DELIVERY_POLICY;
|
|
226
|
+
}
|
|
227
|
+
if (typeof policy !== "object" || Array.isArray(policy)) {
|
|
228
|
+
return {
|
|
229
|
+
feedback: false,
|
|
230
|
+
solutions: false,
|
|
231
|
+
hints: false,
|
|
232
|
+
ai: { hints: false, explanations: false }
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const given = policy;
|
|
236
|
+
const ai = given.ai;
|
|
237
|
+
const aiGiven = ai === void 0 || ai === null || ai === true ? {} : typeof ai === "object" && !Array.isArray(ai) ? ai : { hints: false, explanations: false };
|
|
238
|
+
return {
|
|
239
|
+
feedback: allows(given.feedback),
|
|
240
|
+
solutions: allows(given.solutions),
|
|
241
|
+
hints: allows(given.hints),
|
|
242
|
+
ai: { hints: allows(aiGiven.hints), explanations: allows(aiGiven.explanations) }
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function combineDeliveryPolicies(...policies) {
|
|
246
|
+
const resolved = policies.map(resolveDeliveryPolicy);
|
|
247
|
+
const every = (read) => resolved.every(read);
|
|
248
|
+
return {
|
|
249
|
+
feedback: every((one) => one.feedback),
|
|
250
|
+
solutions: every((one) => one.solutions),
|
|
251
|
+
hints: every((one) => one.hints),
|
|
252
|
+
ai: {
|
|
253
|
+
hints: every((one) => one.ai.hints),
|
|
254
|
+
explanations: every((one) => one.ai.explanations)
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function validateDeliveryPolicy(policy) {
|
|
259
|
+
const issues = [];
|
|
260
|
+
if (policy === void 0 || policy === null) {
|
|
261
|
+
return { success: true, data: {} };
|
|
262
|
+
}
|
|
263
|
+
if (typeof policy !== "object" || Array.isArray(policy)) {
|
|
264
|
+
return {
|
|
265
|
+
success: false,
|
|
266
|
+
issues: [{ path: "", message: "A delivery policy is an object of settings." }]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const given = policy;
|
|
270
|
+
for (const key of Object.keys(given)) {
|
|
271
|
+
if (key === "ai") {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (!SETTINGS.includes(key)) {
|
|
275
|
+
issues.push({
|
|
276
|
+
path: key,
|
|
277
|
+
message: `"${key}" is not a delivery setting. The settings are feedback, solutions, hints and ai.`
|
|
278
|
+
});
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
const value = given[key];
|
|
282
|
+
if (value !== true && value !== false && value !== null && value !== void 0) {
|
|
283
|
+
issues.push({ path: key, message: `"${key}" must be true, false or null.` });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const ai = given.ai;
|
|
287
|
+
if (ai !== void 0 && ai !== null && ai !== true && ai !== false) {
|
|
288
|
+
if (typeof ai !== "object" || Array.isArray(ai)) {
|
|
289
|
+
issues.push({
|
|
290
|
+
path: "ai",
|
|
291
|
+
message: '"ai" must be true, false, or an object of hints and explanations.'
|
|
292
|
+
});
|
|
293
|
+
} else {
|
|
294
|
+
for (const [key, value] of Object.entries(ai)) {
|
|
295
|
+
if (!AI_SETTINGS.includes(key)) {
|
|
296
|
+
issues.push({
|
|
297
|
+
path: `ai.${key}`,
|
|
298
|
+
message: `"ai.${key}" is not an AI setting. The settings are hints and explanations.`
|
|
299
|
+
});
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (value !== true && value !== false && value !== null && value !== void 0) {
|
|
303
|
+
issues.push({ path: `ai.${key}`, message: `"ai.${key}" must be true, false or null.` });
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return issues.length > 0 ? { success: false, issues } : { success: true, data: given };
|
|
309
|
+
}
|
|
310
|
+
|
|
211
311
|
// src/shuffle.ts
|
|
212
312
|
function hashSeed(input) {
|
|
213
313
|
let h = 2166136261 >>> 0;
|
|
@@ -511,6 +611,7 @@ function planSlot(slot, points) {
|
|
|
511
611
|
}
|
|
512
612
|
function planAttempt(entries, options = {}) {
|
|
513
613
|
const { seed, shuffleEntries, points } = options;
|
|
614
|
+
const delivery = frozenDelivery(options.delivery);
|
|
514
615
|
const slots = flattenSequence(entries, {
|
|
515
616
|
...shuffleEntries !== void 0 ? { shuffleEntries } : {},
|
|
516
617
|
...seed !== void 0 ? { seed } : {}
|
|
@@ -525,7 +626,11 @@ function planAttempt(entries, options = {}) {
|
|
|
525
626
|
// The plan's own fingerprint covers the slots verbatim — identity, order,
|
|
526
627
|
// points and content hashes — so one stored value answers "is this still
|
|
527
628
|
// the paper that was sat?" and the per-slot hashes then say what moved.
|
|
528
|
-
|
|
629
|
+
// A policy joins it when there is one: the same paper sat with hints and
|
|
630
|
+
// without is two different attempts. Without one, the fingerprint is the
|
|
631
|
+
// one every plan before policies had.
|
|
632
|
+
planHash: contentHash(delivery === void 0 ? planned : { slots: planned, delivery }),
|
|
633
|
+
...delivery !== void 0 ? { delivery } : {},
|
|
529
634
|
slots: planned,
|
|
530
635
|
totalPoints
|
|
531
636
|
};
|
|
@@ -540,6 +645,7 @@ function verifyAttemptPlan(plan, current) {
|
|
|
540
645
|
const changedCueSlotIds = [];
|
|
541
646
|
const changedPointsSlotIds = [];
|
|
542
647
|
const reorderedSlotIds = [];
|
|
648
|
+
const deliveryChanged = contentHash(plan.delivery ?? null) !== contentHash(current.delivery ?? null);
|
|
543
649
|
for (const slot of plan.slots) {
|
|
544
650
|
const now = after.get(slot.slotId);
|
|
545
651
|
if (now === void 0) {
|
|
@@ -562,16 +668,33 @@ function verifyAttemptPlan(plan, current) {
|
|
|
562
668
|
}
|
|
563
669
|
}
|
|
564
670
|
return {
|
|
565
|
-
matches: missingSlotIds.length === 0 && addedSlotIds.length === 0 && changedSlotIds.length === 0 && changedStimulusSlotIds.length === 0 && changedCueSlotIds.length === 0 && changedPointsSlotIds.length === 0 && reorderedSlotIds.length === 0,
|
|
671
|
+
matches: missingSlotIds.length === 0 && addedSlotIds.length === 0 && changedSlotIds.length === 0 && changedStimulusSlotIds.length === 0 && changedCueSlotIds.length === 0 && changedPointsSlotIds.length === 0 && reorderedSlotIds.length === 0 && !deliveryChanged,
|
|
566
672
|
missingSlotIds,
|
|
567
673
|
addedSlotIds,
|
|
568
674
|
changedSlotIds,
|
|
569
675
|
changedStimulusSlotIds,
|
|
570
676
|
changedCueSlotIds,
|
|
571
677
|
changedPointsSlotIds,
|
|
572
|
-
reorderedSlotIds
|
|
678
|
+
reorderedSlotIds,
|
|
679
|
+
// Present only when it is true, as `rejectedSlotIds` is on a composed
|
|
680
|
+
// score: a drift report between two plans without a policy — every one
|
|
681
|
+
// written before policies existed — keeps exactly the shape it had.
|
|
682
|
+
...deliveryChanged ? { deliveryChanged: true } : {}
|
|
573
683
|
};
|
|
574
684
|
}
|
|
685
|
+
function frozenDelivery(policy) {
|
|
686
|
+
if (policy === void 0 || policy === null) {
|
|
687
|
+
return void 0;
|
|
688
|
+
}
|
|
689
|
+
const checked = validateDeliveryPolicy(policy);
|
|
690
|
+
if (!checked.success) {
|
|
691
|
+
const first = checked.issues[0];
|
|
692
|
+
throw new Error(
|
|
693
|
+
`planAttempt: the delivery policy is not one to record \u2014 ${first?.message ?? "invalid"}` + (checked.issues.length > 1 ? ` (and ${checked.issues.length - 1} more)` : "")
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
return resolveDeliveryPolicy(checked.data);
|
|
697
|
+
}
|
|
575
698
|
function missingOutcome(slot, policy) {
|
|
576
699
|
if (typeof policy === "function") {
|
|
577
700
|
return policy(slot);
|
|
@@ -1537,6 +1660,7 @@ export {
|
|
|
1537
1660
|
MultipleChoiceOptionMediaSchema,
|
|
1538
1661
|
MultipleChoiceOptionSchema,
|
|
1539
1662
|
NativeControlHintSchema,
|
|
1663
|
+
OPEN_DELIVERY_POLICY,
|
|
1540
1664
|
READ_ALOUD_MAX_DIMENSION_WEIGHT,
|
|
1541
1665
|
READ_ALOUD_MAX_REFERENCE_LENGTH,
|
|
1542
1666
|
READ_ALOUD_MAX_SECONDS,
|
|
@@ -1589,6 +1713,7 @@ export {
|
|
|
1589
1713
|
checkAiExplanation,
|
|
1590
1714
|
checkAiHint,
|
|
1591
1715
|
classifyBand,
|
|
1716
|
+
combineDeliveryPolicies,
|
|
1592
1717
|
composeAssessmentScore,
|
|
1593
1718
|
composeTimelineScore,
|
|
1594
1719
|
computePassThreshold,
|
|
@@ -1639,6 +1764,7 @@ export {
|
|
|
1639
1764
|
redactItemGroup,
|
|
1640
1765
|
registerActivityType,
|
|
1641
1766
|
registeredActivityTypes,
|
|
1767
|
+
resolveDeliveryPolicy,
|
|
1642
1768
|
resolvePlaybackPolicy,
|
|
1643
1769
|
restoreAttemptState,
|
|
1644
1770
|
restoreMediaPlayLedger,
|
|
@@ -1652,6 +1778,7 @@ export {
|
|
|
1652
1778
|
stimulusJsonSchema,
|
|
1653
1779
|
stimulusMediaKey,
|
|
1654
1780
|
validateActivity,
|
|
1781
|
+
validateDeliveryPolicy,
|
|
1655
1782
|
validateDraft,
|
|
1656
1783
|
validateItemGroup,
|
|
1657
1784
|
validateItemGroupDraft,
|