@vestra-player/sdk 1.7.13 → 1.7.15
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/dist/commands.js +1 -1
- package/dist/docs-tree.json.gz +0 -0
- package/dist/plugin/commands.js +4 -1
- package/dist/plugin/testing/commands.d.ts +12 -0
- package/dist/plugin/testing/commands.js +37 -9
- package/dist/plugin/testing/index.js +2 -1
- package/dist/plugin/types/commands.d.ts +34 -0
- package/dist/plugin/types/ui-shell.d.ts +4 -3
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.15
|
|
4
|
+
|
|
5
|
+
**Who must change: nobody.** One optional field on an existing call (Ask Vestra UX, step 2: the status strip); `apiVersion` stays `vestra/1`, no new capability or message; the API surface snapshot gains the field.
|
|
6
|
+
|
|
7
|
+
- **`PaletteLeadOptions.status.state`** (`palette.lead.set`'s `status.state`): `"working"` (the default) or an end state, `"done"`, `"failed"` or `"note"`. While the palette is closed the player shows the status in a strip at the top of the main window: `working` with a moving line and a Stop button, until the status changes; an end state with a check, in the danger colour or plain, removed by the player after a few seconds and never shown again (not kept while the plugin is stopped), so the plugin needs no timer. Once `commands.run` has shown a step of the ticket in the strip, a `working` text changes only the palette's status row. The SDK sends `state` only when set; any other value is `invalid` (through `ready`, or `update` rejects). Players before the strip refuse the field with `invalid`; a built-in plugin ships with its player. Docs: [Reference: commands](docs/reference/commands.md#running-commands-for-the-user).
|
|
8
|
+
- **`TestHost`** checks `status.state` like the player (absent or `null` is `working`, any other value than the four is `invalid`) and keeps it in `host.paletteLead`; the end state's timing is the player's and is not modelled. Test: `test/builtin-only.test.ts`.
|
|
9
|
+
- **Docs, Windows confirmations** (player main 7cc5d648): `Dialogs.confirm` and [Platforms](docs/reference/platforms.md) say what the player now shows: `message` is the main instruction with `detail` below it, the `checkbox` is the dialog's own verification box (no second dialog), `checked` is reported on cancel too, and no system sound plays.
|
|
10
|
+
|
|
11
|
+
## 1.7.14
|
|
12
|
+
|
|
13
|
+
**Who must change: nobody.** A product-data refresh and a `TestHost` follow-up to player 0.8.0: no API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged.
|
|
14
|
+
|
|
15
|
+
- **`BUILTIN_COMMANDS`** (`vestra.workshop`, player a08759b0: Ask Vestra runs commands only): `askvestra.undo` (Undo Last Request) is gone; `askvestra.working` (Vestra is working) is new, `focus: "panel"`, in no menu, palette or bar (the plugin keeps itself busy with it while a request runs). The table in [Reference: commands](docs/reference/commands.md#built-in-commands) follows.
|
|
16
|
+
- **`bindings.list`** (player 0.8.0): a `focus: "panel"` command of a plugin whose manifest declares no `ui.mount` is left out, since no key can reach it; it stays declared, so its stored binding is not an orphan and `bindings.set` accepts it. `Bindings.list` says so, and `TestHost` follows for the plugin under test (from its manifest; a `TestHost` used without `startPlugin` lists every command as before). Test: `test/round3a.test.ts`.
|
|
17
|
+
|
|
3
18
|
## 1.7.13
|
|
4
19
|
|
|
5
20
|
**Who must change: nobody.** A product-data refresh of the Slint library copy: no API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged.
|
package/dist/commands.js
CHANGED
|
@@ -601,8 +601,8 @@ vestra.video | video.hue.down | (Hue -1%) | I
|
|
|
601
601
|
vestra.video | video.hue.up | (Hue +1%) | O
|
|
602
602
|
vestra.video | video.gpu-rendering | (GPU Rendering)
|
|
603
603
|
vestra.video | video.upscaling | (AI Upscaling)
|
|
604
|
-
vestra.workshop | askvestra.undo | (Undo Last Request)
|
|
605
604
|
vestra.workshop | askvestra.stop | (Stop)
|
|
605
|
+
vestra.workshop | askvestra.working | (Vestra is working) | | panel
|
|
606
606
|
`;
|
|
607
607
|
/**
|
|
608
608
|
* The commands the player and its built-in plugins register when the
|
package/dist/docs-tree.json.gz
CHANGED
|
Binary file
|
package/dist/plugin/commands.js
CHANGED
|
@@ -407,12 +407,15 @@ function leadJson(options) {
|
|
|
407
407
|
out.status = null;
|
|
408
408
|
else if (status !== undefined) {
|
|
409
409
|
if (typeof status !== "object")
|
|
410
|
-
throw failure("invalid", "status is { text, note? } or null");
|
|
410
|
+
throw failure("invalid", "status is { text, note?, state? } or null");
|
|
411
411
|
out.status = {
|
|
412
412
|
text: text(status.text, "status.text"),
|
|
413
413
|
...(status.note === undefined
|
|
414
414
|
? {}
|
|
415
415
|
: { note: text(status.note, "status.note") }),
|
|
416
|
+
// Sent only when set (players before it refuse the field); the
|
|
417
|
+
// player checks the value.
|
|
418
|
+
...(status.state === undefined ? {} : { state: status.state }),
|
|
416
419
|
};
|
|
417
420
|
}
|
|
418
421
|
return out;
|
|
@@ -23,6 +23,18 @@ export declare function splitCommandKey(_host: TestHost, _inner: Internals, key:
|
|
|
23
23
|
plugin: string;
|
|
24
24
|
command: string;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* The capabilities of the plugin under test's manifest, set by
|
|
28
|
+
* `startPlugin`; a host without an entry (requests sent by hand) lists
|
|
29
|
+
* every command in `bindings.list`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const pluginCapabilities: WeakMap<TestHost, readonly string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* `bindings.list`, as the player's (binding_manager.rs `list`, player
|
|
34
|
+
* 0.8.0): a `focus: "panel"` command of a plugin whose manifest declares no
|
|
35
|
+
* `ui.mount` can never fire from a key, so it is left out; it stays declared
|
|
36
|
+
* (its stored binding is no orphan, `bindings.set` accepts it).
|
|
37
|
+
*/
|
|
26
38
|
export declare function bindingTable(host: TestHost, inner: Internals): {
|
|
27
39
|
commands: {
|
|
28
40
|
title: string;
|
|
@@ -87,7 +87,34 @@ export function splitCommandKey(_host, _inner, key) {
|
|
|
87
87
|
const at = key.indexOf("/");
|
|
88
88
|
return { plugin: key.slice(0, at), command: key.slice(at + 1) };
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The capabilities of the plugin under test's manifest, set by
|
|
92
|
+
* `startPlugin`; a host without an entry (requests sent by hand) lists
|
|
93
|
+
* every command in `bindings.list`.
|
|
94
|
+
*/
|
|
95
|
+
export const pluginCapabilities = new WeakMap();
|
|
96
|
+
/**
|
|
97
|
+
* `bindings.list`, as the player's (binding_manager.rs `list`, player
|
|
98
|
+
* 0.8.0): a `focus: "panel"` command of a plugin whose manifest declares no
|
|
99
|
+
* `ui.mount` can never fire from a key, so it is left out; it stays declared
|
|
100
|
+
* (its stored binding is no orphan, `bindings.set` accepts it).
|
|
101
|
+
*/
|
|
90
102
|
export function bindingTable(host, inner) {
|
|
103
|
+
const all = bindingRows(host, inner);
|
|
104
|
+
const capabilities = pluginCapabilities.get(host);
|
|
105
|
+
const hidden = capabilities !== undefined && !capabilities.includes("ui.mount");
|
|
106
|
+
const declared = new Set(all.map((c) => `${c.plugin}/${c.command}`));
|
|
107
|
+
const commands = all.filter((c) => !(hidden && c.scope === "panel" && c.plugin === host.manifestId));
|
|
108
|
+
const orphans = [...host.bindings.overlay]
|
|
109
|
+
.filter(([key]) => !declared.has(key))
|
|
110
|
+
.map(([key, inputs]) => ({
|
|
111
|
+
ref: splitCommandKey(host, inner, key),
|
|
112
|
+
inputs,
|
|
113
|
+
}));
|
|
114
|
+
return { commands, orphans };
|
|
115
|
+
}
|
|
116
|
+
/** Every command's row of the binding table, bindable or not. */
|
|
117
|
+
function bindingRows(host, inner) {
|
|
91
118
|
const claims = bindingClaims(host, inner);
|
|
92
119
|
const commands = [...host.coreCommands, ...host.commands].map(([id, { declaration }]) => {
|
|
93
120
|
const key = bindingKey(host, inner, id);
|
|
@@ -124,14 +151,7 @@ export function bindingTable(host, inner) {
|
|
|
124
151
|
labels: [...current],
|
|
125
152
|
};
|
|
126
153
|
});
|
|
127
|
-
|
|
128
|
-
const orphans = [...host.bindings.overlay]
|
|
129
|
-
.filter(([key]) => !declared.has(key))
|
|
130
|
-
.map(([key, inputs]) => ({
|
|
131
|
-
ref: splitCommandKey(host, inner, key),
|
|
132
|
-
inputs,
|
|
133
|
-
}));
|
|
134
|
-
return { commands, orphans };
|
|
154
|
+
return commands;
|
|
135
155
|
}
|
|
136
156
|
/** A command's state as the player shows it: its conditions evaluated. */
|
|
137
157
|
export function commandShown(host, _inner, sent, when) {
|
|
@@ -393,7 +413,7 @@ export function commandsHandlers(host, inner) {
|
|
|
393
413
|
"bindings.list": () => bindingTable(host, inner),
|
|
394
414
|
"bindings.set": (p) => {
|
|
395
415
|
const key = `${p.plugin}/${p.command}`;
|
|
396
|
-
const known =
|
|
416
|
+
const known = bindingRows(host, inner).some((c) => `${c.plugin}/${c.command}` === key);
|
|
397
417
|
if (!known && !host.bindings.overlay.has(key))
|
|
398
418
|
throw new HostError("missing", `no command ${key}`);
|
|
399
419
|
host.bindings.overlay.set(key, [...p.inputs]);
|
|
@@ -502,6 +522,8 @@ const LEAD_TEXTS = {
|
|
|
502
522
|
"status.text": 80,
|
|
503
523
|
"status.note": 40,
|
|
504
524
|
};
|
|
525
|
+
/** `palette.lead.set`'s `status.state` (absent or null: `working`). */
|
|
526
|
+
const LEAD_STATES = ["working", "done", "failed", "note"];
|
|
505
527
|
/** The default handlers of `commands.run` and `palette.lead`. */
|
|
506
528
|
export function builtinHandlers(host, inner) {
|
|
507
529
|
return {
|
|
@@ -592,6 +614,12 @@ export function builtinHandlers(host, inner) {
|
|
|
592
614
|
}
|
|
593
615
|
if (typeof p.icon !== "string" && host.imagePath(p.icon) === null)
|
|
594
616
|
throw new HostError("invalid", "icon is an icon name or an image");
|
|
617
|
+
const state = p.status
|
|
618
|
+
?.state;
|
|
619
|
+
if (state !== undefined &&
|
|
620
|
+
state !== null &&
|
|
621
|
+
!LEAD_STATES.includes(state))
|
|
622
|
+
throw new HostError("invalid", `status.state is one of ${LEAD_STATES.join(", ")}`);
|
|
595
623
|
host.paletteLead = { ...p };
|
|
596
624
|
},
|
|
597
625
|
"palette.lead.clear": () => {
|
|
@@ -85,7 +85,7 @@ import { PATCH_FEATURE } from "../patch.js";
|
|
|
85
85
|
import { LOCALES, LIST_SEPARATORS, loadPackageCatalog, TEXT_LIMITS, } from "../../i18n.js";
|
|
86
86
|
import { Internals } from "./internals.js";
|
|
87
87
|
import { on, emit, settle, close, keepsRunning, transportHandlers, tick, takenErrors, tellResidency, } from "./transport.js";
|
|
88
|
-
import { bindingClaims, bindingKey, keysChanged, press, barButtons, commandsHandlers, builtinHandlers, runPaletteLead, } from "./commands.js";
|
|
88
|
+
import { bindingClaims, bindingKey, keysChanged, press, barButtons, commandsHandlers, builtinHandlers, runPaletteLead, pluginCapabilities, } from "./commands.js";
|
|
89
89
|
import { registerCoreActions, windowFacts, coreActionsHandlers, } from "./core-actions.js";
|
|
90
90
|
import { translate, i18nHandlers } from "./i18n.js";
|
|
91
91
|
import { mountOther, unmountOther, mounted, setTimelineRanges, setTimelineLayer, layoutHandlers, } from "./layout.js";
|
|
@@ -2840,6 +2840,7 @@ export async function startPlugin(activate, options = {}) {
|
|
|
2840
2840
|
manifest = { id: read.id, capabilities: read.capabilities };
|
|
2841
2841
|
}
|
|
2842
2842
|
host.manifestId = manifest.id;
|
|
2843
|
+
pluginCapabilities.set(host, manifest.capabilities);
|
|
2843
2844
|
if (options.builtin)
|
|
2844
2845
|
host.builtin = true;
|
|
2845
2846
|
host.loadCatalog(directory);
|
|
@@ -1116,12 +1116,41 @@ export interface PaletteLeadOptions {
|
|
|
1116
1116
|
/**
|
|
1117
1117
|
* Replaces the row while nothing is typed (a running request; the cursor
|
|
1118
1118
|
* starts on it); `null` or absent: none. Its run event has `status: true`.
|
|
1119
|
+
* While the palette is closed the player shows it in a status strip at
|
|
1120
|
+
* the top of the main window, as its `state` says.
|
|
1119
1121
|
*/
|
|
1120
1122
|
status?: {
|
|
1121
1123
|
/** The status text (up to 80 characters). */
|
|
1122
1124
|
text: string | Text;
|
|
1123
1125
|
/** On the right of the row (up to 40 characters). */
|
|
1124
1126
|
note?: string | Text;
|
|
1127
|
+
/**
|
|
1128
|
+
* Still working or ended. Absent: `"working"`.
|
|
1129
|
+
*
|
|
1130
|
+
* - `"working"`: the work goes on. The strip shows the text with a
|
|
1131
|
+
* moving line and a Stop button (Stop is Enter on the status row)
|
|
1132
|
+
* and stays until the status changes or is removed.
|
|
1133
|
+
* - `"done"`, `"failed"`, `"note"`: an end state (finished; failed; a
|
|
1134
|
+
* sentence for the user, such as an answer). The player shows it
|
|
1135
|
+
* with a check, in the danger colour, or plain, then removes it by
|
|
1136
|
+
* itself after a few seconds (about 2 s, 6 s, and 4–10 s by length;
|
|
1137
|
+
* longer while the pointer is on it). It is shown once: not kept,
|
|
1138
|
+
* not shown again later (when the plugin is stopped or woken), and
|
|
1139
|
+
* the row goes back to its usual form. The plugin needs no timer of
|
|
1140
|
+
* its own and may call {@link PaletteLead.done} right after setting
|
|
1141
|
+
* it.
|
|
1142
|
+
*
|
|
1143
|
+
* Once {@link Commands.run} has shown a step of the ticket in the
|
|
1144
|
+
* strip, a `"working"` text changes only the palette's status row,
|
|
1145
|
+
* until an end state, `status: null` or the end of the ticket.
|
|
1146
|
+
*
|
|
1147
|
+
* Players before the status strip refuse the field (`invalid`); a
|
|
1148
|
+
* built-in plugin ships with its player. Any other value: `invalid`
|
|
1149
|
+
* (through `ready`, or `update` rejects).
|
|
1150
|
+
*
|
|
1151
|
+
* @since 1.7.15
|
|
1152
|
+
*/
|
|
1153
|
+
state?: "working" | "done" | "failed" | "note";
|
|
1125
1154
|
} | null;
|
|
1126
1155
|
}
|
|
1127
1156
|
/**
|
|
@@ -1471,6 +1500,11 @@ export interface Bindings {
|
|
|
1471
1500
|
/**
|
|
1472
1501
|
* Every declared command, and overrides whose command is gone.
|
|
1473
1502
|
*
|
|
1503
|
+
* A `focus: "panel"` command of a plugin whose manifest does not declare
|
|
1504
|
+
* `ui.mount` is left out (player 0.8.0): it has no panel, so no key can
|
|
1505
|
+
* reach it. It is still declared: its stored binding is not an orphan,
|
|
1506
|
+
* and `set` accepts it.
|
|
1507
|
+
*
|
|
1474
1508
|
* @capability bindings.manage
|
|
1475
1509
|
* @throws `capability` (rejects) The manifest does not declare
|
|
1476
1510
|
* `bindings.manage`.
|
|
@@ -613,9 +613,10 @@ export interface Dialogs {
|
|
|
613
613
|
* tool window the user just clicked in), else on the main window.
|
|
614
614
|
*
|
|
615
615
|
* **Windows:** a task dialog owned by the active player window, titled
|
|
616
|
-
* "Vestra Player"
|
|
617
|
-
* `
|
|
618
|
-
*
|
|
616
|
+
* "Vestra Player" and centred on it: `message` is the main instruction
|
|
617
|
+
* and `detail` the text below it. A `checkbox` is the dialog's own
|
|
618
|
+
* verification box (no second dialog); `checked` is its state on cancel
|
|
619
|
+
* too. No system sound plays; `destructive` shows a warning icon.
|
|
619
620
|
*
|
|
620
621
|
* Remembering "Don't ask again" is up to the plugin (see
|
|
621
622
|
* {@link Scope.storage}).
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vestra Player SDK
|
|
2
2
|
|
|
3
|
-
> @vestra-player/sdk 1.7.
|
|
3
|
+
> @vestra-player/sdk 1.7.15: 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
|
|