@stim-cli/server 1.20.2 → 1.22.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.
@@ -1,5 +1,6 @@
1
1
  import "node:module";
2
- import { ACTIONS, BUILD_REPO_PATTERN, BUILD_RUBY_VERSION_PATTERN, CAPABILITIES, CONTROL_END_REASONS, DEVICE_POSTURES, ERROR_CODES, FEATURES, FRAME_EDGE, FRAME_FPS, INPUT_BUTTONS, INPUT_KEYS, KEY_MODIFIERS, LEGACY_PUSH_EVENTS, LOG_LEVELS, LOG_SOURCES, MAX_INPUT_TEXT, MAX_LOG_TAIL, NOTIFICATION_LEVELS, NOTIFICATION_SUPPRESSIONS, PLATFORMS, PROTOCOL_VERSION, PUSH_EVENTS, PUSH_TOKEN_PATTERN, RELOAD_PLATFORMS, REPLAY_MARKER_KINDS, REPLAY_RATES, ROTATE_DIRECTIONS, TOUCH_PHASES, VIDEO_CODECS } from "@stim-cli/core/protocol";
2
+ import { ACTIONS, ARCHIVED_PAGE_LIMIT, BUILD_REPO_PATTERN, BUILD_RUBY_VERSION_PATTERN, CAPABILITIES, CONTROL_END_REASONS, DEVICE_POSTURES, ERROR_CODES, FEATURES, FRAME_EDGE, FRAME_FPS, INPUT_BUTTONS, INPUT_KEYS, KEY_MODIFIERS, LEGACY_PUSH_EVENTS, LOG_LEVELS, LOG_SOURCES, MAX_INPUT_TEXT, MAX_LOG_TAIL, NOTIFICATION_LEVELS, NOTIFICATION_SUPPRESSIONS, PLATFORMS, PROTOCOL_VERSION, PUSH_EVENTS, PUSH_TOKEN_PATTERN, RELOAD_PLATFORMS, REPLAY_MARKER_KINDS, REPLAY_RATES, ROTATE_DIRECTIONS, TOUCH_PHASES, VIDEO_CODECS } from "@stim-cli/core/protocol";
3
+ import { SETTING_SCOPES } from "@stim-cli/core/state";
3
4
  //#region \0rolldown/runtime.js
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -31,6 +32,116 @@ var protocol_exports = /* @__PURE__ */ __exportAll({ protocolJsonSchema: () => p
31
32
  import * as import__stim_cli_core_protocol from "@stim-cli/core/protocol";
32
33
  __reExport(protocol_exports, import__stim_cli_core_protocol);
33
34
  const requestId = { type: ["integer", "string"] };
35
+ const runText = {
36
+ type: "string",
37
+ minLength: 1,
38
+ maxLength: 1024,
39
+ pattern: "^[^\\u0000]+$"
40
+ };
41
+ const runSelector = { oneOf: [runText, { type: "boolean" }] };
42
+ const nativeRunProperties = {
43
+ slot: runText,
44
+ remote: runText,
45
+ remoteBuild: runText,
46
+ easProfile: runText,
47
+ device: runSelector,
48
+ wait: runSelector,
49
+ metroCheck: { type: "boolean" },
50
+ buildCache: { type: "boolean" }
51
+ };
52
+ const platformRunOptions = { oneOf: [
53
+ {
54
+ type: "object",
55
+ required: ["platform"],
56
+ additionalProperties: false,
57
+ properties: {
58
+ platform: { const: "ios" },
59
+ ...nativeRunProperties,
60
+ configuration: runText,
61
+ scheme: runText,
62
+ deviceType: runText,
63
+ runtime: runText,
64
+ simulatorApp: runText
65
+ }
66
+ },
67
+ {
68
+ type: "object",
69
+ required: ["platform"],
70
+ additionalProperties: false,
71
+ properties: {
72
+ platform: { const: "android" },
73
+ ...nativeRunProperties,
74
+ variant: runText,
75
+ systemImage: runText,
76
+ deviceProfile: runText
77
+ }
78
+ },
79
+ {
80
+ type: "object",
81
+ required: ["platform"],
82
+ additionalProperties: false,
83
+ properties: {
84
+ platform: { const: "macos" },
85
+ remote: runText,
86
+ remoteBuild: runText
87
+ }
88
+ },
89
+ {
90
+ type: "object",
91
+ required: ["platform"],
92
+ additionalProperties: false,
93
+ properties: {
94
+ platform: { const: "web" },
95
+ headed: { type: "boolean" }
96
+ }
97
+ }
98
+ ] };
99
+ const platformBuildOptions = { oneOf: [
100
+ {
101
+ type: "object",
102
+ required: ["platform"],
103
+ additionalProperties: false,
104
+ properties: {
105
+ platform: { const: "ios" },
106
+ configuration: runText,
107
+ scheme: runText,
108
+ arch: { enum: [
109
+ "arm64",
110
+ "x86_64",
111
+ "all"
112
+ ] },
113
+ buildCache: { type: "boolean" },
114
+ remoteBuild: runText
115
+ }
116
+ },
117
+ {
118
+ type: "object",
119
+ required: ["platform"],
120
+ additionalProperties: false,
121
+ properties: {
122
+ platform: { const: "android" },
123
+ variant: runText,
124
+ abi: { enum: [
125
+ "arm64-v8a",
126
+ "armeabi-v7a",
127
+ "x86",
128
+ "x86_64",
129
+ "all"
130
+ ] },
131
+ buildCache: { type: "boolean" },
132
+ remoteBuild: runText
133
+ }
134
+ },
135
+ {
136
+ type: "object",
137
+ required: ["platform"],
138
+ additionalProperties: false,
139
+ properties: {
140
+ platform: { const: "macos" },
141
+ remoteBuild: runText
142
+ }
143
+ }
144
+ ] };
34
145
  const protocolError = {
35
146
  type: "object",
36
147
  required: ["code", "message"],
@@ -40,14 +151,355 @@ const protocolError = {
40
151
  message: { type: "string" }
41
152
  }
42
153
  };
154
+ const sha256 = {
155
+ type: "string",
156
+ pattern: "^[0-9a-f]{64}$"
157
+ };
43
158
  const buildRepo = {
44
159
  type: "string",
45
160
  pattern: BUILD_REPO_PATTERN
46
161
  };
47
- const sha256 = {
48
- type: "string",
49
- pattern: "^[0-9a-f]{64}$"
162
+ const buildArtifactIdentity = {
163
+ type: "object",
164
+ required: ["fingerprint", "cacheKey"],
165
+ additionalProperties: false,
166
+ properties: {
167
+ fingerprint: {
168
+ type: "string",
169
+ minLength: 1,
170
+ maxLength: 256
171
+ },
172
+ cacheKey: {
173
+ type: "string",
174
+ minLength: 1,
175
+ maxLength: 1024
176
+ }
177
+ }
178
+ };
179
+ const gradleArtifactQuery = {
180
+ type: "object",
181
+ required: [
182
+ "project",
183
+ "sourceDigest",
184
+ "inputs",
185
+ "android"
186
+ ],
187
+ additionalProperties: false,
188
+ properties: {
189
+ project: { type: "string" },
190
+ sourceDigest: sha256,
191
+ inputs: {
192
+ type: "object",
193
+ required: [
194
+ "complete",
195
+ "ignored",
196
+ "outputs"
197
+ ],
198
+ additionalProperties: false,
199
+ properties: {
200
+ complete: { const: true },
201
+ ignored: {
202
+ type: "array",
203
+ items: {
204
+ type: "string",
205
+ minLength: 1
206
+ }
207
+ },
208
+ outputs: {
209
+ type: "array",
210
+ items: {
211
+ type: "string",
212
+ minLength: 1
213
+ }
214
+ }
215
+ }
216
+ },
217
+ android: {
218
+ type: "object",
219
+ required: [
220
+ "variant",
221
+ "abi",
222
+ "gradleBuildCache",
223
+ "pch",
224
+ "compilerCache"
225
+ ],
226
+ additionalProperties: false,
227
+ properties: {
228
+ variant: {
229
+ type: "string",
230
+ minLength: 1
231
+ },
232
+ abi: { type: ["string", "null"] },
233
+ gradleBuildCache: { type: "boolean" },
234
+ pch: { enum: [
235
+ "auto",
236
+ "on",
237
+ "off"
238
+ ] },
239
+ compilerCache: { enum: ["ccache", "none"] },
240
+ gradleRoot: { type: ["string", "null"] },
241
+ module: { type: ["string", "null"] }
242
+ }
243
+ }
244
+ }
245
+ };
246
+ const swiftpmArtifactInputs = {
247
+ type: "object",
248
+ required: [
249
+ "complete",
250
+ "ignored",
251
+ "outputs",
252
+ "localFiles",
253
+ "environment"
254
+ ],
255
+ additionalProperties: false,
256
+ properties: {
257
+ complete: { const: true },
258
+ ignored: {
259
+ type: "array",
260
+ maxItems: 1e3,
261
+ items: {
262
+ type: "string",
263
+ minLength: 1
264
+ }
265
+ },
266
+ outputs: {
267
+ type: "array",
268
+ maxItems: 1e3,
269
+ items: {
270
+ type: "string",
271
+ minLength: 1
272
+ }
273
+ },
274
+ localFiles: {
275
+ type: "array",
276
+ maxItems: 1e3,
277
+ items: {
278
+ type: "string",
279
+ minLength: 1,
280
+ maxLength: 4096
281
+ }
282
+ },
283
+ environment: {
284
+ type: "array",
285
+ maxItems: 1e3,
286
+ items: {
287
+ type: "string",
288
+ pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
289
+ }
290
+ }
291
+ }
292
+ };
293
+ const swiftpmArtifactQuery = {
294
+ type: "object",
295
+ required: [
296
+ "project",
297
+ "sourceDigest",
298
+ "stimBuild",
299
+ "inputs",
300
+ "build"
301
+ ],
302
+ additionalProperties: false,
303
+ properties: {
304
+ project: { type: "string" },
305
+ sourceDigest: sha256,
306
+ stimBuild: {
307
+ type: "string",
308
+ minLength: 1,
309
+ maxLength: 256
310
+ },
311
+ inputs: swiftpmArtifactInputs,
312
+ build: {
313
+ type: "object",
314
+ required: [
315
+ "product",
316
+ "infoPlist",
317
+ "resources",
318
+ "assetCatalog"
319
+ ],
320
+ additionalProperties: false,
321
+ properties: {
322
+ product: {
323
+ type: "string",
324
+ pattern: "^[A-Za-z0-9_.-]{1,100}$"
325
+ },
326
+ infoPlist: {
327
+ type: "string",
328
+ minLength: 1
329
+ },
330
+ resources: {
331
+ type: "object",
332
+ maxProperties: 256,
333
+ additionalProperties: { type: "string" }
334
+ },
335
+ assetCatalog: {
336
+ type: ["string", "null"],
337
+ minLength: 1
338
+ }
339
+ }
340
+ }
341
+ }
342
+ };
343
+ const reactNativeArtifactQuery = {
344
+ type: "object",
345
+ required: [
346
+ "project",
347
+ "fingerprint",
348
+ "isExpo",
349
+ "platform",
350
+ "toolchain"
351
+ ],
352
+ additionalProperties: false,
353
+ oneOf: [{
354
+ properties: {
355
+ platform: { const: "ios" },
356
+ toolchain: { required: [
357
+ "arch",
358
+ "xcode",
359
+ "simulatorSdk",
360
+ "cocoapods"
361
+ ] }
362
+ },
363
+ required: ["ios"]
364
+ }, {
365
+ properties: {
366
+ platform: { const: "android" },
367
+ toolchain: { required: ["jdk"] }
368
+ },
369
+ required: ["android"]
370
+ }],
371
+ properties: {
372
+ project: { type: "string" },
373
+ fingerprint: {
374
+ type: "string",
375
+ minLength: 1,
376
+ maxLength: 256
377
+ },
378
+ isExpo: { type: "boolean" },
379
+ platform: { enum: ["ios", "android"] },
380
+ toolchain: {
381
+ type: "object",
382
+ required: ["stimBuild"],
383
+ additionalProperties: false,
384
+ properties: {
385
+ stimBuild: {
386
+ type: "string",
387
+ minLength: 1
388
+ },
389
+ arch: {
390
+ type: "string",
391
+ minLength: 1
392
+ },
393
+ xcode: {
394
+ type: "string",
395
+ minLength: 1
396
+ },
397
+ simulatorSdk: {
398
+ type: "string",
399
+ minLength: 1
400
+ },
401
+ cocoapods: {
402
+ type: "string",
403
+ minLength: 1
404
+ },
405
+ jdk: {
406
+ type: "string",
407
+ minLength: 1
408
+ }
409
+ }
410
+ },
411
+ ios: {
412
+ type: "object",
413
+ required: [
414
+ "runtime",
415
+ "configuration",
416
+ "scheme",
417
+ "projectPath",
418
+ "optimizations"
419
+ ],
420
+ additionalProperties: false,
421
+ properties: {
422
+ runtime: {
423
+ type: "string",
424
+ minLength: 1
425
+ },
426
+ configuration: {
427
+ type: "string",
428
+ minLength: 1
429
+ },
430
+ scheme: { type: ["string", "null"] },
431
+ projectPath: {
432
+ type: "string",
433
+ minLength: 1
434
+ },
435
+ optimizations: {
436
+ type: "object",
437
+ required: [
438
+ "compilationCache",
439
+ "swiftCompilationCache",
440
+ "prefixMapping"
441
+ ],
442
+ additionalProperties: false,
443
+ properties: {
444
+ compilationCache: { type: "boolean" },
445
+ swiftCompilationCache: { type: ["boolean", "null"] },
446
+ prefixMapping: { type: "boolean" }
447
+ }
448
+ }
449
+ }
450
+ },
451
+ android: {
452
+ type: "object",
453
+ required: [
454
+ "variant",
455
+ "abi",
456
+ "gradleBuildCache",
457
+ "pch",
458
+ "compilerCache"
459
+ ],
460
+ additionalProperties: false,
461
+ properties: {
462
+ variant: { type: ["string", "null"] },
463
+ abi: { type: ["string", "null"] },
464
+ gradleBuildCache: { type: "boolean" },
465
+ pch: { enum: [
466
+ "auto",
467
+ "on",
468
+ "off"
469
+ ] },
470
+ compilerCache: { enum: ["ccache", "none"] },
471
+ gradleRoot: { type: ["string", "null"] },
472
+ module: { type: ["string", "null"] }
473
+ }
474
+ }
475
+ }
476
+ };
477
+ const workspaceRef = {
478
+ type: "object",
479
+ required: ["workspace"],
480
+ additionalProperties: false,
481
+ properties: { workspace: {
482
+ type: "string",
483
+ minLength: 1
484
+ } }
50
485
  };
486
+ const keyedDelta = (description) => ({
487
+ type: "object",
488
+ required: ["upsert", "remove"],
489
+ additionalProperties: false,
490
+ properties: {
491
+ upsert: {
492
+ type: "array",
493
+ items: { type: "object" },
494
+ description
495
+ },
496
+ remove: {
497
+ type: "array",
498
+ items: { type: "string" },
499
+ description: "The paths that are gone."
500
+ }
501
+ }
502
+ });
51
503
  const buildJob = {
52
504
  type: "object",
53
505
  required: ["job"],
@@ -776,14 +1228,10 @@ function protocolJsonSchema() {
776
1228
  },
777
1229
  HelloParams: {
778
1230
  type: "object",
779
- required: [
780
- "protocol",
781
- "client",
782
- "auth"
783
- ],
1231
+ description: "The first request, sent encrypted after the Noise handshake on a network connection, or in the clear on the local Unix socket.",
1232
+ required: ["client"],
784
1233
  additionalProperties: false,
785
1234
  properties: {
786
- protocol: { type: "integer" },
787
1235
  client: {
788
1236
  type: "object",
789
1237
  required: ["name", "version"],
@@ -796,44 +1244,8 @@ function protocolJsonSchema() {
796
1244
  }
797
1245
  }
798
1246
  },
799
- auth: { oneOf: [
800
- {
801
- type: "object",
802
- required: ["pairingToken", "deviceName"],
803
- additionalProperties: false,
804
- properties: {
805
- pairingToken: { type: "string" },
806
- deviceName: {
807
- type: "string",
808
- minLength: 1
809
- }
810
- }
811
- },
812
- {
813
- type: "object",
814
- required: ["deviceToken"],
815
- additionalProperties: false,
816
- properties: { deviceToken: { type: "string" } }
817
- },
818
- {
819
- type: "object",
820
- required: ["request", "deviceName"],
821
- additionalProperties: false,
822
- properties: {
823
- request: { enum: ["build", "device-host"] },
824
- deviceName: {
825
- type: "string",
826
- minLength: 1
827
- },
828
- setupTicket: {
829
- type: "string",
830
- minLength: 43,
831
- maxLength: 43,
832
- pattern: "^[A-Za-z0-9_-]{43}$"
833
- }
834
- }
835
- }
836
- ] }
1247
+ access: { enum: ["build", "device-host"] },
1248
+ desktopBootstrap: { const: true }
837
1249
  }
838
1250
  },
839
1251
  HelloResult: {
@@ -875,7 +1287,9 @@ function protocolJsonSchema() {
875
1287
  name: { type: "string" },
876
1288
  version: { type: "string" },
877
1289
  stim: { type: "string" },
878
- home: { type: "string" }
1290
+ home: { type: "string" },
1291
+ id: { type: "string" },
1292
+ port: { type: "integer" }
879
1293
  }
880
1294
  },
881
1295
  capabilities: {
@@ -899,18 +1313,29 @@ function protocolJsonSchema() {
899
1313
  name: { type: "string" }
900
1314
  }
901
1315
  },
902
- deviceToken: { type: "string" },
903
- approval: {
1316
+ desktopBootstrap: {
904
1317
  type: "object",
905
- required: ["state", "expiresAt"],
1318
+ required: ["nonce", "proof"],
906
1319
  additionalProperties: false,
907
1320
  properties: {
908
- state: { const: "pending" },
909
- expiresAt: { type: "string" }
1321
+ nonce: {
1322
+ type: "string",
1323
+ pattern: "^[A-Za-z0-9_-]{43}$"
1324
+ },
1325
+ proof: {
1326
+ type: "string",
1327
+ pattern: "^[A-Za-z0-9_-]{43}$"
1328
+ }
910
1329
  }
911
1330
  }
912
1331
  }
913
1332
  },
1333
+ DesktopAuthenticateResult: {
1334
+ type: "object",
1335
+ required: ["authorized"],
1336
+ additionalProperties: false,
1337
+ properties: { authorized: { const: true } }
1338
+ },
914
1339
  LogRecord: {
915
1340
  type: "object",
916
1341
  description: "One record as `stim logs --json` prints it.",
@@ -926,6 +1351,25 @@ function protocolJsonSchema() {
926
1351
  }
927
1352
  }
928
1353
  },
1354
+ DesktopLogFilter: {
1355
+ type: "object",
1356
+ required: ["workspace"],
1357
+ additionalProperties: false,
1358
+ properties: {
1359
+ workspace: { type: "string" },
1360
+ sources: {
1361
+ type: "array",
1362
+ minItems: 1,
1363
+ items: { enum: [...LOG_SOURCES] }
1364
+ },
1365
+ level: { enum: [...LOG_LEVELS] },
1366
+ grep: {
1367
+ type: "string",
1368
+ pattern: "^[^\\u0000]*$"
1369
+ },
1370
+ errors: { type: "boolean" }
1371
+ }
1372
+ },
929
1373
  LogFilter: {
930
1374
  type: "object",
931
1375
  oneOf: [{ required: ["workspace"] }, { required: ["archive"] }],
@@ -1383,6 +1827,36 @@ function protocolJsonSchema() {
1383
1827
  suppressed: { enum: [...NOTIFICATION_SUPPRESSIONS] }
1384
1828
  }
1385
1829
  },
1830
+ DesktopReportTarget: { oneOf: [{
1831
+ type: "object",
1832
+ required: ["report"],
1833
+ additionalProperties: false,
1834
+ properties: { report: { const: "gc" } }
1835
+ }, {
1836
+ type: "object",
1837
+ required: ["report", "cwd"],
1838
+ additionalProperties: false,
1839
+ properties: {
1840
+ report: { const: "doctor" },
1841
+ cwd: {
1842
+ type: "string",
1843
+ minLength: 1,
1844
+ maxLength: 4096
1845
+ },
1846
+ platform: { enum: ["ios", "android"] }
1847
+ }
1848
+ }] },
1849
+ DesktopReportSnapshot: {
1850
+ type: "object",
1851
+ required: ["pending", "value"],
1852
+ additionalProperties: false,
1853
+ properties: {
1854
+ pending: { type: "boolean" },
1855
+ value: { type: ["object", "null"] },
1856
+ error: { type: "string" },
1857
+ measuredAt: { type: "string" }
1858
+ }
1859
+ },
1386
1860
  MachineDetails: {
1387
1861
  type: "object",
1388
1862
  required: [
@@ -1405,7 +1879,7 @@ function protocolJsonSchema() {
1405
1879
  statsError: { type: "string" },
1406
1880
  buildMachines: {
1407
1881
  type: ["array", "null"],
1408
- description: "`remoteMachines` from `stim doctor --json --platform ios`.",
1882
+ description: "`remoteMachines` from `stim doctor --json`.",
1409
1883
  items: { type: "object" }
1410
1884
  },
1411
1885
  buildMachinesError: { type: "string" },
@@ -1413,7 +1887,7 @@ function protocolJsonSchema() {
1413
1887
  buildMachinesPending: { type: "boolean" },
1414
1888
  buildClients: {
1415
1889
  type: "array",
1416
- description: "The builds this Mac ran for each client, from the audit log.",
1890
+ description: "The builds this machine ran for each client, from the audit log.",
1417
1891
  items: {
1418
1892
  type: "object",
1419
1893
  required: [
@@ -1916,43 +2390,327 @@ function protocolJsonSchema() {
1916
2390
  request("device-host.input.rotate", session({ direction: { enum: [...ROTATE_DIRECTIONS] } }, ["direction"])),
1917
2391
  request("device-host.input.posture", session({ posture: { enum: [...DEVICE_POSTURES] } }, ["posture"])),
1918
2392
  request("hello", { $ref: "#/$defs/HelloParams" }),
2393
+ request("desktop.authenticate", {
2394
+ type: "object",
2395
+ required: ["proof"],
2396
+ additionalProperties: false,
2397
+ properties: { proof: {
2398
+ type: "string",
2399
+ pattern: "^[A-Za-z0-9_-]{43}$"
2400
+ } }
2401
+ }),
1919
2402
  optionalParams("route.setup", {
1920
2403
  type: "object",
1921
2404
  maxProperties: 0
1922
2405
  }),
1923
- request("status.subscribe"),
1924
- request("logs.query", { $ref: "#/$defs/LogFilter" }),
1925
- request("logs.subscribe", { $ref: "#/$defs/LogFilter" }),
1926
- request("frames.subscribe", { $ref: "#/$defs/FrameTarget" }),
1927
- request("frames.keyframe", {
2406
+ request("desktop.reports.get", { $ref: "#/$defs/DesktopReportTarget" }),
2407
+ request("desktop.reports.subscribe", { $ref: "#/$defs/DesktopReportTarget" }),
2408
+ optionalParams("desktop.reports.invalidate", {
1928
2409
  type: "object",
1929
- required: ["subscription"],
2410
+ maxProperties: 0
2411
+ }),
2412
+ request("desktop.settings.get", {
2413
+ type: "object",
2414
+ required: ["cwd"],
1930
2415
  additionalProperties: false,
1931
- properties: { subscription: { type: "string" } }
2416
+ properties: { cwd: {
2417
+ type: "string",
2418
+ minLength: 1,
2419
+ maxLength: 4096
2420
+ } }
1932
2421
  }),
1933
- request("frames.seek", {
2422
+ request("desktop.settings.write", { oneOf: ["set", "unset"].map((action) => ({
1934
2423
  type: "object",
1935
2424
  required: [
1936
- "subscription",
1937
- "at",
1938
- "rate"
2425
+ "cwd",
2426
+ "action",
2427
+ "key",
2428
+ ...action === "set" ? ["value"] : []
1939
2429
  ],
1940
2430
  additionalProperties: false,
1941
2431
  properties: {
1942
- subscription: { type: "string" },
1943
- at: {
1944
- type: "number",
1945
- description: "Epoch milliseconds on the Mac clock."
2432
+ cwd: {
2433
+ type: "string",
2434
+ minLength: 1,
2435
+ maxLength: 4096
1946
2436
  },
1947
- rate: { enum: [...REPLAY_RATES] }
2437
+ action: { const: action },
2438
+ key: {
2439
+ type: "string",
2440
+ minLength: 1,
2441
+ maxLength: 256
2442
+ },
2443
+ scope: { enum: [...SETTING_SCOPES] },
2444
+ ...action === "set" ? { value: { type: "string" } } : {}
1948
2445
  }
1949
- }),
1950
- request("frames.live", {
2446
+ })) }),
2447
+ request("desktop.logs.subscribe", { $ref: "#/$defs/DesktopLogFilter" }),
2448
+ request("desktop.doctor.run", {
1951
2449
  type: "object",
1952
- required: ["subscription"],
2450
+ required: ["cwd"],
1953
2451
  additionalProperties: false,
1954
- properties: { subscription: { type: "string" } }
1955
- }),
2452
+ properties: {
2453
+ cwd: {
2454
+ type: "string",
2455
+ minLength: 1,
2456
+ maxLength: 4096
2457
+ },
2458
+ platform: { enum: ["ios", "android"] }
2459
+ }
2460
+ }),
2461
+ request("desktop.stop.subscribe", {
2462
+ type: "object",
2463
+ required: ["cwd"],
2464
+ additionalProperties: false,
2465
+ properties: {
2466
+ cwd: {
2467
+ type: "string",
2468
+ minLength: 1,
2469
+ maxLength: 4096
2470
+ },
2471
+ slot: {
2472
+ type: "string",
2473
+ pattern: "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$",
2474
+ not: { enum: [
2475
+ "constructor",
2476
+ "prototype",
2477
+ "__proto__"
2478
+ ] }
2479
+ }
2480
+ }
2481
+ }),
2482
+ request("desktop.machine-access.subscribe", {
2483
+ type: "object",
2484
+ required: ["cwd"],
2485
+ additionalProperties: false,
2486
+ properties: {
2487
+ cwd: {
2488
+ type: "string",
2489
+ minLength: 1,
2490
+ maxLength: 4096
2491
+ },
2492
+ ticket: {
2493
+ type: "string",
2494
+ pattern: "^[A-Za-z0-9_-]{43}$"
2495
+ }
2496
+ }
2497
+ }),
2498
+ request("desktop.reload.subscribe", {
2499
+ type: "object",
2500
+ required: ["cwd"],
2501
+ additionalProperties: false,
2502
+ properties: {
2503
+ cwd: {
2504
+ type: "string",
2505
+ minLength: 1,
2506
+ maxLength: 4096
2507
+ },
2508
+ platform: { enum: [...RELOAD_PLATFORMS] }
2509
+ }
2510
+ }),
2511
+ request("desktop.start.subscribe", {
2512
+ type: "object",
2513
+ required: ["cwd"],
2514
+ additionalProperties: false,
2515
+ properties: {
2516
+ cwd: {
2517
+ type: "string",
2518
+ minLength: 1,
2519
+ maxLength: 4096
2520
+ },
2521
+ remote: { type: "boolean" },
2522
+ resetCache: { type: "boolean" },
2523
+ waitSeconds: {
2524
+ type: "integer",
2525
+ minimum: 1,
2526
+ maximum: Number.MAX_SAFE_INTEGER
2527
+ }
2528
+ }
2529
+ }),
2530
+ request("desktop.run.subscribe", {
2531
+ type: "object",
2532
+ required: ["cwd", "options"],
2533
+ additionalProperties: false,
2534
+ properties: {
2535
+ cwd: {
2536
+ type: "string",
2537
+ minLength: 1,
2538
+ maxLength: 4096
2539
+ },
2540
+ options: platformRunOptions
2541
+ }
2542
+ }),
2543
+ request("desktop.plan.get", { oneOf: [{
2544
+ type: "object",
2545
+ required: ["cwd", "platform"],
2546
+ additionalProperties: false,
2547
+ properties: {
2548
+ cwd: {
2549
+ type: "string",
2550
+ minLength: 1,
2551
+ maxLength: 4096
2552
+ },
2553
+ platform: { enum: ["ios", "android"] },
2554
+ slot: {
2555
+ type: "string",
2556
+ pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
2557
+ },
2558
+ request: {
2559
+ type: "string",
2560
+ pattern: "^[A-Za-z0-9_-]{1,128}$"
2561
+ }
2562
+ }
2563
+ }, {
2564
+ type: "object",
2565
+ required: ["cwd", "platform"],
2566
+ additionalProperties: false,
2567
+ properties: {
2568
+ cwd: {
2569
+ type: "string",
2570
+ minLength: 1,
2571
+ maxLength: 4096
2572
+ },
2573
+ platform: { const: "macos" },
2574
+ request: {
2575
+ type: "string",
2576
+ pattern: "^[A-Za-z0-9_-]{1,128}$"
2577
+ }
2578
+ }
2579
+ }] }),
2580
+ request("desktop.plan.cancel", {
2581
+ type: "object",
2582
+ required: ["request"],
2583
+ additionalProperties: false,
2584
+ properties: { request: {
2585
+ type: "string",
2586
+ pattern: "^[A-Za-z0-9_-]{1,128}$"
2587
+ } }
2588
+ }),
2589
+ request("desktop.build.subscribe", {
2590
+ type: "object",
2591
+ required: ["cwd", "options"],
2592
+ additionalProperties: false,
2593
+ properties: {
2594
+ cwd: {
2595
+ type: "string",
2596
+ minLength: 1,
2597
+ maxLength: 4096
2598
+ },
2599
+ options: platformBuildOptions
2600
+ }
2601
+ }),
2602
+ request("desktop.gc.subscribe", {
2603
+ type: "object",
2604
+ required: ["cwd"],
2605
+ additionalProperties: false,
2606
+ properties: {
2607
+ cwd: {
2608
+ type: "string",
2609
+ minLength: 1,
2610
+ maxLength: 4096
2611
+ },
2612
+ cache: {
2613
+ type: "string",
2614
+ minLength: 1,
2615
+ maxLength: 1024,
2616
+ pattern: "^.*\\S.*$"
2617
+ },
2618
+ olderThan: {
2619
+ type: "integer",
2620
+ minimum: Number.MIN_SAFE_INTEGER,
2621
+ maximum: Number.MAX_SAFE_INTEGER
2622
+ },
2623
+ worktrees: { type: "boolean" },
2624
+ delete: { type: "boolean" },
2625
+ idleMs: {
2626
+ type: "integer",
2627
+ minimum: 1,
2628
+ maximum: Number.MAX_SAFE_INTEGER
2629
+ }
2630
+ }
2631
+ }),
2632
+ request("desktop.worktree.warm.subscribe", {
2633
+ type: "object",
2634
+ required: ["cwd"],
2635
+ additionalProperties: false,
2636
+ properties: { cwd: {
2637
+ type: "string",
2638
+ minLength: 1,
2639
+ maxLength: 4096
2640
+ } }
2641
+ }),
2642
+ request("desktop.worktree.remove.subscribe", {
2643
+ type: "object",
2644
+ required: ["cwd"],
2645
+ additionalProperties: false,
2646
+ properties: {
2647
+ cwd: {
2648
+ type: "string",
2649
+ minLength: 1,
2650
+ maxLength: 4096
2651
+ },
2652
+ target: {
2653
+ type: "string",
2654
+ minLength: 1,
2655
+ maxLength: 4096
2656
+ },
2657
+ force: { type: "boolean" }
2658
+ }
2659
+ }),
2660
+ request("status.subscribe"),
2661
+ request("workspaces.subscribe"),
2662
+ request("workspace.subscribe", workspaceRef),
2663
+ request("machine.subscribe"),
2664
+ request("builds.history", workspaceRef),
2665
+ optionalParams("archived.list", {
2666
+ type: "object",
2667
+ additionalProperties: false,
2668
+ properties: {
2669
+ before: {
2670
+ type: "string",
2671
+ minLength: 1
2672
+ },
2673
+ limit: {
2674
+ type: "integer",
2675
+ minimum: 1,
2676
+ maximum: ARCHIVED_PAGE_LIMIT
2677
+ }
2678
+ }
2679
+ }),
2680
+ request("worktrees.list"),
2681
+ request("maintenance.get"),
2682
+ request("logs.query", { $ref: "#/$defs/LogFilter" }),
2683
+ request("logs.subscribe", { $ref: "#/$defs/LogFilter" }),
2684
+ request("frames.subscribe", { $ref: "#/$defs/FrameTarget" }),
2685
+ request("frames.keyframe", {
2686
+ type: "object",
2687
+ required: ["subscription"],
2688
+ additionalProperties: false,
2689
+ properties: { subscription: { type: "string" } }
2690
+ }),
2691
+ request("frames.seek", {
2692
+ type: "object",
2693
+ required: [
2694
+ "subscription",
2695
+ "at",
2696
+ "rate"
2697
+ ],
2698
+ additionalProperties: false,
2699
+ properties: {
2700
+ subscription: { type: "string" },
2701
+ at: {
2702
+ type: "number",
2703
+ description: "Epoch milliseconds on the machine clock."
2704
+ },
2705
+ rate: { enum: [...REPLAY_RATES] }
2706
+ }
2707
+ }),
2708
+ request("frames.live", {
2709
+ type: "object",
2710
+ required: ["subscription"],
2711
+ additionalProperties: false,
2712
+ properties: { subscription: { type: "string" } }
2713
+ }),
1956
2714
  request("replay.range", {
1957
2715
  type: "object",
1958
2716
  required: ["platform"],
@@ -2001,7 +2759,7 @@ function protocolJsonSchema() {
2001
2759
  },
2002
2760
  at: {
2003
2761
  type: "number",
2004
- description: "Epoch milliseconds on the Mac clock."
2762
+ description: "Epoch milliseconds on the machine clock."
2005
2763
  }
2006
2764
  }
2007
2765
  }),
@@ -2221,11 +2979,24 @@ function protocolJsonSchema() {
2221
2979
  properties: {
2222
2980
  repo: buildRepo,
2223
2981
  lockfile: sha256,
2982
+ dependencies: {
2983
+ type: "object",
2984
+ required: ["project", "packageName"],
2985
+ additionalProperties: false,
2986
+ properties: {
2987
+ project: { type: "string" },
2988
+ packageName: { type: ["string", "null"] }
2989
+ }
2990
+ },
2224
2991
  rubyVersion: {
2225
2992
  type: "string",
2226
2993
  pattern: BUILD_RUBY_VERSION_PATTERN
2227
2994
  },
2228
- native: { enum: ["xcode", "gradle"] }
2995
+ native: { enum: ["xcode", "gradle"] },
2996
+ artifact: buildArtifactIdentity,
2997
+ gradleArtifact: gradleArtifactQuery,
2998
+ reactNativeArtifact: reactNativeArtifactQuery,
2999
+ swiftpmArtifact: swiftpmArtifactQuery
2229
3000
  }
2230
3001
  }),
2231
3002
  request("build.sync", {
@@ -2369,6 +3140,20 @@ function protocolJsonSchema() {
2369
3140
  properties: {
2370
3141
  provider: { const: "gradle" },
2371
3142
  sourceDigest: sha256,
3143
+ cache: {
3144
+ type: "object",
3145
+ required: [
3146
+ "read",
3147
+ "write",
3148
+ "remote"
3149
+ ],
3150
+ additionalProperties: false,
3151
+ properties: {
3152
+ read: { type: "boolean" },
3153
+ write: { type: "boolean" },
3154
+ remote: { type: "boolean" }
3155
+ }
3156
+ },
2372
3157
  inputs: {
2373
3158
  type: "object",
2374
3159
  required: [
@@ -2443,6 +3228,7 @@ function protocolJsonSchema() {
2443
3228
  type: "string",
2444
3229
  pattern: "^[A-Za-z0-9][A-Za-z0-9.-]{0,199}$"
2445
3230
  },
3231
+ artifactInputs: swiftpmArtifactInputs,
2446
3232
  resources: {
2447
3233
  type: "object",
2448
3234
  maxProperties: 256,
@@ -2454,6 +3240,7 @@ function protocolJsonSchema() {
2454
3240
  }
2455
3241
  }
2456
3242
  },
3243
+ cacheArtifact: { type: "boolean" },
2457
3244
  stimBuild: {
2458
3245
  type: "string",
2459
3246
  minLength: 1
@@ -2462,6 +3249,18 @@ function protocolJsonSchema() {
2462
3249
  }),
2463
3250
  request("build.cancel", buildJob),
2464
3251
  request("build.artifact", buildJob),
3252
+ request("build.cached-artifact", {
3253
+ type: "object",
3254
+ required: ["repo", "artifact"],
3255
+ additionalProperties: false,
3256
+ properties: {
3257
+ repo: buildRepo,
3258
+ artifact: buildArtifactIdentity,
3259
+ gradleArtifact: gradleArtifactQuery,
3260
+ reactNativeArtifact: reactNativeArtifactQuery,
3261
+ swiftpmArtifact: swiftpmArtifactQuery
3262
+ }
3263
+ }),
2465
3264
  request("build.attach", buildJob),
2466
3265
  request("server.update.status"),
2467
3266
  request("device-host.sessions"),
@@ -2566,6 +3365,7 @@ function protocolJsonSchema() {
2566
3365
  { $ref: "#/$defs/ServerUpdateProgress" },
2567
3366
  { $ref: "#/$defs/MachineUpdateStatus" },
2568
3367
  { $ref: "#/$defs/HelloResult" },
3368
+ { $ref: "#/$defs/DesktopAuthenticateResult" },
2569
3369
  { $ref: "#/$defs/ControlBeginResult" },
2570
3370
  { $ref: "#/$defs/SimulatorOptions" },
2571
3371
  { $ref: "#/$defs/ActionResult" },
@@ -2714,6 +3514,76 @@ function protocolJsonSchema() {
2714
3514
  }
2715
3515
  }] },
2716
3516
  ServerEvent: { oneOf: [
3517
+ {
3518
+ type: "object",
3519
+ required: [
3520
+ "event",
3521
+ "subscription",
3522
+ "stream",
3523
+ "message"
3524
+ ],
3525
+ additionalProperties: false,
3526
+ properties: {
3527
+ event: { enum: [
3528
+ "desktop-stop-progress",
3529
+ "desktop-reload-progress",
3530
+ "desktop-start-progress",
3531
+ "desktop-run-progress",
3532
+ "desktop-build-progress",
3533
+ "desktop-gc-progress",
3534
+ "desktop-worktree-remove-progress",
3535
+ "desktop-worktree-warm-progress",
3536
+ "desktop-machine-access-progress"
3537
+ ] },
3538
+ subscription: { type: "string" },
3539
+ stream: { enum: ["stdout", "stderr"] },
3540
+ message: { type: "string" }
3541
+ }
3542
+ },
3543
+ {
3544
+ type: "object",
3545
+ required: [
3546
+ "event",
3547
+ "subscription",
3548
+ "exitCode",
3549
+ "stdout",
3550
+ "message"
3551
+ ],
3552
+ additionalProperties: false,
3553
+ properties: {
3554
+ event: { enum: [
3555
+ "desktop-stop-ended",
3556
+ "desktop-reload-ended",
3557
+ "desktop-start-ended",
3558
+ "desktop-run-ended",
3559
+ "desktop-build-ended",
3560
+ "desktop-gc-ended",
3561
+ "desktop-worktree-remove-ended",
3562
+ "desktop-worktree-warm-ended",
3563
+ "desktop-machine-access-ended"
3564
+ ] },
3565
+ subscription: { type: "string" },
3566
+ exitCode: { enum: [0, 1] },
3567
+ stdout: { type: "string" },
3568
+ message: { type: "string" }
3569
+ }
3570
+ },
3571
+ {
3572
+ type: "object",
3573
+ required: [
3574
+ "event",
3575
+ "subscription",
3576
+ "target",
3577
+ "snapshot"
3578
+ ],
3579
+ additionalProperties: false,
3580
+ properties: {
3581
+ event: { const: "desktop-report" },
3582
+ subscription: { type: "string" },
3583
+ target: { $ref: "#/$defs/DesktopReportTarget" },
3584
+ snapshot: { $ref: "#/$defs/DesktopReportSnapshot" }
3585
+ }
3586
+ },
2717
3587
  {
2718
3588
  type: "object",
2719
3589
  required: [
@@ -2804,6 +3674,95 @@ function protocolJsonSchema() {
2804
3674
  }
2805
3675
  }
2806
3676
  },
3677
+ {
3678
+ type: "object",
3679
+ required: [
3680
+ "event",
3681
+ "subscription",
3682
+ "seq"
3683
+ ],
3684
+ additionalProperties: false,
3685
+ properties: {
3686
+ event: { const: "workspaces" },
3687
+ subscription: { type: "string" },
3688
+ seq: {
3689
+ type: "integer",
3690
+ minimum: 0
3691
+ },
3692
+ snapshot: {
3693
+ type: "object",
3694
+ required: [
3695
+ "workspaces",
3696
+ "worktrees",
3697
+ "archived"
3698
+ ],
3699
+ additionalProperties: false,
3700
+ properties: {
3701
+ workspaces: {
3702
+ type: "array",
3703
+ items: { type: "object" }
3704
+ },
3705
+ worktrees: {
3706
+ type: "array",
3707
+ items: { type: "object" }
3708
+ },
3709
+ archived: { type: "object" }
3710
+ }
3711
+ },
3712
+ workspaces: keyedDelta("Workspace summaries to insert or replace by path."),
3713
+ worktrees: keyedDelta("Unprovisioned worktree rows to insert or replace by path."),
3714
+ archived: {
3715
+ type: "object",
3716
+ description: "The archives summary, when it changed."
3717
+ }
3718
+ }
3719
+ },
3720
+ {
3721
+ type: "object",
3722
+ required: [
3723
+ "event",
3724
+ "subscription",
3725
+ "seq",
3726
+ "environment"
3727
+ ],
3728
+ additionalProperties: false,
3729
+ properties: {
3730
+ event: { const: "workspace" },
3731
+ subscription: { type: "string" },
3732
+ seq: {
3733
+ type: "integer",
3734
+ minimum: 0
3735
+ },
3736
+ environment: {
3737
+ oneOf: [{ type: "null" }, { type: "object" }],
3738
+ description: "The environment, as `stim status --json` prints it."
3739
+ }
3740
+ }
3741
+ },
3742
+ {
3743
+ type: "object",
3744
+ required: [
3745
+ "event",
3746
+ "subscription",
3747
+ "seq",
3748
+ "machine"
3749
+ ],
3750
+ additionalProperties: false,
3751
+ properties: {
3752
+ event: { const: "machine" },
3753
+ subscription: { type: "string" },
3754
+ seq: {
3755
+ type: "integer",
3756
+ minimum: 0
3757
+ },
3758
+ machine: { type: "object" },
3759
+ usage: { $ref: "#/$defs/UsageHistory" },
3760
+ ownLeases: {
3761
+ type: "array",
3762
+ items: { type: "string" }
3763
+ }
3764
+ }
3765
+ },
2807
3766
  {
2808
3767
  type: "object",
2809
3768
  required: [