@vestra-player/sdk 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/capability-scan.json +2 -0
- package/dist/api-requests.js +1 -0
- package/dist/commands.js +1 -0
- package/dist/docs-tree.json.gz +0 -0
- package/dist/plugin/connection.d.ts +1 -1
- package/dist/plugin/connection.js +9 -3
- package/dist/plugin/testing/commands.d.ts +5 -0
- package/dist/plugin/testing/commands.js +5 -2
- package/dist/plugin/testing/index.d.ts +27 -0
- package/dist/plugin/testing/index.js +12 -0
- package/dist/plugin/testing/services.js +50 -1
- package/dist/plugin/types/base.d.ts +80 -2
- package/dist/plugin/types/packages.d.ts +10 -1
- package/dist/plugin/types/services.d.ts +10 -4
- package/dist/wire.d.ts +3 -0
- package/dist/wire.js +1 -0
- package/llms.txt +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.10.1
|
|
4
|
+
|
|
5
|
+
**Temporary windows: a product-data sync and the members that go with them.** Who must change: nobody. Additions and docs only; every existing behaviour of the SDK and of `TestHost` is as in 1.10.0 (a `TestHost` behaves differently only when a test sets the new `app.temporary`). Needs player 0.10.3 for the additions; an older player sends no `temporary` and refuses `app.openWindow`.
|
|
6
|
+
|
|
7
|
+
Player 0.10.3 adds temporary windows (like a browser's guest window): the playlist's Play in New Window starts a second player with a temporary profile, deleted when it closes, that reads the main window's plugin library and keychain and changes neither.
|
|
8
|
+
|
|
9
|
+
- **`AppInfo.temporary`** (new, optional): `true` in a temporary window, absent otherwise. A plugin that does background work for the user's profile (an automatic update check) skips it there.
|
|
10
|
+
- **`App.openWindow(paths)`** (new, **built-in plugins only**, as `commands.run`): opens 1 to 64 absolute file paths in a new temporary window and resolves with its `{ pid }`. A plugin that is not built in is refused with `capability`; `invalid` and `missing` for the paths, `unsupported` on macOS (not yet) and without windows, `failed` when the new player does not start. Message `app.openWindow` (area `app`).
|
|
11
|
+
- **`unavailable` in a temporary window** (docs; existing code): `Secrets.set` and `Secrets.delete` (`Secrets.get` reads the main window's values), `PackageCandidate.install`, `Packages.uninstall` and `Packages.setEnabled`. The error-code table says so.
|
|
12
|
+
- **`TestHost`**: `openedWindows` records a built-in plugin's `app.openWindow` (the paths checked as the player does; no process starts; `capability` for any other plugin, through the same check as `commands.run`), and `app.temporary` (new, optional) makes the plugin see `temporary: true` and refuses the five changes above with `unavailable`, as the player does.
|
|
13
|
+
- **Product data**: `BUILTIN_COMMANDS` gains the playlist's `playlist.play-new-window` (Play in New Window, the row menu only: `focus: "panel"`, no key; playlist 0.2.10). The Slint library copy, the submenus, the test host's texts and the palette colours match the player unchanged.
|
|
14
|
+
- **Dependencies** (Dependabot): `oxlint` 1.93.0, `@types/node` 26.6.6 in the lock file, and the `typos` (1.52.2) and `zizmor-action` (0.8.1) workflow actions.
|
|
15
|
+
|
|
16
|
+
The API surface snapshot gains `AppInfo.temporary`, `App.openWindow` and `TestHost.openedWindows`; `TestHost.app`'s line gains `temporary?: boolean` (the one changed line, an addition); no line goes.
|
|
17
|
+
|
|
3
18
|
## 1.10.0
|
|
4
19
|
|
|
5
20
|
**Events, triggers and the state stream: a plugin can learn what happens in the player without staying up for it.** Who must change: nobody. Everything below is an addition or a correction of the docs, except two behaviour changes (the update pass after an `mpv.observe` listener, and a timeline layer's range limit); `subscribe()` and `onChange()` keep working unchanged. Needs player 0.10.0 for the source events, triggers, what the player keeps through standby, and 1000 ranges; an older player sends no source events, refuses the `triggers.*` requests and more than 100 ranges, and everything else works with it.
|
package/capability-scan.json
CHANGED
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"none": {
|
|
81
81
|
"about": "Crosses no such boundary: the plugin's own contributions, the playback session, reading state.",
|
|
82
82
|
"members": [
|
|
83
|
+
"App.openWindow",
|
|
83
84
|
"App.system",
|
|
84
85
|
"BackdropSlot.onChange",
|
|
85
86
|
"Bindings.list",
|
|
@@ -279,6 +280,7 @@
|
|
|
279
280
|
"WireView.writeRows"
|
|
280
281
|
],
|
|
281
282
|
"requests": [
|
|
283
|
+
"app.openWindow",
|
|
282
284
|
"app.system",
|
|
283
285
|
"audio.addTrack",
|
|
284
286
|
"audio.selectTrack",
|
package/dist/api-requests.js
CHANGED
|
@@ -96,6 +96,7 @@ export const API_REQUESTS = Object.freeze({
|
|
|
96
96
|
"Commands.keys": [{ method: "commands.keys" }, listen("commands.keys")],
|
|
97
97
|
"Commands.list": [{ method: "commands.list" }],
|
|
98
98
|
"Commands.run": [{ method: "commands.run" }],
|
|
99
|
+
"App.openWindow": [{ method: "app.openWindow" }],
|
|
99
100
|
"Palette.lead": [{ method: "palette.lead.set" }],
|
|
100
101
|
"Host.run": [{ method: "host.run" }],
|
|
101
102
|
"Windows.create": [{ method: "ui.open" }],
|
package/dist/commands.js
CHANGED
|
@@ -539,6 +539,7 @@ vestra.playback | forward-3 | (Forward 60 s) | Shift+ArrowRight
|
|
|
539
539
|
vestra.playback | backward-4 | (Back 300 s) | Ctrl+Alt+ArrowLeft
|
|
540
540
|
vestra.playback | forward-4 | (Forward 300 s) | Ctrl+Alt+ArrowRight
|
|
541
541
|
vestra.playlist | playlist.play | (Play) | Enter | panel
|
|
542
|
+
vestra.playlist | playlist.play-new-window | (Play in New Window) | | panel
|
|
542
543
|
vestra.playlist | playlist.list-add | (Add Files…)
|
|
543
544
|
vestra.playlist | playlist.list-add-folder | (Add Folder…)
|
|
544
545
|
vestra.playlist | playlist.list-link | (Add Link…)
|
package/dist/docs-tree.json.gz
CHANGED
|
Binary file
|
|
@@ -193,5 +193,5 @@ export declare class Connection {
|
|
|
193
193
|
raw(event: string, listener: Listener): Disposable;
|
|
194
194
|
}
|
|
195
195
|
/** `plugin.app` from the start-up handshake (the runner's environment). */
|
|
196
|
-
export declare function appInfo(raw: unknown, system?: () => Promise<SystemInfo
|
|
196
|
+
export declare function appInfo(raw: unknown, system?: () => Promise<SystemInfo>, openWindow?: App["openWindow"]): App;
|
|
197
197
|
export {};
|
|
@@ -158,7 +158,7 @@ export class Connection {
|
|
|
158
158
|
locale: transport.locale,
|
|
159
159
|
});
|
|
160
160
|
const host = this.host;
|
|
161
|
-
this.app = appInfo(app, () => host.app.system());
|
|
161
|
+
this.app = appInfo(app, () => host.app.system(), (paths) => host.app.openWindow([...paths]));
|
|
162
162
|
const features = app
|
|
163
163
|
?.features;
|
|
164
164
|
this.features = new Set(Array.isArray(features)
|
|
@@ -542,7 +542,7 @@ function allWhys(group) {
|
|
|
542
542
|
return [...new Set([...group.whys.values()].map((why) => why()))];
|
|
543
543
|
}
|
|
544
544
|
/** `plugin.app` from the start-up handshake (the runner's environment). */
|
|
545
|
-
export function appInfo(raw, system = () => Promise.reject(failure("unavailable", "no player to ask"))) {
|
|
545
|
+
export function appInfo(raw, system = () => Promise.reject(failure("unavailable", "no player to ask")), openWindow = () => Promise.reject(failure("unavailable", "no player to ask"))) {
|
|
546
546
|
const info = (raw ?? {});
|
|
547
547
|
const parts = (info.components ?? {});
|
|
548
548
|
const text = (value) => (typeof value === "string" ? value : null);
|
|
@@ -558,8 +558,14 @@ export function appInfo(raw, system = () => Promise.reject(failure("unavailable"
|
|
|
558
558
|
libav: Object.freeze(libav),
|
|
559
559
|
slint: text(parts.slint) ?? "",
|
|
560
560
|
}),
|
|
561
|
+
// Only in a temporary window (player 0.10.3); absent otherwise.
|
|
562
|
+
...(info.temporary === true ? { temporary: true } : {}),
|
|
561
563
|
};
|
|
562
|
-
//
|
|
564
|
+
// Methods, not data: kept out of comparisons and JSON of the facts.
|
|
563
565
|
Object.defineProperty(app, "system", { value: system, enumerable: false });
|
|
566
|
+
Object.defineProperty(app, "openWindow", {
|
|
567
|
+
value: openWindow,
|
|
568
|
+
enumerable: false,
|
|
569
|
+
});
|
|
564
570
|
return Object.freeze(app);
|
|
565
571
|
}
|
|
@@ -67,6 +67,11 @@ export declare function press(host: TestHost, inner: Internals, binding: string,
|
|
|
67
67
|
export declare function barButtons(host: TestHost, _inner: Internals): readonly FakeBarButton[];
|
|
68
68
|
/** The default handlers of this area's wire methods, by method name. */
|
|
69
69
|
export declare function commandsHandlers(host: TestHost, inner: Internals): Record<string, Handler>;
|
|
70
|
+
/**
|
|
71
|
+
* The player's refusal of a built-in-only request to any other plugin
|
|
72
|
+
* (also `app.openWindow`, ./services.ts).
|
|
73
|
+
*/
|
|
74
|
+
export declare function builtinOnly(host: TestHost): void;
|
|
70
75
|
/** The default handlers of `commands.run` and `palette.lead`. */
|
|
71
76
|
export declare function builtinHandlers(host: TestHost, inner: Internals): Record<string, Handler>;
|
|
72
77
|
/** Implements `TestHost.runPaletteLead`. */
|
|
@@ -419,8 +419,11 @@ export function commandsHandlers(host, inner) {
|
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
/// ---------------------------------------------------------------- built-in only: commands.run, palette.lead
|
|
422
|
-
/**
|
|
423
|
-
|
|
422
|
+
/**
|
|
423
|
+
* The player's refusal of a built-in-only request to any other plugin
|
|
424
|
+
* (also `app.openWindow`, ./services.ts).
|
|
425
|
+
*/
|
|
426
|
+
export function builtinOnly(host) {
|
|
424
427
|
if (!host.builtin)
|
|
425
428
|
throw new HostError("capability", "this is for built-in plugins only");
|
|
426
429
|
}
|
|
@@ -2038,6 +2038,16 @@ export declare class TestHost implements Transport {
|
|
|
2038
2038
|
/** The Slint version. */
|
|
2039
2039
|
slint: string;
|
|
2040
2040
|
};
|
|
2041
|
+
/**
|
|
2042
|
+
* `true` to run as a temporary window
|
|
2043
|
+
* ({@link "@vestra-player/sdk"!AppInfo.temporary | AppInfo.temporary}):
|
|
2044
|
+
* the plugin sees it, and `secrets.set`, `secrets.delete`,
|
|
2045
|
+
* `packages.install`, `packages.uninstall` and `packages.setEnabled`
|
|
2046
|
+
* are refused with `unavailable`, as in the player.
|
|
2047
|
+
*
|
|
2048
|
+
* @since 1.10.1
|
|
2049
|
+
*/
|
|
2050
|
+
temporary?: boolean;
|
|
2041
2051
|
};
|
|
2042
2052
|
/**
|
|
2043
2053
|
* The player's rendering choice behind `plugin.rendering`. The mode drawing
|
|
@@ -2417,6 +2427,23 @@ export declare class TestHost implements Transport {
|
|
|
2417
2427
|
* @since 1.7.9
|
|
2418
2428
|
*/
|
|
2419
2429
|
paletteLead: Record<string, Json> | null;
|
|
2430
|
+
/**
|
|
2431
|
+
* Every temporary window a built-in plugin opened with `app.openWindow`,
|
|
2432
|
+
* oldest first: the files and the process id answered
|
|
2433
|
+
* ({@link "@vestra-player/sdk"!App.openWindow | App.openWindow}). No
|
|
2434
|
+
* process starts. A
|
|
2435
|
+
* plugin that is not built in is refused with `capability`, as in the
|
|
2436
|
+
* player; the files are checked as the player does (`invalid`,
|
|
2437
|
+
* `missing`).
|
|
2438
|
+
*
|
|
2439
|
+
* @since 1.10.1
|
|
2440
|
+
*/
|
|
2441
|
+
readonly openedWindows: {
|
|
2442
|
+
/** The files, as the plugin gave them. */
|
|
2443
|
+
paths: string[];
|
|
2444
|
+
/** The process id answered (made up: no process starts). */
|
|
2445
|
+
pid: number;
|
|
2446
|
+
}[];
|
|
2420
2447
|
/**
|
|
2421
2448
|
* Simulate the user activating the palette's lead row: Enter (`keep`:
|
|
2422
2449
|
* Shift+Enter) with `query` typed, or Enter on the status row
|
|
@@ -1937,6 +1937,18 @@ export class TestHost {
|
|
|
1937
1937
|
* @since 1.7.9
|
|
1938
1938
|
*/
|
|
1939
1939
|
paletteLead = null;
|
|
1940
|
+
/**
|
|
1941
|
+
* Every temporary window a built-in plugin opened with `app.openWindow`,
|
|
1942
|
+
* oldest first: the files and the process id answered
|
|
1943
|
+
* ({@link "@vestra-player/sdk"!App.openWindow | App.openWindow}). No
|
|
1944
|
+
* process starts. A
|
|
1945
|
+
* plugin that is not built in is refused with `capability`, as in the
|
|
1946
|
+
* player; the files are checked as the player does (`invalid`,
|
|
1947
|
+
* `missing`).
|
|
1948
|
+
*
|
|
1949
|
+
* @since 1.10.1
|
|
1950
|
+
*/
|
|
1951
|
+
openedWindows = [];
|
|
1940
1952
|
/**
|
|
1941
1953
|
* Simulate the user activating the palette's lead row: Enter (`keep`:
|
|
1942
1954
|
* Shift+Enter) with `query` typed, or Enter on the status row
|
|
@@ -7,12 +7,46 @@
|
|
|
7
7
|
* Internal to the SDK; not exported from `@vestra-player/sdk/testing`.
|
|
8
8
|
*/
|
|
9
9
|
import { statSync } from "node:fs";
|
|
10
|
+
import { isAbsolute } from "node:path";
|
|
10
11
|
import { HostError } from "../../wire.js";
|
|
11
12
|
import { SESSION_STORAGE_LIMITS } from "../services.js";
|
|
12
13
|
import { validStep } from "../player/rules.js";
|
|
13
14
|
import { runCore, windowFacts } from "./core-actions.js";
|
|
15
|
+
import { builtinOnly } from "./commands.js";
|
|
14
16
|
import { shownText, declaredText, shownValues, hostText } from "./i18n.js";
|
|
15
17
|
import { resetWrites, writeProperty, initialValues, seeImages, kebab, typedView, checkType, inSetOrder, } from "./layout.js";
|
|
18
|
+
/** As the player in a temporary window (system.rs `GUEST_SECRETS`). */
|
|
19
|
+
const GUEST_SECRETS = "a temporary window cannot save or delete sign-in details; use the main window";
|
|
20
|
+
/** As the player in a temporary window (package_manager.rs `GUEST_PACKAGES`). */
|
|
21
|
+
const GUEST_PACKAGES = "a temporary window cannot install, update, remove, enable or disable plugins; use the main window";
|
|
22
|
+
/** The player's refusal of a change to the shared keychain or library in a temporary window. */
|
|
23
|
+
function guestRefuses(host, message) {
|
|
24
|
+
if (host.app.temporary === true)
|
|
25
|
+
throw new HostError("unavailable", message);
|
|
26
|
+
}
|
|
27
|
+
/** `app.openWindow`'s files, checked as the player does (capabilities/app_windows.rs). */
|
|
28
|
+
function windowPaths(paths) {
|
|
29
|
+
if (!Array.isArray(paths))
|
|
30
|
+
throw new HostError("invalid", "paths requires a list of file paths");
|
|
31
|
+
if (!paths.length || paths.length > 64)
|
|
32
|
+
throw new HostError("invalid", "paths takes 1 to 64 files");
|
|
33
|
+
return paths.map((path) => {
|
|
34
|
+
if (typeof path !== "string")
|
|
35
|
+
throw new HostError("invalid", "each path is a string");
|
|
36
|
+
if (!isAbsolute(path))
|
|
37
|
+
throw new HostError("invalid", `${path} is not an absolute path`);
|
|
38
|
+
let file = false;
|
|
39
|
+
try {
|
|
40
|
+
file = statSync(path).isFile();
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Not there: `missing` below, as the player.
|
|
44
|
+
}
|
|
45
|
+
if (!file)
|
|
46
|
+
throw new HostError("missing", `${path} is not a file`);
|
|
47
|
+
return path;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
16
50
|
/** A `plugin.storage.session` key, checked as the player does. */
|
|
17
51
|
export function sessionKey(key) {
|
|
18
52
|
if (typeof key !== "string" ||
|
|
@@ -109,11 +143,15 @@ export function servicesHandlers(host, inner) {
|
|
|
109
143
|
"secrets.get": (p) => host.secrets.get(String(p.name)) ?? null,
|
|
110
144
|
"secrets.set": (p) => {
|
|
111
145
|
const name = String(p.name);
|
|
146
|
+
guestRefuses(host, GUEST_SECRETS);
|
|
112
147
|
if (!host.secrets.has(name) && host.secrets.size >= 256)
|
|
113
148
|
throw new HostError("limit", "a plugin stores at most 256 secret names");
|
|
114
149
|
host.secrets.set(name, String(p.value));
|
|
115
150
|
},
|
|
116
|
-
"secrets.delete": (p) =>
|
|
151
|
+
"secrets.delete": (p) => {
|
|
152
|
+
guestRefuses(host, GUEST_SECRETS);
|
|
153
|
+
host.secrets.delete(String(p.name));
|
|
154
|
+
},
|
|
117
155
|
// As the player (src/host/src/session_storage.rs).
|
|
118
156
|
"storage.session.get": (p) => {
|
|
119
157
|
const key = sessionKey(p.key);
|
|
@@ -140,6 +178,14 @@ export function servicesHandlers(host, inner) {
|
|
|
140
178
|
rendering: host.videoRender.gpu ? "gpu" : "software",
|
|
141
179
|
renderingReason: { ...host.rendering.reason },
|
|
142
180
|
}),
|
|
181
|
+
// Built-in only; no process starts: the call is recorded.
|
|
182
|
+
"app.openWindow": (p) => {
|
|
183
|
+
builtinOnly(host);
|
|
184
|
+
const paths = windowPaths(p.paths);
|
|
185
|
+
const pid = 40000 + host.openedWindows.length;
|
|
186
|
+
host.openedWindows.push({ paths, pid });
|
|
187
|
+
return { pid };
|
|
188
|
+
},
|
|
143
189
|
"clipboard.readText": () => host.clipboard.text,
|
|
144
190
|
"clipboard.writeText": (p) => {
|
|
145
191
|
if (typeof p.text !== "string")
|
|
@@ -352,6 +398,7 @@ export function servicesHandlers(host, inner) {
|
|
|
352
398
|
},
|
|
353
399
|
"packages.list": () => structuredClone(host.packages),
|
|
354
400
|
"packages.setEnabled": (p) => {
|
|
401
|
+
guestRefuses(host, GUEST_PACKAGES);
|
|
355
402
|
const id = String(p.id);
|
|
356
403
|
if (id === host.manifestId && p.enabled === false)
|
|
357
404
|
throw new HostError("invalid", "a plugin cannot disable itself");
|
|
@@ -394,6 +441,7 @@ export function servicesHandlers(host, inner) {
|
|
|
394
441
|
"packages.validate": (p) => validatePackage(host, inner, String(p.directory)),
|
|
395
442
|
"packages.validateArchive": (p) => validatePackage(host, inner, String(p.file)),
|
|
396
443
|
"packages.install": (p) => {
|
|
444
|
+
guestRefuses(host, GUEST_PACKAGES);
|
|
397
445
|
const manifest = host.candidates.get(String(p.token));
|
|
398
446
|
if (!manifest)
|
|
399
447
|
throw new HostError("stale", "unknown validation token");
|
|
@@ -448,6 +496,7 @@ export function servicesHandlers(host, inner) {
|
|
|
448
496
|
return { operationId: String(p.requestId), status: "committed" };
|
|
449
497
|
},
|
|
450
498
|
"packages.uninstall": (p) => {
|
|
499
|
+
guestRefuses(host, GUEST_PACKAGES);
|
|
451
500
|
const id = String(p.id);
|
|
452
501
|
const entry = host.packages.find((each) => each.id === id);
|
|
453
502
|
if (!entry)
|
|
@@ -94,12 +94,12 @@ export interface Disposable {
|
|
|
94
94
|
* | code | meaning |
|
|
95
95
|
* | --- | --- |
|
|
96
96
|
* | `stale` | A condition no longer held (the source or the subtitle selection changed); nothing was done. See {@link Conditional}. |
|
|
97
|
-
* | `capability` | The call is for the player's built-in plugins only (`commands.list`, `commands.run`, `palette.lead`) and this plugin is not one. |
|
|
97
|
+
* | `capability` | The call is for the player's built-in plugins only (`commands.list`, `commands.run`, `palette.lead`, `app.openWindow`) and this plugin is not one. |
|
|
98
98
|
* | `invalid` | A bad argument (out of range, malformed, unknown id). |
|
|
99
99
|
* | `missing` | The target does not exist (an empty panel position, a missing file, an unknown command). |
|
|
100
100
|
* | `busy` | The player is still doing a previous call of the same kind (a dialog is open, a step is in flight). |
|
|
101
101
|
* | `conflict` | Another plugin owns the resource (the sequence provider, the display layer, the backdrop, a menu path, the command palette's lead row), or this plugin already uses the id (a window or command id). |
|
|
102
|
-
* | `unavailable` | Not possible right now (no ready media, no user interface, fullscreen, a disabled core action). |
|
|
102
|
+
* | `unavailable` | Not possible right now (no ready media, no user interface, fullscreen, a disabled core action), or not in a temporary window (saving a secret, changing the plugin library; {@link AppInfo.temporary}). |
|
|
103
103
|
* | `unsupported` | Not possible on this system, build or source (a platform gap, software rendering, a source that cannot seek, a filter on a generated stream, an export the player cannot make as asked: a stream copy, a source bitrate it cannot tell). |
|
|
104
104
|
* | `backend` | Loading or resolving failed, or mpv failed a command or a property of {@link Mpv}; `message` is the backend's reason. |
|
|
105
105
|
* | `refused` | {@link Mpv}: a command or a property the pass-through does not carry (it would start a program, load code, write files, end the player, or change what the player manages); `message` names it and why. |
|
|
@@ -1011,6 +1011,40 @@ export interface AppInfo {
|
|
|
1011
1011
|
/** The linked Slint version, e.g. `"1.18.1"`. */
|
|
1012
1012
|
readonly slint: string;
|
|
1013
1013
|
};
|
|
1014
|
+
/**
|
|
1015
|
+
* `true` when this player is a temporary window (a guest, like a
|
|
1016
|
+
* browser's guest window): a second player the main one started with
|
|
1017
|
+
* {@link App.openWindow} (the playlist's Play in New Window), or one the
|
|
1018
|
+
* user started with `--guest`. Absent in the main player and in a player
|
|
1019
|
+
* before 0.10.3.
|
|
1020
|
+
*
|
|
1021
|
+
* @remarks
|
|
1022
|
+
* A temporary window runs with a temporary profile that is deleted when
|
|
1023
|
+
* it closes. Only the player's own settings (look, language, keys,
|
|
1024
|
+
* rendering, window layout) are copied from the main window. A plugin's
|
|
1025
|
+
* data directory (its options, history and lists included) and its
|
|
1026
|
+
* session storage start empty and are discarded when the window closes;
|
|
1027
|
+
* nothing a plugin writes reaches the main window. The plugin library and the keychain are
|
|
1028
|
+
* the main window's, read-only: {@link Secrets.get} reads the main
|
|
1029
|
+
* window's values, while {@link Secrets.set}, {@link Secrets.delete},
|
|
1030
|
+
* {@link PackageCandidate.install}, {@link Packages.uninstall} and
|
|
1031
|
+
* {@link Packages.setEnabled} reject with `unavailable`. A plugin that
|
|
1032
|
+
* does background work for the user's profile (an automatic update
|
|
1033
|
+
* check, a sync) skips it here; work the user starts still runs.
|
|
1034
|
+
*
|
|
1035
|
+
* @example Skip the automatic update check in a temporary window
|
|
1036
|
+
* The main window checks for updates once a day; a temporary window
|
|
1037
|
+
* leaves it to the main one. A check the user asks for still runs.
|
|
1038
|
+
* ```ts
|
|
1039
|
+
* declare function checkForUpdates(): Promise<void>;
|
|
1040
|
+
* // ---cut---
|
|
1041
|
+
* if (!plugin.app.temporary) void checkForUpdates();
|
|
1042
|
+
* ```
|
|
1043
|
+
*
|
|
1044
|
+
* @player 0.10.3
|
|
1045
|
+
* @since 1.10.1
|
|
1046
|
+
*/
|
|
1047
|
+
readonly temporary?: boolean;
|
|
1014
1048
|
}
|
|
1015
1049
|
/**
|
|
1016
1050
|
* `plugin.app`: the fixed facts plus the system, read on request.
|
|
@@ -1057,6 +1091,50 @@ export interface App extends AppInfo {
|
|
|
1057
1091
|
* @since 1.0.0
|
|
1058
1092
|
*/
|
|
1059
1093
|
system(): Promise<SystemInfo>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Open the files in a new temporary window: a second player with a
|
|
1096
|
+
* temporary profile ({@link AppInfo.temporary}) that plays the first file
|
|
1097
|
+
* and lists them all. Resolves once its process started, with its
|
|
1098
|
+
* process id. **Built-in plugins only.**
|
|
1099
|
+
*
|
|
1100
|
+
* @remarks
|
|
1101
|
+
* The playlist's Play in New Window. The new window is a separate player
|
|
1102
|
+
* process and keeps running after this one quits; it shares nothing with
|
|
1103
|
+
* the calling plugin.
|
|
1104
|
+
*
|
|
1105
|
+
* @param paths 1 to 64 absolute paths of existing files, in play order.
|
|
1106
|
+
*
|
|
1107
|
+
* @throws `capability` (rejects) The plugin is not built into the player.
|
|
1108
|
+
* @throws `invalid` (rejects) No path, more than 64, or a path that is not
|
|
1109
|
+
* an absolute path.
|
|
1110
|
+
* @throws `missing` (rejects) A path that is not an existing file.
|
|
1111
|
+
* @throws `unsupported` (rejects) On macOS (not yet), or a player without
|
|
1112
|
+
* windows.
|
|
1113
|
+
* @throws `failed` (rejects) The new player did not start.
|
|
1114
|
+
*
|
|
1115
|
+
* @example Play the selected files in a new window
|
|
1116
|
+
* The playlist's row menu opens the selected local files in a temporary
|
|
1117
|
+
* window, which plays them without changing the main window's list or
|
|
1118
|
+
* settings.
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* declare const selected: string[];
|
|
1121
|
+
* // ---cut---
|
|
1122
|
+
* try {
|
|
1123
|
+
* const { pid } = await plugin.app.openWindow(selected.slice(0, 64));
|
|
1124
|
+
* console.log("temporary window", pid);
|
|
1125
|
+
* } catch (error) {
|
|
1126
|
+
* // `capability`: not a built-in plugin; `unsupported`: macOS.
|
|
1127
|
+
* if ((error as PluginError).code !== "capability") throw error;
|
|
1128
|
+
* }
|
|
1129
|
+
* ```
|
|
1130
|
+
*
|
|
1131
|
+
* @player 0.10.3
|
|
1132
|
+
* @since 1.10.1
|
|
1133
|
+
*/
|
|
1134
|
+
openWindow(paths: readonly string[]): Promise<{
|
|
1135
|
+
/** The new player's process id. */
|
|
1136
|
+
readonly pid: number;
|
|
1137
|
+
}>;
|
|
1060
1138
|
}
|
|
1061
1139
|
/**
|
|
1062
1140
|
* What {@link App.system} reports.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Plugin } from "./base.ts";
|
|
1
|
+
import type { AppInfo, Plugin } from "./base.ts";
|
|
2
2
|
import type { Disposable } from "./base.ts";
|
|
3
3
|
/**
|
|
4
4
|
* The manifest of a package, as validated. The display fields and
|
|
@@ -160,6 +160,9 @@ export interface PackageCandidate {
|
|
|
160
160
|
* needed).
|
|
161
161
|
* @throws `stale` (rejects) The candidate is older than the 32 the player
|
|
162
162
|
* keeps.
|
|
163
|
+
* @throws `unavailable` (rejects) The player is a temporary window
|
|
164
|
+
* ({@link AppInfo.temporary}, player 0.10.3): it runs the main window's
|
|
165
|
+
* plugins as they are and installs or updates none.
|
|
163
166
|
*
|
|
164
167
|
* @example Replace a plugin installed from another source
|
|
165
168
|
* The new package replaces the installed plugin even though it came from
|
|
@@ -531,6 +534,9 @@ export interface Packages {
|
|
|
531
534
|
* @throws `missing` (rejects) An unknown id.
|
|
532
535
|
* @throws `busy` (rejects) The plugin is being installed or reloaded.
|
|
533
536
|
* @throws `unsupported` (rejects) A built-in plugin.
|
|
537
|
+
* @throws `unavailable` (rejects) The player is a temporary window
|
|
538
|
+
* ({@link AppInfo.temporary}, player 0.10.3): it runs the main window's
|
|
539
|
+
* plugins as they are and enables or disables none.
|
|
534
540
|
*
|
|
535
541
|
* @example Turn a third-party plugin off
|
|
536
542
|
* The plugin stops another plugin and keeps it disabled across launches
|
|
@@ -590,6 +596,9 @@ export interface Packages {
|
|
|
590
596
|
* plugin is being installed or reloaded.
|
|
591
597
|
* @throws `revisionConflict` (rejects) The installed revision of that
|
|
592
598
|
* plugin changed meanwhile; call `uninstall` again.
|
|
599
|
+
* @throws `unavailable` (rejects) The player is a temporary window
|
|
600
|
+
* ({@link AppInfo.temporary}, player 0.10.3): it runs the main window's
|
|
601
|
+
* plugins as they are and removes none.
|
|
593
602
|
*
|
|
594
603
|
* @example Uninstall a plugin together with its data
|
|
595
604
|
* The other plugin is removed and its data directory deleted, so a later
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Plugin, SystemInfo } from "./base.ts";
|
|
1
|
+
import type { AppInfo, Plugin, SystemInfo } from "./base.ts";
|
|
2
2
|
import type { RenderOptions } from "./processing.ts";
|
|
3
3
|
import type { Disposable } from "./base.ts";
|
|
4
4
|
/**
|
|
@@ -678,7 +678,9 @@ export interface System {
|
|
|
678
678
|
* Values are stored by the player in the system's secret store under this
|
|
679
679
|
* plugin's id: other plugins cannot read them. Names are 1–64 of
|
|
680
680
|
* `a-z 0-9 . _ -`, values 1–1024 bytes of text, at most 256 names per
|
|
681
|
-
* plugin (`SECRET_LIMITS`).
|
|
681
|
+
* plugin (`SECRET_LIMITS`). In a temporary window
|
|
682
|
+
* ({@link AppInfo.temporary}) `get` reads the main window's values and
|
|
683
|
+
* `set` and `delete` reject with `unavailable` (player 0.10.3).
|
|
682
684
|
*
|
|
683
685
|
* @since 1.0.0
|
|
684
686
|
* @category Services
|
|
@@ -715,7 +717,9 @@ export interface Secrets {
|
|
|
715
717
|
* @throws `limit` (rejects) A new name beyond 256.
|
|
716
718
|
* @throws `unsupported` (rejects) The system has no secret store.
|
|
717
719
|
* @throws `unavailable` (rejects) The store cannot be reached (no keychain,
|
|
718
|
-
* a read-only store, no logged-in session on Windows)
|
|
720
|
+
* a read-only store, no logged-in session on Windows), or the player is
|
|
721
|
+
* a temporary window ({@link AppInfo.temporary}, player 0.10.3), which
|
|
722
|
+
* reads the main window's secrets and saves none.
|
|
719
723
|
* @throws `failed` (rejects) The user denied access, or another system
|
|
720
724
|
* error.
|
|
721
725
|
*
|
|
@@ -741,7 +745,9 @@ export interface Secrets {
|
|
|
741
745
|
* @throws `invalid` (rejects) A bad name.
|
|
742
746
|
* @throws `unsupported` (rejects) The system has no secret store.
|
|
743
747
|
* @throws `unavailable` (rejects) The store cannot be reached (no keychain,
|
|
744
|
-
* a read-only store, no logged-in session on Windows)
|
|
748
|
+
* a read-only store, no logged-in session on Windows), or the player is
|
|
749
|
+
* a temporary window ({@link AppInfo.temporary}, player 0.10.3), which
|
|
750
|
+
* deletes none of the main window's secrets.
|
|
745
751
|
* @throws `failed` (rejects) The user denied access, or another system
|
|
746
752
|
* error.
|
|
747
753
|
*
|
package/dist/wire.d.ts
CHANGED
|
@@ -966,6 +966,9 @@ export declare function createWire(transport: Transport): {
|
|
|
966
966
|
};
|
|
967
967
|
app: {
|
|
968
968
|
system: () => Promise<WireSystemInfo>;
|
|
969
|
+
openWindow: (paths: string[]) => Promise<{
|
|
970
|
+
pid: number;
|
|
971
|
+
}>;
|
|
969
972
|
};
|
|
970
973
|
/**
|
|
971
974
|
* The rendering choice: `state`, `setPreference` and `restart`.
|
package/dist/wire.js
CHANGED
|
@@ -261,6 +261,7 @@ export function createWire(transport) {
|
|
|
261
261
|
},
|
|
262
262
|
app: {
|
|
263
263
|
system: () => transport.request("app.system"),
|
|
264
|
+
openWindow: (paths) => transport.request("app.openWindow", { paths }),
|
|
264
265
|
},
|
|
265
266
|
/**
|
|
266
267
|
* The rendering choice: `state`, `setPreference` and `restart`.
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vestra Player SDK
|
|
2
2
|
|
|
3
|
-
> @vestra-player/sdk 1.10.
|
|
3
|
+
> @vestra-player/sdk 1.10.1: 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.10.
|
|
3
|
+
"version": "1.10.1",
|
|
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": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "0.18.5",
|
|
78
|
-
"oxlint": "1.
|
|
78
|
+
"oxlint": "1.93.0",
|
|
79
79
|
"prettier": "^3.9.10",
|
|
80
80
|
"publint": "0.3.25",
|
|
81
81
|
"typedoc": "0.28.20",
|