@jdg-keyforge/protocol 0.6.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -0
  3. package/dist/common.d.ts +171 -0
  4. package/dist/common.js +7 -0
  5. package/dist/envelope.d.ts +91 -0
  6. package/dist/envelope.js +7 -0
  7. package/dist/events/active_profile_changed.d.ts +16 -0
  8. package/dist/events/active_profile_changed.js +7 -0
  9. package/dist/events/input.d.ts +39 -0
  10. package/dist/events/input.js +7 -0
  11. package/dist/index.d.ts +17 -0
  12. package/dist/index.js +3 -0
  13. package/dist/methods/create_profile.d.ts +68 -0
  14. package/dist/methods/create_profile.js +7 -0
  15. package/dist/methods/delete_profile.d.ts +22 -0
  16. package/dist/methods/delete_profile.js +7 -0
  17. package/dist/methods/duplicate_profile.d.ts +72 -0
  18. package/dist/methods/duplicate_profile.js +7 -0
  19. package/dist/methods/get_auto_switch.d.ts +37 -0
  20. package/dist/methods/get_auto_switch.js +7 -0
  21. package/dist/methods/hello.d.ts +40 -0
  22. package/dist/methods/hello.js +7 -0
  23. package/dist/methods/list_actions.d.ts +69 -0
  24. package/dist/methods/list_actions.js +7 -0
  25. package/dist/methods/list_bindings.d.ts +52 -0
  26. package/dist/methods/list_bindings.js +7 -0
  27. package/dist/methods/list_devices.d.ts +76 -0
  28. package/dist/methods/list_devices.js +7 -0
  29. package/dist/methods/list_profiles.d.ts +73 -0
  30. package/dist/methods/list_profiles.js +7 -0
  31. package/dist/methods/rename_profile.d.ts +24 -0
  32. package/dist/methods/rename_profile.js +7 -0
  33. package/dist/methods/set_active_profile.d.ts +22 -0
  34. package/dist/methods/set_active_profile.js +7 -0
  35. package/dist/methods/set_auto_switch.d.ts +43 -0
  36. package/dist/methods/set_auto_switch.js +7 -0
  37. package/dist/methods/set_binding.d.ts +49 -0
  38. package/dist/methods/set_binding.js +7 -0
  39. package/package.json +48 -0
  40. package/src/common.ts +174 -0
  41. package/src/envelope.ts +94 -0
  42. package/src/events/active_profile_changed.ts +18 -0
  43. package/src/events/input.ts +42 -0
  44. package/src/index.ts +21 -0
  45. package/src/methods/create_profile.ts +71 -0
  46. package/src/methods/delete_profile.ts +24 -0
  47. package/src/methods/duplicate_profile.ts +75 -0
  48. package/src/methods/get_auto_switch.ts +39 -0
  49. package/src/methods/hello.ts +42 -0
  50. package/src/methods/list_actions.ts +71 -0
  51. package/src/methods/list_bindings.ts +55 -0
  52. package/src/methods/list_devices.ts +79 -0
  53. package/src/methods/list_profiles.ts +76 -0
  54. package/src/methods/rename_profile.ts +26 -0
  55. package/src/methods/set_active_profile.ts +24 -0
  56. package/src/methods/set_auto_switch.ts +45 -0
  57. package/src/methods/set_binding.ts +52 -0
@@ -0,0 +1,55 @@
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
+ * Returns all bindings the daemon currently has configured. Read-side counterpart of set_binding. No filters in v1; clients filter client-side if needed.
19
+ */
20
+ export interface MethodListBindings {
21
+ /**
22
+ * No parameters in v1.
23
+ */
24
+ params: {};
25
+ result: {
26
+ /**
27
+ * All currently configured bindings.
28
+ */
29
+ bindings: Binding[];
30
+ };
31
+ }
32
+ /**
33
+ * Maps an input on a specific device to an action.
34
+ */
35
+ export interface Binding {
36
+ device_id: DeviceID;
37
+ input_id: string;
38
+ trigger: InputAction;
39
+ action: Action;
40
+ }
41
+ /**
42
+ * An executable action bound to an input.
43
+ */
44
+ export interface Action {
45
+ /**
46
+ * Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
47
+ */
48
+ type: string;
49
+ /**
50
+ * Action-specific parameters. Schema depends on 'type'.
51
+ */
52
+ params?: {
53
+ [k: string]: unknown;
54
+ };
55
+ }
@@ -0,0 +1,79 @@
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
+ * Kind of physical input.
14
+ */
15
+ export type InputKind = "key" | "encoder";
16
+
17
+ /**
18
+ * Returns the HID devices currently known to the daemon. No filters in v1; clients filter client-side if needed.
19
+ */
20
+ export interface MethodListDevices {
21
+ /**
22
+ * No parameters in v1.
23
+ */
24
+ params: {};
25
+ result: {
26
+ /**
27
+ * All currently enumerated HID devices.
28
+ */
29
+ devices: Device[];
30
+ };
31
+ }
32
+ /**
33
+ * A HID device known to the daemon. Returned by list_devices.
34
+ */
35
+ export interface Device {
36
+ id: DeviceID;
37
+ /**
38
+ * USB Vendor ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x' prefix).
39
+ */
40
+ vendor_id: string;
41
+ /**
42
+ * USB Product ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x' prefix).
43
+ */
44
+ product_id: string;
45
+ /**
46
+ * Manufacturer string from the HID descriptor. May be missing on cheap/clone devices.
47
+ */
48
+ manufacturer?: string;
49
+ /**
50
+ * Product name string from the HID descriptor.
51
+ */
52
+ product?: string;
53
+ /**
54
+ * Serial number string from the HID descriptor. Not all HID devices expose one.
55
+ */
56
+ serial_number?: string;
57
+ /**
58
+ * OS-opaque path used by the HID library to (re)open the device. Format varies per OS; clients should treat it as an opaque token.
59
+ */
60
+ path: string;
61
+ /**
62
+ * Inputs (keys/encoders) the daemon knows this device exposes. Empty for unrecognized devices the daemon can't map.
63
+ */
64
+ inputs: Input[];
65
+ }
66
+ /**
67
+ * A single physical input exposed by a device (a key or an encoder).
68
+ */
69
+ export interface Input {
70
+ /**
71
+ * Logical identifier of the input within the device (e.g. 'key_0x04', 'encoder_0'). Matches InputEvent.input_id and Binding.input_id.
72
+ */
73
+ id: string;
74
+ kind: InputKind;
75
+ /**
76
+ * Human-friendly label for the input (e.g. 'Key 1', 'Encoder'). Optional; clients fall back to id.
77
+ */
78
+ label?: string;
79
+ }
@@ -0,0 +1,76 @@
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
+ * Returns all profiles the daemon currently has, along with the id of the active one. The active profile id is tracked at the daemon level and only exposed here.
19
+ */
20
+ export interface MethodListProfiles {
21
+ /**
22
+ * No parameters in v1.
23
+ */
24
+ params: {};
25
+ result: {
26
+ /**
27
+ * All profiles known to the daemon.
28
+ */
29
+ profiles: Profile[];
30
+ /**
31
+ * Identifier of the currently active profile. Always references one of the profiles in the array.
32
+ */
33
+ active_profile_id: string;
34
+ };
35
+ }
36
+ /**
37
+ * A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
38
+ */
39
+ export interface Profile {
40
+ /**
41
+ * Stable server-generated identifier for the profile.
42
+ */
43
+ id: string;
44
+ /**
45
+ * Human-friendly profile name.
46
+ */
47
+ name: string;
48
+ /**
49
+ * Bindings that belong to this profile.
50
+ */
51
+ bindings: Binding[];
52
+ }
53
+ /**
54
+ * Maps an input on a specific device to an action.
55
+ */
56
+ export interface Binding {
57
+ device_id: DeviceID;
58
+ input_id: string;
59
+ trigger: InputAction;
60
+ action: Action;
61
+ }
62
+ /**
63
+ * An executable action bound to an input.
64
+ */
65
+ export interface Action {
66
+ /**
67
+ * Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
68
+ */
69
+ type: string;
70
+ /**
71
+ * Action-specific parameters. Schema depends on 'type'.
72
+ */
73
+ params?: {
74
+ [k: string]: unknown;
75
+ };
76
+ }
@@ -0,0 +1,26 @@
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
+ * Renames an existing profile. Does not affect its bindings or the active profile.
10
+ */
11
+ export interface MethodRenameProfile {
12
+ params: {
13
+ /**
14
+ * Identifier of the profile to rename.
15
+ */
16
+ id: string;
17
+ /**
18
+ * New human-friendly name for the profile.
19
+ */
20
+ name: string;
21
+ };
22
+ /**
23
+ * Empty acknowledgement object. Reserved for future fields without breaking the schema.
24
+ */
25
+ result: {};
26
+ }
@@ -0,0 +1,24 @@
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
+ * Sets which profile is active. The active profile is the one the binding editor reads and writes; switching it swaps the live binding set.
10
+ */
11
+ export interface MethodSetActiveProfile {
12
+ params: {
13
+ /**
14
+ * Identifier of the profile to activate.
15
+ */
16
+ id: string;
17
+ };
18
+ result: {
19
+ /**
20
+ * Identifier of the now-active profile. Echoes the requested id on success.
21
+ */
22
+ active_profile_id: string;
23
+ };
24
+ }
@@ -0,0 +1,45 @@
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
+ * Replaces the entire auto-switch configuration in one shot (bulk set, not per-rule CRUD): the master toggle and the full rule set. The result echoes the persisted state.
10
+ */
11
+ export interface MethodSetAutoSwitch {
12
+ params: {
13
+ /**
14
+ * Master toggle. When false, the daemon ignores the rules and never auto-switches.
15
+ */
16
+ enabled: boolean;
17
+ /**
18
+ * Full replacement set of app-to-profile rules. Any previously stored rules are discarded.
19
+ */
20
+ rules: AutoSwitchRule[];
21
+ };
22
+ result: {
23
+ /**
24
+ * Master toggle as persisted. Echoes the requested value on success.
25
+ */
26
+ enabled: boolean;
27
+ /**
28
+ * Rules as persisted. Echoes the requested set on success.
29
+ */
30
+ rules: AutoSwitchRule[];
31
+ };
32
+ }
33
+ /**
34
+ * Maps a foreground application to the profile that should become active while that app is frontmost. When the frontmost app matches no rule, the active profile is left unchanged (sticky behavior); there is no fallback profile.
35
+ */
36
+ export interface AutoSwitchRule {
37
+ /**
38
+ * OS-native application identifier: bundle id on macOS, executable name on Linux/Windows. Opaque string, not portable across OSes; the daemon matches it verbatim against the frontmost app.
39
+ */
40
+ app: string;
41
+ /**
42
+ * Identifier of the profile to activate when this app is frontmost.
43
+ */
44
+ profile_id: string;
45
+ }
@@ -0,0 +1,52 @@
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
+ * Creates or updates a binding (input -> action) on a device. The pair (device_id, input_id, trigger) is the unique key; calling this method with an existing key replaces the previous action.
19
+ */
20
+ export interface MethodSetBinding {
21
+ params: {
22
+ binding: Binding;
23
+ };
24
+ /**
25
+ * Empty acknowledgement object. Reserved for future fields (e.g. server-assigned binding id) without breaking the schema.
26
+ */
27
+ result: {};
28
+ }
29
+ /**
30
+ * Maps an input on a specific device to an action.
31
+ */
32
+ export interface Binding {
33
+ device_id: DeviceID;
34
+ input_id: string;
35
+ trigger: InputAction;
36
+ action: Action;
37
+ }
38
+ /**
39
+ * An executable action bound to an input.
40
+ */
41
+ export interface Action {
42
+ /**
43
+ * Action type. Built-ins are well-known; plugin actions use 'plugin.<plugin_id>.<action_id>'.
44
+ */
45
+ type: string;
46
+ /**
47
+ * Action-specific parameters. Schema depends on 'type'.
48
+ */
49
+ params?: {
50
+ [k: string]: unknown;
51
+ };
52
+ }