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