@jdg-keyforge/protocol 0.10.0 → 0.12.0
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/dist/common.d.ts +55 -0
- package/dist/index.d.ts +5 -0
- package/dist/methods/create_profile.d.ts +19 -0
- package/dist/methods/duplicate_profile.d.ts +19 -0
- package/dist/methods/import_profile.d.ts +19 -0
- package/dist/methods/inspect_plugin.d.ts +149 -0
- package/dist/methods/inspect_plugin.js +7 -0
- package/dist/methods/install_plugin.d.ts +163 -0
- package/dist/methods/install_plugin.js +7 -0
- package/dist/methods/list_devices.d.ts +9 -0
- package/dist/methods/list_plugins.d.ts +160 -0
- package/dist/methods/list_plugins.js +7 -0
- package/dist/methods/list_profiles.d.ts +19 -0
- package/dist/methods/set_input_color.d.ts +30 -0
- package/dist/methods/set_input_color.js +7 -0
- package/dist/methods/uninstall_plugin.d.ts +21 -0
- package/dist/methods/uninstall_plugin.js +7 -0
- package/package.json +1 -1
- package/src/common.ts +55 -0
- package/src/index.ts +5 -0
- package/src/methods/create_profile.ts +19 -0
- package/src/methods/duplicate_profile.ts +19 -0
- package/src/methods/import_profile.ts +19 -0
- package/src/methods/inspect_plugin.ts +152 -0
- package/src/methods/install_plugin.ts +166 -0
- package/src/methods/list_devices.ts +9 -0
- package/src/methods/list_plugins.ts +163 -0
- package/src/methods/list_profiles.ts +19 -0
- package/src/methods/set_input_color.ts +33 -0
- package/src/methods/uninstall_plugin.ts +24 -0
package/dist/common.d.ts
CHANGED
|
@@ -24,6 +24,17 @@ export type InputKind = "key" | "encoder";
|
|
|
24
24
|
* via the `definition` "InputAction".
|
|
25
25
|
*/
|
|
26
26
|
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
27
|
+
/**
|
|
28
|
+
* RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
|
|
29
|
+
*
|
|
30
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
31
|
+
* via the `definition` "Color".
|
|
32
|
+
*/
|
|
33
|
+
export type Color = string;
|
|
34
|
+
/**
|
|
35
|
+
* RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
|
|
36
|
+
*/
|
|
37
|
+
export type Color1 = string;
|
|
27
38
|
/**
|
|
28
39
|
* Globally unique plugin identifier in reverse-DNS form (e.g. 'dev.jonidg.spotify'). Lowercase, at least two dot-separated segments, each starting with a letter. Used as the install folder name and as <plugin_id> in Action.type.
|
|
29
40
|
*
|
|
@@ -163,6 +174,24 @@ export interface Profile {
|
|
|
163
174
|
* Bindings that belong to this profile.
|
|
164
175
|
*/
|
|
165
176
|
bindings: Binding[];
|
|
177
|
+
/**
|
|
178
|
+
* LED colors this profile paints on RGB-capable inputs, applied by the daemon whenever the profile becomes active. An RGB input with no entry here is turned off. At most one entry per (device_id, input_id); the daemon enforces uniqueness. Absent means no colors.
|
|
179
|
+
*/
|
|
180
|
+
colors?: InputColor[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* LED color assigned to one input of a device.
|
|
184
|
+
*
|
|
185
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
186
|
+
* via the `definition` "InputColor".
|
|
187
|
+
*/
|
|
188
|
+
export interface InputColor {
|
|
189
|
+
device_id: DeviceID;
|
|
190
|
+
/**
|
|
191
|
+
* Logical identifier of the input within the device. Matches Device.inputs[].id.
|
|
192
|
+
*/
|
|
193
|
+
input_id: string;
|
|
194
|
+
color: Color;
|
|
166
195
|
}
|
|
167
196
|
/**
|
|
168
197
|
* Portable, on-disk representation of a profile, written by export_profile and read by import_profile. Carries no server-local id: the id is meaningless outside the originating installation, so import always assigns a fresh one. The 'version' field lets readers detect and adapt to format changes.
|
|
@@ -187,6 +216,10 @@ export interface ExportedProfile {
|
|
|
187
216
|
* Bindings that belong to the exported profile.
|
|
188
217
|
*/
|
|
189
218
|
bindings: Binding[];
|
|
219
|
+
/**
|
|
220
|
+
* LED colors of the exported profile. Same semantics as Profile.colors.
|
|
221
|
+
*/
|
|
222
|
+
colors?: InputColor[];
|
|
190
223
|
}
|
|
191
224
|
/**
|
|
192
225
|
* A single physical input exposed by a device (a key or an encoder).
|
|
@@ -204,6 +237,11 @@ export interface Input {
|
|
|
204
237
|
* Human-friendly label for the input (e.g. 'Key 1', 'Encoder'). Optional; clients fall back to id.
|
|
205
238
|
*/
|
|
206
239
|
label?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Whether the input has an RGB LED the daemon can drive through set_input_color. Absent means false.
|
|
242
|
+
*/
|
|
243
|
+
rgb?: boolean;
|
|
244
|
+
color?: Color1;
|
|
207
245
|
}
|
|
208
246
|
/**
|
|
209
247
|
* A HID device known to the daemon. Returned by list_devices.
|
|
@@ -300,6 +338,23 @@ export interface PluginLaunchInfo {
|
|
|
300
338
|
*/
|
|
301
339
|
protocol_version: "1";
|
|
302
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* A plugin installed in the daemon, with the state of its process.
|
|
343
|
+
*
|
|
344
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
345
|
+
* via the `definition` "InstalledPlugin".
|
|
346
|
+
*/
|
|
347
|
+
export interface InstalledPlugin {
|
|
348
|
+
manifest: PluginManifest;
|
|
349
|
+
/**
|
|
350
|
+
* State of the plugin process: 'starting' (spawned, hello not received yet), 'running' (connected), 'stopped' (not running, e.g. exited cleanly) or 'error' (failed to start or crashed; see 'error').
|
|
351
|
+
*/
|
|
352
|
+
status: "starting" | "running" | "stopped" | "error";
|
|
353
|
+
/**
|
|
354
|
+
* Human-readable reason why the plugin failed. The daemon sets it only when status is 'error' (not enforced by the schema).
|
|
355
|
+
*/
|
|
356
|
+
error?: string;
|
|
357
|
+
}
|
|
303
358
|
/**
|
|
304
359
|
* Contents of the manifest.json file at the root of a plugin. A plugin is distributed as a '.keyforgeplugin' file: a zip archive with manifest.json at its root (no wrapping folder) plus every file the manifest references. The daemon installs it by extracting the archive into '<config dir>/plugins/<id>/', taking the id from the manifest. All file paths in the manifest (icon, and entrypoint paths containing '/') are relative to the plugin root, use '/' as separator, and must stay inside the plugin root: the daemon rejects '..' segments and any path or archive entry that escapes the root.
|
|
305
360
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,19 @@ export type { MethodExportProfile } from './methods/export_profile.js';
|
|
|
7
7
|
export type { MethodGetAutoSwitch } from './methods/get_auto_switch.js';
|
|
8
8
|
export type { MethodHello } from './methods/hello.js';
|
|
9
9
|
export type { MethodImportProfile } from './methods/import_profile.js';
|
|
10
|
+
export type { MethodInspectPlugin } from './methods/inspect_plugin.js';
|
|
11
|
+
export type { MethodInstallPlugin } from './methods/install_plugin.js';
|
|
10
12
|
export type { MethodListActions } from './methods/list_actions.js';
|
|
11
13
|
export type { MethodListBindings } from './methods/list_bindings.js';
|
|
12
14
|
export type { MethodListDevices } from './methods/list_devices.js';
|
|
15
|
+
export type { MethodListPlugins } from './methods/list_plugins.js';
|
|
13
16
|
export type { MethodListProfiles } from './methods/list_profiles.js';
|
|
14
17
|
export type { MethodRenameProfile } from './methods/rename_profile.js';
|
|
15
18
|
export type { MethodSetActiveProfile } from './methods/set_active_profile.js';
|
|
16
19
|
export type { MethodSetAutoSwitch } from './methods/set_auto_switch.js';
|
|
17
20
|
export type { MethodSetBinding } from './methods/set_binding.js';
|
|
21
|
+
export type { MethodSetInputColor } from './methods/set_input_color.js';
|
|
22
|
+
export type { MethodUninstallPlugin } from './methods/uninstall_plugin.js';
|
|
18
23
|
export type { EventActionInvoked } from './events/action_invoked.js';
|
|
19
24
|
export type { EventActiveProfileChanged } from './events/active_profile_changed.js';
|
|
20
25
|
export type { EventInput } from './events/input.js';
|
|
@@ -11,6 +11,10 @@ export type DeviceID = string;
|
|
|
11
11
|
* What happened on the input.
|
|
12
12
|
*/
|
|
13
13
|
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
14
|
+
/**
|
|
15
|
+
* RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
|
|
16
|
+
*/
|
|
17
|
+
export type Color = string;
|
|
14
18
|
/**
|
|
15
19
|
* Creates a new profile. The server generates the id and returns the profile with an empty bindings array.
|
|
16
20
|
*/
|
|
@@ -41,6 +45,10 @@ export interface Profile {
|
|
|
41
45
|
* Bindings that belong to this profile.
|
|
42
46
|
*/
|
|
43
47
|
bindings: Binding[];
|
|
48
|
+
/**
|
|
49
|
+
* LED colors this profile paints on RGB-capable inputs, applied by the daemon whenever the profile becomes active. An RGB input with no entry here is turned off. At most one entry per (device_id, input_id); the daemon enforces uniqueness. Absent means no colors.
|
|
50
|
+
*/
|
|
51
|
+
colors?: InputColor[];
|
|
44
52
|
}
|
|
45
53
|
/**
|
|
46
54
|
* Maps an input on a specific device to an action.
|
|
@@ -66,3 +74,14 @@ export interface Action {
|
|
|
66
74
|
[k: string]: unknown;
|
|
67
75
|
};
|
|
68
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* LED color assigned to one input of a device.
|
|
79
|
+
*/
|
|
80
|
+
export interface InputColor {
|
|
81
|
+
device_id: DeviceID;
|
|
82
|
+
/**
|
|
83
|
+
* Logical identifier of the input within the device. Matches Device.inputs[].id.
|
|
84
|
+
*/
|
|
85
|
+
input_id: string;
|
|
86
|
+
color: Color;
|
|
87
|
+
}
|
|
@@ -11,6 +11,10 @@ export type DeviceID = string;
|
|
|
11
11
|
* What happened on the input.
|
|
12
12
|
*/
|
|
13
13
|
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
14
|
+
/**
|
|
15
|
+
* RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
|
|
16
|
+
*/
|
|
17
|
+
export type Color = string;
|
|
14
18
|
/**
|
|
15
19
|
* Creates a copy of an existing profile under a new name. The server generates a new id and copies the source profile's bindings. Does not change the active profile.
|
|
16
20
|
*/
|
|
@@ -45,6 +49,10 @@ export interface Profile {
|
|
|
45
49
|
* Bindings that belong to this profile.
|
|
46
50
|
*/
|
|
47
51
|
bindings: Binding[];
|
|
52
|
+
/**
|
|
53
|
+
* LED colors this profile paints on RGB-capable inputs, applied by the daemon whenever the profile becomes active. An RGB input with no entry here is turned off. At most one entry per (device_id, input_id); the daemon enforces uniqueness. Absent means no colors.
|
|
54
|
+
*/
|
|
55
|
+
colors?: InputColor[];
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* Maps an input on a specific device to an action.
|
|
@@ -70,3 +78,14 @@ export interface Action {
|
|
|
70
78
|
[k: string]: unknown;
|
|
71
79
|
};
|
|
72
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* LED color assigned to one input of a device.
|
|
83
|
+
*/
|
|
84
|
+
export interface InputColor {
|
|
85
|
+
device_id: DeviceID;
|
|
86
|
+
/**
|
|
87
|
+
* Logical identifier of the input within the device. Matches Device.inputs[].id.
|
|
88
|
+
*/
|
|
89
|
+
input_id: string;
|
|
90
|
+
color: Color;
|
|
91
|
+
}
|
|
@@ -11,6 +11,10 @@ export type DeviceID = string;
|
|
|
11
11
|
* What happened on the input.
|
|
12
12
|
*/
|
|
13
13
|
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
14
|
+
/**
|
|
15
|
+
* RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
|
|
16
|
+
*/
|
|
17
|
+
export type Color = string;
|
|
14
18
|
/**
|
|
15
19
|
* Reads an ExportedProfile document from 'path' on the daemon host's filesystem, validates it, and creates a new profile from it. The server generates a fresh id; any id in the file is ignored. Does not change the active profile. Returns the created profile.
|
|
16
20
|
*/
|
|
@@ -41,6 +45,10 @@ export interface Profile {
|
|
|
41
45
|
* Bindings that belong to this profile.
|
|
42
46
|
*/
|
|
43
47
|
bindings: Binding[];
|
|
48
|
+
/**
|
|
49
|
+
* LED colors this profile paints on RGB-capable inputs, applied by the daemon whenever the profile becomes active. An RGB input with no entry here is turned off. At most one entry per (device_id, input_id); the daemon enforces uniqueness. Absent means no colors.
|
|
50
|
+
*/
|
|
51
|
+
colors?: InputColor[];
|
|
44
52
|
}
|
|
45
53
|
/**
|
|
46
54
|
* Maps an input on a specific device to an action.
|
|
@@ -66,3 +74,14 @@ export interface Action {
|
|
|
66
74
|
[k: string]: unknown;
|
|
67
75
|
};
|
|
68
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* LED color assigned to one input of a device.
|
|
79
|
+
*/
|
|
80
|
+
export interface InputColor {
|
|
81
|
+
device_id: DeviceID;
|
|
82
|
+
/**
|
|
83
|
+
* Logical identifier of the input within the device. Matches Device.inputs[].id.
|
|
84
|
+
*/
|
|
85
|
+
input_id: string;
|
|
86
|
+
color: Color;
|
|
87
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Globally unique reverse-DNS plugin id; install folder name and <plugin_id> in Action.type.
|
|
8
|
+
*/
|
|
9
|
+
export type PluginID = string;
|
|
10
|
+
/**
|
|
11
|
+
* Kind of physical input.
|
|
12
|
+
*/
|
|
13
|
+
export type InputKind = "key" | "encoder";
|
|
14
|
+
/**
|
|
15
|
+
* Opens the '.keyforgeplugin' package at 'path' on the daemon host's filesystem and validates it exactly as install_plugin would (including rejecting a package with no entrypoint for the daemon host's OS), without installing or changing anything. Lets a client show a confirmation (name, author, version, actions) before installing.
|
|
16
|
+
*/
|
|
17
|
+
export interface MethodInspectPlugin {
|
|
18
|
+
params: {
|
|
19
|
+
/**
|
|
20
|
+
* Filesystem path on the daemon host of the '.keyforgeplugin' package.
|
|
21
|
+
*/
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
result: {
|
|
25
|
+
manifest: PluginManifest;
|
|
26
|
+
/**
|
|
27
|
+
* Version of the plugin with the same id that is currently installed, if any. Installing the package would replace it.
|
|
28
|
+
*/
|
|
29
|
+
installed_version?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Contents of the manifest.json file at the root of a plugin. A plugin is distributed as a '.keyforgeplugin' file: a zip archive with manifest.json at its root (no wrapping folder) plus every file the manifest references. The daemon installs it by extracting the archive into '<config dir>/plugins/<id>/', taking the id from the manifest. All file paths in the manifest (icon, and entrypoint paths containing '/') are relative to the plugin root, use '/' as separator, and must stay inside the plugin root: the daemon rejects '..' segments and any path or archive entry that escapes the root.
|
|
34
|
+
*/
|
|
35
|
+
export interface PluginManifest {
|
|
36
|
+
/**
|
|
37
|
+
* Manifest format version. Currently 1; bumped if the manifest shape changes.
|
|
38
|
+
*/
|
|
39
|
+
manifest_version: 1;
|
|
40
|
+
id: PluginID;
|
|
41
|
+
/**
|
|
42
|
+
* Human-friendly plugin name for the UI.
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* Plugin version (SemVer 2.0).
|
|
47
|
+
*/
|
|
48
|
+
version: string;
|
|
49
|
+
/**
|
|
50
|
+
* Major version of the protocol the plugin speaks. Lets the daemon reject an incompatible plugin before spawning it. Currently '1'.
|
|
51
|
+
*/
|
|
52
|
+
protocol_version: "1";
|
|
53
|
+
/**
|
|
54
|
+
* Plugin author, shown in the UI.
|
|
55
|
+
*/
|
|
56
|
+
author?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Short description of what the plugin does.
|
|
59
|
+
*/
|
|
60
|
+
description?: string;
|
|
61
|
+
/**
|
|
62
|
+
* URL of the plugin homepage or source repository.
|
|
63
|
+
*/
|
|
64
|
+
homepage?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Category the UI groups the plugin's actions under (e.g. 'Audio', 'Streaming').
|
|
67
|
+
*/
|
|
68
|
+
category?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Path to the plugin icon, relative to the plugin root. No leading '/', no '\' and no ':'.
|
|
71
|
+
*/
|
|
72
|
+
icon?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The plugin supports exactly the OSes listed here.
|
|
75
|
+
*/
|
|
76
|
+
entrypoint: {
|
|
77
|
+
darwin?: PluginCommand;
|
|
78
|
+
linux?: PluginCommand;
|
|
79
|
+
windows?: PluginCommand;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Actions the plugin exposes. Each becomes bindable as 'plugin.<id>.<action id>'.
|
|
83
|
+
*
|
|
84
|
+
* @minItems 1
|
|
85
|
+
*/
|
|
86
|
+
actions: [PluginAction, ...PluginAction[]];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Executable plus arguments used to start a plugin process.
|
|
90
|
+
*/
|
|
91
|
+
export interface PluginCommand {
|
|
92
|
+
/**
|
|
93
|
+
* Executable to run. A path containing '/' is resolved relative to the plugin root; a bare name (e.g. 'node') is looked up on the PATH. Always use '/' as separator, also on Windows; absolute paths, '\' and ':' are not allowed.
|
|
94
|
+
*/
|
|
95
|
+
path: string;
|
|
96
|
+
/**
|
|
97
|
+
* Arguments passed to the executable.
|
|
98
|
+
*/
|
|
99
|
+
args?: string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* An action a plugin exposes, declared in its manifest.
|
|
103
|
+
*/
|
|
104
|
+
export interface PluginAction {
|
|
105
|
+
/**
|
|
106
|
+
* Action identifier, unique within the plugin. snake_case, no dots.
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
/**
|
|
110
|
+
* Human-friendly action name for the UI.
|
|
111
|
+
*/
|
|
112
|
+
name: string;
|
|
113
|
+
/**
|
|
114
|
+
* Optional longer description of what the action does.
|
|
115
|
+
*/
|
|
116
|
+
description?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Input kinds the action can be bound to. Omitted means any kind.
|
|
119
|
+
*
|
|
120
|
+
* @minItems 1
|
|
121
|
+
*/
|
|
122
|
+
inputs?: [InputKind, ...InputKind[]];
|
|
123
|
+
/**
|
|
124
|
+
* Params this action accepts, in display order.
|
|
125
|
+
*/
|
|
126
|
+
params: ParamSpec[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Describes one action parameter so a client can render an input for it.
|
|
130
|
+
*/
|
|
131
|
+
export interface ParamSpec {
|
|
132
|
+
/**
|
|
133
|
+
* Param key written into Action.params. Unique within the action.
|
|
134
|
+
*/
|
|
135
|
+
name: string;
|
|
136
|
+
/**
|
|
137
|
+
* Human-friendly field label.
|
|
138
|
+
*/
|
|
139
|
+
label: string;
|
|
140
|
+
/**
|
|
141
|
+
* Param value type. Only 'string' in v1.
|
|
142
|
+
*/
|
|
143
|
+
type: "string";
|
|
144
|
+
required: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Optional placeholder/example shown in the input.
|
|
147
|
+
*/
|
|
148
|
+
placeholder?: string;
|
|
149
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Globally unique reverse-DNS plugin id; install folder name and <plugin_id> in Action.type.
|
|
8
|
+
*/
|
|
9
|
+
export type PluginID = string;
|
|
10
|
+
/**
|
|
11
|
+
* Kind of physical input.
|
|
12
|
+
*/
|
|
13
|
+
export type InputKind = "key" | "encoder";
|
|
14
|
+
/**
|
|
15
|
+
* Installs the '.keyforgeplugin' package at 'path' on the daemon host's filesystem: validates it, extracts it into '<config dir>/plugins/<id>/' and starts the plugin. A package with no entrypoint for the daemon host's OS is rejected with an error and nothing is installed. The response is sent right after spawning, so the returned status is normally 'starting'; clients refresh with list_plugins. If a plugin with the same id is already installed, it is replaced (upgrade): the old process is stopped and its folder swapped atomically. Bindings are never modified, so existing bindings to the plugin's actions keep working after an upgrade.
|
|
16
|
+
*/
|
|
17
|
+
export interface MethodInstallPlugin {
|
|
18
|
+
params: {
|
|
19
|
+
/**
|
|
20
|
+
* Filesystem path on the daemon host of the '.keyforgeplugin' package.
|
|
21
|
+
*/
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
result: {
|
|
25
|
+
plugin: InstalledPlugin;
|
|
26
|
+
/**
|
|
27
|
+
* Version that was replaced, present only when the install was an upgrade.
|
|
28
|
+
*/
|
|
29
|
+
previous_version?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A plugin installed in the daemon, with the state of its process.
|
|
34
|
+
*/
|
|
35
|
+
export interface InstalledPlugin {
|
|
36
|
+
manifest: PluginManifest;
|
|
37
|
+
/**
|
|
38
|
+
* State of the plugin process: 'starting' (spawned, hello not received yet), 'running' (connected), 'stopped' (not running, e.g. exited cleanly) or 'error' (failed to start or crashed; see 'error').
|
|
39
|
+
*/
|
|
40
|
+
status: "starting" | "running" | "stopped" | "error";
|
|
41
|
+
/**
|
|
42
|
+
* Human-readable reason why the plugin failed. The daemon sets it only when status is 'error' (not enforced by the schema).
|
|
43
|
+
*/
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Contents of the manifest.json file at the root of a plugin. A plugin is distributed as a '.keyforgeplugin' file: a zip archive with manifest.json at its root (no wrapping folder) plus every file the manifest references. The daemon installs it by extracting the archive into '<config dir>/plugins/<id>/', taking the id from the manifest. All file paths in the manifest (icon, and entrypoint paths containing '/') are relative to the plugin root, use '/' as separator, and must stay inside the plugin root: the daemon rejects '..' segments and any path or archive entry that escapes the root.
|
|
48
|
+
*/
|
|
49
|
+
export interface PluginManifest {
|
|
50
|
+
/**
|
|
51
|
+
* Manifest format version. Currently 1; bumped if the manifest shape changes.
|
|
52
|
+
*/
|
|
53
|
+
manifest_version: 1;
|
|
54
|
+
id: PluginID;
|
|
55
|
+
/**
|
|
56
|
+
* Human-friendly plugin name for the UI.
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
/**
|
|
60
|
+
* Plugin version (SemVer 2.0).
|
|
61
|
+
*/
|
|
62
|
+
version: string;
|
|
63
|
+
/**
|
|
64
|
+
* Major version of the protocol the plugin speaks. Lets the daemon reject an incompatible plugin before spawning it. Currently '1'.
|
|
65
|
+
*/
|
|
66
|
+
protocol_version: "1";
|
|
67
|
+
/**
|
|
68
|
+
* Plugin author, shown in the UI.
|
|
69
|
+
*/
|
|
70
|
+
author?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Short description of what the plugin does.
|
|
73
|
+
*/
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* URL of the plugin homepage or source repository.
|
|
77
|
+
*/
|
|
78
|
+
homepage?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Category the UI groups the plugin's actions under (e.g. 'Audio', 'Streaming').
|
|
81
|
+
*/
|
|
82
|
+
category?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Path to the plugin icon, relative to the plugin root. No leading '/', no '\' and no ':'.
|
|
85
|
+
*/
|
|
86
|
+
icon?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The plugin supports exactly the OSes listed here.
|
|
89
|
+
*/
|
|
90
|
+
entrypoint: {
|
|
91
|
+
darwin?: PluginCommand;
|
|
92
|
+
linux?: PluginCommand;
|
|
93
|
+
windows?: PluginCommand;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Actions the plugin exposes. Each becomes bindable as 'plugin.<id>.<action id>'.
|
|
97
|
+
*
|
|
98
|
+
* @minItems 1
|
|
99
|
+
*/
|
|
100
|
+
actions: [PluginAction, ...PluginAction[]];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Executable plus arguments used to start a plugin process.
|
|
104
|
+
*/
|
|
105
|
+
export interface PluginCommand {
|
|
106
|
+
/**
|
|
107
|
+
* Executable to run. A path containing '/' is resolved relative to the plugin root; a bare name (e.g. 'node') is looked up on the PATH. Always use '/' as separator, also on Windows; absolute paths, '\' and ':' are not allowed.
|
|
108
|
+
*/
|
|
109
|
+
path: string;
|
|
110
|
+
/**
|
|
111
|
+
* Arguments passed to the executable.
|
|
112
|
+
*/
|
|
113
|
+
args?: string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* An action a plugin exposes, declared in its manifest.
|
|
117
|
+
*/
|
|
118
|
+
export interface PluginAction {
|
|
119
|
+
/**
|
|
120
|
+
* Action identifier, unique within the plugin. snake_case, no dots.
|
|
121
|
+
*/
|
|
122
|
+
id: string;
|
|
123
|
+
/**
|
|
124
|
+
* Human-friendly action name for the UI.
|
|
125
|
+
*/
|
|
126
|
+
name: string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional longer description of what the action does.
|
|
129
|
+
*/
|
|
130
|
+
description?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Input kinds the action can be bound to. Omitted means any kind.
|
|
133
|
+
*
|
|
134
|
+
* @minItems 1
|
|
135
|
+
*/
|
|
136
|
+
inputs?: [InputKind, ...InputKind[]];
|
|
137
|
+
/**
|
|
138
|
+
* Params this action accepts, in display order.
|
|
139
|
+
*/
|
|
140
|
+
params: ParamSpec[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Describes one action parameter so a client can render an input for it.
|
|
144
|
+
*/
|
|
145
|
+
export interface ParamSpec {
|
|
146
|
+
/**
|
|
147
|
+
* Param key written into Action.params. Unique within the action.
|
|
148
|
+
*/
|
|
149
|
+
name: string;
|
|
150
|
+
/**
|
|
151
|
+
* Human-friendly field label.
|
|
152
|
+
*/
|
|
153
|
+
label: string;
|
|
154
|
+
/**
|
|
155
|
+
* Param value type. Only 'string' in v1.
|
|
156
|
+
*/
|
|
157
|
+
type: "string";
|
|
158
|
+
required: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Optional placeholder/example shown in the input.
|
|
161
|
+
*/
|
|
162
|
+
placeholder?: string;
|
|
163
|
+
}
|
|
@@ -11,6 +11,10 @@ export type DeviceID = string;
|
|
|
11
11
|
* Kind of physical input.
|
|
12
12
|
*/
|
|
13
13
|
export type InputKind = "key" | "encoder";
|
|
14
|
+
/**
|
|
15
|
+
* Color the active profile paints on this input. Only set on RGB inputs that have a color in the active profile; absent means the LED is off.
|
|
16
|
+
*/
|
|
17
|
+
export type Color = string;
|
|
14
18
|
/**
|
|
15
19
|
* Returns the HID devices currently known to the daemon. No filters in v1; clients filter client-side if needed.
|
|
16
20
|
*/
|
|
@@ -73,4 +77,9 @@ export interface Input {
|
|
|
73
77
|
* Human-friendly label for the input (e.g. 'Key 1', 'Encoder'). Optional; clients fall back to id.
|
|
74
78
|
*/
|
|
75
79
|
label?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the input has an RGB LED the daemon can drive through set_input_color. Absent means false.
|
|
82
|
+
*/
|
|
83
|
+
rgb?: boolean;
|
|
84
|
+
color?: Color;
|
|
76
85
|
}
|