dsh-boost 0.1.1 → 0.1.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 (52) hide show
  1. package/README.en.md +141 -51
  2. package/README.md +115 -47
  3. package/dist/admission/usage.js +41 -7
  4. package/dist/admission/usage.js.map +1 -1
  5. package/dist/gate/decide.js +33 -2
  6. package/dist/gate/decide.js.map +1 -1
  7. package/dist/hooks/llm-stream.js +232 -58
  8. package/dist/hooks/llm-stream.js.map +1 -1
  9. package/dist/hooks/post-execute.js +206 -39
  10. package/dist/hooks/post-execute.js.map +1 -1
  11. package/dist/hooks/session-state.js +18 -8
  12. package/dist/hooks/session-state.js.map +1 -1
  13. package/dist/index.js +601 -72
  14. package/dist/index.js.map +1 -1
  15. package/dist/scope/doc.js.map +1 -1
  16. package/dist/scope/store.js +24 -9
  17. package/dist/scope/store.js.map +1 -1
  18. package/dist/tools/boost.js +82 -2
  19. package/dist/tools/boost.js.map +1 -1
  20. package/package.json +9 -5
  21. package/dist/admission/fixed-cost.d.ts +0 -23
  22. package/dist/admission/ledger.d.ts +0 -113
  23. package/dist/admission/retrieval.d.ts +0 -65
  24. package/dist/admission/usage.d.ts +0 -75
  25. package/dist/config.d.ts +0 -43
  26. package/dist/gate/binding.d.ts +0 -113
  27. package/dist/gate/decide.d.ts +0 -82
  28. package/dist/gate/guard.d.ts +0 -69
  29. package/dist/gate/invalidate.d.ts +0 -112
  30. package/dist/gate/plan.d.ts +0 -86
  31. package/dist/hooks/clock.d.ts +0 -68
  32. package/dist/hooks/execute.d.ts +0 -79
  33. package/dist/hooks/llm-stream.d.ts +0 -283
  34. package/dist/hooks/pending.d.ts +0 -89
  35. package/dist/hooks/post-execute.d.ts +0 -257
  36. package/dist/hooks/session-state.d.ts +0 -158
  37. package/dist/hooks/synthesize.d.ts +0 -74
  38. package/dist/host/loader.d.ts +0 -23
  39. package/dist/host/platform.d.ts +0 -18
  40. package/dist/host/root.d.ts +0 -25
  41. package/dist/projection/apply.d.ts +0 -174
  42. package/dist/projection/canonicalise.d.ts +0 -43
  43. package/dist/projection/counters.d.ts +0 -65
  44. package/dist/projection/truncate.d.ts +0 -47
  45. package/dist/prompt/protocol.d.ts +0 -45
  46. package/dist/receipts/store.d.ts +0 -198
  47. package/dist/scope/doc.d.ts +0 -117
  48. package/dist/scope/resolve.d.ts +0 -91
  49. package/dist/scope/store.d.ts +0 -135
  50. package/dist/selector/jev.d.ts +0 -93
  51. package/dist/tools/boost.d.ts +0 -380
  52. package/dist/tools/family.d.ts +0 -26
package/dist/index.js CHANGED
@@ -83,6 +83,162 @@ function isVerifiedHostVersion(version) {
83
83
  };
84
84
  return core(version) === core(VERIFIED_HOST_VERSION);
85
85
  }
86
+ /**
87
+ * Parse the semver subset a declared `engines.dsh` range uses.
88
+ *
89
+ * The host's compatibility preflight runs `semver.satisfies(..., {
90
+ * includePrerelease: true })`. This module cannot import `semver` at runtime
91
+ * (it is a dev dependency, and the published graph must stay host-free), so the
92
+ * guard implements only what the manifest's range needs: `major.minor.patch`,
93
+ * an optional prerelease, and the comparison operators. Anything else is
94
+ * unparsable, and an unparsable range makes the guard advisory rather than
95
+ * wrong.
96
+ */
97
+ function parseSemVer(value) {
98
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(value.trim());
99
+ if (match === null)
100
+ return undefined;
101
+ const majorText = match[1];
102
+ const minorText = match[2];
103
+ const patchText = match[3];
104
+ if (majorText === undefined || minorText === undefined || patchText === undefined) {
105
+ return undefined;
106
+ }
107
+ const major = Number(majorText);
108
+ const minor = Number(minorText);
109
+ const patch = Number(patchText);
110
+ if (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) || !Number.isSafeInteger(patch)) {
111
+ return undefined;
112
+ }
113
+ const prerelease = [];
114
+ const prereleaseText = match[4];
115
+ if (prereleaseText !== undefined) {
116
+ for (const identifier of prereleaseText.split('.')) {
117
+ if (/^\d+$/.test(identifier)) {
118
+ const numeric = Number(identifier);
119
+ if (!Number.isSafeInteger(numeric))
120
+ return undefined;
121
+ prerelease.push(numeric);
122
+ }
123
+ else {
124
+ prerelease.push(identifier);
125
+ }
126
+ }
127
+ }
128
+ return { major, minor, patch, prerelease };
129
+ }
130
+ /** Semver precedence for one prerelease identifier (numeric sorts first). */
131
+ function compareIdentifier(left, right) {
132
+ if (typeof left === 'number' && typeof right === 'number')
133
+ return left - right;
134
+ if (typeof left === 'number')
135
+ return -1;
136
+ if (typeof right === 'number')
137
+ return 1;
138
+ return left < right ? -1 : left > right ? 1 : 0;
139
+ }
140
+ /** Semver precedence: negative when `left` is older, positive when newer. */
141
+ function compareSemVer(left, right) {
142
+ for (const key of ['major', 'minor', 'patch']) {
143
+ const delta = left[key] - right[key];
144
+ if (delta !== 0)
145
+ return delta;
146
+ }
147
+ if (left.prerelease.length === 0 && right.prerelease.length === 0)
148
+ return 0;
149
+ // A release outranks every prerelease of the same core version.
150
+ if (left.prerelease.length === 0)
151
+ return 1;
152
+ if (right.prerelease.length === 0)
153
+ return -1;
154
+ const length = Math.max(left.prerelease.length, right.prerelease.length);
155
+ for (let index = 0; index < length; index += 1) {
156
+ const leftPart = left.prerelease[index];
157
+ const rightPart = right.prerelease[index];
158
+ // A shorter identifier list is lower when every shared part is equal.
159
+ if (leftPart === undefined)
160
+ return -1;
161
+ if (rightPart === undefined)
162
+ return 1;
163
+ const delta = compareIdentifier(leftPart, rightPart);
164
+ if (delta !== 0)
165
+ return delta;
166
+ }
167
+ return 0;
168
+ }
169
+ /**
170
+ * Whether `version` satisfies `range`, or `undefined` when either cannot be
171
+ * parsed.
172
+ *
173
+ * Supports the space-separated AND comparators (`>=`, `>`, `<=`, `<`, `=`, or
174
+ * bare) and `||` alternatives. An unevaluable range is not a mismatch: the
175
+ * guard is advisory, and warning on a range it does not understand would be
176
+ * worse than staying quiet.
177
+ */
178
+ function satisfiesRange(version, range) {
179
+ const parsed = parseSemVer(version);
180
+ if (parsed === undefined)
181
+ return undefined;
182
+ let evaluable = false;
183
+ for (const alternative of range.split('||')) {
184
+ const comparators = alternative.trim().split(/\s+/).filter(token => token !== '');
185
+ if (comparators.length === 0)
186
+ continue;
187
+ let matched = true;
188
+ let valid = true;
189
+ for (const token of comparators) {
190
+ const match = /^(>=|<=|>|<|=)?(.+)$/.exec(token);
191
+ const bound = match === null ? undefined : parseSemVer(match[2] ?? '');
192
+ if (match === null || bound === undefined) {
193
+ valid = false;
194
+ break;
195
+ }
196
+ const order = compareSemVer(parsed, bound);
197
+ const operator = match[1] ?? '=';
198
+ const satisfied = operator === '>='
199
+ ? order >= 0
200
+ : operator === '<='
201
+ ? order <= 0
202
+ : operator === '>'
203
+ ? order > 0
204
+ : operator === '<'
205
+ ? order < 0
206
+ : order === 0;
207
+ if (!satisfied) {
208
+ matched = false;
209
+ break;
210
+ }
211
+ }
212
+ if (!valid)
213
+ continue;
214
+ evaluable = true;
215
+ if (matched)
216
+ return true;
217
+ }
218
+ return evaluable ? false : undefined;
219
+ }
220
+ /**
221
+ * The `engines.dsh` range this build declares, read from the package manifest.
222
+ *
223
+ * The manifest is the one authority for "hosts this plugin accepts": the host's
224
+ * preflight reads the same field, so a guard with a hard-coded range would drift
225
+ * from the declaration it is supposed to enforce (review row 51). Memoised; a
226
+ * missing or malformed manifest makes the guard advisory.
227
+ */
228
+ let declaredHostRange = null;
229
+ function declaredHostRangeOf() {
230
+ if (declaredHostRange !== null)
231
+ return declaredHostRange;
232
+ try {
233
+ const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
234
+ const range = manifest.engines?.dsh;
235
+ declaredHostRange = typeof range === 'string' && range.trim() !== '' ? range.trim() : undefined;
236
+ }
237
+ catch {
238
+ declaredHostRange = undefined;
239
+ }
240
+ return declaredHostRange;
241
+ }
86
242
  /**
87
243
  * Stable host code: the resolved host version is not the verified one.
88
244
  *
@@ -92,6 +248,42 @@ function isVerifiedHostVersion(version) {
92
248
  * `ERR_HOST_COMPLETE_SECTION`).
93
249
  */
94
250
  const ERR_HOST_VERSION_MISMATCH = 'ERR_HOST_VERSION_MISMATCH';
251
+ /**
252
+ * Stable host code: `system-prompt/assemble` was never observed.
253
+ *
254
+ * `ctx.on` accepts any string, so a renamed event registers successfully and
255
+ * then never fires. This module needs assemble to warm the visibility cache
256
+ * before section text resolves (design D4). The host runs assemble before
257
+ * `agent/pre-step`, so the first pre-step without a single observed assemble is
258
+ * proof the seam is gone. Raised once per process, on the first step that
259
+ * needed it; the only signal is "never fired", so the event name also joins
260
+ * `missingMounts`, and `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`
261
+ * (the per-event code is carried by the warning and the mount list, which is
262
+ * the reachable status channel without a new status-side mapping).
263
+ */
264
+ const ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE = 'ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE';
265
+ /**
266
+ * Stable host code: `agent/pre-step` was never observed.
267
+ *
268
+ * Raised once, on the first main `llm/stream` request for a session whose step
269
+ * clock was never driven. Without pre-step the turn is unknown, so every
270
+ * pending substitution is abandoned; the warning says why instead of leaving
271
+ * `status` healthy. Auxiliary (`purpose`-tagged) streams do not need the clock
272
+ * and do not raise it. As with assemble, the event name joins `missingMounts`
273
+ * and the per-event code is carried by the one-shot warning.
274
+ */
275
+ const ERR_HOST_NO_AGENT_PRE_STEP = 'ERR_HOST_NO_AGENT_PRE_STEP';
276
+ /**
277
+ * Stable host code: the selector route had to come from `agent/request`.
278
+ *
279
+ * `agent/pre-step` carries `modelSelection` and is the non-deprecated source.
280
+ * When a host leaves it empty, the deprecated `agent/request` resolved config
281
+ * is the only route left; the selector can still run, but the dependency is
282
+ * reported once because that event is marked `@deprecated`. Absence of
283
+ * `agent/request` itself is non-fatal and is reported separately by
284
+ * `ERR_HOST_NO_AGENT_REQUEST`.
285
+ */
286
+ const ERR_HOST_NO_MODEL_SELECTION = 'ERR_HOST_NO_MODEL_SELECTION';
95
287
  /** The app-boot package whose version IS the dsh runtime version. */
96
288
  const HOST_VERSION_PACKAGE = '@deepseek-ai/dsh-app-boot';
97
289
  /** Node's resolver, used only when the host service is unavailable. */
@@ -131,25 +323,47 @@ function hostVersionOf(ctx) {
131
323
  }
132
324
  }
133
325
  /**
134
- * Log the resolved host version once and warn on a mismatch.
326
+ * Log the resolved host version once, warning only outside `engines.dsh`.
135
327
  *
136
328
  * The version guard is deliberately advisory. npm does not read `engines.dsh`;
137
329
  * the host enforces it only through the managed-install compatibility preflight,
138
330
  * which does not run for every composition. A warning here is the only signal
139
331
  * an embedded or mixed tree gets, and it must never stop the plugin: a version
140
332
  * this build did not verify may still work.
333
+ *
334
+ * The check is against the **declared range**, not exact equality (review row
335
+ * 51): `engines.dsh` is `>=0.2.2-rc.4 <0.2.3-0`, and the host's preflight
336
+ * accepts rc.5 and the 0.2.2 release. Warning on those told operators to
337
+ * distrust a host the manifest itself accepts. Inside the range but not the
338
+ * verified build is an informational note; outside it is the warning.
141
339
  */
142
340
  function reportHostVersion(ctx) {
143
341
  const version = hostVersionOf(ctx);
342
+ const range = declaredHostRangeOf();
144
343
  if (version === undefined) {
145
- ctx.logger?.info?.(`dsh-boost: dsh host version unknown (verified against ${VERIFIED_HOST_VERSION}); compatibility cannot be checked`);
344
+ ctx.logger?.info?.(`dsh-boost: dsh host version unknown (verified against ${VERIFIED_HOST_VERSION}${range === undefined ? '' : `; declared range ${range}`}); compatibility cannot be checked`);
345
+ return;
346
+ }
347
+ if (range === undefined) {
348
+ ctx.logger?.info?.(`dsh-boost: dsh host ${version}; the package declares no engines.dsh range, so compatibility cannot be checked`);
349
+ return;
350
+ }
351
+ const accepted = satisfiesRange(version, range);
352
+ if (accepted === undefined) {
353
+ ctx.logger?.info?.(`dsh-boost: dsh host ${version}; the declared range ${range} is not a semver range this guard understands, so compatibility cannot be checked`);
354
+ return;
355
+ }
356
+ if (!accepted) {
357
+ ctx.logger?.warn?.(`dsh-boost: ${ERR_HOST_VERSION_MISMATCH}: this build is verified against dsh ${VERIFIED_HOST_VERSION} (declared range ${range}), but the host reports ${version}, which is outside it; continuing, but a renamed host API may make the plugin inert`);
146
358
  return;
147
359
  }
148
360
  if (isVerifiedHostVersion(version)) {
149
361
  ctx.logger?.info?.(`dsh-boost: dsh host ${version} (verified)`);
150
362
  return;
151
363
  }
152
- ctx.logger?.warn?.(`dsh-boost: ${ERR_HOST_VERSION_MISMATCH}: this build is verified against dsh ${VERIFIED_HOST_VERSION}, but the host reports ${version}; continuing, but a renamed host API may make the plugin inert`);
364
+ // Inside the range the manifest accepts, so this is not a mismatch — just not
365
+ // the exact build the plugin was exercised against.
366
+ ctx.logger?.info?.(`dsh-boost: dsh host ${version} is within the declared range ${range}, but not the exact build this was verified against (${VERIFIED_HOST_VERSION}); continuing`);
153
367
  }
154
368
  /**
155
369
  * Duplicate applies observed in this process.
@@ -167,10 +381,12 @@ let duplicateMountAttempts = 0;
167
381
  *
168
382
  * `dsh-system-prompt` builds a plain `Error` whose message starts with
169
383
  * `prompt section "<name>" is already registered` (global and scoped variants
170
- * both start that way) and exposes no code. Matching that prefix for our own
171
- * section is the only duplicate evidence available; a future wording change
172
- * falls through to the generic branch, which warns with the raw error and keeps
173
- * the control tool mountable instead of silently disabling everything.
384
+ * both start that way) and exposes no code. The message alone proves only that
385
+ * *some* plugin owns the name — another plugin using `dsh-boost` produces the
386
+ * same text — so it is combined with {@link ownSectionRegistries}, the mount
387
+ * marker this module owns (review row 32). A duplicate from a foreign owner is
388
+ * a section-mount failure, not "this plugin is already wired": the remaining
389
+ * hooks and the control tool must still mount.
174
390
  */
175
391
  function isDuplicateSectionError(error) {
176
392
  return (error instanceof Error &&
@@ -206,8 +422,31 @@ function lazyService(ctx, name) {
206
422
  get.reset = () => {
207
423
  resolved = undefined;
208
424
  };
425
+ get.refresh = () => {
426
+ resolved = serviceOf(ctx, name);
427
+ return resolved;
428
+ };
209
429
  return get;
210
430
  }
431
+ /**
432
+ * Run `invalidate` when the owning fiber unloads.
433
+ *
434
+ * Used for the three soft-service memos: a disposed provider must not leave a
435
+ * stale binding behind for a later provider that reuses the same name (review
436
+ * row 6). A host without the effect seam is not a failure: the point-of-use
437
+ * resets still recover, only the disposal edge is missed.
438
+ */
439
+ function onDispose(ctx, invalidate) {
440
+ try {
441
+ const effect = ctx.effect;
442
+ if (typeof effect !== 'function')
443
+ return;
444
+ effect.call(ctx, () => invalidate, 'dsh-boost: soft service bindings');
445
+ }
446
+ catch {
447
+ // A host that rejects the effect still gets the per-use resets.
448
+ }
449
+ }
211
450
  /**
212
451
  * The session id behind an agent or a `Session`.
213
452
  *
@@ -467,26 +706,78 @@ function systemTextOf(options) {
467
706
  *
468
707
  * `agent/pre-step` is the non-deprecated clock seam (`agent/request` is
469
708
  * marked `@deprecated`); it fires once per proposed step with the host
470
- * `turn`/`step`. `agent/request` is kept for the selector route, which only
471
- * its resolved config carries, and as a clock/visibility fallback. A model
709
+ * `turn`/`step`, and it already carries the captured `modelSelection`. The
710
+ * selector route is read from there first; `agent/request`'s resolved config
711
+ * is only the compatibility path for a host whose pre-step does not populate
712
+ * `modelSelection`, and it warns once when it is used. The visibility warm
713
+ * stays at `assemble` (D4); `agent/pre-step` warms only when `assemble` never
714
+ * fired, so no session's visibility depends on the deprecated event. A model
472
715
  * request that reaches `llm/stream` without any observed `agent/request` is
473
- * reported once with `ERR_HOST_NO_AGENT_REQUEST` instead of silently losing
474
- * the route.
716
+ * still reported once with `ERR_HOST_NO_AGENT_REQUEST`; the route itself does
717
+ * not depend on it.
718
+ *
719
+ * ## Every mount is attributed
720
+ *
721
+ * `ctx.on` accepts any string (`cordis/src/events.ts`), so a renamed host
722
+ * event registers successfully and then never fires. Registration failures and
723
+ * "never observed" are therefore different signals, and both must reach the
724
+ * operator:
725
+ *
726
+ * - Each listener is mounted in its own try/catch. A throw names that event in
727
+ * `missingMounts`, and the remaining listeners still mount. Before this, one
728
+ * bare catch around the whole wiring left `status.degraded` empty and lost
729
+ * `session/disposed` (per-session state leaked for the process lifetime).
730
+ * - `ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE` is raised once when the first
731
+ * `agent/pre-step` arrives without a single observed assemble. The host
732
+ * order guarantees assemble first, so its absence is a renamed/removed
733
+ * event. Its only evidence is "never observed"; the event name also joins
734
+ * `missingMounts`, so `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`
735
+ * (the per-event code exists in the warning and the mount list).
736
+ * - `ERR_HOST_NO_AGENT_PRE_STEP` is raised once when the first main
737
+ * `llm/stream` request arrives without any observed pre-step for that
738
+ * session. The step clock cannot advance without it, so substitution is
739
+ * impossible; auxiliary (`purpose`-tagged) streams do not need it and do not
740
+ * raise the warning.
475
741
  *
476
742
  * `session/event` (`turn/end`), `session/flush` and `session/disposed` call
477
743
  * `ReceiptStore.flush()` so the turn-end durability the design promises is
478
744
  * real. `session/disposed` also drops every per-session map the assembly owns
479
745
  * and tells the stores to evict their state.
480
746
  */
481
- function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, workspaces, routes, counters) {
747
+ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, workspaces, routes, counters, missing, ownsSection) {
482
748
  /** Session ids seen at `agent/pre-step`; a `llm/stream` without a request is drift. */
483
749
  const preStepSeen = new Set();
484
750
  /** Session ids observed on `agent/request`. */
485
751
  const requestSeen = new Set();
752
+ let assembleSeen = false;
486
753
  let warnedMissingRequest = false;
487
- /** Warn once per process about a prompt that swallowed the protocol section. */
488
754
  let warnedCompleteSection = false;
489
- ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
755
+ let warnedNoAssemble = false;
756
+ let warnedNoPreStep = false;
757
+ let warnedRouteFallback = false;
758
+ /**
759
+ * Mount one listener in its own try/catch.
760
+ *
761
+ * A failure names the event and is recorded in `missingMounts`; it never
762
+ * stops the next listener. `true` means the registration itself succeeded,
763
+ * which is not proof the host ever emits the event (see the never-observed
764
+ * warnings below).
765
+ */
766
+ const mount = (event, handler, options) => {
767
+ try {
768
+ ctx.on(event, handler, options);
769
+ return true;
770
+ }
771
+ catch (error) {
772
+ missing.add(event);
773
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: ${event} mount failed (${messageOf(error)})`);
774
+ return false;
775
+ }
776
+ };
777
+ // `system-prompt/assemble` stays first: it is the seam that resolves the
778
+ // section text every later step sees (design D4).
779
+ const assembleMounted = mount('system-prompt/assemble', async (_assembly, context, next) => {
780
+ assembleSeen = true;
490
781
  const resolved = await next();
491
782
  try {
492
783
  // `dsh-agent` augments `AssembleContext` with the real `Agent`; `scope`
@@ -502,10 +793,15 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
502
793
  // into an assembly with no agent. Count the decision, not the
503
794
  // section's presence — design §5.5:378 asks for every assembly to be
504
795
  // judged.
505
- counters.protocolSuppressed();
506
- return patchProtocolSection(resolved, false);
796
+ if (ownsSection)
797
+ counters.protocolSuppressed();
798
+ return ownsSection ? patchProtocolSection(resolved, false) : resolved;
507
799
  }
508
800
  const visible = await warmVisibility(scope, registry, agent, sessionId, workspaces);
801
+ // A foreign plugin owns the section name (row 32): warm the judgement the
802
+ // decision path needs, but never rewrite another plugin's text.
803
+ if (!ownsSection)
804
+ return resolved;
509
805
  // Same rule for an invisible workspace: the section is suppressed for
510
806
  // this assembly, so the operator gets a live signal in `boost status`.
511
807
  // A visible one never increments, so the count stays a failure count.
@@ -517,11 +813,19 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
517
813
  return resolved;
518
814
  }
519
815
  });
520
- ctx.on('agent/pre-step', async (payload, next) => {
816
+ const preStepMounted = mount('agent/pre-step', async (payload, next) => {
521
817
  const request = (payload ?? {});
522
818
  const sessionId = sessionIdOf(request.agent);
523
819
  if (sessionId !== undefined) {
524
820
  preStepSeen.add(sessionId);
821
+ // Row 8: assemble runs before pre-step in the host's own order. If it
822
+ // has never run by the first step, the event was renamed or removed and
823
+ // the protocol section cannot be warmed or patched.
824
+ if (!assembleSeen && !warnedNoAssemble && assembleMounted) {
825
+ warnedNoAssemble = true;
826
+ missing.add('system-prompt/assemble');
827
+ ctx.logger?.warn?.(`${ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE}: system-prompt/assemble was not observed before the first agent/pre-step; the protocol section cannot be warmed or patched (the event may have been renamed or removed)`);
828
+ }
525
829
  try {
526
830
  sessions.onModelRequest(sessionId, typeof request.turn === 'number' ? request.turn : Number(request.turn), typeof request.step === 'number' ? request.step : undefined);
527
831
  }
@@ -536,40 +840,64 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
536
840
  }
537
841
  // `agent/pre-step` already carries the captured step selection. It is
538
842
  // the non-deprecated source for the selector route; `agent/request`'s
539
- // resolved config remains a fallback for hosts that only populate it
540
- // there (review row 37). A later request overwrites with the same route.
843
+ // resolved config remains a compatibility fallback for hosts that only
844
+ // populate it there. A later request overwrites with the same route.
541
845
  rememberRoute(routes, sessionId, request.modelSelection);
846
+ // The warm belongs to `system-prompt/assemble` (D4). This is the
847
+ // fallback for a host that skipped or renamed assemble: pre-step is the
848
+ // non-deprecated seam, so visibility no longer depends on the
849
+ // deprecated `agent/request` event.
850
+ if (!assembleSeen) {
851
+ await warmVisibility(scope, registry, request.agent, sessionId, workspaces);
852
+ }
542
853
  }
543
854
  return next();
544
855
  });
545
- ctx.on('agent/request', async (payload, next) => {
856
+ mount('agent/request', async (payload, next) => {
546
857
  const request = (payload ?? {});
547
858
  const sessionId = sessionIdOf(request.agent);
548
859
  if (sessionId !== undefined) {
549
860
  requestSeen.add(sessionId);
550
- try {
551
- sessions.onModelRequest(sessionId, typeof request.turn === 'number' ? request.turn : Number(request.turn), typeof request.step === 'number' ? request.step : undefined);
552
- }
553
- catch {
554
- // A clock that cannot be driven must not break the model request.
555
- }
556
- try {
557
- horizon.observe(sessionId, typeof request.turn === 'number' ? request.turn : Number(request.turn), typeof request.step === 'number' ? request.step : Number(request.step));
558
- }
559
- catch {
560
- // Same as the pre-step observation: history is an estimate.
861
+ // Compatibility only: when pre-step is present it already drove the
862
+ // clock and the horizon. This branch exists for a host that still emits
863
+ // the deprecated event but not the non-deprecated one.
864
+ if (!preStepSeen.has(sessionId)) {
865
+ try {
866
+ sessions.onModelRequest(sessionId, typeof request.turn === 'number' ? request.turn : Number(request.turn), typeof request.step === 'number' ? request.step : undefined);
867
+ }
868
+ catch {
869
+ // A clock that cannot be driven must not break the model request.
870
+ }
871
+ try {
872
+ horizon.observe(sessionId, typeof request.turn === 'number' ? request.turn : Number(request.turn), typeof request.step === 'number' ? request.step : Number(request.step));
873
+ }
874
+ catch {
875
+ // Same as the pre-step observation: history is an estimate.
876
+ }
877
+ if (!assembleSeen) {
878
+ await warmVisibility(scope, registry, request.agent, sessionId, workspaces);
879
+ }
561
880
  }
562
- await warmVisibility(scope, registry, request.agent, sessionId, workspaces);
563
881
  }
564
882
  const config = await next();
565
- if (sessionId !== undefined)
883
+ // Capability check (row 22): the non-deprecated pre-step carries
884
+ // `modelSelection`; when it did, this event must not overwrite the route.
885
+ // When it did not, the resolved config is the only source left, and the
886
+ // deprecated path warns once.
887
+ if (sessionId !== undefined && routes.get(sessionId) === undefined) {
566
888
  rememberRoute(routes, sessionId, config);
889
+ if (routes.get(sessionId) !== undefined && !warnedRouteFallback) {
890
+ warnedRouteFallback = true;
891
+ ctx.logger?.warn?.(`${ERR_HOST_NO_MODEL_SELECTION}: agent/pre-step carried no modelSelection; the selector route came from the deprecated agent/request event, which may be removed`);
892
+ }
893
+ }
567
894
  return config;
568
895
  });
569
896
  // The deprecated event's disappearance would otherwise disable the selector
570
897
  // route silently. A session that reached `llm/stream` after a pre-step but
571
898
  // never saw `agent/request` is proof enough; the model request itself is
572
- // passed through untouched.
899
+ // passed through untouched. The route now comes from pre-step, so this is a
900
+ // compatibility warning, not a correctness dependency.
573
901
  //
574
902
  // This listener is also the complete-section detector, and it MUST be
575
903
  // outermost: the synthesizer mounted by `registerHooks` consumes a queued
@@ -578,16 +906,28 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
578
906
  // substituted. Cordis runs the first-registered listener outermost
579
907
  // (`events.ts` unshifts on `prepend`), so `prepend: true` is what puts the
580
908
  // detector before the synthesizer regardless of mount order (finding 4).
581
- ctx.on('llm/stream', (options, next) => {
909
+ mount('llm/stream', (options, next) => {
582
910
  try {
583
911
  const request = (options ?? {});
584
912
  const sessionId = request.sessionId;
913
+ // Row 8: a main request needs the step clock, which only pre-step
914
+ // drives. An auxiliary (`purpose`) stream carries its own prompt and
915
+ // never needs it, so it is not evidence the seam is missing.
916
+ if (!warnedNoPreStep &&
917
+ preStepMounted &&
918
+ request.purpose === undefined &&
919
+ typeof sessionId === 'string' &&
920
+ !preStepSeen.has(sessionId)) {
921
+ warnedNoPreStep = true;
922
+ missing.add('agent/pre-step');
923
+ ctx.logger?.warn?.(`${ERR_HOST_NO_AGENT_PRE_STEP}: agent/pre-step was not observed before the first main llm/stream request; the step clock cannot advance (the event may have been renamed or removed)`);
924
+ }
585
925
  if (!warnedMissingRequest &&
586
926
  typeof sessionId === 'string' &&
587
927
  preStepSeen.has(sessionId) &&
588
928
  !requestSeen.has(sessionId)) {
589
929
  warnedMissingRequest = true;
590
- ctx.logger?.warn?.('ERR_HOST_NO_AGENT_REQUEST: agent/request was not observed before llm/stream; the selector route cannot be captured (the event is deprecated and may have been removed)');
930
+ ctx.logger?.warn?.('ERR_HOST_NO_AGENT_REQUEST: agent/request was not observed before llm/stream; the deprecated event may have been removed (the selector route is captured from agent/pre-step modelSelection)');
591
931
  }
592
932
  // A `complete: true` prompt section replaces every other section after
593
933
  // the assembly waterfall, so the protocol text
@@ -635,7 +975,7 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
635
975
  // persistence contract rests on, and `session/disposed` flushes again after
636
976
  // the last hook for the id. Receipts are evidence, so an early flush that
637
977
  // does not happen costs latency, never correctness.
638
- ctx.on('session/event', (_session, event) => {
978
+ mount('session/event', (_session, event) => {
639
979
  const type = event?.type;
640
980
  if (type === 'turn/end') {
641
981
  // Fire-and-forget on the real host; `flush()` never rejects.
@@ -643,8 +983,8 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
643
983
  }
644
984
  return undefined;
645
985
  });
646
- ctx.on('session/flush', () => deps.receipts.flush());
647
- ctx.on('session/disposed', async (session) => {
986
+ mount('session/flush', () => deps.receipts.flush());
987
+ mount('session/disposed', async (session) => {
648
988
  const sessionId = sessionIdOf(session);
649
989
  if (sessionId === undefined)
650
990
  return;
@@ -671,6 +1011,9 @@ function wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, worksp
671
1011
  }
672
1012
  deps.receipts.disposeSession(sessionId);
673
1013
  });
1014
+ if (missing.size > 0) {
1015
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`);
1016
+ }
674
1017
  }
675
1018
  /**
676
1019
  * Register the `boost` tool family.
@@ -696,6 +1039,27 @@ function registerBoostTool(ctx, deps) {
696
1039
  const definition = boostTool(deps);
697
1040
  ctx.tools.register(definition, { when: () => true });
698
1041
  }
1042
+ /**
1043
+ * Section registries this module successfully registered into.
1044
+ *
1045
+ * The mount marker this module owns (review row 32). The host's duplicate
1046
+ * message is generic: another plugin registering `dsh-boost` produces exactly
1047
+ * the same text. A duplicate therefore counts as "this plugin is already
1048
+ * wired" only when the same prompt registry object received this module's
1049
+ * section earlier in the process. A foreign owner is a section-mount failure:
1050
+ * the remaining hooks and the control tool still mount, and the foreign text
1051
+ * is never rewritten.
1052
+ */
1053
+ const ownSectionRegistries = new WeakSet();
1054
+ /**
1055
+ * Prompt registries this module already mounted its hooks and tool against.
1056
+ *
1057
+ * Separate from {@link ownSectionRegistries}: a foreign section owner means
1058
+ * this module does not own the section text, but a second apply over the same
1059
+ * registry must still not mount the hooks twice. Marked once a non-duplicate
1060
+ * apply has finished mounting, and consulted only for the duplicate decision.
1061
+ */
1062
+ const mountedRegistries = new WeakSet();
699
1063
  /** The mount label the prompt section reports when it cannot be registered. */
700
1064
  const MOUNT_SECTION = 'systemPrompt.section';
701
1065
  /**
@@ -711,8 +1075,11 @@ const MOUNT_SECTION = 'systemPrompt.section';
711
1075
  * still describes the three event mounts, and those are then mounted one by one
712
1076
  * so a failure names the mount that failed and lands in `missing`.
713
1077
  *
714
- * Returns `true` when the section error is the host's duplicate-registration
715
- * error: a previous apply owns every mount and this one must register nothing.
1078
+ * Returns `alreadyMounted` only when the section error is the host's
1079
+ * duplicate-registration error AND this module registered that same registry
1080
+ * earlier (the mount marker): a previous apply owns every mount and this one
1081
+ * must register nothing. A duplicate from another plugin is a section-mount
1082
+ * failure, so the remaining mounts still happen (review row 32).
716
1083
  */
717
1084
  function mountHooks(ctx, deps, missing) {
718
1085
  const deferred = [];
@@ -742,20 +1109,39 @@ function mountHooks(ctx, deps, missing) {
742
1109
  catch (error) {
743
1110
  registrationError = error;
744
1111
  }
1112
+ let ownsSection = false;
1113
+ const registry = ctx.systemPrompt;
745
1114
  if (sectionError !== undefined && isDuplicateSectionError(sectionError)) {
746
- duplicateMountAttempts += 1;
747
- ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_ALREADY_MOUNTED: duplicate apply #${duplicateMountAttempts} found an existing mount; registration skipped (${messageOf(sectionError)})`);
748
- return true;
1115
+ if (registry !== undefined && mountedRegistries.has(registry)) {
1116
+ duplicateMountAttempts += 1;
1117
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_ALREADY_MOUNTED: duplicate apply #${duplicateMountAttempts} found an existing mount; registration skipped (${messageOf(sectionError)})`);
1118
+ return {
1119
+ alreadyMounted: true,
1120
+ ownsSection: registry !== undefined && ownSectionRegistries.has(registry),
1121
+ };
1122
+ }
1123
+ // The name is taken, but not by this module: the message alone cannot tell
1124
+ // our previous apply from another plugin using the same section name.
1125
+ missing.add(MOUNT_SECTION);
1126
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section "${PROTOCOL_NAME}" is registered by another plugin; mounting the remaining hooks independently (${messageOf(sectionError)})`);
749
1127
  }
750
- if (sectionError !== undefined) {
1128
+ else if (sectionError !== undefined) {
751
1129
  missing.add(MOUNT_SECTION);
752
1130
  ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section registration failed; mounting the remaining hooks independently (${messageOf(sectionError)})`);
753
1131
  }
754
- else if (registrationError !== undefined) {
755
- // The section did not throw, so this is an assembly bug: an unknown mount
756
- // is missing even though no specific one can be named.
757
- missing.add('hooks');
758
- ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: hook assembly failed (${messageOf(registrationError)})`);
1132
+ else {
1133
+ ownsSection = true;
1134
+ // Record the marker only after the host accepted the section: this is the
1135
+ // one registry object a later duplicate may be attributed to.
1136
+ if (ctx.systemPrompt !== undefined && typeof ctx.systemPrompt === 'object') {
1137
+ ownSectionRegistries.add(ctx.systemPrompt);
1138
+ }
1139
+ if (registrationError !== undefined) {
1140
+ // The section did not throw, so this is an assembly bug: an unknown mount
1141
+ // is missing even though no specific one can be named.
1142
+ missing.add('hooks');
1143
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: hook assembly failed (${messageOf(registrationError)})`);
1144
+ }
759
1145
  }
760
1146
  for (const mount of deferred) {
761
1147
  try {
@@ -769,7 +1155,11 @@ function mountHooks(ctx, deps, missing) {
769
1155
  if (missing.size > 0) {
770
1156
  ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`);
771
1157
  }
772
- return false;
1158
+ // A later apply over this registry is a duplicate even when the section name
1159
+ // belonged to another plugin: the hooks and the tool are ours either way.
1160
+ if (registry !== undefined)
1161
+ mountedRegistries.add(registry);
1162
+ return { alreadyMounted: false, ownsSection };
773
1163
  }
774
1164
  export function apply(ctx, config) {
775
1165
  const repairs = [];
@@ -823,27 +1213,75 @@ export function apply(ctx, config) {
823
1213
  // these getters retry until the provider fiber is ACTIVE; an absence is
824
1214
  // never memoised. The workspace registry is the `resolveByPath`/`list()`
825
1215
  // seam; the spill store is the projection backend; the token meter prices
826
- // projections and admission.
1216
+ // projections and admission. A first success is not a permanent binding:
1217
+ // each point of use resets the memo on failure, and the plugin's fiber
1218
+ // disposal drops all three (review row 6).
827
1219
  const registry = lazyService(ctx, 'workspaceRegistry');
828
1220
  const spillService = lazyService(ctx, 'spillStore');
1221
+ // `llm` is soft (see `inject`): projection and admission never need it, and
1222
+ // the selector checks it at call time. A getter keeps a provider that
1223
+ // becomes active after `apply` reachable on the next decision.
1224
+ const llm = lazyService(ctx, 'llm');
829
1225
  /**
830
- * The spill backend the decision path uses, with a failure re-probe.
1226
+ * The workspace registry the visibility warm uses, with a failure re-probe.
831
1227
  *
832
- * A store that resolved is not a store that works: `saveText` rejecting is
833
- * the only evidence the projection path gets (`projection-skipped:spill-failed`),
834
- * and memoising that first success forever would keep every later
835
- * projection pointed at a dead backend while `hasSpill` stayed true. A
836
- * rejection therefore drops the memo; the next decision asks `ctx.get`
837
- * again, which cordis answers from the provider fiber's live state.
1228
+ * `list()` and `resolveByPath()` are total in the resolver (they swallow
1229
+ * their own throws), so this wrapper is the only place a replaced or
1230
+ * disposed provider is observable. A throw drops the memo; the next warm
1231
+ * asks `ctx.get` again and picks up the live binding.
838
1232
  */
839
- const spillBackend = () => {
840
- const backend = spillService();
1233
+ const registryBackend = () => {
1234
+ const backend = registry();
841
1235
  if (backend === undefined)
842
1236
  return undefined;
1237
+ const resolveByPath = backend.resolveByPath;
1238
+ const wrapper = {
1239
+ list: () => {
1240
+ try {
1241
+ return backend.list();
1242
+ }
1243
+ catch (error) {
1244
+ registry.reset();
1245
+ throw error;
1246
+ }
1247
+ },
1248
+ };
1249
+ if (typeof resolveByPath === 'function') {
1250
+ wrapper.resolveByPath = async (path) => {
1251
+ try {
1252
+ return await resolveByPath.call(backend, path);
1253
+ }
1254
+ catch (error) {
1255
+ registry.reset();
1256
+ throw error;
1257
+ }
1258
+ };
1259
+ }
1260
+ return wrapper;
1261
+ };
1262
+ /**
1263
+ * The spill backend the decision path uses, with a pre-write re-confirmation.
1264
+ *
1265
+ * A store that resolved is not a store that still exists: the provider may
1266
+ * be replaced or disposed between the decision that resolved it and the
1267
+ * write. Every write re-reads `ctx.get` through `refresh()` and uses the
1268
+ * current binding. A rejection drops the memo too, so a dead backend cannot
1269
+ * keep every later projection pointed at it while `hasSpill` stays true
1270
+ * (review rows 6 and 31).
1271
+ */
1272
+ const spillBackend = () => {
1273
+ if (spillService() === undefined)
1274
+ return undefined;
843
1275
  return {
844
1276
  saveText: async (input) => {
1277
+ const current = spillService.refresh();
1278
+ if (current === undefined) {
1279
+ // The store disappeared mid-turn: the projection path records this
1280
+ // as `projection-skipped:spill-failed`, not as a crash.
1281
+ throw new Error('spillStore disappeared before the write');
1282
+ }
845
1283
  try {
846
- return await backend.saveText(input);
1284
+ return await current.saveText(input);
847
1285
  }
848
1286
  catch (error) {
849
1287
  spillService.reset();
@@ -852,10 +1290,47 @@ export function apply(ctx, config) {
852
1290
  },
853
1291
  };
854
1292
  };
855
- // `llm` is soft (see `inject`): projection and admission never need it, and
856
- // the selector checks it at call time. A getter keeps a provider that
857
- // becomes active after `apply` reachable on the next decision.
858
- const llm = lazyService(ctx, 'llm');
1293
+ /**
1294
+ * The LLM seam the selector uses, with a failure re-probe.
1295
+ *
1296
+ * The selector turns any failure into an abstention, so a provider that is
1297
+ * replaced after one successful call would otherwise be used for the rest
1298
+ * of the process. A synchronous throw or a throw while the stream is
1299
+ * consumed drops the memo; the next selection asks `ctx.get` again.
1300
+ */
1301
+ const llmBackend = () => {
1302
+ const backend = llm();
1303
+ if (backend === undefined)
1304
+ return undefined;
1305
+ return {
1306
+ stream: (options) => {
1307
+ try {
1308
+ const stream = backend.stream(options);
1309
+ return (async function* () {
1310
+ try {
1311
+ yield* stream;
1312
+ }
1313
+ catch (error) {
1314
+ llm.reset();
1315
+ throw error;
1316
+ }
1317
+ })();
1318
+ }
1319
+ catch (error) {
1320
+ llm.reset();
1321
+ throw error;
1322
+ }
1323
+ },
1324
+ };
1325
+ };
1326
+ // A disposed provider must not leave a stale binding behind for a later
1327
+ // provider that reuses the name. Cordis has no `dispose` event; the effect
1328
+ // seam is the fiber-unload hook (see `onDispose`).
1329
+ onDispose(ctx, () => {
1330
+ registry.reset();
1331
+ spillService.reset();
1332
+ llm.reset();
1333
+ });
859
1334
  const meter = meterSeamOf(ctx);
860
1335
  const projectionCounters = new ProjectionCounters();
861
1336
  // Host capabilities `status` renders as stable codes. Getters keep them
@@ -868,10 +1343,57 @@ export function apply(ctx, config) {
868
1343
  return meter.kind() === 'host';
869
1344
  },
870
1345
  get hasSpill() {
871
- return spillService() !== undefined;
1346
+ // `refresh`, not the memo: a status call reports the host *now*, so a
1347
+ // provider that was replaced or disposed since the last write must not
1348
+ // keep `hasSpill` true (review rows 6 and 50).
1349
+ return spillService.refresh() !== undefined;
1350
+ },
1351
+ get spillUsable() {
1352
+ // Presence is not capability: `{}` resolves, so `hasSpill` alone would
1353
+ // report a healthy projection path until the first `saveText` fails
1354
+ // (review row 50). Probe the method shape, never call it — a status
1355
+ // read must not write a spill artifact. A broken binding is dropped so
1356
+ // a replaced provider is picked up by the next status.
1357
+ try {
1358
+ const backend = spillService.refresh();
1359
+ if (backend === undefined)
1360
+ return false;
1361
+ if (typeof backend.saveText === 'function')
1362
+ return true;
1363
+ spillService.reset();
1364
+ return false;
1365
+ }
1366
+ catch {
1367
+ spillService.reset();
1368
+ return false;
1369
+ }
872
1370
  },
873
1371
  get hasWorkspaceRegistry() {
874
- return registry() !== undefined;
1372
+ // Live fact: a registry that appeared, disappeared or was replaced
1373
+ // since `apply` must be reported as it is now.
1374
+ return registry.refresh() !== undefined;
1375
+ },
1376
+ get workspaceRegistryBroken() {
1377
+ // `resolve.ts` swallows a throwing `list()` per call by design: one
1378
+ // invisible session must not crash a hook. That swallow is exactly why
1379
+ // the failure needs a status-time probe, or every session is judged
1380
+ // invisible while `degraded` stays empty (review row 6). A non-array is
1381
+ // the same fail-closed answer in the resolver, so it is the same
1382
+ // degradation here. `refresh` re-reads the binding so a repaired
1383
+ // provider clears the code on the very next status.
1384
+ try {
1385
+ const backend = registry.refresh();
1386
+ if (backend === undefined)
1387
+ return false;
1388
+ if (Array.isArray(backend.list()))
1389
+ return false;
1390
+ registry.reset();
1391
+ return true;
1392
+ }
1393
+ catch {
1394
+ registry.reset();
1395
+ return true;
1396
+ }
875
1397
  },
876
1398
  };
877
1399
  const fixedOverhead = measureBoostFixedOverhead();
@@ -922,7 +1444,7 @@ export function apply(ctx, config) {
922
1444
  // the mirror instead of leaking one entry per disposed session.
923
1445
  clearAcceptedDispatch: (sessionId) => clearAcceptedDispatch(deps, sessionId),
924
1446
  get llm() {
925
- return llm();
1447
+ return llmBackend();
926
1448
  },
927
1449
  selectorRoute: (sessionId) => routes.get(sessionId),
928
1450
  };
@@ -932,15 +1454,22 @@ export function apply(ctx, config) {
932
1454
  // not take the other three mounts (or the control tool) down with it, and
933
1455
  // must be visible in `status` as `ERR_BOOST_PARTIAL_MOUNT` (review row 2).
934
1456
  const missingMounts = new Set();
935
- if (mountHooks(ctx, deps, missingMounts))
1457
+ const mounts = mountHooks(ctx, deps, missingMounts);
1458
+ if (mounts.alreadyMounted)
936
1459
  return;
937
1460
  // The clock/visibility warm and the session-end cleanup. Wired separately
938
1461
  // so a host that cannot accept these events still gets the tool below.
1462
+ // `wireSessionEvents` mounts each listener in its own try/catch: a throw at
1463
+ // the first one cannot drop the other six (in particular
1464
+ // `session/disposed`, whose loss leaks per-session state for the process
1465
+ // lifetime), and every failure is named in `missingMounts`.
939
1466
  try {
940
- wireSessionEvents(ctx, deps, scope, registry, sessions, horizon, workspaces, routes, projectionCounters);
1467
+ wireSessionEvents(ctx, deps, scope, registryBackend, sessions, horizon, workspaces, routes, projectionCounters, missingMounts, mounts.ownsSection);
941
1468
  }
942
1469
  catch (error) {
943
- ctx.logger?.warn?.(`dsh-boost: session wiring failed: ${messageOf(error)}`);
1470
+ // Only an assembly bug reaches here; each listener mount is contained.
1471
+ missingMounts.add('session-events');
1472
+ ctx.logger?.warn?.(`dsh-boost: ERR_BOOST_PARTIAL_MOUNT: session wiring failed (${messageOf(error)})`);
944
1473
  }
945
1474
  // After the hooks: a genuine duplicate aborts above before it can register
946
1475
  // the tool twice. A different section failure still reaches here, and so