@hyprune/schema 0.0.0-stage → 0.5.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 (78) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/LICENSE +21 -0
  3. package/README.md +140 -2
  4. package/bin/validate.mjs +19 -0
  5. package/examples/extension.json +22 -0
  6. package/examples/ipc/error.json +11 -0
  7. package/examples/ipc/movement.set.request.json +8 -0
  8. package/examples/ipc/movement.set.response.json +7 -0
  9. package/examples/ipc/runtime.exit.request.json +6 -0
  10. package/examples/ipc/runtime.exit.response.json +7 -0
  11. package/examples/ipc/runtime.notice.notification.json +9 -0
  12. package/examples/ipc/session.hello.request.json +17 -0
  13. package/examples/ipc/session.hello.response.json +23 -0
  14. package/examples/ipc/session.ping.request.json +6 -0
  15. package/examples/ipc/session.ping.response.json +7 -0
  16. package/examples/ipc/session.revoked.notification.json +7 -0
  17. package/examples/ipc/shell.claim.request.json +10 -0
  18. package/examples/ipc/shell.claim.response.json +8 -0
  19. package/examples/ipc/shell.overlay.request.json +11 -0
  20. package/examples/ipc/shell.overlay.response.json +7 -0
  21. package/examples/ipc/shell.release.request.json +8 -0
  22. package/examples/ipc/shell.release.response.json +7 -0
  23. package/examples/ipc/state.delta.notification.json +18 -0
  24. package/examples/ipc/state.snapshot.request.json +8 -0
  25. package/examples/ipc/state.snapshot.response.json +37 -0
  26. package/examples/ipc/state.subscribe.request.json +10 -0
  27. package/examples/ipc/state.subscribe.response.json +38 -0
  28. package/examples/ipc/state.unsubscribe.request.json +8 -0
  29. package/examples/ipc/state.unsubscribe.response.json +7 -0
  30. package/examples/ipc/surface.focus.request.json +9 -0
  31. package/examples/ipc/surface.focus.response.json +7 -0
  32. package/examples/ipc/world.load.request.json +9 -0
  33. package/examples/ipc/world.load.response.json +7 -0
  34. package/examples/placement-input.json +169 -0
  35. package/examples/screen-type.json +24 -0
  36. package/examples/world.json +111 -0
  37. package/extensions/hud-style-manifest.schema.json +17 -0
  38. package/extensions/hud-style.schema.json +118 -0
  39. package/lib/validate.d.mts +37 -0
  40. package/lib/validate.mjs +221 -0
  41. package/package.json +57 -4
  42. package/v0/common.schema.json +85 -0
  43. package/v0/extension.schema.json +121 -0
  44. package/v0/ipc.schema.json +1725 -0
  45. package/v0/screen-type.schema.json +115 -0
  46. package/v0/world.schema.json +363 -0
  47. package/v0.10/ipc.schema.json +8811 -0
  48. package/v0.11/ipc.schema.json +8863 -0
  49. package/v0.12/ipc.schema.json +9541 -0
  50. package/v0.13/ipc.schema.json +10032 -0
  51. package/v0.14/ipc.schema.json +10127 -0
  52. package/v0.15/ipc.schema.json +10534 -0
  53. package/v0.16/ipc.schema.json +10550 -0
  54. package/v0.17/ipc.schema.json +10703 -0
  55. package/v0.18/ipc.schema.json +10801 -0
  56. package/v0.19/ipc.schema.json +11587 -0
  57. package/v0.2/common.schema.json +86 -0
  58. package/v0.2/ipc.schema.json +3570 -0
  59. package/v0.2/world.schema.json +363 -0
  60. package/v0.3/common.schema.json +477 -0
  61. package/v0.3/ipc.schema.json +4044 -0
  62. package/v0.3/world.schema.json +390 -0
  63. package/v0.4/common.schema.json +477 -0
  64. package/v0.4/ipc.schema.json +5561 -0
  65. package/v0.4/world.schema.json +496 -0
  66. package/v0.5/common.schema.json +477 -0
  67. package/v0.5/ipc.schema.json +5781 -0
  68. package/v0.5/world.schema.json +790 -0
  69. package/v0.6/common.schema.json +478 -0
  70. package/v0.6/input.schema.json +519 -0
  71. package/v0.6/ipc.schema.json +7375 -0
  72. package/v0.6/world.schema.json +1062 -0
  73. package/v0.7/common.schema.json +478 -0
  74. package/v0.7/ipc.schema.json +7905 -0
  75. package/v0.7/world.schema.json +1062 -0
  76. package/v0.8/ipc.schema.json +7945 -0
  77. package/v0.9/input.schema.json +518 -0
  78. package/v0.9/ipc.schema.json +8613 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "3",
4
+ "result": {
5
+ "subscriptionId": "sub-1",
6
+ "snapshot": {
7
+ "sessionId": "session-1",
8
+ "revision": 0,
9
+ "state": {
10
+ "runtime": {
11
+ "active": false,
12
+ "outputs": [
13
+ "output-1"
14
+ ]
15
+ },
16
+ "world": null,
17
+ "surfaces": [],
18
+ "movement": {
19
+ "modeId": "com.hyprune.fly",
20
+ "position": [
21
+ 0,
22
+ 1,
23
+ 0
24
+ ],
25
+ "orientation": [
26
+ 0,
27
+ 0,
28
+ 0,
29
+ 1
30
+ ]
31
+ },
32
+ "shell": {
33
+ "leases": []
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "5",
4
+ "method": "state.unsubscribe",
5
+ "params": {
6
+ "subscriptionId": "sub-1"
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "5",
4
+ "result": {
5
+ "ok": true
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "7",
4
+ "method": "surface.focus",
5
+ "params": {
6
+ "surfaceId": "surface-1",
7
+ "intent": "pointer"
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "7",
4
+ "result": {
5
+ "revision": 1
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "6",
4
+ "method": "world.load",
5
+ "params": {
6
+ "worldId": "com.hyprune.observatory",
7
+ "spawnId": "arrival"
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "6",
4
+ "result": {
5
+ "revision": 1
6
+ }
7
+ }
@@ -0,0 +1,169 @@
1
+ {
2
+ "version": 2,
3
+ "longHoldMs": 1000,
4
+ "scopeVignette": true,
5
+ "invert_y": false,
6
+ "useDistance": 6,
7
+ "useTolerance": 0.12,
8
+ "captureInputLimit": 256,
9
+ "modes": {
10
+ "world": {
11
+ "look": [
12
+ "MouseMove"
13
+ ],
14
+ "forward": [
15
+ "k",
16
+ "w",
17
+ "Up"
18
+ ],
19
+ "back": [
20
+ "j",
21
+ "s",
22
+ "Down"
23
+ ],
24
+ "left": [
25
+ "h",
26
+ "a",
27
+ "Left"
28
+ ],
29
+ "right": [
30
+ "l",
31
+ "d",
32
+ "Right"
33
+ ],
34
+ "menu": [
35
+ "Tab[L]"
36
+ ],
37
+ "sprint": [
38
+ "Shift_L"
39
+ ],
40
+ "up": [
41
+ "space"
42
+ ],
43
+ "down": [
44
+ "Control_L"
45
+ ],
46
+ "use": [
47
+ "e"
48
+ ],
49
+ "focus": [
50
+ "f"
51
+ ],
52
+ "noclip": [
53
+ "v"
54
+ ],
55
+ "scope": [
56
+ "q"
57
+ ],
58
+ "debug": [
59
+ "F3",
60
+ "y"
61
+ ],
62
+ "capture": [
63
+ "u"
64
+ ],
65
+ "carry": [
66
+ "Super+LMB"
67
+ ],
68
+ "resize": [
69
+ "Super+RMB"
70
+ ],
71
+ "distance": [
72
+ "Super+Wheel"
73
+ ],
74
+ "rotate": [
75
+ "Super+Ctrl+Wheel"
76
+ ],
77
+ "tool1": [
78
+ "1"
79
+ ],
80
+ "tool2": [
81
+ "2"
82
+ ],
83
+ "tool3": [
84
+ "3"
85
+ ],
86
+ "tool4": [
87
+ "4"
88
+ ],
89
+ "hud.cycle": [],
90
+ "transport": [
91
+ "z"
92
+ ],
93
+ "autopilot": [
94
+ "x"
95
+ ],
96
+ "primary": [
97
+ "LMB"
98
+ ],
99
+ "secondary": [
100
+ "RMB"
101
+ ],
102
+ "fly": [
103
+ "F4"
104
+ ],
105
+ "record.toggle": [],
106
+ "exit": [
107
+ "Super+Tab",
108
+ "Back"
109
+ ],
110
+ "tool5": [
111
+ "5"
112
+ ],
113
+ "content.scale": [
114
+ "Super+Shift+Wheel"
115
+ ],
116
+ "window.reset": [
117
+ "Super+Shift+MMB"
118
+ ],
119
+ "carry.facing": [
120
+ "r"
121
+ ],
122
+ "alternate": [
123
+ "MMB"
124
+ ],
125
+ "cycle": [
126
+ "Wheel"
127
+ ]
128
+ },
129
+ "interactive": {
130
+ "exit": [
131
+ "Super+Tab",
132
+ "Back"
133
+ ],
134
+ "debug": [
135
+ "F3"
136
+ ],
137
+ "capture": [
138
+ "Super+u"
139
+ ],
140
+ "record.toggle": []
141
+ },
142
+ "focus": {
143
+ "exit": [
144
+ "Super+Tab",
145
+ "Back"
146
+ ],
147
+ "debug": [
148
+ "F3"
149
+ ],
150
+ "capture": [
151
+ "Super+u"
152
+ ],
153
+ "record.toggle": []
154
+ },
155
+ "menu": {
156
+ "exit": [
157
+ "Escape"
158
+ ],
159
+ "debug": [
160
+ "F3"
161
+ ],
162
+ "capture": [
163
+ "Super+u"
164
+ ],
165
+ "record.toggle": []
166
+ }
167
+ },
168
+ "show_area_markers": false
169
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "descriptorVersion": "0.1",
3
+ "id": "com.hyprune.window",
4
+ "name": "Application window",
5
+ "provider": "com.hyprune.core",
6
+ "source": "window",
7
+ "geometry": "plane",
8
+ "defaultSize": [
9
+ 1.6,
10
+ 0.9
11
+ ],
12
+ "resolution": {
13
+ "width": 1920,
14
+ "height": 1080
15
+ },
16
+ "input": {
17
+ "pointer": true,
18
+ "keyboard": true,
19
+ "touch": false
20
+ },
21
+ "alphaMode": "blend",
22
+ "colorSpace": "srgb",
23
+ "maxFps": 60
24
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "formatVersion": "0.1",
3
+ "id": "com.hyprune.observatory",
4
+ "version": "0.1.0",
5
+ "name": "Observatory",
6
+ "license": "CC-BY-4.0",
7
+ "scene": "scene.gltf",
8
+ "defaultSpawn": "arrival",
9
+ "spawns": [
10
+ {
11
+ "id": "arrival",
12
+ "pose": {
13
+ "position": [
14
+ 0,
15
+ 1,
16
+ 0
17
+ ],
18
+ "rotation": [
19
+ 0,
20
+ 0,
21
+ 0,
22
+ 1
23
+ ]
24
+ }
25
+ }
26
+ ],
27
+ "attribution": [
28
+ {
29
+ "path": ".",
30
+ "author": "Hyprune contributors",
31
+ "license": "CC-BY-4.0"
32
+ }
33
+ ],
34
+ "zones": [
35
+ {
36
+ "id": "work",
37
+ "name": "Work",
38
+ "bounds": {
39
+ "min": [
40
+ -4,
41
+ 0,
42
+ -4
43
+ ],
44
+ "max": [
45
+ 4,
46
+ 4,
47
+ 4
48
+ ]
49
+ }
50
+ }
51
+ ],
52
+ "anchors": [
53
+ {
54
+ "id": "desk",
55
+ "pose": {
56
+ "position": [
57
+ 0,
58
+ 1.4,
59
+ -3
60
+ ],
61
+ "rotation": [
62
+ 0,
63
+ 0,
64
+ 0,
65
+ 1
66
+ ]
67
+ },
68
+ "size": [
69
+ 1.6,
70
+ 0.9
71
+ ],
72
+ "screenType": "com.hyprune.window"
73
+ }
74
+ ],
75
+ "collision": [
76
+ {
77
+ "node": 0,
78
+ "shape": "mesh",
79
+ "layer": "static"
80
+ }
81
+ ],
82
+ "navigation": {
83
+ "kind": "mesh",
84
+ "node": 1,
85
+ "agentRadius": 0.3,
86
+ "agentHeight": 1.8
87
+ },
88
+ "lightmaps": [
89
+ {
90
+ "material": 0,
91
+ "texture": 1,
92
+ "texCoord": 1,
93
+ "encoding": "linear",
94
+ "intensity": 1
95
+ }
96
+ ],
97
+ "audio": [
98
+ {
99
+ "id": "air",
100
+ "path": "audio/air.ogg",
101
+ "position": [
102
+ 0,
103
+ 2,
104
+ 0
105
+ ],
106
+ "radius": 10,
107
+ "gain": 0.2,
108
+ "loop": true
109
+ }
110
+ ]
111
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://hyprune.com/schema/extensions/hud-style-manifest.schema.json",
4
+ "title": "Proposed com.hyprune.hud-style manifest value",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "theme"
9
+ ],
10
+ "properties": {
11
+ "theme": {
12
+ "type": "string",
13
+ "maxLength": 200,
14
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.json$"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://hyprune.com/schema/extensions/hud-style.schema.json",
4
+ "title": "Proposed world HUD style 1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version"
9
+ ],
10
+ "properties": {
11
+ "version": {
12
+ "const": 1
13
+ },
14
+ "colors": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "accent": {
19
+ "type": "string",
20
+ "pattern": "^#[0-9a-fA-F]{6}$"
21
+ },
22
+ "foreground": {
23
+ "type": "string",
24
+ "pattern": "^#[0-9a-fA-F]{6}$"
25
+ },
26
+ "muted": {
27
+ "type": "string",
28
+ "pattern": "^#[0-9a-fA-F]{6}$"
29
+ },
30
+ "tile": {
31
+ "type": "string",
32
+ "pattern": "^#[0-9a-fA-F]{6}$"
33
+ },
34
+ "outline": {
35
+ "type": "string",
36
+ "pattern": "^#[0-9a-fA-F]{6}$"
37
+ },
38
+ "scrim": {
39
+ "type": "string",
40
+ "pattern": "^#[0-9a-fA-F]{6}$"
41
+ }
42
+ }
43
+ },
44
+ "stroke": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "properties": {
48
+ "width": {
49
+ "type": "number",
50
+ "minimum": 1,
51
+ "maximum": 3
52
+ },
53
+ "style": {
54
+ "enum": [
55
+ "outline",
56
+ "shadow"
57
+ ]
58
+ }
59
+ }
60
+ },
61
+ "corners": {
62
+ "enum": [
63
+ "square",
64
+ "bevel",
65
+ "round"
66
+ ]
67
+ },
68
+ "font": {
69
+ "type": "string",
70
+ "maxLength": 200,
71
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.(ttf|otf)$"
72
+ },
73
+ "icons": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "properties": {
77
+ "navigate": {
78
+ "type": "string",
79
+ "maxLength": 200,
80
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.svg$"
81
+ },
82
+ "window": {
83
+ "type": "string",
84
+ "maxLength": 200,
85
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.svg$"
86
+ },
87
+ "path": {
88
+ "type": "string",
89
+ "maxLength": 200,
90
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.svg$"
91
+ },
92
+ "position": {
93
+ "type": "string",
94
+ "maxLength": 200,
95
+ "pattern": "^hud/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+\\.svg$"
96
+ }
97
+ }
98
+ },
99
+ "warp": {
100
+ "enum": [
101
+ "default",
102
+ "ribbons",
103
+ "soft"
104
+ ]
105
+ },
106
+ "id": {
107
+ "type": "string",
108
+ "minLength": 1,
109
+ "maxLength": 128,
110
+ "pattern": "^[a-z0-9][a-z0-9.-]*$"
111
+ },
112
+ "name": {
113
+ "type": "string",
114
+ "minLength": 1,
115
+ "maxLength": 128
116
+ }
117
+ }
118
+ }
@@ -0,0 +1,37 @@
1
+ // Type declarations for lib/validate.mjs.
2
+
3
+ /** Schema kinds `validate` accepts; `scene` checks a scene.gltf against its world format. */
4
+ export type ContractKind = 'world' | 'extension' | 'screen-type' | 'ipc' | 'scene';
5
+
6
+ export interface ValidationResult {
7
+ valid: boolean;
8
+ /** JSON-pointer-prefixed messages; empty when valid. */
9
+ errors: string[];
10
+ }
11
+
12
+ export interface ValidateOptions {
13
+ /** For kind `scene`: the package's parsed world.json (lightmap checks). */
14
+ world?: unknown;
15
+ }
16
+
17
+ /**
18
+ * Validate one parsed JSON document against a published contract version.
19
+ * @param kind contract kind
20
+ * @param value parsed document (world.json, extension.json, an IPC frame, scene.gltf)
21
+ * @param method IPC only: the outstanding request's method, to validate a response's result
22
+ * @param version world format or IPC version, e.g. '0.7' or '0.19' (default '0.1')
23
+ * @throws on an unknown kind, version or method (usage errors, not validation failures)
24
+ */
25
+ export function validate(kind: ContractKind, value: unknown, method?: string, version?: string, options?: ValidateOptions): ValidationResult;
26
+
27
+ /** True when dotted version `version` is at least `minimum` (numeric comparison). */
28
+ export function atLeast(version: string, minimum: string): boolean;
29
+
30
+ /** World formats with a published schema, oldest first. */
31
+ export const worldFormats: readonly string[];
32
+ /** IPC protocol versions with a published schema, oldest first. */
33
+ export const ipcProtocols: readonly string[];
34
+ /** Every contract version directory, oldest first. */
35
+ export const contractVersions: readonly string[];
36
+ /** glTF extensions a scene may list in extensionsRequired for a world format. */
37
+ export function sceneExtensions(version: string): string[];