@mmon-co/ncept-core 0.1.0 → 0.2.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.
@@ -11,6 +11,8 @@ export declare function isNodeId(value: unknown): value is NodeId;
11
11
  export declare function revisionDigest(content: PatchContent): ContentDigest;
12
12
  export declare function candidateRevision(identity: PatchId, content: PatchContent): PatchRevision;
13
13
  export declare function revisionContent(revision: PatchRevision): PatchContent;
14
+ /** The closure of a Notebook revision, with its direct bindings selecting the resolved bases. */
15
+ export declare function notebookBundleForRevision(ref: ExactPatchRef, contents: ReadonlyMap<ContentDigest, PatchContent>): ClosedPatchBundle;
14
16
  /** Compute and verify the exact transitive closure from host-supplied content only. */
15
17
  export declare function bundleForRevision(terminal: ExactPatchRef, contents: ReadonlyMap<ContentDigest, PatchContent>, selection?: ReadonlyMap<PatchId, ExactPatchRef>): ClosedPatchBundle;
16
18
  export declare function lessonOperations(input: {
@@ -32,6 +32,13 @@ export function candidateRevision(identity, content) {
32
32
  export function revisionContent(revision) {
33
33
  return { bases: revision.bases, delta: revision.delta, metadata: revision.metadata };
34
34
  }
35
+ /** The closure of a Notebook revision, with its direct bindings selecting the resolved bases. */
36
+ export function notebookBundleForRevision(ref, contents) {
37
+ const content = contents.get(ref.digest);
38
+ if (!content)
39
+ throw new Error("Notebook content unavailable");
40
+ return bundleForRevision(ref, contents, new Map(content.bases.map((base) => [base.identity, base])));
41
+ }
35
42
  /** Compute and verify the exact transitive closure from host-supplied content only. */
36
43
  export function bundleForRevision(terminal, contents, selection) {
37
44
  const revisions = new Map();
@@ -23,6 +23,8 @@ export declare function resolveVariantStack(source: ClosedPatchBundle, variants:
23
23
  export declare function resolvePatchBundleWithVariants(notebook: ClosedPatchBundle, layers: readonly PatchVariantLayer[], availablePlaygrounds?: ReadonlySet<string>, selection?: ReadonlyMap<PatchId, ExactPatchRef>): VariantResolution;
24
24
  /** Resolve one adopted source's read-time variant. */
25
25
  export declare function resolvePatchBundleWithVariant(notebook: ClosedPatchBundle, source: ClosedPatchBundle, variant: ClosedPatchBundle, sourceVersion: string, availablePlaygrounds?: ReadonlySet<string>): VariantResolution;
26
+ /** Direct Notebook bindings select resolution without rewriting authored history. */
27
+ export declare function notebookSelection(bundle: ClosedPatchBundle): ReadonlyMap<PatchId, ExactPatchRef>;
26
28
  /** Resolve selected base identities at the host's chosen exact revisions. The bundle
27
29
  * must include each reached selection; authored revisions may remain as unused history. */
28
30
  export declare function resolvePatchBundle(bundle: ClosedPatchBundle, availablePlaygrounds?: ReadonlySet<string>, selection?: ReadonlyMap<PatchId, ExactPatchRef>): ResolvedGraph;
@@ -407,6 +407,13 @@ function mergeMetadataProperties(contributions, maskedProperties) {
407
407
  }
408
408
  return { properties, provenance };
409
409
  }
410
+ /** Direct Notebook bindings select resolution without rewriting authored history. */
411
+ export function notebookSelection(bundle) {
412
+ const terminal = bundle.revisions.find(({ ref }) => sameExactPatchRef(ref, bundle.terminal));
413
+ if (!terminal)
414
+ throw new Error("Notebook terminal unavailable");
415
+ return new Map(terminal.bases.map((ref) => [ref.identity, ref]));
416
+ }
410
417
  /** Resolve selected base identities at the host's chosen exact revisions. The bundle
411
418
  * must include each reached selection; authored revisions may remain as unused history. */
412
419
  export function resolvePatchBundle(bundle, availablePlaygrounds, selection) {
@@ -1,5 +1,5 @@
1
1
  import { tryParse } from "std-semver";
2
- import { candidateRevision, exactPatchRefKey, resolvePatchBundle, revisionContent, revisionDigest, } from "../patch/index.js";
2
+ import { candidateRevision, exactPatchRefKey, notebookSelection, resolvePatchBundle, revisionContent, revisionDigest, } from "../patch/index.js";
3
3
  /**
4
4
  * Compose pure Patch rewrites from a release's Theory range to the installed Theory.
5
5
  * Refuse an invalid path before executing any step. The caller mints a new revision
@@ -91,5 +91,5 @@ function validateLiveBundle(profile) {
91
91
  throw new Error(`Theory migration Patch content does not match ${revision.ref.identity}@${revision.ref.digest}`);
92
92
  }
93
93
  // Resolution checks the exact closure, including duplicate/unused revisions and base conflicts.
94
- resolvePatchBundle(profile.patches);
94
+ resolvePatchBundle(profile.patches, undefined, notebookSelection(profile.patches));
95
95
  }
@@ -104,6 +104,8 @@ export interface LessonActivity {
104
104
  /** Related Material surfaces owned by the same Session. */
105
105
  readonly relatedSurfaces?: readonly string[];
106
106
  }
107
+ /** Measurement before the host has assembled its complete related membership. */
108
+ export type LessonActivityHeader = Omit<LessonActivity, "relatedSurfaces">;
107
109
  export type NodeProgress = Readonly<{
108
110
  status: "done" | "tentative" | "open";
109
111
  /** Latest effective self-report, independently of acquisition status. */
@@ -219,6 +221,10 @@ export type ChatContext<S> = Context<S> & Readonly<{
219
221
  unscopedNodes?: readonly NodeId[];
220
222
  /** Tutor text on the current conversation branch, before this turn; not recorded evidence. */
221
223
  tutorMessages?: readonly string[];
224
+ /** Present for a tutor-led opening, before any speech in this Session. */
225
+ opening?: Readonly<{
226
+ latestLearnerMessage?: string;
227
+ }>;
222
228
  /** Evidence accepted in this Session, including its Material surfaces. */
223
229
  sessionObservations?: readonly ObservationId[];
224
230
  missions?: readonly MissionContext[];
@@ -290,6 +296,10 @@ export interface Theory<S, Outcomes extends Record<string, unknown> = Record<str
290
296
  /** A host-proven learner message identity, before preparing the next tutor turn. */
291
297
  reply?(ctx: ChatContext<S>, message: string): Program<unknown>;
292
298
  };
299
+ /** Pure declaration over the accepted event alone: true means event would emit no work.
300
+ * Omission keeps contextual delivery. Hosts may settle consecutive declared-empty hooks together.
301
+ */
302
+ noEventHook?(event: PlatformEvent): boolean;
293
303
  event(event: PlatformEvent, ctx: Context<S>): Program<void>;
294
304
  }
295
305
  /** The pure state operation, derived from the theory's defining reducer. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmon-co/ncept-core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,6 @@
48
48
  }
49
49
  },
50
50
  "scripts": {
51
- "fixture:theory-migration": "bun scripts/theory-migration-fixture.ts",
52
51
  "build": "tsc -p tsconfig.build.json",
53
52
  "prepack": "bun run build"
54
53
  },