@jdg-keyforge/protocol 0.7.0 → 0.9.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 +158 -1
- package/dist/index.d.ts +2 -0
- package/dist/methods/create_profile.d.ts +1 -1
- package/dist/methods/duplicate_profile.d.ts +1 -1
- package/dist/methods/export_profile.d.ts +26 -0
- package/dist/methods/export_profile.js +7 -0
- package/dist/methods/import_profile.d.ts +68 -0
- package/dist/methods/import_profile.js +7 -0
- package/dist/methods/list_actions.d.ts +1 -4
- package/dist/methods/list_bindings.d.ts +1 -1
- package/dist/methods/list_profiles.d.ts +1 -1
- package/dist/methods/set_binding.d.ts +1 -1
- package/package.json +1 -1
- package/src/common.ts +158 -1
- package/src/index.ts +2 -0
- package/src/methods/create_profile.ts +1 -1
- package/src/methods/duplicate_profile.ts +1 -1
- package/src/methods/export_profile.ts +28 -0
- package/src/methods/import_profile.ts +71 -0
- package/src/methods/list_actions.ts +1 -4
- package/src/methods/list_bindings.ts +1 -1
- package/src/methods/list_profiles.ts +1 -1
- package/src/methods/set_binding.ts +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface InputEvent {
|
|
|
57
57
|
*/
|
|
58
58
|
export interface Action {
|
|
59
59
|
/**
|
|
60
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
60
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
61
61
|
*/
|
|
62
62
|
type: string;
|
|
63
63
|
/**
|
|
@@ -149,6 +149,30 @@ export interface Profile {
|
|
|
149
149
|
*/
|
|
150
150
|
bindings: Binding[];
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* 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.
|
|
154
|
+
*
|
|
155
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
156
|
+
* via the `definition` "ExportedProfile".
|
|
157
|
+
*/
|
|
158
|
+
export interface ExportedProfile {
|
|
159
|
+
/**
|
|
160
|
+
* Magic marker identifying the file as a KeyForge profile export.
|
|
161
|
+
*/
|
|
162
|
+
format: "keyforge.profile";
|
|
163
|
+
/**
|
|
164
|
+
* Export format version. Currently 1; bumped if the on-disk shape changes.
|
|
165
|
+
*/
|
|
166
|
+
version: 1;
|
|
167
|
+
/**
|
|
168
|
+
* Human-friendly profile name.
|
|
169
|
+
*/
|
|
170
|
+
name: string;
|
|
171
|
+
/**
|
|
172
|
+
* Bindings that belong to the exported profile.
|
|
173
|
+
*/
|
|
174
|
+
bindings: Binding[];
|
|
175
|
+
}
|
|
152
176
|
/**
|
|
153
177
|
* A single physical input exposed by a device (a key or an encoder).
|
|
154
178
|
*
|
|
@@ -219,3 +243,136 @@ export interface AutoSwitchRule {
|
|
|
219
243
|
*/
|
|
220
244
|
profile_id: string;
|
|
221
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Describes one action parameter so a client can render an input for it.
|
|
248
|
+
*
|
|
249
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
250
|
+
* via the `definition` "ParamSpec".
|
|
251
|
+
*/
|
|
252
|
+
export interface ParamSpec {
|
|
253
|
+
/**
|
|
254
|
+
* Param key written into Action.params. Unique within the action.
|
|
255
|
+
*/
|
|
256
|
+
name: string;
|
|
257
|
+
/**
|
|
258
|
+
* Human-friendly field label.
|
|
259
|
+
*/
|
|
260
|
+
label: string;
|
|
261
|
+
/**
|
|
262
|
+
* Param value type. Only 'string' in v1.
|
|
263
|
+
*/
|
|
264
|
+
type: "string";
|
|
265
|
+
required: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Optional placeholder/example shown in the input.
|
|
268
|
+
*/
|
|
269
|
+
placeholder?: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 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.
|
|
273
|
+
*
|
|
274
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
275
|
+
* via the `definition` "PluginManifest".
|
|
276
|
+
*/
|
|
277
|
+
export interface PluginManifest {
|
|
278
|
+
/**
|
|
279
|
+
* Manifest format version. Currently 1; bumped if the manifest shape changes.
|
|
280
|
+
*/
|
|
281
|
+
manifest_version: 1;
|
|
282
|
+
/**
|
|
283
|
+
* 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.
|
|
284
|
+
*/
|
|
285
|
+
id: string;
|
|
286
|
+
/**
|
|
287
|
+
* Human-friendly plugin name for the UI.
|
|
288
|
+
*/
|
|
289
|
+
name: string;
|
|
290
|
+
/**
|
|
291
|
+
* Plugin version (SemVer 2.0).
|
|
292
|
+
*/
|
|
293
|
+
version: string;
|
|
294
|
+
/**
|
|
295
|
+
* Major version of the protocol the plugin speaks. Lets the daemon reject an incompatible plugin before spawning it. Currently '1'.
|
|
296
|
+
*/
|
|
297
|
+
protocol_version: "1";
|
|
298
|
+
/**
|
|
299
|
+
* Plugin author, shown in the UI.
|
|
300
|
+
*/
|
|
301
|
+
author?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Short description of what the plugin does.
|
|
304
|
+
*/
|
|
305
|
+
description?: string;
|
|
306
|
+
/**
|
|
307
|
+
* URL of the plugin homepage or source repository.
|
|
308
|
+
*/
|
|
309
|
+
homepage?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Category the UI groups the plugin's actions under (e.g. 'Audio', 'Streaming').
|
|
312
|
+
*/
|
|
313
|
+
category?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Path to the plugin icon, relative to the plugin root. No leading '/', no '\' and no ':'.
|
|
316
|
+
*/
|
|
317
|
+
icon?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The plugin supports exactly the OSes listed here.
|
|
320
|
+
*/
|
|
321
|
+
entrypoint: {
|
|
322
|
+
darwin?: PluginCommand;
|
|
323
|
+
linux?: PluginCommand;
|
|
324
|
+
windows?: PluginCommand;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Actions the plugin exposes. Each becomes bindable as 'plugin.<id>.<action id>'.
|
|
328
|
+
*
|
|
329
|
+
* @minItems 1
|
|
330
|
+
*/
|
|
331
|
+
actions: [PluginAction, ...PluginAction[]];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Executable plus arguments used to start a plugin process.
|
|
335
|
+
*
|
|
336
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
337
|
+
* via the `definition` "PluginCommand".
|
|
338
|
+
*/
|
|
339
|
+
export interface PluginCommand {
|
|
340
|
+
/**
|
|
341
|
+
* 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.
|
|
342
|
+
*/
|
|
343
|
+
path: string;
|
|
344
|
+
/**
|
|
345
|
+
* Arguments passed to the executable.
|
|
346
|
+
*/
|
|
347
|
+
args?: string[];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* An action a plugin exposes, declared in its manifest.
|
|
351
|
+
*
|
|
352
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
353
|
+
* via the `definition` "PluginAction".
|
|
354
|
+
*/
|
|
355
|
+
export interface PluginAction {
|
|
356
|
+
/**
|
|
357
|
+
* Action identifier, unique within the plugin. snake_case, no dots.
|
|
358
|
+
*/
|
|
359
|
+
id: string;
|
|
360
|
+
/**
|
|
361
|
+
* Human-friendly action name for the UI.
|
|
362
|
+
*/
|
|
363
|
+
name: string;
|
|
364
|
+
/**
|
|
365
|
+
* Optional longer description of what the action does.
|
|
366
|
+
*/
|
|
367
|
+
description?: string;
|
|
368
|
+
/**
|
|
369
|
+
* Input kinds the action can be bound to. Omitted means any kind.
|
|
370
|
+
*
|
|
371
|
+
* @minItems 1
|
|
372
|
+
*/
|
|
373
|
+
inputs?: [InputKind, ...InputKind[]];
|
|
374
|
+
/**
|
|
375
|
+
* Params this action accepts, in display order.
|
|
376
|
+
*/
|
|
377
|
+
params: ParamSpec[];
|
|
378
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ export * from './envelope.js';
|
|
|
3
3
|
export type { MethodCreateProfile } from './methods/create_profile.js';
|
|
4
4
|
export type { MethodDeleteProfile } from './methods/delete_profile.js';
|
|
5
5
|
export type { MethodDuplicateProfile } from './methods/duplicate_profile.js';
|
|
6
|
+
export type { MethodExportProfile } from './methods/export_profile.js';
|
|
6
7
|
export type { MethodGetAutoSwitch } from './methods/get_auto_switch.js';
|
|
7
8
|
export type { MethodHello } from './methods/hello.js';
|
|
9
|
+
export type { MethodImportProfile } from './methods/import_profile.js';
|
|
8
10
|
export type { MethodListActions } from './methods/list_actions.js';
|
|
9
11
|
export type { MethodListBindings } from './methods/list_bindings.js';
|
|
10
12
|
export type { MethodListDevices } from './methods/list_devices.js';
|
|
@@ -56,7 +56,7 @@ export interface Binding {
|
|
|
56
56
|
*/
|
|
57
57
|
export interface Action {
|
|
58
58
|
/**
|
|
59
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
59
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
60
60
|
*/
|
|
61
61
|
type: string;
|
|
62
62
|
/**
|
|
@@ -60,7 +60,7 @@ export interface Binding {
|
|
|
60
60
|
*/
|
|
61
61
|
export interface Action {
|
|
62
62
|
/**
|
|
63
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
63
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
64
64
|
*/
|
|
65
65
|
type: string;
|
|
66
66
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Serializes the profile identified by 'id' as a portable ExportedProfile document and writes it to 'path' on the daemon host's filesystem. The exported file omits the server-local id. Returns the path that was written.
|
|
8
|
+
*/
|
|
9
|
+
export interface MethodExportProfile {
|
|
10
|
+
params: {
|
|
11
|
+
/**
|
|
12
|
+
* Identifier of the profile to export.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Filesystem path on the daemon host where the exported file is written.
|
|
17
|
+
*/
|
|
18
|
+
path: string;
|
|
19
|
+
};
|
|
20
|
+
result: {
|
|
21
|
+
/**
|
|
22
|
+
* Echo of the path that was written.
|
|
23
|
+
*/
|
|
24
|
+
path: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].
|
|
8
|
+
*/
|
|
9
|
+
export type DeviceID = string;
|
|
10
|
+
/**
|
|
11
|
+
* What happened on the input.
|
|
12
|
+
*/
|
|
13
|
+
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
14
|
+
/**
|
|
15
|
+
* 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
|
+
*/
|
|
17
|
+
export interface MethodImportProfile {
|
|
18
|
+
params: {
|
|
19
|
+
/**
|
|
20
|
+
* Filesystem path on the daemon host of the exported file to import.
|
|
21
|
+
*/
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
result: {
|
|
25
|
+
profile: Profile;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
|
|
30
|
+
*/
|
|
31
|
+
export interface Profile {
|
|
32
|
+
/**
|
|
33
|
+
* Stable server-generated identifier for the profile.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Human-friendly profile name.
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Bindings that belong to this profile.
|
|
42
|
+
*/
|
|
43
|
+
bindings: Binding[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Maps an input on a specific device to an action.
|
|
47
|
+
*/
|
|
48
|
+
export interface Binding {
|
|
49
|
+
device_id: DeviceID;
|
|
50
|
+
input_id: string;
|
|
51
|
+
trigger: InputAction;
|
|
52
|
+
action: Action;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* An executable action bound to an input.
|
|
56
|
+
*/
|
|
57
|
+
export interface Action {
|
|
58
|
+
/**
|
|
59
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
60
|
+
*/
|
|
61
|
+
type: string;
|
|
62
|
+
/**
|
|
63
|
+
* Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
|
|
64
|
+
*/
|
|
65
|
+
params?: {
|
|
66
|
+
[k: string]: unknown;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -44,13 +44,10 @@ export interface ActionDescriptor {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Describes one action parameter so a client can render an input for it.
|
|
47
|
-
*
|
|
48
|
-
* This interface was referenced by `MethodListActions`'s JSON-Schema
|
|
49
|
-
* via the `definition` "ParamSpec".
|
|
50
47
|
*/
|
|
51
48
|
export interface ParamSpec {
|
|
52
49
|
/**
|
|
53
|
-
* Param key written into Action.params.
|
|
50
|
+
* Param key written into Action.params. Unique within the action.
|
|
54
51
|
*/
|
|
55
52
|
name: string;
|
|
56
53
|
/**
|
|
@@ -40,7 +40,7 @@ export interface Binding {
|
|
|
40
40
|
*/
|
|
41
41
|
export interface Action {
|
|
42
42
|
/**
|
|
43
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
43
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
44
44
|
*/
|
|
45
45
|
type: string;
|
|
46
46
|
/**
|
|
@@ -61,7 +61,7 @@ export interface Binding {
|
|
|
61
61
|
*/
|
|
62
62
|
export interface Action {
|
|
63
63
|
/**
|
|
64
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
64
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
65
65
|
*/
|
|
66
66
|
type: string;
|
|
67
67
|
/**
|
|
@@ -37,7 +37,7 @@ export interface Binding {
|
|
|
37
37
|
*/
|
|
38
38
|
export interface Action {
|
|
39
39
|
/**
|
|
40
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
40
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
41
41
|
*/
|
|
42
42
|
type: string;
|
|
43
43
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdg-keyforge/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "TypeScript types for the KeyForge WebSocket protocol, generated from the canonical JSON Schema contracts.",
|
|
5
5
|
"keywords": ["keyforge", "protocol", "types", "json-schema", "websocket"],
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/common.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface InputEvent {
|
|
|
60
60
|
*/
|
|
61
61
|
export interface Action {
|
|
62
62
|
/**
|
|
63
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
63
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
64
64
|
*/
|
|
65
65
|
type: string;
|
|
66
66
|
/**
|
|
@@ -152,6 +152,30 @@ export interface Profile {
|
|
|
152
152
|
*/
|
|
153
153
|
bindings: Binding[];
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* 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.
|
|
157
|
+
*
|
|
158
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
159
|
+
* via the `definition` "ExportedProfile".
|
|
160
|
+
*/
|
|
161
|
+
export interface ExportedProfile {
|
|
162
|
+
/**
|
|
163
|
+
* Magic marker identifying the file as a KeyForge profile export.
|
|
164
|
+
*/
|
|
165
|
+
format: "keyforge.profile";
|
|
166
|
+
/**
|
|
167
|
+
* Export format version. Currently 1; bumped if the on-disk shape changes.
|
|
168
|
+
*/
|
|
169
|
+
version: 1;
|
|
170
|
+
/**
|
|
171
|
+
* Human-friendly profile name.
|
|
172
|
+
*/
|
|
173
|
+
name: string;
|
|
174
|
+
/**
|
|
175
|
+
* Bindings that belong to the exported profile.
|
|
176
|
+
*/
|
|
177
|
+
bindings: Binding[];
|
|
178
|
+
}
|
|
155
179
|
/**
|
|
156
180
|
* A single physical input exposed by a device (a key or an encoder).
|
|
157
181
|
*
|
|
@@ -222,3 +246,136 @@ export interface AutoSwitchRule {
|
|
|
222
246
|
*/
|
|
223
247
|
profile_id: string;
|
|
224
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Describes one action parameter so a client can render an input for it.
|
|
251
|
+
*
|
|
252
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
253
|
+
* via the `definition` "ParamSpec".
|
|
254
|
+
*/
|
|
255
|
+
export interface ParamSpec {
|
|
256
|
+
/**
|
|
257
|
+
* Param key written into Action.params. Unique within the action.
|
|
258
|
+
*/
|
|
259
|
+
name: string;
|
|
260
|
+
/**
|
|
261
|
+
* Human-friendly field label.
|
|
262
|
+
*/
|
|
263
|
+
label: string;
|
|
264
|
+
/**
|
|
265
|
+
* Param value type. Only 'string' in v1.
|
|
266
|
+
*/
|
|
267
|
+
type: "string";
|
|
268
|
+
required: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Optional placeholder/example shown in the input.
|
|
271
|
+
*/
|
|
272
|
+
placeholder?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 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.
|
|
276
|
+
*
|
|
277
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
278
|
+
* via the `definition` "PluginManifest".
|
|
279
|
+
*/
|
|
280
|
+
export interface PluginManifest {
|
|
281
|
+
/**
|
|
282
|
+
* Manifest format version. Currently 1; bumped if the manifest shape changes.
|
|
283
|
+
*/
|
|
284
|
+
manifest_version: 1;
|
|
285
|
+
/**
|
|
286
|
+
* 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.
|
|
287
|
+
*/
|
|
288
|
+
id: string;
|
|
289
|
+
/**
|
|
290
|
+
* Human-friendly plugin name for the UI.
|
|
291
|
+
*/
|
|
292
|
+
name: string;
|
|
293
|
+
/**
|
|
294
|
+
* Plugin version (SemVer 2.0).
|
|
295
|
+
*/
|
|
296
|
+
version: string;
|
|
297
|
+
/**
|
|
298
|
+
* Major version of the protocol the plugin speaks. Lets the daemon reject an incompatible plugin before spawning it. Currently '1'.
|
|
299
|
+
*/
|
|
300
|
+
protocol_version: "1";
|
|
301
|
+
/**
|
|
302
|
+
* Plugin author, shown in the UI.
|
|
303
|
+
*/
|
|
304
|
+
author?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Short description of what the plugin does.
|
|
307
|
+
*/
|
|
308
|
+
description?: string;
|
|
309
|
+
/**
|
|
310
|
+
* URL of the plugin homepage or source repository.
|
|
311
|
+
*/
|
|
312
|
+
homepage?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Category the UI groups the plugin's actions under (e.g. 'Audio', 'Streaming').
|
|
315
|
+
*/
|
|
316
|
+
category?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Path to the plugin icon, relative to the plugin root. No leading '/', no '\' and no ':'.
|
|
319
|
+
*/
|
|
320
|
+
icon?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The plugin supports exactly the OSes listed here.
|
|
323
|
+
*/
|
|
324
|
+
entrypoint: {
|
|
325
|
+
darwin?: PluginCommand;
|
|
326
|
+
linux?: PluginCommand;
|
|
327
|
+
windows?: PluginCommand;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Actions the plugin exposes. Each becomes bindable as 'plugin.<id>.<action id>'.
|
|
331
|
+
*
|
|
332
|
+
* @minItems 1
|
|
333
|
+
*/
|
|
334
|
+
actions: [PluginAction, ...PluginAction[]];
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Executable plus arguments used to start a plugin process.
|
|
338
|
+
*
|
|
339
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
340
|
+
* via the `definition` "PluginCommand".
|
|
341
|
+
*/
|
|
342
|
+
export interface PluginCommand {
|
|
343
|
+
/**
|
|
344
|
+
* 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.
|
|
345
|
+
*/
|
|
346
|
+
path: string;
|
|
347
|
+
/**
|
|
348
|
+
* Arguments passed to the executable.
|
|
349
|
+
*/
|
|
350
|
+
args?: string[];
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* An action a plugin exposes, declared in its manifest.
|
|
354
|
+
*
|
|
355
|
+
* This interface was referenced by `CommonTypes`'s JSON-Schema
|
|
356
|
+
* via the `definition` "PluginAction".
|
|
357
|
+
*/
|
|
358
|
+
export interface PluginAction {
|
|
359
|
+
/**
|
|
360
|
+
* Action identifier, unique within the plugin. snake_case, no dots.
|
|
361
|
+
*/
|
|
362
|
+
id: string;
|
|
363
|
+
/**
|
|
364
|
+
* Human-friendly action name for the UI.
|
|
365
|
+
*/
|
|
366
|
+
name: string;
|
|
367
|
+
/**
|
|
368
|
+
* Optional longer description of what the action does.
|
|
369
|
+
*/
|
|
370
|
+
description?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Input kinds the action can be bound to. Omitted means any kind.
|
|
373
|
+
*
|
|
374
|
+
* @minItems 1
|
|
375
|
+
*/
|
|
376
|
+
inputs?: [InputKind, ...InputKind[]];
|
|
377
|
+
/**
|
|
378
|
+
* Params this action accepts, in display order.
|
|
379
|
+
*/
|
|
380
|
+
params: ParamSpec[];
|
|
381
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,10 @@ export * from './envelope.js';
|
|
|
6
6
|
export type { MethodCreateProfile } from './methods/create_profile.js';
|
|
7
7
|
export type { MethodDeleteProfile } from './methods/delete_profile.js';
|
|
8
8
|
export type { MethodDuplicateProfile } from './methods/duplicate_profile.js';
|
|
9
|
+
export type { MethodExportProfile } from './methods/export_profile.js';
|
|
9
10
|
export type { MethodGetAutoSwitch } from './methods/get_auto_switch.js';
|
|
10
11
|
export type { MethodHello } from './methods/hello.js';
|
|
12
|
+
export type { MethodImportProfile } from './methods/import_profile.js';
|
|
11
13
|
export type { MethodListActions } from './methods/list_actions.js';
|
|
12
14
|
export type { MethodListBindings } from './methods/list_bindings.js';
|
|
13
15
|
export type { MethodListDevices } from './methods/list_devices.js';
|
|
@@ -59,7 +59,7 @@ export interface Binding {
|
|
|
59
59
|
*/
|
|
60
60
|
export interface Action {
|
|
61
61
|
/**
|
|
62
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
62
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
63
63
|
*/
|
|
64
64
|
type: string;
|
|
65
65
|
/**
|
|
@@ -63,7 +63,7 @@ export interface Binding {
|
|
|
63
63
|
*/
|
|
64
64
|
export interface Action {
|
|
65
65
|
/**
|
|
66
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
66
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
67
67
|
*/
|
|
68
68
|
type: string;
|
|
69
69
|
/**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Serializes the profile identified by 'id' as a portable ExportedProfile document and writes it to 'path' on the daemon host's filesystem. The exported file omits the server-local id. Returns the path that was written.
|
|
10
|
+
*/
|
|
11
|
+
export interface MethodExportProfile {
|
|
12
|
+
params: {
|
|
13
|
+
/**
|
|
14
|
+
* Identifier of the profile to export.
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Filesystem path on the daemon host where the exported file is written.
|
|
19
|
+
*/
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
result: {
|
|
23
|
+
/**
|
|
24
|
+
* Echo of the path that was written.
|
|
25
|
+
*/
|
|
26
|
+
path: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].
|
|
10
|
+
*/
|
|
11
|
+
export type DeviceID = string;
|
|
12
|
+
/**
|
|
13
|
+
* What happened on the input.
|
|
14
|
+
*/
|
|
15
|
+
export type InputAction = "press" | "release" | "rotate_cw" | "rotate_ccw" | "click";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 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.
|
|
19
|
+
*/
|
|
20
|
+
export interface MethodImportProfile {
|
|
21
|
+
params: {
|
|
22
|
+
/**
|
|
23
|
+
* Filesystem path on the daemon host of the exported file to import.
|
|
24
|
+
*/
|
|
25
|
+
path: string;
|
|
26
|
+
};
|
|
27
|
+
result: {
|
|
28
|
+
profile: Profile;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
|
|
33
|
+
*/
|
|
34
|
+
export interface Profile {
|
|
35
|
+
/**
|
|
36
|
+
* Stable server-generated identifier for the profile.
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Human-friendly profile name.
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* Bindings that belong to this profile.
|
|
45
|
+
*/
|
|
46
|
+
bindings: Binding[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Maps an input on a specific device to an action.
|
|
50
|
+
*/
|
|
51
|
+
export interface Binding {
|
|
52
|
+
device_id: DeviceID;
|
|
53
|
+
input_id: string;
|
|
54
|
+
trigger: InputAction;
|
|
55
|
+
action: Action;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An executable action bound to an input.
|
|
59
|
+
*/
|
|
60
|
+
export interface Action {
|
|
61
|
+
/**
|
|
62
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
63
|
+
*/
|
|
64
|
+
type: string;
|
|
65
|
+
/**
|
|
66
|
+
* Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
|
|
67
|
+
*/
|
|
68
|
+
params?: {
|
|
69
|
+
[k: string]: unknown;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -46,13 +46,10 @@ export interface ActionDescriptor {
|
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Describes one action parameter so a client can render an input for it.
|
|
49
|
-
*
|
|
50
|
-
* This interface was referenced by `MethodListActions`'s JSON-Schema
|
|
51
|
-
* via the `definition` "ParamSpec".
|
|
52
49
|
*/
|
|
53
50
|
export interface ParamSpec {
|
|
54
51
|
/**
|
|
55
|
-
* Param key written into Action.params.
|
|
52
|
+
* Param key written into Action.params. Unique within the action.
|
|
56
53
|
*/
|
|
57
54
|
name: string;
|
|
58
55
|
/**
|
|
@@ -43,7 +43,7 @@ export interface Binding {
|
|
|
43
43
|
*/
|
|
44
44
|
export interface Action {
|
|
45
45
|
/**
|
|
46
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
46
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
47
47
|
*/
|
|
48
48
|
type: string;
|
|
49
49
|
/**
|
|
@@ -64,7 +64,7 @@ export interface Binding {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface Action {
|
|
66
66
|
/**
|
|
67
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
67
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
68
68
|
*/
|
|
69
69
|
type: string;
|
|
70
70
|
/**
|
|
@@ -40,7 +40,7 @@ export interface Binding {
|
|
|
40
40
|
*/
|
|
41
41
|
export interface Action {
|
|
42
42
|
/**
|
|
43
|
-
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
|
|
43
|
+
* Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain dots) and action ids never do, so the action id is everything after the last dot.
|
|
44
44
|
*/
|
|
45
45
|
type: string;
|
|
46
46
|
/**
|