dsh-diagnostic-tutor 0.1.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +658 -0
  3. package/cordis.patch.yml +23 -0
  4. package/lib/api.js +413 -0
  5. package/lib/api.js.map +1 -0
  6. package/lib/client.js +2029 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/contract.js +14 -0
  9. package/lib/contract.js.map +1 -0
  10. package/lib/diagnosis.js +224 -0
  11. package/lib/diagnosis.js.map +1 -0
  12. package/lib/handoff.js +194 -0
  13. package/lib/handoff.js.map +1 -0
  14. package/lib/index.js +186 -0
  15. package/lib/index.js.map +1 -0
  16. package/lib/lesson.js +285 -0
  17. package/lib/lesson.js.map +1 -0
  18. package/lib/prompt.js +96 -0
  19. package/lib/prompt.js.map +1 -0
  20. package/lib/state.js +500 -0
  21. package/lib/state.js.map +1 -0
  22. package/lib/tools.js +994 -0
  23. package/lib/tools.js.map +1 -0
  24. package/lib/trust-fence.js +101 -0
  25. package/lib/trust-fence.js.map +1 -0
  26. package/lib/types/api.d.ts +62 -0
  27. package/lib/types/api.d.ts.map +1 -0
  28. package/lib/types/contract.d.ts +147 -0
  29. package/lib/types/contract.d.ts.map +1 -0
  30. package/lib/types/diagnosis.d.ts +116 -0
  31. package/lib/types/diagnosis.d.ts.map +1 -0
  32. package/lib/types/handoff.d.ts +141 -0
  33. package/lib/types/handoff.d.ts.map +1 -0
  34. package/lib/types/index.d.ts +71 -0
  35. package/lib/types/index.d.ts.map +1 -0
  36. package/lib/types/lesson.d.ts +295 -0
  37. package/lib/types/lesson.d.ts.map +1 -0
  38. package/lib/types/prompt.d.ts +85 -0
  39. package/lib/types/prompt.d.ts.map +1 -0
  40. package/lib/types/state.d.ts +627 -0
  41. package/lib/types/state.d.ts.map +1 -0
  42. package/lib/types/tools.d.ts +38 -0
  43. package/lib/types/tools.d.ts.map +1 -0
  44. package/lib/types/trust-fence.d.ts +53 -0
  45. package/lib/types/trust-fence.d.ts.map +1 -0
  46. package/lib/types/udt.d.ts +95 -0
  47. package/lib/types/udt.d.ts.map +1 -0
  48. package/lib/types/vocabulary.d.ts +162 -0
  49. package/lib/types/vocabulary.d.ts.map +1 -0
  50. package/lib/udt.js +141 -0
  51. package/lib/udt.js.map +1 -0
  52. package/lib/vocabulary.js +182 -0
  53. package/lib/vocabulary.js.map +1 -0
  54. package/package.json +104 -0
package/lib/state.js ADDED
@@ -0,0 +1,500 @@
1
+ /**
2
+ * The persistence contract for dsh-diagnostic-tutor.
3
+ *
4
+ * This module owns one Cordis **storage domain** — the official DSH
5
+ * persistence seam — and nothing else. It contains no teaching logic: it
6
+ * stores what was observed, never what should happen next.
7
+ *
8
+ * Why a storage domain rather than files of our own:
9
+ * - it is the supported seam; the profile routes it to a backend (the
10
+ * standard profiles use `dsh-storage-json` under `dshHomePath('storages')`);
11
+ * - **the zod schema is the contract** — every record is validated at the
12
+ * durable boundary, so corrupt or hand-edited data cannot enter memory;
13
+ * - reads are synchronous from memory and writes ride one per-domain write
14
+ * chain, so concurrent writers cannot interleave;
15
+ * - unmounting is clean: `Domain.close()` releases the backend unit.
16
+ *
17
+ * ---------------------------------------------------------------------------
18
+ * A refinement of the cross-version discipline (verified against source)
19
+ * ---------------------------------------------------------------------------
20
+ * The rule "import `@deepseek-ai/*` as types only" is about **stateful
21
+ * objects** — services, classes, instances. A second harness cohort must never
22
+ * supply those, because identity checks and `instanceof` would silently fail.
23
+ *
24
+ * `defineDomain` and `domainTable` are a different category: **pure builder
25
+ * functions**. `domainTable(schema)` is literally `{ valueSchema: schema }`,
26
+ * and `defineDomain(spec)` validates a spec and returns it unchanged. They
27
+ * take plain data and return plain data, carry no identity, and are re-exported
28
+ * by the host for exactly this use — the same pattern every published DSH
29
+ * plugin follows.
30
+ *
31
+ * The rules that still hold absolutely: never `instanceof` a returned object,
32
+ * and take every service instance (`DomainFacility`, `Domain`, tables) from
33
+ * `ctx`. Here `DomainFacility` is imported as a **type**, and the `Domain` we
34
+ * use is whatever the host's facility handed back.
35
+ */
36
+ import { defineDomain, domainTable } from '@deepseek-ai/dsh-storage-domain';
37
+ import { z } from 'zod';
38
+ import { endsFocus } from './vocabulary.js';
39
+ import { EvidenceKindSchema, INITIAL_NODE_STATE, NodeRelationSchema, NodeStateSchema, ReadinessSchema, TeachingModeSchema, } from './vocabulary.js';
40
+ import { LessonSchema } from './lesson.js';
41
+ import { HandoffSchema } from './handoff.js';
42
+ /* -------------------------------------------------------------------------- */
43
+ /* Records */
44
+ /* -------------------------------------------------------------------------- */
45
+ /**
46
+ * The learner singleton. Stored in the domain's **global** slot rather than a
47
+ * one-row table, because the global slot exists precisely for a single
48
+ * document and its `initial` value gives a well-defined "never written" state.
49
+ *
50
+ * `initializedAt` is the sentinel that distinguishes "the stored profile" from
51
+ * "the spec's default": it is the empty string until the first write, which is
52
+ * what makes first-run initialization idempotent and restart-detectable.
53
+ *
54
+ * Note there is no field for proficiency, level or score. Preferences only.
55
+ */
56
+ export const LearnerProfileSchema = z.object({
57
+ preferredLanguage: z.string().min(1).optional(),
58
+ mode: TeachingModeSchema.optional(),
59
+ activeCourseId: z.string().min(1).optional(),
60
+ initializedAt: z.string(),
61
+ updatedAt: z.string(),
62
+ });
63
+ /** Lifecycle of a learning goal. Not a mastery status. */
64
+ export const COURSE_STATUSES = ['active', 'paused', 'archived'];
65
+ export const CourseStatusSchema = z.enum(COURSE_STATUSES);
66
+ /**
67
+ * A learning goal in the learner's own words.
68
+ *
69
+ * `goal` is the verbatim statement that started the course; `title` is a short
70
+ * label for display. Neither is ever auto-expanded into a syllabus.
71
+ */
72
+ export const CourseSchema = z.object({
73
+ id: z.string().min(1),
74
+ title: z.string().min(1),
75
+ goal: z.string().min(1),
76
+ status: CourseStatusSchema,
77
+ createdAt: z.string(),
78
+ updatedAt: z.string(),
79
+ });
80
+ /**
81
+ * One observation attached to a node.
82
+ *
83
+ * Evidence records *what happened*, never how good it was. There is no score,
84
+ * no weight and no correctness flag — a `readiness` outcome is the skill's own
85
+ * six-term vocabulary, and it is optional because not every observation rises
86
+ * to a readiness judgement.
87
+ */
88
+ export const EvidenceSchema = z.object({
89
+ kind: EvidenceKindSchema,
90
+ at: z.string(),
91
+ note: z.string().min(1).optional(),
92
+ readiness: ReadinessSchema.optional(),
93
+ });
94
+ /**
95
+ * One node of the diagnosis map.
96
+ *
97
+ * Nodes are born `unconfirmed` and stay that way until evidence supports
98
+ * something else; see `diagnosis.ts` for the transition rules. There is no
99
+ * `progress`, no `weight`, no `order` and no `dueAt`: nothing here describes a
100
+ * schedule or a completion percentage, because the map is not a syllabus.
101
+ */
102
+ export const NodeSchema = z.object({
103
+ id: z.string().min(1),
104
+ courseId: z.string().min(1),
105
+ title: z.string().min(1),
106
+ /** Absent only for the course's single `goal` node. */
107
+ parentId: z.string().min(1).optional(),
108
+ relation: NodeRelationSchema,
109
+ state: NodeStateSchema,
110
+ evidence: z.array(EvidenceSchema),
111
+ createdAt: z.string(),
112
+ updatedAt: z.string(),
113
+ });
114
+ /**
115
+ * The one node being learned right now, per course.
116
+ *
117
+ * This is what makes "Start learning" an explicit act rather than an implicit
118
+ * one: the runtime records which node the learner asked to work on and when,
119
+ * and both the tutor and the panel read it from here instead of guessing.
120
+ *
121
+ * There is deliberately no `progress` field. A focus is a pointer, not a
122
+ * measure; how far along the learner is lives in the node's state and evidence.
123
+ */
124
+ export const FOCUS_STATUSES = ['active', 'ended'];
125
+ export const FocusStatusSchema = z.enum(FOCUS_STATUSES);
126
+ export const FocusSchema = z.object({
127
+ courseId: z.string().min(1),
128
+ nodeId: z.string().min(1),
129
+ startedAt: z.string(),
130
+ status: FocusStatusSchema,
131
+ updatedAt: z.string(),
132
+ /** Set when the status becomes `ended`; absent while the focus is active. */
133
+ endedAt: z.string().optional(),
134
+ /** The recommendation produced when this focus ended. */
135
+ nextStepId: z.string().optional(),
136
+ });
137
+ /**
138
+ * The tutor's decision about where the learner should go after this node.
139
+ *
140
+ * `action` is one of the skill's six readiness outcomes, reused rather than
141
+ * re-invented: the words for "what this concept showed" and "where that sends
142
+ * the learner" are the same words. See `vocabulary.ts` for what each one
143
+ * implies about a target.
144
+ *
145
+ * `targetNodeId` absent means **stay here**. That is the only encoding of
146
+ * "stay" — a named target is always a move — so the runtime never has to guess
147
+ * what a decision meant.
148
+ *
149
+ * `reason` is required and is written for the learner: the panel shows it
150
+ * verbatim, which is what makes the recommendation explicable instead of
151
+ * mysterious.
152
+ */
153
+ export const NextStepSchema = z.object({
154
+ /** Keyed by `fromNodeId`: the latest decision made on leaving that node. */
155
+ fromNodeId: z.string().min(1),
156
+ courseId: z.string().min(1),
157
+ action: ReadinessSchema,
158
+ targetNodeId: z.string().min(1).optional(),
159
+ reason: z.string().min(1),
160
+ createdAt: z.string(),
161
+ });
162
+ /**
163
+ * Identifies the document, so a file found on a disk years later explains
164
+ * itself without this project having to be installed.
165
+ */
166
+ export const EXPORT_FORMAT = 'dsh-diagnostic-tutor/state';
167
+ export const EXPORT_VERSION = 1;
168
+ /* -------------------------------------------------------------------------- */
169
+ /* Domain declaration */
170
+ /* -------------------------------------------------------------------------- */
171
+ /** Domain name. Must match the storage hub's `UNIT_NAME_RE` (`^[a-z][a-z0-9_]*$`). */
172
+ export const UDT_DOMAIN_NAME = 'udt';
173
+ /**
174
+ * Still 1, and that is a deliberate finding rather than an oversight.
175
+ *
176
+ * v0.0.3 added the `nodes` table. That is **additive**: a v1 document simply
177
+ * has no `nodes` map, and the facility builds its table set from the spec, so
178
+ * an old document opens with an empty map.
179
+ *
180
+ * The version must NOT be bumped for an additive change, because the `single`
181
+ * layout enforces it strictly: `dsh-storage-json`'s `openSingleUnit` rejects a
182
+ * document whose stamped version differs from the spec before any compatibility
183
+ * list is consulted (`StorageError: unit 'udt': stored version 1 != expected 2`,
184
+ * `code: 'version-mismatch'`). `compatibleVersions` is honoured by `per-record`
185
+ * backends only. Bumping here would make every existing store unopenable —
186
+ * an outage in exchange for nothing.
187
+ *
188
+ * So: bump this only when a stored *record* can no longer be read as-is, and
189
+ * ship a migration in the same release.
190
+ */
191
+ export const UDT_DOMAIN_VERSION = 1;
192
+ export const COURSES_TABLE = 'courses';
193
+ export const NODES_TABLE = 'nodes';
194
+ export const LESSONS_TABLE = 'lessons';
195
+ export const FOCUS_TABLE = 'focus';
196
+ export const NEXT_STEPS_TABLE = 'next_steps';
197
+ export const HANDOFFS_TABLE = 'handoffs';
198
+ /** Sentinel meaning "the global slot has never been written". */
199
+ export const UNINITIALIZED = '';
200
+ export const udtDomain = defineDomain({
201
+ name: UDT_DOMAIN_NAME,
202
+ version: UDT_DOMAIN_VERSION,
203
+ // Storage architecture is FROZEN for v0.1.0: `single` layout, no per-record,
204
+ // no id migration. One `udt.json` holding every record is what the learner
205
+ // can read, copy and export.
206
+ //
207
+ // `invalidRecords: 'backup-and-skip'` was declared here and deliberately
208
+ // removed. The platform only honours it when the store can move a per-record
209
+ // document aside, so under this layout it never ran — a declaration that
210
+ // reads like a recovery guarantee while doing nothing. What is true instead:
211
+ // a damaged record fails the open, is reported with its table and key, is
212
+ // **not deleted**, and the plugin loads inert rather than failing the
213
+ // profile. `GET /export` on a healthy store is how you keep a copy. See the
214
+ // storage section of the README, which states the same limit.
215
+ global: {
216
+ schema: LearnerProfileSchema,
217
+ initial: { initializedAt: UNINITIALIZED, updatedAt: UNINITIALIZED },
218
+ },
219
+ tables: {
220
+ [COURSES_TABLE]: domainTable(CourseSchema),
221
+ [NODES_TABLE]: domainTable(NodeSchema),
222
+ [LESSONS_TABLE]: domainTable(LessonSchema),
223
+ // Keyed by course, so a course has at most one focus and starting a new
224
+ // one is an upsert rather than an accumulation.
225
+ [FOCUS_TABLE]: domainTable(FocusSchema),
226
+ [NEXT_STEPS_TABLE]: domainTable(NextStepSchema),
227
+ // Keyed by target node, which is what makes "press Continue twice" one
228
+ // handoff rather than two.
229
+ [HANDOFFS_TABLE]: domainTable(HandoffSchema),
230
+ },
231
+ });
232
+ /**
233
+ * Build a fresh node in its born state.
234
+ *
235
+ * Kept here rather than in the tool layer so the "nothing is born confirmed"
236
+ * rule has exactly one implementation.
237
+ *
238
+ * @param input - the fields the caller supplies.
239
+ * @returns a complete, valid record.
240
+ */
241
+ export function newNode(input) {
242
+ const record = {
243
+ id: input.id,
244
+ courseId: input.courseId,
245
+ title: input.title,
246
+ relation: input.relation,
247
+ state: input.state ?? INITIAL_NODE_STATE,
248
+ evidence: input.evidence ?? [],
249
+ createdAt: input.now,
250
+ updatedAt: input.now,
251
+ };
252
+ if (input.parentId !== undefined)
253
+ record.parentId = input.parentId;
254
+ return record;
255
+ }
256
+ /**
257
+ * Open the plugin's domain over the host's facility.
258
+ *
259
+ * The caller owns the returned handle and must `close()` it — see `apply`,
260
+ * which does so from a `ctx.effect` disposer so an unload leaves no residue.
261
+ *
262
+ * @param facility - the `storageDomain` service taken from `ctx`.
263
+ * @returns the open handle.
264
+ */
265
+ export async function openUdState(facility) {
266
+ const domain = await facility.open(udtDomain);
267
+ const courses = domain.table(COURSES_TABLE);
268
+ const nodes = domain.table(NODES_TABLE);
269
+ const lessons = domain.table(LESSONS_TABLE);
270
+ const focus = domain.table(FOCUS_TABLE);
271
+ const nextSteps = domain.table(NEXT_STEPS_TABLE);
272
+ const handoffs = domain.table(HANDOFFS_TABLE);
273
+ const learner = domain.global;
274
+ const listNodesFor = (courseId) => [...nodes.entries()].map(([, record]) => record).filter((record) => record.courseId === courseId);
275
+ return {
276
+ name: domain.name,
277
+ version: UDT_DOMAIN_VERSION,
278
+ readLearner: () => learner.get(),
279
+ isInitialized: () => learner.get().initializedAt !== UNINITIALIZED,
280
+ async ensureLearner(now) {
281
+ const current = learner.get();
282
+ if (current.initializedAt !== UNINITIALIZED)
283
+ return current;
284
+ const initialized = { initializedAt: now, updatedAt: now };
285
+ await learner.set(initialized);
286
+ return initialized;
287
+ },
288
+ async updateLearner(patch, now) {
289
+ const current = learner.get();
290
+ // Preserve the original initialization marker; only the first write sets it.
291
+ const next = {
292
+ ...current,
293
+ ...patch,
294
+ initializedAt: current.initializedAt || now,
295
+ updatedAt: now,
296
+ };
297
+ await learner.set(next);
298
+ return next;
299
+ },
300
+ listCourses: () => [...courses.entries()].map(([, record]) => record),
301
+ readCourse: (id) => courses.get(id),
302
+ async writeCourse(record) {
303
+ await courses.put(record.id, record);
304
+ return record;
305
+ },
306
+ async activateCourse(courseId, now) {
307
+ const target = courses.get(courseId);
308
+ if (!target)
309
+ throw new Error(`no course "${courseId}"`);
310
+ // Pause whatever was in focus, then promote the target. Both writes ride
311
+ // the domain's single chain, so a reader never sees two active goals.
312
+ for (const [key, record] of [...courses.entries()]) {
313
+ if (key === courseId || record.status !== 'active')
314
+ continue;
315
+ await courses.put(key, { ...record, status: 'paused', updatedAt: now });
316
+ }
317
+ const activated = { ...target, status: 'active', updatedAt: now };
318
+ await courses.put(courseId, activated);
319
+ await learner.set({ ...learner.get(), activeCourseId: courseId, updatedAt: now });
320
+ return activated;
321
+ },
322
+ listNodes: listNodesFor,
323
+ readNode: (id) => nodes.get(id),
324
+ async writeNode(record) {
325
+ await nodes.put(record.id, record);
326
+ return record;
327
+ },
328
+ nodeCount: () => nodes.size,
329
+ readMap(courseId) {
330
+ const course = courses.get(courseId);
331
+ if (!course)
332
+ return undefined;
333
+ return { course, nodes: listNodesFor(courseId) };
334
+ },
335
+ readFocus: (courseId) => focus.get(courseId),
336
+ async startFocus(courseId, nodeId, now) {
337
+ const course = courses.get(courseId);
338
+ if (!course)
339
+ throw new Error(`no course "${courseId}"`);
340
+ const node = nodes.get(nodeId);
341
+ if (!node)
342
+ throw new Error(`no node "${nodeId}"`);
343
+ if (node.courseId !== courseId) {
344
+ throw new Error(`node "${nodeId}" belongs to course "${node.courseId}", not "${courseId}"`);
345
+ }
346
+ const record = { courseId, nodeId, startedAt: now, status: 'active', updatedAt: now };
347
+ await focus.put(courseId, record);
348
+ return record;
349
+ },
350
+ async endFocus(courseId, now) {
351
+ const current = focus.get(courseId);
352
+ if (!current || current.status === 'ended')
353
+ return;
354
+ await focus.put(courseId, { ...current, status: 'ended', endedAt: now, updatedAt: now });
355
+ },
356
+ async decideNext(input) {
357
+ const course = courses.get(input.courseId);
358
+ if (!course)
359
+ throw new Error(`no course "${input.courseId}"`);
360
+ const from = nodes.get(input.fromNodeId);
361
+ if (!from)
362
+ throw new Error(`no node "${input.fromNodeId}"`);
363
+ if (from.courseId !== input.courseId) {
364
+ throw new Error(`node "${input.fromNodeId}" belongs to course "${from.courseId}"`);
365
+ }
366
+ if (input.targetNodeId !== undefined) {
367
+ const target = nodes.get(input.targetNodeId);
368
+ if (!target)
369
+ throw new Error(`no node "${input.targetNodeId}"`);
370
+ if (target.courseId !== input.courseId) {
371
+ throw new Error(`node "${input.targetNodeId}" belongs to course "${target.courseId}"`);
372
+ }
373
+ if (input.targetNodeId === input.fromNodeId) {
374
+ throw new Error('a target node equal to the current one is a stay: omit targetNodeId');
375
+ }
376
+ }
377
+ const nextStep = {
378
+ fromNodeId: input.fromNodeId,
379
+ courseId: input.courseId,
380
+ action: input.action,
381
+ reason: input.reason,
382
+ createdAt: input.now,
383
+ ...(input.targetNodeId === undefined ? {} : { targetNodeId: input.targetNodeId }),
384
+ };
385
+ await nextSteps.put(input.fromNodeId, nextStep);
386
+ // A move ends the focus; staying keeps it, because the learner has not
387
+ // moved and the panel must not say they have.
388
+ const moves = endsFocus(input.action, input.targetNodeId !== undefined);
389
+ const current = focus.get(input.courseId) ?? {
390
+ courseId: input.courseId,
391
+ nodeId: input.fromNodeId,
392
+ startedAt: input.now,
393
+ status: 'active',
394
+ updatedAt: input.now,
395
+ };
396
+ const nextFocus = moves
397
+ ? {
398
+ ...current,
399
+ status: 'ended',
400
+ endedAt: input.now,
401
+ nextStepId: input.fromNodeId,
402
+ updatedAt: input.now,
403
+ }
404
+ : { ...current, status: 'active', nextStepId: input.fromNodeId, updatedAt: input.now };
405
+ await focus.put(input.courseId, nextFocus);
406
+ return { nextStep, focus: nextFocus };
407
+ },
408
+ latestNextStep(courseId) {
409
+ return [...nextSteps.entries()]
410
+ .map(([, record]) => record)
411
+ .filter((record) => record.courseId === courseId)
412
+ .sort((left, right) => right.createdAt.localeCompare(left.createdAt))[0];
413
+ },
414
+ readNextStep: (id) => nextSteps.get(id),
415
+ listNextSteps: () => [...nextSteps.entries()].map(([, record]) => record),
416
+ listLessons: () => [...lessons.entries()].map(([, record]) => record),
417
+ listFocus: () => [...focus.entries()].map(([, record]) => record),
418
+ exportState(now) {
419
+ return {
420
+ format: EXPORT_FORMAT,
421
+ version: EXPORT_VERSION,
422
+ exportedAt: now,
423
+ domain: { name: domain.name, version: EXPORT_VERSION },
424
+ learner: learner.get(),
425
+ courses: [...courses.entries()].map(([, record]) => record),
426
+ nodes: [...nodes.entries()].map(([, record]) => record),
427
+ lessons: [...lessons.entries()].map(([, record]) => record),
428
+ nextSteps: [...nextSteps.entries()].map(([, record]) => record),
429
+ focus: [...focus.entries()].map(([, record]) => record),
430
+ };
431
+ },
432
+ async resetState(now) {
433
+ // Table by table, on the domain's own write chain, so a reset cannot
434
+ // interleave with a write that is already queued.
435
+ for (const table of [courses, nodes, lessons, focus, nextSteps, handoffs]) {
436
+ for (const key of [...table.keys()])
437
+ await table.delete(key);
438
+ }
439
+ await learner.set({ initializedAt: UNINITIALIZED, updatedAt: now });
440
+ },
441
+ readHandoff: (targetNodeId) => handoffs.get(targetNodeId),
442
+ async writeHandoff(record) {
443
+ await handoffs.put(record.targetNodeId, record);
444
+ return record;
445
+ },
446
+ async updateHandoff(targetNodeId, transform) {
447
+ const current = handoffs.get(targetNodeId);
448
+ if (current === undefined)
449
+ throw new Error(`no handoff for "${targetNodeId}"`);
450
+ return handoffs.update(targetNodeId, (record) => transform(record));
451
+ },
452
+ listHandoffs: () => [...handoffs.entries()].map(([, record]) => record),
453
+ activeHandoff() {
454
+ const courseId = learner.get().activeCourseId;
455
+ const record = courseId === undefined ? undefined : focus.get(courseId);
456
+ if (record === undefined)
457
+ return undefined;
458
+ return handoffs.get(record.nodeId);
459
+ },
460
+ activeFocus() {
461
+ const courseId = learner.get().activeCourseId;
462
+ if (courseId === undefined)
463
+ return undefined;
464
+ const record = focus.get(courseId);
465
+ if (record === undefined || record.status !== 'active')
466
+ return undefined;
467
+ const course = courses.get(courseId);
468
+ const node = nodes.get(record.nodeId);
469
+ if (!course || !node)
470
+ return undefined;
471
+ return { focus: record, course, node };
472
+ },
473
+ readLesson: (id) => lessons.get(id),
474
+ lessonForNode: (nodeId) => [...lessons.entries()].map(([, record]) => record).find((record) => record.nodeId === nodeId),
475
+ async writeLesson(record) {
476
+ await lessons.put(record.id, record);
477
+ return record;
478
+ },
479
+ lessonCount: () => lessons.size,
480
+ snapshot() {
481
+ const profile = learner.get();
482
+ return {
483
+ domain: domain.name,
484
+ version: UDT_DOMAIN_VERSION,
485
+ initialized: profile.initializedAt !== UNINITIALIZED,
486
+ learner: profile,
487
+ courseCount: courses.size,
488
+ nodeCount: nodes.size,
489
+ lessonCount: lessons.size,
490
+ courses: [...courses.entries()].map(([id, record]) => ({
491
+ id,
492
+ title: record.title,
493
+ status: record.status,
494
+ })),
495
+ };
496
+ },
497
+ close: () => domain.close(),
498
+ };
499
+ }
500
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAO3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OA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