@poolse/react 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/CHANGELOG.md +13 -0
- package/dist/index.cjs +31 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -334,6 +334,8 @@ interface MessageStream {
|
|
|
334
334
|
/** The text so far; empty until the first delta. */
|
|
335
335
|
text: string;
|
|
336
336
|
status: 'streaming' | 'failed';
|
|
337
|
+
/** The tool the agent is running right now, if any (cleared by the next text). */
|
|
338
|
+
tool?: string;
|
|
337
339
|
error?: string;
|
|
338
340
|
}
|
|
339
341
|
/**
|
|
@@ -538,6 +540,19 @@ interface UseCallRoom {
|
|
|
538
540
|
participants: CallParticipant[];
|
|
539
541
|
cameraEnabled: boolean;
|
|
540
542
|
micEnabled: boolean;
|
|
543
|
+
/** You are sharing a screen or window. */
|
|
544
|
+
screenSharing: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Whoever is sharing a screen right now (you included), or null. When
|
|
547
|
+
* several share at once, the first in the roster.
|
|
548
|
+
*/
|
|
549
|
+
sharingParticipant: CallParticipant | null;
|
|
550
|
+
/**
|
|
551
|
+
* Whether this platform can share a screen: a desktop browser, or a
|
|
552
|
+
* native build with screen capture. Phone browsers cannot. Also hide
|
|
553
|
+
* the control when the call's `screen_share_allowed` is false.
|
|
554
|
+
*/
|
|
555
|
+
canShareScreen: boolean;
|
|
541
556
|
/** Which camera is publishing. Meaningless while the camera is off. */
|
|
542
557
|
facingMode: CameraFacing;
|
|
543
558
|
/**
|
|
@@ -596,6 +611,9 @@ interface UseCallRoom {
|
|
|
596
611
|
switchCamera: () => Promise<void>;
|
|
597
612
|
setMicrophoneEnabled: (enabled: boolean) => Promise<void>;
|
|
598
613
|
toggleMic: () => Promise<void>;
|
|
614
|
+
/** Share a screen (the platform's picker opens) or stop sharing. */
|
|
615
|
+
setScreenShareEnabled: (enabled: boolean) => Promise<void>;
|
|
616
|
+
toggleScreenShare: () => Promise<void>;
|
|
599
617
|
}
|
|
600
618
|
/**
|
|
601
619
|
* A call's media, carried by the SFU.
|
|
@@ -608,8 +626,8 @@ interface UseCallRoom {
|
|
|
608
626
|
* await media.join();
|
|
609
627
|
* await media.toggleCamera();
|
|
610
628
|
*
|
|
611
|
-
*
|
|
612
|
-
* point during the call.
|
|
629
|
+
* The camera, the microphone and screen sharing can each be turned on
|
|
630
|
+
* and off at any point during the call.
|
|
613
631
|
*/
|
|
614
632
|
declare function useCallRoom(conversationId: string | null, opts: UseCallRoomOptions): UseCallRoom;
|
|
615
633
|
|
package/dist/index.d.ts
CHANGED
|
@@ -334,6 +334,8 @@ interface MessageStream {
|
|
|
334
334
|
/** The text so far; empty until the first delta. */
|
|
335
335
|
text: string;
|
|
336
336
|
status: 'streaming' | 'failed';
|
|
337
|
+
/** The tool the agent is running right now, if any (cleared by the next text). */
|
|
338
|
+
tool?: string;
|
|
337
339
|
error?: string;
|
|
338
340
|
}
|
|
339
341
|
/**
|
|
@@ -538,6 +540,19 @@ interface UseCallRoom {
|
|
|
538
540
|
participants: CallParticipant[];
|
|
539
541
|
cameraEnabled: boolean;
|
|
540
542
|
micEnabled: boolean;
|
|
543
|
+
/** You are sharing a screen or window. */
|
|
544
|
+
screenSharing: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Whoever is sharing a screen right now (you included), or null. When
|
|
547
|
+
* several share at once, the first in the roster.
|
|
548
|
+
*/
|
|
549
|
+
sharingParticipant: CallParticipant | null;
|
|
550
|
+
/**
|
|
551
|
+
* Whether this platform can share a screen: a desktop browser, or a
|
|
552
|
+
* native build with screen capture. Phone browsers cannot. Also hide
|
|
553
|
+
* the control when the call's `screen_share_allowed` is false.
|
|
554
|
+
*/
|
|
555
|
+
canShareScreen: boolean;
|
|
541
556
|
/** Which camera is publishing. Meaningless while the camera is off. */
|
|
542
557
|
facingMode: CameraFacing;
|
|
543
558
|
/**
|
|
@@ -596,6 +611,9 @@ interface UseCallRoom {
|
|
|
596
611
|
switchCamera: () => Promise<void>;
|
|
597
612
|
setMicrophoneEnabled: (enabled: boolean) => Promise<void>;
|
|
598
613
|
toggleMic: () => Promise<void>;
|
|
614
|
+
/** Share a screen (the platform's picker opens) or stop sharing. */
|
|
615
|
+
setScreenShareEnabled: (enabled: boolean) => Promise<void>;
|
|
616
|
+
toggleScreenShare: () => Promise<void>;
|
|
599
617
|
}
|
|
600
618
|
/**
|
|
601
619
|
* A call's media, carried by the SFU.
|
|
@@ -608,8 +626,8 @@ interface UseCallRoom {
|
|
|
608
626
|
* await media.join();
|
|
609
627
|
* await media.toggleCamera();
|
|
610
628
|
*
|
|
611
|
-
*
|
|
612
|
-
* point during the call.
|
|
629
|
+
* The camera, the microphone and screen sharing can each be turned on
|
|
630
|
+
* and off at any point during the call.
|
|
613
631
|
*/
|
|
614
632
|
declare function useCallRoom(conversationId: string | null, opts: UseCallRoomOptions): UseCallRoom;
|
|
615
633
|
|
package/dist/index.js
CHANGED
|
@@ -890,7 +890,11 @@ function useMessageStreams(conversationId) {
|
|
|
890
890
|
status: "streaming"
|
|
891
891
|
};
|
|
892
892
|
let next;
|
|
893
|
-
if (evt.status === "delta")
|
|
893
|
+
if (evt.status === "delta") {
|
|
894
|
+
const { tool: _done, ...rest } = base;
|
|
895
|
+
next = { ...rest, text: base.text + (evt.delta ?? "") };
|
|
896
|
+
} else if (evt.status === "tool")
|
|
897
|
+
next = { ...base, ...evt.tool ? { tool: evt.tool } : {} };
|
|
894
898
|
else if (evt.status === "failed")
|
|
895
899
|
next = { ...base, status: "failed", ...evt.error ? { error: evt.error } : {} };
|
|
896
900
|
else
|
|
@@ -1156,6 +1160,8 @@ function useCallRoom(conversationId, opts) {
|
|
|
1156
1160
|
const [participants, setParticipants] = useState([]);
|
|
1157
1161
|
const [cameraEnabled, setCamera] = useState(false);
|
|
1158
1162
|
const [micEnabled, setMic] = useState(false);
|
|
1163
|
+
const [screenSharing, setScreen] = useState(false);
|
|
1164
|
+
const [canShareScreen, setCanShare] = useState(false);
|
|
1159
1165
|
const [facingMode, setFacing] = useState(opts.facing ?? "user");
|
|
1160
1166
|
const [alone, setAlone] = useState(false);
|
|
1161
1167
|
const [devices, setDevices] = useState({
|
|
@@ -1199,6 +1205,8 @@ function useCallRoom(conversationId, opts) {
|
|
|
1199
1205
|
if (!target) return;
|
|
1200
1206
|
setCamera(target.isCameraEnabled());
|
|
1201
1207
|
setMic(target.isMicrophoneEnabled());
|
|
1208
|
+
setScreen(target.isScreenShareEnabled());
|
|
1209
|
+
setCanShare(target.canShareScreen());
|
|
1202
1210
|
setFacing(target.getFacingMode());
|
|
1203
1211
|
}, []);
|
|
1204
1212
|
useEffect(() => {
|
|
@@ -1282,6 +1290,22 @@ function useCallRoom(conversationId, opts) {
|
|
|
1282
1290
|
if (!room) return;
|
|
1283
1291
|
await setMicrophoneEnabled(!room.isMicrophoneEnabled());
|
|
1284
1292
|
}, [room, setMicrophoneEnabled]);
|
|
1293
|
+
const setScreenShareEnabled = useCallback(
|
|
1294
|
+
async (enabled) => {
|
|
1295
|
+
if (!room) return;
|
|
1296
|
+
await room.setScreenShareEnabled(enabled);
|
|
1297
|
+
sync(room);
|
|
1298
|
+
},
|
|
1299
|
+
[room, sync]
|
|
1300
|
+
);
|
|
1301
|
+
const toggleScreenShare = useCallback(async () => {
|
|
1302
|
+
if (!room) return;
|
|
1303
|
+
await setScreenShareEnabled(!room.isScreenShareEnabled());
|
|
1304
|
+
}, [room, setScreenShareEnabled]);
|
|
1305
|
+
const sharingParticipant = useMemo(
|
|
1306
|
+
() => participants.find((p) => p.screenSharing) ?? null,
|
|
1307
|
+
[participants]
|
|
1308
|
+
);
|
|
1285
1309
|
const switchCamera = useCallback(async () => {
|
|
1286
1310
|
if (!room) return;
|
|
1287
1311
|
await room.switchCamera();
|
|
@@ -1306,6 +1330,9 @@ function useCallRoom(conversationId, opts) {
|
|
|
1306
1330
|
participants,
|
|
1307
1331
|
cameraEnabled,
|
|
1308
1332
|
micEnabled,
|
|
1333
|
+
screenSharing,
|
|
1334
|
+
sharingParticipant,
|
|
1335
|
+
canShareScreen,
|
|
1309
1336
|
facingMode,
|
|
1310
1337
|
alone,
|
|
1311
1338
|
devices,
|
|
@@ -1320,7 +1347,9 @@ function useCallRoom(conversationId, opts) {
|
|
|
1320
1347
|
switchCamera,
|
|
1321
1348
|
selectDevice,
|
|
1322
1349
|
setMicrophoneEnabled,
|
|
1323
|
-
toggleMic
|
|
1350
|
+
toggleMic,
|
|
1351
|
+
setScreenShareEnabled,
|
|
1352
|
+
toggleScreenShare
|
|
1324
1353
|
};
|
|
1325
1354
|
}
|
|
1326
1355
|
function useLiveCall(conversationId) {
|