@moq/net 0.4.8 → 0.22.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.
- package/README.md +7 -1
- package/announce.d.ts +1 -1
- package/announce.d.ts.map +1 -1
- package/announce.js +1 -1
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -31
- package/announced.js.map +1 -1
- package/announced.test-util.d.ts +2 -0
- package/announced.test-util.d.ts.map +1 -0
- package/announced.test-util.js +27 -0
- package/announced.test-util.js.map +1 -0
- package/auth.d.ts +64 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +20 -0
- package/auth.js.map +1 -0
- package/auth_gate.d.ts +2 -0
- package/auth_gate.d.ts.map +1 -0
- package/auth_gate.js +24 -0
- package/auth_gate.js.map +1 -0
- package/auth_session.d.ts +49 -0
- package/auth_session.d.ts.map +1 -0
- package/auth_session.js +1097 -0
- package/auth_session.js.map +1 -0
- package/bandwidth.d.ts +129 -25
- package/bandwidth.d.ts.map +1 -1
- package/bandwidth.js +410 -138
- package/bandwidth.js.map +1 -1
- package/bandwidth_api.d.ts +1 -1
- package/bandwidth_api.d.ts.map +1 -1
- package/bandwidth_api.js +1 -1
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +62 -36
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -172
- package/broadcast.js.map +1 -1
- package/cache.d.ts +103 -0
- package/cache.d.ts.map +1 -0
- package/cache.js +254 -0
- package/cache.js.map +1 -0
- package/claim.test-util.d.ts +5 -0
- package/claim.test-util.d.ts.map +1 -0
- package/claim.test-util.js +13 -0
- package/claim.test-util.js.map +1 -0
- package/connection/accept.d.ts +20 -12
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -129
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -19
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +119 -23
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -216
- package/connection/connect.js.map +1 -1
- package/connection/dials.d.ts +45 -0
- package/connection/dials.d.ts.map +1 -0
- package/connection/dials.js +109 -0
- package/connection/dials.js.map +1 -0
- package/connection/endpoint.d.ts +60 -0
- package/connection/endpoint.d.ts.map +1 -0
- package/connection/endpoint.js +114 -0
- package/connection/endpoint.js.map +1 -0
- package/connection/forward.d.ts +7 -1
- package/connection/forward.d.ts.map +1 -1
- package/connection/forward.js +265 -80
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +16 -9
- package/connection/goaway.d.ts.map +1 -1
- package/connection/goaway.js +22 -108
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +32 -6
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -20
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +3 -6
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -2
- package/connection/index.js.map +1 -1
- package/connection/liveness.d.ts +14 -0
- package/connection/liveness.d.ts.map +1 -0
- package/connection/liveness.js +30 -0
- package/connection/liveness.js.map +1 -0
- package/connection/pool.d.ts +137 -58
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -117
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts +60 -12
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +859 -233
- package/connection/reload.js.map +1 -1
- package/connection/session.d.ts +91 -0
- package/connection/session.d.ts.map +1 -0
- package/connection/session.js +2 -0
- package/connection/session.js.map +1 -0
- package/connection/stats.d.ts +20 -11
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js +64 -8
- package/connection/stats.js.map +1 -1
- package/connection/ticker.d.ts +4 -0
- package/connection/ticker.d.ts.map +1 -0
- package/connection/ticker.js +66 -0
- package/connection/ticker.js.map +1 -0
- package/connection/tokens.d.ts +2 -0
- package/connection/tokens.d.ts.map +1 -0
- package/connection/tokens.js +404 -0
- package/connection/tokens.js.map +1 -0
- package/connection/transport.d.ts.map +1 -1
- package/connection/transport.js +4 -4
- package/connection/transport.js.map +1 -1
- package/connection/withdrawal.d.ts +2 -0
- package/connection/withdrawal.d.ts.map +1 -0
- package/connection/withdrawal.js +23 -0
- package/connection/withdrawal.js.map +1 -0
- package/consume.js +213 -46
- package/consume.js.map +1 -1
- package/cover.d.ts +59 -0
- package/cover.d.ts.map +1 -0
- package/cover.js +375 -0
- package/cover.js.map +1 -0
- package/datagram.d.ts +70 -11
- package/datagram.d.ts.map +1 -1
- package/datagram.js +317 -1
- package/datagram.js.map +1 -1
- package/datagram_stream.d.ts +18 -0
- package/datagram_stream.d.ts.map +1 -0
- package/datagram_stream.js +67 -0
- package/datagram_stream.js.map +1 -0
- package/defined.test-util.d.ts +2 -0
- package/defined.test-util.d.ts.map +1 -0
- package/defined.test-util.js +7 -0
- package/defined.test-util.js.map +1 -0
- package/delivered.d.ts +75 -0
- package/delivered.d.ts.map +1 -0
- package/delivered.js +228 -0
- package/delivered.js.map +1 -0
- package/demand.d.ts +173 -0
- package/demand.d.ts.map +1 -0
- package/demand.js +582 -0
- package/demand.js.map +1 -0
- package/drops.d.ts +93 -0
- package/drops.d.ts.map +1 -0
- package/drops.js +283 -0
- package/drops.js.map +1 -0
- package/error.d.ts +120 -21
- package/error.d.ts.map +1 -1
- package/error.js +230 -37
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -2
- package/errors.js.map +1 -1
- package/fill.d.ts +174 -0
- package/fill.d.ts.map +1 -0
- package/fill.js +760 -0
- package/fill.js.map +1 -0
- package/flate/decoder.d.ts +2 -0
- package/flate/decoder.d.ts.map +1 -0
- package/flate/decoder.js +63 -0
- package/flate/decoder.js.map +1 -0
- package/flate/encoder.d.ts +2 -0
- package/flate/encoder.d.ts.map +1 -0
- package/flate/encoder.js +64 -0
- package/flate/encoder.js.map +1 -0
- package/flate/group.d.ts +34 -0
- package/flate/group.d.ts.map +1 -0
- package/flate/group.js +140 -0
- package/flate/group.js.map +1 -0
- package/frame.d.ts +80 -0
- package/frame.d.ts.map +1 -0
- package/frame.js +296 -0
- package/frame.js.map +1 -0
- package/frame.test-util.d.ts +5 -0
- package/frame.test-util.d.ts.map +1 -0
- package/frame.test-util.js +9 -0
- package/frame.test-util.js.map +1 -0
- package/group.d.ts +108 -45
- package/group.d.ts.map +1 -1
- package/group.js +1616 -307
- package/group.js.map +1 -1
- package/group_api.d.ts +7 -0
- package/group_api.d.ts.map +1 -0
- package/group_api.js +7 -0
- package/group_api.js.map +1 -0
- package/hop.d.ts +62 -76
- package/hop.d.ts.map +1 -1
- package/hop.js +92 -64
- package/hop.js.map +1 -1
- package/identity.d.ts +39 -0
- package/identity.d.ts.map +1 -0
- package/identity.js +47 -0
- package/identity.js.map +1 -0
- package/ietf/active_count.d.ts +2 -0
- package/ietf/active_count.d.ts.map +1 -0
- package/ietf/active_count.js +30 -0
- package/ietf/active_count.js.map +1 -0
- package/ietf/aliases.js +69 -35
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -62
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +1 -31
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +305 -143
- package/ietf/connection.js.map +1 -1
- package/ietf/datagram.d.ts +60 -0
- package/ietf/datagram.d.ts.map +1 -0
- package/ietf/datagram.js +152 -0
- package/ietf/datagram.js.map +1 -0
- package/ietf/error.d.ts +3 -3
- package/ietf/error.js +82 -100
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +91 -35
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -93
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +20 -30
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -171
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +11 -9
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -35
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -1
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +2 -14
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -14
- package/ietf/index.js.map +1 -1
- package/ietf/join.d.ts +7 -0
- package/ietf/join.d.ts.map +1 -0
- package/ietf/join.js +234 -0
- package/ietf/join.js.map +1 -0
- package/ietf/message.d.ts +18 -2
- package/ietf/message.d.ts.map +1 -1
- package/ietf/message.js +60 -40
- package/ietf/message.js.map +1 -1
- package/ietf/message.test-util.d.ts +6 -0
- package/ietf/message.test-util.d.ts.map +1 -0
- package/ietf/message.test-util.js +13 -0
- package/ietf/message.test-util.js.map +1 -0
- package/ietf/namespace.d.ts +17 -3
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -26
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +194 -32
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -178
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +22 -42
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -472
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +17 -2
- package/ietf/priority.d.ts.map +1 -1
- package/ietf/priority.js +19 -4
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +5 -4
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -48
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +22 -30
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -139
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +46 -69
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -184
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -600
- package/ietf/publisher.js.map +1 -1
- package/ietf/range.d.ts +2 -0
- package/ietf/range.d.ts.map +1 -0
- package/ietf/range.js +222 -0
- package/ietf/range.js.map +1 -0
- package/ietf/request.d.ts +3 -27
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -78
- package/ietf/request.js.map +1 -1
- package/ietf/request_stream.d.ts +1 -6
- package/ietf/request_stream.d.ts.map +1 -1
- package/ietf/request_stream.js +306 -16
- package/ietf/request_stream.js.map +1 -1
- package/ietf/session.d.ts +41 -0
- package/ietf/session.d.ts.map +1 -0
- package/ietf/session.js +65 -0
- package/ietf/session.js.map +1 -0
- package/ietf/setup.d.ts +4 -29
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -117
- package/ietf/setup.js.map +1 -1
- package/ietf/setup_options.d.ts +31 -0
- package/ietf/setup_options.d.ts.map +1 -0
- package/ietf/setup_options.js +138 -0
- package/ietf/setup_options.js.map +1 -0
- package/ietf/solicit.js +4 -14
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +48 -41
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -239
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +13 -76
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -201
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -536
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -27
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +25 -22
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -61
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +13 -42
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +22 -48
- package/ietf/version.js.map +1 -1
- package/implementation.d.ts +2 -0
- package/implementation.d.ts.map +1 -0
- package/implementation.js +5 -0
- package/implementation.js.map +1 -0
- package/index.d.ts +25 -10
- package/index.d.ts.map +1 -1
- package/index.js +19 -6
- package/index.js.map +1 -1
- package/internal.d.ts +1512 -64
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -79
- package/internal.js.map +1 -1
- package/ledger.d.ts +23 -0
- package/ledger.d.ts.map +1 -0
- package/ledger.js +247 -0
- package/ledger.js.map +1 -0
- package/listing.d.ts +132 -0
- package/listing.d.ts.map +1 -0
- package/listing.js +486 -0
- package/listing.js.map +1 -0
- package/lite/announce.d.ts +124 -63
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -158
- package/lite/announce.js.map +1 -1
- package/lite/announce_stream.d.ts +2 -0
- package/lite/announce_stream.d.ts.map +1 -0
- package/lite/announce_stream.js +92 -0
- package/lite/announce_stream.js.map +1 -0
- package/lite/answer.d.ts +22 -0
- package/lite/answer.d.ts.map +1 -0
- package/lite/answer.js +301 -0
- package/lite/answer.js.map +1 -0
- package/lite/auth.d.ts +45 -0
- package/lite/auth.d.ts.map +1 -0
- package/lite/auth.js +204 -0
- package/lite/auth.js.map +1 -0
- package/lite/compat.d.ts +31 -0
- package/lite/compat.d.ts.map +1 -0
- package/lite/compat.js +86 -0
- package/lite/compat.js.map +1 -0
- package/lite/connection.d.ts +1 -45
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +360 -77
- package/lite/connection.js.map +1 -1
- package/lite/datagram-end.d.ts +26 -0
- package/lite/datagram-end.d.ts.map +1 -0
- package/lite/datagram-end.js +30 -0
- package/lite/datagram-end.js.map +1 -0
- package/lite/datagram.d.ts +73 -8
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +144 -9
- package/lite/datagram.js.map +1 -1
- package/lite/duration.d.ts +6 -0
- package/lite/duration.d.ts.map +1 -0
- package/lite/duration.js +14 -0
- package/lite/duration.js.map +1 -0
- package/lite/error.d.ts +9 -0
- package/lite/error.d.ts.map +1 -0
- package/lite/error.js +24 -0
- package/lite/error.js.map +1 -0
- package/lite/fills.d.ts +162 -0
- package/lite/fills.d.ts.map +1 -0
- package/lite/fills.js +486 -0
- package/lite/fills.js.map +1 -0
- package/lite/fit.d.ts +49 -0
- package/lite/fit.d.ts.map +1 -0
- package/lite/fit.js +305 -0
- package/lite/fit.js.map +1 -0
- package/lite/goaway.d.ts +1 -1
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -13
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +64 -13
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -30
- package/lite/group.js.map +1 -1
- package/lite/identity.d.ts +25 -0
- package/lite/identity.d.ts.map +1 -0
- package/lite/identity.js +79 -0
- package/lite/identity.js.map +1 -0
- package/lite/index.d.ts +2 -1
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -1
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +9 -1
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -44
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +9 -2
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +11 -105
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -0
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +10 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +2548 -437
- package/lite/publisher.js.map +1 -1
- package/lite/routed.d.ts +59 -0
- package/lite/routed.d.ts.map +1 -0
- package/lite/routed.js +564 -0
- package/lite/routed.js.map +1 -0
- package/lite/session.d.ts +1 -27
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -99
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +29 -2
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -21
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +5 -11
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +5 -1
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +475 -75
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -142
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +7 -44
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3290 -515
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +24 -9
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -37
- package/lite/track.js.map +1 -1
- package/lite/tracks.d.ts +55 -0
- package/lite/tracks.d.ts.map +1 -0
- package/lite/tracks.js +114 -0
- package/lite/tracks.js.map +1 -0
- package/lite/version.d.ts +132 -24
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +378 -33
- package/lite/version.js.map +1 -1
- package/meta.d.ts +77 -0
- package/meta.d.ts.map +1 -0
- package/meta.js +130 -0
- package/meta.js.map +1 -0
- package/meta_api.d.ts +7 -0
- package/meta_api.d.ts.map +1 -0
- package/meta_api.js +7 -0
- package/meta_api.js.map +1 -0
- package/mint.d.ts +28 -0
- package/mint.d.ts.map +1 -0
- package/mint.js +66 -0
- package/mint.js.map +1 -0
- package/open.d.ts +63 -0
- package/open.d.ts.map +1 -0
- package/open.js +250 -0
- package/open.js.map +1 -0
- package/origin.d.ts +392 -140
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -686
- package/origin.js.map +1 -1
- package/package.json +8 -13
- package/path.d.ts +51 -51
- package/path.d.ts.map +1 -1
- package/path.js +210 -57
- package/path.js.map +1 -1
- package/payload.d.ts +33 -0
- package/payload.d.ts.map +1 -0
- package/payload.js +65 -0
- package/payload.js.map +1 -0
- package/prefix.d.ts +152 -0
- package/prefix.d.ts.map +1 -0
- package/prefix.js +349 -0
- package/prefix.js.map +1 -0
- package/priority.d.ts +8 -0
- package/priority.d.ts.map +1 -0
- package/priority.js +185 -0
- package/priority.js.map +1 -0
- package/queue.d.ts +2 -0
- package/queue.d.ts.map +1 -0
- package/queue.js +46 -0
- package/queue.js.map +1 -0
- package/ranges.d.ts +36 -0
- package/ranges.d.ts.map +1 -0
- package/ranges.js +312 -0
- package/ranges.js.map +1 -0
- package/rescale.d.ts +24 -0
- package/rescale.d.ts.map +1 -0
- package/rescale.js +39 -0
- package/rescale.js.map +1 -0
- package/resume.d.ts +55 -0
- package/resume.d.ts.map +1 -0
- package/resume.js +4173 -0
- package/resume.js.map +1 -0
- package/resume.test-util.d.ts +2 -0
- package/resume.test-util.d.ts.map +1 -0
- package/resume.test-util.js +25 -0
- package/resume.test-util.js.map +1 -0
- package/skips.d.ts +48 -0
- package/skips.d.ts.map +1 -0
- package/skips.js +182 -0
- package/skips.js.map +1 -0
- package/stream.d.ts +75 -37
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -92
- package/stream.js.map +1 -1
- package/subscription.test-util.d.ts +2 -0
- package/subscription.test-util.d.ts.map +1 -0
- package/subscription.test-util.js +49 -0
- package/subscription.test-util.js.map +1 -0
- package/tail.d.ts +23 -14
- package/tail.d.ts.map +1 -1
- package/tail.js +224 -97
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -91
- package/time.js.map +1 -1
- package/timed.d.ts +21 -0
- package/timed.d.ts.map +1 -0
- package/timed.js +2 -0
- package/timed.js.map +1 -0
- package/track.d.ts +577 -245
- package/track.d.ts.map +1 -1
- package/track.js +7306 -771
- package/track.js.map +1 -1
- package/track_api.d.ts +7 -0
- package/track_api.d.ts.map +1 -0
- package/track_api.js +7 -0
- package/track_api.js.map +1 -0
- package/util/abort.d.ts +1 -0
- package/util/abort.d.ts.map +1 -1
- package/util/abort.js +23 -1
- package/util/abort.js.map +1 -1
- package/util/announce.d.ts +4 -0
- package/util/announce.d.ts.map +1 -0
- package/util/announce.js +11 -0
- package/util/announce.js.map +1 -0
- package/util/bigint.d.ts +3 -0
- package/util/bigint.d.ts.map +1 -0
- package/util/bigint.js +8 -0
- package/util/bigint.js.map +1 -0
- package/util/change.d.ts +12 -0
- package/util/change.d.ts.map +1 -0
- package/util/change.js +18 -0
- package/util/change.js.map +1 -0
- package/util/deadline.d.ts +2 -0
- package/util/deadline.d.ts.map +1 -0
- package/util/deadline.js +108 -0
- package/util/deadline.js.map +1 -0
- package/util/decode_error.d.ts +3 -0
- package/util/decode_error.d.ts.map +1 -0
- package/util/decode_error.js +11 -0
- package/util/decode_error.js.map +1 -0
- package/util/demand.d.ts +8 -0
- package/util/demand.d.ts.map +1 -0
- package/util/demand.js +24 -0
- package/util/demand.js.map +1 -0
- package/util/given_up.d.ts +2 -0
- package/util/given_up.d.ts.map +1 -0
- package/util/given_up.js +101 -0
- package/util/given_up.js.map +1 -0
- package/util/hex.d.ts +6 -0
- package/util/hex.d.ts.map +1 -1
- package/util/hex.js +19 -4
- package/util/hex.js.map +1 -1
- package/util/key.d.ts +15 -0
- package/util/key.d.ts.map +1 -0
- package/util/key.js +38 -0
- package/util/key.js.map +1 -0
- package/util/limits.d.ts +2 -0
- package/util/limits.d.ts.map +1 -0
- package/util/limits.js +76 -0
- package/util/limits.js.map +1 -0
- package/util/observed.d.ts +23 -0
- package/util/observed.d.ts.map +1 -0
- package/util/observed.js +122 -0
- package/util/observed.js.map +1 -0
- package/util/sorted.d.ts +2 -0
- package/util/sorted.d.ts.map +1 -0
- package/util/sorted.js +149 -0
- package/util/sorted.js.map +1 -0
- package/util/timeout.d.ts +2 -1
- package/util/timeout.d.ts.map +1 -1
- package/util/timeout.js +13 -9
- package/util/timeout.js.map +1 -1
- package/util/timer.d.ts +2 -0
- package/util/timer.d.ts.map +1 -0
- package/util/timer.js +19 -0
- package/util/timer.js.map +1 -0
- package/util/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -1
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -1
- package/util/varint.js.map +1 -1
- package/util/watch.d.ts +8 -0
- package/util/watch.d.ts.map +1 -0
- package/util/watch.js +38 -0
- package/util/watch.js.map +1 -0
- package/util/yield.d.ts +2 -0
- package/util/yield.d.ts.map +1 -0
- package/util/yield.js +31 -0
- package/util/yield.js.map +1 -0
- package/varint.d.ts +0 -29
- package/varint.d.ts.map +1 -1
- package/varint.js +7 -28
- package/varint.js.map +1 -1
- package/varint_api.d.ts +7 -0
- package/varint_api.d.ts.map +1 -0
- package/varint_api.js +7 -0
- package/varint_api.js.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +4 -0
- package/version.js.map +1 -0
- package/window.d.ts +570 -0
- package/window.d.ts.map +1 -0
- package/window.js +1677 -0
- package/window.js.map +1 -0
- package/wire.d.ts +145 -30
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -0
- package/wire.js.map +1 -1
- package/connection/established.d.ts +0 -53
- package/connection/established.d.ts.map +0 -1
- package/connection/established.js +0 -2
- package/connection/established.js.map +0 -1
- package/ietf/adapter.d.ts +0 -75
- package/ietf/adapter.d.ts.map +0 -1
- package/ietf/adapter.js +0 -699
- package/ietf/adapter.js.map +0 -1
- package/lite/datagram_stream.d.ts +0 -8
- package/lite/datagram_stream.d.ts.map +0 -1
- package/lite/datagram_stream.js +0 -43
- package/lite/datagram_stream.js.map +0 -1
- package/lite/fetch.d.ts +0 -28
- package/lite/fetch.d.ts.map +0 -1
- package/lite/fetch.js +0 -78
- package/lite/fetch.js.map +0 -1
- package/util/log.d.ts +0 -5
- package/util/log.d.ts.map +0 -1
- package/util/log.js +0 -16
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -18
- package/zod.js.map +0 -1
package/origin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,OAAO,EAA8C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW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IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;QACC,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,aAAa,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;YAChC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YACrB,KAAK,GAAG,CAAC;QACV,CAAC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAA+C;QACrD,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,MAAM,KAAK,GAAG,MAAM,YAAY,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,yEAAyE;IACzE,MAAM,CAAC,GAAU;QAChB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACD","sourcesContent":["/**\n * A broadcast routing table, independent of any connection.\n *\n * Publish broadcasts into an origin and hand the origin to one or more connections to\n * serve them; the broadcasts outlive any single session. Hand the same (or another)\n * origin to a connection's `consume` option and the peer's announced routes appear\n * in the table too: each route covers a path prefix, and a request for a path under\n * it resolves through the session that announced it. Mirrors the `origin` module in\n * `rs/moq-net`.\n *\n * @module\n */\nimport { Derived, type Dispose, type GetPromise, type Getter, getter, Once, Signal } from \"@moq/signals\";\nimport * as announce from \"./announced.ts\";\nimport * as broadcast from \"./broadcast.ts\";\nimport { StreamCode, StreamError } from \"./error.ts\";\nimport { isAnonymous, Route, routesEqual } from \"./hop.ts\";\nimport { hiddenBelow, hooks, scopeCaptures, scopeHead, scopeOverlaps } from \"./internal.ts\";\nimport * as Path from \"./path.ts\";\nimport { type Advertised, type Advertisements, registerWire, wireOf } from \"./wire.ts\";\n\nexport type { Cost, Hop, Route } from \"./hop.ts\";\nexport { isAnonymous } from \"./hop.ts\";\n\n/** The rooted permissions shared by a handle and every route it inserts. */\nclass Scope {\n\tstatic readonly all = new Scope(Path.empty());\n\n\treadonly root: Path.Valid;\n\treadonly allowed?: Path.Patterns;\n\n\tconstructor(root: Path.Valid, allowed?: Path.Patterns) {\n\t\tthis.root = root;\n\t\tthis.allowed = allowed;\n\t}\n\n\tnarrow(root: Path.Valid, patterns: Path.Patterns): Scope {\n\t\tconst joined = Path.encode(Path.join(this.root, root));\n\t\tconst rooted = patterns.rooted(joined);\n\t\tconst allowed = this.allowed?.intersect(rooted) ?? rooted;\n\t\tif (allowed.size === 0) throw new Error(\"origin scopes do not overlap\");\n\t\treturn new Scope(joined, allowed);\n\t}\n\n\tmatches(path: Path.Valid): boolean {\n\t\treturn this.allowed?.matches(path) ?? true;\n\t}\n\n\tpath(path: Path.Valid): Path.Valid {\n\t\tconst joined = Path.encode(Path.join(this.root, path));\n\t\tif (!this.matches(joined)) throw new Error(\"path is outside the origin scope\");\n\t\treturn joined;\n\t}\n\n\tprefix(prefix: Path.Valid): Path.Valid {\n\t\tconst joined = Path.encode(Path.join(this.root, prefix));\n\t\tif (this.allowed && !this.allowed.overlaps(Path.Pattern.subtree(joined))) {\n\t\t\tthrow new Error(\"prefix is outside the origin scope\");\n\t\t}\n\t\treturn joined;\n\t}\n\n\tpatterns(pattern: Path.Pattern = Path.Pattern.all()): Path.Patterns {\n\t\tconst rooted = new Path.Patterns([pattern.rooted(this.root)]);\n\t\treturn this.allowed?.intersect(rooted) ?? rooted;\n\t}\n\n\t/** Omit nested heads because the outer subscription already carries their routes. */\n\theads(): Path.Valid[] {\n\t\tif (!this.allowed) return [Path.empty()];\n\t\tconst heads = [...new Set([...this.allowed.rebase(this.root)].map(scopeHead))].sort();\n\t\treturn heads.filter((head) => !heads.some((other) => other !== head && Path.hasPrefix(other, head)));\n\t}\n\n\t/** The exact paths within this scope, relative to its root. */\n\tprojectPaths<T>(values: ReadonlyMap<Path.Valid, T> | undefined): ReadonlyMap<Path.Valid, T> | undefined {\n\t\tif (!values || this === Scope.all) return values;\n\t\tconst out = new Map<Path.Valid, T>();\n\t\tfor (const [path, value] of values) {\n\t\t\tif (!this.matches(path)) continue;\n\t\t\tconst relative = Path.stripPrefix(this.root, path);\n\t\t\tif (relative !== null) out.set(relative, value);\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t * The advertisements that may serve this scope, relative to its root. Every prefix at or\n\t * above the root presents as the empty path, most specific first, since that is the order\n\t * a request beneath the root resolves in.\n\t */\n\tprojectRoutes(values: Advertisements | undefined): Advertisements | undefined {\n\t\tif (!values || this === Scope.all) return values;\n\t\tconst out = new Map<Path.Valid, readonly Advertised[]>();\n\t\tconst covering: [Path.Valid, Advertised[]][] = [];\n\t\tconst allowed = this.allowed && [...this.allowed];\n\t\tfor (const [path, candidates] of values) {\n\t\t\tconst relative = Path.stripPrefix(this.root, path);\n\t\t\tconst above = relative === null || relative === Path.empty();\n\t\t\tif (above && !Path.hasPrefix(path, this.root)) continue;\n\t\t\tconst visible = candidates\n\t\t\t\t.filter((value) => !allowed || allowed.some((pattern) => advertOverlaps(value, path, pattern)))\n\t\t\t\t// The claim moves with the key, so it compares against root-relative requests.\n\t\t\t\t.map((value) => (value.claim ? { ...value, claim: value.claim.rebase(this.root) } : value));\n\t\t\tif (visible.length === 0) continue;\n\t\t\tif (!above) {\n\t\t\t\tout.set(relative, visible);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Hold the empty path's place in the order until every covering prefix is known.\n\t\t\tif (covering.length === 0) out.set(Path.empty(), []);\n\t\t\tcovering.push([path, visible]);\n\t\t}\n\t\tif (covering.length > 0) {\n\t\t\tcovering.sort(([a], [b]) => b.length - a.length);\n\t\t\tout.set(\n\t\t\t\tPath.empty(),\n\t\t\t\tcovering.flatMap(([, visible]) => visible),\n\t\t\t);\n\t\t}\n\t\treturn out;\n\t}\n}\n\n/** Whether the route advertised at `prefix` may serve any path `pattern` admits. */\nfunction advertOverlaps(advert: Advertised, prefix: Path.Valid, pattern: Path.Pattern): boolean {\n\treturn advert.claim ? advert.claim.overlaps(pattern) : scopeOverlaps(pattern, prefix);\n}\n\n/**\n * Presents advertised prefixes relative to a root. Every prefix at or above the root\n * collapses to the empty path, where the most specific one wins, since that is the route\n * a request beneath the root resolves through.\n */\nclass CoveringRoot {\n\treadonly #root: Path.Valid;\n\t#covering?: Path.Valid;\n\n\tconstructor(root: Path.Valid) {\n\t\tthis.#root = root;\n\t}\n\n\t/** The presented path for `path`, or undefined when it is outside the root or a broader cover. */\n\trelative(path: Path.Valid): Path.Valid | undefined {\n\t\tconst relative = Path.stripPrefix(this.#root, path);\n\t\tif (relative !== null && relative !== Path.empty()) return relative;\n\t\tif (relative === null && !Path.hasPrefix(path, this.#root)) return undefined;\n\t\tif (this.#covering !== undefined && !Path.hasPrefix(this.#covering, path)) return undefined;\n\t\tthis.#covering = path;\n\t\treturn Path.empty();\n\t}\n}\n\n/**\n * One requested path: the notify node for everything watching it.\n *\n * `route` is the only reactive part, and the only thing a {@link Request} subscribes to, so\n * a publish or retraction anywhere else in the table cannot wake it. The origin's tables stay\n * the storage; this is a per-path view onto them, refreshed by whichever mutator touched the\n * path. The alternative, deriving each request over the whole `local`/`remote` maps, wakes\n * every open request on every unrelated change.\n *\n * `answer` outlives a session: the answering session clears it when it dies and the next one\n * answers again, which is what makes a request span reconnects.\n *\n * `handles` holds the `closed` of each open {@link Requesting} on the path.\n *\n * A refusal is terminal. With nothing serving, the slot ends: every handle closes with the\n * handler's error and the slot leaves the table, so the next request asks afresh. While\n * another source still serves (a better route was asked and said no), the refuser joins\n * `refused` and is skipped for as long as it stands (a reconnect is a fresh entry), so the\n * current source carries on. A refusal never falls through to a broader prefix or another\n * advertiser.\n *\n * @internal\n */\nexport interface RequestSlot {\n\tblind: number;\n\tanswer?: broadcast.Consumer;\n\treadonly handles: Set<Once<Error | null>>;\n\treadonly refused: Set<RouteEntry>;\n\treadonly route: Signal<broadcast.Consumer | undefined>;\n}\n\n/**\n * One advertised prefix: hops and cost, plus an optional server that answers\n * requests beneath it.\n *\n * The preferred entry per prefix is the one requests resolve through. An originated\n * entry is forwarded by sessions; a received one is not, so a shared origin\n * cannot echo a peer's announcements back to it.\n *\n * @internal\n */\nexport interface RouteEntry {\n\treadonly identity: object;\n\treadonly scope: Scope;\n\t/** The paths the entry may serve beneath its prefix, when its producer is scoped. */\n\treadonly claim?: Path.Patterns;\n\treadonly route: Signal<Route>;\n\treadonly originated: boolean;\n\treadonly server?: ServeState;\n}\n\n/** One advertisement at a prefix. `exact` marks an announced local broadcast, which is only its own path. */\ninterface Candidate extends Advertised {\n\treadonly exact: boolean;\n}\n\n/** Orders advertisements at one prefix: the better route, then a local broadcast on a tie, then fewer hops. */\nfunction compareCandidates(a: Candidate, b: Candidate): number {\n\treturn (\n\t\tcompareRoutes(a.route, b.route) ||\n\t\tNumber(b.exact) - Number(a.exact) ||\n\t\ta.route.hops.length - b.route.hops.length\n\t);\n}\n\n/** Orders two routes by preference: identified before anonymous, then lower warm cost, then lower cold cost. */\nfunction compareRoutes(a: Route, b: Route): number {\n\tconst anonymous = Number(isAnonymous(a)) - Number(isAnonymous(b));\n\tif (anonymous !== 0) return anonymous;\n\tif (a.cost.warm !== b.cost.warm) return a.cost.warm < b.cost.warm ? -1 : 1;\n\tif (a.cost.cold !== b.cost.cold) return a.cost.cold < b.cost.cold ? -1 : 1;\n\treturn 0;\n}\n\n/** The preferred of `entries` (newest first) not skipped: the best route, then fewest hops, then newest. */\nfunction preferredEntry(entries: readonly RouteEntry[], skip?: (entry: RouteEntry) => boolean): RouteEntry | undefined {\n\tlet best: RouteEntry | undefined;\n\tfor (const entry of entries) {\n\t\tif (skip?.(entry)) continue;\n\t\tif (!best) {\n\t\t\tbest = entry;\n\t\t\tcontinue;\n\t\t}\n\t\tconst a = entry.route.peek();\n\t\tconst b = best.route.peek();\n\t\tconst order = compareRoutes(a, b) || a.hops.length - b.hops.length;\n\t\tif (order < 0) best = entry;\n\t}\n\treturn best;\n}\n\n/** Whether a session received `entry`, so it is never forwarded to a peer. */\nfunction received(entry: RouteEntry): boolean {\n\treturn !entry.originated;\n}\n\nfunction noCapacity(): StreamError {\n\treturn new StreamError(StreamCode.NoCapacity, { message: \"no capacity\" });\n}\n\n/** A served route from {@link Producer.dynamic}: the queue a handler drains. */\nclass ServeState {\n\treadonly root: Path.Valid;\n\n\tconstructor(root: Path.Valid) {\n\t\tthis.root = root;\n\t}\n\n\tqueue = new Signal<Request[]>([]);\n\tpending = new Map<Path.Valid, Request>();\n\tserved = new Map<Path.Valid, broadcast.Consumer>();\n\trejected = new Map<Path.Valid, Error>();\n\t// demand() is the only reader of `rejected`. A Consumer.request refusal never\n\t// re-enqueues, so storing the error without a waiter would pin every unique\n\t// path until the route dies.\n\tdemanding = new Map<Path.Valid, number>();\n\tclosed = new Once<Error | null>();\n\tsettled = new Signal(0);\n\tonChange: (path: Path.Valid) => void = () => {};\n\tonReject: (path: Path.Valid, err: Error) => void = () => {};\n\n\tenqueue(path: Path.Valid): void {\n\t\tif (this.closed.peek() !== undefined) return;\n\t\tthis.rejected.delete(path);\n\t\tif (this.pending.has(path)) return;\n\t\tconst live = this.served.get(path);\n\t\tif (live && live.closed.peek() === undefined) return;\n\t\tconst request = makeRequest(Path.stripPrefix(this.root, path) ?? Path.empty(), this);\n\t\tthis.pending.set(path, request);\n\t\tthis.queue.mutate((queue) => {\n\t\t\tqueue.push(request);\n\t\t});\n\t}\n\n\taccept(request: Request, front: broadcast.Consumer): void {\n\t\tconst path = Path.join(this.root, request.path);\n\t\tif (this.closed.peek() !== undefined || this.pending.get(path) !== request) {\n\t\t\tfront.close();\n\t\t\treturn;\n\t\t}\n\t\tthis.pending.delete(path);\n\t\tconst existing = this.served.get(path);\n\t\tif (existing && existing.closed.peek() === undefined) {\n\t\t\tfront.close();\n\t\t\tthis.onChange(path);\n\t\t\tthis.settled.update((n) => n + 1);\n\t\t\treturn;\n\t\t}\n\t\tthis.served.set(path, front);\n\t\tvoid front.closed.then(() => {\n\t\t\tif (this.served.get(path) !== front) return;\n\t\t\tthis.served.delete(path);\n\t\t\tthis.onChange(path);\n\t\t});\n\t\tthis.onChange(path);\n\t\tthis.settled.update((n) => n + 1);\n\t}\n\n\treject(request: Request, err: Error): void {\n\t\tconst path = Path.join(this.root, request.path);\n\t\tif (this.pending.get(path) !== request) return;\n\t\tthis.pending.delete(path);\n\t\tif (this.demanding.has(path)) this.rejected.set(path, err);\n\t\tthis.onReject(path, err);\n\t\tthis.settled.update((n) => n + 1);\n\t}\n\n\tclose(abort?: Error): void {\n\t\tif (this.closed.peek() !== undefined) return;\n\t\tconst err = abort ?? noCapacity();\n\t\tthis.closed.set(err);\n\t\tconst queued = [...this.pending.values()];\n\t\tthis.pending.clear();\n\t\tthis.queue.mutate((queue) => {\n\t\t\tqueue.length = 0;\n\t\t});\n\t\tfor (const request of queued) {\n\t\t\tfinishRequest(request, err);\n\t\t}\n\t\tfor (const [path, front] of this.served) {\n\t\t\tfront.close();\n\t\t\tthis.onChange(path);\n\t\t}\n\t\tthis.served.clear();\n\t\tthis.rejected.clear();\n\t\tthis.demanding.clear();\n\t\tthis.settled.update((n) => n + 1);\n\t}\n}\n\ninterface Presented extends Advertised {\n\treadonly captures: Path.Pattern[] | undefined;\n}\n\n/** A table mutation invalidates the shared route snapshot before its async notification. */\nclass VersionedSignal<T> extends Signal<T> {\n\tversion = 0;\n\n\toverride set(value: T, notify?: boolean): void {\n\t\tthis.version++;\n\t\tsuper.set(value, notify);\n\t}\n}\n\n/** Reactive backing state shared by origin producers and consumers. */\nclass OriginState {\n\t// Both tables decouple the application producing into the origin from the\n\t// connections serving or feeding it. Undefined once the origin closes, so late\n\t// writes fail loudly.\n\t//\n\t// Created is what this endpoint publishes, keyed by exact path, announced or not.\n\t// Local is the announced subset, with its route in advertisedLocal: a broadcast\n\t// exists for nobody, here or at a peer, until it announces. Routes is the\n\t// advertisement table: prefixes a dynamic handle or a received session covers,\n\t// newest first. Local and routes stay separate so a session can never announce a\n\t// received entry back to a peer, which is what makes an origin shared by both\n\t// directions echo-free.\n\tcreated: Map<Path.Valid, broadcast.Consumer> | undefined = new Map();\n\tlocal = new VersionedSignal<Map<Path.Valid, broadcast.Consumer> | undefined>(new Map());\n\tadvertisedLocal = new VersionedSignal<Map<Path.Valid, Route> | undefined>(new Map());\n\troutes = new VersionedSignal<Map<Path.Valid, RouteEntry[]> | undefined>(new Map());\n\n\t#snapshotVersion = \"\";\n\t#snapshot: {\n\t\tcandidates: ReadonlyMap<Path.Valid, readonly Candidate[]>;\n\t\troutes: ReadonlyMap<Path.Valid, Route>;\n\t\tvisible: ReadonlyMap<Path.Valid, Route>;\n\t} = { candidates: new Map(), routes: new Map(), visible: new Map() };\n\n\t/** The full route table is built once per mutation, regardless of observer count. */\n\tavailable = new Derived([this.local, this.advertisedLocal, this.routes], () => this.snapshot().routes);\n\t/** {@link available} without hidden routes, for unscoped readers that did not opt in. */\n\tvisible = new Derived([this.local, this.advertisedLocal, this.routes], () => this.snapshot().visible);\n\n\tsnapshot(): {\n\t\tcandidates: ReadonlyMap<Path.Valid, readonly Candidate[]>;\n\t\troutes: ReadonlyMap<Path.Valid, Route>;\n\t\tvisible: ReadonlyMap<Path.Valid, Route>;\n\t} {\n\t\tconst version = `${this.local.version}/${this.advertisedLocal.version}/${this.routes.version}`;\n\t\tif (version === this.#snapshotVersion) return this.#snapshot;\n\t\tconst candidates = this.candidates();\n\t\tconst available = new Map<Path.Valid, Route>();\n\t\tconst visible = new Map<Path.Valid, Route>();\n\t\tfor (const [path, [best]] of candidates) {\n\t\t\tavailable.set(path, best.route);\n\t\t\tif (!hiddenBelow(Path.empty(), path)) visible.set(path, best.route);\n\t\t}\n\t\tthis.#snapshot = { candidates, routes: available, visible };\n\t\tthis.#snapshotVersion = version;\n\t\treturn this.#snapshot;\n\t}\n\n\t/**\n\t * Every advertisement per prefix, most preferred first, without the `skip`ped entries.\n\t * Readers select after filtering by their scope, so a cheaper route they cannot see\n\t * never hides one they can.\n\t */\n\tcandidates(skip?: (entry: RouteEntry) => boolean): Map<Path.Valid, Candidate[]> {\n\t\tconst out = new Map<Path.Valid, Candidate[]>();\n\t\tfor (const [path, entries] of this.routes.peek() ?? []) {\n\t\t\tconst list: Candidate[] = [];\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (skip?.(entry)) continue;\n\t\t\t\tlist.push({ identity: entry.identity, route: entry.route.peek(), claim: entry.claim, exact: false });\n\t\t\t}\n\t\t\tif (list.length > 0) out.set(path, list);\n\t\t}\n\t\tconst advertised = this.advertisedLocal.peek();\n\t\tfor (const [path, front] of this.local.peek() ?? []) {\n\t\t\tconst local = { identity: front, route: advertised?.get(path) ?? Route.default, exact: true };\n\t\t\tconst list = out.get(path);\n\t\t\tif (list) list.push(local);\n\t\t\telse out.set(path, [local]);\n\t\t}\n\t\tfor (const list of out.values()) {\n\t\t\t// Stable, so equal routes keep the table's newest-first order.\n\t\t\tif (list.length > 1) list.sort(compareCandidates);\n\t\t}\n\t\treturn out;\n\t}\n\n\t// Originated advertisements sessions should forward: exact-path announces plus\n\t// originated dynamics. Identity is the local front or the route entry, so a\n\t// republish diffs as retract-then-announce and a re-price as another active.\n\toriginated = new Signal<Advertisements | undefined>(new Map());\n\n\t// Broadcasts materialized from a served route, keyed by exact path. Shared by every\n\t// request for the path so repeats reuse one accept; dropped (and closed) when the\n\t// providing route goes away or the last request releases it.\n\tmaterialized = new Map<Path.Valid, { entry: RouteEntry; front: broadcast.Consumer }>();\n\n\t// Paths consumers asked for without waiting for an announcement; attached sessions\n\t// answer them with blind subscriptions. Never announced: an answered request is assumed\n\t// present, not known live, so it must not read as an availability claim.\n\trequests = new Signal<Map<Path.Valid, RequestSlot> | undefined>(new Map());\n\n\t// How many sessions are attached, and how many of those support broadcast discovery.\n\t// What backs the public `discovery` getter.\n\tsessions = new Signal({ total: 0, discovery: 0 });\n\n\t// How many things are prepared to answer a request: attached sessions, plus reconnecting\n\t// connections that have no session right now but will. Zero means an unrouted path is\n\t// unroutable rather than merely unanswered, which is the whole difference between \"wait,\n\t// this is coming\" and \"nothing here can ever serve you\".\n\tanswerers = new Signal(0);\n\n\tclosed = new Once<Error | null>();\n\n\t/**\n\t * Recompute what `path` resolves to, waking only the requests watching that path.\n\t *\n\t * A no-op for a path nobody requested, so the common case (publishing into a table\n\t * nobody is asking about) costs a map lookup. Call after any write that could change\n\t * the answer for a single path.\n\t */\n\trefresh(path: Path.Valid): void {\n\t\tconst slot = this.requests.peek()?.get(path);\n\t\tif (!slot) return;\n\t\tslot.route.set(this.route(path, slot));\n\t}\n\n\t/**\n\t * `entry` refused `path` with `err`. A request still serving another source skips the\n\t * refuser; one with nothing serving ends with `err`.\n\t */\n\trefuse(path: Path.Valid, entry: RouteEntry, err: Error): void {\n\t\tconst slot = this.requests.peek()?.get(path);\n\t\tif (!slot) return;\n\t\t// Only the route the request is waiting on speaks for it; a superseded one's answer is moot.\n\t\tif (this.bestEntry(path, (candidate) => slot.refused.has(candidate)) !== entry) return;\n\n\t\tconst serving = slot.route.peek();\n\t\tif (serving && serving.closed.peek() === undefined) {\n\t\t\tslot.refused.add(entry);\n\t\t\tslot.route.set(this.route(path, slot));\n\t\t\treturn;\n\t\t}\n\n\t\tthis.requests.mutate((map) => {\n\t\t\tif (map?.get(path) === slot) map.delete(path);\n\t\t});\n\t\tslot.answer?.close();\n\t\tslot.answer = undefined;\n\t\tslot.route.set(undefined);\n\t\tthis.releaseMaterialized(path);\n\t\tfor (const closed of slot.handles) closed.set(err);\n\t\tslot.handles.clear();\n\t}\n\n\t/**\n\t * Recompute every open request covered by `prefix`, after a route was inserted or\n\t * removed there: a route covers many paths, so a single-path refresh is not enough.\n\t * Every materialized broadcast belongs to an open request, so rerouting them also\n\t * releases a retracted route's session subscription even when nothing reads it again.\n\t */\n\trefreshPrefix(prefix: Path.Valid): void {\n\t\tfor (const [path, slot] of this.requests.peek() ?? []) {\n\t\t\tif (Path.hasPrefix(prefix, path)) slot.route.set(this.route(path, slot));\n\t\t}\n\t}\n\n\t/** Rebuild the publisher-facing originated table after an advertisement write. */\n\trebuildOriginated(): void {\n\t\tif (!this.local.peek() && !this.advertisedLocal.peek() && !this.routes.peek()) {\n\t\t\tthis.originated.set(undefined);\n\t\t\treturn;\n\t\t}\n\t\t// A local broadcast and an originated dynamic at one path compete on cost, as they do for requests.\n\t\tthis.originated.set(this.candidates(received));\n\t}\n\n\t/**\n\t * Release the materialized broadcast for `path`, once its last request is gone: the\n\t * cache exists to share one session subscription between requests, not to outlive\n\t * them.\n\t */\n\treleaseMaterialized(path: Path.Valid): void {\n\t\tconst cached = this.materialized.get(path);\n\t\tif (!cached) return;\n\t\tthis.materialized.delete(path);\n\t\tcached.front.close();\n\t}\n\n\t/** The preferred entry on the most specific route covering `path`, ignoring skipped entries, if any. */\n\tbestEntry(path: Path.Valid, skip?: (entry: RouteEntry) => boolean): RouteEntry | undefined {\n\t\tlet bestPrefix: Path.Valid | undefined;\n\t\tlet best: RouteEntry | undefined;\n\t\tfor (const [prefix, entries] of this.routes.peek() ?? []) {\n\t\t\tif (!Path.hasPrefix(prefix, path)) continue;\n\t\t\tconst entry = preferredEntry(\n\t\t\t\tentries,\n\t\t\t\t(candidate) => !candidate.scope.matches(path) || (skip?.(candidate) ?? false),\n\t\t\t);\n\t\t\tif (!entry) continue;\n\t\t\tif (bestPrefix === undefined || prefix.length > bestPrefix.length) {\n\t\t\t\tbestPrefix = prefix;\n\t\t\t\tbest = entry;\n\t\t\t}\n\t\t}\n\t\treturn best;\n\t}\n\n\t/**\n\t * Whether the announced local broadcast at `path` wins over `entry`, the best route a\n\t * session or dynamic handle announced there. Cost decides, as for any two routes: an\n\t * identified route strictly cheaper than the local one wins, and the local broadcast\n\t * wins a tie. A route at a shorter prefix never competes, since the most specific\n\t * prefix wins outright. False when nothing is announced locally at `path`.\n\t */\n\tlocalWins(path: Path.Valid, entry: RouteEntry | undefined): boolean {\n\t\tconst local = this.advertisedLocal.peek()?.get(path);\n\t\tif (!local || !this.local.peek()?.has(path)) return false;\n\t\tif (!entry || !this.routes.peek()?.get(path)?.includes(entry)) return true;\n\t\treturn compareRoutes(local, entry.route.peek()) <= 0;\n\t}\n\n\t/**\n\t * What `path` resolves to: an announced local publish, a broadcast materialized from\n\t * the best covering route, or the blind answer.\n\t *\n\t * Materialization is lazy and cached per path: the first request under a route opens\n\t * the providing session's subscription and repeats share it. A better route is made\n\t * before the old one breaks: the current front keeps serving until the new route\n\t * answers (then swaps) or refuses (then is skipped). A retracted route swaps at once.\n\t */\n\troute(path: Path.Valid, slot: Pick<RequestSlot, \"answer\" | \"refused\">): broadcast.Consumer | undefined {\n\t\tconst entry = this.bestEntry(path, (candidate) => slot.refused.has(candidate));\n\t\tconst local = this.local.peek()?.get(path);\n\t\tif (local && this.localWins(path, entry)) {\n\t\t\t// Nothing reads a remote front the local broadcast replaced, so close its session subscription.\n\t\t\tthis.releaseMaterialized(path);\n\t\t\treturn local;\n\t\t}\n\n\t\tlet cached = this.materialized.get(path);\n\t\tif (cached && cached.front.closed.peek() !== undefined) {\n\t\t\tthis.materialized.delete(path);\n\t\t\tcached = undefined;\n\t\t}\n\t\tif (cached && cached.entry === entry) return cached.front;\n\t\tif (!entry?.server) {\n\t\t\tthis.releaseMaterialized(path);\n\t\t\treturn slot.answer;\n\t\t}\n\n\t\tconst served = entry.server.served.get(path);\n\t\tif (served && served.closed.peek() === undefined) {\n\t\t\tcached?.front.close();\n\t\t\tthis.materialized.set(path, { entry, front: served });\n\t\t\treturn served;\n\t\t}\n\n\t\tentry.server.enqueue(path);\n\t\treturn cached?.front;\n\t}\n}\n\n/**\n * A non-owning handle on an origin: publish into it and read it, without its lifecycle.\n *\n * What a shared connection lends out. {@link Producer} implements it, so code that is\n * handed an origin rather than owning one should accept this type: closing the origin\n * stays the owner's alone, and a borrower cannot express it.\n *\n * @public\n */\nexport interface Table {\n\t/** Settles once the origin closes; see {@link Producer.closed}. */\n\treadonly closed: GetPromise<Error | null>;\n\n\t/** Whether every attached session announces into the table; see {@link Consumer.discovery}. */\n\treadonly discovery: Getter<boolean | undefined>;\n\n\t/** Create an unannounced broadcast at `path`; see {@link Producer.createBroadcast}. */\n\tcreateBroadcast(path: Path.Valid): broadcast.Producer;\n\n\t/** Resolve `path`, optionally waiting for an announcement; see {@link Consumer.request}. */\n\trequest(path: Path.Valid, options?: RequestOptions): Requesting;\n\n\t/** The available announcements under `scope`, as a live map; see {@link Consumer.broadcasts}. */\n\tbroadcasts(scope?: Path.Pattern, options?: announce.Options): Getter<ReadonlyMap<Path.Valid, Route>>;\n\n\t/** The available broadcasts under `scope`, as a live stream; see {@link Consumer.announced}. */\n\tannounced(scope?: Path.Pattern, options?: announce.Options): announce.Consumer;\n\n\t/** Advertise a prefix and serve requests under it; see {@link Producer.dynamic}. */\n\tdynamic(prefix: Path.Valid, route?: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint }): Dynamic;\n}\n\n/** Options for resolving a broadcast path. */\nexport interface RequestOptions {\n\t/** Wait for a routed announcement when discovery is supported; otherwise subscribe blindly. */\n\tannounced?: boolean;\n}\n\n/**\n * The write side of an origin: create broadcasts by path and advertise them.\n *\n * Independent of any connection. A connection given this origin (via its `publish` option)\n * announces and serves the table's originated advertisements for as long as the session\n * lasts; the broadcasts themselves live until their producer closes or {@link close} tears\n * the origin down. A reconnecting session re-announces the table on each attach, so\n * advertisements made while offline surface on the next connection.\n *\n * Create, attach {@link dynamic} for tracks served on demand, populate, then\n * {@link broadcast.Producer.announce}: an exact-path subscribe before the tracks exist is\n * refused, and nobody can see or reach a broadcast until it announces.\n *\n * @public\n */\nexport class Producer implements Table {\n\t#state = new OriginState();\n\t#scope = Scope.all;\n\t#requests?: Getter<ReadonlyMap<Path.Valid, RequestSlot> | undefined>;\n\n\t// The reader backing the passthroughs, so holding a Producer never requires the\n\t// consume().x() stutter for everyday reads. One instance, so `discovery` keeps its\n\t// identity across reads.\n\t#reader = makeConsumer(this.#state, this.#scope);\n\n\tconstructor() {\n\t\tconst thisProducer = this;\n\t\tregisterWire(this, {\n\t\t\treceive: (prefix, route) => this.#receive(prefix, route),\n\t\t\tinterests: () => this.#scope.heads(),\n\t\t\taccepts: (prefix) =>\n\t\t\t\t!this.#scope.allowed ||\n\t\t\t\tthis.#scope.allowed.overlaps(Path.Pattern.subtree(Path.join(this.#scope.root, prefix))),\n\t\t\tattach: (discovery) => this.#attach(discovery),\n\t\t\texpect: () => this.#expect(),\n\t\t\tget requests() {\n\t\t\t\tif (thisProducer.#scope === Scope.all) return thisProducer.#state.requests;\n\t\t\t\tthisProducer.#requests ??= new Derived([thisProducer.#state.requests], (requests) =>\n\t\t\t\t\tthisProducer.#scope.projectPaths(requests),\n\t\t\t\t);\n\t\t\t\treturn thisProducer.#requests;\n\t\t\t},\n\t\t\tchanged: () => this.#changed(),\n\t\t\tanswer: (path, front) => this.#answer(this.#scope.path(path), front),\n\t\t\troutes: (path) => wireOf(this.#reader).routes(path),\n\t\t});\n\t}\n\n\t/** Narrow this handle to patterns beneath root, presenting paths relative to that root. */\n\tscope(root: Path.Valid, patterns: Path.Patterns): Producer {\n\t\tconst scope = this.#scope.narrow(root, patterns);\n\t\tconst producer = new Producer();\n\t\tproducer.#state = this.#state;\n\t\tproducer.#scope = scope;\n\t\tproducer.#reader = makeConsumer(this.#state, scope);\n\t\treturn producer;\n\t}\n\n\t/**\n\t * Settles once the origin closes: `null` on a clean close, or the abort {@link Error}.\n\t * Peek it synchronously (`undefined` while open), observe it reactively, or `await` it.\n\t */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#state.closed;\n\t}\n\n\t/**\n\t * Create a broadcast at `path`, returning its producer.\n\t *\n\t * The broadcast exists for nobody until {@link broadcast.Producer.announce}: announce\n\t * streams skip it and requests for its path find nothing, on this origin exactly as at\n\t * a peer. Announce once its tracks exist; {@link broadcast.Producer.unannounce}\n\t * withdraws it from everyone again.\n\t *\n\t * Close the producer to drop it. Creating a path again supersedes the previous\n\t * broadcast: the origin drops its handle on the old one, which closes it unless the\n\t * application still holds a consumer clone. An announced local broadcast competes with\n\t * a remote route at the same path on cost, winning ties.\n\t */\n\tcreateBroadcast(path: Path.Valid): broadcast.Producer {\n\t\tpath = this.#scope.path(path);\n\t\tconst created = this.#state.created;\n\t\tif (!created) throw new Error(\"origin is closed\");\n\n\t\tconst producer = new broadcast.Producer();\n\t\thooks.stampPath(producer, path);\n\t\tconst front = producer.consume();\n\n\t\thooks.attachAnnouncer(producer, {\n\t\t\tannounce: (route) => this.#advertiseExact(path, front, route),\n\t\t\tunannounce: () => this.#retractExact(path, front),\n\t\t});\n\n\t\tconst previous = created.get(path);\n\t\tcreated.set(path, front);\n\t\tif (previous) {\n\t\t\tthis.#retractExact(path, previous);\n\t\t\tprevious.close();\n\t\t}\n\n\t\t// Drop it when the broadcast closes, unless a recreate already replaced it: a\n\t\t// stale broadcast closing must not unpublish the live one.\n\t\tvoid front.closed.then(() => {\n\t\t\tthis.#retractExact(path, front);\n\t\t\tif (this.#state.created?.get(path) === front) this.#state.created.delete(path);\n\t\t});\n\n\t\treturn producer;\n\t}\n\n\t#advertiseExact(path: Path.Valid, front: broadcast.Consumer, route: Route): void {\n\t\tif (!this.#state.local.peek()) throw new Error(\"origin is closed\");\n\t\tif (this.#state.created?.get(path) !== front) throw new Error(\"broadcast is closed\");\n\t\t// Both maps move together, so every reader sees the broadcast and its route at once.\n\t\tthis.#state.local.mutate((broadcasts) => {\n\t\t\tbroadcasts?.set(path, front);\n\t\t});\n\t\tthis.#state.advertisedLocal.mutate((advertised) => {\n\t\t\tadvertised?.set(path, route);\n\t\t});\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refresh(path);\n\t}\n\n\t#retractExact(path: Path.Valid, front: broadcast.Consumer): void {\n\t\tif (this.#state.local.peek()?.get(path) !== front) return;\n\t\tthis.#state.local.mutate((broadcasts) => {\n\t\t\tbroadcasts?.delete(path);\n\t\t});\n\t\tthis.#state.advertisedLocal.mutate((advertised) => {\n\t\t\tadvertised?.delete(path);\n\t\t});\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refresh(path);\n\t}\n\n\t/**\n\t * Advertise `prefix` and serve the requests beneath it.\n\t *\n\t * A route is always a prefix: it claims `prefix` and every path beneath it (the\n\t * empty prefix claims every path). A service that only serves some of them\n\t * advertises the covering prefix and rejects the rest as they are requested;\n\t * consumers narrow with a {@link Path.Pattern} locally. The advertisement is\n\t * visible to {@link Consumer.announced} and forwarded by sessions for as long as\n\t * the returned {@link Dynamic} lives. A consumer resolving a path under it that\n\t * no announced local broadcast wins is handed to the handle as a {@link Request}.\n\t */\n\tdynamic(\n\t\tprefix: Path.Valid,\n\t\troute: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint } = Route.default,\n\t): Dynamic {\n\t\treturn this.#insertRoute(prefix, Route.normalize(route), true);\n\t}\n\n\t/**\n\t * Land a route a peer announced, served through the returned handle. Same as\n\t * {@link dynamic} but not originated, so a session never announces it back.\n\t *\n\t * @internal\n\t */\n\t#receive(\n\t\tprefix: Path.Valid,\n\t\troute: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint } = Route.default,\n\t): Dynamic {\n\t\treturn this.#insertRoute(prefix, Route.normalize(route), false);\n\t}\n\n\t#insertRoute(prefix: Path.Valid, route: Route, originated: boolean): Dynamic {\n\t\tprefix = this.#scope.prefix(prefix);\n\t\tconst server = new ServeState(this.#scope.root);\n\t\tserver.onChange = (path) => this.#state.refresh(path);\n\t\tconst entry: RouteEntry = {\n\t\t\tidentity: {},\n\t\t\tscope: this.#scope,\n\t\t\tclaim: this.#scope.allowed?.intersect(new Path.Patterns([Path.Pattern.subtree(prefix)])),\n\t\t\troute: new Signal(route),\n\t\t\toriginated,\n\t\t\tserver,\n\t\t};\n\t\tserver.onReject = (path, err) => this.#state.refuse(path, entry, err);\n\n\t\tlet closed = false;\n\t\tthis.#state.routes.mutate((routes) => {\n\t\t\tif (!routes) {\n\t\t\t\tclosed = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst entries = routes.get(prefix);\n\t\t\tif (entries) entries.unshift(entry);\n\t\t\telse routes.set(prefix, [entry]);\n\t\t});\n\t\tif (closed) {\n\t\t\tserver.close();\n\t\t\treturn makeDynamic(prefix, entry, this.#state, () => {});\n\t\t}\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refreshPrefix(prefix);\n\n\t\tconst retract = () => {\n\t\t\tthis.#state.routes.mutate((routes) => {\n\t\t\t\tconst entries = routes?.get(prefix);\n\t\t\t\tif (!entries) return;\n\t\t\t\tconst index = entries.indexOf(entry);\n\t\t\t\tif (index < 0) return;\n\t\t\t\tentries.splice(index, 1);\n\t\t\t\tif (entries.length === 0) routes?.delete(prefix);\n\t\t\t});\n\t\t\t// A retracted entry can never be picked again, so the refusals pinned to it are dead weight.\n\t\t\tfor (const slot of this.#state.requests.peek()?.values() ?? []) slot.refused.delete(entry);\n\t\t\tserver.close();\n\t\t\tthis.#state.rebuildOriginated();\n\t\t\tthis.#state.refreshPrefix(prefix);\n\t\t};\n\n\t\treturn makeDynamic(prefix, entry, this.#state, retract);\n\t}\n\n\t/**\n\t * Register an attached session, counting it toward the `discovery` state. Returns the\n\t * detach; call it exactly once when the session dies.\n\t *\n\t * @internal\n\t */\n\t#attach(discovery: boolean): Dispose {\n\t\tthis.#sessions(1, discovery);\n\t\tconst release = this.#expect();\n\t\tlet detached = false;\n\t\treturn () => {\n\t\t\tif (detached) return;\n\t\t\tdetached = true;\n\t\t\tthis.#sessions(-1, discovery);\n\t\t\trelease();\n\t\t};\n\t}\n\n\t#sessions(delta: number, discovery: boolean): void {\n\t\tthis.#state.sessions.update(({ total, discovery: d }) => ({\n\t\t\ttotal: total + delta,\n\t\t\tdiscovery: d + (discovery ? delta : 0),\n\t\t}));\n\t}\n\n\t/**\n\t * Declare that something will answer requests on this origin, even with no session\n\t * attached right now.\n\t *\n\t * A reconnecting connection holds one for its whole life, so a request made during a\n\t * reconnect (or before the first session establishes) stays pending instead of reading as\n\t * unroutable. Without it, {@link Request.unroutable} would fire on every page load, in the\n\t * window between wiring the origin up and the handshake completing. Call the returned\n\t * dispose when the connection is done for good.\n\t *\n\t * @internal\n\t */\n\t#expect(): Dispose {\n\t\tthis.#state.answerers.update((count) => count + 1);\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\t// Clamped because closing the origin zeroes the count, and the sessions attached at\n\t\t\t// the time still release afterwards.\n\t\t\tthis.#state.answerers.update((count) => Math.max(0, count - 1));\n\t\t};\n\t}\n\n\t/**\n\t * Resolves once anything a serving session scans changes: the open requests, or either\n\t * side of the routing table.\n\t *\n\t * @internal\n\t */\n\t#changed(): Promise<unknown> {\n\t\treturn Signal.race(this.#state.requests, this.#state.local, this.#state.routes, this.#state.advertisedLocal);\n\t}\n\n\t/**\n\t * Provide `front` as the answer for the open request on `path`, taking ownership of it.\n\t *\n\t * Returns undefined (releasing the front) when the request is gone or already answered;\n\t * first session in wins, and a loser must stay eligible to answer later. The returned\n\t * withdraw releases the front and, if it was the standing answer, vacates the slot and\n\t * wakes the other serving loops so a standby session answers immediately; call it when\n\t * the session dies.\n\t *\n\t * @internal\n\t */\n\t#answer(path: Path.Valid, front: broadcast.Consumer): Dispose | undefined {\n\t\tconst slot = this.#state.requests.peek()?.get(path);\n\t\tif (!slot || slot.answer !== undefined) {\n\t\t\tfront.close();\n\t\t\treturn undefined;\n\t\t}\n\t\tslot.answer = front;\n\t\tthis.#state.refresh(path);\n\n\t\treturn () => {\n\t\t\tif (slot.answer === front) {\n\t\t\t\tslot.answer = undefined;\n\t\t\t\tthis.#state.refresh(path);\n\t\t\t\t// The route signal only reaches this path's requesters; poke the map so every\n\t\t\t\t// serving loop re-scans and one of them re-answers.\n\t\t\t\tthis.#state.requests.mutate(() => {});\n\t\t\t}\n\t\t\tfront.close();\n\t\t};\n\t}\n\n\t/** A read handle for this origin, the side a connection's `publish` option borrows. */\n\tconsume(): Consumer {\n\t\treturn makeConsumer(this.#state, this.#scope);\n\t}\n\n\t/** Whether every attached session announces into the table; see {@link Consumer.discovery}. */\n\tget discovery(): Getter<boolean | undefined> {\n\t\treturn this.#reader.discovery;\n\t}\n\n\t/** Resolve `path`, optionally waiting for an announcement; see {@link Consumer.request}. */\n\trequest(path: Path.Valid, options?: RequestOptions): Requesting {\n\t\treturn this.#reader.request(path, options);\n\t}\n\n\t/** The available announcements under `scope`, as a live map; see {@link Consumer.broadcasts}. */\n\tbroadcasts(scope?: Path.Pattern, options?: announce.Options): Getter<ReadonlyMap<Path.Valid, Route>> {\n\t\treturn this.#reader.broadcasts(scope, options);\n\t}\n\n\t/** The available broadcasts under `scope`, as a live stream; see {@link Consumer.announced}. */\n\tannounced(scope?: Path.Pattern, options?: announce.Options): announce.Consumer {\n\t\treturn this.#reader.announced(scope, options);\n\t}\n\n\t/** Close the origin, every broadcast it still routes, and its announcement streams. Idempotent. */\n\tclose(abort?: Error) {\n\t\tif (this.#state.closed.peek() !== undefined) return;\n\t\tthis.#state.closed.set(abort ?? null);\n\t\tfor (const front of this.#state.created?.values() ?? []) {\n\t\t\tfront.close();\n\t\t}\n\t\tthis.#state.created = undefined;\n\t\tthis.#state.local.update(() => undefined);\n\t\tthis.#state.advertisedLocal.update(() => undefined);\n\t\tthis.#state.routes.update((routes) => {\n\t\t\tfor (const entries of routes?.values() ?? []) {\n\t\t\t\tfor (const entry of entries) entry.server?.close(abort);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t\tthis.#state.originated.update(() => undefined);\n\t\t// Materialized broadcasts are handles we opened; release them.\n\t\tfor (const cached of this.#state.materialized.values()) {\n\t\t\tcached.front.close();\n\t\t}\n\t\tthis.#state.materialized.clear();\n\t\t// Nothing will answer a request on a closed origin, whatever is still attached, so\n\t\t// existing requests report unroutable rather than waiting on a corpse.\n\t\tthis.#state.answerers.set(0);\n\t\tthis.#state.requests.update((requests) => {\n\t\t\tfor (const slot of requests?.values() ?? []) {\n\t\t\t\tslot.answer?.close();\n\t\t\t\tslot.answer = undefined;\n\t\t\t\tslot.route.set(undefined);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t}\n}\n\n// Constructs a Consumer from within this module without exposing a public constructor\n// that would leak the unexported OriginState. Assigned in the class's static block.\nlet makeConsumer: (state: OriginState, scope: Scope) => Consumer;\n\n// Same for Requesting: a public constructor would let a caller forge a handle that no origin\n// ever registered, whose lifecycle guarantees are then false. `@internal` alone would not\n// stop it, since the declaration emit keeps the constructor.\nlet makeRequesting: (\n\tpath: Path.Valid,\n\tactive: Getter<broadcast.Consumer | undefined>,\n\tunroutable: Getter<boolean>,\n\tclosed: Once<Error | null>,\n\tdispose: Dispose,\n) => Requesting;\n\nlet makeDynamic: (prefix: Path.Valid, entry: RouteEntry, state: OriginState, retract: Dispose) => Dynamic;\n\nlet makeRequest: (path: Path.Valid, server: ServeState) => Request;\nlet finishRequest: (request: Request, err: Error) => void;\n\n/**\n * An open request for a path nothing announced; see {@link Consumer.request}.\n *\n * @public\n */\nexport class Requesting {\n\t/** The requested path. */\n\treadonly path: Path.Valid;\n\n\t/**\n\t * The resolved broadcast, or undefined while nothing provides the path.\n\t *\n\t * The table's route when it has one: a local publish (no round trip) or an announced\n\t * broadcast, swapping when a republish takes the path. Otherwise a session's blind\n\t * answer, which is assumed present rather than known live: a missing broadcast\n\t * surfaces as a reset on the first track subscription, not here. Drops back to\n\t * undefined when the providing route dies and resolves again when another appears.\n\t *\n\t * Yours for as long as the request is open: it is a handle of this request's own, so\n\t * closing it ends your view of the path rather than the route everyone else reads.\n\t * {@link close} releases whatever is current.\n\t */\n\treadonly active: Getter<broadcast.Consumer | undefined>;\n\n\t/**\n\t * Whether nothing can serve this path, as opposed to not having served it yet.\n\t *\n\t * True when the origin routes nothing here and nothing is prepared to answer: no session\n\t * attached and no connection reconnecting toward one. False whenever {@link active} is\n\t * set, and false while a connection is still coming up, so the ordinary page-load window\n\t * before the first handshake reads as pending rather than as a missing broadcast. Waiting\n\t * on this is futile by definition; wait for an announcement instead, via the origin's\n\t * `announced`. True once the request is refused.\n\t */\n\treadonly unroutable: Getter<boolean>;\n\n\t/**\n\t * Settles with the error a route's handler refused the path with, or `null` once you\n\t * {@link close} the request. A refusal is final: no other route is asked, and a fresh\n\t * request is needed to try again.\n\t */\n\treadonly closed: GetPromise<Error | null>;\n\n\t#dispose: Dispose;\n\t#disposed = false;\n\n\tprivate constructor(\n\t\tpath: Path.Valid,\n\t\tactive: Getter<broadcast.Consumer | undefined>,\n\t\tunroutable: Getter<boolean>,\n\t\tclosed: GetPromise<Error | null>,\n\t\tdispose: Dispose,\n\t) {\n\t\tthis.path = path;\n\t\tthis.active = active;\n\t\tthis.unroutable = unroutable;\n\t\tthis.closed = closed;\n\t\tthis.#dispose = dispose;\n\t}\n\n\tstatic {\n\t\tmakeRequesting = (path, active, unroutable, closed, dispose) =>\n\t\t\tnew Requesting(path, active, unroutable, closed, dispose);\n\t}\n\n\t/** Withdraw the request. The path stays routed for any other open request. Idempotent. */\n\tclose(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.#dispose();\n\t}\n}\n\n/**\n * The read side of an origin: resolve broadcasts by path and watch what is available.\n *\n * Obtain one from {@link Producer.consume}. Pass it to a connection's `publish` option to\n * serve the origin's local broadcasts to that peer; read it directly to consume anything\n * the origin routes, locally published or discovered by a session.\n *\n * @public\n */\nexport class Consumer {\n\t#state: OriginState;\n\t#scope: Scope;\n\n\tprivate constructor(state: OriginState, scope: Scope) {\n\t\tthis.#state = state;\n\t\tthis.#scope = scope;\n\t\t// True only when every attached session announces. One session that cannot means the\n\t\t// table is an incomplete picture, so a consumer gated on it has to keep its blind\n\t\t// fallback: the paths only that session carries never reach the table at all.\n\t\tthis.#discovery = new Derived([state.sessions], ({ total, discovery }) =>\n\t\t\ttotal === 0 ? undefined : discovery === total,\n\t\t);\n\t\tregisterWire(this, {\n\t\t\troutes: (path) => this.#routes(scope.path(path)),\n\t\t\tbroadcasts:\n\t\t\t\tscope === Scope.all ? state.local : new Derived([state.local], (local) => scope.projectPaths(local)),\n\t\t\tadvertised:\n\t\t\t\tscope === Scope.all\n\t\t\t\t\t? state.originated\n\t\t\t\t\t: new Derived([state.originated], (routes) => scope.projectRoutes(routes)),\n\t\t\tlocal: (path) => this.#local(scope.path(path)),\n\t\t\tdemand: (path) => this.#demand(scope.path(path)),\n\t\t});\n\t}\n\n\tstatic {\n\t\tmakeConsumer = (state, scope) => new Consumer(state, scope);\n\t}\n\n\t/** Settles once the origin closes; see {@link Producer.closed}. */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#state.closed;\n\t}\n\n\t/**\n\t * Whether the announcement table sees everything the attached sessions can serve.\n\t *\n\t * Undefined while no session is attached (nothing is known yet), true when every attached\n\t * session announces into the table, and false as soon as one does not, where\n\t * {@link announced} cannot be complete and consumers should {@link request} paths instead\n\t * of waiting. One blind session among several is still false: the paths only it carries\n\t * never reach the table, so a consumer that trusted the gate would never see them.\n\t */\n\tget discovery(): Getter<boolean | undefined> {\n\t\treturn this.#discovery;\n\t}\n\n\t// Derived per access rather than cached: a lightweight mapped view over the session\n\t// counts, avoiding a Computed's lifecycle.\n\treadonly #discovery: Getter<boolean | undefined>;\n\n\t/**\n\t * Whether the table routes `path`, by an announced local publish or an announced\n\t * route covering it.\n\t *\n\t * Availability, not a handle: {@link request} is the only way to consume by path. A\n\t * request on a routed path resolves to that route and never to a blind answer, which is\n\t * why a serving session leaves it alone.\n\t *\n\t * @internal\n\t */\n\t#routes(path: Path.Valid): boolean {\n\t\tif (this.#state.local.peek()?.has(path)) return true;\n\t\treturn this.#state.bestEntry(path) !== undefined;\n\t}\n\n\t/**\n\t * Resolve `path`, optionally waiting for an announcement.\n\t *\n\t * The one way to consume by path. {@link Requesting.active} follows whatever the table\n\t * routes (an announced local publish, or any feeding session's announcement, swapping\n\t * on a republish or a retraction); when nothing does, the request stands and whichever\n\t * attached session answers first provides a blind subscription instead, re-answered\n\t * across reconnects.\n\t * With `announced: true`, an unrouted request waits while discovery is supported and\n\t * falls back to that blind behavior only when discovery is unavailable. Close the request\n\t * when done. On a closed origin it never resolves.\n\t *\n\t * With several sessions on one origin the first to answer wins, and it may be one that\n\t * does not carry the path. Nothing corrects that: a missing broadcast surfaces as a reset\n\t * on the first track and deliberately leaves the handle open, since the wire cannot tell\n\t * \"not here\" from \"not yet\" and a blind handle is expected to survive until a publisher\n\t * arrives. It matters only on an origin mixing sessions that announce with sessions that\n\t * cannot, where a path only the silent session carries may sit behind another session's\n\t * answer. Prefer {@link unroutable} and announcements over blind requests when the origin\n\t * feeds from more than one connection.\n\t */\n\trequest(path: Path.Valid, options: RequestOptions = {}): Requesting {\n\t\tconst relative = path;\n\t\tpath = this.#scope.path(path);\n\t\tconst requests = this.#state.requests.peek();\n\t\tif (!requests) {\n\t\t\t// Closed origin: a request that can never resolve, and says so.\n\t\t\tconst closed = new Once<Error | null>();\n\t\t\treturn makeRequesting(\n\t\t\t\trelative,\n\t\t\t\tnew Signal<broadcast.Consumer | undefined>(undefined),\n\t\t\t\tgetter(true),\n\t\t\t\tclosed,\n\t\t\t\t() => closed.set(null),\n\t\t\t);\n\t\t}\n\n\t\tlet slot = requests.get(path);\n\t\tif (!slot) {\n\t\t\t// Seeded through the constructor, so a path the table already routes resolves on the\n\t\t\t// first read. It must not go through a silent set: that still captures the pre-seed\n\t\t\t// value as the baseline the next change is compared against, and never flushes to\n\t\t\t// clear it, so a seeded route retracting to undefined would look like no change and\n\t\t\t// notify nobody.\n\t\t\tconst refused = new Set<RouteEntry>();\n\t\t\tconst created: RequestSlot = {\n\t\t\t\tblind: 0,\n\t\t\t\thandles: new Set(),\n\t\t\t\trefused,\n\t\t\t\troute: new Signal(this.#state.route(path, { refused })),\n\t\t\t};\n\t\t\tslot = created;\n\t\t\tthis.#state.requests.mutate((map) => {\n\t\t\t\tmap?.set(path, created);\n\t\t\t});\n\t\t}\n\t\tconst closed = new Once<Error | null>();\n\t\tslot.handles.add(closed);\n\t\tlet blind = !options.announced || this.#discovery.peek() === false;\n\t\tif (blind) slot.blind += 1;\n\t\tthis.#state.requests.mutate(() => {});\n\n\t\t// An announcement-gated request falls back to a blind subscription only while at\n\t\t// least one attached session cannot announce. It returns to the gate if discovery\n\t\t// becomes complete again, and remains gated with no session attached.\n\t\tconst unsubscribeDiscovery = options.announced\n\t\t\t? this.#discovery.subscribe((discovery) => {\n\t\t\t\t\tconst next = discovery === false;\n\t\t\t\t\tif (next === blind) return;\n\t\t\t\t\tblind = next;\n\t\t\t\t\tslot.blind += next ? 1 : -1;\n\t\t\t\t\tthis.#state.requests.mutate(() => {});\n\t\t\t\t})\n\t\t\t: () => {};\n\n\t\t// Hand out a handle of the request's own rather than the table's. Closing a consumer\n\t\t// closes the broadcast once it was the last one, and the table often holds the only\n\t\t// other handle, so lending its front out means an ordinary close() by one requester\n\t\t// can unpublish the path for everybody else.\n\t\tconst taken = slot;\n\n\t\t// Memoized on the route's identity: the same front resolving again returns the handle\n\t\t// we already made, and only a real swap clones a new one (cloning before closing the\n\t\t// old, so a broadcast that both routes share never briefly loses its last handle).\n\t\tlet released = false;\n\t\tlet source: broadcast.Consumer | undefined;\n\t\tlet handle: broadcast.Consumer | undefined;\n\t\tconst own = (front: broadcast.Consumer | undefined): broadcast.Consumer | undefined => {\n\t\t\tif (released) return undefined;\n\t\t\tif (front !== source) {\n\t\t\t\tconst previous = handle;\n\t\t\t\tsource = front;\n\t\t\t\thandle = front?.clone();\n\t\t\t\tif (handle) hooks.stampPath(handle, relative);\n\t\t\t\tprevious?.close();\n\t\t\t}\n\t\t\treturn handle;\n\t\t};\n\n\t\tconst route = taken.route;\n\t\tconst active = new Derived([route], own);\n\n\t\t// Swapping on the read is what keeps a routed path resolving synchronously, but a\n\t\t// holder that only ever peeked would then pin a route that has already been retracted\n\t\t// until it happened to read again. Following the route as well retires it promptly,\n\t\t// and the memo makes the two paths agree: whichever runs first does the swap.\n\t\tconst unsubscribe = route.subscribe(own);\n\n\t\t// Only meaningful while nothing is routed, so it reads the route rather than `active`:\n\t\t// the two cannot disagree, since a routed path always has an answerer-independent\n\t\t// answer.\n\t\tconst unroutable = new Derived(\n\t\t\t[route, this.#state.answerers, closed],\n\t\t\t(front, answerers, ended) => ended !== undefined || (!front && answerers === 0),\n\t\t);\n\n\t\treturn makeRequesting(relative, active, unroutable, closed, () => {\n\t\t\t// Releases this request's handle; the route itself belongs to the table.\n\t\t\treleased = true;\n\t\t\tunsubscribeDiscovery();\n\t\t\tunsubscribe();\n\t\t\thandle?.close();\n\t\t\thandle = undefined;\n\t\t\tsource = undefined;\n\n\t\t\ttaken.handles.delete(closed);\n\t\t\tif (closed.peek() === undefined) closed.set(null);\n\t\t\tif (blind) taken.blind -= 1;\n\t\t\tthis.#state.requests.mutate(() => {});\n\t\t\tif (taken.handles.size > 0) return;\n\n\t\t\t// Defer the teardown a microtask: an effect whose rerun was triggered by the\n\t\t\t// answer resolving closes its old request and takes a new one in the same tick,\n\t\t\t// and tearing down in between would drop the answer it is about to read.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (taken.handles.size > 0) return;\n\t\t\t\t// A refused slot already tore itself down, and the path may hold a newer one.\n\t\t\t\tif (this.#state.requests.peek()?.get(path) !== taken) return;\n\t\t\t\tthis.#state.requests.mutate((map) => {\n\t\t\t\t\tmap?.delete(path);\n\t\t\t\t});\n\t\t\t\ttaken.answer?.close();\n\t\t\t\ttaken.answer = undefined;\n\t\t\t\ttaken.route.set(undefined);\n\t\t\t\tthis.#state.releaseMaterialized(path);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * The announced routes matching `scope`, as a live map from covered prefix to route.\n\t * Local broadcasts appear once announced; received and dynamic routes retain their\n\t * advertised prefixes. Reads are synchronous, and the getter needs no teardown.\n\t * Hidden routes are left out unless `options.hidden` opts in (see {@link announce.Options}).\n\t * Unscoped readers share one snapshot; each distinct scope filters the table on changes.\n\t */\n\tbroadcasts(scope?: Path.Pattern, options?: announce.Options): Getter<ReadonlyMap<Path.Valid, Route>> {\n\t\tconst hidden = options?.hidden ?? false;\n\t\tif (!scope && this.#scope === Scope.all) return hidden ? this.#state.available : this.#state.visible;\n\t\tconst patterns = this.#scope.patterns(scope);\n\t\treturn new Derived([this.#state.available], () => {\n\t\t\tconst routes = new Map<Path.Valid, Route>();\n\t\t\tfor (const [path, entry] of this.#listed(patterns, hidden)) routes.set(path, entry.route);\n\t\t\treturn routes;\n\t\t});\n\t}\n\n\t/**\n\t * The announced routes matching `scope`, as a live stream: every currently advertised\n\t * route arrives first as active, then additions and retractions as they happen.\n\t * Any pattern is accepted. A local broadcast appears once it announces, exactly as a\n\t * peer sees it. A dynamic or received route announces the prefix it covers when its\n\t * subtree overlaps the scope. The stream ends when the origin closes or the consumer is\n\t * closed. Hidden routes are left out unless `options.hidden` opts in (see {@link announce.Options}).\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all(), options?: announce.Options): announce.Consumer {\n\t\tconst producer = new announce.Producer();\n\t\tvoid this.#runAnnounced(producer, this.#scope.patterns(scope), options?.hidden ?? false);\n\t\treturn producer.consume();\n\t}\n\n\t/** One snapshot shared by map readers and announcement-stream diffing. */\n\t#listed(patterns: Path.Patterns, hidden: boolean): Map<Path.Valid, Presented> {\n\t\tconst next = new Map<Path.Valid, Presented>();\n\t\tconst covering = new CoveringRoot(this.#scope.root);\n\t\tconst scopes = [...patterns]\n\t\t\t.sort((a, b) => Path.compareSpecificity(b.specificity(), a.specificity()))\n\t\t\t.map((pattern) => ({ pattern, head: scopeHead(pattern) }));\n\t\tfor (const [path, candidates] of this.#state.snapshot().candidates) {\n\t\t\t// The first candidate this reader can see wins, since the preferred one overall may not be.\n\t\t\tlet entry: Candidate | undefined;\n\t\t\tlet scope: (typeof scopes)[number] | undefined;\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tscope = scopes.find(\n\t\t\t\t\t({ pattern, head }) =>\n\t\t\t\t\t\t(candidate.exact ? pattern.matches(path) : advertOverlaps(candidate, path, pattern)) &&\n\t\t\t\t\t\t(hidden || !hiddenBelow(head, path)),\n\t\t\t\t);\n\t\t\t\tif (scope) {\n\t\t\t\t\tentry = candidate;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!entry || !scope) continue;\n\t\t\tconst relative = covering.relative(path);\n\t\t\tif (relative === undefined) continue;\n\t\t\tnext.set(relative, {\n\t\t\t\tidentity: entry.identity,\n\t\t\t\troute: entry.route,\n\t\t\t\tcaptures: scopeCaptures(scope.pattern, path),\n\t\t\t});\n\t\t}\n\t\treturn next;\n\t}\n\n\tasync #runAnnounced(producer: announce.Producer, patterns: Path.Patterns, hidden: boolean): Promise<void> {\n\t\t// Keyed by the presented path (from the origin, not the scope), valued by identity\n\t\t// plus route. Diffing identity rather than mere presence means a republish emits a\n\t\t// retraction then a fresh announcement; a re-price of the same identity emits an\n\t\t// update.\n\t\tlet active = new Map<Path.Valid, Presented>();\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst local = this.#state.local.peek();\n\t\t\t\tconst advertisedLocal = this.#state.advertisedLocal.peek();\n\t\t\t\tconst routes = this.#state.routes.peek();\n\t\t\t\tif (local === undefined && advertisedLocal === undefined && routes === undefined) break;\n\n\t\t\t\tconst next = this.#listed(patterns, hidden);\n\n\t\t\t\tfor (const [path, snap] of active) {\n\t\t\t\t\tconst cur = next.get(path);\n\t\t\t\t\tif (!cur || cur.identity !== snap.identity)\n\t\t\t\t\t\tproducer.append({\n\t\t\t\t\t\t\tprefix: path,\n\t\t\t\t\t\t\tcaptures: snap.captures,\n\t\t\t\t\t\t\tkind: \"retracted\",\n\t\t\t\t\t\t\troute: snap.route,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tfor (const [path, snap] of next) {\n\t\t\t\t\tconst prev = active.get(path);\n\t\t\t\t\tif (!prev || prev.identity !== snap.identity) {\n\t\t\t\t\t\tproducer.append({\n\t\t\t\t\t\t\tprefix: path,\n\t\t\t\t\t\t\tcaptures: snap.captures,\n\t\t\t\t\t\t\tkind: \"announced\",\n\t\t\t\t\t\t\troute: snap.route,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (!routesEqual(prev.route, snap.route)) {\n\t\t\t\t\t\tproducer.append({ prefix: path, captures: snap.captures, kind: \"updated\", route: snap.route });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tactive = next;\n\n\t\t\t\tawait Signal.race(this.#state.local, this.#state.advertisedLocal, this.#state.routes, producer.closed);\n\t\t\t\tif (producer.closed.peek() !== undefined) return;\n\t\t\t}\n\t\t} catch {\n\t\t\t// The reader closed between the check and an append; nothing left to do.\n\t\t}\n\t\tproducer.close();\n\t}\n\n\t/**\n\t * The local table, borrowed by the wire publishers to answer subscribes.\n\t *\n\t * Deliberately excludes received routes: a session never re-announces what a peer\n\t * told it, so an origin wired to both directions of a connection cannot echo.\n\t * Borrowed, not owned: do not close the fronts. Undefined once the origin closes.\n\t *\n\t * @internal\n\t */\n\t/**\n\t * Originated advertisements a session should forward: exact-path announces plus\n\t * originated dynamics. Undefined once the origin closes.\n\t *\n\t * @internal\n\t */\n\t/**\n\t * The announced local broadcast at `path`, when it beats the originated routes there.\n\t * Resolves through what rebuildOriginated advertised: a peer never sees received routes.\n\t */\n\t#local(path: Path.Valid): broadcast.Consumer | undefined {\n\t\tconst local = this.#state.local.peek()?.get(path);\n\t\tif (local && this.#state.localWins(path, this.#state.bestEntry(path, received))) return local;\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Resolve `path` for serving: an announced local broadcast, or wait for an originated\n\t * dynamic to accept it. Undefined when nothing here can serve the path.\n\t *\n\t * @internal\n\t */\n\tasync #demand(path: Path.Valid): Promise<broadcast.Consumer | undefined> {\n\t\tconst local = this.#local(path);\n\t\tif (local) return local;\n\t\tconst entry = this.#state.bestEntry(path, received);\n\t\tif (!entry?.server) return undefined;\n\n\t\tconst server = entry.server;\n\t\tconst live = server.served.get(path);\n\t\tif (live && live.closed.peek() === undefined) return live;\n\n\t\tserver.enqueue(path);\n\t\tserver.demanding.set(path, (server.demanding.get(path) ?? 0) + 1);\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst served = server.served.get(path);\n\t\t\t\tif (served && served.closed.peek() === undefined) return served;\n\t\t\t\tconst rejected = server.rejected.get(path);\n\t\t\t\tif (rejected) {\n\t\t\t\t\tserver.rejected.delete(path);\n\t\t\t\t\tthrow rejected;\n\t\t\t\t}\n\t\t\t\tconst closed = server.closed.peek();\n\t\t\t\tif (closed !== undefined) {\n\t\t\t\t\tif (closed) throw closed;\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (!server.pending.has(path)) return undefined;\n\t\t\t\tawait Signal.race(server.settled, server.closed);\n\t\t\t}\n\t\t} finally {\n\t\t\tconst n = (server.demanding.get(path) ?? 1) - 1;\n\t\t\tif (n <= 0) server.demanding.delete(path);\n\t\t\telse server.demanding.set(path, n);\n\t\t}\n\t}\n}\n\n/**\n * A served route from {@link Producer.dynamic}: advertises a prefix and answers the\n * requests beneath it.\n *\n * Drop it (or {@link close}) to retract the route and reject anything still waiting\n * with {@link StreamCode.NoCapacity}. {@link update} re-prices it in place.\n *\n * @public\n */\nexport class Dynamic {\n\t/** The prefix this handle advertises. */\n\treadonly prefix: Path.Valid;\n\n\t#entry: RouteEntry;\n\t#state: OriginState;\n\t#retract: Dispose;\n\t#closed = false;\n\n\tprivate constructor(prefix: Path.Valid, entry: RouteEntry, state: OriginState, retract: Dispose) {\n\t\tthis.prefix = Path.stripPrefix(entry.scope.root, prefix) ?? Path.empty();\n\t\tthis.#entry = entry;\n\t\tthis.#state = state;\n\t\tthis.#retract = retract;\n\t}\n\n\tstatic {\n\t\tmakeDynamic = (prefix, entry, state, retract) => new Dynamic(prefix, entry, state, retract);\n\t}\n\n\t/** Re-price the route in place. The prefix is fixed at announce time. */\n\tupdate(route: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint }): void {\n\t\tif (this.#closed) throw new Error(\"dynamic is closed\");\n\t\tthis.#entry.route.set(Route.normalize(route));\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refreshPrefix(Path.join(this.#entry.scope.root, this.prefix));\n\t\tthis.#state.routes.mutate(() => {});\n\t}\n\n\t/** Retract the route and reject anything still waiting. Idempotent. */\n\tclose(): void {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tthis.#retract();\n\t}\n\n\t/** Requests under this prefix, as they arrive, each to {@link Request.accept} or reject. */\n\tasync *requested(): AsyncIterableIterator<Request> {\n\t\tconst server = this.#entry.server;\n\t\tif (!server) return;\n\t\tlet current: Request | undefined;\n\t\tconst drop = () => {\n\t\t\tcurrent?.reject(noCapacity());\n\t\t\tcurrent = undefined;\n\t\t};\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = server.queue.peek()[0];\n\t\t\t\tif (next) {\n\t\t\t\t\tdrop();\n\t\t\t\t\tserver.queue.mutate((queue) => {\n\t\t\t\t\t\tqueue.shift();\n\t\t\t\t\t});\n\t\t\t\t\tcurrent = next;\n\t\t\t\t\tyield next;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (server.closed.peek() !== undefined) return;\n\t\t\t\tawait Signal.race(server.queue, server.closed);\n\t\t\t}\n\t\t} finally {\n\t\t\tdrop();\n\t\t}\n\t}\n}\n\n/**\n * A pending request for a broadcast to be served on demand.\n *\n * Yielded by {@link Dynamic.requested}. {@link accept} resolves it with a live\n * broadcast; {@link reject} resolves it with an error. Advancing the iterator or\n * closing it without either rejects the request.\n *\n * @public\n */\nexport class Request {\n\t/** The path that was requested. */\n\treadonly path: Path.Valid;\n\n\t#server: ServeState;\n\t#done = false;\n\n\tprivate constructor(path: Path.Valid, server: ServeState) {\n\t\tthis.path = path;\n\t\tthis.#server = server;\n\t}\n\n\tstatic {\n\t\tmakeRequest = (path, server) => new Request(path, server);\n\t\tfinishRequest = (request, err) => {\n\t\t\trequest.#done = true;\n\t\t\tvoid err;\n\t\t};\n\t}\n\n\t/**\n\t * Accept the request, resolving every awaiting requester with `broadcast`.\n\t *\n\t * The caller keeps producing into `broadcast`; repeat requests for the path share\n\t * it for as long as it stays live.\n\t */\n\taccept(source: broadcast.Producer | broadcast.Consumer): void {\n\t\tif (this.#done) return;\n\t\tthis.#done = true;\n\t\tconst front = source instanceof broadcast.Producer ? source.consume() : source;\n\t\tthis.#server.accept(this, front);\n\t}\n\n\t/** Reject the request, resolving every awaiting requester with `err`. */\n\treject(err: Error): void {\n\t\tif (this.#done) return;\n\t\tthis.#done = true;\n\t\tthis.#server.reject(this, err);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,OAAO,EAA8C,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEvG,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EACN,OAAO,EACP,UAAU,EACV,aAAa,EACb,UAAU,EACV,WAAW,EACX,gBAAgB,EAEhB,aAAa,EACb,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,GACV,MAAM,eAAe,CAAC;A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AAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,yEAAyE;IACzE,MAAM,CAAC,GAAU;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO;QACtC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACD","sourcesContent":["/**\n * A broadcast routing table, independent of any connection.\n *\n * Publish broadcasts into an origin and hand the origin to one or more connections to\n * serve them; the broadcasts outlive any single session. Hand the same (or another)\n * origin to a connection's `consume` option and the peer's announced routes appear\n * in the table too, under whatever its readers watch: each route covers a path prefix,\n * and a request for a path under it resolves through the session that announced it.\n * Mirrors the `origin` module in `rs/moq-net`.\n *\n * @module\n */\nimport { Derived, type Dispose, type GetPromise, type Getter, Once, race, Signal } from \"@moq/signals\";\nimport type * as Announce from \"./announce.ts\";\nimport * as announce from \"./announced.ts\";\nimport type { Credential } from \"./auth.ts\";\nimport * as broadcast from \"./broadcast.ts\";\nimport { StreamCode, StreamError } from \"./error.ts\";\nimport { type Cost, routesEqual, WireRoute } from \"./hop.ts\";\nimport * as Identity from \"./identity.ts\";\nimport {\n\tarrival,\n\tbestOfTier,\n\tcompareRoutes,\n\tcompareTie,\n\tcompareTier,\n\tcoveringPrefixes,\n\ttype Filed,\n\tfirstEligible,\n\thiddenBelow,\n\thooks,\n\treceive,\n\trouteHops,\n\tsuperseded,\n} from \"./internal.ts\";\nimport * as Path from \"./path.ts\";\nimport { Front } from \"./resume.ts\";\nimport { closeUnwanted } from \"./util/announce.ts\";\nimport {\n\ttype Advertised,\n\ttype Advertisements,\n\ttype InterestListener,\n\tregisterWire,\n\ttype Served,\n\tsameIdentity,\n\twireOf,\n} from \"./wire.ts\";\n\nexport type { Cost, RouteInfo } from \"./hop.ts\";\n\n/** The rooted permissions shared by a handle and every route it inserts. */\nclass Scope {\n\tstatic readonly all = new Scope(Path.empty());\n\n\treadonly root: Path.Valid;\n\t/** The absolute prefixes this handle reaches; unset for every path. */\n\treadonly allowed?: Path.Prefixes;\n\n\tconstructor(root: Path.Valid, allowed?: Path.Prefixes) {\n\t\tthis.root = root;\n\t\tthis.allowed = allowed;\n\t}\n\n\tnarrow(root: Path.Valid, prefixes: Path.Prefixes): Scope {\n\t\tconst joined = Path.encode(Path.join(this.root, root));\n\t\tconst rooted = prefixes.rooted(joined);\n\t\tconst allowed = this.allowed?.intersect(rooted) ?? rooted;\n\t\tif (allowed.size === 0) throw new Error(\"origin scopes do not overlap\");\n\t\treturn new Scope(joined, allowed);\n\t}\n\n\tmatches(path: Path.Valid): boolean {\n\t\treturn this.allowed?.matches(path) ?? true;\n\t}\n\n\t/**\n\t * Where a claim at the absolute `prefix` is filed, so each place serves its whole subtree:\n\t * the prefix itself when this scope covers it, and otherwise each of its prefixes beneath\n\t * it, with how many segments beneath the claim's prefix it lies. Mirrors rs/moq-net's `filed`.\n\t */\n\tfiled(prefix: Path.Valid): [Path.Valid, bigint][] {\n\t\tif (!this.allowed || this.allowed.matches(prefix)) return [[prefix, 0n]];\n\t\tconst depth = Path.parts(prefix).length;\n\t\treturn this.allowed\n\t\t\t.toArray()\n\t\t\t.map((member) => member.text as Path.Valid)\n\t\t\t.filter((at) => Path.check(at) === undefined && Path.hasPrefix(prefix, at))\n\t\t\t.map((at) => [at, BigInt(Path.parts(at).length - depth)]);\n\t}\n\n\tpath(path: Path.Valid): Path.Valid {\n\t\tconst joined = Path.encode(Path.join(this.root, path));\n\t\tif (!this.matches(joined)) throw new Error(\"path is outside the origin scope\");\n\t\treturn joined;\n\t}\n\n\tprefix(prefix: Path.Valid): Path.Valid {\n\t\tconst joined = Path.encode(Path.join(this.root, prefix));\n\t\tif (!this.overlaps(joined)) throw new Error(\"prefix is outside the origin scope\");\n\t\treturn joined;\n\t}\n\n\t/**\n\t * The absolute subtrees a reader of `prefix`, relative to the root, lists within this scope.\n\t * Throws {@link Path.InvalidPrefix} for a prefix holding a `*`, which no grant can name, and\n\t * an error for one past the wire limits, which no session could ask its peer about.\n\t */\n\tlisted(prefix: Path.Valid): Path.Prefixes {\n\t\tconst rooted = new Path.Prefixes([Path.Prefix.parse(Path.encode(Path.join(this.root, prefix)))]);\n\t\tif (!this.allowed) return rooted;\n\t\t// A grant can still name a path the wire refuses, past its limits or ending in an escaped\n\t\t// `/`; no session could ask about it.\n\t\tconst listed = this.allowed.intersect(rooted).toArray();\n\t\treturn new Path.Prefixes(listed.filter((member) => Path.tryDecode(member.text) !== undefined));\n\t}\n\n\t/** The root-relative prefixes this scope asks its peer about: its own, already disjoint. */\n\t#heads(): Path.Valid[] {\n\t\tif (!this.allowed) return [Path.empty()];\n\t\treturn [...this.allowed.rebase(this.root)]\n\t\t\t.map((prefix) => prefix.text as Path.Valid)\n\t\t\t.filter((head) => Path.tryDecode(head) !== undefined);\n\t}\n\n\t#headsCache?: Path.Valid[];\n\n\t/**\n\t * The root-relative prefixes a session asks its peer about for one watched absolute prefix:\n\t * a watch above a head requests the head, since this scope may not ask for more, and a\n\t * watch inside one requests itself.\n\t */\n\tinterests(absolute: Path.Valid): Path.Valid[] {\n\t\tif (this === Scope.all) return [absolute];\n\t\tthis.#headsCache ??= this.#heads();\n\t\tconst relative = Path.stripPrefix(this.root, absolute);\n\t\tif (relative === null) return Path.hasPrefix(absolute, this.root) ? [...this.#headsCache] : [];\n\t\tconst out: Path.Valid[] = [];\n\t\tfor (const head of this.#headsCache) {\n\t\t\tif (Path.hasPrefix(relative, head)) out.push(head);\n\t\t\telse if (Path.hasPrefix(head, relative) && this.overlaps(absolute)) return [relative];\n\t\t}\n\t\treturn out;\n\t}\n\n\t/** Whether this scope allows everything beneath the root-relative `prefix`. */\n\tcovers(prefix: Path.Valid): boolean {\n\t\tif (!this.allowed) return true;\n\t\t// A peer's prefix may fit the wire alone and overflow once joined: nothing allowed lies there.\n\t\tconst path = Path.tryJoin(this.root, prefix);\n\t\treturn path !== undefined && Path.check(path) === undefined && this.allowed.matches(path);\n\t}\n\n\t/** Whether this scope allows anything beneath the absolute `prefix`. */\n\toverlaps(prefix: Path.Valid): boolean {\n\t\treturn this.allowed?.overlaps(prefix) ?? true;\n\t}\n\n\t/** The exact paths within this scope, relative to its root. */\n\tprojectPaths<T>(values: ReadonlyMap<Path.Valid, T>): ReadonlyMap<Path.Valid, T> {\n\t\tif (this === Scope.all) return values;\n\n\t\tconst out = new Map<Path.Valid, T>();\n\t\tfor (const [path, value] of values) {\n\t\t\tif (!this.matches(path)) continue;\n\t\t\tconst relative = Path.stripPrefix(this.root, path);\n\t\t\tif (relative !== null) out.set(relative, value);\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t * The advertisements that may serve this scope, relative to its root. Every prefix at or\n\t * above the root presents as the empty path, as far above it as its claim is above the root,\n\t * most specific first, since that is the order a request beneath the root resolves in.\n\t */\n\tprojectRoutes(values: Advertisements | undefined): Advertisements | undefined {\n\t\tif (!values || this === Scope.all) return values;\n\t\tconst out = new Map<Path.Valid, readonly Advertised[]>();\n\t\tconst covering: [Path.Valid, Advertised[]][] = [];\n\t\tconst allowed = this.allowed;\n\t\tconst rootDepth = Path.parts(this.root).length;\n\t\tfor (const [path, candidates] of values) {\n\t\t\tconst relative = Path.stripPrefix(this.root, path);\n\t\t\tconst above = relative === null || relative === Path.empty();\n\t\t\tif (above && !Path.hasPrefix(path, this.root)) continue;\n\t\t\t// A route serves the whole subtree it is filed at, so it may serve this scope when the two overlap.\n\t\t\tif (allowed && !allowed.overlaps(path)) continue;\n\t\t\tconst visible = candidates;\n\t\t\tif (visible.length === 0) continue;\n\t\t\tif (!above) {\n\t\t\t\tout.set(relative, visible);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Hold the empty path's place in the order until every covering prefix is known.\n\t\t\tif (covering.length === 0) out.set(Path.empty(), []);\n\t\t\t// Raised to the root, a claim is that much further above it, so its Above names its own\n\t\t\t// prefix: claims of one prefix supersede each other wherever each is filed. It keeps\n\t\t\t// where it is filed, so a read beneath the root ranks it as a request there resolves, and\n\t\t\t// its place among its filing's claims, which the merged row below no longer shows.\n\t\t\tconst raised = BigInt(rootDepth - Path.parts(path).length);\n\t\t\tcovering.push([\n\t\t\t\tpath,\n\t\t\t\tvisible.map((value, order) =>\n\t\t\t\t\traised === 0n\n\t\t\t\t\t\t? { ...value, order }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t...value,\n\t\t\t\t\t\t\t\tfiled: path,\n\t\t\t\t\t\t\t\torder,\n\t\t\t\t\t\t\t\troute: { ...value.route, above: (value.route.above ?? 0n) + raised },\n\t\t\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\t\tif (covering.length > 0) {\n\t\t\t// The most specific claim first, as a request beneath the root resolves; claims of one\n\t\t\t// prefix rank against each other wherever each is filed, hashed on the root, as a\n\t\t\t// request for it resolves.\n\t\t\tconst ranked = covering.flatMap(([prefix, visible]) =>\n\t\t\t\tvisible.map((value) => ({\n\t\t\t\t\tvalue,\n\t\t\t\t\tprefix,\n\t\t\t\t\tdepth: Path.parts(prefix).length,\n\t\t\t\t\torder: value.order ?? 0,\n\t\t\t\t\tarrival: arrival(value.ref),\n\t\t\t\t\troute: value.route,\n\t\t\t\t})),\n\t\t\t);\n\t\t\t// A broadcast published above the root serves only its own path, so a tier-mate that\n\t\t\t// serves the root ranks ahead of it, as `presented` ranks them.\n\t\t\tconst serves = (entry: (typeof ranked)[number]) => !entry.value.exact || entry.prefix === this.root;\n\t\t\tranked.sort(\n\t\t\t\t(a, b) =>\n\t\t\t\t\tNumber((a.route.above ?? 0n) - (b.route.above ?? 0n)) ||\n\t\t\t\t\tNumber(serves(b)) - Number(serves(a)) ||\n\t\t\t\t\tcompareTier(this.root, a, b) ||\n\t\t\t\t\tcompareTie(this.root, a, b),\n\t\t\t);\n\t\t\tout.set(\n\t\t\t\tPath.empty(),\n\t\t\t\tranked.map(({ value }) => value),\n\t\t\t);\n\t\t}\n\t\treturn out;\n\t}\n}\n\n/** One segment of the watched-prefix trie, kept while it or anything beneath it is watched. */\ninterface WatchNode {\n\treadonly path: Path.Valid;\n\treadonly parent?: WatchNode;\n\treadonly children: Map<string, WatchNode>;\n\t/** How many open watchers name exactly this prefix. */\n\tcount: number;\n}\n\n/** Whether something strictly above `node` is watched, so `node` rides its request. */\nfunction coveredAbove(node: WatchNode): boolean {\n\tfor (let above = node.parent; above; above = above.parent) if (above.count > 0) return true;\n\treturn false;\n}\n\n/** The broadest watched prefixes strictly beneath `node`: the ones it covers. */\nfunction frontier(node: WatchNode, out: Path.Valid[] = []): Path.Valid[] {\n\tfor (const child of node.children.values()) {\n\t\tif (child.count > 0) out.push(child.path);\n\t\telse frontier(child, out);\n\t}\n\treturn out;\n}\n\n/**\n * One requested path: the notify node for everything watching it.\n *\n * `route` is the only reactive part, and the only thing a {@link Request} subscribes to, so\n * a publish or retraction anywhere else in the table cannot wake it. The origin's tables stay\n * the storage; this is a per-path view onto them, refreshed by whichever mutator touched the\n * path. The alternative, deriving each request over the whole `local`/`remote` maps, wakes\n * every open request on every unrelated change.\n *\n * `answer` is one session's: when that session dies the request it resolved ends, since the\n * next session is another publisher identity unless an identity says otherwise. A slot still\n * waiting is answered by the next session.\n *\n * `handles` holds the `closed` of each open {@link Requesting} on the path.\n *\n * A refusal is terminal, even while another source still serves: the slot ends, every handle\n * closes with the handler's error, and the slot leaves the table, so the next request asks\n * afresh. A refusal never falls through to a broader prefix or another advertiser.\n */\ninterface RequestSlot {\n\t/** Open plain handles that can use a peer without discovery. */\n\tblind: number;\n\tanswer?: broadcast.Consumer;\n\treadonly handles: Set<Once<Error | null>>;\n\t/** Pending plain handles, each ending itself once synced discovery leaves it no route. */\n\treadonly absent: Set<() => void>;\n\t/**\n\t * Called each time the table moves for the path while the slot keeps its route and no takeover\n\t * is pending: the evidence a read stranded on that route waits for.\n\t */\n\treadonly moved: Set<() => void>;\n\t/**\n\t * Open handles pinned to an identity on a slot that is not pinned itself, which they share while\n\t * that identity wins the path: each ends on a refusal that speaks for its identity even once\n\t * another identity wins, as its own resolution would meet it.\n\t */\n\treadonly pinned: Set<{ readonly identity: Identity.Valid; refuse(err: Error): void }>;\n\treadonly route: Signal<Resolution | undefined>;\n\t/** The front a detached slot took from the table, closed with its last handle. */\n\tretired?: broadcast.Consumer;\n\t/** The route a detached slot asked to take over under the same identity, until it answers. */\n\tfailover?: RouteEntry;\n\t/**\n\t * The identity a pinned slot resolves through its own routes, as Rust's lookup does, while\n\t * another identity wins the path. Such a slot is detached from the start: never in the\n\t * table's `requests`, it is shared only by requests pinned to the same identity.\n\t */\n\treadonly pin?: Identity.Valid;\n}\n\n/** One path resolution and the identity of the route that can currently serve it. */\ninterface Resolution {\n\treadonly front?: broadcast.Consumer;\n\treadonly identity?: Identity.Valid;\n\t/** The epoch of the identity the front came from: a request selecting another one never joins it. */\n\treadonly epoch?: bigint;\n\t/** The local broadcast or route entry's ref the front came from, when it did. */\n\treadonly source?: object;\n\t/** Whether the front is the local broadcast, whose word on a track no route news overtakes. */\n\treadonly local?: boolean;\n\t/** Whether the front came from a lite-07 peer's claim, whose refusal is final once its identity loses the path. */\n\treadonly claim?: boolean;\n\t/** Kept while a cheaper route of the identity has yet to answer: a takeover is pending. */\n\treadonly pending?: boolean;\n}\n\n/**\n * One advertised prefix: hops and cost, plus an optional server that answers\n * requests beneath it.\n *\n * The preferred entry per prefix is the one requests resolve through. An originated\n * entry is forwarded by sessions; a received one is not, so a shared origin\n * cannot echo a peer's announcements back to it.\n */\ninterface RouteEntry {\n\treadonly ref: object;\n\treadonly scope: Scope;\n\treadonly route: Signal<WireRoute>;\n\treadonly originated: boolean;\n\treadonly server?: ServeState;\n\t/**\n\t * Set as a received route leaves because its session lost it, rather than its announcer\n\t * ending it: readers then see it go offline, not end.\n\t */\n\tlost: boolean;\n}\n\n/** Whether `entry` may serve a request for `path`. */\nfunction admits(entry: RouteEntry, path: Path.Valid): boolean {\n\treturn entry.scope.matches(path);\n}\n\n/** One advertisement at a prefix. `exact` marks an announced local broadcast, which is only its own path. */\ninterface Candidate extends Advertised {\n\treadonly exact: boolean;\n\t/** Whether the route left because its session lost it; see {@link RouteEntry.lost}. */\n\treadonly lost?: () => boolean;\n}\n\n/**\n * Orders advertisements at a prefix: the most specific claim, then the better route, then a\n * local broadcast on a tie, then fewer hops. A remaining tie is left to the table's newest-first\n * order; see {@link compareTier}.\n */\nfunction compareCandidates(a: Candidate, b: Candidate): number {\n\tconst above = (a.route.above ?? 0n) - (b.route.above ?? 0n);\n\treturn (\n\t\t(above < 0n ? -1 : above > 0n ? 1 : 0) ||\n\t\tcompareRoutes(a.route, b.route) ||\n\t\tNumber(b.exact) - Number(a.exact) ||\n\t\trouteHops(a.route) - routeHops(b.route)\n\t);\n}\n\n/** Whether a session received `entry`, so it is never forwarded to a peer. */\nfunction received(entry: RouteEntry): boolean {\n\treturn !entry.originated;\n}\n\n/**\n * Which claims a lookup passes over: a route entry or an announced local broadcast, with the route\n * it is advertised with. A passed-over claim neither wins nor shadows.\n */\ntype Skip = (claim: RouteEntry | broadcast.Consumer, route: WireRoute) => boolean;\n\n/** What a peer cannot be served through: a received route, or one of another identity than it pinned. */\nfunction unservable(identity: Identity.Valid | undefined): Skip {\n\treturn (claim, route) =>\n\t\t(!(claim instanceof broadcast.Consumer) && received(claim)) ||\n\t\t(identity !== undefined && route.identity !== identity);\n}\n\n/** Whether `slot` still serves an older epoch while it waits on its identity's newer one: nobody joins it meanwhile. */\nfunction outdated(slot: RequestSlot): boolean {\n\tconst current = slot.route.peek();\n\tif (current?.front === undefined || slot.failover === undefined) return false;\n\treturn (slot.failover.route.peek().epoch ?? 0n) !== (current.epoch ?? 0n);\n}\n\nfunction unroutable(): StreamError {\n\treturn new StreamError(StreamCode.Unroutable, { message: \"unroutable\" });\n}\n\n// A selected handler refused these requests; a coalesced route gap can have the same error.\nconst refusedRequests = new WeakSet<GetPromise<Error | null>>();\n\n/** A claim's queue of requests, from {@link Producer.claim}: what a handler drains. */\nclass ServeState {\n\treadonly root: Path.Valid;\n\t/** The prefix the route claims; every served path is at or beneath it. */\n\treadonly prefix: Path.Valid;\n\n\tconstructor(root: Path.Valid, prefix: Path.Valid) {\n\t\tthis.root = root;\n\t\tthis.prefix = prefix;\n\t}\n\n\tqueue = new Signal(new Set<Request>());\n\tpending = new Map<Path.Valid, Request>();\n\tserved = new Map<Path.Valid, broadcast.Consumer>();\n\trejected = new Map<Path.Valid, Error>();\n\t// demand() is the only reader of `rejected`. A Consumer.request refusal never\n\t// re-enqueues, so storing the error without a waiter would pin every unique\n\t// path until the route dies.\n\tdemanding = new Map<Path.Valid, number>();\n\tclosed = new Once<Error | null>();\n\tsettled = new Signal(0);\n\t/** Counts {@link reset}s, so a waiter can tell its request was released rather than answered. */\n\tresets = 0;\n\t/**\n\t * Whether the origin publishes a broadcast of another identity that wins the absolute `path`.\n\t * Set on an application's claim, whose handler may answer with such a broadcast under that\n\t * broadcast's own identity: a request still reaching the claim past it can only be pinned to\n\t * the claim's, and is refused rather than start a second job. Mirrors the Rust\n\t * `ServeState::publishing`.\n\t */\n\tpublishes: (path: Path.Valid) => boolean = () => false;\n\t/**\n\t * The claim's cost while it is announced at its own {@link prefix}, where a job answering it\n\t * ranks in the claim's tier, cost first. See {@link Request.route}.\n\t */\n\tcost: () => Cost | undefined = () => undefined;\n\t/** The announced cost of each job's route at the claim's own {@link prefix}, undefined while hidden. */\n\treadonly jobs = new Set<() => Cost | undefined>();\n\n\t/** Whether `cost` prices a job at the claim's own prefix above the announced claim. */\n\texceeds(cost: Cost): boolean {\n\t\tconst claim = this.cost();\n\t\treturn claim !== undefined && cost > claim;\n\t}\n\n\t/** Whether `cost` prices the claim below one of its announced jobs at its own prefix. */\n\tundercuts(cost: Cost): boolean {\n\t\tfor (const job of this.jobs) {\n\t\t\tconst priced = job();\n\t\t\tif (priced !== undefined && priced > cost) return true;\n\t\t}\n\t\treturn false;\n\t}\n\tonChange: (path: Path.Valid) => void = () => {};\n\tonReject: (path: Path.Valid, err: Error) => void = () => {};\n\n\tenqueue(path: Path.Valid): void {\n\t\tif (this.closed.peek() !== undefined) return;\n\t\tthis.rejected.delete(path);\n\t\tif (this.pending.has(path)) return;\n\t\tconst live = this.served.get(path);\n\t\tif (live && live.closed.peek() === undefined) return;\n\t\tconst request = makeRequest(Path.stripPrefix(this.root, path) ?? Path.empty(), this);\n\t\tthis.pending.set(path, request);\n\t\tthis.queue.mutate((queue) => {\n\t\t\tqueue.add(request);\n\t\t});\n\t}\n\n\t/** Withdraw only this pending request; a later answer cannot replace a newer one. */\n\tforget(path: Path.Valid, request: Request): void {\n\t\tif (this.pending.get(path) !== request) return;\n\t\tthis.pending.delete(path);\n\t\tthis.queue.mutate((queue) => {\n\t\t\tqueue.delete(request);\n\t\t});\n\t\tthis.rejected.delete(path);\n\t\tfinishRequest(request, unroutable());\n\t}\n\n\taccept(request: Request, front: broadcast.Consumer): void {\n\t\tconst path = Path.join(this.root, request.path);\n\t\tif (this.closed.peek() !== undefined || this.pending.get(path) !== request) {\n\t\t\tfront.close();\n\t\t\treturn;\n\t\t}\n\t\tthis.pending.delete(path);\n\t\tconst existing = this.served.get(path);\n\t\tif (existing && existing.closed.peek() === undefined) {\n\t\t\tfront.close();\n\t\t\tthis.onChange(path);\n\t\t\tthis.settled.update((n) => n + 1);\n\t\t\treturn;\n\t\t}\n\t\t// A route claiming a prefix names no broadcast, so a path it serves on request has no\n\t\t// inventory to list.\n\t\tif (path !== this.prefix) hooks.stampUnlisted(front);\n\t\tthis.served.set(path, front);\n\t\tvoid front.closed.then(() => {\n\t\t\tif (this.served.get(path) !== front) return;\n\t\t\tthis.served.delete(path);\n\t\t\tthis.onChange(path);\n\t\t});\n\t\tthis.onChange(path);\n\t\tthis.settled.update((n) => n + 1);\n\t}\n\n\thas(request: Request): boolean {\n\t\treturn this.closed.peek() === undefined && this.pending.get(Path.join(this.root, request.path)) === request;\n\t}\n\n\treject(request: Request, err: Error): void {\n\t\tconst path = Path.join(this.root, request.path);\n\t\tif (this.pending.get(path) !== request) return;\n\t\tthis.pending.delete(path);\n\t\tif (this.demanding.has(path)) this.rejected.set(path, err);\n\t\tthis.onReject(path, err);\n\t\tthis.settled.update((n) => n + 1);\n\t}\n\n\t/**\n\t * A job's exact route just took `request`'s path under an identity of its own, so the claim\n\t * never answers with it: that would hand requesters resolved under the claim's identity another\n\t * stream. The request is refused instead, and its requesters resolve the path afresh: an\n\t * unpinned one onto the job, a peer naming no identity once the job's announcement reaches\n\t * it, and one pinned to the claim's identity is refused.\n\t */\n\trelease(request: Request): void {\n\t\tconst path = Path.join(this.root, request.path);\n\t\t// Already forgotten when nothing else wanted it once the route landed.\n\t\tthis.forget(path, request);\n\t\tthis.onReject(path, unroutable());\n\t\tthis.settled.update((n) => n + 1);\n\t}\n\n\tclose(abort?: Error): void {\n\t\tif (this.closed.peek() !== undefined) return;\n\t\tconst err = abort ?? unroutable();\n\t\tthis.closed.set(err);\n\t\tthis.reset(err);\n\t}\n\n\t/**\n\t * Release answers and the requests handlers hold when the publisher identity changes: a\n\t * handler's late answer is for the old one, and the requesters ask the new one again.\n\t */\n\treset(err: Error = unroutable()): void {\n\t\tthis.resets++;\n\t\tconst queued = [...this.pending.values()];\n\t\tthis.pending.clear();\n\t\tthis.queue.mutate((queue) => {\n\t\t\tqueue.clear();\n\t\t});\n\t\tfor (const request of queued) {\n\t\t\tfinishRequest(request, err);\n\t\t}\n\t\tconst served = [...this.served];\n\t\tthis.served.clear();\n\t\tfor (const [path, front] of served) {\n\t\t\tfront.close();\n\t\t\tthis.onChange(path);\n\t\t}\n\t\tthis.rejected.clear();\n\t\tthis.demanding.clear();\n\t\tthis.settled.update((n) => n + 1);\n\t}\n}\n\ninterface Presented extends Advertised {\n\t/** See {@link Candidate.lost}. */\n\treadonly lost?: () => boolean;\n}\n\n/** What one announcement listing presents of the candidate table. */\ninterface ListingView {\n\t/** Where the absolute `path` presents, relative to the listing's root; undefined if nowhere. */\n\tkey(path: Path.Valid): Path.Valid | undefined;\n\t/** Every path the listing presents. */\n\tall(): Map<Path.Valid, Presented>;\n\t/** What the listing presents now where the absolute `path` {@link key}s, undefined if nothing. */\n\tat(path: Path.Valid): Presented | undefined;\n}\n\n// Which routes a listing reports relative to each listed prefix: those at or beneath it, those\n// that could serve it from above too (`covering`), or only those at or above it (`exact`).\ntype Reach = \"beneath\" | \"both\" | \"above\";\n\n// Navigation belongs to relative references, resolved before publication.\nfunction publishPath(path: Path.Valid): void {\n\tnameable(path);\n\tif (Path.parts(path).some((segment) => segment === \".\" || segment === \"..\")) {\n\t\tthrow new Error(\"broadcast path contains a navigation segment\");\n\t}\n}\n\n// A `*` stays out of every path while a prefix refuses one (so a pattern written where a\n// prefix belongs fails loudly): a broadcast no listing can root at, and that pre-0.22\n// subscribers read as a wildcard, is refused before it is published or watched.\nfunction nameable(path: Path.Valid): void {\n\tif (path.includes(\"*\")) throw new Error(\"path contains a `*`\");\n}\n\n// A broadcast created through the origin: its producer, and the handle the origin routes.\ninterface Created {\n\tproducer: broadcast.Producer;\n\tfront: broadcast.Consumer;\n}\n\n// End a created broadcast the origin no longer routes. Consumer handles never end a produced\n// broadcast, so the origin closes its producer; tracks already subscribed keep serving.\nfunction retire({ producer, front }: Created): void {\n\tfront.close();\n\tproducer.close();\n}\n\n/** Reactive backing state shared by origin producers and consumers. */\nclass OriginState {\n\t// Both tables decouple the application producing into the origin from the\n\t// connections serving or feeding it. Emptied once the origin closes, after which\n\t// `closed` refuses late writes.\n\t//\n\t// Created is what this endpoint publishes, keyed by exact path, announced or not.\n\t// Local is the announced subset, with its route in advertisedLocal: a broadcast\n\t// exists for nobody, here or at a peer, until it announces. Routes is the\n\t// advertisement table: prefixes a dynamic handle or a received session covers,\n\t// newest first. Local and routes stay separate so a session can never announce a\n\t// received entry back to a peer, which is what makes an origin shared by both\n\t// directions echo-free.\n\tcreated = new Map<Path.Valid, Created>();\n\tlocal = new Signal(new Map<Path.Valid, broadcast.Consumer>());\n\tadvertisedLocal = new Signal(new Map<Path.Valid, WireRoute>());\n\troutes = new Signal(new Map<Path.Valid, RouteEntry[]>());\n\n\t// The candidate table announcement listings share, patched at each path a write {@link changed}\n\t// while a listing is open, so an announce costs its own path however many routes the origin\n\t// holds. The first write with no listing open drops it, so does the origin closing, and the\n\t// next listing rebuilds it; until then a new listing reuses it as it stands, still current.\n\t#snapshot: Map<Path.Valid, readonly Candidate[]> | undefined;\n\t// Each open listing's changed paths it has yet to present.\n\t#listings = new Set<Set<Path.Valid>>();\n\n\t/**\n\t * Record that the candidates at `paths` changed. Every write to `local`, `advertisedLocal`,\n\t * `routes`, or a filed entry's route calls this after the write, before its notification lands.\n\t */\n\tchanged(paths: Iterable<Path.Valid>): void {\n\t\tif (this.#listings.size === 0) {\n\t\t\tthis.#snapshot = undefined;\n\t\t\treturn;\n\t\t}\n\t\tfor (const path of paths) {\n\t\t\tif (this.#snapshot) {\n\t\t\t\tconst list = this.#candidatesAt(path);\n\t\t\t\tif (list.length > 0) this.#snapshot.set(path, list);\n\t\t\t\telse this.#snapshot.delete(path);\n\t\t\t}\n\t\t\tfor (const pending of this.#listings) pending.add(path);\n\t\t}\n\t}\n\n\t/** Collect the paths {@link changed} from now on, for one listing, until the returned dispose. */\n\tlisten(): [Set<Path.Valid>, Dispose] {\n\t\tconst pending = new Set<Path.Valid>();\n\t\tthis.#listings.add(pending);\n\t\treturn [pending, () => this.#listings.delete(pending)];\n\t}\n\n\t/** Drop the candidate table along with the tables it reads, once the origin closes. */\n\tclearSnapshot(): void {\n\t\tthis.#snapshot = undefined;\n\t}\n\n\t/** The candidate table, shared by announcement listings, current as of every {@link changed} write. */\n\tsnapshot(): ReadonlyMap<Path.Valid, readonly Candidate[]> {\n\t\tthis.#snapshot ??= this.candidates();\n\t\treturn this.#snapshot;\n\t}\n\n\t/**\n\t * Every advertisement per prefix, most preferred first, without the `skip`ped entries.\n\t * Readers select after filtering by their scope, then drop what a higher epoch of the\n\t * same identity supersedes (see {@link firstEligible}), so a route they cannot see never\n\t * hides one they can.\n\t */\n\tcandidates(skip?: (entry: RouteEntry) => boolean): Map<Path.Valid, Candidate[]> {\n\t\tconst out = new Map<Path.Valid, Candidate[]>();\n\t\tconst routes = this.routes.peek();\n\t\tfor (const path of routes.keys()) {\n\t\t\tconst list = this.#candidatesAt(path, skip);\n\t\t\tif (list.length > 0) out.set(path, list);\n\t\t}\n\t\tfor (const path of this.local.peek().keys()) {\n\t\t\tif (!routes.has(path)) out.set(path, this.#candidatesAt(path));\n\t\t}\n\t\treturn out;\n\t}\n\n\t#candidatesAt(path: Path.Valid, skip?: (entry: RouteEntry) => boolean): Candidate[] {\n\t\tconst list: Candidate[] = [];\n\t\tfor (const entry of this.routes.peek().get(path) ?? []) {\n\t\t\tif (skip?.(entry)) continue;\n\t\t\tlist.push({\n\t\t\t\tref: entry.ref,\n\t\t\t\troute: entry.route.peek(),\n\t\t\t\texact: false,\n\t\t\t\tlost: () => entry.lost,\n\t\t\t});\n\t\t}\n\t\tconst front = this.local.peek().get(path);\n\t\tif (front) {\n\t\t\tlist.push({\n\t\t\t\tref: front,\n\t\t\t\troute: this.advertisedLocal.peek().get(path) ?? WireRoute.default,\n\t\t\t\texact: true,\n\t\t\t});\n\t\t}\n\t\t// Stable, so equal routes keep the table's newest-first order.\n\t\tif (list.length > 1) list.sort(compareCandidates);\n\t\treturn list;\n\t}\n\n\t// Originated advertisements sessions should forward: exact-path announces plus\n\t// originated dynamics. Ref is the local front or the route entry, so a\n\t// republish diffs as retract-then-announce and a re-price as another active.\n\t// Undefined once the origin closes, which ends the sessions publishing it.\n\toriginated = new Signal<Advertisements | undefined>(new Map());\n\n\t// Every open prefix route's server, advertised or not, so the origin's close ends each\n\t// handler loop even for a route that is hidden or withdrawn.\n\tservers = new Set<ServeState>();\n\n\t// Broadcasts materialized from a served route, keyed by exact path. Shared by every\n\t// request for the path so repeats reuse one accept; dropped (and closed) when the\n\t// providing route goes away or the last request releases it.\n\tmaterialized = new Map<\n\t\tPath.Valid,\n\t\t{\n\t\t\tentry: RouteEntry;\n\t\t\tfront: broadcast.Consumer;\n\t\t\tidentity?: Identity.Valid;\n\t\t\tepoch?: bigint;\n\t\t\tsource: object;\n\t\t\tclaim?: boolean;\n\t\t}\n\t>();\n\n\t// Paths consumers asked for without waiting for an announcement; attached sessions\n\t// answer them with blind subscriptions. Never announced: an answered request is assumed\n\t// present, not known live, so it must not read as an availability claim.\n\trequests = new Signal(new Map<Path.Valid, RequestSlot>());\n\n\t// Path-local wakeups for followers, which survive the end of a resolved identity.\n\t// A counter rather than the identity: the identity is a plain object, so two routes with\n\t// identical metadata compare equal, and a coalesced write could hide a takeover\n\t// or the origin closing. Watchers read the table and `closed` themselves when woken.\n\twatchers = new Map<Path.Valid, { users: number; version: Signal<number> }>();\n\n\t// Slots taken out of `requests` because another identity won their path, still open for\n\t// their handles. Nothing joins them, but they are refreshed with the table, so one ends\n\t// once its own identity stops serving, except retained answers from an in-place Restart.\n\tdetached = new Map<Path.Valid, Set<RequestSlot>>();\n\n\t// An in-place Restart forgets served answers for future requests, but resolved handles\n\t// retain their old broadcast without participating in routing or same-identity failover.\n\tretained = new WeakSet<RequestSlot>();\n\n\t// How many sessions are attached, and how many of those support broadcast discovery.\n\t// What backs the public `discovery` getter.\n\tsessions = new Signal({ total: 0, discovery: 0 });\n\n\t// The prefixes whose initial announcements a session is still delivering, counted. An\n\t// announcement stream overlapping one has not synced yet.\n\tsnapshots = new Signal(new Map<Path.Valid, number>());\n\n\t/** Hold an initial set in flight under the absolute `prefix` until the returned dispose. */\n\taddSnapshot(prefix: Path.Valid): Dispose {\n\t\tthis.snapshots.mutate((counts) => {\n\t\t\tcounts.set(prefix, (counts.get(prefix) ?? 0) + 1);\n\t\t});\n\t\tlet landed = false;\n\t\treturn () => {\n\t\t\tif (landed) return;\n\t\t\tlanded = true;\n\t\t\tthis.snapshots.mutate((counts) => {\n\t\t\t\tconst count = (counts.get(prefix) ?? 0) - 1;\n\t\t\t\tif (count > 0) counts.set(prefix, count);\n\t\t\t\telse counts.delete(prefix);\n\t\t\t});\n\t\t\tthis.settle(prefix);\n\t\t};\n\t}\n\n\t// The prefixes whose pending plain requests may have lost their last reason to wait.\n\t#unsettled = new Set<Path.Valid>();\n\n\t/**\n\t * Recheck the pending plain requests under the absolute `prefix` once the current task\n\t * settles, so a session releasing its initial set and downgrading reads as one step.\n\t */\n\tsettle(prefix: Path.Valid): void {\n\t\tif (this.#unsettled.size === 0) queueMicrotask(() => this.#settled());\n\t\tthis.#unsettled.add(prefix);\n\t}\n\n\t#settled(): void {\n\t\tconst requests = this.requests.peek();\n\t\tconst visited = new Set<WatchNode>();\n\t\tfor (const prefix of this.#unsettled) {\n\t\t\t// Every request watches its own path, so the watches beneath the prefix name exactly\n\t\t\t// the requests it can settle, without scanning the rest of the table.\n\t\t\tlet node: WatchNode | undefined = this.#watches;\n\t\t\tfor (const part of Path.parts(prefix)) node = node?.children.get(part);\n\t\t\tconst stack = node ? [node] : [];\n\t\t\tfor (let next = stack.pop(); next; next = stack.pop()) {\n\t\t\t\tif (visited.has(next)) continue;\n\t\t\t\tvisited.add(next);\n\t\t\t\t// Children first: settling a request may prune its node.\n\t\t\t\tstack.push(...next.children.values());\n\t\t\t\tconst slot = requests.get(next.path);\n\t\t\t\tif (slot) for (const absent of [...slot.absent]) absent();\n\t\t\t\t// A pinned slot waits detached.\n\t\t\t\tfor (const other of [...(this.detached.get(next.path) ?? [])]) {\n\t\t\t\t\tfor (const absent of [...other.absent]) absent();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.#unsettled.clear();\n\t}\n\n\t/** Whether every attached session discovers and none owes an initial set covering `path`. */\n\tsynced(path: Path.Valid): boolean {\n\t\tconst { total, discovery } = this.sessions.peek();\n\t\tif (total === 0 || discovery < total) return false;\n\t\tconst snapshots = this.snapshots.peek();\n\t\tfor (const prefix of coveringPrefixes(path)) if (snapshots.has(prefix)) return false;\n\t\treturn true;\n\t}\n\n\t// The literal heads readers are watching, counted, as a trie: announcement streams,\n\t// requests, and followers. Sessions ask their peer for announcements under the broadest of\n\t// these and nothing else, and hear each change to that covering set as it happens, so a\n\t// watch coming or going touches only its prefix and the watches directly above or below.\n\t#watches: WatchNode = { path: Path.empty(), children: new Map(), count: 0 };\n\t#interests = new Set<InterestListener>();\n\n\t/** Count `heads` as watched until the returned dispose runs. */\n\twatch(heads: readonly Path.Valid[]): Dispose {\n\t\tfor (const head of heads) this.#watchOne(head);\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\tfor (const head of heads) this.#unwatchOne(head);\n\t\t};\n\t}\n\n\t#watchOne(head: Path.Valid): void {\n\t\tlet node = this.#watches;\n\t\tfor (const part of Path.parts(head)) {\n\t\t\tlet child = node.children.get(part);\n\t\t\tif (!child) {\n\t\t\t\tchild = { path: Path.join(node.path, part as Path.Valid), parent: node, children: new Map(), count: 0 };\n\t\t\t\tnode.children.set(part, child);\n\t\t\t}\n\t\t\tnode = child;\n\t\t}\n\t\tif (node.count++ > 0 || coveredAbove(node)) return;\n\t\t// Opened before the narrower ones it covers are released, so nothing retracts.\n\t\tthis.#emit(node.path, true);\n\t\tfor (const narrower of frontier(node)) this.#emit(narrower, false);\n\t}\n\n\t#unwatchOne(head: Path.Valid): void {\n\t\tlet node: WatchNode | undefined = this.#watches;\n\t\tfor (const part of Path.parts(head)) node = node?.children.get(part);\n\t\tif (!node || node.count === 0) throw new Error(\"unwatched prefix released\");\n\t\tif (--node.count === 0 && !coveredAbove(node)) {\n\t\t\tfor (const narrower of frontier(node)) this.#emit(narrower, true);\n\t\t\tthis.#emit(node.path, false);\n\t\t}\n\t\t// Prune the segments nothing watches any more.\n\t\twhile (node.parent && node.count === 0 && node.children.size === 0) {\n\t\t\tnode.parent.children.delete(Path.parts(node.path).at(-1) ?? \"\");\n\t\t\tnode = node.parent;\n\t\t}\n\t}\n\n\t#emit(prefix: Path.Valid, wanted: boolean): void {\n\t\tfor (const listener of this.#interests) listener(prefix, wanted);\n\t}\n\n\t/**\n\t * Hear every change to the covering set of watches, starting with each prefix in it now.\n\t * Returns the unsubscribe.\n\t */\n\tinterests(listener: InterestListener): Dispose {\n\t\tthis.#interests.add(listener);\n\t\tif (this.#watches.count > 0) listener(this.#watches.path, true);\n\t\telse for (const prefix of frontier(this.#watches)) listener(prefix, true);\n\t\treturn () => this.#interests.delete(listener);\n\t}\n\n\tclosed = new Once<Error | null>();\n\n\t/**\n\t * Recompute what `path` resolves to, waking only the requests watching that path.\n\t *\n\t * A no-op for a path nobody requested, so the common case (publishing into a table\n\t * nobody is asking about) costs a map lookup. Call after any write that could change\n\t * the answer for a single path.\n\t */\n\trefresh(path: Path.Valid): void {\n\t\tthis.watchers.get(path)?.version.update((n) => n + 1);\n\t\tconst slot = this.requests.peek().get(path);\n\t\tconst detached = [...(this.detached.get(path) ?? [])];\n\t\tif (slot) this.reroute(path, slot);\n\t\tfor (const other of detached) this.reroute(path, other);\n\t\tthis.forget(path);\n\t}\n\n\t/** Release unanswered requests no wire waiter or local route still needs. */\n\tforget(path: Path.Valid): void {\n\t\tconst slot = this.requests.peek().get(path);\n\t\t// An empty slot remains joinable until its deferred teardown removes it.\n\t\tconst best = slot ? this.bestEntry(path) : undefined;\n\t\tconst wanted = best && !this.localWins(path, best) ? best.server : undefined;\n\t\tconst failovers = this.detached.get(path);\n\t\tlet held: Set<RouteEntry> | undefined;\n\t\tfor (const prefix of coveringPrefixes(path)) {\n\t\t\tfor (const entry of this.routes.peek().get(prefix) ?? []) {\n\t\t\t\tconst server = entry.server;\n\t\t\t\tconst pending = server?.pending.get(path);\n\t\t\t\tif (!server || !pending || server.demanding.has(path) || server === wanted) continue;\n\t\t\t\tif (failovers) {\n\t\t\t\t\t// Build once, only when pending work needs a failover ownership check.\n\t\t\t\t\tif (!held) {\n\t\t\t\t\t\theld = new Set();\n\t\t\t\t\t\tfor (const slot of failovers) {\n\t\t\t\t\t\t\tif (slot.handles.size > 0 && slot.failover) held.add(slot.failover);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (held.has(entry)) continue;\n\t\t\t\t}\n\t\t\t\tserver.forget(path, pending);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Recompute what `slot` resolves to. A slot never moves to another publisher identity: while\n\t * its own still serves and another wins `path`, it keeps what it resolved for the handles\n\t * already on it and the next request resolves the winner on a slot of its own; once its own\n\t * stops serving, it ends, except for an answer retained across an in-place Restart.\n\t */\n\treroute(path: Path.Valid, slot: RequestSlot): void {\n\t\tconst before = slot.route.peek()?.source;\n\t\tthis.#reroute(path, slot);\n\t\t// Only the same route still winning, with no takeover pending, is news for a read stranded\n\t\t// on it, as the Rust front unstrands only when the selected route is the serving one.\n\t\tconst after = slot.route.peek();\n\t\tif (before === undefined || after?.source !== before || after.pending || slot.failover) return;\n\t\tfor (const moved of [...slot.moved]) moved();\n\t}\n\n\t#reroute(path: Path.Valid, slot: RequestSlot): void {\n\t\tif (this.retained.has(slot)) return;\n\t\tconst current = slot.route.peek();\n\t\t// A pinned slot follows its identity before it resolves; once resolved, the detached branch\n\t\t// passes its source along, so losing its identity's last route ends it even while parked.\n\t\tif (slot.pin !== undefined && !current?.source) {\n\t\t\tthis.follow(path, slot, slot.pin, undefined);\n\t\t\treturn;\n\t\t}\n\t\t// A detached slot follows its identity once resolved, parked or not.\n\t\tif (current?.source && this.detached.get(path)?.has(slot)) {\n\t\t\tthis.follow(path, slot, current.identity, current.source);\n\t\t\treturn;\n\t\t}\n\t\tif (current?.front && current.source) {\n\t\t\tif (!this.serves(path, current.source, current.identity, false)) {\n\t\t\t\tthis.drop(path, slot, unroutable());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst next = this.identity(path);\n\t\t\tconst held = { ref: current.source, route: { identity: current.identity } };\n\t\t\tif (next && !sameIdentity(held, next)) {\n\t\t\t\tthis.retire(path, slot);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Another epoch of the identity wins: the slot's handles move onto it once it answers, but\n\t\t\t// nobody joins them meanwhile, since an older epoch never stands in for a newer one.\n\t\t\tif (next && (next.route.epoch ?? 0n) !== (current.epoch ?? 0n)) {\n\t\t\t\tthis.retire(path, slot);\n\t\t\t\tthis.follow(path, slot, current.identity, current.source);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tslot.route.set(this.route(path, slot));\n\t}\n\n\t/**\n\t * Keep `slot` on `identity` through its cheapest route, as Rust's lookup does whichever\n\t * identity wins `path`: a local broadcast announced under it, else its best route, each serving\n\t * the same bytes. A move to a route that has not answered yet keeps the front `source` gave\n\t * until it does. Without a route a resolved slot ends, and an unresolved one waits, its handles\n\t * ending once discovery syncs. Without an identity, nothing says another source serves the same\n\t * bytes, so the slot stays on `source` until it stops serving.\n\t */\n\tfollow(\n\t\tpath: Path.Valid,\n\t\tslot: RequestSlot,\n\t\tidentity: Identity.Valid | undefined,\n\t\tsource: object | undefined,\n\t): void {\n\t\t// A slot it follows records a pending takeover in `failover`, so one the slot was taken\n\t\t// out of the table with is stale.\n\t\tconst current = slot.route.peek();\n\t\tif (current?.pending) slot.route.set({ ...current, pending: false });\n\t\tif (identity === undefined) {\n\t\t\tif (source && this.serves(path, source, identity, true)) return;\n\t\t\tthis.drop(path, slot, unroutable());\n\t\t\treturn;\n\t\t}\n\t\t// A broadcast of the identity above `path` shadows its broader routes, as in Rust's lookup.\n\t\tconst skip: Skip = (claim, route) =>\n\t\t\troute.identity !== identity || (!(claim instanceof broadcast.Consumer) && !claim.server);\n\t\tconst entry = this.bestEntry(path, skip);\n\t\tconst local = this.local.peek().get(path);\n\t\tif (\n\t\t\tlocal &&\n\t\t\tthis.advertisedLocal.peek().get(path)?.identity === identity &&\n\t\t\tthis.localWins(path, entry, skip)\n\t\t) {\n\t\t\tslot.failover = undefined;\n\t\t\tif (source === local) return;\n\t\t\tthis.retain(path, slot, undefined);\n\t\t\tconst epoch = this.advertisedLocal.peek().get(path)?.epoch;\n\t\t\tslot.route.set({ front: local, identity, epoch, source: local, local: true });\n\t\t\treturn;\n\t\t}\n\t\tif (!entry?.server) {\n\t\t\tslot.failover = undefined;\n\t\t\tif (source) this.drop(path, slot, unroutable());\n\t\t\telse slot.route.set(undefined);\n\t\t\treturn;\n\t\t}\n\t\tif (entry.ref === source && current?.front !== undefined && current.front.closed.peek() === undefined) {\n\t\t\t// Already on the cheapest, still answering: a takeover still pending speaks for nobody.\n\t\t\tslot.failover = undefined;\n\t\t\treturn;\n\t\t}\n\t\t// An application's claim refuses a path this origin publishes, rather than ask its\n\t\t// handler for another job or hand out an answer it held from before: see\n\t\t// {@link ServeState.publishes}.\n\t\tif (entry.server.publishes(path)) {\n\t\t\tslot.failover = undefined;\n\t\t\tfor (const closed of slot.handles) refusedRequests.add(closed);\n\t\t\tthis.drop(path, slot, unroutable());\n\t\t\treturn;\n\t\t}\n\t\tconst served = entry.server.served.get(path);\n\t\tif (!served || served.closed.peek() !== undefined) {\n\t\t\t// Held by the slot, so the pending request outlives a forget.\n\t\t\tslot.failover = entry;\n\t\t\tentry.server.enqueue(path);\n\t\t\tif (!source) slot.route.set({ identity });\n\t\t\t// Its answer closed: readers park on the identity until the route answers again.\n\t\t\telse if (current?.front?.closed.peek() !== undefined) {\n\t\t\t\tslot.route.set({ identity, epoch: current?.epoch, source });\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tslot.failover = undefined;\n\t\tthis.retain(path, slot, served);\n\t\tconst { epoch, claimed } = entry.route.peek();\n\t\tslot.route.set({ front: served, identity, epoch, source: entry.ref, claim: claimed });\n\t}\n\n\t/**\n\t * Make `front` the session answer `slot` holds, closing the one it held unless the cache or\n\t * another detached slot shares it: a session serves one answer per path, so a pinned slot and\n\t * the path's own requests can take the same one.\n\t */\n\tretain(path: Path.Valid, slot: RequestSlot, front: broadcast.Consumer | undefined): void {\n\t\tconst previous = slot.retired;\n\t\tslot.retired = front;\n\t\tif (previous && previous !== front) this.closeUnheld(path, previous);\n\t}\n\n\t/** Close a session answer nothing at `path` holds any more: neither the cache nor a detached slot. */\n\tcloseUnheld(path: Path.Valid, front: broadcast.Consumer): void {\n\t\tif (this.materialized.get(path)?.front === front) return;\n\t\tfor (const slot of this.detached.get(path) ?? []) if (slot.retired === front) return;\n\t\tfront.close();\n\t}\n\n\t/**\n\t * Whether the identity `source` served under `identity` still serves `path`. Under an\n\t * identity any route of it does, unless `exact` asks for `source` itself; without one only\n\t * `source` does, since nothing says another serves the same bytes.\n\t */\n\tserves(path: Path.Valid, source: object, identity: Identity.Valid | undefined, exact: boolean): boolean {\n\t\tconst matches = (candidate: object) => candidate === source || (!exact && identity !== undefined);\n\t\tconst local = this.local.peek().get(path);\n\t\tconst advertised = this.advertisedLocal.peek().get(path);\n\t\tif (local && advertised && advertised.identity === identity && matches(local)) return true;\n\t\tfor (const [prefix, entries] of this.routes.peek()) {\n\t\t\tif (!Path.hasPrefix(prefix, path)) continue;\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (!entry.server || !admits(entry, path) || entry.route.peek().identity !== identity) continue;\n\t\t\t\tif (matches(entry.ref)) return true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** The publisher identity a request for `path` resolves through, when one serves it. */\n\tidentity(path: Path.Valid): Served | undefined {\n\t\tconst entry = this.bestEntry(path);\n\t\tconst local = this.local.peek().get(path);\n\t\tif (local && this.localWins(path, entry)) {\n\t\t\tconst advertised = this.advertisedLocal.peek().get(path);\n\t\t\treturn { ref: local, route: { identity: advertised?.identity, epoch: advertised?.epoch } };\n\t\t}\n\t\tif (!entry?.server) return undefined;\n\t\treturn { ref: entry.ref, route: entry.route.peek() };\n\t}\n\n\t/**\n\t * Take `slot` out of the table with what it resolved: its handles stay on that identity\n\t * until they close, and nothing joins it again.\n\t */\n\tretire(path: Path.Valid, slot: RequestSlot): void {\n\t\tthis.requests.mutate((map) => {\n\t\t\tif (map.get(path) === slot) map.delete(path);\n\t\t});\n\t\tlet detached = this.detached.get(path);\n\t\tif (!detached) {\n\t\t\tdetached = new Set();\n\t\t\tthis.detached.set(path, detached);\n\t\t}\n\t\tdetached.add(slot);\n\t\tconst cached = this.materialized.get(path);\n\t\tif (cached && cached.front === slot.route.peek()?.front) {\n\t\t\tthis.materialized.delete(path);\n\t\t\tslot.retired = cached.front;\n\t\t}\n\t}\n\n\t/** Preserve this route's resolved answers before its server resets for another identity. */\n\trestart(entry: RouteEntry): void {\n\t\tfor (const path of entry.server?.served.keys() ?? []) {\n\t\t\tconst joined = this.requests.peek().get(path);\n\t\t\tconst slots = [...(this.detached.get(path) ?? [])];\n\t\t\tif (joined) slots.push(joined);\n\t\t\tfor (const slot of slots) {\n\t\t\t\tconst current = slot.route.peek();\n\t\t\t\tif (\n\t\t\t\t\t!current?.front ||\n\t\t\t\t\tcurrent.front.closed.peek() !== undefined ||\n\t\t\t\t\tcurrent.source !== entry.ref ||\n\t\t\t\t\tthis.retained.has(slot)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tthis.retire(path, slot);\n\t\t\t\t// reset() releases the server's front; retain a separate owner even when no\n\t\t\t\t// request has read active yet and therefore no per-request clone exists.\n\t\t\t\tslot.retired = current.front.clone();\n\t\t\t\tslot.failover = undefined;\n\t\t\t\tthis.retained.add(slot);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Whether a plain request needs the non-discovery session's blind answer. */\n\tblind(slot: RequestSlot): boolean {\n\t\tif (slot.blind === 0) return false;\n\t\tconst { total, discovery } = this.sessions.peek();\n\t\treturn discovery < total;\n\t}\n\n\t/**\n\t * `entry` refused `path` with `err`: the request ends with `err`, even while another\n\t * source serves, since asking the next candidate would turn one refusal into a request\n\t * per candidate.\n\t */\n\trefuse(path: Path.Valid, entry: RouteEntry, err: Error): void {\n\t\t// A detached slot failing over to this route ends with its answer.\n\t\tfor (const other of [...(this.detached.get(path) ?? [])]) {\n\t\t\tif (other.failover === entry) {\n\t\t\t\tfor (const closed of other.handles) refusedRequests.add(closed);\n\t\t\t\tthis.drop(path, other, err);\n\t\t\t}\n\t\t}\n\t\tconst slot = this.requests.peek().get(path);\n\t\tif (!slot) return;\n\t\t// Only the route the request is waiting on speaks for it; one superseded by another\n\t\t// route or a local broadcast has a moot answer. Not for a handle pinned to the refusing\n\t\t// claim's identity while this origin publishes the path, though: that claim refuses every\n\t\t// request for the path (see ServeState.publishes), so it would refuse the handle's own.\n\t\tif (this.bestEntry(path) !== entry || this.localWins(path, entry)) {\n\t\t\tif (!entry.server?.publishes(path)) return;\n\t\t\tconst refused = entry.route.peek().identity;\n\t\t\tfor (const pinned of [...slot.pinned]) if (pinned.identity === refused) pinned.refuse(err);\n\t\t\treturn;\n\t\t}\n\t\tfor (const closed of slot.handles) refusedRequests.add(closed);\n\t\tthis.drop(path, slot, err);\n\t}\n\n\t/** End `slot` with `err`, wherever it is held: it leaves the table and every handle closes. */\n\tdrop(path: Path.Valid, slot: RequestSlot, err: Error): void {\n\t\tconst joined = this.requests.peek().get(path) === slot;\n\t\tif (joined) {\n\t\t\tthis.requests.mutate((map) => {\n\t\t\t\tmap.delete(path);\n\t\t\t});\n\t\t}\n\t\tthis.detach(path, slot);\n\t\tslot.failover = undefined;\n\t\tslot.answer?.close();\n\t\tslot.answer = undefined;\n\t\tslot.route.set(undefined);\n\t\tif (joined) this.releaseMaterialized(path);\n\t\tthis.forget(path);\n\t\tfor (const closed of slot.handles) closed.set(err);\n\t\tslot.handles.clear();\n\t}\n\n\t/** Forget a detached slot, releasing the front it took. */\n\tdetach(path: Path.Valid, slot: RequestSlot): void {\n\t\tconst detached = this.detached.get(path);\n\t\tif (!detached?.delete(slot)) return;\n\t\tif (detached.size === 0) this.detached.delete(path);\n\t\tthis.retain(path, slot, undefined);\n\t}\n\n\t/**\n\t * Recompute every open request covered by `prefix`, after a route was inserted or\n\t * removed there: a route covers many paths, so a single-path refresh is not enough.\n\t * Every materialized broadcast belongs to an open request, so rerouting them also\n\t * releases a retracted route's session subscription even when nothing reads it again.\n\t */\n\trefreshPrefix(prefix: Path.Valid): void {\n\t\tfor (const [path, watch] of this.watchers) if (Path.hasPrefix(prefix, path)) watch.version.update((n) => n + 1);\n\t\tconst detached = [...this.detached].map(([path, slots]) => [path, [...slots]] as const);\n\t\tfor (const [path, slot] of [...this.requests.peek()]) {\n\t\t\tif (Path.hasPrefix(prefix, path)) this.reroute(path, slot);\n\t\t}\n\t\tfor (const [path, slots] of detached) {\n\t\t\tif (!Path.hasPrefix(prefix, path)) continue;\n\t\t\tfor (const slot of slots) this.reroute(path, slot);\n\t\t}\n\t\tfor (const path of this.requests.peek().keys()) if (Path.hasPrefix(prefix, path)) this.forget(path);\n\t\t// Read again: a slot rerouting may have retired into it, releasing what it waited on.\n\t\tfor (const path of this.detached.keys()) if (Path.hasPrefix(prefix, path)) this.forget(path);\n\t}\n\n\t/**\n\t * Recompute `path` and every request beneath it, after a broadcast there changed: as a claim\n\t * on its subtree it can shadow or supersede what those resolve to. Found through the watch\n\t * trie, which holds every request's path, so a publish costs its own subtree rather than a\n\t * scan of every open request.\n\t */\n\trefreshBeneath(path: Path.Valid): void {\n\t\tthis.refresh(path);\n\t\tlet node: WatchNode | undefined = this.#watches;\n\t\tfor (const part of Path.parts(path)) node = node?.children.get(part);\n\t\tif (!node) return;\n\t\t// Collected first: a reroute can end a request, which prunes the trie.\n\t\tconst beneath: Path.Valid[] = [];\n\t\tconst stack = [...node.children.values()];\n\t\tfor (let next = stack.pop(); next; next = stack.pop()) {\n\t\t\tif (next.count > 0) beneath.push(next.path);\n\t\t\tstack.push(...next.children.values());\n\t\t}\n\t\tfor (const covered of beneath) this.refresh(covered);\n\t}\n\n\t/** Rebuild the publisher-facing originated table after an advertisement write. */\n\trebuildOriginated(): void {\n\t\tif (this.closed.peek() !== undefined) {\n\t\t\tthis.originated.set(undefined);\n\t\t\treturn;\n\t\t}\n\t\t// A local broadcast and an originated dynamic at one path compete on cost, as they do for requests.\n\t\tthis.originated.set(this.candidates(received));\n\t}\n\n\t/**\n\t * Release the materialized broadcast for `path`, once its last request is gone: the\n\t * cache exists to share one session subscription between requests, not to outlive\n\t * them.\n\t */\n\treleaseMaterialized(path: Path.Valid): void {\n\t\tconst cached = this.materialized.get(path);\n\t\tif (!cached) return;\n\t\tthis.materialized.delete(path);\n\t\tthis.closeUnheld(path, cached.front);\n\t}\n\n\t/**\n\t * The best route entry among the most specific claims covering `path`, ignoring skipped ones.\n\t * An announced local broadcast published above `path` is one of those claims: it serves only\n\t * its own path, so a tier-mate that serves `path` outranks it, but it still supersedes an older\n\t * epoch of its identity and shadows broader claims, and undefined means it won. The local\n\t * broadcast at `path` itself competes through {@link localWins}. Mirrors\n\t * `RouteTable::best_route` in rs/moq-net.\n\t */\n\tbestEntry(path: Path.Valid, skip?: Skip): RouteEntry | undefined {\n\t\tconst routes = this.routes.peek();\n\t\tconst local = this.local.peek();\n\t\tconst advertised = this.advertisedLocal.peek();\n\t\tconst filed: Filed<RouteEntry | broadcast.Consumer>[] = [];\n\t\tconst exact = Path.parts(path).length;\n\t\tlet depth = exact;\n\t\tfor (const prefix of coveringPrefixes(path)) {\n\t\t\tlet order = 0;\n\t\t\tfor (const entry of routes.get(prefix) ?? []) {\n\t\t\t\tconst route = entry.route.peek();\n\t\t\t\tif (!admits(entry, path) || skip?.(entry, route)) continue;\n\t\t\t\tfiled.push({\n\t\t\t\t\tprefix,\n\t\t\t\t\tdepth,\n\t\t\t\t\torder: order++,\n\t\t\t\t\tarrival: arrival(entry.ref),\n\t\t\t\t\tcandidate: entry,\n\t\t\t\t\troute,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst front = depth < exact ? local.get(prefix) : undefined;\n\t\t\tconst route = front && advertised.get(prefix);\n\t\t\tif (front && route && !skip?.(front, route))\n\t\t\t\tfiled.push({ prefix, depth, order, arrival: arrival(front), candidate: front, route });\n\t\t\tdepth--;\n\t\t}\n\t\tconst own = local.has(path) ? advertised.get(path) : undefined;\n\t\tconst best = bestOfTier(path, filed, {\n\t\t\tothers: (specificity) => (own && specificity === exact ? [own] : []),\n\t\t\tserves: (entry) => !(entry.candidate instanceof broadcast.Consumer),\n\t\t})?.candidate;\n\t\treturn best instanceof broadcast.Consumer ? undefined : best;\n\t}\n\n\t/**\n\t * Whether the announced local broadcast at `path` wins over `entry`, the best route a\n\t * session or dynamic handle announced there. They compare as any two routes do: an\n\t * identified route strictly cheaper than the local one wins, and the local broadcast wins a\n\t * tie. A route at a shorter prefix never competes, since the most specific prefix wins\n\t * outright. A higher epoch of the local broadcast's identity at the path supersedes it, among\n\t * the routes `skip` leaves, which must be what `entry` was chosen from. False when nothing is\n\t * announced locally at `path`.\n\t */\n\tlocalWins(path: Path.Valid, entry: RouteEntry | undefined, skip?: Skip): boolean {\n\t\tconst local = this.advertisedLocal.peek().get(path);\n\t\tif (!local || !this.local.peek().has(path)) return false;\n\t\tif (!entry || !this.routes.peek().get(path)?.includes(entry)) return true;\n\t\tconst remote = entry.route.peek();\n\t\t// A broadcast exactly here shadows every broader claim shown here, whatever its epoch or\n\t\t// cost: the best claim is that broad only when each one is.\n\t\tif ((remote.above ?? 0n) > 0n) return true;\n\t\t// Within one identity only the higher epoch is eligible, however cheap the other is, so\n\t\t// any route at the path the request could take supersedes the local broadcast, not only\n\t\t// the best one.\n\t\tconst rivals = (this.routes.peek().get(path) ?? [])\n\t\t\t.filter((candidate) => candidate.scope.matches(path))\n\t\t\t.map((candidate) => [candidate, candidate.route.peek()] as const)\n\t\t\t.filter(([candidate, rival]) => !(skip?.(candidate, rival) ?? false))\n\t\t\t.map(([, rival]) => rival)\n\t\t\t// A broader claim shown here competes with nothing the local broadcast competes with.\n\t\t\t.filter((rival) => (rival.above ?? 0n) === 0n);\n\t\tif (superseded(local, rivals)) return false;\n\t\tif (superseded(remote, [local])) return true;\n\t\treturn compareRoutes(local, remote) <= 0;\n\t}\n\n\t/**\n\t * Whether a claim of `identity` serving `path` refuses a new request pinned to it, because\n\t * this origin publishes the path under another identity (see {@link publishes}).\n\t */\n\trefuses(path: Path.Valid, identity: Identity.Valid): boolean {\n\t\tconst skip: Skip = (claim, route) =>\n\t\t\troute.identity !== identity || (!(claim instanceof broadcast.Consumer) && !claim.server);\n\t\treturn this.bestEntry(path, skip)?.server?.publishes(path) ?? false;\n\t}\n\n\t/**\n\t * Whether an announced local broadcast of another identity than `identity` wins `path`, so a\n\t * request reaching a claim of `identity` for it can only be pinned to that identity. Another\n\t * epoch of `identity` continues its stream, so it does not count. Mirrors the Rust `publishes`.\n\t */\n\tpublishes(path: Path.Valid, identity: Identity.Valid | undefined): boolean {\n\t\tconst local = this.advertisedLocal.peek().get(path);\n\t\tif (!local || local.identity === identity) return false;\n\t\treturn this.localWins(path, this.bestEntry(path));\n\t}\n\n\t/**\n\t * What `path` resolves to: an announced local publish, a broadcast materialized from\n\t * the best covering route, or the blind answer.\n\t *\n\t * Materialization is lazy and cached per path: the first request under a route opens\n\t * the providing session's subscription and repeats share it. A better route is made\n\t * before the old one breaks: the current front keeps serving until the new route\n\t * answers (then swaps) or refuses (then the request ends). A retracted route swaps at once.\n\t */\n\troute(path: Path.Valid, slot: Pick<RequestSlot, \"answer\">): Resolution | undefined {\n\t\tconst entry = this.bestEntry(path);\n\t\tconst local = this.local.peek().get(path);\n\t\tif (local && this.localWins(path, entry)) {\n\t\t\t// Nothing reads a remote front the local broadcast replaced, so close its session subscription.\n\t\t\tthis.releaseMaterialized(path);\n\t\t\tconst advertised = this.advertisedLocal.peek().get(path);\n\t\t\treturn {\n\t\t\t\tfront: local,\n\t\t\t\tidentity: advertised?.identity,\n\t\t\t\tepoch: advertised?.epoch,\n\t\t\t\tsource: local,\n\t\t\t\tlocal: true,\n\t\t\t};\n\t\t}\n\n\t\tlet cached = this.materialized.get(path);\n\t\tif (cached && cached.front.closed.peek() !== undefined) {\n\t\t\tthis.materialized.delete(path);\n\t\t\tcached = undefined;\n\t\t}\n\t\tconst identity = entry?.route.peek().identity;\n\t\tconst epoch = entry?.route.peek().epoch;\n\t\tif (cached && cached.entry === entry && cached.identity === identity && cached.epoch === epoch) return cached;\n\t\tif (!entry?.server) {\n\t\t\tthis.releaseMaterialized(path);\n\t\t\treturn slot.answer ? { front: slot.answer } : undefined;\n\t\t}\n\n\t\tconst served = entry.server.served.get(path);\n\t\tif (served && served.closed.peek() === undefined) {\n\t\t\tconst claim = entry.route.peek().claimed;\n\t\t\tconst resolution = { entry, front: served, identity, epoch, source: entry.ref, claim };\n\t\t\tthis.materialized.set(path, resolution);\n\t\t\tif (cached && cached.front !== served) this.closeUnheld(path, cached.front);\n\t\t\treturn resolution;\n\t\t}\n\n\t\tentry.server.enqueue(path);\n\t\t// The same identity and epoch over another route: the old front serves until the new one\n\t\t// answers. An older epoch never stands in for a newer one.\n\t\tconst kept = cached?.identity === identity && (cached?.epoch ?? 0n) === (epoch ?? 0n) ? cached : undefined;\n\t\treturn {\n\t\t\tfront: kept?.front,\n\t\t\tidentity,\n\t\t\tepoch: kept?.epoch,\n\t\t\tsource: kept?.source,\n\t\t\tclaim: kept?.claim,\n\t\t\tpending: true,\n\t\t};\n\t}\n}\n\n/**\n * The read side of an origin, borrowed: resolve broadcasts by path and watch what is\n * available, without publishing into it or owning its lifecycle.\n *\n * Code that only reads an origin should accept this type. {@link Consumer} implements it\n * and {@link Table} extends it, so `producer.consume()`, a borrowed table, and a structural\n * equivalent all fit.\n *\n * @public\n */\nexport interface Reader {\n\t/** Settles once the origin closes; see {@link Consumer.closed}. */\n\treadonly closed: GetPromise<Error | null>;\n\n\t/** Whether every attached session announces into the table; see {@link Consumer.discovery}. */\n\treadonly discovery: Getter<boolean | undefined>;\n\n\t/** Resolve one publisher identity at `path`; see {@link Consumer.request}. */\n\trequest(path: Path.Valid, options?: RequestOptions): Requesting;\n\n\t/** Follow `path` across publisher identities; see {@link Consumer.follow}. */\n\tfollow(path: Path.Valid, options?: FollowOptions): Following;\n\n\t/** The available broadcasts at or beneath `prefix`, as a live stream; see {@link Consumer.announced}. */\n\tannounced(prefix?: Path.Valid, options?: Announce.Options): Announce.Consumer;\n}\n\n/**\n * A non-owning handle on an origin: publish into it and read it, without its lifecycle.\n *\n * What a shared connection lends out. {@link Producer} implements it, so code that is\n * handed an origin rather than owning one should accept this type: closing the origin\n * stays the owner's alone, and a borrower cannot express it. A borrower that only reads\n * should accept {@link Reader} instead, so `producer.consume()` fits too.\n *\n * @public\n */\nexport interface Table extends Reader {\n\t/** Create a route at exactly `path`, owning a new broadcast; see {@link Producer.route}. */\n\troute(path: Path.Valid, options?: RouteOptions): Route;\n\n\t/** Claim `prefix`, yielding the requests beneath it; see {@link Producer.claim}. */\n\tclaim(prefix: Path.Valid, options?: RouteOptions): Claim;\n}\n\n/**\n * How an application advertises a {@link Route} or {@link Claim}: its visibility at creation,\n * its price, its credential, and, rarely, a stable identity.\n *\n * The default announces at once, at cost 0, under the session's scope, serving a fresh random\n * identity minted when the route or claim is created.\n */\nexport interface RouteOptions {\n\t/**\n\t * Create the route hidden: it exists for nobody until it announces. For a\n\t * publisher that fills its catalog first, or answers a negotiation, before readers may find it.\n\t */\n\thidden?: boolean;\n\t/**\n\t * What pulling content via this route costs: lower wins among routes covering the same\n\t * prefix and anonymity. A publisher prices content it already produces at zero, and content\n\t * it would have to start producing on demand higher.\n\t */\n\tcost?: Cost;\n\t/**\n\t * The credential the advertising request carries, from `auth.add()`. Only a session built\n\t * on the handle that issued it presents it, as the token on its moq-transport\n\t * PUBLISH_NAMESPACE; every other session advertises the route under its own scope.\n\t */\n\tauth?: Credential;\n\t/**\n\t * Serve this stable identity `id` at `epoch`, in place of a freshly minted one.\n\t *\n\t * Only for a publisher that continues the identity's key space across restarts,\n\t * announcing a higher `epoch` each time, such as a counter persisted on disk. Readers\n\t * stitch every route of one identity together, so a publisher that restarts its group\n\t * keys under an old identity splices unrelated groups into their tracks. The highest\n\t * epoch wins over every older one of the identity, cheaper or not. Naming an identity grants\n\t * nothing: publishing still needs the path's grant.\n\t */\n\tidentity?: { id: Identity.Valid; epoch: bigint };\n}\n\n/** Options for resolving one publisher identity with {@link Consumer.request}. */\nexport interface RequestOptions {\n\t/** Refuse a different publisher identity, including an asynchronous answer or a retry. */\n\tidentity?: Identity.Valid;\n}\n\n/** Options for following a broadcast path with {@link Consumer.follow}. */\nexport interface FollowOptions {\n\t/** Follow only this publisher identity, waiting for it to return across gaps. */\n\tidentity?: Identity.Valid;\n}\n\n// Route constructors, assigned in the classes' static blocks so no class exposes one.\nlet makeRoute: (broadcast: broadcast.Producer, control: RouteControl) => Route;\nlet makeClaim: (control: RouteControl, requested: () => AsyncIterableIterator<Request>) => Claim;\nlet exactRoute: (producer: Producer, path: Path.Valid, options: RouteOptions, request: Request) => Route;\n\n/**\n * The write side of an origin: route broadcasts into it by path and advertise them.\n *\n * Independent of any connection. A connection given this origin (via its `publish` option)\n * announces and serves the table's originated advertisements for as long as the session\n * lasts; the broadcasts themselves live until their producer closes or {@link close} tears\n * the origin down. A reconnecting session re-announces the table on each attach, so\n * advertisements made while offline surface on the next connection.\n *\n * Create a {@link route} at a path and fill its broadcast; create it hidden and\n * {@link Route.announce} it once its first tracks exist, since nobody can see or reach a hidden\n * route. To publish broadcasts on demand instead, {@link claim} a prefix and answer the\n * requests beneath it.\n *\n * @public\n */\nexport class Producer implements Table {\n\t#state = new OriginState();\n\t#scope = Scope.all;\n\t#priority = 0;\n\t#requests?: Getter<ReadonlyMap<Path.Valid, RequestSlot>>;\n\n\t// Set on a derived handle, which borrows the origin: what it registered, so its close\n\t// releases only that. The owner has none, since its close ends the whole origin.\n\t#borrowed?: { releases: Set<Dispose>; closed: boolean };\n\n\t// The reader backing the passthroughs, so holding a Producer never requires the\n\t// consume().x() stutter for everyday reads. One object, so `discovery` keeps its\n\t// identity across reads.\n\t#reader = makeConsumer(this.#state, this.#scope);\n\n\tstatic {\n\t\texactRoute = (producer, path, options, request) => producer.#exact(path, options, request);\n\t}\n\n\tconstructor() {\n\t\tconst thisProducer = this;\n\t\tregisterWire(this, {\n\t\t\treceive: (prefix, route) => this.#receive(prefix, route),\n\t\t\tinterests: (listener) => {\n\t\t\t\tif (this.#borrowed?.closed) return () => {};\n\t\t\t\t// What the listener currently wants, so a derived handle's close can retract it\n\t\t\t\t// and its session stops asking the peer for announcements nothing will land.\n\t\t\t\tconst wants = new Map<Path.Valid, number>();\n\t\t\t\tconst unlisten = this.#state.interests((absolute, wanted) => {\n\t\t\t\t\tfor (const prefix of this.#scope.interests(absolute)) {\n\t\t\t\t\t\tconst count = (wants.get(prefix) ?? 0) + (wanted ? 1 : -1);\n\t\t\t\t\t\tif (count > 0) wants.set(prefix, count);\n\t\t\t\t\t\telse wants.delete(prefix);\n\t\t\t\t\t\tlistener(prefix, wanted);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn this.#hold(() => {\n\t\t\t\t\tunlisten();\n\t\t\t\t\tfor (const [prefix, count] of wants) for (let i = 0; i < count; i++) listener(prefix, false);\n\t\t\t\t});\n\t\t\t},\n\t\t\t// A peer's route holding a `*`, or one that overflows the path bounds once rooted, is\n\t\t\t// skipped: `receive` would refuse it (see `nameable`), and that throw would end\n\t\t\t// discovery for the whole session.\n\t\t\taccepts: (prefix) => {\n\t\t\t\tif (prefix.includes(\"*\")) return false;\n\t\t\t\tconst path = Path.tryJoin(this.#scope.root, prefix);\n\t\t\t\t// The wire still counts escaped `/`s, which `receive` checks when it encodes the path.\n\t\t\t\treturn path !== undefined && Path.check(path) === undefined && this.#scope.overlaps(path);\n\t\t\t},\n\t\t\tattach: (discovery) => this.#attach(discovery),\n\t\t\tsnapshot: (prefix) =>\n\t\t\t\tthis.#borrowed?.closed ? () => {} : this.#hold(this.#state.addSnapshot(this.#scope.prefix(prefix))),\n\t\t\tget requests() {\n\t\t\t\tif (thisProducer.#scope === Scope.all) return thisProducer.#state.requests;\n\t\t\t\tthisProducer.#requests ??= new Derived([thisProducer.#state.requests], (requests) =>\n\t\t\t\t\tthisProducer.#scope.projectPaths(requests),\n\t\t\t\t);\n\t\t\t\treturn thisProducer.#requests;\n\t\t\t},\n\t\t\tchanged: () => this.#changed(),\n\t\t\tblind: (slot) => this.#state.blind(slot as RequestSlot),\n\t\t\tanswer: (path, front) => this.#answer(this.#scope.path(path), front),\n\t\t\troutes: (path) => wireOf(this.#reader).routes(path),\n\t\t\tget priority() {\n\t\t\t\treturn thisProducer.#priority;\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Narrow this handle to `prefixes` beneath `root`, presenting paths relative to that root.\n\t * Each prefix covers its whole subtree. The result borrows the origin; see {@link close}.\n\t */\n\tscope(root: Path.Valid, prefixes: Path.Prefixes): Producer {\n\t\tif (this.#borrowed?.closed) throw new Error(\"origin handle is closed\");\n\t\treturn this.#derive(this.#scope.narrow(root, prefixes), this.#priority);\n\t}\n\n\t/**\n\t * Rank the link a session given this handle as its `consume` origin lands its routes\n\t * through: higher wins, and every handle starts at the neutral 0. An integer from -128 to 127.\n\t *\n\t * Only an identity's newest epoch is eligible, but among eligible routes priority decides\n\t * before cost, so links to different operators rank by this instead of comparing their\n\t * prices. On moq-lite-07 a route ranks by the lowest priority of any link on its path. The\n\t * result borrows the origin, as {@link scope}'s does, and its own derived handles keep its\n\t * priority.\n\t */\n\twithPriority(priority: number): Producer {\n\t\tif (this.#borrowed?.closed) throw new Error(\"origin handle is closed\");\n\t\tif (!Number.isInteger(priority) || priority < -128 || priority > 127) {\n\t\t\tthrow new RangeError(\"origin priority must be an integer from -128 to 127\");\n\t\t}\n\t\treturn this.#derive(this.#scope, priority);\n\t}\n\n\t#derive(scope: Scope, priority: number): Producer {\n\t\tconst producer = new Producer();\n\t\tproducer.#state = this.#state;\n\t\tproducer.#scope = scope;\n\t\tproducer.#priority = priority;\n\t\tproducer.#reader = makeConsumer(this.#state, scope);\n\t\tproducer.#borrowed = { releases: new Set(), closed: false };\n\t\treturn producer;\n\t}\n\n\t/**\n\t * Settles once the origin closes: `null` on a clean close, or the abort {@link Error}.\n\t * Peek it synchronously (`undefined` while open), observe it reactively, or `await` it.\n\t */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#state.closed;\n\t}\n\n\t/**\n\t * Create a route at exactly `path`, owning a new broadcast to fill.\n\t *\n\t * This is how local content enters an origin. Fill the broadcast through\n\t * {@link Route.broadcast}. The route serves a fresh random identity, minted here and kept\n\t * for its lifetime, across {@link Route.withdraw} and {@link Route.announce}, since its\n\t * keys continue: a new route is a new stream that never splices into an old one. A\n\t * publisher that continues one key space across restarts may name a stable identity\n\t * instead ({@link RouteOptions.identity}).\n\t *\n\t * Announced at once unless created {@link RouteOptions.hidden | hidden}. A hidden route\n\t * exists for nobody until {@link Route.announce}: announce streams skip it and a request\n\t * for its path finds nothing, on this origin exactly as at a peer. Create it hidden when\n\t * the tracks a subscriber needs first, such as a catalog, are not there yet. To serve paths\n\t * on demand without publishing each one, use {@link claim}.\n\t *\n\t * Closing the route retracts it and closes its broadcast, and so does closing the\n\t * broadcast. Creating a path again supersedes the previous route: the origin retracts it\n\t * and closes its broadcast, and tracks already subscribed keep serving until they end. At\n\t * the same identity, a local broadcast competes on cost and wins ties.\n\t */\n\troute(path: Path.Valid, options: RouteOptions = {}): Route {\n\t\treturn this.#exact(path, options);\n\t}\n\n\t/** An exact route at `path`, answering `request` on its first announce when it is a job's. */\n\t#exact(path: Path.Valid, options: RouteOptions, request?: Request): Route {\n\t\tpath = this.#scope.path(path);\n\t\tif (this.#borrowed?.closed) throw new Error(\"origin handle is closed\");\n\t\tpublishPath(path);\n\t\tif (this.#state.closed.peek() !== undefined) throw new Error(\"origin is closed\");\n\t\tconst created = this.#state.created;\n\t\t// Normalized first, so a bad cost throws before anything is created.\n\t\tlet info = WireRoute.normalize({\n\t\t\tidentity: options.identity?.id ?? Identity.random(),\n\t\t\tepoch: options.identity?.epoch ?? 0n,\n\t\t\tcost: options.cost,\n\t\t\tauth: options.auth,\n\t\t});\n\t\t// A job at its claim's own prefix ranks in the claim's tier, cost first: priced above the\n\t\t// claim, it would lose its path to the claim, which would ask for another job.\n\t\tconst claim = request && jobServer(request).prefix === path ? jobServer(request) : undefined;\n\t\tif (claim?.exceeds(info.cost)) {\n\t\t\trejectJob(request as Request, unroutable());\n\t\t\tthrow unroutable();\n\t\t}\n\n\t\tconst producer = new broadcast.Producer();\n\t\thooks.stampPath(producer, path);\n\t\tconst front = producer.consume();\n\t\tconst announced = () => this.#state.local.peek().get(path) === front;\n\t\tconst retract = () => this.#retractExact(path, front);\n\t\tconst entry = { producer, front };\n\t\tconst previous = created.get(path);\n\t\tcreated.set(path, entry);\n\t\tif (previous) {\n\t\t\tthis.#retractExact(path, previous.front);\n\t\t\tretire(previous);\n\t\t}\n\n\t\t// The request a job's route releases when it first announces.\n\t\tlet pending = request;\n\t\tconst priced = () => (announced() ? info.cost : undefined);\n\t\tclaim?.jobs.add(priced);\n\t\t// Drop the route when its broadcast closes, unless a recreate already replaced it: a\n\t\t// stale broadcast closing must not unpublish the live one. Clearing `created` also stops\n\t\t// a later announce. A job's unanswered request can never be answered now.\n\t\tconst release = this.#hold(() => {\n\t\t\tstop();\n\t\t\tretract();\n\t\t\tclaim?.jobs.delete(priced);\n\t\t\tif (created.get(path) === entry) created.delete(path);\n\t\t\tretire(entry);\n\t\t\tconst job = pending;\n\t\t\tpending = undefined;\n\t\t\tif (job) rejectJob(job, unroutable());\n\t\t});\n\t\t// Synchronous, so a request made right after the broadcast closes finds it gone.\n\t\tconst stop = hooks.onClosed(producer, release);\n\n\t\tconst announce = () => {\n\t\t\tif (producer.closed.peek() !== undefined) throw new Error(\"broadcast is closed\");\n\t\t\tconst job = pending;\n\t\t\tif (!job) {\n\t\t\t\tif (claim?.exceeds(info.cost)) throw unroutable();\n\t\t\t\tthis.#advertiseExact(path, front, info);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpending = undefined;\n\t\t\ttry {\n\t\t\t\t// A request released meanwhile can never be answered, so this route never announces.\n\t\t\t\tif (!jobPending(job) || claim?.exceeds(info.cost)) throw unroutable();\n\t\t\t\tthis.#advertiseExact(path, front, info);\n\t\t\t} catch (err) {\n\t\t\t\trelease();\n\t\t\t\trejectJob(job, err instanceof Error ? err : new Error(String(err)));\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\t// After the route lands, so a requester the release sends back resolves the path onto it.\n\t\t\treleaseJob(job);\n\t\t};\n\t\tconst change = (next: WireRoute) => {\n\t\t\tif (producer.closed.peek() !== undefined) throw new Error(\"broadcast is closed\");\n\t\t\tif (this.#state.closed.peek() !== undefined) throw new Error(\"origin is closed\");\n\t\t\tif (next.cost !== info.cost && claim?.exceeds(next.cost)) throw unroutable();\n\t\t\tinfo = next;\n\t\t\tif (announced()) this.#advertiseExact(path, front, info);\n\t\t};\n\n\t\tconst route = makeRoute(producer, {\n\t\t\tidentity: () => info.identity as Identity.Valid,\n\t\t\tannounce,\n\t\t\twithdraw: retract,\n\t\t\tannounced,\n\t\t\tchange: (update) => change(WireRoute.normalize({ ...info, ...update })),\n\t\t\tclose: release,\n\t\t\tend: release,\n\t\t\tinfo: () => (announced() ? this.#state.advertisedLocal.peek().get(path) : undefined),\n\t\t\tupdate: (next) => {\n\t\t\t\tconst named = WireRoute.normalize(next);\n\t\t\t\t// Refused before it is kept, so a refused price never lingers for a later change.\n\t\t\t\tif (claim?.exceeds(named.cost)) throw unroutable();\n\t\t\t\tinfo = named.identity === undefined ? { ...named, identity: info.identity, epoch: info.epoch } : named;\n\t\t\t\tannounce();\n\t\t\t},\n\t\t});\n\t\tif (!options.hidden) announce();\n\t\treturn route;\n\t}\n\n\t#advertiseExact(path: Path.Valid, front: broadcast.Consumer, route: WireRoute): void {\n\t\tif (this.#state.closed.peek() !== undefined) throw new Error(\"origin is closed\");\n\t\tif (this.#state.created.get(path)?.front !== front) throw new Error(\"broadcast is closed\");\n\t\t// Both maps move together, so every reader sees the broadcast and its route at once.\n\t\tthis.#state.local.mutate((broadcasts) => {\n\t\t\tbroadcasts.set(path, front);\n\t\t});\n\t\tthis.#state.advertisedLocal.mutate((advertised) => {\n\t\t\tadvertised.set(path, route);\n\t\t});\n\t\tthis.#state.changed([path]);\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refreshBeneath(path);\n\t}\n\n\t#retractExact(path: Path.Valid, front: broadcast.Consumer): void {\n\t\tif (this.#state.local.peek().get(path) !== front) return;\n\t\tthis.#state.local.mutate((broadcasts) => {\n\t\t\tbroadcasts.delete(path);\n\t\t});\n\t\tthis.#state.advertisedLocal.mutate((advertised) => {\n\t\t\tadvertised.delete(path);\n\t\t});\n\t\tthis.#state.changed([path]);\n\t\tthis.#state.rebuildOriginated();\n\t\tthis.#state.refreshBeneath(path);\n\t}\n\n\t/**\n\t * Claim `prefix`, yielding the requests beneath it.\n\t *\n\t * A route is always a prefix on the wire: a claim covers `prefix` and every path beneath it\n\t * (the empty prefix claims every path). A service that only serves some of them advertises\n\t * the covering prefix and rejects the rest as they are requested; consumers filter\n\t * announced paths locally. The claim is priced, credentialed and shown like an exact\n\t * route, and forwarded by sessions while it is visible.\n\t *\n\t * A consumer resolving a path under it that no announced local broadcast wins is handed to\n\t * {@link Claim.requested} as a {@link Request}: answer it by serving a broadcast already held\n\t * ({@link Request.serve}), under this claim's identity, or by creating the path's own exact\n\t * route ({@link Request.route}), a job. The claim keeps its identity, minted unless\n\t * {@link RouteOptions.identity} names one, for as long as it lives: each job's exact route\n\t * carries its own, so a job that ends and restarts is a new stream at its path without\n\t * touching the claim or its other paths. A publisher that knows its broadcasts creates each\n\t * one's exact {@link route} instead, so subscribers can enumerate them.\n\t */\n\tclaim(prefix: Path.Valid, options: RouteOptions = {}): Claim {\n\t\tconst info = WireRoute.normalize({\n\t\t\tidentity: options.identity?.id,\n\t\t\tepoch: options.identity?.epoch,\n\t\t\tcost: options.cost,\n\t\t\tauth: options.auth,\n\t\t});\n\t\treturn this.#serving(prefix, info, true, true, !options.hidden);\n\t}\n\n\t/**\n\t * Land a route a peer announced, taken as given. Not originated, so a session never announces it\n\t * back.\n\t */\n\t#receive(prefix: Path.Valid, route?: Partial<WireRoute>): Claim {\n\t\treturn this.#serving(prefix, WireRoute.normalize(route), false, false, true);\n\t}\n\n\t#serving(prefix: Path.Valid, route: WireRoute, originated: boolean, publishes: boolean, visible: boolean): Claim {\n\t\tprefix = this.#scope.prefix(prefix);\n\t\t// A route that names no identity serves one of its own.\n\t\tif (route.identity === undefined) route = { ...route, identity: Identity.random(), epoch: 0n };\n\t\tpublishPath(prefix);\n\t\tconst server = new ServeState(this.#scope.root, prefix);\n\t\tserver.onChange = (path) => this.#state.refresh(path);\n\t\tif (publishes) server.publishes = (path) => this.#state.publishes(path, current.identity);\n\t\t// Filed where the scope lets it serve whole subtrees, each place as many segments above\n\t\t// its path as the claim is broader: one claim, with one ref and one server.\n\t\tconst ref = {};\n\t\tlet current = route;\n\t\tconst lowered = (route: WireRoute, below: bigint): WireRoute =>\n\t\t\tbelow === 0n ? route : { ...route, above: (route.above ?? 0n) + below };\n\t\tconst filed = this.#scope.filed(prefix).map(([at, below]) => {\n\t\t\tconst entry: RouteEntry = {\n\t\t\t\tref,\n\t\t\t\tscope: this.#scope,\n\t\t\t\troute: new Signal(lowered(route, below)),\n\t\t\t\toriginated,\n\t\t\t\tserver,\n\t\t\t\tlost: false,\n\t\t\t};\n\t\t\treturn { at, below, entry };\n\t\t});\n\t\tif (filed.length === 0) throw new Error(\"prefix is outside the origin scope\");\n\t\tconst filings = filed.map(({ at }) => at);\n\t\tserver.onReject = (path, err) => {\n\t\t\tconst place = filed.find(({ at }) => Path.hasPrefix(at, path));\n\t\t\tif (place) this.#state.refuse(path, place.entry, err);\n\t\t};\n\t\tconst refresh = () => {\n\t\t\tthis.#state.rebuildOriginated();\n\t\t\tfor (const { at } of filed) this.#state.refreshPrefix(at);\n\t\t};\n\n\t\tlet inserted = false;\n\t\tlet ended = false;\n\t\t// Closing the origin drops the whole table without visiting each route, so a route\n\t\t// still marked inserted learns of it here, matching an exact route's \"origin is closed\".\n\t\tconst open = () => {\n\t\t\tif (ended) throw new Error(\"claim is closed\");\n\t\t\tif (this.#state.closed.peek() === undefined) return;\n\t\t\tinserted = false;\n\t\t\tthrow new Error(\"origin is closed\");\n\t\t};\n\t\t// Only a claim filed at its own prefix shares a tier with a job there.\n\t\tconst own = filed.some(({ below }) => below === 0n);\n\t\tserver.cost = () => (own && inserted && this.#state.closed.peek() === undefined ? current.cost : undefined);\n\t\tconst insert = () => {\n\t\t\topen();\n\t\t\tif (inserted) return;\n\t\t\tif (own && server.undercuts(current.cost)) throw unroutable();\n\t\t\tthis.#state.routes.mutate((routes) => {\n\t\t\t\tfor (const { at, entry } of filed) {\n\t\t\t\t\tconst entries = routes.get(at);\n\t\t\t\t\tif (entries) entries.unshift(entry);\n\t\t\t\t\telse routes.set(at, [entry]);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#state.changed(filings);\n\t\t\t// Newest at each filing, so newest across them too, as Rust files a new entry each time.\n\t\t\treceive(ref);\n\t\t\tinserted = true;\n\t\t\trefresh();\n\t\t};\n\t\t// Take the entries out of the table, then end (or renew) the server before the requests\n\t\t// beneath them reroute, so none of them resolves through an answer it already gave.\n\t\tconst remove = (server: () => void) => {\n\t\t\tif (inserted) {\n\t\t\t\tinserted = false;\n\t\t\t\tthis.#state.routes.mutate((routes) => {\n\t\t\t\t\tfor (const { at, entry } of filed) {\n\t\t\t\t\t\tconst entries = routes.get(at);\n\t\t\t\t\t\tif (!entries) continue;\n\t\t\t\t\t\tconst index = entries.indexOf(entry);\n\t\t\t\t\t\tif (index < 0) continue;\n\t\t\t\t\t\tentries.splice(index, 1);\n\t\t\t\t\t\tif (entries.length === 0) routes.delete(at);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis.#state.changed(filings);\n\t\t\t}\n\t\t\tserver();\n\t\t\trefresh();\n\t\t};\n\t\t// A received route torn down by any path (its handle, or the scoped handle it came through)\n\t\t// was lost with its session; only its announcer ending it on the wire withdraws it.\n\t\tlet lost = !originated;\n\t\tconst release = this.#hold(() => {\n\t\t\tif (!ended) for (const { entry } of filed) entry.lost = lost;\n\t\t\tended = true;\n\t\t\tthis.#state.servers.delete(server);\n\t\t\tremove(() => server.close());\n\t\t});\n\t\t// A route made after its origin (or this handle) closed is born retracted.\n\t\tif (this.#borrowed?.closed || this.#state.closed.peek() !== undefined) {\n\t\t\tended = true;\n\t\t\tserver.close();\n\t\t} else {\n\t\t\tthis.#state.servers.add(server);\n\t\t\tif (visible) insert();\n\t\t}\n\n\t\tconst update = (next: WireRoute) => {\n\t\t\topen();\n\t\t\tconst previous = current.identity;\n\t\t\tconst restart = inserted && previous !== next.identity;\n\t\t\tconst renewed = previous !== next.identity || (current.epoch ?? 0n) !== (next.epoch ?? 0n);\n\t\t\tcurrent = next;\n\t\t\tfor (const { below, entry } of filed) {\n\t\t\t\tif (restart) this.#state.restart(entry);\n\t\t\t\tentry.route.set(lowered(next, below));\n\t\t\t}\n\t\t\tif (previous !== next.identity) server.reset();\n\t\t\tif (!inserted) return;\n\t\t\t// A claim is new when it restarts, so it moves to the newest place and yields a tie\n\t\t\t// it held to one that kept its identity (see compareTie), at each filing and across them.\n\t\t\tif (renewed) receive(ref);\n\t\t\tthis.#state.routes.mutate((routes) => {\n\t\t\t\tif (!renewed) return;\n\t\t\t\tfor (const { at, entry } of filed) {\n\t\t\t\t\tconst entries = routes.get(at);\n\t\t\t\t\tconst index = entries?.indexOf(entry) ?? -1;\n\t\t\t\t\tif (!entries || index <= 0) continue;\n\t\t\t\t\tentries.splice(index, 1);\n\t\t\t\t\tentries.unshift(entry);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#state.changed(filings);\n\t\t\trefresh();\n\t\t};\n\n\t\tconst publisher = publishes ? this : undefined;\n\t\treturn makeClaim(\n\t\t\t{\n\t\t\t\tidentity: () => current.identity as Identity.Valid,\n\t\t\t\tannounce: insert,\n\t\t\t\twithdraw: () => {\n\t\t\t\t\tif (ended || !inserted) return;\n\t\t\t\t\tremove(() => server.reset());\n\t\t\t\t},\n\t\t\t\tannounced: () => inserted && this.#state.closed.peek() === undefined,\n\t\t\t\tchange: (changed) => {\n\t\t\t\t\tconst next = WireRoute.normalize({ ...current, ...changed });\n\t\t\t\t\tif (own && next.cost !== current.cost && server.undercuts(next.cost)) throw unroutable();\n\t\t\t\t\tupdate(next);\n\t\t\t\t},\n\t\t\t\tclose: release,\n\t\t\t\tend: () => {\n\t\t\t\t\tlost = false;\n\t\t\t\t\trelease();\n\t\t\t\t},\n\t\t\t\tinfo: () => (inserted && this.#state.closed.peek() === undefined ? current : undefined),\n\t\t\t\tupdate: (next) => {\n\t\t\t\t\t// A route naming no identity keeps the one it serves.\n\t\t\t\t\tconst named = WireRoute.normalize(next);\n\t\t\t\t\tupdate(\n\t\t\t\t\t\tnamed.identity === undefined\n\t\t\t\t\t\t\t? { ...named, identity: current.identity, epoch: current.epoch }\n\t\t\t\t\t\t\t: named,\n\t\t\t\t\t);\n\t\t\t\t\tinsert();\n\t\t\t\t},\n\t\t\t},\n\t\t\t() => serveRequests(server, publisher),\n\t\t);\n\t}\n\n\t/**\n\t * Register an attached session, counting it toward the `discovery` state. Returns the\n\t * detach; call it exactly once when the session dies.\n\t */\n\t#attach(discovery: boolean): Dispose {\n\t\tif (this.#borrowed?.closed) return () => {};\n\t\tthis.#sessions(1, discovery);\n\t\treturn this.#hold(() => this.#sessions(-1, discovery));\n\t}\n\n\t#sessions(delta: number, discovery: boolean): void {\n\t\tthis.#state.sessions.update(({ total, discovery: d }) => ({\n\t\t\ttotal: total + delta,\n\t\t\tdiscovery: d + (discovery ? delta : 0),\n\t\t}));\n\t\t// Losing a session without discovery can leave every pending request synced.\n\t\tthis.#state.settle(Path.empty());\n\t}\n\n\t// Run `release` once, at the first of its own call or this derived handle's close, so a\n\t// borrower's close withdraws what it registered. The owner's close tears down everything.\n\t#hold(release: Dispose): Dispose {\n\t\tconst borrowed = this.#borrowed;\n\t\tlet done = false;\n\t\tconst held = () => {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tborrowed?.releases.delete(held);\n\t\t\trelease();\n\t\t};\n\t\tborrowed?.releases.add(held);\n\t\treturn held;\n\t}\n\n\t/**\n\t * Resolves once anything a serving session scans changes: the open requests, either\n\t * side of the routing table, or the attached sessions that decide which requests are blind.\n\t */\n\t#changed(): GetPromise<unknown> {\n\t\treturn Signal.race(\n\t\t\tthis.#state.requests,\n\t\t\tthis.#state.local,\n\t\t\tthis.#state.routes,\n\t\t\tthis.#state.advertisedLocal,\n\t\t\tthis.#state.sessions,\n\t\t);\n\t}\n\n\t/**\n\t * Provide `front` as the answer for the open request on `path`, taking ownership of it.\n\t *\n\t * Returns undefined (releasing the front) when the request is gone or already answered;\n\t * first session in wins, and a loser must stay eligible to answer later. The returned\n\t * withdraw releases the front and, if it was the standing answer, vacates the slot and\n\t * wakes the other serving loops so a standby session answers immediately; call it when\n\t * the session dies.\n\t */\n\t#answer(path: Path.Valid, front: broadcast.Consumer): Dispose | undefined {\n\t\tconst slot = this.#state.requests.peek().get(path);\n\t\tif (!slot || slot.answer !== undefined || this.#borrowed?.closed) {\n\t\t\tfront.close();\n\t\t\treturn undefined;\n\t\t}\n\t\tslot.answer = front;\n\t\tthis.#state.refresh(path);\n\n\t\treturn this.#hold(() => {\n\t\t\tif (slot.answer === front) {\n\t\t\t\t// A request the answer resolved ends with its session: the next session is another\n\t\t\t\t// publisher identity, since nothing (no identity) says it serves the same bytes.\n\t\t\t\tif (slot.route.peek()?.front === front) {\n\t\t\t\t\tthis.#state.drop(path, slot, unroutable());\n\t\t\t\t} else {\n\t\t\t\t\tslot.answer = undefined;\n\t\t\t\t\tthis.#state.refresh(path);\n\t\t\t\t\t// The route signal only reaches this path's requesters; poke the map so every\n\t\t\t\t\t// serving loop re-scans and one of them re-answers.\n\t\t\t\t\tthis.#state.requests.mutate(() => {});\n\t\t\t\t}\n\t\t\t}\n\t\t\tfront.close();\n\t\t});\n\t}\n\n\t/** A read handle for this origin, the side a connection's `publish` option borrows. */\n\tconsume(): Consumer {\n\t\treturn makeConsumer(this.#state, this.#scope);\n\t}\n\n\t/** Whether every attached session announces into the table; see {@link Consumer.discovery}. */\n\tget discovery(): Getter<boolean | undefined> {\n\t\treturn this.#reader.discovery;\n\t}\n\n\t/** Resolve one publisher identity at `path`; see {@link Consumer.request}. */\n\trequest(path: Path.Valid, options?: RequestOptions): Requesting {\n\t\treturn this.#reader.request(path, options);\n\t}\n\n\t/** Follow `path` across publisher identities; see {@link Consumer.follow}. */\n\tfollow(path: Path.Valid, options?: FollowOptions): Following {\n\t\treturn this.#reader.follow(path, options);\n\t}\n\n\t/** The available broadcasts at or beneath `prefix`, as a live stream; see {@link Consumer.announced}. */\n\tannounced(prefix?: Path.Valid, options?: Announce.Options): Announce.Consumer {\n\t\treturn this.#reader.announced(prefix, options);\n\t}\n\n\t/** Every route change at or beneath `prefix`; see {@link Consumer.routes}. @internal */\n\troutes(prefix?: Path.Valid, options?: Announce.Options): announce.Routes {\n\t\treturn this.#reader.routes(prefix, options);\n\t}\n\n\t/**\n\t * Close the origin, every broadcast it still routes, and its announcement streams. Idempotent.\n\t *\n\t * A handle from {@link scope} borrows the origin: closing it\n\t * withdraws only the broadcasts, routes, and sessions (with their answers) registered\n\t * through it and refuses new ones, ignoring `abort`. Only the handle made with `new Producer()` closes the origin.\n\t */\n\tclose(abort?: Error) {\n\t\tconst borrowed = this.#borrowed;\n\t\tif (borrowed) {\n\t\t\tif (borrowed.closed) return;\n\t\t\tborrowed.closed = true;\n\t\t\tfor (const release of [...borrowed.releases]) release();\n\t\t\tborrowed.releases.clear();\n\t\t\treturn;\n\t\t}\n\t\tif (this.#state.closed.peek() !== undefined) return;\n\t\tthis.#state.closed.set(abort ?? null);\n\t\tfor (const watch of this.#state.watchers.values()) watch.version.update((n) => n + 1);\n\t\t// Cleared before the broadcasts close, so each route's synchronous retraction finds\n\t\t// nothing left to rebuild rather than rebuilding the table once per route.\n\t\tconst created = this.#state.created;\n\t\tthis.#state.created = new Map();\n\t\tthis.#state.local.update(() => new Map());\n\t\tthis.#state.advertisedLocal.update(() => new Map());\n\t\tfor (const entry of created.values()) retire(entry);\n\t\tthis.#state.routes.update((routes) => {\n\t\t\tfor (const entries of routes.values()) {\n\t\t\t\tfor (const entry of entries) entry.server?.close(abort);\n\t\t\t}\n\t\t\treturn new Map();\n\t\t});\n\t\tthis.#state.clearSnapshot();\n\t\t// A hidden or withdrawn prefix route is out of the table but its handler still waits.\n\t\tfor (const server of this.#state.servers) server.close(abort);\n\t\tthis.#state.servers.clear();\n\t\tthis.#state.originated.update(() => undefined);\n\t\t// Materialized broadcasts are handles we opened; release them.\n\t\tfor (const cached of this.#state.materialized.values()) {\n\t\t\tcached.front.close();\n\t\t}\n\t\tthis.#state.materialized.clear();\n\t\t// Every open request ends with the origin, pending or resolved, so an await never hangs.\n\t\tconst ended: RequestSlot[] = [];\n\t\tthis.#state.requests.update((requests) => {\n\t\t\tfor (const slot of requests.values()) {\n\t\t\t\tslot.answer?.close();\n\t\t\t\tslot.answer = undefined;\n\t\t\t\tslot.route.set(undefined);\n\t\t\t\tended.push(slot);\n\t\t\t}\n\t\t\treturn new Map();\n\t\t});\n\t\tfor (const [path, slots] of [...this.#state.detached]) {\n\t\t\tfor (const slot of slots) {\n\t\t\t\tthis.#state.detach(path, slot);\n\t\t\t\tslot.route.set(undefined);\n\t\t\t\tended.push(slot);\n\t\t\t}\n\t\t}\n\t\tfor (const slot of ended) {\n\t\t\tfor (const closed of slot.handles) if (closed.peek() === undefined) closed.set(abort ?? null);\n\t\t}\n\t}\n}\n\n// Constructs a Consumer from within this module without exposing a public constructor\n// that would leak the unexported OriginState. Assigned in the class's static block.\nlet makeConsumer: (state: OriginState, scope: Scope) => Consumer;\n\n// Same for Requesting and Following: a public constructor would let a caller forge a handle that no origin\n// ever registered, whose lifecycle guarantees are then false. `@internal` alone would not\n// stop it, since the declaration emit keeps the constructor.\nlet makeRequesting: (\n\tpath: Path.Valid,\n\tactive: Getter<broadcast.Consumer | undefined>,\n\tclosed: Once<Error | null>,\n\tdispose: Dispose,\n) => Requesting;\n\nlet makeFollowing: (\n\tpath: Path.Valid,\n\tactive: Getter<broadcast.Consumer | undefined>,\n\tclosed: Once<Error | null>,\n\tdispose: Dispose,\n) => Following;\n\nlet makeRequest: (path: Path.Valid, server: ServeState) => Request;\nlet finishRequest: (request: Request, err: Error) => void;\nlet setRequestPublisher: (request: Request, publisher: Producer | undefined) => void;\nlet jobPending: (request: Request) => boolean;\nlet releaseJob: (request: Request) => void;\nlet rejectJob: (request: Request, err: Error) => void;\nlet jobServer: (request: Request) => ServeState;\n\n/**\n * An owned request for one publisher identity at a broadcast path; see {@link Consumer.request}.\n *\n * Await {@link broadcast} for the broadcast, as Rust awaits `request(path)`; read {@link active} and\n * {@link closed} to follow it reactively instead. The handle is not itself awaitable, so an\n * `await` or an async return never takes the broadcast out from under the request that owns it.\n *\n * ```ts\n * const request = origin.request(Path.from(\"room\"));\n * const broadcast = await request.broadcast();\n * ```\n *\n * @public\n */\nexport class Requesting {\n\t/** The requested path. */\n\treadonly path: Path.Valid;\n\n\t/**\n\t * The accepted broadcast, or undefined while the request is pending.\n\t * Another route of the same identity taking over keeps\n\t * this handle: its tracks resume on that route from the first group each reader lacks.\n\t * Closing this handle affects only this request.\n\t */\n\treadonly active: Getter<broadcast.Consumer | undefined>;\n\n\t/**\n\t * Settles on refusal, origin shutdown, explicit close, or the accepted identity ending.\n\t * Fails `Unroutable` while pending once discovery syncs without a route for it.\n\t */\n\treadonly closed: GetPromise<Error | null>;\n\n\t#dispose: Dispose;\n\t#disposed = false;\n\t#answer?: Promise<broadcast.Consumer>;\n\n\tprivate constructor(\n\t\tpath: Path.Valid,\n\t\tactive: Getter<broadcast.Consumer | undefined>,\n\t\tclosed: GetPromise<Error | null>,\n\t\tdispose: Dispose,\n\t) {\n\t\tthis.path = path;\n\t\tthis.active = active;\n\t\tthis.closed = closed;\n\t\tthis.#dispose = dispose;\n\t}\n\n\tstatic {\n\t\tmakeRequesting = (path, active, closed, dispose) => new Requesting(path, active, closed, dispose);\n\t}\n\n\t/**\n\t * Resolves with the broadcast once {@link active} holds one. Rejects with the error\n\t * {@link closed} carries if the request ends first, such as `Unroutable`, or with a\n\t * `StreamCode.Cancel` error if it closed cleanly: this handle or its origin was closed. The\n\t * answer is fixed by the first call, and every later call gets the same one. The request\n\t * still owns the broadcast, so close the request, not only the broadcast, when done.\n\t */\n\tbroadcast(): Promise<broadcast.Consumer> {\n\t\tthis.#answer ??= answer(this.active, this.closed);\n\t\treturn this.#answer;\n\t}\n\n\t/** Withdraw the request. The path stays routed for any other open request. Idempotent. */\n\tclose(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.#dispose();\n\t}\n}\n\n// The first of `active` holding a broadcast or `closed` settling, as a promise.\nfunction answer(\n\tactive: Getter<broadcast.Consumer | undefined>,\n\tclosed: GetPromise<Error | null>,\n): Promise<broadcast.Consumer> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet done = false;\n\t\tconst stops: Dispose[] = [];\n\t\tconst check = () => {\n\t\t\tif (done) return;\n\t\t\tconst ended = closed.peek();\n\t\t\tconst value = ended === undefined ? active.peek() : undefined;\n\t\t\tif (ended === undefined && !value) return;\n\t\t\tdone = true;\n\t\t\tfor (const stop of stops) stop();\n\t\t\tif (value) resolve(value);\n\t\t\telse reject(ended ?? new StreamError(StreamCode.Cancel, { message: \"request closed\" }));\n\t\t};\n\t\tcheck();\n\t\tif (!done) stops.push(active.subscribe(check), closed.subscribe(check));\n\t});\n}\n\n/**\n * An owned follower of the publisher identities announced at a broadcast path; see {@link Consumer.follow}.\n *\n * @public\n */\nexport class Following {\n\t/** The followed path. */\n\treadonly path: Path.Valid;\n\n\t/**\n\t * The current announced broadcast, or undefined between publisher identities.\n\t * Moves to each new identity, or waits for the pinned identity when one was requested.\n\t * Another route of the same identity keeps this handle and resumes its tracks.\n\t * Closing this handle affects only this follower.\n\t */\n\treadonly active: Getter<broadcast.Consumer | undefined>;\n\n\t/**\n\t * Settles on refusal, origin shutdown, or explicit close.\n\t * Waits through gaps in announcements for a later start, even when pinned to an identity.\n\t */\n\treadonly closed: GetPromise<Error | null>;\n\n\t#dispose: Dispose;\n\t#disposed = false;\n\n\tprivate constructor(\n\t\tpath: Path.Valid,\n\t\tactive: Getter<broadcast.Consumer | undefined>,\n\t\tclosed: GetPromise<Error | null>,\n\t\tdispose: Dispose,\n\t) {\n\t\tthis.path = path;\n\t\tthis.active = active;\n\t\tthis.closed = closed;\n\t\tthis.#dispose = dispose;\n\t}\n\n\tstatic {\n\t\tmakeFollowing = (path, active, closed, dispose) => new Following(path, active, closed, dispose);\n\t}\n\n\t/** Withdraw the follower. The path stays routed for any other open request. Idempotent. */\n\tclose(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.#dispose();\n\t}\n}\n\n/**\n * The read side of an origin: resolve broadcasts by path and watch what is available.\n *\n * Obtain one from {@link Producer.consume}. Pass it to a connection's `publish` option to\n * serve the origin's local broadcasts to that peer; read it directly to consume anything\n * the origin routes, locally published or discovered by a session.\n *\n * @public\n */\nexport class Consumer implements Reader {\n\t#state: OriginState;\n\t#scope: Scope;\n\n\tprivate constructor(state: OriginState, scope: Scope) {\n\t\tthis.#state = state;\n\t\tthis.#scope = scope;\n\t\t// True only when every attached session announces. One session that cannot means the\n\t\t// table is an incomplete picture, so a consumer gated on it has to keep its blind\n\t\t// fallback: the paths only that session carries never reach the table at all.\n\t\tthis.#discovery = new Derived([state.sessions], ({ total, discovery }) =>\n\t\t\ttotal === 0 ? undefined : discovery === total,\n\t\t);\n\t\tregisterWire(this, {\n\t\t\troutes: (path) => this.#routes(scope.path(path)),\n\t\t\tadvertised:\n\t\t\t\tscope === Scope.all\n\t\t\t\t\t? state.originated\n\t\t\t\t\t: new Derived([state.originated], (routes) => scope.projectRoutes(routes)),\n\t\t\tlocal: (path, identity) => this.#local(scope.path(path), identity),\n\t\t\tdemand: (path, identity, signal) => this.#demand(scope.path(path), identity, signal),\n\t\t\tcovers: (prefix: Path.Valid) => scope.covers(prefix),\n\t\t\tallowed: scope.allowed?.rebase(scope.root),\n\t\t\troot: scope.root,\n\t\t});\n\t}\n\n\tstatic {\n\t\tmakeConsumer = (state, scope) => new Consumer(state, scope);\n\t}\n\n\t/** Settles once the origin closes; see {@link Producer.closed}. */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#state.closed;\n\t}\n\n\t/**\n\t * Whether the announcement table sees everything the attached sessions can serve.\n\t *\n\t * Undefined while no session is attached (nothing is known yet), true when every attached\n\t * session announces into the table, and false as soon as one does not, where\n\t * {@link announced} cannot be complete and consumers should {@link request} paths instead\n\t * of waiting. One blind session among several is still false: the paths only it carries\n\t * never reach the table, so a consumer that trusted the gate would never see them.\n\t */\n\tget discovery(): Getter<boolean | undefined> {\n\t\treturn this.#discovery;\n\t}\n\n\t// Derived per access rather than cached: a lightweight mapped view over the session\n\t// counts, avoiding a Computed's lifecycle.\n\treadonly #discovery: Getter<boolean | undefined>;\n\n\t/**\n\t * Whether the table routes `path`, by an announced local publish or an announced\n\t * route covering it.\n\t *\n\t * Availability, not a handle: {@link request} is the only way to consume by path. A\n\t * request on a routed path resolves to that route and never to a blind answer, which is\n\t * why a serving session leaves it alone.\n\t */\n\t#routes(path: Path.Valid): boolean {\n\t\tif (this.#state.local.peek().has(path)) return true;\n\t\treturn this.#state.bestEntry(path) !== undefined;\n\t}\n\n\t/**\n\t * Resolve one publisher identity serving `path`, pinned to `identity` when given.\n\t *\n\t * The request owns discovery of its path until closed and retries route churn while\n\t * pending. It fails `Unroutable` once at least one session is attached and every\n\t * session's discovery has synced without a route for it, and can use a session without\n\t * discovery instead. With no session attached, such as between reconnects, it waits. Once resolved it keeps\n\t * that identity, ending when the identity stops serving. Use {@link follow} to move on\n\t * to the next one. Await the handle for the broadcast, or the error ending it first.\n\t *\n\t * A job's exact route ({@link Request.route}) carries its own identity. On this origin, a\n\t * request waiting on the job's claim resolves onto the job once its route announces. Through\n\t * a peer's claim, the request resolves the claim's broadcast instead, which is reset once the\n\t * job's route announces: read an on-demand job across a session with {@link follow}.\n\t */\n\trequest(path: Path.Valid, options: RequestOptions = {}): Requesting {\n\t\treturn this.#resolve(path, options.identity, false);\n\t}\n\n\t/**\n\t * Follow `path` across publisher identities, pinned to `identity` when given.\n\t *\n\t * `active` moves to each identity announced at the path, clears between them, and never\n\t * closes on a gap: a pinned follower waits for its identity to return. Owns discovery of\n\t * its path until closed. Requires discovery: a session without it never serves a follower.\n\t * A selected handler's refusal or the origin closing ends it.\n\t */\n\tfollow(path: Path.Valid, options: FollowOptions = {}): Following {\n\t\tconst identity = options.identity;\n\t\tconst absolute = this.#scope.path(path);\n\t\tnameable(absolute);\n\t\tlet watch = this.#state.watchers.get(absolute);\n\t\tif (!watch) {\n\t\t\twatch = { users: 0, version: new Signal(0) };\n\t\t\tthis.#state.watchers.set(absolute, watch);\n\t\t}\n\t\twatch.users++;\n\t\tconst watched = watch;\n\t\tlet unwatch: Dispose = () => {};\n\t\tlet previous = this.#state.identity(absolute);\n\t\tconst active = new Signal<broadcast.Consumer | undefined>(undefined);\n\t\tconst closed = new Once<Error | null>();\n\t\tlet current: Requesting | undefined;\n\t\tlet subscriptions: Dispose[] = [];\n\t\tlet disposed = false;\n\t\tconst release = () => {\n\t\t\tfor (const stop of subscriptions) stop();\n\t\t\tsubscriptions = [];\n\t\t\tcurrent?.close();\n\t\t\tcurrent = undefined;\n\t\t};\n\t\tconst finish = (error: Error | null) => {\n\t\t\tif (disposed) return;\n\t\t\tdisposed = true;\n\t\t\tunwatch();\n\t\t\tif (--watched.users === 0) this.#state.watchers.delete(absolute);\n\t\t\trelease();\n\t\t\tactive.set(undefined);\n\t\t\tclosed.set(error);\n\t\t};\n\t\tconst ended = (error: Error | null | undefined, request: Requesting | undefined = current) => {\n\t\t\tif (!error) return;\n\t\t\t// Provenance survives a coalesced end/start, even when both routes serve one identity.\n\t\t\tif (\n\t\t\t\terror instanceof StreamError &&\n\t\t\t\terror.code === StreamCode.Unroutable &&\n\t\t\t\trequest &&\n\t\t\t\t!refusedRequests.has(request.closed)\n\t\t\t) {\n\t\t\t\tactive.set(undefined);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfinish(error);\n\t\t};\n\t\tconst replace = (next?: Requesting) => {\n\t\t\tif (disposed) {\n\t\t\t\tnext?.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst value = next?.active.peek();\n\t\t\tif (\n\t\t\t\tnext &&\n\t\t\t\tcurrent?.closed.peek() === undefined &&\n\t\t\t\tvalue &&\n\t\t\t\tvalue.closed === current?.active.peek()?.closed &&\n\t\t\t\tvalue.identity === current.active.peek()?.identity\n\t\t\t) {\n\t\t\t\tnext.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trelease();\n\t\t\tcurrent = next;\n\t\t\tactive.set(value);\n\t\t\tif (!next) return;\n\t\t\tsubscriptions.push(\n\t\t\t\tnext.active.subscribe((value) => {\n\t\t\t\t\tactive.set(value);\n\t\t\t\t}),\n\t\t\t);\n\t\t\tsubscriptions.push(next.closed.subscribe((error) => ended(error, next)));\n\t\t\tended(next.closed.peek(), next);\n\t\t};\n\t\ttry {\n\t\t\treplace(this.#resolve(path, identity, true));\n\t\t} catch (error) {\n\t\t\tfinish(error instanceof Error ? error : new Error(String(error)));\n\t\t\tthrow error;\n\t\t}\n\t\tconst changed = () => {\n\t\t\tconst shutdown = this.#state.closed.peek();\n\t\t\tif (shutdown !== undefined) {\n\t\t\t\tfinish(shutdown);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// A refusal landing in the same turn as this wakeup is final; never retry past it.\n\t\t\tended(current?.closed.peek());\n\t\t\tif (disposed) return;\n\t\t\tconst next = this.#state.identity(absolute);\n\t\t\tconst had = previous !== undefined;\n\t\t\tconst same = previous && next && sameIdentity(previous, next);\n\t\t\tprevious = next;\n\t\t\tif (!next) {\n\t\t\t\tif (had) replace(this.#resolve(path, identity, true));\n\t\t\t} else if (!same || !current || current.closed.peek() !== undefined)\n\t\t\t\treplace(this.#resolve(path, identity, true));\n\t\t};\n\t\tif (!disposed) {\n\t\t\tunwatch = watched.version.subscribe(changed);\n\t\t\tchanged();\n\t\t}\n\n\t\treturn makeFollowing(path, active, closed, () => finish(null));\n\t}\n\n\t// One resolution of `path`. A follower's (`announced`) takes only an announced front and\n\t// never reports absence: {@link follow} retries it on the next identity instead.\n\t#resolve(path: Path.Valid, identity: Identity.Valid | undefined, announced: boolean): Requesting {\n\t\tconst relative = path;\n\t\tpath = this.#scope.path(path);\n\t\tnameable(path);\n\t\tconst requests = this.#state.requests.peek();\n\t\tif (this.#state.closed.peek() !== undefined) {\n\t\t\t// Closed origin: a request that can never resolve ends at once.\n\t\t\tconst closed = new Once<Error | null>();\n\t\t\tclosed.set(this.#state.closed.peek() ?? null);\n\t\t\treturn makeRequesting(relative, new Signal<broadcast.Consumer | undefined>(undefined), closed, () => {});\n\t\t}\n\n\t\t// A pin naming another identity than the winner follows that identity's own routes, on a\n\t\t// slot shared only by requests pinned to it, rather than filter the winner afterward.\n\t\tconst pin =\n\t\t\tidentity !== undefined && this.#state.identity(path)?.route.identity !== identity ? identity : undefined;\n\t\tlet fresh: RequestSlot | undefined;\n\t\t// A claim refusing the pin hands a new handle no answer it held from before.\n\t\tconst refused = pin !== undefined && this.#state.refuses(path, pin);\n\t\tlet slot =\n\t\t\tpin === undefined\n\t\t\t\t? requests.get(path)\n\t\t\t\t: [...(this.#state.detached.get(path) ?? [])].find(\n\t\t\t\t\t\t(other) =>\n\t\t\t\t\t\t\tother.pin === pin && !refused && !this.#state.retained.has(other) && !outdated(other),\n\t\t\t\t\t);\n\t\tif (!slot && pin !== undefined) {\n\t\t\tconst created: RequestSlot = {\n\t\t\t\tblind: 0,\n\t\t\t\thandles: new Set(),\n\t\t\t\tabsent: new Set(),\n\t\t\t\tmoved: new Set(),\n\t\t\t\tpinned: new Set(),\n\t\t\t\troute: new Signal<Resolution | undefined>(undefined),\n\t\t\t\tpin,\n\t\t\t};\n\t\t\tslot = created;\n\t\t\tlet detached = this.#state.detached.get(path);\n\t\t\tif (!detached) {\n\t\t\t\tdetached = new Set();\n\t\t\t\tthis.#state.detached.set(path, detached);\n\t\t\t}\n\t\t\tdetached.add(created);\n\t\t\t// Followed once this handle is on it, below, since following can refuse it at once.\n\t\t\tfresh = created;\n\t\t} else if (!slot) {\n\t\t\t// Seeded through the constructor, so a path the table already routes resolves on the\n\t\t\t// first read. It must not go through a silent set: that still captures the pre-seed\n\t\t\t// value as the baseline the next change is compared against, and never flushes to\n\t\t\t// clear it, so a seeded route retracting to undefined would look like no change and\n\t\t\t// notify nobody.\n\t\t\tconst created: RequestSlot = {\n\t\t\t\tblind: 0,\n\t\t\t\thandles: new Set(),\n\t\t\t\tabsent: new Set(),\n\t\t\t\tmoved: new Set(),\n\t\t\t\tpinned: new Set(),\n\t\t\t\troute: new Signal(this.#state.route(path, {})),\n\t\t\t};\n\t\t\tslot = created;\n\t\t\tthis.#state.requests.mutate((map) => {\n\t\t\t\tmap.set(path, created);\n\t\t\t});\n\t\t}\n\t\tconst closed = new Once<Error | null>();\n\t\tslot.handles.add(closed);\n\t\t// Counted, not subscribed: serving sessions decide blindness from the live discovery state.\n\t\tif (!announced) slot.blind += 1;\n\t\t// Resolution owns discovery from the first ask, not just after a route arrives.\n\t\tconst unwatch = this.#state.watch([path]);\n\t\tthis.#state.requests.mutate(() => {});\n\n\t\t// Hand out a handle of the request's own rather than the table's. Closing a consumer\n\t\t// closes the broadcast once it was the last one, and the table often holds the only\n\t\t// other handle, so lending its front out means an ordinary close() by one requester\n\t\t// can unpublish the path for everybody else.\n\t\tconst taken = slot;\n\n\t\t// Memoized on the route's ref: the same front resolving again returns the handle\n\t\t// we already made, and only a real swap clones a new one (cloning before closing the\n\t\t// old, so a broadcast that both routes share never briefly loses its last handle).\n\t\t// Under a carried identity the handle is a logical front instead: another route of it\n\t\t// serves the same stream, so the front re-sources its tracks and the handle stays.\n\t\tlet released = false;\n\t\tlet source: Resolution | undefined;\n\t\tlet handle: broadcast.Consumer | undefined;\n\t\tlet logical: Front | undefined;\n\t\t// Whether another identity than the one the handle reads wins the path, judged over every\n\t\t// route the origin holds: a claim's refusal is then final. Mirrors the Rust `superseded`.\n\t\tconst superseded = () => {\n\t\t\tconst winner = this.#state.identity(path)?.route.identity;\n\t\t\treturn winner !== undefined && winner !== source?.identity;\n\t\t};\n\t\tconst own = (resolution: Resolution | undefined): broadcast.Consumer | undefined => {\n\t\t\tif (released) return undefined;\n\t\t\t// A follower takes only a front something announced; a blind answer is for plain handles.\n\t\t\tconst offered = announced && !resolution?.source ? undefined : resolution?.front;\n\t\t\tconst front = identity === undefined || resolution?.identity === identity ? offered : undefined;\n\t\t\tif (logical && source?.identity !== undefined && resolution?.identity === source.identity) {\n\t\t\t\t// Between routes of the identity, readers wait for the next one to answer.\n\t\t\t\tif (front) logical.serve(front, resolution?.local, resolution?.claim);\n\t\t\t\telse logical.park();\n\t\t\t\treturn handle;\n\t\t\t}\n\t\t\tif (front !== source?.front || resolution?.identity !== source?.identity) {\n\t\t\t\tconst previous = handle;\n\t\t\t\tconst concluded = logical;\n\t\t\t\tsource = front ? { front, identity: resolution?.identity } : undefined;\n\t\t\t\t// A minted identity names an announcement over a wire that carries none, whose\n\t\t\t\t// route may answer a re-request with another stream, so nothing re-sources it.\n\t\t\t\tconst carried = resolution?.identity !== undefined && !Identity.isMinted(resolution.identity);\n\t\t\t\tlogical = front && carried ? new Front(superseded) : undefined;\n\t\t\t\tlogical?.serve(front as broadcast.Consumer, resolution?.local, resolution?.claim);\n\t\t\t\thandle = logical ? logical.consumer : front?.clone();\n\t\t\t\tif (handle) {\n\t\t\t\t\thooks.stampPath(handle, relative);\n\t\t\t\t\thooks.stampIdentity(handle, resolution?.identity);\n\t\t\t\t\t// A logical front lists what the route it was made through lists.\n\t\t\t\t\tif (front && hooks.unlisted(front)) hooks.stampUnlisted(handle);\n\t\t\t\t}\n\t\t\t\tconcluded?.conclude();\n\t\t\t\tprevious?.close();\n\t\t\t}\n\t\t\treturn handle;\n\t\t};\n\n\t\tconst route = taken.route;\n\t\tconst active = new Derived([route], own);\n\n\t\t// Swapping on the read is what keeps a routed path resolving synchronously, but a\n\t\t// holder that only ever peeked would then pin a route that has already been retracted\n\t\t// until it happened to read again. Following the route as well retires it promptly,\n\t\t// and the memo makes the two paths agree: whichever runs first does the swap.\n\t\t// A pending plain request reports absence, as Rust's request does, once discovery of\n\t\t// its path has synced without a route for its identity. Sessions hold that sync from\n\t\t// when the watch opens, so a fresh request waits for its peer's answer. A follower\n\t\t// keeps waiting for a start, and a resolved request ends only with its identity.\n\t\tconst absent = () => {\n\t\t\tif (released || closed.peek() !== undefined) return;\n\t\t\tif (source) {\n\t\t\t\ttaken.absent.delete(absent);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst resolution = route.peek();\n\t\t\tif (resolution && (identity === undefined || resolution.identity === identity)) return;\n\t\t\tif (!this.#state.synced(path)) return;\n\t\t\tclosed.set(unroutable());\n\t\t\trelease();\n\t\t};\n\t\tif (!announced) taken.absent.add(absent);\n\t\t// The table moved while the same route may still win: a read stranded on it asks again.\n\t\t// Queued behind the route's own flush, so a route that changed is served first, and\n\t\t// checked again then: a takeover gone pending meanwhile is no news.\n\t\tconst moved = () => {\n\t\t\tconst at = route.peek()?.source;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tconst now = route.peek();\n\t\t\t\tif (released || now?.source !== at || now?.pending || taken.failover) return;\n\t\t\t\tlogical?.moved();\n\t\t\t});\n\t\t};\n\t\ttaken.moved.add(moved);\n\t\tconst pinned =\n\t\t\tidentity !== undefined && taken.pin === undefined\n\t\t\t\t? {\n\t\t\t\t\t\tidentity,\n\t\t\t\t\t\trefuse: (err: Error) => {\n\t\t\t\t\t\t\tif (released || closed.peek() !== undefined) return;\n\t\t\t\t\t\t\trefusedRequests.add(closed);\n\t\t\t\t\t\t\tclosed.set(err);\n\t\t\t\t\t\t\trelease();\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tif (pinned) taken.pinned.add(pinned);\n\n\t\tconst unsubscribe = route.subscribe((resolution) => {\n\t\t\town(resolution);\n\t\t\tif (!announced) absent();\n\t\t});\n\n\t\tconst release = () => {\n\t\t\t// Releases this request's handle; the route itself belongs to the table.\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\tunsubscribe();\n\t\t\ttaken.absent.delete(absent);\n\t\t\ttaken.moved.delete(moved);\n\t\t\tif (pinned) taken.pinned.delete(pinned);\n\t\t\tlogical?.conclude();\n\t\t\tlogical = undefined;\n\t\t\thandle?.close();\n\t\t\thandle = undefined;\n\t\t\tsource = undefined;\n\n\t\t\tunwatch();\n\t\t\ttaken.handles.delete(closed);\n\t\t\tif (closed.peek() === undefined) closed.set(null);\n\t\t\tif (!announced) taken.blind -= 1;\n\t\t\tthis.#state.requests.mutate(() => {});\n\t\t\tif (taken.handles.size > 0) return;\n\n\t\t\t// Defer the teardown a microtask: an effect whose rerun was triggered by the\n\t\t\t// answer resolving closes its old request and takes a new one in the same tick,\n\t\t\t// and tearing down in between would drop the answer it is about to read.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (taken.handles.size > 0) return;\n\t\t\t\t// A refused slot already tore itself down, and the path may hold a newer one. A\n\t\t\t\t// detached slot owns the front it took.\n\t\t\t\tif (this.#state.requests.peek().get(path) !== taken) {\n\t\t\t\t\tthis.#state.detach(path, taken);\n\t\t\t\t\tthis.#state.forget(path);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.#state.requests.mutate((map) => {\n\t\t\t\t\tmap.delete(path);\n\t\t\t\t});\n\t\t\t\ttaken.answer?.close();\n\t\t\t\ttaken.answer = undefined;\n\t\t\t\ttaken.route.set(undefined);\n\t\t\t\tthis.#state.releaseMaterialized(path);\n\t\t\t\tthis.#state.forget(path);\n\t\t\t});\n\t\t};\n\n\t\tif (fresh) this.#state.follow(path, fresh, identity, undefined);\n\t\tif (!announced) absent();\n\t\treturn makeRequesting(relative, active, closed, release);\n\t}\n\n\t/**\n\t * The paths announced at or beneath `prefix`, relative to the root, within this handle's\n\t * scope, each reported as it becomes present or absent: every currently advertised one\n\t * arrives first as `present`. Another identity taking a path over keeps it present;\n\t * {@link follow} it to see the broadcast change. A local broadcast appears once it announces,\n\t * exactly as a peer sees it. Only routes at or beneath the prefix are listed, unless\n\t * `options.covering` also asks for every route whose subtree overlaps it, a broadcast\n\t * included. The stream ends when the origin closes or the consumer is closed. Hidden routes\n\t * are left out unless `options.hidden` opts in (see {@link Announce.Options}). While open, it\n\t * watches the prefix: a `consume` session asks its peer for announcements there. Throws\n\t * {@link Path.InvalidPrefix} for a prefix holding a `*`.\n\t */\n\tannounced(prefix: Path.Valid = Path.empty(), options?: Announce.Options): Announce.Consumer {\n\t\treturn announce.list(this.routes(prefix, options));\n\t}\n\n\t/**\n\t * Every change to the routes at or beneath `prefix`, for code that forwards routes: a\n\t * re-price is an `update`, and another identity serving a path a `restart`. The prefix,\n\t * options and the watch are as for {@link announced}.\n\t *\n\t * @internal\n\t */\n\troutes(prefix: Path.Valid = Path.empty(), options?: Announce.Options): announce.Routes {\n\t\tconst producer = new announce.Producer();\n\t\tconst reach: Reach = options?.exact ? \"above\" : options?.covering ? \"both\" : \"beneath\";\n\t\tlet listed = this.#scope.listed(prefix);\n\t\t// An exact listing asks what could serve the path itself, which a scope reaching only\n\t\t// beneath it never lets this handle request: nothing to list or wait on.\n\t\tif (reach === \"above\" && !this.#scope.covers(prefix)) listed = new Path.Prefixes();\n\t\tvoid producer.closed.then(this.#state.watch(listed.toArray().map((member) => member.text as Path.Valid)));\n\t\tvoid this.#runAnnounced(producer, listed, options?.hidden ?? false, reach);\n\t\tconst consumer = producer.consume();\n\t\t// The last reader leaving ends the stream and its watch.\n\t\tcloseUnwanted(producer);\n\t\treturn consumer;\n\t}\n\n\t/** What one announcement listing presents of the table, by path or in full. */\n\t#view(listed: Path.Prefixes, hidden: boolean, reach: Reach): ListingView {\n\t\tconst root = this.#scope.root;\n\t\t// The members are disjoint, so at most one lies at or above a path: found among the path's\n\t\t// own prefixes. Those beneath a path are a contiguous run of the sorted texts.\n\t\tconst heads = listed.toArray().map((member) => member.text as Path.Valid);\n\t\tconst named = new Set(heads);\n\t\tconst sorted = [...heads].sort();\n\t\tconst covering = (path: Path.Valid): Path.Valid | undefined => {\n\t\t\tfor (const prefix of coveringPrefixes(path)) if (named.has(prefix)) return prefix;\n\t\t\treturn undefined;\n\t\t};\n\t\tconst beneath = (path: Path.Valid) => {\n\t\t\tif (path === Path.empty() || named.has(path)) return sorted.length > 0;\n\t\t\tconst below = `${path}/`;\n\t\t\tlet lo = 0;\n\t\t\tlet hi = sorted.length;\n\t\t\twhile (lo < hi) {\n\t\t\t\tconst mid = (lo + hi) >>> 1;\n\t\t\t\tif (sorted[mid] < below) lo = mid + 1;\n\t\t\t\telse hi = mid;\n\t\t\t}\n\t\t\treturn sorted[lo]?.startsWith(below) ?? false;\n\t\t};\n\t\t// Every candidate is a claim on the subtree it is filed at, a broadcast included, so a\n\t\t// covering reader sees each one whose subtree overlaps its scope, as Rust's cursor does. A\n\t\t// segment hidden beneath the member the path falls under hides it; a member beneath the path\n\t\t// sees it whole.\n\t\tconst seen = (path: Path.Valid) => {\n\t\t\tif (reach !== \"beneath\" && beneath(path)) return true;\n\t\t\tif (reach === \"above\") return false;\n\t\t\tconst head = covering(path);\n\t\t\treturn head !== undefined && (hidden || !hiddenBelow(head, path));\n\t\t};\n\t\tconst present = (entry: Candidate): Presented => ({\n\t\t\tref: entry.ref,\n\t\t\troute: entry.route,\n\t\t\tlost: entry.lost,\n\t\t});\n\t\t// Every prefix at or above the root presents as the empty path, where the claims covering the\n\t\t// root compete as one tier, as a request beneath the root resolves.\n\t\tconst file = (atRoot: Filed<Candidate>[], path: Path.Valid, candidates: readonly Candidate[]) => {\n\t\t\tconst depth = Path.parts(path).length;\n\t\t\tcandidates.forEach((candidate, order) => {\n\t\t\t\tatRoot.push({\n\t\t\t\t\tprefix: path,\n\t\t\t\t\tdepth,\n\t\t\t\t\torder,\n\t\t\t\t\tarrival: arrival(candidate.ref),\n\t\t\t\t\tcandidate,\n\t\t\t\t\troute: candidate.route,\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\t// Hashed on the root, as a request for it resolves. A broadcast above the root serves only\n\t\t// its own path, so a tier-mate that serves the root ranks ahead of it, as `presented` ranks them.\n\t\tconst best = (atRoot: Filed<Candidate>[]) => {\n\t\t\tconst best = bestOfTier(root, atRoot, {\n\t\t\t\tserves: (entry) => !entry.candidate.exact || entry.prefix === root,\n\t\t\t});\n\t\t\treturn best && present(best.candidate);\n\t\t};\n\t\t// Where an absolute path presents: beneath the root by its relative path, at or above it as\n\t\t// the empty path, and anywhere else not at all.\n\t\tconst key = (path: Path.Valid): Path.Valid | undefined => {\n\t\t\tconst relative = Path.stripPrefix(root, path);\n\t\t\tif (relative !== null) return relative;\n\t\t\treturn Path.hasPrefix(path, root) ? Path.empty() : undefined;\n\t\t};\n\t\treturn {\n\t\t\tkey,\n\t\t\tall: () => {\n\t\t\t\tconst next = new Map<Path.Valid, Presented>();\n\t\t\t\tconst atRoot: Filed<Candidate>[] = [];\n\t\t\t\tfor (const [path, candidates] of this.#state.snapshot()) {\n\t\t\t\t\tif (!seen(path)) continue;\n\t\t\t\t\tconst relative = key(path);\n\t\t\t\t\tif (relative === undefined) continue;\n\t\t\t\t\tif (relative === Path.empty()) {\n\t\t\t\t\t\t// Hold the empty path's place in the order the snapshot lists its first claim.\n\t\t\t\t\t\tif (atRoot.length === 0) next.set(Path.empty(), present(candidates[0]));\n\t\t\t\t\t\tfile(atRoot, path, candidates);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// The preferred candidate wins, unless a higher epoch of its identity supersedes it.\n\t\t\t\t\tconst entry = firstEligible(candidates, () => true);\n\t\t\t\t\tif (entry) next.set(relative, present(entry));\n\t\t\t\t}\n\t\t\t\tconst root = best(atRoot);\n\t\t\t\tif (root) next.set(Path.empty(), root);\n\t\t\t\treturn next;\n\t\t\t},\n\t\t\tat: (path) => {\n\t\t\t\tconst snapshot = this.#state.snapshot();\n\t\t\t\tif (key(path) !== Path.empty()) {\n\t\t\t\t\tconst candidates = snapshot.get(path);\n\t\t\t\t\tconst entry = candidates && seen(path) ? firstEligible(candidates, () => true) : undefined;\n\t\t\t\t\treturn entry && present(entry);\n\t\t\t\t}\n\t\t\t\tconst atRoot: Filed<Candidate>[] = [];\n\t\t\t\tfor (const prefix of coveringPrefixes(root)) {\n\t\t\t\t\tconst candidates = snapshot.get(prefix);\n\t\t\t\t\tif (candidates && seen(prefix)) file(atRoot, prefix, candidates);\n\t\t\t\t}\n\t\t\t\treturn best(atRoot);\n\t\t\t},\n\t\t};\n\t}\n\n\tasync #runAnnounced(\n\t\tproducer: announce.Producer,\n\t\tlisted: Path.Prefixes,\n\t\thidden: boolean,\n\t\treach: Reach,\n\t): Promise<void> {\n\t\tconst view = this.#view(listed, hidden, reach);\n\t\t// The paths written since the last wake: only those can change what this listing presents.\n\t\tconst [pending, unlisten] = this.#state.listen();\n\t\t// Keyed by the presented path (from the origin, not the scope), valued by ref\n\t\t// plus route. Diffing the identity rather than mere presence means a republish emits a\n\t\t// restart; a re-price of the same identity emits an update.\n\t\tlet active: Map<Path.Valid, Presented> | undefined;\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tif (this.#state.closed.peek() !== undefined) break;\n\n\t\t\t\t// The whole table once, then each changed path as presented now, or undefined once gone.\n\t\t\t\tlet next: Map<Path.Valid, Presented | undefined>;\n\t\t\t\tif (active === undefined) {\n\t\t\t\t\tactive = new Map();\n\t\t\t\t\tnext = view.all();\n\t\t\t\t} else {\n\t\t\t\t\tnext = new Map();\n\t\t\t\t\tfor (const path of pending) {\n\t\t\t\t\t\tconst relative = view.key(path);\n\t\t\t\t\t\tif (relative !== undefined && !next.has(relative)) next.set(relative, view.at(path));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpending.clear();\n\n\t\t\t\tfor (const [path, snap] of next) {\n\t\t\t\t\tconst prev = active.get(path);\n\t\t\t\t\tif (prev && !snap)\n\t\t\t\t\t\tproducer.append({\n\t\t\t\t\t\t\tprefix: path,\n\t\t\t\t\t\t\tkind: prev.lost?.() ? \"offline\" : \"end\",\n\t\t\t\t\t\t\troute: prev.route,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tfor (const [path, snap] of next) {\n\t\t\t\t\tconst prev = active.get(path);\n\t\t\t\t\tif (!snap) {\n\t\t\t\t\t\tactive.delete(path);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!prev) {\n\t\t\t\t\t\tproducer.append({ prefix: path, kind: \"start\", route: snap.route });\n\t\t\t\t\t} else if (!sameIdentity(prev, snap)) {\n\t\t\t\t\t\tproducer.append({ prefix: path, kind: \"restart\", route: snap.route });\n\t\t\t\t\t} else if (!routesEqual(prev.route, snap.route)) {\n\t\t\t\t\t\tproducer.append({ prefix: path, kind: \"update\", route: snap.route });\n\t\t\t\t\t}\n\t\t\t\t\tactive.set(path, snap);\n\t\t\t\t}\n\n\t\t\t\t// Synced once no session is still delivering an initial set this stream could\n\t\t\t\t// list: one under a hidden segment holds only a reader that opts in.\n\t\t\t\tlet behind = false;\n\t\t\t\tfor (const prefix of this.#state.snapshots.peek().keys()) {\n\t\t\t\t\tfor (const member of listed) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\treach === \"above\"\n\t\t\t\t\t\t\t\t? !Path.hasPrefix(prefix, member.text as Path.Valid)\n\t\t\t\t\t\t\t\t: !member.overlaps(prefix)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tif (hidden || !hiddenBelow(member.text as Path.Valid, prefix)) behind = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (behind) producer.behind();\n\t\t\t\telse producer.synced();\n\n\t\t\t\tawait Signal.race(\n\t\t\t\t\tthis.#state.local,\n\t\t\t\t\tthis.#state.advertisedLocal,\n\t\t\t\t\tthis.#state.routes,\n\t\t\t\t\tthis.#state.snapshots,\n\t\t\t\t\tproducer.closed,\n\t\t\t\t);\n\n\t\t\t\tif (producer.closed.peek() !== undefined) return;\n\t\t\t}\n\t\t} catch {\n\t\t\t// The reader closed between the check and an append; nothing left to do.\n\t\t} finally {\n\t\t\tunlisten();\n\t\t}\n\t\tproducer.close();\n\t}\n\n\t/**\n\t * The announced local broadcast at `path`, when it beats the originated routes there.\n\t * Resolves through what rebuildOriginated advertised: a peer never sees received routes.\n\t */\n\t#local(path: Path.Valid, identity?: Identity.Valid): broadcast.Consumer | undefined {\n\t\tconst local = this.#state.local.peek().get(path);\n\t\tif (!local) return undefined;\n\t\tif (identity !== undefined && this.#state.advertisedLocal.peek().get(path)?.identity !== identity)\n\t\t\treturn undefined;\n\t\t// Pinned, it competes only with its own identity's routes, whichever identity wins.\n\t\tconst skip = unservable(identity);\n\t\tif (!this.#state.localWins(path, this.#state.bestEntry(path, skip), skip)) return undefined;\n\t\treturn local;\n\t}\n\n\t/**\n\t * Resolve `path` for serving: an announced local broadcast, or wait for an originated\n\t * dynamic to accept it. Undefined when nothing here can serve the path.\n\t */\n\tasync #demand(\n\t\tpath: Path.Valid,\n\t\tidentity?: Identity.Valid,\n\t\tsignal?: AbortSignal,\n\t): Promise<broadcast.Consumer | undefined> {\n\t\tsignal?.throwIfAborted();\n\t\t// Nothing can serve a path holding `*` (see `nameable`), so a peer's request for one is\n\t\t// refused here rather than handed to a claim whose answer would throw.\n\t\tif (path.includes(\"*\")) return undefined;\n\t\tconst cancelled = new Once<true>();\n\t\tlet release: Dispose | undefined;\n\t\tconst abort = () => {\n\t\t\t// Withdraw before a handler can answer in the same turn as cancellation.\n\t\t\trelease?.();\n\t\t\tcancelled.set(true);\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t\ttry {\n\t\t\t// Each pass asks the identity that wins now; an identity change releasing the request starts another.\n\t\t\tfor (;;) {\n\t\t\t\tsignal?.throwIfAborted();\n\t\t\t\t// A peer naming one publisher identity takes that identity's own routes, whichever\n\t\t\t\t// wins, and is never handed another.\n\t\t\t\tconst local = this.#local(path, identity);\n\t\t\t\tif (local) return local;\n\t\t\t\tconst entry = this.#state.bestEntry(path, unservable(identity));\n\t\t\t\tif (!entry?.server) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tidentity !== undefined &&\n\t\t\t\t\t\t(this.#local(path) || this.#state.bestEntry(path, unservable(undefined))?.server)\n\t\t\t\t\t)\n\t\t\t\t\t\tthrow unroutable();\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst server = entry.server;\n\t\t\t\t// Past a broadcast this origin publishes at the path, such as the job answering it,\n\t\t\t\t// an application's claim refuses rather than ask its handler for another or hand\n\t\t\t\t// out an answer it held from before.\n\t\t\t\tif (server.publishes(path)) throw unroutable();\n\t\t\t\tconst live = server.served.get(path);\n\t\t\t\tif (live && live.closed.peek() === undefined) return live;\n\n\t\t\t\tconst resets = server.resets;\n\t\t\t\tserver.enqueue(path);\n\t\t\t\tserver.demanding.set(path, (server.demanding.get(path) ?? 0) + 1);\n\t\t\t\trelease = () => {\n\t\t\t\t\t// Abort and finally share this registration; release it only once.\n\t\t\t\t\trelease = undefined;\n\t\t\t\t\t// A reset already cleared the count, and a later pass may have registered anew.\n\t\t\t\t\tif (server.resets === resets) {\n\t\t\t\t\t\tconst n = (server.demanding.get(path) ?? 1) - 1;\n\t\t\t\t\t\tif (n <= 0) {\n\t\t\t\t\t\t\tserver.demanding.delete(path);\n\t\t\t\t\t\t\tserver.rejected.delete(path);\n\t\t\t\t\t\t\t// Only the final waiter changes which pending routes are still needed.\n\t\t\t\t\t\t\tthis.#state.forget(path);\n\t\t\t\t\t\t} else server.demanding.set(path, n);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\ttry {\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tsignal?.throwIfAborted();\n\t\t\t\t\t\t// The route may name another identity by the time its handler answers.\n\t\t\t\t\t\tif (identity !== undefined && entry.route.peek().identity !== identity) throw unroutable();\n\t\t\t\t\t\tconst served = server.served.get(path);\n\t\t\t\t\t\tif (served && served.closed.peek() === undefined) return served;\n\t\t\t\t\t\tconst rejected = server.rejected.get(path);\n\t\t\t\t\t\tif (rejected) {\n\t\t\t\t\t\t\tthrow rejected;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst closed = server.closed.peek();\n\t\t\t\t\t\tif (closed !== undefined) {\n\t\t\t\t\t\t\tif (closed) throw closed;\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Released by an identity change, which also dropped this pass's count: ask again.\n\t\t\t\t\t\tif (server.resets !== resets) break;\n\t\t\t\t\t\tif (!server.pending.has(path)) {\n\t\t\t\t\t\t\t// Released by a job's exact route, a stream of its own: a peer naming no\n\t\t\t\t\t\t\t// identity subscribes again once that route's announcement reaches it, and\n\t\t\t\t\t\t\t// one pinned to the claim's identity is refused, unless the job carries it.\n\t\t\t\t\t\t\tif (identity === undefined) return undefined;\n\t\t\t\t\t\t\tconst job = this.#local(path, identity);\n\t\t\t\t\t\t\tif (job) return job;\n\t\t\t\t\t\t\tthrow unroutable();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait race([Signal.race(server.settled, server.closed), cancelled]);\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\trelease?.();\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t}\n\t}\n}\n\n/** What a {@link Route} and a {@link Claim} share: the advertisement and how it is changed. */\ninterface RouteControl {\n\tidentity(): Identity.Valid;\n\tannounce(): void;\n\twithdraw(): void;\n\tannounced(): boolean;\n\tchange(update: Partial<Pick<WireRoute, \"cost\" | \"auth\">>): void;\n\tclose(): void;\n\t/** Close as its announcer ending it; {@link close} on a received route means its session lost it. */\n\tend(): void;\n\tinfo(): WireRoute | undefined;\n\tupdate(info: Partial<WireRoute>): void;\n}\n\n// Expose `control` to the protocol layer, which advertises a route as a session's update does.\nfunction registerControl(handle: Route | Claim, control: RouteControl): void {\n\tregisterWire(handle, {\n\t\tget info() {\n\t\t\treturn control.info();\n\t\t},\n\t\tupdate: (info) => control.update(info),\n\t\tend: () => control.end(),\n\t});\n}\n\n/** The requests arriving on a claim's `server`, each answerable with a route of `publisher`'s when it has one. */\nasync function* serveRequests(server: ServeState, publisher: Producer | undefined): AsyncIterableIterator<Request> {\n\tlet current: Request | undefined;\n\tconst drop = () => {\n\t\tcurrent?.reject(unroutable());\n\t\tcurrent = undefined;\n\t};\n\t// Keep the cursor while draining: restarting it would rescan deleted entries.\n\tlet queued = server.queue.peek().values();\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst next = queued.next();\n\t\t\tif (!next.done) {\n\t\t\t\tdrop();\n\t\t\t\tserver.queue.mutate((queue) => {\n\t\t\t\t\tqueue.delete(next.value);\n\t\t\t\t});\n\t\t\t\t// Only a request pinned to the claim's identity reaches it past a broadcast this\n\t\t\t\t// origin publishes at the path, such as the job answering it: that stream is not\n\t\t\t\t// the claim's, so the claim refuses rather than start another. Checked here too,\n\t\t\t\t// since the broadcast may have landed while the request was queued.\n\t\t\t\tif (publisher && server.publishes(Path.join(server.root, next.value.path))) {\n\t\t\t\t\tnext.value.reject(unroutable());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcurrent = next.value;\n\t\t\t\tsetRequestPublisher(current, publisher);\n\t\t\t\tyield next.value;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (server.closed.peek() !== undefined) return;\n\t\t\tawait Signal.race(server.queue, server.closed);\n\t\t\tqueued = server.queue.peek().values();\n\t\t}\n\t} finally {\n\t\tdrop();\n\t}\n}\n\n/**\n * An exact route in an origin, owning its broadcast.\n *\n * Create one with {@link Producer.route}, or a job's with {@link Request.route}.\n *\n * ```ts\n * // Fill the catalog before readers can find it.\n * const route = origin.route(Path.from(\"live/alice\"), { hidden: true });\n * route.broadcast.createTrack(\"catalog.json\");\n * route.announce(); // visible now, same identity\n * route.setCost(5n); // re-prices in place\n * route.withdraw(); // hidden; announce() again continues the same stream\n * ```\n *\n * {@link close} retracts it and closes its broadcast, and so does closing the broadcast.\n *\n * @public\n */\nexport class Route {\n\t/** The broadcast this route owns, to fill with tracks. */\n\treadonly broadcast: broadcast.Producer;\n\treadonly #control: RouteControl;\n\n\tprivate constructor(producer: broadcast.Producer, control: RouteControl) {\n\t\tthis.broadcast = producer;\n\t\tthis.#control = control;\n\t\tregisterControl(this, control);\n\t}\n\n\tstatic {\n\t\tmakeRoute = (producer, control) => new Route(producer, control);\n\t}\n\n\t/**\n\t * The stream this route serves, minted when it was created unless {@link RouteOptions.identity}\n\t * named one, and fixed for the route's life.\n\t */\n\tget identity(): Identity.Valid {\n\t\treturn this.#control.identity();\n\t}\n\n\t/**\n\t * Make the route visible, or keep it so. Idempotent.\n\t *\n\t * Visible to local consumers before it returns. A job's route ({@link Request.route}) also\n\t * releases the requesters waiting on its path through the claim, which resolve it afresh: onto\n\t * this route, under its own identity, unless pinned to the claim's. Throws once the route or its\n\t * broadcast closed, and, announcing nothing, with {@link StreamCode | StreamCode.Unroutable} when\n\t * a job's request was released or its claim retracted meanwhile: that route can never announce.\n\t * A job's route priced above its visible claim at the claim's own prefix (see\n\t * {@link Request.route}) throws the same way, and its first announce can never be retried.\n\t */\n\tannounce(): void {\n\t\tthis.#control.announce();\n\t}\n\n\t/**\n\t * Hide the route from everyone, local and remote alike, keeping its broadcast and identity:\n\t * {@link announce} brings the same stream back. Requests for the path fail with\n\t * {@link StreamCode | StreamCode.Unroutable} meanwhile, while tracks already in flight carry\n\t * on to their own end. Idempotent.\n\t */\n\twithdraw(): void {\n\t\tthis.#control.withdraw();\n\t}\n\n\t/** Whether the route is visible. */\n\tget announced(): boolean {\n\t\treturn this.#control.announced();\n\t}\n\n\t/**\n\t * Re-price the route: lower wins among routes covering the same prefix and anonymity. A\n\t * visible route changes in place, as an update to its readers; a hidden one announces at\n\t * this price. Throws once the route or its broadcast closed, and with\n\t * {@link StreamCode | StreamCode.Unroutable}, keeping the old price, when a job's route would\n\t * cost more than its visible claim at the claim's own prefix (see {@link Request.route}).\n\t */\n\tsetCost(cost: Cost): void {\n\t\tthis.#control.change({ cost });\n\t}\n\n\t/**\n\t * Swap the credential the advertising request carries; see {@link RouteOptions.auth}.\n\t * Undefined advertises under the session's scope. Throws once the route or its broadcast closed.\n\t */\n\t// fallow-ignore-next-line unused-class-member\n\tsetAuth(auth?: Credential): void {\n\t\tthis.#control.change({ auth });\n\t}\n\n\t/** Retract the route for good, closing its broadcast and refusing a job's waiting requesters. Idempotent. */\n\tclose(): void {\n\t\tthis.#control.close();\n\t}\n\n\t/** Calls {@link close}, so `using` retracts the route. */\n\t[Symbol.dispose](): void {\n\t\tthis.close();\n\t}\n}\n\n/**\n * A prefix route in an origin: a claim that every path beneath a prefix can be served,\n * answering each request as it arrives.\n *\n * Create one with {@link Producer.claim}. Requests arrive on {@link requested}; answer each by\n * serving a broadcast already held or by creating the path's own {@link Route}.\n *\n * ```ts\n * const claim = origin.claim(Path.from(\"room\"));\n * for await (const request of claim.requested()) {\n * \tconst route = request.route({ hidden: true });\n * \troute.broadcast.createTrack(\"catalog.json\");\n * \troute.announce(); // the requesters read it\n * }\n * ```\n *\n * {@link close} retracts it and rejects the requests still waiting.\n *\n * @public\n */\nexport class Claim {\n\treadonly #control: RouteControl;\n\treadonly #requested: () => AsyncIterableIterator<Request>;\n\n\tprivate constructor(control: RouteControl, requested: () => AsyncIterableIterator<Request>) {\n\t\tthis.#control = control;\n\t\tthis.#requested = requested;\n\t\tregisterControl(this, control);\n\t}\n\n\tstatic {\n\t\tmakeClaim = (control, requested) => new Claim(control, requested);\n\t}\n\n\t/**\n\t * The stream this claim serves, minted when it was created unless {@link RouteOptions.identity}\n\t * named one. A session's claim follows its peer's.\n\t */\n\tget identity(): Identity.Valid {\n\t\treturn this.#control.identity();\n\t}\n\n\t/**\n\t * Make the claim visible, or keep it so. Idempotent. Visible to local consumers before it\n\t * returns. Throws once the claim or the origin closed, and with\n\t * {@link StreamCode | StreamCode.Unroutable}, staying hidden, when it would cost less than a\n\t * visible job's route at its own prefix (see {@link Request.route}).\n\t */\n\tannounce(): void {\n\t\tthis.#control.announce();\n\t}\n\n\t/**\n\t * Hide the claim from everyone, local and remote alike, keeping its identity: {@link announce}\n\t * brings it back. Requests beneath it fail with {@link StreamCode | StreamCode.Unroutable}\n\t * meanwhile. Idempotent.\n\t */\n\twithdraw(): void {\n\t\tthis.#control.withdraw();\n\t}\n\n\t/** Whether the claim is visible. */\n\tget announced(): boolean {\n\t\treturn this.#control.announced();\n\t}\n\n\t/**\n\t * Re-price the claim: lower wins among routes covering the same prefix and anonymity. A\n\t * visible claim changes in place, as an update to its readers; a hidden one announces at\n\t * this price. Throws once the claim or the origin closed, and with\n\t * {@link StreamCode | StreamCode.Unroutable}, keeping the old price, when the claim would cost\n\t * less than a visible job's route at its own prefix (see {@link Request.route}).\n\t */\n\tsetCost(cost: Cost): void {\n\t\tthis.#control.change({ cost });\n\t}\n\n\t/**\n\t * Swap the credential the advertising request carries; see {@link RouteOptions.auth}.\n\t * Undefined advertises under the session's scope. Throws once the claim or the origin closed.\n\t */\n\t// fallow-ignore-next-line unused-class-member\n\tsetAuth(auth?: Credential): void {\n\t\tthis.#control.change({ auth });\n\t}\n\n\t/**\n\t * The requests beneath this claim, as they arrive, each to answer with {@link Request.serve},\n\t * {@link Request.route} or {@link Request.reject}. Advancing the iterator or closing it without\n\t * answering rejects the request. Ends once the claim is closed or the origin closes.\n\t */\n\trequested(): AsyncIterableIterator<Request> {\n\t\treturn this.#requested();\n\t}\n\n\t/** Retract the claim for good, rejecting the requests still waiting. Idempotent. */\n\tclose(): void {\n\t\tthis.#control.close();\n\t}\n\n\t/** Calls {@link close}, so `using` retracts the claim. */\n\t[Symbol.dispose](): void {\n\t\tthis.close();\n\t}\n}\n\n/**\n * A pending request for a broadcast to be served on demand.\n *\n * Yielded by {@link Claim.requested}. Answer it one of three ways: {@link serve} a broadcast\n * already held, under the claim's identity; create the path's own exact route with\n * {@link route}, a job of its own identity; or {@link reject} it with an error. Advancing the iterator or closing it\n * without answering rejects the request.\n *\n * @public\n */\nexport class Request {\n\t/** The path that was requested. */\n\treadonly path: Path.Valid;\n\n\t#server: ServeState;\n\t// Answered by the application, or withdrawn by the origin before it was.\n\t#state: \"pending\" | \"answered\" | \"withdrawn\" = \"pending\";\n\t#publisher?: Producer;\n\t// Settled once the origin withdraws it: nobody waits on its answer any more.\n\t#unwanted = new Once<true>();\n\n\tprivate constructor(path: Path.Valid, server: ServeState) {\n\t\tthis.path = path;\n\t\tthis.#server = server;\n\t}\n\n\tstatic {\n\t\tmakeRequest = (path, server) => new Request(path, server);\n\t\tsetRequestPublisher = (request, publisher) => {\n\t\t\trequest.#publisher = publisher;\n\t\t};\n\t\tjobPending = (request) => request.#server.has(request);\n\t\t// Its exact route owns availability: never cache a published job under the prefix,\n\t\t// which would keep serving it after that exact route is withdrawn.\n\t\treleaseJob = (request) => request.#server.release(request);\n\t\trejectJob = (request, err) => request.#server.reject(request, err);\n\t\tjobServer = (request) => request.#server;\n\t\tfinishRequest = (request, err) => {\n\t\t\trequest.#state = \"withdrawn\";\n\t\t\tif (request.#unwanted.peek() === undefined) request.#unwanted.set(true);\n\t\t\tvoid err;\n\t\t};\n\t}\n\n\t/**\n\t * Resolves once no requester waits on the answer any more: each left, or the origin moved\n\t * them to another route. Final: a later requester gets a new request.\n\t */\n\t// Public API for a claimant's owner, such as an orchestrator deciding whether to launch work.\n\t// fallow-ignore-next-line unused-class-member\n\tasync unwanted(): Promise<void> {\n\t\tawait this.#unwanted;\n\t}\n\n\t/**\n\t * Answer with the path's own exact route, owning a new broadcast.\n\t *\n\t * The route mints its own identity unless `options` names one, as {@link Producer.route}\n\t * does: the job is its own stream, so a job that ends and restarts beneath the same claim is a\n\t * new stream at its path, and the claim keeps its identity and keeps answering later\n\t * requests. A reader that resolved the path through the claim moves to the job's identity as a\n\t * new stream: a follower is handed the job's broadcast, and a request pinned to the claim's\n\t * identity is refused. Created visible, the route announces now and releases the requesters\n\t * waiting on its path, which resolve it afresh. Created {@link RouteOptions.hidden | hidden},\n\t * they wait until {@link Route.announce}, so the job can fill its catalog first; closing the\n\t * route or its broadcast before then refuses them.\n\t *\n\t * At the claim's own prefix, the job may cost no more than the claim: both rank in one tier,\n\t * where cost comes first, so a pricier job would lose its path to the claim, which would ask for\n\t * another job. Neither may be re-priced past the other while both are visible.\n\t *\n\t * Throws {@link StreamCode | StreamCode.Unroutable} on a request a session forwarded, which can\n\t * only {@link serve} its peer's broadcast, when `options` price the job above its claim at the\n\t * claim's own prefix, refusing the requesters, and, announcing nothing, once the request was\n\t * released or its claim retracted. Otherwise it throws as {@link Producer.route} does.\n\t */\n\troute(options: RouteOptions = {}): Route {\n\t\tif (this.#state !== \"pending\") throw new Error(\"request is closed\");\n\t\tif (!this.#publisher) throw unroutable();\n\t\tlet route: Route;\n\t\ttry {\n\t\t\troute = exactRoute(this.#publisher, this.path, options, this);\n\t\t} finally {\n\t\t\t// Refused for its price, the request is answered: its requesters were refused.\n\t\t\tif (!jobPending(this)) this.#state = \"answered\";\n\t\t}\n\t\tthis.#state = \"answered\";\n\t\treturn route;\n\t}\n\n\t/**\n\t * Serve a held broadcast under this claim without announcing an exact route.\n\t *\n\t * Takes ownership of a consumer; a producer stays the caller's. Every answer at this\n\t * path belongs to the claim's identity and must continue the same keys and\n\t * bytes. Start a new claim for different content, or use {@link route} for a job\n\t * that can restart independently, whose route carries its own identity.\n\t */\n\tserve(source: broadcast.Producer | broadcast.Consumer): void {\n\t\tif (this.#state !== \"pending\") {\n\t\t\t// A withdrawn request takes no answer. Only the handed-off consumer is ours;\n\t\t\t// the application still owns its producer and any other consumers.\n\t\t\tif (this.#state === \"withdrawn\" && source instanceof broadcast.Consumer) source.close();\n\t\t\treturn;\n\t\t}\n\t\tthis.#state = \"answered\";\n\t\tconst front = source instanceof broadcast.Producer ? source.consume() : source;\n\t\tthis.#server.accept(this, front);\n\t}\n\n\t/** Reject the request, resolving every awaiting requester with `err`. */\n\treject(err: Error): void {\n\t\tif (this.#state !== \"pending\") return;\n\t\tthis.#state = \"answered\";\n\n\t\tthis.#server.reject(this, err);\n\t}\n}\n"]}
|