@intellectif/lk-core 1.8.0 → 1.9.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 (76) hide show
  1. package/CHANGELOG.md +17 -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-writing-DeIV-GfN.js → ai-writing-DQjI9EFN.js} +130 -5
  7. package/dist/ai-writing-DQjI9EFN.js.map +1 -0
  8. package/dist/{ai-writing-Bh2Y53cY.cjs → ai-writing-DbpZpGRk.cjs} +135 -4
  9. package/dist/ai-writing-DbpZpGRk.cjs.map +1 -0
  10. package/dist/{ai-Cnm0qE8v.d.cts → ai-zhc9yhRj.d.cts} +160 -2
  11. package/dist/ai-zhc9yhRj.d.cts.map +1 -0
  12. package/dist/{ai-Cnm0qE8v.d.ts → ai-zhc9yhRj.d.ts} +160 -2
  13. package/dist/ai-zhc9yhRj.d.ts.map +1 -0
  14. package/dist/{index-DMh3OYSb.d.cts → index-BeC8tAWf.d.cts} +2 -2
  15. package/dist/{index-DMh3OYSb.d.cts.map → index-BeC8tAWf.d.cts.map} +1 -1
  16. package/dist/{index-CtoPhJAH.d.ts → index-Byar5VVs.d.ts} +2 -2
  17. package/dist/{index-CtoPhJAH.d.ts.map → index-Byar5VVs.d.ts.map} +1 -1
  18. package/dist/{index-fZ67k-WR.d.cts → index-Ccj8oL_E.d.cts} +2 -2
  19. package/dist/{index-fZ67k-WR.d.cts.map → index-Ccj8oL_E.d.cts.map} +1 -1
  20. package/dist/{index-g-EWIugp.d.ts → index-CxkqS62X.d.ts} +89 -7
  21. package/dist/index-CxkqS62X.d.ts.map +1 -0
  22. package/dist/{index-oST8GBFa.d.cts → index-DLsUnGHt.d.cts} +89 -7
  23. package/dist/index-DLsUnGHt.d.cts.map +1 -0
  24. package/dist/{index-HXvg0YRQ.d.ts → index-f4YuMgFb.d.ts} +2 -2
  25. package/dist/{index-HXvg0YRQ.d.ts.map → index-f4YuMgFb.d.ts.map} +1 -1
  26. package/dist/index.cjs +8 -6
  27. package/dist/index.d.cts +40 -7
  28. package/dist/index.d.cts.map +1 -1
  29. package/dist/index.d.ts +40 -7
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +7 -7
  32. package/dist/{item-group-BceUoxoM.js → item-group-CKZk3txt.js} +2 -2
  33. package/dist/{item-group-BceUoxoM.js.map → item-group-CKZk3txt.js.map} +1 -1
  34. package/dist/{item-group-KV4hYu3a.cjs → item-group-COP5OwEC.cjs} +2 -2
  35. package/dist/{item-group-KV4hYu3a.cjs.map → item-group-COP5OwEC.cjs.map} +1 -1
  36. package/dist/{registry-tkacvJUI.js → registry-Bw9grsCN.js} +321 -11
  37. package/dist/registry-Bw9grsCN.js.map +1 -0
  38. package/dist/{registry-Cymq7Ah0.cjs → registry-C9O9txy5.cjs} +332 -10
  39. package/dist/registry-C9O9txy5.cjs.map +1 -0
  40. package/dist/{schemas-DM8sN_f0.js → schemas-BJe3W6Xb.js} +3 -3
  41. package/dist/{schemas-DM8sN_f0.js.map → schemas-BJe3W6Xb.js.map} +1 -1
  42. package/dist/{schemas-wDzbKdKa.cjs → schemas-CXlemRvB.cjs} +3 -3
  43. package/dist/{schemas-wDzbKdKa.cjs.map → schemas-CXlemRvB.cjs.map} +1 -1
  44. package/dist/schemas.cjs +3 -3
  45. package/dist/schemas.d.cts +1 -1
  46. package/dist/schemas.d.ts +1 -1
  47. package/dist/schemas.js +3 -3
  48. package/dist/{scoring-DIBmo_cy.js → scoring-BGKdff2i.js} +214 -26
  49. package/dist/scoring-BGKdff2i.js.map +1 -0
  50. package/dist/{scoring-D9tFvPEG.cjs → scoring-Db1CZeAn.cjs} +219 -25
  51. package/dist/scoring-Db1CZeAn.cjs.map +1 -0
  52. package/dist/scoring.cjs +3 -2
  53. package/dist/scoring.d.cts +3 -3
  54. package/dist/scoring.d.ts +3 -3
  55. package/dist/scoring.js +3 -3
  56. package/dist/{xapi-gCAo549Q.js → xapi-BtBm8AWZ.js} +2 -2
  57. package/dist/{xapi-gCAo549Q.js.map → xapi-BtBm8AWZ.js.map} +1 -1
  58. package/dist/{xapi-Dyqcl3JK.cjs → xapi-DOAqH9__.cjs} +2 -2
  59. package/dist/{xapi-Dyqcl3JK.cjs.map → xapi-DOAqH9__.cjs.map} +1 -1
  60. package/dist/xapi.cjs +1 -1
  61. package/dist/xapi.d.cts +1 -1
  62. package/dist/xapi.d.ts +1 -1
  63. package/dist/xapi.js +1 -1
  64. package/package.json +1 -1
  65. package/vectors/scoring.json +11967 -1
  66. package/vectors/validation.json +1298 -1
  67. package/dist/ai-Cnm0qE8v.d.cts.map +0 -1
  68. package/dist/ai-Cnm0qE8v.d.ts.map +0 -1
  69. package/dist/ai-writing-Bh2Y53cY.cjs.map +0 -1
  70. package/dist/ai-writing-DeIV-GfN.js.map +0 -1
  71. package/dist/index-g-EWIugp.d.ts.map +0 -1
  72. package/dist/index-oST8GBFa.d.cts.map +0 -1
  73. package/dist/registry-Cymq7Ah0.cjs.map +0 -1
  74. package/dist/registry-tkacvJUI.js.map +0 -1
  75. package/dist/scoring-D9tFvPEG.cjs.map +0 -1
  76. package/dist/scoring-DIBmo_cy.js.map +0 -1
@@ -1,6 +1,6 @@
1
- const require_registry = require("./registry-Cymq7Ah0.cjs");
2
- const require_scoring = require("./scoring-D9tFvPEG.cjs");
3
- const require_item_group = require("./item-group-KV4hYu3a.cjs");
1
+ const require_registry = require("./registry-C9O9txy5.cjs");
2
+ const require_scoring = require("./scoring-Db1CZeAn.cjs");
3
+ const require_item_group = require("./item-group-COP5OwEC.cjs");
4
4
  // src/ai-material.ts
5
5
  /**
6
6
  * What a model is told about the group a question sits in: the material the
@@ -3508,6 +3508,131 @@ function aiGradingRequest(input) {
3508
3508
  }
3509
3509
  };
3510
3510
  }
3511
+ const MEASURES = require_registry.SPEAKING_MEASURES;
3512
+ /**
3513
+ * The request for a model's grade of a spoken answer (1.9), or why there is
3514
+ * none to make.
3515
+ *
3516
+ * Built as a written response's is, on the server and from the whole item, with
3517
+ * the take's evidence: the model reads `assessment.transcript` — the
3518
+ * transcriber's verbatim text, the same text the engine measured the take
3519
+ * against — and scores the criteria a judge scores: those that name no
3520
+ * `measure`, or every criterion when `judgeMeasures` is set. The measured
3521
+ * criteria go with it as context, with the engine's scores, so feedback can
3522
+ * speak of them; the model does not score them.
3523
+ *
3524
+ * The evidence is checked as `gradeSpeakingResponse` checks it — valid,
3525
+ * unscripted, for this item's locale and this response's recording — so a model
3526
+ * is never paid to judge a take the grade would refuse. Read the reply with
3527
+ * `checkAiGrading`, and grade with `gradeSpeakingResponse` under the same
3528
+ * `judgeMeasures`.
3529
+ */
3530
+ function aiSpeakingGradingRequest(input) {
3531
+ const { data, response, learnerLocale } = input;
3532
+ if (data.type !== "speaking-response") return {
3533
+ ok: false,
3534
+ problem: "not-speaking-response"
3535
+ };
3536
+ if (data.redacted === true) return {
3537
+ ok: false,
3538
+ problem: "redacted"
3539
+ };
3540
+ const item = data;
3541
+ const rubric = rubricFacts(item.rubric);
3542
+ if (!rubric.ok) return rubric;
3543
+ const authored = item.rubric.criteria;
3544
+ const judged = [];
3545
+ const measured = [];
3546
+ for (const [index, fact] of rubric.criteria.entries()) {
3547
+ const measure = authored[index].measure;
3548
+ if (measure !== void 0 && !MEASURES.includes(measure)) return {
3549
+ ok: false,
3550
+ problem: "no-rubric",
3551
+ path: [
3552
+ "rubric",
3553
+ "criteria",
3554
+ index,
3555
+ "measure"
3556
+ ]
3557
+ };
3558
+ if (measure === void 0 || input.judgeMeasures === true) judged.push({
3559
+ ...fact,
3560
+ ...measure !== void 0 ? { measure } : {}
3561
+ });
3562
+ else measured.push({
3563
+ name: fact.name,
3564
+ measure,
3565
+ weight: fact.weight
3566
+ });
3567
+ }
3568
+ if (judged.length === 0) return {
3569
+ ok: false,
3570
+ problem: "nothing-to-judge"
3571
+ };
3572
+ const recording = response?.type === "speaking-response" ? response.recording : null;
3573
+ if (recording === null || recording === void 0) return {
3574
+ ok: false,
3575
+ problem: "empty-response"
3576
+ };
3577
+ const checked = input.assessment === null || input.assessment === void 0 ? void 0 : require_scoring.validateSpeechAssessment(input.assessment);
3578
+ if (checked === void 0 || !checked.success) return {
3579
+ ok: false,
3580
+ problem: "invalid-assessment"
3581
+ };
3582
+ const evidence = checked.data;
3583
+ if (evidence.status === "no_speech") return {
3584
+ ok: false,
3585
+ problem: "empty-response"
3586
+ };
3587
+ if (evidence.task !== "unscripted" || evidence.locale !== item.locale || evidence.recordingKey !== recording.key) return {
3588
+ ok: false,
3589
+ problem: "evidence-mismatch"
3590
+ };
3591
+ if (evidence.transcript === void 0) return {
3592
+ ok: false,
3593
+ problem: "no-transcript"
3594
+ };
3595
+ const text = evidence.transcript.text;
3596
+ const scores = evidence.scores;
3597
+ const scoreOf = {
3598
+ pronunciation: scores.accuracy,
3599
+ fluency: scores.fluency,
3600
+ prosody: scores.prosody
3601
+ };
3602
+ const media = isRecord$1(item.media) && typeof item.media.type === "string" ? item.media : void 0;
3603
+ const material = materialFacts(input.group);
3604
+ return {
3605
+ ok: true,
3606
+ request: {
3607
+ feature: "speaking-grading",
3608
+ facts: {
3609
+ activityType: "speaking-response",
3610
+ activityId: data.id,
3611
+ title: data.title,
3612
+ locale: item.locale,
3613
+ ...typeof item.instructions === "string" ? { instructions: item.instructions } : {},
3614
+ prompt: typeof item.prompt === "string" ? item.prompt : "",
3615
+ ...media !== void 0 ? { media: {
3616
+ type: media.type,
3617
+ ...typeof media.alt === "string" ? { alt: media.alt } : {}
3618
+ } } : {},
3619
+ text,
3620
+ wordCount: require_registry.countWords(text),
3621
+ rubric: judged,
3622
+ measured: measured.map((fact) => {
3623
+ const score = scoreOf[fact.measure];
3624
+ return score !== void 0 ? {
3625
+ ...fact,
3626
+ score
3627
+ } : fact;
3628
+ }),
3629
+ ...typeof item.languageTarget === "string" ? { languageTarget: item.languageTarget } : {}
3630
+ },
3631
+ ...material !== null ? { material } : {},
3632
+ ...learnerLocale !== void 0 ? { learnerLocale } : {}
3633
+ }
3634
+ };
3635
+ }
3511
3636
  /** The rubric as a model is given it, each criterion's levels read. */
3512
3637
  function rubricFacts(rubric) {
3513
3638
  const listed = isRecord$1(rubric) ? rubric.criteria : void 0;
@@ -5595,6 +5720,12 @@ Object.defineProperty(exports, "aiHintRequest", {
5595
5720
  return aiHintRequest;
5596
5721
  }
5597
5722
  });
5723
+ Object.defineProperty(exports, "aiSpeakingGradingRequest", {
5724
+ enumerable: true,
5725
+ get: function() {
5726
+ return aiSpeakingGradingRequest;
5727
+ }
5728
+ });
5598
5729
  Object.defineProperty(exports, "aiSupports", {
5599
5730
  enumerable: true,
5600
5731
  get: function() {
@@ -5818,4 +5949,4 @@ Object.defineProperty(exports, "validateItemGroupDraft", {
5818
5949
  }
5819
5950
  });
5820
5951
 
5821
- //# sourceMappingURL=ai-writing-Bh2Y53cY.cjs.map
5952
+ //# sourceMappingURL=ai-writing-DbpZpGRk.cjs.map