@vestra-player/sdk 1.11.0 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.2
4
+
5
+ Additions and fixes only; nobody must change anything except a plugin test that relies on a host error the plugin does not handle (below).
6
+
7
+ - **Security fixes (CodeQL):** `vestra-plugin docs` path handling and the table rule parser no longer backtrack polynomially on long input; the manifest check opens each icon, readme and changelog file once and reads through that handle. Behaviour is unchanged.
8
+ - **Examples:** new screenshots (player 0.11.1); `three-ways` shows its speed as an adjust-column tab and cycles on S (the bottom bar belongs to the player's control bar; design rule "Not the bottom bar"); listeners before the first await in `adjust-panel` and `three-ways`; window items under `@tools`.
9
+ - **Repository:** CodeQL, Scorecard, osv-scanner, semgrep (examples) and dependency review in CI; SECURITY.md.
10
+
11
+
12
+ **Tests catch a control made with an old state** (the SDK's control semantics are unchanged). Since 1.11.0 a plugin that read the state once (`await player.read()`) and later pauses, seeks, steps or sets the speed sends the stamp of that copy (`expected`), and the player refuses it with `stale` once the user changed the source. Tests did not see it: no test changed the source between activation and a command, and a refusal the plugin left to its log passed. Who must change: a plugin test that relies on a host error the plugin does not handle (below).
13
+
14
+ - **`TestHost.strictErrors`** (new, default `true`): a host error the plugin logged because nothing handled it (no `try`/`catch`, no `plugin.onError`; also a failure the SDK reports beside a status, such as a shader or render failure) fails the test: the next `host.settle()` (and so `command(id).run()`) rejects with it, or else `stop()`, after its cleanup. The message names the error and says to call `host.expectError(code)`, or to set `strictErrors = false` to only log host errors as before. Errors logged while the plugin stops (`stop`, `park`, `disconnect`) only go to the log.
15
+ - **`TestHost.expectError(code)`** (new): expect one such error; one that never comes fails `stop()`. **`TestHost.loggedErrors`** (new) lists them all.
16
+ - The runtime tells `TestHost` of an error that reaches the plugin's log (`Connection.logged`, internal); the player's runner does not set it and logs as before.
17
+ - `TestHost.openElsewhere` says that it advances the source stamp as the player does, also for the path already open, and that a core action (`coreAction("play-pause").run()`) is a new intent.
18
+ - **Docs**: the testing guide's new section [Change the source in your tests](docs/guides/testing.md#change-the-source-in-your-tests) (the guide is now two pages; `docs-tree.test.ts` takes the page header), and the test host reference.
19
+ - **Golden traces** fail on a host error a scenario does not list (`KNOWN_ERRORS`): `examples/menus` and `examples/adjust-panel` list their `stale` (TODO: until the pending decision on the control semantics or a fix of the examples). The SDK's own tests of refusals expect theirs (`portability`, `round4a`, `video-primitives`).
20
+ - **Examples**: `menus`, `adjust-panel`, `three-ways` and `bookmark` run their controls after a file opened after activation, another file, the same file again and a pause. The ones the player refuses today are `todo` with a TODO: every speed of `menus`, `adjust-panel`'s Normal Speed with the column closed, and `three-ways`' Next Keyframe in styles A and B after a pause.
21
+
22
+ ## 1.11.1
23
+
24
+ **NVIDIA motion smoothing** (T8; needs player 0.11.1, which ships the NVIDIA engine). Additions only; nobody must change anything.
25
+
26
+ - `plugin.video.motion("nvidia")` is no longer reserved. The player's NVIDIA engine is FFmpeg's `fruc_vulkan` on the optical flow hardware of GeForce RTX 30 and newer GPUs (Windows, driver 573.38 or newer); an older player still answers `engine` for every mode. Docs: `MotionEngine`, `plugin.video.motion`, `VideoMotion`, `MotionState.searchMode` and the `MotionReasonCode` table (`engine`, `no-gpu` and `runtime` name NVIDIA's cases). **`other-engine`** (new reason code, user ruling T8): the other engine's converter is on for another plugin; one converter runs at a time, so the mode waits (not run-long; the message names the engine). It ships together with the player that reports it. **`TestHost.nvidiaMotion`** (new): NVIDIA's engine with the same model as `TestHost.motion`, its own state (defaults: both modes work, converting on an RTX 4070 Laptop GPU); one converter at a time as the player (the first engine set to a mode holds it, the other's modes report `other-engine`); `motionChanged()` sends each engine's state. `MotionReasonCode` gains `other-engine` (an addition); no other type changes; the reserved engine's model (`engine` for every mode) is gone from `TestHost`: **`TestHost`'s `nvidia` engine no longer answers `engine` by default** (both modes work, as `TestHost.motion`); a test that relied on `engine` sets `host.nvidiaMotion.double` / `.display` to an `engine` reason. Like the player, `TestHost` puts `other-engine` after the system, filter, renderer, AI upscaling and frame doubling reasons and before `failed`, `overload`, `rate`, `format` and `size`. The API surface snapshot gains `TestHost.nvidiaMotion`. Docs: the `overload` row of the `MotionReasonCode` table says that with software rendering the player's message names the CPU drawing the doubled frames (no type change).
27
+
3
28
  ## 1.11.0
4
29
 
5
30
  **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 plugin that calls `player.subscribe()` or `player.onChange()`, 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).
Binary file
package/dist/docs.js CHANGED
@@ -126,7 +126,16 @@ function distance(a, b) {
126
126
  }
127
127
  /** A path as typed: its segments and `#anchor`. */
128
128
  function parse(path) {
129
- let text = path.trim().replace(/^["'<]+|["'>]+$/g, "");
129
+ let text = path.trim();
130
+ // Quotes and <> around it go; a scan from each end, not a regular
131
+ // expression (`["'>]+$` can be quadratic on a long run of quotes).
132
+ let start = 0;
133
+ while (start < text.length && `"'<`.includes(text[start]))
134
+ start++;
135
+ let end = text.length;
136
+ while (end > start && `"'>`.includes(text[end - 1]))
137
+ end--;
138
+ text = text.slice(start, end);
130
139
  try {
131
140
  text = decodeURIComponent(text);
132
141
  }
@@ -247,7 +256,8 @@ const slug = (heading) => heading
247
256
  .replace(/[^\p{L}\p{N}\s_-]/gu, "")
248
257
  .replace(/\s/g, "-");
249
258
  const FENCE = /^\s*```/;
250
- const TABLE_RULE = /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/;
259
+ // No two `\s*` next to each other (`\s*\|?\s*` is quadratic on spaces).
260
+ const TABLE_RULE = /^\s*(?:\|\s*)?:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*(?:\|\s*)?$/;
251
261
  /**
252
262
  * Lines into pages: the first at most `first` bytes, the others `rest`.
253
263
  * A code fence cut by a page break is closed and opened again; a table's
package/dist/manifest.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * player's `src/host/src/packages/manifest.rs` (the player's tests compare the limits).
4
4
  * Paths in the manifest are checked against the plugin directory.
5
5
  */
6
- import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
6
+ import { closeSync, existsSync, fstatSync, openSync, readFileSync, realpathSync, } from "node:fs";
7
7
  import { join, sep } from "node:path";
8
8
  import { API_VERSION } from "./protocol.js";
9
9
  export const MANIFEST_LIMITS = Object.freeze({
@@ -140,19 +140,39 @@ export function manifestProblems(manifest, directory) {
140
140
  if (!extensions.some((x) => value.toLowerCase().endsWith(x)))
141
141
  return void problem(`${field} must be a ${extensions.join(" or ")} file`);
142
142
  const path = join(directory, value);
143
- if (!existsSync(path))
144
- return void problem(`${field} file ${value} is missing`);
145
143
  let real;
146
144
  try {
147
145
  real = realpathSync(path);
148
146
  }
149
147
  catch {
150
- return void problem(`${field} file ${value} is unreadable`);
148
+ return void problem(existsSync(path)
149
+ ? `${field} file ${value} is unreadable`
150
+ : `${field} file ${value} is missing`);
151
151
  }
152
152
  const root = realpathSync(directory);
153
- if (!real.startsWith(root + sep) || lstatSync(real).isDirectory())
154
- return void problem(`${field} must name a file inside the package`);
155
- const bytes = readFileSync(real);
153
+ const outside = () => void problem(`${field} must name a file inside the package`);
154
+ if (!real.startsWith(root + sep))
155
+ return outside();
156
+ // Opened once: the file checked (not a directory) is the file read,
157
+ // whatever happens to the path meanwhile.
158
+ let handle;
159
+ try {
160
+ handle = openSync(real, "r");
161
+ }
162
+ catch (error) {
163
+ if (error.code === "EISDIR")
164
+ return outside();
165
+ throw error;
166
+ }
167
+ let bytes;
168
+ try {
169
+ if (fstatSync(handle).isDirectory())
170
+ return outside();
171
+ bytes = readFileSync(handle);
172
+ }
173
+ finally {
174
+ closeSync(handle);
175
+ }
156
176
  if (bytes.length > max)
157
177
  return void problem(`${field} file exceeds ${max / 1024} KB`);
158
178
  return bytes;
@@ -105,6 +105,13 @@ export declare class Connection {
105
105
  * a listener), the log before.
106
106
  */
107
107
  reportMirror: (error: unknown) => void;
108
+ /**
109
+ * Told of every error that reaches the plugin's log because nothing in
110
+ * the plugin handled it (no `onError` listener). `TestHost` sets it to
111
+ * fail a test on a host error the test did not expect; the player's
112
+ * runner leaves it unset. The error is logged either way.
113
+ */
114
+ logged: ((error: unknown) => void) | undefined;
108
115
  /** The framework's ears ({@link StateSignals}); silent until `Runtime` sets them. */
109
116
  signals: StateSignals;
110
117
  /**
@@ -129,6 +129,13 @@ export class Connection {
129
129
  * a listener), the log before.
130
130
  */
131
131
  reportMirror = (error) => console.error(`[${this.manifest.id}]`, error);
132
+ /**
133
+ * Told of every error that reaches the plugin's log because nothing in
134
+ * the plugin handled it (no `onError` listener). `TestHost` sets it to
135
+ * fail a test on a host error the test did not expect; the player's
136
+ * runner leaves it unset. The error is logged either way.
137
+ */
138
+ logged = undefined;
132
139
  /** The framework's ears ({@link StateSignals}); silent until `Runtime` sets them. */
133
140
  signals = SILENT;
134
141
  /**
@@ -397,6 +397,7 @@ export class Passes {
397
397
  }
398
398
  catch (error) {
399
399
  console.error(`[${this.#connection.manifest.id}] binding failed:`, error);
400
+ this.#connection.logged?.(error);
400
401
  }
401
402
  finally {
402
403
  this.#pass = undefined;
@@ -189,8 +189,10 @@ export class ScopeImpl {
189
189
  }
190
190
  else if (this.#parent)
191
191
  this.#parent.report(coded);
192
- else
192
+ else {
193
193
  console.error(`[${this.id}]`, coded);
194
+ this.runtime.logged?.(coded);
195
+ }
194
196
  }
195
197
  /** Invoke plugin code on its behalf: report failures, then refresh bindings. */
196
198
  run(handler, ...args) {
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Host errors the plugin logged (SDK 1.11.2): a refusal or failure with a
3
+ * code (`HostError`, e.g. `stale`, `invalid`, `disabled`) that nothing in
4
+ * the plugin handled, so it reached the plugin's log, as the player's log
5
+ * would show it. Under `TestHost.strictErrors` (the default) such an error
6
+ * fails the test at the next `settle()` (also `command(…).run()`) or at
7
+ * `stop()`, unless the test expected it with `expectError(code)`.
8
+ *
9
+ * Part of `TestHost` (`./index.ts`). Internal to the SDK; not exported from
10
+ * `@vestra-player/sdk/testing`.
11
+ */
12
+ import { HostError } from "../../wire.ts";
13
+ import type { TestHost } from "./index.ts";
14
+ /** One host's book of logged errors and expectations. */
15
+ export declare class ErrorBook {
16
+ /** Every host error the plugin logged, expected or not, in order. */
17
+ readonly logged: HostError[];
18
+ /** Logged errors no expectation covered, not yet thrown. */
19
+ readonly unexpected: HostError[];
20
+ /** Codes the test expects, one entry per expected error. */
21
+ readonly expected: string[];
22
+ /** Above 0 while `startPlugin` itself settles (activation, `stop`, `park`). */
23
+ suspended: number;
24
+ }
25
+ /** The book of each host (`TestHost` makes it in its constructor). */
26
+ export declare const errorBooks: WeakMap<TestHost, ErrorBook>;
27
+ /**
28
+ * The runtime's `logged` hook (`Connection.logged`): note an error that
29
+ * reached the plugin's log. Errors without a code of the host's kind (a
30
+ * `TypeError` in the plugin's code) are not counted.
31
+ */
32
+ export declare function noteLogged(host: TestHost, error: unknown): void;
33
+ /**
34
+ * Throw the unexpected host errors logged since the last check, once
35
+ * (they are cleared), when the host is strict.
36
+ */
37
+ export declare function checkErrors(host: TestHost): void;
38
+ /** At `stop()`: the unexpected errors, then the expected ones that never came. */
39
+ export declare function checkErrorsAtStop(host: TestHost): void;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Host errors the plugin logged (SDK 1.11.2): a refusal or failure with a
3
+ * code (`HostError`, e.g. `stale`, `invalid`, `disabled`) that nothing in
4
+ * the plugin handled, so it reached the plugin's log, as the player's log
5
+ * would show it. Under `TestHost.strictErrors` (the default) such an error
6
+ * fails the test at the next `settle()` (also `command(…).run()`) or at
7
+ * `stop()`, unless the test expected it with `expectError(code)`.
8
+ *
9
+ * Part of `TestHost` (`./index.ts`). Internal to the SDK; not exported from
10
+ * `@vestra-player/sdk/testing`.
11
+ */
12
+ import { HostError } from "../../wire.js";
13
+ /** One host's book of logged errors and expectations. */
14
+ export class ErrorBook {
15
+ /** Every host error the plugin logged, expected or not, in order. */
16
+ logged = [];
17
+ /** Logged errors no expectation covered, not yet thrown. */
18
+ unexpected = [];
19
+ /** Codes the test expects, one entry per expected error. */
20
+ expected = [];
21
+ /** Above 0 while `startPlugin` itself settles (activation, `stop`, `park`). */
22
+ suspended = 0;
23
+ }
24
+ /** The book of each host (`TestHost` makes it in its constructor). */
25
+ export const errorBooks = new WeakMap();
26
+ /**
27
+ * The runtime's `logged` hook (`Connection.logged`): note an error that
28
+ * reached the plugin's log. Errors without a code of the host's kind (a
29
+ * `TypeError` in the plugin's code) are not counted.
30
+ */
31
+ export function noteLogged(host, error) {
32
+ const book = errorBooks.get(host);
33
+ if (!book || !(error instanceof HostError))
34
+ return;
35
+ book.logged.push(error);
36
+ const index = book.expected.indexOf(error.code);
37
+ if (index >= 0)
38
+ book.expected.splice(index, 1);
39
+ else
40
+ book.unexpected.push(error);
41
+ }
42
+ /** Why a host error fails a test, and how to expect it instead. */
43
+ function unexpectedMessage(host, errors) {
44
+ const lines = errors.map((error) => ` ${error.code}: ${error.message}`);
45
+ const code = errors[0].code;
46
+ return [
47
+ `${host.manifestId} logged ${errors.length === 1 ? "a host error" : `${errors.length} host errors`} the test did not expect:`,
48
+ ...lines,
49
+ `Nothing in the plugin handled ${errors.length === 1 ? "it" : "them"} (the player's log shows the same). If the test means it, call`,
50
+ `host.expectError(${JSON.stringify(code)}) before the step that causes it; host.strictErrors = false only logs host errors.`,
51
+ ].join("\n");
52
+ }
53
+ /**
54
+ * Throw the unexpected host errors logged since the last check, once
55
+ * (they are cleared), when the host is strict.
56
+ */
57
+ export function checkErrors(host) {
58
+ const book = errorBooks.get(host);
59
+ if (!book || book.suspended > 0 || !book.unexpected.length)
60
+ return;
61
+ const errors = book.unexpected.splice(0);
62
+ if (!host.strictErrors)
63
+ return;
64
+ const error = new Error(unexpectedMessage(host, errors));
65
+ error.cause = errors[0];
66
+ throw error;
67
+ }
68
+ /** At `stop()`: the unexpected errors, then the expected ones that never came. */
69
+ export function checkErrorsAtStop(host) {
70
+ checkErrors(host);
71
+ const book = errorBooks.get(host);
72
+ if (!book || !book.expected.length)
73
+ return;
74
+ const missing = book.expected.splice(0);
75
+ if (!host.strictErrors)
76
+ return;
77
+ throw new Error(`${host.manifestId}: the test expected ${missing.map((code) => `\`${code}\``).join(", ")} (host.expectError), but the plugin never logged ${missing.length === 1 ? "it" : "them"}`);
78
+ }
@@ -2293,11 +2293,39 @@ export declare class TestHost implements Transport {
2293
2293
  /** The converting GPU's name; `null`: none. */
2294
2294
  gpu: string | null;
2295
2295
  };
2296
+ /**
2297
+ * NVIDIA's engine behind `plugin.video.motion("nvidia")`: the same model
2298
+ * as {@link TestHost.motion} (AMD's), its own state, answered the same
2299
+ * way. The defaults are a player where both modes work on a 24 fps video
2300
+ * and a 60 Hz display, converting on an RTX 4070 Laptop GPU. One
2301
+ * converter at a time, as the player: the first engine set to a mode (or
2302
+ * preset to one, `amd` first) holds it while its mode is not `off`, and
2303
+ * the other engine's modes report `other-engine`, in the player's order:
2304
+ * a model's own run-long, renderer, `upscaling` or `doubling` reason
2305
+ * comes first, its `failed`, `overload`, `rate`, `format` or `size` after.
2306
+ * A test of "another plugin holds AMD's converter" sets
2307
+ * `host.motion.mode`.
2308
+ *
2309
+ * @example Test an NVIDIA plugin without an RTX 30 or newer GPU
2310
+ * The same reason on both modes is what the player answers there: the
2311
+ * plugin shows it and keeps the mode off, since `no-gpu` holds for the run.
2312
+ * ```ts
2313
+ * declare const host: TestHost;
2314
+ * // ---cut---
2315
+ * const reason = { code: "no-gpu", message: "no NVIDIA GPU" };
2316
+ * host.nvidiaMotion.double = reason;
2317
+ * host.nvidiaMotion.display = reason;
2318
+ * ```
2319
+ *
2320
+ * @since 1.11.1
2321
+ */
2322
+ readonly nvidiaMotion: TestHost["motion"];
2296
2323
  /**
2297
2324
  * Send `video.motion.changed` with the state {@link TestHost.motion}
2298
- * describes now (without `mode`), as the player does when it changes; a
2299
- * plugin listening with `plugin.video.motion("amd").onChange` receives it.
2300
- * Nothing reaches a plugin that does not listen.
2325
+ * describes now (without `mode`), and then the one of
2326
+ * {@link TestHost.nvidiaMotion}, as the player does when they change; a
2327
+ * plugin listening with `plugin.video.motion(engine).onChange` receives
2328
+ * its engine's. Nothing reaches a plugin that does not listen.
2301
2329
  *
2302
2330
  * @example The GPU fell behind
2303
2331
  * The player turned the converter off for this video; the plugin's
@@ -2716,6 +2744,17 @@ export declare class TestHost implements Transport {
2716
2744
  * `sourceId`, then the given phase. Calls the plugin made against the old
2717
2745
  * state now fail with `stale`.
2718
2746
  *
2747
+ * The source stamp advances exactly as in the player: a new generation
2748
+ * and a new intent, also when `source` is the path already open (the
2749
+ * user opened the same file again). Call it after `startPlugin` to test
2750
+ * what the user does while the plugin runs: a file opened after
2751
+ * activation, another file, the same one again. A control the plugin
2752
+ * then makes with the state it read before (`player.setRate`,
2753
+ * `seek`, `step`, …) is refused with `stale`, as in the player. The
2754
+ * user's own pause, seek or speed change is a core action
2755
+ * (`coreAction("play-pause").run()`): a new intent, which makes an older
2756
+ * state stale too. `setSource` changes the facts only.
2757
+ *
2719
2758
  * @param source - The path or URL.
2720
2759
  * @param phase - The phase to end in (default `"ready"`).
2721
2760
  *
@@ -3179,10 +3218,81 @@ export declare class TestHost implements Transport {
3179
3218
  * assert.equal(importWindow.props["status-text"], expected);
3180
3219
  * ```
3181
3220
  *
3182
- * @throws Never.
3221
+ * @throws `Error` (rejects) The plugin logged a host error the test did
3222
+ * not expect ({@link TestHost.strictErrors}, SDK 1.11.2); the message
3223
+ * names it and says how to expect it ({@link TestHost.expectError}).
3183
3224
  * @since 1.0.0
3184
3225
  */
3185
3226
  settle(ms?: number): Promise<void>;
3227
+ /**
3228
+ * Whether a host error the plugin logged fails the test (default `true`).
3229
+ * A host error is a refusal or failure with a code (`stale`, `invalid`,
3230
+ * `disabled`, …) that nothing in the plugin handled: no `try`/`catch`
3231
+ * around the call and no `plugin.onError` listener, so the player would
3232
+ * only write it to its log. The next {@link TestHost.settle} (so also
3233
+ * `command(…).run()`) rejects with it, or else `stop()`; the message
3234
+ * names the error and how to expect it. A test that means it calls
3235
+ * {@link TestHost.expectError} first. Set `false` to only log host
3236
+ * errors, as before SDK 1.11.2. {@link TestHost.loggedErrors} lists them
3237
+ * either way.
3238
+ *
3239
+ * @example Expect a refusal the plugin does not handle
3240
+ * The user opens another file, then runs a command that controls the
3241
+ * old one with a state the plugin read before: the player refuses it with
3242
+ * `stale`, and the plugin leaves the refusal to its log. The test says so
3243
+ * before it runs the command; without `expectError` the run rejects.
3244
+ * ```ts
3245
+ * declare const host: TestHost;
3246
+ * // ---cut---
3247
+ * host.openElsewhere("/media/other.mp4");
3248
+ * host.expectError("stale");
3249
+ * await host.command("rate-2").run();
3250
+ * ```
3251
+ *
3252
+ * @since 1.11.2
3253
+ */
3254
+ strictErrors: boolean;
3255
+ /**
3256
+ * Expect the plugin to log one host error with `code` (each call
3257
+ * expects one more). An expected error does not fail the test; one that
3258
+ * never comes fails `stop()` (under {@link TestHost.strictErrors}).
3259
+ *
3260
+ * @param code - The error's code, e.g. `"stale"`.
3261
+ *
3262
+ * @example A control after the user changed the source
3263
+ * The plugin read the state once and sets the speed with its old copy;
3264
+ * after the user opened another file the player refuses the control.
3265
+ * ```ts
3266
+ * import assert from "node:assert/strict";
3267
+ * declare const host: TestHost;
3268
+ * // ---cut---
3269
+ * host.openElsewhere("/media/other.mp4");
3270
+ * host.expectError("stale");
3271
+ * await host.command("rate-2").run();
3272
+ * assert.equal(host.loggedErrors.at(-1)?.code, "stale");
3273
+ * ```
3274
+ *
3275
+ * @since 1.11.2
3276
+ */
3277
+ expectError(code: string): void;
3278
+ /**
3279
+ * Every host error the plugin logged (expected or not), oldest first:
3280
+ * errors with a code that nothing in the plugin handled.
3281
+ *
3282
+ * @example Check that nothing was refused
3283
+ * The test asserts that the plugin left no refusal to its log. The list
3284
+ * keeps every host error the plugin did not handle, also those the test
3285
+ * expected with `expectError`, so it is empty only when none came.
3286
+ * ```ts
3287
+ * import assert from "node:assert/strict";
3288
+ * declare const host: TestHost;
3289
+ * // ---cut---
3290
+ * assert.deepEqual(host.loggedErrors.map((error) => error.code), []);
3291
+ * ```
3292
+ *
3293
+ * @since 1.11.2
3294
+ */
3295
+ get loggedErrors(): readonly HostError[];
3186
3296
  /**
3187
3297
  * Close the fake stream servers and delete the host's temporary
3188
3298
  * directories. `stop()` from {@link startPlugin} calls it. It never
@@ -87,6 +87,7 @@ import { LOCALES, LIST_SEPARATORS, loadPackageCatalog, TEXT_LIMITS, } from "../.
87
87
  import { Internals } from "./internals.js";
88
88
  import { sendFacts } from "./facts.js";
89
89
  import { revokeRun, revokers } from "./revoke.js";
90
+ import { checkErrors, checkErrorsAtStop, ErrorBook, errorBooks, noteLogged, } from "./errors.js";
90
91
  import { on, emit, settle, close, keepsRunning, transportHandlers, tick, takenErrors, tellResidency, } from "./transport.js";
91
92
  import { bindingClaims, bindingKey, keysChanged, press, barButtons, commandsHandlers, builtinHandlers, runPaletteLead, } from "./commands.js";
92
93
  import { registerCoreActions, windowFacts, coreActionsHandlers, } from "./core-actions.js";
@@ -1780,11 +1781,49 @@ export class TestHost {
1780
1781
  displayFps: 60,
1781
1782
  gpu: "AMD Radeon 780M Graphics",
1782
1783
  };
1784
+ /**
1785
+ * NVIDIA's engine behind `plugin.video.motion("nvidia")`: the same model
1786
+ * as {@link TestHost.motion} (AMD's), its own state, answered the same
1787
+ * way. The defaults are a player where both modes work on a 24 fps video
1788
+ * and a 60 Hz display, converting on an RTX 4070 Laptop GPU. One
1789
+ * converter at a time, as the player: the first engine set to a mode (or
1790
+ * preset to one, `amd` first) holds it while its mode is not `off`, and
1791
+ * the other engine's modes report `other-engine`, in the player's order:
1792
+ * a model's own run-long, renderer, `upscaling` or `doubling` reason
1793
+ * comes first, its `failed`, `overload`, `rate`, `format` or `size` after.
1794
+ * A test of "another plugin holds AMD's converter" sets
1795
+ * `host.motion.mode`.
1796
+ *
1797
+ * @example Test an NVIDIA plugin without an RTX 30 or newer GPU
1798
+ * The same reason on both modes is what the player answers there: the
1799
+ * plugin shows it and keeps the mode off, since `no-gpu` holds for the run.
1800
+ * ```ts
1801
+ * declare const host: TestHost;
1802
+ * // ---cut---
1803
+ * const reason = { code: "no-gpu", message: "no NVIDIA GPU" };
1804
+ * host.nvidiaMotion.double = reason;
1805
+ * host.nvidiaMotion.display = reason;
1806
+ * ```
1807
+ *
1808
+ * @since 1.11.1
1809
+ */
1810
+ nvidiaMotion = {
1811
+ mode: "off",
1812
+ double: null,
1813
+ display: null,
1814
+ renderingStarting: false,
1815
+ sourceFps: 24,
1816
+ outputFps: null,
1817
+ performance: false,
1818
+ displayFps: 60,
1819
+ gpu: "NVIDIA GeForce RTX 4070 Laptop GPU",
1820
+ };
1783
1821
  /**
1784
1822
  * Send `video.motion.changed` with the state {@link TestHost.motion}
1785
- * describes now (without `mode`), as the player does when it changes; a
1786
- * plugin listening with `plugin.video.motion("amd").onChange` receives it.
1787
- * Nothing reaches a plugin that does not listen.
1823
+ * describes now (without `mode`), and then the one of
1824
+ * {@link TestHost.nvidiaMotion}, as the player does when they change; a
1825
+ * plugin listening with `plugin.video.motion(engine).onChange` receives
1826
+ * its engine's. Nothing reaches a plugin that does not listen.
1788
1827
  *
1789
1828
  * @example The GPU fell behind
1790
1829
  * The player turned the converter off for this video; the plugin's
@@ -1802,8 +1841,10 @@ export class TestHost {
1802
1841
  motionChanged() {
1803
1842
  if (!this.subscriptions.has("video.motion.changed"))
1804
1843
  return;
1805
- const { mode: _, ...state } = motionState(this);
1806
- this.emit("video.motion.changed", state);
1844
+ for (const engine of ["amd", "nvidia"]) {
1845
+ const { mode: _, ...state } = motionState(this, engine);
1846
+ this.emit("video.motion.changed", state);
1847
+ }
1807
1848
  }
1808
1849
  /** What `player.chapters()` lists while media is ready. */
1809
1850
  chapters = [];
@@ -1833,6 +1874,7 @@ export class TestHost {
1833
1874
  */
1834
1875
  constructor() {
1835
1876
  revokers.set(this, (reason) => this.#revoke(reason));
1877
+ errorBooks.set(this, new ErrorBook());
1836
1878
  this.subtitles = {
1837
1879
  presentation: {
1838
1880
  revision: 1,
@@ -2270,6 +2312,17 @@ export class TestHost {
2270
2312
  * `sourceId`, then the given phase. Calls the plugin made against the old
2271
2313
  * state now fail with `stale`.
2272
2314
  *
2315
+ * The source stamp advances exactly as in the player: a new generation
2316
+ * and a new intent, also when `source` is the path already open (the
2317
+ * user opened the same file again). Call it after `startPlugin` to test
2318
+ * what the user does while the plugin runs: a file opened after
2319
+ * activation, another file, the same one again. A control the plugin
2320
+ * then makes with the state it read before (`player.setRate`,
2321
+ * `seek`, `step`, …) is refused with `stale`, as in the player. The
2322
+ * user's own pause, seek or speed change is a core action
2323
+ * (`coreAction("play-pause").run()`): a new intent, which makes an older
2324
+ * state stale too. `setSource` changes the facts only.
2325
+ *
2273
2326
  * @param source - The path or URL.
2274
2327
  * @param phase - The phase to end in (default `"ready"`).
2275
2328
  *
@@ -2750,11 +2803,87 @@ export class TestHost {
2750
2803
  * assert.equal(importWindow.props["status-text"], expected);
2751
2804
  * ```
2752
2805
  *
2753
- * @throws Never.
2806
+ * @throws `Error` (rejects) The plugin logged a host error the test did
2807
+ * not expect ({@link TestHost.strictErrors}, SDK 1.11.2); the message
2808
+ * names it and says how to expect it ({@link TestHost.expectError}).
2754
2809
  * @since 1.0.0
2755
2810
  */
2756
- settle(ms = 0) {
2757
- return settle(this, this.#inner, ms);
2811
+ async settle(ms = 0) {
2812
+ await settle(this, this.#inner, ms);
2813
+ checkErrors(this);
2814
+ }
2815
+ /**
2816
+ * Whether a host error the plugin logged fails the test (default `true`).
2817
+ * A host error is a refusal or failure with a code (`stale`, `invalid`,
2818
+ * `disabled`, …) that nothing in the plugin handled: no `try`/`catch`
2819
+ * around the call and no `plugin.onError` listener, so the player would
2820
+ * only write it to its log. The next {@link TestHost.settle} (so also
2821
+ * `command(…).run()`) rejects with it, or else `stop()`; the message
2822
+ * names the error and how to expect it. A test that means it calls
2823
+ * {@link TestHost.expectError} first. Set `false` to only log host
2824
+ * errors, as before SDK 1.11.2. {@link TestHost.loggedErrors} lists them
2825
+ * either way.
2826
+ *
2827
+ * @example Expect a refusal the plugin does not handle
2828
+ * The user opens another file, then runs a command that controls the
2829
+ * old one with a state the plugin read before: the player refuses it with
2830
+ * `stale`, and the plugin leaves the refusal to its log. The test says so
2831
+ * before it runs the command; without `expectError` the run rejects.
2832
+ * ```ts
2833
+ * declare const host: TestHost;
2834
+ * // ---cut---
2835
+ * host.openElsewhere("/media/other.mp4");
2836
+ * host.expectError("stale");
2837
+ * await host.command("rate-2").run();
2838
+ * ```
2839
+ *
2840
+ * @since 1.11.2
2841
+ */
2842
+ strictErrors = true;
2843
+ /**
2844
+ * Expect the plugin to log one host error with `code` (each call
2845
+ * expects one more). An expected error does not fail the test; one that
2846
+ * never comes fails `stop()` (under {@link TestHost.strictErrors}).
2847
+ *
2848
+ * @param code - The error's code, e.g. `"stale"`.
2849
+ *
2850
+ * @example A control after the user changed the source
2851
+ * The plugin read the state once and sets the speed with its old copy;
2852
+ * after the user opened another file the player refuses the control.
2853
+ * ```ts
2854
+ * import assert from "node:assert/strict";
2855
+ * declare const host: TestHost;
2856
+ * // ---cut---
2857
+ * host.openElsewhere("/media/other.mp4");
2858
+ * host.expectError("stale");
2859
+ * await host.command("rate-2").run();
2860
+ * assert.equal(host.loggedErrors.at(-1)?.code, "stale");
2861
+ * ```
2862
+ *
2863
+ * @since 1.11.2
2864
+ */
2865
+ expectError(code) {
2866
+ errorBooks.get(this).expected.push(code);
2867
+ }
2868
+ /**
2869
+ * Every host error the plugin logged (expected or not), oldest first:
2870
+ * errors with a code that nothing in the plugin handled.
2871
+ *
2872
+ * @example Check that nothing was refused
2873
+ * The test asserts that the plugin left no refusal to its log. The list
2874
+ * keeps every host error the plugin did not handle, also those the test
2875
+ * expected with `expectError`, so it is empty only when none came.
2876
+ * ```ts
2877
+ * import assert from "node:assert/strict";
2878
+ * declare const host: TestHost;
2879
+ * // ---cut---
2880
+ * assert.deepEqual(host.loggedErrors.map((error) => error.code), []);
2881
+ * ```
2882
+ *
2883
+ * @since 1.11.2
2884
+ */
2885
+ get loggedErrors() {
2886
+ return errorBooks.get(this).logged;
2758
2887
  }
2759
2888
  /**
2760
2889
  * Close the fake stream servers and delete the host's temporary
@@ -3108,6 +3237,8 @@ export async function startPlugin(activate, options = {}) {
3108
3237
  // Unlike the player's runner, which logs a refused command declaration
3109
3238
  // and activates the rest: a plugin's tests show the refusal.
3110
3239
  { strictDeclarations: true });
3240
+ // Host errors nothing in the plugin handled (`TestHost.strictErrors`).
3241
+ started.plugin.runtime.logged = (error) => noteLogged(host, error);
3111
3242
  await started.activate(entry);
3112
3243
  // Like the player: a position or resolver another plugin holds is not an
3113
3244
  // activation failure.
@@ -3123,22 +3254,44 @@ export async function startPlugin(activate, options = {}) {
3123
3254
  }
3124
3255
  return started;
3125
3256
  };
3126
- let instance = await run(activate);
3257
+ // Its own waits never throw a logged host error: activation's surfaces
3258
+ // at the test's next `settle()`; one logged while the run stops (a
3259
+ // request refused with `disabled` once `runtime.stop` went out) is the
3260
+ // stop's own and only logged.
3261
+ const book = errorBooks.get(host);
3262
+ const quietly = async (work) => {
3263
+ book.suspended++;
3264
+ try {
3265
+ await work();
3266
+ }
3267
+ finally {
3268
+ book.suspended--;
3269
+ }
3270
+ };
3271
+ const stopping = async (work) => {
3272
+ const before = book.unexpected.length;
3273
+ await quietly(work);
3274
+ book.unexpected.splice(before);
3275
+ };
3276
+ let instance;
3277
+ await quietly(async () => {
3278
+ instance = await run(activate);
3279
+ });
3127
3280
  const triggers = triggerState(host);
3128
3281
  let code = activate;
3129
- triggers.start = async (entry) => {
3282
+ triggers.start = (entry) => quietly(async () => {
3130
3283
  if (entry)
3131
3284
  code = entry;
3132
3285
  instance = await run(code);
3133
- };
3134
- triggers.stop = async (reason) => {
3286
+ });
3287
+ triggers.stop = (reason) => stopping(async () => {
3135
3288
  await instance.dispose({ reason });
3136
3289
  await host.settle();
3137
3290
  // Standby and an upgrade stop the run: the player revokes what it held.
3138
3291
  revokeRun(host, reason);
3139
3292
  await host.settle();
3140
- };
3141
- await host.settle();
3293
+ });
3294
+ await quietly(() => host.settle());
3142
3295
  tellResidency(host);
3143
3296
  // Zero declared parameters (`stop.length === 0`) and a `()` overload, so
3144
3297
  // `t.after(stop)`, `promise.then(stop)` and done-callback test runners
@@ -3154,14 +3307,19 @@ export async function startPlugin(activate, options = {}) {
3154
3307
  const quit = reason === "quit" ? quitEvent(host.source) : null;
3155
3308
  if (quit) {
3156
3309
  host.emit("source.ended", structuredClone(quit));
3157
- await host.settle();
3310
+ await quietly(() => host.settle());
3158
3311
  }
3159
- if (!triggers.parked)
3160
- await instance.dispose({ reason });
3161
- await host.settle();
3162
- revokeRun(host, typeof reason === "string" ? reason : undefined);
3163
- await host.settle();
3312
+ await stopping(async () => {
3313
+ if (!triggers.parked)
3314
+ await instance.dispose({ reason });
3315
+ await host.settle();
3316
+ revokeRun(host, typeof reason === "string" ? reason : undefined);
3317
+ await host.settle();
3318
+ });
3164
3319
  host.close();
3320
+ // After the cleanup: a host error the test did not expect, or one it
3321
+ // expected that never came, fails the test here.
3322
+ checkErrorsAtStop(host);
3165
3323
  };
3166
3324
  return {
3167
3325
  /** The test host the plugin talks to. */
@@ -3185,11 +3343,14 @@ export async function startPlugin(activate, options = {}) {
3185
3343
  */
3186
3344
  async disconnect() {
3187
3345
  host.loseConnection();
3188
- await instance.dispose({ reason: "host-lost" });
3189
- await host.settle();
3190
- revokeRun(host, "host-lost");
3191
- await host.settle();
3346
+ await stopping(async () => {
3347
+ await instance.dispose({ reason: "host-lost" });
3348
+ await host.settle();
3349
+ revokeRun(host, "host-lost");
3350
+ await host.settle();
3351
+ });
3192
3352
  host.close();
3353
+ checkErrorsAtStop(host);
3193
3354
  },
3194
3355
  };
3195
3356
  }
@@ -52,6 +52,7 @@ export declare function failVideoRender(host: TestHost, _inner: Internals, code:
52
52
  export declare function failVideoShaders(host: TestHost, _inner: Internals, id: string, message: string, code?: "failed" | "previous-crash"): void;
53
53
  /** Implements `TestHost.upscalingDecoding`. */
54
54
  export declare function upscalingDecoding(host: TestHost, _inner: Internals, cause: UpscalingDecodingCause, plugins?: readonly UpscalingPlugin[]): UpscalingReason;
55
- export declare function motionState(host: TestHost): WireMotionState;
55
+ /** `video.motion.state` of an engine from its model (`amd` by default). */
56
+ export declare function motionState(host: TestHost, engine?: "amd" | "nvidia"): WireMotionState;
56
57
  /** The default handlers of this area's wire methods, by method name. */
57
58
  export declare function processingHandlers(host: TestHost, inner: Internals): Record<string, Handler>;
@@ -247,54 +247,73 @@ export function upscalingDecoding(host, _inner, cause, plugins = []) {
247
247
  host.upscaling.hwdecCurrent = current;
248
248
  return reason;
249
249
  }
250
- /** `video.motion.state` from {@link TestHost.motion}. */
251
- /** The player's message for the reserved engine (as playback/motion.rs). */
252
- const NO_NVIDIA = {
253
- code: "engine",
254
- message: "this player has no NVIDIA frame-rate converter; motion smoothing works with AMD's (engine amd)",
255
- };
256
- /** `video.motion.state` of the reserved `nvidia` engine: every mode `engine`. */
257
- function nvidiaState(host) {
258
- return {
259
- engine: "nvidia",
260
- mode: "off",
261
- active: "off",
262
- double: { ...NO_NVIDIA },
263
- display: { ...NO_NVIDIA },
264
- searchMode: null,
265
- sourceFps: host.motion.sourceFps,
266
- outputFps: null,
267
- displayFps: host.motion.displayFps,
268
- gpu: null,
269
- inChain: false,
270
- };
271
- }
272
250
  /** The engine a request names, checked as the player does. */
273
251
  function engineOf(p) {
274
252
  if (p.engine !== "amd" && p.engine !== "nvidia")
275
253
  throw new HostError("invalid", 'engine must be "amd" or "nvidia"');
276
254
  return p.engine;
277
255
  }
278
- export function motionState(host) {
279
- const { mode, double, display, sourceFps, displayFps, gpu } = host.motion;
256
+ /** The model of an engine: {@link TestHost.motion} (`amd`) or {@link TestHost.nvidiaMotion}. */
257
+ function modelOf(host, engine) {
258
+ return engine === "amd" ? host.motion : host.nvidiaMotion;
259
+ }
260
+ /** The engine whose converter is in the chain, as the player keeps it: the first one set to a mode, while its mode is not `off`. */
261
+ const motionHolder = new WeakMap();
262
+ /** Which engine holds the converter now: the one recorded while it is on, else the first that is on (`amd` first). */
263
+ function holderOf(host) {
264
+ const on = (engine) => modelOf(host, engine).mode !== "off";
265
+ const recorded = motionHolder.get(host);
266
+ if (recorded && on(recorded))
267
+ return recorded;
268
+ const next = on("amd") ? "amd" : on("nvidia") ? "nvidia" : null;
269
+ if (next)
270
+ motionHolder.set(host, next);
271
+ else
272
+ motionHolder.delete(host);
273
+ return next;
274
+ }
275
+ /** The player's message while the other engine holds the converter (as playback/motion.rs). */
276
+ function otherEngine(holder) {
277
+ const vendor = holder === "amd" ? "AMD" : "NVIDIA";
278
+ return {
279
+ code: "other-engine",
280
+ message: `${vendor} motion smoothing is on (another plugin); one converter runs at a time, so this waits until it is off`,
281
+ };
282
+ }
283
+ /**
284
+ * The reasons the player checks after the other engine holding the
285
+ * converter (playback/motion.rs `check`: the system, the filter, the
286
+ * renderer, AI upscaling and frame doubling come first; then
287
+ * `other-engine`; then these).
288
+ */
289
+ const AFTER_OTHER_ENGINE = ["failed", "overload", "rate", "format", "size"];
290
+ /** `video.motion.state` of an engine from its model (`amd` by default). */
291
+ export function motionState(host, engine = "amd") {
292
+ const model = modelOf(host, engine);
293
+ const { mode, sourceFps, displayFps, gpu } = model;
294
+ // The model's reason and the other engine holding the converter, in the
295
+ // player's order.
296
+ const holder = holderOf(host);
297
+ const waits = holder !== null && holder !== engine ? otherEngine(holder) : null;
298
+ const first = (own) => own === null || (waits !== null && AFTER_OTHER_ENGINE.includes(own.code))
299
+ ? (waits ?? own)
300
+ : own;
301
+ const double = first(model.double);
302
+ const display = first(model.display);
280
303
  const reasonOf = (wanted) => wanted === "double" ? double : wanted === "display" ? display : null;
281
304
  const works = mode !== "off" && reasonOf(mode) === null && sourceFps !== null;
282
305
  const active = works ? mode : "off";
283
306
  const copy = (reason) => reason ? structuredClone(reason) : null;
284
307
  return {
285
- engine: "amd",
308
+ engine,
286
309
  mode,
287
310
  active,
288
311
  double: copy(double),
289
312
  display: copy(display),
290
- searchMode: works
291
- ? host.motion.performance
292
- ? "performance"
293
- : "native"
294
- : null,
313
+ searchMode: works ? (model.performance ? "performance" : "native") : null,
295
314
  sourceFps,
296
315
  outputFps: works
297
- ? (host.motion.outputFps ?? Math.round(sourceFps * 20) / 10)
316
+ ? (model.outputFps ?? Math.round(sourceFps * 20) / 10)
298
317
  : null,
299
318
  displayFps,
300
319
  gpu,
@@ -356,25 +375,25 @@ export function processingHandlers(host, inner) {
356
375
  return upscalingState(host, inner);
357
376
  },
358
377
  // As the player 0.8.1 (see TestHost.motion for the model).
359
- "video.motion.state": (p) => engineOf(p) === "amd" ? motionState(host) : nvidiaState(host),
378
+ "video.motion.state": (p) => motionState(host, engineOf(p)),
360
379
  "video.motion.set": (p) => {
361
380
  const engine = engineOf(p);
362
381
  const mode = p.mode;
363
382
  if (mode !== "off" && mode !== "double" && mode !== "display")
364
383
  throw new HostError("invalid", 'mode must be "off", "double" or "display"');
365
- if (engine === "nvidia") {
366
- if (mode !== "off")
367
- throw new HostError("unsupported", `motion smoothing cannot work here: ${NO_NVIDIA.message}`);
368
- return nvidiaState(host);
369
- }
384
+ const model = modelOf(host, engine);
370
385
  if (mode !== "off") {
371
- const reason = host.motion[mode];
372
- const passes = reason?.code === "rendering" && host.motion.renderingStarting;
386
+ const reason = model[mode];
387
+ const passes = reason?.code === "rendering" && model.renderingStarting;
373
388
  if (reason && MOTION_FIXED.includes(reason.code) && !passes)
374
389
  throw new HostError("unsupported", `motion smoothing cannot work here: ${reason.message}`);
375
390
  }
376
- host.motion.mode = mode;
377
- return motionState(host);
391
+ model.mode = mode;
392
+ // The first engine set to a mode holds the converter while it is on.
393
+ if (mode !== "off" && holderOf(host) === null)
394
+ motionHolder.set(host, engine);
395
+ holderOf(host);
396
+ return motionState(host, engine);
378
397
  },
379
398
  "video.view.set": (p) => {
380
399
  const owner = host.videoView.owner;
@@ -282,8 +282,9 @@ export interface Scope extends Disposable {
282
282
  readonly upscaling: VideoUpscaling;
283
283
  /**
284
284
  * Motion smoothing with one GPU vendor's frame-rate converter: whether it works here and why not, and this
285
- * plugin's mode. `amd` is AMD AMF's on Windows; `nvidia` is reserved
286
- * (every mode reports `engine` until a player has it).
285
+ * plugin's mode. `amd` is AMD AMF's on Windows; `nvidia` is NVIDIA's
286
+ * (FFmpeg's `fruc_vulkan`, GeForce RTX 30 and newer, on Windows; an
287
+ * older player reports `engine` for every mode).
287
288
  *
288
289
  * @param engine - The converter: `"amd"` or `"nvidia"`.
289
290
  * @returns A {@link VideoMotion} for that converter.
@@ -1074,12 +1074,12 @@ export interface Player {
1074
1074
  *
1075
1075
  *
1076
1076
  * @example Push the speed to a panel as it changes
1077
- * A bottom panel shows the playback speed. The listener gets each
1077
+ * A tab in the adjust column shows the playback speed. The listener gets each
1078
1078
  * `source.state` event's data and writes the text with `set`; no update
1079
1079
  * pass runs and the SDK keeps no copy of the state for this.
1080
1080
  * ```ts
1081
- * const bar = plugin.panels.mount("bottom", "ui/bar.slint");
1082
- * plugin.player.on("source.state", (s) => bar.set({ rate: `${s.rate.toFixed(2)}×` }));
1081
+ * const panel = plugin.panels.mount("adjust", "ui/speed.slint", { title: "Speed" });
1082
+ * plugin.player.on("source.state", (s) => panel.set({ rate: `${s.rate.toFixed(2)}×` }));
1083
1083
  * ```
1084
1084
  *
1085
1085
  * @see [Tutorial](../../../docs/tutorial/index.md)
@@ -36,13 +36,13 @@ import type { View } from "./ui-content.ts";
36
36
  * [Events](../../../docs/reference/events.md).
37
37
  *
38
38
  * @example Show the speed with direct messages
39
- * A bottom panel shows the playback speed, written by the plugin itself
39
+ * A tab in the adjust column shows the playback speed, written by the plugin itself
40
40
  * from the raw `source.state` event. The listener types the payload, which
41
- * is `unknown` here, and `view(bar).write` sends the text as a property
41
+ * is `unknown` here, and `view(panel).write` sends the text as a property
42
42
  * write; the SDK keeps no copy of the state and compares nothing.
43
43
  * ```ts
44
- * const bar = plugin.panels.mount("bottom", "ui/bar.slint");
45
- * const view = plugin.wire.view(bar);
44
+ * const panel = plugin.panels.mount("adjust", "ui/speed.slint", { title: "Speed" });
45
+ * const view = plugin.wire.view(panel);
46
46
  * plugin.wire.on("source.state", (data) => {
47
47
  * const s = data as { rate: number }; // the plugin types the payload
48
48
  * void view.write("rate", { value: `${s.rate.toFixed(2)}×` });
@@ -91,12 +91,12 @@ export interface Wire {
91
91
  * @throws `disabled` (rejects) The plugin is stopping.
92
92
  *
93
93
  * @example Write a panel property without the SDK
94
- * The plugin's bottom panel shows "1.00×" in its `rate` property, written
94
+ * The plugin's adjust tab shows "1.00×" in its `rate` property, written
95
95
  * with the player's own request. The parameters are the protocol's
96
96
  * (`property`, `value`); the player checks the value.
97
97
  * ```ts
98
- * const bar = plugin.panels.mount("bottom", "ui/bar.slint");
99
- * await bar.ready;
98
+ * const panel = plugin.panels.mount("adjust", "ui/speed.slint", { title: "Speed" });
99
+ * await panel.ready;
100
100
  * await plugin.wire.request("ui.setMount", { property: "rate", value: "1.00×" });
101
101
  * ```
102
102
  *
@@ -266,9 +266,9 @@ export interface WireView {
266
266
  * plugin's own loop. The write goes out at once; if the player is still
267
267
  * busy with the previous one, only the newest count waits.
268
268
  * ```ts
269
- * const bar = plugin.panels.mount("bottom", "ui/bar.slint");
270
- * await bar.ready;
271
- * const view = plugin.wire.view(bar);
269
+ * const panel = plugin.panels.mount("sidebar", "ui/counter.slint", { title: "Frames" });
270
+ * await panel.ready;
271
+ * const view = plugin.wire.view(panel);
272
272
  * let frames = 0;
273
273
  * const tick = setInterval(() => void view.write("frames", { value: ++frames }), 100); // newest waits
274
274
  * plugin.onDispose(() => clearInterval(tick));
@@ -929,9 +929,12 @@ export interface VideoUpscaling {
929
929
  }
930
930
  /**
931
931
  * A GPU vendor's frame-rate converter for motion smoothing: `amd` (AMD
932
- * AMF's, on Windows with an AMD Radeon GPU); `nvidia` is reserved for
933
- * NVIDIA's converter, which no player has yet (every mode reports
934
- * `engine`). Each vendor's motion smoothing is its own plugin.
932
+ * AMF's, on Windows with an AMD Radeon GPU) and `nvidia` (FFmpeg's
933
+ * `fruc_vulkan` on the optical flow hardware of NVIDIA GeForce RTX 30 and
934
+ * newer GPUs, on Windows with driver 573.38 or newer; a player before it
935
+ * reports `engine` for every mode). Each vendor's motion smoothing is its
936
+ * own plugin. One converter runs at a time: while one engine's is on for
937
+ * some plugin, the other engine's modes report `other-engine` and wait.
935
938
  *
936
939
  * @player 0.8.1
937
940
  * @since 1.7.19
@@ -958,16 +961,17 @@ export type MotionMode = "off" | "double" | "display";
958
961
  *
959
962
  * | Code | Meaning |
960
963
  * | --- | --- |
961
- * | `engine` | The player has no converter of this engine (`nvidia`, until a player has it). |
964
+ * | `engine` | The player has no converter of this engine on this system (`nvidia` on a player before it). |
962
965
  * | `platform` | The player has no frame-rate converter on this system (macOS, Linux). |
963
- * | `no-gpu` | No GPU with a frame-rate converter (Windows: no AMD Radeon GPU). |
964
- * | `runtime` | The GPU's runtime is missing (Windows: AMD's AMF runtime, installed with the AMD driver), or the converter failed to start the same way on two videos in this run (an older GPU AMF does not serve). |
966
+ * | `no-gpu` | No GPU with this engine's converter (Windows: no AMD Radeon GPU; no NVIDIA GeForce RTX 30 or newer GPU). |
967
+ * | `runtime` | The GPU's runtime is missing or too old (Windows: AMD's AMF runtime, installed with the AMD driver; an NVIDIA driver before 573.38), or the converter cannot start on this system (AMD: it failed to start the same way on two videos in this run, an older GPU AMF does not serve; NVIDIA: no Vulkan device or optical flow from the driver, at the first try). |
965
968
  * | `filter` | The player's video library has no frame-rate converter (a player built without it). |
966
969
  * | `rendering` | Match Display only: the player renders in software, or GPU rendering is still starting ({@link Rendering}). |
967
970
  * | `upscaling` | AI upscaling is on ({@link VideoUpscaling}); the two cannot run together. |
968
971
  * | `doubling` | A plugin's video filter already raises the frame rate (a `frameBlend` node, such as Frame Doubling); the two cannot run together. |
972
+ * | `other-engine` | The other engine's converter is on for another plugin (the message names it); one converter runs at a time, so this waits until that one is off. |
969
973
  * | `failed` | The converter stopped on this video; the message has its error. The next video tries again. |
970
- * | `overload` | The GPU could not keep up with this video, even with the faster motion search. The next video tries again. |
974
+ * | `overload` | The output could not keep up with this video: the GPU, even with the faster motion search, or, with software rendering, the CPU drawing the doubled frames (the message says which, and that GPU Rendering helps then). The next video tries again. |
971
975
  * | `rate` | The converter's input rate ({@link MotionState.sourceFps}: 25i deinterlaced by field reads 50) does not fit: outside 10–30 fps (the rates measured), doubled above the display's refresh rate, or (software rendering, Double) twice it is not the display's rate. |
972
976
  * | `format` | The video's format was not measured: 10-bit or deeper, or HDR. |
973
977
  * | `size` | The video is too large for this mode on this renderer: its width × height × the doubled rate is more than the player measured it keeps up with (on the reference laptop: software rendering up to 1080p at 30 fps, GPU rendering's Double up to 4K at 24 fps, Match Display up to 1080p on a 60 Hz display, counted at the display's refresh rate). The next video may fit. |
@@ -995,7 +999,7 @@ export type MotionMode = "off" | "double" | "display";
995
999
  * @since 1.7.19
996
1000
  * @category Processing
997
1001
  */
998
- export type MotionReasonCode = "engine" | "platform" | "no-gpu" | "runtime" | "filter" | "rendering" | "upscaling" | "doubling" | "failed" | "overload" | "rate" | "format" | "size" | (string & {});
1002
+ export type MotionReasonCode = "engine" | "platform" | "no-gpu" | "runtime" | "filter" | "rendering" | "upscaling" | "doubling" | "other-engine" | "failed" | "overload" | "rate" | "format" | "size" | (string & {});
999
1003
  /**
1000
1004
  * Why a motion smoothing mode does not work: a stable
1001
1005
  * {@link MotionReasonCode} to branch on and a sentence to show, the same
@@ -1060,9 +1064,11 @@ export interface MotionState {
1060
1064
  /** Why Match Display cannot work now; `null` while it can. */
1061
1065
  readonly display: MotionReason | null;
1062
1066
  /**
1063
- * The converter's motion search while it runs: `native` on the full
1064
- * frames, `performance` on downscaled ones (the first step when the GPU
1065
- * falls behind); `null` while off.
1067
+ * The converter's motion search while it runs: `native`, the player's
1068
+ * setting for this video, or `performance`, the faster one (the first
1069
+ * step when the GPU falls behind: AMD searches downscaled frames, NVIDIA
1070
+ * uses its fast optical flow, which it already uses above 1440p); `null`
1071
+ * while off.
1066
1072
  */
1067
1073
  readonly searchMode: "native" | "performance" | null;
1068
1074
  /**
@@ -1085,7 +1091,8 @@ export interface MotionState {
1085
1091
  }
1086
1092
  /**
1087
1093
  * `plugin.video.motion(engine)`: motion smoothing, the video's frame rate doubled by
1088
- * the GPU's frame-rate converter (AMD AMF's on Windows).
1094
+ * a GPU vendor's frame-rate converter (AMD AMF's or NVIDIA's
1095
+ * `fruc_vulkan`, on Windows).
1089
1096
  * Read whether it works here and why not; choose a mode for this plugin.
1090
1097
  *
1091
1098
  * @remarks
@@ -1108,8 +1115,13 @@ export interface MotionState {
1108
1115
  * Doubling makes film look like video (the "soap-opera effect"): offer it
1109
1116
  * off by default.
1110
1117
  *
1111
- * **Windows:** an AMD Radeon GPU with the AMD driver (AMF). On a laptop
1112
- * with two GPUs the converter runs on the AMD one, whichever GPU renders.
1118
+ * **Windows:** `amd`: an AMD Radeon GPU with the AMD driver (AMF);
1119
+ * `nvidia`: an NVIDIA GeForce RTX 30 or newer GPU with driver 573.38 or
1120
+ * newer (the converter gets a Vulkan device of its own while it runs, the
1121
+ * renderer is not involved; it starts on slow optical flow on a 4-pixel
1122
+ * grid, fast above 1440p). On a laptop with two GPUs the converter runs on
1123
+ * the engine's GPU, whichever GPU renders. One engine's converter at a
1124
+ * time: the other's modes wait with `other-engine`.
1113
1125
  * **macOS, Linux:** every mode reports `platform`.
1114
1126
  *
1115
1127
  * @example Offer the three modes as radio commands
@@ -1164,7 +1176,7 @@ export interface VideoMotion {
1164
1176
  *
1165
1177
  * @remarks
1166
1178
  * The mode stays this plugin's request until it changes it or stops; the
1167
- * player applies it whenever it can work (a `rate`, `size`, `format`, `doubling`, `upscaling`,
1179
+ * player applies it whenever it can work (a `rate`, `size`, `format`, `doubling`, `other-engine`, `upscaling`,
1168
1180
  * `failed` or `overload` reason can pass with the next video). `off`
1169
1181
  * takes the converter out at once unless another plugin asks for it. The
1170
1182
  * mode is a request of the whole plugin, not of a {@link Scope}.
@@ -323,7 +323,10 @@ export interface BackdropSlot {
323
323
  * `"adjust"`. Each {@link Panel} has its own bridge, state, `toggle()` and
324
324
  * `setInteraction()`; disposing one leaves the others, and stopping the plugin
325
325
  * unmounts them all. The bottom bar and the backdrop hold one panel for all
326
- * plugins; the sidebar and the adjust column one tab per plugin.
326
+ * plugins; the sidebar and the adjust column one tab per plugin. The bottom
327
+ * bar is the player's control bar, a panel of the built-in `vestra.playback`:
328
+ * another plugin's mount there is refused, so do not plan on it; use
329
+ * `"adjust"`, `"sidebar"` or a window.
327
330
  * {@link Panels.bottom}, {@link Panels.sidebar} and {@link Panels.adjust}
328
331
  * describe the positions, whoever mounted there.
329
332
  *
@@ -353,7 +356,11 @@ export interface Panels {
353
356
  * resolves. Handlers and bindings made right after `mount()` (in the same
354
357
  * synchronous code) are part of the first values.
355
358
  *
356
- * - `"bottom"`: under the video, as wide as the video column, as tall as the
359
+ * - `"bottom"`: **held by the player's control bar** (the built-in
360
+ * `vestra.playback`), so another plugin's mount there rejects `ready` with
361
+ * `conflict` and shows nothing (the plugin keeps running, with the warning
362
+ * `slot-occupied`); a plugin does not plan on it. The bar itself sits
363
+ * under the video, as wide as the video column, as tall as the
357
364
  * component's preferred height. It may draw above its slot into the video
358
365
  * area (negative `y`); the player does not clip it. In fullscreen it
359
366
  * floats over the video and shows only while the pointer is in its band
@@ -429,7 +436,9 @@ export interface Panels {
429
436
  * following the playback position and seeking when dragged. Bindings and
430
437
  * handlers made right after `mount` are part of the first values;
431
438
  * `ready` resolves once the main window shows the bar, and rejects with
432
- * `conflict` when another plugin's panel holds the bottom bar.
439
+ * `conflict` when another plugin's panel holds the bottom bar. This is
440
+ * the built-in `vestra.playback`'s case: on a player with its control
441
+ * bar, any other plugin gets `conflict` here.
433
442
  * ```ts
434
443
  * const bar = plugin.panels.mount("bottom", "ui/bar.slint");
435
444
  * // Sent again whenever the position changes, while a stream is open.
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.11.0: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
3
+ > @vestra-player/sdk 1.11.2: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
4
4
 
5
5
  ## Read the documentation
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestra-player/sdk",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Plugin API types, test host and plugin CLI for Vestra Player (apiVersion vestra/1)",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {