@vue-skuilder/db 0.1.23 → 0.1.25

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 (80) hide show
  1. package/dist/{contentSource-BP9hznNV.d.ts → contentSource-BmnmvH8C.d.ts} +268 -3
  2. package/dist/{contentSource-DsJadoBU.d.cts → contentSource-DfBbaLA-.d.cts} +268 -3
  3. package/dist/core/index.d.cts +310 -6
  4. package/dist/core/index.d.ts +310 -6
  5. package/dist/core/index.js +2606 -666
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +2564 -639
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-CHYrQ5pB.d.cts → dataLayerProvider-BeRXVMs5.d.cts} +1 -1
  10. package/dist/{dataLayerProvider-MDTxXq2l.d.ts → dataLayerProvider-CG9GfaAY.d.ts} +1 -1
  11. package/dist/impl/couch/index.d.cts +11 -3
  12. package/dist/impl/couch/index.d.ts +11 -3
  13. package/dist/impl/couch/index.js +2336 -656
  14. package/dist/impl/couch/index.js.map +1 -1
  15. package/dist/impl/couch/index.mjs +2316 -631
  16. package/dist/impl/couch/index.mjs.map +1 -1
  17. package/dist/impl/static/index.d.cts +4 -4
  18. package/dist/impl/static/index.d.ts +4 -4
  19. package/dist/impl/static/index.js +2312 -632
  20. package/dist/impl/static/index.js.map +1 -1
  21. package/dist/impl/static/index.mjs +2315 -630
  22. package/dist/impl/static/index.mjs.map +1 -1
  23. package/dist/{index-Dj0SEgk3.d.ts → index-BWvO-_rJ.d.ts} +1 -1
  24. package/dist/{index-B_j6u5E4.d.cts → index-Ba7hYbHj.d.cts} +1 -1
  25. package/dist/index.d.cts +278 -20
  26. package/dist/index.d.ts +278 -20
  27. package/dist/index.js +3603 -720
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +3529 -674
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/{types-DQaXnuoc.d.ts → types-CJrLM1Ew.d.ts} +1 -1
  32. package/dist/{types-Bn0itutr.d.cts → types-W8n-B6HG.d.cts} +1 -1
  33. package/dist/{types-legacy-DDY4N-Uq.d.cts → types-legacy-JXDxinpU.d.cts} +5 -1
  34. package/dist/{types-legacy-DDY4N-Uq.d.ts → types-legacy-JXDxinpU.d.ts} +5 -1
  35. package/dist/util/packer/index.d.cts +3 -3
  36. package/dist/util/packer/index.d.ts +3 -3
  37. package/docs/brainstorm-navigation-paradigm.md +40 -34
  38. package/docs/future-orchestration-vision.md +216 -0
  39. package/docs/navigators-architecture.md +210 -9
  40. package/docs/todo-review-urgency-adaptation.md +205 -0
  41. package/docs/todo-strategy-authoring.md +8 -6
  42. package/package.json +3 -3
  43. package/src/core/index.ts +2 -0
  44. package/src/core/interfaces/contentSource.ts +7 -0
  45. package/src/core/interfaces/userDB.ts +50 -0
  46. package/src/core/navigators/Pipeline.ts +132 -5
  47. package/src/core/navigators/PipelineAssembler.ts +21 -22
  48. package/src/core/navigators/PipelineDebugger.ts +426 -0
  49. package/src/core/navigators/filters/WeightedFilter.ts +141 -0
  50. package/src/core/navigators/filters/types.ts +4 -0
  51. package/src/core/navigators/generators/CompositeGenerator.ts +82 -19
  52. package/src/core/navigators/generators/elo.ts +14 -1
  53. package/src/core/navigators/generators/srs.ts +146 -18
  54. package/src/core/navigators/generators/types.ts +4 -0
  55. package/src/core/navigators/index.ts +203 -13
  56. package/src/core/orchestration/gradient.ts +133 -0
  57. package/src/core/orchestration/index.ts +210 -0
  58. package/src/core/orchestration/learning.ts +250 -0
  59. package/src/core/orchestration/recording.ts +92 -0
  60. package/src/core/orchestration/signal.ts +67 -0
  61. package/src/core/types/contentNavigationStrategy.ts +38 -0
  62. package/src/core/types/learningState.ts +77 -0
  63. package/src/core/types/types-legacy.ts +4 -0
  64. package/src/core/types/userOutcome.ts +51 -0
  65. package/src/courseConfigRegistration.ts +107 -0
  66. package/src/factory.ts +6 -0
  67. package/src/impl/common/BaseUserDB.ts +16 -0
  68. package/src/impl/couch/user-course-relDB.ts +12 -0
  69. package/src/study/MixerDebugger.ts +555 -0
  70. package/src/study/SessionController.ts +159 -20
  71. package/src/study/SessionDebugger.ts +442 -0
  72. package/src/study/SourceMixer.ts +36 -17
  73. package/src/study/TODO-session-scheduling.md +133 -0
  74. package/src/study/index.ts +2 -0
  75. package/src/study/services/EloService.ts +79 -4
  76. package/src/study/services/ResponseProcessor.ts +130 -72
  77. package/src/study/services/SrsService.ts +9 -0
  78. package/tests/core/navigators/Pipeline.test.ts +2 -0
  79. package/tests/core/navigators/PipelineAssembler.test.ts +4 -4
  80. package/docs/todo-evolutionary-orchestration.md +0 -310
@@ -1,5 +1,5 @@
1
1
  import { CourseConfig } from '@vue-skuilder/common';
2
- import { D as DocType } from './types-legacy-DDY4N-Uq.js';
2
+ import { D as DocType } from './types-legacy-JXDxinpU.js';
3
3
 
4
4
  interface StaticCourseManifest {
5
5
  version: string;
@@ -1,5 +1,5 @@
1
1
  import { CourseConfig } from '@vue-skuilder/common';
2
- import { D as DocType } from './types-legacy-DDY4N-Uq.cjs';
2
+ import { D as DocType } from './types-legacy-JXDxinpU.cjs';
3
3
 
4
4
  interface StaticCourseManifest {
5
5
  version: string;
@@ -14,7 +14,9 @@ declare enum DocType {
14
14
  SCHEDULED_CARD = "SCHEDULED_CARD",
15
15
  TAG = "TAG",
16
16
  NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY",
17
- STRATEGY_STATE = "STRATEGY_STATE"
17
+ STRATEGY_STATE = "STRATEGY_STATE",
18
+ USER_OUTCOME = "USER_OUTCOME",
19
+ STRATEGY_LEARNING_STATE = "STRATEGY_LEARNING_STATE"
18
20
  }
19
21
  interface QualifiedCardID {
20
22
  courseID: string;
@@ -91,6 +93,8 @@ declare const DocTypePrefixes: {
91
93
  readonly PEDAGOGY: "PEDAGOGY";
92
94
  readonly NAVIGATION_STRATEGY: "NAVIGATION_STRATEGY";
93
95
  readonly STRATEGY_STATE: "STRATEGY_STATE";
96
+ readonly USER_OUTCOME: "USER_OUTCOME";
97
+ readonly STRATEGY_LEARNING_STATE: "STRATEGY_LEARNING_STATE";
94
98
  };
95
99
  interface CardHistory<T extends CardRecord> {
96
100
  _id: PouchDB.Core.DocumentId;
@@ -14,7 +14,9 @@ declare enum DocType {
14
14
  SCHEDULED_CARD = "SCHEDULED_CARD",
15
15
  TAG = "TAG",
16
16
  NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY",
17
- STRATEGY_STATE = "STRATEGY_STATE"
17
+ STRATEGY_STATE = "STRATEGY_STATE",
18
+ USER_OUTCOME = "USER_OUTCOME",
19
+ STRATEGY_LEARNING_STATE = "STRATEGY_LEARNING_STATE"
18
20
  }
19
21
  interface QualifiedCardID {
20
22
  courseID: string;
@@ -91,6 +93,8 @@ declare const DocTypePrefixes: {
91
93
  readonly PEDAGOGY: "PEDAGOGY";
92
94
  readonly NAVIGATION_STRATEGY: "NAVIGATION_STRATEGY";
93
95
  readonly STRATEGY_STATE: "STRATEGY_STATE";
96
+ readonly USER_OUTCOME: "USER_OUTCOME";
97
+ readonly STRATEGY_LEARNING_STATE: "STRATEGY_LEARNING_STATE";
94
98
  };
95
99
  interface CardHistory<T extends CardRecord> {
96
100
  _id: PouchDB.Core.DocumentId;
@@ -1,5 +1,5 @@
1
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-Bn0itutr.cjs';
2
- export { C as CouchDBToStaticPacker } from '../../index-B_j6u5E4.cjs';
1
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-W8n-B6HG.cjs';
2
+ export { C as CouchDBToStaticPacker } from '../../index-Ba7hYbHj.cjs';
3
3
  import '@vue-skuilder/common';
4
- import '../../types-legacy-DDY4N-Uq.cjs';
4
+ import '../../types-legacy-JXDxinpU.cjs';
5
5
  import 'moment';
@@ -1,5 +1,5 @@
1
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-DQaXnuoc.js';
2
- export { C as CouchDBToStaticPacker } from '../../index-Dj0SEgk3.js';
1
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-CJrLM1Ew.js';
2
+ export { C as CouchDBToStaticPacker } from '../../index-BWvO-_rJ.js';
3
3
  import '@vue-skuilder/common';
4
- import '../../types-legacy-DDY4N-Uq.js';
4
+ import '../../types-legacy-JXDxinpU.js';
5
5
  import 'moment';
@@ -1,6 +1,10 @@
1
1
  # Brainstorm: Navigation Paradigm Exploration
2
2
 
3
3
  > **Status:** Informal brainstorming. Not a design doc or TODO.
4
+ >
5
+ > **Note:** Many concepts explored here have since been implemented.
6
+ > See `navigators-architecture.md` for current architecture and
7
+ > `devlog/1032-orchestrator` for evolutionary orchestration implementation.
4
8
 
5
9
  This document explores the navigation strategy paradigm: what other strategy types
6
10
  might exist, where the current design shines or struggles, and what alternative
@@ -79,7 +83,8 @@ Trigger-response generators need:
79
83
  4. **Exit criteria** — When does intervention end?
80
84
 
81
85
  This argues for strategies having **lifecycle state**, not just stateless scoring.
82
- See `todo-strategy-state-storage.md` for related concerns.
86
+ **Update:** Strategy state storage is now implemented via `StrategyStateDoc` see
87
+ `navigators-architecture.md` for details.
83
88
 
84
89
  ---
85
90
 
@@ -138,7 +143,7 @@ Strategies are instantiated per-request. No persistence of:
138
143
  - "Last time I surfaced tag X was..."
139
144
  - "This user responds well to strategy Y"
140
145
 
141
- **Mitigation:** `todo-strategy-state-storage.md` (not implemented)
146
+ **Mitigation:** ✅ Implemented via `StrategyStateDoc` — see `navigators-architecture.md`
142
147
 
143
148
  ### 2. Pull-Only Model
144
149
 
@@ -255,25 +260,30 @@ rules:
255
260
  **Pros:** Declarative, inspectable, author-configurable
256
261
  **Cons:** Limited expressiveness, new DSL to maintain
257
262
 
258
- ### 4. Bandit Selection (Planned)
263
+ ### 4. Bandit-Style Selection (IMPLEMENTED ✅)
259
264
 
260
- Instead of a fixed pipeline, select among N candidate pipelines:
265
+ Strategies carry **learnable weights** that automatically tune based on outcomes:
261
266
 
262
267
  ```
263
- PipelineA: ELO
264
- PipelineB: Hierarchy(ELO)
265
- PipelineC: Interference(Hierarchy(ELO))
266
-
267
- Orchestrator selects pipeline per-session based on:
268
- - User cohort
269
- - Historical effectiveness
270
- - Exploration/exploitation balance
268
+ Strategy weights = { weight: 1.2, confidence: 0.8, sampleSize: 500 }
269
+
270
+ Users are distributed across weight space via deviation:
271
+ effectiveWeight = peakWeight + deviation * spread
272
+
273
+ Gradient learning correlates deviation with outcomes:
274
+ +deviation +outcome → increase peak
275
+ +deviation → -outcome decrease peak
271
276
  ```
272
277
 
273
- **Pros:** Learns what works, self-improving
274
- **Cons:** Requires outcome measurement, cold-start problem
278
+ **Implemented features:**
279
+ - LearnableWeight on strategies
280
+ - Deviation-based cohort distribution
281
+ - Outcome recording per user/period
282
+ - Gradient computation via linear regression
283
+ - Automatic weight updates
284
+ - Observability API endpoints
275
285
 
276
- See `todo-evolutionary-orchestration.md`.
286
+ See `navigators-architecture.md` for details.
277
287
 
278
288
  ### 5. LLM-Guided Selection
279
289
 
@@ -316,23 +326,20 @@ Solver finds valid card sequence.
316
326
 
317
327
  Rather than wholesale paradigm shift, extend current model:
318
328
 
319
- ### Near-term (compatible with naive orchestration)
329
+ ### Completed
320
330
 
321
- 1. **Richer context** — Pass session state to strategies
322
- 2. **Trigger-response generator** — New generator type with activation state
323
- 3. **Session-scoped state** — Allow strategies to persist within-session
331
+ 1. **Pipeline architecture** — Generators + Filters with provenance tracking
332
+ 2. **Strategy state storage** — User-scoped persistence via `StrategyStateDoc`
333
+ 3. **Evolutionary orchestration** — Learnable weights with gradient learning
334
+ 4. **Outcome measurement** — `UserOutcomeRecord` for tracking effectiveness
335
+ 5. **Observability** — API endpoints and admin dashboard
324
336
 
325
- ### Medium-term (with strategy state storage)
337
+ ### Still Applicable
326
338
 
327
- 4. **Cross-session state** — Strategies remember past sessions
328
- 5. **Event hooks** — Strategies can subscribe to card results
329
- 6. **Intervention protocol** — Active intervention preempts normal generation
330
-
331
- ### Long-term (with evolutionary orchestration)
332
-
333
- 7. **Bandit selection** among pipelines
334
- 8. **Outcome measurement** for strategy effectiveness
335
- 9. **Hybrid architectures** where blackboard/reactive patterns augment pipeline
339
+ 1. **Trigger-response generators** — Event-driven strategies with activation state
340
+ 2. **Richer context** — Session state, temporal context
341
+ 3. **Event hooks** — Strategies subscribing to card results
342
+ 4. **Intervention protocol** — Active intervention preempts normal generation
336
343
 
337
344
  ---
338
345
 
@@ -362,8 +369,7 @@ Rather than wholesale paradigm shift, extend current model:
362
369
 
363
370
  ## Related Documents
364
371
 
365
- - `navigators-architecture.md` — Current architecture
366
- - `todo-naive-orchestration.md` — Pipeline assembly (prerequisite)
367
- - `todo-strategy-state-storage.md` — State persistence
368
- - `todo-evolutionary-orchestration.md` — Bandit selection vision
369
- - `todo-provenance.md` — Audit trail (transparency)
372
+ - `navigators-architecture.md` — Current architecture (includes evolutionary orchestration)
373
+ - `future-orchestration-vision.md` — Remaining vision items (programmable strategies, self-healing)
374
+ - `todo-strategy-authoring.md` — Strategy creation tools (UI complete)
375
+ - `devlog/1032-orchestrator` — Evolutionary orchestration implementation
@@ -0,0 +1,216 @@
1
+ # Future Orchestration Vision
2
+
3
+ This document tracks aspirational features for the evolutionary orchestration system
4
+ that extend beyond the current implementation.
5
+
6
+ ## Status: VISION / NOT STARTED
7
+
8
+ > **Prerequisite:** The core orchestration system (learnable weights, deviation-based
9
+ > distribution, gradient learning) is implemented. See `navigators-architecture.md`
10
+ > for the current architecture.
11
+
12
+ ---
13
+
14
+ ## Implemented (Reference)
15
+
16
+ The following are **complete** and documented in `navigators-architecture.md`:
17
+
18
+ - ✅ LearnableWeight interface with weight, confidence, sampleSize
19
+ - ✅ Deviation-based weight distribution (bell curve sampling)
20
+ - ✅ UserOutcomeRecord for tracking learning outcomes
21
+ - ✅ Gradient computation via linear regression
22
+ - ✅ Automatic weight updates based on gradient
23
+ - ✅ Observability API endpoints (6 endpoints)
24
+ - ✅ Admin dashboard in platform-ui
25
+
26
+ ---
27
+
28
+ ## Remaining Vision
29
+
30
+ ### 1. Parameterizable / Programmable Strategies
31
+
32
+ **Goal:** Enable template-based prerequisite rules that generalize across courses.
33
+
34
+ ```typescript
35
+ interface ParameterizedPrerequisite {
36
+ pattern: "grade-{n} & {subject}";
37
+ implies: "grade-{n+1} & {subject}";
38
+ constraints: {
39
+ n: { type: "number", min: 1, max: 12 },
40
+ subject: { type: "tag-category", category: "academic-subject" }
41
+ };
42
+ }
43
+ ```
44
+
45
+ **Example use cases:**
46
+ - `grade-3 & geometry` → requires `grade-2 & geometry`
47
+ - `unit-{n} & {topic}` → requires `unit-{n-1} & {topic}`
48
+ - Cross-course strategy reuse without copy-paste
49
+
50
+ **What's needed:**
51
+ 1. Template syntax design
52
+ 2. Variable binding and substitution
53
+ 3. Rule engine to evaluate parameterized rules
54
+ 4. Cross-course strategy registry
55
+
56
+ ---
57
+
58
+ ### 2. Self-Healing Content
59
+
60
+ **Goal:** Automatically identify learning barriers and surface them to authors.
61
+
62
+ **Barrier signals:**
63
+ - High failure rate on specific cards/tags
64
+ - ELO stagnation on specific topics
65
+ - Long dwell time before mastery
66
+ - Drop-off (users abandon at specific points)
67
+ - Cohort-wide plateau detection
68
+
69
+ **Components needed:**
70
+ 1. **Barrier Detection Pipeline** — Analyze outcomes to identify stuck points
71
+ 2. **Alert System** — Notify authors of identified barriers
72
+ 3. **Intervention Hooks** — Enable targeted content insertion
73
+ 4. **Feedback Loop** — Measure whether interventions resolve barriers
74
+
75
+ **Example flow:**
76
+ ```
77
+ Detection: 40% of users fail on "long-division-with-remainders" after
78
+ mastering "long-division-no-remainder"
79
+
80
+ Alert: "Learning barrier detected between division topics.
81
+ Consider intermediate content for remainder concept."
82
+
83
+ Author action: Adds 5 cards on "remainder as leftover" concept
84
+
85
+ Feedback: Barrier detection re-runs, measures improvement
86
+ ```
87
+
88
+ ---
89
+
90
+ ### 3. Cross-Course Strategy Sharing
91
+
92
+ **Goal:** Strategies that prove effective in one course can be shared and
93
+ adapted to other courses.
94
+
95
+ **Components:**
96
+ - Strategy export/import format
97
+ - Cross-course strategy registry
98
+ - Adaptation hints for tag mapping
99
+ - Reputation/effectiveness scores from source course
100
+
101
+ ---
102
+
103
+ ### 4. Author Incentive Mechanisms
104
+
105
+ **Goal:** Create feedback loops that reward authors for effective content.
106
+
107
+ **Potential signals:**
108
+ - User outcomes correlated with specific content
109
+ - Content utility weights (cards that consistently help)
110
+ - Barrier resolution credit
111
+
112
+ **Considerations:**
113
+ - How to attribute outcomes to specific content when many cards contribute?
114
+ - How to handle content that is effective but not "fun"?
115
+ - Privacy implications of tracking detailed content effectiveness
116
+
117
+ ---
118
+
119
+ ### 5. Trigger-Response Generators
120
+
121
+ **Goal:** Event-driven generators that activate under specific conditions.
122
+
123
+ ```typescript
124
+ interface TriggerResponseGenerator {
125
+ trigger: {
126
+ condition: 'failureSpike' | 'plateau' | 'returnAfterGap' | 'frustration';
127
+ parameters: Record<string, number>;
128
+ };
129
+ response: {
130
+ mode: 'remedial' | 'confidence-building' | 'capstone';
131
+ targetTags?: string[];
132
+ duration?: { cards?: number; minutes?: number };
133
+ };
134
+ }
135
+ ```
136
+
137
+ **Example triggers:**
138
+ - Frustration signal (N failures in M minutes) → easier content
139
+ - Plateau detection (no ELO movement for K sessions) → challenging content
140
+ - Inactivity return (first session after gap) → review-heavy session
141
+
142
+ **What's needed:**
143
+ - Event bus / signal mechanism for strategies to observe events
144
+ - Activation state tracking ("I am currently intervening on tag T")
145
+ - Priority over base generator (preempt vs blend)
146
+ - Exit criteria (when does intervention end)
147
+
148
+ See `brainstorm-navigation-paradigm.md` for detailed exploration.
149
+
150
+ ---
151
+
152
+ ### 6. Cohort-Aware Calibration
153
+
154
+ **Goal:** Use population data to improve cold-start behavior.
155
+
156
+ **Applications:**
157
+ - Initial card difficulty estimates from population performance
158
+ - Initial interval estimates based on similar users
159
+ - Strategy weight priors from population effectiveness
160
+
161
+ ---
162
+
163
+ ### 7. LLM-Guided Selection (Experimental)
164
+
165
+ **Goal:** Use language models to interpret learner state and select content.
166
+
167
+ ```
168
+ Given:
169
+ - User profile: { elo: 950, strugglingWith: ['vowel-sounds'], ... }
170
+ - Session context: { duration: 12min, cardsSeen: 8, recentFailures: 2 }
171
+ - Available cards: [...]
172
+
173
+ Select the next 5 cards and explain reasoning.
174
+ ```
175
+
176
+ **Considerations:**
177
+ - Latency and cost
178
+ - Unpredictability and debugging difficulty
179
+ - When is LLM guidance worth the overhead?
180
+
181
+ ---
182
+
183
+ ## Design Decisions Ahead
184
+
185
+ ### Centralized vs Decentralized Orchestration
186
+
187
+ **Option A: Central Orchestrator Service**
188
+ - Single service decides strategy application
189
+ - Cleaner cohort tracking
190
+ - Requires backend infrastructure
191
+
192
+ **Option B: Client-Side Orchestration**
193
+ - Each client computes its own strategy set
194
+ - Works offline
195
+ - Harder to track cohorts
196
+
197
+ **Current:** Hybrid — client computes from synced registry, outcomes reported to backend.
198
+
199
+ ### Outcome Attribution
200
+
201
+ When multiple strategies are active, how do we attribute outcomes?
202
+
203
+ - All strategies get credit/blame equally?
204
+ - Weight by score contribution?
205
+ - Require isolated A/B cells?
206
+
207
+ **Current:** Equal attribution. Future work may instrument isolated testing.
208
+
209
+ ---
210
+
211
+ ## Related Documents
212
+
213
+ - `navigators-architecture.md` — Current implementation (complete)
214
+ - `brainstorm-navigation-paradigm.md` — Exploration of alternative mechanisms
215
+ - `todo-strategy-authoring.md` — Strategy creation tools
216
+ - `devlog/1032-orchestrator` — Implementation details