@framers/agentos 0.5.2 → 0.5.3

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 (29) hide show
  1. package/dist/memory/retrieval/typed-network/TypedNetworkObserver.d.ts +17 -0
  2. package/dist/memory/retrieval/typed-network/TypedNetworkObserver.d.ts.map +1 -1
  3. package/dist/memory/retrieval/typed-network/TypedNetworkObserver.js +45 -6
  4. package/dist/memory/retrieval/typed-network/TypedNetworkObserver.js.map +1 -1
  5. package/dist/memory/retrieval/typed-network/prompts/extraction-schema.d.ts +4 -3
  6. package/dist/memory/retrieval/typed-network/prompts/extraction-schema.d.ts.map +1 -1
  7. package/dist/memory/retrieval/typed-network/prompts/extraction-schema.js +4 -3
  8. package/dist/memory/retrieval/typed-network/prompts/extraction-schema.js.map +1 -1
  9. package/dist/memory-router/MemoryRouter.d.ts +85 -1
  10. package/dist/memory-router/MemoryRouter.d.ts.map +1 -1
  11. package/dist/memory-router/MemoryRouter.js +88 -1
  12. package/dist/memory-router/MemoryRouter.js.map +1 -1
  13. package/dist/memory-router/dispatcher.d.ts +39 -1
  14. package/dist/memory-router/dispatcher.d.ts.map +1 -1
  15. package/dist/memory-router/dispatcher.js +9 -1
  16. package/dist/memory-router/dispatcher.js.map +1 -1
  17. package/dist/memory-router/index.d.ts +7 -5
  18. package/dist/memory-router/index.d.ts.map +1 -1
  19. package/dist/memory-router/index.js +7 -2
  20. package/dist/memory-router/index.js.map +1 -1
  21. package/dist/memory-router/retrieval-config.d.ts +147 -0
  22. package/dist/memory-router/retrieval-config.d.ts.map +1 -0
  23. package/dist/memory-router/retrieval-config.js +268 -0
  24. package/dist/memory-router/retrieval-config.js.map +1 -0
  25. package/dist/memory-router/routing-tables.d.ts +112 -0
  26. package/dist/memory-router/routing-tables.d.ts.map +1 -1
  27. package/dist/memory-router/routing-tables.js +113 -0
  28. package/dist/memory-router/routing-tables.js.map +1 -1
  29. package/package.json +1 -1
@@ -22,6 +22,13 @@
22
22
  * temporal-reasoning back to canonical-hybrid after Phase B revealed the
23
23
  * v1 routing's accuracy gain was within CI noise but paid OM ingest cost.
24
24
  *
25
+ * **Augmented routing (2026-04-26):** The {@link AugmentedRoutingTable}
26
+ * extends the basic dispatch contract with an orthogonal axis — a
27
+ * per-category {@link RetrievalConfigId} pick — so the router can
28
+ * dispatch on (backend × retrieval-config) rather than backend alone.
29
+ * The {@link MINIMIZE_COST_AUGMENTED_TABLE} preset is calibrated from
30
+ * the LongMemEval-M Phase A N=54 ablation matrix (2026-04-26).
31
+ *
25
32
  * @module @framers/agentos/memory-router/routing-tables
26
33
  */
27
34
  // ============================================================================
@@ -134,4 +141,110 @@ export const PRESET_TABLES = Object.freeze({
134
141
  'balanced': BALANCED_TABLE,
135
142
  'maximize-accuracy': MAXIMIZE_ACCURACY_TABLE,
136
143
  });
144
+ // ============================================================================
145
+ // Augmented routing: (backend × retrieval-config) dispatch
146
+ // ============================================================================
147
+ /**
148
+ * The cheapest-and-safest {@link MemoryBackendId} the router can ever
149
+ * pick. Used by {@link SAFE_FALLBACK_DISPATCH_KEY} when an augmented
150
+ * lookup misses (e.g. the predicted category is not in the table or
151
+ * the table is malformed). Matches the existing behavior of
152
+ * {@link MINIMIZE_COST_TABLE} for unknown categories: degrade to the
153
+ * cheap path rather than the OM-premium path.
154
+ */
155
+ export const SAFE_FALLBACK_BACKEND = 'canonical-hybrid';
156
+ /**
157
+ * Default {@link MemoryDispatchKey} used when an augmented lookup
158
+ * misses. Matches the cheap-and-safe path: canonical-hybrid backend
159
+ * with the canonical retrieval config (no HyDE, default rerank,
160
+ * default reader top-K).
161
+ *
162
+ * Frozen at module load.
163
+ */
164
+ export const SAFE_FALLBACK_DISPATCH_KEY = Object.freeze({
165
+ backend: SAFE_FALLBACK_BACKEND,
166
+ retrievalConfig: 'canonical',
167
+ });
168
+ /**
169
+ * Preset: minimize-cost-augmented (2026-04-26 v2).
170
+ *
171
+ * Combines two calibrations into one dispatch table:
172
+ *
173
+ * - **Backend axis** from the LongMemEval-S Phase B N=500
174
+ * {@link MINIMIZE_COST_TABLE}: SSP and MS pay the OM-v11 premium
175
+ * (architectural lift earns it); every other category routes to
176
+ * canonical-hybrid (cheapest Pareto-dominant).
177
+ * - **Retrieval-config axis** from the LongMemEval-M Phase A N=54
178
+ * ablation matrix (per-category-oracle picks): SSA + SSU + MS use
179
+ * the full combined `hyde-topk50-mult5`; KU uses `topk50` (top-K
180
+ * alone is sufficient and cheaper); TR + SSP use `hyde` alone (the
181
+ * wider rerank pool actively hurts these categories).
182
+ *
183
+ * The 2026-04-26 forecasted aggregate at this dispatch table on
184
+ * LongMemEval-M is **68.5%** (per-category-oracle empirical from the
185
+ * ablation matrix), vs **57.4%** static M-tuned (`hyde-topk50-mult5`
186
+ * everywhere) and **30.6%** baseline (`canonical` everywhere).
187
+ * Phase A validation at this preset is the next gate (see
188
+ * `2026-04-26-retrieval-config-router-productionization-plan.md`).
189
+ *
190
+ * **Calibration validity,** N=54 single-seed Phase A on M plus N=500
191
+ * Phase B on S. Phase B at full N=500 on M will tighten per-category
192
+ * confidence intervals; the table here is the directional best-guess
193
+ * for v2 and SHOULD be re-derived from any future Phase B run.
194
+ */
195
+ export const MINIMIZE_COST_AUGMENTED_TABLE = Object.freeze({
196
+ preset: 'minimize-cost-augmented',
197
+ defaultMapping: Object.freeze({
198
+ 'single-session-assistant': Object.freeze({
199
+ backend: 'canonical-hybrid',
200
+ retrievalConfig: 'hyde-topk50-mult5',
201
+ }),
202
+ 'single-session-user': Object.freeze({
203
+ backend: 'canonical-hybrid',
204
+ retrievalConfig: 'hyde-topk50-mult5',
205
+ }),
206
+ 'single-session-preference': Object.freeze({
207
+ backend: 'observational-memory-v11',
208
+ retrievalConfig: 'hyde',
209
+ }),
210
+ 'knowledge-update': Object.freeze({
211
+ backend: 'canonical-hybrid',
212
+ retrievalConfig: 'topk50',
213
+ }),
214
+ 'multi-session': Object.freeze({
215
+ backend: 'observational-memory-v11',
216
+ retrievalConfig: 'hyde-topk50-mult5',
217
+ }),
218
+ 'temporal-reasoning': Object.freeze({
219
+ backend: 'canonical-hybrid',
220
+ retrievalConfig: 'hyde',
221
+ }),
222
+ }),
223
+ });
224
+ /**
225
+ * Convenience registry of augmented preset tables, keyed by preset
226
+ * name. v2 ships only `minimize-cost-augmented`; the other two
227
+ * preset names will be wired in v3 alongside Stage E.
228
+ */
229
+ export const AUGMENTED_PRESET_TABLES = Object.freeze({
230
+ 'minimize-cost-augmented': MINIMIZE_COST_AUGMENTED_TABLE,
231
+ });
232
+ /**
233
+ * Pure-function selector: given a category and an
234
+ * {@link AugmentedRoutingTable}, return the calibrated
235
+ * {@link MemoryDispatchKey}. Falls back to
236
+ * {@link SAFE_FALLBACK_DISPATCH_KEY} when the table is missing the
237
+ * category (a defensive guard for custom-table misuse; the shipping
238
+ * presets cover every category).
239
+ *
240
+ * Stateless. Deterministic. No I/O. Suitable for use inside
241
+ * cache-key construction and hot dispatch loops.
242
+ *
243
+ * @param category - The classifier-predicted query category.
244
+ * @param table - The augmented routing table to consult.
245
+ * @returns A frozen {@link MemoryDispatchKey} for the category.
246
+ */
247
+ export function selectAugmentedDispatch(category, table) {
248
+ return table.defaultMapping[category] ?? SAFE_FALLBACK_DISPATCH_KEY;
249
+ }
137
250
  //# sourceMappingURL=routing-tables.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing-tables.js","sourceRoot":"","sources":["../../src/memory-router/routing-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,kBAAkB;IAClB,eAAe;IACf,oBAAoB;CACZ,CAAC;AA+CX,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;;;;;;;;;GAeG;AACH,MA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AC;YAChC,OAAO,EAAE,kBAA2B;YACpC,eAAe,EAAE,QAAiB;SACnC,CAAC;QACF,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,0BAAmC;YAC5C,eAAe,EAAE,mBAA4B;SAC9C,CAAC;QACF,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC;YAClC,OAAO,EAAE,kBAA2B;YACpC,eAAe,EAAE,MAAe;SACjC,CAAC;KACH,CAAC;CACH,CAA0B,CAAC;AAE5B;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAEhC,MAAM,CAAC,MAAM,CAAC;IAChB,yBAAyB,EAAE,6BAA6B;CACzD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAA6B,EAC7B,KAA4B;IAE5B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,0BAA0B,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Modular AgentOS orchestration library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",