@nakafa/aksara-contracts 0.42.0 → 0.44.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/README.md +20 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.js +1 -1
- package/dist/preview/artifact.d.ts +44 -0
- package/dist/preview/document.d.ts +36 -12
- package/dist/preview/spec.d.ts +196 -36
- package/dist/preview/target.d.ts +10 -3
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +1 -1
- package/dist/program/snapshot/hash.d.ts +153 -0
- package/dist/program/snapshot/hash.js +31 -0
- package/dist/projection/digest.d.ts +74 -22
- package/dist/projection/material.d.ts +10 -0
- package/dist/projection/material.js +15 -0
- package/dist/projection/question.d.ts +188 -0
- package/dist/projection/spec.d.ts +45 -0
- package/dist/projection/verify.d.ts +127 -75
- package/dist/question/answer.d.ts +141 -0
- package/dist/question/answer.js +238 -0
- package/dist/question/item.d.ts +276 -1
- package/dist/question/item.js +63 -38
- package/dist/question/label.d.ts +3 -0
- package/dist/question/label.js +3 -0
- package/dist/question/points.d.ts +18 -0
- package/dist/question/points.js +22 -0
- package/dist/question/response.d.ts +187 -5
- package/dist/question/response.js +41 -4
- package/dist/question/rubric.d.ts +234 -0
- package/dist/question/rubric.js +182 -0
- package/dist/release/rollback/spec.d.ts +264 -0
- package/dist/release/snapshot/data.d.ts +52 -3
- package/dist/release/snapshot/{program-evidence.d.ts → evidence/program.d.ts} +2 -2
- package/dist/release/snapshot/{program-evidence.js → evidence/program.js} +1 -1
- package/dist/release/snapshot/{quran-evidence.d.ts → evidence/quran.d.ts} +2 -2
- package/dist/release/snapshot/{quran-evidence.js → evidence/quran.js} +1 -1
- package/dist/release/snapshot/{tryout-evidence.d.ts → evidence/tryout.d.ts} +2 -2
- package/dist/release/snapshot/{tryout-evidence.js → evidence/tryout.js} +4 -4
- package/dist/release/snapshot/evidence.d.ts +2 -2
- package/dist/release/snapshot/evidence.js +3 -3
- package/dist/release/snapshot/verify.d.ts +88 -31
- package/dist/runtime/spec.d.ts +25 -22
- package/dist/runtime/verify.d.ts +46 -44
- package/dist/transport/batch.d.ts +88 -0
- package/dist/transport/group.d.ts +288 -9
- package/dist/transport/request.d.ts +1858 -1018
- package/dist/transport/response.d.ts +499 -131
- package/dist/transport/snapshot.d.ts +104 -6
- package/dist/tryout/catalog.d.ts +28 -10
- package/dist/tryout/catalog.js +6 -2
- package/dist/tryout/closure/accounting.d.ts +16 -0
- package/dist/tryout/closure/accounting.js +68 -0
- package/dist/tryout/closure/locale.d.ts +14 -0
- package/dist/tryout/{locale-closure.js → closure/locale.js} +13 -72
- package/dist/tryout/{placement-closure.js → closure/placement.js} +1 -0
- package/dist/tryout/{catalog-hash.d.ts → hash/catalog.d.ts} +25 -20
- package/dist/tryout/{catalog-hash.js → hash/catalog.js} +8 -1
- package/dist/tryout/{content-hash.d.ts → hash/content.d.ts} +43 -0
- package/dist/tryout/{placement-hash.d.ts → hash/placement.d.ts} +1 -1
- package/dist/tryout/{placement-hash.js → hash/placement.js} +2 -1
- package/dist/tryout/placement.d.ts +136 -1
- package/dist/tryout/placement.js +16 -2
- package/dist/tryout/scoring.d.ts +37 -0
- package/dist/tryout/scoring.js +89 -0
- package/dist/tryout/spec.d.ts +32 -4
- package/dist/tryout/spec.js +35 -4
- package/package.json +29 -21
- package/dist/program/snapshot/row-hash.d.ts +0 -155
- package/dist/program/snapshot/row-hash.js +0 -34
- package/dist/tryout/locale-closure.d.ts +0 -20
- /package/dist/math/{arc-precision.d.ts → arc.d.ts} +0 -0
- /package/dist/math/{arc-precision.js → arc.js} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.d.ts → evidence/requirement.d.ts} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.js → evidence/requirement.js} +0 -0
- /package/dist/tryout/{placement-closure.d.ts → closure/placement.d.ts} +0 -0
- /package/dist/tryout/{row-hash.d.ts → digest.d.ts} +0 -0
- /package/dist/tryout/{row-hash.js → digest.js} +0 -0
- /package/dist/tryout/{content-hash.js → hash/content.js} +0 -0
|
@@ -58,6 +58,49 @@ export declare const QuestionPromptProjectionSchema: Schema.Struct<{
|
|
|
58
58
|
readonly optionKey: Schema.String;
|
|
59
59
|
readonly order: Schema.Int;
|
|
60
60
|
}>>;
|
|
61
|
+
}>, Schema.Struct<{
|
|
62
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
63
|
+
readonly criterionKey: Schema.String;
|
|
64
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
65
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
66
|
+
readonly kind: Schema.Literal<"number">;
|
|
67
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
68
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
69
|
+
readonly value: Schema.String;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly value: Schema.String;
|
|
72
|
+
}>, Schema.Struct<{
|
|
73
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
74
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
75
|
+
readonly ignoreCase: Schema.Boolean;
|
|
76
|
+
readonly kind: Schema.Literal<"text">;
|
|
77
|
+
}>]>>;
|
|
78
|
+
readonly order: Schema.Int;
|
|
79
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
80
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
81
|
+
readonly levelKey: Schema.String;
|
|
82
|
+
readonly order: Schema.Int;
|
|
83
|
+
readonly points: Schema.Int;
|
|
84
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
85
|
+
}>>;
|
|
86
|
+
}>>;
|
|
87
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
88
|
+
}>, Schema.Struct<{
|
|
89
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
90
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
91
|
+
readonly kind: Schema.Literal<"number">;
|
|
92
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
93
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
94
|
+
readonly value: Schema.String;
|
|
95
|
+
}>>;
|
|
96
|
+
readonly value: Schema.String;
|
|
97
|
+
}>, Schema.Struct<{
|
|
98
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
99
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
100
|
+
readonly ignoreCase: Schema.Boolean;
|
|
101
|
+
readonly kind: Schema.Literal<"text">;
|
|
102
|
+
}>]>;
|
|
103
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
61
104
|
}>, Schema.Struct<{
|
|
62
105
|
readonly kind: Schema.Literal<"single-choice">;
|
|
63
106
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -140,6 +183,49 @@ export declare const QuestionBodyProjectionSchema: Schema.Union<readonly [Schema
|
|
|
140
183
|
readonly optionKey: Schema.String;
|
|
141
184
|
readonly order: Schema.Int;
|
|
142
185
|
}>>;
|
|
186
|
+
}>, Schema.Struct<{
|
|
187
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
188
|
+
readonly criterionKey: Schema.String;
|
|
189
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
190
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
191
|
+
readonly kind: Schema.Literal<"number">;
|
|
192
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
193
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
194
|
+
readonly value: Schema.String;
|
|
195
|
+
}>>;
|
|
196
|
+
readonly value: Schema.String;
|
|
197
|
+
}>, Schema.Struct<{
|
|
198
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
199
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
200
|
+
readonly ignoreCase: Schema.Boolean;
|
|
201
|
+
readonly kind: Schema.Literal<"text">;
|
|
202
|
+
}>]>>;
|
|
203
|
+
readonly order: Schema.Int;
|
|
204
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
205
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
206
|
+
readonly levelKey: Schema.String;
|
|
207
|
+
readonly order: Schema.Int;
|
|
208
|
+
readonly points: Schema.Int;
|
|
209
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
210
|
+
}>>;
|
|
211
|
+
}>>;
|
|
212
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
213
|
+
}>, Schema.Struct<{
|
|
214
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
215
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
216
|
+
readonly kind: Schema.Literal<"number">;
|
|
217
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
218
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
219
|
+
readonly value: Schema.String;
|
|
220
|
+
}>>;
|
|
221
|
+
readonly value: Schema.String;
|
|
222
|
+
}>, Schema.Struct<{
|
|
223
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
224
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
225
|
+
readonly ignoreCase: Schema.Boolean;
|
|
226
|
+
readonly kind: Schema.Literal<"text">;
|
|
227
|
+
}>]>;
|
|
228
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
143
229
|
}>, Schema.Struct<{
|
|
144
230
|
readonly kind: Schema.Literal<"single-choice">;
|
|
145
231
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -212,6 +298,41 @@ export declare const makeQuestionPromptProjection: (input: QuestionProjectionInp
|
|
|
212
298
|
bodyKind: "question";
|
|
213
299
|
kind: "question-body";
|
|
214
300
|
response: {
|
|
301
|
+
readonly criteria: readonly {
|
|
302
|
+
readonly criterionKey: string;
|
|
303
|
+
readonly finalAnswer?: {
|
|
304
|
+
readonly acceptsFractions: boolean;
|
|
305
|
+
readonly kind: "number";
|
|
306
|
+
readonly tolerance?: {
|
|
307
|
+
readonly kind: "absolute" | "relative";
|
|
308
|
+
readonly value: string;
|
|
309
|
+
};
|
|
310
|
+
readonly value: string;
|
|
311
|
+
} | {
|
|
312
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
313
|
+
readonly collapseWhitespace: boolean;
|
|
314
|
+
readonly ignoreCase: boolean;
|
|
315
|
+
readonly kind: "text";
|
|
316
|
+
};
|
|
317
|
+
readonly order: number;
|
|
318
|
+
readonly label: {
|
|
319
|
+
readonly de: string;
|
|
320
|
+
readonly en: string;
|
|
321
|
+
readonly id: string;
|
|
322
|
+
};
|
|
323
|
+
readonly levels: readonly {
|
|
324
|
+
readonly levelKey: string;
|
|
325
|
+
readonly order: number;
|
|
326
|
+
readonly points: number;
|
|
327
|
+
readonly label: {
|
|
328
|
+
readonly de: string;
|
|
329
|
+
readonly en: string;
|
|
330
|
+
readonly id: string;
|
|
331
|
+
};
|
|
332
|
+
}[];
|
|
333
|
+
}[];
|
|
334
|
+
readonly kind: "rubric";
|
|
335
|
+
} | {
|
|
215
336
|
readonly categories: readonly {
|
|
216
337
|
readonly categoryKey: string;
|
|
217
338
|
readonly label: string;
|
|
@@ -240,6 +361,22 @@ export declare const makeQuestionPromptProjection: (input: QuestionProjectionInp
|
|
|
240
361
|
readonly optionKey: string;
|
|
241
362
|
readonly order: number;
|
|
242
363
|
}[];
|
|
364
|
+
} | {
|
|
365
|
+
readonly key: {
|
|
366
|
+
readonly acceptsFractions: boolean;
|
|
367
|
+
readonly kind: "number";
|
|
368
|
+
readonly tolerance?: {
|
|
369
|
+
readonly kind: "absolute" | "relative";
|
|
370
|
+
readonly value: string;
|
|
371
|
+
};
|
|
372
|
+
readonly value: string;
|
|
373
|
+
} | {
|
|
374
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
375
|
+
readonly collapseWhitespace: boolean;
|
|
376
|
+
readonly ignoreCase: boolean;
|
|
377
|
+
readonly kind: "text";
|
|
378
|
+
};
|
|
379
|
+
readonly kind: "short-answer";
|
|
243
380
|
};
|
|
244
381
|
}, import("#contracts/question/item").QuestionResponseLocaleMissingError, never>;
|
|
245
382
|
/** Builds one answer projection without duplicating the prompt response. */
|
|
@@ -294,6 +431,41 @@ export declare const makeQuestionBodyProjection: (input: QuestionProjectionInput
|
|
|
294
431
|
bodyKind: "question";
|
|
295
432
|
kind: "question-body";
|
|
296
433
|
response: {
|
|
434
|
+
readonly criteria: readonly {
|
|
435
|
+
readonly criterionKey: string;
|
|
436
|
+
readonly finalAnswer?: {
|
|
437
|
+
readonly acceptsFractions: boolean;
|
|
438
|
+
readonly kind: "number";
|
|
439
|
+
readonly tolerance?: {
|
|
440
|
+
readonly kind: "absolute" | "relative";
|
|
441
|
+
readonly value: string;
|
|
442
|
+
};
|
|
443
|
+
readonly value: string;
|
|
444
|
+
} | {
|
|
445
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
446
|
+
readonly collapseWhitespace: boolean;
|
|
447
|
+
readonly ignoreCase: boolean;
|
|
448
|
+
readonly kind: "text";
|
|
449
|
+
};
|
|
450
|
+
readonly order: number;
|
|
451
|
+
readonly label: {
|
|
452
|
+
readonly de: string;
|
|
453
|
+
readonly en: string;
|
|
454
|
+
readonly id: string;
|
|
455
|
+
};
|
|
456
|
+
readonly levels: readonly {
|
|
457
|
+
readonly levelKey: string;
|
|
458
|
+
readonly order: number;
|
|
459
|
+
readonly points: number;
|
|
460
|
+
readonly label: {
|
|
461
|
+
readonly de: string;
|
|
462
|
+
readonly en: string;
|
|
463
|
+
readonly id: string;
|
|
464
|
+
};
|
|
465
|
+
}[];
|
|
466
|
+
}[];
|
|
467
|
+
readonly kind: "rubric";
|
|
468
|
+
} | {
|
|
297
469
|
readonly categories: readonly {
|
|
298
470
|
readonly categoryKey: string;
|
|
299
471
|
readonly label: string;
|
|
@@ -322,6 +494,22 @@ export declare const makeQuestionBodyProjection: (input: QuestionProjectionInput
|
|
|
322
494
|
readonly optionKey: string;
|
|
323
495
|
readonly order: number;
|
|
324
496
|
}[];
|
|
497
|
+
} | {
|
|
498
|
+
readonly key: {
|
|
499
|
+
readonly acceptsFractions: boolean;
|
|
500
|
+
readonly kind: "number";
|
|
501
|
+
readonly tolerance?: {
|
|
502
|
+
readonly kind: "absolute" | "relative";
|
|
503
|
+
readonly value: string;
|
|
504
|
+
};
|
|
505
|
+
readonly value: string;
|
|
506
|
+
} | {
|
|
507
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
508
|
+
readonly collapseWhitespace: boolean;
|
|
509
|
+
readonly ignoreCase: boolean;
|
|
510
|
+
readonly kind: "text";
|
|
511
|
+
};
|
|
512
|
+
readonly kind: "short-answer";
|
|
325
513
|
};
|
|
326
514
|
} | {
|
|
327
515
|
artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -62,6 +62,7 @@ export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Stru
|
|
|
62
62
|
readonly name: Schema.String;
|
|
63
63
|
}>>;
|
|
64
64
|
readonly description: Schema.optional<Schema.String>;
|
|
65
|
+
readonly searchTitle: Schema.optionalKey<Schema.Trimmed>;
|
|
65
66
|
readonly subject: Schema.optional<Schema.String>;
|
|
66
67
|
readonly title: Schema.String;
|
|
67
68
|
}>;
|
|
@@ -127,6 +128,49 @@ export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Stru
|
|
|
127
128
|
readonly optionKey: Schema.String;
|
|
128
129
|
readonly order: Schema.Int;
|
|
129
130
|
}>>;
|
|
131
|
+
}>, Schema.Struct<{
|
|
132
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
133
|
+
readonly criterionKey: Schema.String;
|
|
134
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
135
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
136
|
+
readonly kind: Schema.Literal<"number">;
|
|
137
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
138
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
139
|
+
readonly value: Schema.String;
|
|
140
|
+
}>>;
|
|
141
|
+
readonly value: Schema.String;
|
|
142
|
+
}>, Schema.Struct<{
|
|
143
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
144
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
145
|
+
readonly ignoreCase: Schema.Boolean;
|
|
146
|
+
readonly kind: Schema.Literal<"text">;
|
|
147
|
+
}>]>>;
|
|
148
|
+
readonly order: Schema.Int;
|
|
149
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
150
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
151
|
+
readonly levelKey: Schema.String;
|
|
152
|
+
readonly order: Schema.Int;
|
|
153
|
+
readonly points: Schema.Int;
|
|
154
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
155
|
+
}>>;
|
|
156
|
+
}>>;
|
|
157
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
158
|
+
}>, Schema.Struct<{
|
|
159
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
160
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
161
|
+
readonly kind: Schema.Literal<"number">;
|
|
162
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
163
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
164
|
+
readonly value: Schema.String;
|
|
165
|
+
}>>;
|
|
166
|
+
readonly value: Schema.String;
|
|
167
|
+
}>, Schema.Struct<{
|
|
168
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
169
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
170
|
+
readonly ignoreCase: Schema.Boolean;
|
|
171
|
+
readonly kind: Schema.Literal<"text">;
|
|
172
|
+
}>]>;
|
|
173
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
130
174
|
}>, Schema.Struct<{
|
|
131
175
|
readonly kind: Schema.Literal<"single-choice">;
|
|
132
176
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -224,6 +268,7 @@ export declare const RoutedContentProjectionSchema: Schema.Union<readonly [Schem
|
|
|
224
268
|
readonly name: Schema.String;
|
|
225
269
|
}>>;
|
|
226
270
|
readonly description: Schema.optional<Schema.String>;
|
|
271
|
+
readonly searchTitle: Schema.optionalKey<Schema.Trimmed>;
|
|
227
272
|
readonly subject: Schema.optional<Schema.String>;
|
|
228
273
|
readonly title: Schema.String;
|
|
229
274
|
}>;
|
|
@@ -42,81 +42,20 @@ export interface VerifiedContentProjections {
|
|
|
42
42
|
}
|
|
43
43
|
/** Strictly decodes a replayable canonical content projection stream. */
|
|
44
44
|
export declare function decodeContentProjections<E, R>(projections: Stream.Stream<unknown, E, R>): Stream.Stream<{
|
|
45
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
45
46
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
46
47
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
51
|
-
readonly bodyKind: "question";
|
|
52
|
-
readonly blueprint?: {
|
|
53
|
-
readonly cognitiveLevel: string;
|
|
54
|
-
readonly contentDomain: string;
|
|
55
|
-
readonly topic: string;
|
|
56
|
-
};
|
|
57
|
-
readonly kind: "question-body";
|
|
58
|
-
readonly metadata: {
|
|
59
|
-
readonly dateModified?: string;
|
|
60
|
-
readonly datePublished: string;
|
|
61
|
-
readonly authors: readonly {
|
|
62
|
-
readonly name: string;
|
|
63
|
-
}[];
|
|
64
|
-
readonly title: string;
|
|
65
|
-
};
|
|
66
|
-
readonly stimulusKey?: string;
|
|
67
|
-
readonly response: {
|
|
68
|
-
readonly categories: readonly {
|
|
69
|
-
readonly categoryKey: string;
|
|
70
|
-
readonly label: string;
|
|
71
|
-
readonly order: number;
|
|
72
|
-
}[];
|
|
73
|
-
readonly kind: "category";
|
|
74
|
-
readonly statements: readonly {
|
|
75
|
-
readonly correctCategoryKey: string;
|
|
76
|
-
readonly label: string;
|
|
77
|
-
readonly order: number;
|
|
78
|
-
readonly statementKey: string;
|
|
79
|
-
}[];
|
|
80
|
-
} | {
|
|
81
|
-
readonly kind: "multiple-choice";
|
|
82
|
-
readonly options: readonly {
|
|
83
|
-
readonly isCorrect: boolean;
|
|
84
|
-
readonly label: string;
|
|
85
|
-
readonly optionKey: string;
|
|
86
|
-
readonly order: number;
|
|
87
|
-
}[];
|
|
88
|
-
} | {
|
|
89
|
-
readonly kind: "single-choice";
|
|
90
|
-
readonly options: readonly {
|
|
91
|
-
readonly isCorrect: boolean;
|
|
92
|
-
readonly label: string;
|
|
93
|
-
readonly optionKey: string;
|
|
94
|
-
readonly order: number;
|
|
95
|
-
}[];
|
|
96
|
-
};
|
|
97
|
-
} | {
|
|
98
|
-
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
99
|
-
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
100
|
-
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
101
|
-
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
102
|
-
readonly questionNumber: number;
|
|
103
|
-
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
104
|
-
readonly bodyKind: "answer";
|
|
105
|
-
readonly blueprint?: {
|
|
106
|
-
readonly cognitiveLevel: string;
|
|
107
|
-
readonly contentDomain: string;
|
|
108
|
-
readonly topic: string;
|
|
109
|
-
};
|
|
110
|
-
readonly kind: "question-body";
|
|
48
|
+
readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
|
|
49
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
50
|
+
readonly kind: "public-page";
|
|
111
51
|
readonly metadata: {
|
|
112
52
|
readonly dateModified?: string;
|
|
113
53
|
readonly datePublished: string;
|
|
114
|
-
readonly
|
|
115
|
-
readonly name: string;
|
|
116
|
-
}[];
|
|
54
|
+
readonly description: string;
|
|
117
55
|
readonly title: string;
|
|
118
56
|
};
|
|
119
|
-
readonly
|
|
57
|
+
readonly sitemap: true;
|
|
58
|
+
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
120
59
|
} | {
|
|
121
60
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
122
61
|
readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
@@ -179,6 +118,7 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
|
|
|
179
118
|
readonly name: string;
|
|
180
119
|
}[];
|
|
181
120
|
readonly description?: string | undefined;
|
|
121
|
+
readonly searchTitle?: string;
|
|
182
122
|
readonly subject?: string | undefined;
|
|
183
123
|
readonly title: string;
|
|
184
124
|
};
|
|
@@ -186,20 +126,132 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
|
|
|
186
126
|
readonly sitemap: true;
|
|
187
127
|
readonly topicTitle: string;
|
|
188
128
|
} | {
|
|
189
|
-
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
190
129
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
191
130
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
192
|
-
readonly
|
|
193
|
-
readonly
|
|
194
|
-
readonly
|
|
131
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
132
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
133
|
+
readonly questionNumber: number;
|
|
134
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
135
|
+
readonly bodyKind: "question";
|
|
136
|
+
readonly blueprint?: {
|
|
137
|
+
readonly cognitiveLevel: string;
|
|
138
|
+
readonly contentDomain: string;
|
|
139
|
+
readonly topic: string;
|
|
140
|
+
};
|
|
141
|
+
readonly kind: "question-body";
|
|
195
142
|
readonly metadata: {
|
|
196
143
|
readonly dateModified?: string;
|
|
197
144
|
readonly datePublished: string;
|
|
198
|
-
readonly
|
|
145
|
+
readonly authors: readonly {
|
|
146
|
+
readonly name: string;
|
|
147
|
+
}[];
|
|
199
148
|
readonly title: string;
|
|
200
149
|
};
|
|
201
|
-
readonly
|
|
202
|
-
readonly
|
|
150
|
+
readonly stimulusKey?: string;
|
|
151
|
+
readonly response: {
|
|
152
|
+
readonly categories: readonly {
|
|
153
|
+
readonly categoryKey: string;
|
|
154
|
+
readonly label: string;
|
|
155
|
+
readonly order: number;
|
|
156
|
+
}[];
|
|
157
|
+
readonly kind: "category";
|
|
158
|
+
readonly statements: readonly {
|
|
159
|
+
readonly correctCategoryKey: string;
|
|
160
|
+
readonly label: string;
|
|
161
|
+
readonly order: number;
|
|
162
|
+
readonly statementKey: string;
|
|
163
|
+
}[];
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "multiple-choice";
|
|
166
|
+
readonly options: readonly {
|
|
167
|
+
readonly isCorrect: boolean;
|
|
168
|
+
readonly label: string;
|
|
169
|
+
readonly optionKey: string;
|
|
170
|
+
readonly order: number;
|
|
171
|
+
}[];
|
|
172
|
+
} | {
|
|
173
|
+
readonly kind: "single-choice";
|
|
174
|
+
readonly options: readonly {
|
|
175
|
+
readonly isCorrect: boolean;
|
|
176
|
+
readonly label: string;
|
|
177
|
+
readonly optionKey: string;
|
|
178
|
+
readonly order: number;
|
|
179
|
+
}[];
|
|
180
|
+
} | {
|
|
181
|
+
readonly criteria: readonly {
|
|
182
|
+
readonly criterionKey: string;
|
|
183
|
+
readonly finalAnswer?: {
|
|
184
|
+
readonly acceptsFractions: boolean;
|
|
185
|
+
readonly kind: "number";
|
|
186
|
+
readonly tolerance?: {
|
|
187
|
+
readonly kind: "absolute" | "relative";
|
|
188
|
+
readonly value: string;
|
|
189
|
+
};
|
|
190
|
+
readonly value: string;
|
|
191
|
+
} | {
|
|
192
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
193
|
+
readonly collapseWhitespace: boolean;
|
|
194
|
+
readonly ignoreCase: boolean;
|
|
195
|
+
readonly kind: "text";
|
|
196
|
+
};
|
|
197
|
+
readonly order: number;
|
|
198
|
+
readonly label: {
|
|
199
|
+
readonly de: string;
|
|
200
|
+
readonly en: string;
|
|
201
|
+
readonly id: string;
|
|
202
|
+
};
|
|
203
|
+
readonly levels: readonly {
|
|
204
|
+
readonly levelKey: string;
|
|
205
|
+
readonly order: number;
|
|
206
|
+
readonly points: number;
|
|
207
|
+
readonly label: {
|
|
208
|
+
readonly de: string;
|
|
209
|
+
readonly en: string;
|
|
210
|
+
readonly id: string;
|
|
211
|
+
};
|
|
212
|
+
}[];
|
|
213
|
+
}[];
|
|
214
|
+
readonly kind: "rubric";
|
|
215
|
+
} | {
|
|
216
|
+
readonly key: {
|
|
217
|
+
readonly acceptsFractions: boolean;
|
|
218
|
+
readonly kind: "number";
|
|
219
|
+
readonly tolerance?: {
|
|
220
|
+
readonly kind: "absolute" | "relative";
|
|
221
|
+
readonly value: string;
|
|
222
|
+
};
|
|
223
|
+
readonly value: string;
|
|
224
|
+
} | {
|
|
225
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
226
|
+
readonly collapseWhitespace: boolean;
|
|
227
|
+
readonly ignoreCase: boolean;
|
|
228
|
+
readonly kind: "text";
|
|
229
|
+
};
|
|
230
|
+
readonly kind: "short-answer";
|
|
231
|
+
};
|
|
232
|
+
} | {
|
|
233
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
234
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
235
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
236
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
237
|
+
readonly questionNumber: number;
|
|
238
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
239
|
+
readonly bodyKind: "answer";
|
|
240
|
+
readonly blueprint?: {
|
|
241
|
+
readonly cognitiveLevel: string;
|
|
242
|
+
readonly contentDomain: string;
|
|
243
|
+
readonly topic: string;
|
|
244
|
+
};
|
|
245
|
+
readonly kind: "question-body";
|
|
246
|
+
readonly metadata: {
|
|
247
|
+
readonly dateModified?: string;
|
|
248
|
+
readonly datePublished: string;
|
|
249
|
+
readonly authors: readonly {
|
|
250
|
+
readonly name: string;
|
|
251
|
+
}[];
|
|
252
|
+
readonly title: string;
|
|
253
|
+
};
|
|
254
|
+
readonly stimulusKey?: string;
|
|
203
255
|
}, E | ProjectionDecodeError | ProjectionOrderError | ProjectionRouteError, R>;
|
|
204
256
|
/** Authenticates a replayable projection stream against its signed manifest. */
|
|
205
257
|
export declare const verifyContentProjections: <E, R>(input: {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { BigDecimal, Option, Schema } from "effect";
|
|
2
|
+
import type { AppLocaleCode } from "#contracts/locale";
|
|
3
|
+
/**
|
|
4
|
+
* One exact decimal in its only canonical spelling: an optional minus sign, an
|
|
5
|
+
* integer part without leading zeros, and a dot-separated fraction without
|
|
6
|
+
* trailing zeros. Zero is always `0`, so equal values share one encoding.
|
|
7
|
+
* Graders compare it exactly through `matchesAnswerKey`, never through binary
|
|
8
|
+
* floating point.
|
|
9
|
+
*/
|
|
10
|
+
export declare const QuestionDecimalSchema: Schema.String;
|
|
11
|
+
export type QuestionDecimal = typeof QuestionDecimalSchema.Type;
|
|
12
|
+
/**
|
|
13
|
+
* Largest accepted distance from the exact value, inclusive. An absolute
|
|
14
|
+
* tolerance `t` accepts `|answer - value| <= t`. A relative tolerance `r`
|
|
15
|
+
* accepts `|answer - value| <= r * |value|`, is below one, and needs a nonzero
|
|
16
|
+
* value.
|
|
17
|
+
*/
|
|
18
|
+
export declare const QuestionToleranceSchema: Schema.Struct<{
|
|
19
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
20
|
+
readonly value: Schema.String;
|
|
21
|
+
}>;
|
|
22
|
+
export type QuestionTolerance = typeof QuestionToleranceSchema.Type;
|
|
23
|
+
/**
|
|
24
|
+
* Deterministic numeric answer key. A learner number, read by
|
|
25
|
+
* `readNumberAnswer` in the delivery language, matches when its exact value
|
|
26
|
+
* equals `value`, or lies within `tolerance` when present. A fraction such as
|
|
27
|
+
* `6/8` matches only when `acceptsFractions` is true.
|
|
28
|
+
*/
|
|
29
|
+
export declare const QuestionNumberKeySchema: Schema.Struct<{
|
|
30
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
31
|
+
readonly kind: Schema.Literal<"number">;
|
|
32
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
33
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
34
|
+
readonly value: Schema.String;
|
|
35
|
+
}>>;
|
|
36
|
+
readonly value: Schema.String;
|
|
37
|
+
}>;
|
|
38
|
+
export type QuestionNumberKey = typeof QuestionNumberKeySchema.Type;
|
|
39
|
+
/**
|
|
40
|
+
* Deterministic text answer key written in the delivery language. A learner
|
|
41
|
+
* answer matches when it normalizes, under `ignoreCase` and
|
|
42
|
+
* `collapseWhitespace`, to the same text as one accepted answer. Accepted
|
|
43
|
+
* answers are plain text, never Markdown, so show them without rich rendering.
|
|
44
|
+
*/
|
|
45
|
+
export declare const QuestionTextKeySchema: Schema.Struct<{
|
|
46
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
47
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
48
|
+
readonly ignoreCase: Schema.Boolean;
|
|
49
|
+
readonly kind: Schema.Literal<"text">;
|
|
50
|
+
}>;
|
|
51
|
+
export type QuestionTextKey = typeof QuestionTextKeySchema.Type;
|
|
52
|
+
/** Deterministic key shared by short answers and rubric final results. */
|
|
53
|
+
export declare const QuestionAnswerKeySchema: Schema.Union<readonly [Schema.Struct<{
|
|
54
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
55
|
+
readonly kind: Schema.Literal<"number">;
|
|
56
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
57
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
58
|
+
readonly value: Schema.String;
|
|
59
|
+
}>>;
|
|
60
|
+
readonly value: Schema.String;
|
|
61
|
+
}>, Schema.Struct<{
|
|
62
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
63
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
64
|
+
readonly ignoreCase: Schema.Boolean;
|
|
65
|
+
readonly kind: Schema.Literal<"text">;
|
|
66
|
+
}>]>;
|
|
67
|
+
export type QuestionAnswerKey = typeof QuestionAnswerKeySchema.Type;
|
|
68
|
+
/**
|
|
69
|
+
* One learner number read exactly as `numerator / denominator`, with a
|
|
70
|
+
* positive integer denominator that is one for a typed decimal. `fraction`
|
|
71
|
+
* records that the learner wrote `p/q`.
|
|
72
|
+
*/
|
|
73
|
+
export interface QuestionNumberAnswer {
|
|
74
|
+
readonly denominator: BigDecimal.BigDecimal;
|
|
75
|
+
readonly fraction: boolean;
|
|
76
|
+
readonly numerator: BigDecimal.BigDecimal;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reads one typed learner number exactly, under the single grammar every
|
|
80
|
+
* runtime grades with. The input is first read as visible text, as for text
|
|
81
|
+
* answers. A decimal is an optional sign (`+`, `-`, or the minus sign U+2212)
|
|
82
|
+
* and ASCII digits with at most one decimal separator, a comma for `id` and
|
|
83
|
+
* `de` and a dot for `en`, and at least one digit, so `.5` and `5.` read in
|
|
84
|
+
* English. A fraction is an optionally signed integer numerator, a slash with
|
|
85
|
+
* optional spaces on each side, and a nonzero integer denominator. Grouping
|
|
86
|
+
* separators, exponents, mixed numbers such as `1 1/2`, and empty input are
|
|
87
|
+
* not numbers.
|
|
88
|
+
*/
|
|
89
|
+
export declare function readNumberAnswer(input: string, language: AppLocaleCode): Option.Option<QuestionNumberAnswer>;
|
|
90
|
+
/**
|
|
91
|
+
* Grades one typed learner answer against its key, as every runtime must. A
|
|
92
|
+
* text key matches when the answer normalizes to one accepted answer. A
|
|
93
|
+
* numeric key reads the answer with `readNumberAnswer` in the delivery
|
|
94
|
+
* language and compares its exact value, so an unreadable or empty answer
|
|
95
|
+
* never matches.
|
|
96
|
+
*/
|
|
97
|
+
export declare function matchesAnswerKey(key: QuestionAnswerKey, answer: string, language: AppLocaleCode): boolean;
|
|
98
|
+
/** Returns one answer key in stable field order for signed canonicalizers. */
|
|
99
|
+
export declare function canonicalQuestionAnswerKey(key: QuestionAnswerKey): {
|
|
100
|
+
acceptedAnswers: [string, ...string[]];
|
|
101
|
+
collapseWhitespace: boolean;
|
|
102
|
+
ignoreCase: boolean;
|
|
103
|
+
kind: "text";
|
|
104
|
+
} | {
|
|
105
|
+
acceptedAnswers?: never;
|
|
106
|
+
collapseWhitespace?: never;
|
|
107
|
+
ignoreCase?: never;
|
|
108
|
+
acceptsFractions: boolean;
|
|
109
|
+
kind: "number";
|
|
110
|
+
tolerance?: {
|
|
111
|
+
kind: "absolute" | "relative";
|
|
112
|
+
value: string;
|
|
113
|
+
};
|
|
114
|
+
value: string;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Returns the grading rules shared by every delivery language. A numeric key is
|
|
118
|
+
* language-neutral and stays whole; text keeps its rules but drops accepted
|
|
119
|
+
* answers, which each delivery language writes in its own words.
|
|
120
|
+
*/
|
|
121
|
+
export declare function canonicalQuestionAnswerKeyStructure(key: QuestionAnswerKey): {
|
|
122
|
+
acceptedAnswers: [string, ...string[]];
|
|
123
|
+
collapseWhitespace: boolean;
|
|
124
|
+
ignoreCase: boolean;
|
|
125
|
+
kind: "text";
|
|
126
|
+
} | {
|
|
127
|
+
acceptedAnswers?: never;
|
|
128
|
+
collapseWhitespace?: never;
|
|
129
|
+
ignoreCase?: never;
|
|
130
|
+
acceptsFractions: boolean;
|
|
131
|
+
kind: "number";
|
|
132
|
+
tolerance?: {
|
|
133
|
+
kind: "absolute" | "relative";
|
|
134
|
+
value: string;
|
|
135
|
+
};
|
|
136
|
+
value: string;
|
|
137
|
+
} | {
|
|
138
|
+
collapseWhitespace: boolean;
|
|
139
|
+
ignoreCase: boolean;
|
|
140
|
+
kind: "text";
|
|
141
|
+
};
|