@cldmv/slothlet-types 3.18.2 → 3.19.0

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.
@@ -171,5 +171,48 @@ export class ComponentBase {
171
171
  moduleID?: string | undefined;
172
172
  error?: Error | undefined;
173
173
  }): Promise<void>;
174
+ /**
175
+ * Emit the public `impl:collision` lifecycle event (#441).
176
+ * @param {object} data - Collision payload (every field is passed explicitly by the call site).
177
+ * @param {string} data.apiPath - Dot-notation api path where the collision resolved.
178
+ * @param {"dropped"|"replaced"|"merged"|"stacked"} data.resolution - What became of the two
179
+ * writers: `dropped` (incoming discarded, `owner` retained), `replaced` (incoming won, `owner`
180
+ * shadowed), `merged` (namespace nodes combined, both retained), `stacked` (both run as a
181
+ * routine stack under `stackRoutines`).
182
+ * @param {string|null} data.incoming - moduleID of the arriving writer (`null` when unknown).
183
+ * @param {string|null} data.owner - moduleID of the writer that already held the path (`null`
184
+ * when unknown).
185
+ * @param {"value"|"namespace"} data.kind - Whether the colliding contribution is a value leaf
186
+ * or a namespace node.
187
+ * @param {string|null} data.collisionMode - The mode that resolved it (`skip`/`warn`/`replace`/
188
+ * `merge`/`merge-replace`), or `null` where a mode is not meaningful (e.g. `stacked`).
189
+ * @returns {void}
190
+ * @package
191
+ *
192
+ * @description
193
+ * Unlike `impl:created` — which fires post-placement for the path WINNER only, so a leaf a merge
194
+ * discards is never announced — `impl:collision` fires for the collision itself and carries BOTH
195
+ * writers, so a consumer can observe a silently dropped or shadowed leaf regardless of nesting.
196
+ *
197
+ * Fire-and-forget by design: `emit()` isolates each handler's errors and never rejects (mirroring
198
+ * the `impl:created` re-emit in `src/slothlet.mjs`), so a collision-decision site can announce the
199
+ * event without awaiting subscriber code inline and without any unhandled rejection escaping.
200
+ * Synchronous subscribers still run during this call (before `emit()` yields), so an observer that
201
+ * collects events sees them by the time the composing `await` resolves.
202
+ *
203
+ * @example
204
+ * this.emitImplCollision({
205
+ * apiPath: "shared.alpha", resolution: "dropped", incoming: "pkgB_x", owner: "pkgA_y",
206
+ * kind: "value", collisionMode: "merge"
207
+ * });
208
+ */
209
+ emitImplCollision({ apiPath, resolution, incoming, owner, kind, collisionMode }: {
210
+ apiPath: string;
211
+ resolution: "dropped" | "replaced" | "merged" | "stacked";
212
+ incoming: string | null;
213
+ owner: string | null;
214
+ kind: "value" | "namespace";
215
+ collisionMode: string | null;
216
+ }): void;
174
217
  #private;
175
218
  }
@@ -19,7 +19,7 @@ export class Lifecycle extends ComponentBase {
19
19
  maxLogSize: number;
20
20
  /**
21
21
  * Subscribe to lifecycle event
22
- * @param {string} event - Event name (impl:created, impl:changed, impl:removed, materialized:complete, path:collision)
22
+ * @param {string} event - Event name (impl:created, impl:changed, impl:collision, impl:removed, materialized:complete)
23
23
  * @param {Function} handler - Event handler function(eventData)
24
24
  * @returns {Function} Unsubscribe function
25
25
  * @public
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/slothlet-types",
3
- "version": "3.18.2",
3
+ "version": "3.19.0",
4
4
  "description": "TypeScript declaration files (.d.mts) for @cldmv/slothlet. Install alongside @cldmv/slothlet for editor and type-checker support.",
5
5
  "keywords": [
6
6
  "slothlet",
@@ -79,7 +79,7 @@
79
79
  "LICENSE"
80
80
  ],
81
81
  "peerDependencies": {
82
- "@cldmv/slothlet": "3.18.2"
82
+ "@cldmv/slothlet": "3.19.0"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "@cldmv/slothlet": {