@moltzap/client 2026.518.0 → 2026.519.1

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 (84) hide show
  1. package/dist/channel-base/format-cross-conv.d.ts +43 -0
  2. package/dist/channel-base/format-cross-conv.d.ts.map +1 -0
  3. package/dist/channel-base/format-cross-conv.js +69 -0
  4. package/dist/channel-base/format-cross-conv.js.map +1 -0
  5. package/dist/channel-base/format-group-block.d.ts +43 -0
  6. package/dist/channel-base/format-group-block.d.ts.map +1 -0
  7. package/dist/channel-base/format-group-block.js +59 -0
  8. package/dist/channel-base/format-group-block.js.map +1 -0
  9. package/dist/channel-base/index.d.ts +21 -0
  10. package/dist/channel-base/index.d.ts.map +1 -0
  11. package/dist/channel-base/index.js +24 -0
  12. package/dist/channel-base/index.js.map +1 -0
  13. package/dist/channel-base/lease-guard.d.ts +30 -0
  14. package/dist/channel-base/lease-guard.d.ts.map +1 -0
  15. package/dist/channel-base/lease-guard.js +40 -0
  16. package/dist/channel-base/lease-guard.js.map +1 -0
  17. package/dist/channel-base/lease-store.d.ts +30 -0
  18. package/dist/channel-base/lease-store.d.ts.map +1 -0
  19. package/dist/channel-base/lease-store.js +58 -0
  20. package/dist/channel-base/lease-store.js.map +1 -0
  21. package/dist/channel-base/lease.d.ts +94 -0
  22. package/dist/channel-base/lease.d.ts.map +1 -0
  23. package/dist/channel-base/lease.js +110 -0
  24. package/dist/channel-base/lease.js.map +1 -0
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/notification/__tests__/filter-equivalence.test.d.ts +2 -0
  30. package/dist/notification/__tests__/filter-equivalence.test.d.ts.map +1 -0
  31. package/dist/notification/__tests__/filter-equivalence.test.js +123 -0
  32. package/dist/notification/__tests__/filter-equivalence.test.js.map +1 -0
  33. package/dist/notification/__tests__/snapshot-semantics.test.d.ts +2 -0
  34. package/dist/notification/__tests__/snapshot-semantics.test.d.ts.map +1 -0
  35. package/dist/notification/__tests__/snapshot-semantics.test.js +261 -0
  36. package/dist/notification/__tests__/snapshot-semantics.test.js.map +1 -0
  37. package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts +3 -0
  38. package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts.map +1 -0
  39. package/dist/notification/__tests__/snapshot-semantics.types-check.js +62 -0
  40. package/dist/notification/__tests__/snapshot-semantics.types-check.js.map +1 -0
  41. package/dist/notification/errors.d.ts +27 -0
  42. package/dist/notification/errors.d.ts.map +1 -0
  43. package/dist/notification/errors.js +24 -0
  44. package/dist/notification/errors.js.map +1 -0
  45. package/dist/notification/stream.d.ts +84 -0
  46. package/dist/notification/stream.d.ts.map +1 -0
  47. package/dist/notification/stream.js +106 -0
  48. package/dist/notification/stream.js.map +1 -0
  49. package/dist/runtime/index.d.ts +3 -4
  50. package/dist/runtime/index.d.ts.map +1 -1
  51. package/dist/runtime/index.js +3 -3
  52. package/dist/runtime/service-teardown.d.ts +5 -0
  53. package/dist/runtime/service-teardown.d.ts.map +1 -0
  54. package/dist/runtime/service-teardown.js +36 -0
  55. package/dist/runtime/service-teardown.js.map +1 -0
  56. package/dist/runtime/service-teardown.test.d.ts +2 -0
  57. package/dist/runtime/service-teardown.test.d.ts.map +1 -0
  58. package/dist/runtime/service-teardown.test.js +80 -0
  59. package/dist/runtime/service-teardown.test.js.map +1 -0
  60. package/dist/runtime/subscribers.d.ts +74 -136
  61. package/dist/runtime/subscribers.d.ts.map +1 -1
  62. package/dist/runtime/subscribers.js +187 -93
  63. package/dist/runtime/subscribers.js.map +1 -1
  64. package/dist/service.d.ts +10 -0
  65. package/dist/service.d.ts.map +1 -1
  66. package/dist/service.js +45 -12
  67. package/dist/service.js.map +1 -1
  68. package/dist/test-utils/conformance-adapter.d.ts +6 -16
  69. package/dist/test-utils/conformance-adapter.d.ts.map +1 -1
  70. package/dist/test-utils/conformance-adapter.js +100 -59
  71. package/dist/test-utils/conformance-adapter.js.map +1 -1
  72. package/dist/ws-client-test-support.d.ts +1 -1
  73. package/dist/ws-client-test-support.d.ts.map +1 -1
  74. package/dist/ws-client-test-support.js +24 -3
  75. package/dist/ws-client-test-support.js.map +1 -1
  76. package/dist/ws-client.d.ts +52 -54
  77. package/dist/ws-client.d.ts.map +1 -1
  78. package/dist/ws-client.js +40 -168
  79. package/dist/ws-client.js.map +1 -1
  80. package/package.json +7 -3
  81. package/dist/runtime/subscribers.test.d.ts +0 -2
  82. package/dist/runtime/subscribers.test.d.ts.map +0 -1
  83. package/dist/runtime/subscribers.test.js +0 -193
  84. package/dist/runtime/subscribers.test.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Type-canary for AD1 (architect-decision: trust `Stream.runForEach`
3
+ * cancellation to preserve spec #222 §5.3 OQ-3 snapshot semantics).
4
+ *
5
+ * Compile-time assertions only — this file is referenced by `tsc --build`
6
+ * (via the package's vitest config glob) but has no runtime test bodies.
7
+ * Any drift in `subscribe` / `subscribeAll` public signatures, or in the
8
+ * Stream lifecycle contract, surfaces as a TypeScript error here.
9
+ *
10
+ * **DO NOT delete this file** without first updating spec #596 AD1 and
11
+ * the architect plan at issue #604.
12
+ *
13
+ * **Architect stub** (Spec B): canaries probe the architect-stubbed
14
+ * `subscribe` / `subscribeAll` signatures in `../stream.ts`. Impl-staff
15
+ * preserves the canary shapes and re-targets them at
16
+ * `MoltZapWsClient.prototype.subscribe` / `.subscribeAll` once the
17
+ * methods are wired.
18
+ */
19
+ import { Stream } from "effect";
20
+ import { subscribe, subscribeAll } from "../stream.js";
21
+ // Phantom value-level pin: passing a Canary alias forces tsc to resolve
22
+ // the alias; a `false` resolution fires TS2344 because `false` is not
23
+ // assignable to the `true` constraint.
24
+ function assertCanary() {
25
+ // intentionally empty: type-level pin
26
+ }
27
+ import { PresenceChangedNotificationDefinition } from "@moltzap/protocol";
28
+ const _canary1bStream = subscribe(_canary1bRegistry, PresenceChangedNotificationDefinition, _canary1bIsOnline);
29
+ // P3 #612 fix: ground Canary #3 in the ACTUAL return type of a real
30
+ // `Stream.runForEach(_subStreamForCanary, _handlerForCanary)` call,
31
+ // not a manually-reconstructed `Effect<…, E, R>` inferred from the
32
+ // Stream's own type parameters (which would be a tautology). Calling
33
+ // `runForEach` and capturing the return type forces TypeScript to
34
+ // resolve the overloads using the real Stream value's signature.
35
+ const _ad1Canary3Helper = () => Stream.runForEach(_subStreamForCanary, _handlerForCanary);
36
+ // Phantom value-level call sites: pin each Canary alias as used and let
37
+ // knip/oxlint see the file as fully reachable. tsc never invokes
38
+ // `_ad1Canaries`; the canary alias resolutions happen at type-check
39
+ // time inside the function body.
40
+ function _ad1Canaries() {
41
+ assertCanary();
42
+ assertCanary();
43
+ assertCanary();
44
+ assertCanary();
45
+ assertCanary();
46
+ // Force the runtime-shape value declarations to be used (otherwise
47
+ // tsc warns even on `declare const`). Also exercises a real call
48
+ // into Stream.runForEach to keep Canary #3's premise grounded.
49
+ Stream.runForEach(_subStreamForCanary, _handlerForCanary);
50
+ _ad1Canary3Helper();
51
+ // Touch `_canary1bStream` so tsc keeps the canary-call expression
52
+ // alive (the `Equal<>` assertion + the assignment below force the
53
+ // overload to resolve at compile time).
54
+ const _touch1b = _canary1bStream;
55
+ if (false)
56
+ _touch1b;
57
+ }
58
+ // Discard return so module-level `_ad1Canaries` is read; an assignment
59
+ // to `_` satisfies the linter without invoking the function.
60
+ const _adhoc_phantom_canary_ref = _ad1Canaries;
61
+ export { _adhoc_phantom_canary_ref };
62
+ //# sourceMappingURL=snapshot-semantics.types-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-semantics.types-check.js","sourceRoot":"","sources":["../../../src/notification/__tests__/snapshot-semantics.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQvD,wEAAwE;AACxE,sEAAsE;AACtE,uCAAuC;AACvC,SAAS,YAAY;IACnB,sCAAsC;AACxC,CAAC;AA2CD,OAAO,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAC;AAS1E,MAAM,eAAe,GAAG,SAAS,CAC/B,iBAAiB,EACjB,qCAAqC,EACrC,iBAAiB,CAClB,CAAC;AAsCF,oEAAoE;AACpE,oEAAoE;AACpE,mEAAmE;AACnE,qEAAqE;AACrE,kEAAkE;AAClE,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAC7B,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAe5D,wEAAwE;AACxE,iEAAiE;AACjE,oEAAoE;AACpE,iCAAiC;AACjC,SAAS,YAAY;IACnB,YAAY,EAAmC,CAAC;IAChD,YAAY,EAAsC,CAAC;IACnD,YAAY,EAAmC,CAAC;IAChD,YAAY,EAA6C,CAAC;IAC1D,YAAY,EAA6B,CAAC;IAC1C,mEAAmE;IACnE,iEAAiE;IACjE,+DAA+D;IAC/D,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,CAAC;IACpB,kEAAkE;IAClE,kEAAkE;IAClE,wCAAwC;IACxC,MAAM,QAAQ,GAA2B,eAAe,CAAC;IACzD,IAAI,KAAgB;QAAE,QAAQ,CAAC;AACjC,CAAC;AACD,uEAAuE;AACvE,6DAA6D;AAC7D,MAAM,yBAAyB,GAAY,YAAY,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const TimeoutError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
2
+ readonly _tag: "TimeoutError";
3
+ } & Readonly<A>;
4
+ export declare class TimeoutError extends TimeoutError_base<{
5
+ readonly definition: string;
6
+ readonly durationMs: number;
7
+ }> {
8
+ }
9
+ declare const StreamClosedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
10
+ readonly _tag: "StreamClosedError";
11
+ } & Readonly<A>;
12
+ export declare class StreamClosedError extends StreamClosedError_base<{
13
+ readonly definition: string;
14
+ }> {
15
+ }
16
+ /**
17
+ * Union of all notification consumer error tags. Catch sites use
18
+ * `Effect.catchTags({ TimeoutError: ..., StreamClosedError: ... })` for
19
+ * exhaustive handling, or accept this union in their typed error channel.
20
+ *
21
+ * NOT a class — Effect's `Data.TaggedError` classes do not inherit from
22
+ * a shared `Data.TaggedError` base in a way that preserves `_tag`
23
+ * discrimination. The union is the canonical shape.
24
+ */
25
+ export type NotificationConsumerError = TimeoutError | StreamClosedError;
26
+ export {};
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":";;;AAoBA,qBAAa,YAAa,SAAQ,kBAAiC;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;CAAG;;;;AAEL,qBAAa,iBAAkB,SAAQ,uBAAsC;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;CAAG;AAEL;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Tagged errors for the notification consumption surface (Spec B, #596).
3
+ *
4
+ * Per architect-revision r1 (codex review finding #8): `Data.TaggedError`
5
+ * classes do NOT compose via class inheritance — extending one tagged
6
+ * class from another produces broken `_tag` discrimination at runtime.
7
+ * The shared abstraction is therefore a TYPE UNION (`NotificationConsumerError`)
8
+ * not a base class. Catch sites that want to handle "any notification
9
+ * consumer error" pattern-match on the union.
10
+ *
11
+ * `TimeoutError` carries the timeout duration so callers can log + retry
12
+ * with sane backoff. `StreamClosedError` fires when the consumer's Stream
13
+ * completes empty (e.g. the client transitioned to terminal closed state
14
+ * before a notification arrived).
15
+ *
16
+ * **Architect stub** (Spec B). Impl-staff fills any helper combinators
17
+ * (`isTimeoutError`, mapping helpers) per downstream consumer needs.
18
+ */
19
+ import { Data } from "effect";
20
+ export class TimeoutError extends Data.TaggedError("TimeoutError") {
21
+ }
22
+ export class StreamClosedError extends Data.TaggedError("StreamClosedError") {
23
+ }
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAG/D;CAAG;AAEL,MAAM,OAAO,iBAAkB,SAAQ,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAEzE;CAAG"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Stream-returning constructors for `MoltZapWsClient.subscribe` and
3
+ * `MoltZapWsClient.subscribeAll` (Spec B, #596).
4
+ *
5
+ * Architect decision **AD1 — path (a)**: trust `Stream.async` cancellation
6
+ * to drive registry-stored `unregister` finalizer. The registry's
7
+ * `dispatch` snapshots `subsRef` at iteration start, so the spec #222
8
+ * §5.3 OQ-3 snapshot semantic is preserved by Ref atomicity without an
9
+ * additional per-sub cancelled-flag check (architect plan §3).
10
+ *
11
+ * Stream construction uses `Stream.async<DecodedNotification<D>, NotConnectedError>`
12
+ * with the registry storing typed callback references — NOT `Queue` of
13
+ * `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
14
+ * which codex empirically verified is racy under
15
+ * `Queue.offer(Take.fail); Queue.shutdown` and does not reliably propagate
16
+ * the typed failure to the consumer (architect plan §3.2, codex r4).
17
+ *
18
+ * Stream lifecycle (architect-mandated, spec §"Stream lifecycle contract"):
19
+ * 1. `subscribe(def)` returns a Stream value. Pure; no I/O, no scope.
20
+ * 2. Materialization opens the `Stream.async` source: `registry.register`
21
+ * runs synchronously, callbacks are installed; consumer pulls suspend
22
+ * until `emit.single` fires from dispatch.
23
+ * 3. Pre-`connect()` consumer pulls suspend inside `Stream.async`'s
24
+ * internal queue. No `NotConnectedError` until terminal close.
25
+ * 4. Reconnect leaves registry callbacks intact; `subsRef` survives
26
+ * transient disconnects (preserved invariant).
27
+ * 5. `MoltZapWsClient.close` invokes `SubscriberRegistry.closeAll`, which
28
+ * calls each live `sub.onClose(new NotConnectedError(...))`. Each
29
+ * `Stream.async`-backed consumer fails with `NotConnectedError`
30
+ * via `emit.fail` deterministically (no Queue/shutdown race).
31
+ */
32
+ import { Stream } from "effect";
33
+ import { type AnyNotificationDefinition, type DecodedNotification, type NotConnectedError, type NotificationParamsOf } from "@moltzap/protocol";
34
+ import type { SubscriberRegistry } from "../runtime/subscribers.js";
35
+ /**
36
+ * Typed-payload subscribe. Returns a Stream of `DecodedNotification<D>`
37
+ * whose error channel is `NotConnectedError` and whose requirement set is
38
+ * `never` (the registry handle is bound at materialization time inside
39
+ * `Stream.async`'s register callback, so neither Scope nor any other
40
+ * requirement leaks to the consumer).
41
+ *
42
+ * `refinement` is a typed predicate over the definition's params. When the
43
+ * type-guard overload form is used, the Stream's payload narrows to
44
+ * `DecodedNotification<D, R>` via the optional `R` parameter on
45
+ * `DecodedNotification<D>`.
46
+ */
47
+ export declare function subscribe<D extends AnyNotificationDefinition>(registry: SubscriberRegistry, definition: D, refinement?: (params: NotificationParamsOf<D>) => boolean): Stream.Stream<DecodedNotification<D>, NotConnectedError, never>;
48
+ export declare function subscribe<D extends AnyNotificationDefinition, R extends NotificationParamsOf<D>>(registry: SubscriberRegistry, definition: D, refinement: (params: NotificationParamsOf<D>) => params is R): Stream.Stream<DecodedNotification<D, R>, NotConnectedError, never>;
49
+ /**
50
+ * Broad-union escape hatch. The only intended in-tree consumer is
51
+ * `MoltZapService.connect`, which uses this to fan every inbound
52
+ * notification through `MoltZapService.handleNotification`. Payload
53
+ * narrowing is intentionally lost; callers wanting typed payloads use
54
+ * `subscribe(def, refinement?)`.
55
+ *
56
+ * The `subscribeAll` Stream uses a synthetic "match every definition"
57
+ * filter — implemented by the registry treating a `null` definition
58
+ * pointer as "match all", but for the Stream API we instead register
59
+ * one subscription per inbound frame's definition. Simpler: model
60
+ * "match all" by passing an in-band sentinel.
61
+ *
62
+ * Implementation: the registry has no native "match all" subscription
63
+ * shape (intentional — `subscribe<D>` is per-definition). To preserve
64
+ * the registry's typed dispatch surface, `subscribeAll` constructs a
65
+ * Stream that taps the registry via a per-arrival path: registering
66
+ * once with a sentinel definition would require a registry-level "match
67
+ * any" capability we deliberately avoid (would complicate the typed
68
+ * dispatch in subscribers.ts). Instead, the dispatcher feeds every
69
+ * frame to `subscribeAll`'s emit via a dedicated `subscribeAllRef`
70
+ * callback list maintained alongside `subsRef`.
71
+ *
72
+ * Architect-mandated code shape: per spec Goal #2 / plan §5.3, the
73
+ * surface returns a Stream value. Implementation passes the literal
74
+ * `AnyNotificationDefinition` sentinel via the registry's broad-union
75
+ * channel — see `notification/stream.ts → subscribeAllStream` below
76
+ * which registers via a new `SubscriberRegistry.registerAll` helper.
77
+ *
78
+ * To keep the registry minimal we route `subscribeAll` through a thin
79
+ * wrapper that the registry exposes as `registerAll(callbacks)` —
80
+ * identical lifecycle to `register(def, …)` but with no definition
81
+ * match (the dispatcher hits these callbacks for every inbound frame).
82
+ */
83
+ export declare function subscribeAll(registry: SubscriberRegistry, refinement?: (notification: DecodedNotification<AnyNotificationDefinition>) => boolean): Stream.Stream<DecodedNotification<AnyNotificationDefinition>, NotConnectedError, never>;
84
+ //# sourceMappingURL=stream.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mB,CAAC,yBAAyB,CAAC,EAC9C,iBAAiB,EACjB,KAAK,CACN,CAmBA"}
@@ -0,0 +1,106 @@
1
+ /* eslint-disable jsdoc/text-escaping -- JSDoc references to generic types like `Stream.async<DecodedNotification<D>>` use the natural angle-bracket form (TS source style) inside backtick-fenced code spans; the lint rule's pre-render check fires false positives on these multi-line spans. Matches the precedent in filter-equivalence.test.ts. */
2
+ /**
3
+ * Stream-returning constructors for `MoltZapWsClient.subscribe` and
4
+ * `MoltZapWsClient.subscribeAll` (Spec B, #596).
5
+ *
6
+ * Architect decision **AD1 — path (a)**: trust `Stream.async` cancellation
7
+ * to drive registry-stored `unregister` finalizer. The registry's
8
+ * `dispatch` snapshots `subsRef` at iteration start, so the spec #222
9
+ * §5.3 OQ-3 snapshot semantic is preserved by Ref atomicity without an
10
+ * additional per-sub cancelled-flag check (architect plan §3).
11
+ *
12
+ * Stream construction uses `Stream.async<DecodedNotification<D>, NotConnectedError>`
13
+ * with the registry storing typed callback references — NOT `Queue` of
14
+ * `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
15
+ * which codex empirically verified is racy under
16
+ * `Queue.offer(Take.fail); Queue.shutdown` and does not reliably propagate
17
+ * the typed failure to the consumer (architect plan §3.2, codex r4).
18
+ *
19
+ * Stream lifecycle (architect-mandated, spec §"Stream lifecycle contract"):
20
+ * 1. `subscribe(def)` returns a Stream value. Pure; no I/O, no scope.
21
+ * 2. Materialization opens the `Stream.async` source: `registry.register`
22
+ * runs synchronously, callbacks are installed; consumer pulls suspend
23
+ * until `emit.single` fires from dispatch.
24
+ * 3. Pre-`connect()` consumer pulls suspend inside `Stream.async`'s
25
+ * internal queue. No `NotConnectedError` until terminal close.
26
+ * 4. Reconnect leaves registry callbacks intact; `subsRef` survives
27
+ * transient disconnects (preserved invariant).
28
+ * 5. `MoltZapWsClient.close` invokes `SubscriberRegistry.closeAll`, which
29
+ * calls each live `sub.onClose(new NotConnectedError(...))`. Each
30
+ * `Stream.async`-backed consumer fails with `NotConnectedError`
31
+ * via `emit.fail` deterministically (no Queue/shutdown race).
32
+ */
33
+ import { Effect, Stream } from "effect";
34
+ import {} from "@moltzap/protocol";
35
+ export function subscribe(registry, definition, refinement) {
36
+ return Stream.async((emit) => {
37
+ // Synchronous registration — the registry stores the typed callbacks
38
+ // and returns an `unregister` Effect that the Stream's runtime will
39
+ // invoke as the cancellation finalizer. #ignore-sloppy-code[async-keyword]: comment references `Stream.async`, not a function modifier
40
+ //
41
+ // `register` is `Effect<SubscriptionHandle, never>`; `runSync` is safe
42
+ // because the registry mutates an in-memory `Ref` and never yields.
43
+ const handle = Effect.runSync(registry.register(definition, refinement, {
44
+ onFrame: (frame) => Effect.sync(() => {
45
+ emit.single(frame);
46
+ }),
47
+ onClose: (cause) => Effect.sync(() => {
48
+ emit.fail(cause);
49
+ }),
50
+ }));
51
+ // Per P3 issue #613: use `Effect.suspend` to defer running `unregister`
52
+ // to whenever the Stream's runtime invokes the finalizer Effect. This
53
+ // is future-proof if `unregister` ever grows yielded effects (e.g.
54
+ // flushing a queue); the `Effect.sync(() => Effect.runSync(handle.unregister))`
55
+ // form would force-eager-evaluate as sync.
56
+ return Effect.suspend(() => handle.unregister);
57
+ });
58
+ }
59
+ /**
60
+ * Broad-union escape hatch. The only intended in-tree consumer is
61
+ * `MoltZapService.connect`, which uses this to fan every inbound
62
+ * notification through `MoltZapService.handleNotification`. Payload
63
+ * narrowing is intentionally lost; callers wanting typed payloads use
64
+ * `subscribe(def, refinement?)`.
65
+ *
66
+ * The `subscribeAll` Stream uses a synthetic "match every definition"
67
+ * filter — implemented by the registry treating a `null` definition
68
+ * pointer as "match all", but for the Stream API we instead register
69
+ * one subscription per inbound frame's definition. Simpler: model
70
+ * "match all" by passing an in-band sentinel.
71
+ *
72
+ * Implementation: the registry has no native "match all" subscription
73
+ * shape (intentional — `subscribe<D>` is per-definition). To preserve
74
+ * the registry's typed dispatch surface, `subscribeAll` constructs a
75
+ * Stream that taps the registry via a per-arrival path: registering
76
+ * once with a sentinel definition would require a registry-level "match
77
+ * any" capability we deliberately avoid (would complicate the typed
78
+ * dispatch in subscribers.ts). Instead, the dispatcher feeds every
79
+ * frame to `subscribeAll`'s emit via a dedicated `subscribeAllRef`
80
+ * callback list maintained alongside `subsRef`.
81
+ *
82
+ * Architect-mandated code shape: per spec Goal #2 / plan §5.3, the
83
+ * surface returns a Stream value. Implementation passes the literal
84
+ * `AnyNotificationDefinition` sentinel via the registry's broad-union
85
+ * channel — see `notification/stream.ts → subscribeAllStream` below
86
+ * which registers via a new `SubscriberRegistry.registerAll` helper.
87
+ *
88
+ * To keep the registry minimal we route `subscribeAll` through a thin
89
+ * wrapper that the registry exposes as `registerAll(callbacks)` —
90
+ * identical lifecycle to `register(def, …)` but with no definition
91
+ * match (the dispatcher hits these callbacks for every inbound frame).
92
+ */
93
+ export function subscribeAll(registry, refinement) {
94
+ return Stream.async((emit) => {
95
+ const handle = Effect.runSync(registry.registerAll(refinement, {
96
+ onFrame: (frame) => Effect.sync(() => {
97
+ emit.single(frame);
98
+ }),
99
+ onClose: (cause) => Effect.sync(() => {
100
+ emit.fail(cause);
101
+ }),
102
+ }));
103
+ return Effect.suspend(() => handle.unregister);
104
+ });
105
+ }
106
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAAA,wVAAwV;AAExV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAKN,MAAM,mBAAmB,CAAC;AA6B3B,MAAM,UAAU,SAAS,CACvB,QAA4B,EAC5B,UAAa,EACb,UAAyD;IAEzD,OAAO,MAAM,CAAC,KAAK,CAA4C,CAAC,IAAI,EAAE,EAAE;QACtE,qEAAqE;QACrE,oEAAoE;QACpE,uIAAuI;QACvI,EAAE;QACF,uEAAuE;QACvE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AAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * @file Local-service IPC primitives and runtime helpers for the client CLI.
3
3
  *
4
- * The public surface is intentionally narrow: command definitions for the
5
- * local daemon socket and the subscription filter type consumed by status and
6
- * conformance adapters.
4
+ * Spec B (#596) deleted the three-field `SubscriptionFilter` re-export — the
5
+ * notification consumption surface is now Stream-based via
6
+ * `MoltZapWsClient.subscribe(def, refinement?)`.
7
7
  */
8
8
  export { LocalServiceCommands } from "./local-service-commands.js";
9
9
  export type { LocalServiceCommand } from "./local-service-commands.js";
10
- export type { SubscriptionFilter } from "./subscribers.js";
11
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @file Local-service IPC primitives and runtime helpers for the client CLI.
3
3
  *
4
- * The public surface is intentionally narrow: command definitions for the
5
- * local daemon socket and the subscription filter type consumed by status and
6
- * conformance adapters.
4
+ * Spec B (#596) deleted the three-field `SubscriptionFilter` re-export — the
5
+ * notification consumption surface is now Stream-based via
6
+ * `MoltZapWsClient.subscribe(def, refinement?)`.
7
7
  */
8
8
  export { LocalServiceCommands } from "./local-service-commands.js";
9
9
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ import { Effect, Scope } from "effect";
2
+ export declare function composeServiceTeardown(serviceScope: Scope.CloseableScope | null, client: {
3
+ readonly close: () => Effect.Effect<void, never>;
4
+ } | null): Effect.Effect<void, never>;
5
+ //# sourceMappingURL=service-teardown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-teardown.d.ts","sourceRoot":"","sources":["../../src/runtime/service-teardown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAQ,KAAK,EAAE,MAAM,QAAQ,CAAC;AA8B7C,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,EACzC,MAAM,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;CAAE,GAAG,IAAI,GAClE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAQ5B"}
@@ -0,0 +1,36 @@
1
+ /* eslint-disable agent-code-guard/no-conditional-chaining -- composeServiceTeardown IS the resolution site for nullable scope+client inputs; the `closeXxxIfPresent` helpers each narrow their one nullable arg to a concrete `Effect`, so by the time `zipRight` runs every value is fully resolved. The rule fires on the parameter declarations (regarding them as "carriers"), but pushing the null-narrowing to every caller of `MoltZapService.close` would duplicate the conditional shape across the package. */
2
+ import { Effect, Exit, Scope } from "effect";
3
+ /**
4
+ * Build the close-order teardown Effect for `MoltZapService.close`:
5
+ * close the service-owned scope (which interrupts the
6
+ * `subscribeAll → Stream.runForEach` fan-out fiber) BEFORE invoking the
7
+ * ws-client's `close()`. Exposed as a top-level pure helper so the
8
+ * ordering can be exercised by a regression test without spinning up
9
+ * the full service. Codex r0 caught the original two-`runFork` race
10
+ * here; the regression test in `service.test.ts` pins the structural
11
+ * fix (P2-4 r1 cleanup).
12
+ *
13
+ * The chain is single-fork by construction (`Effect.zipRight`): the
14
+ * ws-client `close()` does not begin until the scope finalizer chain
15
+ * has completed.
16
+ */
17
+ function closeScopeIfPresent(serviceScope) {
18
+ if (serviceScope === null)
19
+ return Effect.void;
20
+ return Scope.close(serviceScope, Exit.void);
21
+ }
22
+ function closeClientIfPresent(client) {
23
+ if (client === null)
24
+ return Effect.void;
25
+ return client.close();
26
+ }
27
+ export function composeServiceTeardown(serviceScope, client) {
28
+ // Resolve each optional input to a concrete Effect via the dedicated
29
+ // `closeXxxIfPresent` helpers, then sequence with `zipRight`. Single-fork
30
+ // sequencing: ws-client `close()` does not begin until the scope
31
+ // finalizer chain has completed.
32
+ const closeScope = closeScopeIfPresent(serviceScope);
33
+ const closeClient = closeClientIfPresent(client);
34
+ return closeScope.pipe(Effect.zipRight(closeClient));
35
+ }
36
+ //# sourceMappingURL=service-teardown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-teardown.js","sourceRoot":"","sources":["../../src/runtime/service-teardown.ts"],"names":[],"mappings":"AAAA,yfAAyf;AACzf,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,SAAS,mBAAmB,CAC1B,YAAyC;IAEzC,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IAC9C,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAmE;IAEnE,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACxC,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,YAAyC,EACzC,MAAmE;IAEnE,qEAAqE;IACrE,0EAA0E;IAC1E,iEAAiE;IACjE,iCAAiC;IACjC,MAAM,UAAU,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=service-teardown.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-teardown.test.d.ts","sourceRoot":"","sources":["../../src/runtime/service-teardown.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Spec B (#596) close-ordering regression test (P2-4 r1 cleanup).
3
+ *
4
+ * `MoltZapService.close` MUST close the service-owned scope (which holds
5
+ * the `subscribeAll → Stream.runForEach` fan-out fiber) BEFORE invoking
6
+ * the ws-client's `close()`. Codex r0 caught the original two-`runFork`
7
+ * race; the structural fix lives in `composeServiceTeardown` and these
8
+ * tests pin the ordering so a future refactor can't regress.
9
+ *
10
+ * `composeServiceTeardown` is a pure Effect producer: it composes the
11
+ * close chain but does NOT run it. The tests await the returned Effect
12
+ * via `yield*`, which means by the time we read `events` the chain has
13
+ * fully settled — no `Effect.runFork` race in the test harness either.
14
+ */
15
+ /* eslint-disable agent-code-guard/finalizer-requires-scope -- scope is the test artifact closed explicitly via composeServiceTeardown(scope, ...); no enclosing Effect.scoped frame applies here by design */
16
+ import { describe, expect, it } from "vitest";
17
+ import { Effect, Scope } from "effect";
18
+ import { composeServiceTeardown } from "./service-teardown.js";
19
+ function makeRecorder() {
20
+ const events = [];
21
+ const fakeClient = {
22
+ close: () => Effect.sync(() => {
23
+ events.push("client");
24
+ }),
25
+ };
26
+ return { events, fakeClient };
27
+ }
28
+ function makeScopeRecorder(events) {
29
+ // Build a `Scope.CloseableScope` whose finalizer pushes "scope" — mirrors
30
+ // the runtime shape (the fan-out fiber is installed as a finalizer on
31
+ // `serviceScope` via `Effect.forkIn` in `MoltZapService.connect`). The
32
+ // scope is the artifact under test and is closed explicitly via
33
+ // `composeServiceTeardown`; no enclosing `Effect.scoped` is needed.
34
+ return Effect.gen(function* () {
35
+ const scope = yield* Scope.make();
36
+ yield* Scope.addFinalizer(scope, Effect.sync(() => {
37
+ events.push("scope");
38
+ }));
39
+ return scope;
40
+ });
41
+ }
42
+ function teardownOrderingCloses() {
43
+ return Effect.runPromise(Effect.gen(function* () {
44
+ const { events, fakeClient } = makeRecorder();
45
+ const scope = yield* makeScopeRecorder(events);
46
+ yield* composeServiceTeardown(scope, fakeClient);
47
+ expect(events).toEqual(["scope", "client"]);
48
+ }));
49
+ }
50
+ function teardownNullScopeRunsClient() {
51
+ return Effect.runPromise(Effect.gen(function* () {
52
+ const { events, fakeClient } = makeRecorder();
53
+ yield* composeServiceTeardown(null, fakeClient);
54
+ expect(events).toEqual(["client"]);
55
+ }));
56
+ }
57
+ function teardownNullClientClosesScope() {
58
+ return Effect.runPromise(Effect.gen(function* () {
59
+ const events = [];
60
+ const scope = yield* makeScopeRecorder(events);
61
+ yield* composeServiceTeardown(scope, null);
62
+ expect(events).toEqual(["scope"]);
63
+ }));
64
+ }
65
+ function teardownBothNullIsNoop() {
66
+ return Effect.runPromise(Effect.gen(function* () {
67
+ yield* composeServiceTeardown(null, null);
68
+ // The Effect completed without failing — that IS the assertion. The
69
+ // explicit expect anchors the test name; no value to compare beyond
70
+ // "no throw."
71
+ expect(true).toBe(true);
72
+ }));
73
+ }
74
+ describe("composeServiceTeardown — Spec B close ordering (P2-4)", () => {
75
+ it("closes service-owned scope BEFORE invoking ws-client.close()", teardownOrderingCloses);
76
+ it("tolerates null scope (calls only client.close())", teardownNullScopeRunsClient);
77
+ it("tolerates null client (closes only the scope)", teardownNullClientClosesScope);
78
+ it("no-op when both inputs are null", teardownBothNullIsNoop);
79
+ });
80
+ //# sourceMappingURL=service-teardown.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-teardown.test.js","sourceRoot":"","sources":["../../src/runtime/service-teardown.test.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