@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/README.md
CHANGED
|
@@ -45,7 +45,6 @@ Core's `Observation` envelope carries identity, time, scope, support and the pro
|
|
|
45
45
|
| Payload | Public type and guard from `@mmon-co/ncept-default-theory/outcomes` | Captured evidence |
|
|
46
46
|
| --- | --- | --- |
|
|
47
47
|
| `completion` | `CompletionOutcome`, `isCompletionOutcome` | Playground and scope, exact Node provenance, complete/incomplete and optional validity boundary |
|
|
48
|
-
| `recall` | `RecallOutcome`, `isRecallOutcome` | Card content and Nodes at retrieval, learner answer and recall grade |
|
|
49
48
|
| `quiz` | `QuizOutcome`, `isQuizOutcome` | Questions, choices and correct answers, selected/skipped responses and comments |
|
|
50
49
|
| `attempt` | `AttemptOutcome`, `isAttemptOutcome` | Problem and grading contract at opening, response, assessment, help and exact revision |
|
|
51
50
|
|
|
@@ -71,4 +70,6 @@ Record payload types are exported from `@mmon-co/ncept-default-theory/state` and
|
|
|
71
70
|
|
|
72
71
|
Public guards include `isDemonstration`, `isRetrievalOpenerDemonstration`, `isLapse`, `isGrade`, `isReviewPass`, `isFeatureUse`, `isTeaching`, `isClaim`, `isRetraction`, `isHoming` and `isMemory`. `isDefaultObservation` checks producing-Theory attribution only; it is not a payload validator. `MemorySummaryPayload` and `Interpretation` have exported types but no standalone public guards. Other Theories choose which kinds they understand and preserve unread observations when exchanging a Profile.
|
|
73
72
|
|
|
73
|
+
Queued repetitions emit `attempt` too; their four ratings and latency belong to the queue's scheduling history. Version 1.1 migrates historical recall captures to Problems, freezing the former front/back unaided rule as observed assistance. Existing Demonstrations retain their identities, attribution and readings.
|
|
74
|
+
|
|
74
75
|
Observation-contract changes follow the Theory's semver and forward-migration rules: a patch needs no dependent-data migration, a minor permits a mechanical migration, and a major requires a non-mechanical one. This extraction preserves the existing payloads and validators unchanged.
|
|
@@ -42,7 +42,7 @@ export interface EvaluationToolInput {
|
|
|
42
42
|
readonly input: CatalogArguments;
|
|
43
43
|
}
|
|
44
44
|
export interface MaterialToolInput {
|
|
45
|
-
readonly op: "add" | "edit" | "remove" | "open" | "command";
|
|
45
|
+
readonly op: "add" | "add-many" | "edit" | "remove" | "open" | "command";
|
|
46
46
|
/** Existing Playground identities remain the stored Material kinds. */
|
|
47
47
|
readonly kind: string;
|
|
48
48
|
readonly input: CatalogArguments;
|
package/dist/chat.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { renderSpeech } from "@mmon-co/ncept-core/theory/speaker";
|
|
2
2
|
/* eslint-disable require-yield -- Chat setup is a zero-effect synchronous Program. */
|
|
3
|
-
import { lastMetadataContribution, metadataSetsForEntity, NODE_CRITERION_PROPERTY, NODE_LABEL_PROPERTY, } from "@mmon-co/ncept-core/patch";
|
|
3
|
+
import { provenanceOf, lastMetadataContribution, metadataSetsForEntity, NODE_CRITERION_PROPERTY, NODE_LABEL_PROPERTY, PEDAGOGY_OPENING_PROPERTY, PEDAGOGY_FIRST_MESSAGE_PROPERTY, nodeCascadedProperty, } from "@mmon-co/ncept-core/patch";
|
|
4
4
|
import { CATALOG_MODE_TOOLS, CATALOG_MODE_TITLES, CATALOG_MODE_METADATA_KEYS } from "./catalog-contract.js";
|
|
5
5
|
import { isDefaultObservation, isMemory, memoryDefault } from "./state.js";
|
|
6
6
|
import { skillBody, skillResources, skillsForMode, tutorSystemPrompt } from "./skills.js";
|
|
7
7
|
import { catalogToolsForMode } from "./catalog.js";
|
|
8
8
|
import { evaluationContext, evaluateWatchedReply } from "./evaluation.js";
|
|
9
|
+
import { lessonOpening, openingLanguage } from "./opening.js";
|
|
9
10
|
const COMMON_CONCEPT_PATCH_PROPERTY = "app:common-concept";
|
|
10
11
|
const RAISE_WHEN_PROPERTY = "pedagogy:raise-when";
|
|
11
12
|
const COMMON_CONCEPT_DOCUMENT_URL = "/ncept/playgrounds/document?material=";
|
|
@@ -13,7 +14,7 @@ function metadataValue(ctx, node, property) {
|
|
|
13
14
|
const candidates = metadataSetsForEntity(ctx.graph, { kind: "node", id: node }).flatMap((set) => {
|
|
14
15
|
if (!(property in set.properties))
|
|
15
16
|
return [];
|
|
16
|
-
const source = ctx.graph.provenance.metadataProperties
|
|
17
|
+
const source = provenanceOf(ctx.graph.provenance.metadataProperties, set.id)?.[property]?.at(-1);
|
|
17
18
|
if (source === undefined)
|
|
18
19
|
throw new Error(`Missing provenance for ${property} on ${node}`);
|
|
19
20
|
return [{ value: set.properties[property], source }];
|
|
@@ -24,7 +25,7 @@ function officialDocuments(ctx) {
|
|
|
24
25
|
const officialPatches = new Set(ctx.graph.patchOrder.flatMap(({ identity }) => ctx.graph.patchMetadata[identity]?.properties[COMMON_CONCEPT_PATCH_PROPERTY] === true ? [identity] : []));
|
|
25
26
|
return ctx.graph.nodes.flatMap(({ id }) => {
|
|
26
27
|
if (!id.startsWith("node-mmon-") ||
|
|
27
|
-
!ctx.graph.provenance.nodes
|
|
28
|
+
!provenanceOf(ctx.graph.provenance.nodes, id)?.some(({ patch }) => officialPatches.has(patch.identity)))
|
|
28
29
|
return [];
|
|
29
30
|
const label = metadataValue(ctx, id, NODE_LABEL_PROPERTY);
|
|
30
31
|
const summary = metadataValue(ctx, id, NODE_CRITERION_PROPERTY);
|
|
@@ -45,6 +46,11 @@ function officialDocuments(ctx) {
|
|
|
45
46
|
];
|
|
46
47
|
});
|
|
47
48
|
}
|
|
49
|
+
function linkedDocuments(documents, messages) {
|
|
50
|
+
// A linked official title still counts as offered when the tutor mistypes its destination.
|
|
51
|
+
return documents.filter(({ documentId, label }) => messages.some((text) => text.includes(`${COMMON_CONCEPT_DOCUMENT_URL}${encodeURIComponent(documentId)}`) ||
|
|
52
|
+
text.replace(/\]\(\s+/g, "](").includes(`[${label}](${COMMON_CONCEPT_DOCUMENT_URL}`)));
|
|
53
|
+
}
|
|
48
54
|
/** Exclude Document links already carried by tutor text, in this conversation or a closed Session. */
|
|
49
55
|
function recommendableAffordances(ctx, documents) {
|
|
50
56
|
const told = [
|
|
@@ -53,6 +59,7 @@ function recommendableAffordances(ctx, documents) {
|
|
|
53
59
|
? observation.payload.entries.filter(({ speaker }) => speaker.kind === "tutor").map(({ text }) => text)
|
|
54
60
|
: []),
|
|
55
61
|
];
|
|
62
|
+
const offered = new Set(linkedDocuments(documents, told).map(({ node }) => node));
|
|
56
63
|
return documents.flatMap((document) => {
|
|
57
64
|
const state = ctx.state.nodes[document.node];
|
|
58
65
|
const raiseWhen = metadataValue(ctx, document.node, RAISE_WHEN_PROPERTY);
|
|
@@ -61,7 +68,7 @@ function recommendableAffordances(ctx, documents) {
|
|
|
61
68
|
state.featureUses.length !== 0 ||
|
|
62
69
|
typeof raiseWhen !== "string" ||
|
|
63
70
|
raiseWhen.trim() === "" ||
|
|
64
|
-
|
|
71
|
+
offered.has(document.node))
|
|
65
72
|
return [];
|
|
66
73
|
return [{ ...document, raiseWhen, documentUrl }];
|
|
67
74
|
});
|
|
@@ -97,15 +104,47 @@ function scopedMemory(ctx) {
|
|
|
97
104
|
? `${text.slice(0, MEMORY_PREFETCH_LIMIT)}\n… (truncated; use theory {name:'memory',input:{node}} for the rest)`
|
|
98
105
|
: text;
|
|
99
106
|
}
|
|
107
|
+
function tutorOpening(ctx) {
|
|
108
|
+
if (!ctx.opening)
|
|
109
|
+
return undefined;
|
|
110
|
+
const entry = ctx.entry;
|
|
111
|
+
const nodes = entry?.kind === "lesson" ? entry.lesson.nodes : [];
|
|
112
|
+
const lesson = entry?.kind === "lesson"
|
|
113
|
+
? lessonOpening(ctx.graph, nodes, ctx.missions?.find(({ id }) => id === entry.lesson.mission.id))
|
|
114
|
+
: undefined;
|
|
115
|
+
return [
|
|
116
|
+
"Initial tutor-led turn (host context, not learner speech). " +
|
|
117
|
+
(lesson?.instruction ?? "Begin this Session in its selected mode."),
|
|
118
|
+
openingLanguage(ctx.opening.latestLearnerMessage),
|
|
119
|
+
lesson === undefined ? undefined : "Lesson opening facts: " + JSON.stringify(lesson.facts),
|
|
120
|
+
nodes.length === 0
|
|
121
|
+
? undefined
|
|
122
|
+
: "Authored Node openings (context for when each Node is reached; firstMessage is addressed to the learner): " +
|
|
123
|
+
JSON.stringify(nodes.map((node) => ({
|
|
124
|
+
node,
|
|
125
|
+
firstAction: nodeCascadedProperty(ctx.graph, node, PEDAGOGY_OPENING_PROPERTY),
|
|
126
|
+
firstMessage: nodeCascadedProperty(ctx.graph, node, PEDAGOGY_FIRST_MESSAGE_PROPERTY),
|
|
127
|
+
}))),
|
|
128
|
+
]
|
|
129
|
+
.filter(Boolean)
|
|
130
|
+
.join("\n");
|
|
131
|
+
}
|
|
100
132
|
function* setup(ctx, mode) {
|
|
101
133
|
for (const node of ctx.about)
|
|
102
134
|
if (!ctx.graph.nodes.some(({ id }) => id === node))
|
|
103
135
|
throw new Error(`Missing Node ${node}`);
|
|
104
136
|
const prompt = tutorSystemPrompt(mode);
|
|
137
|
+
const offered = linkedDocuments(officialDocuments(ctx), ctx.tutorMessages ?? []);
|
|
105
138
|
return {
|
|
106
139
|
prompt,
|
|
107
140
|
context: [
|
|
108
141
|
...evaluationContext(ctx),
|
|
142
|
+
tutorOpening(ctx),
|
|
143
|
+
...(offered.length
|
|
144
|
+
? [
|
|
145
|
+
`Application help already offered in this Session (once-only asides):\n${JSON.stringify(offered)}\nKeep subsequent replies on the learner's task unless they ask for more application help.`,
|
|
146
|
+
]
|
|
147
|
+
: []),
|
|
109
148
|
ctx.about.length
|
|
110
149
|
? `This Session is attached to ${ctx.about.join(", ")}. Current Node memory (other Sessions' spans and Records; use theory {name:'memory',input:{node}} for more):\n\n${scopedMemory(ctx) || "(none)"}`
|
|
111
150
|
: "This Session is attached to no Nodes; name Nodes explicitly where a tool needs them.",
|
|
@@ -126,7 +165,9 @@ function* setup(ctx, mode) {
|
|
|
126
165
|
})),
|
|
127
166
|
})}`,
|
|
128
167
|
]),
|
|
129
|
-
]
|
|
168
|
+
]
|
|
169
|
+
.filter(Boolean)
|
|
170
|
+
.join("\n\n"),
|
|
130
171
|
skills: chatSkills(mode),
|
|
131
172
|
tools: catalogToolsForMode(mode ?? "lesson"),
|
|
132
173
|
};
|
package/dist/event.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderSpeech } from "@mmon-co/ncept-core/theory/speaker";
|
|
2
2
|
import { judge, isObservationId, read, write, } from "@mmon-co/ncept-core/observations";
|
|
3
3
|
import { isNodeId, sameExactPatchRef } from "@mmon-co/ncept-core/patch";
|
|
4
|
-
import { isAttemptOutcome, isQuizOutcome,
|
|
4
|
+
import { isAttemptOutcome, isQuizOutcome, practiceAttempts, problemAttempts } from "./outcomes.js";
|
|
5
5
|
import { stateDefault, homeDefaultRecords, isCompletionOutcome, projectGraphChange, homingCandidates, expandNodeMemory, isGrade, nodeDayEvidence, defaultNodeCompletion, completionNodeRef, } from "./state.js";
|
|
6
6
|
/** Entries after a Node's last summary; exactly eight remain verbatim. */
|
|
7
7
|
const MEMORY_COMPACTION_THRESHOLD = 8;
|
|
@@ -287,7 +287,7 @@ export function* event(input, ctx) {
|
|
|
287
287
|
}
|
|
288
288
|
if (object(payload) && payload.kind === "completion")
|
|
289
289
|
throw new Error("Invalid completion outcome");
|
|
290
|
-
if (!
|
|
290
|
+
if (!isQuizOutcome(payload) && !isAttemptOutcome(payload)) {
|
|
291
291
|
if (typeof input.payload === "object" &&
|
|
292
292
|
input.payload !== null &&
|
|
293
293
|
"kind" in input.payload &&
|
|
@@ -366,20 +366,26 @@ export function* event(input, ctx) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
const current = stateDefault(ctx.graph, yield* read.observations({}), ctx.now);
|
|
369
|
+
const summaries = new Map();
|
|
369
370
|
for (const node of new Set(input.about)) {
|
|
370
371
|
const memory = current.memories[node];
|
|
371
372
|
if (memory === undefined ||
|
|
372
373
|
memory.entries.filter((entry) => entry.kind === "entry").length <= MEMORY_COMPACTION_THRESHOLD)
|
|
373
374
|
continue;
|
|
374
|
-
const
|
|
375
|
+
const renderedText = memory.entries
|
|
375
376
|
.map((entry) => entry.kind === "summary"
|
|
376
377
|
? `[summary through ${expandNodeMemory(memory, entry).at(-1)?.position}; Material sources ${JSON.stringify(entry.materialSources)}] quoted derivative: ${JSON.stringify(entry.text)}`
|
|
377
378
|
: `[${entry.at}] ${renderSpeech(entry.speaker, entry.text)}`)
|
|
378
|
-
.join("\n\n")
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
.join("\n\n");
|
|
380
|
+
let text = summaries.get(renderedText);
|
|
381
|
+
if (text === undefined) {
|
|
382
|
+
text = yield* judge(SUMMARIZE, renderedText, { type: "string" }, (raw) => {
|
|
383
|
+
if (typeof raw !== "string")
|
|
384
|
+
throw new Error("Memory summary must be a string");
|
|
385
|
+
return raw;
|
|
386
|
+
});
|
|
387
|
+
summaries.set(renderedText, text);
|
|
388
|
+
}
|
|
383
389
|
const sources = [...new Set(memory.originals.map((entry) => entry.observation))];
|
|
384
390
|
const dependencies = [
|
|
385
391
|
...new Set(memory.originals.flatMap((entry) => [
|
package/dist/implementation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describeDefaultObservation } from "./history.js";
|
|
2
2
|
import { event } from "./event.js";
|
|
3
|
-
import { isAttemptOutcome, isQuizOutcome
|
|
3
|
+
import { isAttemptOutcome, isQuizOutcome } from "./outcomes.js";
|
|
4
4
|
import { initDefaultState, isCompletionOutcome } from "./state.js";
|
|
5
5
|
import { projectDefault } from "./tags.js";
|
|
6
6
|
import { pathDefault } from "./path.js";
|
|
@@ -8,7 +8,14 @@ import { progressDefault, estimateDefault, prepareEstimateDefault } from "./read
|
|
|
8
8
|
/** The single default implementation assembly. */
|
|
9
9
|
export declare const implementation: {
|
|
10
10
|
id: "default";
|
|
11
|
-
version: "1.
|
|
11
|
+
version: "1.1.0";
|
|
12
|
+
migrations: readonly Readonly<{
|
|
13
|
+
from: import("@mmon-co/ncept-core/theory").TheoryDataVersion;
|
|
14
|
+
to: import("@mmon-co/ncept-core/theory").TheoryDataVersion;
|
|
15
|
+
migratePatch(content: import("@mmon-co/ncept-core").PatchContent): import("@mmon-co/ncept-core").PatchContent;
|
|
16
|
+
migrate(profile: import("@mmon-co/ncept-core").Profile): import("@mmon-co/ncept-core").Profile;
|
|
17
|
+
migrateOutcome?(payload: unknown, profile: import("@mmon-co/ncept-core").Profile): unknown;
|
|
18
|
+
}>[];
|
|
12
19
|
initState: typeof initDefaultState;
|
|
13
20
|
project: typeof projectDefault;
|
|
14
21
|
progress: typeof progressDefault;
|
|
@@ -19,13 +26,12 @@ export declare const implementation: {
|
|
|
19
26
|
tags: readonly [...string[], "item-outcomes", "instability", "unused", "coarse", "lesson-split", "self-report", "edge-contradiction", "homeless"];
|
|
20
27
|
outcomes: {
|
|
21
28
|
completion: typeof isCompletionOutcome;
|
|
22
|
-
recall: typeof isRecallOutcome;
|
|
23
29
|
quiz: typeof isQuizOutcome;
|
|
24
30
|
attempt: typeof isAttemptOutcome;
|
|
25
31
|
};
|
|
26
32
|
chat: {
|
|
27
|
-
open: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core
|
|
28
|
-
turn: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core
|
|
33
|
+
open: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core").Program<import("@mmon-co/ncept-core/theory").ChatSetup<import("./state.js").DefaultState>>;
|
|
34
|
+
turn: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core").Program<import("@mmon-co/ncept-core/theory").ChatSetup<import("./state.js").DefaultState>>;
|
|
29
35
|
reply: typeof import("./evaluation.js").evaluateWatchedReply;
|
|
30
36
|
};
|
|
31
37
|
modes: {
|
|
@@ -41,15 +47,15 @@ export declare const implementation: {
|
|
|
41
47
|
mode: string;
|
|
42
48
|
then: "here";
|
|
43
49
|
}[];
|
|
44
|
-
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core
|
|
50
|
+
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
45
51
|
prompt: string;
|
|
46
52
|
context?: string;
|
|
47
53
|
tools: readonly Readonly<{
|
|
48
54
|
name: string;
|
|
49
55
|
description: string;
|
|
50
|
-
schema: import("@mmon-co/ncept-core
|
|
56
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
51
57
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
52
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core
|
|
58
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
53
59
|
}>[];
|
|
54
60
|
skills: readonly Readonly<{
|
|
55
61
|
name: string;
|
|
@@ -78,15 +84,15 @@ export declare const implementation: {
|
|
|
78
84
|
kind: "brief";
|
|
79
85
|
};
|
|
80
86
|
}[];
|
|
81
|
-
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core
|
|
87
|
+
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
82
88
|
prompt: string;
|
|
83
89
|
context?: string;
|
|
84
90
|
tools: readonly Readonly<{
|
|
85
91
|
name: string;
|
|
86
92
|
description: string;
|
|
87
|
-
schema: import("@mmon-co/ncept-core
|
|
93
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
88
94
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
89
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core
|
|
95
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
90
96
|
}>[];
|
|
91
97
|
skills: readonly Readonly<{
|
|
92
98
|
name: string;
|
|
@@ -105,15 +111,15 @@ export declare const implementation: {
|
|
|
105
111
|
};
|
|
106
112
|
capabilities: readonly import("@mmon-co/ncept-core/theory").HostCapability[];
|
|
107
113
|
switches: never[];
|
|
108
|
-
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core
|
|
114
|
+
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
109
115
|
prompt: string;
|
|
110
116
|
context?: string;
|
|
111
117
|
tools: readonly Readonly<{
|
|
112
118
|
name: string;
|
|
113
119
|
description: string;
|
|
114
|
-
schema: import("@mmon-co/ncept-core
|
|
120
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
115
121
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
116
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core
|
|
122
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
117
123
|
}>[];
|
|
118
124
|
skills: readonly Readonly<{
|
|
119
125
|
name: string;
|
|
@@ -147,15 +153,15 @@ export declare const implementation: {
|
|
|
147
153
|
focus: string;
|
|
148
154
|
};
|
|
149
155
|
})[];
|
|
150
|
-
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core
|
|
156
|
+
setup: (ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
151
157
|
prompt: string;
|
|
152
158
|
context?: string;
|
|
153
159
|
tools: readonly Readonly<{
|
|
154
160
|
name: string;
|
|
155
161
|
description: string;
|
|
156
|
-
schema: import("@mmon-co/ncept-core
|
|
162
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
157
163
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
158
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core
|
|
164
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core/theory").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
159
165
|
}>[];
|
|
160
166
|
skills: readonly Readonly<{
|
|
161
167
|
name: string;
|
|
@@ -166,5 +172,19 @@ export declare const implementation: {
|
|
|
166
172
|
}>>;
|
|
167
173
|
};
|
|
168
174
|
};
|
|
175
|
+
noEventHook: (input: import("@mmon-co/ncept-core").PlatformEvent) => input is {
|
|
176
|
+
readonly kind: "surface.open";
|
|
177
|
+
readonly surface: import("@mmon-co/ncept-core").SurfaceId;
|
|
178
|
+
readonly format: string;
|
|
179
|
+
readonly about: readonly import("@mmon-co/ncept-core").NodeId[];
|
|
180
|
+
} | {
|
|
181
|
+
readonly kind: "object.put";
|
|
182
|
+
readonly object: import("@mmon-co/ncept-core").ObjectId;
|
|
183
|
+
readonly meta: import("@mmon-co/ncept-core").ObjectMeta;
|
|
184
|
+
readonly surface?: import("@mmon-co/ncept-core").SurfaceId;
|
|
185
|
+
} | {
|
|
186
|
+
readonly kind: "mission";
|
|
187
|
+
readonly text: string;
|
|
188
|
+
};
|
|
169
189
|
event: typeof event;
|
|
170
190
|
};
|
package/dist/implementation.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { migrations } from "./migrations.js";
|
|
1
2
|
import { chat, modes } from "./chat.js";
|
|
2
3
|
import { describeDefaultObservation } from "./history.js";
|
|
3
4
|
import { event } from "./event.js";
|
|
4
|
-
import { isAttemptOutcome, isQuizOutcome
|
|
5
|
+
import { isAttemptOutcome, isQuizOutcome } from "./outcomes.js";
|
|
5
6
|
import { DEFAULT_THEORY_REF, initDefaultState, isCompletionOutcome } from "./state.js";
|
|
6
7
|
import { defaultTags, projectDefault } from "./tags.js";
|
|
7
8
|
import { pathDefault } from "./path.js";
|
|
@@ -10,6 +11,7 @@ import { progressDefault, estimateDefault, prepareEstimateDefault } from "./read
|
|
|
10
11
|
export const implementation = {
|
|
11
12
|
id: DEFAULT_THEORY_REF.theory,
|
|
12
13
|
version: DEFAULT_THEORY_REF.version,
|
|
14
|
+
migrations,
|
|
13
15
|
initState: initDefaultState,
|
|
14
16
|
project: projectDefault,
|
|
15
17
|
progress: progressDefault,
|
|
@@ -20,11 +22,11 @@ export const implementation = {
|
|
|
20
22
|
tags: defaultTags,
|
|
21
23
|
outcomes: {
|
|
22
24
|
completion: isCompletionOutcome,
|
|
23
|
-
recall: isRecallOutcome,
|
|
24
25
|
quiz: isQuizOutcome,
|
|
25
26
|
attempt: isAttemptOutcome,
|
|
26
27
|
},
|
|
27
28
|
chat,
|
|
28
29
|
modes,
|
|
30
|
+
noEventHook: (input) => input.kind === "surface.open" || input.kind === "object.put" || input.kind === "mission",
|
|
29
31
|
event,
|
|
30
32
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
export declare const defaultTheory: {
|
|
3
3
|
version: string;
|
|
4
4
|
id: "default";
|
|
5
|
+
migrations: readonly Readonly<{
|
|
6
|
+
from: import("@mmon-co/ncept-core").TheoryDataVersion;
|
|
7
|
+
to: import("@mmon-co/ncept-core").TheoryDataVersion;
|
|
8
|
+
migratePatch(content: import("@mmon-co/ncept-core").PatchContent): import("@mmon-co/ncept-core").PatchContent;
|
|
9
|
+
migrate(profile: import("@mmon-co/ncept-core").Profile): import("@mmon-co/ncept-core").Profile;
|
|
10
|
+
migrateOutcome?(payload: unknown, profile: import("@mmon-co/ncept-core").Profile): unknown;
|
|
11
|
+
}>[];
|
|
5
12
|
initState: typeof import("./state.js").initDefaultState;
|
|
6
13
|
project: typeof import("./tags.js").projectDefault;
|
|
7
14
|
progress: typeof import("./reading.js").progressDefault;
|
|
@@ -12,13 +19,12 @@ export declare const defaultTheory: {
|
|
|
12
19
|
tags: readonly [...string[], "item-outcomes", "instability", "unused", "coarse", "lesson-split", "self-report", "edge-contradiction", "homeless"];
|
|
13
20
|
outcomes: {
|
|
14
21
|
completion: typeof import("./state.js").isCompletionOutcome;
|
|
15
|
-
recall: typeof import("./outcomes.js").isRecallOutcome;
|
|
16
22
|
quiz: typeof import("./outcomes.js").isQuizOutcome;
|
|
17
23
|
attempt: typeof import("./outcomes.js").isAttemptOutcome;
|
|
18
24
|
};
|
|
19
25
|
chat: {
|
|
20
|
-
open: (ctx: import("@mmon-co/ncept-core
|
|
21
|
-
turn: (ctx: import("@mmon-co/ncept-core
|
|
26
|
+
open: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core").Program<import("@mmon-co/ncept-core").ChatSetup<import("./state.js").DefaultState>>;
|
|
27
|
+
turn: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>, mode?: "empty" | "charting" | "authoring" | "lesson") => import("@mmon-co/ncept-core").Program<import("@mmon-co/ncept-core").ChatSetup<import("./state.js").DefaultState>>;
|
|
22
28
|
reply: typeof import("./evaluation.js").evaluateWatchedReply;
|
|
23
29
|
};
|
|
24
30
|
modes: {
|
|
@@ -29,26 +35,26 @@ export declare const defaultTheory: {
|
|
|
29
35
|
required: false;
|
|
30
36
|
kinds: never[];
|
|
31
37
|
};
|
|
32
|
-
capabilities: readonly import("@mmon-co/ncept-core
|
|
38
|
+
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
33
39
|
switches: {
|
|
34
40
|
mode: string;
|
|
35
41
|
then: "here";
|
|
36
42
|
}[];
|
|
37
|
-
setup: (ctx: import("@mmon-co/ncept-core
|
|
43
|
+
setup: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
38
44
|
prompt: string;
|
|
39
45
|
context?: string;
|
|
40
46
|
tools: readonly Readonly<{
|
|
41
47
|
name: string;
|
|
42
48
|
description: string;
|
|
43
|
-
schema: import("@mmon-co/ncept-core
|
|
49
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
44
50
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
45
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core
|
|
51
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
46
52
|
}>[];
|
|
47
53
|
skills: readonly Readonly<{
|
|
48
54
|
name: string;
|
|
49
55
|
description: string;
|
|
50
56
|
body: string;
|
|
51
|
-
resources?: readonly import("@mmon-co/ncept-core
|
|
57
|
+
resources?: readonly import("@mmon-co/ncept-core").SkillResource[];
|
|
52
58
|
}>[];
|
|
53
59
|
}>>;
|
|
54
60
|
};
|
|
@@ -63,7 +69,7 @@ export declare const defaultTheory: {
|
|
|
63
69
|
required: false;
|
|
64
70
|
kinds: ("mission" | "checkpoint" | "goal" | "target")[];
|
|
65
71
|
};
|
|
66
|
-
capabilities: readonly import("@mmon-co/ncept-core
|
|
72
|
+
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
67
73
|
switches: {
|
|
68
74
|
mode: string;
|
|
69
75
|
then: "next";
|
|
@@ -71,21 +77,21 @@ export declare const defaultTheory: {
|
|
|
71
77
|
kind: "brief";
|
|
72
78
|
};
|
|
73
79
|
}[];
|
|
74
|
-
setup: (ctx: import("@mmon-co/ncept-core
|
|
80
|
+
setup: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
75
81
|
prompt: string;
|
|
76
82
|
context?: string;
|
|
77
83
|
tools: readonly Readonly<{
|
|
78
84
|
name: string;
|
|
79
85
|
description: string;
|
|
80
|
-
schema: import("@mmon-co/ncept-core
|
|
86
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
81
87
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
82
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core
|
|
88
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
83
89
|
}>[];
|
|
84
90
|
skills: readonly Readonly<{
|
|
85
91
|
name: string;
|
|
86
92
|
description: string;
|
|
87
93
|
body: string;
|
|
88
|
-
resources?: readonly import("@mmon-co/ncept-core
|
|
94
|
+
resources?: readonly import("@mmon-co/ncept-core").SkillResource[];
|
|
89
95
|
}>[];
|
|
90
96
|
}>>;
|
|
91
97
|
};
|
|
@@ -96,23 +102,23 @@ export declare const defaultTheory: {
|
|
|
96
102
|
required: false;
|
|
97
103
|
kinds: ("mission" | "goal")[];
|
|
98
104
|
};
|
|
99
|
-
capabilities: readonly import("@mmon-co/ncept-core
|
|
105
|
+
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
100
106
|
switches: never[];
|
|
101
|
-
setup: (ctx: import("@mmon-co/ncept-core
|
|
107
|
+
setup: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
102
108
|
prompt: string;
|
|
103
109
|
context?: string;
|
|
104
110
|
tools: readonly Readonly<{
|
|
105
111
|
name: string;
|
|
106
112
|
description: string;
|
|
107
|
-
schema: import("@mmon-co/ncept-core
|
|
113
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
108
114
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
109
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core
|
|
115
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
110
116
|
}>[];
|
|
111
117
|
skills: readonly Readonly<{
|
|
112
118
|
name: string;
|
|
113
119
|
description: string;
|
|
114
120
|
body: string;
|
|
115
|
-
resources?: readonly import("@mmon-co/ncept-core
|
|
121
|
+
resources?: readonly import("@mmon-co/ncept-core").SkillResource[];
|
|
116
122
|
}>[];
|
|
117
123
|
}>>;
|
|
118
124
|
};
|
|
@@ -123,7 +129,7 @@ export declare const defaultTheory: {
|
|
|
123
129
|
required: true;
|
|
124
130
|
kinds: ("lesson" | "review")[];
|
|
125
131
|
};
|
|
126
|
-
capabilities: readonly import("@mmon-co/ncept-core
|
|
132
|
+
capabilities: readonly import("@mmon-co/ncept-core").HostCapability[];
|
|
127
133
|
metadataKeys: readonly string[] | undefined;
|
|
128
134
|
switches: ({
|
|
129
135
|
mode: string;
|
|
@@ -140,31 +146,45 @@ export declare const defaultTheory: {
|
|
|
140
146
|
focus: string;
|
|
141
147
|
};
|
|
142
148
|
})[];
|
|
143
|
-
setup: (ctx: import("@mmon-co/ncept-core
|
|
149
|
+
setup: (ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>) => import("@mmon-co/ncept-core").Program<Readonly<{
|
|
144
150
|
prompt: string;
|
|
145
151
|
context?: string;
|
|
146
152
|
tools: readonly Readonly<{
|
|
147
153
|
name: string;
|
|
148
154
|
description: string;
|
|
149
|
-
schema: import("@mmon-co/ncept-core
|
|
155
|
+
schema: import("@mmon-co/ncept-core").JsonSchema;
|
|
150
156
|
members?: readonly Readonly</*elided*/ any>[] | undefined;
|
|
151
|
-
run(args: unknown, ctx: import("@mmon-co/ncept-core
|
|
157
|
+
run(args: unknown, ctx: import("@mmon-co/ncept-core").ChatContext<import("./state.js").DefaultState>): import("@mmon-co/ncept-core").Program<unknown>;
|
|
152
158
|
}>[];
|
|
153
159
|
skills: readonly Readonly<{
|
|
154
160
|
name: string;
|
|
155
161
|
description: string;
|
|
156
162
|
body: string;
|
|
157
|
-
resources?: readonly import("@mmon-co/ncept-core
|
|
163
|
+
resources?: readonly import("@mmon-co/ncept-core").SkillResource[];
|
|
158
164
|
}>[];
|
|
159
165
|
}>>;
|
|
160
166
|
};
|
|
161
167
|
};
|
|
168
|
+
noEventHook: (input: import("@mmon-co/ncept-core").PlatformEvent) => input is {
|
|
169
|
+
readonly kind: "surface.open";
|
|
170
|
+
readonly surface: import("@mmon-co/ncept-core").SurfaceId;
|
|
171
|
+
readonly format: string;
|
|
172
|
+
readonly about: readonly import("@mmon-co/ncept-core").NodeId[];
|
|
173
|
+
} | {
|
|
174
|
+
readonly kind: "object.put";
|
|
175
|
+
readonly object: import("@mmon-co/ncept-core").ObjectId;
|
|
176
|
+
readonly meta: import("@mmon-co/ncept-core").ObjectMeta;
|
|
177
|
+
readonly surface?: import("@mmon-co/ncept-core").SurfaceId;
|
|
178
|
+
} | {
|
|
179
|
+
readonly kind: "mission";
|
|
180
|
+
readonly text: string;
|
|
181
|
+
};
|
|
162
182
|
event: typeof import("./event.js").event;
|
|
163
183
|
};
|
|
164
184
|
/** The range a new Profile accepts: the default Theory's current minor, which a patch deploy keeps. */
|
|
165
185
|
export declare const DEFAULT_THEORY_REQUIREMENT: {
|
|
166
186
|
readonly theory: "default";
|
|
167
|
-
readonly range: "~1.
|
|
187
|
+
readonly range: "~1.1";
|
|
168
188
|
};
|
|
169
189
|
export * from "./path.js";
|
|
170
190
|
export * from "./reading.js";
|
|
@@ -176,8 +196,10 @@ export * from "./state.js";
|
|
|
176
196
|
export * from "./completion.js";
|
|
177
197
|
export * from "./tags.js";
|
|
178
198
|
export * from "./outcomes.js";
|
|
199
|
+
export { recallToAttemptMigration } from "./migrations.js";
|
|
179
200
|
export * from "./roleplay.js";
|
|
180
201
|
export * from "./chat.js";
|
|
202
|
+
export * from "./opening.js";
|
|
181
203
|
export * from "./tools.js";
|
|
182
204
|
export * from "./skills.js";
|
|
183
205
|
export * from "./catalog-contract.js";
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export const defaultTheory = {
|
|
|
6
6
|
version: `${implementation.version}+${theoryContent}`,
|
|
7
7
|
};
|
|
8
8
|
/** The range a new Profile accepts: the default Theory's current minor, which a patch deploy keeps. */
|
|
9
|
-
export const DEFAULT_THEORY_REQUIREMENT = { theory: defaultTheory.id, range: "~1.
|
|
9
|
+
export const DEFAULT_THEORY_REQUIREMENT = { theory: defaultTheory.id, range: "~1.1" };
|
|
10
10
|
export * from "./path.js";
|
|
11
11
|
export * from "./reading.js";
|
|
12
12
|
export * from "./timing.js";
|
|
@@ -17,8 +17,10 @@ export * from "./state.js";
|
|
|
17
17
|
export * from "./completion.js";
|
|
18
18
|
export * from "./tags.js";
|
|
19
19
|
export * from "./outcomes.js";
|
|
20
|
+
export { recallToAttemptMigration } from "./migrations.js";
|
|
20
21
|
export * from "./roleplay.js";
|
|
21
22
|
export * from "./chat.js";
|
|
23
|
+
export * from "./opening.js";
|
|
22
24
|
export * from "./tools.js";
|
|
23
25
|
export * from "./skills.js";
|
|
24
26
|
export * from "./catalog-contract.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Profile } from "@mmon-co/ncept-core";
|
|
2
|
+
import { type ExactPatchRef } from "@mmon-co/ncept-core/patch";
|
|
3
|
+
import type { TheoryMigration } from "@mmon-co/ncept-core/theory";
|
|
4
|
+
declare function migratePayload(payload: unknown, revision: ExactPatchRef): unknown;
|
|
5
|
+
declare function migrate(profile: Profile): Profile;
|
|
6
|
+
export declare const recallToAttemptMigration: {
|
|
7
|
+
from: "1.0";
|
|
8
|
+
to: "1.1";
|
|
9
|
+
migratePatch: (content: import("@mmon-co/ncept-core").PatchContent) => import("@mmon-co/ncept-core").PatchContent;
|
|
10
|
+
migrate: typeof migrate;
|
|
11
|
+
migrateOutcome: (payload: unknown, profile: Profile) => unknown;
|
|
12
|
+
migratePayload: typeof migratePayload;
|
|
13
|
+
};
|
|
14
|
+
export declare const migrations: readonly TheoryMigration[];
|
|
15
|
+
export {};
|