@mmon-co/ncept-default-theory 3.0.18 → 3.0.20
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/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 +15 -10
- 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/reading.js +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/schedules.d.ts +1 -1
- package/dist/skills/sources.d.ts +4 -4
- package/dist/skills/sources.js +4 -4
- package/dist/timing.d.ts +3 -3
- package/dist/timing.js +34 -19
- package/dist/tools.js +2 -2
- package/package.json +1 -1
package/dist/timing.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { isNodeId } from "@mmon-co/ncept-core/patch";
|
|
2
|
-
import { isDemonstration, initDefaultState } from "./state.js";
|
|
2
|
+
import { isDemonstration, isHoming, homeDefaultRecords, initDefaultState } from "./state.js";
|
|
3
3
|
export const UNMEASURED_LESSON_TIMING = { minutesPerNode: 20, rough: true };
|
|
4
4
|
export const UNMEASURED_REVIEW_TIMING = { minutesPerNode: 2, rough: true };
|
|
5
5
|
/** Unique unaided checks in Review Sessions; acquisition already predates these checks. */
|
|
6
|
-
export function measuredReviewTiming(observations, activities) {
|
|
7
|
-
const reviews = activities.filter((activity) => activity.
|
|
6
|
+
export function measuredReviewTiming(graph, observations, activities) {
|
|
7
|
+
const reviews = activities.filter((activity) => activity.kind === "review");
|
|
8
|
+
const activeMs = reviews.reduce((sum, activity) => sum + activity.activeMs, 0);
|
|
9
|
+
if (activeMs <= 0)
|
|
10
|
+
return UNMEASURED_REVIEW_TIMING;
|
|
8
11
|
const surfaces = new Map(reviews.flatMap((activity) => [activity.surface, ...(activity.relatedSurfaces ?? [])].map((surface) => [surface, activity])));
|
|
9
12
|
const reviewed = new Set();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const last = observations.reduce((at, observation) => (observation.at > at ? observation.at : at), "");
|
|
14
|
+
const { records, current } = homeDefaultRecords(graph, observations, last);
|
|
15
|
+
for (const record of records) {
|
|
16
|
+
const activity = record.surface === undefined ? undefined : surfaces.get(record.surface);
|
|
17
|
+
if (!activity || record.at < activity.startedAt || !isDemonstration(record.payload) || !record.payload.unaided)
|
|
13
18
|
continue;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
for (const node of current.get(record.id) ?? [])
|
|
20
|
+
if (activity.nodes.includes(node))
|
|
21
|
+
reviewed.add(activity.surface + "/" + node);
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
return reviewed.size && activeMs > 0
|
|
20
|
-
? { minutesPerNode: activeMs / 60_000 / reviewed.size, rough: false }
|
|
21
|
-
: UNMEASURED_REVIEW_TIMING;
|
|
23
|
+
return reviewed.size ? { minutesPerNode: activeMs / 60_000 / reviewed.size, rough: false } : UNMEASURED_REVIEW_TIMING;
|
|
22
24
|
}
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
+
/** Measure demonstrated transitions at recording time. Later forgetting or a change in
|
|
26
|
+
* Record homes does not erase work the Session did.
|
|
25
27
|
*/
|
|
26
28
|
export function measuredLessonTiming(graph, observations, activities) {
|
|
27
29
|
return prepareLessonTiming(graph, observations, activities).measure();
|
|
@@ -29,20 +31,33 @@ export function measuredLessonTiming(graph, observations, activities) {
|
|
|
29
31
|
/** One reading's resumable recording-time scan. Roughness needs only its first transition;
|
|
30
32
|
* acquisition timing needs the complete unique (teaching surface, Node) denominator. */
|
|
31
33
|
export function prepareLessonTiming(graph, observations, activities) {
|
|
32
|
-
const teaching = activities.filter((activity) => activity.
|
|
33
|
-
const lessonSurfaces = new Map(teaching.
|
|
34
|
+
const teaching = activities.filter((activity) => activity.kind === "lesson");
|
|
35
|
+
const lessonSurfaces = new Map(teaching.flatMap((activity) => [activity.surface, ...(activity.relatedSurfaces ?? [])].map((surface) => [surface, activity])));
|
|
34
36
|
const demonstrated = new Set();
|
|
35
37
|
function* transitions() {
|
|
36
38
|
const state = initDefaultState(graph);
|
|
37
39
|
let consumed = 0;
|
|
38
40
|
for (const [index, observation] of observations.entries()) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
if (observation.standing === "abandoned")
|
|
42
|
+
continue;
|
|
43
|
+
const payload = observation.payload;
|
|
44
|
+
let activity = observation.surface === undefined ? undefined : lessonSurfaces.get(observation.surface);
|
|
45
|
+
const homing = isHoming(payload) ? payload : undefined;
|
|
46
|
+
if (!homing && (!activity || observation.at < activity.startedAt))
|
|
41
47
|
continue;
|
|
42
48
|
// Skipped evidence still belongs to the prefix, but never to this activity's denominator.
|
|
43
49
|
if (consumed < index)
|
|
44
50
|
state.step(observations.slice(consumed, index));
|
|
51
|
+
consumed = index;
|
|
45
52
|
const before = state.read(observation.at);
|
|
53
|
+
if (homing) {
|
|
54
|
+
const record = before.records.find(({ id }) => id === homing.of);
|
|
55
|
+
activity = record?.surface === undefined ? undefined : lessonSurfaces.get(record.surface);
|
|
56
|
+
if (!activity || !record || record.at < activity.startedAt)
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (!activity)
|
|
60
|
+
continue;
|
|
46
61
|
state.step([observation]);
|
|
47
62
|
consumed = index + 1;
|
|
48
63
|
const after = state.read(observation.at);
|
package/dist/tools.js
CHANGED
|
@@ -217,7 +217,7 @@ function retractionCandidates(ctx, observations) {
|
|
|
217
217
|
}));
|
|
218
218
|
}
|
|
219
219
|
function lessonCompletion(ctx) {
|
|
220
|
-
const lesson = ctx.lesson?.
|
|
220
|
+
const lesson = ctx.lesson?.here;
|
|
221
221
|
if (ctx.mode !== "lesson" || lesson === undefined)
|
|
222
222
|
return undefined;
|
|
223
223
|
const nodes = lesson.nodes.map((node) => {
|
|
@@ -523,7 +523,7 @@ const recordDemonstration = {
|
|
|
523
523
|
throw new Error("Invalid demonstration");
|
|
524
524
|
const observation = { at: ctx.now, about: [...ctx.about], nodes: [node], surface: ctx.surface, payload };
|
|
525
525
|
const id = yield* write(observation);
|
|
526
|
-
const lesson = ctx.mode === "lesson" &&
|
|
526
|
+
const lesson = ctx.mode === "lesson" && ctx.lesson !== undefined
|
|
527
527
|
? lessonCompletion({ ...ctx, state: stateDefault(ctx.graph, yield* read.observations({}), ctx.now) })
|
|
528
528
|
: undefined;
|
|
529
529
|
return { observation: { ...observation, id }, citations: [id], ...(lesson === undefined ? {} : { lesson }) };
|