@intellectif/lk-core 1.6.0 → 1.7.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 +20 -0
- package/dist/{ai-i3jwXnpX.d.cts → ai-B1wYrqcB.d.cts} +39 -15
- package/dist/ai-B1wYrqcB.d.cts.map +1 -0
- package/dist/{ai-i3jwXnpX.d.ts → ai-B1wYrqcB.d.ts} +39 -15
- package/dist/ai-B1wYrqcB.d.ts.map +1 -0
- package/dist/ai-check.cjs +13 -6
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +1 -5
- package/dist/ai-check.d.cts.map +1 -1
- package/dist/ai-check.d.ts +1 -5
- package/dist/ai-check.d.ts.map +1 -1
- package/dist/ai-check.js +13 -6
- package/dist/ai-check.js.map +1 -1
- package/dist/{ai-writing-OJ5m_1EB.js → ai-writing-B7oMCt66.js} +46 -43
- package/dist/ai-writing-B7oMCt66.js.map +1 -0
- package/dist/{ai-writing-C4YRVrFi.cjs → ai-writing-DrPTV3R2.cjs} +46 -43
- package/dist/ai-writing-DrPTV3R2.cjs.map +1 -0
- package/dist/{index-DeD8EI1D.d.ts → index-BM8LeDWn.d.cts} +2 -42
- package/dist/index-BM8LeDWn.d.cts.map +1 -0
- package/dist/{index-Uh1u57yq.d.cts → index-BTkMQtws.d.ts} +2 -42
- package/dist/index-BTkMQtws.d.ts.map +1 -0
- package/dist/{index-Dj92T76o.d.ts → index-BU99GFTl.d.ts} +2 -8
- package/dist/index-BU99GFTl.d.ts.map +1 -0
- package/dist/{index-WBHSrIUU.d.ts → index-BdXs4-en.d.ts} +5 -12
- package/dist/index-BdXs4-en.d.ts.map +1 -0
- package/dist/{index-CFRgZLhH.d.cts → index-DP9rvyOz.d.cts} +5 -12
- package/dist/index-DP9rvyOz.d.cts.map +1 -0
- package/dist/{index--U7hHV0s.d.cts → index-XCCoPoTU.d.cts} +2 -8
- package/dist/index-XCCoPoTU.d.cts.map +1 -0
- package/dist/index.cjs +13 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -70
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -70
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -20
- package/dist/index.js.map +1 -1
- package/dist/{item-group-CQRbb8Rx.cjs → item-group-8P3WFuUK.cjs} +4 -6
- package/dist/{item-group-CQRbb8Rx.cjs.map → item-group-8P3WFuUK.cjs.map} +1 -1
- package/dist/{item-group-BbvvH_Ob.js → item-group-CeDk7mfM.js} +4 -6
- package/dist/{item-group-BbvvH_Ob.js.map → item-group-CeDk7mfM.js.map} +1 -1
- package/dist/{registry-B23o9UWh.js → registry-D92hz9iA.js} +60 -89
- package/dist/registry-D92hz9iA.js.map +1 -0
- package/dist/{registry-Ih5n4PVZ.cjs → registry-hzrkTeIT.cjs} +61 -91
- package/dist/registry-hzrkTeIT.cjs.map +1 -0
- package/dist/{schemas-Q2dyOgc2.cjs → schemas-BWeskONy.cjs} +5 -7
- package/dist/{schemas-Q2dyOgc2.cjs.map → schemas-BWeskONy.cjs.map} +1 -1
- package/dist/{schemas-yId-bJhD.js → schemas-C7TViWCg.js} +5 -7
- package/dist/{schemas-yId-bJhD.js.map → schemas-C7TViWCg.js.map} +1 -1
- package/dist/schemas.cjs +3 -3
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +3 -3
- package/dist/{scoring-CaPS6q8b.cjs → scoring-CtkCFyFT.cjs} +22 -42
- package/dist/{scoring-CaPS6q8b.cjs.map → scoring-CtkCFyFT.cjs.map} +1 -1
- package/dist/{scoring-CLMdk8i9.js → scoring-DD1GHcLI.js} +22 -42
- package/dist/{scoring-CLMdk8i9.js.map → scoring-DD1GHcLI.js.map} +1 -1
- package/dist/scoring.cjs +2 -2
- package/dist/scoring.d.cts +2 -2
- package/dist/scoring.d.ts +2 -2
- package/dist/scoring.js +2 -2
- package/dist/{xapi-BX0hvRRB.cjs → xapi-7btSpx6v.cjs} +5 -8
- package/dist/{xapi-BX0hvRRB.cjs.map → xapi-7btSpx6v.cjs.map} +1 -1
- package/dist/{xapi-Cdk9fTvV.js → xapi-Cgicg-zU.js} +5 -8
- package/dist/{xapi-Cdk9fTvV.js.map → xapi-Cgicg-zU.js.map} +1 -1
- package/dist/xapi.cjs +1 -1
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/dist/xapi.js +1 -1
- package/package.json +2 -2
- package/dist/ai-i3jwXnpX.d.cts.map +0 -1
- package/dist/ai-i3jwXnpX.d.ts.map +0 -1
- package/dist/ai-writing-C4YRVrFi.cjs.map +0 -1
- package/dist/ai-writing-OJ5m_1EB.js.map +0 -1
- package/dist/index--U7hHV0s.d.cts.map +0 -1
- package/dist/index-CFRgZLhH.d.cts.map +0 -1
- package/dist/index-DeD8EI1D.d.ts.map +0 -1
- package/dist/index-Dj92T76o.d.ts.map +0 -1
- package/dist/index-Uh1u57yq.d.cts.map +0 -1
- package/dist/index-WBHSrIUU.d.ts.map +0 -1
- package/dist/registry-B23o9UWh.js.map +0 -1
- package/dist/registry-Ih5n4PVZ.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_registry = require("./registry-
|
|
2
|
-
const require_scoring = require("./scoring-
|
|
3
|
-
const require_item_group = require("./item-group-
|
|
4
|
-
|
|
1
|
+
const require_registry = require("./registry-hzrkTeIT.cjs");
|
|
2
|
+
const require_scoring = require("./scoring-CtkCFyFT.cjs");
|
|
3
|
+
const require_item_group = require("./item-group-8P3WFuUK.cjs");
|
|
4
|
+
// src/ai-material.ts
|
|
5
5
|
/**
|
|
6
6
|
* What a model is told about the group a question sits in: the material the
|
|
7
7
|
* learner reads and sees beside it.
|
|
@@ -89,8 +89,7 @@ function materialFacts(group) {
|
|
|
89
89
|
...locale !== void 0 ? { locale } : {}
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
//#region src/ai-text.ts
|
|
92
|
+
// src/ai-text.ts
|
|
94
93
|
/**
|
|
95
94
|
* How the SDK reads text a model wrote, before a learner does. Internal: shared
|
|
96
95
|
* by the AI checks, and exported by none of the package's entry points.
|
|
@@ -178,8 +177,7 @@ function folded(text) {
|
|
|
178
177
|
}
|
|
179
178
|
/** A quote as it is searched for: folded, and without the spaces around it. */
|
|
180
179
|
const needle = (quote) => folded(quote).chars.trim();
|
|
181
|
-
|
|
182
|
-
//#region src/ai.ts
|
|
180
|
+
// src/ai.ts
|
|
183
181
|
/**
|
|
184
182
|
* The activity types the SDK builds facts for, and which of them take hints.
|
|
185
183
|
* A dictation takes none: its answer is the whole sentence, and it has
|
|
@@ -284,6 +282,11 @@ const base = (data) => ({
|
|
|
284
282
|
title: data.title,
|
|
285
283
|
...typeof data.locale === "string" ? { locale: data.locale } : {}
|
|
286
284
|
});
|
|
285
|
+
/** The item's instructions, trimmed; nothing for none, or for blank ones the learner never sees. */
|
|
286
|
+
function instructionsOf$1(data) {
|
|
287
|
+
const text = data.instructions;
|
|
288
|
+
return typeof text === "string" && text.trim() !== "" ? { instructions: text.trim() } : {};
|
|
289
|
+
}
|
|
287
290
|
/**
|
|
288
291
|
* The facts a model is given about one item and one answer. `details` are the
|
|
289
292
|
* SDK's per-part verdicts — from its own scorer, or from a server's outcome in
|
|
@@ -303,6 +306,7 @@ function buildAiFacts(data, response, details) {
|
|
|
303
306
|
return {
|
|
304
307
|
...base(data),
|
|
305
308
|
activityType: "multiple-choice",
|
|
309
|
+
...instructionsOf$1(data),
|
|
306
310
|
question: item.question,
|
|
307
311
|
mode: item.mode,
|
|
308
312
|
options: item.options.map((option) => {
|
|
@@ -328,6 +332,7 @@ function buildAiFacts(data, response, details) {
|
|
|
328
332
|
return {
|
|
329
333
|
...base(data),
|
|
330
334
|
activityType: "fill-in-the-blanks",
|
|
335
|
+
...instructionsOf$1(data),
|
|
331
336
|
passage: require_registry.numberedPassage(item.passage),
|
|
332
337
|
blanks: require_registry.placeholderOrder(item.passage).map((id, index) => {
|
|
333
338
|
const blank = blanks.get(id);
|
|
@@ -353,6 +358,7 @@ function buildAiFacts(data, response, details) {
|
|
|
353
358
|
return {
|
|
354
359
|
...base(data),
|
|
355
360
|
activityType: "gap-select",
|
|
361
|
+
...instructionsOf$1(data),
|
|
356
362
|
passage: require_registry.numberedPassage(item.passage),
|
|
357
363
|
gaps: require_registry.placeholderOrder(item.passage).map((id, index) => {
|
|
358
364
|
const gap = gaps.get(id);
|
|
@@ -596,8 +602,7 @@ function hintRevealsAnswer(facts, hint) {
|
|
|
596
602
|
default: return true;
|
|
597
603
|
}
|
|
598
604
|
}
|
|
599
|
-
|
|
600
|
-
//#region src/ai-coaching.ts
|
|
605
|
+
// src/ai-coaching.ts
|
|
601
606
|
/** The most words one coaching may work on. More is refused, not cut. */
|
|
602
607
|
const AI_COACHING_MAX_WORDS = 20;
|
|
603
608
|
/** The longest tip for one word, in code points. */
|
|
@@ -865,8 +870,7 @@ function checkSound(raw, fact) {
|
|
|
865
870
|
heard: instead.symbol
|
|
866
871
|
};
|
|
867
872
|
}
|
|
868
|
-
|
|
869
|
-
//#region src/media-refs.ts
|
|
873
|
+
// src/media-refs.ts
|
|
870
874
|
const MAIN_KINDS = [
|
|
871
875
|
"audio",
|
|
872
876
|
"video",
|
|
@@ -1035,8 +1039,7 @@ function transcriptOf(holder) {
|
|
|
1035
1039
|
if (!isRecord$3(holder)) return null;
|
|
1036
1040
|
return ownText(holder) ?? (isRecord$3(holder.media) ? ownText(holder.media) : null);
|
|
1037
1041
|
}
|
|
1038
|
-
|
|
1039
|
-
//#region src/authoring/recordings.ts
|
|
1042
|
+
// src/authoring/recordings.ts
|
|
1040
1043
|
const written$1 = (value) => typeof value === "string" && value.trim() !== "";
|
|
1041
1044
|
/** The script's turns that have a speaker and words, or none. */
|
|
1042
1045
|
function turnsOf(script) {
|
|
@@ -1099,8 +1102,7 @@ function stimulusFindings(stimulus) {
|
|
|
1099
1102
|
script: stimulus.script
|
|
1100
1103
|
}, ["stimulus"]), ...holderFindings(stimulus.media, ["stimulus", "media"])];
|
|
1101
1104
|
}
|
|
1102
|
-
|
|
1103
|
-
//#region src/authoring/item-group.ts
|
|
1105
|
+
// src/authoring/item-group.ts
|
|
1104
1106
|
/**
|
|
1105
1107
|
* A new, empty reading or listening testlet for an editor to start from.
|
|
1106
1108
|
*
|
|
@@ -1494,8 +1496,7 @@ function checkItems(draft) {
|
|
|
1494
1496
|
for (const id of repeated) issues.push(require_registry.issue("ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`));
|
|
1495
1497
|
return issues;
|
|
1496
1498
|
}
|
|
1497
|
-
|
|
1498
|
-
//#region src/authoring/index.ts
|
|
1499
|
+
// src/authoring/index.ts
|
|
1499
1500
|
/**
|
|
1500
1501
|
* Tells a draft that is not finished from a draft that is wrong.
|
|
1501
1502
|
*
|
|
@@ -1652,8 +1653,7 @@ function critiqueDraft(type, draft) {
|
|
|
1652
1653
|
const critique = descriptor.authoring?.critique;
|
|
1653
1654
|
return require_registry.withValidationScope(() => [...critique === void 0 ? [] : critique(draft), ...recordingFindings(draft)]).map(require_registry.normaliseFinding);
|
|
1654
1655
|
}
|
|
1655
|
-
|
|
1656
|
-
//#region src/ai-critique.ts
|
|
1656
|
+
// src/ai-critique.ts
|
|
1657
1657
|
/** The most findings one critique may carry. More is refused, not cut. */
|
|
1658
1658
|
const AI_CRITIQUE_MAX_FINDINGS = 20;
|
|
1659
1659
|
/** The longest message or quote in a finding, in code points. */
|
|
@@ -1701,10 +1701,10 @@ const NOT_WORDS = /* @__PURE__ */ new Set([
|
|
|
1701
1701
|
"timeline"
|
|
1702
1702
|
]);
|
|
1703
1703
|
/**
|
|
1704
|
-
* Every string an author wrote into an item, with its path: the
|
|
1705
|
-
* options, the passage, the answers, the hints, the
|
|
1706
|
-
* `alt`. Settings, ids and addresses are left out, and
|
|
1707
|
-
* sidecar: the plain field beside it holds the same words.
|
|
1704
|
+
* Every string an author wrote into an item, with its path: the instructions,
|
|
1705
|
+
* the question, the options, the passage, the answers, the hints, the
|
|
1706
|
+
* feedback, a picture's `alt`. Settings, ids and addresses are left out, and
|
|
1707
|
+
* so is any `…Html` sidecar: the plain field beside it holds the same words.
|
|
1708
1708
|
*/
|
|
1709
1709
|
function fieldsOf(value, path = []) {
|
|
1710
1710
|
if (typeof value === "string") return value.trim() === "" ? [] : [{
|
|
@@ -1825,8 +1825,7 @@ function checkAiCritique(raw, request) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
};
|
|
1827
1827
|
}
|
|
1828
|
-
|
|
1829
|
-
//#region src/ai-drafts.ts
|
|
1828
|
+
// src/ai-drafts.ts
|
|
1830
1829
|
/** The most drafts one request may ask for, and the most a reply may hold when it names no count. */
|
|
1831
1830
|
const AI_DRAFTS_MAX_COUNT = 50;
|
|
1832
1831
|
/** The most repair passes `generateDrafts` makes. */
|
|
@@ -1918,7 +1917,7 @@ const FIELDS = {
|
|
|
1918
1917
|
},
|
|
1919
1918
|
transcript: text("What the learner hears and types: words from the source, as they are said there."),
|
|
1920
1919
|
referenceText: text("What the learner reads aloud: a sentence or two from the source."),
|
|
1921
|
-
instructions: text("Optional.
|
|
1920
|
+
instructions: text("Optional. The task, shown to the learner before the item: what to do (\"Complete the sentence. Use ONE word.\"), or how to read it aloud. Never part of the text the learner answers."),
|
|
1922
1921
|
prompt: text("The writing task, as plain text."),
|
|
1923
1922
|
minWords: {
|
|
1924
1923
|
type: "integer",
|
|
@@ -1950,6 +1949,7 @@ const FIELDS = {
|
|
|
1950
1949
|
const WRITES = {
|
|
1951
1950
|
"multiple-choice": [
|
|
1952
1951
|
"title",
|
|
1952
|
+
"instructions",
|
|
1953
1953
|
"question",
|
|
1954
1954
|
"mode",
|
|
1955
1955
|
"options",
|
|
@@ -1957,12 +1957,14 @@ const WRITES = {
|
|
|
1957
1957
|
],
|
|
1958
1958
|
"fill-in-the-blanks": [
|
|
1959
1959
|
"title",
|
|
1960
|
+
"instructions",
|
|
1960
1961
|
"passage",
|
|
1961
1962
|
"blanks",
|
|
1962
1963
|
"feedback"
|
|
1963
1964
|
],
|
|
1964
1965
|
"gap-select": [
|
|
1965
1966
|
"title",
|
|
1967
|
+
"instructions",
|
|
1966
1968
|
"passage",
|
|
1967
1969
|
"gaps",
|
|
1968
1970
|
"feedback"
|
|
@@ -2100,10 +2102,16 @@ function feedbackOf(entry) {
|
|
|
2100
2102
|
...incorrect !== void 0 ? { incorrect } : {}
|
|
2101
2103
|
} };
|
|
2102
2104
|
}
|
|
2105
|
+
/** The instructions a model wrote for the learner, when it wrote any. */
|
|
2106
|
+
function instructionsOf(entry) {
|
|
2107
|
+
const instructions = written(entry.instructions);
|
|
2108
|
+
return instructions !== void 0 ? { instructions } : {};
|
|
2109
|
+
}
|
|
2103
2110
|
/** A type's content, read from what a model wrote. */
|
|
2104
2111
|
function contentOf(type, entry, newId) {
|
|
2105
2112
|
switch (type) {
|
|
2106
2113
|
case "multiple-choice": return {
|
|
2114
|
+
...instructionsOf(entry),
|
|
2107
2115
|
question: stringOf(entry.question),
|
|
2108
2116
|
...typeof entry.mode === "string" ? { mode: entry.mode } : {},
|
|
2109
2117
|
options: listOf(entry.options).map((option) => {
|
|
@@ -2119,6 +2127,7 @@ function contentOf(type, entry, newId) {
|
|
|
2119
2127
|
...feedbackOf(entry)
|
|
2120
2128
|
};
|
|
2121
2129
|
case "fill-in-the-blanks": return {
|
|
2130
|
+
...instructionsOf(entry),
|
|
2122
2131
|
passage: stringOf(entry.passage),
|
|
2123
2132
|
blanks: listOf(entry.blanks).map((blank, index) => {
|
|
2124
2133
|
const fields = isRecord$1(blank) ? blank : {};
|
|
@@ -2132,6 +2141,7 @@ function contentOf(type, entry, newId) {
|
|
|
2132
2141
|
...feedbackOf(entry)
|
|
2133
2142
|
};
|
|
2134
2143
|
case "gap-select": return {
|
|
2144
|
+
...instructionsOf(entry),
|
|
2135
2145
|
passage: stringOf(entry.passage),
|
|
2136
2146
|
gaps: listOf(entry.gaps).map((gap, index) => {
|
|
2137
2147
|
const marked = listOf(isRecord$1(gap) ? gap.choices : void 0);
|
|
@@ -2152,14 +2162,11 @@ function contentOf(type, entry, newId) {
|
|
|
2152
2162
|
transcript: stringOf(entry.transcript),
|
|
2153
2163
|
...feedbackOf(entry)
|
|
2154
2164
|
};
|
|
2155
|
-
case "read-aloud": {
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
...feedbackOf(entry)
|
|
2161
|
-
};
|
|
2162
|
-
}
|
|
2165
|
+
case "read-aloud": return {
|
|
2166
|
+
referenceText: stringOf(entry.referenceText),
|
|
2167
|
+
...instructionsOf(entry),
|
|
2168
|
+
...feedbackOf(entry)
|
|
2169
|
+
};
|
|
2163
2170
|
default: {
|
|
2164
2171
|
const criteria = listOf(isRecord$1(entry.rubric) ? entry.rubric.criteria : void 0);
|
|
2165
2172
|
return {
|
|
@@ -2530,8 +2537,7 @@ function interactiveVideoFromDrafts(input) {
|
|
|
2530
2537
|
findings: critiqueItemGroupDraft(group)
|
|
2531
2538
|
};
|
|
2532
2539
|
}
|
|
2533
|
-
|
|
2534
|
-
//#region src/ai-written.ts
|
|
2540
|
+
// src/ai-written.ts
|
|
2535
2541
|
/**
|
|
2536
2542
|
* What the AI features about a written response share: reading a model's text
|
|
2537
2543
|
* fields, and finding each correction's quote in the learner's text.
|
|
@@ -2674,8 +2680,7 @@ function checkCorrections(raw, text) {
|
|
|
2674
2680
|
corrections
|
|
2675
2681
|
};
|
|
2676
2682
|
}
|
|
2677
|
-
|
|
2678
|
-
//#region src/ai-grading.ts
|
|
2683
|
+
// src/ai-grading.ts
|
|
2679
2684
|
/**
|
|
2680
2685
|
* How far a model's level probabilities may sum from 1 and still be a
|
|
2681
2686
|
* distribution: rounding in a model's output, not a different judgement.
|
|
@@ -2999,8 +3004,7 @@ function checkAiGrading(raw, request) {
|
|
|
2999
3004
|
}
|
|
3000
3005
|
};
|
|
3001
3006
|
}
|
|
3002
|
-
|
|
3003
|
-
//#region src/ai-writing.ts
|
|
3007
|
+
// src/ai-writing.ts
|
|
3004
3008
|
/**
|
|
3005
3009
|
* The request for feedback on a draft, or `null` when there is none to give:
|
|
3006
3010
|
* not a written response, an author who switched explanations off (writing
|
|
@@ -3170,7 +3174,6 @@ function checkAiWritingFeedback(raw, request) {
|
|
|
3170
3174
|
}
|
|
3171
3175
|
};
|
|
3172
3176
|
}
|
|
3173
|
-
//#endregion
|
|
3174
3177
|
Object.defineProperty(exports, "AI_COACHING_MAX_TIP_LENGTH", {
|
|
3175
3178
|
enumerable: true,
|
|
3176
3179
|
get: function() {
|
|
@@ -3454,4 +3457,4 @@ Object.defineProperty(exports, "validateItemGroupDraft", {
|
|
|
3454
3457
|
}
|
|
3455
3458
|
});
|
|
3456
3459
|
|
|
3457
|
-
//# sourceMappingURL=ai-writing-
|
|
3460
|
+
//# sourceMappingURL=ai-writing-DrPTV3R2.cjs.map
|