@intellectif/lk-core 1.5.0 → 1.6.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 (78) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/ai-check.cjs +2 -2
  3. package/dist/ai-check.d.cts +1 -1
  4. package/dist/ai-check.d.ts +1 -1
  5. package/dist/ai-check.js +2 -2
  6. package/dist/{ai-BYryFkF9.d.ts → ai-i3jwXnpX.d.cts} +45 -4
  7. package/dist/ai-i3jwXnpX.d.cts.map +1 -0
  8. package/dist/{ai-BYryFkF9.d.cts → ai-i3jwXnpX.d.ts} +45 -4
  9. package/dist/ai-i3jwXnpX.d.ts.map +1 -0
  10. package/dist/{ai-writing-Cen7-3qs.cjs → ai-writing-C4YRVrFi.cjs} +275 -15
  11. package/dist/ai-writing-C4YRVrFi.cjs.map +1 -0
  12. package/dist/{ai-writing-D8PdhJJz.js → ai-writing-OJ5m_1EB.js} +273 -31
  13. package/dist/ai-writing-OJ5m_1EB.js.map +1 -0
  14. package/dist/{index-D7R3Ll8R.d.cts → index--U7hHV0s.d.cts} +2 -2
  15. package/dist/{index-D7R3Ll8R.d.cts.map → index--U7hHV0s.d.cts.map} +1 -1
  16. package/dist/{index-qMbxed1B.d.cts → index-CFRgZLhH.d.cts} +41 -12
  17. package/dist/index-CFRgZLhH.d.cts.map +1 -0
  18. package/dist/{index-DUaW1Tj5.d.ts → index-DeD8EI1D.d.ts} +2 -2
  19. package/dist/{index-DUaW1Tj5.d.ts.map → index-DeD8EI1D.d.ts.map} +1 -1
  20. package/dist/{index-wMc1E_aM.d.ts → index-Dj92T76o.d.ts} +2 -2
  21. package/dist/{index-wMc1E_aM.d.ts.map → index-Dj92T76o.d.ts.map} +1 -1
  22. package/dist/{index-Bg0aeWtM.d.cts → index-Uh1u57yq.d.cts} +2 -2
  23. package/dist/{index-Bg0aeWtM.d.cts.map → index-Uh1u57yq.d.cts.map} +1 -1
  24. package/dist/{index-CxpiWedW.d.ts → index-WBHSrIUU.d.ts} +41 -12
  25. package/dist/index-WBHSrIUU.d.ts.map +1 -0
  26. package/dist/index.cjs +63 -7
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +137 -5
  29. package/dist/index.d.cts.map +1 -1
  30. package/dist/index.d.ts +137 -5
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +58 -8
  33. package/dist/index.js.map +1 -1
  34. package/dist/{item-group-DdSUCUjM.js → item-group-BbvvH_Ob.js} +3 -2
  35. package/dist/item-group-BbvvH_Ob.js.map +1 -0
  36. package/dist/{item-group-DEB7nLID.cjs → item-group-CQRbb8Rx.cjs} +3 -2
  37. package/dist/item-group-CQRbb8Rx.cjs.map +1 -0
  38. package/dist/{registry-DaZRpqjW.js → registry-B23o9UWh.js} +65 -18
  39. package/dist/registry-B23o9UWh.js.map +1 -0
  40. package/dist/{registry-Ce00A_OW.cjs → registry-Ih5n4PVZ.cjs} +82 -17
  41. package/dist/registry-Ih5n4PVZ.cjs.map +1 -0
  42. package/dist/{schemas-DksueYsu.cjs → schemas-Q2dyOgc2.cjs} +77 -14
  43. package/dist/schemas-Q2dyOgc2.cjs.map +1 -0
  44. package/dist/{schemas-BioKFf3F.js → schemas-yId-bJhD.js} +72 -15
  45. package/dist/schemas-yId-bJhD.js.map +1 -0
  46. package/dist/schemas.cjs +5 -2
  47. package/dist/schemas.d.cts +2 -2
  48. package/dist/schemas.d.ts +2 -2
  49. package/dist/schemas.js +4 -3
  50. package/dist/{scoring-BKNNTz-s.js → scoring-CLMdk8i9.js} +2 -2
  51. package/dist/{scoring-BKNNTz-s.js.map → scoring-CLMdk8i9.js.map} +1 -1
  52. package/dist/{scoring-lKQVYsxy.cjs → scoring-CaPS6q8b.cjs} +2 -2
  53. package/dist/{scoring-lKQVYsxy.cjs.map → scoring-CaPS6q8b.cjs.map} +1 -1
  54. package/dist/scoring.cjs +2 -2
  55. package/dist/scoring.d.cts +2 -2
  56. package/dist/scoring.d.ts +2 -2
  57. package/dist/scoring.js +2 -2
  58. package/dist/{xapi-NYrTlpID.cjs → xapi-BX0hvRRB.cjs} +2 -2
  59. package/dist/{xapi-NYrTlpID.cjs.map → xapi-BX0hvRRB.cjs.map} +1 -1
  60. package/dist/{xapi-wR6gu4qS.js → xapi-Cdk9fTvV.js} +2 -2
  61. package/dist/{xapi-wR6gu4qS.js.map → xapi-Cdk9fTvV.js.map} +1 -1
  62. package/dist/xapi.cjs +1 -1
  63. package/dist/xapi.d.cts +1 -1
  64. package/dist/xapi.d.ts +1 -1
  65. package/dist/xapi.js +1 -1
  66. package/package.json +1 -1
  67. package/dist/ai-BYryFkF9.d.cts.map +0 -1
  68. package/dist/ai-BYryFkF9.d.ts.map +0 -1
  69. package/dist/ai-writing-Cen7-3qs.cjs.map +0 -1
  70. package/dist/ai-writing-D8PdhJJz.js.map +0 -1
  71. package/dist/index-CxpiWedW.d.ts.map +0 -1
  72. package/dist/index-qMbxed1B.d.cts.map +0 -1
  73. package/dist/item-group-DEB7nLID.cjs.map +0 -1
  74. package/dist/item-group-DdSUCUjM.js.map +0 -1
  75. package/dist/registry-Ce00A_OW.cjs.map +0 -1
  76. package/dist/registry-DaZRpqjW.js.map +0 -1
  77. package/dist/schemas-BioKFf3F.js.map +0 -1
  78. package/dist/schemas-DksueYsu.cjs.map +0 -1
@@ -157,6 +157,20 @@ const MediaTrackSchema = zod_v4.strictObject({
157
157
  default: zod_v4.boolean().optional()
158
158
  });
159
159
  const MAX_TRACKS = 12;
160
+ /** The most turns a recording's `script` may hold. */
161
+ const SCRIPT_MAX_TURNS = 500;
162
+ /**
163
+ * One speaker's turn in an author-only `script`. Loose, as content is: a host
164
+ * may keep its own fields on a turn (the voice it cast, a direction for it).
165
+ * Unlike a track's, both fields are required, so a misspelt one is still
166
+ * caught.
167
+ */
168
+ const ScriptTurnSchema = zod_v4.looseObject({
169
+ speaker: maxUnits(zod_v4.string(), 60).refine((speaker) => speaker.trim().length > 0, { error: "A script turn needs a speaker." }),
170
+ text: zod_v4.string().refine((text) => text.trim().length > 0, { error: "A script turn needs words." })
171
+ });
172
+ /** An author-only `script`: one turn or more, in the order they are spoken. */
173
+ const ScriptSchema = zod_v4.array(ScriptTurnSchema).min(1).max(500);
160
174
  /** `poster` on anything but a video: an image with nothing to stand in for. */
161
175
  function posterFits(m) {
162
176
  return m.poster === void 0 || m.type === "video";
@@ -199,7 +213,9 @@ const MediaSchema = zod_v4.looseObject({
199
213
  captionsUrl: MediaUrlSchema.optional(),
200
214
  tracks: zod_v4.array(MediaTrackSchema).min(1).max(MAX_TRACKS).optional(),
201
215
  poster: MediaUrlSchema.optional(),
202
- playback: MediaPlaybackSchema.optional()
216
+ playback: MediaPlaybackSchema.optional(),
217
+ transcript: zod_v4.string().optional(),
218
+ script: ScriptSchema.optional()
203
219
  }).refine((m) => m.type !== "image" && m.type !== "embed" || typeof m.alt === "string" && m.alt.length > 0, {
204
220
  error: "image and embed media require non-empty alt text (WCAG 1.1.1 / 4.1.2).",
205
221
  path: ["alt"]
@@ -3064,6 +3080,9 @@ const ITEM_FINDING_SEVERITY = {
3064
3080
  wr_criterion_name_duplicate: "warning",
3065
3081
  wr_levels_unreadable: "warning",
3066
3082
  ra_text_long_for_time: "warning",
3083
+ media_transcript_unused: "advice",
3084
+ media_script_differs: "warning",
3085
+ media_transcript_differs: "warning",
3067
3086
  set_key_position_same: "warning"
3068
3087
  };
3069
3088
  function finding(code, path, message) {
@@ -3732,7 +3751,9 @@ const MultipleChoiceOptionMediaSchema = zod_v4.looseObject({
3732
3751
  type: zod_v4.enum(["image", "audio"]),
3733
3752
  url: MediaUrlSchema,
3734
3753
  alt: zod_v4.string().min(1).optional(),
3735
- captionsUrl: MediaUrlSchema.optional()
3754
+ captionsUrl: MediaUrlSchema.optional(),
3755
+ transcript: zod_v4.string().optional(),
3756
+ script: ScriptSchema.optional()
3736
3757
  }).refine((media) => media.type !== "image" || media.alt !== void 0 && media.alt !== "", {
3737
3758
  error: "An image option requires a non-empty `alt`.",
3738
3759
  path: ["alt"]
@@ -5000,6 +5021,21 @@ function guardOf(policy) {
5000
5021
  //#endregion
5001
5022
  //#region src/registry/builtins.ts
5002
5023
  /**
5024
+ * Where the built-in types keep their files (`mediaSlots`). Every type has its
5025
+ * `media`; dictation and read-aloud add a slower recording; a multiple-choice
5026
+ * option may carry a picture or a recording of its own.
5027
+ */
5028
+ const MAIN_MEDIA = [{ path: ["media"] }];
5029
+ const MAIN_AND_SLOW_MEDIA = [{ path: ["media"] }, { path: ["slowMedia"] }];
5030
+ function multipleChoiceMediaSlots(data) {
5031
+ const options = Array.isArray(data.options) ? data.options : [];
5032
+ return [...MAIN_MEDIA, ...options.map((_, index) => ({ path: [
5033
+ "options",
5034
+ index,
5035
+ "media"
5036
+ ] }))];
5037
+ }
5038
+ /**
5003
5039
  * Field-sensitivity policies for the built-in types (R7). Fail-closed:
5004
5040
  * anything not listed here is dropped by `redact()`. `scoringStrategy` is
5005
5041
  * answer-key everywhere — MC `partial` penalises wrong selections while
@@ -5019,10 +5055,11 @@ function guardOf(policy) {
5019
5055
  * documents ("a field the policy does not classify is removed") stopped at the
5020
5056
  * media boundary. It no longer does.
5021
5057
  *
5022
- * Everything here is public by necessity: the client is the thing that renders
5023
- * and enforces the policy, and "1 play remaining" is text the learner has to
5024
- * read. None of it is an answer key — a listening paper's answer key is
5025
- * `stimulus.transcript`, which stays `author-only`.
5058
+ * Public by necessity, except what the recording says: the client is the thing
5059
+ * that renders and enforces the policy, and "1 play remaining" is text the
5060
+ * learner has to read. `transcript` and `script` are the exception, and
5061
+ * `author-only`: what a listening question's recording says is that question's
5062
+ * answer, as `stimulus.transcript` is a listening paper's.
5026
5063
  */
5027
5064
  const MEDIA_FIELD_POLICY = {
5028
5065
  type: "public",
@@ -5043,7 +5080,9 @@ const MEDIA_FIELD_POLICY = {
5043
5080
  seek: "public",
5044
5081
  rate: "public",
5045
5082
  nativeControlHints: "public"
5046
- }
5083
+ },
5084
+ transcript: "author-only",
5085
+ script: "author-only"
5047
5086
  };
5048
5087
  const SHARED_PUBLIC_FIELDS = {
5049
5088
  schemaVersion: "public",
@@ -5113,7 +5152,9 @@ const MULTIPLE_CHOICE_FIELD_POLICY = {
5113
5152
  type: "public",
5114
5153
  url: "public",
5115
5154
  alt: "public",
5116
- captionsUrl: "public"
5155
+ captionsUrl: "public",
5156
+ transcript: "author-only",
5157
+ script: "author-only"
5117
5158
  }
5118
5159
  }
5119
5160
  };
@@ -5253,7 +5294,8 @@ const multipleChoiceType = defineActivityType({
5253
5294
  "option-deselected",
5254
5295
  "submitted"
5255
5296
  ],
5256
- authoring: multipleChoiceAuthoring
5297
+ authoring: multipleChoiceAuthoring,
5298
+ mediaSlots: multipleChoiceMediaSlots
5257
5299
  });
5258
5300
  /** Built-in Fill-in-the-Blanks descriptor. */
5259
5301
  const fillInTheBlanksType = defineActivityType({
@@ -5276,7 +5318,8 @@ const fillInTheBlanksType = defineActivityType({
5276
5318
  "hint-requested",
5277
5319
  "submitted"
5278
5320
  ],
5279
- authoring: fillInTheBlanksAuthoring
5321
+ authoring: fillInTheBlanksAuthoring,
5322
+ mediaSlots: () => MAIN_MEDIA
5280
5323
  });
5281
5324
  /**
5282
5325
  * Built-in Written Response descriptor. Grading is DEFERRED: submissions are
@@ -5308,7 +5351,8 @@ const writtenResponseType = defineActivityType({
5308
5351
  correctResponsesPattern: () => []
5309
5352
  },
5310
5353
  interactions: ["text-changed", "submitted"],
5311
- authoring: writtenResponseAuthoring
5354
+ authoring: writtenResponseAuthoring,
5355
+ mediaSlots: () => MAIN_MEDIA
5312
5356
  });
5313
5357
  /** Built-in Gap Select descriptor. */
5314
5358
  const gapSelectType = defineActivityType({
@@ -5327,7 +5371,8 @@ const gapSelectType = defineActivityType({
5327
5371
  correctResponsesPattern: (data) => [data.gaps.map((gap) => `${gap.id}[.]${gap.correctChoiceId}`).join("[,]")]
5328
5372
  },
5329
5373
  interactions: ["gap-selected", "submitted"],
5330
- authoring: gapSelectAuthoring
5374
+ authoring: gapSelectAuthoring,
5375
+ mediaSlots: () => MAIN_MEDIA
5331
5376
  });
5332
5377
  /**
5333
5378
  * Built-in Dictation descriptor. Graded synchronously: the score is the
@@ -5354,7 +5399,8 @@ const dictationType = defineActivityType({
5354
5399
  "hint-requested",
5355
5400
  "submitted"
5356
5401
  ],
5357
- authoring: dictationAuthoring
5402
+ authoring: dictationAuthoring,
5403
+ mediaSlots: () => MAIN_AND_SLOW_MEDIA
5358
5404
  });
5359
5405
  /**
5360
5406
  * Read Aloud, the type with no answer key at all.
@@ -5435,7 +5481,8 @@ const readAloudType = defineActivityType({
5435
5481
  "recording-uploaded",
5436
5482
  "submitted"
5437
5483
  ],
5438
- authoring: readAloudAuthoring
5484
+ authoring: readAloudAuthoring,
5485
+ mediaSlots: () => MAIN_AND_SLOW_MEDIA
5439
5486
  });
5440
5487
  /**
5441
5488
  * The SDK's own types, by type: what the registry is created holding
@@ -5563,10 +5610,10 @@ function isStandardSchema(value) {
5563
5610
  * A schema's own JSON Schema, when it implements the Standard JSON Schema
5564
5611
  * converter (`'~standard'.jsonSchema`) — zod 4.6 does — or `undefined`.
5565
5612
  */
5566
- function standardJsonSchemaOf(schema) {
5613
+ function standardJsonSchemaOf(schema, target = "draft-07") {
5567
5614
  const converter = schema["~standard"].jsonSchema;
5568
5615
  if (typeof converter?.output !== "function") return;
5569
- const generated = converter.output({ target: "draft-07" });
5616
+ const generated = converter.output({ target });
5570
5617
  return generated !== null && typeof generated === "object" && !Array.isArray(generated) ? generated : void 0;
5571
5618
  }
5572
5619
  //#endregion
@@ -5773,6 +5820,12 @@ Object.defineProperty(exports, "RedactedScoringError", {
5773
5820
  return RedactedScoringError;
5774
5821
  }
5775
5822
  });
5823
+ Object.defineProperty(exports, "SCRIPT_MAX_TURNS", {
5824
+ enumerable: true,
5825
+ get: function() {
5826
+ return SCRIPT_MAX_TURNS;
5827
+ }
5828
+ });
5776
5829
  Object.defineProperty(exports, "SPEECH_ASSESSMENT_MAX_TEXT_LENGTH", {
5777
5830
  enumerable: true,
5778
5831
  get: function() {
@@ -5791,6 +5844,12 @@ Object.defineProperty(exports, "STEP", {
5791
5844
  return STEP;
5792
5845
  }
5793
5846
  });
5847
+ Object.defineProperty(exports, "ScriptSchema", {
5848
+ enumerable: true,
5849
+ get: function() {
5850
+ return ScriptSchema;
5851
+ }
5852
+ });
5794
5853
  Object.defineProperty(exports, "UnknownActivityTypeError", {
5795
5854
  enumerable: true,
5796
5855
  get: function() {
@@ -5887,6 +5946,12 @@ Object.defineProperty(exports, "fillInTheBlanksType", {
5887
5946
  return fillInTheBlanksType;
5888
5947
  }
5889
5948
  });
5949
+ Object.defineProperty(exports, "finding", {
5950
+ enumerable: true,
5951
+ get: function() {
5952
+ return finding;
5953
+ }
5954
+ });
5890
5955
  Object.defineProperty(exports, "fold", {
5891
5956
  enumerable: true,
5892
5957
  get: function() {
@@ -6092,4 +6157,4 @@ Object.defineProperty(exports, "writtenResponseType", {
6092
6157
  }
6093
6158
  });
6094
6159
 
6095
- //# sourceMappingURL=registry-Ce00A_OW.cjs.map
6160
+ //# sourceMappingURL=registry-Ih5n4PVZ.cjs.map