@mmon-co/ncept-default-theory 3.0.12 → 3.0.14

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/chat.d.ts CHANGED
@@ -14,6 +14,11 @@ type Recommendation = ProductDocument & {
14
14
  readonly raiseWhen: string;
15
15
  readonly documentUrl: string;
16
16
  };
17
+ /** Only an unambiguous official title can identify the intended link. */
18
+ export declare function officialDocumentLinks(ctx: ChatContext<DefaultState>): Map<string, {
19
+ url: string;
20
+ materialUrl: string;
21
+ }>;
17
22
  export declare function documentListing(ctx: ChatContext<DefaultState>): {
18
23
  documents: ProductDocument[];
19
24
  candidates: Recommendation[];
package/dist/chat.js CHANGED
@@ -82,6 +82,22 @@ function recommendableAffordances(ctx, documents) {
82
82
  return [{ ...document, raiseWhen, documentUrl }];
83
83
  });
84
84
  }
85
+ /** Only an unambiguous official title can identify the intended link. */
86
+ export function officialDocumentLinks(ctx) {
87
+ const links = new Map();
88
+ const seen = new Set();
89
+ for (const { node, label, documentId } of officialDocuments(ctx)) {
90
+ if (seen.has(label)) {
91
+ links.delete(label);
92
+ continue;
93
+ }
94
+ seen.add(label);
95
+ const url = docsUrl(ctx, node);
96
+ if (url)
97
+ links.set(label, { url, materialUrl: "/ncept/playgrounds/document?material=" + documentId });
98
+ }
99
+ return links;
100
+ }
85
101
  export function documentListing(ctx) {
86
102
  const documents = officialDocuments(ctx);
87
103
  return { documents, candidates: recommendableAffordances(ctx, documents) };
@@ -143,7 +159,8 @@ function* setup(ctx, mode) {
143
159
  if (!ctx.graph.nodes.some(({ id }) => id === node))
144
160
  throw new Error(`Missing Node ${node}`);
145
161
  const prompt = tutorSystemPrompt(mode);
146
- const offered = linkedDocuments(ctx, officialDocuments(ctx), ctx.tutorMessages ?? []);
162
+ const { documents, candidates } = documentListing(ctx);
163
+ const offered = linkedDocuments(ctx, documents, ctx.tutorMessages ?? []);
147
164
  const entry = ctx.entry;
148
165
  const intervalNodes = entry?.kind === "review"
149
166
  ? entry.nodes.filter((node) => nodeReviewSchedule(ctx.graph, node).kind === "interval")
@@ -153,11 +170,12 @@ function* setup(ctx, mode) {
153
170
  context: [
154
171
  ...evaluationContext(ctx),
155
172
  tutorOpening(ctx),
156
- ...(offered.length
157
- ? [
158
- `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.`,
159
- ]
160
- : []),
173
+ offered.length
174
+ ? `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.`
175
+ : !ctx.opening && candidates.length
176
+ ? "If the learner's current message matches a cue, briefly link its guide alongside the answer:\n" +
177
+ candidates.map(({ raiseWhen, label, documentUrl }) => `${raiseWhen} [${label}](${documentUrl})`).join("\n")
178
+ : undefined,
161
179
  ctx.about.length
162
180
  ? `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)"}`
163
181
  : "This Session is attached to no Nodes; name Nodes explicitly where a tool needs them.",
package/dist/release.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const theoryContent = "922d7ffb3c3f3e6b626b32d62e008d20a427e222a12489ebeef02132349bd1ad";
1
+ export declare const theoryContent = "fb917e7d1b5c0084e6743cd20d696f0d74bd67457eeaa1b9f6f2ee596de9e890";
package/dist/release.js CHANGED
@@ -1 +1 @@
1
- export const theoryContent = "922d7ffb3c3f3e6b626b32d62e008d20a427e222a12489ebeef02132349bd1ad";
1
+ export const theoryContent = "fb917e7d1b5c0084e6743cd20d696f0d74bd67457eeaa1b9f6f2ee596de9e890";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmon-co/ncept-default-theory",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "license": "FSL-1.1-ALv2",
5
5
  "repository": {
6
6
  "type": "git",