instar 1.3.581 → 1.3.582

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.
@@ -15226,6 +15226,17 @@ export function createRoutes(ctx) {
15226
15226
  minDistinctTopicsPreference: cl?.minDistinctTopicsPreference ?? 2,
15227
15227
  });
15228
15228
  const prefs = new PreferencesManager(ctx.config.stateDir);
15229
+ // WS2.1 SEND-SIDE: this per-request PreferencesManager is the SOLE recordPreference
15230
+ // writer (the correction loop routes every write through it below). Attach the
15231
+ // journal-backed emitter so a learned preference replicates. PUT-ONLY (recordPreference
15232
+ // upserts on dedupeKey; no delete path). Dark by default ⇒ emitter absent ⇒ no-op.
15233
+ if (ctx.replicatedRecordEmitter) {
15234
+ const _prefEmitter = ctx.replicatedRecordEmitter;
15235
+ const { PREF_STORE_KEY, buildPrefRecordData } = await import('../core/PreferencesReplicatedStore.js');
15236
+ prefs.setReplicationEmitter({
15237
+ emitPut: (entry) => _prefEmitter.emit(PREF_STORE_KEY, entry.dedupeKey, (hlc, origin, observed) => buildPrefRecordData({ entry, hlc, op: 'put', origin, observed })),
15238
+ });
15239
+ }
15229
15240
  const port = ctx.config.port;
15230
15241
  const authToken = ctx.config.authToken;
15231
15242
  const evo = ctx.evolution;