@intellectif/lk-core 0.18.0 → 0.19.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 +31 -0
- package/README.md +1 -0
- package/dist/{activity-HH8dxN1v.d.cts → activity-f0bgZSTP.d.cts} +163 -141
- package/dist/{activity-HH8dxN1v.d.ts → activity-f0bgZSTP.d.ts} +163 -141
- package/dist/ai-check.cjs +283 -0
- package/dist/ai-check.cjs.map +1 -0
- package/dist/ai-check.d.cts +106 -0
- package/dist/ai-check.d.ts +106 -0
- package/dist/ai-check.js +283 -0
- package/dist/ai-check.js.map +1 -0
- package/dist/chunk-BIJCO2HM.js +443 -0
- package/dist/chunk-BIJCO2HM.js.map +1 -0
- package/dist/chunk-FVZJ4X3Y.cjs +443 -0
- package/dist/chunk-FVZJ4X3Y.cjs.map +1 -0
- package/dist/{index-BrBBUb1i.d.ts → index-DMCM3e3P.d.ts} +4 -4
- package/dist/{index-DejnxQpK.d.cts → index-bpuDhvXV.d.cts} +4 -4
- package/dist/index.cjs +35 -425
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +37 -427
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.cts +2 -2
- package/dist/schemas.d.ts +2 -2
- package/dist/scoring.d.cts +2 -2
- package/dist/scoring.d.ts +2 -2
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/package.json +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z as LearnerResponse, Y as ItemOutcome, j as AiExplanationRequest, o as AiGrade, p as AiHintRequest, ad as ScoringDetail, q as AiItemFacts, w as AiTextResult, u as AiRefusal, a as ActivityData, ai as ValidationError, f as ActivityType, b as ActivityDataMap, C as CriterionScore, Q as GradeRecord, a5 as NativeControlHint, d as ActivityMedia, af as ScoringResult, z as DeferredScoringPartial, E as DictationData, G as DictationLearnerResponse, J as FillInTheBlanksData, K as FillInTheBlanksLearnerResponse, N as GapSelectData, P as GapSelectLearnerResponse, a1 as MultipleChoiceData, a2 as MultipleChoiceLearnerResponse, a6 as ReadAloudData, a9 as ReadAloudLearnerResponse, ak as WrittenResponseData, al as WrittenResponseLearnerResponse } from './activity-
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-
|
|
1
|
+
import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z as LearnerResponse, Y as ItemOutcome, j as AiExplanationRequest, o as AiGrade, p as AiHintRequest, ad as ScoringDetail, q as AiItemFacts, w as AiTextResult, u as AiRefusal, a as ActivityData, ai as ValidationError, f as ActivityType, b as ActivityDataMap, C as CriterionScore, Q as GradeRecord, a5 as NativeControlHint, d as ActivityMedia, af as ScoringResult, z as DeferredScoringPartial, E as DictationData, G as DictationLearnerResponse, J as FillInTheBlanksData, K as FillInTheBlanksLearnerResponse, N as GapSelectData, P as GapSelectLearnerResponse, a1 as MultipleChoiceData, a2 as MultipleChoiceLearnerResponse, a6 as ReadAloudData, a9 as ReadAloudLearnerResponse, ak as WrittenResponseData, al as WrittenResponseLearnerResponse } from './activity-f0bgZSTP.cjs';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-f0bgZSTP.cjs';
|
|
3
3
|
import { ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.cjs';
|
|
4
4
|
export { AssessmentSectionInput, Band, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, DictationAlignment, DictationCharOp, DictationReference, DictationWordAlignment, GradeReadAloudOptions, PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudWordAlignment, ReadAloudWordState, RoundingMode, SPEECH_ASSESSMENT_MAX_WORDS, ScoringOptions, SectionScore, SpeechAssessment, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment } from './scoring.cjs';
|
|
5
|
-
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-
|
|
6
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
5
|
+
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-bpuDhvXV.cjs';
|
|
6
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-bpuDhvXV.cjs';
|
|
7
7
|
import { z } from 'zod/v4';
|
|
8
8
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.cjs';
|
|
9
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z as LearnerResponse, Y as ItemOutcome, j as AiExplanationRequest, o as AiGrade, p as AiHintRequest, ad as ScoringDetail, q as AiItemFacts, w as AiTextResult, u as AiRefusal, a as ActivityData, ai as ValidationError, f as ActivityType, b as ActivityDataMap, C as CriterionScore, Q as GradeRecord, a5 as NativeControlHint, d as ActivityMedia, af as ScoringResult, z as DeferredScoringPartial, E as DictationData, G as DictationLearnerResponse, J as FillInTheBlanksData, K as FillInTheBlanksLearnerResponse, N as GapSelectData, P as GapSelectLearnerResponse, a1 as MultipleChoiceData, a2 as MultipleChoiceLearnerResponse, a6 as ReadAloudData, a9 as ReadAloudLearnerResponse, ak as WrittenResponseData, al as WrittenResponseLearnerResponse } from './activity-
|
|
2
|
-
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-
|
|
1
|
+
import { v as AiSupportedActivityType, g as AiActivityInput, k as AiFeature, Z as LearnerResponse, Y as ItemOutcome, j as AiExplanationRequest, o as AiGrade, p as AiHintRequest, ad as ScoringDetail, q as AiItemFacts, w as AiTextResult, u as AiRefusal, a as ActivityData, ai as ValidationError, f as ActivityType, b as ActivityDataMap, C as CriterionScore, Q as GradeRecord, a5 as NativeControlHint, d as ActivityMedia, af as ScoringResult, z as DeferredScoringPartial, E as DictationData, G as DictationLearnerResponse, J as FillInTheBlanksData, K as FillInTheBlanksLearnerResponse, N as GapSelectData, P as GapSelectLearnerResponse, a1 as MultipleChoiceData, a2 as MultipleChoiceLearnerResponse, a6 as ReadAloudData, a9 as ReadAloudLearnerResponse, ak as WrittenResponseData, al as WrittenResponseLearnerResponse } from './activity-f0bgZSTP.js';
|
|
2
|
+
export { A as ActivityAiPermissions, c as ActivityFeedback, e as ActivityResult, h as AiBlankFact, i as AiDictationFacts, l as AiFillInTheBlanksFacts, m as AiGapFact, n as AiGapSelectFacts, r as AiMultipleChoiceFacts, s as AiOptionFact, t as AiProvenance, x as AiVerdict, y as AiWordFact, B as BlankConfig, D as DeferredReason, F as DictationEquivalence, H as DictationSlowMedia, I as DictationTolerance, L as GapSelectBank, M as GapSelectChoice, O as GapSelectGap, R as Grader, S as GraderKind, T as GraderUsage, U as GradingState, V as InlineCorrection, W as InteractionEvent, X as InteractionKind, _ as LearnerResponseMap, $ as MediaPlaybackPolicy, a0 as MediaTrack, a3 as MultipleChoiceOption, a4 as MultipleChoiceOptionMedia, a7 as ReadAloudDimension, a8 as ReadAloudDimensionWeight, aa as ReadAloudSlowMedia, ab as RecordingBounds, ac as RecordingRef, ae as ScoringOutcome, ag as TextMatchPolicy, ah as TextMatchResult, aj as ValidationResult, am as WrittenResponseRubric, an as WrittenResponseRubricCriterion, ao as XAPIActor, ap as XAPIConfig, aq as XAPIContext, ar as XAPIContextActivities, as as XAPIError, at as XAPIObject, au as XAPIResult, av as XAPIScore, aw as XAPIStatement, ax as XAPIVerbObject, ay as levenshteinDistance, az as matchText } from './activity-f0bgZSTP.js';
|
|
3
3
|
import { ScoredItem, RoundingPolicy, CompositionPolicy, AssessmentScore } from './scoring.js';
|
|
4
4
|
export { AssessmentSectionInput, Band, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, DictationAlignment, DictationCharOp, DictationReference, DictationWordAlignment, GradeReadAloudOptions, PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudWordAlignment, ReadAloudWordState, RoundingMode, SPEECH_ASSESSMENT_MAX_WORDS, ScoringOptions, SectionScore, SpeechAssessment, SpeechMeasurement, SpeechPhoneme, SpeechPhonemeCandidate, SpeechPlausibilityPolicy, SpeechSyllable, SpeechUnscorable, SpeechUnscorableCode, SpeechWord, SpeechWordError, WavInspection, WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment } from './scoring.js';
|
|
5
|
-
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-
|
|
6
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
5
|
+
import { a5 as SequenceSlot, a4 as SequenceEntry, I as ItemGroup, i as MediaProgress } from './index-DMCM3e3P.js';
|
|
6
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, k as MediaTimeline, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a6 as SequenceSlotGroup, a7 as Stimulus, a8 as StimulusKind, a9 as StimulusSchema, aa as TextMatchPolicySchema, ab as TimelineChapter, ac as TimelineChapterSchema, ad as TimelineCue, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-DMCM3e3P.js';
|
|
7
7
|
import { z } from 'zod/v4';
|
|
8
8
|
export { AnsweredStatementParams, CompletedStatementParams, SubmittedStatementParams, XAPIObjectParams, XAPIStatementParams, XAPIVerb, XAPIVerbKey, XAPI_VERB_DISPLAY, validateXAPIStatement, xAPIBuilder, xapiDefinitionFor } from './xapi.js';
|
|
9
9
|
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_PASS_THRESHOLD,
|
|
3
|
-
alignReadAloud,
|
|
4
|
-
classifyBand,
|
|
5
|
-
composeAssessmentScore,
|
|
6
|
-
computePassThreshold,
|
|
7
|
-
diffDictationChars,
|
|
8
|
-
evaluate,
|
|
9
|
-
gradeFromRubric,
|
|
10
|
-
gradeReadAloud,
|
|
11
|
-
gte,
|
|
12
|
-
hasGrade,
|
|
13
|
-
inspectWav,
|
|
14
|
-
isGradeInRange,
|
|
15
|
-
outcomeFromGrade,
|
|
16
|
-
outcomeFromUnscorable,
|
|
17
|
-
roundGrade,
|
|
18
|
-
score,
|
|
19
|
-
validateSpeechAssessment
|
|
20
|
-
} from "./chunk-MMEQKFFQ.js";
|
|
21
1
|
import {
|
|
22
2
|
XAPIVerb,
|
|
23
3
|
XAPI_VERB_DISPLAY,
|
|
@@ -51,6 +31,40 @@ import {
|
|
|
51
31
|
validateItemGroup,
|
|
52
32
|
writtenResponseJsonSchema
|
|
53
33
|
} from "./chunk-Z7QQZ53L.js";
|
|
34
|
+
import {
|
|
35
|
+
AI_EXPLANATION_TYPES,
|
|
36
|
+
AI_HINT_TYPES,
|
|
37
|
+
AI_TEXT_MAX_LENGTH,
|
|
38
|
+
aiAllowedByContent,
|
|
39
|
+
aiExplanationRequest,
|
|
40
|
+
aiGradeOf,
|
|
41
|
+
aiHintRequest,
|
|
42
|
+
aiSupports,
|
|
43
|
+
buildAiFacts,
|
|
44
|
+
checkAiExplanation,
|
|
45
|
+
checkAiHint,
|
|
46
|
+
hintRevealsAnswer,
|
|
47
|
+
readAiTextResult
|
|
48
|
+
} from "./chunk-BIJCO2HM.js";
|
|
49
|
+
import {
|
|
50
|
+
DEFAULT_PASS_THRESHOLD,
|
|
51
|
+
alignReadAloud,
|
|
52
|
+
classifyBand,
|
|
53
|
+
composeAssessmentScore,
|
|
54
|
+
computePassThreshold,
|
|
55
|
+
diffDictationChars,
|
|
56
|
+
evaluate,
|
|
57
|
+
gradeFromRubric,
|
|
58
|
+
gradeReadAloud,
|
|
59
|
+
gte,
|
|
60
|
+
hasGrade,
|
|
61
|
+
inspectWav,
|
|
62
|
+
outcomeFromGrade,
|
|
63
|
+
outcomeFromUnscorable,
|
|
64
|
+
roundGrade,
|
|
65
|
+
score,
|
|
66
|
+
validateSpeechAssessment
|
|
67
|
+
} from "./chunk-MMEQKFFQ.js";
|
|
54
68
|
import {
|
|
55
69
|
ActivitySchemaError,
|
|
56
70
|
AiPermissionsSchema,
|
|
@@ -82,7 +96,6 @@ import {
|
|
|
82
96
|
MultipleChoiceOptionMediaSchema,
|
|
83
97
|
MultipleChoiceOptionSchema,
|
|
84
98
|
NativeControlHintSchema,
|
|
85
|
-
PLACEHOLDER_RE,
|
|
86
99
|
READ_ALOUD_MAX_DIMENSION_WEIGHT,
|
|
87
100
|
READ_ALOUD_MAX_REFERENCE_LENGTH,
|
|
88
101
|
READ_ALOUD_MAX_SECONDS,
|
|
@@ -139,409 +152,6 @@ import {
|
|
|
139
152
|
writtenResponseType
|
|
140
153
|
} from "./chunk-D3GP5MET.js";
|
|
141
154
|
|
|
142
|
-
// src/ai.ts
|
|
143
|
-
var AI_EXPLANATION_TYPES = [
|
|
144
|
-
"multiple-choice",
|
|
145
|
-
"fill-in-the-blanks",
|
|
146
|
-
"gap-select",
|
|
147
|
-
"dictation"
|
|
148
|
-
];
|
|
149
|
-
var AI_HINT_TYPES = [
|
|
150
|
-
"multiple-choice",
|
|
151
|
-
"fill-in-the-blanks",
|
|
152
|
-
"gap-select"
|
|
153
|
-
];
|
|
154
|
-
var AI_TEXT_MAX_LENGTH = 2e3;
|
|
155
|
-
function aiSupports(activityType, feature) {
|
|
156
|
-
const types = feature === "hint" ? AI_HINT_TYPES : AI_EXPLANATION_TYPES;
|
|
157
|
-
return types.includes(activityType);
|
|
158
|
-
}
|
|
159
|
-
function aiAllowedByContent(data, feature) {
|
|
160
|
-
const permissions = data.ai;
|
|
161
|
-
if (typeof permissions !== "object" || permissions === null) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
const key = feature === "hint" ? "hints" : "explanations";
|
|
165
|
-
return permissions[key] !== false;
|
|
166
|
-
}
|
|
167
|
-
function aiGradeOf(result) {
|
|
168
|
-
const ratio = result.maxScore > 0 ? result.score / result.maxScore : 0;
|
|
169
|
-
let category = "partly-correct";
|
|
170
|
-
if (ratio >= 1 - 1e-9) {
|
|
171
|
-
category = "correct";
|
|
172
|
-
} else if (ratio <= 1e-9) {
|
|
173
|
-
category = "incorrect";
|
|
174
|
-
}
|
|
175
|
-
return { score: result.score, maxScore: result.maxScore, passed: result.passed, category };
|
|
176
|
-
}
|
|
177
|
-
function placeholderOrder(passage) {
|
|
178
|
-
return [...passage.matchAll(PLACEHOLDER_RE)].map((match) => match[1]);
|
|
179
|
-
}
|
|
180
|
-
function numberedPassage(passage) {
|
|
181
|
-
let position = 0;
|
|
182
|
-
return passage.replace(PLACEHOLDER_RE, () => {
|
|
183
|
-
position += 1;
|
|
184
|
-
return `[${position}]`;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function isAnswerOption(detail, chosen) {
|
|
188
|
-
switch (detail.outcome) {
|
|
189
|
-
case "correct":
|
|
190
|
-
case "incorrect-omission":
|
|
191
|
-
return true;
|
|
192
|
-
case "incorrect":
|
|
193
|
-
case "correct-omission":
|
|
194
|
-
return false;
|
|
195
|
-
default:
|
|
196
|
-
return chosen ? detail.correct : !detail.correct;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
var firstString = (value) => Array.isArray(value) ? value[0] : value;
|
|
200
|
-
var listOf = (value) => value === void 0 ? null : Array.isArray(value) ? [...value] : [value];
|
|
201
|
-
function emptyResponse(type) {
|
|
202
|
-
switch (type) {
|
|
203
|
-
case "multiple-choice":
|
|
204
|
-
return { type: "multiple-choice", selectedOptionIds: [] };
|
|
205
|
-
case "fill-in-the-blanks":
|
|
206
|
-
return { type: "fill-in-the-blanks", answers: {} };
|
|
207
|
-
case "gap-select":
|
|
208
|
-
return { type: "gap-select", selections: {} };
|
|
209
|
-
case "dictation":
|
|
210
|
-
return { type: "dictation", text: "" };
|
|
211
|
-
default:
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
var base = (data) => ({
|
|
216
|
-
activityId: data.id,
|
|
217
|
-
title: data.title,
|
|
218
|
-
...typeof data.locale === "string" ? { locale: data.locale } : {}
|
|
219
|
-
});
|
|
220
|
-
function buildAiFacts(data, response, details) {
|
|
221
|
-
const byId = new Map((details ?? []).map((detail) => [detail.itemId, detail]));
|
|
222
|
-
const full = data.redacted !== true;
|
|
223
|
-
switch (data.type) {
|
|
224
|
-
case "multiple-choice": {
|
|
225
|
-
const item = data;
|
|
226
|
-
const chosen = new Set(
|
|
227
|
-
response?.type === "multiple-choice" ? response.selectedOptionIds : []
|
|
228
|
-
);
|
|
229
|
-
return {
|
|
230
|
-
...base(data),
|
|
231
|
-
activityType: "multiple-choice",
|
|
232
|
-
question: item.question,
|
|
233
|
-
mode: item.mode,
|
|
234
|
-
options: item.options.map((option) => {
|
|
235
|
-
const detail = byId.get(option.id);
|
|
236
|
-
const wasChosen = chosen.has(option.id);
|
|
237
|
-
let correct = null;
|
|
238
|
-
if (full && typeof option.isCorrect === "boolean") {
|
|
239
|
-
correct = option.isCorrect;
|
|
240
|
-
} else if (detail !== void 0) {
|
|
241
|
-
correct = isAnswerOption(detail, wasChosen);
|
|
242
|
-
}
|
|
243
|
-
return {
|
|
244
|
-
id: option.id,
|
|
245
|
-
text: option.text,
|
|
246
|
-
chosen: wasChosen,
|
|
247
|
-
correct,
|
|
248
|
-
...typeof option.feedback === "string" ? { feedback: option.feedback } : {}
|
|
249
|
-
};
|
|
250
|
-
})
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
case "fill-in-the-blanks": {
|
|
254
|
-
const item = data;
|
|
255
|
-
const answers = response?.type === "fill-in-the-blanks" ? response.answers : {};
|
|
256
|
-
const blanks = new Map(item.blanks.map((blank) => [blank.id, blank]));
|
|
257
|
-
return {
|
|
258
|
-
...base(data),
|
|
259
|
-
activityType: "fill-in-the-blanks",
|
|
260
|
-
passage: numberedPassage(item.passage),
|
|
261
|
-
blanks: placeholderOrder(item.passage).map((id, index) => {
|
|
262
|
-
const blank = blanks.get(id);
|
|
263
|
-
const detail = byId.get(id);
|
|
264
|
-
const accepted = full && Array.isArray(blank?.acceptedAnswers) ? [...blank.acceptedAnswers] : listOf(detail?.correctResponse);
|
|
265
|
-
return {
|
|
266
|
-
id,
|
|
267
|
-
position: index + 1,
|
|
268
|
-
typed: typeof answers[id] === "string" ? answers[id] : "",
|
|
269
|
-
accepted,
|
|
270
|
-
correct: detail === void 0 ? null : detail.correct,
|
|
271
|
-
...typeof blank?.hint === "string" ? { hint: blank.hint } : {},
|
|
272
|
-
...typeof blank?.feedback === "string" ? { feedback: blank.feedback } : {}
|
|
273
|
-
};
|
|
274
|
-
})
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
case "gap-select": {
|
|
278
|
-
const item = data;
|
|
279
|
-
const selections = response?.type === "gap-select" ? response.selections : {};
|
|
280
|
-
const gaps = new Map(item.gaps.map((gap) => [gap.id, gap]));
|
|
281
|
-
const banks = new Map((item.banks ?? []).map((bank) => [bank.id, bank]));
|
|
282
|
-
return {
|
|
283
|
-
...base(data),
|
|
284
|
-
activityType: "gap-select",
|
|
285
|
-
passage: numberedPassage(item.passage),
|
|
286
|
-
gaps: placeholderOrder(item.passage).map((id, index) => {
|
|
287
|
-
const gap = gaps.get(id);
|
|
288
|
-
const choices = gap?.choices ?? (gap?.bankId === void 0 ? [] : banks.get(gap.bankId)?.choices ?? []);
|
|
289
|
-
const textOf = (choiceId) => choiceId === void 0 ? null : choices.find((choice) => choice.id === choiceId)?.text ?? null;
|
|
290
|
-
const detail = byId.get(id);
|
|
291
|
-
const answerId = full && typeof gap?.correctChoiceId === "string" ? gap.correctChoiceId : firstString(detail?.correctResponse);
|
|
292
|
-
return {
|
|
293
|
-
id,
|
|
294
|
-
position: index + 1,
|
|
295
|
-
choices: choices.map((choice) => choice.text),
|
|
296
|
-
chosen: textOf(selections[id]),
|
|
297
|
-
answer: textOf(answerId),
|
|
298
|
-
correct: detail === void 0 ? null : detail.correct,
|
|
299
|
-
...typeof gap?.feedback === "string" ? { feedback: gap.feedback } : {}
|
|
300
|
-
};
|
|
301
|
-
})
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
case "dictation": {
|
|
305
|
-
const item = data;
|
|
306
|
-
const typed = response?.type === "dictation" ? response.text : "";
|
|
307
|
-
const hasKey = full && typeof item.transcript === "string";
|
|
308
|
-
let words = null;
|
|
309
|
-
if (hasKey) {
|
|
310
|
-
words = alignDictation(item, typed).words.map((word) => ({
|
|
311
|
-
expected: word.reference,
|
|
312
|
-
typed: word.attempt,
|
|
313
|
-
status: word.status
|
|
314
|
-
}));
|
|
315
|
-
} else if (details !== null && details.length > 0) {
|
|
316
|
-
words = details.map((detail) => {
|
|
317
|
-
const expected = firstString(detail.correctResponse) ?? "";
|
|
318
|
-
const attempt = firstString(detail.learnerResponse) ?? "";
|
|
319
|
-
let status = "incorrect";
|
|
320
|
-
if (detail.correct) {
|
|
321
|
-
status = "correct";
|
|
322
|
-
} else if (attempt === "") {
|
|
323
|
-
status = "missing";
|
|
324
|
-
} else if (expected === "") {
|
|
325
|
-
status = "extra";
|
|
326
|
-
}
|
|
327
|
-
return { expected, typed: attempt, status };
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
return {
|
|
331
|
-
...base(data),
|
|
332
|
-
activityType: "dictation",
|
|
333
|
-
transcript: hasKey ? item.transcript : null,
|
|
334
|
-
typed,
|
|
335
|
-
words
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
default:
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
function gradeLocally(data, response) {
|
|
343
|
-
if (data.redacted === true) {
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
try {
|
|
347
|
-
const result = score(data.type, data, response);
|
|
348
|
-
return { details: result.details, grade: aiGradeOf(result) };
|
|
349
|
-
} catch {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function aiExplanationRequest(input) {
|
|
354
|
-
const { data, response, outcome, learnerLocale } = input;
|
|
355
|
-
if (!aiSupports(data.type, "explanation") || !aiAllowedByContent(data, "explanation")) {
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
let details = null;
|
|
359
|
-
let grade = null;
|
|
360
|
-
if (outcome?.status === "scored") {
|
|
361
|
-
const { score: recorded, maxScore, passed } = outcome;
|
|
362
|
-
if (!isGradeInRange(recorded, maxScore)) {
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
details = outcome.details;
|
|
366
|
-
grade = aiGradeOf({ score: recorded, maxScore, passed });
|
|
367
|
-
} else if (response !== null) {
|
|
368
|
-
const local = gradeLocally(data, response);
|
|
369
|
-
if (local !== null) {
|
|
370
|
-
details = local.details;
|
|
371
|
-
grade = local.grade;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (grade === null) {
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
const facts = buildAiFacts(data, response, details);
|
|
378
|
-
if (facts === null) {
|
|
379
|
-
return null;
|
|
380
|
-
}
|
|
381
|
-
return {
|
|
382
|
-
feature: "explanation",
|
|
383
|
-
facts,
|
|
384
|
-
grade,
|
|
385
|
-
...learnerLocale !== void 0 ? { learnerLocale } : {}
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
function aiHintRequest(input) {
|
|
389
|
-
const { data, previousHints, learnerLocale } = input;
|
|
390
|
-
if (!aiSupports(data.type, "hint") || !aiAllowedByContent(data, "hint") || data.redacted === true) {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
const response = input.response ?? emptyResponse(data.type);
|
|
394
|
-
const local = response === null ? null : gradeLocally(data, response);
|
|
395
|
-
const facts = buildAiFacts(data, response, local?.details ?? null);
|
|
396
|
-
if (facts === null) {
|
|
397
|
-
return null;
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
feature: "hint",
|
|
401
|
-
facts,
|
|
402
|
-
hintNumber: previousHints.length + 1,
|
|
403
|
-
previousHints: [...previousHints],
|
|
404
|
-
...learnerLocale !== void 0 ? { learnerLocale } : {}
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
var VERDICTS = ["correct", "partly-correct", "incorrect"];
|
|
408
|
-
function provenanceOf(raw) {
|
|
409
|
-
if (typeof raw !== "object" || raw === null) {
|
|
410
|
-
return void 0;
|
|
411
|
-
}
|
|
412
|
-
const kept = {};
|
|
413
|
-
for (const key of ["model", "promptHash", "generatedAt"]) {
|
|
414
|
-
const value = raw[key];
|
|
415
|
-
if (typeof value === "string" && value.length > 0 && value.length <= 200) {
|
|
416
|
-
kept[key] = value;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return Object.keys(kept).length > 0 ? kept : void 0;
|
|
420
|
-
}
|
|
421
|
-
function cleanText(text) {
|
|
422
|
-
return text.replace(/\r\n?/g, "\n").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u2028\u2029]/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
423
|
-
}
|
|
424
|
-
function readAiTextResult(raw) {
|
|
425
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
426
|
-
return { ok: false, refusal: "malformed" };
|
|
427
|
-
}
|
|
428
|
-
const record = raw;
|
|
429
|
-
if (typeof record.text !== "string") {
|
|
430
|
-
return { ok: false, refusal: "malformed" };
|
|
431
|
-
}
|
|
432
|
-
if (record.verdict !== void 0 && !VERDICTS.includes(record.verdict)) {
|
|
433
|
-
return { ok: false, refusal: "malformed" };
|
|
434
|
-
}
|
|
435
|
-
const text = cleanText(record.text);
|
|
436
|
-
if (text === "") {
|
|
437
|
-
return { ok: false, refusal: "empty" };
|
|
438
|
-
}
|
|
439
|
-
if ([...text].length > AI_TEXT_MAX_LENGTH) {
|
|
440
|
-
return { ok: false, refusal: "too-long" };
|
|
441
|
-
}
|
|
442
|
-
const provenance = provenanceOf(record.provenance);
|
|
443
|
-
return {
|
|
444
|
-
ok: true,
|
|
445
|
-
result: {
|
|
446
|
-
text,
|
|
447
|
-
...record.verdict !== void 0 ? { verdict: record.verdict } : {},
|
|
448
|
-
...provenance !== void 0 ? { provenance } : {}
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
function checkAiExplanation(raw, request) {
|
|
453
|
-
const read = readAiTextResult(raw);
|
|
454
|
-
if (!read.ok) {
|
|
455
|
-
return read;
|
|
456
|
-
}
|
|
457
|
-
if (read.result.verdict !== void 0 && read.result.verdict !== request.grade.category) {
|
|
458
|
-
return { ok: false, refusal: "contradicts-grade" };
|
|
459
|
-
}
|
|
460
|
-
return read;
|
|
461
|
-
}
|
|
462
|
-
function checkAiHint(raw, request) {
|
|
463
|
-
const read = readAiTextResult(raw);
|
|
464
|
-
if (!read.ok) {
|
|
465
|
-
return read;
|
|
466
|
-
}
|
|
467
|
-
if (hintRevealsAnswer(request.facts, read.result.text)) {
|
|
468
|
-
return { ok: false, refusal: "reveals-answer" };
|
|
469
|
-
}
|
|
470
|
-
return read;
|
|
471
|
-
}
|
|
472
|
-
function fold(text) {
|
|
473
|
-
const folded = text.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
474
|
-
return folded === "" ? [] : folded.split(" ");
|
|
475
|
-
}
|
|
476
|
-
function containsWords(haystack, needle) {
|
|
477
|
-
if (needle.length === 0 || needle.length > haystack.length) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
for (let start = 0; start + needle.length <= haystack.length; start += 1) {
|
|
481
|
-
let match = true;
|
|
482
|
-
for (let offset = 0; offset < needle.length; offset += 1) {
|
|
483
|
-
if (haystack[start + offset] !== needle[offset]) {
|
|
484
|
-
match = false;
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
if (match) {
|
|
489
|
-
return true;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
|
-
var isShort = (words) => words.length === 1 && [...words[0]].length < 4;
|
|
495
|
-
function neighbours(passage, position) {
|
|
496
|
-
const marker = `[${position}]`;
|
|
497
|
-
const at = passage.indexOf(marker);
|
|
498
|
-
if (at === -1) {
|
|
499
|
-
return {};
|
|
500
|
-
}
|
|
501
|
-
const strip = (text) => text.replace(/\[\d+\]/g, " ");
|
|
502
|
-
const left = fold(strip(passage.slice(0, at)));
|
|
503
|
-
const right = fold(strip(passage.slice(at + marker.length)));
|
|
504
|
-
const before = left[left.length - 1];
|
|
505
|
-
const after = right[0];
|
|
506
|
-
return {
|
|
507
|
-
...before !== void 0 ? { before } : {},
|
|
508
|
-
...after !== void 0 ? { after } : {}
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
function hintRevealsAnswer(facts, hint) {
|
|
512
|
-
const words = fold(hint);
|
|
513
|
-
const reveals = (answer, passage, position) => {
|
|
514
|
-
const needle = fold(answer);
|
|
515
|
-
if (needle.length === 0) {
|
|
516
|
-
return false;
|
|
517
|
-
}
|
|
518
|
-
if (!isShort(needle) || passage === void 0 || position === void 0) {
|
|
519
|
-
return containsWords(words, needle);
|
|
520
|
-
}
|
|
521
|
-
const { before, after } = neighbours(passage, position);
|
|
522
|
-
if (before === void 0 && after === void 0) {
|
|
523
|
-
return containsWords(words, needle);
|
|
524
|
-
}
|
|
525
|
-
return before !== void 0 && containsWords(words, [before, ...needle]) || after !== void 0 && containsWords(words, [...needle, after]);
|
|
526
|
-
};
|
|
527
|
-
switch (facts.activityType) {
|
|
528
|
-
case "multiple-choice":
|
|
529
|
-
return facts.options.some((option) => option.correct === true && reveals(option.text));
|
|
530
|
-
case "fill-in-the-blanks":
|
|
531
|
-
return facts.blanks.some(
|
|
532
|
-
(blank) => (blank.accepted ?? []).some((answer) => reveals(answer, facts.passage, blank.position))
|
|
533
|
-
);
|
|
534
|
-
case "gap-select":
|
|
535
|
-
return facts.gaps.some(
|
|
536
|
-
(gap) => gap.answer !== null && reveals(gap.answer, facts.passage, gap.position)
|
|
537
|
-
);
|
|
538
|
-
case "dictation":
|
|
539
|
-
return false;
|
|
540
|
-
default:
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
155
|
// src/content-hash.ts
|
|
546
156
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
547
157
|
if (value === null) {
|
|
@@ -1625,11 +1235,11 @@ function normalise(found) {
|
|
|
1625
1235
|
}
|
|
1626
1236
|
|
|
1627
1237
|
// src/redact.ts
|
|
1628
|
-
function mergePolicy(
|
|
1238
|
+
function mergePolicy(base, overrides) {
|
|
1629
1239
|
if (overrides === void 0) {
|
|
1630
|
-
return
|
|
1240
|
+
return base;
|
|
1631
1241
|
}
|
|
1632
|
-
const merged = { ...
|
|
1242
|
+
const merged = { ...base };
|
|
1633
1243
|
for (const [key, override] of Object.entries(overrides)) {
|
|
1634
1244
|
const current = merged[key];
|
|
1635
1245
|
merged[key] = typeof override === "object" && typeof current === "object" ? { ...current, ...override } : override;
|