@mmon-co/ncept-default-theory 1.0.0 → 2.0.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 +2 -1
- package/dist/catalog-contract.d.ts +1 -1
- package/dist/chat.js +46 -5
- package/dist/event.js +14 -8
- package/dist/implementation.d.ts +37 -17
- package/dist/implementation.js +4 -2
- package/dist/index.d.ts +46 -24
- package/dist/index.js +3 -1
- package/dist/migrations.d.ts +15 -0
- package/dist/migrations.js +67 -0
- package/dist/opening.d.ts +20 -0
- package/dist/opening.js +33 -0
- package/dist/outcomes.d.ts +9 -24
- package/dist/outcomes.js +16 -47
- package/dist/path.d.ts +2 -0
- package/dist/path.js +7 -6
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/skills/sources.d.ts +7 -7
- package/dist/skills/sources.js +7 -7
- package/dist/state.d.ts +1 -1
- package/dist/state.js +5 -5
- package/dist/tags.js +3 -3
- package/dist/tools.js +4 -10
- package/package.json +2 -2
package/dist/state.js
CHANGED
|
@@ -2,10 +2,10 @@ import { createEmptyCard, forgetting_curve, fsrs, generatorParameters, Rating }
|
|
|
2
2
|
import { readTheoryState } from "@mmon-co/ncept-core/theory";
|
|
3
3
|
import { dependentCones } from "./dependent-cone.js";
|
|
4
4
|
import { COMPLETION_PROPERTY, compileCompletion, completionBoundary, prepareCompletionHistory, } from "./completion.js";
|
|
5
|
-
import { exactPatchRefKey, lastMetadataContribution, metadataSetsForEntity, NODE_CRITERION_PROPERTY, sameExactPatchRef, } from "@mmon-co/ncept-core/patch";
|
|
5
|
+
import { provenanceOf, exactPatchRefKey, lastMetadataContribution, metadataSetsForEntity, NODE_CRITERION_PROPERTY, sameExactPatchRef, } from "@mmon-co/ncept-core/patch";
|
|
6
6
|
import { compareObservations, isObservationId, isObservationTimestamp, } from "@mmon-co/ncept-core/observations";
|
|
7
7
|
export const DEFAULT_THEORY_ID = "default";
|
|
8
|
-
export const DEFAULT_THEORY_REF = { theory: DEFAULT_THEORY_ID, version: "1.
|
|
8
|
+
export const DEFAULT_THEORY_REF = { theory: DEFAULT_THEORY_ID, version: "1.1.0" };
|
|
9
9
|
function object(value) {
|
|
10
10
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
11
|
}
|
|
@@ -308,7 +308,7 @@ export function homingCandidates(graph) {
|
|
|
308
308
|
const value = set.properties[NODE_CRITERION_PROPERTY];
|
|
309
309
|
if (value === undefined)
|
|
310
310
|
return [];
|
|
311
|
-
const source = graph.provenance.metadataProperties
|
|
311
|
+
const source = provenanceOf(graph.provenance.metadataProperties, set.id)?.[NODE_CRITERION_PROPERTY]?.at(-1);
|
|
312
312
|
if (typeof value !== "string" || source === undefined)
|
|
313
313
|
throw new Error(`Invalid capability statement for ${id}`);
|
|
314
314
|
return [{ value, source }];
|
|
@@ -458,7 +458,7 @@ export function defaultNodeCompletion(graph, node, index) {
|
|
|
458
458
|
: (index.metadata.get(node) ?? [])).flatMap((set) => {
|
|
459
459
|
if (!(COMPLETION_PROPERTY in set.properties))
|
|
460
460
|
return [];
|
|
461
|
-
const source = graph.provenance.metadataProperties
|
|
461
|
+
const source = provenanceOf(graph.provenance.metadataProperties, set.id)?.[COMPLETION_PROPERTY]?.at(-1);
|
|
462
462
|
if (source === undefined)
|
|
463
463
|
throw new Error(`Missing completion provenance for ${node}`);
|
|
464
464
|
return [{ value: set.properties[COMPLETION_PROPERTY], source }];
|
|
@@ -469,7 +469,7 @@ export function defaultNodeCompletion(graph, node, index) {
|
|
|
469
469
|
}
|
|
470
470
|
/** Stable authoring provenance, rather than the terminal of an unrelated graph edit. */
|
|
471
471
|
export function completionNodeRef(graph, node, nodeIds) {
|
|
472
|
-
const provenance = graph.provenance.nodes
|
|
472
|
+
const provenance = provenanceOf(graph.provenance.nodes, node)?.at(-1)?.patch;
|
|
473
473
|
if (!provenance || !(nodeIds?.has(node) ?? graph.nodes.some(({ id }) => id === node)))
|
|
474
474
|
throw new Error(`Unknown completion Node ${node}`);
|
|
475
475
|
return { node, provenance };
|
package/dist/tags.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dependentCones } from "./dependent-cone.js";
|
|
2
|
-
import { nodePriority, teachingPath, pathProperty } from "./path.js";
|
|
2
|
+
import { nodePriority, teachingPath, pathProperty, nodeAllowsReview } from "./path.js";
|
|
3
3
|
import { NODE_ELABORATE_PROPERTY } from "@mmon-co/ncept-core/patch";
|
|
4
4
|
import { completionCaption } from "./completion.js";
|
|
5
5
|
import { defaultProjectionBasis, DEFAULT_PARAMETERS, } from "./state.js";
|
|
@@ -39,11 +39,11 @@ export const defaultQueryTokens = {
|
|
|
39
39
|
}),
|
|
40
40
|
reachable: (state, graph, reached = reachableNodes(state, graph)) => reached,
|
|
41
41
|
frontier: (state, graph, reached = reachableNodes(state, graph)) => new Set([...reached].filter((id) => !isDefaultKnown(defaultNodeState(state, id)))),
|
|
42
|
-
"review:due": select((node, graph, id) =>
|
|
42
|
+
"review:due": select((node, graph, id) => nodeAllowsReview(graph, id) &&
|
|
43
43
|
!node.reviewCleared &&
|
|
44
44
|
isDefaultReviewable(node) &&
|
|
45
45
|
(node.schedule?.lapsed === true || (node.schedule?.retrievability ?? 1) < DEFAULT_PARAMETERS.retention.due)),
|
|
46
|
-
"review:fading": select((node, graph, id) =>
|
|
46
|
+
"review:fading": select((node, graph, id) => nodeAllowsReview(graph, id) &&
|
|
47
47
|
!node.reviewCleared &&
|
|
48
48
|
isDefaultReviewable(node) &&
|
|
49
49
|
(node.schedule?.lapsed === true || (node.schedule?.retrievability ?? 1) < DEFAULT_PARAMETERS.retention.fading)),
|
package/dist/tools.js
CHANGED
|
@@ -4,7 +4,7 @@ import { projectDefault } from "./tags.js";
|
|
|
4
4
|
import { contentDigest } from "@mmon-co/ncept-core/digest";
|
|
5
5
|
import { CATALOG_MAX_PAGE_SIZE, CATALOG_PAGE_SIZE } from "./catalog-contract.js";
|
|
6
6
|
import { effectiveObservations, isObservationId, read, write, } from "@mmon-co/ncept-core/observations";
|
|
7
|
-
import { materialKey, projectVisualGraph, route } from "@mmon-co/ncept-core/patch";
|
|
7
|
+
import { provenanceOf, materialKey, projectVisualGraph, route } from "@mmon-co/ncept-core/patch";
|
|
8
8
|
import { readMissionPath } from "@mmon-co/ncept-core/theory/path";
|
|
9
9
|
import { pathDefault } from "./path.js";
|
|
10
10
|
import { event, refinePendingHomes } from "./event.js";
|
|
@@ -236,17 +236,11 @@ function lessonCompletion(ctx) {
|
|
|
236
236
|
const complete = nodes.every(({ complete }) => complete);
|
|
237
237
|
return {
|
|
238
238
|
complete,
|
|
239
|
-
status: complete
|
|
240
|
-
? "This Lesson's completion queries hold; the host owns closure and the next Lesson."
|
|
241
|
-
: "This Lesson stays open; the next Lesson is not cleared for starting.",
|
|
239
|
+
status: complete ? "This Lesson's completion queries hold." : "This Lesson's completion queries do not yet hold.",
|
|
242
240
|
nodes,
|
|
243
241
|
};
|
|
244
242
|
}
|
|
245
243
|
function closeRecount(ctx, rawPractising) {
|
|
246
|
-
const lesson = lessonCompletion(ctx);
|
|
247
|
-
if (lesson !== undefined)
|
|
248
|
-
throw new Error("close_recount is for Review. The host closes Lessons when every focus Node's pedagogy:completion query holds.\n" +
|
|
249
|
-
JSON.stringify(lesson));
|
|
250
244
|
const practising = rawPractising === undefined ? [] : rawPractising;
|
|
251
245
|
if (!Array.isArray(practising))
|
|
252
246
|
throw new Error("Expected practice directions");
|
|
@@ -416,7 +410,7 @@ export const defaultInstrumentTools = [
|
|
|
416
410
|
"1. demonstrated: the Node query holds. A Node with no completion is never demonstrated. Aided attempts count only as practice unless the query selects them.",
|
|
417
411
|
"2. probably-known: an attached knows claim is newer than any failure on this Node.",
|
|
418
412
|
"3. unknown: otherwise. Only demonstrated and probably-known count as known for routing.",
|
|
419
|
-
"Retention is separate: the schedule replays the first unaided attempt per Node per UTC day as Good or Again. Unaided success also gives Good to direct prerequisites, at most once per day; failure never flows down. A diagnosed component regression supplies Again unless its slip is already recorded. An unresolved failure stays due for Review until an unaided success, independently of the forgetting curve. Claims start a short schedule without covering prerequisites. Review tags select ordinary acquired Nodes and scheduled completion-bound Nodes below the retention thresholds. Scheduled completion-bound Nodes remain eligible despite acquisition withdrawal; incomplete or expired reports do not supply Again.",
|
|
413
|
+
"Retention is separate: the schedule replays the first unaided attempt per Node per UTC day as Good or Again. Unaided success also gives Good to direct prerequisites, at most once per day; failure never flows down. A diagnosed component regression supplies Again unless its slip is already recorded. An unresolved failure stays due for Review until an unaided success, independently of the forgetting curve. Claims start a short schedule without covering prerequisites. Review tags select ordinary acquired Nodes and scheduled completion-bound Nodes below the retention thresholds, excluding milestones and Nodes with pedagogy:review: false. Scheduled completion-bound Nodes remain eligible despite acquisition withdrawal; incomplete or expired reports do not supply Again.",
|
|
420
414
|
"A newer knows claim can follow failure; a later failure defeats that claim unless completion still holds.",
|
|
421
415
|
].join("\n"),
|
|
422
416
|
*run(raw, ctx) {
|
|
@@ -447,7 +441,7 @@ export const defaultInstrumentTools = [
|
|
|
447
441
|
.filter((material) => material.about.includes(node))
|
|
448
442
|
.map((material) => ({
|
|
449
443
|
material,
|
|
450
|
-
provenance: ctx.graph.provenance.materials
|
|
444
|
+
provenance: provenanceOf(ctx.graph.provenance.materials, materialKey(material)) ?? [],
|
|
451
445
|
}))),
|
|
452
446
|
nodeTool("memory", "Opaque Node memory tail or summary with original Record citations.", (ctx, node) => {
|
|
453
447
|
const memory = ctx.state.memories[node] ?? emptyNodeMemory(node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmon-co/ncept-default-theory",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepack": "bun run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@mmon-co/ncept-core": "^0.
|
|
43
|
+
"@mmon-co/ncept-core": "^0.3.0",
|
|
44
44
|
"ts-fsrs": "^4.0.0",
|
|
45
45
|
"yaml": "^2.5.0"
|
|
46
46
|
},
|