@vestra-player/sdk 1.7.8 → 1.7.10

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 (43) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/api-requests.js +3 -0
  3. package/dist/capabilities.d.ts +9 -0
  4. package/dist/capabilities.js +1 -0
  5. package/dist/capability-rules.d.ts +3 -0
  6. package/dist/capability-rules.js +6 -1
  7. package/dist/commands.d.ts +15 -2
  8. package/dist/commands.js +7 -1
  9. package/dist/docs-tree.json.gz +0 -0
  10. package/dist/host-capabilities.js +53 -0
  11. package/dist/manifest.js +12 -1
  12. package/dist/player-runtime.d.ts +1 -0
  13. package/dist/player-runtime.js +1 -0
  14. package/dist/plugin/commands.d.ts +2 -1
  15. package/dist/plugin/commands.js +131 -4
  16. package/dist/plugin/connection.d.ts +7 -1
  17. package/dist/plugin/connection.js +16 -3
  18. package/dist/plugin/errors.d.ts +5 -1
  19. package/dist/plugin/errors.js +8 -2
  20. package/dist/plugin/index.js +4 -0
  21. package/dist/plugin/player.js +1 -1
  22. package/dist/plugin/scope.d.ts +1 -0
  23. package/dist/plugin/scope.js +2 -1
  24. package/dist/plugin/subtitles.js +2 -2
  25. package/dist/plugin/testing/commands.d.ts +7 -0
  26. package/dist/plugin/testing/commands.js +211 -0
  27. package/dist/plugin/testing/index.d.ts +70 -0
  28. package/dist/plugin/testing/index.js +66 -1
  29. package/dist/plugin/testing/internals.d.ts +14 -0
  30. package/dist/plugin/testing/internals.js +14 -1
  31. package/dist/plugin/types/base.d.ts +8 -5
  32. package/dist/plugin/types/commands.d.ts +412 -1
  33. package/dist/request-queue.d.ts +66 -0
  34. package/dist/request-queue.js +209 -0
  35. package/dist/source.d.ts +2 -1
  36. package/dist/source.js +3 -5
  37. package/dist/subtitles.d.ts +4 -2
  38. package/dist/subtitles.js +4 -10
  39. package/dist/wire.d.ts +25 -4
  40. package/dist/wire.js +6 -0
  41. package/llms.txt +2 -2
  42. package/package.json +1 -1
  43. package/slint/vestra/icons.slint +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.10
4
+
5
+ **Who must change: nobody.** No API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged. A plugin that sends many requests at once now sees some of them answered later, never refused.
6
+
7
+ - **Requests in flight** (user design, 2026-11-11): the SDK keeps at most 256 of a plugin's requests, and 3 MiB of their lines, sent and not yet answered (`REQUEST_LIMITS`, exported from `./runtime` for the player's agreement test). The rest wait in the plugin's own queue and go out in the order made as answers come in: no error, no reordering. The player's backstop (past 320 unanswered lines or 4 MiB per plugin it answers `limit`; it does not stop the plugin) is so never reached by a plugin on the SDK, only by a client that bypasses it; the byte cap leaves one `MESSAGE_LIMIT` line of room under 4 MiB, since a few large lines would cross 4 MiB long before 256 requests, and each line counts 32 bytes more than the SDK's estimate, for the id's digits and the shared runner's envelope the player also counts. One queue per plugin, each member of the shared runner included (it lives in the plugin's connection, over the runner's transport).
8
+ - **What never waits**: the answers to the player's own calls (`sourceResolvers.respond`, `producer.ack`, `producer.ackInput`), which the player may be waiting for before it answers one of the plugin's requests; they count while in flight. `palette.lead.done` waits in order like any request, so it never passes a waiting `commands.run` of the same ticket. A line over `MESSAGE_LIMIT` is refused at once as before. Events are not requests.
9
+ - **Aborting**: a waiting request whose `AbortSignal` is aborted leaves the queue unsent and rejects with `aborted` (`player.open`'s submit, `subtitles.load`'s upload). A sent request runs to its answer, as before. An abort counts as a definite outcome (nothing is asked again about an operation that was never sent).
10
+ - **Stopping**: when the plugin stops, every waiting request rejects with `disabled` ("plugin stopped"), as the runner rejects those in flight; the cleanup's own requests go out as before.
11
+ - **`TestHost`** sits behind the same queue, so a plugin's tests see the same waiting. Limits reference: "Requests in flight". Tests: `test/request-queue.test.ts` (10,000 requests in order with at most 256 in flight, the byte cap, abort while waiting, stop and disconnect with a full queue, replies past a full queue, `palette.lead.done` behind a waiting `commands.run`). Errors reference: `limit` names the player's backstop.
12
+ - **Capability checker**: `media.sources.open` without `playback.control` names the request `media.sources.open` (it named `source.operation`, which asks for that capability only once it counts as declared); a need is attributed to the request that needed it first.
13
+
14
+ ## 1.7.9
15
+
16
+ **Who must change: nobody; additions only.** The two new capabilities are for the player's built-in plugins only: a third-party plugin cannot declare them (the player refuses the package at install, the plugin registry refuses it, `vestra-plugin check` reports it, and every call fails with `capability`). A built-in plugin that uses them needs player 0.7.6. `apiVersion` stays `vestra/1`; the API surface snapshot gains the new members.
17
+
18
+ Intended users: the built-in Vestra Player AI's Ask Vestra (the palette's first row runs the commands a sentence asks for). The members are shaped by what they do, not by AI: a calculator or unit converter in the palette's first row, a search over the history, jump to a time or chapter, a macro or remote-control plugin running saved commands, a tutorial that shows a command's key. They stay built-in only because one lead row receives every query and running any plugin's command is a wider boundary than any capability so far (the player's ticket, rate limits and confirmation are the boundary; opening them needs the user's ruling).
19
+
20
+ - **`plugin.commands.list()`** (`commands.run`): the command palette's table (`CommandList`, `CommandInfo`): every listed command, the player's own and every plugin's, with its label, category, path, place, keys, owner, state and whether running it asks first (`dangerous`), and a `revision`.
21
+ - **`plugin.commands.run(id, { ticket, step?, of? })`** (`commands.run`, risky): runs a listed command as the palette does, for the ticket of a user action. Resolves `{ ran: true }`, or `{ ran: false, declined: true }` when the user chose Don't Run in the player's own alert, which comes before a command declared `destructive`, the player's Close and Quit, anything in the Settings and Plugins menus, and every command of a plugin that is not built in. Each run shows an OSD line naming the plugin and the command (`step`/`of`, 1–99 and together, add `1/2`). Fails `ticket` (none, ended or expired), `missing`, `disabled` (with the command's reason), `busy`, `invalid` (`step`/`of`, the palette itself) and `limit` (4 a second and 30 per ticket, 120 a minute per plugin).
22
+ - **`plugin.palette.lead(options)`** (`palette.lead`; `Palette`, `PaletteLead`, `PaletteLeadOptions`, `PaletteLeadRun`): the palette's first row (`title`, `icon`, `placeholder`, `empty`, `note`, `status`, with the player's lengths). One plugin holds it (`conflict` for another); the player keeps it while the plugin is stopped. `onRun` hears Enter / Shift+Enter / a click with `{ query, keep, ticket, status }` (the `palette.lead` event, sent unasked to the holder and waking a stopped one); `update` changes it, `done(ticket)` ends a request's ticket, `dispose` removes the row. A refused row reaches `ready` and `onError` without failing activation, so a development load (not built in) still activates.
23
+ - **`CommandOptions.destructive`** (any plugin): the command cannot be undone; `commands.run` asks the user before running it. Sent only when `true`.
24
+ - **`CAPABILITY_INFO[…].builtinOnly`**, from the player's table (`builtinOnly` in its `capabilities.json`). `vestra-plugin check` (and every other command, through the manifest check) reports a built-in-only capability as an error for an id without the `vestra.` prefix (only built-in plugins have one) and as a hint for a `vestra.` id. The Capabilities reference marks them and has a "Built-in plugins only" section; the Commands reference has "Running commands for the user".
25
+ - **Error codes**: `ticket` is new; `disabled` also means a disabled command for `commands.run`; `conflict` also covers the lead row.
26
+ - **Icons**: `BAR_BUTTON_ICONS` and `BarButtonIcon` gain `search-ai` (the palette's button while a plugin holds the lead row); `BarButtonIcon` also gains `sliders`, which `BAR_BUTTON_ICONS` already had.
27
+ - **`TestHost`**: `startPlugin(…, { builtin: true })` (`host.builtin`) runs the plugin as a built-in one; without it both capabilities fail with `capability`, as in the player. `host.paletteLead` is the row as set; `host.runPaletteLead(query, { keep?, status? })` is the user's Enter and returns the ticket (a new one ends the earlier). `commands.list`/`commands.run` follow the player's table, checks, order of refusals, tickets, rates and OSD line over the core commands and the plugin's own; the alert's answer comes from `dialogAnswers`. Tests: `test/builtin-only.test.ts`.
28
+ - Capability table synced from the player (`commands.run`: `commands.list`, `commands.run`; `palette.lead`: `palette.lead.set`, `.clear`, `.done`); the generated Capabilities, Errors and Messages tables follow.
29
+
3
30
  ## 1.7.8
4
31
 
5
32
  **Who must change: nobody; additions only.** A plugin that uses them declares the new capability `media.sources` (exports of its files also `media.read` and `media.control`, as any export; `media.sources.open` also `playback.control`, as any open) and needs the player that serves them (`minPlayerVersion` of the first player release after 0.7.6). `apiVersion` stays `vestra/1`; the API surface snapshot gains the new members. Snapshot exports are unchanged.
@@ -100,6 +100,9 @@ export const API_REQUESTS = Object.freeze({
100
100
  "Resolvers.add": [{ method: "sourceResolvers.register" }],
101
101
  "Commands.add": [{ method: "commands.register" }],
102
102
  "Commands.keys": [{ method: "commands.keys" }, listen("commands.keys")],
103
+ "Commands.list": [{ method: "commands.list" }],
104
+ "Commands.run": [{ method: "commands.run" }],
105
+ "Palette.lead": [{ method: "palette.lead.set" }],
103
106
  "Host.run": [{ method: "host.run" }],
104
107
  "Windows.create": [{ method: "ui.open" }],
105
108
  "Dialogs.confirm": [{ method: "dialogs.confirm" }],
@@ -36,6 +36,15 @@ export interface CapabilityInfo {
36
36
  * clipboard, every shortcut, the keychain, other plugins).
37
37
  */
38
38
  readonly risky: boolean;
39
+ /**
40
+ * `true` when only the player's built-in plugins may declare it
41
+ * (`commands.run`, `palette.lead`): the player refuses a package of any
42
+ * other plugin that declares it, and its calls fail with `capability`.
43
+ * `vestra-plugin check` reports it.
44
+ *
45
+ * @since 1.7.9
46
+ */
47
+ readonly builtinOnly: boolean;
39
48
  }
40
49
  /**
41
50
  * Every manifest capability the player knows (`vestra/1`), in the player's
@@ -44,6 +44,7 @@ export const CAPABILITY_INFO = Object.freeze(Object.fromEntries(Object.entries(c
44
44
  requires: Object.freeze(info.requires),
45
45
  label: info.label,
46
46
  risky: info.risky,
47
+ builtinOnly: info.builtinOnly,
47
48
  }),
48
49
  ])));
49
50
  /**
@@ -25,6 +25,8 @@ export interface HostCapability {
25
25
  readonly name: string;
26
26
  readonly label: string;
27
27
  readonly risky: boolean;
28
+ /** Only built-in plugins may declare it (absent: `false`). */
29
+ readonly builtinOnly?: boolean;
28
30
  readonly requires: readonly string[];
29
31
  readonly residency: string;
30
32
  readonly methods: readonly HostMethod[];
@@ -119,4 +121,5 @@ export declare function capabilityInfo(rules?: CapabilityRules): Record<string,
119
121
  requires: string[];
120
122
  label: string;
121
123
  risky: boolean;
124
+ builtinOnly: boolean;
122
125
  }>;
@@ -143,6 +143,10 @@ export function requestsNeed(requests, capabilities, rules = RULES) {
143
143
  };
144
144
  // Every capability any round needed; the answer is the last round's needs
145
145
  // (read with all of them declared) and then any earlier one it left out.
146
+ // Each keeps the request of the round that first needed it, the one read
147
+ // closest to the manifest: `MediaSources.open` needs `playback.control` for
148
+ // `media.sources.open`, not for `source.operation`, which asks for it only
149
+ // once it counts as declared.
146
150
  const all = new Map();
147
151
  for (;;) {
148
152
  const needs = round(new Set(all.keys()));
@@ -152,7 +156,7 @@ export function requestsNeed(requests, capabilities, rules = RULES) {
152
156
  all.set(need.capability, need);
153
157
  if (all.size === before)
154
158
  return [
155
- ...needs,
159
+ ...needs.map((need) => all.get(need.capability)),
156
160
  ...[...all.values()].filter((need) => !needs.some((each) => each.capability === need.capability)),
157
161
  ];
158
162
  }
@@ -173,6 +177,7 @@ export function capabilityInfo(rules = RULES) {
173
177
  requires: [...capability.requires],
174
178
  label: capability.label,
175
179
  risky: capability.risky,
180
+ builtinOnly: capability.builtinOnly === true,
176
181
  };
177
182
  for (const [api, requests] of Object.entries(rules.apis))
178
183
  for (const request of requests) {
@@ -2,6 +2,7 @@
2
2
  import type { Json, Transport } from "./wire.ts";
3
3
  import type { ListJson, TextJson } from "./i18n.ts";
4
4
  import type { ConditionJson } from "./plugin/when.ts";
5
+ import type { CommandList, CommandRunResult } from "./plugin/types.ts";
5
6
  /**
6
7
  * The player's command registry caps, the same values as the player's own
7
8
  * table (the player's tests check that they agree). They are runaway guards,
@@ -134,7 +135,8 @@ export declare const MENU_IDS: readonly ["open", "playback", "subtitles", "video
134
135
  * icon of the player's V-Line set, `@vestra/icons.slint` (draw one in your own
135
136
  * Slint with `Icon { name: "store"; }`). The player's tests check that this
136
137
  * list is its icon set. `"sliders"` (three sliders, the player's Adjustments
137
- * and Effects button).
138
+ * and Effects button); `"search-ai"` (the magnifier with the AI icon's
139
+ * cross, the palette's button while a plugin holds its lead row).
138
140
  *
139
141
  * @example Check in a test that the button's icon exists
140
142
  * The test fails before release if the plugin's bar button names an icon
@@ -152,7 +154,7 @@ export declare const MENU_IDS: readonly ["open", "playback", "subtitles", "video
152
154
  *
153
155
  * @category Testing
154
156
  */
155
- export declare const BAR_BUTTON_ICONS: readonly ["play", "pause", "stop", "back", "forward", "open", "volume", "mute", "playlist", "detach", "attach", "close", "failed", "move-top", "move-up", "move-down", "move-bottom", "search", "chapter", "bookmark", "check-task", "check-box", "menu-check", "submenu", "scroll-up", "scroll-down", "caret-down", "sort-asc", "sort-desc", "tag-remove", "preview-play", "add", "remove", "sort", "fullscreen", "exit-fullscreen", "store", "ai", "sliders"];
157
+ export declare const BAR_BUTTON_ICONS: readonly ["play", "pause", "stop", "back", "forward", "open", "volume", "mute", "playlist", "detach", "attach", "close", "failed", "move-top", "move-up", "move-down", "move-bottom", "search", "chapter", "bookmark", "check-task", "check-box", "menu-check", "submenu", "scroll-up", "scroll-down", "caret-down", "sort-asc", "sort-desc", "tag-remove", "preview-play", "add", "remove", "sort", "fullscreen", "exit-fullscreen", "store", "ai", "sliders", "search-ai"];
156
158
  /**
157
159
  * The player's limits on bottom-bar buttons (`CommandOptions.button`), the same
158
160
  * values as the player's (its tests check that they agree). A button past
@@ -344,6 +346,8 @@ export type CommandDeclaration = {
344
346
  * set, like `category`.
345
347
  */
346
348
  home?: string;
349
+ /** The command cannot be undone; sent only when `true`. */
350
+ destructive?: boolean;
347
351
  };
348
352
  /**
349
353
  * `commands.keys`: each of the plugin's own commands, by local id, and each of
@@ -378,4 +382,13 @@ export declare function commandClient(transport: Transport): {
378
382
  update: (id: string, revision: number, state: CommandState, when?: CommandWhen) => Promise<{
379
383
  revision: number;
380
384
  }>;
385
+ /** The palette's table (`commands.run`). */
386
+ list: () => Promise<CommandList>;
387
+ /** Run any listed command for a user action's ticket (`commands.run`). */
388
+ run: (params: {
389
+ id: string;
390
+ ticket: string;
391
+ step?: number;
392
+ of?: number;
393
+ }) => Promise<CommandRunResult>;
381
394
  };
package/dist/commands.js CHANGED
@@ -139,7 +139,8 @@ export const MENU_IDS = [
139
139
  * icon of the player's V-Line set, `@vestra/icons.slint` (draw one in your own
140
140
  * Slint with `Icon { name: "store"; }`). The player's tests check that this
141
141
  * list is its icon set. `"sliders"` (three sliders, the player's Adjustments
142
- * and Effects button).
142
+ * and Effects button); `"search-ai"` (the magnifier with the AI icon's
143
+ * cross, the palette's button while a plugin holds its lead row).
143
144
  *
144
145
  * @example Check in a test that the button's icon exists
145
146
  * The test fails before release if the plugin's bar button names an icon
@@ -197,6 +198,7 @@ export const BAR_BUTTON_ICONS = [
197
198
  "store",
198
199
  "ai",
199
200
  "sliders",
201
+ "search-ai",
200
202
  ];
201
203
  /**
202
204
  * The player's limits on bottom-bar buttons (`CommandOptions.button`), the same
@@ -670,5 +672,9 @@ export function commandClient(transport) {
670
672
  state,
671
673
  ...(when ? { when: when } : {}),
672
674
  }),
675
+ /** The palette's table (`commands.run`). */
676
+ list: () => transport.request("commands.list", {}),
677
+ /** Run any listed command for a user action's ticket (`commands.run`). */
678
+ run: (params) => transport.request("commands.run", params),
673
679
  };
674
680
  }
Binary file
@@ -6,6 +6,7 @@ export const HOST_CAPABILITIES = {
6
6
  apiVersion: "vestra/1",
7
7
  capabilities: [
8
8
  {
9
+ builtinOnly: false,
9
10
  label: "Provide audio and video it generates itself",
10
11
  methods: [
11
12
  { name: "producer.prepare", needs: "producer.av" },
@@ -21,6 +22,7 @@ export const HOST_CAPABILITIES = {
21
22
  risky: false,
22
23
  },
23
24
  {
25
+ builtinOnly: false,
24
26
  label: "Read what is playing and the position",
25
27
  methods: [
26
28
  { name: "source.state", needs: "playback.read" },
@@ -36,6 +38,7 @@ export const HOST_CAPABILITIES = {
36
38
  risky: false,
37
39
  },
38
40
  {
41
+ builtinOnly: false,
39
42
  label: "Open media, control playback, keep the computer awake",
40
43
  methods: [
41
44
  { name: "playback.set", needs: "playback.control" },
@@ -64,6 +67,7 @@ export const HOST_CAPABILITIES = {
64
67
  risky: false,
65
68
  },
66
69
  {
70
+ builtinOnly: false,
67
71
  label: "Resolve online video addresses",
68
72
  methods: [
69
73
  { name: "sourceResolvers.register", needs: "source.resolve" },
@@ -77,6 +81,7 @@ export const HOST_CAPABILITIES = {
77
81
  risky: false,
78
82
  },
79
83
  {
84
+ builtinOnly: false,
80
85
  label: "Receive playback changes as they happen",
81
86
  methods: [
82
87
  {
@@ -112,6 +117,7 @@ export const HOST_CAPABILITIES = {
112
117
  risky: false,
113
118
  },
114
119
  {
120
+ builtinOnly: false,
115
121
  label: "Add menu commands and shortcuts",
116
122
  methods: [
117
123
  { name: "commands.register", needs: "commands" },
@@ -126,6 +132,7 @@ export const HOST_CAPABILITIES = {
126
132
  risky: false,
127
133
  },
128
134
  {
135
+ builtinOnly: false,
129
136
  label: "Open tool windows",
130
137
  methods: [
131
138
  { name: "ui.open", needs: "ui.window" },
@@ -139,6 +146,7 @@ export const HOST_CAPABILITIES = {
139
146
  risky: false,
140
147
  },
141
148
  {
149
+ builtinOnly: false,
142
150
  label: "Show panels in the bottom bar, the sidebar or behind the video",
143
151
  methods: [
144
152
  { name: "ui.mount", needs: "ui.mount" },
@@ -155,6 +163,7 @@ export const HOST_CAPABILITIES = {
155
163
  risky: false,
156
164
  },
157
165
  {
166
+ builtinOnly: false,
158
167
  label: "Show file pickers and confirmations",
159
168
  methods: [
160
169
  { name: "dialogs.open", needs: "ui.dialog" },
@@ -166,6 +175,7 @@ export const HOST_CAPABILITIES = {
166
175
  risky: false,
167
176
  },
168
177
  {
178
+ builtinOnly: false,
169
179
  label: "Install, uninstall and disable other plugins",
170
180
  methods: [{ name: "packages.*", needs: "plugins.manage" }],
171
181
  name: "plugins.manage",
@@ -174,6 +184,7 @@ export const HOST_CAPABILITIES = {
174
184
  risky: true,
175
185
  },
176
186
  {
187
+ builtinOnly: false,
177
188
  label: "Process the picture (filters, shaders)",
178
189
  methods: [
179
190
  {
@@ -204,6 +215,7 @@ export const HOST_CAPABILITIES = {
204
215
  risky: false,
205
216
  },
206
217
  {
218
+ builtinOnly: false,
207
219
  label: "Process the sound",
208
220
  methods: [],
209
221
  name: "processing.audio",
@@ -212,6 +224,7 @@ export const HOST_CAPABILITIES = {
212
224
  risky: false,
213
225
  },
214
226
  {
227
+ builtinOnly: false,
215
228
  label: "Read subtitles",
216
229
  methods: [{ name: "subtitles.state", needs: "subtitles.read" }],
217
230
  name: "subtitles.read",
@@ -220,6 +233,7 @@ export const HOST_CAPABILITIES = {
220
233
  risky: false,
221
234
  },
222
235
  {
236
+ builtinOnly: false,
223
237
  label: "Load and change subtitles",
224
238
  methods: [{ name: "subtitles.*", needs: "subtitles.control" }],
225
239
  name: "subtitles.control",
@@ -228,6 +242,7 @@ export const HOST_CAPABILITIES = {
228
242
  risky: false,
229
243
  },
230
244
  {
245
+ builtinOnly: false,
231
246
  label: "Take snapshots and export clips",
232
247
  methods: [
233
248
  { name: "snapshot.state", needs: "media.read" },
@@ -240,6 +255,7 @@ export const HOST_CAPABILITIES = {
240
255
  risky: false,
241
256
  },
242
257
  {
258
+ builtinOnly: false,
243
259
  label: "Take snapshots and export clips",
244
260
  methods: [
245
261
  { name: "snapshot.*", needs: "media.control" },
@@ -251,6 +267,7 @@ export const HOST_CAPABILITIES = {
251
267
  risky: false,
252
268
  },
253
269
  {
270
+ builtinOnly: false,
254
271
  label: "Remember videos you add and export from them later",
255
272
  methods: [
256
273
  {
@@ -269,6 +286,7 @@ export const HOST_CAPABILITIES = {
269
286
  risky: false,
270
287
  },
271
288
  {
289
+ builtinOnly: false,
272
290
  label: "Show messages on the video",
273
291
  methods: [
274
292
  { name: "osd.show", needs: "ui.osd" },
@@ -280,6 +298,7 @@ export const HOST_CAPABILITIES = {
280
298
  risky: false,
281
299
  },
282
300
  {
301
+ builtinOnly: false,
283
302
  label: "Read and write the clipboard",
284
303
  methods: [
285
304
  { name: "clipboard.readText", needs: "clipboard" },
@@ -292,6 +311,7 @@ export const HOST_CAPABILITIES = {
292
311
  risky: true,
293
312
  },
294
313
  {
314
+ builtinOnly: false,
295
315
  label: "Adjust the main window (size, on top, picture-in-picture)",
296
316
  methods: [
297
317
  { name: "window.setVideoArea", needs: "window.control" },
@@ -305,6 +325,7 @@ export const HOST_CAPABILITIES = {
305
325
  risky: false,
306
326
  },
307
327
  {
328
+ builtinOnly: false,
308
329
  label: "Change all shortcuts",
309
330
  methods: [
310
331
  { name: "bindings.list", needs: "bindings.manage" },
@@ -317,6 +338,7 @@ export const HOST_CAPABILITIES = {
317
338
  risky: true,
318
339
  },
319
340
  {
341
+ builtinOnly: false,
320
342
  label: "Show marks on the progress bar",
321
343
  methods: [
322
344
  { name: "timeline.set", needs: "timeline.marks" },
@@ -328,6 +350,7 @@ export const HOST_CAPABILITIES = {
328
350
  risky: false,
329
351
  },
330
352
  {
353
+ builtinOnly: false,
331
354
  label: "Receive files dropped on the player",
332
355
  methods: [
333
356
  { name: "drops.provide", needs: "ui.drop" },
@@ -340,6 +363,7 @@ export const HOST_CAPABILITIES = {
340
363
  risky: false,
341
364
  },
342
365
  {
366
+ builtinOnly: false,
343
367
  label: "Add pages to the Options window",
344
368
  methods: [{ name: "settings.*", needs: "ui.settings" }],
345
369
  name: "ui.settings",
@@ -348,6 +372,7 @@ export const HOST_CAPABILITIES = {
348
372
  risky: false,
349
373
  },
350
374
  {
375
+ builtinOnly: false,
351
376
  label: "Change the player's palette",
352
377
  methods: [
353
378
  { name: "appearance.set", needs: "ui.theme" },
@@ -359,6 +384,7 @@ export const HOST_CAPABILITIES = {
359
384
  risky: false,
360
385
  },
361
386
  {
387
+ builtinOnly: false,
362
388
  label: "Store sign-in details in the system keychain",
363
389
  methods: [
364
390
  { name: "secrets.get", needs: "secrets" },
@@ -371,6 +397,7 @@ export const HOST_CAPABILITIES = {
371
397
  risky: true,
372
398
  },
373
399
  {
400
+ builtinOnly: false,
374
401
  label: "Choose GPU or software rendering and restart the player",
375
402
  methods: [
376
403
  { name: "rendering.setPreference", needs: "rendering.manage" },
@@ -382,6 +409,7 @@ export const HOST_CAPABILITIES = {
382
409
  risky: true,
383
410
  },
384
411
  {
412
+ builtinOnly: false,
385
413
  label: "Upscale the video with the GPU's video upscaler",
386
414
  methods: [
387
415
  { name: "video.upscaling.state", needs: "video.upscaling" },
@@ -392,6 +420,31 @@ export const HOST_CAPABILITIES = {
392
420
  residency: "live",
393
421
  risky: false,
394
422
  },
423
+ {
424
+ builtinOnly: true,
425
+ label: "Run any player or plugin command",
426
+ methods: [
427
+ { name: "commands.list", needs: "commands.run" },
428
+ { name: "commands.run", needs: "commands.run" },
429
+ ],
430
+ name: "commands.run",
431
+ requires: [],
432
+ residency: "none",
433
+ risky: true,
434
+ },
435
+ {
436
+ builtinOnly: true,
437
+ label: "Add the first row of the command palette",
438
+ methods: [
439
+ { name: "palette.lead.set", needs: "palette.lead" },
440
+ { name: "palette.lead.clear", needs: "palette.lead" },
441
+ { name: "palette.lead.done", needs: "palette.lead" },
442
+ ],
443
+ name: "palette.lead",
444
+ requires: [],
445
+ residency: "recordable",
446
+ risky: false,
447
+ },
395
448
  ],
396
449
  uncapable: [
397
450
  { name: "packages.list", needs: null },
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 } from "./capabilities.js";
8
+ import { API_VERSION, CAPABILITIES, CAPABILITY_INFO } from "./capabilities.js";
9
9
  export const MANIFEST_LIMITS = Object.freeze({
10
10
  idBytes: 128,
11
11
  name: 64,
@@ -75,6 +75,17 @@ export function manifestProblems(manifest, directory) {
75
75
  problem(`unknown capabilities ${unknown.join(", ")}`);
76
76
  if (new Set(capabilities).size !== capabilities.length)
77
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
+ }
78
89
  }
79
90
  if (typeof manifest.entry !== "string" || !relative(manifest.entry))
80
91
  problem("entry must be a relative path inside the package");
@@ -16,6 +16,7 @@ export { HOST_CAPABILITIES } from "./host-capabilities.ts";
16
16
  export { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BUILTIN_COMMANDS, BUILTIN_SUBMENUS, COMMAND_LIMITS, MENU_IDS, } from "./commands.ts";
17
17
  export { BINDING_INPUTS } from "./plugin/bindings.ts";
18
18
  export { MEDIA_SOURCE_LIMITS } from "./plugin/media.ts";
19
+ export { REQUEST_LIMITS, UNQUEUED_METHODS } from "./request-queue.ts";
19
20
  export { OSD_LIMITS } from "./plugin/osd.ts";
20
21
  export { TIMELINE_LIMITS } from "./plugin/timeline.ts";
21
22
  export { SECRET_LIMITS, SESSION_STORAGE_LIMITS } from "./plugin/services.ts";
@@ -14,6 +14,7 @@ export { HOST_CAPABILITIES } from "./host-capabilities.js";
14
14
  export { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BUILTIN_COMMANDS, BUILTIN_SUBMENUS, COMMAND_LIMITS, MENU_IDS, } from "./commands.js";
15
15
  export { BINDING_INPUTS } from "./plugin/bindings.js";
16
16
  export { MEDIA_SOURCE_LIMITS } from "./plugin/media.js";
17
+ export { REQUEST_LIMITS, UNQUEUED_METHODS } from "./request-queue.js";
17
18
  export { OSD_LIMITS } from "./plugin/osd.js";
18
19
  export { TIMELINE_LIMITS } from "./plugin/timeline.js";
19
20
  export { SECRET_LIMITS, SESSION_STORAGE_LIMITS } from "./plugin/services.js";
@@ -1,6 +1,6 @@
1
1
  import type { Runtime } from "./runtime.ts";
2
2
  import type { ScopeImpl } from "./scope.ts";
3
- import type { Commands } from "./types.ts";
3
+ import type { Commands, Palette } from "./types.ts";
4
4
  /**
5
5
  * One per plugin: the SDK's copy of the key labels of the plugin's own
6
6
  * commands. Started by the first `keys` read or a `player.on("commands.keys")`: it
@@ -16,4 +16,5 @@ declare class KeysService {
16
16
  }
17
17
  export declare const keysOf: (runtime: Runtime) => KeysService;
18
18
  export declare const commands: (scope: ScopeImpl) => Commands;
19
+ export declare const palette: (scope: ScopeImpl) => Palette;
19
20
  export {};