@poolse/sdk 3.2.0-dev.0 → 3.2.0-dev.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.
package/dist/index.d.cts CHANGED
@@ -549,6 +549,8 @@ interface LiveCall {
549
549
  ring_states: Record<string, 'ringing' | 'answered' | 'declined' | 'missed'>;
550
550
  /** The workspace's call limits (dashboard → Calls). False: hide the camera button. */
551
551
  video_allowed?: boolean;
552
+ /** Whether the workspace lets people share a screen in calls. */
553
+ screen_share_allowed?: boolean;
552
554
  /** How many people the call holds; one more joining is refused with `call_full`. */
553
555
  max_participants?: number;
554
556
  }
@@ -579,6 +581,7 @@ interface MessageDeletedEvent {
579
581
  *
580
582
  * * `started`: the agent began writing (carries `sender_external_id`).
581
583
  * * `delta`: the next piece of text; append it.
584
+ * * `tool`: the agent is running one of its tools (`tool` is its name).
582
585
  * * `failed`: the agent couldn't answer; nothing will be posted.
583
586
  *
584
587
  * The finished reply arrives as a normal `message:new` whose `id`
@@ -588,9 +591,10 @@ interface MessageStreamEvent {
588
591
  id: Uuid;
589
592
  conversation_id: Uuid;
590
593
  sender_id: Uuid;
591
- status: 'started' | 'delta' | 'failed';
594
+ status: 'started' | 'delta' | 'tool' | 'failed';
592
595
  sender_external_id?: string | null;
593
596
  delta?: string;
597
+ tool?: string;
594
598
  error?: string;
595
599
  }
596
600
  /** `typing:start` / `typing:stop`. */
@@ -1322,6 +1326,7 @@ interface LiveKitParticipant {
1322
1326
  name?: string | undefined;
1323
1327
  isMicrophoneEnabled?: boolean;
1324
1328
  isCameraEnabled?: boolean;
1329
+ isScreenShareEnabled?: boolean;
1325
1330
  isSpeaking?: boolean;
1326
1331
  getTrackPublication(source: string): LiveKitPublication | undefined;
1327
1332
  }
@@ -1335,6 +1340,15 @@ interface LiveKitLocalParticipant extends LiveKitParticipant {
1335
1340
  facingMode?: CameraFacing;
1336
1341
  }): Promise<unknown>;
1337
1342
  setMicrophoneEnabled(enabled: boolean): Promise<unknown>;
1343
+ /**
1344
+ * Publish a screen or window. On the web the browser shows its own
1345
+ * picker; `audio` asks for the tab's or system's sound with it, which
1346
+ * the browser may not offer. Optional because a React Native build
1347
+ * without screen capture wired up has no such method.
1348
+ */
1349
+ setScreenShareEnabled?(enabled: boolean, options?: {
1350
+ audio?: boolean;
1351
+ }): Promise<unknown>;
1338
1352
  }
1339
1353
  interface LiveKitRoomHandle {
1340
1354
  localParticipant: LiveKitLocalParticipant;
@@ -1464,6 +1478,16 @@ interface CallParticipant {
1464
1478
  * the view is drawn at.
1465
1479
  */
1466
1480
  videoTrackRef: LiveKitTrackReference | null;
1481
+ /** Sharing a screen or window right now. */
1482
+ screenSharing: boolean;
1483
+ /**
1484
+ * The shared screen, or null. Separate from {@link videoTrack}: someone
1485
+ * can share with their camera on, and the two are drawn differently
1486
+ * (the screen large and uncropped, the camera as a face).
1487
+ */
1488
+ screenTrack: LiveKitTrack | null;
1489
+ /** The shared screen as a renderable reference, for React Native's `<VideoTrack>`. */
1490
+ screenTrackRef: LiveKitTrackReference | null;
1467
1491
  }
1468
1492
  interface CallRoomOptions {
1469
1493
  /**
@@ -1662,6 +1686,29 @@ declare class CallRoom {
1662
1686
  * selected anyway.
1663
1687
  */
1664
1688
  switchCamera(): Promise<void>;
1689
+ /**
1690
+ * Share a screen or window, or stop sharing.
1691
+ *
1692
+ * On the web the browser opens its own picker. Closing it without
1693
+ * choosing is not an error: the call carries on and nothing is
1694
+ * reported. Stopping from the browser's own "Stop sharing" bar ends
1695
+ * the share the same way, and the roster follows.
1696
+ *
1697
+ * A workspace with screen sharing off (or out of video minutes) has a
1698
+ * media token that cannot publish a screen; LiveKit refuses it and the
1699
+ * refusal arrives through `onError`. Hide the control instead using
1700
+ * the call's `screen_share_allowed`.
1701
+ */
1702
+ setScreenShareEnabled(enabled: boolean, options?: {
1703
+ audio?: boolean;
1704
+ }): Promise<void>;
1705
+ isScreenShareEnabled(): boolean;
1706
+ /**
1707
+ * Whether this platform can share a screen at all: a browser with
1708
+ * `getDisplayMedia` (not phone browsers), or a native build with
1709
+ * screen capture. Only meaningful once joined on native.
1710
+ */
1711
+ canShareScreen(): boolean;
1665
1712
  /** Which camera the local video track is capturing from. */
1666
1713
  getFacingMode(): CameraFacing;
1667
1714
  /**
@@ -1859,7 +1906,7 @@ declare class AuthError extends ApiError {
1859
1906
  */
1860
1907
  type CallMedia = 'audio' | 'video';
1861
1908
 
1862
- declare const version = "3.2.0-dev.0";
1909
+ declare const version = "3.2.0-dev.2";
1863
1910
 
1864
1911
  type CallLogMedia = 'audio' | 'video';
1865
1912
  /** What became of one person a call involved (the caller excluded). */
package/dist/index.d.ts CHANGED
@@ -549,6 +549,8 @@ interface LiveCall {
549
549
  ring_states: Record<string, 'ringing' | 'answered' | 'declined' | 'missed'>;
550
550
  /** The workspace's call limits (dashboard → Calls). False: hide the camera button. */
551
551
  video_allowed?: boolean;
552
+ /** Whether the workspace lets people share a screen in calls. */
553
+ screen_share_allowed?: boolean;
552
554
  /** How many people the call holds; one more joining is refused with `call_full`. */
553
555
  max_participants?: number;
554
556
  }
@@ -579,6 +581,7 @@ interface MessageDeletedEvent {
579
581
  *
580
582
  * * `started`: the agent began writing (carries `sender_external_id`).
581
583
  * * `delta`: the next piece of text; append it.
584
+ * * `tool`: the agent is running one of its tools (`tool` is its name).
582
585
  * * `failed`: the agent couldn't answer; nothing will be posted.
583
586
  *
584
587
  * The finished reply arrives as a normal `message:new` whose `id`
@@ -588,9 +591,10 @@ interface MessageStreamEvent {
588
591
  id: Uuid;
589
592
  conversation_id: Uuid;
590
593
  sender_id: Uuid;
591
- status: 'started' | 'delta' | 'failed';
594
+ status: 'started' | 'delta' | 'tool' | 'failed';
592
595
  sender_external_id?: string | null;
593
596
  delta?: string;
597
+ tool?: string;
594
598
  error?: string;
595
599
  }
596
600
  /** `typing:start` / `typing:stop`. */
@@ -1322,6 +1326,7 @@ interface LiveKitParticipant {
1322
1326
  name?: string | undefined;
1323
1327
  isMicrophoneEnabled?: boolean;
1324
1328
  isCameraEnabled?: boolean;
1329
+ isScreenShareEnabled?: boolean;
1325
1330
  isSpeaking?: boolean;
1326
1331
  getTrackPublication(source: string): LiveKitPublication | undefined;
1327
1332
  }
@@ -1335,6 +1340,15 @@ interface LiveKitLocalParticipant extends LiveKitParticipant {
1335
1340
  facingMode?: CameraFacing;
1336
1341
  }): Promise<unknown>;
1337
1342
  setMicrophoneEnabled(enabled: boolean): Promise<unknown>;
1343
+ /**
1344
+ * Publish a screen or window. On the web the browser shows its own
1345
+ * picker; `audio` asks for the tab's or system's sound with it, which
1346
+ * the browser may not offer. Optional because a React Native build
1347
+ * without screen capture wired up has no such method.
1348
+ */
1349
+ setScreenShareEnabled?(enabled: boolean, options?: {
1350
+ audio?: boolean;
1351
+ }): Promise<unknown>;
1338
1352
  }
1339
1353
  interface LiveKitRoomHandle {
1340
1354
  localParticipant: LiveKitLocalParticipant;
@@ -1464,6 +1478,16 @@ interface CallParticipant {
1464
1478
  * the view is drawn at.
1465
1479
  */
1466
1480
  videoTrackRef: LiveKitTrackReference | null;
1481
+ /** Sharing a screen or window right now. */
1482
+ screenSharing: boolean;
1483
+ /**
1484
+ * The shared screen, or null. Separate from {@link videoTrack}: someone
1485
+ * can share with their camera on, and the two are drawn differently
1486
+ * (the screen large and uncropped, the camera as a face).
1487
+ */
1488
+ screenTrack: LiveKitTrack | null;
1489
+ /** The shared screen as a renderable reference, for React Native's `<VideoTrack>`. */
1490
+ screenTrackRef: LiveKitTrackReference | null;
1467
1491
  }
1468
1492
  interface CallRoomOptions {
1469
1493
  /**
@@ -1662,6 +1686,29 @@ declare class CallRoom {
1662
1686
  * selected anyway.
1663
1687
  */
1664
1688
  switchCamera(): Promise<void>;
1689
+ /**
1690
+ * Share a screen or window, or stop sharing.
1691
+ *
1692
+ * On the web the browser opens its own picker. Closing it without
1693
+ * choosing is not an error: the call carries on and nothing is
1694
+ * reported. Stopping from the browser's own "Stop sharing" bar ends
1695
+ * the share the same way, and the roster follows.
1696
+ *
1697
+ * A workspace with screen sharing off (or out of video minutes) has a
1698
+ * media token that cannot publish a screen; LiveKit refuses it and the
1699
+ * refusal arrives through `onError`. Hide the control instead using
1700
+ * the call's `screen_share_allowed`.
1701
+ */
1702
+ setScreenShareEnabled(enabled: boolean, options?: {
1703
+ audio?: boolean;
1704
+ }): Promise<void>;
1705
+ isScreenShareEnabled(): boolean;
1706
+ /**
1707
+ * Whether this platform can share a screen at all: a browser with
1708
+ * `getDisplayMedia` (not phone browsers), or a native build with
1709
+ * screen capture. Only meaningful once joined on native.
1710
+ */
1711
+ canShareScreen(): boolean;
1665
1712
  /** Which camera the local video track is capturing from. */
1666
1713
  getFacingMode(): CameraFacing;
1667
1714
  /**
@@ -1859,7 +1906,7 @@ declare class AuthError extends ApiError {
1859
1906
  */
1860
1907
  type CallMedia = 'audio' | 'video';
1861
1908
 
1862
- declare const version = "3.2.0-dev.0";
1909
+ declare const version = "3.2.0-dev.2";
1863
1910
 
1864
1911
  type CallLogMedia = 'audio' | 'video';
1865
1912
  /** What became of one person a call involved (the caller excluded). */
package/dist/index.js CHANGED
@@ -1421,6 +1421,56 @@ var CallRoom = class {
1421
1421
  this.emitError(new Error(`could not switch camera: ${String(err)}`));
1422
1422
  }
1423
1423
  }
1424
+ /**
1425
+ * Share a screen or window, or stop sharing.
1426
+ *
1427
+ * On the web the browser opens its own picker. Closing it without
1428
+ * choosing is not an error: the call carries on and nothing is
1429
+ * reported. Stopping from the browser's own "Stop sharing" bar ends
1430
+ * the share the same way, and the roster follows.
1431
+ *
1432
+ * A workspace with screen sharing off (or out of video minutes) has a
1433
+ * media token that cannot publish a screen; LiveKit refuses it and the
1434
+ * refusal arrives through `onError`. Hide the control instead using
1435
+ * the call's `screen_share_allowed`.
1436
+ */
1437
+ async setScreenShareEnabled(enabled, options = {}) {
1438
+ const room = this.room;
1439
+ if (!room) return;
1440
+ const local = room.localParticipant;
1441
+ if (!local.setScreenShareEnabled) {
1442
+ this.emitError(new Error("screen sharing is not available on this platform"));
1443
+ return;
1444
+ }
1445
+ try {
1446
+ await local.setScreenShareEnabled(
1447
+ enabled,
1448
+ enabled ? { audio: options.audio ?? true } : void 0
1449
+ );
1450
+ this.emitParticipants();
1451
+ } catch (err) {
1452
+ const name = err?.name;
1453
+ if (name === "NotAllowedError" || name === "AbortError") {
1454
+ this.emitParticipants();
1455
+ return;
1456
+ }
1457
+ this.emitError(new Error(`could not share the screen: ${String(err)}`));
1458
+ }
1459
+ }
1460
+ isScreenShareEnabled() {
1461
+ return this.room?.localParticipant.isScreenShareEnabled ?? false;
1462
+ }
1463
+ /**
1464
+ * Whether this platform can share a screen at all: a browser with
1465
+ * `getDisplayMedia` (not phone browsers), or a native build with
1466
+ * screen capture. Only meaningful once joined on native.
1467
+ */
1468
+ canShareScreen() {
1469
+ const local = this.room?.localParticipant;
1470
+ if (local && !local.setScreenShareEnabled) return false;
1471
+ if (typeof document === "undefined") return !!local?.setScreenShareEnabled;
1472
+ return typeof globalThis.navigator?.mediaDevices?.getDisplayMedia === "function";
1473
+ }
1424
1474
  /** Which camera the local video track is capturing from. */
1425
1475
  getFacingMode() {
1426
1476
  return this.facing;
@@ -1587,6 +1637,9 @@ var CallRoom = class {
1587
1637
  const publication = participant.getTrackPublication(cameraSource);
1588
1638
  const live = publication && !publication.isMuted && publication.track ? publication : null;
1589
1639
  const videoTrack = live?.track ?? null;
1640
+ const screenSource = this.livekit.Track.Source["ScreenShare"] ?? "screen_share";
1641
+ const screenPublication = participant.getTrackPublication(screenSource);
1642
+ const screen = screenPublication && !screenPublication.isMuted && screenPublication.track ? screenPublication : null;
1590
1643
  return {
1591
1644
  userId: participant.identity,
1592
1645
  name: participant.name,
@@ -1595,7 +1648,10 @@ var CallRoom = class {
1595
1648
  cameraEnabled: participant.isCameraEnabled ?? false,
1596
1649
  speaking: participant.isSpeaking ?? false,
1597
1650
  videoTrack,
1598
- videoTrackRef: live ? { participant, publication: live, source: cameraSource } : null
1651
+ videoTrackRef: live ? { participant, publication: live, source: cameraSource } : null,
1652
+ screenSharing: !!screen,
1653
+ screenTrack: screen?.track ?? null,
1654
+ screenTrackRef: screen ? { participant, publication: screen, source: screenSource } : null
1599
1655
  };
1600
1656
  }
1601
1657
  async teardown() {
@@ -1984,7 +2040,7 @@ var Poolse = class {
1984
2040
  };
1985
2041
 
1986
2042
  // src/version.ts
1987
- var version = "3.2.0-dev.0";
2043
+ var version = "3.2.0-dev.2";
1988
2044
 
1989
2045
  // src/call-log.ts
1990
2046
  function parseCallLogBody(body) {