@bridgething/lib 0.1.2

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/bindings/client.d.ts +1904 -0
  4. package/dist/bindings/client.d.ts.map +1 -0
  5. package/dist/bindings/client.js +2 -0
  6. package/dist/bindings/client.js.map +1 -0
  7. package/dist/bindings/gateway.d.ts +1508 -0
  8. package/dist/bindings/gateway.d.ts.map +1 -0
  9. package/dist/bindings/gateway.js +2 -0
  10. package/dist/bindings/gateway.js.map +1 -0
  11. package/dist/bindings/shared.d.ts +1485 -0
  12. package/dist/bindings/shared.d.ts.map +1 -0
  13. package/dist/bindings/shared.js +3 -0
  14. package/dist/bindings/shared.js.map +1 -0
  15. package/dist/bindings/stock.d.ts +14 -0
  16. package/dist/bindings/stock.d.ts.map +1 -0
  17. package/dist/bindings/stock.js +3 -0
  18. package/dist/bindings/stock.js.map +1 -0
  19. package/dist/bindings/wire.d.ts +47 -0
  20. package/dist/bindings/wire.d.ts.map +1 -0
  21. package/dist/bindings/wire.js +3 -0
  22. package/dist/bindings/wire.js.map +1 -0
  23. package/dist/codec.d.ts +66 -0
  24. package/dist/codec.d.ts.map +1 -0
  25. package/dist/codec.js +180 -0
  26. package/dist/codec.js.map +1 -0
  27. package/dist/framing.d.ts +34 -0
  28. package/dist/framing.d.ts.map +1 -0
  29. package/dist/framing.js +69 -0
  30. package/dist/framing.js.map +1 -0
  31. package/dist/index.d.ts +19 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +20 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/logger.d.ts +21 -0
  36. package/dist/logger.d.ts.map +1 -0
  37. package/dist/logger.js +23 -0
  38. package/dist/logger.js.map +1 -0
  39. package/dist/uuid-fields.generated.d.ts +7 -0
  40. package/dist/uuid-fields.generated.d.ts.map +1 -0
  41. package/dist/uuid-fields.generated.js +15 -0
  42. package/dist/uuid-fields.generated.js.map +1 -0
  43. package/dist/uuid.d.ts +6 -0
  44. package/dist/uuid.d.ts.map +1 -0
  45. package/dist/uuid.js +20 -0
  46. package/dist/uuid.js.map +1 -0
  47. package/dist/version.d.ts +2 -0
  48. package/dist/version.d.ts.map +1 -0
  49. package/dist/version.js +3 -0
  50. package/dist/version.js.map +1 -0
  51. package/package.json +87 -0
@@ -0,0 +1,1904 @@
1
+ import type { AcceptCallAction, BridgeThingMeta, BrightnessMode, BrightnessState, BrowseResult, CallEndReason, Capabilities, CommunicationsState, ConfigEntry, CurrentlyActiveApplication, Device, Diagnostics, DismissReason, DtmfTone, EndCallAction, FavoritesPage, ForwardMessage, GeoAccuracy, GeoError, HardwareState, HttpHeader, InitiateCallType, ItemKind, ItemRef, LibraryError, LogEntry, LogLevel, LogSource, NetError, NetFetchRequest, NetFetchResponse, Notification, NowPlayingUpdate, OtaError, OtaProgress, Peer, PhoneCall, PhoneCallService, PhoneError, PhoneState, PlayContext, PlayerError, PlayerState, Position, QueueItem, QueuePosition, RecommendationsResult, RepeatMode, SearchResult, StreamBegin, StreamChunk, StreamEnd, StreamError, TimeInfo, WebappError, WebappInfo, WsError, WsFrame } from './shared';
2
+ import type { MsgMeta, WireError } from './wire';
3
+ /**
4
+ * 0..=100 ambient-brightness indicator derived from the on-board ALS +
5
+ * backlight curve. Low = dark room, high = bright room.
6
+ */
7
+ export type AmbientLightUpdate = {
8
+ ambientLevel: number;
9
+ };
10
+ /**
11
+ * An asset was evicted from the cache; webapps should drop any cached
12
+ * Blob URL for it and refetch on next use.
13
+ */
14
+ export type AssetCleared = {
15
+ id: string;
16
+ };
17
+ /**
18
+ * Webapp request: read an asset by id. Bridge replies with `Got` on hit
19
+ * or `NotFound` (domain) when neither cache nor companion has it.
20
+ */
21
+ export type AssetGet = {
22
+ /**
23
+ * Opaque asset id, e.g. `iap2/art/<persistent-hex>/<n>` for iAP2 art or a
24
+ * companion-defined shape like `spotify/img/<id>`.
25
+ */
26
+ id: string;
27
+ /**
28
+ * Correlates the `Got` or `NotFound` reply back to this request.
29
+ */
30
+ requestId: string;
31
+ };
32
+ /**
33
+ * Successful reply to `AssetGet`: the requested bytes.
34
+ */
35
+ export type AssetGot = {
36
+ /**
37
+ * Echoes the `AssetGet.request_id` this reply resolves.
38
+ */
39
+ requestId: string;
40
+ /**
41
+ * Echoes the requested asset id.
42
+ */
43
+ id: string;
44
+ /**
45
+ * Raw asset bytes, already reassembled if the companion sent them as a
46
+ * chunked BT transfer.
47
+ */
48
+ bytes: Uint8Array;
49
+ /**
50
+ * Best-effort content type; `None` when the source didn't provide one.
51
+ */
52
+ mime: string | null;
53
+ };
54
+ /**
55
+ * Domain-error reply to `AssetGet`: neither the cache nor a connected
56
+ * companion has an asset for this id.
57
+ */
58
+ export type AssetNotFound = {
59
+ /**
60
+ * Echoes the `AssetGet.request_id` this reply resolves.
61
+ */
62
+ requestId: string;
63
+ /**
64
+ * Echoes the requested asset id.
65
+ */
66
+ id: string;
67
+ };
68
+ /**
69
+ * Webapp hint to warm the asset cache for a set of ids so subsequent
70
+ * `Get` calls hit cache. Fire-and-forget; webapps observe completion
71
+ * via `Asset.Ready` events.
72
+ */
73
+ export type AssetPreload = {
74
+ /**
75
+ * Ids to prefetch, capped at 64 per call. Ids already cached and ids
76
+ * under the `iap2/art/` prefix are skipped, since iAP2 art only ever
77
+ * arrives via a push from the phone, not a pull request.
78
+ */
79
+ ids: Array<string>;
80
+ };
81
+ /**
82
+ * An asset became fetchable in the cache; a subsequent `AssetGet` for this
83
+ * id will resolve without a companion round trip.
84
+ */
85
+ export type AssetReady = {
86
+ id: string;
87
+ };
88
+ /**
89
+ * Describes the device's own bluetooth adapter. `interface` is the
90
+ * host-side interface name (e.g. `hci0`).
91
+ */
92
+ export type BluetoothInterface = {
93
+ mac: string;
94
+ name: string;
95
+ interface: string;
96
+ };
97
+ /**
98
+ * Outcome of an in-flight pairing attempt initiated by a peer device.
99
+ */
100
+ export type BluetoothPairingResult = {
101
+ success: boolean;
102
+ };
103
+ /**
104
+ * A pairing PIN a peer device is displaying, for a webapp to show as
105
+ * on-screen confirmation.
106
+ */
107
+ export type BluetoothPin = {
108
+ mac: string;
109
+ name: string;
110
+ pin: string;
111
+ };
112
+ /**
113
+ * Whether a companion phone is currently connected over bluetooth.
114
+ */
115
+ export type BluetoothStatus = {
116
+ connected: boolean;
117
+ };
118
+ /**
119
+ * Daemon-side asset events. `Got` and `NotFound` resolve a webapp `Get`
120
+ * (correlated by request_id). `Ready` broadcasts to all connected
121
+ * webapps whenever the cache gains an asset, regardless of source
122
+ * (companion push, iAP2 FileTransfer, request fulfilment, lazy disk
123
+ * load). `Cleared` broadcasts on every eviction path - LRU pressure,
124
+ * TTL expiry, companion-issued Clear, daemon shutdown - so SDK
125
+ * consumers can drop Blob URLs and refetch as needed.
126
+ */
127
+ export type BridgeToClientAssetMsg = {
128
+ event: 'got';
129
+ data: AssetGot;
130
+ } | {
131
+ event: 'notFound';
132
+ data: AssetNotFound;
133
+ } | {
134
+ event: 'ready';
135
+ data: AssetReady;
136
+ } | {
137
+ event: 'cleared';
138
+ data: AssetCleared;
139
+ };
140
+ /**
141
+ * Daemon -> webapp audio events: TTS lifecycle notifications and
142
+ * volume/mute changes.
143
+ */
144
+ export type BridgeToClientAudioMsg = {
145
+ event: 'ttsStarted';
146
+ data: TtsStarted;
147
+ } | {
148
+ event: 'ttsEnded';
149
+ data: TtsEnded;
150
+ } | {
151
+ event: 'volumeChanged';
152
+ data: VolumeChanged;
153
+ };
154
+ /**
155
+ * Daemon -> webapp bluetooth surface: connection status/events,
156
+ * in-flight pairing feedback, and the reply to `bluetooth.list`.
157
+ */
158
+ export type BridgeToClientBluetoothMsg = {
159
+ event: 'status';
160
+ data: BluetoothStatus;
161
+ } | {
162
+ event: 'connectedDevice';
163
+ data: ConnectedDevice;
164
+ } | {
165
+ event: 'interface';
166
+ data: BluetoothInterface;
167
+ } | {
168
+ event: 'pairingResult';
169
+ data: BluetoothPairingResult;
170
+ } | {
171
+ event: 'pin';
172
+ data: BluetoothPin;
173
+ } | {
174
+ event: 'pairedDevices';
175
+ data: PairedDevicesMap;
176
+ };
177
+ /**
178
+ * Daemon -> webapp capabilities surface. `Update` is the broadcast event
179
+ * fired on connect + on every change; `Snapshot` is the typed reply to
180
+ * `CapabilitiesGet`. Webapps that auto-react to capability change
181
+ * listen on `Update` and don't need to call `Get`.
182
+ */
183
+ export type BridgeToClientCapabilitiesMsg = {
184
+ event: 'update';
185
+ data: CapabilitiesSnapshot;
186
+ } | {
187
+ event: 'snapshot';
188
+ data: CapabilitiesSnapshot;
189
+ };
190
+ /**
191
+ * Daemon -> webapp config replies and events. `Get` / `List` reply to
192
+ * the matching requests. `Changed` broadcasts whenever the gateway
193
+ * writes or deletes a value for the active webapp.
194
+ */
195
+ export type BridgeToClientConfigMsg = {
196
+ event: 'get';
197
+ data: ConfigGetReply;
198
+ } | {
199
+ event: 'list';
200
+ data: ConfigListReply;
201
+ } | {
202
+ event: 'changed';
203
+ data: ConfigChanged;
204
+ };
205
+ /**
206
+ * Daemon -> webapp location surface: the `Position` stream a watch
207
+ * produces, plus replies to `geo.watch` and `geo.getOnce`.
208
+ */
209
+ export type BridgeToClientGeoMsg = {
210
+ event: 'position';
211
+ data: Position;
212
+ } | {
213
+ event: 'watchReply';
214
+ data: GeoWatchReply;
215
+ } | {
216
+ event: 'getOnceReply';
217
+ data: GeoGetOnceReply;
218
+ } | {
219
+ event: 'errorReply';
220
+ data: GeoErrorReply;
221
+ };
222
+ /**
223
+ * Daemon -> webapp hardware surface: ambient-light and backlight
224
+ * change events, plus the reply to `hardware.stateGet`.
225
+ */
226
+ export type BridgeToClientHardwareMsg = {
227
+ event: 'ambientLightUpdate';
228
+ data: AmbientLightUpdate;
229
+ } | {
230
+ event: 'brightnessChanged';
231
+ data: BrightnessState;
232
+ } | {
233
+ event: 'stateReply';
234
+ data: HardwareStateReply;
235
+ };
236
+ /**
237
+ * Daemon -> webapp replies and events for the library surface. `BrowseReply`, `SearchReply`,
238
+ * `RecommendationsReply`, `FavoritesListReply`, and `FavoritesContainsReply` answer the
239
+ * matching `ClientToBridgeLibraryMsg` request; `LibraryErrorReply` replaces the reply on
240
+ * failure. `FavoriteChanged` is a live event broadcast to every connected webapp whenever a
241
+ * favorite's status changes.
242
+ */
243
+ export type BridgeToClientLibraryMsg = {
244
+ event: 'browseReply';
245
+ data: LibraryBrowseReply;
246
+ } | {
247
+ event: 'searchReply';
248
+ data: LibrarySearchReply;
249
+ } | {
250
+ event: 'recommendationsReply';
251
+ data: LibraryRecommendationsReply;
252
+ } | {
253
+ event: 'favoritesListReply';
254
+ data: LibraryFavoritesListReply;
255
+ } | {
256
+ event: 'favoritesContainsReply';
257
+ data: LibraryFavoritesContainsReply;
258
+ } | {
259
+ event: 'libraryErrorReply';
260
+ data: LibraryErrorReply;
261
+ } | {
262
+ event: 'favoriteChanged';
263
+ data: FavoriteChanged;
264
+ };
265
+ /**
266
+ * bridgething -> client
267
+ * messages from bridgething to the client (webapp).
268
+ *
269
+ * these messages travel over the local websocket on port 8891.
270
+ */
271
+ export type BridgeToClientMsg = {
272
+ id: string;
273
+ meta: MsgMeta;
274
+ data: BridgeToClientMsgData;
275
+ };
276
+ export type BridgeToClientMsgData = {
277
+ type: 'asset';
278
+ data: BridgeToClientAssetMsg;
279
+ } | {
280
+ type: 'audio';
281
+ data: BridgeToClientAudioMsg;
282
+ } | {
283
+ type: 'bluetooth';
284
+ data: BridgeToClientBluetoothMsg;
285
+ } | {
286
+ type: 'capabilities';
287
+ data: BridgeToClientCapabilitiesMsg;
288
+ } | {
289
+ type: 'config';
290
+ data: BridgeToClientConfigMsg;
291
+ } | {
292
+ type: 'geo';
293
+ data: BridgeToClientGeoMsg;
294
+ } | {
295
+ type: 'hardware';
296
+ data: BridgeToClientHardwareMsg;
297
+ } | {
298
+ type: 'library';
299
+ data: BridgeToClientLibraryMsg;
300
+ } | {
301
+ type: 'net';
302
+ data: BridgeToClientNetMsg;
303
+ } | {
304
+ type: 'notifications';
305
+ data: BridgeToClientNotificationsMsg;
306
+ } | {
307
+ type: 'peer';
308
+ data: BridgeToClientPeerMsg;
309
+ } | {
310
+ type: 'phone';
311
+ data: BridgeToClientPhoneMsg;
312
+ } | {
313
+ type: 'player';
314
+ data: BridgeToClientPlayerMsg;
315
+ } | {
316
+ type: 'store';
317
+ data: BridgeToClientStoreMsg;
318
+ } | {
319
+ type: 'system';
320
+ data: BridgeToClientSystemMsg;
321
+ } | {
322
+ type: 'time';
323
+ data: BridgeToClientTimeMsg;
324
+ } | {
325
+ type: 'voice';
326
+ data: BridgeToClientVoiceMsg;
327
+ } | {
328
+ type: 'webapp';
329
+ data: BridgeToClientWebappMsg;
330
+ } | {
331
+ type: 'forward';
332
+ data: ForwardMessage;
333
+ } | {
334
+ type: 'error';
335
+ data: WireError;
336
+ } | {
337
+ type: 'ack';
338
+ } | {
339
+ type: 'done';
340
+ };
341
+ /**
342
+ * Daemon -> webapp network surface: replies to `fetch` and `ws.open`,
343
+ * WebSocket frame/close/error events, and the `Stream*` event trio
344
+ * driven by `net.stream.open`.
345
+ */
346
+ export type BridgeToClientNetMsg = {
347
+ event: 'fetchReply';
348
+ data: NetFetchReply;
349
+ } | {
350
+ event: 'fetchErrorReply';
351
+ data: NetFetchErrorReply;
352
+ } | {
353
+ event: 'wsOpenReply';
354
+ data: NetWsOpenReply;
355
+ } | {
356
+ event: 'wsErrorReply';
357
+ data: NetWsErrorReply;
358
+ } | {
359
+ event: 'wsMessage';
360
+ data: NetWsMessage;
361
+ } | {
362
+ event: 'wsClosed';
363
+ data: NetWsClosed;
364
+ } | {
365
+ event: 'wsErrorEvent';
366
+ data: NetWsErrorEvent;
367
+ } | {
368
+ event: 'streamBegin';
369
+ data: StreamBegin;
370
+ } | {
371
+ event: 'streamChunk';
372
+ data: StreamChunk;
373
+ } | {
374
+ event: 'streamEnd';
375
+ data: StreamEnd;
376
+ } | {
377
+ event: 'streamError';
378
+ data: StreamError;
379
+ };
380
+ /**
381
+ * Daemon -> webapp notification mirror. `Posted` fires for a new
382
+ * notification, `Updated` when an existing one's content changes, and
383
+ * `Removed` when it is dismissed, acted on, or cleared remotely.
384
+ */
385
+ export type BridgeToClientNotificationsMsg = {
386
+ event: 'posted';
387
+ data: Notification;
388
+ } | {
389
+ event: 'updated';
390
+ data: Notification;
391
+ } | {
392
+ event: 'removed';
393
+ data: NotificationRemoved;
394
+ };
395
+ /**
396
+ * Daemon -> webapp peer surface: a full snapshot of every known peer
397
+ * (paired, iAP2, and companion-gateway state), re-sent whenever any
398
+ * peer changes. There is no per-webapp request; a fresh snapshot
399
+ * arrives on connect and after every change.
400
+ */
401
+ export type BridgeToClientPeerMsg = {
402
+ event: 'snapshot';
403
+ data: PeerSnapshotMap;
404
+ };
405
+ /**
406
+ * Daemon -> webapp telephony surface. `CallStarted`/`CallUpdated`/
407
+ * `CallEnded`/`CommunicationsChanged` are unsolicited broadcasts driven by
408
+ * the connected companion's telephony state; `StateReply`/`ErrorReply`
409
+ * answer webapp-issued requests and commands.
410
+ */
411
+ export type BridgeToClientPhoneMsg = {
412
+ event: 'callStarted';
413
+ data: PhoneCall;
414
+ } | {
415
+ event: 'callUpdated';
416
+ data: PhoneCall;
417
+ } | {
418
+ event: 'callEnded';
419
+ data: PhoneCallEnded;
420
+ } | {
421
+ event: 'communicationsChanged';
422
+ data: PhoneCommunicationsReply;
423
+ } | {
424
+ event: 'stateReply';
425
+ data: PhoneStateReply;
426
+ } | {
427
+ event: 'errorReply';
428
+ data: PhoneErrorReply;
429
+ };
430
+ /**
431
+ * Daemon -> webapp player surface. `Snapshot` lands on connect with the
432
+ * current player state; `Delta` is the `NowPlayingUpdate` stream the
433
+ * SDK auto-merges; `QueueChanged` fires when the queue mutates without
434
+ * a track change. `StateReply`/`QueueReply` are the typed responses
435
+ * to the matching webapp queries.
436
+ */
437
+ export type BridgeToClientPlayerMsg = {
438
+ event: 'snapshot';
439
+ data: PlayerStateReply;
440
+ } | {
441
+ event: 'delta';
442
+ data: NowPlayingUpdate;
443
+ } | {
444
+ event: 'queueChanged';
445
+ data: PlayerQueueReply;
446
+ } | {
447
+ event: 'stateReply';
448
+ data: PlayerStateReply;
449
+ } | {
450
+ event: 'queueReply';
451
+ data: PlayerQueueReply;
452
+ } | {
453
+ event: 'errorReply';
454
+ data: PlayerErrorReply;
455
+ };
456
+ /**
457
+ * Daemon -> webapp KV storage replies. `Response` answers all three
458
+ * `client.store` requests (`Get` / `Put` / `Delete`).
459
+ */
460
+ export type BridgeToClientStoreMsg = {
461
+ event: 'response';
462
+ data: StorageResponse;
463
+ };
464
+ /**
465
+ * Daemon -> webapp system events and replies. `Version` replies to
466
+ * `VersionRequest` with the daemon's `BridgeThingMeta`. `DiagnosticsReply`,
467
+ * `LogsTailReply`, `LogsSubscribeReply`, and `DeviceNickname` are replies
468
+ * to their matching requests. `LogEntry` streams matching lines to a live
469
+ * `LogsSubscribe` subscription. `OtaProgress` / `OtaError` report OTA
470
+ * orchestrator state. `DeviceNicknameChanged` broadcasts whenever the
471
+ * nickname mutates, including from another surface.
472
+ */
473
+ export type BridgeToClientSystemMsg = {
474
+ event: 'version';
475
+ data: BridgeThingMeta;
476
+ } | {
477
+ event: 'diagnosticsReply';
478
+ data: DiagnosticsReply;
479
+ } | {
480
+ event: 'logsTailReply';
481
+ data: LogsTailReply;
482
+ } | {
483
+ event: 'logsSubscribeReply';
484
+ data: LogsSubscribeReply;
485
+ } | {
486
+ event: 'logEntry';
487
+ data: LogEntry;
488
+ } | {
489
+ event: 'otaProgress';
490
+ data: OtaProgress;
491
+ } | {
492
+ event: 'otaError';
493
+ data: OtaError;
494
+ } | {
495
+ event: 'deviceNickname';
496
+ data: DeviceNicknameReply;
497
+ } | {
498
+ event: 'deviceNicknameChanged';
499
+ data: DeviceNicknameReply;
500
+ };
501
+ /**
502
+ * Daemon -> webapp wall-clock surface: an initial snapshot at
503
+ * announce, `Changed` events on tz/locale/clock updates, and the
504
+ * reply to `time.get`.
505
+ */
506
+ export type BridgeToClientTimeMsg = {
507
+ event: 'changed';
508
+ data: TimeSnapshot;
509
+ } | {
510
+ event: 'snapshot';
511
+ data: TimeSnapshot;
512
+ };
513
+ /**
514
+ * Daemon -> webapp voice/NLU surface: mic state-change events and the
515
+ * reply to `voice.stateGet`.
516
+ */
517
+ export type BridgeToClientVoiceMsg = {
518
+ event: 'stateChanged';
519
+ data: VoiceState;
520
+ } | {
521
+ event: 'stateReply';
522
+ data: VoiceStateReply;
523
+ };
524
+ /**
525
+ * Daemon -> webapp replies and events for the webapp-management surface. `ListReply`,
526
+ * `CurrentReply`, `ActiveReply`, and `IconReply` answer the matching `ClientToBridgeWebappMsg`
527
+ * request; `WebappError` replaces the reply on failure. `WebappInstalled` is a live event
528
+ * broadcast to every connected webapp whenever an installed-webapp transfer completes.
529
+ */
530
+ export type BridgeToClientWebappMsg = {
531
+ event: 'listReply';
532
+ data: WebappListReply;
533
+ } | {
534
+ event: 'currentReply';
535
+ data: WebappCurrentReply;
536
+ } | {
537
+ event: 'activeReply';
538
+ data: WebappActiveReply;
539
+ } | {
540
+ event: 'iconReply';
541
+ data: WebappIconReply;
542
+ } | {
543
+ event: 'webappError';
544
+ data: WebappError;
545
+ } | {
546
+ event: 'activeChanged';
547
+ data: WebappActiveChanged;
548
+ } | {
549
+ event: 'webappInstalled';
550
+ data: WebappInfo;
551
+ } | {
552
+ event: 'webappUninstalled';
553
+ data: WebappUninstalled;
554
+ };
555
+ /**
556
+ * Wrapper carrying one `Capabilities` snapshot; reply to `CapabilitiesGet`
557
+ * and payload of the `Update` broadcast event.
558
+ */
559
+ export type CapabilitiesSnapshot = {
560
+ capabilities: Capabilities;
561
+ };
562
+ /**
563
+ * Webapp-side asset operations: `get` fetches bytes by id, `preload` warms
564
+ * the cache ahead of time so a later `get` resolves instantly.
565
+ */
566
+ export type ClientToBridgeAssetMsg = {
567
+ event: 'get';
568
+ data: AssetGet;
569
+ } | {
570
+ event: 'preload';
571
+ data: AssetPreload;
572
+ };
573
+ /**
574
+ * Webapp -> daemon audio control surface: volume/mute, TTS playback, and
575
+ * earcons. All fire-and-forget; `setVolume`/`setMute` broadcast a
576
+ * `VolumeChanged` event, and TTS lifecycle is reported via
577
+ * `TtsStarted`/`TtsEnded`.
578
+ */
579
+ export type ClientToBridgeAudioMsg = {
580
+ event: 'volumeUp';
581
+ } | {
582
+ event: 'volumeDown';
583
+ } | {
584
+ event: 'setVolume';
585
+ data: SetVolume;
586
+ } | {
587
+ event: 'muteToggle';
588
+ } | {
589
+ event: 'setMute';
590
+ data: SetMute;
591
+ } | {
592
+ event: 'tts';
593
+ data: Tts;
594
+ } | {
595
+ event: 'ttsCancel';
596
+ data: TtsCancel;
597
+ } | {
598
+ event: 'ttsCancelAll';
599
+ } | {
600
+ event: 'earcon';
601
+ data: Earcon;
602
+ };
603
+ /**
604
+ * Webapp -> daemon bluetooth surface: adapter alias, discoverable
605
+ * state, and paired-device management. The device is the peripheral
606
+ * during pairing (it never scans for new devices); `connect` only
607
+ * re-establishes a link to an already-paired device.
608
+ */
609
+ export type ClientToBridgeBluetoothMsg = {
610
+ event: 'list';
611
+ } | {
612
+ event: 'connect';
613
+ data: ConnectBluetooth;
614
+ } | {
615
+ event: 'enableDiscoverable';
616
+ } | {
617
+ event: 'disableDiscoverable';
618
+ } | {
619
+ event: 'forget';
620
+ data: ForgetBluetooth;
621
+ } | {
622
+ event: 'setAlias';
623
+ data: SetBluetoothAlias;
624
+ };
625
+ /**
626
+ * Webapp -> daemon capabilities surface. `Get` is the one-shot pull;
627
+ * most webapps instead listen for `BridgeToClientCapabilitiesMsg::Update`.
628
+ */
629
+ export type ClientToBridgeCapabilitiesMsg = {
630
+ event: 'get';
631
+ };
632
+ /**
633
+ * Webapp -> daemon read-only config surface (`client.config`). Config
634
+ * values are user-tunable settings the gateway pushes down for the
635
+ * active webapp; webapps cannot write here. `Get` reads a single key,
636
+ * `List` reads every set key. The daemon also broadcasts
637
+ * `BridgeToClientConfigMsg::Changed` whenever the gateway writes a
638
+ * value, so most webapps don't need to poll `Get`.
639
+ */
640
+ export type ClientToBridgeConfigMsg = {
641
+ event: 'get';
642
+ data: ConfigGet;
643
+ } | {
644
+ event: 'list';
645
+ };
646
+ /**
647
+ * Webapp -> daemon location surface: `watch`/`unwatch` register and
648
+ * release a standing subscription, `getOnce` fetches a single fix.
649
+ * Every fix originates from the connected phone; the device has no
650
+ * GPS of its own.
651
+ */
652
+ export type ClientToBridgeGeoMsg = {
653
+ event: 'watch';
654
+ data: GeoWatch;
655
+ } | {
656
+ event: 'unwatch';
657
+ data: GeoUnwatch;
658
+ } | {
659
+ event: 'getOnce';
660
+ data: GeoGetOnce;
661
+ };
662
+ /**
663
+ * Webapp -> daemon hardware surface: display backlight control. Wheel
664
+ * / button / touch input never crosses this wire; the kiosk delivers
665
+ * those directly to the active webapp as chromium keypresses.
666
+ */
667
+ export type ClientToBridgeHardwareMsg = {
668
+ event: 'displaySetMode';
669
+ data: DisplaySetMode;
670
+ } | {
671
+ event: 'displaySetLevel';
672
+ data: DisplaySetLevel;
673
+ } | {
674
+ event: 'stateGet';
675
+ };
676
+ /**
677
+ * Webapp -> daemon library surface: browse/search/recommend across the connected gateway's
678
+ * library, and read or mutate favorites. `Browse`, `Search`, `Recommendations`,
679
+ * `FavoritesList`, and `FavoritesContains` are request/reply and fail with
680
+ * `LibraryErrorReply` when no gateway is connected. `FavoritesToggle`, `FavoritesSet`, and
681
+ * `FavoritesSetMany` are fire-and-forget commands with no completion reply; if no gateway is
682
+ * connected they are silently dropped, and on success their effect surfaces later as a
683
+ * `FavoriteChanged` event.
684
+ */
685
+ export type ClientToBridgeLibraryMsg = {
686
+ event: 'browse';
687
+ data: LibraryBrowse;
688
+ } | {
689
+ event: 'search';
690
+ data: LibrarySearch;
691
+ } | {
692
+ event: 'recommendations';
693
+ data: LibraryRecommendations;
694
+ } | {
695
+ event: 'favoritesList';
696
+ data: LibraryFavoritesList;
697
+ } | {
698
+ event: 'favoritesContains';
699
+ data: LibraryFavoritesContains;
700
+ } | {
701
+ event: 'favoritesToggle';
702
+ data: FavoritesToggle;
703
+ } | {
704
+ event: 'favoritesSet';
705
+ data: FavoritesSet;
706
+ } | {
707
+ event: 'favoritesSetMany';
708
+ data: FavoritesSetMany;
709
+ };
710
+ /**
711
+ * client -> bridgething
712
+ * messages from the client (webapp) to bridgething.
713
+ *
714
+ * these messages travel over the local websocket on port 8891.
715
+ */
716
+ export type ClientToBridgeMsg = {
717
+ id: string;
718
+ meta: MsgMeta;
719
+ data: ClientToBridgeMsgData;
720
+ };
721
+ export type ClientToBridgeMsgData = {
722
+ type: 'asset';
723
+ data: ClientToBridgeAssetMsg;
724
+ } | {
725
+ type: 'audio';
726
+ data: ClientToBridgeAudioMsg;
727
+ } | {
728
+ type: 'bluetooth';
729
+ data: ClientToBridgeBluetoothMsg;
730
+ } | {
731
+ type: 'capabilities';
732
+ data: ClientToBridgeCapabilitiesMsg;
733
+ } | {
734
+ type: 'config';
735
+ data: ClientToBridgeConfigMsg;
736
+ } | {
737
+ type: 'geo';
738
+ data: ClientToBridgeGeoMsg;
739
+ } | {
740
+ type: 'hardware';
741
+ data: ClientToBridgeHardwareMsg;
742
+ } | {
743
+ type: 'library';
744
+ data: ClientToBridgeLibraryMsg;
745
+ } | {
746
+ type: 'net';
747
+ data: ClientToBridgeNetMsg;
748
+ } | {
749
+ type: 'notifications';
750
+ data: ClientToBridgeNotificationsMsg;
751
+ } | {
752
+ type: 'phone';
753
+ data: ClientToBridgePhoneMsg;
754
+ } | {
755
+ type: 'player';
756
+ data: ClientToBridgePlayerMsg;
757
+ } | {
758
+ type: 'store';
759
+ data: ClientToBridgeStoreMsg;
760
+ } | {
761
+ type: 'system';
762
+ data: ClientToBridgeSystemMsg;
763
+ } | {
764
+ type: 'time';
765
+ data: ClientToBridgeTimeMsg;
766
+ } | {
767
+ type: 'voice';
768
+ data: ClientToBridgeVoiceMsg;
769
+ } | {
770
+ type: 'webapp';
771
+ data: ClientToBridgeWebappMsg;
772
+ } | {
773
+ type: 'forward';
774
+ data: ForwardMessage;
775
+ };
776
+ /**
777
+ * Webapp -> daemon network surface: HTTP fetch, WebSocket, and byte
778
+ * streams, all proxied through the connected companion. The device
779
+ * has no network connectivity of its own.
780
+ */
781
+ export type ClientToBridgeNetMsg = {
782
+ event: 'fetch';
783
+ data: NetFetch;
784
+ } | {
785
+ event: 'wsOpen';
786
+ data: NetWsOpen;
787
+ } | {
788
+ event: 'wsClose';
789
+ data: NetWsClose;
790
+ } | {
791
+ event: 'wsSend';
792
+ data: NetWsSend;
793
+ } | {
794
+ event: 'streamOpen';
795
+ data: NetStreamOpen;
796
+ } | {
797
+ event: 'streamCancel';
798
+ data: NetStreamCancel;
799
+ };
800
+ /**
801
+ * Webapp -> daemon notification action surface. Fire-and-forget; invokes
802
+ * the notification's positive or negative ANCS-style action slot on the
803
+ * connected companion. Prefer `positiveAction`/`negativeAction` on the
804
+ * `Notification` to decide whether a slot exists before invoking it.
805
+ */
806
+ export type ClientToBridgeNotificationsMsg = {
807
+ event: 'invokePositive';
808
+ data: NotificationInvoke;
809
+ } | {
810
+ event: 'invokeNegative';
811
+ data: NotificationInvoke;
812
+ };
813
+ /**
814
+ * Webapp -> daemon call-control surface. Commands are fire-and-forget and
815
+ * route to the connected companion's telephony backend (iAP2 call CSMs on
816
+ * iOS, gateway telephony on Android); outcomes surface asynchronously via
817
+ * `BridgeToClientPhoneMsg` events.
818
+ */
819
+ export type ClientToBridgePhoneMsg = {
820
+ event: 'answer';
821
+ data: PhoneCallAction;
822
+ } | {
823
+ event: 'accept';
824
+ data: PhoneAcceptAction;
825
+ } | {
826
+ event: 'decline';
827
+ data: PhoneCallAction;
828
+ } | {
829
+ event: 'end';
830
+ data: PhoneCallAction;
831
+ } | {
832
+ event: 'endTyped';
833
+ data: PhoneEndAction;
834
+ } | {
835
+ event: 'hold';
836
+ data: PhoneCallAction;
837
+ } | {
838
+ event: 'unhold';
839
+ data: PhoneCallAction;
840
+ } | {
841
+ event: 'initiate';
842
+ data: PhoneInitiateAction;
843
+ } | {
844
+ event: 'swap';
845
+ } | {
846
+ event: 'merge';
847
+ } | {
848
+ event: 'mute';
849
+ data: PhoneMuteAction;
850
+ } | {
851
+ event: 'dtmf';
852
+ data: PhoneDtmfAction;
853
+ } | {
854
+ event: 'stateGet';
855
+ };
856
+ /**
857
+ * Webapp -> daemon player control surface. Commands are fire-and-forget;
858
+ * the daemon routes each to whichever gateway owns playback. The two
859
+ * requests fetch a one-shot snapshot.
860
+ */
861
+ export type ClientToBridgePlayerMsg = {
862
+ event: 'play';
863
+ data: PlayUri;
864
+ } | {
865
+ event: 'queue';
866
+ data: QueueUri;
867
+ } | {
868
+ event: 'pause';
869
+ } | {
870
+ event: 'resume';
871
+ } | {
872
+ event: 'skipNext';
873
+ } | {
874
+ event: 'skipPrev';
875
+ data: SkipPrev;
876
+ } | {
877
+ event: 'skipToIndex';
878
+ data: SkipToIndex;
879
+ } | {
880
+ event: 'seekTo';
881
+ data: SeekTo;
882
+ } | {
883
+ event: 'setShuffle';
884
+ data: SetShuffle;
885
+ } | {
886
+ event: 'setRepeat';
887
+ data: SetRepeat;
888
+ } | {
889
+ event: 'setSpeed';
890
+ data: SetSpeed;
891
+ } | {
892
+ event: 'setCrossfade';
893
+ data: SetCrossfade;
894
+ } | {
895
+ event: 'stateGet';
896
+ } | {
897
+ event: 'queueGet';
898
+ };
899
+ /**
900
+ * Webapp -> daemon KV storage surface (`client.store`). Storage is
901
+ * scoped per webapp: keys set by one webapp are invisible to others.
902
+ * `Get` / `Put` / `Delete` each reply with the resulting `StorageResponse`.
903
+ */
904
+ export type ClientToBridgeStoreMsg = {
905
+ event: 'get';
906
+ data: KVGet;
907
+ } | {
908
+ event: 'put';
909
+ data: KVPut;
910
+ } | {
911
+ event: 'delete';
912
+ data: KVDelete;
913
+ };
914
+ /**
915
+ * Webapp -> daemon system control surface. `VersionRequest` fetches the
916
+ * daemon's `BridgeThingMeta` identity block; `DiagnosticsGet` fetches a
917
+ * one-shot health snapshot; `LogsTail` pulls a batch of recent log
918
+ * entries; `LogsSubscribe` / `LogsUnsubscribe` open and close a live log
919
+ * stream; `Reboot` / `PowerOff` restart or shut down the device;
920
+ * `FactoryReset` wipes daemon state (config, store, paired devices) and
921
+ * reboots; `DeviceGetNickname` reads the current device nickname.
922
+ */
923
+ export type ClientToBridgeSystemMsg = {
924
+ event: 'versionRequest';
925
+ } | {
926
+ event: 'diagnosticsGet';
927
+ } | {
928
+ event: 'logsTail';
929
+ data: LogsTail;
930
+ } | {
931
+ event: 'logsSubscribe';
932
+ data: LogsSubscribe;
933
+ } | {
934
+ event: 'logsUnsubscribe';
935
+ data: LogsUnsubscribe;
936
+ } | {
937
+ event: 'reboot';
938
+ } | {
939
+ event: 'powerOff';
940
+ } | {
941
+ event: 'factoryReset';
942
+ } | {
943
+ event: 'deviceGetNickname';
944
+ };
945
+ /**
946
+ * Webapp -> daemon wall-clock surface. The device has no
947
+ * battery-backed RTC, so time authority lives with the connected
948
+ * companion (or with iOS over iAP2's DeviceTimeUpdate).
949
+ */
950
+ export type ClientToBridgeTimeMsg = {
951
+ event: 'get';
952
+ };
953
+ /**
954
+ * Webapp -> daemon voice/NLU surface: mic mute control and manual
955
+ * capture triggering. May be unavailable on builds without the mic
956
+ * hardware or the NLU pipeline enabled.
957
+ */
958
+ export type ClientToBridgeVoiceMsg = {
959
+ event: 'cancel';
960
+ } | {
961
+ event: 'pushToTalk';
962
+ } | {
963
+ event: 'muteMic';
964
+ data: MicMute;
965
+ } | {
966
+ event: 'unmuteMic';
967
+ data: MicUnmute;
968
+ } | {
969
+ event: 'stateGet';
970
+ };
971
+ /**
972
+ * Webapp -> daemon webapp-management surface: enumerate installed webapps, inspect which one
973
+ * is active, switch the kiosk to a different webapp, and fetch icon bytes. All four verbs are
974
+ * request/reply.
975
+ */
976
+ export type ClientToBridgeWebappMsg = {
977
+ event: 'list';
978
+ } | {
979
+ event: 'current';
980
+ } | {
981
+ event: 'activate';
982
+ data: WebappActivate;
983
+ } | {
984
+ event: 'icon';
985
+ data: WebappIcon;
986
+ };
987
+ /**
988
+ * Broadcast when the gateway writes a new value for the active webapp.
989
+ * `value: None` means the entry was deleted; consumers should fall back
990
+ * to whatever default they declared.
991
+ */
992
+ export type ConfigChanged = {
993
+ key: string;
994
+ value: string | null;
995
+ };
996
+ /**
997
+ * Webapp request: read one config value for the currently active webapp,
998
+ * as most recently set by the gateway. This surface is read-only; only
999
+ * the gateway can write config.
1000
+ */
1001
+ export type ConfigGet = {
1002
+ key: string;
1003
+ };
1004
+ /**
1005
+ * Reply to `ConfigGet`.
1006
+ */
1007
+ export type ConfigGetReply = {
1008
+ key: string;
1009
+ /**
1010
+ * `None` when the gateway has never set this key, as opposed to an empty string.
1011
+ */
1012
+ value: string | null;
1013
+ };
1014
+ /**
1015
+ * Reply to `ConfigList`.
1016
+ */
1017
+ export type ConfigListReply = {
1018
+ entries: Array<ConfigEntry>;
1019
+ };
1020
+ /**
1021
+ * Payload for `bluetooth.connect`: connect to an already-paired
1022
+ * device by MAC.
1023
+ */
1024
+ export type ConnectBluetooth = {
1025
+ mac: string;
1026
+ };
1027
+ /**
1028
+ * The bluetooth device currently connected to the daemon.
1029
+ */
1030
+ export type ConnectedDevice = {
1031
+ name: string;
1032
+ mac: string;
1033
+ };
1034
+ /**
1035
+ * Current device nickname. `nickname: None` when the user hasn't set
1036
+ * one. Reply to `DeviceGetNickname`; daemon also broadcasts this as a
1037
+ * `DeviceNicknameChanged` event when the value mutates so webapps stay
1038
+ * in sync without polling.
1039
+ */
1040
+ export type DeviceNicknameReply = {
1041
+ nickname: string | null;
1042
+ };
1043
+ /**
1044
+ * Reply to `DiagnosticsGet`.
1045
+ */
1046
+ export type DiagnosticsReply = {
1047
+ diagnostics: Diagnostics;
1048
+ };
1049
+ /**
1050
+ * Set the manual backlight level. Ignored unless `mode == Manual`;
1051
+ * callers should pair with `setMode({ Manual })` when forcing a level.
1052
+ */
1053
+ export type DisplaySetLevel = {
1054
+ /**
1055
+ * Backlight level in `[0.0, 1.0]`.
1056
+ */
1057
+ level: number;
1058
+ };
1059
+ /**
1060
+ * Payload for `hardware.displaySetMode`: switch backlight control
1061
+ * between daemon-driven (`Auto`, following the ALS) and webapp-driven
1062
+ * (`Manual`, via `displaySetLevel`).
1063
+ */
1064
+ export type DisplaySetMode = {
1065
+ mode: BrightnessMode;
1066
+ };
1067
+ /**
1068
+ * Payload for `earcon`.
1069
+ */
1070
+ export type Earcon = {
1071
+ /**
1072
+ * Earcon name; must be one of `AudioCapabilities.earcons`.
1073
+ */
1074
+ name: string;
1075
+ };
1076
+ /**
1077
+ * Event: a library item's favorited status changed. Fired for changes made through this
1078
+ * client's own `favoritesToggle`/`favoritesSet`/`favoritesSetMany` calls as well as changes
1079
+ * made natively on the connected phone (e.g. in the Spotify or Apple Music app).
1080
+ */
1081
+ export type FavoriteChanged = {
1082
+ uri: string;
1083
+ liked: boolean;
1084
+ };
1085
+ /**
1086
+ * Payload for the `favoritesSet` command: set `item`'s favorited state explicitly. Fire-and-
1087
+ * forget; the result surfaces as a `FavoriteChanged` event.
1088
+ */
1089
+ export type FavoritesSet = {
1090
+ item: ItemRef;
1091
+ liked: boolean;
1092
+ };
1093
+ /**
1094
+ * Bulk favorites mutation. Webapps observing partial success listen
1095
+ * for `FavoriteChanged` events.
1096
+ */
1097
+ export type FavoritesSetMany = {
1098
+ entries: Array<FavoritesSet>;
1099
+ };
1100
+ /**
1101
+ * Payload for the `favoritesToggle` command: flip `item`'s favorited state (liked becomes
1102
+ * unliked and vice versa). Fire-and-forget; the result surfaces as a `FavoriteChanged` event.
1103
+ */
1104
+ export type FavoritesToggle = {
1105
+ item: ItemRef;
1106
+ };
1107
+ /**
1108
+ * Payload for `bluetooth.forget`: unpair a device and drop it from
1109
+ * the daemon's known-device set.
1110
+ */
1111
+ export type ForgetBluetooth = {
1112
+ mac: string;
1113
+ };
1114
+ /**
1115
+ * Error response to a failed `geo.watch` or `geo.getOnce` request.
1116
+ */
1117
+ export type GeoErrorReply = {
1118
+ error: GeoError;
1119
+ };
1120
+ /**
1121
+ * Payload for `geo.getOnce`: fetch a single phone-sourced position
1122
+ * fix without registering a standing watch.
1123
+ */
1124
+ export type GeoGetOnce = {
1125
+ accuracy: GeoAccuracy;
1126
+ };
1127
+ /**
1128
+ * Response to `geo.getOnce`.
1129
+ */
1130
+ export type GeoGetOnceReply = {
1131
+ position: Position;
1132
+ };
1133
+ /**
1134
+ * Stop a previously-issued watch. `token` is the value returned in
1135
+ * `GeoWatchReply.token`. The daemon refcounts watches across webapps;
1136
+ * the companion gets `Unwatch` only when the last token is released.
1137
+ */
1138
+ export type GeoUnwatch = {
1139
+ token: string;
1140
+ };
1141
+ /**
1142
+ * Payload for `geo.watch`: register a standing subscription for
1143
+ * phone-sourced position fixes. The daemon aggregates every active
1144
+ * watcher's `accuracy` and `min_interval_ms` and forwards the most
1145
+ * demanding combination to the companion.
1146
+ */
1147
+ export type GeoWatch = {
1148
+ accuracy: GeoAccuracy;
1149
+ /**
1150
+ * Minimum time between fixes, in milliseconds. The daemon uses the
1151
+ * smallest value across all active watchers.
1152
+ */
1153
+ minIntervalMs: number;
1154
+ };
1155
+ /**
1156
+ * Watch handle. Webapps pass the token back as
1157
+ * `ClientToBridgeGeoMsg::Unwatch { token }` to release the watch.
1158
+ * Tokens are scoped to the webapp's WS connection - the daemon
1159
+ * auto-releases on disconnect.
1160
+ */
1161
+ export type GeoWatchReply = {
1162
+ token: string;
1163
+ };
1164
+ /**
1165
+ * Response to `hardware.stateGet`.
1166
+ */
1167
+ export type HardwareStateReply = {
1168
+ state: HardwareState;
1169
+ };
1170
+ /**
1171
+ * Webapp request: delete the KV storage entry at `key`.
1172
+ */
1173
+ export type KVDelete = {
1174
+ key: string;
1175
+ };
1176
+ /**
1177
+ * Webapp request: read a value out of KV storage by key.
1178
+ */
1179
+ export type KVGet = {
1180
+ key: string;
1181
+ };
1182
+ /**
1183
+ * Webapp request: write a value to KV storage under `key`.
1184
+ */
1185
+ export type KVPut = {
1186
+ key: string;
1187
+ value: string;
1188
+ };
1189
+ /**
1190
+ * Payload for the `browse` request: page through a folder in the library tree, or the root
1191
+ * menu when `node_id` is `None`. Root-level results are cached by the daemon for up to 5
1192
+ * minutes, so a fresh call immediately after a library change on the gateway side may still
1193
+ * return the previous shelf layout.
1194
+ */
1195
+ export type LibraryBrowse = {
1196
+ /**
1197
+ * Folder to descend into, from a prior result's `BrowseFolder::node_id`. `None` browses the root.
1198
+ */
1199
+ nodeId: string | null;
1200
+ /**
1201
+ * Requested page size; the daemon clamps this to 100 regardless of the value sent.
1202
+ */
1203
+ limit: number;
1204
+ offset: number;
1205
+ /**
1206
+ * Root only: cap on the number of folders returned. `None` returns every folder.
1207
+ */
1208
+ sections?: number | null;
1209
+ /**
1210
+ * Root only: preview children per folder. `None` is the gateway default; `0` skips preview
1211
+ * hydration entirely and returns a cheap index of node ids, titles, and totals.
1212
+ */
1213
+ preview?: number | null;
1214
+ };
1215
+ export type LibraryBrowseReply = {
1216
+ result: BrowseResult;
1217
+ };
1218
+ export type LibraryErrorReply = {
1219
+ error: LibraryError;
1220
+ };
1221
+ /**
1222
+ * Batch "is each of these favorited?" lookup. Reply `liked` is
1223
+ * index-aligned with the request `uris`, capped at 50 per call.
1224
+ */
1225
+ export type LibraryFavoritesContains = {
1226
+ /**
1227
+ * Uris to check; the daemon truncates this to the first 50 regardless of the count sent.
1228
+ */
1229
+ uris: Array<string>;
1230
+ };
1231
+ export type LibraryFavoritesContainsReply = {
1232
+ /**
1233
+ * Index-aligned with the request's `uris`.
1234
+ */
1235
+ liked: Array<boolean>;
1236
+ };
1237
+ /**
1238
+ * Payload for the `favoritesList` request: page through the user's saved/liked library items,
1239
+ * mixed across kinds.
1240
+ */
1241
+ export type LibraryFavoritesList = {
1242
+ /**
1243
+ * Requested page size; the daemon clamps this to 100 regardless of the value sent.
1244
+ */
1245
+ limit: number;
1246
+ offset: number;
1247
+ };
1248
+ export type LibraryFavoritesListReply = {
1249
+ page: FavoritesPage;
1250
+ };
1251
+ /**
1252
+ * Recommendations seeded by up to 5 items. Spotify hard-caps at 5
1253
+ * combined seeds across tracks/artists/genres.
1254
+ */
1255
+ export type LibraryRecommendations = {
1256
+ /**
1257
+ * Seed items; the daemon truncates this to the first 5 regardless of the count sent.
1258
+ */
1259
+ seeds: Array<ItemRef>;
1260
+ /**
1261
+ * Restrict results to this item kind. `None` lets the gateway choose based on the seeds.
1262
+ */
1263
+ kind: ItemKind | null;
1264
+ /**
1265
+ * Requested page size; the daemon clamps this to 100 regardless of the value sent.
1266
+ */
1267
+ limit: number;
1268
+ offset: number;
1269
+ };
1270
+ export type LibraryRecommendationsReply = {
1271
+ result: RecommendationsResult;
1272
+ };
1273
+ /**
1274
+ * Payload for the `search` request: free-text search across the connected gateway's library.
1275
+ */
1276
+ export type LibrarySearch = {
1277
+ query: string;
1278
+ /**
1279
+ * Restrict results to these item kinds. `None` searches every kind.
1280
+ */
1281
+ kinds: Array<ItemKind> | null;
1282
+ /**
1283
+ * Requested page size; the daemon clamps this to 100 regardless of the value sent.
1284
+ */
1285
+ limit: number;
1286
+ offset: number;
1287
+ };
1288
+ export type LibrarySearchReply = {
1289
+ result: SearchResult;
1290
+ };
1291
+ /**
1292
+ * Open a streaming subscription. Daemon returns a `LogsSubscribeReply`
1293
+ * with an opaque token; webapp passes the token to `LogsUnsubscribe`
1294
+ * to release. Subscriptions are scoped to the WS connection - the
1295
+ * daemon auto-releases on disconnect.
1296
+ */
1297
+ export type LogsSubscribe = {
1298
+ /**
1299
+ * Reserved for selecting the log source; the daemon serves its own tracing stream regardless.
1300
+ */
1301
+ source: LogSource;
1302
+ /**
1303
+ * Allow-list of levels to include; an empty vector matches every level.
1304
+ */
1305
+ levels: Array<LogLevel>;
1306
+ /**
1307
+ * Case-sensitive substring match against `target` or `message`; `None` disables filtering.
1308
+ */
1309
+ filter: string | null;
1310
+ };
1311
+ /**
1312
+ * Reply to `LogsSubscribe`.
1313
+ */
1314
+ export type LogsSubscribeReply = {
1315
+ /**
1316
+ * Opaque handle; pass to `LogsUnsubscribe` to release the subscription.
1317
+ */
1318
+ token: string;
1319
+ };
1320
+ /**
1321
+ * Pull a one-shot batch of recent log entries. The source, levels, and
1322
+ * filter narrow the returned entries.
1323
+ */
1324
+ export type LogsTail = {
1325
+ /**
1326
+ * Reserved for selecting the log source; the daemon serves its own tracing stream regardless.
1327
+ */
1328
+ source: LogSource;
1329
+ /**
1330
+ * Allow-list of levels to include; an empty vector matches every level.
1331
+ */
1332
+ levels: Array<LogLevel>;
1333
+ /**
1334
+ * Case-sensitive substring match against `target` or `message`; `None` disables filtering.
1335
+ */
1336
+ filter: string | null;
1337
+ /**
1338
+ * Caps how many of the most recent matching entries return, in chronological order.
1339
+ */
1340
+ maxLines: number;
1341
+ };
1342
+ /**
1343
+ * Reply to `LogsTail`.
1344
+ */
1345
+ export type LogsTailReply = {
1346
+ /**
1347
+ * Matching entries in chronological order (oldest first).
1348
+ */
1349
+ entries: Array<LogEntry>;
1350
+ };
1351
+ /**
1352
+ * Release a log stream opened by `LogsSubscribe`. Fire-and-forget: unknown
1353
+ * or malformed tokens are silently ignored rather than surfacing an error.
1354
+ */
1355
+ export type LogsUnsubscribe = {
1356
+ token: string;
1357
+ };
1358
+ /**
1359
+ * Payload for `voice.muteMic`.
1360
+ */
1361
+ export type MicMute = {
1362
+ /**
1363
+ * When true and a capture session is already in progress, let it
1364
+ * keep running instead of cutting it short.
1365
+ */
1366
+ preserve: boolean;
1367
+ };
1368
+ /**
1369
+ * Payload for `voice.unmuteMic`.
1370
+ */
1371
+ export type MicUnmute = {
1372
+ /**
1373
+ * Accepted for symmetry with `MicMute`; the daemon ignores it on
1374
+ * unmute.
1375
+ */
1376
+ preserve: boolean;
1377
+ };
1378
+ /**
1379
+ * Payload for `net.fetch`: a single proxied HTTP request/response
1380
+ * round-trip through the connected companion's network stack.
1381
+ */
1382
+ export type NetFetch = {
1383
+ request: NetFetchRequest;
1384
+ };
1385
+ /**
1386
+ * Error response to `net.fetch`.
1387
+ */
1388
+ export type NetFetchErrorReply = {
1389
+ error: NetError;
1390
+ };
1391
+ /**
1392
+ * Response to `net.fetch`.
1393
+ */
1394
+ export type NetFetchReply = {
1395
+ response: NetFetchResponse;
1396
+ };
1397
+ /**
1398
+ * Payload for `net.stream.cancel`. Ignored by the daemon if
1399
+ * `stream_id` isn't owned by the calling webapp.
1400
+ */
1401
+ export type NetStreamCancel = {
1402
+ streamId: string;
1403
+ };
1404
+ /**
1405
+ * Payload for `net.stream.open`: like `fetch` but delivers the
1406
+ * response body incrementally as `StreamChunk` events instead of one
1407
+ * frame. `stream_id` is assigned by the webapp.
1408
+ */
1409
+ export type NetStreamOpen = {
1410
+ streamId: string;
1411
+ request: NetFetchRequest;
1412
+ };
1413
+ /**
1414
+ * Payload for `net.ws.close`. Ignored by the daemon if `connection_id`
1415
+ * isn't owned by the calling webapp.
1416
+ */
1417
+ export type NetWsClose = {
1418
+ connectionId: string;
1419
+ code: number | null;
1420
+ reason: string | null;
1421
+ };
1422
+ /**
1423
+ * The WebSocket closed, locally or by the remote end.
1424
+ */
1425
+ export type NetWsClosed = {
1426
+ connectionId: string;
1427
+ code: number;
1428
+ reason: string;
1429
+ };
1430
+ /**
1431
+ * Asynchronous WebSocket failure after `net.ws.open` already
1432
+ * succeeded.
1433
+ */
1434
+ export type NetWsErrorEvent = {
1435
+ connectionId: string;
1436
+ error: WsError;
1437
+ };
1438
+ /**
1439
+ * Error response to `net.ws.open`.
1440
+ */
1441
+ export type NetWsErrorReply = {
1442
+ error: WsError;
1443
+ };
1444
+ /**
1445
+ * One inbound frame on an open WebSocket.
1446
+ */
1447
+ export type NetWsMessage = {
1448
+ connectionId: string;
1449
+ frame: WsFrame;
1450
+ };
1451
+ /**
1452
+ * Payload for `net.ws.open`: establish a WebSocket routed through the
1453
+ * companion. `connection_id` is assigned by the webapp up front so
1454
+ * inbound frame/close/error routing is wired before the companion's
1455
+ * ack arrives.
1456
+ */
1457
+ export type NetWsOpen = {
1458
+ connectionId: string;
1459
+ url: string;
1460
+ /**
1461
+ * Subprotocols offered to the server, in preference order.
1462
+ */
1463
+ protocols: Array<string> | null;
1464
+ headers: Array<HttpHeader> | null;
1465
+ };
1466
+ /**
1467
+ * Response to `net.ws.open`.
1468
+ */
1469
+ export type NetWsOpenReply = {
1470
+ /**
1471
+ * The subprotocol the server selected, when `NetWsOpen.protocols`
1472
+ * offered a list.
1473
+ */
1474
+ acceptedProtocol: string | null;
1475
+ };
1476
+ /**
1477
+ * Payload for `net.ws.send`.
1478
+ */
1479
+ export type NetWsSend = {
1480
+ connectionId: string;
1481
+ frame: WsFrame;
1482
+ };
1483
+ /**
1484
+ * Payload for `invokePositive` and `invokeNegative`.
1485
+ */
1486
+ export type NotificationInvoke = {
1487
+ /**
1488
+ * Notification id to act on, from `Notification.id`.
1489
+ */
1490
+ id: string;
1491
+ };
1492
+ export type NotificationRemoved = {
1493
+ /**
1494
+ * Id of the notification that was removed, from `Notification.id`.
1495
+ */
1496
+ id: string;
1497
+ reason: DismissReason;
1498
+ };
1499
+ /**
1500
+ * Map of MAC string to `Device`.
1501
+ */
1502
+ export type PairedDevicesMap = {
1503
+ [key in string]: Device;
1504
+ };
1505
+ /**
1506
+ * Map of peer-id to `Peer`.
1507
+ */
1508
+ export type PeerSnapshotMap = {
1509
+ [key in string]: Peer;
1510
+ };
1511
+ /**
1512
+ * Explicit-action variant of `Answer`. `Accept` (default) places any
1513
+ * existing active call on hold; `EndAndAccept` ends the existing call
1514
+ * first. Webapps gate on `CommunicationsState.hold_and_accept_available`
1515
+ * or `end_and_accept_available` before sending the non-default action.
1516
+ */
1517
+ export type PhoneAcceptAction = {
1518
+ /**
1519
+ * Target call, as surfaced on `PhoneCall.call_id`.
1520
+ */
1521
+ callId: string;
1522
+ action: AcceptCallAction;
1523
+ };
1524
+ /**
1525
+ * Payload for `answer`, `decline`, `end`, `hold`, and `unhold`: the call to act on.
1526
+ */
1527
+ export type PhoneCallAction = {
1528
+ /**
1529
+ * Target call, as surfaced on `PhoneCall.call_id`.
1530
+ */
1531
+ callId: string;
1532
+ };
1533
+ export type PhoneCallEnded = {
1534
+ /**
1535
+ * Echoes `PhoneCall.call_id` for the call that just ended.
1536
+ */
1537
+ callId: string;
1538
+ reason: CallEndReason;
1539
+ };
1540
+ /**
1541
+ * Broadcast whenever `CommunicationsState` changes: signal, registration,
1542
+ * or which call-control verbs are currently legal.
1543
+ */
1544
+ export type PhoneCommunicationsReply = {
1545
+ state: CommunicationsState;
1546
+ };
1547
+ /**
1548
+ * Payload for `dtmf`: play a tone on an active call.
1549
+ */
1550
+ export type PhoneDtmfAction = {
1551
+ /**
1552
+ * Call to send the tone on; `None` targets the active call.
1553
+ */
1554
+ callId: string | null;
1555
+ tone: DtmfTone;
1556
+ };
1557
+ /**
1558
+ * Explicit-action variant of `End`. `End` (default) ends the named
1559
+ * call; `EndAll` ends every active call (multi-call / conference).
1560
+ */
1561
+ export type PhoneEndAction = {
1562
+ /**
1563
+ * Target call, as surfaced on `PhoneCall.call_id`.
1564
+ */
1565
+ callId: string;
1566
+ action: EndCallAction;
1567
+ };
1568
+ /**
1569
+ * Response when a phone command could not be carried out.
1570
+ */
1571
+ export type PhoneErrorReply = {
1572
+ error: PhoneError;
1573
+ };
1574
+ /**
1575
+ * Payload for `initiate`: place an outbound call.
1576
+ */
1577
+ export type PhoneInitiateAction = {
1578
+ /**
1579
+ * What kind of outbound call to place.
1580
+ */
1581
+ kind: InitiateCallType;
1582
+ /**
1583
+ * Destination address (e.g. phone number) for `Destination` calls; ignored for `Voicemail`/`Redial`.
1584
+ */
1585
+ destinationId: string | null;
1586
+ /**
1587
+ * Call bearer to use; `None` lets the companion pick its default.
1588
+ */
1589
+ service: PhoneCallService | null;
1590
+ /**
1591
+ * Contact id to associate with the call, when known.
1592
+ */
1593
+ addressBookId: string | null;
1594
+ };
1595
+ /**
1596
+ * Payload for `mute`: mic-mute state for the active call.
1597
+ */
1598
+ export type PhoneMuteAction = {
1599
+ /**
1600
+ * `true` mutes the mic, `false` unmutes.
1601
+ */
1602
+ mute: boolean;
1603
+ };
1604
+ /**
1605
+ * Response to `stateGet`.
1606
+ */
1607
+ export type PhoneStateReply = {
1608
+ state: PhoneState;
1609
+ };
1610
+ /**
1611
+ * Payload for the `play` command.
1612
+ */
1613
+ export type PlayUri = {
1614
+ /**
1615
+ * Resource to play, e.g. `spotify:track:...`; any uri scheme a connected gateway claims.
1616
+ */
1617
+ uri: string;
1618
+ /**
1619
+ * Optional album/playlist/show to play `uri` within, so next/prev follow that list.
1620
+ */
1621
+ context: PlayContext | null;
1622
+ };
1623
+ export type PlayerErrorReply = {
1624
+ error: PlayerError;
1625
+ };
1626
+ /**
1627
+ * Response to `queueGet`, also carried by the `QueueChanged` event.
1628
+ */
1629
+ export type PlayerQueueReply = {
1630
+ /**
1631
+ * The now-playing track, when one is loaded.
1632
+ */
1633
+ current: QueueItem | null;
1634
+ /**
1635
+ * Upcoming tracks in queue order.
1636
+ */
1637
+ items: Array<QueueItem>;
1638
+ /**
1639
+ * Recently-played history.
1640
+ */
1641
+ previous: Array<QueueItem>;
1642
+ };
1643
+ /**
1644
+ * Response to `stateGet`, also carried by the `Snapshot` event.
1645
+ */
1646
+ export type PlayerStateReply = {
1647
+ state: PlayerState;
1648
+ /**
1649
+ * The app currently driving playback, when known (iOS surfaces this over iAP2).
1650
+ */
1651
+ activeApp: CurrentlyActiveApplication | null;
1652
+ };
1653
+ /**
1654
+ * Payload for the `queue` command.
1655
+ */
1656
+ export type QueueUri = {
1657
+ /**
1658
+ * Resource to enqueue.
1659
+ */
1660
+ uri: string;
1661
+ /**
1662
+ * Where in the queue it lands (append / next / explicit index).
1663
+ */
1664
+ position: QueuePosition;
1665
+ };
1666
+ /**
1667
+ * Payload for `seekTo`: jump to an absolute playhead position.
1668
+ */
1669
+ export type SeekTo = {
1670
+ /**
1671
+ * Target playhead in milliseconds from track start.
1672
+ */
1673
+ positionMs: number;
1674
+ };
1675
+ /**
1676
+ * Payload for `bluetooth.setAlias`: rename the device's own adapter
1677
+ * as seen by peers during discovery and pairing.
1678
+ */
1679
+ export type SetBluetoothAlias = {
1680
+ name: string;
1681
+ };
1682
+ /**
1683
+ * Payload for `setCrossfade`.
1684
+ */
1685
+ export type SetCrossfade = {
1686
+ /**
1687
+ * Crossfade duration in milliseconds; `None` turns crossfade off.
1688
+ */
1689
+ durationMs: number | null;
1690
+ };
1691
+ /**
1692
+ * Payload for `setMute`.
1693
+ */
1694
+ export type SetMute = {
1695
+ /**
1696
+ * `true` mutes output, `false` unmutes.
1697
+ */
1698
+ muted: boolean;
1699
+ };
1700
+ /**
1701
+ * Payload for `setRepeat`.
1702
+ */
1703
+ export type SetRepeat = {
1704
+ /**
1705
+ * Desired repeat mode (off / all / one).
1706
+ */
1707
+ mode: RepeatMode;
1708
+ };
1709
+ /**
1710
+ * Payload for `setShuffle`.
1711
+ */
1712
+ export type SetShuffle = {
1713
+ /**
1714
+ * Desired shuffle state.
1715
+ */
1716
+ on: boolean;
1717
+ };
1718
+ /**
1719
+ * Payload for `setSpeed`. Honored only by gateways that support rate control.
1720
+ */
1721
+ export type SetSpeed = {
1722
+ /**
1723
+ * Playback rate; 1.0 is normal speed.
1724
+ */
1725
+ speed: number;
1726
+ };
1727
+ /**
1728
+ * Payload for `setVolume`.
1729
+ */
1730
+ export type SetVolume = {
1731
+ /**
1732
+ * Absolute output level, `0.0` (silent) to `1.0` (max).
1733
+ */
1734
+ level: number;
1735
+ };
1736
+ /**
1737
+ * Payload for `skipPrev`: go to the previous track, or restart the current one.
1738
+ */
1739
+ export type SkipPrev = {
1740
+ /**
1741
+ * When true, restart the current track if it is progressed past the restart threshold; otherwise always move to the previous track.
1742
+ */
1743
+ allowSeeking: boolean;
1744
+ };
1745
+ /**
1746
+ * Payload for `skipToIndex`: jump to a specific row in the current queue.
1747
+ */
1748
+ export type SkipToIndex = {
1749
+ /**
1750
+ * 0-based index into the queue.
1751
+ */
1752
+ index: number;
1753
+ };
1754
+ /**
1755
+ * Reply to `KVGet`, `KVPut`, and `KVDelete` alike; the request that
1756
+ * produced it distinguishes which operation happened.
1757
+ */
1758
+ export type StorageResponse = {
1759
+ key: string;
1760
+ /**
1761
+ * `None` on a `Get` miss or after a `Delete`; `Put` always echoes back `Some` of what it just wrote.
1762
+ */
1763
+ value: string | null;
1764
+ };
1765
+ /**
1766
+ * Wraps `TimeInfo` for the wire; used as both the `time.get` reply and
1767
+ * the `Changed` event payload.
1768
+ */
1769
+ export type TimeSnapshot = {
1770
+ time: TimeInfo;
1771
+ };
1772
+ /**
1773
+ * Fire-and-forget TTS request. `id` is webapp-assigned and used both
1774
+ * for cancellation and for matching back-to-back `TtsStarted`/`TtsEnded`
1775
+ * events. `voice` selects from `AudioCapabilities.voices`; `None` uses
1776
+ * the gateway default.
1777
+ */
1778
+ export type Tts = {
1779
+ id: string;
1780
+ text: string;
1781
+ voice: string | null;
1782
+ };
1783
+ /**
1784
+ * Payload for `ttsCancel`.
1785
+ */
1786
+ export type TtsCancel = {
1787
+ /**
1788
+ * Id of the in-flight `Tts` request to cancel, as passed to `Tts.id`.
1789
+ */
1790
+ id: string;
1791
+ };
1792
+ /**
1793
+ * Fired when a `Tts` request stops playing, whether it finished or was cut short.
1794
+ */
1795
+ export type TtsEnded = {
1796
+ /**
1797
+ * Echoes `Tts.id`.
1798
+ */
1799
+ id: string;
1800
+ /**
1801
+ * `true` if playback finished naturally; `false` if cancelled or interrupted.
1802
+ */
1803
+ completed: boolean;
1804
+ };
1805
+ /**
1806
+ * Fired when a `Tts` request begins audibly playing.
1807
+ */
1808
+ export type TtsStarted = {
1809
+ /**
1810
+ * Echoes `Tts.id`.
1811
+ */
1812
+ id: string;
1813
+ };
1814
+ /**
1815
+ * Current mic state.
1816
+ */
1817
+ export type VoiceState = {
1818
+ muted: boolean;
1819
+ /**
1820
+ * True while a capture session is actively recording.
1821
+ */
1822
+ capturing: boolean;
1823
+ };
1824
+ /**
1825
+ * Response to `voice.stateGet`.
1826
+ */
1827
+ export type VoiceStateReply = {
1828
+ state: VoiceState;
1829
+ };
1830
+ /**
1831
+ * Current output level and mute state, broadcast after any change
1832
+ * regardless of whether this webapp issued the command.
1833
+ */
1834
+ export type VolumeChanged = {
1835
+ /**
1836
+ * Absolute output level, `0.0` (silent) to `1.0` (max).
1837
+ */
1838
+ level: number;
1839
+ muted: boolean;
1840
+ };
1841
+ /**
1842
+ * Payload for the `activate` request: switch the kiosk to the given webapp. The kiosk runs
1843
+ * exactly one webapp at a time, so the daemon navigates it away from whatever was previously
1844
+ * active.
1845
+ */
1846
+ export type WebappActivate = {
1847
+ /**
1848
+ * Id of an installed webapp, from `webapp.list`.
1849
+ */
1850
+ id: string;
1851
+ };
1852
+ /**
1853
+ * Broadcast when the active webapp changes; carries the new active webapp's name.
1854
+ */
1855
+ export type WebappActiveChanged = {
1856
+ name: string;
1857
+ };
1858
+ export type WebappActiveReply = {
1859
+ /**
1860
+ * Id of the webapp that was just activated.
1861
+ */
1862
+ id: string | null;
1863
+ name: string | null;
1864
+ };
1865
+ export type WebappCurrentReply = {
1866
+ /**
1867
+ * `None` when no webapp is currently active in the kiosk.
1868
+ */
1869
+ id: string | null;
1870
+ name: string | null;
1871
+ };
1872
+ /**
1873
+ * Fetch the icon bytes for an installed webapp. Returns the raw bytes
1874
+ * declared by the manifest's `icon` field.
1875
+ */
1876
+ export type WebappIcon = {
1877
+ /**
1878
+ * Id of an installed webapp, from `webapp.list`.
1879
+ */
1880
+ id: string;
1881
+ };
1882
+ /**
1883
+ * Reply to the `icon` request: the raw icon bytes declared by the webapp's manifest.
1884
+ */
1885
+ export type WebappIconReply = {
1886
+ bytes: Uint8Array;
1887
+ /**
1888
+ * MIME type declared by the manifest's icon; `None` if the manifest didn't declare one.
1889
+ */
1890
+ mime: string | null;
1891
+ };
1892
+ export type WebappListReply = {
1893
+ /**
1894
+ * Excludes `Launcher`-role bundles used as alternate home screens.
1895
+ */
1896
+ webapps: Array<WebappInfo>;
1897
+ };
1898
+ /**
1899
+ * Broadcast when an installed webapp is removed; carries the removed webapp's name.
1900
+ */
1901
+ export type WebappUninstalled = {
1902
+ name: string;
1903
+ };
1904
+ //# sourceMappingURL=client.d.ts.map