@mmon-co/ncept-default-theory 3.0.19 → 3.0.21
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 +1 -1
- package/dist/catalog-contract.d.ts +19 -11
- package/dist/catalog-contract.js +18 -4
- package/dist/chat.d.ts +359 -2
- package/dist/chat.js +43 -14
- package/dist/graph-draft-batch.d.ts +145 -0
- package/dist/graph-draft-batch.js +187 -0
- package/dist/implementation.d.ts +359 -2
- package/dist/index.d.ts +360 -2
- package/dist/index.js +1 -0
- package/dist/opening.js +1 -1
- package/dist/path.d.ts +3 -3
- package/dist/path.js +17 -121
- package/dist/reading.js +3 -7
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/schedules.d.ts +1 -2
- package/dist/schedules.js +0 -10
- package/dist/skills/sources.d.ts +8 -8
- package/dist/skills/sources.js +8 -8
- package/dist/timing.d.ts +0 -3
- package/dist/timing.js +3 -25
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +3 -22
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,9 +71,128 @@ export declare const defaultTheory: {
|
|
|
71
71
|
}[];
|
|
72
72
|
entry: {
|
|
73
73
|
required: false;
|
|
74
|
-
kinds: ("
|
|
74
|
+
kinds: ("checkpoint" | "target" | "mission" | "goal")[];
|
|
75
75
|
};
|
|
76
76
|
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
77
|
+
graphDraftBatch: {
|
|
78
|
+
properties: {
|
|
79
|
+
nodes: {
|
|
80
|
+
type: "array";
|
|
81
|
+
items: {
|
|
82
|
+
type: "object";
|
|
83
|
+
properties: {
|
|
84
|
+
id: {
|
|
85
|
+
description: string;
|
|
86
|
+
type: "string";
|
|
87
|
+
};
|
|
88
|
+
label: {
|
|
89
|
+
type: "string";
|
|
90
|
+
};
|
|
91
|
+
criterion: {
|
|
92
|
+
type: "string";
|
|
93
|
+
};
|
|
94
|
+
priority: {
|
|
95
|
+
type: "number";
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
milestone: {
|
|
99
|
+
type: "boolean";
|
|
100
|
+
};
|
|
101
|
+
elaborate: {
|
|
102
|
+
type: "boolean";
|
|
103
|
+
};
|
|
104
|
+
review: {
|
|
105
|
+
type: "object";
|
|
106
|
+
properties: {
|
|
107
|
+
kind: {
|
|
108
|
+
enum: string[];
|
|
109
|
+
type: "string";
|
|
110
|
+
};
|
|
111
|
+
days: {
|
|
112
|
+
type: "number";
|
|
113
|
+
exclusiveMinimum: number;
|
|
114
|
+
description: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
required: ("kind" | "days")[];
|
|
118
|
+
additionalProperties: false;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
122
|
+
additionalProperties: false;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
edges: {
|
|
126
|
+
type: "array";
|
|
127
|
+
items: {
|
|
128
|
+
type: "object";
|
|
129
|
+
properties: {
|
|
130
|
+
from: {
|
|
131
|
+
description: string;
|
|
132
|
+
type: "string";
|
|
133
|
+
};
|
|
134
|
+
to: {
|
|
135
|
+
description: string;
|
|
136
|
+
type: "string";
|
|
137
|
+
};
|
|
138
|
+
id: {
|
|
139
|
+
description: string;
|
|
140
|
+
type: "string";
|
|
141
|
+
};
|
|
142
|
+
because: {
|
|
143
|
+
type: "string";
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
147
|
+
additionalProperties: false;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
tags: {
|
|
151
|
+
type: "array";
|
|
152
|
+
items: {
|
|
153
|
+
type: "object";
|
|
154
|
+
properties: {
|
|
155
|
+
name: {
|
|
156
|
+
description: string;
|
|
157
|
+
type: "string";
|
|
158
|
+
};
|
|
159
|
+
nodes: {
|
|
160
|
+
type: "array";
|
|
161
|
+
items: {
|
|
162
|
+
description: string;
|
|
163
|
+
type: "string";
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
edges: {
|
|
167
|
+
type: "array";
|
|
168
|
+
items: {
|
|
169
|
+
description: string;
|
|
170
|
+
type: "string";
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
priority: {
|
|
174
|
+
type: "number";
|
|
175
|
+
description: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
179
|
+
additionalProperties: false;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
targets: {
|
|
183
|
+
description: string;
|
|
184
|
+
type: "array";
|
|
185
|
+
items: {
|
|
186
|
+
description: string;
|
|
187
|
+
type: "string";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core").SemanticOperation[]): {
|
|
192
|
+
targets?: `node-${string}`[] | undefined;
|
|
193
|
+
operations: import("@mmon-co/ncept-core").SemanticOperation[];
|
|
194
|
+
};
|
|
195
|
+
};
|
|
77
196
|
switches: {
|
|
78
197
|
mode: string;
|
|
79
198
|
then: "next";
|
|
@@ -107,6 +226,125 @@ export declare const defaultTheory: {
|
|
|
107
226
|
kinds: ("mission" | "goal")[];
|
|
108
227
|
};
|
|
109
228
|
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
229
|
+
graphDraftBatch: {
|
|
230
|
+
properties: {
|
|
231
|
+
nodes: {
|
|
232
|
+
type: "array";
|
|
233
|
+
items: {
|
|
234
|
+
type: "object";
|
|
235
|
+
properties: {
|
|
236
|
+
id: {
|
|
237
|
+
description: string;
|
|
238
|
+
type: "string";
|
|
239
|
+
};
|
|
240
|
+
label: {
|
|
241
|
+
type: "string";
|
|
242
|
+
};
|
|
243
|
+
criterion: {
|
|
244
|
+
type: "string";
|
|
245
|
+
};
|
|
246
|
+
priority: {
|
|
247
|
+
type: "number";
|
|
248
|
+
description: string;
|
|
249
|
+
};
|
|
250
|
+
milestone: {
|
|
251
|
+
type: "boolean";
|
|
252
|
+
};
|
|
253
|
+
elaborate: {
|
|
254
|
+
type: "boolean";
|
|
255
|
+
};
|
|
256
|
+
review: {
|
|
257
|
+
type: "object";
|
|
258
|
+
properties: {
|
|
259
|
+
kind: {
|
|
260
|
+
enum: string[];
|
|
261
|
+
type: "string";
|
|
262
|
+
};
|
|
263
|
+
days: {
|
|
264
|
+
type: "number";
|
|
265
|
+
exclusiveMinimum: number;
|
|
266
|
+
description: string;
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
required: ("kind" | "days")[];
|
|
270
|
+
additionalProperties: false;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
274
|
+
additionalProperties: false;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
edges: {
|
|
278
|
+
type: "array";
|
|
279
|
+
items: {
|
|
280
|
+
type: "object";
|
|
281
|
+
properties: {
|
|
282
|
+
from: {
|
|
283
|
+
description: string;
|
|
284
|
+
type: "string";
|
|
285
|
+
};
|
|
286
|
+
to: {
|
|
287
|
+
description: string;
|
|
288
|
+
type: "string";
|
|
289
|
+
};
|
|
290
|
+
id: {
|
|
291
|
+
description: string;
|
|
292
|
+
type: "string";
|
|
293
|
+
};
|
|
294
|
+
because: {
|
|
295
|
+
type: "string";
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
299
|
+
additionalProperties: false;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
tags: {
|
|
303
|
+
type: "array";
|
|
304
|
+
items: {
|
|
305
|
+
type: "object";
|
|
306
|
+
properties: {
|
|
307
|
+
name: {
|
|
308
|
+
description: string;
|
|
309
|
+
type: "string";
|
|
310
|
+
};
|
|
311
|
+
nodes: {
|
|
312
|
+
type: "array";
|
|
313
|
+
items: {
|
|
314
|
+
description: string;
|
|
315
|
+
type: "string";
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
edges: {
|
|
319
|
+
type: "array";
|
|
320
|
+
items: {
|
|
321
|
+
description: string;
|
|
322
|
+
type: "string";
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
priority: {
|
|
326
|
+
type: "number";
|
|
327
|
+
description: string;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
331
|
+
additionalProperties: false;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
targets: {
|
|
335
|
+
description: string;
|
|
336
|
+
type: "array";
|
|
337
|
+
items: {
|
|
338
|
+
description: string;
|
|
339
|
+
type: "string";
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core").SemanticOperation[]): {
|
|
344
|
+
targets?: `node-${string}`[] | undefined;
|
|
345
|
+
operations: import("@mmon-co/ncept-core").SemanticOperation[];
|
|
346
|
+
};
|
|
347
|
+
};
|
|
110
348
|
switches: never[];
|
|
111
349
|
setup: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
112
350
|
prompt: string;
|
|
@@ -131,9 +369,128 @@ export declare const defaultTheory: {
|
|
|
131
369
|
frontTab: string;
|
|
132
370
|
entry: {
|
|
133
371
|
required: true;
|
|
134
|
-
kinds: ("
|
|
372
|
+
kinds: ("target" | "mission")[];
|
|
135
373
|
};
|
|
136
374
|
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
375
|
+
graphDraftBatch: {
|
|
376
|
+
properties: {
|
|
377
|
+
nodes: {
|
|
378
|
+
type: "array";
|
|
379
|
+
items: {
|
|
380
|
+
type: "object";
|
|
381
|
+
properties: {
|
|
382
|
+
id: {
|
|
383
|
+
description: string;
|
|
384
|
+
type: "string";
|
|
385
|
+
};
|
|
386
|
+
label: {
|
|
387
|
+
type: "string";
|
|
388
|
+
};
|
|
389
|
+
criterion: {
|
|
390
|
+
type: "string";
|
|
391
|
+
};
|
|
392
|
+
priority: {
|
|
393
|
+
type: "number";
|
|
394
|
+
description: string;
|
|
395
|
+
};
|
|
396
|
+
milestone: {
|
|
397
|
+
type: "boolean";
|
|
398
|
+
};
|
|
399
|
+
elaborate: {
|
|
400
|
+
type: "boolean";
|
|
401
|
+
};
|
|
402
|
+
review: {
|
|
403
|
+
type: "object";
|
|
404
|
+
properties: {
|
|
405
|
+
kind: {
|
|
406
|
+
enum: string[];
|
|
407
|
+
type: "string";
|
|
408
|
+
};
|
|
409
|
+
days: {
|
|
410
|
+
type: "number";
|
|
411
|
+
exclusiveMinimum: number;
|
|
412
|
+
description: string;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
required: ("kind" | "days")[];
|
|
416
|
+
additionalProperties: false;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
420
|
+
additionalProperties: false;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
edges: {
|
|
424
|
+
type: "array";
|
|
425
|
+
items: {
|
|
426
|
+
type: "object";
|
|
427
|
+
properties: {
|
|
428
|
+
from: {
|
|
429
|
+
description: string;
|
|
430
|
+
type: "string";
|
|
431
|
+
};
|
|
432
|
+
to: {
|
|
433
|
+
description: string;
|
|
434
|
+
type: "string";
|
|
435
|
+
};
|
|
436
|
+
id: {
|
|
437
|
+
description: string;
|
|
438
|
+
type: "string";
|
|
439
|
+
};
|
|
440
|
+
because: {
|
|
441
|
+
type: "string";
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
445
|
+
additionalProperties: false;
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
tags: {
|
|
449
|
+
type: "array";
|
|
450
|
+
items: {
|
|
451
|
+
type: "object";
|
|
452
|
+
properties: {
|
|
453
|
+
name: {
|
|
454
|
+
description: string;
|
|
455
|
+
type: "string";
|
|
456
|
+
};
|
|
457
|
+
nodes: {
|
|
458
|
+
type: "array";
|
|
459
|
+
items: {
|
|
460
|
+
description: string;
|
|
461
|
+
type: "string";
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
edges: {
|
|
465
|
+
type: "array";
|
|
466
|
+
items: {
|
|
467
|
+
description: string;
|
|
468
|
+
type: "string";
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
priority: {
|
|
472
|
+
type: "number";
|
|
473
|
+
description: string;
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
477
|
+
additionalProperties: false;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
targets: {
|
|
481
|
+
description: string;
|
|
482
|
+
type: "array";
|
|
483
|
+
items: {
|
|
484
|
+
description: string;
|
|
485
|
+
type: "string";
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core").SemanticOperation[]): {
|
|
490
|
+
targets?: `node-${string}`[] | undefined;
|
|
491
|
+
operations: import("@mmon-co/ncept-core").SemanticOperation[];
|
|
492
|
+
};
|
|
493
|
+
};
|
|
137
494
|
metadataKeys: readonly string[] | undefined;
|
|
138
495
|
switches: ({
|
|
139
496
|
mode: string;
|
|
@@ -208,4 +565,5 @@ export * from "./tools.js";
|
|
|
208
565
|
export * from "./skills.js";
|
|
209
566
|
export * from "./catalog-contract.js";
|
|
210
567
|
export * from "./catalog.js";
|
|
568
|
+
export { graphDraftBatch, type GraphDraftBatchInput } from "./graph-draft-batch.js";
|
|
211
569
|
export * from "./evaluation.js";
|
package/dist/index.js
CHANGED
package/dist/opening.js
CHANGED
|
@@ -8,7 +8,7 @@ export function lessonOpening(graph, nodes, mission) {
|
|
|
8
8
|
.filter(({ from, to }) => nodes.includes(from) && !nodes.includes(to) && mission?.nodes.includes(to))
|
|
9
9
|
.map(({ to }) => to));
|
|
10
10
|
return {
|
|
11
|
-
instruction: "
|
|
11
|
+
instruction: "Recheck prerequisites marked fadingPrerequisiteOfHere with fresh problems (material Skill, review.md) before building on them. Then make and open the Lesson’s Materials per the focus Nodes’ guidance (ask first only if that guidance leaves the work undecided). Introduce the Lesson—what its focus Nodes cover, its Materials in order, what completes it, and what follows. If there was no fading-prerequisite recheck and the focus Nodes have prior prerequisites with Records and no authored first action or conjectured-measure opener supersedes it, open with a quick retrieval prompt on prior work rather than a recap (recording the attempt with retrieval-opener); otherwise elicit the first action (using the first Node’s authored first action if supplied; later Nodes’ openings wait until those Nodes are reached).",
|
|
12
12
|
facts: {
|
|
13
13
|
focus: nodes.map((node) => ({
|
|
14
14
|
...label(node),
|
package/dist/path.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NodeId, type ResolvedGraph } from "@mmon-co/ncept-core/patch";
|
|
2
2
|
import { type MissionPath, type MissionFuture, type PathContext, type PathInputs, type PathSelection } from "@mmon-co/ncept-core/theory";
|
|
3
|
-
import {
|
|
3
|
+
import type { DefaultState } from "./state.js";
|
|
4
4
|
import { type ReviewSchedule } from "./schedules.js";
|
|
5
5
|
export { REVIEW_PROPERTY, validateReviewSchedule, type ReviewSchedule } from "./schedules.js";
|
|
6
6
|
/** Default-theory authoring metadata, not Core graph vocabulary. */
|
|
@@ -15,6 +15,6 @@ export declare function nodePriority(graph: ResolvedGraph, node: NodeId): number
|
|
|
15
15
|
* not by lesson, so a Node may be taught in more than one group.
|
|
16
16
|
*/
|
|
17
17
|
export declare function teachingPath(graph: ResolvedGraph, targets: readonly NodeId[]): MissionPath;
|
|
18
|
+
/** The syllabus stays addressable as progress changes; only the future is upcoming. */
|
|
18
19
|
export declare function pathDefault(context: PathContext): MissionFuture;
|
|
19
|
-
|
|
20
|
-
export declare function preparePathDefault(inputs: PathInputs, state?: DefaultState): (selection: PathSelection) => MissionFuture;
|
|
20
|
+
export declare function preparePathDefault(inputs: PathInputs, _state?: DefaultState): (selection: PathSelection) => MissionFuture;
|
package/dist/path.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { provenanceOf, lastMetadataContribution, metadataSetsForEntity, NODE_ELABORATE_PROPERTY, nodeCascadedProperty, route, unscopedCopyTagName, } from "@mmon-co/ncept-core/patch";
|
|
2
2
|
import { dependentCones } from "./dependent-cone.js";
|
|
3
|
-
import { LESSON_TAG_PREFIX,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { REVIEW_PROPERTY, retrievabilityAt, sameReviewCurve } from "./schedules.js";
|
|
3
|
+
import { LESSON_TAG_PREFIX, } from "@mmon-co/ncept-core/theory";
|
|
4
|
+
import { progressDefault } from "./reading.js";
|
|
5
|
+
import { REVIEW_PROPERTY } from "./schedules.js";
|
|
7
6
|
export { REVIEW_PROPERTY, validateReviewSchedule } from "./schedules.js";
|
|
8
7
|
/** Default-theory authoring metadata, not Core graph vocabulary. */
|
|
9
8
|
export function pathProperty(graph, node, key) {
|
|
@@ -180,125 +179,22 @@ export function teachingPath(graph, targets) {
|
|
|
180
179
|
first.lessons.unshift({ kind: "checkpoint", numbered: false, nodes: [], checkpoint: { required: true } });
|
|
181
180
|
return { sections, warnings: [...warnings.values()] };
|
|
182
181
|
}
|
|
183
|
-
/**
|
|
184
|
-
function ranked(nodes, context) {
|
|
185
|
-
const rank = (id) => context.projection.nodes[id]?.find((tag) => tag.tag === "review:due")?.rank ?? 0;
|
|
186
|
-
return [...nodes].sort((a, b) => rank(b) - rank(a) || a.localeCompare(b));
|
|
187
|
-
}
|
|
188
|
-
/** Nodes are indivisible: an over-budget first Node must still make progress. */
|
|
189
|
-
function packed(candidates, context, estimate) {
|
|
190
|
-
const nodes = [];
|
|
191
|
-
for (const node of ranked(candidates, context)) {
|
|
192
|
-
if (nodes.length &&
|
|
193
|
-
estimate([{ kind: "review", numbered: false, nodes: [...nodes, node] }]).minutes > context.minutes)
|
|
194
|
-
break;
|
|
195
|
-
nodes.push(node);
|
|
196
|
-
}
|
|
197
|
-
return nodes;
|
|
198
|
-
}
|
|
199
|
-
/** Invalidate at the next membership threshold or candidate rank change. FSRS rounds
|
|
200
|
-
* retrievability, so an unrounded analytic crossing would miss the first effective tick.
|
|
201
|
-
* Rank changes are conservative: the order may survive one, but cannot change before it.
|
|
202
|
-
*/
|
|
203
|
-
function pathValidity(context, scope, state) {
|
|
204
|
-
const now = Date.parse(context.now);
|
|
205
|
-
const boundaries = context.projection.validUntil === undefined ? [] : [Date.parse(context.projection.validUntil)];
|
|
206
|
-
const candidates = context.graph.nodes.flatMap(({ id }) => {
|
|
207
|
-
const schedule = state.nodes[id]?.schedule;
|
|
208
|
-
const rank = context.projection.nodes[id]?.find(({ tag }) => tag === "review:due")?.rank;
|
|
209
|
-
return scope.has(id) && schedule && rank !== undefined
|
|
210
|
-
? [{ id, schedule, priority: Math.round(rank - 1 + schedule.retrievability) }]
|
|
211
|
-
: [];
|
|
212
|
-
});
|
|
213
|
-
// Integer priority dominates decay. Identical curves keep even their stable ties forever.
|
|
214
|
-
const competing = new Set(candidates
|
|
215
|
-
.filter((a) => candidates.some((b) => a.priority === b.priority && !sameReviewCurve(a.schedule, b.schedule)))
|
|
216
|
-
.map(({ id }) => id));
|
|
217
|
-
for (const { id } of context.graph.nodes) {
|
|
218
|
-
const node = state.nodes[id];
|
|
219
|
-
const schedule = node?.schedule;
|
|
220
|
-
if (!scope.has(id) || !schedule || node.reviewCleared)
|
|
221
|
-
continue;
|
|
222
|
-
const at = (time) => retrievabilityAt(schedule, time);
|
|
223
|
-
const nextBelow = (threshold) => {
|
|
224
|
-
if (threshold <= 0 || at(now) < threshold)
|
|
225
|
-
return;
|
|
226
|
-
let low = now, high = now + 86_400_000;
|
|
227
|
-
while (at(high) >= threshold && high < 8_640_000_000_000_000)
|
|
228
|
-
high = Math.min(8_640_000_000_000_000, now + (high - now) * 2);
|
|
229
|
-
if (at(high) >= threshold)
|
|
230
|
-
return;
|
|
231
|
-
while (high - low > 1) {
|
|
232
|
-
const mid = Math.floor(low + (high - low) / 2);
|
|
233
|
-
if (at(mid) < threshold)
|
|
234
|
-
high = mid;
|
|
235
|
-
else
|
|
236
|
-
low = mid;
|
|
237
|
-
}
|
|
238
|
-
boundaries.push(high);
|
|
239
|
-
};
|
|
240
|
-
if (!schedule.lapsed) {
|
|
241
|
-
nextBelow(DEFAULT_PARAMETERS.retention.due);
|
|
242
|
-
nextBelow(DEFAULT_PARAMETERS.retention.fading);
|
|
243
|
-
}
|
|
244
|
-
if (competing.has(id))
|
|
245
|
-
nextBelow(schedule.retrievability);
|
|
246
|
-
}
|
|
247
|
-
const expiry = Math.min(...boundaries);
|
|
248
|
-
return Number.isFinite(expiry) ? { validUntil: new Date(expiry).toISOString() } : {};
|
|
249
|
-
}
|
|
182
|
+
/** The syllabus stays addressable as progress changes; only the future is upcoming. */
|
|
250
183
|
export function pathDefault(context) {
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
/** The syllabus stays addressable as progress changes; only the future is upcoming.
|
|
261
|
-
* A trailing unnumbered review is maintenance; a review with numberOffset 1 blocks the
|
|
262
|
-
* following teaching stop. A graph-wide reading has only maintenance, and no Mission.
|
|
263
|
-
*/
|
|
264
|
-
function readPath(context, tags, estimate, readState) {
|
|
265
|
-
if (context.retired?.outcome === "abandoned")
|
|
266
|
-
return { sections: [], warnings: [], future: [] };
|
|
267
|
-
const { graph, targets, projection } = context;
|
|
268
|
-
const path = teachingPath(graph, targets ?? []);
|
|
269
|
-
const scope = targets === undefined
|
|
270
|
-
? new Set(graph.nodes.map(({ id }) => id))
|
|
271
|
-
: new Set(path.sections.flatMap(({ lessons }) => lessons.flatMap(({ nodes }) => nodes)));
|
|
272
|
-
const due = packed(graph.nodes.map(({ id }) => id).filter((id) => scope.has(id) && tags("review:due").has(id)), context, estimate);
|
|
273
|
-
const maintenance = due.length ? [{ kind: "review", numbered: false, nodes: due }] : [];
|
|
274
|
-
if (context.retired?.outcome === "achieved" || targets === undefined)
|
|
275
|
-
return { ...path, ...pathValidity(context, scope, readState()), future: maintenance };
|
|
276
|
-
const progress = progressDefault(graph, projection, [...scope]);
|
|
277
|
-
const next = path.sections
|
|
278
|
-
.flatMap(({ lessons }) => lessons)
|
|
279
|
-
.find((lesson) => lesson.numbered && lesson.nodes.some((id) => progress[id]?.status === "open"));
|
|
280
|
-
const cone = new Set(next?.nodes.flatMap((id) => {
|
|
281
|
-
const result = route(graph, id);
|
|
282
|
-
return result.kind === "found" ? result.nodes.map(({ id }) => id) : [];
|
|
283
|
-
}) ?? []);
|
|
284
|
-
const fading = packed(graph.nodes
|
|
285
|
-
.map(({ id }) => id)
|
|
286
|
-
.filter((id) => cone.has(id) && !next?.nodes.includes(id) && tags("review:fading").has(id)), context, estimate);
|
|
287
|
-
const sections = path.sections.map((section) => ({
|
|
288
|
-
...section,
|
|
289
|
-
lessons: section.lessons.flatMap((lesson) => lesson === next && fading.length
|
|
290
|
-
? [{ kind: "review", numbered: false, numberOffset: 1, nodes: fading }, lesson]
|
|
291
|
-
: [lesson]),
|
|
292
|
-
}));
|
|
184
|
+
const { graph, targets, projection, retired } = context;
|
|
185
|
+
const validity = projection.validUntil === undefined ? {} : { validUntil: projection.validUntil };
|
|
186
|
+
const path = teachingPath(graph, retired?.outcome === "abandoned" ? [] : (targets ?? []));
|
|
187
|
+
if (retired || targets === undefined)
|
|
188
|
+
return { ...path, ...validity, future: [] };
|
|
189
|
+
const lessons = path.sections.flatMap((section) => section.lessons);
|
|
190
|
+
const scope = [...new Set(lessons.flatMap((lesson) => lesson.nodes))];
|
|
191
|
+
const progress = progressDefault(graph, projection, scope);
|
|
293
192
|
return {
|
|
294
193
|
...path,
|
|
295
|
-
...
|
|
296
|
-
|
|
297
|
-
future: [
|
|
298
|
-
...sections
|
|
299
|
-
.flatMap(({ lessons }) => lessons)
|
|
300
|
-
.filter((lesson) => !lesson.numbered || lesson.nodes.some((id) => progress[id]?.status === "open")),
|
|
301
|
-
...maintenance,
|
|
302
|
-
],
|
|
194
|
+
...validity,
|
|
195
|
+
future: lessons.filter((lesson) => !lesson.numbered || lesson.nodes.some((id) => progress[id]?.status === "open")),
|
|
303
196
|
};
|
|
304
197
|
}
|
|
198
|
+
export function preparePathDefault(inputs, _state) {
|
|
199
|
+
return (selection) => pathDefault({ ...inputs, ...selection });
|
|
200
|
+
}
|
package/dist/reading.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumberedStop } from "@mmon-co/ncept-core/theory/path";
|
|
2
2
|
import { defaultTheoryMessages } from "./messages.js";
|
|
3
|
-
import { prepareLessonTiming
|
|
3
|
+
import { prepareLessonTiming } from "./timing.js";
|
|
4
4
|
/** Read a frozen default assessment through the same boundary as a live projection. */
|
|
5
5
|
export function defaultTagProgress(tags) {
|
|
6
6
|
const display = tags.find(({ tag }) => tag === "demonstrated" || tag === "probably-known" || tag === "unknown");
|
|
@@ -56,20 +56,16 @@ export function estimateDefault(context, lessons) {
|
|
|
56
56
|
export function prepareEstimateDefault(context) {
|
|
57
57
|
let teachingTiming;
|
|
58
58
|
let timing;
|
|
59
|
-
let reviewTiming;
|
|
60
59
|
return (lessons) => {
|
|
61
60
|
const teaching = new Set(lessons.filter(isNumberedStop).flatMap(({ nodes }) => nodes));
|
|
62
61
|
const progress = progressDefault(context.graph, context.projection, [...teaching]);
|
|
63
62
|
const open = [...teaching].filter((id) => progress[id]?.status === "open").length;
|
|
64
|
-
const reviews = lessons.filter(({ kind }) => kind === "review").reduce((sum, { nodes }) => sum + nodes.length, 0);
|
|
65
63
|
teachingTiming ??= prepareLessonTiming(context.graph, context.observations, context.activities);
|
|
66
64
|
if (open > 0)
|
|
67
65
|
timing ??= teachingTiming.measure();
|
|
68
|
-
if (reviews > 0)
|
|
69
|
-
reviewTiming ??= measuredReviewTiming(context.graph, context.observations, context.activities);
|
|
70
66
|
return {
|
|
71
|
-
minutes: open * (timing?.minutesPerNode ?? 0)
|
|
72
|
-
rough:
|
|
67
|
+
minutes: open * (timing?.minutesPerNode ?? 0),
|
|
68
|
+
rough: timing?.rough ?? teachingTiming.rough(),
|
|
73
69
|
};
|
|
74
70
|
};
|
|
75
71
|
}
|
package/dist/release.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const theoryContent = "
|
|
1
|
+
export declare const theoryContent = "6b8491bb1acf87fe29b0a6750ff10687b8f310bb2c65fd954eb8841b4b34a95d";
|
package/dist/release.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const theoryContent = "
|
|
1
|
+
export const theoryContent = "6b8491bb1acf87fe29b0a6750ff10687b8f310bb2c65fd954eb8841b4b34a95d";
|
package/dist/schedules.d.ts
CHANGED
|
@@ -44,8 +44,7 @@ type RetentionEvidence = {
|
|
|
44
44
|
readonly grades: readonly Observation<Grade>[];
|
|
45
45
|
};
|
|
46
46
|
type Replay = (evidence: RetentionEvidence) => ReplayedSchedule | undefined;
|
|
47
|
-
export declare function validateReviewSchedule(value: unknown):
|
|
47
|
+
export declare function validateReviewSchedule(value: unknown): asserts value is ReviewSchedule | undefined;
|
|
48
48
|
export declare function prepareReviewReplay(schedule: ReviewSchedule): Replay;
|
|
49
|
-
export declare function sameReviewCurve(a: NodeSchedule, b: NodeSchedule): boolean;
|
|
50
49
|
export declare function retrievabilityAt(schedule: ReplayedSchedule, time: number): number;
|
|
51
50
|
export {};
|
package/dist/schedules.js
CHANGED
|
@@ -150,16 +150,6 @@ export function prepareReviewReplay(schedule) {
|
|
|
150
150
|
return schedulers.never.replay;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
export function sameReviewCurve(a, b) {
|
|
154
|
-
if (a.lastReview !== b.lastReview)
|
|
155
|
-
return false;
|
|
156
|
-
return a.kind === "fsrs"
|
|
157
|
-
? b.kind === "fsrs" &&
|
|
158
|
-
a.stability === b.stability &&
|
|
159
|
-
a.stabilityFast === b.stabilityFast &&
|
|
160
|
-
a.difficulty === b.difficulty
|
|
161
|
-
: b.kind === "interval" && a.days === b.days;
|
|
162
|
-
}
|
|
163
153
|
export function retrievabilityAt(schedule, time) {
|
|
164
154
|
const elapsed = (time - Date.parse(schedule.lastReview)) / DAY_MS;
|
|
165
155
|
if (schedule.kind === "fsrs")
|