@vestra-player/sdk 1.10.1 → 1.11.0-rc.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 (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/bin/vestra-plugin.mjs +1 -131
  3. package/dist/api-requests.d.ts +1 -1
  4. package/dist/api-requests.js +9 -2
  5. package/dist/docs-tree.json.gz +0 -0
  6. package/dist/manifest.d.ts +0 -5
  7. package/dist/manifest.js +1 -8
  8. package/dist/mpv.js +1 -1
  9. package/dist/plugin/appearance.d.ts +2 -2
  10. package/dist/plugin/appearance.js +3 -3
  11. package/dist/plugin/connection.d.ts +38 -28
  12. package/dist/plugin/connection.js +101 -98
  13. package/dist/plugin/index.js +8 -6
  14. package/dist/plugin/passes.js +1 -1
  15. package/dist/plugin/player/events.d.ts +18 -9
  16. package/dist/plugin/player/events.js +36 -11
  17. package/dist/plugin/player.d.ts +31 -28
  18. package/dist/plugin/player.js +42 -68
  19. package/dist/plugin/scope.d.ts +2 -9
  20. package/dist/plugin/scope.js +21 -27
  21. package/dist/plugin/subtitles.d.ts +6 -1
  22. package/dist/plugin/subtitles.js +18 -2
  23. package/dist/plugin/testing/commands.js +1 -1
  24. package/dist/plugin/testing/facts.d.ts +46 -0
  25. package/dist/plugin/testing/facts.js +106 -0
  26. package/dist/plugin/testing/index.d.ts +12 -14
  27. package/dist/plugin/testing/index.js +52 -18
  28. package/dist/plugin/testing/media.js +6 -0
  29. package/dist/plugin/testing/revoke.d.ts +15 -0
  30. package/dist/plugin/testing/revoke.js +13 -0
  31. package/dist/plugin/testing/transport.js +8 -0
  32. package/dist/plugin/timeline.d.ts +2 -2
  33. package/dist/plugin/timeline.js +3 -3
  34. package/dist/plugin/types/base.d.ts +15 -15
  35. package/dist/plugin/types/commands.d.ts +8 -8
  36. package/dist/plugin/types/playback.d.ts +240 -116
  37. package/dist/plugin/types/plugin-wire.d.ts +2 -2
  38. package/dist/plugin/types/processing.d.ts +2 -3
  39. package/dist/plugin/types/subtitles.d.ts +9 -8
  40. package/dist/plugin/types/ui-layout.d.ts +32 -17
  41. package/dist/plugin/types/ui-locale.d.ts +9 -9
  42. package/dist/plugin/types/ui-shell.d.ts +7 -6
  43. package/dist/plugin/view/layout.d.ts +33 -1
  44. package/dist/plugin/view/layout.js +63 -34
  45. package/dist/plugin/window.d.ts +9 -1
  46. package/dist/plugin/window.js +14 -2
  47. package/dist/processing.d.ts +2 -2
  48. package/dist/request-queue.d.ts +7 -3
  49. package/dist/request-queue.js +19 -5
  50. package/dist/ts-plugin.d.ts +3 -4
  51. package/dist/ts-plugin.js +1 -1
  52. package/dist/wire.d.ts +1 -1
  53. package/dist/wire.js +1 -1
  54. package/llms.txt +3 -3
  55. package/package.json +2 -4
  56. package/capability-scan.json +0 -389
  57. package/dist/capability-scan.d.ts +0 -95
  58. package/dist/capability-scan.js +0 -249
  59. package/dist/member-uses.d.ts +0 -61
  60. package/dist/member-uses.js +0 -160
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.0
4
+
5
+ **The second batch of events, no capability disclosure, and the built-in-only refusal renamed** (user rulings 2026-11-16 and 2026-11-21). Plugins have no capabilities, neither as declarations (gone since 1.9.0) nor as a disclosure: the name-based scan and its table are removed, and the plugin store no longer shows what a plugin's code uses. The player's real API boundaries stay (request validation and the built-in-only requests); their refusal now has the code `builtin-only`. Breaking, released as a minor without an alias, since every plugin is the project's own (ruling 2026-11-21). Who must change: a tool that runs `vestra-plugin scan` or reads `@vestra-player/sdk/capability-scan.json`, and a plugin that compares `error.code` for a built-in-only call (below).
6
+
7
+ **The second batch of events** (needs the player version that sends them, 0.11):
8
+
9
+ - **Fact events** (new, `FactEvent` and `FactEventPayloads`, a third overload of `player.on`): `video.reconfigured` (`{ sourceId, width, height, displayWidth, displayHeight, fps, rotation, hdr }`), `audio.reconfigured` (`{ sourceId, sampleRate, channels, format }`), `audio.tracks.changed` (`{ sourceId, audioTracks }`, as `AudioTrack`s), `subtitles.changed` (`{ state }`, a `SubtitlesState`, taken into `plugin.subtitles.state` first), `window.changed` (a `WindowState`, taken into `plugin.window.state` first; a resize once it has settled for 300 ms), `layout.changed` (`{ slots }`, each position with its panels, `LayoutPosition`), `audio.devices.changed` (`{ devices, requested, active }`) and `app.started` (`{ version, previous }`). Each is sent once per change; a listener of one does not keep the plugin running, and the player wakes a plugin in standby for it.
10
+ - Removed `Player.subscribe()` and `Player.onChange()`.
11
+ - **An event reaches a plugin from its first listener.** `source.state`, `playback.backend`, `window.state`, `timeline.changed`, `appearance.changed` and `resolvers.fileTypes` are subscribed while a listener, a watcher (`MainWindow.onChange`, a panel slot's `onChange`, `Subtitles.onChange`, a media handle's `ready` and `onEnd`, a scrub) or a stream holds them; the SDK's own copy and a binding's read never subscribe them on their own, so a bound value or a command state that reads `plugin.player.state` shows the newest snapshot the plugin has. `Media.ready` no longer polls the state every 100 ms.
12
+ - **No request after `runtime.stop`**: once the player sent `runtime.stop`, every request of the plugin is refused with `disabled` and not sent, the plugin's own cleanup included (the player's runner refused them already). In `TestHost` the cleanup requests at a plugin's stop (and at `park()` and `upgrade()`) are therefore no longer sent, and the test host revokes what the run held itself, as the player does: its windows, panels, commands, settings pages, resolvers, sequence provider, streams and filter chains.
13
+ - **`TestHost`** sends the fact events by the player's rules: `audio.tracks.changed` after a source change, `window.changed` and `layout.changed` after a `window.state`, `subtitles.changed` and `audio.devices.changed` after a request or an event changed them, and `video.reconfigured` and `audio.reconfigured` from `host.stats` when a source becomes ready. `app.started` is sent with `host.emit`.
14
+
15
+ **No capability disclosure:**
16
+
17
+ - **Removed: `vestra-plugin scan`** and the package's `capability-scan.json` (and its `./capability-scan.json` export), with the scanner behind them (`src/capability-scan.ts`, `src/member-uses.ts`), its test, its generated docs table and the reference page `Capability scan`. The guides, the tutorial, the manifest and mpv reference pages and the maintainers' notes no longer mention a scan or a disclosure.
18
+ - **A manifest with `capabilities` is refused as an ordinary unknown field**: `vestra-plugin check` reports `unknown field "capabilities"`, as for any other field the rules do not list, with no message of its own (`CAPABILITIES_REMOVED` is gone). `startPlugin` no longer looks at the field: like every other field but `id`, nothing in the manifest changes how the test runs. The troubleshooting entry is now the general `unknown field` one.
19
+ - **The refusal of a built-in-only call is the error code `builtin-only`** (breaking; all plugins are the project's own, user ruling 2026-11-21, so a minor version and no alias). `commands.list`, `commands.run`, `palette.lead` and `app.openWindow` from a plugin that is not built in fail with `builtin-only` ("this is for built-in plugins only"), in the player and in `TestHost`. The error-code table, the `@throws` lines, their examples, the message table and the guides say so. Who must change: a plugin that compares `error.code` for these calls (the player's Store, Ask Vestra and the plugin repository's Clip Export change with this release).
20
+ - **mpv**: the refusal of the `clipboard` property and command group says "the clipboard has its own API (plugin.clipboard)" (`MPV_RULES`, as the player).
21
+ - The message table reads hyphenated `@throws` codes too: `builtin-only`, `source-missing` and `source-changed` now show in its Errors column (`scripts/doc-tables/messages.mjs`).
22
+ - `doc-lint` drops its check that no `@capability` tag is left in `src/`; the issue template for API proposals no longer asks for one; the deprecated `ts-plugin` stub's log line and `check --json`'s refusal no longer mention capabilities.
23
+
3
24
  ## 1.10.1
4
25
 
5
26
  **Temporary windows: a product-data sync and the members that go with them.** Who must change: nobody. Additions and docs only; every existing behaviour of the SDK and of `TestHost` is as in 1.10.0 (a `TestHost` behaves differently only when a test sets the new `app.temporary`). Needs player 0.10.3 for the additions; an older player sends no `temporary` and refuses `app.openWindow`.
@@ -4,7 +4,6 @@
4
4
  * keep its translations up to date.
5
5
  *
6
6
  * vestra-plugin <check|build|test|pack> [plugin-dir...] [--version x.y.z] [--out dir]
7
- * vestra-plugin scan [plugin-dir...]
8
7
  * vestra-plugin i18n extract [plugin-dir...] [--locale <lang>]...
9
8
  * vestra-plugin i18n check [plugin-dir...]
10
9
  * vestra-plugin docs [path] [--page N]
@@ -22,11 +21,6 @@
22
21
  * test node --test on tests/*.test.{ts,mjs}
23
22
  * pack build, then dist/ → <out>/<id>-<version>.vxp (a zip; default
24
23
  * out: the current directory) with its sha256 and size
25
- * scan the boundary categories the plugin's code uses (player,
26
- * plugins, clipboard, credentials, camera, microphone, screen,
27
- * notifications), as JSON: by type for TypeScript, by name
28
- * (best effort, said in the output) for JavaScript; reads the
29
- * source only, checks and changes nothing
30
24
  * docs the SDK's documentation by path, for coding agents: `/` lists
31
25
  * Overview, Guides and API, `/API/Media/Snapshot/dispose` is
32
26
  * one member's whole documentation; --search <query> lists
@@ -880,126 +874,8 @@ async function pack(target, flag, outDirectory) {
880
874
  );
881
875
  }
882
876
 
883
- /**
884
- * `vestra-plugin scan`: the boundary categories a plugin's code uses
885
- * (src/capability-scan.ts, capability-scan.json), as JSON on standard
886
- * output: one object for one directory, an array for several. It reads the
887
- * source and the manifest's id and version; it runs no type check and no
888
- * build, and changes nothing.
889
- *
890
- * TypeScript files are scanned by type, against this SDK's own
891
- * declarations (whatever the project has installed); JavaScript files, and
892
- * TypeScript files of a plugin that imports no SDK types, by name. A
893
- * directory with no source outside dist/ (a built package) is scanned in
894
- * dist/.
895
- */
896
- async function scanPlugin(directory) {
897
- const ts = await typescript();
898
- const scanner = await import(
899
- pathToFileURL(join(sdkRoot, "dist/capability-scan.js")).href
900
- );
901
- const root = resolve(directory);
902
- if (!present(join(root, "manifest.json")))
903
- fail(`${directory}: no manifest.json in ${root}`);
904
- const manifest = await json(join(root, "manifest.json"));
905
- const isScript = (file) => /\.[mc]?js$/.test(file);
906
- const isTyped = (file) => /\.[mc]?tsx?$/.test(file) && !isDeclaration(file);
907
- let all = (await files(root)).filter(
908
- (file) => isScript(file) || isTyped(file),
909
- );
910
- // A built package: its code is dist/ alone.
911
- if (!all.length && present(join(root, "dist")))
912
- all = (await files(join(root, "dist")))
913
- .filter(isScript)
914
- .map((file) => join("dist", file));
915
- all.sort();
916
- let typed = all.filter(isTyped).map((file) => join(root, file));
917
- const read = async (file) => ({
918
- file,
919
- text: await readFile(file, "utf8"),
920
- });
921
- const named = await Promise.all(
922
- all.filter(isScript).map((file) => read(join(root, file))),
923
- );
924
- const relativeTo = (file) =>
925
- relative(root, resolve(file)).split(sep).join("/");
926
- const program = typed.length
927
- ? ts.createProgram(typed, {
928
- target: ts.ScriptTarget.ES2023,
929
- module: ts.ModuleKind.NodeNext,
930
- moduleResolution: ts.ModuleResolutionKind.NodeNext,
931
- allowImportingTsExtensions: true,
932
- noEmit: true,
933
- skipLibCheck: true,
934
- types: [],
935
- // This SDK's declarations, wherever the plugin's own copy is.
936
- paths: { [SDK]: [join(sdkRoot, "dist/index.d.ts")] },
937
- })
938
- : undefined;
939
- let found = scanner.scan(ts, program, {
940
- typed,
941
- named,
942
- relative: relativeTo,
943
- });
944
- const notes = [];
945
- if (!found.resolved) {
946
- // No SDK types to go by: read the TypeScript by name too.
947
- notes.push(
948
- "The TypeScript files import no types of @vestra-player/sdk; they were scanned by name (best effort).",
949
- );
950
- named.push(...(await Promise.all(typed.map(read))));
951
- typed = [];
952
- found = scanner.scan(ts, undefined, {
953
- typed,
954
- named,
955
- relative: relativeTo,
956
- });
957
- }
958
- if (named.length)
959
- notes.push(
960
- "Files scanned by name have no types: a member counts when it is used on something named as its module of plugin (plugin.clipboard.readText, clipboard.readText). A use under another name is missed, and a name that only looks like one is counted.",
961
- );
962
- if (!typed.length && !named.length)
963
- notes.push("No TypeScript or JavaScript files were found.");
964
- if (found.unchecked.length)
965
- notes.push(
966
- "Some requests by name could not be placed (unchecked): what they ask for is not in uses.",
967
- );
968
- return {
969
- scan: scanner.SCAN_FORMAT,
970
- sdk: (await json(join(sdkRoot, "package.json"))).version,
971
- plugin: typeof manifest.id === "string" ? manifest.id : null,
972
- version: typeof manifest.version === "string" ? manifest.version : null,
973
- uses: found.uses,
974
- method:
975
- typed.length && named.length
976
- ? "mixed"
977
- : typed.length
978
- ? "types"
979
- : named.length
980
- ? "names"
981
- : "none",
982
- files: { types: typed.length, names: named.length },
983
- evidence: found.evidence,
984
- unchecked: found.unchecked,
985
- notes,
986
- };
987
- }
988
-
989
- /** `vestra-plugin scan [plugin-dir...]`. */
990
- async function scanCommand(args) {
991
- const directories = args.length ? args : ["."];
992
- const results = [];
993
- for (const directory of directories)
994
- results.push({ directory, ...(await scanPlugin(directory)) });
995
- const [only] = results;
996
- if (results.length === 1) delete only.directory;
997
- console.log(JSON.stringify(results.length === 1 ? only : results, null, 2));
998
- }
999
-
1000
877
  const USAGE = [
1001
878
  "usage: vestra-plugin <check|build|test|pack> [plugin-dir...] [--version x.y.z] [--out dir]",
1002
- " vestra-plugin scan [plugin-dir...]",
1003
879
  " vestra-plugin i18n extract [plugin-dir...] [--locale <lang>]...",
1004
880
  " vestra-plugin i18n check [plugin-dir...]",
1005
881
  " vestra-plugin docs [path] [--page N]",
@@ -1058,10 +934,6 @@ async function main() {
1058
934
  await docsCommand(args);
1059
935
  return;
1060
936
  }
1061
- if (command === "scan") {
1062
- await scanCommand(args);
1063
- return;
1064
- }
1065
937
  let subcommand = null;
1066
938
  if (command === "i18n") {
1067
939
  subcommand = args.shift();
@@ -1082,9 +954,7 @@ async function main() {
1082
954
  if (locales.length && subcommand !== "extract")
1083
955
  fail("--locale applies to i18n extract");
1084
956
  if (args.includes("--json"))
1085
- fail(
1086
- "--json was removed in SDK 1.9.0 with the capability check it reported (manifest capabilities are gone); check prints its result as text",
1087
- );
957
+ fail("--json was removed in SDK 1.9.0; check prints its result as text");
1088
958
  const flag = option("--version");
1089
959
  const out = option("--out");
1090
960
  const directories = args.length ? args : ["."];
@@ -24,7 +24,7 @@ export interface ApiRequest {
24
24
  export declare const API_REQUESTS: Readonly<Record<string, readonly ApiRequest[]>>;
25
25
  /**
26
26
  * The events whose listener subscribes (`events.subscribe` with the event
27
- * name): the plugin API's `HostEvent` and `SourceEvent`. Other names a
27
+ * name): the plugin API's `HostEvent`, `SourceEvent` and `FactEvent`. Other names a
28
28
  * plugin listens to (`commands.execute`, `ui.callback`) arrive unasked and
29
29
  * need nothing.
30
30
  * test/wire-facade.test.ts keeps it equal to `EVENT_NEEDS`.
@@ -26,7 +26,6 @@ export const API_REQUESTS = Object.freeze({
26
26
  "Player.stats": [{ method: "playback.stats" }],
27
27
  "Player.chapters": [{ method: "player.chapters" }],
28
28
  "Player.audioDevices": [{ method: "player.audioDevices" }],
29
- "Player.onChange": [listen("source.state")],
30
29
  "Player.open": submit,
31
30
  "Player.openStream": [
32
31
  { method: "producer.prepare" },
@@ -170,7 +169,7 @@ export const API_REQUESTS = Object.freeze({
170
169
  });
171
170
  /**
172
171
  * The events whose listener subscribes (`events.subscribe` with the event
173
- * name): the plugin API's `HostEvent` and `SourceEvent`. Other names a
172
+ * name): the plugin API's `HostEvent`, `SourceEvent` and `FactEvent`. Other names a
174
173
  * plugin listens to (`commands.execute`, `ui.callback`) arrive unasked and
175
174
  * need nothing.
176
175
  * test/wire-facade.test.ts keeps it equal to `EVENT_NEEDS`.
@@ -192,4 +191,12 @@ export const SUBSCRIBED_EVENTS = Object.freeze([
192
191
  "source.opening",
193
192
  "source.ready",
194
193
  "source.ended",
194
+ "video.reconfigured",
195
+ "audio.reconfigured",
196
+ "audio.tracks.changed",
197
+ "subtitles.changed",
198
+ "window.changed",
199
+ "layout.changed",
200
+ "audio.devices.changed",
201
+ "app.started",
195
202
  ]);
Binary file
@@ -15,11 +15,6 @@ export declare const MANIFEST_LIMITS: Readonly<{
15
15
  /** Every field a manifest may have; anything else is rejected by the player. */
16
16
  export declare const MANIFEST_FIELDS: readonly string[];
17
17
  export declare const validVersion: (value: unknown) => value is string;
18
- /**
19
- * Why a manifest with `capabilities` is refused (SDK 1.9.0, player 0.9.0):
20
- * the field is gone, and what it switched on is two calls.
21
- */
22
- export declare const CAPABILITIES_REMOVED = "manifest.json has \"capabilities\", which SDK 1.9.0 (player 0.9.0) removed: delete the field. What it switched on is now a call, first in activate(): plugin.player.subscribe() for \"events\", await plugin.player.read() for \"playback.read\"; everything else needs nothing (the store shows what the code uses, from its scan)";
23
18
  /** Problems with `manifest` (empty: valid) and hints that do not fail. */
24
19
  export declare function manifestProblems(manifest: Record<string, unknown>, directory: string): {
25
20
  problems: string[];
package/dist/manifest.js CHANGED
@@ -43,11 +43,6 @@ export const validVersion = (value) => typeof value === "string" &&
43
43
  value.length <= 32 &&
44
44
  VERSION.test(value) &&
45
45
  value.split(".").every((part) => BigInt(part) <= 4294967295n);
46
- /**
47
- * Why a manifest with `capabilities` is refused (SDK 1.9.0, player 0.9.0):
48
- * the field is gone, and what it switched on is two calls.
49
- */
50
- export const CAPABILITIES_REMOVED = 'manifest.json has "capabilities", which SDK 1.9.0 (player 0.9.0) removed: delete the field. What it switched on is now a call, first in activate(): plugin.player.subscribe() for "events", await plugin.player.read() for "playback.read"; everything else needs nothing (the store shows what the code uses, from its scan)';
51
46
  /** Problems with `manifest` (empty: valid) and hints that do not fail. */
52
47
  export function manifestProblems(manifest, directory) {
53
48
  const problems = [];
@@ -58,9 +53,7 @@ export function manifestProblems(manifest, directory) {
58
53
  Array.isArray(manifest))
59
54
  return { problems: ["manifest.json must be an object"], hints };
60
55
  for (const key of Object.keys(manifest))
61
- if (key === "capabilities")
62
- problem(CAPABILITIES_REMOVED);
63
- else if (!MANIFEST_FIELDS.includes(key))
56
+ if (!MANIFEST_FIELDS.includes(key))
64
57
  problem(`unknown field "${key}"`);
65
58
  const id = manifest.id;
66
59
  if (typeof id !== "string" ||
package/dist/mpv.js CHANGED
@@ -75,7 +75,7 @@ export const MPV_RULES = Object.freeze({
75
75
  files: "it makes the player write or delete files (a plugin writes its own with Node)",
76
76
  quit: "it ends the player",
77
77
  input: "the keyboard and the mouse are the player's (plugin.commands, plugin.bindings)",
78
- clipboard: "the clipboard has its own capability (plugin.clipboard)",
78
+ clipboard: "the clipboard has its own API (plugin.clipboard)",
79
79
  managed: "the player manages it and keeps its own state of it (use the plugin API's member for it)",
80
80
  filters: "a plugin changes only its own labelled filters (vf/af add, pre, toggle or remove of @label:…, a label not starting with vestra-)",
81
81
  }),
@@ -5,8 +5,8 @@ import type { Appearance, LanguagePreference, ThemeId } from "./types.ts";
5
5
  export declare const THEMES: readonly ThemeId[];
6
6
  /**
7
7
  * One per plugin: the value comes with the `window.state` read before
8
- * activation; after `plugin.player.subscribe()`, `appearance.changed` keeps it current once
9
- * the plugin uses it (or listens to that event with `player.on`).
8
+ * activation; `appearance.changed` keeps it current while the plugin
9
+ * listens to that event (`player.on`), and this plugin's own `set` does.
10
10
  */
11
11
  declare class AppearanceService {
12
12
  #private;
@@ -9,8 +9,8 @@ const preference = (value) => value === "system" || LOCALES.includes(value)
9
9
  export const THEMES = ["vestra", "vestra-light"];
10
10
  /**
11
11
  * One per plugin: the value comes with the `window.state` read before
12
- * activation; after `plugin.player.subscribe()`, `appearance.changed` keeps it current once
13
- * the plugin uses it (or listens to that event with `player.on`).
12
+ * activation; `appearance.changed` keeps it current while the plugin
13
+ * listens to that event (`player.on`), and this plugin's own `set` does.
14
14
  */
15
15
  class AppearanceService {
16
16
  #runtime;
@@ -40,7 +40,7 @@ class AppearanceService {
40
40
  const theme = event?.theme;
41
41
  if (theme && THEMES.includes(theme))
42
42
  this.accept(theme);
43
- }, "events", true);
43
+ }, "held", true);
44
44
  }
45
45
  /** An event's theme, or this plugin's own `set`: only a change counts. */
46
46
  accept(theme) {
@@ -15,9 +15,9 @@ export type Why = () => string;
15
15
  export declare const WAKE_EVENTS: readonly string[];
16
16
  /**
17
17
  * What the runtime reads of the plugin's manifest: its id. Nothing in the
18
- * manifest switches behaviour (1.9.0): event delivery and the start-up
19
- * reads are the plugin's explicit calls (`plugin.player.subscribe()`,
20
- * `plugin.player.read()`).
18
+ * manifest switches behaviour (1.9.0): the start-up read is the plugin's
19
+ * explicit call (`plugin.player.read()`), and an event reaches the plugin
20
+ * from its first listener.
21
21
  */
22
22
  export interface PluginManifest {
23
23
  id: string;
@@ -48,6 +48,16 @@ export interface StateSignals {
48
48
  /** Something the plugin sees changed that no key describes: everything is evaluated again. */
49
49
  invalidate(): void;
50
50
  }
51
+ /**
52
+ * When an event group is subscribed at the player. `"held"`: only while
53
+ * something holds it: a plugin listener (`plugin.player.on`), a hold (a
54
+ * watcher such as `MainWindow.onChange`, a media handle's `ready`) or a
55
+ * stream. The SDK's own copy (a mirror) and a binding's read never
56
+ * subscribe it on their own; between holders the copy is the newest value
57
+ * the plugin has (its start-up read, its own calls, an event's data).
58
+ * `null`: subscribed from the group's first entry, whatever it is.
59
+ */
60
+ export type Needs = "held" | null;
51
61
  /**
52
62
  * Per-plugin connection to the player. Scopes reach it through `Runtime`;
53
63
  * the flat RPC clients stay private here so protocol fields never reach
@@ -115,14 +125,6 @@ export declare class Connection {
115
125
  */
116
126
  readonly features: ReadonlySet<string>;
117
127
  constructor(transport: Transport, manifest: PluginManifest, directory: string, dataDirectory?: string, app?: unknown, options?: RuntimeOptions);
118
- /** Event delivery is on (`plugin.player.subscribe()` was called). */
119
- get delivering(): boolean;
120
- /**
121
- * Turn event delivery on (`plugin.player.subscribe()`): every later
122
- * listener is subscribed, and so is what was added before and heard
123
- * nothing. Idempotent.
124
- */
125
- deliver(): void;
126
128
  /** Read the state copy kept by `event` again, if one exists; never rejects. */
127
129
  reread(event: string): Promise<void>;
128
130
  /** Lazily created singletons shared by every scope of this plugin. */
@@ -151,31 +153,39 @@ export declare class Connection {
151
153
  callSite(): () => string | undefined;
152
154
  /**
153
155
  * Host events with one `events.subscribe` per name, however many listeners.
154
- * An event that needs delivery (`"events"`) is subscribed only once
155
- * `plugin.player.subscribe()` was called; until then its listener simply
156
- * never fires.
156
+ * A plugin listener subscribes its event at once. A `"held"` event (the
157
+ * default, {@link Needs}) is subscribed only while a listener, a hold or
158
+ * a stream holds it: a state copy alone (`mirror`) waits, and hears the
159
+ * events while something else holds the group.
157
160
  * `mirror`: the SDK's own copy of the state (`plugin.player.state` and
158
161
  * the like), not a listener of the plugin's (see {@link EventGroup}).
159
162
  */
160
- on(event: string, listener: Listener,
161
- /** `"events"`: it arrives after `plugin.player.subscribe()`; `null`: always. */
162
- needs?: "events" | null, mirror?: boolean): Disposable;
163
+ on(event: string, listener: Listener, needs?: Needs, mirror?: boolean): Disposable;
163
164
  /**
164
- * Count `event` as listened to while held: a watcher of a service's
165
- * state, a binding that reads it. Nothing when nothing subscribed to it
166
- * (no `plugin.player.subscribe()`, or the service did not start).
165
+ * Hold `event` while the handle lives: a watcher of a service's state
166
+ * (`MainWindow.onChange`, a panel slot's `onChange`, a media handle's
167
+ * `ready` and `onEnd`, a scrub). It counts as listened to, and a
168
+ * held-only group ({@link Needs}) is subscribed while held, with its copy
169
+ * read once more when the subscription starts after `read()` (or
170
+ * `always`). Nothing when nothing started the group (the service did
171
+ * not start).
167
172
  */
168
- hold(event: string, why?: Why): Disposable;
173
+ hold(event: string, why?: Why, always?: boolean): Disposable;
169
174
  /**
170
- * Hear `event` while followed, whether or not event delivery is on, and
171
- * count it as listened to (`plugin.player.stream`, SDK 1.10.0): the group
172
- * the caller started (a state copy's) is subscribed now if it waited for
173
- * `plugin.player.subscribe()`, and only it. When the last follower ends,
174
- * such a group waits again as before: its subscription at the player
175
- * ends, and the copy stays as it was. Nothing when nothing started the
176
- * group.
175
+ * {@link Connection.hold} for `plugin.player.stream` (SDK 1.10.0): the
176
+ * stream reads the state itself when it opens, so the copy is not read
177
+ * once more here.
177
178
  */
178
179
  follow(event: string, why?: Why): Disposable;
180
+ /**
181
+ * Count `event` as listened to while a binding reads its state: the
182
+ * binding's reason joins what the player is told while the group is
183
+ * subscribed, but it never subscribes a held-only group on its own (a
184
+ * bound value that reads `plugin.player.state` shows the newest snapshot
185
+ * the plugin has; a stream or an event makes it follow the player).
186
+ * Nothing when nothing started the group.
187
+ */
188
+ bindingReads(event: string, why: Why): Disposable;
179
189
  /**
180
190
  * Why the plugin listens to each event it really listens to (mirrors
181
191
  * left out), as the player's log says it: for {@link TestHost} and