@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,310 +0,0 @@
1
- # TODO: Evolutionary Orchestration Vision
2
-
3
- ## Status: FOUNDATIONAL WORK COMPLETE, ORCHESTRATION NOT STARTED
4
-
5
- > **Prerequisite:** `packages/db/docs/todo-naive-orchestration.md` — Pipeline assembly must be
6
- > working before evolutionary selection can be layered on top. This document describes the
7
- > "grander vision"; naive orchestration is the foundation.
8
-
9
- This document tracks progress toward the "grander vision" of dynamic orchestration with
10
- evolutionary pressures, as outlined in `u.3.strategic-nuggets.md`.
11
-
12
- ## The Vision (Summary)
13
-
14
- A self-improving courseware system where:
15
-
16
- 1. **N strategies exist** — Each a hypothesis about effective content sequencing
17
- 2. **M users exist** — Each with learning goals and measurable outcomes
18
- 3. **Multi-arm bandit selection** — Strategies are applied based on confidence in their utility
19
- 4. **Evolutionary pressure** — Effective strategies propagate, ineffective ones decay
20
- 5. **Self-healing content** — System identifies barriers and incentivizes remediation
21
-
22
- ---
23
-
24
- ## Progress Assessment
25
-
26
- ### ✅ COMPLETE: Strategy Infrastructure
27
-
28
- | Component | Status | Notes |
29
- |-----------|--------|-------|
30
- | `WeightedCard` API | ✅ Done | Unified scored candidate model |
31
- | `ContentNavigator` base class | ✅ Done | Extensible strategy framework |
32
- | Delegate pattern composition | ✅ Done | Strategies can wrap/chain |
33
- | `HierarchyDefinition` strategy | ✅ Done | Prerequisite gating |
34
- | `InterferenceMitigator` strategy | ✅ Done | Confusable concept separation |
35
- | `RelativePriority` strategy | ✅ Done | Utility-based content ordering |
36
- | `SessionController` integration | ✅ Done | `getWeightedCards()` is live |
37
- | Pipeline assembly | ❌ Not done | See `todo-naive-orchestration.md` |
38
-
39
- **What this enables:**
40
- - Multiple strategies can coexist and be configured per-course
41
- - Strategies return graded suitability scores (0-1), not just binary include/exclude
42
- - Composition allows layering strategies: `Priority(Interference(Hierarchy(ELO)))`
43
-
44
- **What's missing for basic operation:**
45
- - No pipeline configuration in CourseConfig (`navigationPipeline` field)
46
- - No assembly logic to chain configured strategies
47
- - Currently falls back to hard-coded ELO navigator
48
-
49
- ---
50
-
51
- ### 🟡 PARTIAL: Strategy State & Context
52
-
53
- | Component | Status | Notes |
54
- |-----------|--------|-------|
55
- | Read user ELO (global + per-tag) | ✅ Done | Via `CourseRegistration.elo` |
56
- | Read user history | ✅ Done | `getSeenCards()`, `getPendingReviews()` |
57
- | Write strategy-specific state | ❌ Not done | See `todo-strategy-state-storage.md` |
58
- | Temporal tracking | ❌ Not done | "When was tag X last introduced?" |
59
-
60
- **Gap for evolutionary vision:**
61
- - Strategies cannot yet persist their own learning/state
62
- - No mechanism for tracking strategy effectiveness over time
63
-
64
- ---
65
-
66
- ### ❌ NOT STARTED: Multi-Arm Bandit Selection
67
-
68
- The core orchestration logic described in the vision:
69
-
70
- ```
71
- each of N strategies divides into cohorts via some hashId collision metric
72
- eg: h(strategyHash + slowRotationSalt) xor userHash
73
- if resultant Ones are < utilityConfidence percent of total bits,
74
- then include the strategy for the user
75
- ```
76
-
77
- **What's needed:**
78
-
79
- 1. **Strategy Registry** — Central list of available strategies with metadata
80
- 2. **Utility Confidence** — Per-strategy confidence score (0-1)
81
- 3. **Cohort Assignment** — Deterministic but rotatable user-to-strategy mapping
82
- 4. **Salt Rotation** — Periodic rotation to prevent user lock-in
83
- 5. **Outcome Measurement** — Track goal achievement per cohort
84
-
85
- **Proposed architecture:**
86
-
87
- ```typescript
88
- interface StrategyRegistryEntry {
89
- strategyId: string;
90
- strategyType: string;
91
- config: unknown;
92
-
93
- // Evolutionary metadata
94
- utilityConfidence: number; // 0-1, probability of usefulness
95
- createdAt: string;
96
- lastMeasuredAt: string;
97
- cohortSalt: string; // Rotated periodically
98
-
99
- // Outcome tracking
100
- metrics: {
101
- usersExposed: number;
102
- goalAchievementRate: number;
103
- engagementScore: number;
104
- progressRate: number;
105
- };
106
- }
107
-
108
- interface Orchestrator {
109
- // Determine which strategies apply to this user for this session
110
- selectStrategies(userId: string, courseId: string): Promise<StrategyRegistryEntry[]>;
111
-
112
- // Record outcome for evolutionary learning
113
- recordOutcome(userId: string, strategyIds: string[], outcome: Outcome): Promise<void>;
114
-
115
- // Rotate cohort assignments
116
- rotateSalt(): Promise<void>;
117
-
118
- // Prune ineffective strategies
119
- pruneStrategies(minConfidence: number): Promise<void>;
120
- }
121
- ```
122
-
123
- ---
124
-
125
- ### ❌ NOT STARTED: Parameterizable / Programmable Strategies
126
-
127
- The vision describes:
128
-
129
- ```
130
- would like to extend into parameterizable / programmable strategies.
131
- eg, should be able to specify deps like:
132
- `grade-{n}` & `geometry` -> `grade-{n+1}` & `geometry`
133
- ```
134
-
135
- **What's needed:**
136
-
137
- 1. **Template syntax** — Pattern matching for tag relationships
138
- 2. **Variable binding** — Extract and apply variables in prerequisite rules
139
- 3. **Rule engine** — Evaluate parameterized rules against user state
140
-
141
- **Example:**
142
- ```typescript
143
- interface ParameterizedPrerequisite {
144
- pattern: "grade-{n} & {subject}";
145
- implies: "grade-{n+1} & {subject}";
146
- constraints: {
147
- n: { type: "number", min: 1, max: 12 },
148
- subject: { type: "tag-category", category: "academic-subject" }
149
- };
150
- }
151
- ```
152
-
153
- ---
154
-
155
- ### ❌ NOT STARTED: Self-Healing Content
156
-
157
- The meta-consideration from the vision:
158
-
159
- ```
160
- - identifying learning 'barriers' where substantive portion of cohort gets stuck or abandons
161
- - surfacing that info in a useful way
162
- - author aims to diagnose and remedy by providing intermediate content
163
- ```
164
-
165
- **What's needed:**
166
-
167
- 1. **Barrier Detection** — Identify cards/tags where many users get stuck
168
- 2. **Cohort Analysis** — Compare progress across strategy cohorts
169
- 3. **Alert System** — Surface barriers to authors
170
- 4. **Intervention Hooks** — Enable targeted content insertion
171
- 5. **Feedback Loop** — Measure intervention effectiveness
172
-
173
- **Signals for barrier detection:**
174
- - High failure rate on specific cards
175
- - Long dwell time before mastery
176
- - Drop-off (users abandon course at specific points)
177
- - ELO stagnation on specific tags
178
-
179
- ---
180
-
181
- ## Roadmap to Full Vision
182
-
183
- ### Phase A: Foundation (COMPLETE ✅)
184
-
185
- - [x] WeightedCard API
186
- - [x] ContentNavigator framework
187
- - [x] Core strategies (Hierarchy, Interference, RelativePriority)
188
- - [x] SessionController integration
189
-
190
- ### Phase B: Strategy Ecosystem (IN PROGRESS 🟡)
191
-
192
- - [ ] SRS as ContentNavigator (`todo-srs-navigator.md`)
193
- - [ ] Strategy authoring tools (`todo-strategy-authoring.md`)
194
- - [ ] Strategy state storage (`todo-strategy-state-storage.md`)
195
- - [ ] Provenance/audit trail (`todo-provenance.md`)
196
-
197
- ### Phase C: Measurement Infrastructure (NOT STARTED)
198
-
199
- - [ ] Define "learning outcome" metrics
200
- - [ ] Instrument strategy usage per user
201
- - [ ] Track outcome-to-strategy correlation
202
- - [ ] Build cohort comparison views
203
-
204
- ### Phase D: Multi-Arm Bandit Orchestrator (NOT STARTED)
205
-
206
- - [ ] Strategy registry with utility confidence
207
- - [ ] Cohort assignment algorithm
208
- - [ ] Salt rotation mechanism
209
- - [ ] Confidence update rules (Bayesian or frequentist)
210
- - [ ] Orchestrator integration with SessionController
211
-
212
- ### Phase E: Evolutionary Pressure (NOT STARTED)
213
-
214
- - [ ] Strategy creation incentives
215
- - [ ] Automatic strategy pruning
216
- - [ ] Strategy mutation/variation generation
217
- - [ ] A/B testing framework
218
-
219
- ### Phase F: Self-Healing (NOT STARTED)
220
-
221
- - [ ] Barrier detection pipeline
222
- - [ ] Author alerting system
223
- - [ ] Intervention recommendation engine
224
- - [ ] Content gap analysis
225
-
226
- ### Phase G: Programmable Strategies (NOT STARTED)
227
-
228
- - [ ] Template syntax design
229
- - [ ] Rule engine implementation
230
- - [ ] Variable binding in prerequisites
231
- - [ ] Cross-course strategy generalization
232
-
233
- ---
234
-
235
- ## Key Design Decisions Ahead
236
-
237
- ### 1. Centralized vs Decentralized Orchestration
238
-
239
- **Option A: Central Orchestrator Service**
240
- - Single service decides strategy application
241
- - Cleaner cohort tracking
242
- - Requires backend infrastructure
243
-
244
- **Option B: Client-Side Orchestration**
245
- - Each client computes its own strategy set
246
- - Works offline
247
- - Harder to track cohorts
248
-
249
- **Recommendation:** Hybrid — client computes from synced registry, outcomes reported to backend.
250
-
251
- ### 2. Confidence Update Mechanism
252
-
253
- **Option A: Frequentist (Simple)**
254
- - Track success/failure counts
255
- - Confidence = success_rate with smoothing
256
- - Easy to implement
257
-
258
- **Option B: Bayesian (Principled)**
259
- - Prior belief + observed evidence
260
- - Thompson sampling for exploration/exploitation
261
- - More complex but theoretically sound
262
-
263
- **Recommendation:** Start with frequentist, migrate to Bayesian if needed.
264
-
265
- ### 3. Strategy Granularity
266
-
267
- **Question:** What counts as "a strategy" for evolutionary purposes?
268
-
269
- - A specific `HierarchyDefinition` config? (Fine-grained)
270
- - The `HierarchyDefinition` approach in general? (Coarse-grained)
271
- - A specific prerequisite rule within a hierarchy? (Very fine-grained)
272
-
273
- **Recommendation:** Start coarse (strategy type + major config), add granularity as measurement matures.
274
-
275
- ### 4. Outcome Attribution
276
-
277
- **Question:** If a user is exposed to multiple strategies, how do we attribute outcomes?
278
-
279
- - All strategies get credit/blame equally?
280
- - Weight by score contribution?
281
- - Require isolated A/B cells?
282
-
283
- **Recommendation:** Start with equal attribution, instrument for isolated testing later.
284
-
285
- ---
286
-
287
- ## Related Documents
288
-
289
- - `u.3.strategic-nuggets.md` — Original vision statement
290
- - `todo-srs-navigator.md` — SRS migration
291
- - `todo-strategy-authoring.md` — Authoring tools
292
- - `todo-strategy-state-storage.md` — State persistence
293
- - `todo-provenance.md` — Audit trail for transparency
294
- - `a.2.plan.md` — Detailed implementation plan
295
- - `a.3.todo.md` — Task tracking
296
- - `packages/db/docs/navigators-architecture.md` — Technical architecture
297
-
298
- ---
299
-
300
- ## Summary
301
-
302
- **Where we are:** Solid foundation. Strategies exist, compose, return scores, and are integrated
303
- with SessionController. The infrastructure supports the vision.
304
-
305
- **What's next:** Build the measurement and orchestration layers. The strategies can now *exist*;
306
- we need to make them *compete* and *evolve*.
307
-
308
- **The gap:** The evolutionary pressure mechanisms (multi-arm bandit selection, outcome measurement,
309
- confidence updates, self-healing) are not yet implemented. This is where the "magic" of the
310
- vision lives, and it's entirely ahead of us.