@altnovatrail/spec 0.18.43 → 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/README.md CHANGED
@@ -30,6 +30,8 @@ From 0.17.0 on, `@altnovatrail/spec/exportv2` takes the place of `@altnovatrail/
30
30
 
31
31
  From 0.18.0 on, `@altnovatrail/spec/exportv3` takes the place of `@altnovatrail/spec/exportv2`: the types of the part's version 3, whose profile names its stored works without their bytes, `WorkInfo`, and each stored work is a file of its own beside the part of `api`, `Work`. A consumer of 0.17 that imports `exportv2` imports `exportv3` from 0.18 on.
32
32
 
33
+ From 0.19.0 on, `@altnovatrail/spec/exportv4` takes the place of `@altnovatrail/spec/exportv3`: the types of the part's version 4, which adds the pages from the learner's paper, each a file of its own, `Paper`, and to a profile its hint mode and its open attempts of tasks from paper, `PaperAttempt`, and to a record of the evidence log the ID of an adult's correction, `correction_id`. A consumer of 0.18 that imports `exportv3` imports `exportv4` from 0.19 on.
34
+
33
35
  The types are declarations alone, with no code to run, so import them with `import type`; the page's JSON is data, which a module imports with `with { type: "json" }` or reads as a file:
34
36
 
35
37
  ```ts
@@ -52,17 +54,18 @@ function show(task: open.Task, manifest: open.Manifest) {
52
54
  - **`@altnovatrail/spec/deploymentv1`** holds the types of the deployment configuration's version 1: the file, `Deployment`, and the test vectors of reading it, `ReadingVector`, whose file is any JSON value, `unknown`. A type gives the shape alone: a reader checks the file against its schema and then against the rules of reading, section 5 of the format's text.
53
55
  - **`@altnovatrail/spec/legalv3`** holds the types of version 3 of the legal texts: the passport, `Legal`, with each `Text` and its `TextVersion` with its `translations`, each `Set` and its `SetVersion`, and the test vectors of reading the part, `ReadingVector`, whose passport is any JSON value, `unknown`. A type gives the shape alone: a reader checks the passport against its schema and then the part against the rules of reading, section 5 of the part's text.
54
56
  - **`@altnovatrail/spec/consentagev1`** holds the types of version 1 of the table of the age of digital consent: the table, `ConsentAge`, with each country's `Entry`, the `Country` codes, and the test vectors of reading the table, `ReadingVector`, whose table is any JSON value, `unknown`, and of the category, `CategoryVector`. A type gives the shape alone: a reader checks the table against its schema and then against the rules of reading, section 5 of the part's text, and computes a learner's category as the part's text says.
55
- - **`@altnovatrail/spec/exportv3`** holds the types of version 3 of the format of the export: `Manifest`, `Account`, `Profile` with its `Attempt`, `Submission`, `Choice`, `EvidenceEntry`, `StateEntry` and `WorkInfo`, `Device`, `Work`, and the test vectors of reading an export, `ReadingVector`. A type gives the shape alone: a reader checks each file against its schema and then the export against the rules of reading, section 5 of the part's text.
57
+ - **`@altnovatrail/spec/exportv4`** holds the types of version 4 of the format of the export: `Manifest`, `Account`, `Profile` with its `Attempt`, `PaperAttempt`, `Submission`, `Choice`, `EvidenceEntry`, `StateEntry` and `WorkInfo`, `Device`, `Work`, `Paper` with its `TaskFrame` and `Task`, `Image`, and the test vectors of reading an export, `ReadingVector`. A type gives the shape alone: a reader checks each file against its schema and then the export against the rules of reading, section 5 of the part's text.
56
58
  - **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
57
- - `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history`, `marks` and `filled` and its methods `exportWork()` and `exportPicture()`, the PNG of the work that the app stores;
59
+ - `CanvasElement`, which describes the element's properties `tool`, `task`, `paper`, `tracing`, `workedExample`, `demoState`, `manifest`, `media`, `history`, `marks` and `filled` and its methods `exportWork()` and `exportPicture()`, the PNG of the work that the app stores;
58
60
  - `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
59
- - the events `toolchange`, `historychange` and `demochange`, with `CanvasEventMap` naming them;
61
+ - the events `toolchange`, `historychange`, `demochange` and `tracingchange`, with `CanvasEventMap` naming them;
60
62
  - the state of a worked example's demo, `DemoState`;
63
+ - a task from the learner's paper, `PaperTask`, and where its tracing paper lies, `TracingState`;
61
64
  - the history of writing;
62
65
  - the work for checking, with the context of its submission;
63
- - the tutor's marks of a submission, `Marks`, `Mark` and `Anchor`: their kind and place come from the contract between the app and the platform's API, the message `Mark` of `novatrail.api.v1` in the npm package `@altnovatrail/contracts`, and their name from the app.
66
+ - the tutor's marks of a submission, `Marks`, `Mark` — a frame, `FrameMark`, or a wavy line, `WavyLineMark` — and `Anchor`: their kind and place come from the contract between the app and the platform's API, the message `Mark` of `novatrail.api.v1` in the npm package `@altnovatrail/contracts`, and their name from the app.
64
67
 
65
- Its unions are exact: an event of the history is told by its `kind`, and the work of a sheet or of a workbook by its key, `png` or `cells`. The declarations need the DOM's types, so the consumer's `lib` must include `dom`. The package registers nothing. The canvas's own package puts the element in `HTMLElementTagNameMap` and its events in `GlobalEventHandlersEventMap`.
68
+ Its unions are exact: an event of the history is told by its `kind`, and the work of a sheet, of a workbook or of a task from paper by its keys: `cells` a workbook, `statement` a task from paper, `png` without it a sheet. The declarations need the DOM's types, so the consumer's `lib` must include `dom`. The package registers nothing. The canvas's own package puts the element in `HTMLElementTagNameMap` and its events in `GlobalEventHandlersEventMap`.
66
69
 
67
70
  A type gives the shape of a value and nothing more: the schemas decide what is valid. Code that reads a value from elsewhere checks it against its schema first.
68
71
 
@@ -1,7 +1,7 @@
1
1
  // Code generated by tools/types from admission/schemas; DO NOT EDIT.
2
2
 
3
3
  /**
4
- * The types of the admission table, major version 0, generated from the schemas of version 0.4 in
4
+ * The types of the admission table, major version 0, generated from the schemas of version 0.5 in
5
5
  * admission/schemas by tools/types (R72, R73 and R96 in spec's docs/decisions.md): the same types
6
6
  * as the Go package admissionv0, by the same names — the table, and the vectors of answers of the
7
7
  * admission function. The schemas decide what is valid: a type gives the shape of a value alone,
@@ -110,10 +110,12 @@ export interface CapabilityRule {
110
110
  *
111
111
  * A capability of AI (concepts 10): reading handwriting, reading text, the analysis of a solution's
112
112
  * steps, the assessment by a rubric, the hint, the words after a correct answer — the praise of a
113
- * step and the question of which technique helped —, and voice — the voicing of the tutor by a
114
- * provider and the learner's voice input, which are one capability for now.
113
+ * step and the question of which technique helped —, voice — the voicing of the tutor by a provider
114
+ * and the learner's voice input, which are one capability for now —, and for a task from paper the
115
+ * finding of the tasks on the photo of a page, the reading of a task's statement into a formula for
116
+ * the solver, and the solving of a task for its key.
115
117
  */
116
- export type Capability = "handwriting_reading" | "text_reading" | "solution_analysis" | "rubric_assessment" | "hint" | "correct_answer_words" | "voice";
118
+ export type Capability = "handwriting_reading" | "text_reading" | "solution_analysis" | "rubric_assessment" | "hint" | "correct_answer_words" | "voice" | "task_finding" | "statement_reading" | "task_solving";
117
119
 
118
120
  /**
119
121
  * AgeCategory is the type of admission-table.schema.json#/$defs/age_category.
package/canvas/index.d.ts CHANGED
@@ -7,8 +7,11 @@
7
7
  * writing, by properties; it gives the work for checking and the work's picture by its methods, and
8
8
  * tells what the learner did by events. In place of a task it may show a lesson's worked example,
9
9
  * whose demo the learner opens part by part with its buttons, and how far they have gone is a
10
- * property and an event too. The types of the task, of the worked example and of the manifest are
11
- * the module format's open views, formatv0/open.
10
+ * property and an event too. In place of either it may show a task from the learner's paper: the
11
+ * task's crop over a dotted sheet as tracing paper, which the learner moves, hides and writes on,
12
+ * and where the tracing paper lies is a property and an event as well (R162). The types of the
13
+ * task, of the worked example and of the manifest are the module format's open views,
14
+ * formatv0/open.
12
15
  *
13
16
  * It takes the tutor's marks of a submission too, by a property, with the submission's context:
14
17
  * their kind and their place come from the contract between app and api, novatrail.api.v1, whose
@@ -61,6 +64,39 @@ export interface DemoState {
61
64
  */
62
65
  export type DemoChangeEvent = CustomEvent<DemoState>;
63
66
 
67
+ /**
68
+ * A task from the learner's paper (concepts 8; R162): the task's crop, which app cut on the device
69
+ * from the photo of the page by its task frame. The element lays it over a sheet in dots — the
70
+ * sheet of a task from paper has no other grid and no choice of one — as tracing paper, in place of
71
+ * a task's statement and template. It has no answer slot of the format: its one slot is the whole
72
+ * work, at the place 1, 1. The tools are the pen and the eraser.
73
+ */
74
+ export interface PaperTask {
75
+ /** The task's crop, a JPEG or a PNG, as app cut it, without the learner's strokes. */
76
+ readonly statement: Blob;
77
+ }
78
+
79
+ /**
80
+ * Where the tracing paper of a task from paper lies on the sheet, and whether it is hidden. A new
81
+ * task from paper starts at the element's own place for it, shown.
82
+ */
83
+ export interface TracingState {
84
+ /** Its top left corner on the sheet, in the sheet's units: [x, y]. */
85
+ readonly at: readonly [x: number, y: number];
86
+ /**
87
+ * Whether the tracing paper is hidden, with the strokes on it: they stay in the history and in
88
+ * the work for checking, out of sight.
89
+ */
90
+ readonly hidden: boolean;
91
+ }
92
+
93
+ /**
94
+ * The event the element sends from its host, bubbling and composed, when the learner moves the
95
+ * tracing paper by its grip "Move the task", or hides or shows it by its button atop the tools —
96
+ * not when the consumer sets `tracing`. Its detail is the new state, frozen.
97
+ */
98
+ export type TracingChangeEvent = CustomEvent<TracingState>;
99
+
64
100
  /**
65
101
  * A point of a stroke: where it lies on the sheet, in its logical units, when it was written and
66
102
  * how hard the pointer pressed.
@@ -104,9 +140,12 @@ export interface Stroke {
104
140
  export type HistoryEvent =
105
141
  /**
106
142
  * A stroke written, and when it landed: its last point's time, or later, if it ended without its
107
- * pointerup after an action that landed while it was under way.
143
+ * pointerup after an action that landed while it was under way. On a task from paper, `on` is
144
+ * `"tracing"` for a stroke written on the tracing paper, whose points are in the sheet's units
145
+ * from the tracing paper's top left corner, so that it moves with it; a stroke of the sheet has
146
+ * no `on`.
108
147
  */
109
- | { readonly kind: "write"; readonly t: number; readonly stroke: Stroke }
148
+ | { readonly kind: "write"; readonly t: number; readonly stroke: Stroke; readonly on?: "tracing" }
110
149
  /** One press of the eraser: the strokes it took off, in the sheet's order, when it lifted. */
111
150
  | { readonly kind: "erase"; readonly t: number; readonly ids: readonly number[] }
112
151
  /** The sheet cleared: every stroke that was on it, in the sheet's order. */
@@ -228,6 +267,8 @@ export interface SheetSubmission {
228
267
  * forged.
229
268
  */
230
269
  readonly digest: string;
270
+ /** Never on a sheet's context, so that a task from paper's is never taken for one. */
271
+ readonly tracing?: never;
231
272
  }
232
273
 
233
274
  /**
@@ -243,13 +284,33 @@ export interface WorkbookSubmission {
243
284
  readonly digest: string;
244
285
  }
245
286
 
246
- /** The context of one submission, of a sheet or of a workbook: its keys tell which. */
247
- export type Submission = SheetSubmission | WorkbookSubmission;
287
+ /**
288
+ * The context of one submission of a task from paper: the numbers of the crop of the work — the
289
+ * tracing paper at its place with the strokes on it, and the sheet's strokes —, the groups of the
290
+ * strokes of both, where the tracing paper lay, and the digest of it all. A context of the tracing
291
+ * paper at another place the element does not take back. app keeps it on the device, in the
292
+ * profile's history of tasks from paper, and never sends it (R162).
293
+ */
294
+ export interface PaperSubmission {
295
+ readonly crop: CropNumbers;
296
+ readonly groups: readonly Group[];
297
+ readonly tracing: TracingState;
298
+ /** What the submission was made of: 16 hex digits. */
299
+ readonly digest: string;
300
+ }
301
+
302
+ /**
303
+ * The context of one submission, of a sheet, of a workbook or of a task from paper: its keys tell
304
+ * which.
305
+ */
306
+ export type Submission = SheetSubmission | WorkbookSubmission | PaperSubmission;
248
307
 
249
308
  /** The work of a sheet for checking: the PNG of the crop, and the context of the submission. */
250
309
  export interface ExportedSheet {
251
310
  readonly png: Blob;
252
311
  readonly submission: SheetSubmission;
312
+ /** Never on a sheet's work, so that a task from paper's is never taken for one. */
313
+ readonly statement?: never;
253
314
  }
254
315
 
255
316
  /**
@@ -269,8 +330,23 @@ export interface ExportedWorkbook {
269
330
  readonly submission: WorkbookSubmission;
270
331
  }
271
332
 
272
- /** The work for checking, of a sheet or of a workbook: its key, `png` or `cells`, tells which. */
273
- export type ExportedWork = ExportedSheet | ExportedWorkbook;
333
+ /**
334
+ * The work of a task from paper for checking, the two images of `PaperWork` of the contract: the
335
+ * task's crop as it was given, and the PNG of the crop of the work — the tracing paper at its place
336
+ * with the strokes on it, and the sheet's visible strokes, whether the tracing paper is shown or
337
+ * hidden —, with the context of the submission (contracts/README.md, section 15).
338
+ */
339
+ export interface ExportedPaper {
340
+ readonly statement: Blob;
341
+ readonly png: Blob;
342
+ readonly submission: PaperSubmission;
343
+ }
344
+
345
+ /**
346
+ * The work for checking, of a sheet, of a workbook or of a task from paper: its keys tell which —
347
+ * `cells` a workbook, `statement` a task from paper, and `png` without it a sheet.
348
+ */
349
+ export type ExportedWork = ExportedSheet | ExportedWorkbook | ExportedPaper;
274
350
 
275
351
  /**
276
352
  * Where a tutor's mark is: a group of strokes by its label, an answer cell by its place, or a box on
@@ -284,8 +360,11 @@ export type Anchor =
284
360
  /** [ymin, xmin, ymax, xmax] in whole thousandths of the crop's height and width; min < max. */
285
361
  | { readonly box: readonly [number, number, number, number] };
286
362
 
287
- /** A mark of the tutor's layer: a frame, so far, with where it is and its name. */
288
- export interface Mark {
363
+ /** A mark of the tutor's layer: a frame, a wavy line or a verdict, with where it is and its name. */
364
+ export type Mark = FrameMark | WavyLineMark | VerdictMark;
365
+
366
+ /** A frame round the place: on a sheet, on a workbook and on a task from paper. */
367
+ export interface FrameMark {
289
368
  readonly kind: "frame";
290
369
  readonly at: Anchor;
291
370
  /**
@@ -295,10 +374,50 @@ export interface Mark {
295
374
  readonly name: string;
296
375
  }
297
376
 
377
+ /**
378
+ * A wavy line under the place of the first mistake, on a task from paper alone, at a box on the
379
+ * crop of its work, which the profile's hint mode "Show where" brings with the words of a rung
380
+ * (concepts 10; R162). The element draws it under the strokes the box takes, on the sheet or on the
381
+ * tracing paper, over a light halo, so that it holds the contrast of 3:1 over the sheet and over the
382
+ * photo of any page, and puts it in the accessibility tree as it puts a frame, by its name (R90).
383
+ */
384
+ export interface WavyLineMark {
385
+ readonly kind: "wavy_line";
386
+ /** [ymin, xmin, ymax, xmax] in whole thousandths of the crop's height and width; min < max. */
387
+ readonly at: { readonly box: readonly [number, number, number, number] };
388
+ /**
389
+ * What a screen reader names it, in app's words, in the language of its screen: "Tutor's mark:
390
+ * where the mistake is". A name empty or of white space alone is a TypeError.
391
+ */
392
+ readonly name: string;
393
+ }
394
+
395
+ /**
396
+ * The verdict of one answer of a task from paper, by the answer on the crop of its work: a tick
397
+ * when it is right, a cross when it is not, which app gives for each task of a frame of several
398
+ * by the box its reading gave (R162). It is app's, not a mark of api's: the verdict of the answer
399
+ * says it. The element draws it at the right of the group of the learner's strokes nearest the box,
400
+ * one group a verdict, or of the box when none is near, over a light halo, so that it holds the
401
+ * contrast of 3:1 over the sheet and over the photo of any page, and puts it in the accessibility
402
+ * tree as it puts a frame, by its name (R90).
403
+ */
404
+ export interface VerdictMark {
405
+ readonly kind: "verdict";
406
+ /** [ymin, xmin, ymax, xmax] in whole thousandths of the crop's height and width; min < max. */
407
+ readonly at: { readonly box: readonly [number, number, number, number] };
408
+ /** Whether the answer is right: a tick, or a cross. */
409
+ readonly correct: boolean;
410
+ /**
411
+ * What a screen reader names it, in app's words, in the language of its screen: "Task 2: not
412
+ * yet". A name empty or of white space alone is a TypeError.
413
+ */
414
+ readonly name: string;
415
+ }
416
+
298
417
  /**
299
418
  * The tutor's marks of one submission, with the context of the submission that the element gave
300
- * with its work and app kept: a sheet's or a workbook's. The marks are those of one answer of
301
- * api, in its order.
419
+ * with its work and app kept: a sheet's, a workbook's or a task from paper's. The marks are those of
420
+ * one answer of api, in its order.
302
421
  */
303
422
  export interface Marks {
304
423
  readonly submission: Submission;
@@ -310,6 +429,7 @@ export interface CanvasEventMap {
310
429
  historychange: HistoryChangeEvent;
311
430
  toolchange: ToolChangeEvent;
312
431
  demochange: DemoChangeEvent;
432
+ tracingchange: TracingChangeEvent;
313
433
  }
314
434
 
315
435
  /**
@@ -323,7 +443,9 @@ export type Media = (ref: string) => Promise<Blob>;
323
443
  * The element `<novatrail-canvas>` as its contract with app has it. The language of its buttons is
324
444
  * its own attribute `lang`. While it has the boolean attribute `tools-hidden`, its bar of tools — and
325
445
  * on a worked example its row, with the slot `actions` — is out of sight and out of the
326
- * accessibility tree: app sets it on a phone while its tutor's sheet is open. Among the style properties `--novatrail-canvas-*` that app sets, `--novatrail-canvas-accent`
446
+ * accessibility tree: app sets it on a phone while its tutor's sheet is open. While it has the boolean
447
+ * attribute `statement-hidden`, it draws no task statement, and app draws the statement as its card
448
+ * above the element (R161). Among the style properties `--novatrail-canvas-*` that app sets, `--novatrail-canvas-accent`
327
449
  * is the accent of the tool in use and of the focus ring, `--novatrail-canvas-glass` the fill of the
328
450
  * bar's glass, and `--novatrail-canvas-top` the offset of the band in whose middle the bar stands. On
329
451
  * a worked example, app puts its own "Continue" into the element's named slot `actions`, a child
@@ -341,6 +463,23 @@ export interface CanvasElement extends HTMLElement {
341
463
  * a task with an answer slot bound `zone`, which no module of the first slice takes.
342
464
  */
343
465
  task: open.Task | undefined;
466
+ /**
467
+ * A task from the learner's paper, in place of a task of a module and of a worked example: one
468
+ * given while the element shows either is a TypeError, and so are a task or an example given
469
+ * while it shows one. Its manifest is none: the height of a digit on the crop is the default of
470
+ * the module format, and the element's buttons speak its `lang`. Given before the history, the
471
+ * tracing paper's state and the marks.
472
+ */
473
+ paper: PaperTask | undefined;
474
+ /**
475
+ * Where the tracing paper lies and whether it is hidden, frozen: `undefined` without a task from
476
+ * paper. The learner changes it by the grip and the button, which a `tracingchange` tells; the
477
+ * consumer keeps it and gives it back to open the task as it was, which tells nothing. A state
478
+ * given before the task from paper is a TypeError, and so is one that puts the tracing paper
479
+ * wholly off the sheet; `undefined` changes nothing.
480
+ */
481
+ get tracing(): TracingState | undefined;
482
+ set tracing(state: TracingState | undefined);
344
483
  /**
345
484
  * The open view of a lesson's worked example, its segment `worked_example`, in place of a task;
346
485
  * its module's manifest is `manifest`, as a task's is. The element shows the example's statement
@@ -394,29 +533,33 @@ export interface CanvasElement extends HTMLElement {
394
533
  * sheet or the page it was made on, as its digest tells: one of other strokes or other boxes is a
395
534
  * TypeError, and so are marks given before the task and the history, a mark of another kind, a
396
535
  * name empty or of white space alone, a group's label the submission has not, a box that is not
397
- * whole thousandths with min < max, and on a workbook any place but a cell. A new history puts the
536
+ * whole thousandths with min < max, on a workbook any place but a cell, and a wavy line anywhere
537
+ * but on a task from paper. A new history puts the
398
538
  * marks back on their strokes, or takes them off. `undefined` takes the marks off. A worked
399
539
  * example's sheet has nothing to mark: marks are a TypeError there.
400
540
  */
401
541
  get marks(): Marks | undefined;
402
542
  set marks(marks: Marks | undefined);
403
543
  /**
404
- * Which answer slots are filled, frozen: a workbook's boxes, and on a sheet the task's one slot
405
- * bound `anywhere` or `sheet`. `null` on a sheet whose slots are bound `choice`, whose options app
544
+ * Which answer slots are filled, frozen: a workbook's boxes, on a sheet the task's one slot
545
+ * bound `anywhere` or `sheet`, and on a task from paper its one slot, the sheet and the tracing
546
+ * paper both. `null` on a sheet whose slots are bound `choice`, whose options app
406
547
  * marks, on a sheet with no task, and for a worked example. An action on the sheet changes it
407
548
  * before its `historychange`, and a task or a history given changes it with no event.
408
549
  */
409
550
  readonly filled: Filled | null;
410
551
  /**
411
- * The work for checking, as the sheet is when it is called: a sheet's crop or a workbook's boxes,
412
- * with the context of the submission. A sheet without strokes, a workbook with no box filled and a
413
- * worked example give `null`.
552
+ * The work for checking, as the sheet is when it is called: a sheet's crop, a workbook's boxes, or
553
+ * a task from paper's crop of its work with the task's crop, with the context of the submission. A
554
+ * sheet without strokes, a task from paper with no stroke on the sheet or on the tracing paper, a
555
+ * workbook with no box filled and a worked example give `null`.
414
556
  */
415
557
  exportWork(): Promise<ExportedWork | null>;
416
558
  /**
417
559
  * The picture of the work, which app puts as the stored work's `picture` (contracts/README.md,
418
560
  * section 15): always a Blob of a PNG, with no condition, of the strokes of the whole surface — the
419
- * sheet or the workbook's page — as it is when it is called, within the limit of a stored work
561
+ * sheet, with the tracing paper of a task from paper, or the workbook's page — as it is when it is
562
+ * called, within the limit of a stored work
420
563
  * there. Its size and its colours are canvas's (R83 canvas).
421
564
  */
422
565
  exportPicture(): Promise<Blob>;
@@ -1,9 +1,9 @@
1
1
  // Code generated by tools/types from export/schemas; DO NOT EDIT.
2
2
 
3
3
  /**
4
- * The types of the format of the export, version 3 of the part, generated from the schemas in
4
+ * The types of the format of the export, version 4 of the part, generated from the schemas in
5
5
  * export/schemas by tools/types (R72, R73 and R135 in spec's docs/decisions.md): the same types as
6
- * the Go package exportv3, by the same names — the files of an export, the manifest, the account, a
6
+ * the Go package exportv4, by the same names — the files of an export, the manifest, the account, a
7
7
  * profile with every record of it, what a device holds of it and a stored work, and the vectors of
8
8
  * reading. A field that holds the JSON of a message of protobuf, or a value as the element
9
9
  * <novatrail-canvas> gives it, is any JSON value, unknown, as a reader gets it. The schemas decide
@@ -95,9 +95,9 @@ export type Day = string;
95
95
  /**
96
96
  * FileID is the type of common.schema.json#/$defs/file_id.
97
97
  *
98
- * An ID that names a file of the export, a profile's or an attempt's, as api gives it: 1 to 200
99
- * letters, digits, -, _ and ., the first not a ., so that it is one part of a path, never . or ..
100
- * (section 3).
98
+ * An ID that names a file of the export — a profile's or an attempt's, as api gives it, or a page's
99
+ * from paper, as app gives it —: 1 to 200 letters, digits, -, _ and ., the first not a ., so that
100
+ * it is one part of a path, never . or .. (section 3).
101
101
  */
102
102
  export type FileID = string;
103
103
 
@@ -246,6 +246,36 @@ export interface WorkSubmission {
246
246
  */
247
247
  export type WorkKind = "handwriting" | "essay" | "drawing";
248
248
 
249
+ /**
250
+ * Image is the type of common.schema.json#/$defs/image.
251
+ *
252
+ * An image of a page from paper, as the device holds it: its type and its bytes in base64.
253
+ */
254
+ export interface Image {
255
+ /**
256
+ * What the image is: a JPEG or a PNG.
257
+ */
258
+ readonly media_type: ImageMediaType;
259
+ /**
260
+ * The image's bytes, at most 4 MiB, in base64 (RFC 4648, section 4).
261
+ */
262
+ readonly data: string;
263
+ }
264
+
265
+ /**
266
+ * ImageMediaType is the type of common.schema.json#/$defs/image/properties/media_type.
267
+ *
268
+ * What the image is: a JPEG or a PNG.
269
+ */
270
+ export type ImageMediaType = "image/jpeg" | "image/png";
271
+
272
+ /**
273
+ * ThousandthsBox is the type of common.schema.json#/$defs/thousandths_box.
274
+ *
275
+ * A box [ymin, xmin, ymax, xmax] in whole thousandths of the height and the width of an image.
276
+ */
277
+ export type ThousandthsBox = readonly number[];
278
+
249
279
  // The types of device.schema.json.
250
280
 
251
281
  /**
@@ -435,6 +465,106 @@ export interface Manifest {
435
465
  */
436
466
  export type ManifestScope = "profile" | "account";
437
467
 
468
+ // The types of paper.schema.json.
469
+
470
+ /**
471
+ * Paper is the type of paper.schema.json.
472
+ *
473
+ * A page from the learner's paper that the device holds, paper/<profile id>/<page id>.json, which
474
+ * app writes beside api.zip: the photo of the page, its task frames, and each picked task's crop
475
+ * and work (section 4 of the text of the part; R162). The server keeps none of it.
476
+ */
477
+ export interface Paper {
478
+ /**
479
+ * The version of the part, the integer in export/VERSION.
480
+ */
481
+ readonly format: number;
482
+ /**
483
+ * The ID of the profile whose page it is.
484
+ */
485
+ readonly profile_id: FileID;
486
+ /**
487
+ * The ID of the page, as app gave it.
488
+ */
489
+ readonly page_id: FileID;
490
+ /**
491
+ * When the learner took the photo, or picked it.
492
+ */
493
+ readonly taken_at: Time;
494
+ /**
495
+ * The photo of the page, without the metadata of its file, as it was sent to find its tasks.
496
+ */
497
+ readonly photo: Image;
498
+ /**
499
+ * The task frames of the page, those the AI found and those the learner drew, in the order app
500
+ * shows them; a frame the learner removed is not here.
501
+ */
502
+ readonly frames: readonly TaskFrame[];
503
+ /**
504
+ * The tasks picked on the page, in the order of their attempts.
505
+ */
506
+ readonly tasks: readonly Task[];
507
+ }
508
+
509
+ /**
510
+ * TaskFrame is the type of paper.schema.json#/$defs/task_frame.
511
+ *
512
+ * A rectangle round one task on the photo of the page.
513
+ */
514
+ export interface TaskFrame {
515
+ /**
516
+ * The frame on the photo.
517
+ */
518
+ readonly box: ThousandthsBox;
519
+ /**
520
+ * Who framed the task: the AI that found the tasks, or the learner by hand.
521
+ */
522
+ readonly by: TaskFrameBy;
523
+ }
524
+
525
+ /**
526
+ * TaskFrameBy is the type of paper.schema.json#/$defs/task_frame/properties/by.
527
+ *
528
+ * Who framed the task: the AI that found the tasks, or the learner by hand.
529
+ */
530
+ export type TaskFrameBy = "ai" | "learner";
531
+
532
+ /**
533
+ * Task is the type of paper.schema.json#/$defs/task.
534
+ *
535
+ * A picked task of the page: its crop and its work, as the device holds them.
536
+ */
537
+ export interface Task {
538
+ /**
539
+ * The attempt of the task, as api gave it.
540
+ */
541
+ readonly attempt_id: ID;
542
+ /**
543
+ * The task's frame, by its place in frames, from 1.
544
+ */
545
+ readonly frame: number;
546
+ /**
547
+ * The task's crop as app cut it by its frame, without the learner's strokes.
548
+ */
549
+ readonly statement: Image;
550
+ /**
551
+ * The history of writing as the canvas gave it, the strokes of the sheet and of the tracing
552
+ * paper: write/erase/clear/undo events with t; strokes with id, kind and points x, y, t, p; on a
553
+ * stroke of the tracing paper, on "tracing".
554
+ */
555
+ readonly history: unknown;
556
+ /**
557
+ * Where the tracing paper lay at the end and whether it was hidden, as the canvas gave it: at [x,
558
+ * y] and hidden.
559
+ */
560
+ readonly tracing: unknown;
561
+ /**
562
+ * Each submission of the task, in order: its context, as the canvas gave it, and the history
563
+ * length when it was sent.
564
+ */
565
+ readonly submissions: readonly WorkSubmission[];
566
+ }
567
+
438
568
  // The types of profile.schema.json.
439
569
 
440
570
  /**
@@ -488,6 +618,11 @@ export interface Profile {
488
618
  * The default mode of the screen of a task.
489
619
  */
490
620
  readonly default_mode: ProfileDefaultMode;
621
+ /**
622
+ * The hint mode: whether a task from paper gets the wavy line with the words of a rung,
623
+ * "show_where", or the words alone, "questions_only" (R162).
624
+ */
625
+ readonly hint_mode: ProfileHintMode;
491
626
  /**
492
627
  * The interface language, a BCP 47 tag; absent when none is set.
493
628
  */
@@ -521,6 +656,12 @@ export interface Profile {
521
656
  * The profile's attempts, open and closed.
522
657
  */
523
658
  readonly attempts: readonly Attempt[];
659
+ /**
660
+ * The profile's open attempts of tasks from paper, those of one page: api keeps one only while it
661
+ * is open, and nothing of it once it ends (R162; privacy 4.1). Their page, crops and work are the
662
+ * device's, under paper/.
663
+ */
664
+ readonly paper_attempts: readonly PaperAttempt[];
524
665
  /**
525
666
  * The engine's choices for the profile.
526
667
  */
@@ -599,6 +740,14 @@ export type ProfilePresentationStyleVoicingSpeed = "normal" | "slow";
599
740
  */
600
741
  export type ProfileDefaultMode = "by_steps" | "self";
601
742
 
743
+ /**
744
+ * ProfileHintMode is the type of profile.schema.json#/properties/hint_mode.
745
+ *
746
+ * The hint mode: whether a task from paper gets the wavy line with the words of a rung,
747
+ * "show_where", or the words alone, "questions_only" (R162).
748
+ */
749
+ export type ProfileHintMode = "questions_only" | "show_where";
750
+
602
751
  /**
603
752
  * ConnectedModule is the type of profile.schema.json#/$defs/connected_module.
604
753
  */
@@ -807,7 +956,8 @@ export type AttemptCloseReason = "correct" | "solution_shown" | "left" | "abando
807
956
  */
808
957
  export interface Rung {
809
958
  /**
810
- * The rung, 1 to 3.
959
+ * The rung, 1 to 3; on an attempt of a task from paper, 0 is its opening question, the model's
960
+ * words alone (R82).
811
961
  */
812
962
  readonly rung: number;
813
963
  /**
@@ -1069,6 +1219,55 @@ export type RubricSubmissionCriterionMarks = "met" | "not_met" | "not_assessed";
1069
1219
  */
1070
1220
  export type RubricSubmissionFeedbackSource = "model" | "no_feedback";
1071
1221
 
1222
+ /**
1223
+ * PaperAttempt is the type of profile.schema.json#/$defs/paper_attempt.
1224
+ */
1225
+ export interface PaperAttempt {
1226
+ /**
1227
+ * The attempt's ID, which the task of its page in paper/ names.
1228
+ */
1229
+ readonly attempt_id: ID;
1230
+ /**
1231
+ * When the attempt began.
1232
+ */
1233
+ readonly begun_at: Time;
1234
+ /**
1235
+ * When the learner last acted on it.
1236
+ */
1237
+ readonly last_action_at: Time;
1238
+ /**
1239
+ * Where the key of each task of the attempt's crop came from, in the order of the page, as its
1240
+ * items; absent before a submission derived them. The keys themselves are the program's and never
1241
+ * reach the device (R05).
1242
+ */
1243
+ readonly key_sources?: readonly PaperAttemptKeySources[];
1244
+ /**
1245
+ * The attempt's wrong answers.
1246
+ */
1247
+ readonly wrong_answers: number;
1248
+ /**
1249
+ * The rungs given, in order, with their words.
1250
+ */
1251
+ readonly rungs: readonly Rung[];
1252
+ /**
1253
+ * Whether the words after a correct answer were given.
1254
+ */
1255
+ readonly correct_answer_words_given: boolean;
1256
+ /**
1257
+ * Each submission, in order, with its verdict, what was read and its observation.
1258
+ */
1259
+ readonly submissions: readonly Submission[];
1260
+ }
1261
+
1262
+ /**
1263
+ * PaperAttemptKeySources is the type of
1264
+ * profile.schema.json#/$defs/paper_attempt/properties/key_sources/items.
1265
+ *
1266
+ * Where one task's key came from: the solver, one solution of AI, or none, when the solution gave
1267
+ * no one answer a program can compare.
1268
+ */
1269
+ export type PaperAttemptKeySources = "solver" | "ai" | "none";
1270
+
1072
1271
  /**
1073
1272
  * Choice is the type of profile.schema.json#/$defs/choice.
1074
1273
  */
@@ -1177,14 +1376,19 @@ export interface EvidenceEntry {
1177
1376
  */
1178
1377
  readonly seq: number;
1179
1378
  /**
1180
- * The attempt the evidence is of; one per attempt. An adult's correction of the module's level,
1181
- * whose evidence has level_set_by_adult, is of no attempt: it holds the correction's ID.
1379
+ * The attempt the evidence is of; one per attempt. Absent from an adult's correction of the
1380
+ * module's level, whose evidence has level_set_by_adult and which is of no attempt.
1182
1381
  */
1183
- readonly attempt_id: ID;
1382
+ readonly attempt_id?: ID;
1383
+ /**
1384
+ * The ID of an adult's correction of the module's level, whose evidence has level_set_by_adult
1385
+ * (R157): absent from the evidence of an attempt.
1386
+ */
1387
+ readonly correction_id?: ID;
1184
1388
  /**
1185
- * The digest of the attempt's package, by which wrong_key versions are filtered. For an adult's
1186
- * correction of the module's level, the digest of the package of the module's current version,
1187
- * which no wrong_key version filters out.
1389
+ * The digest of the package the evidence is of: of the attempt, by which wrong_key versions
1390
+ * filter the evidence of attempts; of an adult's correction, the package of the module's current
1391
+ * version, which no wrong_key version filters out.
1188
1392
  */
1189
1393
  readonly package_digest: string;
1190
1394
  /**
@@ -1312,8 +1516,8 @@ export interface ProblemReport {
1312
1516
  */
1313
1517
  readonly attempt_id: ID;
1314
1518
  /**
1315
- * The answer that brought the words: a rung's, explain differently, after a correct answer, or
1316
- * the feedback of an essay.
1519
+ * The answer that brought the words: a rung's, explain differently, after a correct answer, the
1520
+ * feedback of an essay, or the opening question of a task from paper.
1317
1521
  */
1318
1522
  readonly reply: ProblemReportReply;
1319
1523
  /**
@@ -1349,10 +1553,10 @@ export interface ProblemReport {
1349
1553
  /**
1350
1554
  * ProblemReportReply is the type of profile.schema.json#/$defs/problem_report/properties/reply.
1351
1555
  *
1352
- * The answer that brought the words: a rung's, explain differently, after a correct answer, or the
1353
- * feedback of an essay.
1556
+ * The answer that brought the words: a rung's, explain differently, after a correct answer, the
1557
+ * feedback of an essay, or the opening question of a task from paper.
1354
1558
  */
1355
- export type ProblemReportReply = "rung" | "explained_differently" | "correct_answer" | "essay_feedback";
1559
+ export type ProblemReportReply = "rung" | "explained_differently" | "correct_answer" | "essay_feedback" | "opening";
1356
1560
 
1357
1561
  /**
1358
1562
  * ProblemReportKind is the type of profile.schema.json#/$defs/problem_report/properties/kind.
@@ -1407,7 +1611,7 @@ export interface Case {
1407
1611
  * The step that refuses the export: the schema, or the ID of the rule. Left out when the reader
1408
1612
  * accepts it.
1409
1613
  */
1410
- export type CaseRefusedBy = "schema" | "export.files" | "export.scope" | "export.profiles" | "export.works" | "export.case" | "export.proto";
1614
+ export type CaseRefusedBy = "schema" | "export.files" | "export.scope" | "export.profiles" | "export.works" | "export.paper" | "export.case" | "export.proto";
1411
1615
 
1412
1616
  // The types of work.schema.json.
1413
1617
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altnovatrail/spec",
3
- "version": "0.18.43",
3
+ "version": "0.19.0",
4
4
  "description": "The types of NovaTrail's module format for TypeScript, generated from its schemas: the parts of a module and their open views, the canonical view, the inventory, the module index and the test vectors. And the types of the element <novatrail-canvas>, the contract of the canvas and the app. And the types of the admission table, which says which AI provider may serve which age category. And the numbers and widths of the workbook's page and its test vectors, as JSON, by which a canvas lays the page out. And the types of the deployment configuration, the file /deployment.json that the app reads at its start. And the types of the legal texts' passport, which names each text, its versions and the sets of texts of the samples page. And the types of the table of the age of digital consent, which gives each country's age with the law that sets it. And the types of the files of an export, the file the owner of an account gets of a profile or of the account.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,8 +32,8 @@
32
32
  "./consentagev1": {
33
33
  "types": "./consentagev1/index.d.ts"
34
34
  },
35
- "./exportv3": {
36
- "types": "./exportv3/index.d.ts"
35
+ "./exportv4": {
36
+ "types": "./exportv4/index.d.ts"
37
37
  },
38
38
  "./package.json": "./package.json"
39
39
  },
@@ -45,7 +45,7 @@
45
45
  "deploymentv1",
46
46
  "legalv3",
47
47
  "consentagev1",
48
- "exportv3"
48
+ "exportv4"
49
49
  ],
50
50
  "sideEffects": false
51
51
  }