@mmon-co/ncept-default-theory 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/catalog.js CHANGED
@@ -139,7 +139,7 @@ function evaluationCatalogTool(mode) {
139
139
  name: "evaluation",
140
140
  members: operations.map(({ tool }) => tool),
141
141
  description: operations === evaluationOperations
142
- ? "Delegate chat checks: watch grades subsequent learner replies; stop ends it; judge grades one response (message selects original learner media). Grader decision uses the Account decision model. Host records per-Node verdicts and returns criterion probabilities; do not record them again. Usually delegate rather than manually record. Record/material-attempt grades a Material item answered in chat; identical retries return the existing Record, later different answers get new Records. A runner's outcome stays the record. Override corrects a delegated or Material Record with a reason; claim records self-report; retract corrects evidence. Before an interpretation-correction, read that interpretation's current handles with theory interpretations. A close-recount carries no citations. Artifact filing is host-owned."
142
+ ? "Delegate chat checks: watch grades subsequent learner replies; stop ends it; judge grades one posed check (message selects original learner media). For judge and record/demonstration, including direct grading when judge fails, copy the posed task and just the learner's answer to it; answer any separate learner question in your reply. Grader decision uses the Account decision model. Host records per-Node verdicts and returns criterion probabilities; do not record them again. Usually delegate rather than manually record. Record/material-attempt grades a Material item answered in chat; identical retries return the existing Record, later different answers get new Records. A runner's outcome stays the record. Override corrects a delegated or Material Record with a reason; claim records self-report; retract corrects evidence. Before an interpretation-correction, read that interpretation's current handles with theory interpretations. A close-recount carries no citations. Artifact filing is host-owned."
143
143
  : "Record evidence that needs no grading: claim records self-report; retract corrects evidence. Nothing here grades a response; graded checks happen in a Lesson's Materials. Artifact filing is host-owned.",
144
144
  schema: {
145
145
  type: "object",
@@ -29,5 +29,13 @@ export declare function assessmentCapabilities(graph: ResolvedGraph, nodes: read
29
29
  }[];
30
30
  /** Called before a web tutor turn; only host-proven learner replies are passed here. */
31
31
  export declare function evaluateWatchedReply(ctx: Ctx, message: string): Program<unknown>;
32
+ export declare const posedTask: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ export declare const learnerAttempt: {
37
+ type: string;
38
+ description: string;
39
+ };
32
40
  export declare const evaluationTools: readonly Tool<unknown, unknown, DefaultState>[];
33
41
  export {};
@@ -221,10 +221,19 @@ export function* evaluateWatchedReply(ctx, message) {
221
221
  const spec = specification({ ...watch.payload.specification }, ctx);
222
222
  return yield* assess(ctx, spec, { message }, watch.id);
223
223
  }
224
+ export const posedTask = {
225
+ type: "string",
226
+ description: "The check as posed, verbatim. A question the learner asks alongside the answer is separate.",
227
+ };
228
+ export const learnerAttempt = {
229
+ type: "string",
230
+ description: "The learner's own words answering this check. Leave out any separate question they ask in the same send.",
231
+ };
224
232
  const specProperties = {
225
- task: { type: "string", minLength: 1 },
233
+ task: { ...posedTask, minLength: 1 },
226
234
  rubric: {
227
235
  type: "array",
236
+ description: "Criteria for the posed task alone.",
228
237
  minItems: 1,
229
238
  items: {
230
239
  type: "object",
@@ -288,12 +297,12 @@ export const evaluationTools = [
288
297
  },
289
298
  {
290
299
  name: "evaluation_judge",
291
- description: "Grade one response and record the verdict. Supply response text or a selected learner message identity for original media.",
300
+ description: "Grade one posed check and record the verdict. Supply the answer excerpt as response for text, or a selected learner message identity for original media.",
292
301
  schema: {
293
302
  type: "object",
294
303
  additionalProperties: false,
295
304
  required: specKeys,
296
- properties: { ...specProperties, response: { type: "string" }, message: { type: "string", minLength: 1 } },
305
+ properties: { ...specProperties, response: learnerAttempt, message: { type: "string", minLength: 1 } },
297
306
  oneOf: [
298
307
  {
299
308
  type: "object",
@@ -3,7 +3,7 @@ import { event } from "./event.js";
3
3
  import { isAttemptOutcome, isQuizOutcome } from "./outcomes.js";
4
4
  import { initDefaultState, isCompletionOutcome } from "./state.js";
5
5
  import { projectDefault } from "./tags.js";
6
- import { pathDefault } from "./path.js";
6
+ import { pathDefault, preparePathDefault } from "./path.js";
7
7
  import { progressDefault, estimateDefault, prepareEstimateDefault } from "./reading.js";
8
8
  /** The single default implementation assembly. */
9
9
  export declare const implementation: {
@@ -25,6 +25,7 @@ export declare const implementation: {
25
25
  estimate: typeof estimateDefault;
26
26
  prepareEstimate: typeof prepareEstimateDefault;
27
27
  path: typeof pathDefault;
28
+ preparePath: typeof preparePathDefault;
28
29
  describeObservation: typeof describeDefaultObservation;
29
30
  tags: readonly [...string[], "item-outcomes", "instability", "unused", "coarse", "lesson-split", "self-report", "edge-contradiction", "homeless"];
30
31
  outcomes: {
@@ -5,7 +5,7 @@ import { event } from "./event.js";
5
5
  import { isAttemptOutcome, isQuizOutcome } from "./outcomes.js";
6
6
  import { DEFAULT_THEORY_REF, initDefaultState, isCompletionOutcome } from "./state.js";
7
7
  import { defaultTags, projectDefault } from "./tags.js";
8
- import { pathDefault } from "./path.js";
8
+ import { pathDefault, preparePathDefault } from "./path.js";
9
9
  import { progressDefault, estimateDefault, prepareEstimateDefault } from "./reading.js";
10
10
  /** The single default implementation assembly. */
11
11
  export const implementation = {
@@ -18,6 +18,7 @@ export const implementation = {
18
18
  estimate: estimateDefault,
19
19
  prepareEstimate: prepareEstimateDefault,
20
20
  path: pathDefault,
21
+ preparePath: preparePathDefault,
21
22
  describeObservation: describeDefaultObservation,
22
23
  tags: defaultTags,
23
24
  outcomes: {
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export declare const defaultTheory: {
18
18
  estimate: typeof import("./reading.js").estimateDefault;
19
19
  prepareEstimate: typeof import("./reading.js").prepareEstimateDefault;
20
20
  path: typeof import("./path.js").pathDefault;
21
+ preparePath: typeof import("./path.js").preparePathDefault;
21
22
  describeObservation: typeof import("./history.js").describeDefaultObservation;
22
23
  tags: readonly [...string[], "item-outcomes", "instability", "unused", "coarse", "lesson-split", "self-report", "edge-contradiction", "homeless"];
23
24
  outcomes: {
package/dist/path.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type NodeId, type ResolvedGraph } from "@mmon-co/ncept-core/patch";
2
- import { type MissionPath, type MissionFuture, type PathContext } from "@mmon-co/ncept-core/theory";
2
+ import { type MissionPath, type MissionFuture, type PathContext, type PathInputs, type PathSelection } from "@mmon-co/ncept-core/theory";
3
+ import { type DefaultState } from "./state.js";
3
4
  import { type ReviewSchedule } from "./schedules.js";
4
5
  export { REVIEW_PROPERTY, validateReviewSchedule, type ReviewSchedule } from "./schedules.js";
5
6
  /** Default-theory authoring metadata, not Core graph vocabulary. */
@@ -14,8 +15,6 @@ export declare function nodePriority(graph: ResolvedGraph, node: NodeId): number
14
15
  * not by lesson, so a Node may be taught in more than one group.
15
16
  */
16
17
  export declare function teachingPath(graph: ResolvedGraph, targets: readonly NodeId[]): MissionPath;
17
- /** The syllabus stays addressable as progress changes; only the future is upcoming.
18
- * A trailing unnumbered review is maintenance; a review with numberOffset 1 blocks the
19
- * following teaching stop. A graph-wide reading has only maintenance, and no Mission.
20
- */
21
18
  export declare function pathDefault(context: PathContext): MissionFuture;
19
+ /** The graph and historical timing are independent of the Mission's targets and run. */
20
+ export declare function preparePathDefault(inputs: PathInputs, state?: DefaultState): (selection: PathSelection) => MissionFuture;
package/dist/path.js CHANGED
@@ -186,8 +186,7 @@ function ranked(nodes, context) {
186
186
  return [...nodes].sort((a, b) => rank(b) - rank(a) || a.localeCompare(b));
187
187
  }
188
188
  /** Nodes are indivisible: an over-budget first Node must still make progress. */
189
- function packed(candidates, context) {
190
- const estimate = prepareEstimateDefault(context);
189
+ function packed(candidates, context, estimate) {
191
190
  const nodes = [];
192
191
  for (const node of ranked(candidates, context)) {
193
192
  if (nodes.length &&
@@ -201,10 +200,9 @@ function packed(candidates, context) {
201
200
  * retrievability, so an unrounded analytic crossing would miss the first effective tick.
202
201
  * Rank changes are conservative: the order may survive one, but cannot change before it.
203
202
  */
204
- function pathValidity(context, scope) {
203
+ function pathValidity(context, scope, state) {
205
204
  const now = Date.parse(context.now);
206
205
  const boundaries = context.projection.validUntil === undefined ? [] : [Date.parse(context.projection.validUntil)];
207
- const state = stateDefault(context.graph, context.observations, context.now);
208
206
  const candidates = context.graph.nodes.flatMap(({ id }) => {
209
207
  const schedule = state.nodes[id]?.schedule;
210
208
  const rank = context.projection.nodes[id]?.find(({ tag }) => tag === "review:due")?.rank;
@@ -249,23 +247,32 @@ function pathValidity(context, scope) {
249
247
  const expiry = Math.min(...boundaries);
250
248
  return Number.isFinite(expiry) ? { validUntil: new Date(expiry).toISOString() } : {};
251
249
  }
250
+ export function pathDefault(context) {
251
+ return preparePathDefault(context)(context);
252
+ }
253
+ /** The graph and historical timing are independent of the Mission's targets and run. */
254
+ export function preparePathDefault(inputs, state) {
255
+ let estimate;
256
+ let tags;
257
+ const readState = () => (state ??= stateDefault(inputs.graph, inputs.observations, inputs.now));
258
+ return (selection) => readPath({ ...inputs, ...selection }, (tags ??= tagIndex(inputs.projection)), (estimate ??= prepareEstimateDefault(inputs)), readState);
259
+ }
252
260
  /** The syllabus stays addressable as progress changes; only the future is upcoming.
253
261
  * A trailing unnumbered review is maintenance; a review with numberOffset 1 blocks the
254
262
  * following teaching stop. A graph-wide reading has only maintenance, and no Mission.
255
263
  */
256
- export function pathDefault(context) {
264
+ function readPath(context, tags, estimate, readState) {
257
265
  if (context.retired?.outcome === "abandoned")
258
266
  return { sections: [], warnings: [], future: [] };
259
267
  const { graph, targets, projection } = context;
260
268
  const path = teachingPath(graph, targets ?? []);
261
- const tags = tagIndex(projection);
262
269
  const scope = targets === undefined
263
270
  ? new Set(graph.nodes.map(({ id }) => id))
264
271
  : new Set(path.sections.flatMap(({ lessons }) => lessons.flatMap(({ nodes }) => nodes)));
265
- const due = packed(graph.nodes.map(({ id }) => id).filter((id) => scope.has(id) && tags("review:due").has(id)), context);
272
+ const due = packed(graph.nodes.map(({ id }) => id).filter((id) => scope.has(id) && tags("review:due").has(id)), context, estimate);
266
273
  const maintenance = due.length ? [{ kind: "review", numbered: false, nodes: due }] : [];
267
274
  if (context.retired?.outcome === "achieved" || targets === undefined)
268
- return { ...path, ...pathValidity(context, scope), future: maintenance };
275
+ return { ...path, ...pathValidity(context, scope, readState()), future: maintenance };
269
276
  const progress = progressDefault(graph, projection, [...scope]);
270
277
  const next = path.sections
271
278
  .flatMap(({ lessons }) => lessons)
@@ -276,7 +283,7 @@ export function pathDefault(context) {
276
283
  }) ?? []);
277
284
  const fading = packed(graph.nodes
278
285
  .map(({ id }) => id)
279
- .filter((id) => cone.has(id) && !next?.nodes.includes(id) && tags("review:fading").has(id)), context);
286
+ .filter((id) => cone.has(id) && !next?.nodes.includes(id) && tags("review:fading").has(id)), context, estimate);
280
287
  const sections = path.sections.map((section) => ({
281
288
  ...section,
282
289
  lessons: section.lessons.flatMap((lesson) => lesson === next && fading.length
@@ -285,7 +292,7 @@ export function pathDefault(context) {
285
292
  }));
286
293
  return {
287
294
  ...path,
288
- ...pathValidity(context, scope),
295
+ ...pathValidity(context, scope, readState()),
289
296
  sections,
290
297
  future: [
291
298
  ...sections
package/dist/release.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const theoryContent = "6c049d0fff88f3c7c07156c23de1d5e18802ce8ecd58532a36e4be28dc76477c";
1
+ export declare const theoryContent = "814d0be3f30a2fa51d5599fd548c6f011ff0d797ba9ed56ab1940d02d151bea1";
package/dist/release.js CHANGED
@@ -1 +1 @@
1
- export const theoryContent = "6c049d0fff88f3c7c07156c23de1d5e18802ce8ecd58532a36e4be28dc76477c";
1
+ export const theoryContent = "814d0be3f30a2fa51d5599fd548c6f011ff0d797ba9ed56ab1940d02d151bea1";
package/dist/tools.js CHANGED
@@ -9,6 +9,7 @@ import { readMissionPath } from "@mmon-co/ncept-core/theory/path";
9
9
  import { pathDefault } from "./path.js";
10
10
  import { event, refinePendingHomes } from "./event.js";
11
11
  import { isAttemptOutcome } from "./outcomes.js";
12
+ import { learnerAttempt, posedTask } from "./evaluation.js";
12
13
  import { activeDefaultRecords, completionNodeRef, electedObservations, assertDefaultRetraction, emptyNodeMemory, interpretationsDefault, isClaim, isDefaultObservation, isDemonstration, isRetrievalOpenerDemonstration, isTeaching, memoryDefault, stateDefault, DEFAULT_THEORY_REF, } from "./state.js";
13
14
  import { defaultNodeState, defaultQueryTokens, indicatorsDefault, isDefaultKnown, isDefaultReviewable, isDefaultReviewDue, } from "./tags.js";
14
15
  const nodeProperty = { type: "string", pattern: "^node-.+" };
@@ -514,7 +515,7 @@ const recordDemonstration = {
514
515
  name: "record_demonstration",
515
516
  description: [
516
517
  "Record one attempted posed check: a posed task with a determinable outcome and an attempt. Reading, explanation, a remark in passing, dialogue is not one. An explicit I don’t know response to a posed task is a dont-know demonstration; closing without answering is not.",
517
- "Use it for a free response, a requested Artifact section, an observed step, or an explicitly posed conversational check. Preserve task and response verbatim; grade success/failure with grader tutor. For a lesson-opening retrieval prompt, use record_retrieval_opener instead.",
518
+ "Use it for a free response, a requested Artifact section, an observed step, or an explicitly posed conversational check. Preserve the posed task and answer excerpt verbatim, including when grading directly after a judge error; grade success/failure with grader tutor. For a lesson-opening retrieval prompt, use record_retrieval_opener instead.",
518
519
  "Decide unaided when posing: the task must be at least as demanding as the Node's capability statement in every respect. Hints, candidates on a production capability, a missing required clock, or tools on a no-tool task make it aided. Help before outcome makes it aided; the completion after help is not a second attempt.",
519
520
  "For an answer to a Material item, use record_material_attempt. A runner records its own outcome; correct a wrong runner grade with evaluation_override and a reason. An option's optional error string remains verbatim in the response.",
520
521
  "Never infer prerequisite failures. Record a prerequisite only if its own posed step was attempted; the label query accounts for structural evidence.",
@@ -524,8 +525,8 @@ const recordDemonstration = {
524
525
  outcome: { enum: ["success", "failure", "dont-know"] },
525
526
  unaided: { type: "boolean" },
526
527
  grader: { enum: ["mechanical", "tutor", "learner"] },
527
- task: { type: "string" },
528
- response: { type: "string" },
528
+ task: posedTask,
529
+ response: learnerAttempt,
529
530
  }, ["node", "outcome", "unaided", "grader"]),
530
531
  *run(raw, ctx) {
531
532
  const input = args(raw, ["node", "outcome", "unaided", "grader", "task", "response"], ["node", "outcome", "unaided", "grader"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmon-co/ncept-default-theory",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "license": "FSL-1.1-ALv2",
5
5
  "repository": {
6
6
  "type": "git",