@limrun/api 0.70.1 → 0.71.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 (151) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/client.d.mts +1 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +1 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +1 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -0
  9. package/client.mjs.map +1 -1
  10. package/exec-client.d.mts +9 -0
  11. package/exec-client.d.mts.map +1 -1
  12. package/exec-client.d.ts +9 -0
  13. package/exec-client.d.ts.map +1 -1
  14. package/exec-client.js.map +1 -1
  15. package/exec-client.mjs.map +1 -1
  16. package/index.d.mts +2 -1
  17. package/index.d.mts.map +1 -1
  18. package/index.d.ts +2 -1
  19. package/index.d.ts.map +1 -1
  20. package/index.js +1 -0
  21. package/index.js.map +1 -1
  22. package/index.mjs +1 -0
  23. package/index.mjs.map +1 -1
  24. package/instance-client.d.mts +2 -0
  25. package/instance-client.d.mts.map +1 -1
  26. package/instance-client.d.ts +2 -0
  27. package/instance-client.d.ts.map +1 -1
  28. package/instance-client.js +6 -2
  29. package/instance-client.js.map +1 -1
  30. package/instance-client.mjs +6 -2
  31. package/instance-client.mjs.map +1 -1
  32. package/internal/persist-option.d.mts +4 -0
  33. package/internal/persist-option.d.mts.map +1 -1
  34. package/internal/persist-option.d.ts +4 -0
  35. package/internal/persist-option.d.ts.map +1 -1
  36. package/internal/persist-option.js +10 -3
  37. package/internal/persist-option.js.map +1 -1
  38. package/internal/persist-option.mjs +9 -3
  39. package/internal/persist-option.mjs.map +1 -1
  40. package/internal/session-stream.d.mts +6 -5
  41. package/internal/session-stream.d.mts.map +1 -1
  42. package/internal/session-stream.d.ts +6 -5
  43. package/internal/session-stream.d.ts.map +1 -1
  44. package/internal/session-stream.js +6 -5
  45. package/internal/session-stream.js.map +1 -1
  46. package/internal/session-stream.mjs +6 -5
  47. package/internal/session-stream.mjs.map +1 -1
  48. package/ios-client.d.mts +28 -1
  49. package/ios-client.d.mts.map +1 -1
  50. package/ios-client.d.ts +28 -1
  51. package/ios-client.d.ts.map +1 -1
  52. package/ios-client.js +27 -14
  53. package/ios-client.js.map +1 -1
  54. package/ios-client.mjs +28 -15
  55. package/ios-client.mjs.map +1 -1
  56. package/package.json +1 -1
  57. package/resources/android-instances.d.mts +18 -5
  58. package/resources/android-instances.d.mts.map +1 -1
  59. package/resources/android-instances.d.ts +18 -5
  60. package/resources/android-instances.d.ts.map +1 -1
  61. package/resources/daemon-client-shared.d.mts +3 -0
  62. package/resources/daemon-client-shared.d.mts.map +1 -1
  63. package/resources/daemon-client-shared.d.ts +3 -0
  64. package/resources/daemon-client-shared.d.ts.map +1 -1
  65. package/resources/daemon-client-shared.js +2 -0
  66. package/resources/daemon-client-shared.js.map +1 -1
  67. package/resources/daemon-client-shared.mjs +2 -0
  68. package/resources/daemon-client-shared.mjs.map +1 -1
  69. package/resources/gradle-instances-helpers.d.mts +3 -0
  70. package/resources/gradle-instances-helpers.d.mts.map +1 -1
  71. package/resources/gradle-instances-helpers.d.ts +3 -0
  72. package/resources/gradle-instances-helpers.d.ts.map +1 -1
  73. package/resources/gradle-instances-helpers.js +2 -0
  74. package/resources/gradle-instances-helpers.js.map +1 -1
  75. package/resources/gradle-instances-helpers.mjs +2 -0
  76. package/resources/gradle-instances-helpers.mjs.map +1 -1
  77. package/resources/gradle-instances.d.mts +21 -5
  78. package/resources/gradle-instances.d.mts.map +1 -1
  79. package/resources/gradle-instances.d.ts +21 -5
  80. package/resources/gradle-instances.d.ts.map +1 -1
  81. package/resources/index.d.mts +2 -1
  82. package/resources/index.d.mts.map +1 -1
  83. package/resources/index.d.ts +2 -1
  84. package/resources/index.d.ts.map +1 -1
  85. package/resources/index.js +2 -0
  86. package/resources/index.js.map +1 -1
  87. package/resources/index.mjs +1 -0
  88. package/resources/index.mjs.map +1 -1
  89. package/resources/ios-instances-helpers.d.mts +4 -0
  90. package/resources/ios-instances-helpers.d.mts.map +1 -1
  91. package/resources/ios-instances-helpers.d.ts +4 -0
  92. package/resources/ios-instances-helpers.d.ts.map +1 -1
  93. package/resources/ios-instances-helpers.js +6 -0
  94. package/resources/ios-instances-helpers.js.map +1 -1
  95. package/resources/ios-instances-helpers.mjs +6 -0
  96. package/resources/ios-instances-helpers.mjs.map +1 -1
  97. package/resources/ios-instances.d.mts +18 -5
  98. package/resources/ios-instances.d.mts.map +1 -1
  99. package/resources/ios-instances.d.ts +18 -5
  100. package/resources/ios-instances.d.ts.map +1 -1
  101. package/resources/secrets.d.mts +66 -0
  102. package/resources/secrets.d.mts.map +1 -0
  103. package/resources/secrets.d.ts +66 -0
  104. package/resources/secrets.d.ts.map +1 -0
  105. package/resources/secrets.js +141 -0
  106. package/resources/secrets.js.map +1 -0
  107. package/resources/secrets.mjs +137 -0
  108. package/resources/secrets.mjs.map +1 -0
  109. package/resources/session-artifacts.d.mts +46 -5
  110. package/resources/session-artifacts.d.mts.map +1 -1
  111. package/resources/session-artifacts.d.ts +46 -5
  112. package/resources/session-artifacts.d.ts.map +1 -1
  113. package/resources/session-artifacts.js +3 -3
  114. package/resources/session-artifacts.js.map +1 -1
  115. package/resources/session-artifacts.mjs +3 -3
  116. package/resources/session-artifacts.mjs.map +1 -1
  117. package/resources/xcode-instances-helpers.d.mts +3 -0
  118. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  119. package/resources/xcode-instances-helpers.d.ts +3 -0
  120. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  121. package/resources/xcode-instances-helpers.js +2 -0
  122. package/resources/xcode-instances-helpers.js.map +1 -1
  123. package/resources/xcode-instances-helpers.mjs +2 -0
  124. package/resources/xcode-instances-helpers.mjs.map +1 -1
  125. package/resources/xcode-instances.d.mts +21 -5
  126. package/resources/xcode-instances.d.mts.map +1 -1
  127. package/resources/xcode-instances.d.ts +21 -5
  128. package/resources/xcode-instances.d.ts.map +1 -1
  129. package/src/client.ts +1 -0
  130. package/src/exec-client.ts +9 -0
  131. package/src/index.ts +4 -0
  132. package/src/instance-client.ts +9 -3
  133. package/src/internal/persist-option.ts +10 -5
  134. package/src/internal/session-stream.ts +6 -5
  135. package/src/ios-client.ts +87 -28
  136. package/src/resources/android-instances.ts +19 -5
  137. package/src/resources/daemon-client-shared.ts +5 -0
  138. package/src/resources/gradle-instances-helpers.ts +5 -0
  139. package/src/resources/gradle-instances.ts +22 -5
  140. package/src/resources/index.ts +4 -0
  141. package/src/resources/ios-instances-helpers.ts +7 -0
  142. package/src/resources/ios-instances.ts +19 -5
  143. package/src/resources/secrets.ts +210 -0
  144. package/src/resources/session-artifacts.ts +63 -8
  145. package/src/resources/xcode-instances-helpers.ts +5 -0
  146. package/src/resources/xcode-instances.ts +22 -5
  147. package/src/version.ts +1 -1
  148. package/version.d.mts +1 -1
  149. package/version.d.ts +1 -1
  150. package/version.js +1 -1
  151. package/version.mjs +1 -1
@@ -16,11 +16,16 @@ export function persistFields(persist: PersistOption | undefined): {
16
16
  if (persist === true) {
17
17
  return { persist: true };
18
18
  }
19
- if (
20
- persist.ttlSeconds !== undefined &&
21
- (!Number.isInteger(persist.ttlSeconds) || persist.ttlSeconds <= 0)
22
- ) {
19
+ return { persist: true, ...ttlFields(persist.ttlSeconds) };
20
+ }
21
+
22
+ /** The ttlSeconds wire field of a persisted capture, checked before it is sent. */
23
+ export function ttlFields(ttlSeconds: number | undefined): { ttlSeconds?: number } {
24
+ if (ttlSeconds === undefined) {
25
+ return {};
26
+ }
27
+ if (!Number.isInteger(ttlSeconds) || ttlSeconds <= 0) {
23
28
  throw new Error('ttlSeconds must be a positive integer');
24
29
  }
25
- return { persist: true, ...(persist.ttlSeconds !== undefined && { ttlSeconds: persist.ttlSeconds }) };
30
+ return { ttlSeconds };
26
31
  }
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Long-lived tail of a runtime session SSE stream (live app logs or the
3
- * coalesced event log). The runtime replays its buffer on first connect and
4
- * tags every entry with a monotonic SSE id; eventsource-client sends
5
- * Last-Event-ID on reconnect, so the runtime resumes exactly where the
6
- * stream broke and each entry is delivered exactly once.
2
+ * Long-lived tail of a runtime session SSE stream (live app logs, the
3
+ * coalesced event log, or iOS app performance samples). The runtime replays
4
+ * its buffer on first connect and tags every entry with a monotonic SSE id;
5
+ * eventsource-client sends Last-Event-ID on reconnect, so the runtime resumes
6
+ * exactly where the stream broke and each entry is delivered exactly once,
7
+ * as long as the entries are still in the runtime's buffer.
7
8
  *
8
9
  * Stream health follows the exec client's model (and reuses its policy): the
9
10
  * EventSource reconnects forever on its own, so a dead stream (deleted
package/src/ios-client.ts CHANGED
@@ -31,9 +31,9 @@ import {
31
31
  type StartForwardHttpProxyOptions,
32
32
  } from './http-proxy';
33
33
  import { startXcrunShim as startClientXcrunShim } from './ios-shim';
34
- import { persistFields, type PersistOption } from './internal/persist-option';
34
+ import { persistFields, ttlFields, type PersistOption } from './internal/persist-option';
35
35
  import { streamSessionEntries } from './internal/session-stream';
36
- import type { SessionLogLine, SessionEvent } from './resources/session-artifacts';
36
+ import type { SessionLogLine, SessionEvent, PerformanceSample } from './resources/session-artifacts';
37
37
  import { LogStream } from './log-stream';
38
38
 
39
39
  export { type PersistOption } from './internal/persist-option';
@@ -540,6 +540,8 @@ export type AppHangCallback = (info: AppHangInfo) => Promise<void> | void;
540
540
  type LaunchAppCommonOptions = {
541
541
  /** App environment variables. Requires relaunch; reserved keys and existing launch variables are ignored. */
542
542
  env?: Record<string, string>;
543
+ /** Secret references resolved on the simulator before launching the app. */
544
+ envFromSecret?: Record<string, string>;
543
545
  /** Called once when the launched app exits, crashes, or is terminated. */
544
546
  onExit?: LaunchAppExitCallback;
545
547
  /**
@@ -1085,6 +1087,31 @@ export type InstanceClient = {
1085
1087
  onError?: (error: Error) => void;
1086
1088
  }) => () => void;
1087
1089
 
1090
+ /**
1091
+ * Start saving the running apps' {@link PerformanceSample}s. The instance
1092
+ * samples whether or not anything listens, so this capture always persists:
1093
+ * it is uploaded to Limrun's bucket when it stops or the instance
1094
+ * terminates, kept for `ttlSeconds` (server default 72h); list it with
1095
+ * `iosInstances.listPerformanceCaptures`. One performance capture runs at a
1096
+ * time; the server rejects a second start.
1097
+ */
1098
+ startPerformanceCapture: (options?: { ttlSeconds?: number }) => Promise<void>;
1099
+
1100
+ /** Stop the active performance capture and upload it. */
1101
+ stopPerformanceCapture: () => Promise<void>;
1102
+
1103
+ /**
1104
+ * Tail the running apps' {@link PerformanceSample}s; no capture is needed.
1105
+ * On connect the instance replays its recent samples, so a late subscriber
1106
+ * still sees history. Same reconnect and lifecycle semantics as
1107
+ * {@link streamAppLogCapture}, except that a gap longer than the replay
1108
+ * window loses the samples in between.
1109
+ */
1110
+ streamPerformance: (handlers: {
1111
+ onSample: (sample: PerformanceSample) => void;
1112
+ onError?: (error: Error) => void;
1113
+ }) => () => void;
1114
+
1088
1115
  /**
1089
1116
  * Play an audio file as the simulator's microphone input. Stage the file on
1090
1117
  * the instance first with `pushFile` (no bundle ID); `path` is the same
@@ -1510,6 +1537,7 @@ type PendingRequest<T> = {
1510
1537
  * Options for a simctl execution
1511
1538
  */
1512
1539
  export type SimctlOptions = {
1540
+ envFromSecret?: Record<string, string>;
1513
1541
  /** Disconnect from the instance when the command completes */
1514
1542
  disconnectOnExit?: boolean;
1515
1543
  /** Data written to the command's standard input, which is then closed */
@@ -1518,6 +1546,7 @@ export type SimctlOptions = {
1518
1546
 
1519
1547
  // Simctl uses streaming, so it's handled separately
1520
1548
  type SimctlRequest = {
1549
+ envFromSecret?: Record<string, string>;
1521
1550
  type: 'simctl';
1522
1551
  id: string;
1523
1552
  args: string[];
@@ -2135,6 +2164,8 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2135
2164
  stopAppLogCaptureResult: () => undefined,
2136
2165
  startEventCaptureResult: () => undefined,
2137
2166
  stopEventCaptureResult: () => undefined,
2167
+ startPerformanceCaptureResult: () => undefined,
2168
+ stopPerformanceCaptureResult: () => undefined,
2138
2169
  cameraControlResult: () => undefined,
2139
2170
  playOnMicrophoneResult: (msg): IosPlayOnMicrophoneResult => ({
2140
2171
  duration: msg.duration ?? 0,
@@ -2345,6 +2376,9 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2345
2376
  stopEventCapture,
2346
2377
  streamAppLogCapture,
2347
2378
  streamEventCapture,
2379
+ startPerformanceCapture,
2380
+ stopPerformanceCapture,
2381
+ streamPerformance,
2348
2382
  playOnMicrophone,
2349
2383
  stopMicrophonePlayback,
2350
2384
  microphoneStatus,
@@ -2562,7 +2596,9 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2562
2596
  'launchApp runtime launches require RelaunchIfRunning so runtime injection is applied.',
2563
2597
  );
2564
2598
  }
2565
- const hasEnvironment = Object.keys(launchOptions.env ?? {}).length > 0;
2599
+ const hasEnvironment =
2600
+ Object.keys(launchOptions.env ?? {}).length > 0 ||
2601
+ Object.keys(launchOptions.envFromSecret ?? {}).length > 0;
2566
2602
  const mode =
2567
2603
  launchOptions.runtime ? 'RelaunchIfRunning' : (
2568
2604
  launchOptions.mode ?? (hasEnvironment ? 'RelaunchIfRunning' : undefined)
@@ -2579,15 +2615,21 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2579
2615
  });
2580
2616
  }
2581
2617
  try {
2582
- await sendRequest<void>('launchApp', {
2583
- bundleId,
2584
- mode,
2585
- runtime: launchOptions.runtime,
2586
- env: launchOptions.env,
2587
- execId,
2588
- // Sent only with onHang so other launches stay byte-identical.
2589
- hangs: onHang ? true : undefined,
2590
- });
2618
+ await sendRequest<void>(
2619
+ 'launchApp',
2620
+ {
2621
+ bundleId,
2622
+ mode,
2623
+ runtime: launchOptions.runtime,
2624
+ env: launchOptions.env,
2625
+ envFromSecret: launchOptions.envFromSecret,
2626
+ execId,
2627
+ // Sent only with onHang so other launches stay byte-identical.
2628
+ hangs: onHang ? true : undefined,
2629
+ },
2630
+ undefined,
2631
+ 90000,
2632
+ );
2591
2633
  } catch (error) {
2592
2634
  if (execId) {
2593
2635
  deleteServerNotification('appExit', execId);
@@ -2860,8 +2902,11 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2860
2902
  });
2861
2903
  };
2862
2904
 
2905
+ // A stop answers once its persisted capture is uploaded, which grows with the capture's length.
2906
+ const captureStopTimeoutMs = 300_000;
2907
+
2863
2908
  const stopAppLogCapture = async (): Promise<void> => {
2864
- await sendRequest<void>('stopAppLogCapture');
2909
+ await sendRequest<void>('stopAppLogCapture', {}, undefined, captureStopTimeoutMs);
2865
2910
  };
2866
2911
 
2867
2912
  const startEventCapture = async (opts?: { persist?: PersistOption }): Promise<void> => {
@@ -2869,30 +2914,43 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2869
2914
  };
2870
2915
 
2871
2916
  const stopEventCapture = async (): Promise<void> => {
2872
- await sendRequest<void>('stopEventCapture');
2917
+ await sendRequest<void>('stopEventCapture', {}, undefined, captureStopTimeoutMs);
2873
2918
  };
2874
2919
 
2920
+ const startPerformanceCapture = async (opts?: { ttlSeconds?: number }): Promise<void> => {
2921
+ await sendRequest<void>('startPerformanceCapture', ttlFields(opts?.ttlSeconds));
2922
+ };
2923
+
2924
+ const stopPerformanceCapture = async (): Promise<void> => {
2925
+ await sendRequest<void>('stopPerformanceCapture', {}, undefined, captureStopTimeoutMs);
2926
+ };
2927
+
2928
+ const tailSession = <T extends { ts: number }>(
2929
+ stream: 'applogs' | 'events' | 'performance',
2930
+ onEntry: (entry: T) => void,
2931
+ onError?: (error: Error) => void,
2932
+ ): (() => void) =>
2933
+ streamSessionEntries<T>({
2934
+ url: `${options.apiUrl}/session/${stream}/events`,
2935
+ token: options.token,
2936
+ onEntry,
2937
+ onError,
2938
+ });
2939
+
2875
2940
  const streamAppLogCapture = (handlers: {
2876
2941
  onLine: (line: SessionLogLine) => void;
2877
2942
  onError?: (error: Error) => void;
2878
- }): (() => void) =>
2879
- streamSessionEntries<SessionLogLine>({
2880
- url: `${options.apiUrl}/session/applogs/events`,
2881
- token: options.token,
2882
- onEntry: handlers.onLine,
2883
- onError: handlers.onError,
2884
- });
2943
+ }): (() => void) => tailSession('applogs', handlers.onLine, handlers.onError);
2885
2944
 
2886
2945
  const streamEventCapture = (handlers: {
2887
2946
  onEvent: (event: SessionEvent) => void;
2888
2947
  onError?: (error: Error) => void;
2889
- }): (() => void) =>
2890
- streamSessionEntries<SessionEvent>({
2891
- url: `${options.apiUrl}/session/events/events`,
2892
- token: options.token,
2893
- onEntry: handlers.onEvent,
2894
- onError: handlers.onError,
2895
- });
2948
+ }): (() => void) => tailSession('events', handlers.onEvent, handlers.onError);
2949
+
2950
+ const streamPerformance = (handlers: {
2951
+ onSample: (sample: PerformanceSample) => void;
2952
+ onError?: (error: Error) => void;
2953
+ }): (() => void) => tailSession('performance', handlers.onSample, handlers.onError);
2896
2954
 
2897
2955
  const stopRecording = async (saveTo: { presignedUrl?: string; localPath?: string }): Promise<string> => {
2898
2956
  await sendRequest<void>('stopVideoRecording', {
@@ -3088,6 +3146,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
3088
3146
 
3089
3147
  const simctlRequest: SimctlRequest = {
3090
3148
  type: 'simctl',
3149
+ ...(opts.envFromSecret && { envFromSecret: opts.envFromSecret }),
3091
3150
  id,
3092
3151
  args,
3093
3152
  ...(opts.stdin !== undefined && { stdin: Buffer.from(opts.stdin).toString('base64') }),
@@ -77,10 +77,18 @@ export namespace AndroidInstance {
77
77
  labels?: { [key: string]: string };
78
78
 
79
79
  terminatedAt?: string;
80
+
81
+ /**
82
+ * Billing cutoff for a deletion requested while the region is unavailable.
83
+ * Absent for normal regional deletions.
84
+ */
85
+ terminatingAt?: string;
80
86
  }
81
87
 
82
88
  export interface Spec {
83
89
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
90
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
91
+ envFromSecret?: Record<string, string>;
84
92
  role?: { permissions: string[] };
85
93
 
86
94
  /**
@@ -118,7 +126,7 @@ export namespace AndroidInstance {
118
126
  */
119
127
  token?: string;
120
128
 
121
- state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminated';
129
+ state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminating' | 'terminated';
122
130
 
123
131
  adbWebSocketUrl?: string;
124
132
 
@@ -145,13 +153,15 @@ export namespace AndroidInstance {
145
153
  targetHttpPortUrlPrefix?: string;
146
154
 
147
155
  /**
148
- * Machine-readable reason the instance was terminated. Always present once state
149
- * is "terminated", never present before that. New values may be added over time,
150
- * so treat any unrecognized value as "Unknown". Known values:
156
+ * Machine-readable reason for instance termination. Present when state is
157
+ * "terminating" or "terminated". New values may be added over time, so treat any
158
+ * unrecognized value as "Unknown". Known values:
151
159
  *
152
160
  * - "UserRequested": terminated by a delete request to the API.
153
161
  * - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
154
162
  * - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
163
+ * - "CapacityTimeout": no instance was free when it was created, and none freed
164
+ * up before its wait for capacity ended.
155
165
  * - "Unknown": terminated for a cause the platform did not attribute, including
156
166
  * instances that failed to get ready during creation. See errorMessage for
157
167
  * details when available.
@@ -178,7 +188,9 @@ export interface AndroidInstanceUpdateParams {
178
188
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
179
189
  metadata?: { labels: { [key: string]: string } };
180
190
  spec?: {
181
- role: {
191
+ /** Replaces saved bindings. Use {} to clear them. */
192
+ envFromSecret?: Record<string, string>;
193
+ role?: {
182
194
  /** Replaces the complete list. Use [] to remove delegated permissions. */
183
195
  permissions: string[];
184
196
  };
@@ -217,6 +229,8 @@ export namespace AndroidInstanceCreateParams {
217
229
 
218
230
  export interface Spec {
219
231
  /** Inline instance role. Omit for the organization's compatibility default. */
232
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
233
+ envFromSecret?: Record<string, string>;
220
234
  role?: {
221
235
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
222
236
  permissions: Array<string>;
@@ -95,6 +95,9 @@ export type BuildRunOptions = {
95
95
  cwd?: string;
96
96
  /** Extra KEY=VALUE entries. Sandbox paths remain managed; the last repeated user entry wins. */
97
97
  env?: string[];
98
+ /** Secret references resolved by the workload; overrides saved bindings for this operation. */
99
+ envFromSecret?: Record<string, string>;
100
+ fileFromSecret?: Record<string, string>;
98
101
  /** Command timeout in seconds, from 1 to 21600. Defaults to 3600. */
99
102
  timeoutSeconds?: number;
100
103
  };
@@ -116,6 +119,8 @@ export function createBuildRun(execOptions: ExecOptions) {
116
119
  commandLine,
117
120
  cwd: options?.cwd ?? '.',
118
121
  ...(options?.env?.length && { env: options.env }),
122
+ ...(options?.envFromSecret && { envFromSecret: options.envFromSecret }),
123
+ ...(options?.fileFromSecret && { fileFromSecret: options.fileFromSecret }),
119
124
  ...(options?.timeoutSeconds !== undefined && { timeoutSeconds: options.timeoutSeconds }),
120
125
  };
121
126
  return exec(request, execOptions);
@@ -67,6 +67,9 @@ export type GradleSyncOptions = {
67
67
  export type GradleBuildOptions = {
68
68
  /** Extra KEY=VALUE entries shared by all build phases; sandbox paths remain managed. */
69
69
  env?: string[];
70
+ /** Secret references resolved by the workload; overrides saved bindings for this operation. */
71
+ envFromSecret?: Record<string, string>;
72
+ fileFromSecret?: Record<string, string>;
70
73
  /**
71
74
  * Gradle tasks to run. Omit for the server default (assembleDebug, or
72
75
  * bundleRelease when signing is set).
@@ -250,6 +253,8 @@ class GradleInstancesHelpers extends GradleInstances {
250
253
  const request: GradleBuildExecRequest = {
251
254
  command: 'gradlebuild',
252
255
  ...(options?.env?.length && { env: options.env }),
256
+ ...(options?.envFromSecret && { envFromSecret: options.envFromSecret }),
257
+ ...(options?.fileFromSecret && { fileFromSecret: options.fileFromSecret }),
253
258
  ...(options?.tasks?.length && { tasks: options.tasks }),
254
259
  ...(options?.projectPath && { projectPath: options.projectPath }),
255
260
  ...(options?.reactNative && { reactNative: options.reactNative }),
@@ -78,10 +78,19 @@ export namespace GradleInstance {
78
78
  labels?: { [key: string]: string };
79
79
 
80
80
  terminatedAt?: string;
81
+
82
+ /**
83
+ * Billing cutoff for a deletion requested while the region is unavailable.
84
+ * Absent for normal regional deletions.
85
+ */
86
+ terminatingAt?: string;
81
87
  }
82
88
 
83
89
  export interface Spec {
84
90
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
91
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
92
+ envFromSecret?: Record<string, string>;
93
+ fileFromSecret?: Record<string, string>;
85
94
  role?: { permissions: string[] };
86
95
 
87
96
  inactivityTimeout: string;
@@ -99,20 +108,22 @@ export namespace GradleInstance {
99
108
  */
100
109
  token?: string;
101
110
 
102
- state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminated';
111
+ state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminating' | 'terminated';
103
112
 
104
113
  apiUrl?: string;
105
114
 
106
115
  errorMessage?: string;
107
116
 
108
117
  /**
109
- * Machine-readable reason the instance was terminated. Always present once state
110
- * is "terminated", never present before that. New values may be added over time,
111
- * so treat any unrecognized value as "Unknown". Known values:
118
+ * Machine-readable reason for instance termination. Present when state is
119
+ * "terminating" or "terminated". New values may be added over time, so treat any
120
+ * unrecognized value as "Unknown". Known values:
112
121
  *
113
122
  * - "UserRequested": terminated by a delete request to the API.
114
123
  * - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
115
124
  * - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
125
+ * - "CapacityTimeout": no instance was free when it was created, and none freed
126
+ * up before its wait for capacity ended.
116
127
  * - "Unknown": terminated for a cause the platform did not attribute, including
117
128
  * instances that failed to get ready during creation. See errorMessage for
118
129
  * details when available.
@@ -127,7 +138,10 @@ export interface GradleInstanceUpdateParams {
127
138
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
128
139
  metadata?: { labels: { [key: string]: string } };
129
140
  spec?: {
130
- role: {
141
+ /** Replaces saved bindings. Use {} to clear them. */
142
+ envFromSecret?: Record<string, string>;
143
+ fileFromSecret?: Record<string, string>;
144
+ role?: {
131
145
  /** Replaces the complete list. Use [] to remove delegated permissions. */
132
146
  permissions: string[];
133
147
  };
@@ -166,6 +180,9 @@ export namespace GradleInstanceCreateParams {
166
180
 
167
181
  export interface Spec {
168
182
  /** Inline instance role. Omit for the organization's compatibility default. */
183
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
184
+ envFromSecret?: Record<string, string>;
185
+ fileFromSecret?: Record<string, string>;
169
186
  role?: {
170
187
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
171
188
  permissions: Array<string>;
@@ -66,6 +66,8 @@ export {
66
66
  type SessionLogLine,
67
67
  type SessionEvent,
68
68
  type SessionEventType,
69
+ type PerformanceSample,
70
+ type PerformanceThread,
69
71
  } from './session-artifacts';
70
72
  export {
71
73
  XcodeInstances,
@@ -117,3 +119,5 @@ export {
117
119
  type AccessTokenCreateParams,
118
120
  type AccessTokenRevokeResponse,
119
121
  } from './access-tokens';
122
+
123
+ export * from './secrets';
@@ -42,4 +42,11 @@ export class IosInstances extends GeneratedIosInstances {
42
42
  listEvents(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]> {
43
43
  return this.listSessionArtifacts(id, 'eventLog', options);
44
44
  }
45
+
46
+ /**
47
+ * List the instance's persisted performance captures.
48
+ */
49
+ listPerformanceCaptures(id: string, options?: RequestOptions): APIPromise<SessionArtifact[]> {
50
+ return this.listSessionArtifacts(id, 'performance', options);
51
+ }
45
52
  }
@@ -77,10 +77,18 @@ export namespace IosInstance {
77
77
  labels?: { [key: string]: string };
78
78
 
79
79
  terminatedAt?: string;
80
+
81
+ /**
82
+ * Billing cutoff for a deletion requested while the region is unavailable.
83
+ * Absent for normal regional deletions.
84
+ */
85
+ terminatingAt?: string;
80
86
  }
81
87
 
82
88
  export interface Spec {
83
89
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
90
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
91
+ envFromSecret?: Record<string, string>;
84
92
  role?: { permissions: string[] };
85
93
 
86
94
  /**
@@ -118,7 +126,7 @@ export namespace IosInstance {
118
126
  */
119
127
  token?: string;
120
128
 
121
- state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminated';
129
+ state: 'unknown' | 'creating' | 'assigned' | 'ready' | 'terminating' | 'terminated';
122
130
 
123
131
  apiUrl?: string;
124
132
 
@@ -141,13 +149,15 @@ export namespace IosInstance {
141
149
  targetHttpPortUrlPrefix?: string;
142
150
 
143
151
  /**
144
- * Machine-readable reason the instance was terminated. Always present once state
145
- * is "terminated", never present before that. New values may be added over time,
146
- * so treat any unrecognized value as "Unknown". Known values:
152
+ * Machine-readable reason for instance termination. Present when state is
153
+ * "terminating" or "terminated". New values may be added over time, so treat any
154
+ * unrecognized value as "Unknown". Known values:
147
155
  *
148
156
  * - "UserRequested": terminated by a delete request to the API.
149
157
  * - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
150
158
  * - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
159
+ * - "CapacityTimeout": no instance was free when it was created, and none freed
160
+ * up before its wait for capacity ended.
151
161
  * - "Unknown": terminated for a cause the platform did not attribute, including
152
162
  * instances that failed to get ready during creation. See errorMessage for
153
163
  * details when available.
@@ -162,7 +172,9 @@ export interface IosInstanceUpdateParams {
162
172
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
163
173
  metadata?: { labels: { [key: string]: string } };
164
174
  spec?: {
165
- role: {
175
+ /** Replaces saved bindings. Use {} to clear them. */
176
+ envFromSecret?: Record<string, string>;
177
+ role?: {
166
178
  /** Replaces the complete list. Use [] to remove delegated permissions. */
167
179
  permissions: string[];
168
180
  };
@@ -201,6 +213,8 @@ export namespace IosInstanceCreateParams {
201
213
 
202
214
  export interface Spec {
203
215
  /** Inline instance role. Omit for the organization's compatibility default. */
216
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
217
+ envFromSecret?: Record<string, string>;
204
218
  role?: {
205
219
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
206
220
  permissions: Array<string>;