@vestra-player/sdk 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +2 -2
  3. package/bin/vestra-plugin.mjs +11 -100
  4. package/capability-scan.json +3 -1
  5. package/dist/api-requests.d.ts +11 -36
  6. package/dist/api-requests.js +18 -47
  7. package/dist/capability-scan.d.ts +1 -1
  8. package/dist/capability-scan.js +8 -9
  9. package/dist/docs-tree.json.gz +0 -0
  10. package/dist/docs.d.ts +1 -1
  11. package/dist/docs.js +1 -1
  12. package/dist/index.d.ts +4 -5
  13. package/dist/manifest.d.ts +5 -0
  14. package/dist/manifest.js +9 -24
  15. package/dist/member-uses.d.ts +61 -0
  16. package/dist/member-uses.js +160 -0
  17. package/dist/player-runtime.d.ts +1 -2
  18. package/dist/player-runtime.js +1 -2
  19. package/dist/plugin/appearance.d.ts +1 -1
  20. package/dist/plugin/appearance.js +2 -2
  21. package/dist/plugin/bindings.d.ts +1 -1
  22. package/dist/plugin/bindings.js +2 -2
  23. package/dist/plugin/commands.js +1 -12
  24. package/dist/plugin/connection.d.ts +26 -7
  25. package/dist/plugin/connection.js +68 -36
  26. package/dist/plugin/drops.js +1 -1
  27. package/dist/plugin/index.js +9 -15
  28. package/dist/plugin/media.js +0 -12
  29. package/dist/plugin/mpv.js +0 -7
  30. package/dist/plugin/packages.js +1 -2
  31. package/dist/plugin/player/events.d.ts +4 -3
  32. package/dist/plugin/player/events.js +7 -6
  33. package/dist/plugin/player.d.ts +21 -13
  34. package/dist/plugin/player.js +56 -21
  35. package/dist/plugin/services.d.ts +4 -4
  36. package/dist/plugin/services.js +7 -29
  37. package/dist/plugin/settings.js +1 -1
  38. package/dist/plugin/shaders.js +0 -2
  39. package/dist/plugin/stream.d.ts +2 -1
  40. package/dist/plugin/stream.js +2 -2
  41. package/dist/plugin/testing/commands.d.ts +3 -10
  42. package/dist/plugin/testing/commands.js +6 -15
  43. package/dist/plugin/testing/index.d.ts +26 -116
  44. package/dist/plugin/testing/index.js +30 -104
  45. package/dist/plugin/testing/processing.js +1 -1
  46. package/dist/plugin/testing/services.js +0 -1
  47. package/dist/plugin/timeline.d.ts +2 -3
  48. package/dist/plugin/timeline.js +4 -8
  49. package/dist/plugin/types/base.d.ts +40 -86
  50. package/dist/plugin/types/commands.d.ts +10 -67
  51. package/dist/plugin/types/packages.d.ts +17 -55
  52. package/dist/plugin/types/playback.d.ts +126 -144
  53. package/dist/plugin/types/plugin-wire.d.ts +6 -36
  54. package/dist/plugin/types/processing.d.ts +10 -49
  55. package/dist/plugin/types/services.d.ts +11 -70
  56. package/dist/plugin/types/snapshots.d.ts +7 -60
  57. package/dist/plugin/types/sources.d.ts +2 -11
  58. package/dist/plugin/types/subtitles.d.ts +5 -26
  59. package/dist/plugin/types/ui-content.d.ts +1 -16
  60. package/dist/plugin/types/ui-layout.d.ts +53 -79
  61. package/dist/plugin/types/ui-locale.d.ts +5 -23
  62. package/dist/plugin/types/ui-shell.d.ts +13 -59
  63. package/dist/plugin/view/layout.js +1 -1
  64. package/dist/plugin/view.js +0 -2
  65. package/dist/plugin/window.d.ts +1 -1
  66. package/dist/plugin/window.js +1 -1
  67. package/dist/plugin/wire-facade.js +1 -2
  68. package/dist/processing.d.ts +2 -3
  69. package/dist/protocol.d.ts +14 -0
  70. package/dist/protocol.js +14 -0
  71. package/dist/request-queue.js +1 -1
  72. package/dist/subtitles.d.ts +1 -1
  73. package/dist/ts-plugin.d.ts +8 -15
  74. package/dist/ts-plugin.js +3 -141
  75. package/dist/wire.d.ts +7 -12
  76. package/dist/wire.js +6 -8
  77. package/llms.txt +4 -4
  78. package/package.json +1 -2
  79. package/dist/capabilities.d.ts +0 -107
  80. package/dist/capabilities.js +0 -69
  81. package/dist/capability-check.d.ts +0 -176
  82. package/dist/capability-check.js +0 -461
  83. package/dist/capability-rules.d.ts +0 -125
  84. package/dist/capability-rules.js +0 -192
  85. package/dist/host-capabilities.d.ts +0 -10
  86. package/dist/host-capabilities.js +0 -492
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0
4
+
5
+ **Who must change: every plugin with a `capabilities` field, and every plugin that follows the player's state.** Manifest capabilities are gone (user rulings 2026-11-13; plan `design/sdk-1.9/PLAN.md`, C2 and the SDK half of C3). A manifest says who the plugin is; what the store shows the user comes only from the capability scan of the code ([Capability scan](docs/reference/scan.md)). The two declarations that changed how a plugin ran are now calls, and nothing else is declared or checked. Needs player 0.9.0, which removes its gate in the same release; `apiVersion` stays `vestra/1`.
6
+
7
+ **Migration** (first lines of `activate`, then delete the field):
8
+
9
+ ```ts
10
+ export default async function activate(plugin: Plugin) {
11
+ plugin.player.subscribe(); // was "events"
12
+ await plugin.player.read(); // was "playback.read"
13
+ // …the rest unchanged
14
+ }
15
+ ```
16
+
17
+ Keep only the lines whose declaration the manifest had; a plugin that had neither adds nothing. Set `minPlayerVersion` to `0.9.0`: an older player requires the field. Remove `@vestra-player/sdk/ts-plugin` from `tsconfig.json`, `capabilities` from `startPlugin(…)` options in tests, and `--json` from `vestra-plugin check`.
18
+
19
+ **New: the explicit calls** (C2).
20
+
21
+ - **`plugin.player.subscribe()`** (sync, idempotent): turns on event delivery for this run and subscribes the state copy now. Until it is called, a listener of `source.state`, `playback.backend`, `window.state`, `timeline.changed`, `appearance.changed` or `resolvers.fileTypes` never runs, as without `events` before (the one-time warning in the log now names `subscribe()`); a listener added earlier starts to hear events at the call. The other events (`packages.changed`, `bindings.changed`, `commands.keys`, `video.upscaling.changed`, `video.motion.changed`) arrive from the first listener, as they did with their own declarations.
22
+ - **`await plugin.player.read()`** (idempotent; a failed read is tried again by the next call): reads `source.state` and `timeline.marks` and turns on the re-reads after the plugin's own actions (`host.run`, closing a `Media`, a stream's end), as `playback.read` did. Before it, `plugin.player.state` is the empty state. `subscribe()` after `read()` reads the state once more, since a change between the two sent no event.
23
+ - **Command keys and the layout state start on first use** (`plugin.commands.keys`, `plugin.panels.*.state`), with no declaration.
24
+ - **Wire order** (the one ruled shift): the start-up `window.state` read now comes first, because it is answered before `activate` begins; the player-state requests follow it, one round trip later. Proof: with the explicit calls first in `activate`, all 19 golden scenarios equal their declared traces after that one transformation (step 1 of this release, recorded on both paths before the declared one was removed; `test/explicit-calls.test.ts` keeps the request sequences); in this release the 14 traces it changes were regenerated (list below) and the others are byte-identical.
25
+
26
+ **Removed: everything that reads declarations** (C3, SDK half; no legacy path).
27
+
28
+ - **Manifest field `capabilities`**: an error everywhere the SDK reads a manifest (`vestra-plugin check`/`build`/`pack`, `startPlugin`), with a message that names the change and the two calls (`CAPABILITIES_REMOVED`). An error, not a warning, because the player refuses unknown manifest fields and an ignored list would leave a plugin that silently stops hearing events or reading the state; the message says exactly what to write instead.
29
+ - **Early refusals with `capability`** (`media.sources`, `playback.control` for `media.sources.open`, `mpv`, `secrets`, `rendering.manage`, `video.upscaling`, `video.motion`, `processing.video`, `timeline.marks`, `commands.run`, `palette.lead`): the calls are sent and the player answers. `capability` remains the player's (and `TestHost`'s) code for the built-in-only requests (`commands.list`, `commands.run`, `palette.lead.*`) from a plugin that is not built in.
30
+ - **`CAPABILITY_INFO` and `CapabilityInfo`** (`./testing`), **`CAPABILITIES`, `CAPABILITY_INFO`, `HOST_CAPABILITIES`** (`./runtime`), the copy of the player's capability table (`src/host-capabilities.ts`, `npm run capabilities:sync`), the capability checker and its rules, the `@capability` doc tag and the [Capabilities](https://vestrasys.github.io/vestra-player-sdk/documents/Reference.html) reference page.
31
+ - **`vestra-plugin check`**: no capability step; `--json` (which only reported it) fails with a message.
32
+ - **`@vestra-player/sdk/ts-plugin`**: no checker and no quick fix; the module stays as a no-op so that a `tsconfig.json` that lists it still loads (remove it; a later major removes the module).
33
+ - **`PluginInfo.capabilities`, `PackageManifest.capabilities`** and `TestHost.packages[].capabilities`.
34
+ - **`startPlugin`'s `capabilities` option.** `id` now means "start with this id and read no manifest".
35
+ - **`TestHost` `bindings.list`** lists a plugin's `focus: "panel"` commands without a `ui.mount` declaration to look at (player 0.8.0 left them out). Everything else in `TestHost` is unchanged.
36
+
37
+ **Player side: panels compile one by one, when first shown** (player 0.9.0; no API change). A panel shown at once (the bottom bar, the backdrop, the current tab of an open column) still compiles at the mount and rejects `ready` with `ui-prepare`; a tab mounted in the background compiles when it is first shown (an adjust tab when the column opens), and a failure then reaches `onError` as `ui-prepare`, the tab staying empty until the plugin mounts it again. Mounting or unmounting a panel no longer rebuilds the main window, so other panels keep their component state; a panel gets a new instance only when its place is made again (a column closed and opened, the fullscreen overlay, the floating sidebar) or after the player unloaded it (at most 4 loaded per column). Docs follow (`Panel`, `Panel.ready`, `ui-prepare`, the guides).
38
+
39
+ **Kept**: the capability scan and `capability-scan.json` (its test now covers every method the SDK sends instead of the removed table), `API_REQUESTS` (the message and event tables), the message and event reference pages (by area; the events table says which events wait for `subscribe()`).
40
+
41
+ **Golden traces regenerated** (the ruled `window.state` shift; nothing else differs): `builtins-info`, `builtins-playback`, `builtins-playlist`, `builtins-subtitles`, `builtins-video`, `examples-adjust-panel`, `examples-blur`, `examples-bookmark`, `examples-menus`, `examples-signal-generator`, `styles-speed-a`, `styles-speed-b`, `styles-speed-c`, `host-start-taken`. The 11 examples and the three style plugins were migrated (field deleted, the calls inserted, `minPlayerVersion` 0.9.0); built-ins at the pinned player commit, which still declare, start through the same calls (`test/explicit.ts`) until they are migrated and re-pinned.
42
+
3
43
  ## 1.8.0
4
44
 
5
45
  **Who must change: nobody.** Pure additions and a product-data sync (user rulings 2026-11-13, plan A): the 31 existing capabilities, their members, what each needs and every existing behaviour of the SDK and of `TestHost` are as in 1.7.20; the existing tests and golden traces pass unchanged. A plugin that does nothing keeps working on every player. A plugin that uses an addition needs the player released with this SDK (`minPlayerVersion`); `apiVersion` stays `vestra/1`.
package/README.md CHANGED
@@ -41,7 +41,7 @@ npm i -D @vestra-player/sdk # Node.js 26 or newer
41
41
  "version": "0.1.0",
42
42
  "apiVersion": "vestra/1",
43
43
  "entry": "main.ts",
44
- "capabilities": ["commands", "ui.osd"]
44
+ "minPlayerVersion": "0.9.0"
45
45
  }
46
46
  ```
47
47
 
@@ -81,7 +81,7 @@ The [documentation site](https://vestrasys.github.io/vestra-player-sdk/) is the
81
81
 
82
82
  - **[Tutorial](https://vestrasys.github.io/vestra-player-sdk/documents/Tutorial.html)**: one page: what a plugin is (a process that talks to the player), the three ways to write one with an example each, where things live, and running, testing and publishing.
83
83
  - **[Guides](https://vestrasys.github.io/vestra-player-sdk/documents/Guides.html)**: one task each (goal, steps, often a complete example): windows, settings and translations, playback, storage, window state, sliders, subtitles, video filters, the GPU switch, menu state that needs no running plugin (`plugin.when`), testing, publishing, your own store, documentation for coding agents; the design rules every plugin follows; and troubleshooting.
84
- - **[Reference](https://vestrasys.github.io/vestra-player-sdk/documents/Reference.html)**: capabilities, manifest fields, limits, menus and bindings, platforms, theme, error codes, events, messages, translations, the test host, and the [command line](https://vestrasys.github.io/vestra-player-sdk/documents/Command_line.html) (`vestra-plugin check`, `test`, `build`, `pack`, `i18n extract`, `i18n check`).
84
+ - **[Reference](https://vestrasys.github.io/vestra-player-sdk/documents/Reference.html)**: manifest fields, limits, menus and bindings, platforms, theme, error codes, events, messages, translations, the test host, and the [command line](https://vestrasys.github.io/vestra-player-sdk/documents/Command_line.html) (`vestra-plugin check`, `test`, `build`, `pack`, `i18n extract`, `i18n check`).
85
85
  - **[Examples](https://vestrasys.github.io/vestra-player-sdk/documents/Examples.html)**: the walkthroughs above.
86
86
  - **[API](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk.html)**: every type and member of `@vestra-player/sdk` and `@vestra-player/sdk/testing`.
87
87
 
@@ -13,12 +13,8 @@
13
13
  * A plugin directory holds manifest.json; the default is the current
14
14
  * directory. Works in any project that depends on @vestra-player/sdk.
15
15
  *
16
- * check strict type check of the plugin's .ts files and tests/*.ts
17
- * (then every use of an API member whose capability manifest.json
18
- * does not declare: file:line, member, capability; fails on any;
19
- * a plugin.wire.request or event listener whose name the check
20
- * cannot read is listed as unchecked, without failing; --json
21
- * prints the findings and the unchecked calls as JSON)
16
+ * check the manifest, then a strict type check of the plugin's .ts
17
+ * files and tests/*.ts
22
18
  * build check, then write dist/: .ts → .js with types stripped, other
23
19
  * package files copied, dist/manifest.json with `version`
24
20
  * test node --test on tests/*.test.{ts,mjs}
@@ -105,9 +101,6 @@ const i18n = await import(pathToFileURL(join(sdkRoot, "dist/i18n.js")).href);
105
101
  const i18nTools = await import(
106
102
  pathToFileURL(join(sdkRoot, "dist/i18n-tools.js")).href
107
103
  );
108
- const capabilityCheck = await import(
109
- pathToFileURL(join(sdkRoot, "dist/capability-check.js")).href
110
- );
111
104
  const SDK = "@vestra-player/sdk";
112
105
 
113
106
  /** Never part of a production package. */
@@ -319,10 +312,10 @@ function checkConfig(target, sources) {
319
312
  };
320
313
  }
321
314
 
322
- async function check(target, report = null) {
323
- const say = report ? () => {} : (line) => console.log(line);
315
+ async function check(target) {
316
+ const say = (line) => console.log(line);
324
317
  for (const hint of target.hints ?? []) say(`${target.name}: hint: ${hint}`);
325
- dependencies(target, !!report);
318
+ dependencies(target);
326
319
  const own = (await files(target.directory)).filter(
327
320
  (file) => isTypeScript(file) || file.endsWith(".mts"),
328
321
  );
@@ -336,48 +329,19 @@ async function check(target, report = null) {
336
329
  );
337
330
  if (!sources.length) {
338
331
  say(`${target.name}: no TypeScript to check`);
339
- report?.push({ plugin: target.name, findings: [], unchecked: [] });
340
332
  return;
341
333
  }
342
334
  const tsc = compiler("typescript/lib/tsc.js");
343
335
  const scratch = await mkdtemp(join(tmpdir(), "vestra-plugin-check-"));
344
- let findings;
345
- let unchecked;
346
336
  try {
347
337
  const config = join(scratch, "tsconfig.json");
348
338
  await writeFile(config, JSON.stringify(checkConfig(target, sources)));
349
- if (
350
- run(process.execPath, [tsc, "-p", config], {
351
- stdio: report ? ["ignore", process.stderr, "inherit"] : "inherit",
352
- }) !== 0
353
- )
339
+ if (run(process.execPath, [tsc, "-p", config], { stdio: "inherit" }) !== 0)
354
340
  fail(`${target.name}: type check failed`);
355
341
  say(`${target.name}: type check passed (${sources.length} files)`);
356
- ({ findings, unchecked } = await capabilityFindings(target, config));
357
342
  } finally {
358
343
  await rm(scratch, { recursive: true, force: true });
359
344
  }
360
- if (report) report.push({ plugin: target.name, findings, unchecked });
361
- else {
362
- for (const finding of findings)
363
- console.error(
364
- `${relative(process.cwd(), finding.file) || finding.file}:${finding.line}:${finding.column}: ${finding.message} (request ${finding.method})`,
365
- );
366
- // Calls whose capability depends on a name the check cannot read
367
- // (plugin.wire.request with a computed method): a note, never a failure.
368
- for (const call of unchecked)
369
- console.log(
370
- `${relative(process.cwd(), call.file) || call.file}:${call.line}:${call.column}: unchecked: ${call.message}`,
371
- );
372
- }
373
- if (findings.length) {
374
- const missing = [...new Set(findings.map((each) => each.capability))];
375
- fail(
376
- `${target.name}: ${findings.length} use${findings.length === 1 ? "" : "s"} of undeclared capabilities; add ${missing.map((each) => `"${each}"`).join(", ")} to manifest.json "capabilities" (or stop using those members)`,
377
- );
378
- }
379
- say(`${target.name}: capabilities declared for every API use`);
380
- if (report) return;
381
345
  for (const line of await forWarnings(target))
382
346
  console.log(`${target.name}: warning: ${line}`);
383
347
  // Translation warnings never fail the check.
@@ -392,48 +356,6 @@ async function check(target, report = null) {
392
356
  }
393
357
  }
394
358
 
395
- /**
396
- * Uses of API members whose capability the manifest does not declare
397
- * (`findings`), and calls whose capability depends on a name the check
398
- * cannot read (`unchecked`: `plugin.wire.request` with a computed method),
399
- * in the plugin's production files (not tests/), with the type check's
400
- * compiler options (src/capability-check.ts).
401
- */
402
- async function capabilityFindings(target, config) {
403
- const ts = await typescript();
404
- const parsed = ts.getParsedCommandLineOfConfigFile(
405
- config,
406
- {},
407
- {
408
- ...ts.sys,
409
- onUnRecoverableConfigFileDiagnostic: (diagnostic) =>
410
- fail(
411
- `${target.name}: ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`,
412
- ),
413
- },
414
- );
415
- const files = (await sourceFiles(target)).typescript.map((file) =>
416
- join(target.directory, file),
417
- );
418
- if (!parsed || !files.length) return { findings: [], unchecked: [] };
419
- const program = ts.createProgram(parsed.fileNames, parsed.options);
420
- const capabilities = Array.isArray(target.manifest.capabilities)
421
- ? target.manifest.capabilities
422
- : [];
423
- const { findings, unchecked } = capabilityCheck.checkCapabilities(
424
- ts,
425
- program,
426
- { files, capabilities },
427
- );
428
- return {
429
- findings: findings.map((finding) => ({
430
- ...finding,
431
- file: resolve(finding.file),
432
- })),
433
- unchecked: unchecked.map((call) => ({ ...call, file: resolve(call.file) })),
434
- };
435
- }
436
-
437
359
  /** Slint source without its comments (string literals kept as they are). */
438
360
  function slintCode(text) {
439
361
  let out = "";
@@ -996,7 +918,6 @@ async function scanCommand(args) {
996
918
 
997
919
  const USAGE = [
998
920
  "usage: vestra-plugin <check|build|test|pack> [plugin-dir...] [--version x.y.z] [--out dir]",
999
- " vestra-plugin check [plugin-dir...] --json",
1000
921
  " vestra-plugin scan [plugin-dir...]",
1001
922
  " vestra-plugin i18n extract [plugin-dir...] [--locale <lang>]...",
1002
923
  " vestra-plugin i18n check [plugin-dir...]",
@@ -1079,12 +1000,10 @@ async function main() {
1079
1000
  }
1080
1001
  if (locales.length && subcommand !== "extract")
1081
1002
  fail("--locale applies to i18n extract");
1082
- const jsonIndex = args.indexOf("--json");
1083
- const report = jsonIndex >= 0 ? [] : null;
1084
- if (report) {
1085
- args.splice(jsonIndex, 1);
1086
- if (command !== "check") fail("--json applies to check");
1087
- }
1003
+ if (args.includes("--json"))
1004
+ fail(
1005
+ "--json was removed in SDK 1.9.0 with the capability check it reported (manifest capabilities are gone); check prints its result as text",
1006
+ );
1088
1007
  const flag = option("--version");
1089
1008
  const out = option("--out");
1090
1009
  const directories = args.length ? args : ["."];
@@ -1092,12 +1011,11 @@ async function main() {
1092
1011
  fail("--version applies to a single plugin");
1093
1012
  const failed = [];
1094
1013
  for (const directory of directories) {
1095
- const reported = report?.length ?? 0;
1096
1014
  try {
1097
1015
  const target = await plugin(directory);
1098
1016
  if (subcommand === "extract") await i18nExtract(target, locales);
1099
1017
  else if (subcommand === "check") await i18nCheck(target);
1100
- else if (command === "check") await check(target, report);
1018
+ else if (command === "check") await check(target);
1101
1019
  else if (command === "build") await build(target, flag);
1102
1020
  else if (command === "pack") await pack(target, flag, out);
1103
1021
  else await test(target);
@@ -1105,15 +1023,8 @@ async function main() {
1105
1023
  if (!error.expected) throw error;
1106
1024
  console.error(`✖ ${error.message}`);
1107
1025
  failed.push(directory);
1108
- if (report) {
1109
- if (report.length === reported)
1110
- report.push({ findings: [], unchecked: [] });
1111
- report[reported].error = error.message;
1112
- }
1113
1026
  }
1114
- if (report) report[reported] = { directory, ...report[reported] };
1115
1027
  }
1116
- if (report) console.log(JSON.stringify(report, null, 2));
1117
1028
  if (failed.length) {
1118
1029
  console.error(
1119
1030
  `${subcommand ? `i18n ${subcommand}` : command} failed for: ${failed.join(", ")}`,
@@ -1,5 +1,5 @@
1
1
  {
2
- "about": "The capability scan's table (docs/reference/scan.md): which API members and which requests of the player's protocol cross a boundary the user should know about, by category. Hand-maintained: every method of the public API and every method of the player's capability table is in exactly one list, a category's or none's (test/capability-scan.test.ts). `vestra-plugin scan` reports the categories a plugin uses. It changes nothing at run time: the manifest's capabilities gate the API as before.",
2
+ "about": "The capability scan's table (docs/reference/scan.md): which API members and which requests of the player's protocol cross a boundary the user should know about, by category. Hand-maintained: every method of the public API is in exactly one list, a category's or none's, and every request the SDK sends has a category by name or prefix (test/capability-scan.test.ts). `vestra-plugin scan` reports the categories a plugin uses. It changes nothing at run time; since SDK 1.9.0 it is the only disclosure (manifests declare nothing).",
3
3
  "version": 1,
4
4
  "categories": {
5
5
  "player": {
@@ -164,6 +164,7 @@
164
164
  "Player.openStream",
165
165
  "Player.previous",
166
166
  "Player.provideSequence",
167
+ "Player.read",
167
168
  "Player.refresh",
168
169
  "Player.restart",
169
170
  "Player.scrub",
@@ -177,6 +178,7 @@
177
178
  "Player.setStepSeek",
178
179
  "Player.stats",
179
180
  "Player.step",
181
+ "Player.subscribe",
180
182
  "Power.preventSleep",
181
183
  "RenderOptions.onStatus",
182
184
  "RenderOptions.set",
@@ -1,25 +1,15 @@
1
1
  /**
2
- * Which player requests each member of the plugin API sends: the SDK's half
3
- * of the capability rule (the player's half, what each request needs, is
4
- * `HOST_CAPABILITIES`). A member is written `Interface.member` as in
5
- * `CAPABILITY_INFO`; members declared on `Scope` are written `Plugin.…`.
2
+ * Which player requests each member of the plugin API sends, written
3
+ * `Interface.member`; members declared on `Scope` are written `Plugin.…`.
4
+ * The generated reference pages read it: the Stability column of the
5
+ * message table (docs/reference/messages.md) and the members of each event
6
+ * (docs/reference/events.md). For a listener the row is the
7
+ * `events.subscribe` with its event name.
6
8
  *
7
- * List the requests that decide the member's capabilities: the one it
8
- * sends to do its work, and for a listener the `events.subscribe` with its
9
- * event name. A string parameter that the player's rule reads (`event`,
10
- * `stage`) is given in `params`. `also: true` marks a request whose
11
- * capability the member needs on top of its own (documented at the member,
12
- * not listed in its capability's `CAPABILITY_INFO.apis`).
13
- *
14
- * Members that need no capability are left out, apart from a few that show
15
- * a rule's "none" case. Members of objects that another listed member
16
- * returns (a `Window` from `Windows.create`, a `Panel` from `Panels.mount`)
17
- * are left out too: the call that created the object already needs the
18
- * capability.
19
- *
20
- * Order matters for `CAPABILITY_INFO`: each capability lists its members in
21
- * this table's order. test/capability-rules.test.ts checks every method and
22
- * parameter against the player's table.
9
+ * A row lists the request the member sends to do its work. Members whose
10
+ * requests come from a handle another member returned (a `Window` from
11
+ * `Windows.create`) are listed in the message table's `WRAPPED_BY`
12
+ * (scripts/doc-tables/messages.mjs) instead.
23
13
  *
24
14
  * @internal
25
15
  */
@@ -27,10 +17,8 @@
27
17
  export interface ApiRequest {
28
18
  /** The wire method (`source.submit`). */
29
19
  readonly method: string;
30
- /** String parameters the player's rule for the method reads. */
20
+ /** String parameters that name what is meant (`event`, `stage`). */
31
21
  readonly params?: Readonly<Record<string, string>>;
32
- /** A further capability, documented at the member. */
33
- readonly also?: true;
34
22
  }
35
23
  /** @internal */
36
24
  export declare const API_REQUESTS: Readonly<Record<string, readonly ApiRequest[]>>;
@@ -43,16 +31,3 @@ export declare const API_REQUESTS: Readonly<Record<string, readonly ApiRequest[]
43
31
  * @internal
44
32
  */
45
33
  export declare const SUBSCRIBED_EVENTS: readonly string[];
46
- /**
47
- * Members whose requests depend on an argument, which `API_REQUESTS` cannot
48
- * list: the event name of a listener (`event`: a subscribed event's
49
- * `events.subscribe`, nothing for the others) or the method name of a request
50
- * (`method`: that method, with the string fields of the second argument as its
51
- * parameters). The capability check reads the argument when its type is one
52
- * string (a literal, a constant), and reports the call as unchecked otherwise
53
- * (a computed name, a union of several, the member taken by destructuring or as
54
- * a value).
55
- *
56
- * @internal
57
- */
58
- export declare const ARGUMENT_APIS: Readonly<Record<string, "event" | "method">>;
@@ -1,33 +1,24 @@
1
1
  /**
2
- * Which player requests each member of the plugin API sends: the SDK's half
3
- * of the capability rule (the player's half, what each request needs, is
4
- * `HOST_CAPABILITIES`). A member is written `Interface.member` as in
5
- * `CAPABILITY_INFO`; members declared on `Scope` are written `Plugin.…`.
2
+ * Which player requests each member of the plugin API sends, written
3
+ * `Interface.member`; members declared on `Scope` are written `Plugin.…`.
4
+ * The generated reference pages read it: the Stability column of the
5
+ * message table (docs/reference/messages.md) and the members of each event
6
+ * (docs/reference/events.md). For a listener the row is the
7
+ * `events.subscribe` with its event name.
6
8
  *
7
- * List the requests that decide the member's capabilities: the one it
8
- * sends to do its work, and for a listener the `events.subscribe` with its
9
- * event name. A string parameter that the player's rule reads (`event`,
10
- * `stage`) is given in `params`. `also: true` marks a request whose
11
- * capability the member needs on top of its own (documented at the member,
12
- * not listed in its capability's `CAPABILITY_INFO.apis`).
13
- *
14
- * Members that need no capability are left out, apart from a few that show
15
- * a rule's "none" case. Members of objects that another listed member
16
- * returns (a `Window` from `Windows.create`, a `Panel` from `Panels.mount`)
17
- * are left out too: the call that created the object already needs the
18
- * capability.
19
- *
20
- * Order matters for `CAPABILITY_INFO`: each capability lists its members in
21
- * this table's order. test/capability-rules.test.ts checks every method and
22
- * parameter against the player's table.
9
+ * A row lists the request the member sends to do its work. Members whose
10
+ * requests come from a handle another member returned (a `Window` from
11
+ * `Windows.create`) are listed in the message table's `WRAPPED_BY`
12
+ * (scripts/doc-tables/messages.mjs) instead.
23
13
  *
24
14
  * @internal
25
15
  */
26
16
  const submit = [{ method: "source.submit" }, { method: "source.operation" }];
27
- const readsSubtitles = { method: "subtitles.state", also: true };
28
- const listen = (event, also) => also
29
- ? { method: "events.subscribe", params: { event }, also }
30
- : { method: "events.subscribe", params: { event } };
17
+ const readsSubtitles = { method: "subtitles.state" };
18
+ const listen = (event) => ({
19
+ method: "events.subscribe",
20
+ params: { event },
21
+ });
31
22
  /** @internal */
32
23
  export const API_REQUESTS = Object.freeze({
33
24
  "Player.state": [{ method: "source.state" }],
@@ -39,7 +30,7 @@ export const API_REQUESTS = Object.freeze({
39
30
  "Player.open": submit,
40
31
  "Player.openStream": [
41
32
  { method: "producer.prepare" },
42
- { method: "source.submit", also: true },
33
+ { method: "source.submit" },
43
34
  ],
44
35
  "Player.setPaused": submit,
45
36
  "Player.seek": submit,
@@ -119,7 +110,7 @@ export const API_REQUESTS = Object.freeze({
119
110
  "Packages.uninstall": [{ method: "packages.uninstall" }],
120
111
  "Plugin.video.filter": [
121
112
  { method: "processing.replace", params: { stage: "video" } },
122
- listen("source.state", true),
113
+ listen("source.state"),
123
114
  ],
124
115
  "Plugin.video.view": [{ method: "video.view.set" }],
125
116
  "Plugin.video.render": [{ method: "video.render.set" }],
@@ -132,8 +123,6 @@ export const API_REQUESTS = Object.freeze({
132
123
  { method: "snapshot.capture" },
133
124
  ],
134
125
  "Snapshot.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
135
- // Parts of remembered files: also media.sources (documented at the
136
- // members; the player checks it for jobs.start with parts and jobs.check).
137
126
  "MediaCapture.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
138
127
  "MediaCapture.exportCheck": [{ method: "jobs.check" }],
139
128
  "MediaSources.remember": [{ method: "media.sources.remember" }],
@@ -141,8 +130,7 @@ export const API_REQUESTS = Object.freeze({
141
130
  "MediaSources.locate": [{ method: "media.sources.locate" }],
142
131
  "MediaSources.forget": [{ method: "media.sources.forget" }],
143
132
  "MediaSources.list": [{ method: "media.sources.list" }],
144
- // An open like Player.open: playback.control (the player's rule for
145
- // media.sources.open), with which source.operation needs it too.
133
+ // An open like Player.open, followed with source.operation.
146
134
  "MediaSources.open": [
147
135
  { method: "media.sources.open" },
148
136
  { method: "source.operation" },
@@ -197,20 +185,3 @@ export const SUBSCRIBED_EVENTS = Object.freeze([
197
185
  "video.upscaling.changed",
198
186
  "video.motion.changed",
199
187
  ]);
200
- /**
201
- * Members whose requests depend on an argument, which `API_REQUESTS` cannot
202
- * list: the event name of a listener (`event`: a subscribed event's
203
- * `events.subscribe`, nothing for the others) or the method name of a request
204
- * (`method`: that method, with the string fields of the second argument as its
205
- * parameters). The capability check reads the argument when its type is one
206
- * string (a literal, a constant), and reports the call as unchecked otherwise
207
- * (a computed name, a union of several, the member taken by destructuring or as
208
- * a value).
209
- *
210
- * @internal
211
- */
212
- export const ARGUMENT_APIS = Object.freeze({
213
- "Player.on": "event",
214
- "Wire.on": "event",
215
- "Wire.request": "method",
216
- });
@@ -10,7 +10,7 @@ export interface ScanList {
10
10
  readonly about: string;
11
11
  /** API members, `Interface.member` (`Clipboard.readText`, `Scope.video.filter`). */
12
12
  readonly members: readonly string[];
13
- /** Methods of the player's protocol, as its capability table names them (`packages.*`). */
13
+ /** Methods of the player's protocol, by name or prefix (`packages.*`). */
14
14
  readonly requests: readonly string[];
15
15
  }
16
16
  /** @internal `capability-scan.json`. */
@@ -5,24 +5,23 @@
5
5
  * prints the result; the plugin repository's index and the store show it.
6
6
  *
7
7
  * The table is `capability-scan.json` at the package's root, maintained by
8
- * hand: every method of the public API and every method of the player's
9
- * capability table is in one category's list or in `none`'s
10
- * (test/capability-scan.test.ts). Nothing here is read at run time: the
11
- * manifest's capabilities gate the API as before.
8
+ * hand: every method of the public API is in one category's list or in
9
+ * `none`'s, and every request the SDK sends has a category by name or
10
+ * prefix (test/capability-scan.test.ts). Nothing here is read at run time;
11
+ * since 1.9.0 the scan is the only disclosure (manifests declare nothing).
12
12
  *
13
- * TypeScript files are scanned by type, with the capability checker's
14
- * resolution (`findMemberUses`, capability-check.ts): a member counts
13
+ * TypeScript files are scanned by type (`findMemberUses`, member-uses.ts): a member counts
15
14
  * however its object was reached. JavaScript files have no types and are
16
15
  * scanned by name, best effort (`scanNamesInto`); the result says which
17
16
  * way each file was read.
18
17
  *
19
18
  * The TypeScript module is passed in, never imported (as in
20
- * capability-check.ts). Node only: it reads the table from disk.
19
+ * member-uses.ts). Node only: it reads the table from disk.
21
20
  *
22
21
  * @internal
23
22
  */
24
23
  import { readFileSync } from "node:fs";
25
- import { findMemberUses } from "./capability-check.js";
24
+ import { findMemberUses } from "./member-uses.js";
26
25
  /** @internal The scan's categories, in the order results list them. */
27
26
  export const SCAN_CATEGORIES = [
28
27
  "player",
@@ -107,7 +106,7 @@ class Findings {
107
106
  this.unchecked.push({
108
107
  file: this.#relative(file),
109
108
  line,
110
- message: `a request of ${JSON.stringify(method)}, which the player's capability table does not know`,
109
+ message: `a request of ${JSON.stringify(method)}, which capability-scan.json does not list`,
111
110
  });
112
111
  else if (category !== null)
113
112
  this.add(category, { request: method, file, line, by });
Binary file
package/dist/docs.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface DocsOptions {
21
21
  * page of the documentation site (its file name works too:
22
22
  * `/Guides/Guides/testing`); `/API/<category>/<symbol>/<member>` is a
23
23
  * declaration with its signature, parameters, return value, errors,
24
- * capability, player version and examples. Matching ignores case, spaces
24
+ * player version and examples. Matching ignores case, spaces
25
25
  * and punctuation; a leading `/` and a `.md` suffix are optional; `.`
26
26
  * works like `/` (`Snapshot.export`); a name that is not at its level is
27
27
  * looked up below it (`TestHost`, `/API/Snapshot` finds
package/dist/docs.js CHANGED
@@ -450,7 +450,7 @@ function notFound(asked, segments, page) {
450
450
  * page of the documentation site (its file name works too:
451
451
  * `/Guides/Guides/testing`); `/API/<category>/<symbol>/<member>` is a
452
452
  * declaration with its signature, parameters, return value, errors,
453
- * capability, player version and examples. Matching ignores case, spaces
453
+ * player version and examples. Matching ignores case, spaces
454
454
  * and punctuation; a leading `/` and a `.md` suffix are optional; `.`
455
455
  * works like `/` (`Snapshot.export`); a name that is not at its level is
456
456
  * looked up below it (`TestHost`, `/API/Snapshot` finds
package/dist/index.d.ts CHANGED
@@ -8,16 +8,15 @@
8
8
  * import with `import type`.
9
9
  *
10
10
  * Start with {@link Plugin} and {@link Scope}: every module
11
- * (`plugin.commands`, `plugin.player`, `plugin.windows`…) hangs off them and
12
- * documents the manifest capability it needs. Errors are described at
11
+ * (`plugin.commands`, `plugin.player`, `plugin.windows`…) hangs off them.
12
+ * Errors are described at
13
13
  * {@link PluginError}. Tests use `@vestra-player/sdk/testing`.
14
14
  *
15
15
  * @example Add a menu item that shows a message
16
16
  * The player gets a Tools ▸ Hello menu item; picking it shows "Hello" on
17
17
  * the video. The player imports the entry module and calls `activate` with
18
- * the plugin's `Plugin` object; `commands.add` registers the item (manifest
19
- * capability `commands`), and the player calls `run` when the user picks it
20
- * or presses a key bound to it. `osd.show` needs `ui.osd`.
18
+ * the plugin's `Plugin` object; `commands.add` registers the item, and the
19
+ * player calls `run` when the user picks it or presses a key bound to it.
21
20
  * ```ts
22
21
  * import type { Plugin } from "@vestra-player/sdk";
23
22
  *
@@ -15,6 +15,11 @@ 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)";
18
23
  /** Problems with `manifest` (empty: valid) and hints that do not fail. */
19
24
  export declare function manifestProblems(manifest: Record<string, unknown>, directory: string): {
20
25
  problems: string[];
package/dist/manifest.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
7
7
  import { join, sep } from "node:path";
8
- import { API_VERSION, CAPABILITIES, CAPABILITY_INFO } from "./capabilities.js";
8
+ import { API_VERSION } from "./protocol.js";
9
9
  export const MANIFEST_LIMITS = Object.freeze({
10
10
  idBytes: 128,
11
11
  name: 64,
@@ -26,7 +26,6 @@ export const MANIFEST_FIELDS = [
26
26
  "version",
27
27
  "apiVersion",
28
28
  "entry",
29
- "capabilities",
30
29
  "name",
31
30
  "author",
32
31
  "punchline",
@@ -44,6 +43,11 @@ export const validVersion = (value) => typeof value === "string" &&
44
43
  value.length <= 32 &&
45
44
  VERSION.test(value) &&
46
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)';
47
51
  /** Problems with `manifest` (empty: valid) and hints that do not fail. */
48
52
  export function manifestProblems(manifest, directory) {
49
53
  const problems = [];
@@ -54,7 +58,9 @@ export function manifestProblems(manifest, directory) {
54
58
  Array.isArray(manifest))
55
59
  return { problems: ["manifest.json must be an object"], hints };
56
60
  for (const key of Object.keys(manifest))
57
- if (!MANIFEST_FIELDS.includes(key))
61
+ if (key === "capabilities")
62
+ problem(CAPABILITIES_REMOVED);
63
+ else if (!MANIFEST_FIELDS.includes(key))
58
64
  problem(`unknown field "${key}"`);
59
65
  const id = manifest.id;
60
66
  if (typeof id !== "string" ||
@@ -66,27 +72,6 @@ export function manifestProblems(manifest, directory) {
66
72
  hints.push(`id "${id}" has no prefix: the official repository needs <GitHub user or organization>.<plugin name>`);
67
73
  if (manifest.apiVersion !== API_VERSION)
68
74
  problem(`apiVersion is ${JSON.stringify(manifest.apiVersion)}; this SDK is ${API_VERSION}`);
69
- const capabilities = manifest.capabilities;
70
- if (!Array.isArray(capabilities))
71
- problem("capabilities must be an array");
72
- else {
73
- const unknown = capabilities.filter((c) => !CAPABILITIES.includes(c));
74
- if (unknown.length)
75
- problem(`unknown capabilities ${unknown.join(", ")}`);
76
- if (new Set(capabilities).size !== capabilities.length)
77
- problem("capabilities must be unique");
78
- // Only a built-in plugin may declare these. Built-in plugins have a
79
- // `vestra.` id, which the player refuses for any other package: any
80
- // other id is an error, a `vestra.` id a reminder.
81
- const builtinOnly = capabilities.filter((c) => CAPABILITY_INFO[c]?.builtinOnly);
82
- if (builtinOnly.length) {
83
- const text = `${builtinOnly.join(", ")}: built-in plugins only (the player refuses any other plugin that declares ${builtinOnly.length === 1 ? "it" : "them"}, and its calls fail with code capability)`;
84
- if (typeof id === "string" && /^vestra\./i.test(id))
85
- hints.push(text);
86
- else
87
- problem(text);
88
- }
89
- }
90
75
  if (typeof manifest.entry !== "string" || !relative(manifest.entry))
91
76
  problem("entry must be a relative path inside the package");
92
77
  if (manifest.version !== undefined && !validVersion(manifest.version))