@nonstrict/recordkit 0.87.1 → 0.97.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 (54) hide show
  1. package/bin/README.md +1 -1
  2. package/bin/recordkit-rpc +0 -0
  3. package/out/Errors.d.ts +91 -0
  4. package/out/Errors.js +63 -0
  5. package/out/Errors.js.map +1 -0
  6. package/out/InputEvents.d.ts +661 -0
  7. package/out/InputEvents.js +8 -0
  8. package/out/InputEvents.js.map +1 -0
  9. package/out/IpcRecordKit.js +13 -0
  10. package/out/IpcRecordKit.js.map +1 -1
  11. package/out/NonstrictRPC.d.ts +9 -0
  12. package/out/NonstrictRPC.js +27 -4
  13. package/out/NonstrictRPC.js.map +1 -1
  14. package/out/RecordKit.d.ts +267 -5
  15. package/out/RecordKit.js +243 -3
  16. package/out/RecordKit.js.map +1 -1
  17. package/out/Recorder.d.ts +451 -53
  18. package/out/Recorder.js +80 -2
  19. package/out/Recorder.js.map +1 -1
  20. package/out/RecordingMetadata.d.ts +96 -0
  21. package/out/RecordingMetadata.js +12 -0
  22. package/out/RecordingMetadata.js.map +1 -0
  23. package/out/WebAudioUtils.d.ts +35 -0
  24. package/out/WebAudioUtils.js +37 -0
  25. package/out/WebAudioUtils.js.map +1 -1
  26. package/out/WindowLevels.d.ts +46 -0
  27. package/out/WindowLevels.js +41 -0
  28. package/out/WindowLevels.js.map +1 -0
  29. package/out/browser.d.ts +8 -1
  30. package/out/browser.js +3 -1
  31. package/out/browser.js.map +1 -1
  32. package/out/index.cjs +603 -9
  33. package/out/index.cjs.map +1 -1
  34. package/out/index.d.ts +8 -0
  35. package/out/index.js +3 -0
  36. package/out/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/Errors.test.ts +38 -0
  39. package/src/Errors.ts +151 -0
  40. package/src/InputEvents.ts +695 -0
  41. package/src/IpcRecordKit.ts +12 -0
  42. package/src/NonstrictRPC.test.ts +24 -1
  43. package/src/NonstrictRPC.ts +29 -5
  44. package/src/RecordKit.ts +347 -11
  45. package/src/Recorder.schema.test.ts +167 -0
  46. package/src/Recorder.ts +558 -80
  47. package/src/RecordingMetadata.ts +125 -0
  48. package/src/WebAudioUtils.test.ts +78 -0
  49. package/src/WebAudioUtils.ts +57 -1
  50. package/src/WindowLevels.test.ts +34 -0
  51. package/src/WindowLevels.ts +47 -0
  52. package/src/browser.ts +12 -2
  53. package/src/index.ts +8 -0
  54. package/src/__snapshots__/NonstrictRPC.test.ts.snap +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRecordKit.js","sourceRoot":"","sources":["../src/IpcRecordKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,OAAO,YAAY;IACf,YAAY,CAAgB;IAC3B,KAAK,CAAQ;IAEtB;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,gBAAwB,EAAE,cAAuB,KAAK;QACrE,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;QAAC,CAAC;QAEjG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtE,MAAM,YAAY,GAAG,KAAK,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAA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M,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAAC,CAAC;QAE1F,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC9D,OAAO,CAAC,GAAG,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,OAAe;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAAC,CAAC;QAC5E,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;QAAC,CAAC;QAC3G,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;CACF"}
@@ -11,7 +11,16 @@ export declare class NSRPC {
11
11
  private readonly send;
12
12
  private responseHandlers;
13
13
  private closureTargets;
14
+ private terminationError?;
14
15
  constructor(send: (data: string) => void);
16
+ /**
17
+ * Marks the RPC connection as permanently gone, e.g. because the external process exited.
18
+ *
19
+ * All in-flight requests are rejected with the given error and any future request fails
20
+ * immediately with the same error, instead of waiting forever for a response that can no
21
+ * longer arrive.
22
+ */
23
+ terminate(error: Error): void;
15
24
  receive(data: string): void;
16
25
  private sendMessage;
17
26
  private sendResponse;
@@ -5,9 +5,25 @@ export class NSRPC {
5
5
  send;
6
6
  responseHandlers = new Map();
7
7
  closureTargets = new Map();
8
+ terminationError;
8
9
  constructor(send) {
9
10
  this.send = send;
10
11
  }
12
+ /**
13
+ * Marks the RPC connection as permanently gone, e.g. because the external process exited.
14
+ *
15
+ * All in-flight requests are rejected with the given error and any future request fails
16
+ * immediately with the same error, instead of waiting forever for a response that can no
17
+ * longer arrive.
18
+ */
19
+ terminate(error) {
20
+ this.terminationError = error;
21
+ const pendingHandlers = [...this.responseHandlers.values()];
22
+ this.responseHandlers.clear();
23
+ for (const handler of pendingHandlers) {
24
+ handler.reject(error);
25
+ }
26
+ }
11
27
  receive(data) {
12
28
  // TODO: For now we just assume the message is a valid NSRPC message, but we should:
13
29
  // - Check if the nsrpc property is set to a number in the range of 1..<2
@@ -63,6 +79,9 @@ export class NSRPC {
63
79
  this.sendMessage({ ...response, nsrpc: 1, id });
64
80
  }
65
81
  async sendRequest(request) {
82
+ if (this.terminationError !== undefined) {
83
+ throw this.terminationError;
84
+ }
66
85
  const id = "req_" + randomUUID();
67
86
  const response = new Promise((resolve, reject) => {
68
87
  this.responseHandlers.set(id, { resolve, reject });
@@ -137,16 +156,20 @@ export class NSRPC {
137
156
  }
138
157
  /* Perform remote procedures */
139
158
  async initialize(args) {
140
- const target = args.target;
141
- finalizationRegistry.register(args.lifecycle, async () => {
142
- await this.release(target);
143
- });
144
159
  await this.sendRequest({
145
160
  target: args.target,
146
161
  type: args.type,
147
162
  params: args.params,
148
163
  procedure: "init",
149
164
  });
165
+ // Register the GC release only after a successful init; registering earlier would later send a
166
+ // release for a target the external process never knew about.
167
+ const target = args.target;
168
+ finalizationRegistry.register(args.lifecycle, () => {
169
+ // Swallow rejections: the external process may already be gone, in which case there is
170
+ // nothing left to release.
171
+ this.release(target).catch(() => { });
172
+ });
150
173
  }
151
174
  async perform(body) {
152
175
  return await this.sendRequest({
@@ -1 +1 @@
1
- {"version":3,"file":"NonstrictRPC.js","sourceRoot":"","s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AAM,IAAI,UAAU,EAAE,EAAE,CAAC;QAC1D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEjD,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE;YACpD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import { Recorder, RecorderSchemaItem } from "./Recorder.js";
3
- import type { SystemAudioBackend } from "./Recorder.js";
3
+ import type { SystemAudioBackend, RecorderSettings, Size } from "./Recorder.js";
4
4
  import { EventEmitter } from "events";
5
5
  /**
6
6
  * Entry point for the RecordKit SDK, an instance is available as `recordkit` that can be imported from the module. Do not instantiate this class directly.
@@ -13,6 +13,15 @@ import { EventEmitter } from "events";
13
13
  *
14
14
  * @groupDescription Logging
15
15
  * Log what's going on to the console for easy debugging and troubleshooting. See the [Logging and Error Handling guide](https://recordkit.dev/guides/logging-and-errors) for more information.
16
+ *
17
+ * @groupDescription Preferred Devices
18
+ * Read and update the user's preferred devices, so you can pre-select sensible defaults in your UI.
19
+ *
20
+ * @groupDescription Window Control
21
+ * Move, resize, center and maximize windows of other applications (requires Accessibility Control permission).
22
+ *
23
+ * @groupDescription Device Control
24
+ * Configure capture devices, such as selecting a camera's active format or fetching an application's icon.
16
25
  */
17
26
  export declare class RecordKit extends EventEmitter {
18
27
  private ipcRecordKit;
@@ -101,6 +110,158 @@ export declare class RecordKit extends EventEmitter {
101
110
  * @group Discovery
102
111
  */
103
112
  getRunningApplications(): Promise<RunningApplication[]>;
113
+ /**
114
+ * The user's preferred devices for each source type, ordered most-preferred first.
115
+ *
116
+ * RecordKit remembers which devices the user last recorded with (unless disabled via the recorder's
117
+ * `updatesUserPreferred` setting). Use this to pre-select a sensible default device in your UI.
118
+ *
119
+ * @group Preferred Devices
120
+ */
121
+ getUserPreferred(): Promise<UserPreferred>;
122
+ /**
123
+ * Records the given microphone as the user's most-preferred microphone.
124
+ *
125
+ * Call this whenever the user manually selects a microphone, so it can be pre-selected later via
126
+ * {@link getUserPreferred}. The selection moves to the front of {@link UserPreferred.microphoneIDs}.
127
+ *
128
+ * @param microphone - The microphone to prefer, either a {@link Microphone} or its {@link Microphone.id}.
129
+ * @group Preferred Devices
130
+ */
131
+ updatePreferredMicrophone(microphone: Microphone | string): Promise<void>;
132
+ /**
133
+ * Records the given camera as the user's most-preferred camera.
134
+ *
135
+ * Call this whenever the user manually selects a camera, so it can be pre-selected later via
136
+ * {@link getUserPreferred}. The selection moves to the front of {@link UserPreferred.cameraIDs}.
137
+ *
138
+ * @param camera - The camera to prefer, either a {@link Camera} or its {@link Camera.id}.
139
+ * @group Preferred Devices
140
+ */
141
+ updatePreferredCamera(camera: Camera | string): Promise<void>;
142
+ /**
143
+ * Records the given display as the user's most-preferred display.
144
+ *
145
+ * Call this whenever the user manually selects a display, so it can be pre-selected later via
146
+ * {@link getUserPreferred}. The selection moves to the front of {@link UserPreferred.displayIDs}.
147
+ *
148
+ * @param display - The display to prefer, either a {@link Display} or its {@link Display.id}.
149
+ * @group Preferred Devices
150
+ */
151
+ updatePreferredDisplay(display: Display | number): Promise<void>;
152
+ /**
153
+ * Records the given Apple device as the user's most-preferred Apple device.
154
+ *
155
+ * Call this whenever the user manually selects an Apple device, so it can be pre-selected later via
156
+ * {@link getUserPreferred}. The selection moves to the front of {@link UserPreferred.appleDeviceIDs}.
157
+ *
158
+ * @param device - The Apple device to prefer, either an {@link AppleDevice} or its {@link AppleDevice.id}.
159
+ * @group Preferred Devices
160
+ */
161
+ updatePreferredAppleDevice(device: AppleDevice | string): Promise<void>;
162
+ /**
163
+ * Maximizes the given window, resizing it to fill the display's visible area (excluding the menu bar and Dock)
164
+ * and centering it on that display.
165
+ *
166
+ * Requires Accessibility Control permission (see {@link getAccessibilityControlAccess}).
167
+ *
168
+ * @remarks
169
+ * Rejects if the window cannot be maximized — typically because Accessibility permission is missing,
170
+ * the target display cannot be found, or the window is minimized or closed.
171
+ *
172
+ * @param window - The window to maximize, either a {@link Window} or its {@link Window.id}.
173
+ * @param options.display - The display to maximize onto, either a {@link Display} or its {@link Display.id}. Defaults to the window's current display.
174
+ * @group Window Control
175
+ */
176
+ maximizeWindow(window: Window | number, options?: {
177
+ display?: Display | number;
178
+ }): Promise<void>;
179
+ /**
180
+ * Resizes the given window to the given size (in points), keeping it centered on its display.
181
+ *
182
+ * Requires Accessibility Control permission (see {@link getAccessibilityControlAccess}).
183
+ *
184
+ * @remarks
185
+ * The requested size is clipped to the display's visible frame if it would be larger. After resizing,
186
+ * the window is re-centered so that a window which could not shrink/grow to the requested size still
187
+ * ends up centered. Rejects if Accessibility permission is missing, the target display cannot be found,
188
+ * or the window is minimized, closed, or does not support resizing.
189
+ *
190
+ * @param window - The window to resize, either a {@link Window} or its {@link Window.id}.
191
+ * @param size - The new size in points.
192
+ * @param options.display - The display to center on, either a {@link Display} or its {@link Display.id}. Defaults to the window's current display.
193
+ * @group Window Control
194
+ */
195
+ resizeWindow(window: Window | number, size: Size, options?: {
196
+ display?: Display | number;
197
+ }): Promise<void>;
198
+ /**
199
+ * Centers the given window within the visible area (excluding the menu bar and Dock) of its display,
200
+ * keeping its current size.
201
+ *
202
+ * Requires Accessibility Control permission (see {@link getAccessibilityControlAccess}).
203
+ *
204
+ * @remarks
205
+ * Rejects if Accessibility permission is missing, the target display cannot be found, or the window is
206
+ * minimized, closed, or does not support moving.
207
+ *
208
+ * @param window - The window to center, either a {@link Window} or its {@link Window.id}.
209
+ * @param options.display - The display to center on, either a {@link Display} or its {@link Display.id}. Defaults to the window's current display.
210
+ * @group Window Control
211
+ */
212
+ centerWindow(window: Window | number, options?: {
213
+ display?: Display | number;
214
+ }): Promise<void>;
215
+ /**
216
+ * Moves the given window so its top-left corner is at the given position (in points, top-left origin).
217
+ *
218
+ * Requires Accessibility Control permission (see {@link getAccessibilityControlAccess}).
219
+ *
220
+ * @remarks
221
+ * Rejects if Accessibility permission is missing, or the window is minimized, closed, or does not
222
+ * support moving.
223
+ *
224
+ * @param window - The window to move, either a {@link Window} or its {@link Window.id}.
225
+ * @param position - The new top-left origin for the window, in points (top-left coordinate space).
226
+ * @group Window Control
227
+ */
228
+ moveWindow(window: Window | number, position: {
229
+ x: number;
230
+ y: number;
231
+ }): Promise<void>;
232
+ /**
233
+ * Selects the camera's active capture format that best matches the given dimensions (in pixels).
234
+ *
235
+ * Use this when you want the camera to deliver a specific resolution — typically before recording or
236
+ * before showing a live preview, so the preview renders at the intended resolution. The format stays
237
+ * in effect until something else changes it.
238
+ *
239
+ * The chosen format is the smallest format whose dimensions are ≥ the target, preferring biplanar YUV
240
+ * pixel formats, and falling back to the largest available format if nothing meets the target.
241
+ *
242
+ * @remarks
243
+ * Rejects if the camera is unavailable, has no usable video format, or its configuration is locked by
244
+ * another process.
245
+ *
246
+ * @param camera - The camera to configure, either a {@link Camera} or its {@link Camera.id}.
247
+ * @param dimensions - Target dimensions in pixels.
248
+ * @group Device Control
249
+ */
250
+ setCameraActiveFormat(camera: Camera | string, dimensions: Size): Promise<void>;
251
+ /**
252
+ * Returns the camera capture format that {@link setCameraActiveFormat} would select for the given
253
+ * dimensions (in pixels), without applying it. Returns `undefined` if the camera has no suitable format.
254
+ *
255
+ * @group Device Control
256
+ */
257
+ getCameraBestFormat(camera: Camera | string, dimensions: Size): Promise<CameraFormat | undefined>;
258
+ /**
259
+ * Returns the icon of the given running application as a `data:image/png;base64,...` URL,
260
+ * usable directly as the `src` of an HTML `<img>` tag.
261
+ *
262
+ * @group Device Control
263
+ */
264
+ getApplicationIcon(application: RunningApplication | number): Promise<string>;
104
265
  /**
105
266
  * Indicates if camera can be used.
106
267
  *
@@ -131,6 +292,19 @@ export declare class RecordKit extends EventEmitter {
131
292
  getSystemAudioRecordingAccess(options?: {
132
293
  backend?: SystemAudioPermissionBackend;
133
294
  }): Promise<boolean>;
295
+ /**
296
+ * Probes whether system audio can actually be recorded with the given backend by attempting a short silent capture.
297
+ *
298
+ * Unlike {@link getSystemAudioRecordingAccess}, which reads the recorded permission state, this verifies the
299
+ * permission is truly usable, immediately detecting cases where the OS reports a permission as granted but
300
+ * capture would still fail (e.g. after the user revokes it).
301
+ *
302
+ * @remarks If the permission state is still undetermined, this may trigger the system audio permission prompt.
303
+ * @group Permissions
304
+ */
305
+ probeSystemAudioRecordingAccess(options?: {
306
+ backend?: SystemAudioPermissionBackend;
307
+ }): Promise<boolean>;
134
308
  /**
135
309
  * Indicates if keystroke events of other apps can be recorded via Input Monitoring.
136
310
  *
@@ -177,7 +351,9 @@ export declare class RecordKit extends EventEmitter {
177
351
  * - `screenCaptureKit`: Screen Recording permission
178
352
  * - `_beta_coreAudio`: deprecated alias for `coreAudio`
179
353
  *
180
- * Afterwards, the users needs to restart this app, for the permission to become active in the app.
354
+ * For the `screenCaptureKit` backend the user must restart the app before the granted permission
355
+ * becomes active. The `default` and `coreAudio` backends return the live granted/denied result
356
+ * with no restart required (macOS 14.2+).
181
357
  *
182
358
  * @returns Boolean value that indicates whether the user granted or denied access to your app.
183
359
  * @group Permissions
@@ -207,14 +383,38 @@ export declare class RecordKit extends EventEmitter {
207
383
  * @group Permissions
208
384
  */
209
385
  requestAccessibilityControlAccess(): Promise<void>;
386
+ /**
387
+ * Creates a {@link Recorder} for the given schema.
388
+ *
389
+ * The schema describes what to record (its `items`, e.g. a webcam, display, microphone or system audio),
390
+ * where to write the resulting RecordKit bundle (`output_directory`), and optional session-wide
391
+ * {@link RecorderSettings}. Call {@link Recorder.prepare} then {@link Recorder.start} on the returned recorder.
392
+ *
393
+ * @remarks The given `schema` is consumed: device/window objects in its `items` are replaced by their IDs and
394
+ * any callbacks are registered internally. Pass a fresh schema object per call rather than reusing one.
395
+ *
396
+ * @group Recording
397
+ */
210
398
  createRecorder(schema: {
211
399
  output_directory?: string;
212
400
  items: RecorderSchemaItem[];
213
- settings?: {
214
- allowFrameReordering?: boolean;
215
- };
401
+ settings?: RecorderSettings;
216
402
  }): Promise<Recorder>;
217
403
  }
404
+ /**
405
+ * Typed event overloads for {@link RecordKit}. Declaration-merges with the class so that
406
+ * `recordkit.on('log', message => …)` receives a typed {@link LogMessage} instead of `any`.
407
+ *
408
+ * @group Logging
409
+ */
410
+ export interface RecordKit {
411
+ /** Fires for every log message emitted by RecordKit. See {@link LogMessage}. */
412
+ on(event: 'log', listener: (message: LogMessage) => void): this;
413
+ /** @see {@link RecordKit.on} */
414
+ once(event: 'log', listener: (message: LogMessage) => void): this;
415
+ /** @see {@link RecordKit.on} */
416
+ off(event: 'log', listener: (message: LogMessage) => void): this;
417
+ }
218
418
  /** @ignore */
219
419
  export declare let recordkit: RecordKit;
220
420
  /**
@@ -286,6 +486,8 @@ export interface RunningApplication {
286
486
  export interface Camera {
287
487
  /** An identifier that uniquely identifies the camera. */
288
488
  id: string;
489
+ /** Indicates whether this is a virtual camera (e.g. provided by software rather than physical hardware). */
490
+ isVirtual: boolean;
289
491
  /** A localized camera name for display in the user interface. */
290
492
  name: string;
291
493
  /** The model ID of this camera. */
@@ -309,6 +511,19 @@ export interface Camera {
309
511
  */
310
512
  preview_url?: string;
311
513
  }
514
+ /**
515
+ * A camera capture format, as returned by {@link RecordKit.getCameraBestFormat}.
516
+ *
517
+ * @group Discovery
518
+ */
519
+ export interface CameraFormat {
520
+ /** Width of the format, in pixels. */
521
+ width: number;
522
+ /** Height of the format, in pixels. */
523
+ height: number;
524
+ /** Highest frame rate supported by this format, in frames per second. */
525
+ maxFrameRate: number;
526
+ }
312
527
  /**
313
528
  * A microphone whose audio can be recorded.
314
529
  *
@@ -317,6 +532,8 @@ export interface Camera {
317
532
  export interface Microphone {
318
533
  /** An identifier that uniquely identifies the microphone. */
319
534
  id: string;
535
+ /** Indicates whether this is a virtual microphone (e.g. provided by software rather than physical hardware). */
536
+ isVirtual: boolean;
320
537
  /** A localized microphone name for display in the user interface. */
321
538
  name: string;
322
539
  /** The model ID of this microphone. */
@@ -343,8 +560,12 @@ export interface Display {
343
560
  id: number;
344
561
  /** Name of this display. */
345
562
  localizedName?: string;
563
+ /** SF Symbol name representing this display (e.g. `laptopcomputer`, `display`), suitable for use in the UI. */
564
+ symbolName: string;
346
565
  /** Frame of the display, relative to the main display. Uses top-left coordinate space. */
347
566
  frame: Bounds;
567
+ /** Visible frame of the display (excluding the menu bar and Dock), relative to the main display. Top-left coordinate space. */
568
+ visibleFrame?: Bounds;
348
569
  /** Indicates if this is the main display. */
349
570
  isMain: boolean;
350
571
  /**
@@ -386,7 +607,48 @@ export interface Bounds {
386
607
  width: number;
387
608
  height: number;
388
609
  }
610
+ /**
611
+ * The user's preferred device IDs for each source type, ordered most-preferred first.
612
+ *
613
+ * @group Preferred Devices
614
+ */
615
+ export interface UserPreferred {
616
+ /** Preferred microphone IDs (matching {@link Microphone.id}), most-preferred first. */
617
+ microphoneIDs: string[];
618
+ /** Preferred camera IDs (matching {@link Camera.id}), most-preferred first. */
619
+ cameraIDs: string[];
620
+ /** Preferred display IDs (matching {@link Display.id}), most-preferred first. */
621
+ displayIDs: number[];
622
+ /** Preferred Apple device IDs (matching {@link AppleDevice.id}), most-preferred first. */
623
+ appleDeviceIDs: string[];
624
+ }
389
625
  /**
390
626
  * @group Logging
391
627
  */
392
628
  export type LogLevel = 'trace' | 'debug' | 'info' | 'warning' | 'error' | 'critical';
629
+ /**
630
+ * A structured log message emitted by RecordKit, delivered as the payload of the `'log'` event.
631
+ *
632
+ * @example
633
+ * ```ts
634
+ * recordkit.on('log', (message) => {
635
+ * if (message.level === 'error') myLogger.error(message.category, message.message, message.metadata)
636
+ * })
637
+ * ```
638
+ *
639
+ * @group Logging
640
+ */
641
+ export interface LogMessage {
642
+ /** Time the message was logged, in milliseconds since the Unix epoch. Use `new Date(timestamp)` to get a `Date`. */
643
+ timestamp: number;
644
+ /** Severity level of the message. */
645
+ level: LogLevel;
646
+ /** Category the message belongs to (e.g. the subsystem that emitted it). */
647
+ category: string;
648
+ /** The log message text. */
649
+ message: string;
650
+ /** Additional structured key/value metadata attached to the message. */
651
+ metadata: Record<string, string>;
652
+ /** Pre-formatted, human-readable representation of the message (timestamp, level, category, message and metadata). */
653
+ formattedMessage: string;
654
+ }