@vestra-player/sdk 1.5.13 → 1.5.14

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/llms.txt CHANGED
@@ -1,22 +1,14 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.5.13: 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; it runs in its own Node.js process. llms-full.txt, next to this file, has every declaration, the guides and the examples; L<n> below are its line numbers.
4
-
5
- **How plugins run**
6
-
7
- - Each plugin runs in its own Node.js process (Node.js 26, which the player ships) started by the player.
8
- - The player loads the entry module and calls its **default export** `activate(plugin)`.
9
- - Everything a plugin creates (commands, windows, panels, filters, listeners…) is a handle owned by `plugin` or a child scope, and is released automatically when the plugin stops.
10
- - Plugins are trusted code.
11
- - The API is the same on macOS and Windows.
3
+ > @vestra-player/sdk 1.5.14: 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; it runs in its own Node.js process. Everything a plugin creates (commands, windows, panels, filters, listeners…) is a handle that is released automatically when the plugin stops. L<n> are line numbers in llms-full.txt, next to this file: every page, declaration and example.
12
4
 
13
5
  **Rules**
14
6
 
15
- - **Only the public SDK.** Import `@vestra-player/sdk` with `import type` only (a runtime import fails `vestra-plugin build`) and `@vestra-player/sdk/testing` only in tests. `@vestra-player/sdk/runtime` and the SDK's internal modules are for the player.
16
- - **No other plugins.** Do not import another plugin's code, read its directory or data directory, or talk to it privately (shared files, sockets, messages). A plugin must load, run and stop while no other plugin is installed. Plugins share only what the API makes public: player state, timeline marks, menus, settings pages.
17
- - **No system commands.** Do not run `open`, `sips`, `plutil`, `security`, `cmd`, `powershell` or similar. Use the API (`plugin.system` to open files and links, `plugin.clipboard`, `plugin.secrets`, `plugin.tools` for ffmpeg and ffprobe) or portable Node.js code. If the API lacks something every system needs, ask for it in the SDK repository.
7
+ - **Only the public SDK.** Import `@vestra-player/sdk` with `import type` only (a runtime import fails `vestra-plugin build`) and `@vestra-player/sdk/testing` only in tests.
8
+ - **No other plugins.** Do not import another plugin's code, read its directory or data directory, or talk to it privately (shared files, sockets, messages).
9
+ - **No system commands.** Do not run `open`, `sips`, `plutil`, `security`, `cmd`, `powershell` or similar.
18
10
  - **macOS and Windows.** The same code runs on both: build paths with `node:path`, write package paths with `/`, and handle `unsupported` where a method documents a platform difference.
19
- - **Your own id.** `<owner>.<name>`, where the owner is your GitHub user or organization. `vestra` and `vestra.*` are reserved for the plugins built into the player.
11
+ - **Your own id.** `<owner>.<name>`, where the owner is your GitHub user or organization.
20
12
 
21
13
  **Files**
22
14
 
@@ -29,7 +21,7 @@ my-plugin/
29
21
  package.json dev dependency and scripts
30
22
  ```
31
23
 
32
- **manifest.json** (every field; unknown fields and capabilities are rejected; id ≤ 128 bytes, name, author ≤ 64 characters, punchline ≤ 120, description ≤ 2000, tags ≤ 8 of ≤ 24 characters, license ≤ 64, sourceUrl ≤ 2048 bytes, icon PNG or JPEG ≤ 512 KB and 1024 px per side, readme, changelog ≤ 256 KB)
24
+ **manifest.json**
33
25
 
34
26
  ```json
35
27
  {
@@ -37,21 +29,12 @@ my-plugin/
37
29
  "version": "0.1.0",
38
30
  "apiVersion": "vestra/1",
39
31
  "entry": "main.ts",
40
- "capabilities": ["commands", "ui.osd"],
41
- "minPlayerVersion": "0.4.1",
42
- "name": "Hello",
43
- "author": "Me",
44
- "punchline": "Says hello from the Tools menu.",
45
- "description": "A first plugin.\nIt adds Tools ▸ Hello, which shows an on-screen message.",
46
- "tags": ["example"],
47
- "icon": "assets/icon.png",
48
- "readme": "README.md",
49
- "changelog": "CHANGELOG.md",
50
- "sourceUrl": "https://github.com/me/hello",
51
- "license": "MIT"
32
+ "capabilities": ["commands", "ui.osd", "playback.read", "events"]
52
33
  }
53
34
  ```
54
35
 
36
+ Fields: `id`, `version`, `apiVersion`, `entry`, `capabilities`, `name`, `author`, `punchline`, `description`, `tags`, `icon`, `readme`, `changelog`, `sourceUrl`, `license`, `minPlayerVersion`; unknown fields and capabilities are rejected. Rules and limits: L2025–2087.
37
+
55
38
  **main.ts**
56
39
 
57
40
  ```ts
@@ -66,62 +49,45 @@ export default async function activate(plugin: Plugin) {
66
49
  }
67
50
  ```
68
51
 
69
- **Capabilities** (a call without its capability fails with `capability`)
70
-
71
- - `commands`: `commands.add`, `host.run`
72
- - `ui.window`: `windows.create`
73
- - `ui.mount`: `panels.mount`, `panels.bottom` / `.sidebar` / `.backdrop`
74
- - `ui.dialog`: `dialogs.*`
75
- - `ui.osd`: `osd.show`, `osd.panel`
76
- - `ui.drop`: `drops.provide`, `Panel.onDrop`
77
- - `ui.theme`: `appearance.set`
78
- - `ui.settings`: `settings.page`, `settings.show`
79
- - `playback.read`: reading `player.state` at start, `refresh`, `stats`, `chapters`, `audioDevices`, `timeline.marks`
80
- - `events`: live `player.state` / `onChange`, panel visibility, subtitle and window updates
81
- - `playback.control`: `player.open`, `setPaused`, `seek`, `setRate`, … and `power.preventSleep`
82
- - `producer.av`: `player.openStream` (with `playback.control`: the stream becomes the player's source)
83
- - `processing.video`: `video.filter` (with `playback.read` and `events`), `video.view`, `video.render` (with `playback.read`)
84
- - `processing.audio`: `audio.filter` (with `playback.read` and `events`)
85
- - `subtitles.read` / `subtitles.control`: reading / changing subtitles
86
- - `media.read` / `media.control`: `media.capture`, snapshot exports
87
- - `source.resolve`: `resolvers.add`
88
- - `plugins.manage`: `packages.validate`, `rollback`, `setEnabled`, `uninstall`
89
- - `clipboard`: `clipboard.*`
90
- - `window.control`: `window.setVideoArea`, `setAlwaysOnTop`, `setCursorAutoHide`, `setPictureInPicture`
91
- - `bindings.manage`: `bindings.*`
92
- - `timeline.marks`: `timeline.layer()`
93
- - `secrets`: `secrets.*`
94
- - No capability is needed for `tools`, `storage`, `system`, `ui.image`, `plugin.app`, reading `window.state` and `appearance.theme`, and `packages.list`.
95
-
96
- **Test** (`tests/*.test.ts`, run by `vestra-plugin test`)
97
-
98
- ```ts
99
- // tests/main.test.ts
100
- import assert from "node:assert/strict";
101
- import test from "node:test";
102
- import { startPlugin } from "@vestra-player/sdk/testing";
103
- import activate from "../main.ts";
104
-
105
- test("shows the position", async () => {
106
- const { host, stop } = await startPlugin(activate, {
107
- directory: new URL("..", import.meta.url), // reads manifest.json
108
- });
109
- host.setSource({ phase: "ready", position: 12, duration: 60 });
110
- await host.settle();
111
- await host.command("where").run();
112
- assert.deepEqual(host.osd, ["12.0 s of 60.0 s"]);
113
- await stop();
114
- });
115
- ```
52
+ **Capabilities** (a call without one fails with `capability`)
53
+
54
+ - `producer.av`: Player.openStream (also `playback.control`)
55
+ - `playback.read`: Player.state/refresh/stats/chapters/audioDevices, Timeline.marks
56
+ - `playback.control`: Player.open/setPaused/seek/setRate/restart/close/scrub/setOutput/provideSequence/next/previous/addAudioTrack/selectAudioTrack/step/setStepSeek/setLoop/setAudioDevice, Power.preventSleep
57
+ - `source.resolve`: Resolvers.add
58
+ - `events`: Player/Subtitles/Timeline/MainWindow/Appearance/PanelSlot/Panel/BackdropSlot.onChange, Resolvers.onFileTypesChange
59
+ - `commands`: Commands.add, Host.run
60
+ - `ui.window`: Windows.create
61
+ - `ui.mount`: Panels.mount/bottom/sidebar/backdrop, PanelSlot/Panel/BackdropSlot.onChange
62
+ - `ui.dialog`: Dialogs.confirm/openFile/openFiles/openDirectory/saveFile
63
+ - `plugins.manage`: Packages.validate/validateArchive/rollback/setEnabled/uninstall
64
+ - `processing.video`: Plugin.video.filter/video.view/video.render (also `playback.read`)
65
+ - `processing.audio`: Plugin.audio.filter (also `playback.read`, `events`)
66
+ - `subtitles.read`: Subtitles.state/onChange/refresh
67
+ - `subtitles.control`: Subtitles.select/load/remove/setStyle
68
+ - `media.read`: MediaCapture.capture, Snapshot.export (also `media.control`)
69
+ - `media.control`: MediaCapture.capture, Snapshot.export (also `media.read`)
70
+ - `ui.osd`: Osd.show/panel
71
+ - `clipboard`: Clipboard.readText/writeText/writeImage
72
+ - `window.control`: MainWindow.setVideoArea/setAlwaysOnTop/setCursorAutoHide/setPictureInPicture
73
+ - `bindings.manage`: Bindings.list/set/reset/onChange
74
+ - `timeline.marks`: Timeline.layer
75
+ - `ui.drop`: Drops.provide, Panel.onDrop
76
+ - `ui.settings`: Settings.page/show
77
+ - `ui.theme`: Appearance.set/setLanguage
78
+ - `secrets`: Secrets.get/set/delete
79
+ - No capability: `tools`, `storage`, `system`, `app`, `ui` (images and Markdown), `i18n`, reading window.state, appearance.theme and packages.list. Details: L2088–2130.
80
+
81
+ **Test**: `tests/*.test.ts` with `node:test`, run by `vestra-plugin test`. `startPlugin(activate, { directory: new URL("..", import.meta.url) })` from `@vestra-player/sdk/testing` returns `{ host, stop }`; `host` is a TestHost (an in-memory player): `host.setSource(…)`, `host.command(id).run()`, `host.press(key)`, `await host.settle()`, then assert on `host.osd`, `host.window(id).props`… Guide: L1587–1752; TestHost: L6649.
116
82
 
117
83
  **Command line**
118
84
 
119
- - `vestra-plugin check [dir...]`: Checks the manifest, then a strict type check of the plugin and its tests.
120
- - `vestra-plugin test [dir...]`: Runs `node --test` on `tests/*.test.{ts,mjs}`.
121
- - `vestra-plugin build [dir...] [--version x.y.z]`: Writes `dist/`: types stripped, files copied, manifest versioned.
122
- - `vestra-plugin pack [dir...] [--version x.y.z] [--out dir]`: Builds, then packs `dist/` as `<id>-<version>.vxp`.
123
- - `vestra-plugin i18n extract [dir...] [--locale lang]`: Collects the texts to translate into `locales/`, keeping translations.
124
- - `vestra-plugin i18n check [dir...]`: Translation coverage and untranslatable text; fails on stale catalogs.
85
+ - `vestra-plugin check`: strict type check of the plugin's .ts files and tests/*.ts
86
+ - `vestra-plugin build`: check, then write dist/
87
+ - `vestra-plugin test`: node --test on tests/*.test.{ts,mjs}
88
+ - `vestra-plugin pack`: build, then dist/ → <out>/<id>-<version>.vxp
89
+ - `vestra-plugin i18n extract`: find the texts to translate, write locales/messages.pot and merge it into every locales/<lang>.po
90
+ - `vestra-plugin i18n check`: coverage per language, placeholder and plural problems, a stale messages.pot
125
91
  - `vestra-player --plugin <dir>` runs a plugin from source, no build needed.
126
92
 
127
93
  **Error codes** (`error.code`; branch on it, never on `message`)
@@ -131,79 +97,49 @@ test("shows the position", async () => {
131
97
  - `invalid`: A bad argument
132
98
  - `missing`: The target does not exist
133
99
  - `busy`: The player is still doing a previous call of the same kind
134
- - `conflict`: Another plugin owns the resource, or this plugin already uses the id
100
+ - `conflict`: Another plugin owns the resource
135
101
  - `unavailable`: Not possible right now
136
102
  - `unsupported`: Not possible on this system, build or source
137
103
  - `failed`: The operation ran and failed
138
104
  - `aborted`: An `AbortSignal` fired
139
105
  - `timeout`: A time limit ran out
140
- - `limit`: A player-wide limit was reached, a property value is over the limits of PropValue, or a request is longer than the player's 1 MiB message
141
- - `reserved`: Packages.validate, PackageCandidate.install: the id is `vestra` or starts with `vestra.`, which only the player's built-in plugins use
106
+ - `limit`: A player-wide limit was reached, a property value is over the limits of PropValue
107
+ - `reserved`: The id is `vestra` or starts with `vestra.`
142
108
  - `versionMismatch`: The package needs a newer player or another `apiVersion`
143
- - `ui-prepare`: The player could not prepare a mounted panel or a settings page
144
- - `ui`: The player could not apply a property to a tool window or a settings page, or could not build the Options window
145
- - `disabled`: The plugin is being stopped
146
- - Others: PluginError, llms-full.txt L974.
109
+ - Others: PluginError, llms-full.txt L3027.
147
110
 
148
111
  ## Reference
149
112
 
150
- - [Full reference](https://vestrasys.github.io/vestra-player-sdk/llms-full.txt): in the package at node_modules/@vestra-player/sdk/llms-full.txt.
151
- - [Tutorial: Getting started](https://vestrasys.github.io/vestra-player-sdk/documents/Getting_started.html): L9–280
152
- - [Concept: Windows, panels, settings pages, dialogs and the OSD](https://vestrasys.github.io/vestra-player-sdk/documents/Windows__panels__settings_pages__dialogs_and_the_OSD.html): L281–626
153
- - [How-to: Keep a slider responsive while dragging](https://vestrasys.github.io/vestra-player-sdk/documents/Keep_a_slider_responsive_while_dragging.html): L627–801
154
- - [How-to: Remember a window's state between runs](https://vestrasys.github.io/vestra-player-sdk/documents/Remember_a_window_s_state_between_runs.html): L802–931
155
- - [API: @vestra-player/sdk](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk.html): L932–4427
156
- - [API: @vestra-player/sdk/testing](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk_testing.html) (TestHost, startPlugin): L4428–5538
113
+ - [llms-full.txt](https://vestrasys.github.io/vestra-player-sdk/llms-full.txt), also node_modules/@vestra-player/sdk/llms-full.txt; the pages are on the [site](https://vestrasys.github.io/vestra-player-sdk/).
114
+ - Tutorials: Getting started L9–214
115
+ - Concepts: How a plugin runs L215–364; Commands, menus and key bindings L365–462; Playback state, controls and sources L463–584; Video and audio processing L585–662; Windows, panels, settings pages, dialogs and the OSD L663–949
116
+ - How-to: Keep a slider responsive while dragging L950–1124; Remember a window's state between runs L1125–1254; Translate a plugin L1255–1438; Migrate a plugin to English source text L1439–1586; Test a plugin L1587–1752; Publish a plugin L1753–1841
117
+ - Guidelines: Interface guidelines L1842–1926; Menu guidelines L1927–2024
118
+ - Reference: Manifest L2025–2087; Capabilities L2088–2130; Limits L2131–2225; Commands, menus and bindings L2226–2694; Platforms L2695–2723; Theme L2724–2928; Command line L2929–2984
119
+ - [API: @vestra-player/sdk](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk.html): L2985–6484
120
+ - [API: @vestra-player/sdk/testing](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk_testing.html): L6485–7809
157
121
 
158
122
  ## API
159
123
 
160
- Where each module of `plugin` is declared:
161
-
162
- - Plugin L1153, Scope L1022, PluginError L974, Disposable L947
163
- - plugin.commands: Commands L1361
164
- - plugin.windows: Windows L1566
165
- - plugin.panels: Panels L2207
166
- - plugin.dialogs: Dialogs L2493
167
- - plugin.player: Player L2934
168
- - plugin.video: VideoFilter L3199, VideoView L3262, RenderOptions L3304
169
- - plugin.audio: AudioFilter L3223
170
- - plugin.subtitles: Subtitles L3402
171
- - plugin.media: MediaCapture L3562
172
- - plugin.resolvers: Resolvers L3667
173
- - plugin.packages: Packages L3907
174
- - plugin.osd: Osd L3135
175
- - plugin.host: Host L3083
176
- - plugin.clipboard: Clipboard L4024
177
- - plugin.power: Power L4044
178
- - plugin.tools: Tools L4077
179
- - plugin.storage: Storage L4120
180
- - plugin.system: System L4143
181
- - plugin.secrets: Secrets L4161
182
- - plugin.window: MainWindow L2330
183
- - plugin.app: App L2411
184
- - plugin.bindings: Bindings L3994
185
- - plugin.ui: Ui L1453
186
- - plugin.timeline: Timeline L2287
187
- - plugin.drops: Drops L1863
188
- - plugin.appearance: Appearance L1892
189
- - plugin.i18n: I18n L2034
190
- - plugin.settings: Settings L2140
124
+ Where each module of `plugin` (`plugin.<module>`) is declared:
125
+
126
+ - Plugin L3206, Scope L3075, PluginError L3027, Disposable L3000
127
+ - Commands L3418; Windows L3623; Panels L4264; Dialogs L4550; Player L4991; video: VideoFilter L5256, VideoView L5319, RenderOptions L5361; audio: AudioFilter L5280; Subtitles L5459; media: MediaCapture L5619; Resolvers L5724; Packages L5964; Osd L5192; Host L5140; Clipboard L6081; Power L6101; Tools L6134; Storage L6177; System L6200; Secrets L6218; window: MainWindow L4387; App L4468; Bindings L6051; Ui L3510; Timeline L4344; Drops L3920; Appearance L3949; I18n L4091; Settings L4197.
191
128
 
192
129
  ## Examples
193
130
 
194
- Complete plugins with tests, in [examples/](https://github.com/vestrasys/vestra-player-sdk/tree/main/examples) and in llms-full.txt:
131
+ Tested plugins in [examples/](https://github.com/vestrasys/vestra-player-sdk/tree/main/examples):
195
132
 
196
- - hello: The README Quick start: one menu command and an on-screen message. L5955–6044
197
- - blur: A tool window with one slider that blurs the playing video. L6045–6306
198
- - signal-generator: Generates its own video and audio: colour bars and a 1 kHz tone. L6307–6639
199
- - bookmark: A tool window bound to the playback state: remember the position and jump back to it. L6640–6824
200
- - panel-menu: A sidebar panel with its own right-click menu. L6825–7030
201
- - menus: Radio menu items, separator groups and a menu item whose title changes. L7031–7190
202
- - theme-widgets: A tool window drawn with the player's theme and widgets. L7191–7354
203
- - markdown: A window that shows a Markdown document. L7355–7548
204
- - i18n: A plugin in the player's language: English source text, a Chinese translation. L7549–7716
133
+ - hello: The README Quick start: one menu command and an on-screen message. L8226–8315
134
+ - blur: A tool window with one slider that blurs the playing video. L8316–8577
135
+ - signal-generator: Generates its own video and audio: colour bars and a 1 kHz tone. L8578–8910
136
+ - bookmark: A tool window bound to the playback state: remember the position and jump back to it. L8911–9095
137
+ - panel-menu: A sidebar panel with its own right-click menu. L9096–9301
138
+ - menus: Radio menu items, separator groups and a menu item whose title changes. L9302–9461
139
+ - theme-widgets: A tool window drawn with the player's theme and widgets. L9462–9625
140
+ - markdown: A window that shows a Markdown document. L9626–9820
141
+ - i18n: A plugin in the player's language: English source text, a Chinese translation. L9821–9988
205
142
 
206
143
  ## Optional
207
144
 
208
- - [Changelog](https://github.com/vestrasys/vestra-player-sdk/blob/main/CHANGELOG.md): changes per version and the player version each addition needs.
209
- - Declarations with every doc comment: node_modules/@vestra-player/sdk/dist/plugin/types.d.ts, dist/plugin/testing.d.ts; Slint widgets: slint/vestra/*.slint.
145
+ - [Changelog](https://github.com/vestrasys/vestra-player-sdk/blob/main/CHANGELOG.md); full doc comments in dist/plugin/*.d.ts; Slint library in slint/vestra/.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestra-player/sdk",
3
- "version": "1.5.13",
3
+ "version": "1.5.14",
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": {
@@ -48,6 +48,7 @@
48
48
  "docs": "typedoc",
49
49
  "docs:check": "node scripts/check-docs.mjs",
50
50
  "docs:llms": "node scripts/llms.mjs",
51
+ "docs:tables": "node scripts/doc-tables.mjs",
51
52
  "examples": "node scripts/check-examples.mjs",
52
53
  "format": "prettier --write \"{src,test,bin,scripts,examples}/**/*.{ts,mjs}\" package.json tsconfig.json tsconfig.check.json typedoc.json .oxlintrc.json examples/tsconfig.json \"examples/*/package.json\"",
53
54
  "format:check": "prettier --check \"{src,test,bin,scripts,examples}/**/*.{ts,mjs}\" package.json tsconfig.json tsconfig.check.json typedoc.json .oxlintrc.json examples/tsconfig.json \"examples/*/package.json\"",