From e30438bb67a12cf2d345822812d7af953285225b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 29 Oct 2026 09:30:35 -0700 Subject: [PATCH 1/7] chore(quest): claim quest/m1/api-audit/resolve/watch-origin.md Quest-Claim: 0e4872dce27cec9a From e0b68950da134fac450e8bf666682af5d6dadf9d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 29 Oct 2026 09:36:29 -0700 Subject: [PATCH 2/7] fix(watch): accept structural read-side origins Co-Authored-By: GPT-6.1 Sol --- js/watch/api/element.api.md | 2 +- js/watch/api/index.api.md | 4 +-- js/watch/src/broadcast.test.ts | 2 +- js/watch/src/broadcast.ts | 20 ++++++------ js/watch/src/player.test.ts | 36 ++++++++++++++++++++++ js/watch/src/player.ts | 6 ++-- quest/m1/api-audit/resolve/README.md | 1 - quest/m1/api-audit/resolve/watch-origin.md | 22 ------------- 8 files changed, 52 insertions(+), 41 deletions(-) delete mode 100644 quest/m1/api-audit/resolve/watch-origin.md diff --git a/js/watch/api/element.api.md b/js/watch/api/element.api.md index e3ea8a99964..3c3ed50a4ec 100644 --- a/js/watch/api/element.api.md +++ b/js/watch/api/element.api.md @@ -16,7 +16,7 @@ import { Video } from "@moq/watch"; export default class extends HTMLElement { constructor(); - attributeChangedCallback(name: "delay" | "buffer" | "url" | "name" | "follow" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "announced" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; + attributeChangedCallback(name: "delay" | "buffer" | "follow" | "announced" | "url" | "name" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; readonly audio: Audio.Decoder; get backend(): Video.Backend; set backend(value: Video.Backend); diff --git a/js/watch/api/index.api.md b/js/watch/api/index.api.md index 1683a82b913..95009c052d2 100644 --- a/js/watch/api/index.api.md +++ b/js/watch/api/index.api.md @@ -106,7 +106,7 @@ export type BroadcastInput = { enabled: Signals.Getter; follow: Signals.Getter; name: Signals.Getter; - origin: Signals.Getter; + origin: Signals.Getter | undefined>; }; export type BroadcastOutput = { @@ -160,7 +160,7 @@ export type PlayerInput = { enabled: Signals.Getter; follow: Signals.Getter; name: Signals.Getter; - origin: Signals.Getter; + origin: BroadcastInput["origin"]; paused: Signals.Getter; probe: Signals.Getter; text: { diff --git a/js/watch/src/broadcast.test.ts b/js/watch/src/broadcast.test.ts index 048784b3f0a..5fe99486f7e 100644 --- a/js/watch/src/broadcast.test.ts +++ b/js/watch/src/broadcast.test.ts @@ -26,7 +26,7 @@ function origin(paths: string[]): Origin.Producer { function broadcast(name: string, paths: string[] = [name]): { source: Broadcast; owner: Origin.Producer } { const owner = origin(paths); const source = new Broadcast({ - origin: owner, + origin: owner.consume(), name: Path.from(name), enabled: true, follow: false, diff --git a/js/watch/src/broadcast.ts b/js/watch/src/broadcast.ts index 4edded91170..39afe991772 100644 --- a/js/watch/src/broadcast.ts +++ b/js/watch/src/broadcast.ts @@ -45,7 +45,7 @@ function provesOther(active: Moq.Broadcast.Consumer | undefined, epoch: Moq.Epoc // Whether an announced route covers `path`, until closed. Hidden routes count: a service claim // under a `.`-named prefix is kept out of listings, but it still covers the renditions it would // produce, and this is never shown to anyone. -function watchCovered(origin: Moq.Origin.Table, path: Moq.Path.Valid): { covered: Getter; close: () => void } { +function watchCovered(origin: Origin, path: Moq.Path.Valid): { covered: Getter; close: () => void } { const announced = origin.announced(Path.Pattern.literal(path), { hidden: true }); const covered = new Signal(false); const active = new Set(); @@ -100,9 +100,9 @@ export type CatalogFormat = (typeof CATALOG_FORMATS)[number]; * another component whose output is wired in) does the writing. */ export type BroadcastInput = { - // The origin to consume from. Independent of any connection: whichever sessions feed + // The read-side origin to borrow. Independent of any connection: whichever sessions feed // the origin resolve the broadcast, and the handle spans their reconnects. - origin: Getter; + origin: Getter | undefined>; // Whether to start downloading the broadcast. Defaults to true. enabled: Getter; @@ -126,6 +126,8 @@ export type BroadcastInput = { catalog: Getter; }; +type Origin = NonNullable>; + /** Signals the component derives. */ export type BroadcastOutput = { // "error" means the origin refused the broadcast; `error` says why. @@ -163,13 +165,13 @@ export class Broadcast { // its relay about the broadcasts a catalog actually references. readonly #watches = new Map< Moq.Path.Valid, - { origin: Moq.Origin.Table; covered: Getter; close: () => void; users: number } + { origin: Origin; covered: Getter; close: () => void; users: number } >(); // Requests are shared by callers; each owns its restart watch in the origin. readonly #references = new Map< Moq.Path.Valid, - { origin: Moq.Origin.Table; follow: boolean; request: Moq.Origin.Requesting; users: number } + { origin: Origin; follow: boolean; request: Moq.Origin.Requesting; users: number } >(); // The catalog as published, before renditions this consumer cannot use are dropped. Kept @@ -221,7 +223,7 @@ export class Broadcast { // gets selected: its service claims a covering prefix, and nothing announces the exact path // until this subscribes. Watches exactly `path`, shared by every caller asking about it. // The blind cases (announcement gate off, no discovery) never reach here; see `#relativeTarget`. - #isPathAnnounced(effect: Effect, origin: Moq.Origin.Table, path: Moq.Path.Valid): boolean { + #isPathAnnounced(effect: Effect, origin: Origin, path: Moq.Path.Valid): boolean { let entry = this.#watches.get(path); if (!entry || entry.origin !== origin) { entry?.close(); @@ -244,11 +246,7 @@ export class Broadcast { } // Share one origin request across callers reading the same referenced broadcast. - #requestBroadcast( - effect: Effect, - origin: Moq.Origin.Table, - path: Moq.Path.Valid, - ): Moq.Broadcast.Consumer | undefined { + #requestBroadcast(effect: Effect, origin: Origin, path: Moq.Path.Valid): Moq.Broadcast.Consumer | undefined { const follow = effect.get(this.in.follow); let entry = this.#references.get(path); if (!entry || entry.origin !== origin || entry.follow !== follow) { diff --git a/js/watch/src/player.test.ts b/js/watch/src/player.test.ts index 4e593d23a01..d4f131d6a78 100644 --- a/js/watch/src/player.test.ts +++ b/js/watch/src/player.test.ts @@ -1,4 +1,5 @@ import { expect, mock, test } from "bun:test"; +import { Origin, Path } from "@moq/net"; import { Signal } from "@moq/signals"; // Bun does not run Vite's worklet loader; these tests never create an AudioContext. @@ -15,6 +16,41 @@ test("Player refuses the renamed reload and announced inputs", () => { expect(() => new Player({ announced: true } as never)).toThrow("`announced` was renamed to `follow`"); }); +test.each(["table", "consumer", "structural"] as const)("Player borrows a %s origin", async (role) => { + const producer = new Origin.Producer(); + const consumer = producer.consume(); + const table: Origin.Table = producer; + const origins = { + table, + consumer, + structural: { + closed: consumer.closed, + discovery: consumer.discovery, + request: consumer.request.bind(consumer), + follow: consumer.follow.bind(consumer), + announced: consumer.announced.bind(consumer), + }, + }; + const name = Path.from("live.hang"); + const player = new Player({ origin: origins[role], name, catalogFormat: "manual", catalog: {} }); + try { + const active = player.broadcast.out.active.changed(); + const publication = producer.createBroadcast(name); + publication.announce(); + expect((await active)?.path).toBe(name); + expect(player.in.origin.peek()).toBe(origins[role]); + expect(player.broadcast.in.origin.peek()).toBe(origins[role]); + + player.close(); + await flush(); + expect(producer.closed.peek()).toBeUndefined(); + expect(publication.broadcast.closed.peek()).toBeUndefined(); + } finally { + player.close(); + producer.close(); + } +}); + test("Player owns the shared pipeline and feeds output policy into decoders", async () => { const enabled = new Signal(true); const paused = new Signal(false); diff --git a/js/watch/src/player.ts b/js/watch/src/player.ts index b31ac65fb28..245837bba15 100644 --- a/js/watch/src/player.ts +++ b/js/watch/src/player.ts @@ -4,15 +4,15 @@ import type * as Moq from "@moq/net"; import { Path } from "@moq/net"; import { Effect, type Getter, getter, type Inputs, type Readonlys, Signal } from "@moq/signals"; import * as Audio from "./audio"; -import { Broadcast, type CatalogFormat } from "./broadcast"; +import { Broadcast, type BroadcastInput, type CatalogFormat } from "./broadcast"; import { type Delay, Sync } from "./sync"; import * as Text from "./text"; import * as Video from "./video"; /** Inputs for a complete broadcast playback pipeline. */ export type PlayerInput = { - /** Origin that supplies the broadcast. */ - origin: Getter; + /** Read-side origin that supplies the broadcast, borrowed without its lifecycle. */ + origin: BroadcastInput["origin"]; /** Broadcast path relative to the origin. */ name: Getter; /** Whether the pipeline may subscribe. */ diff --git a/quest/m1/api-audit/resolve/README.md b/quest/m1/api-audit/resolve/README.md index 8dfaf5375d2..83b04f632fb 100644 --- a/quest/m1/api-audit/resolve/README.md +++ b/quest/m1/api-audit/resolve/README.md @@ -51,7 +51,6 @@ Wire: none. ## Required - [Bindings request and follow](/quest/m1/api-audit/resolve/bindings.md) - moq-ffi, the C ABI, and every wrapper mirror `request` and `follow` with an optional epoch -- [The player takes any read-side origin](/quest/m1/api-audit/resolve/watch-origin.md) - `@moq/watch`'s `Player` and `Broadcast` accept a read-only `Origin.Consumer` as well as a `Table` - [The carla demo pins its driver epoch](/quest/m1/api-audit/resolve/callers.md) - the demo's driver watcher requests each run pinned to its announced epoch ## Related diff --git a/quest/m1/api-audit/resolve/watch-origin.md b/quest/m1/api-audit/resolve/watch-origin.md deleted file mode 100644 index 553aaa0e2f9..00000000000 --- a/quest/m1/api-audit/resolve/watch-origin.md +++ /dev/null @@ -1,22 +0,0 @@ -# [S] The player takes any read-side origin - -## Goal - -`@moq/watch`'s `Player` and `Broadcast` accept a read-only `Origin.Consumer` -as well as an `Origin.Table`, so `new Player({ origin: producer.consume() })` -type-checks. - -## Plan - -Decided 2026-10-27 (maintainer): both take a structural read-side origin type -(`closed`, `discovery`, `request`, `follow`, `announced`), not -`Origin.Table`. Today the call above fails to type-check because `Table` also -requires `createBroadcast` and `requests`. Retype every `Moq.Origin.Table` -input in `js/watch/src/player.ts` and `broadcast.ts`. Do not add an adapter -or a parallel player class. - -The `request(path, { announced })` calls already map onto `follow` and -`request` ([moq-dev/moq#7173](https://github.com/moq-dev/moq/pull/7173)). - -Public API: widens `@moq/watch`'s accepted input; not breaking. -Wire: none. From 65753a99b596168314aa01e62616f46cda7e3f5c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 30 Oct 2026 08:15:18 -0700 Subject: [PATCH 3/7] docs(net): point read-only borrowers at the Consumer members they need Co-Authored-By: Claude Opus 5.5 --- js/net/src/origin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/net/src/origin.ts b/js/net/src/origin.ts index 772b34f40a4..8af6989d3a0 100644 --- a/js/net/src/origin.ts +++ b/js/net/src/origin.ts @@ -1105,7 +1105,8 @@ class OriginState { * * What a shared connection lends out. {@link Producer} implements it, so code that is * handed an origin rather than owning one should accept this type: closing the origin - * stays the owner's alone, and a borrower cannot express it. + * stays the owner's alone, and a borrower cannot express it. A borrower that only reads + * should accept just the {@link Consumer} members it needs, so `producer.consume()` fits too. * * @public */ From 78ff1cb39b23528e9616300a77d13b0272ee7f0f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 31 Oct 2026 02:41:07 -0700 Subject: [PATCH 4/7] quest: size the two-resolutions epic now its last child lands Co-Authored-By: Claude Opus 5.5 --- quest/m1/api-audit/resolve/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/quest/m1/api-audit/resolve/README.md b/quest/m1/api-audit/resolve/README.md index bedbb00207d..752c5686ecb 100644 --- a/quest/m1/api-audit/resolve/README.md +++ b/quest/m1/api-audit/resolve/README.md @@ -1,4 +1,4 @@ -# Two broadcast resolutions +# [M] Two broadcast resolutions ## Goal @@ -50,9 +50,6 @@ Public API: breaking task shape in moq-net; behavior changes in `@moq/net` and the bindings. The method and epoch renames broke every wrapper. Wire: none. -## Required - - ## Related - [Origin fronts park](/quest/m2/origin-front-parks.md) - touches the same retry From a1783982f554bd948a55f8f622ddd597a6180523 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 04:42:58 -0800 Subject: [PATCH 5/7] chore(quest): claim quest/m1/api-audit/origin-reader.md Quest-Claim: 8cf0618e79b5c4f0 From 7bec1e1e7f1b27f8c2a615805a5fe87791098902 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 04:48:12 -0800 Subject: [PATCH 6/7] feat(net): name the origin read side as Origin.Reader Origin.Table extends Origin.Reader and Origin.Consumer implements it, so @moq/watch's Player and Broadcast take Origin.Reader instead of a Pick list, and the stats demo reads through it. Co-Authored-By: Claude Opus 5.5 --- demo/web/src/stats.ts | 2 +- js/net/api/index.api.md | 16 ++++++++------ js/net/src/origin.ts | 34 +++++++++++++++++++---------- js/watch/api/element.api.md | 2 +- js/watch/api/index.api.md | 4 ++-- js/watch/src/broadcast.ts | 21 +++++++++++------- js/watch/src/player.ts | 4 ++-- quest/m1/api-audit/README.md | 1 - quest/m1/api-audit/origin-reader.md | 20 ----------------- 9 files changed, 51 insertions(+), 53 deletions(-) delete mode 100644 quest/m1/api-audit/origin-reader.md diff --git a/demo/web/src/stats.ts b/demo/web/src/stats.ts index 814a3446b92..40a89063812 100644 --- a/demo/web/src/stats.ts +++ b/demo/web/src/stats.ts @@ -185,7 +185,7 @@ discovery.run((effect) => { }); }); -function subscribeNode(effect: Signals.Effect, origin: Net.Origin.Table, path: Net.Path.Valid, node: string) { +function subscribeNode(effect: Signals.Effect, origin: Net.Origin.Reader, path: Net.Path.Valid, node: string) { nodeStats.mutate((s) => { s[node] = { egress: {}, diff --git a/js/net/api/index.api.md b/js/net/api/index.api.md index 5794f3acbe0..13237c38196 100644 --- a/js/net/api/index.api.md +++ b/js/net/api/index.api.md @@ -378,7 +378,7 @@ export namespace Group { export const IMPLEMENTATION: string; export namespace Origin { - export class Consumer { + export class Consumer implements Origin.Reader { announced(scope?: Path.Pattern, options?: Announce.Options): Announce.Consumer; get closed(): Signals.GetPromise; get discovery(): Signals.Getter; @@ -418,6 +418,13 @@ export namespace Origin { get route(): Origin.Route | undefined; unannounce(): void; } + export interface Reader { + announced(scope?: Path.Pattern, options?: Announce.Options): Announce.Consumer; + readonly closed: Signals.GetPromise; + readonly discovery: Signals.Getter; + follow(path: Path.Valid, options?: Origin.RequestOptions): Origin.Requesting; + request(path: Path.Valid, options?: Origin.RequestOptions): Origin.Requesting; + } export class Request { readonly path: Path.Valid; prepare(epoch: Epoch.Valid): Origin.Prepared; @@ -444,13 +451,8 @@ export namespace Origin { epoch?: Epoch.Valid; hops: Origin.Hop[]; } - export interface Table { - announced(scope?: Path.Pattern, options?: Announce.Options): Announce.Consumer; - readonly closed: Signals.GetPromise; + export interface Table extends Origin.Reader { createBroadcast(path: Path.Valid): Origin.Publication; - readonly discovery: Signals.Getter; - follow(path: Path.Valid, options?: Origin.RequestOptions): Origin.Requesting; - request(path: Path.Valid, options?: Origin.RequestOptions): Origin.Requesting; requests(prefix: Path.Valid): Origin.Requests; } export function isAnonymous(route: Origin.Route): boolean; diff --git a/js/net/src/origin.ts b/js/net/src/origin.ts index 8af6989d3a0..4040546a1de 100644 --- a/js/net/src/origin.ts +++ b/js/net/src/origin.ts @@ -1101,25 +1101,22 @@ class OriginState { } /** - * A non-owning handle on an origin: publish into it and read it, without its lifecycle. + * The read side of an origin, borrowed: resolve broadcasts by path and watch what is + * available, without publishing into it or owning its lifecycle. * - * What a shared connection lends out. {@link Producer} implements it, so code that is - * handed an origin rather than owning one should accept this type: closing the origin - * stays the owner's alone, and a borrower cannot express it. A borrower that only reads - * should accept just the {@link Consumer} members it needs, so `producer.consume()` fits too. + * Code that only reads an origin should accept this type. {@link Consumer} implements it + * and {@link Table} extends it, so `producer.consume()`, a borrowed table, and a structural + * equivalent all fit. * * @public */ -export interface Table { - /** Settles once the origin closes; see {@link Producer.closed}. */ +export interface Reader { + /** Settles once the origin closes; see {@link Consumer.closed}. */ readonly closed: GetPromise; /** Whether every attached session announces into the table; see {@link Consumer.discovery}. */ readonly discovery: Getter; - /** Create an unannounced broadcast at `path`; see {@link Producer.createBroadcast}. */ - createBroadcast(path: Path.Valid): Publication; - /** Resolve one publisher instance at `path`; see {@link Consumer.request}. */ request(path: Path.Valid, options?: RequestOptions): Requesting; @@ -1128,6 +1125,21 @@ export interface Table { /** The available broadcasts under `scope`, as a live stream; see {@link Consumer.announced}. */ announced(scope?: Path.Pattern, options?: Announce.Options): Announce.Consumer; +} + +/** + * A non-owning handle on an origin: publish into it and read it, without its lifecycle. + * + * What a shared connection lends out. {@link Producer} implements it, so code that is + * handed an origin rather than owning one should accept this type: closing the origin + * stays the owner's alone, and a borrower cannot express it. A borrower that only reads + * should accept {@link Reader} instead, so `producer.consume()` fits too. + * + * @public + */ +export interface Table extends Reader { + /** Create an unannounced broadcast at `path`; see {@link Producer.createBroadcast}. */ + createBroadcast(path: Path.Valid): Publication; /** Advertise a prefix and serve requests under it; see {@link Producer.requests}. */ requests(prefix: Path.Valid): Requests; @@ -1679,7 +1691,7 @@ export class Requesting { * * @public */ -export class Consumer { +export class Consumer implements Reader { #state: OriginState; #scope: Scope; diff --git a/js/watch/api/element.api.md b/js/watch/api/element.api.md index 3c3ed50a4ec..e3ea8a99964 100644 --- a/js/watch/api/element.api.md +++ b/js/watch/api/element.api.md @@ -16,7 +16,7 @@ import { Video } from "@moq/watch"; export default class extends HTMLElement { constructor(); - attributeChangedCallback(name: "delay" | "buffer" | "follow" | "announced" | "url" | "name" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; + attributeChangedCallback(name: "delay" | "buffer" | "url" | "name" | "follow" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "announced" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; readonly audio: Audio.Decoder; get backend(): Video.Backend; set backend(value: Video.Backend); diff --git a/js/watch/api/index.api.md b/js/watch/api/index.api.md index 16172b792d3..a0f85527470 100644 --- a/js/watch/api/index.api.md +++ b/js/watch/api/index.api.md @@ -107,7 +107,7 @@ export type BroadcastInput = { enabled: Signals.Getter; follow: Signals.Getter; name: Signals.Getter; - origin: Signals.Getter | undefined>; + origin: Signals.Getter; }; export type BroadcastOutput = { @@ -161,7 +161,7 @@ export type PlayerInput = { enabled: Signals.Getter; follow: Signals.Getter; name: Signals.Getter; - origin: BroadcastInput["origin"]; + origin: Signals.Getter; paused: Signals.Getter; probe: Signals.Getter; text: { diff --git a/js/watch/src/broadcast.ts b/js/watch/src/broadcast.ts index eba038b74d0..01e64924aae 100644 --- a/js/watch/src/broadcast.ts +++ b/js/watch/src/broadcast.ts @@ -46,7 +46,10 @@ function provesOther(active: Moq.Broadcast.Consumer | undefined, epoch: Moq.Epoc // Whether an announced route covers `path`, until closed. Hidden routes count: a service claim // under a `.`-named prefix is kept out of listings, but it still covers the renditions it would // produce, and this is never shown to anyone. -function watchCovered(origin: Origin, path: Moq.Path.Valid): { covered: Getter; close: () => void } { +function watchCovered( + origin: Moq.Origin.Reader, + path: Moq.Path.Valid, +): { covered: Getter; close: () => void } { const announced = origin.announced(Path.Pattern.literal(path), { hidden: true, covering: true }); const covered = new Signal(false); const active = new Set(); @@ -103,7 +106,7 @@ export type CatalogFormat = (typeof CATALOG_FORMATS)[number]; export type BroadcastInput = { // The read-side origin to borrow. Independent of any connection: whichever sessions feed // the origin resolve the broadcast, and the handle spans their reconnects. - origin: Getter | undefined>; + origin: Getter; // Whether to start downloading the broadcast. Defaults to true. enabled: Getter; @@ -127,8 +130,6 @@ export type BroadcastInput = { catalog: Getter; }; -type Origin = NonNullable>; - /** Signals the component derives. */ export type BroadcastOutput = { // "error" means the origin refused the broadcast; `error` says why. @@ -166,13 +167,13 @@ export class Broadcast { // its relay about the broadcasts a catalog actually references. readonly #watches = new Map< Moq.Path.Valid, - { origin: Origin; covered: Getter; close: () => void; users: number } + { origin: Moq.Origin.Reader; covered: Getter; close: () => void; users: number } >(); // Requests are shared by callers; each owns its restart watch in the origin. readonly #references = new Map< Moq.Path.Valid, - { origin: Origin; follow: boolean; request: Moq.Origin.Requesting; users: number } + { origin: Moq.Origin.Reader; follow: boolean; request: Moq.Origin.Requesting; users: number } >(); // The catalog as published, before renditions this consumer cannot use are dropped. Kept @@ -228,7 +229,7 @@ export class Broadcast { // gets selected: its service claims a covering prefix, and nothing announces the exact path // until this subscribes. Watches exactly `path`, shared by every caller asking about it. // The blind cases (announcement gate off, no discovery) never reach here; see `#relativeTarget`. - #isPathAnnounced(effect: Effect, origin: Origin, path: Moq.Path.Valid): boolean { + #isPathAnnounced(effect: Effect, origin: Moq.Origin.Reader, path: Moq.Path.Valid): boolean { let entry = this.#watches.get(path); if (!entry || entry.origin !== origin) { entry?.close(); @@ -251,7 +252,11 @@ export class Broadcast { } // Share one origin request across callers reading the same referenced broadcast. - #requestBroadcast(effect: Effect, origin: Origin, path: Moq.Path.Valid): Moq.Broadcast.Consumer | undefined { + #requestBroadcast( + effect: Effect, + origin: Moq.Origin.Reader, + path: Moq.Path.Valid, + ): Moq.Broadcast.Consumer | undefined { const follow = effect.get(this.in.follow); let entry = this.#references.get(path); if (!entry || entry.origin !== origin || entry.follow !== follow) { diff --git a/js/watch/src/player.ts b/js/watch/src/player.ts index 245837bba15..ad585ac2edb 100644 --- a/js/watch/src/player.ts +++ b/js/watch/src/player.ts @@ -4,7 +4,7 @@ import type * as Moq from "@moq/net"; import { Path } from "@moq/net"; import { Effect, type Getter, getter, type Inputs, type Readonlys, Signal } from "@moq/signals"; import * as Audio from "./audio"; -import { Broadcast, type BroadcastInput, type CatalogFormat } from "./broadcast"; +import { Broadcast, type CatalogFormat } from "./broadcast"; import { type Delay, Sync } from "./sync"; import * as Text from "./text"; import * as Video from "./video"; @@ -12,7 +12,7 @@ import * as Video from "./video"; /** Inputs for a complete broadcast playback pipeline. */ export type PlayerInput = { /** Read-side origin that supplies the broadcast, borrowed without its lifecycle. */ - origin: BroadcastInput["origin"]; + origin: Getter; /** Broadcast path relative to the origin. */ name: Getter; /** Whether the pipeline may subscribe. */ diff --git a/quest/m1/api-audit/README.md b/quest/m1/api-audit/README.md index 61f5a0b44c8..25b8abef735 100644 --- a/quest/m1/api-audit/README.md +++ b/quest/m1/api-audit/README.md @@ -76,7 +76,6 @@ Rejected in planning: - [Two broadcast resolutions](/quest/m1/api-audit/resolve/README.md) - Rust, JS, and the bindings resolve a broadcast with `request(path, epoch)` or `follow(path, epoch)`, and every racy two-step caller is gone - [Routes are the origin API](/quest/m1/api-audit/route/README.md) - apps announce exact or prefix routes through one `Route` handle that owns its broadcast and carries an `identity`, prefix routes can serve a held broadcast, and readers get a listing plus `follow` - [moq-congestion's first-publish names](/quest/m1/api-audit/congestion-names.md) - `bbr3::Config`, `cubic::Config`, `Metrics`, `Factory`, and no `into_any` -- [@moq/net names the origin read side](/quest/m1/api-audit/origin-reader.md) - `Origin.Reader`, which `Origin.Table` extends, replaces `Pick` lists ## Related diff --git a/quest/m1/api-audit/origin-reader.md b/quest/m1/api-audit/origin-reader.md deleted file mode 100644 index bab430313fd..00000000000 --- a/quest/m1/api-audit/origin-reader.md +++ /dev/null @@ -1,20 +0,0 @@ -# [S] @moq/net names the origin read side - -## Goal - -@moq/net exports a named read-side origin interface, `Origin.Reader`, that -`Origin.Table` extends, so readers such as @moq/watch accept that one name -instead of repeating a `Pick` list. - -## Plan - -[moq-dev/moq#7251](https://github.com/moq-dev/moq/pull/7251) makes @moq/watch -accept a structural read-side origin and leaves the named interface as a -follow-up. Name it before the API cut, and move existing `Pick` lists to it. -If #7251 has not merged, `Player` and `Broadcast` still take `Origin.Table`: -widen their origin inputs to `Origin.Reader` here. - -Decided 2026-10-30 (maintainer, /quest-plan of the 2026-10-30 /quest-complete follow-ups): ✅ new m1 api-audit quest / drop. - -Public API: @moq/net adds `Origin.Reader`; @moq/watch's origin inputs accept -it. Both are additive, so nothing migrates. Wire: none. From 556d6752b36917a4a9185548e314569404381e48 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 20:49:54 -0800 Subject: [PATCH 7/7] chore(watch): regenerate the element API report TypeScript prints the observed-attribute union in literal-creation order, which shifts with the origin types checked before it. Co-Authored-By: Claude Opus 5.5 --- js/watch/api/element.api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/watch/api/element.api.md b/js/watch/api/element.api.md index 3c3ed50a4ec..e3ea8a99964 100644 --- a/js/watch/api/element.api.md +++ b/js/watch/api/element.api.md @@ -16,7 +16,7 @@ import { Video } from "@moq/watch"; export default class extends HTMLElement { constructor(); - attributeChangedCallback(name: "delay" | "buffer" | "follow" | "announced" | "url" | "name" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; + attributeChangedCallback(name: "delay" | "buffer" | "url" | "name" | "follow" | "volume" | "muted" | "paused" | "visible" | "backend" | "versions" | "announced" | "catalog-format" | "captions", oldValue: string | null, newValue: string | null): void; readonly audio: Audio.Decoder; get backend(): Video.Backend; set backend(value: Video.Backend);