@intellectif/lk-core 0.22.0 → 1.0.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 +15 -0
- package/README.md +5 -5
- package/dist/{activity-CYc7SD3d.d.cts → activity-DgpBJeBc.d.cts} +11 -15
- package/dist/{activity-CYc7SD3d.d.ts → activity-DgpBJeBc.d.ts} +11 -15
- package/dist/ai-check.cjs +8 -8
- package/dist/ai-check.d.cts +1 -1
- package/dist/ai-check.d.ts +1 -1
- package/dist/ai-check.js +3 -3
- 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-5UCR4UNR.js → chunk-RCZCP5OE.js} +12 -7
- package/dist/chunk-RCZCP5OE.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-OPMY2MNS.cjs → chunk-W5KB3DNT.cjs} +19 -14
- package/dist/chunk-W5KB3DNT.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-BVNeSCWC.d.ts +548 -0
- package/dist/index-BlOLlwOi.d.cts +548 -0
- package/dist/index.cjs +129 -206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -15
- package/dist/index.d.ts +115 -15
- package/dist/index.js +26 -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 +2 -2
- package/dist/scoring.d.ts +2 -2
- 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 { x as AiSupportedActivityType, g as AiActivityInput, l as AiFeature, a4 as LearnerResponse, a3 as ItemOutcome, k as AiExplanationRequest, p as AiGrade, q as AiHintRequest, ak as ScoringDetail, r as AiItemFacts, y as AiTextResult, v as AiRefusal, F as AiWritingFeedbackRequest, E as AiWritingFeedback, a as ActivityData, ap as ValidationError, f as ActivityType, b as ActivityDataMap, I as CriterionScore, X as GradeRecord, ac as NativeControlHint, d as ActivityMedia, am as ScoringResult, K as DeferredScoringPartial, L as DictationData, N as DictationLearnerResponse, Q as FillInTheBlanksData, R as FillInTheBlanksLearnerResponse, U as GapSelectData, W as GapSelectLearnerResponse, a8 as MultipleChoiceData, a9 as MultipleChoiceLearnerResponse, ad as ReadAloudData, ag as ReadAloudLearnerResponse, ar as WrittenResponseData, as as WrittenResponseLearnerResponse } from './activity-
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiCriterionJudgement, j as AiDictationFacts, m as AiFillInTheBlanksFacts, n as AiGapFact, o as AiGapSelectFacts, s as AiMultipleChoiceFacts, t as AiOptionFact, u as AiProvenance, w as AiRubricCriterionFact, z as AiVerdict, B as AiWordFact, C as AiWritingCorrection, D as AiWritingFacts, G as AiWritingFeedbackResult, H as BlankConfig, J as DeferredReason, M as DictationEquivalence, O as DictationSlowMedia, P as DictationTolerance, S as GapSelectBank, T as GapSelectChoice, V as GapSelectGap, Y as Grader, Z as GraderKind, _ as GraderUsage, $ as GradingState, a0 as InlineCorrection, a1 as InteractionEvent, a2 as InteractionKind, a5 as LearnerResponseMap, a6 as MediaPlaybackPolicy, a7 as MediaTrack, aa as MultipleChoiceOption, ab as MultipleChoiceOptionMedia, ae as ReadAloudDimension, af as ReadAloudDimensionWeight, ah as ReadAloudSlowMedia, ai as RecordingBounds, aj as RecordingRef, al as ScoringOutcome, an as TextMatchPolicy, ao as TextMatchResult, aq as ValidationResult, at as WrittenResponseRubric, au as WrittenResponseRubricCriterion, av as XAPIActor, aw as XAPIConfig, ax as XAPIContext, ay as XAPIContextActivities, az as XAPIError, aA as XAPIObject, aB as XAPIResult, aC as XAPIScore, aD as XAPIStatement, aE as XAPIVerbObject, aF as levenshteinDistance, aG as matchText } from './activity-
|
|
1
|
+
import { x as AiSupportedActivityType, g as AiActivityInput, l as AiFeature, a4 as LearnerResponse, a3 as ItemOutcome, k as AiExplanationRequest, p as AiGrade, q as AiHintRequest, ak as ScoringDetail, r as AiItemFacts, y as AiTextResult, v as AiRefusal, F as AiWritingFeedbackRequest, E as AiWritingFeedback, a as ActivityData, ap as ValidationError, f as ActivityType, b as ActivityDataMap, I as CriterionScore, X as GradeRecord, ac as NativeControlHint, d as ActivityMedia, am as ScoringResult, K as DeferredScoringPartial, L as DictationData, N as DictationLearnerResponse, Q as FillInTheBlanksData, R as FillInTheBlanksLearnerResponse, U as GapSelectData, W as GapSelectLearnerResponse, a8 as MultipleChoiceData, a9 as MultipleChoiceLearnerResponse, ad as ReadAloudData, ag as ReadAloudLearnerResponse, ar as WrittenResponseData, as as WrittenResponseLearnerResponse } from './activity-DgpBJeBc.cjs';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiCriterionJudgement, j as AiDictationFacts, m as AiFillInTheBlanksFacts, n as AiGapFact, o as AiGapSelectFacts, s as AiMultipleChoiceFacts, t as AiOptionFact, u as AiProvenance, w as AiRubricCriterionFact, z as AiVerdict, B as AiWordFact, C as AiWritingCorrection, D as AiWritingFacts, G as AiWritingFeedbackResult, H as BlankConfig, J as DeferredReason, M as DictationEquivalence, O as DictationSlowMedia, P as DictationTolerance, S as GapSelectBank, T as GapSelectChoice, V as GapSelectGap, Y as Grader, Z as GraderKind, _ as GraderUsage, $ as GradingState, a0 as InlineCorrection, a1 as InteractionEvent, a2 as InteractionKind, a5 as LearnerResponseMap, a6 as MediaPlaybackPolicy, a7 as MediaTrack, aa as MultipleChoiceOption, ab as MultipleChoiceOptionMedia, ae as ReadAloudDimension, af as ReadAloudDimensionWeight, ah as ReadAloudSlowMedia, ai as RecordingBounds, aj as RecordingRef, al as ScoringOutcome, an as TextMatchPolicy, ao as TextMatchResult, aq as ValidationResult, at as WrittenResponseRubric, au as WrittenResponseRubricCriterion, av as XAPIActor, aw as XAPIConfig, ax as XAPIContext, ay as XAPIContextActivities, az as XAPIError, aA as XAPIObject, aB as XAPIResult, aC as XAPIScore, aD as XAPIStatement, aE as XAPIVerbObject, aF as levenshteinDistance, aG as matchText } from './activity-DgpBJeBc.cjs';
|
|
3
3
|
import { ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.cjs';
|
|
4
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, SpeechAssessment, 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 {
|
|
6
|
-
export {
|
|
7
|
-
import { z } from 'zod/v4';
|
|
5
|
+
import { p as SequenceSlot, S as SequenceEntry, I as ItemGroup, M as MediaProgress } from './index-BlOLlwOi.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-BlOLlwOi.cjs';
|
|
8
7
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.cjs';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -1217,6 +1216,80 @@ declare function serializeMediaPlayLedger(plan: AttemptPlan, entries: Readonly<R
|
|
|
1217
1216
|
*/
|
|
1218
1217
|
declare function restoreMediaPlayLedger(plan: AttemptPlan, stored: MediaPlayLedger): MediaPlayLedger;
|
|
1219
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* Standard Schema v1 (https://standardschema.dev): the interface zod, valibot,
|
|
1221
|
+
* ArkType and other validators implement, so a library can accept a schema from
|
|
1222
|
+
* any of them without depending on one. Copied here, as the specification asks
|
|
1223
|
+
* a library to do, so lk-core depends on no validator's types.
|
|
1224
|
+
*
|
|
1225
|
+
* A registered activity type's `schema` and `redactedSchema` are Standard
|
|
1226
|
+
* Schemas. A zod 4 schema is one as written: `schema: z.object({ … })` needs no
|
|
1227
|
+
* adapter.
|
|
1228
|
+
*/
|
|
1229
|
+
/** A schema that validates unknown input and produces `Output`. */
|
|
1230
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1231
|
+
/** The Standard Schema properties. */
|
|
1232
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
1233
|
+
}
|
|
1234
|
+
declare namespace StandardSchemaV1 {
|
|
1235
|
+
/** The Standard Schema properties interface. */
|
|
1236
|
+
interface Props<Input = unknown, Output = Input> {
|
|
1237
|
+
/** The version number of the standard. */
|
|
1238
|
+
readonly version: 1;
|
|
1239
|
+
/** The vendor name of the schema library. */
|
|
1240
|
+
readonly vendor: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* Validates unknown input values. lk-core validates synchronously, so a
|
|
1243
|
+
* schema whose validation returns a Promise is refused when it is read.
|
|
1244
|
+
*/
|
|
1245
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
1246
|
+
/** Inferred types associated with the schema. */
|
|
1247
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1248
|
+
}
|
|
1249
|
+
/** The result interface of the validate function. */
|
|
1250
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1251
|
+
/** The result interface if validation succeeds. */
|
|
1252
|
+
interface SuccessResult<Output> {
|
|
1253
|
+
/** The typed output value. */
|
|
1254
|
+
readonly value: Output;
|
|
1255
|
+
/** The absence of issues indicates success. */
|
|
1256
|
+
readonly issues?: undefined;
|
|
1257
|
+
}
|
|
1258
|
+
/** Options for the validate function. */
|
|
1259
|
+
interface Options {
|
|
1260
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
1261
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
1262
|
+
}
|
|
1263
|
+
/** The result interface if validation fails. */
|
|
1264
|
+
interface FailureResult {
|
|
1265
|
+
/** The issues of failed validation. */
|
|
1266
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1267
|
+
}
|
|
1268
|
+
/** The issue interface of the failure output. */
|
|
1269
|
+
interface Issue {
|
|
1270
|
+
/** The error message of the issue. */
|
|
1271
|
+
readonly message: string;
|
|
1272
|
+
/** The path of the issue, if any. */
|
|
1273
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1274
|
+
}
|
|
1275
|
+
/** The path segment interface of the issue. */
|
|
1276
|
+
interface PathSegment {
|
|
1277
|
+
/** The key representing a path segment. */
|
|
1278
|
+
readonly key: PropertyKey;
|
|
1279
|
+
}
|
|
1280
|
+
/** The Standard Schema types interface. */
|
|
1281
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1282
|
+
/** The input type of the schema. */
|
|
1283
|
+
readonly input: Input;
|
|
1284
|
+
/** The output type of the schema. */
|
|
1285
|
+
readonly output: Output;
|
|
1286
|
+
}
|
|
1287
|
+
/** Infers the input type of a Standard Schema. */
|
|
1288
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
1289
|
+
/** Infers the output type of a Standard Schema. */
|
|
1290
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1220
1293
|
/** ScoringResult without `passed` — the public `score()` / `evaluate()` fill that in. */
|
|
1221
1294
|
type PartialScoringResult = Omit<ScoringResult, 'passed'>;
|
|
1222
1295
|
/**
|
|
@@ -1294,8 +1367,9 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1294
1367
|
* length included, so report a rule about a whole list at the list's own path.
|
|
1295
1368
|
* A failure at the root of the draft is accounted for only by an issue at the
|
|
1296
1369
|
* root. A `null` the schema refuses, where nothing here reports it, comes back
|
|
1297
|
-
* as `null_not_allowed
|
|
1298
|
-
*
|
|
1370
|
+
* as `null_not_allowed`. A zod 4 schema tells a refused `null` from a rule of
|
|
1371
|
+
* yours that merely points at one, which keeps its own code; a schema from
|
|
1372
|
+
* another library cannot, so report such a rule here, at its path.
|
|
1299
1373
|
*
|
|
1300
1374
|
* A code documented in `docs/authoring.md` is reported with its documented
|
|
1301
1375
|
* severity. For a code of your own, a severity other than `'incomplete'` is
|
|
@@ -1309,14 +1383,38 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1309
1383
|
* descriptor makes `validateActivity`, `validateDraft`, `score`, `evaluate`,
|
|
1310
1384
|
* `redact`, and `jsonSchemaFor` work for the type — an activity type is a value,
|
|
1311
1385
|
* not a hardcoded union member (R1).
|
|
1386
|
+
*
|
|
1387
|
+
* Its schemas are Standard Schemas ({@link StandardSchemaV1}), so they can be
|
|
1388
|
+
* written with any library that implements the standard — a zod 4 schema is
|
|
1389
|
+
* one as it stands:
|
|
1390
|
+
*
|
|
1391
|
+
* ```ts
|
|
1392
|
+
* const pollType = defineActivityType<PollData, PollResponse>({
|
|
1393
|
+
* type: 'poll',
|
|
1394
|
+
* schema: z.looseObject({ type: z.literal('poll'), id: z.string(), … }),
|
|
1395
|
+
* scoring: { kind: 'sync', score: scorePoll },
|
|
1396
|
+
* });
|
|
1397
|
+
* registerActivityType(pollType);
|
|
1398
|
+
* ```
|
|
1312
1399
|
*/
|
|
1313
1400
|
interface ActivityTypeDescriptor<TData extends {
|
|
1314
1401
|
type: string;
|
|
1315
1402
|
}, TResponse> {
|
|
1316
1403
|
/** The `type` discriminator string (kebab-case by convention). */
|
|
1317
1404
|
readonly type: TData['type'];
|
|
1318
|
-
/**
|
|
1319
|
-
|
|
1405
|
+
/**
|
|
1406
|
+
* The activity's data contract, as a Standard Schema whose output is the
|
|
1407
|
+
* data. Its validation must be synchronous: every entry point that reads it
|
|
1408
|
+
* is.
|
|
1409
|
+
*/
|
|
1410
|
+
readonly schema: StandardSchemaV1<unknown, TData>;
|
|
1411
|
+
/**
|
|
1412
|
+
* The contract as JSON Schema, for `jsonSchemaFor`. Leave it out when
|
|
1413
|
+
* `schema` can produce one itself through the Standard JSON Schema converter
|
|
1414
|
+
* (`'~standard'.jsonSchema`), as a zod 4.6 schema can; give it to override
|
|
1415
|
+
* that, or for a library that cannot.
|
|
1416
|
+
*/
|
|
1417
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1320
1418
|
/** How responses are graded. */
|
|
1321
1419
|
readonly scoring: ActivityTypeScoring<TData, TResponse>;
|
|
1322
1420
|
/** Whether a response counts as an answer (vs. blank/untouched). */
|
|
@@ -1325,10 +1423,11 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1325
1423
|
readonly fieldPolicy?: FieldPolicy;
|
|
1326
1424
|
/**
|
|
1327
1425
|
* 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
|
|
1426
|
+
* satisfy, as a Standard Schema. Strict by design: it proves the ABSENCE of
|
|
1427
|
+
* answer-key fields, so `assertRedacted` can guarantee a payload is safe to
|
|
1428
|
+
* send to a learner.
|
|
1330
1429
|
*/
|
|
1331
|
-
readonly redactedSchema?:
|
|
1430
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1332
1431
|
/** Interop facts for xAPI (and later QTI) statement building. */
|
|
1333
1432
|
readonly interop?: ActivityTypeInterop<TData>;
|
|
1334
1433
|
/** The interaction-event kinds components for this type emit. */
|
|
@@ -1342,7 +1441,8 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1342
1441
|
*/
|
|
1343
1442
|
interface RegisteredActivityTypeDescriptor {
|
|
1344
1443
|
readonly type: string;
|
|
1345
|
-
readonly schema:
|
|
1444
|
+
readonly schema: StandardSchemaV1;
|
|
1445
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1346
1446
|
readonly scoring: {
|
|
1347
1447
|
readonly kind: 'sync';
|
|
1348
1448
|
readonly score: (data: unknown, response: unknown) => PartialScoringResult;
|
|
@@ -1353,7 +1453,7 @@ interface RegisteredActivityTypeDescriptor {
|
|
|
1353
1453
|
};
|
|
1354
1454
|
readonly isAnswered?: (response: unknown) => boolean;
|
|
1355
1455
|
readonly fieldPolicy?: FieldPolicy;
|
|
1356
|
-
readonly redactedSchema?:
|
|
1456
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1357
1457
|
readonly interop?: ActivityTypeInterop<unknown>;
|
|
1358
1458
|
readonly interactions?: readonly string[];
|
|
1359
1459
|
readonly authoring?: ActivityTypeAuthoring<unknown>;
|
|
@@ -1695,4 +1795,4 @@ interface ThemeTokens {
|
|
|
1695
1795
|
'--lk-transition-base': string;
|
|
1696
1796
|
}
|
|
1697
1797
|
|
|
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 };
|
|
1798
|
+
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, StandardSchemaV1, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { x as AiSupportedActivityType, g as AiActivityInput, l as AiFeature, a4 as LearnerResponse, a3 as ItemOutcome, k as AiExplanationRequest, p as AiGrade, q as AiHintRequest, ak as ScoringDetail, r as AiItemFacts, y as AiTextResult, v as AiRefusal, F as AiWritingFeedbackRequest, E as AiWritingFeedback, a as ActivityData, ap as ValidationError, f as ActivityType, b as ActivityDataMap, I as CriterionScore, X as GradeRecord, ac as NativeControlHint, d as ActivityMedia, am as ScoringResult, K as DeferredScoringPartial, L as DictationData, N as DictationLearnerResponse, Q as FillInTheBlanksData, R as FillInTheBlanksLearnerResponse, U as GapSelectData, W as GapSelectLearnerResponse, a8 as MultipleChoiceData, a9 as MultipleChoiceLearnerResponse, ad as ReadAloudData, ag as ReadAloudLearnerResponse, ar as WrittenResponseData, as as WrittenResponseLearnerResponse } from './activity-
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiCriterionJudgement, j as AiDictationFacts, m as AiFillInTheBlanksFacts, n as AiGapFact, o as AiGapSelectFacts, s as AiMultipleChoiceFacts, t as AiOptionFact, u as AiProvenance, w as AiRubricCriterionFact, z as AiVerdict, B as AiWordFact, C as AiWritingCorrection, D as AiWritingFacts, G as AiWritingFeedbackResult, H as BlankConfig, J as DeferredReason, M as DictationEquivalence, O as DictationSlowMedia, P as DictationTolerance, S as GapSelectBank, T as GapSelectChoice, V as GapSelectGap, Y as Grader, Z as GraderKind, _ as GraderUsage, $ as GradingState, a0 as InlineCorrection, a1 as InteractionEvent, a2 as InteractionKind, a5 as LearnerResponseMap, a6 as MediaPlaybackPolicy, a7 as MediaTrack, aa as MultipleChoiceOption, ab as MultipleChoiceOptionMedia, ae as ReadAloudDimension, af as ReadAloudDimensionWeight, ah as ReadAloudSlowMedia, ai as RecordingBounds, aj as RecordingRef, al as ScoringOutcome, an as TextMatchPolicy, ao as TextMatchResult, aq as ValidationResult, at as WrittenResponseRubric, au as WrittenResponseRubricCriterion, av as XAPIActor, aw as XAPIConfig, ax as XAPIContext, ay as XAPIContextActivities, az as XAPIError, aA as XAPIObject, aB as XAPIResult, aC as XAPIScore, aD as XAPIStatement, aE as XAPIVerbObject, aF as levenshteinDistance, aG as matchText } from './activity-
|
|
1
|
+
import { x as AiSupportedActivityType, g as AiActivityInput, l as AiFeature, a4 as LearnerResponse, a3 as ItemOutcome, k as AiExplanationRequest, p as AiGrade, q as AiHintRequest, ak as ScoringDetail, r as AiItemFacts, y as AiTextResult, v as AiRefusal, F as AiWritingFeedbackRequest, E as AiWritingFeedback, a as ActivityData, ap as ValidationError, f as ActivityType, b as ActivityDataMap, I as CriterionScore, X as GradeRecord, ac as NativeControlHint, d as ActivityMedia, am as ScoringResult, K as DeferredScoringPartial, L as DictationData, N as DictationLearnerResponse, Q as FillInTheBlanksData, R as FillInTheBlanksLearnerResponse, U as GapSelectData, W as GapSelectLearnerResponse, a8 as MultipleChoiceData, a9 as MultipleChoiceLearnerResponse, ad as ReadAloudData, ag as ReadAloudLearnerResponse, ar as WrittenResponseData, as as WrittenResponseLearnerResponse } from './activity-DgpBJeBc.js';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiCriterionJudgement, j as AiDictationFacts, m as AiFillInTheBlanksFacts, n as AiGapFact, o as AiGapSelectFacts, s as AiMultipleChoiceFacts, t as AiOptionFact, u as AiProvenance, w as AiRubricCriterionFact, z as AiVerdict, B as AiWordFact, C as AiWritingCorrection, D as AiWritingFacts, G as AiWritingFeedbackResult, H as BlankConfig, J as DeferredReason, M as DictationEquivalence, O as DictationSlowMedia, P as DictationTolerance, S as GapSelectBank, T as GapSelectChoice, V as GapSelectGap, Y as Grader, Z as GraderKind, _ as GraderUsage, $ as GradingState, a0 as InlineCorrection, a1 as InteractionEvent, a2 as InteractionKind, a5 as LearnerResponseMap, a6 as MediaPlaybackPolicy, a7 as MediaTrack, aa as MultipleChoiceOption, ab as MultipleChoiceOptionMedia, ae as ReadAloudDimension, af as ReadAloudDimensionWeight, ah as ReadAloudSlowMedia, ai as RecordingBounds, aj as RecordingRef, al as ScoringOutcome, an as TextMatchPolicy, ao as TextMatchResult, aq as ValidationResult, at as WrittenResponseRubric, au as WrittenResponseRubricCriterion, av as XAPIActor, aw as XAPIConfig, ax as XAPIContext, ay as XAPIContextActivities, az as XAPIError, aA as XAPIObject, aB as XAPIResult, aC as XAPIScore, aD as XAPIStatement, aE as XAPIVerbObject, aF as levenshteinDistance, aG as matchText } from './activity-DgpBJeBc.js';
|
|
3
3
|
import { ResolvedItemScoringPolicy, ItemScoringPolicy, ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.js';
|
|
4
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, SpeechAssessment, 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 {
|
|
6
|
-
export {
|
|
7
|
-
import { z } from 'zod/v4';
|
|
5
|
+
import { p as SequenceSlot, S as SequenceEntry, I as ItemGroup, M as MediaProgress } from './index-BVNeSCWC.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-BVNeSCWC.js';
|
|
8
7
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -1217,6 +1216,80 @@ declare function serializeMediaPlayLedger(plan: AttemptPlan, entries: Readonly<R
|
|
|
1217
1216
|
*/
|
|
1218
1217
|
declare function restoreMediaPlayLedger(plan: AttemptPlan, stored: MediaPlayLedger): MediaPlayLedger;
|
|
1219
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* Standard Schema v1 (https://standardschema.dev): the interface zod, valibot,
|
|
1221
|
+
* ArkType and other validators implement, so a library can accept a schema from
|
|
1222
|
+
* any of them without depending on one. Copied here, as the specification asks
|
|
1223
|
+
* a library to do, so lk-core depends on no validator's types.
|
|
1224
|
+
*
|
|
1225
|
+
* A registered activity type's `schema` and `redactedSchema` are Standard
|
|
1226
|
+
* Schemas. A zod 4 schema is one as written: `schema: z.object({ … })` needs no
|
|
1227
|
+
* adapter.
|
|
1228
|
+
*/
|
|
1229
|
+
/** A schema that validates unknown input and produces `Output`. */
|
|
1230
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1231
|
+
/** The Standard Schema properties. */
|
|
1232
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
1233
|
+
}
|
|
1234
|
+
declare namespace StandardSchemaV1 {
|
|
1235
|
+
/** The Standard Schema properties interface. */
|
|
1236
|
+
interface Props<Input = unknown, Output = Input> {
|
|
1237
|
+
/** The version number of the standard. */
|
|
1238
|
+
readonly version: 1;
|
|
1239
|
+
/** The vendor name of the schema library. */
|
|
1240
|
+
readonly vendor: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* Validates unknown input values. lk-core validates synchronously, so a
|
|
1243
|
+
* schema whose validation returns a Promise is refused when it is read.
|
|
1244
|
+
*/
|
|
1245
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
1246
|
+
/** Inferred types associated with the schema. */
|
|
1247
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1248
|
+
}
|
|
1249
|
+
/** The result interface of the validate function. */
|
|
1250
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1251
|
+
/** The result interface if validation succeeds. */
|
|
1252
|
+
interface SuccessResult<Output> {
|
|
1253
|
+
/** The typed output value. */
|
|
1254
|
+
readonly value: Output;
|
|
1255
|
+
/** The absence of issues indicates success. */
|
|
1256
|
+
readonly issues?: undefined;
|
|
1257
|
+
}
|
|
1258
|
+
/** Options for the validate function. */
|
|
1259
|
+
interface Options {
|
|
1260
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
1261
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
1262
|
+
}
|
|
1263
|
+
/** The result interface if validation fails. */
|
|
1264
|
+
interface FailureResult {
|
|
1265
|
+
/** The issues of failed validation. */
|
|
1266
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1267
|
+
}
|
|
1268
|
+
/** The issue interface of the failure output. */
|
|
1269
|
+
interface Issue {
|
|
1270
|
+
/** The error message of the issue. */
|
|
1271
|
+
readonly message: string;
|
|
1272
|
+
/** The path of the issue, if any. */
|
|
1273
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1274
|
+
}
|
|
1275
|
+
/** The path segment interface of the issue. */
|
|
1276
|
+
interface PathSegment {
|
|
1277
|
+
/** The key representing a path segment. */
|
|
1278
|
+
readonly key: PropertyKey;
|
|
1279
|
+
}
|
|
1280
|
+
/** The Standard Schema types interface. */
|
|
1281
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1282
|
+
/** The input type of the schema. */
|
|
1283
|
+
readonly input: Input;
|
|
1284
|
+
/** The output type of the schema. */
|
|
1285
|
+
readonly output: Output;
|
|
1286
|
+
}
|
|
1287
|
+
/** Infers the input type of a Standard Schema. */
|
|
1288
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
1289
|
+
/** Infers the output type of a Standard Schema. */
|
|
1290
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1220
1293
|
/** ScoringResult without `passed` — the public `score()` / `evaluate()` fill that in. */
|
|
1221
1294
|
type PartialScoringResult = Omit<ScoringResult, 'passed'>;
|
|
1222
1295
|
/**
|
|
@@ -1294,8 +1367,9 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1294
1367
|
* length included, so report a rule about a whole list at the list's own path.
|
|
1295
1368
|
* A failure at the root of the draft is accounted for only by an issue at the
|
|
1296
1369
|
* root. A `null` the schema refuses, where nothing here reports it, comes back
|
|
1297
|
-
* as `null_not_allowed
|
|
1298
|
-
*
|
|
1370
|
+
* as `null_not_allowed`. A zod 4 schema tells a refused `null` from a rule of
|
|
1371
|
+
* yours that merely points at one, which keeps its own code; a schema from
|
|
1372
|
+
* another library cannot, so report such a rule here, at its path.
|
|
1299
1373
|
*
|
|
1300
1374
|
* A code documented in `docs/authoring.md` is reported with its documented
|
|
1301
1375
|
* severity. For a code of your own, a severity other than `'incomplete'` is
|
|
@@ -1309,14 +1383,38 @@ interface ActivityTypeAuthoring<TData> {
|
|
|
1309
1383
|
* descriptor makes `validateActivity`, `validateDraft`, `score`, `evaluate`,
|
|
1310
1384
|
* `redact`, and `jsonSchemaFor` work for the type — an activity type is a value,
|
|
1311
1385
|
* not a hardcoded union member (R1).
|
|
1386
|
+
*
|
|
1387
|
+
* Its schemas are Standard Schemas ({@link StandardSchemaV1}), so they can be
|
|
1388
|
+
* written with any library that implements the standard — a zod 4 schema is
|
|
1389
|
+
* one as it stands:
|
|
1390
|
+
*
|
|
1391
|
+
* ```ts
|
|
1392
|
+
* const pollType = defineActivityType<PollData, PollResponse>({
|
|
1393
|
+
* type: 'poll',
|
|
1394
|
+
* schema: z.looseObject({ type: z.literal('poll'), id: z.string(), … }),
|
|
1395
|
+
* scoring: { kind: 'sync', score: scorePoll },
|
|
1396
|
+
* });
|
|
1397
|
+
* registerActivityType(pollType);
|
|
1398
|
+
* ```
|
|
1312
1399
|
*/
|
|
1313
1400
|
interface ActivityTypeDescriptor<TData extends {
|
|
1314
1401
|
type: string;
|
|
1315
1402
|
}, TResponse> {
|
|
1316
1403
|
/** The `type` discriminator string (kebab-case by convention). */
|
|
1317
1404
|
readonly type: TData['type'];
|
|
1318
|
-
/**
|
|
1319
|
-
|
|
1405
|
+
/**
|
|
1406
|
+
* The activity's data contract, as a Standard Schema whose output is the
|
|
1407
|
+
* data. Its validation must be synchronous: every entry point that reads it
|
|
1408
|
+
* is.
|
|
1409
|
+
*/
|
|
1410
|
+
readonly schema: StandardSchemaV1<unknown, TData>;
|
|
1411
|
+
/**
|
|
1412
|
+
* The contract as JSON Schema, for `jsonSchemaFor`. Leave it out when
|
|
1413
|
+
* `schema` can produce one itself through the Standard JSON Schema converter
|
|
1414
|
+
* (`'~standard'.jsonSchema`), as a zod 4.6 schema can; give it to override
|
|
1415
|
+
* that, or for a library that cannot.
|
|
1416
|
+
*/
|
|
1417
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1320
1418
|
/** How responses are graded. */
|
|
1321
1419
|
readonly scoring: ActivityTypeScoring<TData, TResponse>;
|
|
1322
1420
|
/** Whether a response counts as an answer (vs. blank/untouched). */
|
|
@@ -1325,10 +1423,11 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1325
1423
|
readonly fieldPolicy?: FieldPolicy;
|
|
1326
1424
|
/**
|
|
1327
1425
|
* 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
|
|
1426
|
+
* satisfy, as a Standard Schema. Strict by design: it proves the ABSENCE of
|
|
1427
|
+
* answer-key fields, so `assertRedacted` can guarantee a payload is safe to
|
|
1428
|
+
* send to a learner.
|
|
1330
1429
|
*/
|
|
1331
|
-
readonly redactedSchema?:
|
|
1430
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1332
1431
|
/** Interop facts for xAPI (and later QTI) statement building. */
|
|
1333
1432
|
readonly interop?: ActivityTypeInterop<TData>;
|
|
1334
1433
|
/** The interaction-event kinds components for this type emit. */
|
|
@@ -1342,7 +1441,8 @@ interface ActivityTypeDescriptor<TData extends {
|
|
|
1342
1441
|
*/
|
|
1343
1442
|
interface RegisteredActivityTypeDescriptor {
|
|
1344
1443
|
readonly type: string;
|
|
1345
|
-
readonly schema:
|
|
1444
|
+
readonly schema: StandardSchemaV1;
|
|
1445
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
1346
1446
|
readonly scoring: {
|
|
1347
1447
|
readonly kind: 'sync';
|
|
1348
1448
|
readonly score: (data: unknown, response: unknown) => PartialScoringResult;
|
|
@@ -1353,7 +1453,7 @@ interface RegisteredActivityTypeDescriptor {
|
|
|
1353
1453
|
};
|
|
1354
1454
|
readonly isAnswered?: (response: unknown) => boolean;
|
|
1355
1455
|
readonly fieldPolicy?: FieldPolicy;
|
|
1356
|
-
readonly redactedSchema?:
|
|
1456
|
+
readonly redactedSchema?: StandardSchemaV1;
|
|
1357
1457
|
readonly interop?: ActivityTypeInterop<unknown>;
|
|
1358
1458
|
readonly interactions?: readonly string[];
|
|
1359
1459
|
readonly authoring?: ActivityTypeAuthoring<unknown>;
|
|
@@ -1695,4 +1795,4 @@ interface ThemeTokens {
|
|
|
1695
1795
|
'--lk-transition-base': string;
|
|
1696
1796
|
}
|
|
1697
1797
|
|
|
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 };
|
|
1798
|
+
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, StandardSchemaV1, 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 };
|