@okhay-p/mivra 0.1.6 → 0.1.7
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/{chunk-DYXNHODU.js → chunk-M62PZTK3.js} +117 -4
- package/dist/chunk-M62PZTK3.js.map +7 -0
- package/dist/{chunk-KE5ZEREE.js → chunk-T5WM74CI.js} +2 -1
- package/dist/{chunk-B47HA6IQ.js → chunk-TKDX5OCX.js} +739 -478
- package/dist/chunk-TKDX5OCX.js.map +7 -0
- package/dist/cli.js +492 -123
- package/dist/cli.js.map +4 -4
- package/dist/{client-4UG5W5NJ.js → client-76YUHG4T.js} +2 -2
- package/dist/exercise-child.js +1 -1
- package/dist/extract-child.js +2 -2
- package/dist/python-child.js +1 -1
- package/dist/{start-SX3BCBIN.js → start-GVAACONX.js} +14504 -12040
- package/dist/start-GVAACONX.js.map +7 -0
- package/drizzle/0021_strange_gamma_corps.sql +2 -0
- package/drizzle/0022_fast_forgotten_one.sql +28 -0
- package/drizzle/0023_low_wiccan.sql +17 -0
- package/drizzle/0024_windy_annihilus.sql +1 -0
- package/drizzle/0025_brief_rictor.sql +6 -0
- package/drizzle/0026_greedy_sally_floyd.sql +1 -0
- package/drizzle/0027_regular_calypso.sql +41 -0
- package/drizzle/0028_lazy_agent_zero.sql +17 -0
- package/drizzle/meta/0021_snapshot.json +2313 -0
- package/drizzle/meta/0022_snapshot.json +2529 -0
- package/drizzle/meta/0023_snapshot.json +2654 -0
- package/drizzle/meta/0024_snapshot.json +2662 -0
- package/drizzle/meta/0025_snapshot.json +2707 -0
- package/drizzle/meta/0026_snapshot.json +2714 -0
- package/drizzle/meta/0027_snapshot.json +2816 -0
- package/drizzle/meta/0028_snapshot.json +2940 -0
- package/drizzle/meta/_journal.json +56 -0
- package/package.json +1 -1
- package/web/assets/exercise-workers/{exercise.worker-DzC1lTCg.js → exercise.worker-LCHlYekD.js} +11 -11
- package/web/assets/exercise-workers/python-exercise.worker-DeTriNjh.js +236 -0
- package/web/assets/index-CQjNLnxP.js +540 -0
- package/web/assets/index-DpV5il_3.css +1 -0
- package/web/assets/{module-ES6BEMUI-Chb6aYUZ.js → module-ES6BEMUI-B2wjplZC.js} +1 -1
- package/web/assets/render.worker-OksjuBjV.js +537 -0
- package/web/index.html +2 -2
- package/dist/chunk-B47HA6IQ.js.map +0 -7
- package/dist/chunk-DYXNHODU.js.map +0 -7
- package/dist/start-SX3BCBIN.js.map +0 -7
- package/web/assets/exercise-workers/python-exercise.worker-CtSr-syJ.js +0 -236
- package/web/assets/index-D3M-SX0V.js +0 -538
- package/web/assets/index-DUFQVtIh.css +0 -1
- package/web/assets/render.worker-D6KYAHiU.js +0 -537
- /package/dist/{chunk-KE5ZEREE.js.map → chunk-T5WM74CI.js.map} +0 -0
- /package/dist/{client-4UG5W5NJ.js.map → client-76YUHG4T.js.map} +0 -0
|
@@ -19,6 +19,9 @@ __export(schema_exports, {
|
|
|
19
19
|
attempts: () => attempts,
|
|
20
20
|
conceptEdgeKinds: () => conceptEdgeKinds,
|
|
21
21
|
conceptEdges: () => conceptEdges,
|
|
22
|
+
conceptSessionEdges: () => conceptSessionEdges,
|
|
23
|
+
conceptSessionSources: () => conceptSessionSources,
|
|
24
|
+
conceptSessionStatuses: () => conceptSessionStatuses,
|
|
22
25
|
conceptSources: () => conceptSources,
|
|
23
26
|
concepts: () => concepts,
|
|
24
27
|
courseKinds: () => courseKinds,
|
|
@@ -27,6 +30,8 @@ __export(schema_exports, {
|
|
|
27
30
|
documentChunks: () => documentChunks,
|
|
28
31
|
documentKinds: () => documentKinds,
|
|
29
32
|
documents: () => documents,
|
|
33
|
+
flashcardRatings: () => flashcardRatings,
|
|
34
|
+
flashcardReviews: () => flashcardReviews,
|
|
30
35
|
lessonErrorActions: () => lessonErrorActions,
|
|
31
36
|
lessonSections: () => lessonSections,
|
|
32
37
|
lessonStatuses: () => lessonStatuses,
|
|
@@ -36,12 +41,16 @@ __export(schema_exports, {
|
|
|
36
41
|
memorySources: () => memorySources,
|
|
37
42
|
memoryStatuses: () => memoryStatuses,
|
|
38
43
|
messages: () => messages,
|
|
44
|
+
noteAliases: () => noteAliases,
|
|
39
45
|
noteChunks: () => noteChunks,
|
|
40
46
|
noteLinks: () => noteLinks,
|
|
41
47
|
noteTags: () => noteTags,
|
|
42
48
|
notes: () => notes,
|
|
49
|
+
placementDepths: () => placementDepths,
|
|
50
|
+
reviewSessions: () => reviewSessions,
|
|
43
51
|
runStatuses: () => runStatuses,
|
|
44
52
|
runs: () => runs,
|
|
53
|
+
sessionDocuments: () => sessionDocuments,
|
|
45
54
|
sessions: () => sessions,
|
|
46
55
|
settings: () => settings,
|
|
47
56
|
syllabusVersions: () => syllabusVersions,
|
|
@@ -93,6 +102,11 @@ var runs = sqliteTable(
|
|
|
93
102
|
* reasoning metadata never replays to a different destination under the same model id. Null otherwise.
|
|
94
103
|
*/
|
|
95
104
|
endpoint: text("endpoint"),
|
|
105
|
+
/**
|
|
106
|
+
* The open lesson selected when this run started, if any. `""` means explicitly no lesson open;
|
|
107
|
+
* `null` marks legacy runs recorded before lesson selection was persisted.
|
|
108
|
+
*/
|
|
109
|
+
lessonId: text("lesson_id"),
|
|
96
110
|
error: text("error"),
|
|
97
111
|
startedAt: integer("started_at", { mode: "timestamp_ms" }).notNull(),
|
|
98
112
|
endedAt: integer("ended_at", { mode: "timestamp_ms" })
|
|
@@ -155,12 +169,12 @@ var memories = sqliteTable(
|
|
|
155
169
|
},
|
|
156
170
|
(t) => [index("memories_status_idx").on(t.status, t.createdAt), index("memories_run_idx").on(t.runId), index("memories_note_idx").on(t.noteId)]
|
|
157
171
|
);
|
|
158
|
-
var documentKinds = ["pdf", "pptx"];
|
|
172
|
+
var documentKinds = ["pdf", "pptx", "text", "markdown"];
|
|
159
173
|
var documents = sqliteTable(
|
|
160
174
|
"documents",
|
|
161
175
|
{
|
|
162
176
|
id: text("id").primaryKey(),
|
|
163
|
-
sessionId: text("session_id").
|
|
177
|
+
sessionId: text("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
164
178
|
messageId: text("message_id").references(() => messages.id, { onDelete: "set null" }),
|
|
165
179
|
filename: text("filename").notNull(),
|
|
166
180
|
kind: text("kind", { enum: documentKinds }).notNull(),
|
|
@@ -173,6 +187,20 @@ var documents = sqliteTable(
|
|
|
173
187
|
},
|
|
174
188
|
(t) => [index("documents_session_idx").on(t.sessionId, t.createdAt)]
|
|
175
189
|
);
|
|
190
|
+
var sessionDocuments = sqliteTable(
|
|
191
|
+
"session_documents",
|
|
192
|
+
{
|
|
193
|
+
sessionId: text("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
194
|
+
documentId: text("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
|
|
195
|
+
messageId: text("message_id").references(() => messages.id, { onDelete: "set null" }),
|
|
196
|
+
attachedAt: integer("attached_at", { mode: "timestamp_ms" }).notNull()
|
|
197
|
+
},
|
|
198
|
+
(t) => [
|
|
199
|
+
primaryKey({ columns: [t.sessionId, t.documentId] }),
|
|
200
|
+
index("session_documents_session_idx").on(t.sessionId, t.attachedAt),
|
|
201
|
+
index("session_documents_document_idx").on(t.documentId)
|
|
202
|
+
]
|
|
203
|
+
);
|
|
176
204
|
var documentChunks = sqliteTable(
|
|
177
205
|
"document_chunks",
|
|
178
206
|
{
|
|
@@ -185,6 +213,7 @@ var documentChunks = sqliteTable(
|
|
|
185
213
|
(t) => [uniqueIndex("document_chunks_document_seq_idx").on(t.documentId, t.seq)]
|
|
186
214
|
);
|
|
187
215
|
var courseStatuses = ["interviewing", "active", "complete"];
|
|
216
|
+
var placementDepths = ["quick", "thorough", "skip"];
|
|
188
217
|
var courseKinds = ["lessons", "project"];
|
|
189
218
|
var courses = sqliteTable(
|
|
190
219
|
"courses",
|
|
@@ -193,6 +222,8 @@ var courses = sqliteTable(
|
|
|
193
222
|
sessionId: text("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
194
223
|
goal: text("goal").notNull(),
|
|
195
224
|
kind: text("kind", { enum: courseKinds }).notNull().default("lessons"),
|
|
225
|
+
/** How much the placement interview asks (protocol's PlacementDepth); courses from before it are `quick`. */
|
|
226
|
+
placementDepth: text("placement_depth", { enum: placementDepths }).notNull().default("quick"),
|
|
196
227
|
status: text("status", { enum: courseStatuses }).notNull(),
|
|
197
228
|
/** The subject icon's Lucide name, from protocol's `courseIcons`, chosen by the tutor with the first syllabus; null until then. */
|
|
198
229
|
icon: text("icon"),
|
|
@@ -324,9 +355,19 @@ var noteLinks = sqliteTable(
|
|
|
324
355
|
{
|
|
325
356
|
noteId: text("note_id").notNull().references(() => notes.id, { onDelete: "cascade" }),
|
|
326
357
|
target: text("target").notNull(),
|
|
358
|
+
/** Normalised target (`noteKey(target)`) for fast, Unicode- and whitespace-aware backlink lookup. */
|
|
359
|
+
targetKey: text("target_key").notNull().default(""),
|
|
327
360
|
kind: text("kind", { enum: ["link", "embed"] }).notNull()
|
|
328
361
|
},
|
|
329
|
-
(t) => [primaryKey({ columns: [t.noteId, t.target, t.kind] })]
|
|
362
|
+
(t) => [primaryKey({ columns: [t.noteId, t.target, t.kind] }), index("note_links_target_key_idx").on(t.targetKey)]
|
|
363
|
+
);
|
|
364
|
+
var noteAliases = sqliteTable(
|
|
365
|
+
"note_aliases",
|
|
366
|
+
{
|
|
367
|
+
noteId: text("note_id").notNull().references(() => notes.id, { onDelete: "cascade" }),
|
|
368
|
+
aliasKey: text("alias_key").notNull()
|
|
369
|
+
},
|
|
370
|
+
(t) => [primaryKey({ columns: [t.noteId, t.aliasKey] }), index("note_aliases_alias_idx").on(t.aliasKey, t.noteId)]
|
|
330
371
|
);
|
|
331
372
|
var noteTags = sqliteTable(
|
|
332
373
|
"note_tags",
|
|
@@ -392,6 +433,25 @@ var conceptSources = sqliteTable(
|
|
|
392
433
|
},
|
|
393
434
|
(t) => [primaryKey({ columns: [t.conceptId, t.noteId] }), index("concept_sources_note_idx").on(t.noteId)]
|
|
394
435
|
);
|
|
436
|
+
var conceptSessionStatuses = ["pending", "active"];
|
|
437
|
+
var conceptSessionSources = sqliteTable(
|
|
438
|
+
"concept_session_sources",
|
|
439
|
+
{
|
|
440
|
+
id: text("id").primaryKey(),
|
|
441
|
+
conceptId: text("concept_id").notNull().references(() => concepts.id, { onDelete: "cascade" }),
|
|
442
|
+
sessionId: text("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
443
|
+
/** The run that wrote it; it stays `pending` until that run completes. */
|
|
444
|
+
runId: text("run_id").references(() => runs.id, { onDelete: "set null" }),
|
|
445
|
+
status: text("status", { enum: conceptSessionStatuses }).notNull().default("active"),
|
|
446
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
447
|
+
},
|
|
448
|
+
(t) => [
|
|
449
|
+
uniqueIndex("concept_session_sources_concept_session_idx").on(t.conceptId, t.sessionId).where(sql`${t.sessionId} is not null`),
|
|
450
|
+
index("concept_session_sources_concept_idx").on(t.conceptId),
|
|
451
|
+
index("concept_session_sources_session_idx").on(t.sessionId),
|
|
452
|
+
index("concept_session_sources_run_idx").on(t.runId)
|
|
453
|
+
]
|
|
454
|
+
);
|
|
395
455
|
var conceptEdgeKinds = ["prerequisite", "related"];
|
|
396
456
|
var conceptEdges = sqliteTable(
|
|
397
457
|
"concept_edges",
|
|
@@ -403,6 +463,27 @@ var conceptEdges = sqliteTable(
|
|
|
403
463
|
},
|
|
404
464
|
(t) => [primaryKey({ columns: [t.fromId, t.toId, t.kind, t.noteId] }), index("concept_edges_note_idx").on(t.noteId), index("concept_edges_to_idx").on(t.toId)]
|
|
405
465
|
);
|
|
466
|
+
var conceptSessionEdges = sqliteTable(
|
|
467
|
+
"concept_session_edges",
|
|
468
|
+
{
|
|
469
|
+
id: text("id").primaryKey(),
|
|
470
|
+
fromId: text("from_id").notNull().references(() => concepts.id, { onDelete: "cascade" }),
|
|
471
|
+
toId: text("to_id").notNull().references(() => concepts.id, { onDelete: "cascade" }),
|
|
472
|
+
kind: text("kind", { enum: conceptEdgeKinds }).notNull(),
|
|
473
|
+
sessionId: text("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
474
|
+
/** The run that wrote it; it stays `pending` until that run completes. */
|
|
475
|
+
runId: text("run_id").references(() => runs.id, { onDelete: "set null" }),
|
|
476
|
+
status: text("status", { enum: conceptSessionStatuses }).notNull().default("active"),
|
|
477
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
478
|
+
},
|
|
479
|
+
(t) => [
|
|
480
|
+
uniqueIndex("concept_session_edges_edge_session_idx").on(t.fromId, t.toId, t.kind, t.sessionId).where(sql`${t.sessionId} is not null`),
|
|
481
|
+
index("concept_session_edges_from_to_idx").on(t.fromId, t.toId, t.kind),
|
|
482
|
+
index("concept_session_edges_to_idx").on(t.toId),
|
|
483
|
+
index("concept_session_edges_session_idx").on(t.sessionId),
|
|
484
|
+
index("concept_session_edges_run_idx").on(t.runId)
|
|
485
|
+
]
|
|
486
|
+
);
|
|
406
487
|
var memorySources = sqliteTable(
|
|
407
488
|
"memory_sources",
|
|
408
489
|
{
|
|
@@ -413,6 +494,28 @@ var memorySources = sqliteTable(
|
|
|
413
494
|
},
|
|
414
495
|
(t) => [primaryKey({ columns: [t.memoryId, t.noteId] }), index("memory_sources_note_idx").on(t.noteId)]
|
|
415
496
|
);
|
|
497
|
+
var reviewSessions = sqliteTable("review_sessions", {
|
|
498
|
+
sessionId: text("session_id").primaryKey().references(() => sessions.id, { onDelete: "cascade" }),
|
|
499
|
+
concepts: text("concepts", { mode: "json" }).notNull(),
|
|
500
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
501
|
+
});
|
|
502
|
+
var flashcardRatings = ["again", "good", "easy"];
|
|
503
|
+
var flashcardReviews = sqliteTable(
|
|
504
|
+
"flashcard_reviews",
|
|
505
|
+
{
|
|
506
|
+
id: text("id").primaryKey(),
|
|
507
|
+
artifactId: text("artifact_id").notNull().references(() => artifacts.id, { onDelete: "cascade" }),
|
|
508
|
+
sessionId: text("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
509
|
+
cardId: text("card_id").notNull(),
|
|
510
|
+
rating: text("rating", { enum: flashcardRatings }).notNull(),
|
|
511
|
+
repetitions: integer("repetitions").notNull(),
|
|
512
|
+
intervalDays: integer("interval_days").notNull(),
|
|
513
|
+
ease: real("ease").notNull(),
|
|
514
|
+
dueAt: integer("due_at", { mode: "timestamp_ms" }).notNull(),
|
|
515
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
516
|
+
},
|
|
517
|
+
(t) => [index("flashcard_reviews_card_idx").on(t.artifactId, t.cardId, t.createdAt), index("flashcard_reviews_session_idx").on(t.sessionId)]
|
|
518
|
+
);
|
|
416
519
|
|
|
417
520
|
// ../server/src/db/client.ts
|
|
418
521
|
var defaultMigrations = fileURLToPath(new URL("../../drizzle", import.meta.url));
|
|
@@ -455,7 +558,11 @@ function openDb(path, { migrationsFolder = defaultMigrations, onBackup, clock =
|
|
|
455
558
|
if (backup) onBackup?.(backup);
|
|
456
559
|
}
|
|
457
560
|
const db = drizzle(sqlite, { schema: schema_exports });
|
|
561
|
+
sqlite.pragma("foreign_keys = OFF");
|
|
458
562
|
migrate(db, { migrationsFolder });
|
|
563
|
+
sqlite.pragma("foreign_keys = ON");
|
|
564
|
+
const violations = sqlite.pragma("foreign_key_check");
|
|
565
|
+
if (violations.length > 0) throw new Error(`Database foreign key check failed after migration (${violations.length} violation(s)).`);
|
|
459
566
|
return db;
|
|
460
567
|
} catch (error) {
|
|
461
568
|
sqlite.close();
|
|
@@ -471,6 +578,7 @@ export {
|
|
|
471
578
|
attempts,
|
|
472
579
|
memories,
|
|
473
580
|
documents,
|
|
581
|
+
sessionDocuments,
|
|
474
582
|
documentChunks,
|
|
475
583
|
courses,
|
|
476
584
|
syllabusVersions,
|
|
@@ -482,14 +590,19 @@ export {
|
|
|
482
590
|
notes,
|
|
483
591
|
noteChunks,
|
|
484
592
|
noteLinks,
|
|
593
|
+
noteAliases,
|
|
485
594
|
noteTags,
|
|
486
595
|
usageRecords,
|
|
487
596
|
concepts,
|
|
488
597
|
conceptSources,
|
|
598
|
+
conceptSessionSources,
|
|
489
599
|
conceptEdges,
|
|
600
|
+
conceptSessionEdges,
|
|
490
601
|
memorySources,
|
|
602
|
+
reviewSessions,
|
|
603
|
+
flashcardReviews,
|
|
491
604
|
KEEP_BACKUPS,
|
|
492
605
|
NewerDatabaseError,
|
|
493
606
|
openDb
|
|
494
607
|
};
|
|
495
|
-
//# sourceMappingURL=chunk-
|
|
608
|
+
//# sourceMappingURL=chunk-M62PZTK3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../server/src/db/client.ts", "../../server/src/db/schema.ts"],
|
|
4
|
+
"sourcesContent": ["import { chmodSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { basename, dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport Database from \"better-sqlite3\";\nimport { drizzle } from \"drizzle-orm/better-sqlite3\";\nimport { migrate } from \"drizzle-orm/better-sqlite3/migrator\";\nimport { readMigrationFiles } from \"drizzle-orm/migrator\";\nimport * as schema from \"./schema.js\";\n\nconst defaultMigrations = fileURLToPath(new URL(\"../../drizzle\", import.meta.url));\n\n/** Backups kept in `backups/` next to the database; older ones are deleted after a new one is made. */\nexport const KEEP_BACKUPS = 5;\n\n/** The database was migrated by a newer Mivra than this one, which can't safely use it. */\nexport class NewerDatabaseError extends Error {\n constructor(path: string) {\n super(`${path} was last used by a newer version of Mivra. Update Mivra, or restore an older copy from the backups folder next to it.`);\n }\n}\n\n/**\n * When the database already holds data and migrations are pending, copies it to `backups/` first (ADR-013), so an\n * upgrade that goes wrong never costs the learner their history. Drizzle applies every migration newer than the\n * last one recorded, so that's what counts as pending. A database a newer Mivra migrated is refused instead.\n */\nfunction backupBeforeMigrating(sqlite: Database.Database, path: string, migrationsFolder: string, clock: () => Date): string | undefined {\n const hasTable = sqlite.prepare(\"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = '__drizzle_migrations'\").get();\n // A new database has nothing to lose.\n if (!hasTable) return undefined;\n const last = sqlite.prepare(\"SELECT created_at FROM __drizzle_migrations ORDER BY created_at DESC LIMIT 1\").get() as { created_at: number | string } | undefined;\n if (!last) return undefined;\n const lastApplied = Number(last.created_at);\n const known = readMigrationFiles({ migrationsFolder });\n const newestKnown = Math.max(0, ...known.map((m) => m.folderMillis));\n if (lastApplied > newestKnown) throw new NewerDatabaseError(path);\n if (!known.some((m) => m.folderMillis > lastApplied)) return undefined;\n\n // Private from the start: the folder is 0700, so a copy is never readable by other users, even before its chmod.\n const dir = join(dirname(path), \"backups\");\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n chmodSync(dir, 0o700);\n const name = basename(path, \".db\");\n const target = join(dir, `${name}-${clock().toISOString().replace(/[:.]/g, \"-\")}.db`);\n // VACUUM INTO writes a consistent copy, WAL included, in one statement. If it fails, nothing is migrated.\n sqlite.prepare(\"VACUUM INTO ?\").run(target);\n chmodSync(target, 0o600);\n\n // Only Mivra's own backups (exactly its timestamped names) are ever deleted, never the one just made, and never a\n // copy the learner put here. Names sort by time.\n const generated = new RegExp(`^${name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}-\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}-\\\\d{2}-\\\\d{2}-\\\\d{3}Z\\\\.db$`);\n const older = readdirSync(dir).filter((f) => generated.test(f) && f !== basename(target)).sort();\n for (const old of older.slice(0, Math.max(0, older.length - (KEEP_BACKUPS - 1)))) rmSync(join(dir, old), { force: true });\n return target;\n}\n\nexport interface OpenDbOptions {\n /** Where the migrations are; a bundled build (the `@okhay-p/mivra` package) passes where it ships them. */\n migrationsFolder?: string;\n /** Told the backup's path when one is made before migrating. */\n onBackup?: (path: string) => void;\n clock?: () => Date;\n}\n\n/**\n * Opens (or creates) the SQLite database and applies pending migrations, backing it up first when it holds data\n * (ADR-013). Pass \":memory:\" for tests.\n */\nexport function openDb(path: string, { migrationsFolder = defaultMigrations, onBackup, clock = () => new Date() }: OpenDbOptions = {}) {\n if (path !== \":memory:\") mkdirSync(dirname(path), { recursive: true });\n const sqlite = new Database(path);\n try {\n sqlite.pragma(\"journal_mode = WAL\");\n sqlite.pragma(\"foreign_keys = ON\");\n if (path !== \":memory:\") {\n const backup = backupBeforeMigrating(sqlite, path, migrationsFolder, clock);\n if (backup) onBackup?.(backup);\n }\n const db = drizzle(sqlite, { schema });\n // SQLite ignores PRAGMA foreign_keys = OFF inside a transaction (which Drizzle's migrator opens), so table-rebuild\n // migrations need foreign keys disabled outside migrate() and verified immediately afterwards.\n sqlite.pragma(\"foreign_keys = OFF\");\n migrate(db, { migrationsFolder });\n sqlite.pragma(\"foreign_keys = ON\");\n const violations = sqlite.pragma(\"foreign_key_check\") as unknown[];\n if (violations.length > 0) throw new Error(`Database foreign key check failed after migration (${violations.length} violation(s)).`);\n return db;\n } catch (error) {\n sqlite.close();\n throw error;\n }\n}\n\nexport type Db = ReturnType<typeof openDb>;\n", "import { sql } from \"drizzle-orm\";\nimport { index, integer, primaryKey, real, sqliteTable, text, uniqueIndex } from \"drizzle-orm/sqlite-core\";\n\nexport const sessions = sqliteTable(\"sessions\", {\n id: text(\"id\").primaryKey(),\n title: text(\"title\").notNull(),\n /** The learner renamed it, so automatic titling (a first message, the tutor's course title) leaves it alone. */\n titleSetByLearner: integer(\"title_set_by_learner\", { mode: \"boolean\" }).notNull().default(false),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp_ms\" }).notNull(),\n});\n\n/**\n * One row per AI SDK UIMessage; `parts` holds the message parts as JSON.\n * `seq` is the message's position within its session and defines conversation order.\n */\nexport const messages = sqliteTable(\n \"messages\",\n {\n id: text(\"id\").primaryKey(),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n seq: integer(\"seq\").notNull(),\n role: text(\"role\", { enum: [\"system\", \"user\", \"assistant\"] }).notNull(),\n parts: text(\"parts\", { mode: \"json\" }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"messages_session_seq_idx\").on(t.sessionId, t.seq)],\n);\n\nexport const runStatuses = [\"running\", \"completed\", \"cancelled\", \"failed\"] as const;\nexport type RunStatus = (typeof runStatuses)[number];\n\n/**\n * One row per model generation. A session has at most one running run at a time,\n * enforced by the partial unique index. Cancelled runs may save display-only partial text.\n */\nexport const runs = sqliteTable(\n \"runs\",\n {\n id: text(\"id\").primaryKey(),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n userMessageId: text(\"user_message_id\")\n .notNull()\n .references(() => messages.id, { onDelete: \"cascade\" }),\n /** A unique claim on the quiz reply this automatic run continues. No synthetic user message. */\n continuationOf: text(\"continuation_of\"),\n assistantMessageId: text(\"assistant_message_id\").references(() => messages.id, { onDelete: \"set null\" }),\n status: text(\"status\", { enum: runStatuses }).notNull(),\n /** The model that ran, as \"<provider>:<model-id>\" (ADR-012). Null for runs before it was recorded. */\n model: text(\"model\"),\n /** The reasoning effort it ran with; null leaves it to the model's default. */\n effort: text(\"effort\"),\n /**\n * For a custom provider's model (issue #69), a fingerprint of the endpoint it ran against, so private\n * reasoning metadata never replays to a different destination under the same model id. Null otherwise.\n */\n endpoint: text(\"endpoint\"),\n /**\n * The open lesson selected when this run started, if any. `\"\"` means explicitly no lesson open;\n * `null` marks legacy runs recorded before lesson selection was persisted.\n */\n lessonId: text(\"lesson_id\"),\n error: text(\"error\"),\n startedAt: integer(\"started_at\", { mode: \"timestamp_ms\" }).notNull(),\n endedAt: integer(\"ended_at\", { mode: \"timestamp_ms\" }),\n },\n (t) => [\n uniqueIndex(\"runs_continuation_once_idx\").on(t.continuationOf),\n index(\"runs_session_idx\").on(t.sessionId, t.startedAt),\n uniqueIndex(\"runs_one_running_per_session_idx\")\n .on(t.sessionId)\n .where(sql`${t.status} = 'running'`),\n ],\n);\n\n/**\n * A learning artifact produced by an agent tool call (ADR-006). `spec` is the full, validated tool\n * input, including private fields such as a check's answer key; clients only ever see a view of it.\n */\nexport const artifacts = sqliteTable(\n \"artifacts\",\n {\n id: text(\"id\").primaryKey(),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n runId: text(\"run_id\")\n .notNull()\n .references(() => runs.id, { onDelete: \"cascade\" }),\n toolCallId: text(\"tool_call_id\").notNull(),\n kind: text(\"kind\").notNull(),\n version: integer(\"version\").notNull(),\n spec: text(\"spec\", { mode: \"json\" }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [index(\"artifacts_session_idx\").on(t.sessionId, t.createdAt), uniqueIndex(\"artifacts_tool_call_idx\").on(t.runId, t.toolCallId)],\n);\n\nexport const attemptJudges = [\"grader\", \"model\"] as const;\n\n/**\n * A learner's graded answer to a check artifact. One attempt per artifact (the grade reveals the\n * answer). `concept` and `correct` double as the first progress evidence (ADR-006). A project milestone is\n * checked as often as the learner likes: each `mivra check` replaces its attempt, until its lesson is finished.\n * `judge` says who graded it: the deterministic `grader`, or a `model` reviewing a milestone's code (ADR-016), whose\n * verdict is a second attempt on the same artifact, so it counts as separate evidence.\n */\nexport const attempts = sqliteTable(\n \"attempts\",\n {\n id: text(\"id\").primaryKey(),\n artifactId: text(\"artifact_id\")\n .notNull()\n .references(() => artifacts.id, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n answer: text(\"answer\", { mode: \"json\" }).notNull(),\n grade: text(\"grade\", { mode: \"json\" }).notNull(),\n correct: integer(\"correct\", { mode: \"boolean\" }).notNull(),\n concept: text(\"concept\"),\n judge: text(\"judge\", { enum: attemptJudges }).notNull().default(\"grader\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"attempts_one_per_artifact_idx\").on(t.artifactId, t.judge), index(\"attempts_session_idx\").on(t.sessionId, t.createdAt), index(\"attempts_created_idx\").on(t.createdAt)],\n);\n\nexport const memoryStatuses = [\"pending\", \"active\", \"superseded\"] as const;\n\n/** The model's inferences about the learner (ADR-009). Pending until the reply that wrote them completes. */\nexport const memories = sqliteTable(\n \"memories\",\n {\n id: text(\"id\").primaryKey(),\n kind: text(\"kind\", { enum: [\"goal\", \"preference\", \"misconception\", \"known\"] }).notNull(),\n text: text(\"text\").notNull(),\n concept: text(\"concept\"),\n basis: text(\"basis\", { enum: [\"wrong_answer\", \"chat\", \"import\"] }).notNull(),\n attemptId: text(\"attempt_id\").references(() => attempts.id, { onDelete: \"set null\" }),\n sessionId: text(\"session_id\").references(() => sessions.id, { onDelete: \"set null\" }),\n runId: text(\"run_id\").references(() => runs.id, { onDelete: \"set null\" }),\n status: text(\"status\", { enum: memoryStatuses }).notNull(),\n /** The memory this one corrects, kept until this one is deleted. */\n replacesId: text(\"replaces_id\"),\n /** For basis `import`, the imported note it was drawn from (ADR-014): deleting the note deletes the memory. */\n noteId: text(\"note_id\").references(() => notes.id, { onDelete: \"cascade\" }),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n editedAt: integer(\"edited_at\", { mode: \"timestamp_ms\" }),\n },\n (t) => [index(\"memories_status_idx\").on(t.status, t.createdAt), index(\"memories_run_idx\").on(t.runId), index(\"memories_note_idx\").on(t.noteId)],\n);\n\nexport const documentKinds = [\"pdf\", \"pptx\", \"text\", \"markdown\"] as const;\n\n/**\n * A document in the learner's Source Library (ADR-010, ADR-018). Only extracted/cleaned text is kept in\n * `document_chunks`, never the original binary file. Documents outlive individual sessions; attachments\n * to chats and courses live in `session_documents`.\n */\nexport const documents = sqliteTable(\n \"documents\",\n {\n id: text(\"id\").primaryKey(),\n sessionId: text(\"session_id\").references(() => sessions.id, { onDelete: \"set null\" }),\n messageId: text(\"message_id\").references(() => messages.id, { onDelete: \"set null\" }),\n filename: text(\"filename\").notNull(),\n kind: text(\"kind\", { enum: documentKinds }).notNull(),\n byteSize: integer(\"byte_size\").notNull(),\n textChars: integer(\"text_chars\").notNull(),\n pageCount: integer(\"page_count\").notNull(),\n pagesWithText: integer(\"pages_with_text\").notNull(),\n status: text(\"status\", { enum: [\"ready\"] }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [index(\"documents_session_idx\").on(t.sessionId, t.createdAt)],\n);\n\n/**\n * Links a library document to a session (chat or course), with the optional user message whose chip displays it.\n * Deleting a session removes only this link, keeping the document in the Source Library (ADR-018).\n */\nexport const sessionDocuments = sqliteTable(\n \"session_documents\",\n {\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n documentId: text(\"document_id\")\n .notNull()\n .references(() => documents.id, { onDelete: \"cascade\" }),\n messageId: text(\"message_id\").references(() => messages.id, { onDelete: \"set null\" }),\n attachedAt: integer(\"attached_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [\n primaryKey({ columns: [t.sessionId, t.documentId] }),\n index(\"session_documents_session_idx\").on(t.sessionId, t.attachedAt),\n index(\"session_documents_document_idx\").on(t.documentId),\n ],\n);\n\n/**\n * A piece of a document's text; `page` is its page or slide number and `seq` its position in the document.\n * The migration adds the document_chunks_fts FTS5 table, which triggers keep in sync with this one and\n * which relies on `id` being a stable rowid. Drizzle doesn't model it, so SessionStore queries it in SQL.\n */\nexport const documentChunks = sqliteTable(\n \"document_chunks\",\n {\n id: integer(\"id\").primaryKey({ autoIncrement: true }),\n documentId: text(\"document_id\")\n .notNull()\n .references(() => documents.id, { onDelete: \"cascade\" }),\n page: integer(\"page\").notNull(),\n seq: integer(\"seq\").notNull(),\n text: text(\"text\").notNull(),\n },\n (t) => [uniqueIndex(\"document_chunks_document_seq_idx\").on(t.documentId, t.seq)],\n);\n\nexport const courseStatuses = [\"interviewing\", \"active\", \"complete\"] as const;\nexport const placementDepths = [\"quick\", \"thorough\", \"skip\"] as const;\n/** A course of lessons, or a project course whose topics are milestones checked in the learner's repository (ADR-016). */\nexport const courseKinds = [\"lessons\", \"project\"] as const;\n\n/**\n * A course (ADR-011): one learning goal, taught in its own chat session. It starts with a placement\n * interview and becomes active once the AI has written its syllabus.\n */\nexport const courses = sqliteTable(\n \"courses\",\n {\n id: text(\"id\").primaryKey(),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n goal: text(\"goal\").notNull(),\n kind: text(\"kind\", { enum: courseKinds }).notNull().default(\"lessons\"),\n /** How much the placement interview asks (protocol's PlacementDepth); courses from before it are `quick`. */\n placementDepth: text(\"placement_depth\", { enum: placementDepths }).notNull().default(\"quick\"),\n status: text(\"status\", { enum: courseStatuses }).notNull(),\n /** The subject icon's Lucide name, from protocol's `courseIcons`, chosen by the tutor with the first syllabus; null until then. */\n icon: text(\"icon\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"courses_session_idx\").on(t.sessionId)],\n);\n\n/**\n * One immutable version of a course's syllabus. `topics` is the ordered list of topics, each with a\n * server-assigned id that stays the same across versions, so lessons can refer to their topic.\n * `known` is what the AI said the learner already knows, labelled by source.\n */\nexport const syllabusVersions = sqliteTable(\n \"syllabus_versions\",\n {\n id: text(\"id\").primaryKey(),\n courseId: text(\"course_id\")\n .notNull()\n .references(() => courses.id, { onDelete: \"cascade\" }),\n version: integer(\"version\").notNull(),\n topics: text(\"topics\", { mode: \"json\" }).notNull(),\n known: text(\"known\", { mode: \"json\" }).notNull(),\n /** Who made this version: the interview, the tutor on request (Change), or adaptive generation (ADR-011). */\n source: text(\"source\", { enum: [\"interview\", \"tutor\", \"adaptive\", \"undo\"] }).notNull().default(\"interview\"),\n /** For an adaptive change, the finished lesson whose results prompted it: at most one change per lesson. */\n triggerLessonId: text(\"trigger_lesson_id\"),\n /** Why it changed, shown to the learner. Null for the first version. */\n reason: text(\"reason\"),\n /** Ids of the topics this version added or changed, for highlighting. */\n changedTopicIds: text(\"changed_topic_ids\", { mode: \"json\" }).notNull().default(sql`'[]'`),\n runId: text(\"run_id\").references(() => runs.id, { onDelete: \"set null\" }),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"syllabus_versions_course_version_idx\").on(t.courseId, t.version)],\n);\n\nexport const lessonStatuses = [\"generating\", \"ready\", \"failed\", \"finished\"] as const;\n/** What the learner can do about a failed lesson, when it's more than retrying: fix the lesson model's override (issue #71). */\nexport const lessonErrorActions = [\"lesson-model\"] as const;\n\n/**\n * One lesson per syllabus topic (ADR-011). Generation runs in the lesson's own hidden session, so its\n * artifacts, attempts and model transcript use the existing tables. A finished lesson is frozen.\n */\nexport const lessons = sqliteTable(\n \"lessons\",\n {\n id: text(\"id\").primaryKey(),\n courseId: text(\"course_id\")\n .notNull()\n .references(() => courses.id, { onDelete: \"cascade\" }),\n topicId: text(\"topic_id\").notNull(),\n topicTitle: text(\"topic_title\").notNull(),\n /** The topic's position in the syllabus when the lesson started. */\n position: integer(\"position\").notNull(),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n status: text(\"status\", { enum: lessonStatuses }).notNull(),\n error: text(\"error\"),\n /** Set with `error` when that message is Mivra's own and names a fix; the lesson then shows it. */\n errorAction: text(\"error_action\", { enum: lessonErrorActions }),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n finishedAt: integer(\"finished_at\", { mode: \"timestamp_ms\" }),\n },\n (t) => [uniqueIndex(\"lessons_course_topic_idx\").on(t.courseId, t.topicId), uniqueIndex(\"lessons_session_idx\").on(t.sessionId)],\n);\n\n/** An immutable lesson section: prose, or a reference to an artifact. Versions list sections by id. */\nexport const lessonSections = sqliteTable(\n \"lesson_sections\",\n {\n id: text(\"id\").primaryKey(),\n lessonId: text(\"lesson_id\")\n .notNull()\n .references(() => lessons.id, { onDelete: \"cascade\" }),\n kind: text(\"kind\", { enum: [\"prose\", \"artifact\"] }).notNull(),\n title: text(\"title\").notNull(),\n markdown: text(\"markdown\"),\n artifactId: text(\"artifact_id\").references(() => artifacts.id, { onDelete: \"cascade\" }),\n /** Sections of the previous lesson this one revisits, by id, so the page can link back to them. */\n revisits: text(\"revisits\", { mode: \"json\" }).notNull().default(sql`'[]'`),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [index(\"lesson_sections_lesson_idx\").on(t.lessonId), uniqueIndex(\"lesson_sections_artifact_idx\").on(t.artifactId)],\n);\n\n/**\n * A version of a lesson: its outline and the ordered ids of its sections. Version 1 grows while it is\n * generated; later versions (Change, ADR-011) are new rows, so attempts stay with what the learner saw.\n */\nexport const lessonVersions = sqliteTable(\n \"lesson_versions\",\n {\n id: text(\"id\").primaryKey(),\n lessonId: text(\"lesson_id\")\n .notNull()\n .references(() => lessons.id, { onDelete: \"cascade\" }),\n version: integer(\"version\").notNull(),\n outline: text(\"outline\", { mode: \"json\" }).notNull(),\n sectionIds: text(\"section_ids\", { mode: \"json\" }).notNull(),\n /** Ids of the sections this version added or changed, for highlighting. Empty for version 1. */\n changedSectionIds: text(\"changed_section_ids\", { mode: \"json\" }).notNull().default(sql`'[]'`),\n /** Why the tutor changed it. Null for version 1. */\n reason: text(\"reason\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"lesson_versions_lesson_version_idx\").on(t.lessonId, t.version)],\n);\n\n/** App-wide settings as JSON values by key, such as the current model selection (ADR-012). */\nexport const settings = sqliteTable(\"settings\", {\n key: text(\"key\").primaryKey(),\n value: text(\"value\", { mode: \"json\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp_ms\" }).notNull(),\n});\n\n/** One imported Obsidian vault (ADR-014). Importing again replaces its notes with the new snapshot. */\nexport const vaultImports = sqliteTable(\n \"vault_imports\",\n {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n source: text(\"source\", { enum: [\"obsidian\"] }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"vault_imports_name_idx\").on(t.name)],\n);\n\n/**\n * A Markdown note from an imported vault, written only by the import (ADR-014). `hash` is the SHA-256 of its text,\n * so a re-import skips unchanged files. `titleKey` and `aliases` (already normalised) resolve `[[links]]`.\n */\nexport const notes = sqliteTable(\n \"notes\",\n {\n id: text(\"id\").primaryKey(),\n importId: text(\"import_id\")\n .notNull()\n .references(() => vaultImports.id, { onDelete: \"cascade\" }),\n path: text(\"path\").notNull(),\n title: text(\"title\").notNull(),\n titleKey: text(\"title_key\").notNull(),\n aliases: text(\"aliases\", { mode: \"json\" }).$type<string[]>().notNull(),\n body: text(\"body\").notNull(),\n hash: text(\"hash\").notNull(),\n /** The hash this note had when it was last distilled, or null if it never was. Differing from `hash` means it's waiting. */\n distilledHash: text(\"distilled_hash\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"notes_import_path_idx\").on(t.importId, t.path), index(\"notes_import_title_idx\").on(t.importId, t.titleKey)],\n);\n\n/**\n * A piece of a note's text under its heading path (`Heading > Subheading`). The migration adds the note_chunks_fts\n * FTS5 table, kept in sync by triggers, which relies on `id` being a stable rowid, as for document chunks.\n */\nexport const noteChunks = sqliteTable(\n \"note_chunks\",\n {\n id: integer(\"id\").primaryKey({ autoIncrement: true }),\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n seq: integer(\"seq\").notNull(),\n heading: text(\"heading\"),\n text: text(\"text\").notNull(),\n },\n (t) => [uniqueIndex(\"note_chunks_note_seq_idx\").on(t.noteId, t.seq)],\n);\n\n/** A `[[link]]` or `![[embed]]` as written, without its heading or display text. Resolved to a note when read. */\nexport const noteLinks = sqliteTable(\n \"note_links\",\n {\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n target: text(\"target\").notNull(),\n /** Normalised target (`noteKey(target)`) for fast, Unicode- and whitespace-aware backlink lookup. */\n targetKey: text(\"target_key\").notNull().default(\"\"),\n kind: text(\"kind\", { enum: [\"link\", \"embed\"] }).notNull(),\n },\n (t) => [primaryKey({ columns: [t.noteId, t.target, t.kind] }), index(\"note_links_target_key_idx\").on(t.targetKey)],\n);\n\n/**\n * One alias of a note (already normalised, as in `notes.aliases`), so a link written as an alias is found by index\n * rather than by scanning every note's JSON array. Kept in step with `notes.aliases` by the note store.\n */\nexport const noteAliases = sqliteTable(\n \"note_aliases\",\n {\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n aliasKey: text(\"alias_key\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.noteId, t.aliasKey] }), index(\"note_aliases_alias_idx\").on(t.aliasKey, t.noteId)],\n);\n\n/** A tag from a note's text or frontmatter, lower-cased and without its `#`. */\nexport const noteTags = sqliteTable(\n \"note_tags\",\n {\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n tag: text(\"tag\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.noteId, t.tag] }), index(\"note_tags_tag_idx\").on(t.tag)],\n);\n\nexport const usageKinds = [\"chat\", \"continuation\", \"lesson\", \"distillation\", \"review\", \"test\"] as const;\nexport const usageStatuses = [\"completed\", \"failed\", \"cancelled\"] as const;\nexport const usageBillings = [\"api\", \"subscription\"] as const;\n\n/**\n * One model call's accounting (issue #70): a provider call, so a tutor run with several tool-call steps has one row\n * per step. Content-free by design: no prompt, reply, error text or credential, only what the Usage page needs.\n * `session_id` and `run_id` are plain ids with no foreign key, so deleting a chat keeps its rows and totals; labels\n * are snapshots, so a renamed or removed provider stays readable. A null token count was not reported (unknown),\n * never zero. `price` is the per-million-token price known when the call ended, kept so later price changes never\n * rewrite history; `estimated_cost` was computed from it then. For a subscription call that estimate is only an\n * API-price comparison, never a charge.\n */\nexport const usageRecords = sqliteTable(\n \"usage_records\",\n {\n id: text(\"id\").primaryKey(),\n kind: text(\"kind\", { enum: usageKinds }).notNull(),\n status: text(\"status\", { enum: usageStatuses }).notNull(),\n sessionId: text(\"session_id\"),\n runId: text(\"run_id\"),\n /** The call's position within its run (or test), from 0. Each tool-call step, and each retry, is its own call. */\n seq: integer(\"seq\").notNull(),\n /** \"openrouter\", \"anthropic\", \"openai\", \"chatgpt\" or \"custom:<provider id>\". */\n provider: text(\"provider\").notNull(),\n providerLabel: text(\"provider_label\").notNull(),\n model: text(\"model\").notNull(),\n modelLabel: text(\"model_label\"),\n effort: text(\"effort\"),\n billing: text(\"billing\", { enum: usageBillings }).notNull(),\n /** All input tokens, cached ones included. */\n inputTokens: integer(\"input_tokens\"),\n inputNoCacheTokens: integer(\"input_no_cache_tokens\"),\n inputCacheReadTokens: integer(\"input_cache_read_tokens\"),\n inputCacheWriteTokens: integer(\"input_cache_write_tokens\"),\n /** All output tokens, reasoning included. */\n outputTokens: integer(\"output_tokens\"),\n outputReasoningTokens: integer(\"output_reasoning_tokens\"),\n /** US dollars the provider reported for this call (OpenRouter does). */\n reportedCost: real(\"reported_cost\"),\n price: text(\"price\", { mode: \"json\" }),\n /** US dollars at `price`, or null when the price or a needed token count is unknown. */\n estimatedCost: real(\"estimated_cost\"),\n startedAt: integer(\"started_at\", { mode: \"timestamp_ms\" }).notNull(),\n endedAt: integer(\"ended_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [index(\"usage_records_started_idx\").on(t.startedAt), index(\"usage_records_run_idx\").on(t.runId)],\n);\n\n/**\n * A node of the knowledge graph (ADR-014), drawn from imported notes or live tutoring sessions (issue #140).\n * `key` is the name's `conceptKey` (ADR-009), so one concept has one node however its name is written.\n * A concept lives as long as at least one note, session, or edge supports it.\n */\nexport const concepts = sqliteTable(\n \"concepts\",\n {\n id: text(\"id\").primaryKey(),\n key: text(\"key\").notNull(),\n name: text(\"name\").notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [uniqueIndex(\"concepts_key_idx\").on(t.key)],\n);\n\n/** Which notes a concept was drawn from. */\nexport const conceptSources = sqliteTable(\n \"concept_sources\",\n {\n conceptId: text(\"concept_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n },\n (t) => [primaryKey({ columns: [t.conceptId, t.noteId] }), index(\"concept_sources_note_idx\").on(t.noteId)],\n);\n\n/**\n * Whether a row a tutoring run wrote counts yet: `pending` until its run completes (then `active`), and deleted if the\n * run is cancelled or fails, as for memories (ADR-009).\n */\nexport const conceptSessionStatuses = [\"pending\", \"active\"] as const;\n\n/**\n * Which tutoring sessions introduced or linked a concept (issue #140). Kept when a vault is deleted or\n * re-imported, and kept when its session is deleted (`session_id` becomes null, as for memories).\n */\nexport const conceptSessionSources = sqliteTable(\n \"concept_session_sources\",\n {\n id: text(\"id\").primaryKey(),\n conceptId: text(\"concept_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\").references(() => sessions.id, { onDelete: \"set null\" }),\n /** The run that wrote it; it stays `pending` until that run completes. */\n runId: text(\"run_id\").references(() => runs.id, { onDelete: \"set null\" }),\n status: text(\"status\", { enum: conceptSessionStatuses }).notNull().default(\"active\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [\n uniqueIndex(\"concept_session_sources_concept_session_idx\")\n .on(t.conceptId, t.sessionId)\n .where(sql`${t.sessionId} is not null`),\n index(\"concept_session_sources_concept_idx\").on(t.conceptId),\n index(\"concept_session_sources_session_idx\").on(t.sessionId),\n index(\"concept_session_sources_run_idx\").on(t.runId),\n ],\n);\n\nexport const conceptEdgeKinds = [\"prerequisite\", \"related\"] as const;\n\n/**\n * An edge between two concepts, one row per note that supports it. `prerequisite` reads \"from is a prerequisite of\n * to\"; a `related` edge is stored once, with the smaller id as `from`.\n */\nexport const conceptEdges = sqliteTable(\n \"concept_edges\",\n {\n fromId: text(\"from_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n toId: text(\"to_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n kind: text(\"kind\", { enum: conceptEdgeKinds }).notNull(),\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n },\n (t) => [primaryKey({ columns: [t.fromId, t.toId, t.kind, t.noteId] }), index(\"concept_edges_note_idx\").on(t.noteId), index(\"concept_edges_to_idx\").on(t.toId)],\n);\n\n/**\n * An edge between two concepts recorded during a live tutoring session (issue #140). Kept across vault deletions\n * and re-imports, and kept if the originating session is deleted (`session_id` becomes null).\n */\nexport const conceptSessionEdges = sqliteTable(\n \"concept_session_edges\",\n {\n id: text(\"id\").primaryKey(),\n fromId: text(\"from_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n toId: text(\"to_id\")\n .notNull()\n .references(() => concepts.id, { onDelete: \"cascade\" }),\n kind: text(\"kind\", { enum: conceptEdgeKinds }).notNull(),\n sessionId: text(\"session_id\").references(() => sessions.id, { onDelete: \"set null\" }),\n /** The run that wrote it; it stays `pending` until that run completes. */\n runId: text(\"run_id\").references(() => runs.id, { onDelete: \"set null\" }),\n status: text(\"status\", { enum: conceptSessionStatuses }).notNull().default(\"active\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [\n uniqueIndex(\"concept_session_edges_edge_session_idx\")\n .on(t.fromId, t.toId, t.kind, t.sessionId)\n .where(sql`${t.sessionId} is not null`),\n index(\"concept_session_edges_from_to_idx\").on(t.fromId, t.toId, t.kind),\n index(\"concept_session_edges_to_idx\").on(t.toId),\n index(\"concept_session_edges_session_idx\").on(t.sessionId),\n index(\"concept_session_edges_run_idx\").on(t.runId),\n ],\n);\n\n/**\n * Every note that supports a memory drawn from notes, its own `note_id` among them, with the text that note gave.\n * Repeats aren't saved twice (one `known` memory per concept per import), so a memory can stand on several notes; it\n * moves to another when its note goes, taking that note's text unless the learner edited it, and goes only with the\n * last.\n */\nexport const memorySources = sqliteTable(\n \"memory_sources\",\n {\n memoryId: text(\"memory_id\")\n .notNull()\n .references(() => memories.id, { onDelete: \"cascade\" }),\n noteId: text(\"note_id\")\n .notNull()\n .references(() => notes.id, { onDelete: \"cascade\" }),\n /** What this note said, as the model put it: the memory's text if it moves to this note. */\n text: text(\"text\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.memoryId, t.noteId] }), index(\"memory_sources_note_idx\").on(t.noteId)],\n);\n\n/**\n * A spaced-review session (Phase 2A): an ordinary chat session the learner started from their \"Due for review\" list,\n * with the concepts it was seeded with. `concepts` is the JSON list of due items as they stood when it started, so the\n * tutor's instructions stay the same for the whole session. Which concepts are due is never stored (ADR-009).\n */\nexport const reviewSessions = sqliteTable(\"review_sessions\", {\n sessionId: text(\"session_id\")\n .primaryKey()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n concepts: text(\"concepts\", { mode: \"json\" }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n});\n\nexport const flashcardRatings = [\"again\", \"good\", \"easy\"] as const;\n\n/**\n * Flashcard self-ratings (Phase 3C): one row per rating of one card in a flashcard_deck artifact, with the schedule it\n * set. A self-rating is a subjective scheduling signal, not graded evidence (ADR-006, ADR-009), so it lives here and\n * never in `attempts`: mastery, the due-for-review queue and the learner's concept state never read this table.\n */\nexport const flashcardReviews = sqliteTable(\n \"flashcard_reviews\",\n {\n id: text(\"id\").primaryKey(),\n artifactId: text(\"artifact_id\")\n .notNull()\n .references(() => artifacts.id, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\")\n .notNull()\n .references(() => sessions.id, { onDelete: \"cascade\" }),\n cardId: text(\"card_id\").notNull(),\n rating: text(\"rating\", { enum: flashcardRatings }).notNull(),\n repetitions: integer(\"repetitions\").notNull(),\n intervalDays: integer(\"interval_days\").notNull(),\n ease: real(\"ease\").notNull(),\n dueAt: integer(\"due_at\", { mode: \"timestamp_ms\" }).notNull(),\n createdAt: integer(\"created_at\", { mode: \"timestamp_ms\" }).notNull(),\n },\n (t) => [index(\"flashcard_reviews_card_idx\").on(t.artifactId, t.cardId, t.createdAt), index(\"flashcard_reviews_session_idx\").on(t.sessionId)],\n);\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,SAAS,WAAW,WAAW,aAAa,cAAc;AAC1D,SAAS,UAAU,SAAS,YAAY;AACxC,SAAS,qBAAqB;AAC9B,OAAO,cAAc;AACrB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,0BAA0B;;;ACNnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,WAAW;AACpB,SAAS,OAAO,SAAS,YAAY,MAAM,aAAa,MAAM,mBAAmB;AAE1E,IAAM,WAAW,YAAY,YAAY;AAAA,EAC9C,IAAI,KAAK,IAAI,EAAE,WAAW;AAAA,EAC1B,OAAO,KAAK,OAAO,EAAE,QAAQ;AAAA;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