@mmon-co/ncept-default-theory 3.0.19 → 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.
@@ -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. Expanding a Node's ordered
78
- * references must equal nodeTutorGuidance(graph, node), with independent keep/replace per kind.
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", "propose"];
99
- readonly charting: readonly ["evaluation", "query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "propose", "web_search", "fetch_page", "code", "bash", "undo"];
100
- readonly authoring: readonly ["query", "read", "theory", "skill", "report_friction", "edit_graph_draft", "propose", "web_search", "fetch_page", "code", "bash", "undo", "material"];
101
- readonly lesson: readonly ["query", "read", "theory", "skill", "report_friction", "material", "edit_graph_draft", "edit_metadata", "evaluation", "propose", "web_search", "fetch_page", "code", "bash", "undo"];
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[]>>>;
@@ -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", "propose"],
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
- "propose",
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
- "propose",
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
- "propose",
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: ("mission" | "checkpoint" | "target" | "goal")[];
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: ("review" | "id" | "label" | "milestone" | "priority" | "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: ("review" | "id" | "label" | "milestone" | "priority" | "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: ("mission" | "review" | "target")[];
376
+ kinds: ("review" | "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: ("review" | "id" | "label" | "milestone" | "priority" | "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
@@ -8,6 +8,7 @@ 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 { graphDraftBatch } from "./graph-draft-batch.js";
11
12
  const COMMON_CONCEPT_PATCH_PROPERTY = "app:common-concept";
12
13
  const RAISE_WHEN_PROPERTY = "pedagogy:raise-when";
13
14
  const DOCS_URL_PROPERTY = "app:docs-url";
@@ -250,6 +251,7 @@ export const modes = {
250
251
  ],
251
252
  entry: { required: false, kinds: ["goal", "mission", "target", "checkpoint"] },
252
253
  capabilities: catalogCapabilities("charting"),
254
+ graphDraftBatch,
253
255
  switches: [{ mode: "lesson", then: "next", carry: { kind: "brief" } }],
254
256
  setup: (ctx) => setup(ctx, "charting"),
255
257
  },
@@ -258,6 +260,7 @@ export const modes = {
258
260
  frontTab: "map",
259
261
  entry: { required: false, kinds: ["goal", "mission"] },
260
262
  capabilities: catalogCapabilities("authoring"),
263
+ graphDraftBatch,
261
264
  switches: [],
262
265
  setup: (ctx) => setup(ctx, "authoring"),
263
266
  },
@@ -266,6 +269,7 @@ export const modes = {
266
269
  frontTab: "document",
267
270
  entry: { required: true, kinds: ["mission", "target", "review"] },
268
271
  capabilities: catalogCapabilities("lesson"),
272
+ graphDraftBatch,
269
273
  metadataKeys: CATALOG_MODE_METADATA_KEYS.lesson,
270
274
  switches: [
271
275
  { mode: "lesson", then: "next", carry: { kind: "brief" } },
@@ -0,0 +1,145 @@
1
+ import { type EdgeId, type NodeId, type SemanticOperation } from "@mmon-co/ncept-core";
2
+ import { type ReviewSchedule } from "./schedules.js";
3
+ export type GraphDraftBatchInput = {
4
+ nodes?: {
5
+ id: NodeId;
6
+ label: string;
7
+ criterion?: string;
8
+ priority?: number;
9
+ milestone?: boolean;
10
+ elaborate?: boolean;
11
+ review?: ReviewSchedule;
12
+ }[];
13
+ edges?: {
14
+ from: NodeId;
15
+ to: NodeId;
16
+ id?: EdgeId;
17
+ because?: string;
18
+ }[];
19
+ tags?: {
20
+ name: string;
21
+ nodes?: NodeId[];
22
+ edges?: EdgeId[];
23
+ priority?: number;
24
+ }[];
25
+ targets?: NodeId[];
26
+ };
27
+ export declare const graphDraftBatch: {
28
+ properties: {
29
+ nodes: {
30
+ type: "array";
31
+ items: {
32
+ type: "object";
33
+ properties: {
34
+ id: {
35
+ description: string;
36
+ type: "string";
37
+ };
38
+ label: {
39
+ type: "string";
40
+ };
41
+ criterion: {
42
+ type: "string";
43
+ };
44
+ priority: {
45
+ type: "number";
46
+ description: string;
47
+ };
48
+ milestone: {
49
+ type: "boolean";
50
+ };
51
+ elaborate: {
52
+ type: "boolean";
53
+ };
54
+ review: {
55
+ type: "object";
56
+ properties: {
57
+ kind: {
58
+ enum: string[];
59
+ type: "string";
60
+ };
61
+ days: {
62
+ type: "number";
63
+ exclusiveMinimum: number;
64
+ description: string;
65
+ };
66
+ };
67
+ required: ("kind" | "days")[];
68
+ additionalProperties: false;
69
+ };
70
+ };
71
+ required: ("review" | "id" | "label" | "milestone" | "priority" | "criterion" | "elaborate")[];
72
+ additionalProperties: false;
73
+ };
74
+ };
75
+ edges: {
76
+ type: "array";
77
+ items: {
78
+ type: "object";
79
+ properties: {
80
+ from: {
81
+ description: string;
82
+ type: "string";
83
+ };
84
+ to: {
85
+ description: string;
86
+ type: "string";
87
+ };
88
+ id: {
89
+ description: string;
90
+ type: "string";
91
+ };
92
+ because: {
93
+ type: "string";
94
+ };
95
+ };
96
+ required: ("id" | "to" | "from" | "because")[];
97
+ additionalProperties: false;
98
+ };
99
+ };
100
+ tags: {
101
+ type: "array";
102
+ items: {
103
+ type: "object";
104
+ properties: {
105
+ name: {
106
+ description: string;
107
+ type: "string";
108
+ };
109
+ nodes: {
110
+ type: "array";
111
+ items: {
112
+ description: string;
113
+ type: "string";
114
+ };
115
+ };
116
+ edges: {
117
+ type: "array";
118
+ items: {
119
+ description: string;
120
+ type: "string";
121
+ };
122
+ };
123
+ priority: {
124
+ type: "number";
125
+ description: string;
126
+ };
127
+ };
128
+ required: ("nodes" | "name" | "edges" | "priority")[];
129
+ additionalProperties: false;
130
+ };
131
+ };
132
+ targets: {
133
+ description: string;
134
+ type: "array";
135
+ items: {
136
+ description: string;
137
+ type: "string";
138
+ };
139
+ };
140
+ };
141
+ compile(input: Readonly<Record<string, unknown>>, graph: Pick<import("@mmon-co/ncept-core").ResolvedGraph, "nodes" | "edges">, previous: readonly SemanticOperation[]): {
142
+ targets?: `node-${string}`[] | undefined;
143
+ operations: SemanticOperation[];
144
+ };
145
+ };