dsh-model-switch 0.4.55 → 0.4.57

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.
@@ -1,599 +1,2 @@
1
- import { r as memoryRouteOf } from "./session-route-D8izd8Zd.js";
2
- //#region lib/types/prime-memory-route.js
3
- /**
4
- * Model Switch's adapter to `dsh-prime-memory`'s distillation route.
5
- *
6
- * prime-memory owns its distillation route: a `distillChain` in the volatile
7
- * `live` settings section (`distillProvider`/`distillModel` before 0.x chains
8
- * existed), read through its own settings handle and committed with
9
- * `ctx.settings.update('dsh-memory', { live })` — a volatile-only commit that
10
- * does not remount the plugin. This module only builds the write Model Switch
11
- * offers; it never runs a distillation call, never rewrites the plugin, and
12
- * never changes a route the user did not ask to change.
13
- *
14
- * All functions here are pure.
15
- */
16
- /** The loader row id prime-memory is composed under (fixed by its bundle patch). */
17
- const PRIME_MEMORY_ENTRY_ID = "dsh-memory";
18
- /** The package name that identifies the row; the authoritative identity. */
19
- const PRIME_MEMORY_PACKAGE = "dsh-prime-memory";
20
- /** A non-blank string; blank values behave exactly like an absent field. */
21
- function present(value) {
22
- return typeof value === "string" && value.trim() !== "";
23
- }
24
- /**
25
- * Whether one loader entry is prime-memory.
26
- *
27
- * The package name wins over the row id: a profile layer may rename the row,
28
- * while an unrelated row could recycle the id.
29
- * @param entry - the loader entry to test.
30
- * @returns True for prime-memory's row.
31
- */
32
- function isPrimeMemoryRow(entry) {
33
- const name = entry?.options?.name;
34
- if (present(name)) return name === PRIME_MEMORY_PACKAGE;
35
- return entry?.options?.id === PRIME_MEMORY_ENTRY_ID;
36
- }
37
- /**
38
- * The chain prime-memory should use, given the route Model Switch wants.
39
- *
40
- * The chosen route goes first; the entries prime-memory already had follow in
41
- * their own order, minus any route that duplicates the chosen one (a duplicate
42
- * is a guaranteed second failure, not a fallback). An empty chosen route leaves
43
- * the existing chain untouched.
44
- * @param primary - the route Model Switch wants first, if any.
45
- * @param existing - prime-memory's current chain, as read from its settings.
46
- * @returns The chain to write; empty when neither side has a complete route.
47
- */
48
- function planDistillChain(primary, existing) {
49
- const chain = [];
50
- const seen = /* @__PURE__ */ new Set();
51
- const push = (entry) => {
52
- const key = `${entry.provider}\u0000${entry.model}`;
53
- if (seen.has(key)) return;
54
- seen.add(key);
55
- chain.push(entry);
56
- };
57
- if (primary !== void 0 && present(primary.provider) && present(primary.model)) {
58
- const effort = primary.reasoningEffort;
59
- push(present(effort) ? {
60
- provider: primary.provider,
61
- model: primary.model,
62
- reasoningEffort: effort
63
- } : {
64
- provider: primary.provider,
65
- model: primary.model
66
- });
67
- }
68
- for (const entry of existing ?? []) {
69
- if (!present(entry.provider) || !present(entry.model)) continue;
70
- push(present(entry.reasoningEffort) ? {
71
- provider: entry.provider,
72
- model: entry.model,
73
- reasoningEffort: entry.reasoningEffort
74
- } : {
75
- provider: entry.provider,
76
- model: entry.model
77
- });
78
- }
79
- return chain;
80
- }
81
- /**
82
- * The settings patch that writes one distillation chain.
83
- *
84
- * Only the `distillChain` key is produced: prime-memory's `live` section carries
85
- * unrelated switches (capture, trace, embedding, memory mutation), and a patch
86
- * naming them would rewrite the user's choices.
87
- * @param chain - the chain to write.
88
- * @returns The `live` patch to pass to `ctx.settings.update`.
89
- */
90
- function distillChainPatch(chain) {
91
- return { live: { distillChain: chain } };
92
- }
93
- //#endregion
94
- //#region lib/types/prime-memory-compat.js
95
- /**
96
- * Adapt `dsh-prime-memory`'s distillation route to this plugin's route.
97
- *
98
- * The memory plugin resolves its distillation route from its own runtime
99
- * settings section (`live.distillChain`, legacy `live.distillProvider/Model`,
100
- * else the deployment default model), and it WRITES that section through the
101
- * host's settings-forms service:
102
- *
103
- * await forms.update('dsh-memory', { live: next })
104
- *
105
- * Its row config is read once at plugin init, so patching
106
- * `entry.options.config.llm.*` afterwards has no effect (verified on 0.2.1-rc.3:
107
- * the model kept being the deployment default). This adapter therefore writes
108
- * the same section the plugin itself writes, and only that key:
109
- *
110
- * - a chain that is already set and is not the one this adapter wrote counts as
111
- * user intent and is left alone (`user-set`);
112
- * - an empty Model Switch route means "leave it alone" (`no-route`);
113
- * - nothing is persisted by us beyond that section, and no other `live` key
114
- * (capture, trace, embedding, memory mutation) is touched.
115
- *
116
- * The route itself is provider-group based: the group of the deployment default
117
- * provider (read from the `agent-default-model` row), falling back to the flat
118
- * memory pair.
119
- */
120
- /** Row name and dependencies, mirroring the sibling adapter row. */
121
- const name = "model-switch-prime-memory-compat";
122
- const inject = [
123
- "loader",
124
- "modelSwitch",
125
- "settings"
126
- ];
127
- /** The loader row id prime-memory is composed under (fixed by its bundle patch). */
128
- const MEMORY_ENTRY_ID = "dsh-memory";
129
- /** The state the settings page reads. */
130
- const primeMemoryCompatStatus = { installed: false };
131
- /**
132
- * Write the memory row's static route into the profile patch itself.
133
- *
134
- * `settings.update` only accepts the entry's *live* schema fields, so the static
135
- * `llm` pin never survives that call. The pin is what `resolveModelRoute` returns
136
- * first, and it is the only key every distillation layer honours — so it has to be
137
- * written where the next start reads it: the row config in the profile document.
138
- * @param documentPath - the profile patch file.
139
- * @param provider - route provider to pin.
140
- * @param model - route model to pin.
141
- * @returns whether the document changed.
142
- */
143
- /**
144
- * Remove this plugin's own static pin from the memory row.
145
- *
146
- * `effectiveCfg` (dsh-prime-memory `pipeline/runner.js`) treats a non-empty
147
- * `cfg.llm.provider + cfg.llm.model` pair as "pinned" and then ignores *both* the runtime
148
- * chain and the legacy `distillProvider`/`distillModel` pair. A pin written earlier — for a
149
- * host whose live RPC was not ready yet — is therefore not harmless: it keeps winning over
150
- * every later live push, which is exactly the "the card changed, the calls did not" report.
151
- * Once a live push is confirmed, the pin has to go.
152
- *
153
- * @param documentPath - the profile patch document that holds the memory row.
154
- * @returns what happened, so the caller can log it without guessing.
155
- */
156
- async function clearStaticPin(documentPath) {
157
- const { readFile, writeFile } = await import("node:fs/promises");
158
- let text;
159
- try {
160
- text = await readFile(documentPath, "utf8");
161
- } catch {
162
- return "missing";
163
- }
164
- const rows = text.split(/(?=^- id: )/m);
165
- const index = rows.findIndex((row) => /^- id: dsh-memory\r?\n/.test(row));
166
- if (index < 0) return "missing";
167
- const row = rows[index];
168
- const trimmed = row.replace(/^ {4}llm:\r?\n(?: {6}.*\r?\n)*/m, "");
169
- if (trimmed === row) return "absent";
170
- rows[index] = trimmed;
171
- try {
172
- await writeFile(documentPath, rows.join(""), "utf8");
173
- } catch {
174
- return "missing";
175
- }
176
- return "cleared";
177
- }
178
- async function writeStaticPin(documentPath, provider, model) {
179
- const { readFile, writeFile } = await import("node:fs/promises");
180
- let text;
181
- try {
182
- text = await readFile(documentPath, "utf8");
183
- } catch {
184
- return "missing";
185
- }
186
- const rows = text.split(/(?=^- id: )/m);
187
- const index = rows.findIndex((row) => /^- id: dsh-memory\r?\n/.test(row));
188
- if (index < 0) return "missing";
189
- const row = rows[index];
190
- const desired = ` llm:\n provider: ${provider}\n model: ${model}\n`;
191
- let next;
192
- if (/^ {4}llm:\r?\n(?: {6}.*\r?\n)*/m.test(row)) next = row.replace(/^ {4}llm:\r?\n(?: {6}.*\r?\n)*/m, desired);
193
- else if (/^ {2}config:\r?\n/m.test(row)) next = row.replace(/^ {2}config:\r?\n/m, ` config:\n${desired}`);
194
- else next = row.replace(/^- id: dsh-memory\r?\n/m, `- id: dsh-memory\n config:\n${desired}`);
195
- if (next === row) return "unchanged";
196
- rows[index] = next;
197
- try {
198
- await writeFile(documentPath, rows.join(""), "utf8");
199
- } catch {
200
- return "missing";
201
- }
202
- return "written";
203
- }
204
- /** A non-blank string. */
205
- function text(value) {
206
- return typeof value === "string" ? value.trim() : "";
207
- }
208
- /** Read a value as a plain record. */
209
- function asRecord(value) {
210
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
211
- }
212
- /**
213
- * The distillation chain a settings section currently carries.
214
- *
215
- * Accepts the chain form and the legacy provider/model pair, so a user who set
216
- * the old two fields is still recognised as user intent.
217
- * @param section - the `live` section (or a whole settings view) to read.
218
- * @returns The chain entries; empty when nothing is set.
219
- */
220
- function chainOf(section) {
221
- const live = asRecord(section);
222
- if (live === void 0) return [];
223
- const chain = live.distillChain;
224
- if (Array.isArray(chain)) {
225
- const entries = [];
226
- for (const item of chain) {
227
- const entry = asRecord(item);
228
- const provider = text(entry?.provider);
229
- const model = text(entry?.model);
230
- if (provider === "" || model === "") continue;
231
- const effort = text(entry?.reasoningEffort);
232
- entries.push(effort === "" ? {
233
- provider,
234
- model
235
- } : {
236
- provider,
237
- model,
238
- reasoningEffort: effort
239
- });
240
- }
241
- return entries;
242
- }
243
- const provider = text(live.distillProvider);
244
- const model = text(live.distillModel);
245
- return provider === "" || model === "" ? [] : [{
246
- provider,
247
- model
248
- }];
249
- }
250
- /**
251
- * Decide the route config one memory row would run with from its config alone.
252
- *
253
- * Kept for the settings-free path (a profile that pins `config.llm.*`): the
254
- * runtime path writes the settings section instead, because the plugin reads its
255
- * config only at init.
256
- * @param config - the row's current config (any JSON-ish value).
257
- * @param route - this plugin's distillation route; an incomplete pair counts as unset.
258
- * @param adoptedRoute - a `provider/model` this adapter wrote on an earlier pass.
259
- * @returns The config to install, whether it changed, and what was applied.
260
- */
261
- function planPrimeMemoryRoute(config, route, adoptedRoute) {
262
- const base = asRecord(config);
263
- if (base === void 0) return {
264
- config: {},
265
- changed: false,
266
- skipped: "no-route"
267
- };
268
- const llm = asRecord(base.llm) ?? {};
269
- const declaredProvider = text(llm.provider);
270
- const declaredModel = text(llm.model);
271
- const declaredRoute = declaredProvider !== "" && declaredModel !== "" ? `${declaredProvider}/${declaredModel}` : void 0;
272
- if (!(declaredRoute !== void 0 && adoptedRoute !== void 0 && declaredRoute === adoptedRoute) && (declaredProvider !== "" || declaredModel !== "")) return {
273
- config: base,
274
- changed: false,
275
- skipped: "user-set"
276
- };
277
- const provider = text(route?.provider);
278
- const model = text(route?.model);
279
- if (provider === "" || model === "") return {
280
- config: base,
281
- changed: false,
282
- skipped: "no-route"
283
- };
284
- return {
285
- config: {
286
- ...base,
287
- llm: {
288
- ...llm,
289
- provider,
290
- model
291
- }
292
- },
293
- changed: true,
294
- route: `${provider}/${model}`
295
- };
296
- }
297
- /** The endpoint the memory plugin registers for its own runtime settings writes. */
298
- const MEMORY_RPC_PATH = "/dsh-memory/rpc/settings-set";
299
- /**
300
- * Whether the memory row's live section already carries exactly our route.
301
- *
302
- * The RPC write path persists the live section to the profile document on every
303
- * call, and a document change reloads the composition — so pushing an unchanged
304
- * route re-triggers this adapter forever (a ~6 s recompose loop, observed with
305
- * `dsh-prime-memory@0.26.10`). Comparing first is what makes the push idempotent
306
- * across reloads.
307
- *
308
- * @param value - the memory row's live settings object, as the forms describe it.
309
- * @param provider - route provider to compare against.
310
- * @param model - route model to compare against.
311
- * @returns true when a push would change nothing.
312
- */
313
- function memoryLiveMatchesRoute(value, provider, model) {
314
- const outer = value === null || typeof value !== "object" ? void 0 : value;
315
- if (outer === void 0) return false;
316
- const inner = outer.live;
317
- const live = inner !== null && typeof inner === "object" ? inner : outer;
318
- if (live.distillProvider !== provider || live.distillModel !== model) return false;
319
- const chain = live.distillChain;
320
- if (Array.isArray(chain) && chain.length !== 0) return false;
321
- const layers = live.distillLayerChains;
322
- if (layers === null || typeof layers !== "object") return false;
323
- for (const key of [
324
- "l1",
325
- "l2",
326
- "l3"
327
- ]) {
328
- const layer = layers[key];
329
- if (!Array.isArray(layer) || layer.length !== 1) return false;
330
- const first = layer[0];
331
- if (first === void 0 || first.provider !== provider || first.model !== model) return false;
332
- }
333
- return true;
334
- }
335
- /**
336
- * Hand the route to the memory plugin through the RPC it registers for its own
337
- * settings page.
338
- *
339
- * Writing the config document (what `settings.update` does) only changes what the
340
- * next start reads; the plugin resolves its route from the runtime settings object
341
- * it built at `apply`. This endpoint is the documented runtime write path — the
342
- * same one its own "distillation parameters" panel posts to — so it takes effect
343
- * without a restart, which is exactly what a provider switch needs.
344
- */
345
- async function pushMemoryRoute(ctx, route) {
346
- const server = ctx.get("webServer", false);
347
- const port = server?.port ?? server?.address?.port;
348
- if (typeof port !== "number" || port <= 0) return "absent";
349
- try {
350
- const response = await fetch(`http://127.0.0.1:${port}${MEMORY_RPC_PATH}`, {
351
- method: "POST",
352
- headers: { "content-type": "application/json" },
353
- body: JSON.stringify({
354
- distillChain: [],
355
- distillLayerChains: {
356
- l1: [{
357
- provider: route.provider,
358
- model: route.model
359
- }],
360
- l2: [{
361
- provider: route.provider,
362
- model: route.model
363
- }],
364
- l3: [{
365
- provider: route.provider,
366
- model: route.model
367
- }]
368
- },
369
- distillProvider: route.provider,
370
- distillModel: route.model,
371
- reasoningEffort: ""
372
- })
373
- });
374
- if (response.status === 404 || response.status === 405 || response.status === 403) return "absent";
375
- return response.ok ? "pushed" : "rejected";
376
- } catch {
377
- return "absent";
378
- }
379
- }
380
- /** The `agent-default-model` row's provider: the deployment default. */
381
- function defaultProviderOf(loader) {
382
- if (typeof loader?.entries !== "function") return void 0;
383
- for (const entry of loader.entries()) {
384
- if (entry.options?.id !== "agent-default-model") continue;
385
- const provider = text(asRecord(entry.options?.config)?.provider);
386
- if (provider !== "") return provider;
387
- }
388
- }
389
- /** The `settings` service the memory plugin itself writes through. */
390
- function formsOf(ctx) {
391
- try {
392
- return ctx.get("settings", false);
393
- } catch {
394
- return;
395
- }
396
- }
397
- /** Live attempts to spend before falling back to the static pin. */
398
- const PIN_AFTER_ATTEMPTS = 4;
399
- /**
400
- * Install the adapter for the whole profile.
401
- *
402
- * Writes the memory plugin's own `live` section on activation, on every
403
- * `loader/patch-context`, on `loader/entry-init`, once more after a short delay
404
- * (a bundle-inserted row is often composed after this one), and again whenever
405
- * this plugin's settings change.
406
- * @param ctx - this row's context.
407
- * @param loader - the loader service, when present.
408
- * @param routeOf - resolves this plugin's distillation route for one settings snapshot.
409
- * @returns The disposer and a replay hook.
410
- */
411
- function installPrimeMemoryCompat(ctx, loader, routeOf) {
412
- /** The route this adapter wrote last, so it may replace its own value only. */
413
- let adoptedRoute;
414
- let pending;
415
- let attempt = 0;
416
- const timers = [];
417
- const primeMemoryEntry = () => {
418
- for (const entry of loader?.entries?.() ?? []) if (isPrimeMemoryRow(entry)) return entry;
419
- };
420
- const memoryRowPresent = () => primeMemoryEntry() !== void 0;
421
- /** The live section the memory plugin registered, read back through the host. */
422
- const sectionOf = (forms) => {
423
- try {
424
- return (forms.describe?.({ redactSecrets: true }) ?? []).find((item) => item.ns === MEMORY_ENTRY_ID);
425
- } catch {
426
- return;
427
- }
428
- };
429
- const scheduleRetry = () => {
430
- if (attempt >= 8) return;
431
- const delay = Math.min(4e3, 200 * 2 ** attempt);
432
- attempt += 1;
433
- const timer = setTimeout(() => {
434
- run();
435
- }, delay);
436
- timer.unref?.();
437
- timers.push(timer);
438
- };
439
- /**
440
- * Last resort for a host whose live seams never accept the route.
441
- *
442
- * Writing the static pin disables every live form (`pinned` in `effectiveCfg`), so it must
443
- * not happen while the live attempts still have a chance: a pin written on a slow start is
444
- * what kept overriding later pushes. It therefore waits for the retry budget to run out.
445
- *
446
- * @param forms - the settings service describing the memory row.
447
- * @param provider - route provider to pin.
448
- * @param model - route model to pin.
449
- * @param wanted - `provider/model`, for the log line.
450
- */
451
- const pinAsFallback = async (forms, provider, model, wanted) => {
452
- if (attempt < PIN_AFTER_ATTEMPTS) {
453
- scheduleRetry();
454
- return;
455
- }
456
- const documentPath = forms.documentPath;
457
- if (typeof documentPath !== "string" || documentPath === "") return;
458
- try {
459
- if (await writeStaticPin(documentPath, provider, model) === "written") ctx.logger.info(`model-switch: pinned the dsh-prime-memory distillation route to ${wanted} after ${attempt} live attempts (applies from the next start)`);
460
- } catch (cause) {
461
- ctx.logger.warn(`model-switch: could not pin the dsh-prime-memory route (${String(cause)})`);
462
- }
463
- };
464
- /**
465
- * Write our route into the section the plugin itself reads, then read it back.
466
- *
467
- * The plugin builds that section inside its own `apply` (`settings.register`), so
468
- * a write issued before that point lands in a section nobody reads — the reason
469
- * an unverified "write once at mount" pass left it on the deployment default.
470
- * Writing only once the section is visible, and verifying by reading the chain
471
- * back, is what makes this measurable instead of hopeful.
472
- */
473
- const run = async () => {
474
- if (pending !== void 0) return pending;
475
- if (!memoryRowPresent()) return;
476
- const route = routeOf();
477
- const provider = text(route?.provider);
478
- const model = text(route?.model);
479
- if (provider === "" || model === "") {
480
- primeMemoryCompatStatus.routeSkipped = "no-route";
481
- return;
482
- }
483
- const forms = formsOf(ctx);
484
- if (forms?.update === void 0 || forms.describe === void 0) {
485
- primeMemoryCompatStatus.routeSkipped = "no-route";
486
- scheduleRetry();
487
- return;
488
- }
489
- const wanted = `${provider}/${model}`;
490
- if (memoryLiveMatchesRoute(sectionOf(forms)?.value, provider, model)) {
491
- adoptedRoute = wanted;
492
- primeMemoryCompatStatus.installed = true;
493
- primeMemoryCompatStatus.route = wanted;
494
- delete primeMemoryCompatStatus.routeSkipped;
495
- return;
496
- }
497
- const pushed = await pushMemoryRoute(ctx, {
498
- provider,
499
- model
500
- });
501
- if (pushed === "pushed") {
502
- adoptedRoute = wanted;
503
- primeMemoryCompatStatus.installed = true;
504
- primeMemoryCompatStatus.route = wanted;
505
- delete primeMemoryCompatStatus.routeSkipped;
506
- }
507
- if (pushed === "pushed") {
508
- const pinnedDocument = forms.documentPath;
509
- if (typeof pinnedDocument === "string" && pinnedDocument !== "") try {
510
- if (await clearStaticPin(pinnedDocument) === "cleared") ctx.logger.info("model-switch: removed the stale dsh-prime-memory static pin; the live route decides now");
511
- } catch (cause) {
512
- ctx.logger.warn(`model-switch: could not clear the dsh-prime-memory static pin (${String(cause)})`);
513
- }
514
- return;
515
- }
516
- const section = sectionOf(forms);
517
- if (section === void 0 || asRecord(section.value) === void 0) {
518
- await pinAsFallback(forms, provider, model, wanted);
519
- return;
520
- }
521
- const current = chainOf(section.value);
522
- const declared = current.length > 0 ? `${text(current[0]?.provider)}/${text(current[0]?.model)}` : "";
523
- if (declared !== "" && declared !== wanted && adoptedRoute !== wanted) {
524
- primeMemoryCompatStatus.routeSkipped = "user-set";
525
- primeMemoryCompatStatus.route = void 0;
526
- return;
527
- }
528
- const chain = planDistillChain({
529
- provider,
530
- model
531
- }, current);
532
- pending = forms.update(MEMORY_ENTRY_ID, distillChainPatch(chain), section.revision).then(async () => {
533
- const applied = chainOf(sectionOf(forms)?.value);
534
- if ((applied.length > 0 ? `${text(applied[0]?.provider)}/${text(applied[0]?.model)}` : "") !== wanted) {
535
- await pinAsFallback(forms, provider, model, wanted);
536
- return;
537
- }
538
- adoptedRoute = wanted;
539
- attempt = 0;
540
- primeMemoryCompatStatus.installed = true;
541
- primeMemoryCompatStatus.route = wanted;
542
- delete primeMemoryCompatStatus.routeSkipped;
543
- }).catch(async (cause) => {
544
- primeMemoryCompatStatus.routeSkipped = "no-route";
545
- ctx.logger.warn(`model-switch: could not write the dsh-prime-memory distillation route (${String(cause)})`);
546
- await pinAsFallback(forms, provider, model, wanted);
547
- }).finally(() => {
548
- pending = void 0;
549
- });
550
- return pending;
551
- };
552
- const replay = () => {
553
- run();
554
- return true;
555
- };
556
- run();
557
- const offPatch = ctx.on("loader/patch-context", function(first, second) {
558
- const nextFn = typeof first === "function" ? first : second;
559
- if (isPrimeMemoryRow(typeof first === "function" ? this : first)) run();
560
- return nextFn === void 0 ? void 0 : nextFn();
561
- });
562
- const offInit = ctx.on("loader/entry-init", function(first) {
563
- const candidate = this ?? first;
564
- if (candidate !== void 0 && isPrimeMemoryRow(candidate)) run();
565
- });
566
- const offService = ctx.on("internal/service", (name) => {
567
- if (name === "settings") run();
568
- });
569
- const lateSweep = setTimeout(() => {
570
- run();
571
- }, 1500);
572
- return {
573
- dispose: () => {
574
- offPatch();
575
- offInit();
576
- offService();
577
- clearTimeout(lateSweep);
578
- for (const timer of timers) clearTimeout(timer);
579
- },
580
- replay
581
- };
582
- }
583
- /**
584
- * Row entry point: adapt the memory plugin on activation and on remount.
585
- * @param ctx - this row's context.
586
- */
587
- function apply(ctx) {
588
- const loader = ctx.get("loader", false);
589
- const routeOf = () => memoryRouteOf(ctx.modelSwitch.currentSettings(), defaultProviderOf(loader));
590
- const adapter = installPrimeMemoryCompat(ctx, loader, routeOf);
591
- ctx.effect(function* () {
592
- yield adapter.dispose;
593
- yield ctx.on("model-switch/settings-update", () => {
594
- if (adapter.replay()) ctx.logger.info("model-switch: re-applied the dsh-prime-memory distillation route after a settings change");
595
- });
596
- }, "model-switch: keep the dsh-prime-memory route aligned with the settings");
597
- }
598
- //#endregion
599
- export { apply, chainOf, clearStaticPin, inject, installPrimeMemoryCompat, memoryLiveMatchesRoute, name, planPrimeMemoryRoute, primeMemoryCompatStatus, pushMemoryRoute, writeStaticPin };
1
+ import { a as installPrimeMemoryCompat, c as planPrimeMemoryRoute, d as readMemoryLive, f as writeStaticPin, i as inject, l as primeMemoryCompatStatus, n as chainOf, o as memoryLiveMatchesRoute, r as clearStaticPin, s as name, t as apply, u as pushMemoryRoute } from "./prime-memory-compat-X6WlrtaN.js";
2
+ export { apply, chainOf, clearStaticPin, inject, installPrimeMemoryCompat, memoryLiveMatchesRoute, name, planPrimeMemoryRoute, primeMemoryCompatStatus, pushMemoryRoute, readMemoryLive, writeStaticPin };