@intellectif/lk-core 1.6.0 → 1.8.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/{ai-i3jwXnpX.d.ts → ai-Cnm0qE8v.d.cts} +334 -16
  3. package/dist/ai-Cnm0qE8v.d.cts.map +1 -0
  4. package/dist/{ai-i3jwXnpX.d.cts → ai-Cnm0qE8v.d.ts} +334 -16
  5. package/dist/ai-Cnm0qE8v.d.ts.map +1 -0
  6. package/dist/ai-check.cjs +88 -7
  7. package/dist/ai-check.cjs.map +1 -1
  8. package/dist/ai-check.d.cts +11 -7
  9. package/dist/ai-check.d.cts.map +1 -1
  10. package/dist/ai-check.d.ts +11 -7
  11. package/dist/ai-check.d.ts.map +1 -1
  12. package/dist/ai-check.js +88 -7
  13. package/dist/ai-check.js.map +1 -1
  14. package/dist/{ai-writing-C4YRVrFi.cjs → ai-writing-Bh2Y53cY.cjs} +2567 -203
  15. package/dist/ai-writing-Bh2Y53cY.cjs.map +1 -0
  16. package/dist/{ai-writing-OJ5m_1EB.js → ai-writing-DeIV-GfN.js} +2428 -172
  17. package/dist/ai-writing-DeIV-GfN.js.map +1 -0
  18. package/dist/{index-Dj92T76o.d.ts → index-CtoPhJAH.d.ts} +2 -8
  19. package/dist/index-CtoPhJAH.d.ts.map +1 -0
  20. package/dist/{index--U7hHV0s.d.cts → index-DMh3OYSb.d.cts} +2 -8
  21. package/dist/index-DMh3OYSb.d.cts.map +1 -0
  22. package/dist/{index-WBHSrIUU.d.ts → index-HXvg0YRQ.d.ts} +5 -12
  23. package/dist/index-HXvg0YRQ.d.ts.map +1 -0
  24. package/dist/{index-CFRgZLhH.d.cts → index-fZ67k-WR.d.cts} +5 -12
  25. package/dist/index-fZ67k-WR.d.cts.map +1 -0
  26. package/dist/{index-DeD8EI1D.d.ts → index-g-EWIugp.d.ts} +2 -42
  27. package/dist/index-g-EWIugp.d.ts.map +1 -0
  28. package/dist/{index-Uh1u57yq.d.cts → index-oST8GBFa.d.cts} +2 -42
  29. package/dist/index-oST8GBFa.d.cts.map +1 -0
  30. package/dist/index.cjs +287 -20
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +227 -71
  33. package/dist/index.d.cts.map +1 -1
  34. package/dist/index.d.ts +227 -71
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +276 -21
  37. package/dist/index.js.map +1 -1
  38. package/dist/{item-group-BbvvH_Ob.js → item-group-BceUoxoM.js} +4 -6
  39. package/dist/{item-group-BbvvH_Ob.js.map → item-group-BceUoxoM.js.map} +1 -1
  40. package/dist/{item-group-CQRbb8Rx.cjs → item-group-KV4hYu3a.cjs} +4 -6
  41. package/dist/{item-group-CQRbb8Rx.cjs.map → item-group-KV4hYu3a.cjs.map} +1 -1
  42. package/dist/{registry-Ih5n4PVZ.cjs → registry-Cymq7Ah0.cjs} +97 -92
  43. package/dist/registry-Cymq7Ah0.cjs.map +1 -0
  44. package/dist/{registry-B23o9UWh.js → registry-tkacvJUI.js} +79 -91
  45. package/dist/registry-tkacvJUI.js.map +1 -0
  46. package/dist/{schemas-yId-bJhD.js → schemas-DM8sN_f0.js} +5 -7
  47. package/dist/{schemas-yId-bJhD.js.map → schemas-DM8sN_f0.js.map} +1 -1
  48. package/dist/{schemas-Q2dyOgc2.cjs → schemas-wDzbKdKa.cjs} +5 -7
  49. package/dist/{schemas-Q2dyOgc2.cjs.map → schemas-wDzbKdKa.cjs.map} +1 -1
  50. package/dist/schemas.cjs +3 -3
  51. package/dist/schemas.d.cts +1 -1
  52. package/dist/schemas.d.ts +1 -1
  53. package/dist/schemas.js +3 -3
  54. package/dist/{scoring-CaPS6q8b.cjs → scoring-D9tFvPEG.cjs} +22 -42
  55. package/dist/{scoring-CaPS6q8b.cjs.map → scoring-D9tFvPEG.cjs.map} +1 -1
  56. package/dist/{scoring-CLMdk8i9.js → scoring-DIBmo_cy.js} +22 -42
  57. package/dist/{scoring-CLMdk8i9.js.map → scoring-DIBmo_cy.js.map} +1 -1
  58. package/dist/scoring.cjs +2 -2
  59. package/dist/scoring.d.cts +2 -2
  60. package/dist/scoring.d.ts +2 -2
  61. package/dist/scoring.js +2 -2
  62. package/dist/{xapi-BX0hvRRB.cjs → xapi-Dyqcl3JK.cjs} +5 -8
  63. package/dist/{xapi-BX0hvRRB.cjs.map → xapi-Dyqcl3JK.cjs.map} +1 -1
  64. package/dist/{xapi-Cdk9fTvV.js → xapi-gCAo549Q.js} +5 -8
  65. package/dist/{xapi-Cdk9fTvV.js.map → xapi-gCAo549Q.js.map} +1 -1
  66. package/dist/xapi.cjs +1 -1
  67. package/dist/xapi.d.cts +1 -1
  68. package/dist/xapi.d.ts +1 -1
  69. package/dist/xapi.js +1 -1
  70. package/package.json +2 -2
  71. package/vectors/README.md +23 -0
  72. package/vectors/variants.d.mts +20 -0
  73. package/vectors/variants.json +5753 -0
  74. package/vectors/variants.mjs +67 -0
  75. package/dist/ai-i3jwXnpX.d.cts.map +0 -1
  76. package/dist/ai-i3jwXnpX.d.ts.map +0 -1
  77. package/dist/ai-writing-C4YRVrFi.cjs.map +0 -1
  78. package/dist/ai-writing-OJ5m_1EB.js.map +0 -1
  79. package/dist/index--U7hHV0s.d.cts.map +0 -1
  80. package/dist/index-CFRgZLhH.d.cts.map +0 -1
  81. package/dist/index-DeD8EI1D.d.ts.map +0 -1
  82. package/dist/index-Dj92T76o.d.ts.map +0 -1
  83. package/dist/index-Uh1u57yq.d.cts.map +0 -1
  84. package/dist/index-WBHSrIUU.d.ts.map +0 -1
  85. package/dist/registry-B23o9UWh.js.map +0 -1
  86. package/dist/registry-Ih5n4PVZ.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod/v4";
2
2
  import { $ZodCheck } from "zod/v4/core";
3
- //#region src/schemas/ai.ts
3
+ // src/schemas/ai.ts
4
4
  /**
5
5
  * What an author allows AI to do for one item: see `ActivityAiPermissions`.
6
6
  * Loose like every content schema, so a key a later release adds survives an
@@ -10,8 +10,7 @@ const AiPermissionsSchema = z.looseObject({
10
10
  explanations: z.boolean().optional(),
11
11
  hints: z.boolean().optional()
12
12
  });
13
- //#endregion
14
- //#region src/schemas/feedback.ts
13
+ // src/schemas/feedback.ts
15
14
  /**
16
15
  * Optional authored "overall feedback" shown after submission, selected by
17
16
  * whether the learner passed (h5p-style overall feedback). Both fields are
@@ -21,8 +20,7 @@ const FeedbackSchema = z.looseObject({
21
20
  correct: z.string().min(1).optional(),
22
21
  incorrect: z.string().min(1).optional()
23
22
  });
24
- //#endregion
25
- //#region src/schemas/text-length.ts
23
+ // src/schemas/text-length.ts
26
24
  /**
27
25
  * `schema`, refusing a string longer than `max` UTF-16 code units — its
28
26
  * JavaScript `length`, the unit these limits have always counted in.
@@ -45,8 +43,7 @@ function maxUnits(schema, max) {
45
43
  });
46
44
  }).meta({ maxLength: max });
47
45
  }
48
- //#endregion
49
- //#region src/schemas/media.ts
46
+ // src/schemas/media.ts
50
47
  /**
51
48
  * Optional media attached to an activity, rendered above the question or
52
49
  * passage — e.g. a recording to listen to, or an embedded video to watch
@@ -244,8 +241,7 @@ const RedactedMediaSchema = z.strictObject({
244
241
  error: "embed media requires an absolute http(s) provider URL. data:, blob:, and relative URLs are not allowed for embeds — the embed iframe runs with allow-scripts, and a data:/same-origin document there is an XSS vector.",
245
242
  path: ["url"]
246
243
  }).refine(posterFits, POSTER_FITS).refine(tracksFit, TRACKS_FIT).refine(tracksAreDistinct, TRACKS_DISTINCT);
247
- //#endregion
248
- //#region src/schemas/fill-in-the-blanks.ts
244
+ // src/schemas/fill-in-the-blanks.ts
249
245
  /**
250
246
  * Matches `{{ blank_id }}` placeholders in a passage, capturing the trimmed id.
251
247
  * Exported for the draft checks in `authoring/`, which must read a passage
@@ -253,6 +249,12 @@ const RedactedMediaSchema = z.strictObject({
253
249
  */
254
250
  const PLACEHOLDER_RE = /\{\{\s*([^{}]+?)\s*\}\}/g;
255
251
  /**
252
+ * The instructions of an item with a passage: plain text, with no `{{id}}`
253
+ * placeholder. Blanks and gaps live in the passage only, and one written here
254
+ * would be shown to the learner as it stands. Shared by Gap Select.
255
+ */
256
+ const PassageInstructionsSchema = z.string().refine((text) => text.match(PLACEHOLDER_RE) === null, { error: "The instructions are plain text: a {{id}} placeholder belongs in the passage, where its blank or gap is." });
257
+ /**
256
258
  * Zod schema for a `TextMatchPolicy` — the opt-in matching tolerances a blank
257
259
  * may declare. Every default reproduces the v1 trim + case-fold semantics.
258
260
  */
@@ -300,6 +302,7 @@ const FillInTheBlanksDataSchema = z.looseObject({
300
302
  type: z.literal("fill-in-the-blanks"),
301
303
  id: z.string().min(1),
302
304
  title: z.string().min(1),
305
+ instructions: PassageInstructionsSchema.optional(),
303
306
  passage: z.string().min(1),
304
307
  passageHtml: z.string().optional(),
305
308
  blanks: z.array(BlankConfigSchema).min(1),
@@ -331,8 +334,7 @@ const FillInTheBlanksDataSchema = z.looseObject({
331
334
  error: "Each blank id must appear exactly once in blanks[] and have exactly one matching {{id}} placeholder in the passage, and vice versa.",
332
335
  path: ["passage"]
333
336
  });
334
- //#endregion
335
- //#region src/answer-leak.ts
337
+ // src/answer-leak.ts
336
338
  /**
337
339
  * Whether a text gives an answer away: the rule an AI hint is held to, and the
338
340
  * one the item critic holds an author's own hint, title and passage to.
@@ -419,8 +421,7 @@ function revealsAnswer(text, answer, passage, position) {
419
421
  if (before === void 0 && after === void 0) return containsWords(words, needle);
420
422
  return before !== void 0 && containsWords(words, [before, ...needle]) || after !== void 0 && containsWords(words, [...needle, after]);
421
423
  }
422
- //#endregion
423
- //#region src/built-in-types.ts
424
+ // src/built-in-types.ts
424
425
  /**
425
426
  * The activity types the SDK ships, in one closed list.
426
427
  *
@@ -456,8 +457,7 @@ function isBuiltInActivityType(type) {
456
457
  * @internal
457
458
  */
458
459
  function everyBuiltInTypeHandled(_value) {}
459
- //#endregion
460
- //#region src/scoring/dictation/edit-distance.ts
460
+ // src/scoring/dictation/edit-distance.ts
461
461
  /**
462
462
  * The code points of `text`, as numbers. A surrogate pair is one code point; a
463
463
  * lone surrogate iterates as one code point too — deterministic, never thrown.
@@ -509,8 +509,7 @@ function similarity(a, b) {
509
509
  const max = Math.max(codePoints(a).length, codePoints(b).length);
510
510
  return max === 0 ? 0 : (max - editDistance(a, b)) / max;
511
511
  }
512
- //#endregion
513
- //#region src/validation-scope.ts
512
+ // src/validation-scope.ts
514
513
  /**
515
514
  * Work shared for the length of one outermost validation call.
516
515
  *
@@ -549,8 +548,7 @@ function scopeCache(key, create) {
549
548
  }
550
549
  return value;
551
550
  }
552
- //#endregion
553
- //#region src/scoring/dictation/unicode-joining.ts
551
+ // src/scoring/dictation/unicode-joining.ts
554
552
  /**
555
553
  * Unicode data the dictation normaliser reads when it decides whether a joiner
556
554
  * changes how the text is drawn (see `normalize.ts`): the viramas, and which
@@ -768,8 +766,7 @@ const JOINS_BACKWARD = [
768
766
  [69577, 69578],
769
767
  [125184, 125251]
770
768
  ];
771
- //#endregion
772
- //#region src/scoring/dictation/normalize.ts
769
+ // src/scoring/dictation/normalize.ts
773
770
  /**
774
771
  * The longest transcript a dictation accepts, in code points, before and after
775
772
  * its equivalences are applied — and its rules may not grow it past twice
@@ -1729,8 +1726,7 @@ function searchReveal(forms, candidate) {
1729
1726
  return fields.some((field) => containsPhrase(field, phrase));
1730
1727
  });
1731
1728
  }
1732
- //#endregion
1733
- //#region src/scoring/dictation/align.ts
1729
+ // src/scoring/dictation/align.ts
1734
1730
  /**
1735
1731
  * The words the scorer can emit a detail for, one list per candidate — index 0
1736
1732
  * is the transcript, index n is `acceptedTranscripts[n − 1]` — each word in the
@@ -1929,8 +1925,7 @@ function alignWords(reference, attempt) {
1929
1925
  }
1930
1926
  return words;
1931
1927
  }
1932
- //#endregion
1933
- //#region src/errors.ts
1928
+ // src/errors.ts
1934
1929
  /** Thrown when activity data fails schema validation at a component boundary. */
1935
1930
  var ActivitySchemaError = class extends Error {
1936
1931
  activityType;
@@ -1984,8 +1979,7 @@ var DeferredScoringError = class extends Error {
1984
1979
  this.name = "DeferredScoringError";
1985
1980
  }
1986
1981
  };
1987
- //#endregion
1988
- //#region src/schemas/after-issues.ts
1982
+ // src/schemas/after-issues.ts
1989
1983
  /**
1990
1984
  * A check zod runs even when another field was refused. An ordinary check is
1991
1985
  * skipped once any issue has been reported, so an author fixing a recording's
@@ -2022,8 +2016,7 @@ function parsedFields(payload) {
2022
2016
  refused
2023
2017
  };
2024
2018
  }
2025
- //#endregion
2026
- //#region src/schemas/dictation.ts
2019
+ // src/schemas/dictation.ts
2027
2020
  /**
2028
2021
  * Zod schema for the slower second recording of a dictation. Loose like every
2029
2022
  * content schema (a sidecar survives), audio only, and — deliberately — with no
@@ -2205,8 +2198,7 @@ function groupCaptionsField(group, written) {
2205
2198
  }
2206
2199
  /** The message every validator gives for {@link groupCaptionsRevealDictation}. */
2207
2200
  const GROUP_CAPTIONS_REVEAL_DICTATION = "The stimulus recording carries captions, and a dictation in this group plays that recording: the captions are the answer. Remove the captions, or give the dictation its own recording.";
2208
- //#endregion
2209
- //#region src/authoring/issues.ts
2201
+ // src/authoring/issues.ts
2210
2202
  /**
2211
2203
  * Every issue code the SDK's draft checks can report, with its severity.
2212
2204
  *
@@ -2542,8 +2534,7 @@ function coveredPathsOf(reported) {
2542
2534
  }
2543
2535
  return covered;
2544
2536
  }
2545
- //#endregion
2546
- //#region src/authoring/dictation.ts
2537
+ // src/authoring/dictation.ts
2547
2538
  /**
2548
2539
  * Draft support for `dictation`.
2549
2540
  *
@@ -2733,8 +2724,7 @@ function checkTolerance(tolerance) {
2733
2724
  }
2734
2725
  return issues;
2735
2726
  }
2736
- //#endregion
2737
- //#region src/count-words.ts
2727
+ // src/count-words.ts
2738
2728
  /**
2739
2729
  * Canonical word counter for written-response bounds: tokens are
2740
2730
  * maximal runs of non-whitespace (split on `\s+`), so hyphenated forms
@@ -2839,8 +2829,7 @@ function levelDistribution(values, count, chosen) {
2839
2829
  const sum = read.reduce((total, p) => total + p, 0);
2840
2830
  return Math.abs(sum - 1) <= 1e-6 && read[chosen] === Math.max(...read) ? read : null;
2841
2831
  }
2842
- //#endregion
2843
- //#region src/scoring/strategies/all-or-nothing.ts
2832
+ // src/scoring/strategies/all-or-nothing.ts
2844
2833
  /**
2845
2834
  * All-or-nothing scoring: full credit only when every item is correct.
2846
2835
  *
@@ -2850,8 +2839,7 @@ function levelDistribution(values, count, chosen) {
2850
2839
  function allOrNothingStrategy(correctItems) {
2851
2840
  return correctItems.every((isCorrect) => isCorrect) ? 1 : 0;
2852
2841
  }
2853
- //#endregion
2854
- //#region src/scoring/strategies/partial.ts
2842
+ // src/scoring/strategies/partial.ts
2855
2843
  /**
2856
2844
  * Partial-credit scoring for Multiple Choice — balanced/symmetric scheme.
2857
2845
  *
@@ -2891,8 +2879,7 @@ function partialStrategy(correctSelected, incorrectSelected, totalCorrect, total
2891
2879
  function partialBlankStrategy(correctBlanks, totalBlanks) {
2892
2880
  return correctBlanks / totalBlanks;
2893
2881
  }
2894
- //#endregion
2895
- //#region src/scoring/text-match.ts
2882
+ // src/scoring/text-match.ts
2896
2883
  /** Combining marks (any script) removed for diacritic folding after NFD decomposition. */
2897
2884
  const COMBINING_MARKS_RE = /\p{M}/gu;
2898
2885
  /**
@@ -2985,8 +2972,7 @@ function matchText(input, accepted, policy = {}) {
2985
2972
  via: "none"
2986
2973
  };
2987
2974
  }
2988
- //#endregion
2989
- //#region src/scoring/activity-scorers/fill-in-the-blanks.ts
2975
+ // src/scoring/activity-scorers/fill-in-the-blanks.ts
2990
2976
  /**
2991
2977
  * Resolves the effective match policy for a blank. The legacy
2992
2978
  * `caseSensitive` / `trimWhitespace` flags map onto the baseline policy
@@ -3030,8 +3016,7 @@ function scoreFillInTheBlanks(data, response) {
3030
3016
  details
3031
3017
  };
3032
3018
  }
3033
- //#endregion
3034
- //#region src/authoring/findings.ts
3019
+ // src/authoring/findings.ts
3035
3020
  /**
3036
3021
  * Every finding code the SDK's item critic can report, with its severity.
3037
3022
  *
@@ -3050,6 +3035,7 @@ const ITEM_FINDING_SEVERITY = {
3050
3035
  fib_hint_reveals_answer: "warning",
3051
3036
  fib_answer_in_passage: "warning",
3052
3037
  fib_accepted_answer_redundant: "advice",
3038
+ fib_tolerance_spans_words: "advice",
3053
3039
  gs_title_reveals_answer: "warning",
3054
3040
  gs_choices_duplicate: "warning",
3055
3041
  gs_bank_no_distractor: "warning",
@@ -3060,7 +3046,12 @@ const ITEM_FINDING_SEVERITY = {
3060
3046
  media_transcript_unused: "advice",
3061
3047
  media_script_differs: "warning",
3062
3048
  media_transcript_differs: "warning",
3063
- set_key_position_same: "warning"
3049
+ set_key_position_same: "warning",
3050
+ set_key_position_bias: "warning",
3051
+ set_key_longest_bias: "warning",
3052
+ set_stem_duplicate: "warning",
3053
+ set_item_answers_item: "warning",
3054
+ set_key_repeated: "advice"
3064
3055
  };
3065
3056
  function finding(code, path, message) {
3066
3057
  return {
@@ -3084,8 +3075,7 @@ function normaliseFinding(found) {
3084
3075
  severity: documented ?? (found.severity === "advice" ? "advice" : "warning")
3085
3076
  };
3086
3077
  }
3087
- //#endregion
3088
- //#region src/authoring/critique.ts
3078
+ // src/authoring/critique.ts
3089
3079
  /**
3090
3080
  * The built-in item critic: what an experienced item writer points out on
3091
3081
  * review, as far as a rule can see it without a model.
@@ -3251,6 +3241,17 @@ function critiqueFillInTheBlanks(draft) {
3251
3241
  laterIndex
3252
3242
  ], `"${laterText}" is already accepted as "${accepted[earlier]}" under this blank's matching.`));
3253
3243
  });
3244
+ const forgiven = policyFor(blank).levenshtein ?? 0;
3245
+ const spanning = accepted.findIndex((answer) => {
3246
+ const text = written(answer);
3247
+ return text !== void 0 && /\s/.test(text.trim());
3248
+ });
3249
+ if (forgiven > 0 && spanning !== -1) findings.push(finding("fib_tolerance_spans_words", [
3250
+ "blanks",
3251
+ index,
3252
+ "acceptedAnswers",
3253
+ spanning
3254
+ ], `Blank ${ordinal(index)} forgives ${forgiven === 1 ? "one edit" : `${forgiven} edits`} over an answer of several words, so "${accepted[spanning]}" with one word in another form is marked right. Make it a one-word blank, or take the tolerance off.`));
3254
3255
  });
3255
3256
  return findings;
3256
3257
  }
@@ -3368,8 +3369,7 @@ function keyPositionFinding(items, path) {
3368
3369
  if (positions.length < KEY_POSITION_MINIMUM || !positions.every((at) => at === positions[0])) return [];
3369
3370
  return [finding("set_key_position_same", path, `In all ${positions.length} single-answer questions the right option is option ${ordinal(positions[0])}. Vary its position, or shuffle the options.`)];
3370
3371
  }
3371
- //#endregion
3372
- //#region src/authoring/fill-in-the-blanks.ts
3372
+ // src/authoring/fill-in-the-blanks.ts
3373
3373
  /**
3374
3374
  * Draft support for `fill-in-the-blanks`.
3375
3375
  *
@@ -3501,8 +3501,7 @@ function pairsOneToOne$1(placeholders, blanks) {
3501
3501
  if (placeholders.size !== blankIds.length) return false;
3502
3502
  return blankIds.every((id) => typeof id === "string" && placeholders.get(id) === 1);
3503
3503
  }
3504
- //#endregion
3505
- //#region src/authoring/gap-select.ts
3504
+ // src/authoring/gap-select.ts
3506
3505
  /** Mirrors `GapSelectChoiceSchema` arrays: `.min(2)` on both a gap's own list and a bank. */
3507
3506
  const MIN_CHOICES = 2;
3508
3507
  /**
@@ -3700,8 +3699,7 @@ function pairsOneToOne(placeholders, gaps) {
3700
3699
  if (new Set(ids).size !== ids.length || placeholders.size !== ids.length) return false;
3701
3700
  return ids.every((id) => typeof id === "string" && placeholders.get(id) === 1);
3702
3701
  }
3703
- //#endregion
3704
- //#region src/schemas/multiple-choice.ts
3702
+ // src/schemas/multiple-choice.ts
3705
3703
  /**
3706
3704
  * Zod schema for a single Multiple Choice option. Loose: unknown keys are
3707
3705
  * preserved through validation (forward-compat / consumer sidecars — B7).
@@ -3765,6 +3763,7 @@ const MultipleChoiceDataSchema = z.looseObject({
3765
3763
  type: z.literal("multiple-choice"),
3766
3764
  id: z.string().min(1),
3767
3765
  title: z.string().min(1),
3766
+ instructions: z.string().optional(),
3768
3767
  question: z.string().min(1),
3769
3768
  questionHtml: z.string().optional(),
3770
3769
  mode: z.enum(["single", "multi"]),
@@ -3794,8 +3793,7 @@ const MultipleChoiceDataSchema = z.looseObject({
3794
3793
  error: "Option ids must be unique within the activity.",
3795
3794
  path: ["options"]
3796
3795
  });
3797
- //#endregion
3798
- //#region src/authoring/multiple-choice.ts
3796
+ // src/authoring/multiple-choice.ts
3799
3797
  /** Mirrors `MultipleChoiceDataSchema`: `options` is `.min(2).max(26)`. */
3800
3798
  const MIN_OPTIONS = 2;
3801
3799
  const MAX_OPTIONS = 26;
@@ -3898,8 +3896,7 @@ function checkOptionMedia(media, index, ordinal) {
3898
3896
  if (kind === "video" || kind === "embed") return [issue("mc_option_media_kind", [...path, "type"], `Option ${ordinal} carries ${kind === "embed" ? "an embedded player" : "a video"}, which cannot be an option: its controls swallow the click that selects the answer. Use a picture or a recording.`)];
3899
3897
  return checkMedia(media, path, MultipleChoiceOptionMediaSchema);
3900
3898
  }
3901
- //#endregion
3902
- //#region src/scoring/speech/limits.ts
3899
+ // src/scoring/speech/limits.ts
3903
3900
  /**
3904
3901
  * The longest reference text a read-aloud item accepts, in code points, before
3905
3902
  * and after normalisation. It is the dictation transcript cap on purpose: the
@@ -3949,8 +3946,7 @@ const SPEECH_ASSESSMENT_MAX_WORDS = 1e3;
3949
3946
  * read-aloud item comes near it.
3950
3947
  */
3951
3948
  const SPEECH_ASSESSMENT_MAX_TEXT_LENGTH = DICTATION_MAX_TEXT_LENGTH;
3952
- //#endregion
3953
- //#region src/scoring/speech/locale.ts
3949
+ // src/scoring/speech/locale.ts
3954
3950
  /**
3955
3951
  * A BCP 47 tag in the one spelling read-aloud accepts: a lowercase language of
3956
3952
  * two or three letters, an optional title-case script, and a region of two
@@ -3966,8 +3962,7 @@ const SPEECH_ASSESSMENT_MAX_TEXT_LENGTH = DICTATION_MAX_TEXT_LENGTH;
3966
3962
  * Internal: the content schema and the assessment validator share it.
3967
3963
  */
3968
3964
  const CANONICAL_LOCALE_RE = /^[a-z]{2,3}(?:-[A-Z][a-z]{3})?-(?:[A-Z]{2}|[0-9]{3})$/;
3969
- //#endregion
3970
- //#region src/schemas/read-aloud.ts
3965
+ // src/schemas/read-aloud.ts
3971
3966
  /** The dimensions a read-aloud grade can be made of, in the order they are documented. */
3972
3967
  const READ_ALOUD_DIMENSIONS = [
3973
3968
  "accuracy",
@@ -4120,8 +4115,7 @@ const ReadAloudDataSchema = z.looseObject({
4120
4115
  if (minSeconds !== void 0 && minSeconds >= maxSeconds) report(["recording", "minSeconds"], minSeconds, "The shortest take must be shorter than the longest.");
4121
4116
  }
4122
4117
  }));
4123
- //#endregion
4124
- //#region src/authoring/read-aloud.ts
4118
+ // src/authoring/read-aloud.ts
4125
4119
  /**
4126
4120
  * Draft support for `read-aloud`.
4127
4121
  *
@@ -4284,8 +4278,7 @@ function checkSlowRecording(draft) {
4284
4278
  if (typeof slow.url === "string" && slow.url !== "" && slow.url === media.url) issues.push(issue("ra_slow_media_same_recording", ["slowMedia", "url"], "The slow model recording is the same file as the recording. Point it at the slower reading."));
4285
4279
  return issues;
4286
4280
  }
4287
- //#endregion
4288
- //#region src/authoring/written-response.ts
4281
+ // src/authoring/written-response.ts
4289
4282
  /**
4290
4283
  * Draft support for `written-response`.
4291
4284
  *
@@ -4373,8 +4366,7 @@ function checkCriteria(criteria) {
4373
4366
  else if (totalWeight === Number.POSITIVE_INFINITY) issues.push(issue("wr_rubric_weights_too_large", ["rubric", "criteria"], "The rubric weights add up to more than can be calculated with. Use smaller weights."));
4374
4367
  return issues;
4375
4368
  }
4376
- //#endregion
4377
- //#region src/schemas/gap-select.ts
4369
+ // src/schemas/gap-select.ts
4378
4370
  /**
4379
4371
  * Zod schema for one selectable choice. Loose, like every other schema here:
4380
4372
  * unknown keys are preserved so a consumer sidecar survives validation.
@@ -4438,6 +4430,7 @@ const GapSelectDataSchema = z.looseObject({
4438
4430
  type: z.literal("gap-select"),
4439
4431
  id: z.string().min(1),
4440
4432
  title: z.string().min(1),
4433
+ instructions: PassageInstructionsSchema.optional(),
4441
4434
  passage: z.string().min(1),
4442
4435
  passageHtml: z.string().optional(),
4443
4436
  gaps: z.array(GapSelectGapSchema).min(1),
@@ -4498,8 +4491,7 @@ const GapSelectDataSchema = z.looseObject({
4498
4491
  error: "Each gap needs unique choice ids and a `correctChoiceId` that is one of the choices it offers.",
4499
4492
  path: ["gaps"]
4500
4493
  });
4501
- //#endregion
4502
- //#region src/schemas/written-response.ts
4494
+ // src/schemas/written-response.ts
4503
4495
  /** Zod schema for a single rubric criterion. Loose: unknown keys preserved. */
4504
4496
  const WrittenResponseRubricCriterionSchema = z.looseObject({
4505
4497
  name: z.string().min(1),
@@ -4570,8 +4562,7 @@ const WrittenResponseDataSchema = z.looseObject({
4570
4562
  error: "maxWords must be greater than or equal to minWords.",
4571
4563
  path: ["maxWords"]
4572
4564
  });
4573
- //#endregion
4574
- //#region src/schemas/redacted.ts
4565
+ // src/schemas/redacted.ts
4575
4566
  /**
4576
4567
  * Schemas for REDACTED activity data — the learner-safe projection `redact()`
4577
4568
  * produces (R7). Deliberately STRICT (`z.strictObject`), the opposite of the
@@ -4635,6 +4626,7 @@ const RedactedMultipleChoiceOptionSchema = z.strictObject({
4635
4626
  const RedactedMultipleChoiceDataSchema = z.strictObject({
4636
4627
  ...redactedBase,
4637
4628
  type: z.literal("multiple-choice"),
4629
+ instructions: z.string().optional(),
4638
4630
  question: z.string().min(1),
4639
4631
  questionHtml: z.string().optional(),
4640
4632
  mode: z.enum(["single", "multi"]),
@@ -4650,6 +4642,7 @@ const RedactedBlankConfigSchema = z.strictObject({
4650
4642
  const RedactedFillInTheBlanksDataSchema = z.strictObject({
4651
4643
  ...redactedBase,
4652
4644
  type: z.literal("fill-in-the-blanks"),
4645
+ instructions: z.string().optional(),
4653
4646
  passage: z.string().min(1),
4654
4647
  passageHtml: z.string().optional(),
4655
4648
  blanks: z.array(RedactedBlankConfigSchema).min(1)
@@ -4688,6 +4681,7 @@ const RedactedGapSelectGapSchema = z.strictObject({
4688
4681
  const RedactedGapSelectDataSchema = z.strictObject({
4689
4682
  ...redactedBase,
4690
4683
  type: z.literal("gap-select"),
4684
+ instructions: z.string().optional(),
4691
4685
  passage: z.string().min(1),
4692
4686
  passageHtml: z.string().optional(),
4693
4687
  gaps: z.array(RedactedGapSelectGapSchema).min(1),
@@ -4813,8 +4807,7 @@ const RedactedReadAloudDataSchema = z.strictObject({
4813
4807
  path: ["slowMedia", "url"]
4814
4808
  });
4815
4809
  });
4816
- //#endregion
4817
- //#region src/scoring/activity-scorers/dictation.ts
4810
+ // src/scoring/activity-scorers/dictation.ts
4818
4811
  /**
4819
4812
  * Scores a Dictation response: the character-level similarity of what the
4820
4813
  * learner typed to the transcript, over the whole sentence.
@@ -4853,8 +4846,7 @@ function scoreDictation(data, response) {
4853
4846
  details
4854
4847
  };
4855
4848
  }
4856
- //#endregion
4857
- //#region src/scoring/activity-scorers/gap-select.ts
4849
+ // src/scoring/activity-scorers/gap-select.ts
4858
4850
  /**
4859
4851
  * The choices a gap offers: its own list, or the bank it names.
4860
4852
  *
@@ -4908,8 +4900,7 @@ function scoreGapSelect(data, response) {
4908
4900
  details
4909
4901
  };
4910
4902
  }
4911
- //#endregion
4912
- //#region src/scoring/activity-scorers/multiple-choice.ts
4903
+ // src/scoring/activity-scorers/multiple-choice.ts
4913
4904
  /**
4914
4905
  * Scores a Multiple Choice response. Pure; trusts its typed inputs (validation
4915
4906
  * is the component boundary's job). Options are looked up by id; an unknown
@@ -4953,8 +4944,7 @@ function scoreMultipleChoice(data, response) {
4953
4944
  details
4954
4945
  };
4955
4946
  }
4956
- //#endregion
4957
- //#region src/registry/define.ts
4947
+ // src/registry/define.ts
4958
4948
  /**
4959
4949
  * Identity helper that gives full type inference when authoring a descriptor:
4960
4950
  *
@@ -4969,8 +4959,7 @@ function scoreMultipleChoice(data, response) {
4969
4959
  function defineActivityType(descriptor) {
4970
4960
  return descriptor;
4971
4961
  }
4972
- //#endregion
4973
- //#region src/registry/keep-when.ts
4962
+ // src/registry/keep-when.ts
4974
4963
  /**
4975
4964
  * A nested field policy that keeps its field only when the field's value
4976
4965
  * passes a test. Internal: the symbol is never exported, so no host policy can
@@ -4995,8 +4984,7 @@ function keepWhen(policy, test) {
4995
4984
  function guardOf(policy) {
4996
4985
  return policy[KEEP_WHEN];
4997
4986
  }
4998
- //#endregion
4999
- //#region src/registry/builtins.ts
4987
+ // src/registry/builtins.ts
5000
4988
  /**
5001
4989
  * Where the built-in types keep their files (`mediaSlots`). Every type has its
5002
4990
  * `media`; dictation and read-aloud add a slower recording; a multiple-choice
@@ -5114,6 +5102,7 @@ const TEXT_MATCH_FIELD_POLICY = {
5114
5102
  };
5115
5103
  const MULTIPLE_CHOICE_FIELD_POLICY = {
5116
5104
  ...SHARED_PUBLIC_FIELDS,
5105
+ instructions: "public",
5117
5106
  question: "public",
5118
5107
  questionHtml: "public",
5119
5108
  mode: "public",
@@ -5148,6 +5137,7 @@ const MULTIPLE_CHOICE_FIELD_POLICY = {
5148
5137
  */
5149
5138
  const GAP_SELECT_FIELD_POLICY = {
5150
5139
  ...SHARED_PUBLIC_FIELDS,
5140
+ instructions: "public",
5151
5141
  passage: "public",
5152
5142
  passageHtml: "public",
5153
5143
  presentation: "public",
@@ -5174,6 +5164,7 @@ const GAP_SELECT_FIELD_POLICY = {
5174
5164
  };
5175
5165
  const FILL_IN_THE_BLANKS_FIELD_POLICY = {
5176
5166
  ...SHARED_PUBLIC_FIELDS,
5167
+ instructions: "public",
5177
5168
  passage: "public",
5178
5169
  passageHtml: "public",
5179
5170
  scoringStrategy: "answer-key",
@@ -5476,8 +5467,7 @@ const BUILT_IN_DESCRIPTORS = {
5476
5467
  dictation: dictationType,
5477
5468
  "read-aloud": readAloudType
5478
5469
  };
5479
- //#endregion
5480
- //#region src/schemas/read-schema.ts
5470
+ // src/schemas/read-schema.ts
5481
5471
  /**
5482
5472
  * How every entry point reads a schema — `validateActivity`, `validateDraft`,
5483
5473
  * `validateItemGroup`, `redact`, `assertRedacted` — so a schema is read one way
@@ -5593,8 +5583,7 @@ function standardJsonSchemaOf(schema, target = "draft-07") {
5593
5583
  const generated = converter.output({ target });
5594
5584
  return generated !== null && typeof generated === "object" && !Array.isArray(generated) ? generated : void 0;
5595
5585
  }
5596
- //#endregion
5597
- //#region src/registry/registry.ts
5586
+ // src/registry/registry.ts
5598
5587
  /**
5599
5588
  * Module-scoped default registry (deliberate — no registry instances until a
5600
5589
  * second consumer exists), created holding the SDK's own types.
@@ -5640,7 +5629,6 @@ function getActivityTypeDescriptor(type) {
5640
5629
  function registeredActivityTypes() {
5641
5630
  return [...registry.keys()];
5642
5631
  }
5643
- //#endregion
5644
- export { DeferredScoringError as $, normaliseFinding as A, coveredPathsOf as B, READ_ALOUD_MAX_TAKES as C, MediaSchema as Ct, MultipleChoiceOptionMediaSchema as D, maxUnits as Dt, MultipleChoiceDataSchema as E, ScriptSchema as Et, levelKey as F, isUnwritten as G, isMissingId as H, readRubricLevels as I, refusesEmpty as J, issue as K, countWords as L, matchText as M, LEVEL_PROBABILITY_TOLERANCE as N, keyPositionFinding as O, levelDistribution as P, ActivitySchemaError as Q, DRAFT_ISSUE_SEVERITY as R, READ_ALOUD_MAX_SECONDS as S, FillInTheBlanksDataSchema as St, SPEECH_ASSESSMENT_MAX_WORDS as T, SCRIPT_MAX_TURNS as Tt, isRecord as U, covers as V, isUnset as W, GROUP_CAPTIONS_REVEAL_DICTATION as X, DictationDataSchema as Y, groupCaptionsField as Z, GapSelectDataSchema as _, containsWords as _t, readSchema as a, dictationReferenceWords as at, READ_ALOUD_MAX_DIMENSION_WEIGHT as b, placeholderOrder as bt, dictationType as c, DICTATION_MAX_EQUIVALENCE_LENGTH as ct, multipleChoiceType as d, codePointLength as dt, RedactedScoringError as et, readAloudType as f, normalizeDictationText as ft, WrittenResponseDataSchema as g, isBuiltInActivityType as gt, defineActivityType as h, everyBuiltInTypeHandled as ht, isOwnSchema as i, alignSequences as it, levenshteinDistance as j, finding as k, fillInTheBlanksType as l, DICTATION_MAX_TEXT_LENGTH as lt, guardOf as m, BUILT_IN_ACTIVITY_TYPES as mt, registerActivityType as n, STEP as nt, standardJsonSchemaOf as o, DICTATION_MAX_ACCEPTED_TRANSCRIPTS as ot, writtenResponseType as p, withValidationScope as pt, pathKey as q, registeredActivityTypes as r, alignDictation as rt, MEDIA_FIELD_POLICY as s, DICTATION_MAX_EQUIVALENCES as st, getActivityTypeDescriptor as t, UnknownActivityTypeError as tt, gapSelectType as u, DICTATION_MAX_TRANSCRIPT_LENGTH as ut, ReadAloudDataSchema as v, fold as vt, SPEECH_ASSESSMENT_MAX_TEXT_LENGTH as w, RedactedMediaSchema as wt, READ_ALOUD_MAX_REFERENCE_LENGTH as x, revealsAnswer as xt, CANONICAL_LOCALE_RE as y, numberedPassage as yt, checkMedia as z };
5632
+ export { ActivitySchemaError as $, normaliseFinding as A, maxUnits as At, checkMedia as B, READ_ALOUD_MAX_TAKES as C, revealsAnswer as Ct, MultipleChoiceOptionMediaSchema as D, RedactedMediaSchema as Dt, MultipleChoiceDataSchema as E, MediaSchema as Et, levelDistribution as F, isUnset as G, covers as H, levelKey as I, pathKey as J, isUnwritten as K, readRubricLevels as L, levenshteinDistance as M, matchText as N, keyPositionFinding as O, SCRIPT_MAX_TURNS as Ot, LEVEL_PROBABILITY_TOLERANCE as P, groupCaptionsField as Q, countWords as R, READ_ALOUD_MAX_SECONDS as S, placeholderOrder as St, SPEECH_ASSESSMENT_MAX_WORDS as T, PLACEHOLDER_RE as Tt, isMissingId as U, coveredPathsOf as V, isRecord as W, DictationDataSchema as X, refusesEmpty as Y, GROUP_CAPTIONS_REVEAL_DICTATION as Z, GapSelectDataSchema as _, isBuiltInActivityType as _t, readSchema as a, alignSequences as at, READ_ALOUD_MAX_DIMENSION_WEIGHT as b, numberedPassage as bt, dictationType as c, DICTATION_MAX_EQUIVALENCES as ct, multipleChoiceType as d, DICTATION_MAX_TRANSCRIPT_LENGTH as dt, DeferredScoringError as et, readAloudType as f, codePointLength as ft, WrittenResponseDataSchema as g, everyBuiltInTypeHandled as gt, defineActivityType as h, BUILT_IN_ACTIVITY_TYPES as ht, isOwnSchema as i, alignDictation as it, policyFor as j, finding as k, ScriptSchema as kt, fillInTheBlanksType as l, DICTATION_MAX_EQUIVALENCE_LENGTH as lt, guardOf as m, withValidationScope as mt, registerActivityType as n, UnknownActivityTypeError as nt, standardJsonSchemaOf as o, dictationReferenceWords as ot, writtenResponseType as p, normalizeDictationText as pt, issue as q, registeredActivityTypes as r, STEP as rt, MEDIA_FIELD_POLICY as s, DICTATION_MAX_ACCEPTED_TRANSCRIPTS as st, getActivityTypeDescriptor as t, RedactedScoringError as tt, gapSelectType as u, DICTATION_MAX_TEXT_LENGTH as ut, ReadAloudDataSchema as v, containsWords as vt, SPEECH_ASSESSMENT_MAX_TEXT_LENGTH as w, FillInTheBlanksDataSchema as wt, READ_ALOUD_MAX_REFERENCE_LENGTH as x, passageWithoutPlaceholders as xt, CANONICAL_LOCALE_RE as y, fold as yt, DRAFT_ISSUE_SEVERITY as z };
5645
5633
 
5646
- //# sourceMappingURL=registry-B23o9UWh.js.map
5634
+ //# sourceMappingURL=registry-tkacvJUI.js.map