@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/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Record payload types are exported from `@mmon-co/ncept-default-theory/state` and
|
|
|
58
58
|
| `demonstration` | `Demonstration` | A Node's success/failure/don't-know, whether unaided, grader, task and response; optional evaluation records criterion probabilities and overrides. `recording: "retrieval-opener"` marks lesson-opening retrieval. |
|
|
59
59
|
| `lapse` | `Lapse` | Diagnosed regression for a Node, optionally linked to the same lesson's prior slip; affects retention, not acquisition |
|
|
60
60
|
| `grade` | `Grade` | A Node's whole-day retention judgment (`Again`, `Hard`, `Good`, `Easy`) and the exact learner-day interval |
|
|
61
|
-
| `review-pass` | `ReviewPass` |
|
|
61
|
+
| `review-pass` | `ReviewPass` | Historical evidence of a passed Review for a Node, suppressing its due and fading tags until a covering grade sets retention |
|
|
62
62
|
| `feature-use` | `FeatureUse` | An accepted operation name, not proof of every criterion clause |
|
|
63
63
|
| `teaching` | `Teaching` | An explicit explanation taught for a Node, separate from competence evidence |
|
|
64
64
|
| `claim` | `Claim` | A statement, optional eliciting prompt and learner stance (`knows`, `forgotten`, `unfamiliar`) |
|
|
@@ -56,10 +56,6 @@ export interface FetchPageToolInput {
|
|
|
56
56
|
readonly url: string;
|
|
57
57
|
readonly op?: "read" | "download";
|
|
58
58
|
}
|
|
59
|
-
export interface ProposeToolInput {
|
|
60
|
-
readonly op: "graph-diff" | "mission" | "revision" | "preferences" | "settings" | "mode" | "missing-capability";
|
|
61
|
-
readonly input: CatalogArguments;
|
|
62
|
-
}
|
|
63
59
|
export interface SkillToolInput {
|
|
64
60
|
readonly name: string;
|
|
65
61
|
/** A relative resource filename in the named Skill, never an arbitrary filesystem path. */
|
|
@@ -73,12 +69,21 @@ export interface GraphReadOptions {
|
|
|
73
69
|
readonly projection?: "compact" | "source";
|
|
74
70
|
readonly provenance?: boolean;
|
|
75
71
|
}
|
|
72
|
+
export type GuidanceEntryInput = {
|
|
73
|
+
readonly text: string;
|
|
74
|
+
readonly nodes?: readonly NodeId[];
|
|
75
|
+
readonly mode?: "replace" | "keep";
|
|
76
|
+
readonly from?: {
|
|
77
|
+
readonly tags?: readonly string[];
|
|
78
|
+
readonly nodes?: readonly NodeId[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
76
81
|
/**
|
|
77
|
-
* A compact graph stores every surviving origin entry once
|
|
78
|
-
* references
|
|
82
|
+
* A compact graph stores every surviving origin entry once, in the same shape the tutor writes.
|
|
83
|
+
* A Node's ordered references follow nodeTutorGuidance(graph, node), with independent cascades per kind.
|
|
79
84
|
*/
|
|
80
85
|
export interface CompactGuidance {
|
|
81
|
-
readonly guidance: Readonly<Record<string, TutorGuidanceEntry
|
|
86
|
+
readonly guidance: Readonly<Record<string, GuidanceEntryInput & Pick<TutorGuidanceEntry, "kind" | "origin">>>;
|
|
82
87
|
readonly effectiveGuidance: Readonly<Partial<Record<NodeId, readonly string[]>>>;
|
|
83
88
|
}
|
|
84
89
|
/** Modes whose evaluation is narrower than Lesson's; the rest mount every operation. Chart records self-report, and grading happens in Lessons. */
|
|
@@ -94,11 +99,14 @@ export declare const CATALOG_MODE_TITLES: {
|
|
|
94
99
|
readonly authoring: "Author";
|
|
95
100
|
readonly lesson: "Lesson";
|
|
96
101
|
};
|
|
102
|
+
export declare const PROPOSAL_TOOL_NAMES: readonly ["propose_graph_draft", "propose_mission", "propose_mission_revision", "propose_mode", "propose_settings", "propose_preferences", "record_missing_capability"];
|
|
103
|
+
export declare function isProposalToolName(name: string): name is (typeof PROPOSAL_TOOL_NAMES)[number];
|
|
97
104
|
export declare const CATALOG_MODE_TOOLS: {
|
|
98
|
-
readonly empty: readonly ["query", "read", "theory", "skill", "report_friction", "
|
|
99
|
-
readonly charting: readonly ["evaluation", "query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "
|
|
100
|
-
readonly authoring: readonly ["query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "
|
|
101
|
-
readonly lesson: readonly ["query", "read", "theory", "skill", "report_friction", "material", "edit_graph_draft", "edit_metadata", "evaluation", "
|
|
105
|
+
readonly empty: readonly ["query", "read", "theory", "skill", "report_friction", "propose_mode", "propose_settings", "propose_preferences"];
|
|
106
|
+
readonly charting: readonly ["evaluation", "query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "propose_graph_draft", "propose_mission", "propose_mission_revision", "propose_mode", "propose_settings", "propose_preferences", "web_search", "fetch_page", "code", "bash", "undo"];
|
|
107
|
+
readonly authoring: readonly ["query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "propose_graph_draft", "propose_mission", "propose_mission_revision", "propose_mode", "propose_settings", "propose_preferences", "web_search", "fetch_page", "code", "bash", "undo", "material"];
|
|
108
|
+
readonly lesson: readonly ["query", "read", "theory", "skill", "report_friction", "material", "edit_graph_draft", "edit_metadata", "evaluation", "propose_graph_draft", "propose_mission", "propose_mission_revision", "propose_mode", "propose_settings", "propose_preferences", "record_missing_capability", "web_search", "fetch_page", "code", "bash", "undo"];
|
|
102
109
|
};
|
|
110
|
+
export declare function catalogRootNames(mode: string | undefined): readonly string[] | undefined;
|
|
103
111
|
/** The keys each mode's edit_metadata may write; the tool is mounted only where a list exists. */
|
|
104
112
|
export declare const CATALOG_MODE_METADATA_KEYS: Readonly<Partial<Record<keyof typeof CATALOG_MODE_TOOLS, readonly string[]>>>;
|
package/dist/catalog-contract.js
CHANGED
|
@@ -20,8 +20,19 @@ export const CATALOG_MODE_TITLES = {
|
|
|
20
20
|
authoring: "Author",
|
|
21
21
|
lesson: "Lesson",
|
|
22
22
|
};
|
|
23
|
+
const CHAT_PROPOSAL_TOOLS = ["propose_mode", "propose_settings", "propose_preferences"];
|
|
24
|
+
const GRAPH_PROPOSAL_TOOLS = [
|
|
25
|
+
"propose_graph_draft",
|
|
26
|
+
"propose_mission",
|
|
27
|
+
"propose_mission_revision",
|
|
28
|
+
...CHAT_PROPOSAL_TOOLS,
|
|
29
|
+
];
|
|
30
|
+
export const PROPOSAL_TOOL_NAMES = [...GRAPH_PROPOSAL_TOOLS, "record_missing_capability"];
|
|
31
|
+
export function isProposalToolName(name) {
|
|
32
|
+
return PROPOSAL_TOOL_NAMES.some((tool) => tool === name);
|
|
33
|
+
}
|
|
23
34
|
export const CATALOG_MODE_TOOLS = {
|
|
24
|
-
empty: ["query", "read", "theory", "skill", "report_friction",
|
|
35
|
+
empty: ["query", "read", "theory", "skill", "report_friction", ...CHAT_PROPOSAL_TOOLS],
|
|
25
36
|
charting: [
|
|
26
37
|
"evaluation",
|
|
27
38
|
"query",
|
|
@@ -30,7 +41,7 @@ export const CATALOG_MODE_TOOLS = {
|
|
|
30
41
|
"skill",
|
|
31
42
|
"report_friction",
|
|
32
43
|
"edit_graph_draft",
|
|
33
|
-
|
|
44
|
+
...GRAPH_PROPOSAL_TOOLS,
|
|
34
45
|
"web_search",
|
|
35
46
|
"fetch_page",
|
|
36
47
|
"code",
|
|
@@ -45,7 +56,7 @@ export const CATALOG_MODE_TOOLS = {
|
|
|
45
56
|
"skill",
|
|
46
57
|
"report_friction",
|
|
47
58
|
"edit_graph_draft",
|
|
48
|
-
|
|
59
|
+
...GRAPH_PROPOSAL_TOOLS,
|
|
49
60
|
"web_search",
|
|
50
61
|
"fetch_page",
|
|
51
62
|
"code",
|
|
@@ -63,7 +74,7 @@ export const CATALOG_MODE_TOOLS = {
|
|
|
63
74
|
"edit_graph_draft",
|
|
64
75
|
"edit_metadata",
|
|
65
76
|
"evaluation",
|
|
66
|
-
|
|
77
|
+
...PROPOSAL_TOOL_NAMES,
|
|
67
78
|
"web_search",
|
|
68
79
|
"fetch_page",
|
|
69
80
|
"code",
|
|
@@ -71,6 +82,9 @@ export const CATALOG_MODE_TOOLS = {
|
|
|
71
82
|
"undo",
|
|
72
83
|
],
|
|
73
84
|
};
|
|
85
|
+
export function catalogRootNames(mode) {
|
|
86
|
+
return Object.entries(CATALOG_MODE_TOOLS).find(([name]) => name === mode)?.[1];
|
|
87
|
+
}
|
|
74
88
|
/** The keys each mode's edit_metadata may write; the tool is mounted only where a list exists. */
|
|
75
89
|
export const CATALOG_MODE_METADATA_KEYS = {
|
|
76
90
|
lesson: ["pedagogy:completion"],
|
package/dist/chat.d.ts
CHANGED
|
@@ -75,9 +75,128 @@ export declare const modes: {
|
|
|
75
75
|
}[];
|
|
76
76
|
entry: {
|
|
77
77
|
required: false;
|
|
78
|
-
kinds: ("
|
|
78
|
+
kinds: ("checkpoint" | "target" | "mission" | "goal")[];
|
|
79
79
|
};
|
|
80
80
|
capabilities: readonly HostCapability[];
|
|
81
|
+
graphDraftBatch: {
|
|
82
|
+
properties: {
|
|
83
|
+
nodes: {
|
|
84
|
+
type: "array";
|
|
85
|
+
items: {
|
|
86
|
+
type: "object";
|
|
87
|
+
properties: {
|
|
88
|
+
id: {
|
|
89
|
+
description: string;
|
|
90
|
+
type: "string";
|
|
91
|
+
};
|
|
92
|
+
label: {
|
|
93
|
+
type: "string";
|
|
94
|
+
};
|
|
95
|
+
criterion: {
|
|
96
|
+
type: "string";
|
|
97
|
+
};
|
|
98
|
+
priority: {
|
|
99
|
+
type: "number";
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
milestone: {
|
|
103
|
+
type: "boolean";
|
|
104
|
+
};
|
|
105
|
+
elaborate: {
|
|
106
|
+
type: "boolean";
|
|
107
|
+
};
|
|
108
|
+
review: {
|
|
109
|
+
type: "object";
|
|
110
|
+
properties: {
|
|
111
|
+
kind: {
|
|
112
|
+
enum: string[];
|
|
113
|
+
type: "string";
|
|
114
|
+
};
|
|
115
|
+
days: {
|
|
116
|
+
type: "number";
|
|
117
|
+
exclusiveMinimum: number;
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
required: ("kind" | "days")[];
|
|
122
|
+
additionalProperties: false;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
126
|
+
additionalProperties: false;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
edges: {
|
|
130
|
+
type: "array";
|
|
131
|
+
items: {
|
|
132
|
+
type: "object";
|
|
133
|
+
properties: {
|
|
134
|
+
from: {
|
|
135
|
+
description: string;
|
|
136
|
+
type: "string";
|
|
137
|
+
};
|
|
138
|
+
to: {
|
|
139
|
+
description: string;
|
|
140
|
+
type: "string";
|
|
141
|
+
};
|
|
142
|
+
id: {
|
|
143
|
+
description: string;
|
|
144
|
+
type: "string";
|
|
145
|
+
};
|
|
146
|
+
because: {
|
|
147
|
+
type: "string";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
151
|
+
additionalProperties: false;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
tags: {
|
|
155
|
+
type: "array";
|
|
156
|
+
items: {
|
|
157
|
+
type: "object";
|
|
158
|
+
properties: {
|
|
159
|
+
name: {
|
|
160
|
+
description: string;
|
|
161
|
+
type: "string";
|
|
162
|
+
};
|
|
163
|
+
nodes: {
|
|
164
|
+
type: "array";
|
|
165
|
+
items: {
|
|
166
|
+
description: string;
|
|
167
|
+
type: "string";
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
edges: {
|
|
171
|
+
type: "array";
|
|
172
|
+
items: {
|
|
173
|
+
description: string;
|
|
174
|
+
type: "string";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
priority: {
|
|
178
|
+
type: "number";
|
|
179
|
+
description: string;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
183
|
+
additionalProperties: false;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
targets: {
|
|
187
|
+
description: string;
|
|
188
|
+
type: "array";
|
|
189
|
+
items: {
|
|
190
|
+
description: string;
|
|
191
|
+
type: "string";
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core/patch").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core/patch").SemanticOperation[]): {
|
|
196
|
+
targets?: `node-${string}`[] | undefined;
|
|
197
|
+
operations: import("@mmon-co/ncept-core/patch").SemanticOperation[];
|
|
198
|
+
};
|
|
199
|
+
};
|
|
81
200
|
switches: {
|
|
82
201
|
mode: string;
|
|
83
202
|
then: "next";
|
|
@@ -111,6 +230,125 @@ export declare const modes: {
|
|
|
111
230
|
kinds: ("mission" | "goal")[];
|
|
112
231
|
};
|
|
113
232
|
capabilities: readonly HostCapability[];
|
|
233
|
+
graphDraftBatch: {
|
|
234
|
+
properties: {
|
|
235
|
+
nodes: {
|
|
236
|
+
type: "array";
|
|
237
|
+
items: {
|
|
238
|
+
type: "object";
|
|
239
|
+
properties: {
|
|
240
|
+
id: {
|
|
241
|
+
description: string;
|
|
242
|
+
type: "string";
|
|
243
|
+
};
|
|
244
|
+
label: {
|
|
245
|
+
type: "string";
|
|
246
|
+
};
|
|
247
|
+
criterion: {
|
|
248
|
+
type: "string";
|
|
249
|
+
};
|
|
250
|
+
priority: {
|
|
251
|
+
type: "number";
|
|
252
|
+
description: string;
|
|
253
|
+
};
|
|
254
|
+
milestone: {
|
|
255
|
+
type: "boolean";
|
|
256
|
+
};
|
|
257
|
+
elaborate: {
|
|
258
|
+
type: "boolean";
|
|
259
|
+
};
|
|
260
|
+
review: {
|
|
261
|
+
type: "object";
|
|
262
|
+
properties: {
|
|
263
|
+
kind: {
|
|
264
|
+
enum: string[];
|
|
265
|
+
type: "string";
|
|
266
|
+
};
|
|
267
|
+
days: {
|
|
268
|
+
type: "number";
|
|
269
|
+
exclusiveMinimum: number;
|
|
270
|
+
description: string;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
required: ("kind" | "days")[];
|
|
274
|
+
additionalProperties: false;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
278
|
+
additionalProperties: false;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
edges: {
|
|
282
|
+
type: "array";
|
|
283
|
+
items: {
|
|
284
|
+
type: "object";
|
|
285
|
+
properties: {
|
|
286
|
+
from: {
|
|
287
|
+
description: string;
|
|
288
|
+
type: "string";
|
|
289
|
+
};
|
|
290
|
+
to: {
|
|
291
|
+
description: string;
|
|
292
|
+
type: "string";
|
|
293
|
+
};
|
|
294
|
+
id: {
|
|
295
|
+
description: string;
|
|
296
|
+
type: "string";
|
|
297
|
+
};
|
|
298
|
+
because: {
|
|
299
|
+
type: "string";
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
303
|
+
additionalProperties: false;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
tags: {
|
|
307
|
+
type: "array";
|
|
308
|
+
items: {
|
|
309
|
+
type: "object";
|
|
310
|
+
properties: {
|
|
311
|
+
name: {
|
|
312
|
+
description: string;
|
|
313
|
+
type: "string";
|
|
314
|
+
};
|
|
315
|
+
nodes: {
|
|
316
|
+
type: "array";
|
|
317
|
+
items: {
|
|
318
|
+
description: string;
|
|
319
|
+
type: "string";
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
edges: {
|
|
323
|
+
type: "array";
|
|
324
|
+
items: {
|
|
325
|
+
description: string;
|
|
326
|
+
type: "string";
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
priority: {
|
|
330
|
+
type: "number";
|
|
331
|
+
description: string;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
335
|
+
additionalProperties: false;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
targets: {
|
|
339
|
+
description: string;
|
|
340
|
+
type: "array";
|
|
341
|
+
items: {
|
|
342
|
+
description: string;
|
|
343
|
+
type: "string";
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core/patch").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core/patch").SemanticOperation[]): {
|
|
348
|
+
targets?: `node-${string}`[] | undefined;
|
|
349
|
+
operations: import("@mmon-co/ncept-core/patch").SemanticOperation[];
|
|
350
|
+
};
|
|
351
|
+
};
|
|
114
352
|
switches: never[];
|
|
115
353
|
setup: (ctx: ChatContext<DefaultState>) => Program<Readonly<{
|
|
116
354
|
prompt: string;
|
|
@@ -135,9 +373,128 @@ export declare const modes: {
|
|
|
135
373
|
frontTab: string;
|
|
136
374
|
entry: {
|
|
137
375
|
required: true;
|
|
138
|
-
kinds: ("
|
|
376
|
+
kinds: ("target" | "mission")[];
|
|
139
377
|
};
|
|
140
378
|
capabilities: readonly HostCapability[];
|
|
379
|
+
graphDraftBatch: {
|
|
380
|
+
properties: {
|
|
381
|
+
nodes: {
|
|
382
|
+
type: "array";
|
|
383
|
+
items: {
|
|
384
|
+
type: "object";
|
|
385
|
+
properties: {
|
|
386
|
+
id: {
|
|
387
|
+
description: string;
|
|
388
|
+
type: "string";
|
|
389
|
+
};
|
|
390
|
+
label: {
|
|
391
|
+
type: "string";
|
|
392
|
+
};
|
|
393
|
+
criterion: {
|
|
394
|
+
type: "string";
|
|
395
|
+
};
|
|
396
|
+
priority: {
|
|
397
|
+
type: "number";
|
|
398
|
+
description: string;
|
|
399
|
+
};
|
|
400
|
+
milestone: {
|
|
401
|
+
type: "boolean";
|
|
402
|
+
};
|
|
403
|
+
elaborate: {
|
|
404
|
+
type: "boolean";
|
|
405
|
+
};
|
|
406
|
+
review: {
|
|
407
|
+
type: "object";
|
|
408
|
+
properties: {
|
|
409
|
+
kind: {
|
|
410
|
+
enum: string[];
|
|
411
|
+
type: "string";
|
|
412
|
+
};
|
|
413
|
+
days: {
|
|
414
|
+
type: "number";
|
|
415
|
+
exclusiveMinimum: number;
|
|
416
|
+
description: string;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
required: ("kind" | "days")[];
|
|
420
|
+
additionalProperties: false;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
required: ("id" | "label" | "milestone" | "priority" | "review" | "criterion" | "elaborate")[];
|
|
424
|
+
additionalProperties: false;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
edges: {
|
|
428
|
+
type: "array";
|
|
429
|
+
items: {
|
|
430
|
+
type: "object";
|
|
431
|
+
properties: {
|
|
432
|
+
from: {
|
|
433
|
+
description: string;
|
|
434
|
+
type: "string";
|
|
435
|
+
};
|
|
436
|
+
to: {
|
|
437
|
+
description: string;
|
|
438
|
+
type: "string";
|
|
439
|
+
};
|
|
440
|
+
id: {
|
|
441
|
+
description: string;
|
|
442
|
+
type: "string";
|
|
443
|
+
};
|
|
444
|
+
because: {
|
|
445
|
+
type: "string";
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
required: ("id" | "to" | "from" | "because")[];
|
|
449
|
+
additionalProperties: false;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
tags: {
|
|
453
|
+
type: "array";
|
|
454
|
+
items: {
|
|
455
|
+
type: "object";
|
|
456
|
+
properties: {
|
|
457
|
+
name: {
|
|
458
|
+
description: string;
|
|
459
|
+
type: "string";
|
|
460
|
+
};
|
|
461
|
+
nodes: {
|
|
462
|
+
type: "array";
|
|
463
|
+
items: {
|
|
464
|
+
description: string;
|
|
465
|
+
type: "string";
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
edges: {
|
|
469
|
+
type: "array";
|
|
470
|
+
items: {
|
|
471
|
+
description: string;
|
|
472
|
+
type: "string";
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
priority: {
|
|
476
|
+
type: "number";
|
|
477
|
+
description: string;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
required: ("nodes" | "name" | "edges" | "priority")[];
|
|
481
|
+
additionalProperties: false;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
targets: {
|
|
485
|
+
description: string;
|
|
486
|
+
type: "array";
|
|
487
|
+
items: {
|
|
488
|
+
description: string;
|
|
489
|
+
type: "string";
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core/patch").ResolvedGraph, "nodes" | "edges">, previous: readonly import("@mmon-co/ncept-core/patch").SemanticOperation[]): {
|
|
494
|
+
targets?: `node-${string}`[] | undefined;
|
|
495
|
+
operations: import("@mmon-co/ncept-core/patch").SemanticOperation[];
|
|
496
|
+
};
|
|
497
|
+
};
|
|
141
498
|
metadataKeys: readonly string[] | undefined;
|
|
142
499
|
switches: ({
|
|
143
500
|
mode: string;
|
package/dist/chat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 { provenanceOf, lastMetadataContribution, metadataSetsForEntity, NODE_CRITERION_PROPERTY, NODE_LABEL_PROPERTY, PEDAGOGY_OPENING_PROPERTY, PEDAGOGY_FIRST_MESSAGE_PROPERTY, nodeCascadedProperty, } 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, route, } 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";
|
|
@@ -8,6 +8,8 @@ import { catalogToolsForMode } from "./catalog.js";
|
|
|
8
8
|
import { evaluationContext, evaluateWatchedReply } from "./evaluation.js";
|
|
9
9
|
import { lessonOpening, openingLanguage } from "./opening.js";
|
|
10
10
|
import { nodeReviewSchedule } from "./path.js";
|
|
11
|
+
import { defaultQueryTokens } from "./tags.js";
|
|
12
|
+
import { graphDraftBatch } from "./graph-draft-batch.js";
|
|
11
13
|
const COMMON_CONCEPT_PATCH_PROPERTY = "app:common-concept";
|
|
12
14
|
const RAISE_WHEN_PROPERTY = "pedagogy:raise-when";
|
|
13
15
|
const DOCS_URL_PROPERTY = "app:docs-url";
|
|
@@ -153,6 +155,40 @@ function tutorOpening(ctx) {
|
|
|
153
155
|
.filter(Boolean)
|
|
154
156
|
.join("\n");
|
|
155
157
|
}
|
|
158
|
+
function dueNodes(ctx) {
|
|
159
|
+
const { graph, state, entry } = ctx;
|
|
160
|
+
const due = defaultQueryTokens["review:due"](state, graph);
|
|
161
|
+
const fading = defaultQueryTokens["review:fading"](state, graph);
|
|
162
|
+
if (due.size === 0 && fading.size === 0)
|
|
163
|
+
return [];
|
|
164
|
+
const here = ctx.lesson?.here;
|
|
165
|
+
const focus = new Set(here?.nodes);
|
|
166
|
+
const prerequisites = new Set();
|
|
167
|
+
for (const node of focus) {
|
|
168
|
+
const result = route(graph, node);
|
|
169
|
+
if (result.kind === "found")
|
|
170
|
+
for (const { id } of result.nodes)
|
|
171
|
+
if (!focus.has(id))
|
|
172
|
+
prerequisites.add(id);
|
|
173
|
+
}
|
|
174
|
+
const missionId = here?.mission.id ?? (entry?.kind === "mission" ? entry.id : undefined);
|
|
175
|
+
const mission = ctx.missions?.find(({ id }) => id === missionId);
|
|
176
|
+
const scope = new Set([...ctx.about, ...(mission?.nodes ?? []), ...prerequisites]);
|
|
177
|
+
const retrievability = (node) => state.nodes[node]?.schedule?.retrievability ?? 1;
|
|
178
|
+
return [...scope]
|
|
179
|
+
.filter((node) => due.has(node) || fading.has(node))
|
|
180
|
+
.sort((a, b) => retrievability(a) - retrievability(b) || a.localeCompare(b))
|
|
181
|
+
.map((node) => {
|
|
182
|
+
const label = nodeCascadedProperty(graph, node, NODE_LABEL_PROPERTY);
|
|
183
|
+
return {
|
|
184
|
+
node,
|
|
185
|
+
label: typeof label === "string" ? label : node,
|
|
186
|
+
status: fading.has(node) ? "fading" : "due",
|
|
187
|
+
...(fading.has(node) && prerequisites.has(node) ? { fadingPrerequisiteOfHere: true } : {}),
|
|
188
|
+
...(nodeReviewSchedule(graph, node).kind === "interval" ? { interval: true } : {}),
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
}
|
|
156
192
|
function* setup(ctx, mode) {
|
|
157
193
|
for (const node of ctx.about)
|
|
158
194
|
if (!ctx.graph.nodes.some(({ id }) => id === node))
|
|
@@ -161,10 +197,7 @@ function* setup(ctx, mode) {
|
|
|
161
197
|
const prompt = tutorSystemPrompt(mode);
|
|
162
198
|
const { documents, candidates } = documentListing(ctx);
|
|
163
199
|
const offered = linkedDocuments(ctx, documents, ctx.tutorMessages ?? []);
|
|
164
|
-
const
|
|
165
|
-
const intervalNodes = entry?.kind === "review"
|
|
166
|
-
? entry.nodes.filter((node) => nodeReviewSchedule(ctx.graph, node).kind === "interval")
|
|
167
|
-
: [];
|
|
200
|
+
const retention = dueNodes(ctx);
|
|
168
201
|
return {
|
|
169
202
|
prompt,
|
|
170
203
|
context: [
|
|
@@ -181,14 +214,7 @@ function* setup(ctx, mode) {
|
|
|
181
214
|
: "This Session is attached to no Nodes; name Nodes explicitly where a tool needs them.",
|
|
182
215
|
...(ctx.entry === undefined ? [] : [`Session opening (host-resolved facts):\n${JSON.stringify(ctx.entry)}`]),
|
|
183
216
|
...(ctx.missions?.length ? [`Current Missions (context data):\n${JSON.stringify(ctx.missions)}`] : []),
|
|
184
|
-
|
|
185
|
-
? [
|
|
186
|
-
`Current Review (frozen batch; check retention, not teach):\n${JSON.stringify({
|
|
187
|
-
...entry,
|
|
188
|
-
...(intervalNodes.length > 0 ? { intervalNodes } : {}),
|
|
189
|
-
})}`,
|
|
190
|
-
]
|
|
191
|
-
: []),
|
|
217
|
+
retention.length ? `Due and fading Nodes (most overdue first):\n${JSON.stringify(retention)}` : undefined,
|
|
192
218
|
...(here === undefined
|
|
193
219
|
? []
|
|
194
220
|
: [
|
|
@@ -250,6 +276,7 @@ export const modes = {
|
|
|
250
276
|
],
|
|
251
277
|
entry: { required: false, kinds: ["goal", "mission", "target", "checkpoint"] },
|
|
252
278
|
capabilities: catalogCapabilities("charting"),
|
|
279
|
+
graphDraftBatch,
|
|
253
280
|
switches: [{ mode: "lesson", then: "next", carry: { kind: "brief" } }],
|
|
254
281
|
setup: (ctx) => setup(ctx, "charting"),
|
|
255
282
|
},
|
|
@@ -258,14 +285,16 @@ export const modes = {
|
|
|
258
285
|
frontTab: "map",
|
|
259
286
|
entry: { required: false, kinds: ["goal", "mission"] },
|
|
260
287
|
capabilities: catalogCapabilities("authoring"),
|
|
288
|
+
graphDraftBatch,
|
|
261
289
|
switches: [],
|
|
262
290
|
setup: (ctx) => setup(ctx, "authoring"),
|
|
263
291
|
},
|
|
264
292
|
lesson: {
|
|
265
293
|
title: CATALOG_MODE_TITLES.lesson,
|
|
266
294
|
frontTab: "document",
|
|
267
|
-
entry: { required: true, kinds: ["mission", "target"
|
|
295
|
+
entry: { required: true, kinds: ["mission", "target"] },
|
|
268
296
|
capabilities: catalogCapabilities("lesson"),
|
|
297
|
+
graphDraftBatch,
|
|
269
298
|
metadataKeys: CATALOG_MODE_METADATA_KEYS.lesson,
|
|
270
299
|
switches: [
|
|
271
300
|
{ mode: "lesson", then: "next", carry: { kind: "brief" } },
|