@limrun/api 0.77.1 → 0.77.3

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 (126) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +92 -2
  3. package/client.d.mts +18 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +18 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +42 -6
  8. package/client.js.map +1 -1
  9. package/client.mjs +43 -7
  10. package/client.mjs.map +1 -1
  11. package/destination-tunnel.d.mts.map +1 -1
  12. package/destination-tunnel.d.ts.map +1 -1
  13. package/destination-tunnel.js +3 -2
  14. package/destination-tunnel.js.map +1 -1
  15. package/destination-tunnel.mjs +3 -2
  16. package/destination-tunnel.mjs.map +1 -1
  17. package/gradle-snapshot.d.mts +2 -2
  18. package/gradle-snapshot.d.mts.map +1 -1
  19. package/gradle-snapshot.d.ts +2 -2
  20. package/gradle-snapshot.d.ts.map +1 -1
  21. package/gradle-snapshot.js +1 -1
  22. package/gradle-snapshot.js.map +1 -1
  23. package/gradle-snapshot.mjs +1 -1
  24. package/gradle-snapshot.mjs.map +1 -1
  25. package/index.d.mts +1 -0
  26. package/index.d.mts.map +1 -1
  27. package/index.d.ts +1 -0
  28. package/index.d.ts.map +1 -1
  29. package/index.js.map +1 -1
  30. package/index.mjs.map +1 -1
  31. package/internal/instance-phase-stream.d.mts +10 -1
  32. package/internal/instance-phase-stream.d.mts.map +1 -1
  33. package/internal/instance-phase-stream.d.ts +10 -1
  34. package/internal/instance-phase-stream.d.ts.map +1 -1
  35. package/internal/instance-phase-stream.js +17 -6
  36. package/internal/instance-phase-stream.js.map +1 -1
  37. package/internal/instance-phase-stream.mjs +17 -6
  38. package/internal/instance-phase-stream.mjs.map +1 -1
  39. package/lib/workload-credentials.d.mts +14 -3
  40. package/lib/workload-credentials.d.mts.map +1 -1
  41. package/lib/workload-credentials.d.ts +14 -3
  42. package/lib/workload-credentials.d.ts.map +1 -1
  43. package/lib/workload-credentials.js +50 -14
  44. package/lib/workload-credentials.js.map +1 -1
  45. package/lib/workload-credentials.mjs +46 -13
  46. package/lib/workload-credentials.mjs.map +1 -1
  47. package/package.json +1 -1
  48. package/resources/access-tokens.d.mts +7 -4
  49. package/resources/access-tokens.d.mts.map +1 -1
  50. package/resources/access-tokens.d.ts +7 -4
  51. package/resources/access-tokens.d.ts.map +1 -1
  52. package/resources/assets.d.mts +19 -4
  53. package/resources/assets.d.mts.map +1 -1
  54. package/resources/assets.d.ts +19 -4
  55. package/resources/assets.d.ts.map +1 -1
  56. package/resources/gradle-instances-helpers.d.mts +1 -1
  57. package/resources/gradle-instances.d.mts.map +1 -1
  58. package/resources/gradle-instances.d.ts.map +1 -1
  59. package/resources/gradle-instances.js +12 -4
  60. package/resources/gradle-instances.js.map +1 -1
  61. package/resources/gradle-instances.mjs +12 -4
  62. package/resources/gradle-instances.mjs.map +1 -1
  63. package/resources/index.d.mts +2 -0
  64. package/resources/index.d.mts.map +1 -1
  65. package/resources/index.d.ts +2 -0
  66. package/resources/index.d.ts.map +1 -1
  67. package/resources/index.js +2 -0
  68. package/resources/index.js.map +1 -1
  69. package/resources/index.mjs +2 -0
  70. package/resources/index.mjs.map +1 -1
  71. package/resources/macos-instances-helpers.d.mts +271 -0
  72. package/resources/macos-instances-helpers.d.mts.map +1 -0
  73. package/resources/macos-instances-helpers.d.ts +271 -0
  74. package/resources/macos-instances-helpers.d.ts.map +1 -0
  75. package/resources/macos-instances-helpers.js +298 -0
  76. package/resources/macos-instances-helpers.js.map +1 -0
  77. package/resources/macos-instances-helpers.mjs +296 -0
  78. package/resources/macos-instances-helpers.mjs.map +1 -0
  79. package/resources/macos-instances.d.mts +19 -0
  80. package/resources/macos-instances.d.mts.map +1 -1
  81. package/resources/macos-instances.d.ts +19 -0
  82. package/resources/macos-instances.d.ts.map +1 -1
  83. package/resources/support-tickets.d.mts +3 -0
  84. package/resources/support-tickets.d.mts.map +1 -1
  85. package/resources/support-tickets.d.ts +3 -0
  86. package/resources/support-tickets.d.ts.map +1 -1
  87. package/resources/support-tickets.js +8 -0
  88. package/resources/support-tickets.js.map +1 -1
  89. package/resources/support-tickets.mjs +8 -0
  90. package/resources/support-tickets.mjs.map +1 -1
  91. package/resources/xcode-instances-helpers.d.mts +1 -0
  92. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  93. package/resources/xcode-instances-helpers.d.ts +1 -0
  94. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  95. package/resources/xcode-instances-helpers.js +15 -9
  96. package/resources/xcode-instances-helpers.js.map +1 -1
  97. package/resources/xcode-instances-helpers.mjs +15 -9
  98. package/resources/xcode-instances-helpers.mjs.map +1 -1
  99. package/src/client.ts +80 -9
  100. package/src/destination-tunnel.ts +3 -2
  101. package/src/gradle-snapshot.ts +3 -4
  102. package/src/index.ts +16 -0
  103. package/src/internal/instance-phase-stream.ts +30 -8
  104. package/src/lib/workload-credentials.ts +70 -13
  105. package/src/resources/access-tokens.ts +7 -4
  106. package/src/resources/assets.ts +24 -4
  107. package/src/resources/gradle-instances.ts +15 -3
  108. package/src/resources/index.ts +11 -0
  109. package/src/resources/macos-instances-helpers.ts +655 -0
  110. package/src/resources/macos-instances.ts +30 -0
  111. package/src/resources/support-tickets.ts +15 -0
  112. package/src/resources/xcode-instances-helpers.ts +16 -8
  113. package/src/version.ts +1 -1
  114. package/src/xcode-cache.ts +3 -4
  115. package/version.d.mts +1 -1
  116. package/version.d.ts +1 -1
  117. package/version.js +1 -1
  118. package/version.mjs +1 -1
  119. package/xcode-cache.d.mts +2 -2
  120. package/xcode-cache.d.mts.map +1 -1
  121. package/xcode-cache.d.ts +2 -2
  122. package/xcode-cache.d.ts.map +1 -1
  123. package/xcode-cache.js +1 -1
  124. package/xcode-cache.js.map +1 -1
  125. package/xcode-cache.mjs +1 -1
  126. package/xcode-cache.mjs.map +1 -1
@@ -0,0 +1,271 @@
1
+ import { type TcpTunnelOptions, type Tunnel } from "../tunnel.mjs";
2
+ import { type ExecChildProcess } from "../exec-client.mjs";
3
+ import { type BuildRunOptions, type LogLevel } from "./daemon-client-shared.mjs";
4
+ import { type MacosInstance } from "./macos-instances.mjs";
5
+ import { type DestinationTcpTunnel, type DestinationTunnelStartOptions } from "../destination-tunnel-dialer.mjs";
6
+ import { APIPromise } from "../core/api-promise.mjs";
7
+ import { RequestOptions } from "../internal/request-options.mjs";
8
+ import { type PersistOption } from "../internal/persist-option.mjs";
9
+ import { type TrustedCaCertificate } from "../internal/trusted-ca.mjs";
10
+ import { type PerformanceSample, type SessionArtifact, type SessionArtifactKind, type SessionEvent, type SessionLogLine } from "./session-artifacts.mjs";
11
+ import { type DestinationTunnelStatus } from "../internal/destination-tunnel-management.mjs";
12
+ export type MacosCreateClientParams = {
13
+ logLevel?: LogLevel;
14
+ } & ({
15
+ instance: MacosInstance;
16
+ } | {
17
+ apiUrl: string;
18
+ token: string;
19
+ });
20
+ /**
21
+ * Options of {@link MacosClient.startTunnel}, as on iOS and Android: inspection is on and bodies
22
+ * are off unless `inspection` says otherwise.
23
+ */
24
+ export type MacosTunnelOptions = DestinationTunnelStartOptions;
25
+ /** Options of {@link MacosClient.startRecording}. */
26
+ export interface MacosRecordingOptions {
27
+ /** The recording's ID, `[a-z0-9][a-z0-9_-]{0,63}`. Generated when omitted; never reused. */
28
+ recordingId?: string;
29
+ /** Encoder quality from 5 to 10; the server default is 5. */
30
+ quality?: number;
31
+ /** Upload the recording to Limrun's bucket when it stops; list it with `listRecordings`. */
32
+ persist?: PersistOption;
33
+ }
34
+ /** Where a stopped recording goes, besides the instance's own download URL. */
35
+ export interface MacosRecordingDestination {
36
+ /** An HTTPS presigned PUT URL the instance uploads the MP4 to before the stop resolves. */
37
+ presignedUrl?: string;
38
+ /** A local path this client downloads the MP4 to. */
39
+ localPath?: string;
40
+ }
41
+ /** Handlers of a live stream. `onError` fires at most once, and the stream is then closed. */
42
+ /**
43
+ * How {@link MacosClient.launchApp} treats an app that already runs: `ForegroundIfRunning` brings
44
+ * it to the front, `RelaunchIfRunning` stops it and starts it anew.
45
+ */
46
+ export type MacosLaunchMode = 'ForegroundIfRunning' | 'RelaunchIfRunning';
47
+ export interface MacosLaunchAppOptions {
48
+ /** Defaults to `ForegroundIfRunning`. */
49
+ mode?: MacosLaunchMode;
50
+ /** Command-line arguments for the app. */
51
+ arguments?: string[];
52
+ /** Environment variables for the app. */
53
+ env?: Record<string, string>;
54
+ }
55
+ export interface MacosLaunchAppResult {
56
+ bundleId: string;
57
+ pid: number;
58
+ /** False when the app already ran and was brought to the front. */
59
+ launched: boolean;
60
+ }
61
+ export interface MacosStreamHandlers<T> {
62
+ onEntry: (entry: T) => void;
63
+ /** Called once the entries the instance replays on connect have all arrived. */
64
+ onReplayed?: () => void;
65
+ onError?: (error: Error) => void;
66
+ }
67
+ /** A point on the screen, in pixels of `screenshot()`, from the top-left corner. */
68
+ export interface MacosPoint {
69
+ x: number;
70
+ y: number;
71
+ }
72
+ /** Modifier keys held while a key is pressed. */
73
+ export type MacosModifier = 'shift' | 'control' | 'option' | 'command';
74
+ /** Where the guest's SSH server can be reached once {@link MacosClient.enableSsh} returns. */
75
+ export interface MacosSshAccess {
76
+ /** The guest account the key logs in as. */
77
+ user: string;
78
+ /** The guest port sshd listens on; forward a local port to it with `startPortForward`. */
79
+ port: number;
80
+ }
81
+ /**
82
+ * MacosClient works inside a running macOS instance: it runs shell commands
83
+ * as the guest's user, forwards local ports into the guest, and drives the
84
+ * screen with the mouse and keyboard.
85
+ */
86
+ export interface MacosClient {
87
+ /**
88
+ * Run a shell command line as the guest's user, in its login session, with
89
+ * a login shell's PATH. `cwd` is relative to the user's home directory.
90
+ * Output streams on `stdout` and `stderr`; the promise resolves with the
91
+ * exit code. `kill()` ends the command and everything it started.
92
+ */
93
+ run(commandLine: string, options?: BuildRunOptions): ExecChildProcess;
94
+ /**
95
+ * Turn on the guest's SSH server and let `publicKey` (one OpenSSH public key
96
+ * line) log in. Password logins stay off. Reach the server with
97
+ * `startPortForward(localPort, access.port)`.
98
+ */
99
+ enableSsh(publicKey: string): Promise<MacosSshAccess>;
100
+ /**
101
+ * Accept TCP connections on `localPort` (on 127.0.0.1 unless `hostname` is
102
+ * given) and carry each one to `remotePort` inside the guest.
103
+ */
104
+ startPortForward(localPort: number, remotePort: number, options?: TcpTunnelOptions & {
105
+ hostname?: string;
106
+ }): Promise<Tunnel>;
107
+ /** A JPEG of the screen. Its pixels are the coordinates the input methods take. */
108
+ screenshot(): Promise<Buffer>;
109
+ /** Click at a point. */
110
+ tap(point: MacosPoint, options?: {
111
+ button?: 'left' | 'right';
112
+ }): Promise<void>;
113
+ /** Type text with key presses on the US layout. */
114
+ typeText(text: string): Promise<void>;
115
+ /**
116
+ * Press one key, such as `enter`, `tab`, `escape`, `up`, `f5` or `a`, while
117
+ * holding the given modifiers.
118
+ */
119
+ pressKey(key: string, modifiers?: MacosModifier[]): Promise<void>;
120
+ /**
121
+ * Scroll by `dy` (positive scrolls down) and `dx` (positive scrolls right)
122
+ * pixels over the point, or wherever the pointer is when none is given.
123
+ */
124
+ scroll(options: {
125
+ dx?: number;
126
+ dy?: number;
127
+ at?: MacosPoint;
128
+ }): Promise<void>;
129
+ /** Press at `from`, move to `to` over `durationMs`, and release. */
130
+ drag(from: MacosPoint, to: MacosPoint, options?: {
131
+ durationMs?: number;
132
+ }): Promise<void>;
133
+ /**
134
+ * Restore a disk snapshot into the guest and set the key the instance saves under when it
135
+ * terminates. A snapshot is an asset of kind `MacOSSnapshot`, so the instance's role needs read
136
+ * on the restore keys' asset names, and create, upload and update on `key`'s.
137
+ *
138
+ * Each restore key is tried in order: its exact name first, then the newest asset whose name
139
+ * starts with it, skipping snapshots saved on another macOS build. Without `restoreKeys`,
140
+ * `key` is restored. Without either, nothing is restored. Call it once the instance is ready
141
+ * and before using the guest; asking again joins the restore already running. Resolves with the
142
+ * final progress event; `onProgress` sees every event, with byte counts while downloading.
143
+ */
144
+ restoreSnapshot(options: MacosSnapshotRestoreOptions): Promise<MacosSnapshotProgress>;
145
+ /**
146
+ * Let code in the guest reach destinations on this machine through a destination tunnel, as on
147
+ * an iOS simulator. `localhost:port` and `IPv4:port` selectors are reached at those addresses in
148
+ * the guest; domain selectors are resolved in the guest to addresses the tunnel serves and
149
+ * dialed from this machine. One tunnel serves an instance at a time.
150
+ */
151
+ startTunnel(options: MacosTunnelOptions): Promise<DestinationTcpTunnel>;
152
+ /** The instance's tunnel, if one is active. */
153
+ getTunnelStatus(): Promise<DestinationTunnelStatus>;
154
+ /** Stop the tunnel with this ID; another tunnel that replaced it keeps running. */
155
+ stopTunnel(tunnelId: string): Promise<void>;
156
+ /**
157
+ * Trust a PEM-encoded CA certificate system-wide in the guest, for example the CA of an
158
+ * intercepting proxy you record traffic with. macOS asks an administrator to confirm a new
159
+ * trusted root, so the instance answers that dialog itself and it shows on the screen for a
160
+ * few seconds. Adding a certificate the guest already trusts changes nothing.
161
+ */
162
+ addCaCertificate(pem: string): Promise<TrustedCaCertificate>;
163
+ /**
164
+ * Start recording the screen and return the recording's ID. Up to eight recordings may be
165
+ * active or uploading at once.
166
+ */
167
+ startRecording(options?: MacosRecordingOptions): Promise<string>;
168
+ /**
169
+ * Stop a recording, or the latest active one when `recordingId` is omitted, and return its
170
+ * download URL, which takes the instance token and lasts while the instance runs.
171
+ */
172
+ stopRecording(recordingId?: string, saveTo?: MacosRecordingDestination): Promise<string>;
173
+ /**
174
+ * Launch an app by bundle ID (`com.example.app`), name (`TextEdit`) or path
175
+ * (`/Applications/Safari.app`) and bring it to the front. An app launched this way has its
176
+ * stdout and stderr in its app log; one started any other way writes them nowhere. Arguments
177
+ * and environment apply only when the app starts, not when it already runs.
178
+ */
179
+ launchApp(app: string, options?: MacosLaunchAppOptions): Promise<MacosLaunchAppResult>;
180
+ /** Stop every process of an app. Succeeds when the app is not running. */
181
+ terminateApp(bundleId: string): Promise<void>;
182
+ /**
183
+ * The last `lines` lines of an app's log: its stdout and stderr when it was started with
184
+ * {@link launchApp}, and what it wrote to the unified log in the past hour, in time order.
185
+ * For an app that is not Apple's, Apple's frameworks' messages are left out.
186
+ */
187
+ appLogTail(bundleId: string, lines: number): Promise<string>;
188
+ /**
189
+ * Follow an app's log, as {@link appLogTail} reads it, one line per `onEntry`. Returns a
190
+ * function that stops it.
191
+ */
192
+ streamAppLog(bundleId: string, handlers: MacosStreamHandlers<string>): () => void;
193
+ /**
194
+ * Start capturing an app's logs. One app log capture runs at a time. With `persist`, the
195
+ * capture is uploaded to Limrun's bucket when it stops or the instance terminates; list it
196
+ * with `macosInstances.listAppLogs`.
197
+ */
198
+ startAppLogCapture(options: {
199
+ bundleId: string;
200
+ persist?: PersistOption;
201
+ }): Promise<void>;
202
+ /** Stop the active app log capture. */
203
+ stopAppLogCapture(): Promise<void>;
204
+ /**
205
+ * Start capturing the coalesced event log of clicks, scrolls and keys sent to the screen.
206
+ * Typing is logged as a count of characters, never their content.
207
+ */
208
+ startEventCapture(options?: {
209
+ persist?: PersistOption;
210
+ }): Promise<void>;
211
+ /** Stop the active event capture. */
212
+ stopEventCapture(): Promise<void>;
213
+ /**
214
+ * Start saving the running apps' performance samples. The capture always persists, kept for
215
+ * `ttlSeconds` (server default 72h); list it with `macosInstances.listPerformanceCaptures`.
216
+ */
217
+ startPerformanceCapture(options?: {
218
+ ttlSeconds?: number;
219
+ }): Promise<void>;
220
+ /** Stop the active performance capture and upload it. */
221
+ stopPerformanceCapture(): Promise<void>;
222
+ /**
223
+ * Tail the live app log capture. On connect the instance replays its recent lines, and a
224
+ * dropped connection resumes where it left off. Returns a function that closes it.
225
+ */
226
+ streamAppLogCapture(handlers: MacosStreamHandlers<SessionLogLine>): () => void;
227
+ /** Tail the live event capture, with {@link streamAppLogCapture}'s semantics. */
228
+ streamEventCapture(handlers: MacosStreamHandlers<SessionEvent>): () => void;
229
+ /**
230
+ * Tail the running apps' CPU, memory, thread and disk samples, about once a second; no
231
+ * capture is needed. On connect the instance replays its recent samples.
232
+ */
233
+ streamPerformance(handlers: MacosStreamHandlers<PerformanceSample>): () => void;
234
+ }
235
+ export interface MacosSnapshotRestoreOptions {
236
+ /** The asset name the instance saves its changes under when it terminates. Set once. */
237
+ key?: string;
238
+ /** Asset names, or name prefixes, to restore from, in order. Defaults to `key`. */
239
+ restoreKeys?: string[];
240
+ onProgress?: (progress: MacosSnapshotProgress) => void;
241
+ }
242
+ /** A restore's progress, as the instance reports it. */
243
+ export interface MacosSnapshotProgress {
244
+ phase: 'resolving' | 'downloading' | 'extracting' | 'restored' | 'skipped' | 'failed' | string;
245
+ /** The asset name the restore matched. */
246
+ key?: string;
247
+ matchKind?: 'exact_hit' | 'prefix_hit' | string;
248
+ /** Whether the bytes came through the regional accelerator or straight from storage. */
249
+ source?: 'tag' | 'direct' | string;
250
+ totalBytes?: number;
251
+ doneBytes?: number;
252
+ reason?: string;
253
+ message?: string;
254
+ }
255
+ declare module './macos-instances.mjs' {
256
+ interface MacosInstances {
257
+ /** Create a client that works inside a running macOS instance. */
258
+ createClient(params: MacosCreateClientParams): Promise<MacosClient>;
259
+ /** List the instance's persisted session artifacts, optionally narrowed to one kind. */
260
+ listSessionArtifacts(id: string, kind?: SessionArtifactKind, options?: RequestOptions): APIPromise<SessionArtifact[]>;
261
+ /** List the instance's persisted screen recordings. */
262
+ listRecordings(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
263
+ /** List the instance's persisted app log captures. */
264
+ listAppLogs(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
265
+ /** List the instance's persisted event log captures. */
266
+ listEvents(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
267
+ /** List the instance's persisted performance captures. */
268
+ listPerformanceCaptures(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
269
+ }
270
+ }
271
+ //# sourceMappingURL=macos-instances-helpers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-instances-helpers.d.mts","sourceRoot":"","sources":["../src/resources/macos-instances-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,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AAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB,kEAAkE;QAClE,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QACpE,wFAAwF;QACxF,oBAAoB,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,mBAAmB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;QACjC,uDAAuD;QACvD,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;QACpF,sDAAsD;QACtD,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;QACjF,wDAAwD;QACxD,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;QAChF,0DAA0D;QAC1D,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;KAC9F;CACF"}
@@ -0,0 +1,271 @@
1
+ import { type TcpTunnelOptions, type Tunnel } from "../tunnel.js";
2
+ import { type ExecChildProcess } from "../exec-client.js";
3
+ import { type BuildRunOptions, type LogLevel } from "./daemon-client-shared.js";
4
+ import { type MacosInstance } from "./macos-instances.js";
5
+ import { type DestinationTcpTunnel, type DestinationTunnelStartOptions } from "../destination-tunnel-dialer.js";
6
+ import { APIPromise } from "../core/api-promise.js";
7
+ import { RequestOptions } from "../internal/request-options.js";
8
+ import { type PersistOption } from "../internal/persist-option.js";
9
+ import { type TrustedCaCertificate } from "../internal/trusted-ca.js";
10
+ import { type PerformanceSample, type SessionArtifact, type SessionArtifactKind, type SessionEvent, type SessionLogLine } from "./session-artifacts.js";
11
+ import { type DestinationTunnelStatus } from "../internal/destination-tunnel-management.js";
12
+ export type MacosCreateClientParams = {
13
+ logLevel?: LogLevel;
14
+ } & ({
15
+ instance: MacosInstance;
16
+ } | {
17
+ apiUrl: string;
18
+ token: string;
19
+ });
20
+ /**
21
+ * Options of {@link MacosClient.startTunnel}, as on iOS and Android: inspection is on and bodies
22
+ * are off unless `inspection` says otherwise.
23
+ */
24
+ export type MacosTunnelOptions = DestinationTunnelStartOptions;
25
+ /** Options of {@link MacosClient.startRecording}. */
26
+ export interface MacosRecordingOptions {
27
+ /** The recording's ID, `[a-z0-9][a-z0-9_-]{0,63}`. Generated when omitted; never reused. */
28
+ recordingId?: string;
29
+ /** Encoder quality from 5 to 10; the server default is 5. */
30
+ quality?: number;
31
+ /** Upload the recording to Limrun's bucket when it stops; list it with `listRecordings`. */
32
+ persist?: PersistOption;
33
+ }
34
+ /** Where a stopped recording goes, besides the instance's own download URL. */
35
+ export interface MacosRecordingDestination {
36
+ /** An HTTPS presigned PUT URL the instance uploads the MP4 to before the stop resolves. */
37
+ presignedUrl?: string;
38
+ /** A local path this client downloads the MP4 to. */
39
+ localPath?: string;
40
+ }
41
+ /** Handlers of a live stream. `onError` fires at most once, and the stream is then closed. */
42
+ /**
43
+ * How {@link MacosClient.launchApp} treats an app that already runs: `ForegroundIfRunning` brings
44
+ * it to the front, `RelaunchIfRunning` stops it and starts it anew.
45
+ */
46
+ export type MacosLaunchMode = 'ForegroundIfRunning' | 'RelaunchIfRunning';
47
+ export interface MacosLaunchAppOptions {
48
+ /** Defaults to `ForegroundIfRunning`. */
49
+ mode?: MacosLaunchMode;
50
+ /** Command-line arguments for the app. */
51
+ arguments?: string[];
52
+ /** Environment variables for the app. */
53
+ env?: Record<string, string>;
54
+ }
55
+ export interface MacosLaunchAppResult {
56
+ bundleId: string;
57
+ pid: number;
58
+ /** False when the app already ran and was brought to the front. */
59
+ launched: boolean;
60
+ }
61
+ export interface MacosStreamHandlers<T> {
62
+ onEntry: (entry: T) => void;
63
+ /** Called once the entries the instance replays on connect have all arrived. */
64
+ onReplayed?: () => void;
65
+ onError?: (error: Error) => void;
66
+ }
67
+ /** A point on the screen, in pixels of `screenshot()`, from the top-left corner. */
68
+ export interface MacosPoint {
69
+ x: number;
70
+ y: number;
71
+ }
72
+ /** Modifier keys held while a key is pressed. */
73
+ export type MacosModifier = 'shift' | 'control' | 'option' | 'command';
74
+ /** Where the guest's SSH server can be reached once {@link MacosClient.enableSsh} returns. */
75
+ export interface MacosSshAccess {
76
+ /** The guest account the key logs in as. */
77
+ user: string;
78
+ /** The guest port sshd listens on; forward a local port to it with `startPortForward`. */
79
+ port: number;
80
+ }
81
+ /**
82
+ * MacosClient works inside a running macOS instance: it runs shell commands
83
+ * as the guest's user, forwards local ports into the guest, and drives the
84
+ * screen with the mouse and keyboard.
85
+ */
86
+ export interface MacosClient {
87
+ /**
88
+ * Run a shell command line as the guest's user, in its login session, with
89
+ * a login shell's PATH. `cwd` is relative to the user's home directory.
90
+ * Output streams on `stdout` and `stderr`; the promise resolves with the
91
+ * exit code. `kill()` ends the command and everything it started.
92
+ */
93
+ run(commandLine: string, options?: BuildRunOptions): ExecChildProcess;
94
+ /**
95
+ * Turn on the guest's SSH server and let `publicKey` (one OpenSSH public key
96
+ * line) log in. Password logins stay off. Reach the server with
97
+ * `startPortForward(localPort, access.port)`.
98
+ */
99
+ enableSsh(publicKey: string): Promise<MacosSshAccess>;
100
+ /**
101
+ * Accept TCP connections on `localPort` (on 127.0.0.1 unless `hostname` is
102
+ * given) and carry each one to `remotePort` inside the guest.
103
+ */
104
+ startPortForward(localPort: number, remotePort: number, options?: TcpTunnelOptions & {
105
+ hostname?: string;
106
+ }): Promise<Tunnel>;
107
+ /** A JPEG of the screen. Its pixels are the coordinates the input methods take. */
108
+ screenshot(): Promise<Buffer>;
109
+ /** Click at a point. */
110
+ tap(point: MacosPoint, options?: {
111
+ button?: 'left' | 'right';
112
+ }): Promise<void>;
113
+ /** Type text with key presses on the US layout. */
114
+ typeText(text: string): Promise<void>;
115
+ /**
116
+ * Press one key, such as `enter`, `tab`, `escape`, `up`, `f5` or `a`, while
117
+ * holding the given modifiers.
118
+ */
119
+ pressKey(key: string, modifiers?: MacosModifier[]): Promise<void>;
120
+ /**
121
+ * Scroll by `dy` (positive scrolls down) and `dx` (positive scrolls right)
122
+ * pixels over the point, or wherever the pointer is when none is given.
123
+ */
124
+ scroll(options: {
125
+ dx?: number;
126
+ dy?: number;
127
+ at?: MacosPoint;
128
+ }): Promise<void>;
129
+ /** Press at `from`, move to `to` over `durationMs`, and release. */
130
+ drag(from: MacosPoint, to: MacosPoint, options?: {
131
+ durationMs?: number;
132
+ }): Promise<void>;
133
+ /**
134
+ * Restore a disk snapshot into the guest and set the key the instance saves under when it
135
+ * terminates. A snapshot is an asset of kind `MacOSSnapshot`, so the instance's role needs read
136
+ * on the restore keys' asset names, and create, upload and update on `key`'s.
137
+ *
138
+ * Each restore key is tried in order: its exact name first, then the newest asset whose name
139
+ * starts with it, skipping snapshots saved on another macOS build. Without `restoreKeys`,
140
+ * `key` is restored. Without either, nothing is restored. Call it once the instance is ready
141
+ * and before using the guest; asking again joins the restore already running. Resolves with the
142
+ * final progress event; `onProgress` sees every event, with byte counts while downloading.
143
+ */
144
+ restoreSnapshot(options: MacosSnapshotRestoreOptions): Promise<MacosSnapshotProgress>;
145
+ /**
146
+ * Let code in the guest reach destinations on this machine through a destination tunnel, as on
147
+ * an iOS simulator. `localhost:port` and `IPv4:port` selectors are reached at those addresses in
148
+ * the guest; domain selectors are resolved in the guest to addresses the tunnel serves and
149
+ * dialed from this machine. One tunnel serves an instance at a time.
150
+ */
151
+ startTunnel(options: MacosTunnelOptions): Promise<DestinationTcpTunnel>;
152
+ /** The instance's tunnel, if one is active. */
153
+ getTunnelStatus(): Promise<DestinationTunnelStatus>;
154
+ /** Stop the tunnel with this ID; another tunnel that replaced it keeps running. */
155
+ stopTunnel(tunnelId: string): Promise<void>;
156
+ /**
157
+ * Trust a PEM-encoded CA certificate system-wide in the guest, for example the CA of an
158
+ * intercepting proxy you record traffic with. macOS asks an administrator to confirm a new
159
+ * trusted root, so the instance answers that dialog itself and it shows on the screen for a
160
+ * few seconds. Adding a certificate the guest already trusts changes nothing.
161
+ */
162
+ addCaCertificate(pem: string): Promise<TrustedCaCertificate>;
163
+ /**
164
+ * Start recording the screen and return the recording's ID. Up to eight recordings may be
165
+ * active or uploading at once.
166
+ */
167
+ startRecording(options?: MacosRecordingOptions): Promise<string>;
168
+ /**
169
+ * Stop a recording, or the latest active one when `recordingId` is omitted, and return its
170
+ * download URL, which takes the instance token and lasts while the instance runs.
171
+ */
172
+ stopRecording(recordingId?: string, saveTo?: MacosRecordingDestination): Promise<string>;
173
+ /**
174
+ * Launch an app by bundle ID (`com.example.app`), name (`TextEdit`) or path
175
+ * (`/Applications/Safari.app`) and bring it to the front. An app launched this way has its
176
+ * stdout and stderr in its app log; one started any other way writes them nowhere. Arguments
177
+ * and environment apply only when the app starts, not when it already runs.
178
+ */
179
+ launchApp(app: string, options?: MacosLaunchAppOptions): Promise<MacosLaunchAppResult>;
180
+ /** Stop every process of an app. Succeeds when the app is not running. */
181
+ terminateApp(bundleId: string): Promise<void>;
182
+ /**
183
+ * The last `lines` lines of an app's log: its stdout and stderr when it was started with
184
+ * {@link launchApp}, and what it wrote to the unified log in the past hour, in time order.
185
+ * For an app that is not Apple's, Apple's frameworks' messages are left out.
186
+ */
187
+ appLogTail(bundleId: string, lines: number): Promise<string>;
188
+ /**
189
+ * Follow an app's log, as {@link appLogTail} reads it, one line per `onEntry`. Returns a
190
+ * function that stops it.
191
+ */
192
+ streamAppLog(bundleId: string, handlers: MacosStreamHandlers<string>): () => void;
193
+ /**
194
+ * Start capturing an app's logs. One app log capture runs at a time. With `persist`, the
195
+ * capture is uploaded to Limrun's bucket when it stops or the instance terminates; list it
196
+ * with `macosInstances.listAppLogs`.
197
+ */
198
+ startAppLogCapture(options: {
199
+ bundleId: string;
200
+ persist?: PersistOption;
201
+ }): Promise<void>;
202
+ /** Stop the active app log capture. */
203
+ stopAppLogCapture(): Promise<void>;
204
+ /**
205
+ * Start capturing the coalesced event log of clicks, scrolls and keys sent to the screen.
206
+ * Typing is logged as a count of characters, never their content.
207
+ */
208
+ startEventCapture(options?: {
209
+ persist?: PersistOption;
210
+ }): Promise<void>;
211
+ /** Stop the active event capture. */
212
+ stopEventCapture(): Promise<void>;
213
+ /**
214
+ * Start saving the running apps' performance samples. The capture always persists, kept for
215
+ * `ttlSeconds` (server default 72h); list it with `macosInstances.listPerformanceCaptures`.
216
+ */
217
+ startPerformanceCapture(options?: {
218
+ ttlSeconds?: number;
219
+ }): Promise<void>;
220
+ /** Stop the active performance capture and upload it. */
221
+ stopPerformanceCapture(): Promise<void>;
222
+ /**
223
+ * Tail the live app log capture. On connect the instance replays its recent lines, and a
224
+ * dropped connection resumes where it left off. Returns a function that closes it.
225
+ */
226
+ streamAppLogCapture(handlers: MacosStreamHandlers<SessionLogLine>): () => void;
227
+ /** Tail the live event capture, with {@link streamAppLogCapture}'s semantics. */
228
+ streamEventCapture(handlers: MacosStreamHandlers<SessionEvent>): () => void;
229
+ /**
230
+ * Tail the running apps' CPU, memory, thread and disk samples, about once a second; no
231
+ * capture is needed. On connect the instance replays its recent samples.
232
+ */
233
+ streamPerformance(handlers: MacosStreamHandlers<PerformanceSample>): () => void;
234
+ }
235
+ export interface MacosSnapshotRestoreOptions {
236
+ /** The asset name the instance saves its changes under when it terminates. Set once. */
237
+ key?: string;
238
+ /** Asset names, or name prefixes, to restore from, in order. Defaults to `key`. */
239
+ restoreKeys?: string[];
240
+ onProgress?: (progress: MacosSnapshotProgress) => void;
241
+ }
242
+ /** A restore's progress, as the instance reports it. */
243
+ export interface MacosSnapshotProgress {
244
+ phase: 'resolving' | 'downloading' | 'extracting' | 'restored' | 'skipped' | 'failed' | string;
245
+ /** The asset name the restore matched. */
246
+ key?: string;
247
+ matchKind?: 'exact_hit' | 'prefix_hit' | string;
248
+ /** Whether the bytes came through the regional accelerator or straight from storage. */
249
+ source?: 'tag' | 'direct' | string;
250
+ totalBytes?: number;
251
+ doneBytes?: number;
252
+ reason?: string;
253
+ message?: string;
254
+ }
255
+ declare module './macos-instances' {
256
+ interface MacosInstances {
257
+ /** Create a client that works inside a running macOS instance. */
258
+ createClient(params: MacosCreateClientParams): Promise<MacosClient>;
259
+ /** List the instance's persisted session artifacts, optionally narrowed to one kind. */
260
+ listSessionArtifacts(id: string, kind?: SessionArtifactKind, options?: RequestOptions): APIPromise<SessionArtifact[]>;
261
+ /** List the instance's persisted screen recordings. */
262
+ listRecordings(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
263
+ /** List the instance's persisted app log captures. */
264
+ listAppLogs(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
265
+ /** List the instance's persisted event log captures. */
266
+ listEvents(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
267
+ /** List the instance's persisted performance captures. */
268
+ listPerformanceCaptures(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]>;
269
+ }
270
+ }
271
+ //# sourceMappingURL=macos-instances-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-instances-helpers.d.ts","sourceRoot":"","sources":["../src/resources/macos-instances-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,qBAAkB;AAC/E,OAAO,EAAE,KAAK,gBAAgB,EAAE,0BAAuB;AACvD,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,QAAQ,EACd,kCAA+B;AAChC,OAAO,EAAkB,KAAK,aAAa,EAAE,6BAA0B;AACvE,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EACnC,wCAAqC;AACtC,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,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