@limrun/api 0.77.2 → 0.78.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 (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +35 -0
  3. package/destination-tunnel.d.mts.map +1 -1
  4. package/destination-tunnel.d.ts.map +1 -1
  5. package/destination-tunnel.js +3 -2
  6. package/destination-tunnel.js.map +1 -1
  7. package/destination-tunnel.mjs +3 -2
  8. package/destination-tunnel.mjs.map +1 -1
  9. package/index.d.mts +1 -0
  10. package/index.d.mts.map +1 -1
  11. package/index.d.ts +1 -0
  12. package/index.d.ts.map +1 -1
  13. package/index.js.map +1 -1
  14. package/index.mjs.map +1 -1
  15. package/ios-client.d.mts +85 -0
  16. package/ios-client.d.mts.map +1 -1
  17. package/ios-client.d.ts +85 -0
  18. package/ios-client.d.ts.map +1 -1
  19. package/ios-client.js +52 -8
  20. package/ios-client.js.map +1 -1
  21. package/ios-client.mjs +50 -7
  22. package/ios-client.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/resources/assets.d.mts +19 -4
  25. package/resources/assets.d.mts.map +1 -1
  26. package/resources/assets.d.ts +19 -4
  27. package/resources/assets.d.ts.map +1 -1
  28. package/resources/gradle-instances-helpers.d.mts +1 -1
  29. package/resources/index.d.mts +2 -0
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +2 -0
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js +2 -0
  34. package/resources/index.js.map +1 -1
  35. package/resources/index.mjs +2 -0
  36. package/resources/index.mjs.map +1 -1
  37. package/resources/macos-instances-helpers.d.mts +271 -0
  38. package/resources/macos-instances-helpers.d.mts.map +1 -0
  39. package/resources/macos-instances-helpers.d.ts +271 -0
  40. package/resources/macos-instances-helpers.d.ts.map +1 -0
  41. package/resources/macos-instances-helpers.js +298 -0
  42. package/resources/macos-instances-helpers.js.map +1 -0
  43. package/resources/macos-instances-helpers.mjs +296 -0
  44. package/resources/macos-instances-helpers.mjs.map +1 -0
  45. package/resources/macos-instances.d.mts +19 -0
  46. package/resources/macos-instances.d.mts.map +1 -1
  47. package/resources/macos-instances.d.ts +19 -0
  48. package/resources/macos-instances.d.ts.map +1 -1
  49. package/src/destination-tunnel.ts +3 -2
  50. package/src/index.ts +16 -0
  51. package/src/ios-client.ts +162 -7
  52. package/src/resources/assets.ts +24 -4
  53. package/src/resources/index.ts +11 -0
  54. package/src/resources/macos-instances-helpers.ts +655 -0
  55. package/src/resources/macos-instances.ts +30 -0
  56. package/src/version.ts +1 -1
  57. package/version.d.mts +1 -1
  58. package/version.d.ts +1 -1
  59. package/version.js +1 -1
  60. package/version.mjs +1 -1
@@ -60,6 +60,8 @@ export declare namespace MacosInstance {
60
60
  role?: {
61
61
  permissions: string[];
62
62
  };
63
+ /** The private tunnel the instance named at create. */
64
+ tunnel?: string;
63
65
  }
64
66
  interface Status {
65
67
  state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminating' | 'terminated';
@@ -94,6 +96,17 @@ export declare namespace MacosInstance {
94
96
  * details when available.
95
97
  */
96
98
  terminationReason?: string;
99
+ /**
100
+ * The disk snapshot save the instance runs when it terminates, under the key a client gave
101
+ * `restoreSnapshot`. Absent until the instance is deleted.
102
+ */
103
+ snapshot?: {
104
+ save?: {
105
+ phase: 'requested' | 'archiving' | 'uploading' | 'published' | 'skipped' | 'failed' | 'timed_out' | string;
106
+ reason?: string;
107
+ message?: string;
108
+ };
109
+ };
97
110
  }
98
111
  }
99
112
  export interface MacosInstanceUpdateParams {
@@ -178,6 +191,12 @@ export declare namespace MacosInstanceCreateParams {
178
191
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
179
192
  permissions: Array<string>;
180
193
  };
194
+ /**
195
+ * Names a private tunnel, created in the console (Network) or the API, that
196
+ * serves this instance. Creation fails while no connector (`lim tunnel run`)
197
+ * holds it, and the instance becomes ready only after the tunnel attaches.
198
+ */
199
+ tunnel?: string;
181
200
  }
182
201
  namespace Spec {
183
202
  interface Clue {
@@ -1 +1 @@
1
- {"version":3,"file":"macos-instances.d.mts","sourceRoot":"","sources":["../src/resources/macos-instances.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,WAAW,EAAE,+BAA2B;AAE1E,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D,yEAAyE;AACzE,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;IAK9F;;OAEG;IACH,IAAI,CACF,KAAK,GAAE,uBAAuB,GAAG,IAAI,GAAG,SAAc,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC;IAIlD;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO9D,+FAA+F;IAC/F,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IASjG;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;CAGrE;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC;IAEjC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC;IAEzB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;CAC9B;AAED,yBAAiB,aAAa,CAAC;I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CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -60,6 +60,8 @@ export declare namespace MacosInstance {
60
60
  role?: {
61
61
  permissions: string[];
62
62
  };
63
+ /** The private tunnel the instance named at create. */
64
+ tunnel?: string;
63
65
  }
64
66
  interface Status {
65
67
  state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminating' | 'terminated';
@@ -94,6 +96,17 @@ export declare namespace MacosInstance {
94
96
  * details when available.
95
97
  */
96
98
  terminationReason?: string;
99
+ /**
100
+ * The disk snapshot save the instance runs when it terminates, under the key a client gave
101
+ * `restoreSnapshot`. Absent until the instance is deleted.
102
+ */
103
+ snapshot?: {
104
+ save?: {
105
+ phase: 'requested' | 'archiving' | 'uploading' | 'published' | 'skipped' | 'failed' | 'timed_out' | string;
106
+ reason?: string;
107
+ message?: string;
108
+ };
109
+ };
97
110
  }
98
111
  }
99
112
  export interface MacosInstanceUpdateParams {
@@ -178,6 +191,12 @@ export declare namespace MacosInstanceCreateParams {
178
191
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
179
192
  permissions: Array<string>;
180
193
  };
194
+ /**
195
+ * Names a private tunnel, created in the console (Network) or the API, that
196
+ * serves this instance. Creation fails while no connector (`lim tunnel run`)
197
+ * holds it, and the instance becomes ready only after the tunnel attaches.
198
+ */
199
+ tunnel?: string;
181
200
  }
182
201
  namespace Spec {
183
202
  interface Clue {
@@ -1 +1 @@
1
- {"version":3,"file":"macos-instances.d.ts","sourceRoot":"","sources":["../src/resources/macos-instances.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,O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,uBAAuB,GACxD,CAAC;CACH"}
@@ -1,6 +1,7 @@
1
1
  import crypto from 'crypto';
2
2
  import net from 'net';
3
- import { domainToASCII } from 'url';
3
+ // A default import: browsers bundle this module (through the macOS client) and only Node runs it.
4
+ import url from 'url';
4
5
  import {
5
6
  DestinationTunnelProtocolError,
6
7
  readArray,
@@ -637,7 +638,7 @@ function canonicalizeDestinationTunnelDomain(domain: string): string {
637
638
  if (base.endsWith('.') || base.startsWith('.')) invalid();
638
639
  if (net.isIP(base) !== 0) invalid();
639
640
  if (base === 'localhost') invalid();
640
- if (domainToASCII(base) !== base) invalid();
641
+ if (url.domainToASCII(base) !== base) invalid();
641
642
  const labels = base.split('.');
642
643
  for (const label of labels) {
643
644
  if (label.length === 0 || label.length > 63) invalid();
package/src/index.ts CHANGED
@@ -171,6 +171,22 @@ export {
171
171
  type GradleRunOptions,
172
172
  type GradleBuildLog,
173
173
  } from './resources/gradle-instances-helpers';
174
+ export {
175
+ type MacosCreateClientParams,
176
+ type MacosClient,
177
+ type MacosPoint,
178
+ type MacosModifier,
179
+ type MacosSshAccess,
180
+ type MacosSnapshotRestoreOptions,
181
+ type MacosSnapshotProgress,
182
+ type MacosTunnelOptions,
183
+ type MacosRecordingOptions,
184
+ type MacosRecordingDestination,
185
+ type MacosStreamHandlers,
186
+ type MacosLaunchMode,
187
+ type MacosLaunchAppOptions,
188
+ type MacosLaunchAppResult,
189
+ } from './resources/macos-instances-helpers';
174
190
  export { type AssetUploadOptions } from './resources/daemon-client-shared';
175
191
  export {
176
192
  type SessionArtifact,
package/src/ios-client.ts CHANGED
@@ -181,11 +181,94 @@ export type ElementTreeNode = {
181
181
 
182
182
  export type ElementTree = ElementTreeNode[];
183
183
 
184
+ /**
185
+ * Which reader answers an element tree request.
186
+ * - `accessibility` (default): the tree assistive technologies see. It leaves out elements the
187
+ * software keyboard covers and has no container types for navigation bars or tab bars.
188
+ * - `xcuitest`: XCTest's own snapshot, the tree XCUITest queries. Navigation bars, tab bars, the
189
+ * keyboard and alerts arrive as typed containers with their children. Full-tree reads only:
190
+ * omit `point` and `visibleOnly`. Takes about a second per read.
191
+ */
192
+ export type ElementTreeSource = 'accessibility' | 'xcuitest';
193
+
184
194
  export type ElementTreeOptions = {
185
195
  /** Skip branches whose nonempty frames fall outside the display. Full-tree reads only. Defaults to false. */
186
196
  visibleOnly?: boolean;
197
+ /** Which reader answers. Defaults to `accessibility`. */
198
+ source?: ElementTreeSource;
199
+ /**
200
+ * Wait up to this many milliseconds, at most 30000, for the screen to settle before answering:
201
+ * until two reads in a row match and the screen stops animating. A blinking text caret does not
202
+ * count as activity. {@link ElementTreeRead.idle} says whether it settled in time.
203
+ */
204
+ waitForIdleTimeoutMs?: number;
205
+ };
206
+
207
+ /** The software keyboard on screen. `frame` uses the element tree's coordinates. */
208
+ export type KeyboardState = {
209
+ frame: ElementTreeFrame;
210
+ };
211
+
212
+ /**
213
+ * An alert covering the app. `system` is a system prompt, such as a permission request; `app` is the
214
+ * app's own alert or confirmation dialog. Sheets are not reported.
215
+ */
216
+ export type ModalState = {
217
+ kind: 'system' | 'app';
218
+ label: string | null;
219
+ };
220
+
221
+ /** An element tree together with what the server reports about the screen around it. */
222
+ export type ElementTreeRead = {
223
+ tree: ElementTree;
224
+ /**
225
+ * The software keyboard on full-tree reads from the `accessibility` source, or `null` when it is
226
+ * hidden. Absent on point reads, and on `xcuitest` reads, whose tree has XCTest's own Keyboard element.
227
+ */
228
+ keyboard?: KeyboardState | null;
229
+ /** The alert covering the app on `xcuitest` reads, or `null` when there is none. Absent on other reads. */
230
+ modal?: ModalState | null;
231
+ /** Whether the screen settled in time. Present only when `waitForIdleTimeoutMs` was set. */
232
+ idle?: boolean;
187
233
  };
188
234
 
235
+ /** Where typed text would go. */
236
+ export type FocusedElement = {
237
+ /** The element that reports focus, or `null` when none does. */
238
+ element: ElementTreeNode | null;
239
+ /**
240
+ * The software keyboard, or `null` when it is hidden. A keyboard with no element means the focused
241
+ * input is under the keyboard, which iOS leaves out of the tree: typeText still reaches it, and
242
+ * setElementValue fails with the `covered_by_keyboard` code.
243
+ */
244
+ keyboard: KeyboardState | null;
245
+ };
246
+
247
+ /**
248
+ * An iOS command the instance rejected. `message` is the server's error text; servers that predate
249
+ * error codes leave `code` and `written` undefined.
250
+ */
251
+ export class CommandError extends Error {
252
+ /**
253
+ * The reason, stable to branch on: `no_focused_element`, `covered_by_keyboard`,
254
+ * `element_not_found`, `ambiguous_selector`, `ambiguous_focus`, `no_usable_frame`, `busy`,
255
+ * `invalid_request`, `unavailable`, `input_failed` or `internal`. New codes may appear.
256
+ */
257
+ readonly code: string | undefined;
258
+ /**
259
+ * Set by typeText, setElementValue and pressKey: `none` when nothing reached the app, so a retry
260
+ * cannot double the text, and `unknown` when input had started.
261
+ */
262
+ readonly written: 'none' | 'unknown' | undefined;
263
+
264
+ constructor(message: string, code?: string, written?: 'none' | 'unknown') {
265
+ super(message);
266
+ this.name = 'CommandError';
267
+ this.code = code;
268
+ this.written = written;
269
+ }
270
+ }
271
+
189
272
  export type ElementTreeResultMessage = {
190
273
  type: 'elementTreeResult';
191
274
  id: string;
@@ -780,6 +863,10 @@ export type PerformActionResult = {
780
863
  elementLabel?: string;
781
864
  elementType?: string;
782
865
  error?: string;
866
+ /** Why the action failed; see {@link CommandError.code}. */
867
+ code?: string;
868
+ /** Whether a failed text action's input reached the app; see {@link CommandError.written}. */
869
+ written?: 'none' | 'unknown';
783
870
  };
784
871
 
785
872
  /**
@@ -833,6 +920,18 @@ export type InstanceClient = {
833
920
  */
834
921
  elementTreeRaw: (point?: AccessibilityPoint, options?: ElementTreeOptions) => Promise<string>;
835
922
 
923
+ /**
924
+ * Get the element tree with what the server reports about the screen: the software keyboard,
925
+ * the alert covering the app, and whether the screen settled.
926
+ * @param point Optional point to get the element at that specific location
927
+ */
928
+ readElementTree: (point?: AccessibilityPoint, options?: ElementTreeOptions) => Promise<ElementTreeRead>;
929
+
930
+ /**
931
+ * Get the element typed text would go to, and the software keyboard.
932
+ */
933
+ focusedElement: () => Promise<FocusedElement>;
934
+
836
935
  /**
837
936
  * Tap at the specified coordinates on the active screen (uses native screen dimensions)
838
937
  * @param x X coordinate in points
@@ -1739,6 +1838,12 @@ type ServerResponse = {
1739
1838
  type: string;
1740
1839
  id: string;
1741
1840
  error?: string;
1841
+ code?: string;
1842
+ written?: 'none' | 'unknown';
1843
+ // elementTree and focusedElement fields
1844
+ keyboard?: KeyboardState | null;
1845
+ modal?: ModalState | null;
1846
+ idle?: boolean;
1742
1847
  // Response-specific fields
1743
1848
  base64?: string;
1744
1849
  width?: number;
@@ -2280,6 +2385,13 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2280
2385
  };
2281
2386
  };
2282
2387
 
2388
+ // A failed batch reports its error at the top level; the failing action's result carries the code.
2389
+ const commandError = (message: ServerResponse): CommandError => {
2390
+ const failedAction = message.results?.find((result) => result.error);
2391
+ const source = failedAction ?? message;
2392
+ return new CommandError(message.error!, source.code, source.written);
2393
+ };
2394
+
2283
2395
  // Generic request sender with timeout and response handling
2284
2396
  const sendRequest = <T>(
2285
2397
  type: string,
@@ -2534,7 +2646,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2534
2646
 
2535
2647
  if (message.error) {
2536
2648
  logger.debug(`Server error for ${message.type}: ${message.error}`);
2537
- request.reject(new Error(message.error));
2649
+ request.reject(commandError(message));
2538
2650
  return;
2539
2651
  }
2540
2652
 
@@ -2640,6 +2752,8 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2640
2752
  screenshot,
2641
2753
  elementTree,
2642
2754
  elementTreeRaw,
2755
+ readElementTree,
2756
+ focusedElement,
2643
2757
  tap,
2644
2758
  tapWithScreenSize,
2645
2759
  tapElement,
@@ -2735,18 +2849,58 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2735
2849
  return sendRequest<ScreenshotData>('screenshot', options);
2736
2850
  };
2737
2851
 
2852
+ // An idle wait runs on the server before it answers, so the request waits for it too.
2853
+ const elementTreeTimeoutMs = (options: ElementTreeOptions) =>
2854
+ 30_000 + (options.waitForIdleTimeoutMs ?? 0);
2855
+
2738
2856
  const elementTree = (
2739
2857
  point?: AccessibilityPoint,
2740
2858
  options: ElementTreeOptions = {},
2741
2859
  ): Promise<ElementTree> => {
2742
- return sendRequest<ElementTree>('elementTree', { point, ...options });
2860
+ return sendRequest<ElementTree>(
2861
+ 'elementTree',
2862
+ { point, ...options },
2863
+ undefined,
2864
+ elementTreeTimeoutMs(options),
2865
+ );
2743
2866
  };
2744
2867
 
2745
2868
  const elementTreeRaw = (
2746
2869
  point?: AccessibilityPoint,
2747
2870
  options: ElementTreeOptions = {},
2748
2871
  ): Promise<string> => {
2749
- return sendRequest<string>('elementTree', { point, ...options }, (msg) => msg.json ?? '');
2872
+ return sendRequest<string>(
2873
+ 'elementTree',
2874
+ { point, ...options },
2875
+ (msg) => msg.json ?? '',
2876
+ elementTreeTimeoutMs(options),
2877
+ );
2878
+ };
2879
+
2880
+ const readElementTree = (
2881
+ point?: AccessibilityPoint,
2882
+ options: ElementTreeOptions = {},
2883
+ ): Promise<ElementTreeRead> => {
2884
+ return sendRequest<ElementTreeRead>(
2885
+ 'elementTree',
2886
+ { point, ...options },
2887
+ (msg) => {
2888
+ const read: ElementTreeRead = { tree: parseElementTree(msg.json ?? '[]') };
2889
+ // Absent and null differ: null answers "none", absent means the read does not report it.
2890
+ if (msg.keyboard !== undefined) read.keyboard = msg.keyboard;
2891
+ if (msg.modal !== undefined) read.modal = msg.modal;
2892
+ if (msg.idle !== undefined) read.idle = msg.idle;
2893
+ return read;
2894
+ },
2895
+ elementTreeTimeoutMs(options),
2896
+ );
2897
+ };
2898
+
2899
+ const focusedElement = (): Promise<FocusedElement> => {
2900
+ return sendRequest<FocusedElement>('focusedElement', {}, (msg) => ({
2901
+ element: msg.json ? (JSON.parse(msg.json) as ElementTreeNode) : null,
2902
+ keyboard: msg.keyboard ?? null,
2903
+ }));
2750
2904
  };
2751
2905
 
2752
2906
  const tap = (x: number, y: number): Promise<void> => {
@@ -2784,11 +2938,12 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2784
2938
  );
2785
2939
  };
2786
2940
 
2787
- // The server fails absent selectors fast with a typed error whose phrase
2788
- // the e2e suite pins. The other two phrases are pre-fail-fast servers:
2789
- // their touch path reports a miss after its own sweep ("was not found on
2790
- // screen"), and their ax path reports "not found for selector".
2941
+ // The server fails absent selectors fast with the element_not_found code. The phrases cover
2942
+ // servers that predate codes: the first is the fail-fast phrase the e2e suite pins, and the
2943
+ // other two are pre-fail-fast servers, whose touch path reports a miss after its own sweep
2944
+ // ("was not found on screen") and whose ax path reports "not found for selector".
2791
2945
  const isAbsentSelectorError = (error: unknown): boolean => {
2946
+ if (error instanceof CommandError && error.code === 'element_not_found') return true;
2792
2947
  const message = error instanceof Error ? error.message : String(error);
2793
2948
  return /matched nothing in the accessibility tree|was not found on screen after scrolling|Accessibility element not found for selector/.test(
2794
2949
  message,
@@ -68,7 +68,7 @@ export class Assets extends APIResource {
68
68
  export interface Asset {
69
69
  id: string;
70
70
 
71
- kind: 'App' | 'Keychain';
71
+ kind: 'App' | 'Keychain' | 'MacOSSnapshot';
72
72
 
73
73
  name: string;
74
74
 
@@ -102,6 +102,26 @@ export interface Asset {
102
102
  signedDownloadUrl?: string;
103
103
 
104
104
  signedUploadUrl?: string;
105
+
106
+ /** What a kind records about its file. A `MacOSSnapshot` records the macOS build it restores onto. */
107
+ metadata?: AssetSnapshotMetadata;
108
+
109
+ /** SHA-256 of the uploaded file, for assets uploaded in parts. */
110
+ sha256?: string;
111
+
112
+ sizeBytes?: number;
113
+
114
+ /** When the last complete upload finished. */
115
+ publishedAt?: string;
116
+ }
117
+
118
+ /** The metadata of a `MacOSSnapshot` asset: a macOS instance's saved changes. */
119
+ export interface AssetSnapshotMetadata {
120
+ /** The guest's macOS build; a snapshot restores only onto the same one. */
121
+ compatKey: string;
122
+ format: string;
123
+ uncompressedSizeBytes: number;
124
+ sourceInstanceId?: string;
105
125
  }
106
126
 
107
127
  export type AssetListResponse = Array<Asset>;
@@ -109,7 +129,7 @@ export type AssetListResponse = Array<Asset>;
109
129
  export interface AssetGetOrCreateResponse {
110
130
  id: string;
111
131
 
112
- kind: 'App' | 'Keychain';
132
+ kind: 'App' | 'Keychain' | 'MacOSSnapshot';
113
133
 
114
134
  name: string;
115
135
 
@@ -152,7 +172,7 @@ export interface AssetListParams {
152
172
  /**
153
173
  * Filters assets by kind.
154
174
  */
155
- kindFilter?: 'App' | 'Keychain';
175
+ kindFilter?: 'App' | 'Keychain' | 'MacOSSnapshot';
156
176
 
157
177
  /**
158
178
  * Maximum number of items to be returned. The default is 50.
@@ -237,7 +257,7 @@ export interface AssetGetOrCreateParams {
237
257
  deeplink?: string;
238
258
  }
239
259
 
240
- export type AssetKind = 'App' | 'Keychain';
260
+ export type AssetKind = 'App' | 'Keychain' | 'MacOSSnapshot';
241
261
 
242
262
  export type AssetPlatform = 'ios' | 'android' | 'xcode';
243
263
 
@@ -124,6 +124,17 @@ export {
124
124
  type GradleBuildOptions,
125
125
  type GradleBuildLog,
126
126
  } from './gradle-instances-helpers';
127
+ // Side-effect import, as for Gradle: grafts createClient onto MacosInstances.
128
+ import './macos-instances-helpers';
129
+ export {
130
+ type MacosCreateClientParams,
131
+ type MacosClient,
132
+ type MacosPoint,
133
+ type MacosModifier,
134
+ type MacosSshAccess,
135
+ type MacosSnapshotRestoreOptions,
136
+ type MacosSnapshotProgress,
137
+ } from './macos-instances-helpers';
127
138
 
128
139
  export {
129
140
  AccessTokens,