@moq/net 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/announced.d.ts +14 -0
  2. package/announced.d.ts.map +1 -1
  3. package/announced.js.map +1 -1
  4. package/broadcast.d.ts +6 -3
  5. package/broadcast.d.ts.map +1 -1
  6. package/broadcast.js +9 -5
  7. package/broadcast.js.map +1 -1
  8. package/connection/accept.js +9 -1
  9. package/connection/accept.js.map +1 -1
  10. package/connection/connect.d.ts.map +1 -1
  11. package/connection/connect.js +10 -1
  12. package/connection/connect.js.map +1 -1
  13. package/connection/established.d.ts +2 -1
  14. package/connection/established.d.ts.map +1 -1
  15. package/connection/established.js.map +1 -1
  16. package/connection/forward.js +9 -2
  17. package/connection/forward.js.map +1 -1
  18. package/connection/handshake.d.ts +1 -0
  19. package/connection/handshake.d.ts.map +1 -1
  20. package/connection/handshake.js +3 -0
  21. package/connection/handshake.js.map +1 -1
  22. package/connection/pool.d.ts +8 -10
  23. package/connection/pool.d.ts.map +1 -1
  24. package/connection/pool.js +18 -8
  25. package/connection/pool.js.map +1 -1
  26. package/connection/reload.js +6 -6
  27. package/connection/reload.js.map +1 -1
  28. package/error.d.ts.map +1 -1
  29. package/error.js +21 -0
  30. package/error.js.map +1 -1
  31. package/ietf/adapter.d.ts +5 -1
  32. package/ietf/adapter.d.ts.map +1 -1
  33. package/ietf/adapter.js +27 -9
  34. package/ietf/adapter.js.map +1 -1
  35. package/ietf/connection.d.ts +1 -1
  36. package/ietf/connection.d.ts.map +1 -1
  37. package/ietf/connection.js +9 -5
  38. package/ietf/connection.js.map +1 -1
  39. package/ietf/error.js +27 -2
  40. package/ietf/error.js.map +1 -1
  41. package/ietf/hidden.d.ts +2 -0
  42. package/ietf/hidden.d.ts.map +1 -0
  43. package/ietf/hidden.js +30 -0
  44. package/ietf/hidden.js.map +1 -0
  45. package/ietf/index.d.ts +1 -0
  46. package/ietf/index.d.ts.map +1 -1
  47. package/ietf/index.js +1 -0
  48. package/ietf/index.js.map +1 -1
  49. package/ietf/object.d.ts +8 -2
  50. package/ietf/object.d.ts.map +1 -1
  51. package/ietf/object.js +17 -3
  52. package/ietf/object.js.map +1 -1
  53. package/ietf/parameters.d.ts +5 -0
  54. package/ietf/parameters.d.ts.map +1 -1
  55. package/ietf/parameters.js +20 -0
  56. package/ietf/parameters.js.map +1 -1
  57. package/ietf/properties.d.ts +1 -0
  58. package/ietf/properties.d.ts.map +1 -1
  59. package/ietf/properties.js +14 -0
  60. package/ietf/properties.js.map +1 -1
  61. package/ietf/publish.d.ts +19 -2
  62. package/ietf/publish.d.ts.map +1 -1
  63. package/ietf/publish.js +40 -6
  64. package/ietf/publish.js.map +1 -1
  65. package/ietf/publisher.js +114 -60
  66. package/ietf/publisher.js.map +1 -1
  67. package/ietf/subscribe.d.ts.map +1 -1
  68. package/ietf/subscribe.js +3 -4
  69. package/ietf/subscribe.js.map +1 -1
  70. package/ietf/subscribe_namespace.d.ts +8 -2
  71. package/ietf/subscribe_namespace.d.ts.map +1 -1
  72. package/ietf/subscribe_namespace.js +18 -8
  73. package/ietf/subscribe_namespace.js.map +1 -1
  74. package/ietf/subscriber.js +189 -66
  75. package/ietf/subscriber.js.map +1 -1
  76. package/internal.d.ts +7 -0
  77. package/internal.d.ts.map +1 -1
  78. package/internal.js +11 -0
  79. package/internal.js.map +1 -1
  80. package/lite/announce.d.ts +46 -2
  81. package/lite/announce.d.ts.map +1 -1
  82. package/lite/announce.js +126 -11
  83. package/lite/announce.js.map +1 -1
  84. package/lite/connection.d.ts +1 -1
  85. package/lite/connection.d.ts.map +1 -1
  86. package/lite/connection.js +9 -3
  87. package/lite/connection.js.map +1 -1
  88. package/lite/publisher.js +168 -109
  89. package/lite/publisher.js.map +1 -1
  90. package/lite/subscribe.d.ts +10 -4
  91. package/lite/subscribe.d.ts.map +1 -1
  92. package/lite/subscribe.js +20 -10
  93. package/lite/subscribe.js.map +1 -1
  94. package/lite/subscriber.d.ts +10 -2
  95. package/lite/subscriber.d.ts.map +1 -1
  96. package/lite/subscriber.js +159 -93
  97. package/lite/subscriber.js.map +1 -1
  98. package/lite/version.d.ts +11 -0
  99. package/lite/version.d.ts.map +1 -1
  100. package/lite/version.js +56 -0
  101. package/lite/version.js.map +1 -1
  102. package/origin.d.ts +37 -18
  103. package/origin.d.ts.map +1 -1
  104. package/origin.js +248 -103
  105. package/origin.js.map +1 -1
  106. package/package.json +7 -3
  107. package/stream.d.ts +2 -2
  108. package/stream.d.ts.map +1 -1
  109. package/stream.js +16 -11
  110. package/stream.js.map +1 -1
  111. package/tail.d.ts +11 -0
  112. package/tail.d.ts.map +1 -0
  113. package/tail.js +121 -0
  114. package/tail.js.map +1 -0
  115. package/track.d.ts +33 -5
  116. package/track.d.ts.map +1 -1
  117. package/track.js +98 -30
  118. package/track.js.map +1 -1
  119. package/wire.d.ts +2 -0
  120. package/wire.d.ts.map +1 -1
  121. package/wire.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../src/ietf/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAA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AC;QACb,qBAAqB,CAAC,IAAI,EAAE;YAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SAC7F,CAAC,CAAC;IACJ,CAAC;IAED,qFAAqF;IAC5E,KAAK;QACb,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAChD,CAAC;CACD","sourcesContent":["import * as announce from \"../announced.ts\";\nimport * as broadcast from \"../broadcast.ts\";\nimport { BroadcastCache } from \"../consume.ts\";\nimport { controlTimeout, error, ProtocolViolation, reason } from \"../error.ts\";\nimport * as netGroup from \"../group.ts\";\nimport { Cost, type Route, routesEqual, UNKNOWN_HOP } from \"../hop.ts\";\nimport { scopeCaptures, scopeHead, scopeOverlaps } from \"../internal.ts\";\nimport * as Path from \"../path.ts\";\nimport type { Reader, Stream } from \"../stream.ts\";\nimport { type Timescale, Timestamp } from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { TimeoutError, withTimeout } from \"../util/timeout.ts\";\nimport { overrideBroadcastWire, wireOf } from \"../wire.ts\";\nimport type { Session } from \"./adapter.ts\";\nimport { DuplicateTrackAlias, RetiredTrackAlias, TrackAliases } from \"./aliases.ts\";\nimport * as Cluster from \"./cluster.ts\";\nimport { requestReason, toRequestCode } from \"./error.ts\";\nimport { Frame, type Group as GroupMessage } from \"./object.ts\";\nimport { toWire } from \"./priority.ts\";\nimport { type Publish, PublishError } from \"./publish.ts\";\nimport {\n\ttype PublishNamespace,\n\tPublishNamespaceDone,\n\tPublishNamespaceError,\n\tPublishNamespaceOk,\n\tPublishNamespaceUpdate,\n} from \"./publish_namespace.ts\";\nimport { RequestError, RequestOk } from \"./request.ts\";\nimport { joinFilter, Subscribe, SubscribeError, SubscribeOk, Unsubscribe } from \"./subscribe.ts\";\nimport {\n\tPublishBlocked,\n\tSubscribeNamespace,\n\tSubscribeNamespaceEntry,\n\tSubscribeNamespaceEntryDone,\n\tSubscribeNamespaceLegacy,\n\tSubscribeNamespaceOk,\n\tUnsubscribeNamespace,\n} from \"./subscribe_namespace.ts\";\nimport { Version } from \"./version.ts\";\n\n// Bound on how long stream-open plus SUBSCRIBE_OK may take. Browsers cap\n// concurrent QUIC streams (Chrome ~100); past the cap openBi() silently\n// blocks. The timeout turns that into a clear error.\nconst SUBSCRIBE_OK_TIMEOUT_MS = 10_000;\n\n// Out-parameter for #openSubscribe: lets the caller observe partial progress\n// (stream opened, trackAlias registered) so it can clean up on timeout even\n// before the setup promise settles.\ntype SubscribeSetupState = {\n\tstream?: Stream;\n\tregisteredAlias?: bigint;\n\t/**\n\t * Whether the caller has given up. Setup checks this once the stream exists so a request\n\t * opened after the timeout still unwinds: nothing else settles setup if the peer has\n\t * gone quiet, and the cleanup that fired first saw no stream to tear down.\n\t */\n\tcancelled?: boolean;\n\t/**\n\t * Whether the SUBSCRIBE reached the wire. From that moment the publisher may be serving,\n\t * even before it answers, so abandoning owes it a cancellation regardless of whether we\n\t * ever saw the SUBSCRIBE_OK.\n\t */\n\tsent?: boolean;\n\t/**\n\t * Whether the publisher answered with an error. It has torn the request down already, so\n\t * there is nothing left to cancel and naming the dead request id at it risks being read\n\t * as a protocol violation.\n\t */\n\trejected?: boolean;\n};\n\n/**\n * Handles subscribing to broadcasts using moq-transport protocol.\n * Uses the stream-per-request pattern (real bidi streams for v17, virtual for v14-v16).\n *\n * @internal\n */\nexport class Subscriber {\n\t#session: Session;\n\n\t// The Hop IDs this session declared; see {@link Cluster}. What the peer declared is what\n\t// says whether an advertisement carries a hop path, and ours is what a path looping back\n\t// to us contains.\n\t#cluster?: Cluster.Hops;\n\n\t// Publisher-chosen aliases used by incoming group streams.\n\t#aliases = new TrackAliases<track.Producer>();\n\n\t// Units for each track's object Timestamps, from the TIMESCALE Track Property in\n\t// SUBSCRIBE_OK. A track missing from this map declared no timeline, so the publisher\n\t// opted out of timestamps and its frames are stamped on arrival instead.\n\t#timescales = new Map<bigint, Timescale>();\n\n\t// Dedup consumed broadcasts per path: repeat consume() calls share one subscription.\n\t#consumes = new BroadcastCache();\n\n\t// Paths with a legacy PUBLISH_NAMESPACE request in flight, reserved synchronously.\n\t// The count below is only taken once the OK is written, and two requests that both\n\t// got past the duplicate check before either attached would both take one.\n\t#legacyRequests = new Set<Path.Valid>();\n\n\t// Every announced path, counted by how many live advertisements reference it.\n\t//\n\t// A peer may advertise one namespace twice on a session: an unsolicited\n\t// PUBLISH_NAMESPACE and an inline NAMESPACE answering our own SUBSCRIBE_NAMESPACE are\n\t// two messages about one source, which the MoQ Solicit draft requires us to tolerate.\n\t// Counting them is what keeps the second from duplicating the announce and the first\n\t// to end from retracting what the other still holds.\n\t#announced = new Map<Path.Valid, { count: number; route: Route }>();\n\n\t// Any consumers that want each new announcement, keyed by their local filter.\n\t#announcedConsumers = new Map<announce.Producer, Path.Pattern>();\n\n\t/**\n\t * Creates a new Subscriber instance.\n\t *\n\t * @internal\n\t */\n\tconstructor({\n\t\tsession,\n\t\tcluster,\n\t}: {\n\t\t/** The session abstraction for bidi streams and request IDs. */\n\t\tsession: Session;\n\t\t/** The Hop IDs the SETUP exchange settled (MoQ Cluster). */\n\t\tcluster?: Cluster.Hops;\n\t}) {\n\t\tthis.#session = session;\n\t\tthis.#cluster = cluster;\n\t}\n\n\t/**\n\t * Whether an advertisement is ours coming back: its hop path already ran through us, so\n\t * subscribing via it would route us back to ourselves.\n\t *\n\t * A conforming peer withholds these (it knows our Hop ID), so this is the backstop that\n\t * keeps a mesh working when one member does not. A session that negotiated nothing\n\t * carries no path, and there is nothing to check.\n\t */\n\t#reflected(advert: Cluster.Advert | undefined): boolean {\n\t\treturn advert !== undefined && this.#cluster !== undefined && Cluster.loops(advert, this.#cluster.self);\n\t}\n\n\t/** The route an advertisement carries; one without a path is anonymous and free. */\n\t#route(advert: Cluster.Advert | undefined): Route {\n\t\tif (advert === undefined) return { hops: [UNKNOWN_HOP], cost: Cost.zero };\n\t\treturn { hops: advert.hops, cost: { warm: advert.cost, cold: advert.cost } };\n\t}\n\n\t/**\n\t * Gets an announced reader matching `scope`. Paths are relative to the session,\n\t * not the scope.\n\t *\n\t * The peer is asked with SUBSCRIBE_NAMESPACE regardless of what it declared, and an\n\t * unsolicited PUBLISH_NAMESPACE lands here too, so a peer that only tells and one\n\t * that only answers are both discovered.\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all()): announce.Consumer {\n\t\t// The wire speaks announce interest by prefix.\n\t\tconst prefix = scopeHead(scope);\n\t\tconst announced = new announce.Producer();\n\t\tfor (const [active, info] of this.#announced) {\n\t\t\tif (!scopeOverlaps(scope, active)) continue;\n\t\t\tannounced.append({\n\t\t\t\tprefix: active,\n\t\t\t\tcaptures: scopeCaptures(scope, active),\n\t\t\t\tkind: \"announced\",\n\t\t\t\troute: info.route,\n\t\t\t});\n\t\t}\n\t\tthis.#announcedConsumers.set(announced, scope);\n\n\t\tvoid this.#runAnnounced(announced, prefix).finally(() => {\n\t\t\tthis.#announcedConsumers.delete(announced);\n\t\t\tannounced.close();\n\t\t});\n\n\t\treturn announced.consume();\n\t}\n\n\t/**\n\t * Record one more advertisement for a path, telling consumers only when it is the\n\t * first. A second one is the same namespace said twice, not news.\n\t */\n\t#attachAnnounce(path: Path.Valid, route: Route) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing) {\n\t\t\texisting.count += 1;\n\t\t\treturn;\n\t\t}\n\t\tthis.#announced.set(path, { count: 1, route });\n\n\t\tconsole.debug(`announced: broadcast=${path} active=true`);\n\t\tfor (const [consumer, scope] of this.#announcedConsumers) {\n\t\t\tif (!scopeOverlaps(scope, path)) continue;\n\t\t\tconsumer.append({ prefix: path, captures: scopeCaptures(scope, path), kind: \"announced\", route });\n\t\t}\n\t}\n\n\t/**\n\t * Replace the stored route for a path that is already announced. A no-op when the\n\t * hops and cost did not change; otherwise consumers hear `updated` so a forwarder\n\t * can reprice without retracting.\n\t */\n\t#updateAnnounce(path: Path.Valid, route: Route) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing === undefined || routesEqual(existing.route, route)) return;\n\t\texisting.route = route;\n\t\tconsole.debug(`announced: broadcast=${path} rerouted`);\n\t\tfor (const [consumer, scope] of this.#announcedConsumers) {\n\t\t\tif (!scopeOverlaps(scope, path)) continue;\n\t\t\tconsumer.append({ prefix: path, captures: scopeCaptures(scope, path), kind: \"updated\", route });\n\t\t}\n\t}\n\n\t/**\n\t * Drop one advertisement for a path, retracting it only once the last one goes.\n\t */\n\t#detachAnnounce(path: Path.Valid) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing === undefined) return;\n\t\tif (existing.count > 1) {\n\t\t\texisting.count -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#announced.delete(path);\n\n\t\t// The path is gone, so stop sharing its broadcast: a holder outliving the publisher\n\t\t// would otherwise hand the dead generation to whoever consumes the path next.\n\t\tthis.#consumes.evict(path);\n\t\tconsole.debug(`announced: broadcast=${path} active=false`);\n\n\t\tfor (const [consumer, scope] of this.#announcedConsumers) {\n\t\t\tif (!scopeOverlaps(scope, path)) continue;\n\t\t\ttry {\n\t\t\t\tconsumer.append({\n\t\t\t\t\tprefix: path,\n\t\t\t\t\tcaptures: scopeCaptures(scope, path),\n\t\t\t\t\tkind: \"retracted\",\n\t\t\t\t\troute: existing.route,\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\t// Consumer already closed, will be cleaned up\n\t\t\t}\n\t\t}\n\t}\n\n\tasync #runAnnounced(announced: announce.Producer, prefix: Path.Valid) {\n\t\tconst version = this.#session.version;\n\n\t\t// Suffixes live on this stream, so a repeat is recognized as an update to the\n\t\t// advertisement rather than a second one, which would leak the count.\n\t\tconst live = new Set<Path.Valid>();\n\n\t\t// Set once the teardown below has given back everything this stream held. The read\n\t\t// loop is not awaited when the local consumer closes first, and closing the stream\n\t\t// cancels the transport without discarding what the reader already buffered, so a\n\t\t// fully buffered entry can still decode afterwards. Attaching one then would take a\n\t\t// reference nobody is left to release, pinning the path for the session.\n\t\tlet released = false;\n\n\t\t// v14/v15: SubscribeNamespace on control stream (via adapter virtual stream)\n\t\t// v16+: SubscribeNamespace on its own real bidi stream\n\n\t\tconst requestId = await this.#session.nextRequestId();\n\t\tif (requestId === undefined) return;\n\n\t\ttry {\n\t\t\t// v16: use a real bidi stream (not virtual control stream)\n\t\t\tconst stream =\n\t\t\t\tversion === Version.DRAFT_16 && this.#session.openNativeBi\n\t\t\t\t\t? await this.#session.openNativeBi()\n\t\t\t\t\t: await this.#session.openBi();\n\n\t\t\ttry {\n\t\t\t\t// Draft-18+ uses SUBSCRIBE_NAMESPACE (0x50); earlier drafts use the\n\t\t\t\t// legacy 0x11 message with a Subscribe Options field.\n\t\t\t\tif (\n\t\t\t\t\tversion === Version.DRAFT_14 ||\n\t\t\t\t\tversion === Version.DRAFT_15 ||\n\t\t\t\t\tversion === Version.DRAFT_16 ||\n\t\t\t\t\tversion === Version.DRAFT_17\n\t\t\t\t) {\n\t\t\t\t\tawait stream.writer.u53(SubscribeNamespaceLegacy.id);\n\t\t\t\t\tawait new SubscribeNamespaceLegacy({ namespace: prefix, requestId }).encode(stream.writer, version);\n\t\t\t\t} else {\n\t\t\t\t\tawait stream.writer.u53(SubscribeNamespace.id);\n\t\t\t\t\tawait new SubscribeNamespace({ namespace: prefix, requestId }).encode(stream.writer, version);\n\t\t\t\t}\n\t\t\t\tconsole.debug(`subscribe_namespace written: requestId=${requestId}`);\n\n\t\t\t\t// Read response\n\t\t\t\tconst respTypeId = await stream.reader.u53();\n\t\t\t\tif (respTypeId === RequestOk.id) {\n\t\t\t\t\tawait RequestOk.decode(stream.reader, version);\n\t\t\t\t} else if (respTypeId === SubscribeNamespaceOk.id) {\n\t\t\t\t\t// v14: SubscribeNamespaceOk\n\t\t\t\t\tconst size = await stream.reader.u16();\n\t\t\t\t\tawait stream.reader.read(size);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`SubscribeNamespace rejected: typeId=0x${respTypeId.toString(16)}`);\n\t\t\t\t}\n\n\t\t\t\t// Loop reading Namespace/NamespaceDone entries\n\t\t\t\tconst readLoop = (async () => {\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tconst done = await stream.reader.done();\n\t\t\t\t\t\tif (done) break;\n\n\t\t\t\t\t\tconst msgType = await stream.reader.u53();\n\t\t\t\t\t\tif (msgType === SubscribeNamespaceEntry.id) {\n\t\t\t\t\t\t\tconst entry = await SubscribeNamespaceEntry.decode(\n\t\t\t\t\t\t\t\tstream.reader,\n\t\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\t\tCluster.negotiated(this.#cluster),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (released) break;\n\t\t\t\t\t\t\tconst path = Path.join(prefix, entry.suffix);\n\n\t\t\t\t\t\t\t// A repeat updates the advertisement in place, so one that now\n\t\t\t\t\t\t\t// loops back through us has taken a route we can't subscribe\n\t\t\t\t\t\t\t// over: the path is gone even though the message says active.\n\t\t\t\t\t\t\tif (this.#reflected(entry.cluster)) {\n\t\t\t\t\t\t\t\tconsole.debug(`dropping reflected namespace: broadcast=${path}`);\n\t\t\t\t\t\t\t\tif (live.delete(path)) this.#detachAnnounce(path);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// A repeat replaces the advertisement in place: HOP_PATH / ROUTE_COST\n\t\t\t\t\t\t\t// can change without a NAMESPACE_DONE. Only the first is a new path.\n\t\t\t\t\t\t\tconst route = this.#route(entry.cluster);\n\t\t\t\t\t\t\tif (live.has(path)) {\n\t\t\t\t\t\t\t\tthis.#updateAnnounce(path, route);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlive.add(path);\n\t\t\t\t\t\t\t\tthis.#attachAnnounce(path, route);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (msgType === SubscribeNamespaceEntryDone.id) {\n\t\t\t\t\t\t\tconst entry = await SubscribeNamespaceEntryDone.decode(stream.reader, version);\n\t\t\t\t\t\t\tif (released) break;\n\t\t\t\t\t\t\tconst path = Path.join(prefix, entry.suffix);\n\n\t\t\t\t\t\t\tif (live.delete(path)) {\n\t\t\t\t\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (msgType === PublishBlocked.id && version === Version.DRAFT_17) {\n\t\t\t\t\t\t\tconst blocked = await PublishBlocked.decode(stream.reader, version);\n\t\t\t\t\t\t\tconsole.debug(`publish_blocked: suffix=${blocked.suffix} track=${blocked.trackName}`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`unexpected message on subscribe_namespace stream: 0x${msgType.toString(16)}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})();\n\n\t\t\t\t// The race below can end through the consumer's close while a message that\n\t\t\t\t// already arrived is still decoding, which leaves the loop with nothing\n\t\t\t\t// awaiting it: a violation decoded after that would land nowhere, and its\n\t\t\t\t// rejection would go unhandled. Idempotent with the catch below, which is\n\t\t\t\t// what runs when the loop is the one that ends the race.\n\t\t\t\treadLoop.catch((err: unknown) => {\n\t\t\t\t\tif (err instanceof ProtocolViolation) this.#session.close();\n\t\t\t\t});\n\n\t\t\t\t// Wait for either the read loop or the announced to close\n\t\t\t\tawait Promise.race([readLoop, announced.closed]);\n\n\t\t\t\t// For v14/v15: send UnsubscribeNamespace before closing\n\t\t\t\tif (version === Version.DRAFT_14 || version === Version.DRAFT_15) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait stream.writer.u53(UnsubscribeNamespace.id);\n\t\t\t\t\t\tconst unsub = new UnsubscribeNamespace({ requestId });\n\t\t\t\t\t\tawait unsub.encode(stream.writer, version);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Stream might already be closed\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstream.close();\n\t\t\t} catch (err) {\n\t\t\t\tstream.abort(error(err));\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`subscribe_namespace error: ${reason(e)}`);\n\n\t\t\t// An advertisement is decoded here rather than in the session dispatch, so this\n\t\t\t// is the only place a malformed one surfaces. The cluster draft requires closing\n\t\t\t// the session over those, and the stream alone is not enough: the peer would\n\t\t\t// just repeat it on the next SUBSCRIBE_NAMESPACE.\n\t\t\tif (e instanceof ProtocolViolation) this.#session.close();\n\n\t\t\t// Abort the stream rather than letting the caller's `finally` close it cleanly.\n\t\t\t// A rejected namespace subscription is a failure, and a consumer that can't tell\n\t\t\t// it from \"nothing is published under this prefix\" waits forever on a broadcast\n\t\t\t// that will never be announced. Matches the lite subscriber.\n\t\t\tannounced.close(e);\n\t\t} finally {\n\t\t\t// The stream owns every advertisement it carried, so release them however it\n\t\t\t// ends: a clean close, a decode error, or the peer resetting it. Without this\n\t\t\t// each namespace keeps its count and the source never detaches, which would\n\t\t\t// pin the path for the session even after the other source withdrew.\n\t\t\treleased = true;\n\t\t\tfor (const path of live) {\n\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t}\n\t\t\tlive.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Consumes a broadcast from the connection.\n\t *\n\t * Deduplicated per path: repeat calls for the same still-live path share one reference-counted\n\t * broadcast (and one upstream subscription). The shared broadcast closes once every caller has\n\t * closed its handle, so callers close normally.\n\t */\n\tconsume(path: Path.Valid): broadcast.Consumer {\n\t\treturn this.#consumes.get(path) ?? this.#consumes.insert(path, this.#createConsume(path));\n\t}\n\n\t#createConsume(path: Path.Valid): broadcast.Consumer {\n\t\t// moq-transport has no one-shot group fetch; ConsumeBroadcast rejects it. Track info\n\t\t// is resolved by the subscribe path (the inherited resolveTrackInfo).\n\t\tconst consumer = new ConsumeBroadcast();\n\n\t\tvoid (async () => {\n\t\t\tfor (;;) {\n\t\t\t\tconst request = await wireOf(consumer).requested();\n\t\t\t\tif (!request) break;\n\t\t\t\tvoid this.#runSubscribe(path, request);\n\t\t\t}\n\t\t})();\n\n\t\treturn consumer;\n\t}\n\n\tasync #runSubscribe(broadcast: Path.Valid, request: track.Request) {\n\t\tconst requestId = await this.#session.nextRequestId();\n\t\tif (requestId === undefined) {\n\t\t\trequest.reject(new Error(\"session closed\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\n\t\t// IETF negotiates group order in SUBSCRIBE_OK; this implementation only supports\n\t\t// descending (newest-first), which is what moq-lite fixes group order to, so the\n\t\t// mapping needs nothing here. (There's no per-frame timescale either, so every\n\t\t// property stays at its default.) This resolves the consumer's track.info() and\n\t\t// gives us the write side that incoming object streams are routed into.\n\t\tconst producer = request.accept({});\n\n\t\t// Open the stream and wait for SUBSCRIBE_OK under a timeout. State\n\t\t// flows back via `state` so the timeout path can clean up the stream\n\t\t// and any registration if setup eventually finishes.\n\t\tconst state: SubscribeSetupState = {};\n\t\tconst setup = this.#openSubscribe(state, broadcast, request, producer, requestId);\n\n\t\t// The publisher can be serving before it answers, so waiting only on the response\n\t\t// would miss the local side going away and leave it serving a track nobody reads.\n\t\t// Demand returning before we commit is not abandonment, matching the serving loop.\n\t\tconst waitAbandoned = async (): Promise<null> => {\n\t\t\tfor (;;) {\n\t\t\t\tawait producer.unused();\n\t\t\t\tif (producer.closed.peek() !== undefined || !producer.used.peek()) return null;\n\t\t\t}\n\t\t};\n\n\t\tlet stream: Stream;\n\t\tlet trackAlias: bigint;\n\t\ttry {\n\t\t\tconst result = await Promise.race([\n\t\t\t\twithTimeout(\n\t\t\t\t\tsetup,\n\t\t\t\t\tSUBSCRIBE_OK_TIMEOUT_MS,\n\t\t\t\t\t`subscribe timed out after ${SUBSCRIBE_OK_TIMEOUT_MS}ms waiting for SUBSCRIBE_OK (browser stream limit reached?)`,\n\t\t\t\t),\n\t\t\t\twaitAbandoned(),\n\t\t\t]);\n\n\t\t\tif (result === null) throw new Error(\"subscribe abandoned before it was accepted\");\n\n\t\t\tstream = result.stream;\n\t\t\ttrackAlias = result.alias;\n\t\t\tconsole.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\t// A control request that timed out is not late content, so it carries its own code.\n\t\t\tconst e = err instanceof TimeoutError ? controlTimeout(err) : error(err);\n\t\t\tproducer.close(e);\n\t\t\tconsole.warn(\n\t\t\t\t`subscribe error: id=${requestId} broadcast=${broadcast} track=${request.name} error=${reason(e)}`,\n\t\t\t);\n\t\t\t// Runs now for whatever is already open, and again if `setup` settles late.\n\t\t\t// Retirement is repeated because a late SUBSCRIBE_OK can register an alias after\n\t\t\t// the first pass; the stream is torn down once.\n\t\t\tlet torn = false;\n\t\t\tconst cleanup = async (afterSetup: boolean) => {\n\t\t\t\tstate.cancelled = true;\n\n\t\t\t\tif (state.registeredAlias !== undefined && this.#aliases.retire(state.registeredAlias, producer)) {\n\t\t\t\t\tthis.#timescales.delete(state.registeredAlias);\n\t\t\t\t}\n\n\t\t\t\tif (!state.stream || torn) return;\n\n\t\t\t\t// A SUBSCRIBE still being written must not be torn down from here. Aborting a\n\t\t\t\t// Web Stream waits for the in-flight write, so the request can still reach the\n\t\t\t\t// peer while the abort destroys the stream we would have cancelled on. Setup\n\t\t\t\t// unwinds on the cancelled flag once that write lands, and its pass below has\n\t\t\t\t// the finished picture.\n\t\t\t\tif (!state.sent && !afterSetup) return;\n\t\t\t\ttorn = true;\n\n\t\t\t\t// Once the SUBSCRIBE is out the publisher may be serving, whether or not it has\n\t\t\t\t// answered yet: data streams are independent of the request stream. Aborting says\n\t\t\t\t// nothing on v14-16, where the request rides a virtual stream whose reset is\n\t\t\t\t// local, so the UNSUBSCRIBE has to go out explicitly.\n\t\t\t\tif (state.sent && !state.rejected) await this.#cancelSubscribe(state.stream, requestId);\n\t\t\t\tstate.stream.abort(e);\n\t\t\t};\n\n\t\t\t// Tear down what is already open rather than waiting on `setup`. A peer that\n\t\t\t// opened the stream and then went quiet never settles it, and deferring would\n\t\t\t// leave the request outstanding for the life of the session -- which is the\n\t\t\t// timeout case, not a rare one.\n\t\t\tvoid cleanup(false);\n\t\t\tsetup.then(\n\t\t\t\t() => cleanup(true),\n\t\t\t\t() => cleanup(true),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Which terminal fired decides whether we owe the publisher a cancellation, so\n\t\t\t// tag them rather than racing bare promises.\n\t\t\tconst publisherEnded = Symbol(\"publisher\");\n\t\t\tconst localEnded = Symbol(\"local\");\n\t\t\tconst idle = Symbol(\"idle\");\n\n\t\t\t// Terminal conditions settle at most once (stream close = PublishDone, track close =\n\t\t\t// local unsubscribe); race them once so the demand loop doesn't re-subscribe each pass.\n\t\t\tconst done = Promise.race([\n\t\t\t\tstream.reader.closed.then(() => publisherEnded),\n\t\t\t\tproducer.closed.then(() => localEnded),\n\t\t\t]);\n\n\t\t\t// Serve until a terminal condition fires or the last local subscriber leaves. The unused\n\t\t\t// wake is level-triggered: re-check demand so a subscriber that returns before we tear\n\t\t\t// down resumes on the same stream.\n\t\t\tlet terminal = localEnded;\n\t\t\tfor (;;) {\n\t\t\t\tconst reason = await Promise.race([done, producer.unused().then(() => idle)]);\n\t\t\t\tif (reason === idle && producer.closed.peek() === undefined && producer.used.peek()) continue;\n\t\t\t\tterminal = reason;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Close before the cancellation is written, not after: awaiting the write first\n\t\t\t// reopens the window the demand re-check above just closed, and a subscriber that\n\t\t\t// returned during it would be closed by this line. The lite subscriber closes\n\t\t\t// straight out of its loop for the same reason.\n\t\t\tproducer.close();\n\n\t\t\t// The publisher already ended the request, so there is nothing to cancel. Sending\n\t\t\t// UNSUBSCRIBE here would name a request it has already torn down.\n\t\t\tif (terminal !== publisherEnded) await this.#cancelSubscribe(stream, requestId);\n\n\t\t\tstream.close();\n\t\t\tconsole.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = error(err);\n\t\t\tproducer.close(e);\n\t\t\tstream.abort(e);\n\t\t\tconsole.warn(\n\t\t\t\t`subscribe error: id=${requestId} broadcast=${broadcast} track=${request.name} error=${reason(e)}`,\n\t\t\t);\n\t\t} finally {\n\t\t\t// Only the owner tears down the alias metadata: a later subscription may have\n\t\t\t// reclaimed the alias and installed its own timescale.\n\t\t\tif (this.#aliases.retire(trackAlias, producer)) this.#timescales.delete(trackAlias);\n\t\t}\n\t}\n\n\t/**\n\t * Tell the publisher to stop serving a subscription we are walking away from.\n\t *\n\t * v14-16 cancel with UNSUBSCRIBE (draft-16 section 9.12), which is what lets the\n\t * publisher destroy the subscription (section 5.1.1); v17+ removed the message and\n\t * rely on the stream reset instead. Every path that abandons an Established\n\t * subscription goes through here, because those versions carry the request over a\n\t * virtual stream whose reset never reaches the peer.\n\t */\n\tasync #cancelSubscribe(stream: Stream, requestId: bigint) {\n\t\tconst version = this.#session.version;\n\t\tif (version !== Version.DRAFT_14 && version !== Version.DRAFT_15 && version !== Version.DRAFT_16) return;\n\n\t\ttry {\n\t\t\tawait stream.writer.u53(Unsubscribe.id);\n\t\t\tawait new Unsubscribe({ requestId }).encode(stream.writer, version);\n\t\t} catch {\n\t\t\t// The stream may already be gone; there is nothing further to tell the peer.\n\t\t}\n\t}\n\n\t// Opens the subscribe stream, sends SUBSCRIBE, and reads the response.\n\t// `state` is populated as soon as the stream opens and again when the\n\t// trackAlias is registered, so the caller can clean both up on timeout\n\t// even before this promise settles.\n\tasync #openSubscribe(\n\t\tstate: SubscribeSetupState,\n\t\tbroadcast: Path.Valid,\n\t\trequest: track.Request,\n\t\tproducer: track.Producer,\n\t\trequestId: bigint,\n\t): Promise<{ stream: Stream; alias: bigint }> {\n\t\tconst version = this.#session.version;\n\n\t\tstate.stream = await this.#session.openBi();\n\n\t\t// The timeout can fire while the open is still in flight, in which case cleanup ran\n\t\t// with nothing to release. Bail now that the stream is recorded, so settling this\n\t\t// promise hands it back to be torn down.\n\t\tif (state.cancelled) throw new Error(\"subscribe cancelled before it was sent\");\n\n\t\tawait state.stream.writer.u53(Subscribe.id);\n\t\tconst msg = new Subscribe({\n\t\t\trequestId,\n\t\t\ttrackNamespace: broadcast,\n\t\t\ttrackName: request.name,\n\t\t\tsubscriberPriority: toWire(request.priority),\n\t\t\t// No fill is requested: the fill's fetch stream and the live subscription split\n\t\t\t// the group across two streams, and this subscriber does not reassemble them into\n\t\t\t// one group yet. A lenient publisher (like ours) replays the whole in-range group\n\t\t\t// on the subscription instead; a strict one only delivers from the next published\n\t\t\t// object, and that mid-group stream is dropped, degrading the join to the next\n\t\t\t// group boundary.\n\t\t\tfilter: joinFilter(version),\n\t\t});\n\t\tawait msg.encode(state.stream.writer, version);\n\t\tstate.sent = true;\n\n\t\t// The caller may have given up while that write was in flight. It deliberately left\n\t\t// the stream alone, so unwind here and let its cleanup send the cancellation now that\n\t\t// the SUBSCRIBE has actually reached the peer.\n\t\tif (state.cancelled) throw new Error(\"subscribe cancelled while it was being sent\");\n\t\tconsole.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\n\t\tconst respTypeId = await state.stream.reader.u53();\n\t\tif (respTypeId !== SubscribeOk.id) {\n\t\t\tlet reasonPhrase = \"unknown error\";\n\t\t\ttry {\n\t\t\t\tif (respTypeId === RequestError.id) {\n\t\t\t\t\tconst err =\n\t\t\t\t\t\tversion === Version.DRAFT_14\n\t\t\t\t\t\t\t? await SubscribeError.decode(state.stream.reader, version)\n\t\t\t\t\t\t\t: await RequestError.decode(state.stream.reader, version);\n\t\t\t\t\treasonPhrase = requestReason(err.errorCode, err.reasonPhrase, \"subscribe\", version);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Decoding error response failed, use default message\n\t\t\t}\n\t\t\tstate.rejected = true;\n\t\t\tthrow new Error(`SUBSCRIBE error: ${reasonPhrase}`);\n\t\t}\n\n\t\tconst ok = await SubscribeOk.decode(state.stream.reader, version);\n\n\t\ttry {\n\t\t\tthis.#aliases.set(ok.trackAlias, producer, { broadcast, name: request.name });\n\t\t\tconst timescale = ok.properties.timescale;\n\t\t\tif (timescale !== undefined) {\n\t\t\t\tthis.#timescales.set(ok.trackAlias, timescale);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// Only one alias naming two different tracks is the session's problem. A publisher\n\t\t\t// sharing an alias between subscriptions to one track is allowed to do that, and\n\t\t\t// disconnecting over it would drop every other broadcast on the session.\n\t\t\tif (err instanceof DuplicateTrackAlias) this.#session.close();\n\t\t\tthrow err;\n\t\t}\n\t\tstate.registeredAlias = ok.trackAlias;\n\t\treturn { stream: state.stream, alias: ok.trackAlias };\n\t}\n\n\t/**\n\t * Handles an incoming PUBLISH_NAMESPACE on a bidi stream.\n\t * Tracks announced broadcasts and notifies consumers.\n\t *\n\t * @internal\n\t */\n\tasync runPublishNamespace(msg: PublishNamespace, stream: Stream) {\n\t\tconst version = this.#session.version;\n\t\tconst path = msg.trackNamespace;\n\n\t\t// A path that already ran through us looped back. Refuse it rather than holding an\n\t\t// advertisement we could never subscribe through. The peer knows our Hop ID, so a\n\t\t// conforming one never offers it; 0 as the retry interval says not to come back.\n\t\tif (this.#reflected(msg.cluster)) {\n\t\t\tconsole.debug(`dropping reflected publish_namespace: broadcast=${path}`);\n\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\tawait new RequestError({\n\t\t\t\trequestId: msg.requestId,\n\t\t\t\terrorCode: toRequestCode(\"uninterested\", \"publish_namespace\", version),\n\t\t\t\treasonPhrase: \"route loops back\",\n\t\t\t}).encode(stream.writer, version);\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\t// Draft-14/15 key their namespace-scoped messages by name, not request ID, so the\n\t\t// adapter can hold only one request per namespace: a second would overwrite the\n\t\t// first, and the withdrawals would then close the wrong stream and fail to find\n\t\t// the other. Nothing is lost by refusing it, because the case that makes a second\n\t\t// reference legitimate (an inline NAMESPACE for a path a PUBLISH_NAMESPACE already\n\t\t// carried) needs a message those drafts do not have.\n\t\tconst legacy = version === Version.DRAFT_14 || version === Version.DRAFT_15;\n\t\tif (legacy && (this.#announced.has(path) || this.#legacyRequests.has(path))) {\n\t\t\tconsole.warn(\"duplicate PublishNamespace\");\n\t\t\t// No draft registers a code for a duplicate, and this refusal is a draft-14/15\n\t\t\t// implementation limit, which is what INTERNAL_ERROR describes.\n\t\t\tconst errorCode = toRequestCode(\"internal\", \"publish_namespace\", version);\n\t\t\tif (version === Version.DRAFT_14) {\n\t\t\t\tawait stream.writer.u53(PublishNamespaceError.id);\n\t\t\t\tawait new PublishNamespaceError({\n\t\t\t\t\trequestId: msg.requestId,\n\t\t\t\t\terrorCode,\n\t\t\t\t\treasonPhrase: \"duplicate namespace\",\n\t\t\t\t}).encode(stream.writer, version);\n\t\t\t} else {\n\t\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\t\tawait new RequestError({\n\t\t\t\t\trequestId: msg.requestId,\n\t\t\t\t\terrorCode,\n\t\t\t\t\treasonPhrase: \"duplicate namespace\",\n\t\t\t\t}).encode(stream.writer, version);\n\t\t\t}\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\t// Everywhere else a path this session already knows is not refused: the same\n\t\t// namespace can reach us twice, and the count is what tells the second apart from\n\t\t// news. This request owns exactly one of those references and gives it back when\n\t\t// the stream ends.\n\t\tif (legacy) this.#legacyRequests.add(path);\n\t\tlet attached = false;\n\n\t\ttry {\n\t\t\t// Send OK first. This must complete before notifying consumers,\n\t\t\t// because consumers may trigger Subscribe writes that would\n\t\t\t// interleave with our OK on the control stream.\n\t\t\tif (version === Version.DRAFT_14) {\n\t\t\t\tawait stream.writer.u53(PublishNamespaceOk.id);\n\t\t\t\tconst ok = new PublishNamespaceOk({ requestId: msg.requestId });\n\t\t\t\tawait ok.encode(stream.writer, version);\n\t\t\t} else {\n\t\t\t\tawait stream.writer.u53(RequestOk.id);\n\t\t\t\tconst ok = new RequestOk({\n\t\t\t\t\trequestId: version === Version.DRAFT_15 || version === Version.DRAFT_16 ? msg.requestId : undefined,\n\t\t\t\t});\n\t\t\t\tawait ok.encode(stream.writer, version);\n\t\t\t}\n\n\t\t\t// Only now is the advertisement ours to announce, for the reason above: a\n\t\t\t// consumer reacting with a SUBSCRIBE must not interleave with that OK.\n\t\t\tattached = true;\n\t\t\tthis.#attachAnnounce(path, this.#route(msg.cluster));\n\n\t\t\t// An advertisement is updated in place with REQUEST_UPDATE on the stream that\n\t\t\t// already carries it, so read until the stream ends rather than waiting on the\n\t\t\t// close. Nothing else would deliver a re-parented route. What the peer holds\n\t\t\t// is kept current, since an update carries only what changed.\n\t\t\tlet held = msg.cluster;\n\t\t\tconst done = version === Version.DRAFT_16 || legacy;\n\t\t\tfor (;;) {\n\t\t\t\tif (await stream.reader.done()) break;\n\n\t\t\t\tconst typeId = await stream.reader.u53();\n\t\t\t\tif (done && typeId === PublishNamespaceDone.id) {\n\t\t\t\t\tawait PublishNamespaceDone.decode(stream.reader, version);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// A repeated PUBLISH_NAMESPACE lands here too: a second request on the\n\t\t\t\t// stream is the base draft's duplicate request ID.\n\t\t\t\tif (typeId !== PublishNamespaceUpdate.id) {\n\t\t\t\t\tthrow new ProtocolViolation(\n\t\t\t\t\t\t`unexpected message on publish_namespace stream: 0x${typeId.toString(16)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst update = await PublishNamespaceUpdate.decode(stream.reader, version);\n\n\t\t\t\t// The parameters exist only on a session that negotiated the extension;\n\t\t\t\t// anywhere else they are the peer's violation.\n\t\t\t\tif (held === undefined) {\n\t\t\t\t\tif (update.update.hops !== undefined || update.update.cost !== undefined) {\n\t\t\t\t\t\tthrow new ProtocolViolation(\"cluster parameters on a session that negotiated none\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// A different original publisher is a different advertisement, which the\n\t\t\t\t\t// draft has withdrawn and made again: its content is not continuous with\n\t\t\t\t\t// what is held. Refusing the update closes the stream, which is that\n\t\t\t\t\t// withdrawal.\n\t\t\t\t\tif (update.update.hops !== undefined && update.update.hops[0] !== held.hops[0]) {\n\t\t\t\t\t\tconsole.warn(`publish_namespace update changes the publisher: broadcast=${path}`);\n\t\t\t\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\t\t\t\tawait new RequestError({\n\t\t\t\t\t\t\terrorCode: toRequestCode(\"not_supported\", \"publish_namespace\", version),\n\t\t\t\t\t\t\treasonPhrase: \"a new publisher is a new advertisement\",\n\t\t\t\t\t\t}).encode(stream.writer, version);\n\t\t\t\t\t\tstream.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\theld = Cluster.apply(held, update.update);\n\t\t\t\t}\n\n\t\t\t\t// A path that now runs through us is unusable, so give it back. The update\n\t\t\t\t// itself is accepted, and reading continues: this stream is the\n\t\t\t\t// advertisement's only channel, so a later clean path arrives here or\n\t\t\t\t// nowhere.\n\t\t\t\tif (this.#reflected(held)) {\n\t\t\t\t\tif (attached) {\n\t\t\t\t\t\tattached = false;\n\t\t\t\t\t\tconsole.debug(`publish_namespace now loops back, detaching: broadcast=${path}`);\n\t\t\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t\t\t}\n\t\t\t\t} else if (!attached) {\n\t\t\t\t\t// Re-attach: a clean path replaced the reflected one we detached from.\n\t\t\t\t\tattached = true;\n\t\t\t\t\tthis.#attachAnnounce(path, this.#route(held));\n\t\t\t\t} else {\n\t\t\t\t\tthis.#updateAnnounce(path, this.#route(held));\n\t\t\t\t}\n\n\t\t\t\t// Nothing here can fail to apply, so every update is acknowledged. A leaf\n\t\t\t\t// routes nothing, so a repricing changes nothing it holds; consumers still\n\t\t\t\t// hear the new route so a forwarder can reprice.\n\t\t\t\tawait stream.writer.u53(RequestOk.id);\n\t\t\t\tawait new RequestOk({}).encode(stream.writer, version);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (legacy) this.#legacyRequests.delete(path);\n\n\t\t\t// Give back exactly what was taken: a request that never got its OK out never\n\t\t\t// referenced the path, and retracting there would drop someone else's count.\n\t\t\tif (attached) {\n\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles an incoming PUBLISH on a bidi stream.\n\t * We don't support reverse publish, so send error.\n\t *\n\t * @internal\n\t */\n\tasync runPublish(msg: Publish, stream: Stream) {\n\t\tconst version = this.#session.version;\n\n\t\t// We decline the method itself rather than this particular track, which would be\n\t\t// UNINTERESTED.\n\t\t//\n\t\t// The alias the message carries is deliberately not recorded. Nothing will ever bind\n\t\t// it, and a rejected request has no lifetime of ours to hang the cleanup on.\n\t\tconst errorCode = toRequestCode(\"not_supported\", \"publish\", version);\n\n\t\tif (version === Version.DRAFT_14) {\n\t\t\tawait stream.writer.u53(PublishError.id);\n\t\t\tconst err = new PublishError({\n\t\t\t\trequestId: msg.requestId,\n\t\t\t\terrorCode,\n\t\t\t\treasonPhrase: \"publish not supported\",\n\t\t\t});\n\t\t\tawait err.encode(stream.writer, version);\n\t\t} else {\n\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\tconst err = new RequestError({\n\t\t\t\trequestId: version === Version.DRAFT_15 || version === Version.DRAFT_16 ? msg.requestId : undefined,\n\t\t\t\terrorCode,\n\t\t\t\treasonPhrase: \"publish not supported\",\n\t\t\t});\n\t\t\tawait err.encode(stream.writer, version);\n\t\t}\n\t\tstream.close();\n\t}\n\n\t/**\n\t * Handles an ObjectStream message (group + frames on uni stream).\n\t *\n\t * @internal\n\t */\n\tasync handleGroup(group: GroupMessage, stream: Reader) {\n\t\tif (group.subGroupId !== 0) {\n\t\t\tthrow new Error(\"subgroups are not supported\");\n\t\t}\n\n\t\t// FIRST_OBJECT clear says this stream starts partway through the group, which the\n\t\t// draft lets a publisher do to answer a filter. Nothing above here can use it: the\n\t\t// objects that would arrive are not decodable without the missing head, and a group\n\t\t// is the unit an application resyncs on. Drop it and pick up at the next group, the\n\t\t// same degradation as a publisher that no longer holds the head.\n\t\t//\n\t\t// This only saves reading a stream we would throw away. The bit is the publisher's\n\t\t// claim, so what is enforced is the object ids themselves: `Frame.decode` holds every\n\t\t// object to starting at 0 and incrementing by 1, whatever the header said and on the\n\t\t// drafts that have no such bit to read.\n\t\tif (!group.flags.firstObject) {\n\t\t\tconsole.debug(`dropping a group with no head: alias=${group.trackAlias} group=${group.groupId}`);\n\t\t\tstream.stop(new Error(\"a group must start at object 0\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst producer = new netGroup.Producer(group.groupId);\n\n\t\ttry {\n\t\t\t// The control message establishing this alias can arrive after the data stream.\n\t\t\tconst track = await this.#aliases.get(group.trackAlias);\n\n\t\t\ttrack.writeGroup(producer);\n\n\t\t\tfor (;;) {\n\t\t\t\tconst done = await Promise.race([stream.done(), producer.closed, track.closed]);\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tconst frame = await Frame.decode(\n\t\t\t\t\tstream,\n\t\t\t\t\tgroup.flags,\n\t\t\t\t\tthis.#timescales.get(group.trackAlias),\n\t\t\t\t\tthis.#session.version,\n\t\t\t\t);\n\t\t\t\tif (frame.payload === undefined) break;\n\n\t\t\t\tproducer.writeFrame({ payload: frame.payload, timestamp: frame.timestamp ?? Timestamp.now() });\n\t\t\t}\n\n\t\t\tproducer.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\t// Ours: we cancelled the subscription and the publisher has not stopped yet.\n\t\t\t// Anything else on this alias is the publisher sending data for a track it never\n\t\t\t// acknowledged, which is worth seeing.\n\t\t\tif (e instanceof RetiredTrackAlias) {\n\t\t\t\tconsole.debug(`dropping group for a cancelled subscription: alias=${group.trackAlias}`);\n\t\t\t}\n\t\t\tproducer.close(e);\n\t\t\tstream.stop(e);\n\t\t}\n\t}\n}\n\n/**\n * A broadcast consumed from a moq-transport session. Track info is resolved by the\n * subscribe path (the inherited `resolveTrackInfo`), but the protocol has no one-shot\n * group fetch, so `track.Consumer.fetchGroup()` is rejected.\n */\nclass ConsumeBroadcast extends broadcast.Consumer {\n\tconstructor(state?: never) {\n\t\tsuper(state);\n\t\toverrideBroadcastWire(this, {\n\t\t\tfetchGroup: () => Promise.reject(new Error(\"fetch group is not supported for moq-transport\")),\n\t\t});\n\t}\n\n\t// Preserve the subclass when the consume cache shares this broadcast across callers.\n\toverride clone(): ConsumeBroadcast {\n\t\treturn new ConsumeBroadcast(this.shareState());\n\t}\n}\n"]}
1
+ {"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../src/ietf/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzG,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,i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,SAAS,IAAI,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9F,CAAC;YAED,wCAAwC;YACxC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,YAAY,iBAAiB,EAAE,CAAC;gBACpC,wEAAwE;gBACxE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;gBACnB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACP,6EAA6E;gBAC7E,oDAAoD;gBACpD,IAAI,CAAC;oBACJ,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACR,0DAA0D;gBAC3D,CAAC;YACF,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;gBAAS,CAAC;YACV,IAAI,EAAE,CAAC;QACR,CAAC;IACF,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,gBAAiB,SAAQ,SAAS,CAAC,QAAQ;IAChD,YAAY,KAAa;QACxB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,qBAAqB,CAAC,IAAI,EAAE;YAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SAC7F,CAAC,CAAC;IACJ,CAAC;IAED,qFAAqF;IAC5E,KAAK;QACb,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAChD,CAAC;CACD","sourcesContent":["import { race, Signal } from \"@moq/signals\";\nimport * as announce from \"../announced.ts\";\nimport * as broadcast from \"../broadcast.ts\";\nimport { BroadcastCache } from \"../consume.ts\";\nimport { closeError, controlTimeout, error, ProtocolViolation, reason, sessionCause } from \"../error.ts\";\nimport * as netGroup from \"../group.ts\";\nimport { Cost, type Route, routesEqual, UNKNOWN_HOP } from \"../hop.ts\";\nimport { hiddenBelow, hooks, scopeCaptures, scopeHead, scopeOverlaps } from \"../internal.ts\";\nimport * as Path from \"../path.ts\";\nimport type { Reader, Stream } from \"../stream.ts\";\nimport { TAIL_GRACE_MS, Tail } from \"../tail.ts\";\nimport { type Timescale, Timestamp } from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { TimeoutError, withTimeout } from \"../util/timeout.ts\";\nimport { overrideBroadcastWire, wireOf } from \"../wire.ts\";\nimport type { Session } from \"./adapter.ts\";\nimport { DuplicateTrackAlias, RetiredTrackAlias, TrackAliases } from \"./aliases.ts\";\nimport * as Cluster from \"./cluster.ts\";\nimport { requestReason, toRequestCode } from \"./error.ts\";\nimport { Frame, type Group as GroupMessage } from \"./object.ts\";\nimport { fromWire, toWire } from \"./priority.ts\";\nimport { type Publish, PublishDone, PublishError, publishDoneClean } from \"./publish.ts\";\nimport {\n\ttype PublishNamespace,\n\tPublishNamespaceDone,\n\tPublishNamespaceError,\n\tPublishNamespaceOk,\n\tPublishNamespaceUpdate,\n} from \"./publish_namespace.ts\";\nimport { RequestError, RequestOk } from \"./request.ts\";\nimport { joinFilter, Subscribe, SubscribeError, SubscribeOk, Unsubscribe } from \"./subscribe.ts\";\nimport {\n\tPublishBlocked,\n\tSubscribeNamespace,\n\tSubscribeNamespaceEntry,\n\tSubscribeNamespaceEntryDone,\n\tSubscribeNamespaceLegacy,\n\tSubscribeNamespaceOk,\n\tUnsubscribeNamespace,\n} from \"./subscribe_namespace.ts\";\nimport { Version } from \"./version.ts\";\n\n// Bound on how long stream-open plus SUBSCRIBE_OK may take. Browsers cap\n// concurrent QUIC streams (Chrome ~100); past the cap openBi() silently\n// blocks. The timeout turns that into a clear error.\nconst SUBSCRIBE_OK_TIMEOUT_MS = 10_000;\n\n// A live subscription, as the track alias its data streams name resolves to.\ntype Subscription = {\n\t// The write side incoming group streams are routed into.\n\ttrack: track.Producer;\n\t// The group streams received, so the subscription can wait for the ones PUBLISH_DONE\n\t// says are still owed.\n\ttail: Tail;\n};\n\n// Out-parameter for #openSubscribe: lets the caller observe partial progress\n// (stream opened, trackAlias registered) so it can clean up on timeout even\n// before the setup promise settles.\ntype SubscribeSetupState = {\n\tstream?: Stream;\n\tregisteredAlias?: bigint;\n\t/**\n\t * Whether the caller has given up. Setup checks this once the stream exists so a request\n\t * opened after the timeout still unwinds: nothing else settles setup if the peer has\n\t * gone quiet, and the cleanup that fired first saw no stream to tear down.\n\t */\n\tcancelled?: boolean;\n\t/**\n\t * Whether the SUBSCRIBE reached the wire. From that moment the publisher may be serving,\n\t * even before it answers, so abandoning owes it a cancellation regardless of whether we\n\t * ever saw the SUBSCRIBE_OK.\n\t */\n\tsent?: boolean;\n\t/**\n\t * Whether the publisher answered with an error. It has torn the request down already, so\n\t * there is nothing left to cancel and naming the dead request id at it risks being read\n\t * as a protocol violation.\n\t */\n\trejected?: boolean;\n};\n\n/** A local announce reader's filter: its scope, the prefix it asked for, and its hidden opt-in. */\ntype Filter = { scope: Path.Pattern; prefix: Path.Valid; hidden: boolean };\n\n/** Whether a reader with `filter` sees an announcement at `path`. */\nfunction sees(filter: Filter, path: Path.Valid): boolean {\n\treturn scopeOverlaps(filter.scope, path) && (filter.hidden || !hiddenBelow(filter.prefix, path));\n}\n\n/**\n * Handles subscribing to broadcasts using moq-transport protocol.\n * Uses the stream-per-request pattern (real bidi streams for v17, virtual for v14-v16).\n *\n * @internal\n */\nexport class Subscriber {\n\t#session: Session;\n\n\t// The transport, so a request cut off by the session's close ends with the session's\n\t// error. Optional for tests that drive a bare session.\n\t#quic?: WebTransport;\n\n\t// The Hop IDs this session declared; see {@link Cluster}. What the peer declared is what\n\t// says whether an advertisement carries a hop path, and ours is what a path looping back\n\t// to us contains.\n\t#cluster?: Cluster.Hops;\n\n\t// Publisher-chosen aliases used by incoming group streams.\n\t#aliases = new TrackAliases<Subscription>();\n\n\t// Units for each track's object Timestamps, from the TIMESCALE Track Property in\n\t// SUBSCRIBE_OK. A track missing from this map declared no timeline, so the publisher\n\t// opted out of timestamps and its frames are stamped on arrival instead.\n\t#timescales = new Map<bigint, Timescale>();\n\n\t// Dedup consumed broadcasts per path: repeat consume() calls share one subscription.\n\t#consumes = new BroadcastCache();\n\n\t// Paths with a legacy PUBLISH_NAMESPACE request in flight, reserved synchronously.\n\t// The count below is only taken once the OK is written, and two requests that both\n\t// got past the duplicate check before either attached would both take one.\n\t#legacyRequests = new Set<Path.Valid>();\n\n\t// Every announced path, counted by how many live advertisements reference it.\n\t//\n\t// A peer may advertise one namespace twice on a session: an unsolicited\n\t// PUBLISH_NAMESPACE and an inline NAMESPACE answering our own SUBSCRIBE_NAMESPACE are\n\t// two messages about one source, which the MoQ Solicit draft requires us to tolerate.\n\t// Counting them is what keeps the second from duplicating the announce and the first\n\t// to end from retracting what the other still holds.\n\t#announced = new Map<Path.Valid, { count: number; route: Route }>();\n\n\t// Any consumers that want each new announcement, keyed by their local filter.\n\t#announcedConsumers = new Map<announce.Producer, Filter>();\n\n\t// Whether the peer understands the HIDDEN parameter (MoQ Hidden).\n\t#hidden: boolean;\n\n\t/**\n\t * Creates a new Subscriber instance.\n\t *\n\t * @internal\n\t */\n\tconstructor({\n\t\tsession,\n\t\tquic,\n\t\tcluster,\n\t\thidden = false,\n\t}: {\n\t\t/** The session abstraction for bidi streams and request IDs. */\n\t\tsession: Session;\n\t\t/** The transport the session runs on. */\n\t\tquic?: WebTransport;\n\t\t/** The Hop IDs the SETUP exchange settled (MoQ Cluster). */\n\t\tcluster?: Cluster.Hops;\n\t\t/** Whether the peer understands the HIDDEN parameter (MoQ Hidden). */\n\t\thidden?: boolean;\n\t}) {\n\t\tthis.#session = session;\n\t\tthis.#quic = quic;\n\t\tthis.#cluster = cluster;\n\t\tthis.#hidden = hidden;\n\t}\n\n\t/**\n\t * Whether an advertisement is ours coming back: its hop path already ran through us, so\n\t * subscribing via it would route us back to ourselves.\n\t *\n\t * A conforming peer withholds these (it knows our Hop ID), so this is the backstop that\n\t * keeps a mesh working when one member does not. A session that negotiated nothing\n\t * carries no path, and there is nothing to check.\n\t */\n\t#reflected(advert: Cluster.Advert | undefined): boolean {\n\t\treturn advert !== undefined && this.#cluster !== undefined && Cluster.loops(advert, this.#cluster.self);\n\t}\n\n\t/** The route an advertisement carries; one without a path is anonymous and free. */\n\t#route(advert: Cluster.Advert | undefined): Route {\n\t\tif (advert === undefined) return { hops: [UNKNOWN_HOP], cost: Cost.zero };\n\t\treturn { hops: advert.hops, cost: { warm: advert.cost, cold: advert.cost } };\n\t}\n\n\t/**\n\t * Gets an announced reader matching `scope`. Paths are relative to the session,\n\t * not the scope.\n\t *\n\t * The peer is asked with SUBSCRIBE_NAMESPACE regardless of what it declared, and an\n\t * unsolicited PUBLISH_NAMESPACE lands here too, so a peer that only tells and one\n\t * that only answers are both discovered.\n\t *\n\t * Hidden routes (a `.`-prefixed segment below the scope's head) are left out unless\n\t * `options.hidden` opts in. The opt-in rides the SUBSCRIBE_NAMESPACE when the peer\n\t * understands it (MoQ Hidden); the rule is also applied here, since an unsolicited\n\t * PUBLISH_NAMESPACE or a peer that never heard of it hides nothing.\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all(), options?: announce.Options): announce.Consumer {\n\t\t// The wire speaks announce interest by prefix.\n\t\tconst prefix = scopeHead(scope);\n\t\tconst filter = { scope, prefix, hidden: options?.hidden ?? false };\n\t\tconst announced = new announce.Producer();\n\t\tfor (const [active, info] of this.#announced) {\n\t\t\tif (!sees(filter, active)) continue;\n\t\t\tannounced.append({\n\t\t\t\tprefix: active,\n\t\t\t\tcaptures: scopeCaptures(scope, active),\n\t\t\t\tkind: \"announced\",\n\t\t\t\troute: info.route,\n\t\t\t});\n\t\t}\n\t\tthis.#announcedConsumers.set(announced, filter);\n\n\t\tvoid this.#runAnnounced(announced, prefix, filter.hidden && this.#hidden).finally(() => {\n\t\t\tthis.#announcedConsumers.delete(announced);\n\t\t\tannounced.close();\n\t\t});\n\n\t\treturn announced.consume();\n\t}\n\n\t/**\n\t * Record one more advertisement for a path, telling consumers only when it is the\n\t * first. A second one is the same namespace said twice, not news.\n\t */\n\t#attachAnnounce(path: Path.Valid, route: Route) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing) {\n\t\t\texisting.count += 1;\n\t\t\treturn;\n\t\t}\n\t\tthis.#announced.set(path, { count: 1, route });\n\n\t\tconsole.debug(`announced: broadcast=${path} active=true`);\n\t\tfor (const [consumer, filter] of this.#announcedConsumers) {\n\t\t\tif (!sees(filter, path)) continue;\n\t\t\tconst scope = filter.scope;\n\t\t\tconsumer.append({ prefix: path, captures: scopeCaptures(scope, path), kind: \"announced\", route });\n\t\t}\n\t}\n\n\t/**\n\t * Replace the stored route for a path that is already announced. A no-op when the\n\t * hops and cost did not change; otherwise consumers hear `updated` so a forwarder\n\t * can reprice without retracting.\n\t */\n\t#updateAnnounce(path: Path.Valid, route: Route) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing === undefined || routesEqual(existing.route, route)) return;\n\t\texisting.route = route;\n\t\tconsole.debug(`announced: broadcast=${path} rerouted`);\n\t\tfor (const [consumer, filter] of this.#announcedConsumers) {\n\t\t\tif (!sees(filter, path)) continue;\n\t\t\tconst scope = filter.scope;\n\t\t\tconsumer.append({ prefix: path, captures: scopeCaptures(scope, path), kind: \"updated\", route });\n\t\t}\n\t}\n\n\t/**\n\t * Drop one advertisement for a path, retracting it only once the last one goes.\n\t */\n\t#detachAnnounce(path: Path.Valid) {\n\t\tconst existing = this.#announced.get(path);\n\t\tif (existing === undefined) return;\n\t\tif (existing.count > 1) {\n\t\t\texisting.count -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#announced.delete(path);\n\n\t\t// The path is gone, so stop sharing its broadcast: a holder outliving the publisher\n\t\t// would otherwise hand the dead generation to whoever consumes the path next.\n\t\tthis.#consumes.evict(path);\n\t\tconsole.debug(`announced: broadcast=${path} active=false`);\n\n\t\tfor (const [consumer, filter] of this.#announcedConsumers) {\n\t\t\tif (!sees(filter, path)) continue;\n\t\t\tconst scope = filter.scope;\n\t\t\ttry {\n\t\t\t\tconsumer.append({\n\t\t\t\t\tprefix: path,\n\t\t\t\t\tcaptures: scopeCaptures(scope, path),\n\t\t\t\t\tkind: \"retracted\",\n\t\t\t\t\troute: existing.route,\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\t// Consumer already closed, will be cleaned up\n\t\t\t}\n\t\t}\n\t}\n\n\tasync #runAnnounced(announced: announce.Producer, prefix: Path.Valid, hidden: boolean) {\n\t\tconst version = this.#session.version;\n\n\t\t// Suffixes live on this stream, so a repeat is recognized as an update to the\n\t\t// advertisement rather than a second one, which would leak the count.\n\t\tconst live = new Set<Path.Valid>();\n\n\t\t// Set once the teardown below has given back everything this stream held. The read\n\t\t// loop is not awaited when the local consumer closes first, and closing the stream\n\t\t// cancels the transport without discarding what the reader already buffered, so a\n\t\t// fully buffered entry can still decode afterwards. Attaching one then would take a\n\t\t// reference nobody is left to release, pinning the path for the session.\n\t\tlet released = false;\n\n\t\t// v14/v15: SubscribeNamespace on control stream (via adapter virtual stream)\n\t\t// v16+: SubscribeNamespace on its own real bidi stream\n\n\t\tconst requestId = await this.#session.nextRequestId();\n\t\tif (requestId === undefined) return;\n\n\t\ttry {\n\t\t\t// v16: use a real bidi stream (not virtual control stream)\n\t\t\tconst stream =\n\t\t\t\tversion === Version.DRAFT_16 && this.#session.openNativeBi\n\t\t\t\t\t? await this.#session.openNativeBi()\n\t\t\t\t\t: await this.#session.openBi();\n\n\t\t\ttry {\n\t\t\t\t// Draft-18+ uses SUBSCRIBE_NAMESPACE (0x50); earlier drafts use the\n\t\t\t\t// legacy 0x11 message with a Subscribe Options field.\n\t\t\t\tif (\n\t\t\t\t\tversion === Version.DRAFT_14 ||\n\t\t\t\t\tversion === Version.DRAFT_15 ||\n\t\t\t\t\tversion === Version.DRAFT_16 ||\n\t\t\t\t\tversion === Version.DRAFT_17\n\t\t\t\t) {\n\t\t\t\t\tawait stream.writer.u53(SubscribeNamespaceLegacy.id);\n\t\t\t\t\tawait new SubscribeNamespaceLegacy({ namespace: prefix, requestId, hidden }).encode(\n\t\t\t\t\t\tstream.writer,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tawait stream.writer.u53(SubscribeNamespace.id);\n\t\t\t\t\tawait new SubscribeNamespace({ namespace: prefix, requestId, hidden }).encode(\n\t\t\t\t\t\tstream.writer,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconsole.debug(`subscribe_namespace written: requestId=${requestId}`);\n\n\t\t\t\t// Read response\n\t\t\t\tconst respTypeId = await stream.reader.u53();\n\t\t\t\tif (respTypeId === RequestOk.id) {\n\t\t\t\t\tawait RequestOk.decode(stream.reader, version);\n\t\t\t\t} else if (respTypeId === SubscribeNamespaceOk.id) {\n\t\t\t\t\t// v14: SubscribeNamespaceOk\n\t\t\t\t\tconst size = await stream.reader.u16();\n\t\t\t\t\tawait stream.reader.read(size);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`SubscribeNamespace rejected: typeId=0x${respTypeId.toString(16)}`);\n\t\t\t\t}\n\n\t\t\t\t// Loop reading Namespace/NamespaceDone entries\n\t\t\t\tconst readLoop = (async () => {\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tconst done = await stream.reader.done();\n\t\t\t\t\t\tif (done) break;\n\n\t\t\t\t\t\tconst msgType = await stream.reader.u53();\n\t\t\t\t\t\tif (msgType === SubscribeNamespaceEntry.id) {\n\t\t\t\t\t\t\tconst entry = await SubscribeNamespaceEntry.decode(\n\t\t\t\t\t\t\t\tstream.reader,\n\t\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\t\tCluster.negotiated(this.#cluster),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (released) break;\n\t\t\t\t\t\t\tconst path = Path.join(prefix, entry.suffix);\n\n\t\t\t\t\t\t\t// A repeat updates the advertisement in place, so one that now\n\t\t\t\t\t\t\t// loops back through us has taken a route we can't subscribe\n\t\t\t\t\t\t\t// over: the path is gone even though the message says active.\n\t\t\t\t\t\t\tif (this.#reflected(entry.cluster)) {\n\t\t\t\t\t\t\t\tconsole.debug(`dropping reflected namespace: broadcast=${path}`);\n\t\t\t\t\t\t\t\tif (live.delete(path)) this.#detachAnnounce(path);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// A repeat replaces the advertisement in place: HOP_PATH / ROUTE_COST\n\t\t\t\t\t\t\t// can change without a NAMESPACE_DONE. Only the first is a new path.\n\t\t\t\t\t\t\tconst route = this.#route(entry.cluster);\n\t\t\t\t\t\t\tif (live.has(path)) {\n\t\t\t\t\t\t\t\tthis.#updateAnnounce(path, route);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlive.add(path);\n\t\t\t\t\t\t\t\tthis.#attachAnnounce(path, route);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (msgType === SubscribeNamespaceEntryDone.id) {\n\t\t\t\t\t\t\tconst entry = await SubscribeNamespaceEntryDone.decode(stream.reader, version);\n\t\t\t\t\t\t\tif (released) break;\n\t\t\t\t\t\t\tconst path = Path.join(prefix, entry.suffix);\n\n\t\t\t\t\t\t\tif (live.delete(path)) {\n\t\t\t\t\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (msgType === PublishBlocked.id && version === Version.DRAFT_17) {\n\t\t\t\t\t\t\tconst blocked = await PublishBlocked.decode(stream.reader, version);\n\t\t\t\t\t\t\tconsole.debug(`publish_blocked: suffix=${blocked.suffix} track=${blocked.trackName}`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`unexpected message on subscribe_namespace stream: 0x${msgType.toString(16)}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})();\n\n\t\t\t\t// The race below can end through the consumer's close while a message that\n\t\t\t\t// already arrived is still decoding, which leaves the loop with nothing\n\t\t\t\t// awaiting it: a violation decoded after that would land nowhere, and its\n\t\t\t\t// rejection would go unhandled. Idempotent with the catch below, which is\n\t\t\t\t// what runs when the loop is the one that ends the race.\n\t\t\t\treadLoop.catch((err: unknown) => {\n\t\t\t\t\tif (err instanceof ProtocolViolation) this.#session.close();\n\t\t\t\t});\n\n\t\t\t\t// Wait for either the read loop or the announced to close\n\t\t\t\tawait race([readLoop, announced.closed]);\n\n\t\t\t\t// For v14/v15: send UnsubscribeNamespace before closing\n\t\t\t\tif (version === Version.DRAFT_14 || version === Version.DRAFT_15) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait stream.writer.u53(UnsubscribeNamespace.id);\n\t\t\t\t\t\tconst unsub = new UnsubscribeNamespace({ requestId });\n\t\t\t\t\t\tawait unsub.encode(stream.writer, version);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Stream might already be closed\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstream.close();\n\t\t\t} catch (err) {\n\t\t\t\tstream.abort(error(err));\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`subscribe_namespace error: ${reason(e)}`);\n\n\t\t\t// An advertisement is decoded here rather than in the session dispatch, so this\n\t\t\t// is the only place a malformed one surfaces. The cluster draft requires closing\n\t\t\t// the session over those, and the stream alone is not enough: the peer would\n\t\t\t// just repeat it on the next SUBSCRIBE_NAMESPACE.\n\t\t\tif (e instanceof ProtocolViolation) this.#session.close();\n\n\t\t\t// Abort the stream rather than letting the caller's `finally` close it cleanly.\n\t\t\t// A rejected namespace subscription is a failure, and a consumer that can't tell\n\t\t\t// it from \"nothing is published under this prefix\" waits forever on a broadcast\n\t\t\t// that will never be announced. Matches the lite subscriber.\n\t\t\tannounced.close(e);\n\t\t} finally {\n\t\t\t// The stream owns every advertisement it carried, so release them however it\n\t\t\t// ends: a clean close, a decode error, or the peer resetting it. Without this\n\t\t\t// each namespace keeps its count and the source never detaches, which would\n\t\t\t// pin the path for the session even after the other source withdrew.\n\t\t\treleased = true;\n\t\t\tfor (const path of live) {\n\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t}\n\t\t\tlive.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Consumes a broadcast from the connection.\n\t *\n\t * Deduplicated per path: repeat calls for the same still-live path share one reference-counted\n\t * broadcast (and one upstream subscription). The shared broadcast closes once every caller has\n\t * closed its handle, so callers close normally.\n\t */\n\tconsume(path: Path.Valid): broadcast.Consumer {\n\t\treturn this.#consumes.get(path) ?? this.#consumes.insert(path, this.#createConsume(path));\n\t}\n\n\t#createConsume(path: Path.Valid): broadcast.Consumer {\n\t\t// moq-transport has no one-shot group fetch; ConsumeBroadcast rejects it. Track info\n\t\t// is resolved by the subscribe path (the inherited resolveTrackInfo).\n\t\tconst consumer = new ConsumeBroadcast();\n\n\t\tvoid (async () => {\n\t\t\tfor (;;) {\n\t\t\t\tconst request = await wireOf(consumer).requested();\n\t\t\t\tif (!request) break;\n\t\t\t\tvoid this.#runSubscribe(path, request);\n\t\t\t}\n\t\t})();\n\n\t\treturn consumer;\n\t}\n\n\t// The adapter is gone. If the transport has already closed, that close is the\n\t// error. A still-open transport, such as a GOAWAY drain, has no peer code yet,\n\t// so this does not wait for it.\n\tasync #closedSession(): Promise<Error> {\n\t\tconst quic = this.#quic;\n\t\tif (!quic) return new Error(\"session closed\");\n\t\treturn Promise.race([\n\t\t\tcloseError(quic),\n\t\t\tnew Promise<Error>((resolve) => queueMicrotask(() => resolve(new Error(\"session closed\")))),\n\t\t]);\n\t}\n\n\tasync #runSubscribe(broadcast: Path.Valid, request: track.Request) {\n\t\tconst requestId = await this.#session.nextRequestId();\n\t\tif (requestId === undefined) {\n\t\t\trequest.reject(await this.#closedSession());\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\n\t\t// Keep the request pending until SUBSCRIBE_OK supplies immutable track metadata.\n\t\t// Group streams already wait on the alias, so early data stays behind this response.\n\t\tconst producer = hooks.pendingTrackProducer(request);\n\t\tconst subscription: Subscription = { track: producer, tail: new Tail() };\n\n\t\t// Open the stream and wait for SUBSCRIBE_OK under a timeout. State\n\t\t// flows back via `state` so the timeout path can clean up the stream\n\t\t// and any registration if setup eventually finishes.\n\t\tconst state: SubscribeSetupState = {};\n\t\tconst setup = this.#openSubscribe(state, broadcast, request, subscription, requestId);\n\n\t\t// The publisher can be serving before it answers, so waiting only on the response\n\t\t// would miss the local side going away and leave it serving a track nobody reads.\n\t\t// Demand returning before we commit is not abandonment, matching the serving loop.\n\t\tconst waitAbandoned = async (): Promise<null> => {\n\t\t\t// An info-only lookup attaches no subscriber yet still waits on SUBSCRIBE_OK for\n\t\t\t// the track info, so only demand that arrived and then left is abandonment.\n\t\t\twhile (!producer.used.peek() && producer.closed.peek() === undefined) {\n\t\t\t\tawait Signal.race(producer.used, producer.closed);\n\t\t\t}\n\t\t\tfor (;;) {\n\t\t\t\tawait producer.unused();\n\t\t\t\tif (producer.closed.peek() !== undefined || !producer.used.peek()) return null;\n\t\t\t}\n\t\t};\n\n\t\tlet stream: Stream;\n\t\tlet trackAlias: bigint;\n\t\ttry {\n\t\t\tconst result = await race([\n\t\t\t\twithTimeout(\n\t\t\t\t\tsetup,\n\t\t\t\t\tSUBSCRIBE_OK_TIMEOUT_MS,\n\t\t\t\t\t`subscribe timed out after ${SUBSCRIBE_OK_TIMEOUT_MS}ms waiting for SUBSCRIBE_OK (browser stream limit reached?)`,\n\t\t\t\t),\n\t\t\t\twaitAbandoned(),\n\t\t\t]);\n\n\t\t\tif (result === null) throw new Error(\"subscribe abandoned before it was accepted\");\n\n\t\t\tstream = result.stream;\n\t\t\ttrackAlias = result.alias;\n\t\t\tconsole.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\t// A control request that timed out is not late content, so it carries its own code.\n\t\t\tconst e = err instanceof TimeoutError ? controlTimeout(err) : await sessionCause(this.#quic, err);\n\t\t\trequest.reject(e);\n\t\t\tconsole.warn(\n\t\t\t\t`subscribe error: id=${requestId} broadcast=${broadcast} track=${request.name} error=${reason(e)}`,\n\t\t\t);\n\t\t\t// Runs now for whatever is already open, and again if `setup` settles late.\n\t\t\t// Retirement is repeated because a late SUBSCRIBE_OK can register an alias after\n\t\t\t// the first pass; the stream is torn down once.\n\t\t\tlet torn = false;\n\t\t\tconst cleanup = async (afterSetup: boolean) => {\n\t\t\t\tstate.cancelled = true;\n\n\t\t\t\tif (state.registeredAlias !== undefined && this.#aliases.retire(state.registeredAlias, subscription)) {\n\t\t\t\t\tthis.#timescales.delete(state.registeredAlias);\n\t\t\t\t}\n\n\t\t\t\tif (!state.stream || torn) return;\n\n\t\t\t\t// A SUBSCRIBE still being written must not be torn down from here. Aborting a\n\t\t\t\t// Web Stream waits for the in-flight write, so the request can still reach the\n\t\t\t\t// peer while the abort destroys the stream we would have cancelled on. Setup\n\t\t\t\t// unwinds on the cancelled flag once that write lands, and its pass below has\n\t\t\t\t// the finished picture.\n\t\t\t\tif (!state.sent && !afterSetup) return;\n\t\t\t\ttorn = true;\n\n\t\t\t\t// Once the SUBSCRIBE is out the publisher may be serving, whether or not it has\n\t\t\t\t// answered yet: data streams are independent of the request stream. Aborting says\n\t\t\t\t// nothing on v14-16, where the request rides a virtual stream whose reset is\n\t\t\t\t// local, so the UNSUBSCRIBE has to go out explicitly.\n\t\t\t\tif (state.sent && !state.rejected) await this.#cancelSubscribe(state.stream, requestId);\n\t\t\t\tstate.stream.abort(e);\n\t\t\t};\n\n\t\t\t// Tear down what is already open rather than waiting on `setup`. A peer that\n\t\t\t// opened the stream and then went quiet never settles it, and deferring would\n\t\t\t// leave the request outstanding for the life of the session -- which is the\n\t\t\t// timeout case, not a rare one.\n\t\t\tvoid cleanup(false);\n\t\t\tsetup.then(\n\t\t\t\t() => cleanup(true),\n\t\t\t\t() => cleanup(true),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Which terminal fired decides whether we owe the publisher a cancellation, so\n\t\t\t// tag them rather than racing bare promises.\n\t\t\tconst publisherEnded = Symbol(\"publisher\");\n\t\t\tconst localEnded = Symbol(\"local\");\n\t\t\tconst idle = Symbol(\"idle\");\n\n\t\t\t// Terminal conditions settle at most once (PublishDone, track close = local\n\t\t\t// unsubscribe); race them once so the demand loop doesn't re-subscribe each pass.\n\t\t\tconst done = race([\n\t\t\t\tthis.#runPublishDone(stream, subscription).then(() => publisherEnded),\n\t\t\t\tproducer.closed.then(() => localEnded),\n\t\t\t]);\n\n\t\t\t// Serve until a terminal condition fires or the last local subscriber leaves. The unused\n\t\t\t// wake is level-triggered: re-check demand so a subscriber that returns before we tear\n\t\t\t// down resumes on the same stream.\n\t\t\tlet terminal = localEnded;\n\t\t\tfor (;;) {\n\t\t\t\tconst reason = await race([done, producer.unused().then(() => idle)]);\n\t\t\t\tif (reason === idle && producer.closed.peek() === undefined && producer.used.peek()) continue;\n\t\t\t\tterminal = reason;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Close before the cancellation is written, not after: awaiting the write first\n\t\t\t// reopens the window the demand re-check above just closed, and a subscriber that\n\t\t\t// returned during it would be closed by this line. The lite subscriber closes\n\t\t\t// straight out of its loop for the same reason.\n\t\t\tproducer.close();\n\n\t\t\t// The publisher already ended the request, so there is nothing to cancel. Sending\n\t\t\t// UNSUBSCRIBE here would name a request it has already torn down.\n\t\t\tif (terminal !== publisherEnded) await this.#cancelSubscribe(stream, requestId);\n\n\t\t\tstream.close();\n\t\t\tconsole.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = await sessionCause(this.#quic, err);\n\t\t\tproducer.close(e);\n\t\t\tstream.abort(e);\n\t\t\tconsole.warn(\n\t\t\t\t`subscribe error: id=${requestId} broadcast=${broadcast} track=${request.name} error=${reason(e)}`,\n\t\t\t);\n\t\t} finally {\n\t\t\t// Only the owner tears down the alias metadata: a later subscription may have\n\t\t\t// reclaimed the alias and installed its own timescale.\n\t\t\tif (this.#aliases.retire(trackAlias, subscription)) this.#timescales.delete(trackAlias);\n\t\t}\n\t}\n\n\t/**\n\t * Read the PUBLISH_DONE that ends a subscription, then wait for the data streams it counts.\n\t *\n\t * An error status aborts the track with it. A clean one leaves streams in flight, since\n\t * QUIC does not order them, so wait until the Stream Count many have been read, or a\n\t * bounded grace for the ones that never arrive (the draft says to use a timeout). The count\n\t * is only a hint: a peer may send 0 regardless, so 0 waits out the grace. A request stream\n\t * that ends without one ends the track the same way.\n\t */\n\tasync #runPublishDone(stream: Stream, subscription: Subscription): Promise<void> {\n\t\tconst version = this.#session.version;\n\t\tlet count: bigint | undefined;\n\t\tif (!(await stream.reader.done())) {\n\t\t\tconst typeId = await stream.reader.u53();\n\t\t\tif (typeId !== PublishDone.id) {\n\t\t\t\tthrow new ProtocolViolation(`unexpected message on a subscription: 0x${typeId.toString(16)}`);\n\t\t\t}\n\t\t\tconst done = await PublishDone.decode(stream.reader, version);\n\t\t\tif (!publishDoneClean(done.statusCode, version)) {\n\t\t\t\tthrow new Error(`publish done: status=0x${done.statusCode.toString(16)} reason=${done.reasonPhrase}`);\n\t\t\t}\n\t\t\tcount = done.streamCount;\n\t\t}\n\n\t\tconst { tail, track } = subscription;\n\t\tconst complete = () => count !== undefined && count > 0n && BigInt(tail.streams) >= count;\n\t\tawait tail.settle(complete, TAIL_GRACE_MS, track.closed);\n\t}\n\n\t/**\n\t * Tell the publisher to stop serving a subscription we are walking away from.\n\t *\n\t * v14-16 cancel with UNSUBSCRIBE (draft-16 section 9.12), which is what lets the\n\t * publisher destroy the subscription (section 5.1.1); v17+ removed the message and\n\t * rely on the stream reset instead. Every path that abandons an Established\n\t * subscription goes through here, because those versions carry the request over a\n\t * virtual stream whose reset never reaches the peer.\n\t */\n\tasync #cancelSubscribe(stream: Stream, requestId: bigint) {\n\t\tconst version = this.#session.version;\n\t\tif (version !== Version.DRAFT_14 && version !== Version.DRAFT_15 && version !== Version.DRAFT_16) return;\n\n\t\ttry {\n\t\t\tawait stream.writer.u53(Unsubscribe.id);\n\t\t\tawait new Unsubscribe({ requestId }).encode(stream.writer, version);\n\t\t} catch {\n\t\t\t// The stream may already be gone; there is nothing further to tell the peer.\n\t\t}\n\t}\n\n\t// Opens the subscribe stream, sends SUBSCRIBE, and reads the response.\n\t// `state` is populated as soon as the stream opens and again when the\n\t// trackAlias is registered, so the caller can clean both up on timeout\n\t// even before this promise settles.\n\tasync #openSubscribe(\n\t\tstate: SubscribeSetupState,\n\t\tbroadcast: Path.Valid,\n\t\trequest: track.Request,\n\t\tsubscription: Subscription,\n\t\trequestId: bigint,\n\t): Promise<{ stream: Stream; alias: bigint }> {\n\t\tconst version = this.#session.version;\n\n\t\tstate.stream = await this.#session.openBi();\n\n\t\t// The timeout can fire while the open is still in flight, in which case cleanup ran\n\t\t// with nothing to release. Bail now that the stream is recorded, so settling this\n\t\t// promise hands it back to be torn down.\n\t\tif (state.cancelled) throw new Error(\"subscribe cancelled before it was sent\");\n\n\t\tawait state.stream.writer.u53(Subscribe.id);\n\t\tconst msg = new Subscribe({\n\t\t\trequestId,\n\t\t\ttrackNamespace: broadcast,\n\t\t\ttrackName: request.name,\n\t\t\tsubscriberPriority: toWire(request.priority),\n\t\t\t// No fill is requested: the fill's fetch stream and the live subscription split\n\t\t\t// the group across two streams, and this subscriber does not reassemble them into\n\t\t\t// one group yet. A lenient publisher (like ours) replays the whole in-range group\n\t\t\t// on the subscription instead; a strict one only delivers from the next published\n\t\t\t// object, and that mid-group stream is dropped, degrading the join to the next\n\t\t\t// group boundary.\n\t\t\tfilter: joinFilter(version),\n\t\t});\n\t\tawait msg.encode(state.stream.writer, version);\n\t\tstate.sent = true;\n\n\t\t// The caller may have given up while that write was in flight. It deliberately left\n\t\t// the stream alone, so unwind here and let its cleanup send the cancellation now that\n\t\t// the SUBSCRIBE has actually reached the peer.\n\t\tif (state.cancelled) throw new Error(\"subscribe cancelled while it was being sent\");\n\t\tconsole.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${request.name}`);\n\n\t\tconst respTypeId = await state.stream.reader.u53();\n\t\tif (respTypeId !== SubscribeOk.id) {\n\t\t\tlet reasonPhrase = \"unknown error\";\n\t\t\ttry {\n\t\t\t\tif (respTypeId === RequestError.id) {\n\t\t\t\t\tconst err =\n\t\t\t\t\t\tversion === Version.DRAFT_14\n\t\t\t\t\t\t\t? await SubscribeError.decode(state.stream.reader, version)\n\t\t\t\t\t\t\t: await RequestError.decode(state.stream.reader, version);\n\t\t\t\t\treasonPhrase = requestReason(err.errorCode, err.reasonPhrase, \"subscribe\", version);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Decoding error response failed, use default message\n\t\t\t}\n\t\t\tstate.rejected = true;\n\t\t\tthrow new Error(`SUBSCRIBE error: ${reasonPhrase}`);\n\t\t}\n\n\t\tconst ok = await SubscribeOk.decode(state.stream.reader, version);\n\t\tif (state.cancelled) throw new Error(\"subscribe cancelled before acceptance\");\n\t\trequest.accept({ priority: fromWire(ok.properties.priority ?? 128) });\n\n\t\ttry {\n\t\t\tthis.#aliases.set(ok.trackAlias, subscription, { broadcast, name: request.name });\n\t\t\tconst timescale = ok.properties.timescale;\n\t\t\tif (timescale !== undefined) {\n\t\t\t\tthis.#timescales.set(ok.trackAlias, timescale);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// Only one alias naming two different tracks is the session's problem. A publisher\n\t\t\t// sharing an alias between subscriptions to one track is allowed to do that, and\n\t\t\t// disconnecting over it would drop every other broadcast on the session.\n\t\t\tif (err instanceof DuplicateTrackAlias) this.#session.close();\n\t\t\tthrow err;\n\t\t}\n\t\tstate.registeredAlias = ok.trackAlias;\n\t\treturn { stream: state.stream, alias: ok.trackAlias };\n\t}\n\n\t/**\n\t * Handles an incoming PUBLISH_NAMESPACE on a bidi stream.\n\t * Tracks announced broadcasts and notifies consumers.\n\t *\n\t * @internal\n\t */\n\tasync runPublishNamespace(msg: PublishNamespace, stream: Stream) {\n\t\tconst version = this.#session.version;\n\t\tconst path = msg.trackNamespace;\n\n\t\t// A path that already ran through us looped back. Refuse it rather than holding an\n\t\t// advertisement we could never subscribe through. The peer knows our Hop ID, so a\n\t\t// conforming one never offers it; 0 as the retry interval says not to come back.\n\t\tif (this.#reflected(msg.cluster)) {\n\t\t\tconsole.debug(`dropping reflected publish_namespace: broadcast=${path}`);\n\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\tawait new RequestError({\n\t\t\t\trequestId: msg.requestId,\n\t\t\t\terrorCode: toRequestCode(\"uninterested\", \"publish_namespace\", version),\n\t\t\t\treasonPhrase: \"route loops back\",\n\t\t\t}).encode(stream.writer, version);\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\t// Draft-14/15 key their namespace-scoped messages by name, not request ID, so the\n\t\t// adapter can hold only one request per namespace: a second would overwrite the\n\t\t// first, and the withdrawals would then close the wrong stream and fail to find\n\t\t// the other. Nothing is lost by refusing it, because the case that makes a second\n\t\t// reference legitimate (an inline NAMESPACE for a path a PUBLISH_NAMESPACE already\n\t\t// carried) needs a message those drafts do not have.\n\t\tconst legacy = version === Version.DRAFT_14 || version === Version.DRAFT_15;\n\t\tif (legacy && (this.#announced.has(path) || this.#legacyRequests.has(path))) {\n\t\t\tconsole.warn(\"duplicate PublishNamespace\");\n\t\t\t// No draft registers a code for a duplicate, and this refusal is a draft-14/15\n\t\t\t// implementation limit, which is what INTERNAL_ERROR describes.\n\t\t\tconst errorCode = toRequestCode(\"internal\", \"publish_namespace\", version);\n\t\t\tif (version === Version.DRAFT_14) {\n\t\t\t\tawait stream.writer.u53(PublishNamespaceError.id);\n\t\t\t\tawait new PublishNamespaceError({\n\t\t\t\t\trequestId: msg.requestId,\n\t\t\t\t\terrorCode,\n\t\t\t\t\treasonPhrase: \"duplicate namespace\",\n\t\t\t\t}).encode(stream.writer, version);\n\t\t\t} else {\n\t\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\t\tawait new RequestError({\n\t\t\t\t\trequestId: msg.requestId,\n\t\t\t\t\terrorCode,\n\t\t\t\t\treasonPhrase: \"duplicate namespace\",\n\t\t\t\t}).encode(stream.writer, version);\n\t\t\t}\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\t// Everywhere else a path this session already knows is not refused: the same\n\t\t// namespace can reach us twice, and the count is what tells the second apart from\n\t\t// news. This request owns exactly one of those references and gives it back when\n\t\t// the stream ends.\n\t\tif (legacy) this.#legacyRequests.add(path);\n\t\tlet attached = false;\n\n\t\ttry {\n\t\t\t// Send OK first. This must complete before notifying consumers,\n\t\t\t// because consumers may trigger Subscribe writes that would\n\t\t\t// interleave with our OK on the control stream.\n\t\t\tif (version === Version.DRAFT_14) {\n\t\t\t\tawait stream.writer.u53(PublishNamespaceOk.id);\n\t\t\t\tconst ok = new PublishNamespaceOk({ requestId: msg.requestId });\n\t\t\t\tawait ok.encode(stream.writer, version);\n\t\t\t} else {\n\t\t\t\tawait stream.writer.u53(RequestOk.id);\n\t\t\t\tconst ok = new RequestOk({\n\t\t\t\t\trequestId: version === Version.DRAFT_15 || version === Version.DRAFT_16 ? msg.requestId : undefined,\n\t\t\t\t});\n\t\t\t\tawait ok.encode(stream.writer, version);\n\t\t\t}\n\n\t\t\t// Only now is the advertisement ours to announce, for the reason above: a\n\t\t\t// consumer reacting with a SUBSCRIBE must not interleave with that OK.\n\t\t\tattached = true;\n\t\t\tthis.#attachAnnounce(path, this.#route(msg.cluster));\n\n\t\t\t// An advertisement is updated in place with REQUEST_UPDATE on the stream that\n\t\t\t// already carries it, so read until the stream ends rather than waiting on the\n\t\t\t// close. Nothing else would deliver a re-parented route. What the peer holds\n\t\t\t// is kept current, since an update carries only what changed.\n\t\t\tlet held = msg.cluster;\n\t\t\tconst done = version === Version.DRAFT_16 || legacy;\n\t\t\tfor (;;) {\n\t\t\t\tif (await stream.reader.done()) break;\n\n\t\t\t\tconst typeId = await stream.reader.u53();\n\t\t\t\tif (done && typeId === PublishNamespaceDone.id) {\n\t\t\t\t\tawait PublishNamespaceDone.decode(stream.reader, version);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// A repeated PUBLISH_NAMESPACE lands here too: a second request on the\n\t\t\t\t// stream is the base draft's duplicate request ID.\n\t\t\t\tif (typeId !== PublishNamespaceUpdate.id) {\n\t\t\t\t\tthrow new ProtocolViolation(\n\t\t\t\t\t\t`unexpected message on publish_namespace stream: 0x${typeId.toString(16)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst update = await PublishNamespaceUpdate.decode(stream.reader, version);\n\n\t\t\t\t// The parameters exist only on a session that negotiated the extension;\n\t\t\t\t// anywhere else they are the peer's violation.\n\t\t\t\tif (held === undefined) {\n\t\t\t\t\tif (update.update.hops !== undefined || update.update.cost !== undefined) {\n\t\t\t\t\t\tthrow new ProtocolViolation(\"cluster parameters on a session that negotiated none\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// A different original publisher is a different advertisement, which the\n\t\t\t\t\t// draft has withdrawn and made again: its content is not continuous with\n\t\t\t\t\t// what is held. Refusing the update closes the stream, which is that\n\t\t\t\t\t// withdrawal.\n\t\t\t\t\tif (update.update.hops !== undefined && update.update.hops[0] !== held.hops[0]) {\n\t\t\t\t\t\tconsole.warn(`publish_namespace update changes the publisher: broadcast=${path}`);\n\t\t\t\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\t\t\t\tawait new RequestError({\n\t\t\t\t\t\t\terrorCode: toRequestCode(\"not_supported\", \"publish_namespace\", version),\n\t\t\t\t\t\t\treasonPhrase: \"a new publisher is a new advertisement\",\n\t\t\t\t\t\t}).encode(stream.writer, version);\n\t\t\t\t\t\tstream.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\theld = Cluster.apply(held, update.update);\n\t\t\t\t}\n\n\t\t\t\t// A path that now runs through us is unusable, so give it back. The update\n\t\t\t\t// itself is accepted, and reading continues: this stream is the\n\t\t\t\t// advertisement's only channel, so a later clean path arrives here or\n\t\t\t\t// nowhere.\n\t\t\t\tif (this.#reflected(held)) {\n\t\t\t\t\tif (attached) {\n\t\t\t\t\t\tattached = false;\n\t\t\t\t\t\tconsole.debug(`publish_namespace now loops back, detaching: broadcast=${path}`);\n\t\t\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t\t\t}\n\t\t\t\t} else if (!attached) {\n\t\t\t\t\t// Re-attach: a clean path replaced the reflected one we detached from.\n\t\t\t\t\tattached = true;\n\t\t\t\t\tthis.#attachAnnounce(path, this.#route(held));\n\t\t\t\t} else {\n\t\t\t\t\tthis.#updateAnnounce(path, this.#route(held));\n\t\t\t\t}\n\n\t\t\t\t// Nothing here can fail to apply, so every update is acknowledged. A leaf\n\t\t\t\t// routes nothing, so a repricing changes nothing it holds; consumers still\n\t\t\t\t// hear the new route so a forwarder can reprice.\n\t\t\t\tawait stream.writer.u53(RequestOk.id);\n\t\t\t\tawait new RequestOk({}).encode(stream.writer, version);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (legacy) this.#legacyRequests.delete(path);\n\n\t\t\t// Give back exactly what was taken: a request that never got its OK out never\n\t\t\t// referenced the path, and retracting there would drop someone else's count.\n\t\t\tif (attached) {\n\t\t\t\tthis.#detachAnnounce(path);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles an incoming PUBLISH on a bidi stream.\n\t * We don't support reverse publish, so send error.\n\t *\n\t * @internal\n\t */\n\tasync runPublish(msg: Publish, stream: Stream) {\n\t\tconst version = this.#session.version;\n\n\t\t// We decline the method itself rather than this particular track, which would be\n\t\t// UNINTERESTED.\n\t\t//\n\t\t// The alias the message carries is deliberately not recorded. Nothing will ever bind\n\t\t// it, and a rejected request has no lifetime of ours to hang the cleanup on.\n\t\tconst errorCode = toRequestCode(\"not_supported\", \"publish\", version);\n\n\t\tif (version === Version.DRAFT_14) {\n\t\t\tawait stream.writer.u53(PublishError.id);\n\t\t\tconst err = new PublishError({\n\t\t\t\trequestId: msg.requestId,\n\t\t\t\terrorCode,\n\t\t\t\treasonPhrase: \"publish not supported\",\n\t\t\t});\n\t\t\tawait err.encode(stream.writer, version);\n\t\t} else {\n\t\t\tawait stream.writer.u53(RequestError.id);\n\t\t\tconst err = new RequestError({\n\t\t\t\trequestId: version === Version.DRAFT_15 || version === Version.DRAFT_16 ? msg.requestId : undefined,\n\t\t\t\terrorCode,\n\t\t\t\treasonPhrase: \"publish not supported\",\n\t\t\t});\n\t\t\tawait err.encode(stream.writer, version);\n\t\t}\n\t\tstream.close();\n\t}\n\n\t/**\n\t * Handles an ObjectStream message (group + frames on uni stream).\n\t *\n\t * @internal\n\t */\n\tasync handleGroup(group: GroupMessage, stream: Reader) {\n\t\tif (group.subGroupId !== 0) {\n\t\t\tthrow new Error(\"subgroups are not supported\");\n\t\t}\n\n\t\tlet subscription: Subscription;\n\t\ttry {\n\t\t\t// The control message establishing this alias can arrive after the data stream.\n\t\t\tsubscription = await this.#aliases.get(group.trackAlias);\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\t// Ours: we cancelled the subscription and the publisher has not stopped yet.\n\t\t\t// Anything else on this alias is the publisher sending data for a track it never\n\t\t\t// acknowledged, which is worth seeing.\n\t\t\tif (e instanceof RetiredTrackAlias) {\n\t\t\t\tconsole.debug(`dropping group for a cancelled subscription: alias=${group.trackAlias}`);\n\t\t\t}\n\t\t\tstream.stop(e);\n\t\t\treturn;\n\t\t}\n\n\t\tconst { track, tail } = subscription;\n\t\t// Every data stream counts toward PUBLISH_DONE's Stream Count, even one dropped below.\n\t\tconst read = tail.open(group.groupId);\n\n\t\t// Created on the first object rather than the header: an END_OF_TRACK at object 0\n\t\t// means the group does not exist at all.\n\t\tlet producer: netGroup.Producer | undefined;\n\t\tconst open = () => {\n\t\t\tif (!producer) {\n\t\t\t\tproducer = new netGroup.Producer(group.groupId);\n\t\t\t\ttrack.writeGroup(producer);\n\t\t\t}\n\t\t\treturn producer;\n\t\t};\n\n\t\ttry {\n\t\t\t// FIRST_OBJECT clear says this stream starts partway through the group, which the\n\t\t\t// draft lets a publisher do to answer a filter. Nothing above here can use it: the\n\t\t\t// objects that would arrive are not decodable without the missing head, and a group\n\t\t\t// is the unit an application resyncs on. Drop it and pick up at the next group, the\n\t\t\t// same degradation as a publisher that no longer holds the head.\n\t\t\t//\n\t\t\t// This only saves reading a stream we would throw away. The bit is the publisher's\n\t\t\t// claim, so what is enforced is the object ids themselves: `Frame.decode` holds every\n\t\t\t// object to starting at 0 and incrementing by 1, whatever the header said and on the\n\t\t\t// drafts that have no such bit to read.\n\t\t\tif (!group.flags.firstObject) {\n\t\t\t\tconsole.debug(`dropping a group with no head: alias=${group.trackAlias} group=${group.groupId}`);\n\t\t\t\tstream.stop(new Error(\"a group must start at object 0\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The alias binds after SUBSCRIBE_OK commits the track property; an omitted\n\t\t\t// header priority inherits it (draft-21 section 10.4).\n\t\t\tif (!group.flags.hasPriority) group.publisherPriority = toWire((await track.info()).priority);\n\n\t\t\tfor (;;) {\n\t\t\t\t// Only the group's own stream ends it: a track that closes first has already\n\t\t\t\t// closed (or aborted) this group through its cache.\n\t\t\t\tconst done = await (producer ? race([stream.done(), producer.closed]) : stream.done());\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tconst frame = await Frame.decode(\n\t\t\t\t\tstream,\n\t\t\t\t\tgroup.flags,\n\t\t\t\t\tthis.#timescales.get(group.trackAlias),\n\t\t\t\t\tthis.#session.version,\n\t\t\t\t);\n\n\t\t\t\tif (frame.endOfTrack) {\n\t\t\t\t\t// No object at or past this location exists: after the group's last object\n\t\t\t\t\t// the track ends with it, and at object 0 it ends before it.\n\t\t\t\t\tconst end = producer ? group.groupId + 1 : group.groupId;\n\t\t\t\t\tproducer?.close();\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttrack.finishAt(end);\n\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\tthrow new ProtocolViolation(`invalid END_OF_TRACK: ${reason(error(err))}`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (frame.payload === undefined) break;\n\n\t\t\t\topen().writeFrame({ payload: frame.payload, timestamp: frame.timestamp ?? Timestamp.now() });\n\t\t\t}\n\n\t\t\t// A group with no objects still exists.\n\t\t\topen().close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tif (e instanceof ProtocolViolation) {\n\t\t\t\t// The publisher broke the track's end, which no later group can repair.\n\t\t\t\tproducer?.close(e);\n\t\t\t\ttrack.close(e);\n\t\t\t} else {\n\t\t\t\t// A stream that fails before its first object still names a group, which the\n\t\t\t\t// reader sees fail rather than silently go missing.\n\t\t\t\ttry {\n\t\t\t\t\topen().close(e);\n\t\t\t\t} catch {\n\t\t\t\t\t// The track has already closed or ended below this group.\n\t\t\t\t}\n\t\t\t}\n\t\t\tstream.stop(e);\n\t\t} finally {\n\t\t\tread();\n\t\t}\n\t}\n}\n\n/**\n * A broadcast consumed from a moq-transport session. Track info is resolved by the\n * subscribe path (the inherited `resolveTrackInfo`), but the protocol has no one-shot\n * group fetch, so `track.Consumer.fetchGroup()` is rejected.\n */\nclass ConsumeBroadcast extends broadcast.Consumer {\n\tconstructor(state?: never) {\n\t\tsuper(state);\n\t\toverrideBroadcastWire(this, {\n\t\t\tfetchGroup: () => Promise.reject(new Error(\"fetch group is not supported for moq-transport\")),\n\t\t});\n\t}\n\n\t// Preserve the subclass when the consume cache shares this broadcast across callers.\n\toverride clone(): ConsumeBroadcast {\n\t\treturn new ConsumeBroadcast(this.shareState());\n\t}\n}\n"]}
package/internal.d.ts CHANGED
@@ -22,6 +22,11 @@ export declare function groupBounds(groups?: Groups): {
22
22
  * The peer echoes every suffix beneath it, and the caller filters what arrives.
23
23
  */
24
24
  export declare function scopeHead(scope: Path.Pattern): Path.Valid;
25
+ /**
26
+ * Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce
27
+ * discovery unless the request opts in. A path at or above the prefix never hides.
28
+ */
29
+ export declare function hiddenBelow(prefix: Path.Valid, path: Path.Valid): boolean;
25
30
  /** Whether the announced prefix's subtree overlaps `scope`. */
26
31
  export declare function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean;
27
32
  /** What `scope` captures from an exact announced prefix, if it pins every wildcard. */
@@ -83,6 +88,8 @@ export interface TrackRequestOptions {
83
88
  export declare const hooks: {
84
89
  /** Mint a track {@link Request}; assigned by `track.ts`. */
85
90
  makeRequest: (options: TrackRequestOptions) => Request;
91
+ /** Access the existing producer while a request awaits immutable wire metadata. */
92
+ pendingTrackProducer: (request: Request) => Producer;
86
93
  /**
87
94
  * Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.
88
95
  *
package/internal.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,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AAC,CAAC;IAC3E,yEAAyE;IACzE,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAC7F,kFAAkF;IAClF,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,8DAA8D;IAC9D,eAAe,EAAE,CAChB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QAAC,UAAU,IAAI,IAAI,CAAA;KAAE,KAC3D,IAAI,CAAC;CAyCV,CAAC"}
package/internal.js CHANGED
@@ -23,6 +23,14 @@ export function groupBounds(groups = {}) {
23
23
  export function scopeHead(scope) {
24
24
  return Path.from(scope.head);
25
25
  }
26
+ /**
27
+ * Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce
28
+ * discovery unless the request opts in. A path at or above the prefix never hides.
29
+ */
30
+ export function hiddenBelow(prefix, path) {
31
+ const below = Path.stripPrefix(prefix, path);
32
+ return below !== null && Path.parts(below).some((part) => part.startsWith("."));
33
+ }
26
34
  /** Whether the announced prefix's subtree overlaps `scope`. */
27
35
  export function scopeOverlaps(scope, prefix) {
28
36
  return scope.overlaps(Path.Pattern.subtree(prefix));
@@ -36,6 +44,9 @@ export const hooks = {
36
44
  makeRequest: () => {
37
45
  throw new Error("track.ts not loaded");
38
46
  },
47
+ pendingTrackProducer: () => {
48
+ throw new Error("track.ts not loaded");
49
+ },
39
50
  tryRecvGroup: () => {
40
51
  throw new Error("track.ts not loaded");
41
52
  },
package/internal.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,MAAM,GAAW,EAAE;IAC9C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AC;IACD,eAAe,EAAE,GAAG,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD,CAAC","sourcesContent":["/**\n * Package-internal constructor hooks. Classes keep their constructors private so consumers\n * can't mint detached handles; sibling modules create instances through these hooks instead.\n * Not exported from the package entrypoint.\n *\n * @module\n */\nimport type { Dispose, Getter } from \"@moq/signals\";\nimport type { Producer as BroadcastProducer } from \"./broadcast.ts\";\nimport type { Frame, Consumer as GroupConsumer } from \"./group.ts\";\nimport type { Route } from \"./hop.ts\";\nimport * as Path from \"./path.ts\";\nimport type { Timestamp } from \"./time.ts\";\nimport type { Groups, Producer, Request, Subscriber } from \"./track.ts\";\n\n/** Normalize public group bounds into an inclusive start and exclusive end. */\nexport function groupBounds(groups: Groups = {}): { start: number; end?: number } {\n\tconst bound = (value: Groups[\"start\"] | undefined, start: boolean): number | undefined => {\n\t\tif (value === undefined) return undefined;\n\t\tif ((value.included === undefined) === (value.excluded === undefined)) {\n\t\t\tthrow new Error(\"a group bound must be either included or excluded\");\n\t\t}\n\t\tconst sequence = value.included ?? value.excluded;\n\t\tif (sequence === undefined || !Number.isSafeInteger(sequence) || sequence < 0) {\n\t\t\tthrow new Error(\"a group bound must be a non-negative safe integer\");\n\t\t}\n\t\treturn sequence + (start ? Number(value.excluded !== undefined) : Number(value.included !== undefined));\n\t};\n\treturn { start: bound(groups.start, true) ?? 0, end: bound(groups.end, false) };\n}\n\n/**\n * The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.\n * The peer echoes every suffix beneath it, and the caller filters what arrives.\n */\nexport function scopeHead(scope: Path.Pattern): Path.Valid {\n\treturn Path.from(scope.head);\n}\n\n/** Whether the announced prefix's subtree overlaps `scope`. */\nexport function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean {\n\treturn scope.overlaps(Path.Pattern.subtree(prefix));\n}\n\n/** What `scope` captures from an exact announced prefix, if it pins every wildcard. */\nexport function scopeCaptures(scope: Path.Pattern, prefix: Path.Valid): Path.Pattern[] | undefined {\n\treturn scope.captures(Path.Pattern.literal(prefix));\n}\n\n/**\n * What a non-blocking group read found, which is everything the caller needs to decide what\n * to do next: no second look at the track's closed state, and no ordering rule to get wrong.\n */\nexport type Recv =\n\t/** A group to serve. It has already left the buffer, so dropping this is dropping the group. */\n\t| { kind: \"group\"; group: GroupConsumer }\n\t/** Nothing readable, but the track is live and may produce more. */\n\t| { kind: \"idle\" }\n\t/** The producer finished, yet groups above the cap are still held: raising it releases them. */\n\t| { kind: \"boundary\" }\n\t/** The producer finished and the buffer is drained. Nothing can follow. */\n\t| { kind: \"done\" }\n\t/** The track aborted. */\n\t| { kind: \"error\"; error: Error };\n\n/** A package-internal frame read the wire publisher completes once written. */\nexport interface ReadGroupFrame {\n\t/** Frame sequence within the group. */\n\tsequence: number;\n\t/** Frame returned to the publisher. */\n\tframe: Frame;\n\t/** Mark the frame delivered or deliberately skipped by the wire publisher. */\n\tcomplete(): void;\n}\n\n/** The next group or datagram sequence shared by dynamic producers of one broadcast track. */\nexport interface TrackSequence {\n\tnext: number;\n}\n\n/** Per-track sequence namespaces owned by one broadcast generation. */\nexport type TrackSequences = Map<string, TrackSequence>;\n\n/** Inputs for creating a package-internal track request. */\nexport interface TrackRequestOptions {\n\t/** The requested track name. */\n\tname: string;\n\t/** The producer that will serve the request. */\n\tproducer: Producer;\n\t/** Sequence namespaces shared by the broadcast generation. */\n\tsequences: TrackSequences;\n\t/** Requests not yet accepted or rejected by the publisher. */\n\tpending: Set<Request>;\n}\n\n/** Hooks assigned in static blocks by the owning class. */\nexport const hooks: {\n\t/** Mint a track {@link Request}; assigned by `track.ts`. */\n\tmakeRequest: (options: TrackRequestOptions) => Request;\n\t/**\n\t * Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.\n\t *\n\t * Synchronous so a caller can pop a group and act on it in the same turn. Park on\n\t * {@link groupChanged} when it reports `idle` or `boundary`.\n\t */\n\ttryRecvGroup: (subscriber: Subscriber) => Recv;\n\t/** Wake once a subscriber's group cursor may read differently; assigned by `track.ts`. */\n\tgroupChanged: (subscriber: Subscriber, fn: () => void) => Dispose;\n\t/**\n\t * Exempt a subscriber from live-delivery policy for a one-shot FETCH scan: it names one\n\t * old group explicitly, so it is neither late against the live edge nor bound by the start\n\t * a live subscription resolves to.\n\t */\n\texemptFetch: (subscriber: Subscriber) => void;\n\t/**\n\t * Replace a serving cursor. An omitted start keeps the current floor; a provided start\n\t * can lower it. Wire publishers apply SUBSCRIBE_UPDATE here rather than through\n\t * `setGroups`, which never rewinds.\n\t */\n\treplaceGroups: (subscriber: Subscriber, groups: Groups) => void;\n\t/** Return a group's first timestamp, retained even after its first frame is read. */\n\tgroupTimestamp: (group: GroupConsumer) => Timestamp | undefined;\n\tgroupLatest: (group: GroupConsumer) => Timestamp | undefined;\n\t/** Keep applying a subscription's drift policy after it hands a group out. */\n\texpireGroup: (\n\t\tgroup: GroupConsumer,\n\t\texpiry: { expired: () => boolean; changed: readonly Getter<unknown>[] },\n\t) => void;\n\t/** Stop an in-flight group operation if the handed-out group expires. */\n\tguardGroup: <T>(group: GroupConsumer, operation: Promise<T>) => Promise<T>;\n\t/** Read a frame the wire publisher completes (or skips) once written. */\n\treadGroupFrame: (group: GroupConsumer, from?: number) => Promise<ReadGroupFrame | undefined>;\n\t/** Make an evicted mirror terminal while its track timeline still contains it. */\n\tevictGroup: (group: GroupConsumer) => void;\n\t/** Attach the origin advertisement of a created broadcast. */\n\tattachAnnouncer: (\n\t\tproducer: BroadcastProducer,\n\t\tannouncer: { announce(route: Route): void; unannounce(): void },\n\t) => void;\n} = {\n\tmakeRequest: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\ttryRecvGroup: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupChanged: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\texemptFetch: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\treplaceGroups: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupTimestamp: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tgroupLatest: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\texpireGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tguardGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\treadGroupFrame: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tevictGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tattachAnnouncer: () => {\n\t\tthrow new Error(\"broadcast.ts not loaded\");\n\t},\n};\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,MAAM,GAAW,EAAE;IAC9C,MAAM,KAAK,GAAG,CAAC,KAAkC,EAAE,KAAc,EAAsB,EAAE;QACxF,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QA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AC;IACxC,CAAC;IACD,oBAAoB,EAAE,GAAG,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,YAAY,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,YAAY,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,cAAc,EAAE,GAAG,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,cAAc,EAAE,GAAG,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD,CAAC","sourcesContent":["/**\n * Package-internal constructor hooks. Classes keep their constructors private so consumers\n * can't mint detached handles; sibling modules create instances through these hooks instead.\n * Not exported from the package entrypoint.\n *\n * @module\n */\nimport type { Dispose, Getter } from \"@moq/signals\";\nimport type { Producer as BroadcastProducer } from \"./broadcast.ts\";\nimport type { Frame, Consumer as GroupConsumer } from \"./group.ts\";\nimport type { Route } from \"./hop.ts\";\nimport * as Path from \"./path.ts\";\nimport type { Timestamp } from \"./time.ts\";\nimport type { Groups, Producer, Request, Subscriber } from \"./track.ts\";\n\n/** Normalize public group bounds into an inclusive start and exclusive end. */\nexport function groupBounds(groups: Groups = {}): { start: number; end?: number } {\n\tconst bound = (value: Groups[\"start\"] | undefined, start: boolean): number | undefined => {\n\t\tif (value === undefined) return undefined;\n\t\tif ((value.included === undefined) === (value.excluded === undefined)) {\n\t\t\tthrow new Error(\"a group bound must be either included or excluded\");\n\t\t}\n\t\tconst sequence = value.included ?? value.excluded;\n\t\tif (sequence === undefined || !Number.isSafeInteger(sequence) || sequence < 0) {\n\t\t\tthrow new Error(\"a group bound must be a non-negative safe integer\");\n\t\t}\n\t\treturn sequence + (start ? Number(value.excluded !== undefined) : Number(value.included !== undefined));\n\t};\n\treturn { start: bound(groups.start, true) ?? 0, end: bound(groups.end, false) };\n}\n\n/**\n * The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.\n * The peer echoes every suffix beneath it, and the caller filters what arrives.\n */\nexport function scopeHead(scope: Path.Pattern): Path.Valid {\n\treturn Path.from(scope.head);\n}\n\n/**\n * Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce\n * discovery unless the request opts in. A path at or above the prefix never hides.\n */\nexport function hiddenBelow(prefix: Path.Valid, path: Path.Valid): boolean {\n\tconst below = Path.stripPrefix(prefix, path);\n\treturn below !== null && Path.parts(below).some((part) => part.startsWith(\".\"));\n}\n\n/** Whether the announced prefix's subtree overlaps `scope`. */\nexport function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean {\n\treturn scope.overlaps(Path.Pattern.subtree(prefix));\n}\n\n/** What `scope` captures from an exact announced prefix, if it pins every wildcard. */\nexport function scopeCaptures(scope: Path.Pattern, prefix: Path.Valid): Path.Pattern[] | undefined {\n\treturn scope.captures(Path.Pattern.literal(prefix));\n}\n\n/**\n * What a non-blocking group read found, which is everything the caller needs to decide what\n * to do next: no second look at the track's closed state, and no ordering rule to get wrong.\n */\nexport type Recv =\n\t/** A group to serve. It has already left the buffer, so dropping this is dropping the group. */\n\t| { kind: \"group\"; group: GroupConsumer }\n\t/** Nothing readable, but the track is live and may produce more. */\n\t| { kind: \"idle\" }\n\t/** The producer finished, yet groups above the cap are still held: raising it releases them. */\n\t| { kind: \"boundary\" }\n\t/** The producer finished and the buffer is drained. Nothing can follow. */\n\t| { kind: \"done\" }\n\t/** The track aborted. */\n\t| { kind: \"error\"; error: Error };\n\n/** A package-internal frame read the wire publisher completes once written. */\nexport interface ReadGroupFrame {\n\t/** Frame sequence within the group. */\n\tsequence: number;\n\t/** Frame returned to the publisher. */\n\tframe: Frame;\n\t/** Mark the frame delivered or deliberately skipped by the wire publisher. */\n\tcomplete(): void;\n}\n\n/** The next group or datagram sequence shared by dynamic producers of one broadcast track. */\nexport interface TrackSequence {\n\tnext: number;\n}\n\n/** Per-track sequence namespaces owned by one broadcast generation. */\nexport type TrackSequences = Map<string, TrackSequence>;\n\n/** Inputs for creating a package-internal track request. */\nexport interface TrackRequestOptions {\n\t/** The requested track name. */\n\tname: string;\n\t/** The producer that will serve the request. */\n\tproducer: Producer;\n\t/** Sequence namespaces shared by the broadcast generation. */\n\tsequences: TrackSequences;\n\t/** Requests not yet accepted or rejected by the publisher. */\n\tpending: Set<Request>;\n}\n\n/** Hooks assigned in static blocks by the owning class. */\nexport const hooks: {\n\t/** Mint a track {@link Request}; assigned by `track.ts`. */\n\tmakeRequest: (options: TrackRequestOptions) => Request;\n\t/** Access the existing producer while a request awaits immutable wire metadata. */\n\tpendingTrackProducer: (request: Request) => Producer;\n\t/**\n\t * Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.\n\t *\n\t * Synchronous so a caller can pop a group and act on it in the same turn. Park on\n\t * {@link groupChanged} when it reports `idle` or `boundary`.\n\t */\n\ttryRecvGroup: (subscriber: Subscriber) => Recv;\n\t/** Wake once a subscriber's group cursor may read differently; assigned by `track.ts`. */\n\tgroupChanged: (subscriber: Subscriber, fn: () => void) => Dispose;\n\t/**\n\t * Exempt a subscriber from live-delivery policy for a one-shot FETCH scan: it names one\n\t * old group explicitly, so it is neither late against the live edge nor bound by the start\n\t * a live subscription resolves to.\n\t */\n\texemptFetch: (subscriber: Subscriber) => void;\n\t/**\n\t * Replace a serving cursor. An omitted start keeps the current floor; a provided start\n\t * can lower it. Wire publishers apply SUBSCRIBE_UPDATE here rather than through\n\t * `setGroups`, which never rewinds.\n\t */\n\treplaceGroups: (subscriber: Subscriber, groups: Groups) => void;\n\t/** Return a group's first timestamp, retained even after its first frame is read. */\n\tgroupTimestamp: (group: GroupConsumer) => Timestamp | undefined;\n\tgroupLatest: (group: GroupConsumer) => Timestamp | undefined;\n\t/** Keep applying a subscription's drift policy after it hands a group out. */\n\texpireGroup: (\n\t\tgroup: GroupConsumer,\n\t\texpiry: { expired: () => boolean; changed: readonly Getter<unknown>[] },\n\t) => void;\n\t/** Stop an in-flight group operation if the handed-out group expires. */\n\tguardGroup: <T>(group: GroupConsumer, operation: Promise<T>) => Promise<T>;\n\t/** Read a frame the wire publisher completes (or skips) once written. */\n\treadGroupFrame: (group: GroupConsumer, from?: number) => Promise<ReadGroupFrame | undefined>;\n\t/** Make an evicted mirror terminal while its track timeline still contains it. */\n\tevictGroup: (group: GroupConsumer) => void;\n\t/** Attach the origin advertisement of a created broadcast. */\n\tattachAnnouncer: (\n\t\tproducer: BroadcastProducer,\n\t\tannouncer: { announce(route: Route): void; unannounce(): void },\n\t) => void;\n} = {\n\tmakeRequest: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tpendingTrackProducer: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\ttryRecvGroup: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupChanged: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\texemptFetch: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\treplaceGroups: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupTimestamp: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tgroupLatest: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\texpireGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tguardGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\treadGroupFrame: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tevictGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tattachAnnouncer: () => {\n\t\tthrow new Error(\"broadcast.ts not loaded\");\n\t},\n};\n"]}
@@ -3,6 +3,15 @@ import * as Path from "../path";
3
3
  import type { Reader, Writer } from "../stream";
4
4
  import { Version } from "./version";
5
5
  export type { Cost };
6
+ /**
7
+ * Lite-07: copy `keep` path segments (from the head) or hops (from the tail) of the
8
+ * live announcement `distance` back from the stream's next Announce ID, where 1 is the
9
+ * latest ANNOUNCE_START. Resolved by {@link AnnounceHistory}.
10
+ */
11
+ export type Base = {
12
+ distance: bigint;
13
+ keep: number;
14
+ };
6
15
  /**
7
16
  * An announcement on the Announce Stream, advertising or retracting a broadcast.
8
17
  *
@@ -16,12 +25,15 @@ export type { Cost };
16
25
  export type AnnounceBroadcast =
17
26
  /** A broadcast is now available, carrying the path suffix, the hop chain, and
18
27
  * (lite-06+) the route cost. An absent cost encodes as zero; it decodes as
19
- * `undefined` on a wire with no room for one. */
28
+ * `undefined` on a wire with no room for one. On lite-07, `suffix` follows the
29
+ * segments `pathBase` copies and `hops` precede the ones `hopBase` copies. */
20
30
  {
21
31
  status: "active";
22
32
  suffix: Path.Valid;
23
33
  hops: Hop[];
24
34
  cost?: Cost;
35
+ pathBase?: Base;
36
+ hopBase?: Base;
25
37
  }
26
38
  /** Pre-lite-06: a broadcast is no longer available, retracted by path. */
27
39
  | {
@@ -41,6 +53,7 @@ export type AnnounceBroadcast =
41
53
  id: bigint;
42
54
  hops: Hop[];
43
55
  cost?: Cost;
56
+ hopBase?: Base;
44
57
  }
45
58
  /** An unknown lite-06+ announce type, skipped by length. Does not assign an id. */
46
59
  | {
@@ -52,6 +65,33 @@ export declare function encodeAnnounceBroadcast(w: Writer, msg: AnnounceBroadcas
52
65
  export declare function decodeAnnounceBroadcast(r: Reader, version: Version): Promise<AnnounceBroadcast>;
53
66
  /** Like {@link decodeAnnounceBroadcast} but resolves `undefined` on a clean FIN. */
54
67
  export declare function decodeAnnounceBroadcastMaybe(r: Reader, version: Version): Promise<AnnounceBroadcast | undefined>;
68
+ type Advertised = {
69
+ suffix: Path.Valid;
70
+ hops: Hop[];
71
+ };
72
+ /**
73
+ * The live announcements on one lite-06+ announce stream, by Announce ID: what
74
+ * ANNOUNCE_END and ANNOUNCE_UPDATE reference, and what a lite-07 base copies from.
75
+ * Every violation throws {@link ProtocolViolation}.
76
+ */
77
+ export declare class AnnounceHistory {
78
+ #private;
79
+ /** An ANNOUNCE_START: resolve it and assign it the next id. */
80
+ start(msg: {
81
+ suffix: Path.Valid;
82
+ hops: Hop[];
83
+ pathBase?: Base;
84
+ hopBase?: Base;
85
+ }): Advertised;
86
+ /** An ANNOUNCE_UPDATE: resolve its chain before replacing the old one, which it may be based on. */
87
+ update(msg: {
88
+ id: bigint;
89
+ hops: Hop[];
90
+ hopBase?: Base;
91
+ }): Advertised;
92
+ /** An ANNOUNCE_END: retire the id, returning its suffix. */
93
+ end(id: bigint): Path.Valid;
94
+ }
55
95
  /**
56
96
  * ANNOUNCE_REQUEST: sent by the subscriber to request ANNOUNCE_BROADCAST messages
57
97
  * for a path prefix. Renamed from `AnnounceInterest` in lite-05.
@@ -66,7 +106,11 @@ export declare class AnnounceRequest {
66
106
  *
67
107
  * Must be a bigint: peer origins are up to 62 bits and overflow u53. */
68
108
  excludeHop: bigint;
69
- constructor(prefix: Path.Valid, excludeHop?: bigint);
109
+ /** Lite07+: also announce routes with a `.`-prefixed segment below the prefix. Not on
110
+ * the wire earlier, so a value set here is ignored when encoding for an older version
111
+ * and decodes as false. */
112
+ hidden: boolean;
113
+ constructor(prefix: Path.Valid, excludeHop?: bigint, hidden?: boolean);
70
114
  encode(w: Writer, version: Version): Promise<void>;
71
115
  static decode(r: Reader, version: Version): Promise<AnnounceRequest>;
72
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/lite/announce.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,GAAG,EAAoC,MAAM,WAAW,CAAC;AAClF,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAA6D,OAAO,EAAE,MAAM,cAAc,CAAC;AAclG,YAAY,EAAE,IAAI,EAAE,CAAC;AAErB;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB;AAC5B;;iDAEiD;AAC/C;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE;AACpE,0EAA0E;GACxE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAA;CAAE;AACzC;sEACsE;GACpE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AACnC;oFACoF;GAClF;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE;AAC7D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