@stim-cli/server 1.16.0 → 1.17.1

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.
@@ -187,13 +187,26 @@ function protocolJsonSchema() {
187
187
  "deviceKey"
188
188
  ],
189
189
  additionalProperties: false,
190
- oneOf: [{
191
- required: ["backend"],
192
- properties: { deviceKey: { pattern: "^ios:mobile:[a-fA-F0-9-]{36}$" } }
193
- }, {
194
- not: { required: ["backend"] },
195
- properties: { deviceKey: { pattern: "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+@[1-9][0-9]{0,9}$" } }
196
- }],
190
+ oneOf: [
191
+ {
192
+ required: ["backend"],
193
+ properties: {
194
+ backend: { const: "ios-instance" },
195
+ deviceKey: { pattern: "^ios:mobile:[a-fA-F0-9-]{36}$" }
196
+ }
197
+ },
198
+ {
199
+ required: ["backend"],
200
+ properties: {
201
+ backend: { const: "android-instance" },
202
+ deviceKey: { pattern: "^android:mobile:emulator-[0-9]+$" }
203
+ }
204
+ },
205
+ {
206
+ not: { required: ["backend"] },
207
+ properties: { deviceKey: { pattern: "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+@[1-9][0-9]{0,9}$" } }
208
+ }
209
+ ],
197
210
  properties: {
198
211
  tenant: {
199
212
  type: "string",
@@ -207,7 +220,7 @@ function protocolJsonSchema() {
207
220
  type: "string",
208
221
  pattern: "^[A-Za-z0-9._-]{1,128}$"
209
222
  },
210
- backend: { const: "ios-instance" },
223
+ backend: { enum: ["ios-instance", "android-instance"] },
211
224
  deviceKey: { type: "string" }
212
225
  }
213
226
  }
@@ -391,6 +404,19 @@ function protocolJsonSchema() {
391
404
  }
392
405
  }
393
406
  },
407
+ HostedLocalDeviceCount: { anyOf: [{
408
+ type: "integer",
409
+ minimum: 0
410
+ }, {
411
+ type: "object",
412
+ required: ["unknown"],
413
+ additionalProperties: false,
414
+ properties: { unknown: {
415
+ type: "string",
416
+ minLength: 1,
417
+ maxLength: 4e3
418
+ } }
419
+ }] },
394
420
  HostedDeviceOffer: {
395
421
  type: "object",
396
422
  required: [
@@ -444,7 +470,8 @@ function protocolJsonSchema() {
444
470
  workerDiskFreeBytes: {
445
471
  type: ["number", "null"],
446
472
  minimum: 0
447
- }
473
+ },
474
+ localDevices: { $ref: "#/$defs/HostedLocalDeviceCount" }
448
475
  }
449
476
  },
450
477
  capacity: {
@@ -467,7 +494,8 @@ function protocolJsonSchema() {
467
494
  available: {
468
495
  type: ["integer", "null"],
469
496
  minimum: 0
470
- }
497
+ },
498
+ local: { $ref: "#/$defs/HostedLocalDeviceCount" }
471
499
  }
472
500
  }
473
501
  },
@@ -541,6 +569,68 @@ function protocolJsonSchema() {
541
569
  maximum: 65535
542
570
  } }
543
571
  },
572
+ HostedSessionRow: {
573
+ type: "object",
574
+ required: [
575
+ "id",
576
+ "client",
577
+ "platform",
578
+ "device",
579
+ "app",
580
+ "state",
581
+ "parked",
582
+ "since",
583
+ "workspace"
584
+ ],
585
+ additionalProperties: false,
586
+ properties: {
587
+ id: { type: "string" },
588
+ client: {
589
+ type: "object",
590
+ required: ["id", "name"],
591
+ additionalProperties: false,
592
+ properties: {
593
+ id: { type: "string" },
594
+ name: { type: "string" }
595
+ }
596
+ },
597
+ platform: { enum: [
598
+ "ios",
599
+ "android",
600
+ "macos"
601
+ ] },
602
+ device: { type: ["string", "null"] },
603
+ app: { type: ["string", "null"] },
604
+ state: { enum: [
605
+ "preparing",
606
+ "ready",
607
+ "stopping",
608
+ "stopped",
609
+ "unknown"
610
+ ] },
611
+ parked: { type: "boolean" },
612
+ since: { type: "string" },
613
+ workspace: { type: "string" }
614
+ }
615
+ },
616
+ HostedSessionsResult: {
617
+ type: "object",
618
+ required: ["sessions"],
619
+ additionalProperties: false,
620
+ properties: { sessions: {
621
+ type: "array",
622
+ items: { $ref: "#/$defs/HostedSessionRow" }
623
+ } }
624
+ },
625
+ HostedSessionStopResult: {
626
+ type: "object",
627
+ required: ["id", "state"],
628
+ additionalProperties: false,
629
+ properties: {
630
+ id: { type: "string" },
631
+ state: { enum: ["stopping", "stopped"] }
632
+ }
633
+ },
544
634
  HostedDeviceSession: {
545
635
  type: "object",
546
636
  required: [
@@ -662,6 +752,7 @@ function protocolJsonSchema() {
662
752
  createdAt: { type: "string" },
663
753
  notice: { type: "string" },
664
754
  appAttempt: { type: "string" },
755
+ agent: { $ref: "#/$defs/HostedAppDelivery/properties/agent" },
665
756
  metroPort: {
666
757
  type: "integer",
667
758
  minimum: 1,
@@ -1307,7 +1398,7 @@ function protocolJsonSchema() {
1307
1398
  statsError: { type: "string" },
1308
1399
  buildMachines: {
1309
1400
  type: ["array", "null"],
1310
- description: "`buildMachines` from `stim doctor --json --platform ios`.",
1401
+ description: "`remoteMachines` from `stim doctor --json --platform ios`.",
1311
1402
  items: { type: "object" }
1312
1403
  },
1313
1404
  buildMachinesError: { type: "string" },
@@ -1315,7 +1406,7 @@ function protocolJsonSchema() {
1315
1406
  buildMachinesPending: { type: "boolean" },
1316
1407
  buildClients: {
1317
1408
  type: "array",
1318
- description: "The builds this Mac ran for each client as a build machine, from the audit log.",
1409
+ description: "The builds this Mac ran for each client, from the audit log.",
1319
1410
  items: {
1320
1411
  type: "object",
1321
1412
  required: [
@@ -1689,6 +1780,11 @@ function protocolJsonSchema() {
1689
1780
  minimum: 1,
1690
1781
  maximum: 65535
1691
1782
  },
1783
+ clientMetroPort: {
1784
+ type: "integer",
1785
+ minimum: 1,
1786
+ maximum: 65535
1787
+ },
1692
1788
  secret: {
1693
1789
  type: "string",
1694
1790
  pattern: "^[a-f0-9]{64}$"
@@ -1865,6 +1961,16 @@ function protocolJsonSchema() {
1865
1961
  }
1866
1962
  }
1867
1963
  }),
1964
+ request("archive.detail", {
1965
+ type: "object",
1966
+ required: ["archive"],
1967
+ additionalProperties: false,
1968
+ properties: { archive: {
1969
+ type: "string",
1970
+ minLength: 1,
1971
+ pattern: "^(?!.*\\.\\.)[^/\\\\\\u0000]+$"
1972
+ } }
1973
+ }),
1868
1974
  request("replay.keyframe", {
1869
1975
  type: "object",
1870
1976
  required: ["platform", "at"],
@@ -2263,6 +2369,8 @@ function protocolJsonSchema() {
2263
2369
  request("build.artifact", buildJob),
2264
2370
  request("build.attach", buildJob),
2265
2371
  request("server.update.status"),
2372
+ request("device-host.sessions"),
2373
+ request("device-host.sessions.stop", session({})),
2266
2374
  request("machines.update.start", {
2267
2375
  type: "object",
2268
2376
  required: ["machine"],
@@ -2352,6 +2460,8 @@ function protocolJsonSchema() {
2352
2460
  result: { anyOf: [
2353
2461
  { $ref: "#/$defs/HostedDeviceOffer" },
2354
2462
  { $ref: "#/$defs/HostedDeviceSession" },
2463
+ { $ref: "#/$defs/HostedSessionsResult" },
2464
+ { $ref: "#/$defs/HostedSessionStopResult" },
2355
2465
  { $ref: "#/$defs/HostedAppDelivery" },
2356
2466
  { $ref: "#/$defs/HostedMetroResult" },
2357
2467
  { $ref: "#/$defs/HostedAppOfferResult" },
package/dist/protocol.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as protocolJsonSchema } from "./protocol-BHSl7bQ_.mjs";
1
+ import { t as protocolJsonSchema } from "./protocol-Btu-PwQS.mjs";
2
2
  export * from "@stim-cli/core/protocol";
3
3
  export { protocolJsonSchema };
@@ -162,11 +162,27 @@
162
162
  "backend"
163
163
  ],
164
164
  "properties": {
165
+ "backend": {
166
+ "const": "ios-instance"
167
+ },
165
168
  "deviceKey": {
166
169
  "pattern": "^ios:mobile:[a-fA-F0-9-]{36}$"
167
170
  }
168
171
  }
169
172
  },
173
+ {
174
+ "required": [
175
+ "backend"
176
+ ],
177
+ "properties": {
178
+ "backend": {
179
+ "const": "android-instance"
180
+ },
181
+ "deviceKey": {
182
+ "pattern": "^android:mobile:emulator-[0-9]+$"
183
+ }
184
+ }
185
+ },
170
186
  {
171
187
  "not": {
172
188
  "required": [
@@ -194,7 +210,10 @@
194
210
  "pattern": "^[A-Za-z0-9._-]{1,128}$"
195
211
  },
196
212
  "backend": {
197
- "const": "ios-instance"
213
+ "enum": [
214
+ "ios-instance",
215
+ "android-instance"
216
+ ]
198
217
  },
199
218
  "deviceKey": {
200
219
  "type": "string"
@@ -490,6 +509,28 @@
490
509
  }
491
510
  }
492
511
  },
512
+ "HostedLocalDeviceCount": {
513
+ "anyOf": [
514
+ {
515
+ "type": "integer",
516
+ "minimum": 0
517
+ },
518
+ {
519
+ "type": "object",
520
+ "required": [
521
+ "unknown"
522
+ ],
523
+ "additionalProperties": false,
524
+ "properties": {
525
+ "unknown": {
526
+ "type": "string",
527
+ "minLength": 1,
528
+ "maxLength": 4000
529
+ }
530
+ }
531
+ }
532
+ ]
533
+ },
493
534
  "HostedDeviceOffer": {
494
535
  "type": "object",
495
536
  "required": [
@@ -553,6 +594,9 @@
553
594
  "null"
554
595
  ],
555
596
  "minimum": 0
597
+ },
598
+ "localDevices": {
599
+ "$ref": "#/$defs/HostedLocalDeviceCount"
556
600
  }
557
601
  }
558
602
  },
@@ -579,6 +623,9 @@
579
623
  "null"
580
624
  ],
581
625
  "minimum": 0
626
+ },
627
+ "local": {
628
+ "$ref": "#/$defs/HostedLocalDeviceCount"
582
629
  }
583
630
  }
584
631
  }
@@ -729,6 +776,113 @@
729
776
  }
730
777
  }
731
778
  },
779
+ "HostedSessionRow": {
780
+ "type": "object",
781
+ "required": [
782
+ "id",
783
+ "client",
784
+ "platform",
785
+ "device",
786
+ "app",
787
+ "state",
788
+ "parked",
789
+ "since",
790
+ "workspace"
791
+ ],
792
+ "additionalProperties": false,
793
+ "properties": {
794
+ "id": {
795
+ "type": "string"
796
+ },
797
+ "client": {
798
+ "type": "object",
799
+ "required": [
800
+ "id",
801
+ "name"
802
+ ],
803
+ "additionalProperties": false,
804
+ "properties": {
805
+ "id": {
806
+ "type": "string"
807
+ },
808
+ "name": {
809
+ "type": "string"
810
+ }
811
+ }
812
+ },
813
+ "platform": {
814
+ "enum": [
815
+ "ios",
816
+ "android",
817
+ "macos"
818
+ ]
819
+ },
820
+ "device": {
821
+ "type": [
822
+ "string",
823
+ "null"
824
+ ]
825
+ },
826
+ "app": {
827
+ "type": [
828
+ "string",
829
+ "null"
830
+ ]
831
+ },
832
+ "state": {
833
+ "enum": [
834
+ "preparing",
835
+ "ready",
836
+ "stopping",
837
+ "stopped",
838
+ "unknown"
839
+ ]
840
+ },
841
+ "parked": {
842
+ "type": "boolean"
843
+ },
844
+ "since": {
845
+ "type": "string"
846
+ },
847
+ "workspace": {
848
+ "type": "string"
849
+ }
850
+ }
851
+ },
852
+ "HostedSessionsResult": {
853
+ "type": "object",
854
+ "required": [
855
+ "sessions"
856
+ ],
857
+ "additionalProperties": false,
858
+ "properties": {
859
+ "sessions": {
860
+ "type": "array",
861
+ "items": {
862
+ "$ref": "#/$defs/HostedSessionRow"
863
+ }
864
+ }
865
+ }
866
+ },
867
+ "HostedSessionStopResult": {
868
+ "type": "object",
869
+ "required": [
870
+ "id",
871
+ "state"
872
+ ],
873
+ "additionalProperties": false,
874
+ "properties": {
875
+ "id": {
876
+ "type": "string"
877
+ },
878
+ "state": {
879
+ "enum": [
880
+ "stopping",
881
+ "stopped"
882
+ ]
883
+ }
884
+ }
885
+ },
732
886
  "HostedDeviceSession": {
733
887
  "type": "object",
734
888
  "required": [
@@ -917,6 +1071,9 @@
917
1071
  "appAttempt": {
918
1072
  "type": "string"
919
1073
  },
1074
+ "agent": {
1075
+ "$ref": "#/$defs/HostedAppDelivery/properties/agent"
1076
+ },
920
1077
  "metroPort": {
921
1078
  "type": "integer",
922
1079
  "minimum": 1,
@@ -1144,11 +1301,14 @@
1144
1301
  "device-frames",
1145
1302
  "macos-hosted",
1146
1303
  "ios-hosted",
1304
+ "android-hosted",
1147
1305
  "hosted-ios-agent",
1306
+ "hosted-android-agent",
1148
1307
  "duo-frames",
1149
1308
  "workspace-diff",
1150
1309
  "hosted-congestion",
1151
1310
  "hosted-ios-data",
1311
+ "hosted-android-data",
1152
1312
  "server-update"
1153
1313
  ]
1154
1314
  }
@@ -1959,7 +2119,7 @@
1959
2119
  "array",
1960
2120
  "null"
1961
2121
  ],
1962
- "description": "`buildMachines` from `stim doctor --json --platform ios`.",
2122
+ "description": "`remoteMachines` from `stim doctor --json --platform ios`.",
1963
2123
  "items": {
1964
2124
  "type": "object"
1965
2125
  }
@@ -1975,7 +2135,7 @@
1975
2135
  },
1976
2136
  "buildClients": {
1977
2137
  "type": "array",
1978
- "description": "The builds this Mac ran for each client as a build machine, from the audit log.",
2138
+ "description": "The builds this Mac ran for each client, from the audit log.",
1979
2139
  "items": {
1980
2140
  "type": "object",
1981
2141
  "required": [
@@ -2905,6 +3065,11 @@
2905
3065
  "minimum": 1,
2906
3066
  "maximum": 65535
2907
3067
  },
3068
+ "clientMetroPort": {
3069
+ "type": "integer",
3070
+ "minimum": 1,
3071
+ "maximum": 65535
3072
+ },
2908
3073
  "secret": {
2909
3074
  "type": "string",
2910
3075
  "pattern": "^[a-f0-9]{64}$"
@@ -3881,6 +4046,40 @@
3881
4046
  }
3882
4047
  }
3883
4048
  },
4049
+ {
4050
+ "type": "object",
4051
+ "required": [
4052
+ "id",
4053
+ "method",
4054
+ "params"
4055
+ ],
4056
+ "additionalProperties": false,
4057
+ "properties": {
4058
+ "id": {
4059
+ "type": [
4060
+ "integer",
4061
+ "string"
4062
+ ]
4063
+ },
4064
+ "method": {
4065
+ "const": "archive.detail"
4066
+ },
4067
+ "params": {
4068
+ "type": "object",
4069
+ "required": [
4070
+ "archive"
4071
+ ],
4072
+ "additionalProperties": false,
4073
+ "properties": {
4074
+ "archive": {
4075
+ "type": "string",
4076
+ "minLength": 1,
4077
+ "pattern": "^(?!.*\\.\\.)[^/\\\\\\u0000]+$"
4078
+ }
4079
+ }
4080
+ }
4081
+ }
4082
+ },
3884
4083
  {
3885
4084
  "type": "object",
3886
4085
  "required": [
@@ -5419,6 +5618,61 @@
5419
5618
  }
5420
5619
  }
5421
5620
  },
5621
+ {
5622
+ "type": "object",
5623
+ "required": [
5624
+ "id",
5625
+ "method"
5626
+ ],
5627
+ "additionalProperties": false,
5628
+ "properties": {
5629
+ "id": {
5630
+ "type": [
5631
+ "integer",
5632
+ "string"
5633
+ ]
5634
+ },
5635
+ "method": {
5636
+ "const": "device-host.sessions"
5637
+ },
5638
+ "params": {
5639
+ "type": "object",
5640
+ "maxProperties": 0
5641
+ }
5642
+ }
5643
+ },
5644
+ {
5645
+ "type": "object",
5646
+ "required": [
5647
+ "id",
5648
+ "method",
5649
+ "params"
5650
+ ],
5651
+ "additionalProperties": false,
5652
+ "properties": {
5653
+ "id": {
5654
+ "type": [
5655
+ "integer",
5656
+ "string"
5657
+ ]
5658
+ },
5659
+ "method": {
5660
+ "const": "device-host.sessions.stop"
5661
+ },
5662
+ "params": {
5663
+ "type": "object",
5664
+ "required": [
5665
+ "session"
5666
+ ],
5667
+ "additionalProperties": false,
5668
+ "properties": {
5669
+ "session": {
5670
+ "type": "string"
5671
+ }
5672
+ }
5673
+ }
5674
+ }
5675
+ },
5422
5676
  {
5423
5677
  "type": "object",
5424
5678
  "required": [
@@ -5632,6 +5886,12 @@
5632
5886
  {
5633
5887
  "$ref": "#/$defs/HostedDeviceSession"
5634
5888
  },
5889
+ {
5890
+ "$ref": "#/$defs/HostedSessionsResult"
5891
+ },
5892
+ {
5893
+ "$ref": "#/$defs/HostedSessionStopResult"
5894
+ },
5635
5895
  {
5636
5896
  "$ref": "#/$defs/HostedAppDelivery"
5637
5897
  },
@@ -0,0 +1,34 @@
1
+ import Foundation
2
+
3
+ /// Finds DeviceKit's iPhone Duo model (V68.usdz). Xcode 27.0 does not ship it; Xcode 27.1 does.
4
+ public enum DuoModelAsset {
5
+ static let relativePath =
6
+ "SharedFrameworks/DeviceKit.framework/Versions/A/PlugIns/CoreDevicePopDeviceKitExtension.devicekitplugin/Contents/Resources/V68.usdz"
7
+
8
+ static func locate(selected: String, installed: [String], exists: (String) -> Bool) -> String? {
9
+ for developerDir in [selected] + installed.filter({ $0 != selected }) {
10
+ let path = URL(fileURLWithPath: developerDir).deletingLastPathComponent().appendingPathComponent(relativePath).path
11
+ if exists(path) { return path }
12
+ }
13
+ return nil
14
+ }
15
+
16
+ static func reason(selected: String) -> String {
17
+ "The iPhone Duo hardware model is not in the selected Xcode (\(URL(fileURLWithPath: selected).deletingLastPathComponent().deletingLastPathComponent().lastPathComponent)) or any other Xcode in /Applications. Xcode 27.1 or later includes it."
18
+ }
19
+
20
+ static var installedDeveloperDirs: [String] {
21
+ let names = (try? FileManager.default.contentsOfDirectory(atPath: "/Applications")) ?? []
22
+ return names.filter { $0.hasPrefix("Xcode") && $0.hasSuffix(".app") }.sorted(by: >)
23
+ .map { "/Applications/\($0)/Contents/Developer" }
24
+ }
25
+
26
+ static var current: URL? {
27
+ locate(selected: CoreSimulator.developerDir, installed: installedDeveloperDirs, exists: FileManager.default.fileExists)
28
+ .map { URL(fileURLWithPath: $0) }
29
+ }
30
+
31
+ public static var unavailableReason: String? {
32
+ current == nil ? reason(selected: CoreSimulator.developerDir) : nil
33
+ }
34
+ }
@@ -24,16 +24,8 @@ final class DuoModelView: SCNView {
24
24
  private var quarterTurns = 0
25
25
  var activeID: UInt32
26
26
 
27
- static var assetURL: URL {
28
- URL(fileURLWithPath: CoreSimulator.developerDir)
29
- .deletingLastPathComponent()
30
- .appendingPathComponent(
31
- "SharedFrameworks/DeviceKit.framework/Versions/A/PlugIns/CoreDevicePopDeviceKitExtension.devicekitplugin/Contents/Resources/V68.usdz"
32
- )
33
- }
34
-
35
27
  static func load(innerID: UInt32, coverID: UInt32, nativeTurns: [UInt32: Int], assetURL: URL? = nil) -> DuoModelView? {
36
- guard let source = SCNSceneSource(url: assetURL ?? Self.assetURL, options: nil),
28
+ guard let url = assetURL ?? DuoModelAsset.current, let source = SCNSceneSource(url: url, options: nil),
37
29
  let scene = source.scene(options: [.animationImportPolicy: SCNSceneSource.AnimationImportPolicy.play]),
38
30
  let inner = scene.rootNode.childNode(withName: "mQHVkATpIwJRVQx", recursively: true),
39
31
  let cover = scene.rootNode.childNode(withName: "zaWsadDZpWAUDAX", recursively: true),