@intellectif/lk-core 0.22.0 → 1.1.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 +30 -0
- package/README.md +6 -6
- package/dist/{activity-CYc7SD3d.d.cts → activity-MBOYLBjR.d.cts} +128 -22
- package/dist/{activity-CYc7SD3d.d.ts → activity-MBOYLBjR.d.ts} +128 -22
- package/dist/ai-check.cjs +138 -9
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +6 -3
- package/dist/ai-check.d.ts +6 -3
- package/dist/ai-check.js +133 -4
- package/dist/ai-check.js.map +1 -1
- package/dist/{chunk-2CV6NU32.cjs → chunk-2JT2WUQ2.cjs} +77 -39
- package/dist/chunk-2JT2WUQ2.cjs.map +1 -0
- package/dist/{chunk-D4TOPSHV.cjs → chunk-DSDXL3JO.cjs} +1216 -1105
- package/dist/chunk-DSDXL3JO.cjs.map +1 -0
- package/dist/{chunk-D3GP5MET.js → chunk-FBKTION6.js} +1093 -982
- package/dist/chunk-FBKTION6.js.map +1 -0
- package/dist/{chunk-Q7MV3IXJ.js → chunk-IARLJ5MW.js} +15 -16
- package/dist/chunk-IARLJ5MW.js.map +1 -0
- package/dist/{chunk-OPMY2MNS.cjs → chunk-LDFQUZII.cjs} +248 -22
- package/dist/chunk-LDFQUZII.cjs.map +1 -0
- package/dist/{chunk-5UCR4UNR.js → chunk-NQHETFDA.js} +238 -12
- package/dist/chunk-NQHETFDA.js.map +1 -0
- package/dist/{chunk-X5DAXBJI.js → chunk-SJVRUPJT.js} +2 -2
- package/dist/{chunk-EOFWSGLU.cjs → chunk-TJJFKKH2.cjs} +4 -4
- package/dist/{chunk-EOFWSGLU.cjs.map → chunk-TJJFKKH2.cjs.map} +1 -1
- package/dist/{chunk-WQVZPIN7.cjs → chunk-VSH7ECQL.cjs} +44 -45
- package/dist/chunk-VSH7ECQL.cjs.map +1 -0
- package/dist/{chunk-Z7QQZ53L.js → chunk-XS6U2ARZ.js} +70 -32
- package/dist/chunk-XS6U2ARZ.js.map +1 -0
- package/dist/index-DlCW0XaQ.d.cts +548 -0
- package/dist/index-DlcqkM_L.d.ts +548 -0
- package/dist/index.cjs +129 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +178 -21
- package/dist/index.d.ts +178 -21
- package/dist/index.js +34 -103
- package/dist/index.js.map +1 -1
- package/dist/schemas.cjs +3 -94
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +2 -3
- package/dist/schemas.d.ts +2 -3
- package/dist/schemas.js +6 -97
- package/dist/scoring.cjs +3 -3
- package/dist/scoring.d.cts +242 -242
- package/dist/scoring.d.ts +242 -242
- package/dist/scoring.js +2 -2
- package/dist/xapi.cjs +3 -3
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/dist/xapi.js +2 -2
- package/package.json +4 -4
- package/vectors/README.md +32 -2
- package/vectors/scoring.json +1 -498
- package/vectors/validation.json +6742 -0
- package/vectors/validation.mjs +195 -0
- package/dist/chunk-2CV6NU32.cjs.map +0 -1
- package/dist/chunk-5UCR4UNR.js.map +0 -1
- package/dist/chunk-D3GP5MET.js.map +0 -1
- package/dist/chunk-D4TOPSHV.cjs.map +0 -1
- package/dist/chunk-OPMY2MNS.cjs.map +0 -1
- package/dist/chunk-Q7MV3IXJ.js.map +0 -1
- package/dist/chunk-WQVZPIN7.cjs.map +0 -1
- package/dist/chunk-Z7QQZ53L.js.map +0 -1
- package/dist/index-0Z3-nnAP.d.ts +0 -2303
- package/dist/index-CxxiNSSH.d.cts +0 -2303
- /package/dist/{chunk-X5DAXBJI.js.map → chunk-SJVRUPJT.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact,
|
|
3
|
-
import { ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.cjs';
|
|
4
|
-
export { AssessmentSectionInput, Band, DEFAULT_ITEM_SCORING_POLICY, 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, EvaluateOptions, GradeReadAloudOptions, ITEM_SCORING_MAX_RETRIES, ItemScoringCount, ItemScoringPolicyIssue, ItemTriesOutcome, ItemTriesScore, ItemTry, ItemTryScore, 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,
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import { z } from 'zod/v4';
|
|
1
|
+
import { F as AiSupportedActivityType, g as AiActivityInput, p as AiFeature, ab as LearnerResponse, aa as ItemOutcome, o as AiExplanationRequest, t as AiGrade, u as AiHintRequest, ar as ScoringDetail, v as AiItemFacts, G as AiTextResult, C as AiRefusal, a2 as GradeRecord, j as AiCoachingRequest, i as AiCoaching, M as AiWritingFeedbackRequest, L as AiWritingFeedback, a as ActivityData, aw as ValidationError, f as ActivityType, b as ActivityDataMap, P as CriterionScore, aj as NativeControlHint, d as ActivityMedia, at as ScoringResult, R as DeferredScoringPartial, S as DictationData, U as DictationLearnerResponse, X as FillInTheBlanksData, Y as FillInTheBlanksLearnerResponse, $ as GapSelectData, a1 as GapSelectLearnerResponse, af as MultipleChoiceData, ag as MultipleChoiceLearnerResponse, ak as ReadAloudData, an as ReadAloudLearnerResponse, ay as WrittenResponseData, az as WrittenResponseLearnerResponse } from './activity-MBOYLBjR.cjs';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, k as AiCoachingResult, l as AiCoachingWord, m as AiCriterionJudgement, n as AiDictationFacts, q as AiFillInTheBlanksFacts, r as AiGapFact, s as AiGapSelectFacts, w as AiMultipleChoiceFacts, x as AiOptionFact, y as AiProvenance, z as AiReadingFacts, B as AiReadingWordFact, D as AiRubricCriterionFact, E as AiSoundFact, H as AiVerdict, I as AiWordFact, J as AiWritingCorrection, K as AiWritingFacts, N as AiWritingFeedbackResult, O as BlankConfig, Q as DeferredReason, T as DictationEquivalence, V as DictationSlowMedia, W as DictationTolerance, Z as GapSelectBank, _ as GapSelectChoice, a0 as GapSelectGap, a3 as Grader, a4 as GraderKind, a5 as GraderUsage, a6 as GradingState, a7 as InlineCorrection, a8 as InteractionEvent, a9 as InteractionKind, ac as LearnerResponseMap, ad as MediaPlaybackPolicy, ae as MediaTrack, ah as MultipleChoiceOption, ai as MultipleChoiceOptionMedia, al as ReadAloudDimension, am as ReadAloudDimensionWeight, ao as ReadAloudSlowMedia, ap as RecordingBounds, aq as RecordingRef, as as ScoringOutcome, au as TextMatchPolicy, av as TextMatchResult, ax as ValidationResult, aA as WrittenResponseRubric, aB as WrittenResponseRubricCriterion, aC as XAPIActor, aD as XAPIConfig, aE as XAPIContext, aF as XAPIContextActivities, aG as XAPIError, aH as XAPIObject, aI as XAPIResult, aJ as XAPIScore, aK as XAPIStatement, aL as XAPIVerbObject, aM as levenshteinDistance, aN as matchText } from './activity-MBOYLBjR.cjs';
|
|
3
|
+
import { SpeechAssessment, ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.cjs';
|
|
4
|
+
export { AssessmentSectionInput, Band, DEFAULT_ITEM_SCORING_POLICY, 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, EvaluateOptions, GradeReadAloudOptions, ITEM_SCORING_MAX_RETRIES, ItemScoringCount, ItemScoringPolicyIssue, ItemTriesOutcome, ItemTriesScore, ItemTry, ItemTryScore, 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, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, evaluateTries, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, resolveItemScoringPolicy, roundGrade, score, scoreTries, validateItemScoringPolicy, validateSpeechAssessment } from './scoring.cjs';
|
|
5
|
+
import { p as SequenceSlot, S as SequenceEntry, I as ItemGroup, M as MediaProgress } from './index-DlCW0XaQ.cjs';
|
|
6
|
+
export { a as MediaTimeline, R as RedactedActivity, b as RedactedBlankConfig, c as RedactedDictationData, d as RedactedDictationSlowMedia, e as RedactedFillInTheBlanksData, f as RedactedGapSelectBank, g as RedactedGapSelectChoice, h as RedactedGapSelectData, i as RedactedGapSelectGap, j as RedactedMultipleChoiceData, k as RedactedMultipleChoiceOption, l as RedactedMultipleChoiceOptionMedia, m as RedactedReadAloudData, n as RedactedStimulus, o as RedactedWrittenResponseData, q as SequenceSlotGroup, r as Stimulus, s as StimulusKind, T as TimelineChapter, t as TimelineCue, u as dictationJsonSchema, v as fillInTheBlanksJsonSchema, w as gapSelectJsonSchema, x as itemGroupJsonSchema, y as jsonSchemaFor, z as multipleChoiceJsonSchema, A as readAloudJsonSchema, B as stimulusJsonSchema, C as validateActivity, D as validateItemGroup, E as validateMedia, F as validateOptionMedia, G as writtenResponseJsonSchema } from './index-DlCW0XaQ.cjs';
|
|
8
7
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.cjs';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -19,16 +18,16 @@ declare const AI_TEXT_MAX_LENGTH = 2000;
|
|
|
19
18
|
/**
|
|
20
19
|
* Whether the SDK supports `feature` for this activity type: explanations and
|
|
21
20
|
* hints for the types it builds facts for, and writing feedback for a written
|
|
22
|
-
* response
|
|
21
|
+
* response, and coaching for a read-aloud. A consumer's own type has none.
|
|
23
22
|
*/
|
|
24
23
|
declare function aiSupports(activityType: string, feature: AiFeature): boolean;
|
|
25
24
|
/**
|
|
26
25
|
* Whether the item's author allows `feature`. Only an explicit `false`
|
|
27
26
|
* switches it off: an author can refuse a feature, never force one on.
|
|
28
27
|
*
|
|
29
|
-
* Writing feedback
|
|
30
|
-
* learner's own answer, and an author who switched one
|
|
31
|
-
* the
|
|
28
|
+
* Writing feedback and pronunciation coaching read `explanations`: each is a
|
|
29
|
+
* model's words about the learner's own answer, and an author who switched one
|
|
30
|
+
* off has switched off the others.
|
|
32
31
|
*/
|
|
33
32
|
declare function aiAllowedByContent(data: AiActivityInput, feature: AiFeature): boolean;
|
|
34
33
|
/** A grade as an explanation must speak to it: all marks, some, or none. */
|
|
@@ -132,6 +131,63 @@ declare function checkAiHint(raw: unknown, request: AiHintRequest): {
|
|
|
132
131
|
*/
|
|
133
132
|
declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
134
133
|
|
|
134
|
+
/** The most words one coaching may work on. More is refused, not cut. */
|
|
135
|
+
declare const AI_COACHING_MAX_WORDS = 20;
|
|
136
|
+
/** The longest tip for one word, in code points. */
|
|
137
|
+
declare const AI_COACHING_MAX_TIP_LENGTH = 500;
|
|
138
|
+
/**
|
|
139
|
+
* The request for coaching on a graded reading, or `null` when there is none
|
|
140
|
+
* to give: not a read-aloud, an author who switched explanations off (coaching
|
|
141
|
+
* reads `ai.explanations`), or no marks.
|
|
142
|
+
*
|
|
143
|
+
* The marks come from the `assessment` when one is given — with each word's
|
|
144
|
+
* sounds and what each was heard as — and then only from it: an assessment
|
|
145
|
+
* `gradeReadAloud` would not read (no speech heard, unscripted, or made against
|
|
146
|
+
* another text or locale) gives none, rather than a stored grade's marks the
|
|
147
|
+
* learner is not looking at. With no assessment, they come from
|
|
148
|
+
* `grade.details`, without sounds.
|
|
149
|
+
*
|
|
150
|
+
* The facts are the text as the learner saw it, those marks word by word, and
|
|
151
|
+
* the engine's dimension scores. The marks are the engine's; the model
|
|
152
|
+
* explains them.
|
|
153
|
+
*/
|
|
154
|
+
declare function aiCoachingRequest(input: {
|
|
155
|
+
data: AiActivityInput;
|
|
156
|
+
assessment?: SpeechAssessment | null;
|
|
157
|
+
grade?: GradeRecord | null;
|
|
158
|
+
learnerLocale?: string;
|
|
159
|
+
}): AiCoachingRequest | null;
|
|
160
|
+
/**
|
|
161
|
+
* Checks coaching a port returned for `request`, and turns it into what a
|
|
162
|
+
* learner is shown. As every AI text, it is shown whole or not at all.
|
|
163
|
+
*
|
|
164
|
+
* - **The text** is read as every AI text is (`readAiTextResult`).
|
|
165
|
+
* - **Every word coached is one the engine marked.** Each `itemId` names a word
|
|
166
|
+
* of the text marked `mispronounced` or `omitted`, once; coaching on a word
|
|
167
|
+
* read correctly, or one the text does not have, refuses the whole reply as
|
|
168
|
+
* `contradicts-marks`. Praise belongs in `text`.
|
|
169
|
+
* - **Every sound named is one the engine reported** for that word, and a sound
|
|
170
|
+
* it was heard as is one the engine heard it as. Where the facts carry no
|
|
171
|
+
* sounds — marks from a stored grade, or an assessor that reports none — any
|
|
172
|
+
* sound is `contradicts-marks`: nothing stands behind it.
|
|
173
|
+
* - **Nothing numeric is read.** A score in the reply is ignored: the marks and
|
|
174
|
+
* the grade are the engine's.
|
|
175
|
+
* - **Limits:** {@link AI_COACHING_MAX_WORDS} words, a tip of
|
|
176
|
+
* {@link AI_COACHING_MAX_TIP_LENGTH} code points; over them `too-long`. A
|
|
177
|
+
* shape that is not the one documented is `malformed`.
|
|
178
|
+
*
|
|
179
|
+
* The words come back in reading order, each with the word as the marks show it
|
|
180
|
+
* (the SDK's reading of the text, never the model's), and each sound spelt as
|
|
181
|
+
* the engine spelt it.
|
|
182
|
+
*/
|
|
183
|
+
declare function checkAiCoaching(raw: unknown, request: AiCoachingRequest): {
|
|
184
|
+
ok: true;
|
|
185
|
+
coaching: AiCoaching;
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
refusal: AiRefusal;
|
|
189
|
+
};
|
|
190
|
+
|
|
135
191
|
/** The most corrections one piece of writing feedback may carry. More is refused, not cut. */
|
|
136
192
|
declare const AI_WRITING_MAX_CORRECTIONS = 20;
|
|
137
193
|
/** The longest quote, correction, explanation or criterion comment, in code points. */
|
|
@@ -1217,6 +1273,80 @@ declare function serializeMediaPlayLedger(plan: AttemptPlan, entries: Readonly<R
|
|
|
1217
1273
|
*/
|
|
1218
1274
|
declare function restoreMediaPlayLedger(plan: AttemptPlan, stored: MediaPlayLedger): MediaPlayLedger;
|
|
1219
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Standard Schema v1 (https://standardschema.dev): the interface zod, valibot,
|
|
1278
|
+
* ArkType and other validators implement, so a library can accept a schema from
|
|
1279
|
+
* any of them without depending on one. Copied here, as the specification asks
|
|
1280
|
+
* a library to do, so lk-core depends on no validator's types.
|
|
1281
|
+
*
|
|
1282
|
+
* A registered activity type's `schema` and `redactedSchema` are Standard
|
|
1283
|
+
* Schemas. A zod 4 schema is one as written: `schema: z.object({ … })` needs no
|
|
1284
|
+
* adapter.
|
|
1285
|
+
*/
|
|
1286
|
+
/** A schema that validates unknown input and produces `Output`. */
|
|
1287
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1288
|
+
/** The Standard Schema properties. */
|
|
1289
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
1290
|
+
}
|
|
1291
|
+
declare namespace StandardSchemaV1 {
|
|
1292
|
+
/** The Standard Schema properties interface. */
|
|
1293
|
+
interface Props<Input = unknown, Output = Input> {
|
|
1294
|
+
/** The version number of the standard. */
|
|
1295
|
+
readonly version: 1;
|
|
1296
|
+
/** The vendor name of the schema library. */
|
|
1297
|
+
readonly vendor: string;
|
|
1298
|
+
/**
|
|
1299
|
+
* Validates unknown input values. lk-core validates synchronously, so a
|
|
1300
|
+
* schema whose validation returns a Promise is refused when it is read.
|
|
1301
|
+
*/
|
|
1302
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
1303
|
+
/** Inferred types associated with the schema. */
|
|
1304
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1305
|
+
}
|
|
1306
|
+
/** The result interface of the validate function. */
|
|
1307
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1308
|
+
/** The result interface if validation succeeds. */
|
|
1309
|
+
interface SuccessResult<Output> {
|
|
1310
|
+
/** The typed output value. */
|
|
1311
|
+
readonly value: Output;
|
|
1312
|
+
/** The absence of issues indicates success. */
|
|
1313
|
+
readonly issues?: undefined;
|
|
1314
|
+
}
|
|
1315
|
+
/** Options for the validate function. */
|
|
1316
|
+
interface Options {
|
|
1317
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
1318
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
1319
|
+
}
|
|
1320
|
+
/** The result interface if validation fails. */
|
|
1321
|
+
interface FailureResult {
|
|
1322
|
+
/** The issues of failed validation. */
|
|
1323
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1324
|
+
}
|
|
1325
|
+
/** The issue interface of the failure output. */
|
|
1326
|
+
interface Issue {
|
|
1327
|
+
/** The error message of the issue. */
|
|
1328
|
+
readonly message: string;
|
|
1329
|
+
/** The path of the issue, if any. */
|
|
1330
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1331
|
+
}
|
|
1332
|
+
/** The path segment interface of the issue. */
|
|
1333
|
+
interface PathSegment {
|
|
1334
|
+
/** The key representing a path segment. */
|
|
1335
|
+
readonly key: PropertyKey;
|
|
1336
|
+
}
|
|
1337
|
+
/** The Standard Schema types interface. */
|
|
1338
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1339
|
+
/** The input type of the schema. */
|
|
1340
|
+
readonly input: Input;
|
|
1341
|
+
/** The output type of the schema. */
|
|
1342
|
+
readonly output: Output;
|
|
1343
|
+
}
|
|
1344
|
+
/** Infers the input type of a Standard Schema. */
|
|
1345
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
1346
|
+
/** Infers the output type of a Standard Schema. */
|
|
1347
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1220
1350
|
/** ScoringResult without `passed` — the public `score()` / `evaluate()` fill that in. */
|
|
1221
1351
|
type PartialScoringResult = Omit<ScoringResult, 'passed'>;
|
|
1222
1352
|
/**
|
|
@@ -1294,8 +1424,9 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1294
1424
|
* length included, so report a rule about a whole list at the list's own path.
|
|
1295
1425
|
* A failure at the root of the draft is accounted for only by an issue at the
|
|
1296
1426
|
* root. A `null` the schema refuses, where nothing here reports it, comes back
|
|
1297
|
-
* as `null_not_allowed
|
|
1298
|
-
*
|
|
1427
|
+
* as `null_not_allowed`. A zod 4 schema tells a refused `null` from a rule of
|
|
1428
|
+
* yours that merely points at one, which keeps its own code; a schema from
|
|
1429
|
+
* another library cannot, so report such a rule here, at its path.
|
|
1299
1430
|
*
|
|
1300
1431
|
* A code documented in `docs/authoring.md` is reported with its documented
|
|
1301
1432
|
* severity. For a code of your own, a severity other than `'incomplete'` is
|
|
@@ -1309,14 +1440,38 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1309
1440
|
* descriptor makes `validateActivity`, `validateDraft`, `score`, `evaluate`,
|
|
1310
1441
|
* `redact`, and `jsonSchemaFor` work for the type — an activity type is a value,
|
|
1311
1442
|
* not a hardcoded union member (R1).
|
|
1443
|
+
*
|
|
1444
|
+
* Its schemas are Standard Schemas ({@link StandardSchemaV1}), so they can be
|
|
1445
|
+
* written with any library that implements the standard — a zod 4 schema is
|
|
1446
|
+
* one as it stands:
|
|
1447
|
+
*
|
|
1448
|
+
* ```ts
|
|
1449
|
+
* const pollType = defineActivityType<PollData, PollResponse>({
|
|
1450
|
+
* type: 'poll',
|
|
1451
|
+
* schema: z.looseObject({ type: z.literal('poll'), id: z.string(), … }),
|
|
1452
|
+
* scoring: { kind: 'sync', score: scorePoll },
|
|
1453
|
+
* });
|
|
1454
|
+
* registerActivityType(pollType);
|
|
1455
|
+
* ```
|
|
1312
1456
|
*/
|
|
1313
1457
|
interface ActivityTypeDescriptor<TData extends {
|
|
1314
1458
|
type: string;
|
|
1315
1459
|
}, TResponse> {
|
|
1316
1460
|
/** The `type` discriminator string (kebab-case by convention). */
|
|
1317
1461
|
readonly type: TData['type'];
|
|
1318
|
-
/**
|
|
1319
|
-
|
|
1462
|
+
/**
|
|
1463
|
+
* The activity's data contract, as a Standard Schema whose output is the
|
|
1464
|
+
* data. Its validation must be synchronous: every entry point that reads it
|
|
1465
|
+
* is.
|
|
1466
|
+
*/
|
|
1467
|
+
readonly schema: StandardSchemaV1<unknown, TData>;
|
|
1468
|
+
/**
|
|
1469
|
+
* The contract as JSON Schema, for `jsonSchemaFor`. Leave it out when
|
|
1470
|
+
* `schema` can produce one itself through the Standard JSON Schema converter
|
|
1471
|
+
* (`'~standard'.jsonSchema`), as a zod 4.6 schema can; give it to override
|
|
1472
|
+
* that, or for a library that cannot.
|
|
1473
|
+
*/
|
|
1474
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1320
1475
|
/** How responses are graded. */
|
|
1321
1476
|
readonly scoring: ActivityTypeScoring<TData, TResponse>;
|
|
1322
1477
|
/** Whether a response counts as an answer (vs. blank/untouched). */
|
|
@@ -1325,10 +1480,11 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1325
1480
|
readonly fieldPolicy?: FieldPolicy;
|
|
1326
1481
|
/**
|
|
1327
1482
|
* Schema the output of `redact(data)` (with default `reveal: 'none'`) must
|
|
1328
|
-
* satisfy. Strict by design: it proves the ABSENCE of
|
|
1329
|
-
* so `assertRedacted` can guarantee a payload is safe to
|
|
1483
|
+
* satisfy, as a Standard Schema. Strict by design: it proves the ABSENCE of
|
|
1484
|
+
* answer-key fields, so `assertRedacted` can guarantee a payload is safe to
|
|
1485
|
+
* send to a learner.
|
|
1330
1486
|
*/
|
|
1331
|
-
readonly redactedSchema?:
|
|
1487
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1332
1488
|
/** Interop facts for xAPI (and later QTI) statement building. */
|
|
1333
1489
|
readonly interop?: ActivityTypeInterop<TData>;
|
|
1334
1490
|
/** The interaction-event kinds components for this type emit. */
|
|
@@ -1342,7 +1498,8 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1342
1498
|
*/
|
|
1343
1499
|
interface RegisteredActivityTypeDescriptor {
|
|
1344
1500
|
readonly type: string;
|
|
1345
|
-
readonly schema:
|
|
1501
|
+
readonly schema: StandardSchemaV1;
|
|
1502
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1346
1503
|
readonly scoring: {
|
|
1347
1504
|
readonly kind: 'sync';
|
|
1348
1505
|
readonly score: (data: unknown, response: unknown) => PartialScoringResult;
|
|
@@ -1353,7 +1510,7 @@ interface RegisteredActivityTypeDescriptor {
|
|
|
1353
1510
|
};
|
|
1354
1511
|
readonly isAnswered?: (response: unknown) => boolean;
|
|
1355
1512
|
readonly fieldPolicy?: FieldPolicy;
|
|
1356
|
-
readonly redactedSchema?:
|
|
1513
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1357
1514
|
readonly interop?: ActivityTypeInterop<unknown>;
|
|
1358
1515
|
readonly interactions?: readonly string[];
|
|
1359
1516
|
readonly authoring?: ActivityTypeAuthoring<unknown>;
|
|
@@ -1695,4 +1852,4 @@ interface ThemeTokens {
|
|
|
1695
1852
|
'--lk-transition-base': string;
|
|
1696
1853
|
}
|
|
1697
1854
|
|
|
1698
|
-
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, AI_WRITING_MAX_CORRECTIONS, AI_WRITING_MAX_FIELD_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AiWritingFeedback, AiWritingFeedbackRequest, 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, ItemScoringPolicy, 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, ResolvedItemScoringPolicy, 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, aiWritingFeedbackRequest, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, checkAiWritingFeedback, 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 };
|
|
1855
|
+
export { AI_COACHING_MAX_TIP_LENGTH, AI_COACHING_MAX_WORDS, AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, AI_WRITING_MAX_CORRECTIONS, AI_WRITING_MAX_FIELD_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiCoaching, AiCoachingRequest, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AiWritingFeedback, AiWritingFeedbackRequest, 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, ItemScoringPolicy, 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, ResolvedItemScoringPolicy, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, SpeechAssessment, StandardSchemaV1, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiCoachingRequest, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, aiWritingFeedbackRequest, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiCoaching, checkAiExplanation, checkAiHint, checkAiWritingFeedback, 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
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact,
|
|
3
|
-
import { ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.js';
|
|
4
|
-
export { AssessmentSectionInput, Band, DEFAULT_ITEM_SCORING_POLICY, 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, EvaluateOptions, GradeReadAloudOptions, ITEM_SCORING_MAX_RETRIES, ItemScoringCount, ItemScoringPolicyIssue, ItemTriesOutcome, ItemTriesScore, ItemTry, ItemTryScore, 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,
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import { z } from 'zod/v4';
|
|
1
|
+
import { F as AiSupportedActivityType, g as AiActivityInput, p as AiFeature, ab as LearnerResponse, aa as ItemOutcome, o as AiExplanationRequest, t as AiGrade, u as AiHintRequest, ar as ScoringDetail, v as AiItemFacts, G as AiTextResult, C as AiRefusal, a2 as GradeRecord, j as AiCoachingRequest, i as AiCoaching, M as AiWritingFeedbackRequest, L as AiWritingFeedback, a as ActivityData, aw as ValidationError, f as ActivityType, b as ActivityDataMap, P as CriterionScore, aj as NativeControlHint, d as ActivityMedia, at as ScoringResult, R as DeferredScoringPartial, S as DictationData, U as DictationLearnerResponse, X as FillInTheBlanksData, Y as FillInTheBlanksLearnerResponse, $ as GapSelectData, a1 as GapSelectLearnerResponse, af as MultipleChoiceData, ag as MultipleChoiceLearnerResponse, ak as ReadAloudData, an as ReadAloudLearnerResponse, ay as WrittenResponseData, az as WrittenResponseLearnerResponse } from './activity-MBOYLBjR.js';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, k as AiCoachingResult, l as AiCoachingWord, m as AiCriterionJudgement, n as AiDictationFacts, q as AiFillInTheBlanksFacts, r as AiGapFact, s as AiGapSelectFacts, w as AiMultipleChoiceFacts, x as AiOptionFact, y as AiProvenance, z as AiReadingFacts, B as AiReadingWordFact, D as AiRubricCriterionFact, E as AiSoundFact, H as AiVerdict, I as AiWordFact, J as AiWritingCorrection, K as AiWritingFacts, N as AiWritingFeedbackResult, O as BlankConfig, Q as DeferredReason, T as DictationEquivalence, V as DictationSlowMedia, W as DictationTolerance, Z as GapSelectBank, _ as GapSelectChoice, a0 as GapSelectGap, a3 as Grader, a4 as GraderKind, a5 as GraderUsage, a6 as GradingState, a7 as InlineCorrection, a8 as InteractionEvent, a9 as InteractionKind, ac as LearnerResponseMap, ad as MediaPlaybackPolicy, ae as MediaTrack, ah as MultipleChoiceOption, ai as MultipleChoiceOptionMedia, al as ReadAloudDimension, am as ReadAloudDimensionWeight, ao as ReadAloudSlowMedia, ap as RecordingBounds, aq as RecordingRef, as as ScoringOutcome, au as TextMatchPolicy, av as TextMatchResult, ax as ValidationResult, aA as WrittenResponseRubric, aB as WrittenResponseRubricCriterion, aC as XAPIActor, aD as XAPIConfig, aE as XAPIContext, aF as XAPIContextActivities, aG as XAPIError, aH as XAPIObject, aI as XAPIResult, aJ as XAPIScore, aK as XAPIStatement, aL as XAPIVerbObject, aM as levenshteinDistance, aN as matchText } from './activity-MBOYLBjR.js';
|
|
3
|
+
import { SpeechAssessment, ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.js';
|
|
4
|
+
export { AssessmentSectionInput, Band, DEFAULT_ITEM_SCORING_POLICY, 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, EvaluateOptions, GradeReadAloudOptions, ITEM_SCORING_MAX_RETRIES, ItemScoringCount, ItemScoringPolicyIssue, ItemTriesOutcome, ItemTriesScore, ItemTry, ItemTryScore, 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, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, evaluateTries, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, resolveItemScoringPolicy, roundGrade, score, scoreTries, validateItemScoringPolicy, validateSpeechAssessment } from './scoring.js';
|
|
5
|
+
import { p as SequenceSlot, S as SequenceEntry, I as ItemGroup, M as MediaProgress } from './index-DlcqkM_L.js';
|
|
6
|
+
export { a as MediaTimeline, R as RedactedActivity, b as RedactedBlankConfig, c as RedactedDictationData, d as RedactedDictationSlowMedia, e as RedactedFillInTheBlanksData, f as RedactedGapSelectBank, g as RedactedGapSelectChoice, h as RedactedGapSelectData, i as RedactedGapSelectGap, j as RedactedMultipleChoiceData, k as RedactedMultipleChoiceOption, l as RedactedMultipleChoiceOptionMedia, m as RedactedReadAloudData, n as RedactedStimulus, o as RedactedWrittenResponseData, q as SequenceSlotGroup, r as Stimulus, s as StimulusKind, T as TimelineChapter, t as TimelineCue, u as dictationJsonSchema, v as fillInTheBlanksJsonSchema, w as gapSelectJsonSchema, x as itemGroupJsonSchema, y as jsonSchemaFor, z as multipleChoiceJsonSchema, A as readAloudJsonSchema, B as stimulusJsonSchema, C as validateActivity, D as validateItemGroup, E as validateMedia, F as validateOptionMedia, G as writtenResponseJsonSchema } from './index-DlcqkM_L.js';
|
|
8
7
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -19,16 +18,16 @@ declare const AI_TEXT_MAX_LENGTH = 2000;
|
|
|
19
18
|
/**
|
|
20
19
|
* Whether the SDK supports `feature` for this activity type: explanations and
|
|
21
20
|
* hints for the types it builds facts for, and writing feedback for a written
|
|
22
|
-
* response
|
|
21
|
+
* response, and coaching for a read-aloud. A consumer's own type has none.
|
|
23
22
|
*/
|
|
24
23
|
declare function aiSupports(activityType: string, feature: AiFeature): boolean;
|
|
25
24
|
/**
|
|
26
25
|
* Whether the item's author allows `feature`. Only an explicit `false`
|
|
27
26
|
* switches it off: an author can refuse a feature, never force one on.
|
|
28
27
|
*
|
|
29
|
-
* Writing feedback
|
|
30
|
-
* learner's own answer, and an author who switched one
|
|
31
|
-
* the
|
|
28
|
+
* Writing feedback and pronunciation coaching read `explanations`: each is a
|
|
29
|
+
* model's words about the learner's own answer, and an author who switched one
|
|
30
|
+
* off has switched off the others.
|
|
32
31
|
*/
|
|
33
32
|
declare function aiAllowedByContent(data: AiActivityInput, feature: AiFeature): boolean;
|
|
34
33
|
/** A grade as an explanation must speak to it: all marks, some, or none. */
|
|
@@ -132,6 +131,63 @@ declare function checkAiHint(raw: unknown, request: AiHintRequest): {
|
|
|
132
131
|
*/
|
|
133
132
|
declare function hintRevealsAnswer(facts: AiItemFacts, hint: string): boolean;
|
|
134
133
|
|
|
134
|
+
/** The most words one coaching may work on. More is refused, not cut. */
|
|
135
|
+
declare const AI_COACHING_MAX_WORDS = 20;
|
|
136
|
+
/** The longest tip for one word, in code points. */
|
|
137
|
+
declare const AI_COACHING_MAX_TIP_LENGTH = 500;
|
|
138
|
+
/**
|
|
139
|
+
* The request for coaching on a graded reading, or `null` when there is none
|
|
140
|
+
* to give: not a read-aloud, an author who switched explanations off (coaching
|
|
141
|
+
* reads `ai.explanations`), or no marks.
|
|
142
|
+
*
|
|
143
|
+
* The marks come from the `assessment` when one is given — with each word's
|
|
144
|
+
* sounds and what each was heard as — and then only from it: an assessment
|
|
145
|
+
* `gradeReadAloud` would not read (no speech heard, unscripted, or made against
|
|
146
|
+
* another text or locale) gives none, rather than a stored grade's marks the
|
|
147
|
+
* learner is not looking at. With no assessment, they come from
|
|
148
|
+
* `grade.details`, without sounds.
|
|
149
|
+
*
|
|
150
|
+
* The facts are the text as the learner saw it, those marks word by word, and
|
|
151
|
+
* the engine's dimension scores. The marks are the engine's; the model
|
|
152
|
+
* explains them.
|
|
153
|
+
*/
|
|
154
|
+
declare function aiCoachingRequest(input: {
|
|
155
|
+
data: AiActivityInput;
|
|
156
|
+
assessment?: SpeechAssessment | null;
|
|
157
|
+
grade?: GradeRecord | null;
|
|
158
|
+
learnerLocale?: string;
|
|
159
|
+
}): AiCoachingRequest | null;
|
|
160
|
+
/**
|
|
161
|
+
* Checks coaching a port returned for `request`, and turns it into what a
|
|
162
|
+
* learner is shown. As every AI text, it is shown whole or not at all.
|
|
163
|
+
*
|
|
164
|
+
* - **The text** is read as every AI text is (`readAiTextResult`).
|
|
165
|
+
* - **Every word coached is one the engine marked.** Each `itemId` names a word
|
|
166
|
+
* of the text marked `mispronounced` or `omitted`, once; coaching on a word
|
|
167
|
+
* read correctly, or one the text does not have, refuses the whole reply as
|
|
168
|
+
* `contradicts-marks`. Praise belongs in `text`.
|
|
169
|
+
* - **Every sound named is one the engine reported** for that word, and a sound
|
|
170
|
+
* it was heard as is one the engine heard it as. Where the facts carry no
|
|
171
|
+
* sounds — marks from a stored grade, or an assessor that reports none — any
|
|
172
|
+
* sound is `contradicts-marks`: nothing stands behind it.
|
|
173
|
+
* - **Nothing numeric is read.** A score in the reply is ignored: the marks and
|
|
174
|
+
* the grade are the engine's.
|
|
175
|
+
* - **Limits:** {@link AI_COACHING_MAX_WORDS} words, a tip of
|
|
176
|
+
* {@link AI_COACHING_MAX_TIP_LENGTH} code points; over them `too-long`. A
|
|
177
|
+
* shape that is not the one documented is `malformed`.
|
|
178
|
+
*
|
|
179
|
+
* The words come back in reading order, each with the word as the marks show it
|
|
180
|
+
* (the SDK's reading of the text, never the model's), and each sound spelt as
|
|
181
|
+
* the engine spelt it.
|
|
182
|
+
*/
|
|
183
|
+
declare function checkAiCoaching(raw: unknown, request: AiCoachingRequest): {
|
|
184
|
+
ok: true;
|
|
185
|
+
coaching: AiCoaching;
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
refusal: AiRefusal;
|
|
189
|
+
};
|
|
190
|
+
|
|
135
191
|
/** The most corrections one piece of writing feedback may carry. More is refused, not cut. */
|
|
136
192
|
declare const AI_WRITING_MAX_CORRECTIONS = 20;
|
|
137
193
|
/** The longest quote, correction, explanation or criterion comment, in code points. */
|
|
@@ -1217,6 +1273,80 @@ declare function serializeMediaPlayLedger(plan: AttemptPlan, entries: Readonly<R
|
|
|
1217
1273
|
*/
|
|
1218
1274
|
declare function restoreMediaPlayLedger(plan: AttemptPlan, stored: MediaPlayLedger): MediaPlayLedger;
|
|
1219
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Standard Schema v1 (https://standardschema.dev): the interface zod, valibot,
|
|
1278
|
+
* ArkType and other validators implement, so a library can accept a schema from
|
|
1279
|
+
* any of them without depending on one. Copied here, as the specification asks
|
|
1280
|
+
* a library to do, so lk-core depends on no validator's types.
|
|
1281
|
+
*
|
|
1282
|
+
* A registered activity type's `schema` and `redactedSchema` are Standard
|
|
1283
|
+
* Schemas. A zod 4 schema is one as written: `schema: z.object({ … })` needs no
|
|
1284
|
+
* adapter.
|
|
1285
|
+
*/
|
|
1286
|
+
/** A schema that validates unknown input and produces `Output`. */
|
|
1287
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1288
|
+
/** The Standard Schema properties. */
|
|
1289
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
1290
|
+
}
|
|
1291
|
+
declare namespace StandardSchemaV1 {
|
|
1292
|
+
/** The Standard Schema properties interface. */
|
|
1293
|
+
interface Props<Input = unknown, Output = Input> {
|
|
1294
|
+
/** The version number of the standard. */
|
|
1295
|
+
readonly version: 1;
|
|
1296
|
+
/** The vendor name of the schema library. */
|
|
1297
|
+
readonly vendor: string;
|
|
1298
|
+
/**
|
|
1299
|
+
* Validates unknown input values. lk-core validates synchronously, so a
|
|
1300
|
+
* schema whose validation returns a Promise is refused when it is read.
|
|
1301
|
+
*/
|
|
1302
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
1303
|
+
/** Inferred types associated with the schema. */
|
|
1304
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1305
|
+
}
|
|
1306
|
+
/** The result interface of the validate function. */
|
|
1307
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1308
|
+
/** The result interface if validation succeeds. */
|
|
1309
|
+
interface SuccessResult<Output> {
|
|
1310
|
+
/** The typed output value. */
|
|
1311
|
+
readonly value: Output;
|
|
1312
|
+
/** The absence of issues indicates success. */
|
|
1313
|
+
readonly issues?: undefined;
|
|
1314
|
+
}
|
|
1315
|
+
/** Options for the validate function. */
|
|
1316
|
+
interface Options {
|
|
1317
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
1318
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
1319
|
+
}
|
|
1320
|
+
/** The result interface if validation fails. */
|
|
1321
|
+
interface FailureResult {
|
|
1322
|
+
/** The issues of failed validation. */
|
|
1323
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1324
|
+
}
|
|
1325
|
+
/** The issue interface of the failure output. */
|
|
1326
|
+
interface Issue {
|
|
1327
|
+
/** The error message of the issue. */
|
|
1328
|
+
readonly message: string;
|
|
1329
|
+
/** The path of the issue, if any. */
|
|
1330
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1331
|
+
}
|
|
1332
|
+
/** The path segment interface of the issue. */
|
|
1333
|
+
interface PathSegment {
|
|
1334
|
+
/** The key representing a path segment. */
|
|
1335
|
+
readonly key: PropertyKey;
|
|
1336
|
+
}
|
|
1337
|
+
/** The Standard Schema types interface. */
|
|
1338
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1339
|
+
/** The input type of the schema. */
|
|
1340
|
+
readonly input: Input;
|
|
1341
|
+
/** The output type of the schema. */
|
|
1342
|
+
readonly output: Output;
|
|
1343
|
+
}
|
|
1344
|
+
/** Infers the input type of a Standard Schema. */
|
|
1345
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
1346
|
+
/** Infers the output type of a Standard Schema. */
|
|
1347
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1220
1350
|
/** ScoringResult without `passed` — the public `score()` / `evaluate()` fill that in. */
|
|
1221
1351
|
type PartialScoringResult = Omit<ScoringResult, 'passed'>;
|
|
1222
1352
|
/**
|
|
@@ -1294,8 +1424,9 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1294
1424
|
* length included, so report a rule about a whole list at the list's own path.
|
|
1295
1425
|
* A failure at the root of the draft is accounted for only by an issue at the
|
|
1296
1426
|
* root. A `null` the schema refuses, where nothing here reports it, comes back
|
|
1297
|
-
* as `null_not_allowed
|
|
1298
|
-
*
|
|
1427
|
+
* as `null_not_allowed`. A zod 4 schema tells a refused `null` from a rule of
|
|
1428
|
+
* yours that merely points at one, which keeps its own code; a schema from
|
|
1429
|
+
* another library cannot, so report such a rule here, at its path.
|
|
1299
1430
|
*
|
|
1300
1431
|
* A code documented in `docs/authoring.md` is reported with its documented
|
|
1301
1432
|
* severity. For a code of your own, a severity other than `'incomplete'` is
|
|
@@ -1309,14 +1440,38 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1309
1440
|
* descriptor makes `validateActivity`, `validateDraft`, `score`, `evaluate`,
|
|
1310
1441
|
* `redact`, and `jsonSchemaFor` work for the type — an activity type is a value,
|
|
1311
1442
|
* not a hardcoded union member (R1).
|
|
1443
|
+
*
|
|
1444
|
+
* Its schemas are Standard Schemas ({@link StandardSchemaV1}), so they can be
|
|
1445
|
+
* written with any library that implements the standard — a zod 4 schema is
|
|
1446
|
+
* one as it stands:
|
|
1447
|
+
*
|
|
1448
|
+
* ```ts
|
|
1449
|
+
* const pollType = defineActivityType<PollData, PollResponse>({
|
|
1450
|
+
* type: 'poll',
|
|
1451
|
+
* schema: z.looseObject({ type: z.literal('poll'), id: z.string(), … }),
|
|
1452
|
+
* scoring: { kind: 'sync', score: scorePoll },
|
|
1453
|
+
* });
|
|
1454
|
+
* registerActivityType(pollType);
|
|
1455
|
+
* ```
|
|
1312
1456
|
*/
|
|
1313
1457
|
interface ActivityTypeDescriptor<TData extends {
|
|
1314
1458
|
type: string;
|
|
1315
1459
|
}, TResponse> {
|
|
1316
1460
|
/** The `type` discriminator string (kebab-case by convention). */
|
|
1317
1461
|
readonly type: TData['type'];
|
|
1318
|
-
/**
|
|
1319
|
-
|
|
1462
|
+
/**
|
|
1463
|
+
* The activity's data contract, as a Standard Schema whose output is the
|
|
1464
|
+
* data. Its validation must be synchronous: every entry point that reads it
|
|
1465
|
+
* is.
|
|
1466
|
+
*/
|
|
1467
|
+
readonly schema: StandardSchemaV1<unknown, TData>;
|
|
1468
|
+
/**
|
|
1469
|
+
* The contract as JSON Schema, for `jsonSchemaFor`. Leave it out when
|
|
1470
|
+
* `schema` can produce one itself through the Standard JSON Schema converter
|
|
1471
|
+
* (`'~standard'.jsonSchema`), as a zod 4.6 schema can; give it to override
|
|
1472
|
+
* that, or for a library that cannot.
|
|
1473
|
+
*/
|
|
1474
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1320
1475
|
/** How responses are graded. */
|
|
1321
1476
|
readonly scoring: ActivityTypeScoring<TData, TResponse>;
|
|
1322
1477
|
/** Whether a response counts as an answer (vs. blank/untouched). */
|
|
@@ -1325,10 +1480,11 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1325
1480
|
readonly fieldPolicy?: FieldPolicy;
|
|
1326
1481
|
/**
|
|
1327
1482
|
* Schema the output of `redact(data)` (with default `reveal: 'none'`) must
|
|
1328
|
-
* satisfy. Strict by design: it proves the ABSENCE of
|
|
1329
|
-
* so `assertRedacted` can guarantee a payload is safe to
|
|
1483
|
+
* satisfy, as a Standard Schema. Strict by design: it proves the ABSENCE of
|
|
1484
|
+
* answer-key fields, so `assertRedacted` can guarantee a payload is safe to
|
|
1485
|
+
* send to a learner.
|
|
1330
1486
|
*/
|
|
1331
|
-
readonly redactedSchema?:
|
|
1487
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1332
1488
|
/** Interop facts for xAPI (and later QTI) statement building. */
|
|
1333
1489
|
readonly interop?: ActivityTypeInterop<TData>;
|
|
1334
1490
|
/** The interaction-event kinds components for this type emit. */
|
|
@@ -1342,7 +1498,8 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1342
1498
|
*/
|
|
1343
1499
|
interface RegisteredActivityTypeDescriptor {
|
|
1344
1500
|
readonly type: string;
|
|
1345
|
-
readonly schema:
|
|
1501
|
+
readonly schema: StandardSchemaV1;
|
|
1502
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1346
1503
|
readonly scoring: {
|
|
1347
1504
|
readonly kind: 'sync';
|
|
1348
1505
|
readonly score: (data: unknown, response: unknown) => PartialScoringResult;
|
|
@@ -1353,7 +1510,7 @@ interface RegisteredActivityTypeDescriptor {
|
|
|
1353
1510
|
};
|
|
1354
1511
|
readonly isAnswered?: (response: unknown) => boolean;
|
|
1355
1512
|
readonly fieldPolicy?: FieldPolicy;
|
|
1356
|
-
readonly redactedSchema?:
|
|
1513
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1357
1514
|
readonly interop?: ActivityTypeInterop<unknown>;
|
|
1358
1515
|
readonly interactions?: readonly string[];
|
|
1359
1516
|
readonly authoring?: ActivityTypeAuthoring<unknown>;
|
|
@@ -1695,4 +1852,4 @@ interface ThemeTokens {
|
|
|
1695
1852
|
'--lk-transition-base': string;
|
|
1696
1853
|
}
|
|
1697
1854
|
|
|
1698
|
-
export { AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, AI_WRITING_MAX_CORRECTIONS, AI_WRITING_MAX_FIELD_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AiWritingFeedback, AiWritingFeedbackRequest, 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, ItemScoringPolicy, 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, ResolvedItemScoringPolicy, 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, aiWritingFeedbackRequest, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiExplanation, checkAiHint, checkAiWritingFeedback, 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 };
|
|
1855
|
+
export { AI_COACHING_MAX_TIP_LENGTH, AI_COACHING_MAX_WORDS, AI_EXPLANATION_TYPES, AI_HINT_TYPES, AI_TEXT_MAX_LENGTH, AI_WRITING_MAX_CORRECTIONS, AI_WRITING_MAX_FIELD_LENGTH, ActivityData, ActivityDataMap, ActivityMedia, ActivitySchemaError, ActivityType, type ActivityTypeAuthoring, type ActivityTypeDescriptor, type ActivityTypeInterop, type ActivityTypeScoring, AiActivityInput, AiCoaching, AiCoachingRequest, AiExplanationRequest, AiFeature, AiGrade, AiHintRequest, AiItemFacts, AiRefusal, AiSupportedActivityType, AiTextResult, AiWritingFeedback, AiWritingFeedbackRequest, 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, ItemScoringPolicy, 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, ResolvedItemScoringPolicy, type ResolvedPlaybackPolicy, type ResponseDiffEntry, RoundingPolicy, ScoredItem, ScoringDetail, ScoringResult, type SeededShuffleOptions, type Sensitivity, SequenceEntry, SequenceSlot, type ShuffleVersion, SpeechAssessment, StandardSchemaV1, TIMELINE_MAX_CHAPTERS, TIMELINE_MAX_ITEMS, TIMELINE_MAX_QUIZZES, TIMELINE_MAX_TITLE_LENGTH, type ThemeTokens, UnknownActivityTypeError, ValidationError, WrittenResponseData, WrittenResponseLearnerResponse, type XAPIInteractionType, aiAllowedByContent, aiCoachingRequest, aiExplanationRequest, aiGradeOf, aiHintRequest, aiSupports, aiWritingFeedbackRequest, assertRedacted, assertRedactedItemGroup, buildAiFacts, canonicalJson, checkAiCoaching, checkAiExplanation, checkAiHint, checkAiWritingFeedback, 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 };
|