@stim-cli/server 1.14.0 → 1.16.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 (52) hide show
  1. package/README.md +1773 -92
  2. package/dist/protocol-BHSl7bQ_.mjs +2772 -0
  3. package/dist/protocol.d.mts +2 -496
  4. package/dist/protocol.mjs +3 -2
  5. package/dist/protocol.schema.json +5388 -684
  6. package/dist/scrcpy/LICENSE +204 -0
  7. package/dist/scrcpy/NOTICE +22 -0
  8. package/dist/scrcpy/scrcpy-server +0 -0
  9. package/dist/stats-read.d.mts +1 -0
  10. package/dist/stats-read.mjs +46 -0
  11. package/dist/stim-frames/AndroidDeviceStream.swift +284 -0
  12. package/dist/stim-frames/DevToolsClient.swift +180 -0
  13. package/dist/stim-frames/DeviceFrameGeometry.swift +41 -0
  14. package/dist/stim-frames/DeviceFrameView.swift +167 -0
  15. package/dist/stim-frames/DuoCaptureSource.swift +132 -0
  16. package/dist/stim-frames/DuoDeviceProfile.swift +37 -0
  17. package/dist/stim-frames/DuoFrameRenderer.swift +111 -0
  18. package/dist/stim-frames/DuoHingeMonitor.swift +89 -0
  19. package/dist/stim-frames/DuoMesh.swift +100 -0
  20. package/dist/stim-frames/DuoModelView.swift +275 -0
  21. package/dist/stim-frames/DuoPoseClip.swift +140 -0
  22. package/dist/stim-frames/DuoScreenHitMesh.swift +200 -0
  23. package/dist/stim-frames/EmulatorFrameArtwork.swift +113 -0
  24. package/dist/stim-frames/EmulatorInput.swift +13 -2
  25. package/dist/stim-frames/EmulatorPosture.swift +2 -2
  26. package/dist/stim-frames/FrameArtwork.swift +37 -0
  27. package/dist/stim-frames/H264Decoder.swift +109 -0
  28. package/dist/stim-frames/InputMessages.swift +27 -6
  29. package/dist/stim-frames/KeyboardLayoutMap.swift +70 -0
  30. package/dist/stim-frames/MacosSource.swift +677 -0
  31. package/dist/stim-frames/OwnedAppWindowReader.swift +87 -0
  32. package/dist/stim-frames/OwnedAppWindows.swift +108 -0
  33. package/dist/stim-frames/PhoneSource.swift +315 -0
  34. package/dist/stim-frames/ProcessStream.swift +155 -0
  35. package/dist/stim-frames/ScrcpyProtocol.swift +167 -0
  36. package/dist/stim-frames/SimulatorDevelopmentOptions.swift +81 -0
  37. package/dist/stim-frames/SimulatorFrameArtwork.swift +118 -0
  38. package/dist/stim-frames/SimulatorHID.swift +70 -29
  39. package/dist/stim-frames/SimulatorHingeAngle.swift +56 -0
  40. package/dist/stim-frames/SimulatorPosture.swift +277 -0
  41. package/dist/stim-frames/SimulatorRotation.swift +28 -8
  42. package/dist/stim-frames/Siniulator-LICENSE.txt +21 -0
  43. package/dist/stim-frames/StoragePaths.swift +42 -0
  44. package/dist/stim-frames/VideoEncoder.swift +8 -6
  45. package/dist/stim-frames/WebPage.swift +301 -0
  46. package/dist/stim-frames/main.swift +651 -22
  47. package/dist/stim-host/Info.plist +28 -0
  48. package/dist/stim-host/stim-host.c +153 -0
  49. package/dist/stim-server-CvqlgkBK.mjs +14887 -0
  50. package/dist/stim-server.mjs +6 -4421
  51. package/package.json +3 -3
  52. package/dist/protocol-IroIg8Td.mjs +0 -865
@@ -1,865 +0,0 @@
1
- //#region src/protocol.ts
2
- const PROTOCOL_VERSION = 1;
3
- const PROTOCOL_SCHEMA_FILE = "protocol.schema.json";
4
- /** `read` serves state. `control` also runs {@link ACTIONS}; only the Mac grants it. */
5
- const CAPABILITIES = ["read", "control"];
6
- const METHODS = [
7
- "hello",
8
- "status.subscribe",
9
- "logs.query",
10
- "logs.subscribe",
11
- "stats.get",
12
- "settings.get",
13
- "frames.subscribe",
14
- "frames.keyframe",
15
- "build.plan",
16
- "machine.get",
17
- "machine.history",
18
- "unsubscribe",
19
- "action",
20
- "control.begin",
21
- "control.end",
22
- "input.touch",
23
- "input.text",
24
- "input.button",
25
- "input.rotate",
26
- "input.posture",
27
- "push.register",
28
- "push.unregister"
29
- ];
30
- const PUSH_TOKEN_PATTERN = "^(Expo|Exponent)PushToken\\[[^\\]\\s]{1,256}\\]$";
31
- /**
32
- * `unauthorized`, `pairing-expired` and `protocol-unsupported` refuse the client until it pairs again or
33
- * updates; clients retry the others.
34
- */
35
- const ERROR_CODES = [
36
- "unauthorized",
37
- "pairing-expired",
38
- "protocol-unsupported",
39
- "identity-unavailable",
40
- "bad-request",
41
- "unknown-method",
42
- "already-authenticated",
43
- "unknown-subscription",
44
- "unknown-workspace",
45
- "limit-exceeded",
46
- "slow-client",
47
- "status-failed",
48
- "logs-failed",
49
- "stim-failed",
50
- "frames-failed",
51
- "forbidden",
52
- "unknown-action",
53
- "action-busy",
54
- "action-failed",
55
- "device-busy",
56
- "unknown-session"
57
- ];
58
- const LOG_SOURCES = [
59
- "metro",
60
- "client",
61
- "device",
62
- "build",
63
- "agent"
64
- ];
65
- const LOG_LEVELS = [
66
- "debug",
67
- "info",
68
- "warn",
69
- "error",
70
- "fatal"
71
- ];
72
- const MAX_LOG_TAIL = 5e3;
73
- /** `reload` also reaches the workspace's Stim-owned Chrome page. */
74
- const RELOAD_PLATFORMS = [
75
- "ios",
76
- "android",
77
- "web"
78
- ];
79
- const FRAME_FPS = {
80
- default: 5,
81
- max: 30,
82
- video: 60
83
- };
84
- const FRAME_EDGE = {
85
- min: 240,
86
- default: 1280,
87
- max: 2048
88
- };
89
- const VIDEO_CODECS = ["h264"];
90
- const VIDEO_HEADER_VERSION = 1;
91
- /** The keyframe bit of a {@link VideoPacket}'s flags. */
92
- const VIDEO_KEYFRAME = 1;
93
- /** The flag bits of a {@link VideoPacket} that carry an iPhone Duo's posture, as `posture` on a `frame` event. */
94
- const VIDEO_FOLDED = 2;
95
- const VIDEO_UNFOLDED = 4;
96
- /** Each action runs one fixed `stim` command in the workspace. */
97
- const ACTIONS = ["reload", "stop"];
98
- const TOUCH_PHASES = [
99
- "down",
100
- "move",
101
- "up"
102
- ];
103
- const MAX_INPUT_TEXT = 256;
104
- /** `home` and `lock` on both platforms; `back` and `app-switch` on Android only. */
105
- const INPUT_BUTTONS = [
106
- "home",
107
- "lock",
108
- "back",
109
- "app-switch"
110
- ];
111
- /** `left` turns the device a quarter turn counterclockwise, `right` clockwise. */
112
- const ROTATE_DIRECTIONS = ["left", "right"];
113
- const DEVICE_POSTURES = [
114
- "folded",
115
- "half-open",
116
- "unfolded"
117
- ];
118
- /** The attention events stim-server can push, named like the phone's notification settings. */
119
- const PUSH_EVENTS = [
120
- "build-failed",
121
- "log-errors",
122
- "disk",
123
- "app-stopped",
124
- "slow-build"
125
- ];
126
- const CONTROL_END_REASONS = [
127
- "idle",
128
- "taken-over",
129
- "device-gone",
130
- "forbidden",
131
- "failed"
132
- ];
133
- const requestId = { type: ["integer", "string"] };
134
- const protocolError = {
135
- type: "object",
136
- required: ["code", "message"],
137
- additionalProperties: false,
138
- properties: {
139
- code: { enum: [...ERROR_CODES] },
140
- message: { type: "string" }
141
- }
142
- };
143
- function request(method, params) {
144
- return {
145
- type: "object",
146
- required: params ? [
147
- "id",
148
- "method",
149
- "params"
150
- ] : ["id", "method"],
151
- additionalProperties: false,
152
- properties: {
153
- id: requestId,
154
- method: { const: method },
155
- params: params ?? {
156
- type: "object",
157
- maxProperties: 0
158
- }
159
- }
160
- };
161
- }
162
- function session(properties, required = []) {
163
- return {
164
- type: "object",
165
- required: ["session", ...required],
166
- additionalProperties: false,
167
- properties: {
168
- session: { type: "string" },
169
- ...properties
170
- }
171
- };
172
- }
173
- function optionalParams(method, params) {
174
- return {
175
- type: "object",
176
- required: ["id", "method"],
177
- additionalProperties: false,
178
- properties: {
179
- id: requestId,
180
- method: { const: method },
181
- params
182
- }
183
- };
184
- }
185
- /** The JSON Schema of every message on the wire, written to `dist/protocol.schema.json` at build time. */
186
- function protocolJsonSchema() {
187
- return {
188
- $schema: "https://json-schema.org/draft/2020-12/schema",
189
- title: "Stim server protocol",
190
- description: `Messages exchanged over the stim-server WebSocket, protocol version 1.`,
191
- "x-stim-protocol": 1,
192
- $defs: {
193
- ProtocolError: protocolError,
194
- HelloParams: {
195
- type: "object",
196
- required: [
197
- "protocol",
198
- "client",
199
- "auth"
200
- ],
201
- additionalProperties: false,
202
- properties: {
203
- protocol: { type: "integer" },
204
- client: {
205
- type: "object",
206
- required: ["name", "version"],
207
- properties: {
208
- name: { type: "string" },
209
- version: { type: "string" }
210
- }
211
- },
212
- auth: { oneOf: [{
213
- type: "object",
214
- required: ["pairingToken", "deviceName"],
215
- additionalProperties: false,
216
- properties: {
217
- pairingToken: { type: "string" },
218
- deviceName: {
219
- type: "string",
220
- minLength: 1
221
- }
222
- }
223
- }, {
224
- type: "object",
225
- required: ["deviceToken"],
226
- additionalProperties: false,
227
- properties: { deviceToken: { type: "string" } }
228
- }] }
229
- }
230
- },
231
- HelloResult: {
232
- type: "object",
233
- required: [
234
- "protocol",
235
- "server",
236
- "capabilities",
237
- "actions",
238
- "device"
239
- ],
240
- additionalProperties: false,
241
- properties: {
242
- protocol: { type: "integer" },
243
- server: {
244
- type: "object",
245
- required: [
246
- "name",
247
- "version",
248
- "stim",
249
- "home"
250
- ],
251
- additionalProperties: false,
252
- properties: {
253
- name: { type: "string" },
254
- version: { type: "string" },
255
- stim: { type: "string" },
256
- home: { type: "string" }
257
- }
258
- },
259
- capabilities: {
260
- type: "array",
261
- items: { enum: [...CAPABILITIES] }
262
- },
263
- actions: {
264
- type: "array",
265
- items: { enum: [...ACTIONS] }
266
- },
267
- device: {
268
- type: "object",
269
- required: ["id", "name"],
270
- additionalProperties: false,
271
- properties: {
272
- id: { type: "string" },
273
- name: { type: "string" }
274
- }
275
- },
276
- deviceToken: { type: "string" }
277
- }
278
- },
279
- LogRecord: {
280
- type: "object",
281
- description: "One record as `stim logs --json` prints it.",
282
- properties: {
283
- ts: { type: "number" },
284
- src: { type: "string" },
285
- level: { type: "string" },
286
- msg: { type: "string" },
287
- context: {
288
- type: "array",
289
- items: { type: "string" },
290
- description: "With `errors`: the code frame and stack lines Expo printed after this error."
291
- }
292
- }
293
- },
294
- LogFilter: {
295
- type: "object",
296
- required: ["workspace"],
297
- additionalProperties: false,
298
- properties: {
299
- workspace: {
300
- type: "string",
301
- description: "An environment path from a status payload."
302
- },
303
- sources: {
304
- type: "array",
305
- minItems: 1,
306
- items: { enum: [...LOG_SOURCES] }
307
- },
308
- level: { enum: [...LOG_LEVELS] },
309
- slot: {
310
- type: "string",
311
- pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
312
- },
313
- grep: {
314
- type: "string",
315
- pattern: "^[^\\u0000]*$",
316
- description: "A regular expression matched against each message."
317
- },
318
- errors: { type: "boolean" },
319
- tail: {
320
- type: "integer",
321
- minimum: 1,
322
- maximum: MAX_LOG_TAIL,
323
- default: MAX_LOG_TAIL
324
- }
325
- }
326
- },
327
- FrameTarget: {
328
- type: "object",
329
- required: ["workspace", "platform"],
330
- additionalProperties: false,
331
- properties: {
332
- workspace: {
333
- type: "string",
334
- description: "An environment path from a status payload."
335
- },
336
- platform: { enum: ["ios", "android"] },
337
- slot: {
338
- type: "string",
339
- minLength: 1,
340
- default: "default"
341
- },
342
- fps: {
343
- type: "integer",
344
- minimum: 1,
345
- maximum: FRAME_FPS.video,
346
- default: FRAME_FPS.default,
347
- description: `At most ${FRAME_FPS.max} unless the result offers video.`
348
- },
349
- maxEdge: {
350
- type: "integer",
351
- minimum: FRAME_EDGE.min,
352
- maximum: FRAME_EDGE.max,
353
- default: FRAME_EDGE.default
354
- },
355
- video: {
356
- type: "array",
357
- items: { enum: [...VIDEO_CODECS] }
358
- }
359
- }
360
- },
361
- ActionParams: { oneOf: [{
362
- type: "object",
363
- required: ["action", "workspace"],
364
- additionalProperties: false,
365
- properties: {
366
- action: { const: "reload" },
367
- workspace: {
368
- type: "string",
369
- description: "An environment path from a status payload."
370
- },
371
- platform: { enum: [...RELOAD_PLATFORMS] }
372
- }
373
- }, {
374
- type: "object",
375
- required: ["action", "workspace"],
376
- additionalProperties: false,
377
- properties: {
378
- action: { const: "stop" },
379
- workspace: {
380
- type: "string",
381
- description: "An environment path from a status payload."
382
- }
383
- }
384
- }] },
385
- ActionResult: {
386
- type: "object",
387
- required: [
388
- "action",
389
- "workspace",
390
- "output"
391
- ],
392
- additionalProperties: false,
393
- properties: {
394
- action: { enum: [...ACTIONS] },
395
- workspace: { type: "string" },
396
- output: {
397
- type: "object",
398
- description: "The JSON the command printed."
399
- }
400
- }
401
- },
402
- ControlBeginParams: {
403
- type: "object",
404
- required: ["workspace", "platform"],
405
- additionalProperties: false,
406
- properties: {
407
- workspace: {
408
- type: "string",
409
- description: "An environment path from a status payload."
410
- },
411
- platform: { enum: ["ios", "android"] },
412
- slot: {
413
- type: "string",
414
- minLength: 1,
415
- default: "default"
416
- },
417
- takeOver: {
418
- type: "boolean",
419
- default: false
420
- }
421
- }
422
- },
423
- ControlBeginResult: {
424
- type: "object",
425
- required: [
426
- "session",
427
- "platform",
428
- "lease",
429
- "postures"
430
- ],
431
- additionalProperties: false,
432
- properties: {
433
- session: { type: "string" },
434
- platform: { enum: ["ios", "android"] },
435
- lease: { oneOf: [{ type: "null" }, {
436
- type: "object",
437
- required: ["grantedAt", "expiresAt"],
438
- additionalProperties: false,
439
- properties: {
440
- grantedAt: {
441
- type: ["string", "null"],
442
- format: "date-time"
443
- },
444
- expiresAt: {
445
- type: "string",
446
- format: "date-time"
447
- }
448
- }
449
- }] },
450
- postures: {
451
- type: "array",
452
- items: { enum: [...DEVICE_POSTURES] },
453
- uniqueItems: true
454
- }
455
- }
456
- },
457
- BuildPlanParams: {
458
- type: "object",
459
- required: ["workspace", "platform"],
460
- additionalProperties: false,
461
- properties: {
462
- workspace: {
463
- type: "string",
464
- description: "An environment path from a status payload."
465
- },
466
- platform: { enum: ["ios", "android"] },
467
- slot: {
468
- type: "string",
469
- pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$",
470
- default: "default"
471
- }
472
- }
473
- },
474
- WorkspaceParams: {
475
- type: "object",
476
- additionalProperties: false,
477
- properties: { workspace: {
478
- type: "string",
479
- description: "An environment path from a status payload."
480
- } }
481
- },
482
- MachineHistory: {
483
- type: "object",
484
- required: ["intervalMs", "samples"],
485
- additionalProperties: false,
486
- properties: {
487
- intervalMs: { type: "integer" },
488
- samples: {
489
- type: "array",
490
- items: {
491
- type: "object",
492
- required: [
493
- "at",
494
- "cpu",
495
- "memoryUsedBytes",
496
- "memoryPressure",
497
- "diskFreeBytes"
498
- ],
499
- additionalProperties: false,
500
- properties: {
501
- at: { type: "integer" },
502
- cpu: { type: ["number", "null"] },
503
- memoryUsedBytes: { type: ["number", "null"] },
504
- memoryPressure: { enum: [
505
- 0,
506
- 1,
507
- 2,
508
- null
509
- ] },
510
- diskFreeBytes: { type: ["number", "null"] }
511
- }
512
- }
513
- }
514
- }
515
- },
516
- MachineUsage: {
517
- type: "object",
518
- required: [
519
- "volumes",
520
- "memory",
521
- "load",
522
- "cpu",
523
- "sampledAt"
524
- ],
525
- additionalProperties: false,
526
- properties: {
527
- volumes: {
528
- type: "array",
529
- items: {
530
- type: "object",
531
- required: [
532
- "mount",
533
- "holds",
534
- "freeBytes",
535
- "totalBytes"
536
- ],
537
- additionalProperties: false,
538
- properties: {
539
- mount: { type: "string" },
540
- holds: {
541
- type: "array",
542
- items: { type: "string" }
543
- },
544
- freeBytes: { type: "number" },
545
- totalBytes: { type: "number" }
546
- }
547
- }
548
- },
549
- memory: {
550
- type: "object",
551
- required: [
552
- "totalBytes",
553
- "usedBytes",
554
- "pressure"
555
- ],
556
- additionalProperties: false,
557
- properties: {
558
- totalBytes: { type: "number" },
559
- usedBytes: { type: ["number", "null"] },
560
- pressure: { enum: [
561
- "normal",
562
- "warning",
563
- "critical",
564
- null
565
- ] }
566
- }
567
- },
568
- load: {
569
- type: "object",
570
- required: [
571
- "avg1",
572
- "avg5",
573
- "avg15",
574
- "cpus"
575
- ],
576
- additionalProperties: false,
577
- properties: {
578
- avg1: { type: "number" },
579
- avg5: { type: "number" },
580
- avg15: { type: "number" },
581
- cpus: { type: "integer" }
582
- }
583
- },
584
- cpu: {
585
- type: "object",
586
- required: ["usage", "cores"],
587
- additionalProperties: false,
588
- properties: {
589
- usage: { type: ["number", "null"] },
590
- cores: { type: "integer" }
591
- }
592
- },
593
- sampledAt: {
594
- type: "string",
595
- format: "date-time"
596
- }
597
- }
598
- },
599
- ClientRequest: { oneOf: [
600
- request("hello", { $ref: "#/$defs/HelloParams" }),
601
- request("status.subscribe"),
602
- request("logs.query", { $ref: "#/$defs/LogFilter" }),
603
- request("logs.subscribe", { $ref: "#/$defs/LogFilter" }),
604
- request("frames.subscribe", { $ref: "#/$defs/FrameTarget" }),
605
- request("frames.keyframe", {
606
- type: "object",
607
- required: ["subscription"],
608
- additionalProperties: false,
609
- properties: { subscription: { type: "string" } }
610
- }),
611
- request("build.plan", { $ref: "#/$defs/BuildPlanParams" }),
612
- request("machine.get"),
613
- optionalParams("machine.history", {
614
- type: "object",
615
- additionalProperties: false,
616
- properties: { sinceMs: { type: "number" } }
617
- }),
618
- optionalParams("stats.get", { $ref: "#/$defs/WorkspaceParams" }),
619
- optionalParams("settings.get", { $ref: "#/$defs/WorkspaceParams" }),
620
- request("unsubscribe", {
621
- type: "object",
622
- required: ["subscription"],
623
- additionalProperties: false,
624
- properties: { subscription: { type: "string" } }
625
- }),
626
- request("action", { $ref: "#/$defs/ActionParams" }),
627
- request("control.begin", { $ref: "#/$defs/ControlBeginParams" }),
628
- request("control.end", session({})),
629
- request("input.touch", session({
630
- phase: { enum: [...TOUCH_PHASES] },
631
- x: {
632
- type: "number",
633
- minimum: 0,
634
- maximum: 1
635
- },
636
- y: {
637
- type: "number",
638
- minimum: 0,
639
- maximum: 1
640
- },
641
- display: {
642
- type: "integer",
643
- minimum: 0,
644
- maximum: 3,
645
- default: 0
646
- }
647
- }, [
648
- "phase",
649
- "x",
650
- "y"
651
- ])),
652
- request("input.text", session({ text: {
653
- type: "string",
654
- minLength: 1,
655
- maxLength: 256,
656
- pattern: "^[\\x20-\\x7e\\n\\t\\b]+$"
657
- } }, ["text"])),
658
- request("input.button", session({ button: { enum: [...INPUT_BUTTONS] } }, ["button"])),
659
- request("input.rotate", session({ direction: { enum: [...ROTATE_DIRECTIONS] } }, ["direction"])),
660
- request("input.posture", session({ posture: { enum: [...DEVICE_POSTURES] } }, ["posture"])),
661
- request("push.register", {
662
- type: "object",
663
- required: [
664
- "token",
665
- "events",
666
- "ref"
667
- ],
668
- additionalProperties: false,
669
- properties: {
670
- token: {
671
- type: "string",
672
- pattern: PUSH_TOKEN_PATTERN,
673
- description: "An Expo push token."
674
- },
675
- events: {
676
- type: "array",
677
- minItems: 1,
678
- uniqueItems: true,
679
- items: { enum: [...PUSH_EVENTS] }
680
- },
681
- agentOnly: {
682
- type: "boolean",
683
- default: false
684
- },
685
- ref: {
686
- type: "string",
687
- minLength: 1,
688
- maxLength: 128
689
- }
690
- }
691
- }),
692
- request("push.unregister")
693
- ] },
694
- ServerResponse: { oneOf: [{
695
- type: "object",
696
- required: ["id", "result"],
697
- additionalProperties: false,
698
- properties: {
699
- id: requestId,
700
- result: { anyOf: [
701
- { $ref: "#/$defs/HelloResult" },
702
- { $ref: "#/$defs/ControlBeginResult" },
703
- { $ref: "#/$defs/ActionResult" },
704
- { $ref: "#/$defs/MachineUsage" },
705
- { $ref: "#/$defs/MachineHistory" },
706
- {
707
- type: "object",
708
- required: ["subscription"],
709
- additionalProperties: false,
710
- properties: {
711
- subscription: { type: "string" },
712
- video: { enum: [...VIDEO_CODECS] }
713
- }
714
- },
715
- {
716
- type: "object",
717
- required: ["records"],
718
- additionalProperties: false,
719
- properties: { records: {
720
- type: "array",
721
- items: { $ref: "#/$defs/LogRecord" }
722
- } }
723
- },
724
- {
725
- type: "object",
726
- description: "The payload of `stim stats --json`, `stim settings --json` or `stim ios|android --plan --json`, or {} for unsubscribe."
727
- }
728
- ] }
729
- }
730
- }, {
731
- type: "object",
732
- required: ["id", "error"],
733
- additionalProperties: false,
734
- properties: {
735
- id: { type: [
736
- "integer",
737
- "string",
738
- "null"
739
- ] },
740
- error: { $ref: "#/$defs/ProtocolError" }
741
- }
742
- }] },
743
- ServerEvent: { oneOf: [
744
- {
745
- type: "object",
746
- required: [
747
- "event",
748
- "subscription",
749
- "payload"
750
- ],
751
- additionalProperties: false,
752
- properties: {
753
- event: { const: "status" },
754
- subscription: { type: "string" },
755
- payload: {
756
- type: "object",
757
- description: "A full payload, as `stim status --watch --json` prints it."
758
- }
759
- }
760
- },
761
- {
762
- type: "object",
763
- required: [
764
- "event",
765
- "subscription",
766
- "records"
767
- ],
768
- additionalProperties: false,
769
- properties: {
770
- event: { const: "logs" },
771
- subscription: { type: "string" },
772
- records: {
773
- type: "array",
774
- items: { $ref: "#/$defs/LogRecord" }
775
- }
776
- }
777
- },
778
- {
779
- type: "object",
780
- required: [
781
- "event",
782
- "subscription",
783
- "platform",
784
- "slot",
785
- "mime",
786
- "width",
787
- "height",
788
- "capturedAt",
789
- "data"
790
- ],
791
- additionalProperties: false,
792
- properties: {
793
- event: { const: "frame" },
794
- subscription: { type: "string" },
795
- platform: { enum: ["ios", "android"] },
796
- slot: { type: "string" },
797
- mime: { const: "image/jpeg" },
798
- width: { type: "integer" },
799
- height: { type: "integer" },
800
- capturedAt: {
801
- type: "string",
802
- format: "date-time"
803
- },
804
- data: {
805
- type: "string",
806
- contentEncoding: "base64"
807
- },
808
- posture: { enum: ["folded", "unfolded"] }
809
- }
810
- },
811
- {
812
- type: "object",
813
- required: [
814
- "event",
815
- "subscription",
816
- "delayed"
817
- ],
818
- additionalProperties: false,
819
- properties: {
820
- event: { const: "frame-delayed" },
821
- subscription: { type: "string" },
822
- delayed: { type: "boolean" }
823
- }
824
- },
825
- {
826
- type: "object",
827
- required: [
828
- "event",
829
- "session",
830
- "reason",
831
- "message"
832
- ],
833
- additionalProperties: false,
834
- properties: {
835
- event: { const: "control-ended" },
836
- session: { type: "string" },
837
- reason: { enum: [...CONTROL_END_REASONS] },
838
- message: { type: "string" }
839
- }
840
- },
841
- {
842
- type: "object",
843
- required: [
844
- "event",
845
- "subscription",
846
- "error"
847
- ],
848
- additionalProperties: false,
849
- properties: {
850
- event: { const: "error" },
851
- subscription: { type: "string" },
852
- error: { $ref: "#/$defs/ProtocolError" }
853
- }
854
- }
855
- ] }
856
- },
857
- oneOf: [
858
- { $ref: "#/$defs/ClientRequest" },
859
- { $ref: "#/$defs/ServerResponse" },
860
- { $ref: "#/$defs/ServerEvent" }
861
- ]
862
- };
863
- }
864
- //#endregion
865
- export { VIDEO_HEADER_VERSION as C, protocolJsonSchema as E, VIDEO_FOLDED as S, VIDEO_UNFOLDED as T, PUSH_TOKEN_PATTERN as _, ERROR_CODES as a, TOUCH_PHASES as b, INPUT_BUTTONS as c, MAX_INPUT_TEXT as d, MAX_LOG_TAIL as f, PUSH_EVENTS as g, PROTOCOL_VERSION as h, DEVICE_POSTURES as i, LOG_LEVELS as l, PROTOCOL_SCHEMA_FILE as m, CAPABILITIES as n, FRAME_EDGE as o, METHODS as p, CONTROL_END_REASONS as r, FRAME_FPS as s, ACTIONS as t, LOG_SOURCES as u, RELOAD_PLATFORMS as v, VIDEO_KEYFRAME as w, VIDEO_CODECS as x, ROTATE_DIRECTIONS as y };