@intellectif/lk-core 1.2.0 → 1.4.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 (105) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -2
  3. package/dist/ai-CnmLPMzd.d.cts +2417 -0
  4. package/dist/ai-CnmLPMzd.d.cts.map +1 -0
  5. package/dist/ai-CnmLPMzd.d.ts +2417 -0
  6. package/dist/ai-CnmLPMzd.d.ts.map +1 -0
  7. package/dist/ai-check.cjs +845 -620
  8. package/dist/ai-check.cjs.map +1 -1
  9. package/dist/ai-check.d.cts +82 -80
  10. package/dist/ai-check.d.cts.map +1 -0
  11. package/dist/ai-check.d.ts +82 -80
  12. package/dist/ai-check.d.ts.map +1 -0
  13. package/dist/ai-check.js +843 -621
  14. package/dist/ai-check.js.map +1 -1
  15. package/dist/ai-writing-CPpH9Qxq.js +2601 -0
  16. package/dist/ai-writing-CPpH9Qxq.js.map +1 -0
  17. package/dist/ai-writing-G6tnCGzw.cjs +2846 -0
  18. package/dist/ai-writing-G6tnCGzw.cjs.map +1 -0
  19. package/dist/index-2nigSf4N.d.cts +339 -0
  20. package/dist/index-2nigSf4N.d.cts.map +1 -0
  21. package/dist/index-B54baFUA.d.ts +339 -0
  22. package/dist/index-B54baFUA.d.ts.map +1 -0
  23. package/dist/index-BAfEHCnD.d.cts +1071 -0
  24. package/dist/index-BAfEHCnD.d.cts.map +1 -0
  25. package/dist/index-BqMXWuNC.d.cts +153 -0
  26. package/dist/index-BqMXWuNC.d.cts.map +1 -0
  27. package/dist/index-CVWvymVb.d.ts +1071 -0
  28. package/dist/index-CVWvymVb.d.ts.map +1 -0
  29. package/dist/index-CcHDTxIZ.d.ts +153 -0
  30. package/dist/index-CcHDTxIZ.d.ts.map +1 -0
  31. package/dist/index.cjs +1211 -1146
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +941 -861
  34. package/dist/index.d.cts.map +1 -0
  35. package/dist/index.d.ts +941 -861
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +1063 -1147
  38. package/dist/index.js.map +1 -1
  39. package/dist/item-group-DXiR8nOr.js +445 -0
  40. package/dist/item-group-DXiR8nOr.js.map +1 -0
  41. package/dist/item-group-DroFXgLb.cjs +505 -0
  42. package/dist/item-group-DroFXgLb.cjs.map +1 -0
  43. package/dist/registry-DVi0LR_i.cjs +5915 -0
  44. package/dist/registry-DVi0LR_i.cjs.map +1 -0
  45. package/dist/registry-Dsx9mNsS.js +5449 -0
  46. package/dist/registry-Dsx9mNsS.js.map +1 -0
  47. package/dist/schemas-Bdw0nGPo.js +152 -0
  48. package/dist/schemas-Bdw0nGPo.js.map +1 -0
  49. package/dist/schemas-DVbAOrtd.cjs +224 -0
  50. package/dist/schemas-DVbAOrtd.cjs.map +1 -0
  51. package/dist/schemas.cjs +16 -34
  52. package/dist/schemas.d.cts +2 -2
  53. package/dist/schemas.d.ts +2 -2
  54. package/dist/schemas.js +3 -34
  55. package/dist/scoring-B2_HEhMT.cjs +1748 -0
  56. package/dist/scoring-B2_HEhMT.cjs.map +1 -0
  57. package/dist/scoring-BZqUkuDF.js +1604 -0
  58. package/dist/scoring-BZqUkuDF.js.map +1 -0
  59. package/dist/scoring.cjs +37 -75
  60. package/dist/scoring.d.cts +3 -1103
  61. package/dist/scoring.d.ts +3 -1103
  62. package/dist/scoring.js +3 -75
  63. package/dist/xapi-CMTph7wG.js +332 -0
  64. package/dist/xapi-CMTph7wG.js.map +1 -0
  65. package/dist/xapi-DNzkSJ0S.cjs +362 -0
  66. package/dist/xapi-DNzkSJ0S.cjs.map +1 -0
  67. package/dist/xapi.cjs +7 -16
  68. package/dist/xapi.d.cts +2 -150
  69. package/dist/xapi.d.ts +2 -150
  70. package/dist/xapi.js +2 -16
  71. package/package.json +4 -4
  72. package/dist/activity-D705CXng.d.cts +0 -2162
  73. package/dist/activity-D705CXng.d.ts +0 -2162
  74. package/dist/chunk-46BXIGLG.cjs +0 -272
  75. package/dist/chunk-46BXIGLG.cjs.map +0 -1
  76. package/dist/chunk-4YANYTFN.cjs +0 -1256
  77. package/dist/chunk-4YANYTFN.cjs.map +0 -1
  78. package/dist/chunk-7KOWU4RO.js +0 -2207
  79. package/dist/chunk-7KOWU4RO.js.map +0 -1
  80. package/dist/chunk-7THXD7AN.cjs +0 -5057
  81. package/dist/chunk-7THXD7AN.cjs.map +0 -1
  82. package/dist/chunk-CYCTIXUN.cjs +0 -118
  83. package/dist/chunk-CYCTIXUN.cjs.map +0 -1
  84. package/dist/chunk-CYPA5BW5.js +0 -118
  85. package/dist/chunk-CYPA5BW5.js.map +0 -1
  86. package/dist/chunk-JTNDIBZO.js +0 -272
  87. package/dist/chunk-JTNDIBZO.js.map +0 -1
  88. package/dist/chunk-MV2N2WNS.js +0 -352
  89. package/dist/chunk-MV2N2WNS.js.map +0 -1
  90. package/dist/chunk-MXI26H62.cjs +0 -2207
  91. package/dist/chunk-MXI26H62.cjs.map +0 -1
  92. package/dist/chunk-QS7B42ZR.js +0 -5057
  93. package/dist/chunk-QS7B42ZR.js.map +0 -1
  94. package/dist/chunk-QX2ERL72.js +0 -1256
  95. package/dist/chunk-QX2ERL72.js.map +0 -1
  96. package/dist/chunk-ZWXQSKCX.cjs +0 -352
  97. package/dist/chunk-ZWXQSKCX.cjs.map +0 -1
  98. package/dist/index-BChYtrEe.d.ts +0 -548
  99. package/dist/index-VXt_v3YI.d.cts +0 -548
  100. package/dist/schemas.cjs.map +0 -1
  101. package/dist/schemas.js.map +0 -1
  102. package/dist/scoring.cjs.map +0 -1
  103. package/dist/scoring.js.map +0 -1
  104. package/dist/xapi.cjs.map +0 -1
  105. package/dist/xapi.js.map +0 -1
@@ -0,0 +1,339 @@
1
+ import { St as ActivityMedia, Xt as MultipleChoiceOptionMedia, bt as ActivityDataMap, ln as ValidationResult, tt as ItemGroup, wt as ActivityType } from "./ai-CnmLPMzd.cjs";
2
+ //#region src/types/redacted.d.ts
3
+ /**
4
+ * The learner-safe SHAPE of each built-in type.
5
+ *
6
+ * `redact()` returns `RedactedActivityData`, which proves a payload is
7
+ * learner-safe but is index-signature typed — it deliberately says nothing
8
+ * about what the payload still CONTAINS. That is right for the assertion and
9
+ * useless for anything that has to render or transport the result, so every
10
+ * integrator would end up re-declaring these interfaces by hand, and they would
11
+ * drift the moment a schema changed.
12
+ *
13
+ * Use them for the payload a server sends an exam client, and for the props of
14
+ * a renderer that must never see an answer key.
15
+ *
16
+ * Each is pinned to the strict schema `assertRedacted` checks against by a
17
+ * compile-time equality test, so the type and the validator cannot disagree.
18
+ * They are written out rather than inferred from those schemas so that the
19
+ * published types name no validation library.
20
+ */
21
+ /** A caption or subtitle track, unchanged by redaction. */
22
+ interface Track {
23
+ kind: 'captions' | 'subtitles';
24
+ src: string;
25
+ srclang: string;
26
+ label: string;
27
+ default?: boolean | undefined;
28
+ }
29
+ /** A recording's playback policy, unchanged by redaction. */
30
+ interface Playback {
31
+ controls?: 'native' | 'minimal' | undefined;
32
+ maxPlays?: number | undefined;
33
+ seek?: 'allow' | 'none' | undefined;
34
+ rate?: 'allow' | 'fixed' | undefined;
35
+ nativeControlHints?: ('hide-download' | 'hide-rate')[] | undefined;
36
+ }
37
+ /** An item's or a stimulus's media, unchanged by redaction. */
38
+ interface Media {
39
+ type: 'image' | 'audio' | 'video' | 'embed';
40
+ url: string;
41
+ alt?: string | undefined;
42
+ captionsUrl?: string | undefined;
43
+ tracks?: Track[] | undefined;
44
+ poster?: string | undefined;
45
+ playback?: Playback | undefined;
46
+ }
47
+ /** The author's switches for AI help, unchanged by redaction. */
48
+ interface AiSwitches {
49
+ explanations?: boolean | undefined;
50
+ hints?: boolean | undefined;
51
+ }
52
+ /** What every redacted item carries, whatever its type. */
53
+ interface RedactedItem {
54
+ redacted: true;
55
+ schemaVersion: '1.0';
56
+ id: string;
57
+ title: string;
58
+ slotKey?: string | undefined;
59
+ media?: Media | undefined;
60
+ passThreshold?: number | undefined;
61
+ learningObjectives?: string[] | undefined;
62
+ difficultyLevel?: 1 | 2 | 3 | 4 | 5 | undefined;
63
+ ai?: AiSwitches | undefined;
64
+ }
65
+ /** An option's picture or recording, unchanged by redaction — it is what the learner picks. */
66
+ interface RedactedMultipleChoiceOptionMedia {
67
+ type: 'image' | 'audio';
68
+ url: string;
69
+ alt?: string | undefined;
70
+ captionsUrl?: string | undefined;
71
+ }
72
+ /** An option with `isCorrect` and its feedback removed. */
73
+ interface RedactedMultipleChoiceOption {
74
+ id: string;
75
+ text: string;
76
+ media?: RedactedMultipleChoiceOptionMedia | undefined;
77
+ }
78
+ /** A Multiple Choice item with the answer key, feedback and strategy removed. */
79
+ interface RedactedMultipleChoiceData extends RedactedItem {
80
+ type: 'multiple-choice';
81
+ question: string;
82
+ questionHtml?: string | undefined;
83
+ mode: 'single' | 'multi';
84
+ options: RedactedMultipleChoiceOption[];
85
+ shuffle?: boolean | undefined;
86
+ locale?: string | undefined;
87
+ }
88
+ /** A blank with its accepted answers and matching rules removed; the hint survives. */
89
+ interface RedactedBlankConfig {
90
+ id: string;
91
+ hint?: string | undefined;
92
+ }
93
+ /** A Fill-in-the-Blanks item with every accepted answer removed. */
94
+ interface RedactedFillInTheBlanksData extends RedactedItem {
95
+ type: 'fill-in-the-blanks';
96
+ passage: string;
97
+ passageHtml?: string | undefined;
98
+ blanks: RedactedBlankConfig[];
99
+ locale?: string | undefined;
100
+ }
101
+ /** A Written Response item; the rubric survives, because it tells the learner what is assessed. */
102
+ interface RedactedWrittenResponseData extends RedactedItem {
103
+ type: 'written-response';
104
+ prompt: string;
105
+ promptHtml?: string | undefined;
106
+ minWords: number;
107
+ maxWords: number;
108
+ rubric?: {
109
+ criteria: {
110
+ name: string;
111
+ weight: number;
112
+ description?: string | undefined;
113
+ }[];
114
+ label?: string | undefined;
115
+ } | undefined;
116
+ languageTarget?: string | undefined;
117
+ locale?: string | undefined;
118
+ }
119
+ /** A selectable choice, unchanged by redaction. */
120
+ interface RedactedGapSelectChoice {
121
+ id: string;
122
+ text: string;
123
+ }
124
+ /** A word bank, unchanged by redaction — the learner picks from it. */
125
+ interface RedactedGapSelectBank {
126
+ id: string;
127
+ choices: RedactedGapSelectChoice[];
128
+ }
129
+ /** A gap with its `correctChoiceId` removed; every choice it offers survives. */
130
+ interface RedactedGapSelectGap {
131
+ id: string;
132
+ choices?: RedactedGapSelectChoice[] | undefined;
133
+ bankId?: string | undefined;
134
+ }
135
+ /** A Gap Select item the learner can still answer: choices intact, answer key gone. */
136
+ interface RedactedGapSelectData extends RedactedItem {
137
+ type: 'gap-select';
138
+ passage: string;
139
+ passageHtml?: string | undefined;
140
+ gaps: RedactedGapSelectGap[];
141
+ banks?: RedactedGapSelectBank[] | undefined;
142
+ presentation?: 'dropdown' | undefined;
143
+ shuffleChoices?: boolean | undefined;
144
+ locale?: string | undefined;
145
+ }
146
+ /** The slower recording of a dictation, unchanged by redaction. */
147
+ interface RedactedDictationSlowMedia {
148
+ type: 'audio';
149
+ url: string;
150
+ alt?: string | undefined;
151
+ }
152
+ /** A Dictation item with its transcript, accepted alternatives and tolerances removed. */
153
+ interface RedactedDictationData extends RedactedItem {
154
+ type: 'dictation';
155
+ slowMedia?: RedactedDictationSlowMedia | undefined;
156
+ hints?: {
157
+ mode: 'progressive-words';
158
+ } | undefined;
159
+ locale?: string | undefined;
160
+ }
161
+ /**
162
+ * A Read Aloud item, which keeps everything but the authored feedback: the text
163
+ * to read is what the learner is asked to read. The slow recording needs no
164
+ * redacted counterpart of its own — the content schema for it is already strict.
165
+ */
166
+ interface RedactedReadAloudData extends RedactedItem {
167
+ type: 'read-aloud';
168
+ instructions?: string | undefined;
169
+ referenceText: string;
170
+ locale: string;
171
+ slowMedia?: RedactedDictationSlowMedia | undefined;
172
+ recording: {
173
+ maxSeconds: number;
174
+ minSeconds?: number | undefined;
175
+ maxTakes?: number | undefined;
176
+ };
177
+ scoring: {
178
+ dimensions: {
179
+ name: 'accuracy' | 'fluency' | 'completeness' | 'prosody';
180
+ weight: number;
181
+ }[];
182
+ };
183
+ }
184
+ /** A stimulus as a learner receives it: everything but the author-only `transcript`. */
185
+ interface RedactedStimulus {
186
+ id: string;
187
+ kind: 'text' | 'image' | 'audio' | 'video' | 'mixed';
188
+ title?: string | undefined;
189
+ body?: string | undefined;
190
+ bodyHtml?: string | undefined;
191
+ media?: Media | undefined;
192
+ locale?: string | undefined;
193
+ attribution?: string | undefined;
194
+ }
195
+ /**
196
+ * Discriminated union of every built-in redacted activity. Narrow it on
197
+ * `type`, exactly as you would `ActivityData`:
198
+ *
199
+ * ```ts
200
+ * function render(item: RedactedActivity) {
201
+ * if (item.type === 'multiple-choice') {
202
+ * return item.options.map((option) => option.text); // no `isCorrect` to leak
203
+ * }
204
+ * }
205
+ * ```
206
+ */
207
+ type RedactedActivity = RedactedMultipleChoiceData | RedactedFillInTheBlanksData | RedactedWrittenResponseData | RedactedGapSelectData | RedactedDictationData | RedactedReadAloudData;
208
+ //#endregion
209
+ //#region src/schemas/item-group.d.ts
210
+ /**
211
+ * Validates an item group in full: the container and stimulus against
212
+ * {@link ItemGroupSchema}, then every item against the schema registered for
213
+ * its `type`. Errors from items are reported at `items.<index>.…`.
214
+ *
215
+ * Unlike `validateActivity`, an item whose type is not registered is REPORTED
216
+ * (code `unknown_activity_type`) rather than thrown: a group is validated as
217
+ * a whole, and an author fixing a six-item group wants every problem listed,
218
+ * not the first one that happened to throw.
219
+ */
220
+ declare function validateItemGroup(data: unknown): ValidationResult<ItemGroup>;
221
+ //#endregion
222
+ //#region src/schemas/json-schema.d.ts
223
+ /**
224
+ * JSON Schema (Draft 7) for a `Stimulus`. Structural contract only — the
225
+ * kind/media/body consistency guards are Zod-only.
226
+ */
227
+ declare const stimulusJsonSchema: Record<string, unknown>;
228
+ /**
229
+ * JSON Schema (Draft 7) for an `ItemGroup` CONTAINER. Items appear as objects
230
+ * with `type` and `id` only; each item's own contract is `jsonSchemaFor(type)`.
231
+ * For an AI generation pipeline, ask for the group and each item separately
232
+ * rather than a single nested schema — that keeps the per-type schema the
233
+ * registry's, not a copy.
234
+ */
235
+ declare const itemGroupJsonSchema: Record<string, unknown>;
236
+ /**
237
+ * JSON Schema (Draft 7) representation of the Multiple Choice activity data
238
+ * contract, generated natively by Zod 4. Draft 7 is mandated by Requirement
239
+ * 2.2 for the widest AI-prompt / OpenAPI tooling compatibility. The semantic
240
+ * `.refine()` guards are not representable in JSON Schema and are
241
+ * intentionally omitted — the export captures the *structural* contract only.
242
+ * Since v0.3 the source schemas are loose, so these no longer emit
243
+ * `additionalProperties: false` — the JSON Schema and `validateActivity` now
244
+ * agree on unknown-key handling.
245
+ */
246
+ /**
247
+ * JSON Schema (Draft 7) representation of the Gap Select activity data
248
+ * contract. Structural contract only: the six semantic guards — the
249
+ * passage/gap bijection, id uniqueness, the one-choice-source rule, and an
250
+ * answer key that names a choice the gap offers — are Zod-only, as they are
251
+ * for the other types.
252
+ */
253
+ declare const gapSelectJsonSchema: Record<string, unknown>;
254
+ /**
255
+ * JSON Schema (Draft 7) representation of the Dictation activity data
256
+ * contract. Structural contract, plus the raw length caps JSON Schema can
257
+ * state in code points as zod counts them — `maxLength` 2000 on a transcript
258
+ * and an accepted transcript, 200 on a rule's `from` and `to`. The twelve
259
+ * semantic guards — a transcript that survives normalisation, the caps after
260
+ * equivalences are applied, distinct candidates, audio only, the
261
+ * slow-recording rules, no captions, no transcript in the title — are
262
+ * Zod-only, as they are for the other types.
263
+ */
264
+ declare const dictationJsonSchema: Record<string, unknown>;
265
+ /**
266
+ * JSON Schema (Draft 7) representation of the Read Aloud activity data
267
+ * contract. Structural contract, plus the raw cap JSON Schema can state in code
268
+ * points as zod counts them — `maxLength` 2000 on the reference text — and the
269
+ * canonical locale pattern. The ten semantic guards — the cap after
270
+ * normalisation, a text that survives it, the spaced-script rule, the
271
+ * model-recording rules, unique dimensions, a weight above 0, and the take
272
+ * bounds — are Zod-only, as they are for the other types.
273
+ */
274
+ declare const readAloudJsonSchema: Record<string, unknown>;
275
+ declare const multipleChoiceJsonSchema: Record<string, unknown>;
276
+ /**
277
+ * JSON Schema (Draft 7) representation of the Fill-in-the-Blanks activity data
278
+ * contract, generated natively by Zod 4. Structural contract only (semantic
279
+ * `.refine()` guards are Zod-only and not representable in JSON Schema).
280
+ */
281
+ declare const fillInTheBlanksJsonSchema: Record<string, unknown>;
282
+ /**
283
+ * JSON Schema (Draft 7) representation of the Written Response activity data
284
+ * contract. Structural contract only.
285
+ */
286
+ declare const writtenResponseJsonSchema: Record<string, unknown>;
287
+ /**
288
+ * Derives the JSON Schema (Draft 7) for any REGISTERED activity type — the
289
+ * live, registry-backed replacement for the static per-type exports above,
290
+ * and the building block for AI generation pipelines (R6.1): pass the result
291
+ * as a structured-output schema so a model can only emit valid items.
292
+ *
293
+ * For a type you registered, it is the descriptor's `jsonSchema` when you gave
294
+ * one, or else what the schema produces through the Standard JSON Schema
295
+ * converter (`'~standard'.jsonSchema`) — a zod 4.6 schema has one. A fresh copy
296
+ * every call.
297
+ *
298
+ * @throws UnknownActivityTypeError when `type` has no registered descriptor.
299
+ * @throws Error when a registered type has neither a `jsonSchema` nor a schema
300
+ * that can produce one.
301
+ */
302
+ declare function jsonSchemaFor(type: string): Record<string, unknown>;
303
+ //#endregion
304
+ //#region src/schemas/index.d.ts
305
+ /**
306
+ * Checks a piece of activity media — an item's `media`, a stimulus's, a
307
+ * dictation's `slowMedia` — on its own, the way `validateActivity` checks it
308
+ * inside an item: its kind, an address in the allowed schemes, a playback
309
+ * policy only on audio, captions and tracks only where they can play. For an
310
+ * editor's media picker, which holds the media before the item is whole.
311
+ *
312
+ * @returns `{ success: true, data }`, or `{ success: false, errors }` with the
313
+ * same codes, paths and messages `validateActivity` reports.
314
+ */
315
+ declare function validateMedia(value: unknown): ValidationResult<ActivityMedia>;
316
+ /**
317
+ * Checks a multiple-choice option's `media` on its own: a picture or a
318
+ * recording, at an address in the allowed schemes, with no playback policy.
319
+ *
320
+ * @returns `{ success: true, data }`, or `{ success: false, errors }` with the
321
+ * same codes, paths and messages `validateActivity` reports.
322
+ */
323
+ declare function validateOptionMedia(value: unknown): ValidationResult<MultipleChoiceOptionMedia>;
324
+ /**
325
+ * Validates raw activity data against the schema registered for the given
326
+ * activity type (built-in or consumer-registered via `registerActivityType`).
327
+ *
328
+ * Unknown keys are PRESERVED, not stripped: every built-in schema is loose,
329
+ * so consumer sidecar fields and forward-version fields survive validation
330
+ * verbatim in the returned `data`.
331
+ *
332
+ * @returns `{ success: true, data }` with the typed, validated data, or
333
+ * `{ success: false, errors }` with one entry per failed constraint.
334
+ * @throws UnknownActivityTypeError when `type` has no registered descriptor.
335
+ */
336
+ declare function validateActivity<T extends ActivityType>(type: T, data: unknown): ValidationResult<ActivityDataMap[T]>;
337
+ //#endregion
338
+ export { RedactedMultipleChoiceData as C, RedactedStimulus as D, RedactedReadAloudData as E, RedactedWrittenResponseData as O, RedactedGapSelectGap as S, RedactedMultipleChoiceOptionMedia as T, RedactedDictationSlowMedia as _, fillInTheBlanksJsonSchema as a, RedactedGapSelectChoice as b, jsonSchemaFor as c, stimulusJsonSchema as d, writtenResponseJsonSchema as f, RedactedDictationData as g, RedactedBlankConfig as h, dictationJsonSchema as i, multipleChoiceJsonSchema as l, RedactedActivity as m, validateMedia as n, gapSelectJsonSchema as o, validateItemGroup as p, validateOptionMedia as r, itemGroupJsonSchema as s, validateActivity as t, readAloudJsonSchema as u, RedactedFillInTheBlanksData as v, RedactedMultipleChoiceOption as w, RedactedGapSelectData as x, RedactedGapSelectBank as y };
339
+ //# sourceMappingURL=index-2nigSf4N.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-2nigSf4N.d.cts","names":[],"sources":["../src/types/redacted.ts","../src/schemas/item-group.ts","../src/schemas/json-schema.ts","../src/schemas/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBU;EACR;EACA;EACA;EACA;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA,SAAS;EACT;EACA,WAAW;;;UAIH;EACR;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA,KAAK;;;UAIU;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA,QAAQ;;;UAIO,mCAAmC;EAClD;EACA;EACA;EACA;EACA,SAAS;EACT;EACA;;;UAIe;EACf;EACA;;;UAIe,oCAAoC;EACnD;EACA;EACA;EACA,QAAQ;EACR;;;UAIe,oCAAoC;EACnD;EACA;EACA;EACA;EACA;EACA;IAEM;MAAY;MAAc;MAAgB;;IAC1C;;EAGN;EACA;;;UAIe;EACf;EACA;;;UAIe;EACf;EACA,SAAS;;;UAIM;EACf;EACA,UAAU;EACV;;;UAIe,8BAA8B;EAC7C;EACA;EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;;;UAIe;EACf;EACA;EACA;;;UAIe,8BAA8B;EAC7C;EACA,YAAY;EACZ;IAAU;;EACV;;;;;;;UAQe,8BAA8B;EAC7C;EACA;EACA;EACA;EACA,YAAY;EACZ;IACE;IACA;IACA;;EAEF;IACE;MACE;MACA;;;;;UAMW;EACf;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;;;;;;;;;;;;;KAeU,mBACR,6BACA,8BACA,8BACA,wBACA,wBACA;;;;;;;;;;;;;iBCgNY,kBAAkB,gBAAgB,iBAAiB;;;;;;;cClatD,oBAAoB;;;;;;;;cAWpB,qBAAqB;;;;;;;;;;;;;;;;;;cAqBrB,qBAAqB;;;;;;;;;;;cAcrB,qBAAqB;;;;;;;;;;cAarB,qBAAqB;cAIrB,0BAA0B;;;;;;cAY1B,2BAA2B;;;;;cAW3B,2BAA2B;;;;;;;;;;;;;;;;iBAsBxB,cAAc,eAAe;;;;;;;;;;;;;iBCvE7B,cAAc,iBAAiB,iBAAiB;;;;;;;;iBAWhD,oBAAoB,iBAAiB,iBAAiB;;;;;;;;;;;;;iBA8BtD,iBAAiB,UAAU,cACzC,MAAM,GACN,gBACC,iBAAiB,gBAAgB"}
@@ -0,0 +1,339 @@
1
+ import { St as ActivityMedia, Xt as MultipleChoiceOptionMedia, bt as ActivityDataMap, ln as ValidationResult, tt as ItemGroup, wt as ActivityType } from "./ai-CnmLPMzd.js";
2
+ //#region src/types/redacted.d.ts
3
+ /**
4
+ * The learner-safe SHAPE of each built-in type.
5
+ *
6
+ * `redact()` returns `RedactedActivityData`, which proves a payload is
7
+ * learner-safe but is index-signature typed — it deliberately says nothing
8
+ * about what the payload still CONTAINS. That is right for the assertion and
9
+ * useless for anything that has to render or transport the result, so every
10
+ * integrator would end up re-declaring these interfaces by hand, and they would
11
+ * drift the moment a schema changed.
12
+ *
13
+ * Use them for the payload a server sends an exam client, and for the props of
14
+ * a renderer that must never see an answer key.
15
+ *
16
+ * Each is pinned to the strict schema `assertRedacted` checks against by a
17
+ * compile-time equality test, so the type and the validator cannot disagree.
18
+ * They are written out rather than inferred from those schemas so that the
19
+ * published types name no validation library.
20
+ */
21
+ /** A caption or subtitle track, unchanged by redaction. */
22
+ interface Track {
23
+ kind: 'captions' | 'subtitles';
24
+ src: string;
25
+ srclang: string;
26
+ label: string;
27
+ default?: boolean | undefined;
28
+ }
29
+ /** A recording's playback policy, unchanged by redaction. */
30
+ interface Playback {
31
+ controls?: 'native' | 'minimal' | undefined;
32
+ maxPlays?: number | undefined;
33
+ seek?: 'allow' | 'none' | undefined;
34
+ rate?: 'allow' | 'fixed' | undefined;
35
+ nativeControlHints?: ('hide-download' | 'hide-rate')[] | undefined;
36
+ }
37
+ /** An item's or a stimulus's media, unchanged by redaction. */
38
+ interface Media {
39
+ type: 'image' | 'audio' | 'video' | 'embed';
40
+ url: string;
41
+ alt?: string | undefined;
42
+ captionsUrl?: string | undefined;
43
+ tracks?: Track[] | undefined;
44
+ poster?: string | undefined;
45
+ playback?: Playback | undefined;
46
+ }
47
+ /** The author's switches for AI help, unchanged by redaction. */
48
+ interface AiSwitches {
49
+ explanations?: boolean | undefined;
50
+ hints?: boolean | undefined;
51
+ }
52
+ /** What every redacted item carries, whatever its type. */
53
+ interface RedactedItem {
54
+ redacted: true;
55
+ schemaVersion: '1.0';
56
+ id: string;
57
+ title: string;
58
+ slotKey?: string | undefined;
59
+ media?: Media | undefined;
60
+ passThreshold?: number | undefined;
61
+ learningObjectives?: string[] | undefined;
62
+ difficultyLevel?: 1 | 2 | 3 | 4 | 5 | undefined;
63
+ ai?: AiSwitches | undefined;
64
+ }
65
+ /** An option's picture or recording, unchanged by redaction — it is what the learner picks. */
66
+ interface RedactedMultipleChoiceOptionMedia {
67
+ type: 'image' | 'audio';
68
+ url: string;
69
+ alt?: string | undefined;
70
+ captionsUrl?: string | undefined;
71
+ }
72
+ /** An option with `isCorrect` and its feedback removed. */
73
+ interface RedactedMultipleChoiceOption {
74
+ id: string;
75
+ text: string;
76
+ media?: RedactedMultipleChoiceOptionMedia | undefined;
77
+ }
78
+ /** A Multiple Choice item with the answer key, feedback and strategy removed. */
79
+ interface RedactedMultipleChoiceData extends RedactedItem {
80
+ type: 'multiple-choice';
81
+ question: string;
82
+ questionHtml?: string | undefined;
83
+ mode: 'single' | 'multi';
84
+ options: RedactedMultipleChoiceOption[];
85
+ shuffle?: boolean | undefined;
86
+ locale?: string | undefined;
87
+ }
88
+ /** A blank with its accepted answers and matching rules removed; the hint survives. */
89
+ interface RedactedBlankConfig {
90
+ id: string;
91
+ hint?: string | undefined;
92
+ }
93
+ /** A Fill-in-the-Blanks item with every accepted answer removed. */
94
+ interface RedactedFillInTheBlanksData extends RedactedItem {
95
+ type: 'fill-in-the-blanks';
96
+ passage: string;
97
+ passageHtml?: string | undefined;
98
+ blanks: RedactedBlankConfig[];
99
+ locale?: string | undefined;
100
+ }
101
+ /** A Written Response item; the rubric survives, because it tells the learner what is assessed. */
102
+ interface RedactedWrittenResponseData extends RedactedItem {
103
+ type: 'written-response';
104
+ prompt: string;
105
+ promptHtml?: string | undefined;
106
+ minWords: number;
107
+ maxWords: number;
108
+ rubric?: {
109
+ criteria: {
110
+ name: string;
111
+ weight: number;
112
+ description?: string | undefined;
113
+ }[];
114
+ label?: string | undefined;
115
+ } | undefined;
116
+ languageTarget?: string | undefined;
117
+ locale?: string | undefined;
118
+ }
119
+ /** A selectable choice, unchanged by redaction. */
120
+ interface RedactedGapSelectChoice {
121
+ id: string;
122
+ text: string;
123
+ }
124
+ /** A word bank, unchanged by redaction — the learner picks from it. */
125
+ interface RedactedGapSelectBank {
126
+ id: string;
127
+ choices: RedactedGapSelectChoice[];
128
+ }
129
+ /** A gap with its `correctChoiceId` removed; every choice it offers survives. */
130
+ interface RedactedGapSelectGap {
131
+ id: string;
132
+ choices?: RedactedGapSelectChoice[] | undefined;
133
+ bankId?: string | undefined;
134
+ }
135
+ /** A Gap Select item the learner can still answer: choices intact, answer key gone. */
136
+ interface RedactedGapSelectData extends RedactedItem {
137
+ type: 'gap-select';
138
+ passage: string;
139
+ passageHtml?: string | undefined;
140
+ gaps: RedactedGapSelectGap[];
141
+ banks?: RedactedGapSelectBank[] | undefined;
142
+ presentation?: 'dropdown' | undefined;
143
+ shuffleChoices?: boolean | undefined;
144
+ locale?: string | undefined;
145
+ }
146
+ /** The slower recording of a dictation, unchanged by redaction. */
147
+ interface RedactedDictationSlowMedia {
148
+ type: 'audio';
149
+ url: string;
150
+ alt?: string | undefined;
151
+ }
152
+ /** A Dictation item with its transcript, accepted alternatives and tolerances removed. */
153
+ interface RedactedDictationData extends RedactedItem {
154
+ type: 'dictation';
155
+ slowMedia?: RedactedDictationSlowMedia | undefined;
156
+ hints?: {
157
+ mode: 'progressive-words';
158
+ } | undefined;
159
+ locale?: string | undefined;
160
+ }
161
+ /**
162
+ * A Read Aloud item, which keeps everything but the authored feedback: the text
163
+ * to read is what the learner is asked to read. The slow recording needs no
164
+ * redacted counterpart of its own — the content schema for it is already strict.
165
+ */
166
+ interface RedactedReadAloudData extends RedactedItem {
167
+ type: 'read-aloud';
168
+ instructions?: string | undefined;
169
+ referenceText: string;
170
+ locale: string;
171
+ slowMedia?: RedactedDictationSlowMedia | undefined;
172
+ recording: {
173
+ maxSeconds: number;
174
+ minSeconds?: number | undefined;
175
+ maxTakes?: number | undefined;
176
+ };
177
+ scoring: {
178
+ dimensions: {
179
+ name: 'accuracy' | 'fluency' | 'completeness' | 'prosody';
180
+ weight: number;
181
+ }[];
182
+ };
183
+ }
184
+ /** A stimulus as a learner receives it: everything but the author-only `transcript`. */
185
+ interface RedactedStimulus {
186
+ id: string;
187
+ kind: 'text' | 'image' | 'audio' | 'video' | 'mixed';
188
+ title?: string | undefined;
189
+ body?: string | undefined;
190
+ bodyHtml?: string | undefined;
191
+ media?: Media | undefined;
192
+ locale?: string | undefined;
193
+ attribution?: string | undefined;
194
+ }
195
+ /**
196
+ * Discriminated union of every built-in redacted activity. Narrow it on
197
+ * `type`, exactly as you would `ActivityData`:
198
+ *
199
+ * ```ts
200
+ * function render(item: RedactedActivity) {
201
+ * if (item.type === 'multiple-choice') {
202
+ * return item.options.map((option) => option.text); // no `isCorrect` to leak
203
+ * }
204
+ * }
205
+ * ```
206
+ */
207
+ type RedactedActivity = RedactedMultipleChoiceData | RedactedFillInTheBlanksData | RedactedWrittenResponseData | RedactedGapSelectData | RedactedDictationData | RedactedReadAloudData;
208
+ //#endregion
209
+ //#region src/schemas/item-group.d.ts
210
+ /**
211
+ * Validates an item group in full: the container and stimulus against
212
+ * {@link ItemGroupSchema}, then every item against the schema registered for
213
+ * its `type`. Errors from items are reported at `items.<index>.…`.
214
+ *
215
+ * Unlike `validateActivity`, an item whose type is not registered is REPORTED
216
+ * (code `unknown_activity_type`) rather than thrown: a group is validated as
217
+ * a whole, and an author fixing a six-item group wants every problem listed,
218
+ * not the first one that happened to throw.
219
+ */
220
+ declare function validateItemGroup(data: unknown): ValidationResult<ItemGroup>;
221
+ //#endregion
222
+ //#region src/schemas/json-schema.d.ts
223
+ /**
224
+ * JSON Schema (Draft 7) for a `Stimulus`. Structural contract only — the
225
+ * kind/media/body consistency guards are Zod-only.
226
+ */
227
+ declare const stimulusJsonSchema: Record<string, unknown>;
228
+ /**
229
+ * JSON Schema (Draft 7) for an `ItemGroup` CONTAINER. Items appear as objects
230
+ * with `type` and `id` only; each item's own contract is `jsonSchemaFor(type)`.
231
+ * For an AI generation pipeline, ask for the group and each item separately
232
+ * rather than a single nested schema — that keeps the per-type schema the
233
+ * registry's, not a copy.
234
+ */
235
+ declare const itemGroupJsonSchema: Record<string, unknown>;
236
+ /**
237
+ * JSON Schema (Draft 7) representation of the Multiple Choice activity data
238
+ * contract, generated natively by Zod 4. Draft 7 is mandated by Requirement
239
+ * 2.2 for the widest AI-prompt / OpenAPI tooling compatibility. The semantic
240
+ * `.refine()` guards are not representable in JSON Schema and are
241
+ * intentionally omitted — the export captures the *structural* contract only.
242
+ * Since v0.3 the source schemas are loose, so these no longer emit
243
+ * `additionalProperties: false` — the JSON Schema and `validateActivity` now
244
+ * agree on unknown-key handling.
245
+ */
246
+ /**
247
+ * JSON Schema (Draft 7) representation of the Gap Select activity data
248
+ * contract. Structural contract only: the six semantic guards — the
249
+ * passage/gap bijection, id uniqueness, the one-choice-source rule, and an
250
+ * answer key that names a choice the gap offers — are Zod-only, as they are
251
+ * for the other types.
252
+ */
253
+ declare const gapSelectJsonSchema: Record<string, unknown>;
254
+ /**
255
+ * JSON Schema (Draft 7) representation of the Dictation activity data
256
+ * contract. Structural contract, plus the raw length caps JSON Schema can
257
+ * state in code points as zod counts them — `maxLength` 2000 on a transcript
258
+ * and an accepted transcript, 200 on a rule's `from` and `to`. The twelve
259
+ * semantic guards — a transcript that survives normalisation, the caps after
260
+ * equivalences are applied, distinct candidates, audio only, the
261
+ * slow-recording rules, no captions, no transcript in the title — are
262
+ * Zod-only, as they are for the other types.
263
+ */
264
+ declare const dictationJsonSchema: Record<string, unknown>;
265
+ /**
266
+ * JSON Schema (Draft 7) representation of the Read Aloud activity data
267
+ * contract. Structural contract, plus the raw cap JSON Schema can state in code
268
+ * points as zod counts them — `maxLength` 2000 on the reference text — and the
269
+ * canonical locale pattern. The ten semantic guards — the cap after
270
+ * normalisation, a text that survives it, the spaced-script rule, the
271
+ * model-recording rules, unique dimensions, a weight above 0, and the take
272
+ * bounds — are Zod-only, as they are for the other types.
273
+ */
274
+ declare const readAloudJsonSchema: Record<string, unknown>;
275
+ declare const multipleChoiceJsonSchema: Record<string, unknown>;
276
+ /**
277
+ * JSON Schema (Draft 7) representation of the Fill-in-the-Blanks activity data
278
+ * contract, generated natively by Zod 4. Structural contract only (semantic
279
+ * `.refine()` guards are Zod-only and not representable in JSON Schema).
280
+ */
281
+ declare const fillInTheBlanksJsonSchema: Record<string, unknown>;
282
+ /**
283
+ * JSON Schema (Draft 7) representation of the Written Response activity data
284
+ * contract. Structural contract only.
285
+ */
286
+ declare const writtenResponseJsonSchema: Record<string, unknown>;
287
+ /**
288
+ * Derives the JSON Schema (Draft 7) for any REGISTERED activity type — the
289
+ * live, registry-backed replacement for the static per-type exports above,
290
+ * and the building block for AI generation pipelines (R6.1): pass the result
291
+ * as a structured-output schema so a model can only emit valid items.
292
+ *
293
+ * For a type you registered, it is the descriptor's `jsonSchema` when you gave
294
+ * one, or else what the schema produces through the Standard JSON Schema
295
+ * converter (`'~standard'.jsonSchema`) — a zod 4.6 schema has one. A fresh copy
296
+ * every call.
297
+ *
298
+ * @throws UnknownActivityTypeError when `type` has no registered descriptor.
299
+ * @throws Error when a registered type has neither a `jsonSchema` nor a schema
300
+ * that can produce one.
301
+ */
302
+ declare function jsonSchemaFor(type: string): Record<string, unknown>;
303
+ //#endregion
304
+ //#region src/schemas/index.d.ts
305
+ /**
306
+ * Checks a piece of activity media — an item's `media`, a stimulus's, a
307
+ * dictation's `slowMedia` — on its own, the way `validateActivity` checks it
308
+ * inside an item: its kind, an address in the allowed schemes, a playback
309
+ * policy only on audio, captions and tracks only where they can play. For an
310
+ * editor's media picker, which holds the media before the item is whole.
311
+ *
312
+ * @returns `{ success: true, data }`, or `{ success: false, errors }` with the
313
+ * same codes, paths and messages `validateActivity` reports.
314
+ */
315
+ declare function validateMedia(value: unknown): ValidationResult<ActivityMedia>;
316
+ /**
317
+ * Checks a multiple-choice option's `media` on its own: a picture or a
318
+ * recording, at an address in the allowed schemes, with no playback policy.
319
+ *
320
+ * @returns `{ success: true, data }`, or `{ success: false, errors }` with the
321
+ * same codes, paths and messages `validateActivity` reports.
322
+ */
323
+ declare function validateOptionMedia(value: unknown): ValidationResult<MultipleChoiceOptionMedia>;
324
+ /**
325
+ * Validates raw activity data against the schema registered for the given
326
+ * activity type (built-in or consumer-registered via `registerActivityType`).
327
+ *
328
+ * Unknown keys are PRESERVED, not stripped: every built-in schema is loose,
329
+ * so consumer sidecar fields and forward-version fields survive validation
330
+ * verbatim in the returned `data`.
331
+ *
332
+ * @returns `{ success: true, data }` with the typed, validated data, or
333
+ * `{ success: false, errors }` with one entry per failed constraint.
334
+ * @throws UnknownActivityTypeError when `type` has no registered descriptor.
335
+ */
336
+ declare function validateActivity<T extends ActivityType>(type: T, data: unknown): ValidationResult<ActivityDataMap[T]>;
337
+ //#endregion
338
+ export { RedactedMultipleChoiceData as C, RedactedStimulus as D, RedactedReadAloudData as E, RedactedWrittenResponseData as O, RedactedGapSelectGap as S, RedactedMultipleChoiceOptionMedia as T, RedactedDictationSlowMedia as _, fillInTheBlanksJsonSchema as a, RedactedGapSelectChoice as b, jsonSchemaFor as c, stimulusJsonSchema as d, writtenResponseJsonSchema as f, RedactedDictationData as g, RedactedBlankConfig as h, dictationJsonSchema as i, multipleChoiceJsonSchema as l, RedactedActivity as m, validateMedia as n, gapSelectJsonSchema as o, validateItemGroup as p, validateOptionMedia as r, itemGroupJsonSchema as s, validateActivity as t, readAloudJsonSchema as u, RedactedFillInTheBlanksData as v, RedactedMultipleChoiceOption as w, RedactedGapSelectData as x, RedactedGapSelectBank as y };
339
+ //# sourceMappingURL=index-B54baFUA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B54baFUA.d.ts","names":[],"sources":["../src/types/redacted.ts","../src/schemas/item-group.ts","../src/schemas/json-schema.ts","../src/schemas/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBU;EACR;EACA;EACA;EACA;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA,SAAS;EACT;EACA,WAAW;;;UAIH;EACR;EACA;;;UAIQ;EACR;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA,KAAK;;;UAIU;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA,QAAQ;;;UAIO,mCAAmC;EAClD;EACA;EACA;EACA;EACA,SAAS;EACT;EACA;;;UAIe;EACf;EACA;;;UAIe,oCAAoC;EACnD;EACA;EACA;EACA,QAAQ;EACR;;;UAIe,oCAAoC;EACnD;EACA;EACA;EACA;EACA;EACA;IAEM;MAAY;MAAc;MAAgB;;IAC1C;;EAGN;EACA;;;UAIe;EACf;EACA;;;UAIe;EACf;EACA,SAAS;;;UAIM;EACf;EACA,UAAU;EACV;;;UAIe,8BAA8B;EAC7C;EACA;EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;;;UAIe;EACf;EACA;EACA;;;UAIe,8BAA8B;EAC7C;EACA,YAAY;EACZ;IAAU;;EACV;;;;;;;UAQe,8BAA8B;EAC7C;EACA;EACA;EACA;EACA,YAAY;EACZ;IACE;IACA;IACA;;EAEF;IACE;MACE;MACA;;;;;UAMW;EACf;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;;;;;;;;;;;;;KAeU,mBACR,6BACA,8BACA,8BACA,wBACA,wBACA;;;;;;;;;;;;;iBCgNY,kBAAkB,gBAAgB,iBAAiB;;;;;;;cClatD,oBAAoB;;;;;;;;cAWpB,qBAAqB;;;;;;;;;;;;;;;;;;cAqBrB,qBAAqB;;;;;;;;;;;cAcrB,qBAAqB;;;;;;;;;;cAarB,qBAAqB;cAIrB,0BAA0B;;;;;;cAY1B,2BAA2B;;;;;cAW3B,2BAA2B;;;;;;;;;;;;;;;;iBAsBxB,cAAc,eAAe;;;;;;;;;;;;;iBCvE7B,cAAc,iBAAiB,iBAAiB;;;;;;;;iBAWhD,oBAAoB,iBAAiB,iBAAiB;;;;;;;;;;;;;iBA8BtD,iBAAiB,UAAU,cACzC,MAAM,GACN,gBACC,iBAAiB,gBAAgB"}