@speechos/react 1.0.0 → 1.0.3
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/components/SpeechOSWidget.d.cts +4 -7
- package/dist/components/SpeechOSWidget.d.ts +4 -7
- package/dist/context.d.cts +30 -9
- package/dist/context.d.ts +30 -9
- package/dist/hooks/index.d.cts +2 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/useCommand.d.cts +73 -0
- package/dist/hooks/useCommand.d.ts +73 -0
- package/dist/hooks/useSpeechOSWidget.d.cts +74 -0
- package/dist/hooks/useSpeechOSWidget.d.ts +74 -0
- package/dist/index.cjs +139 -87
- package/dist/index.d.cts +5 -20
- package/dist/index.d.ts +5 -20
- package/dist/index.js +132 -81
- package/package.json +8 -7
- package/dist/hooks/useTranscription.d.cts +0 -87
- package/dist/hooks/useTranscription.d.ts +0 -87
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speechos/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React hooks and components for SpeechOS voice integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "
|
|
26
|
-
"directory": "
|
|
25
|
+
"url": "git+ssh://git@github.com/speechos-org/speechos-client.git",
|
|
26
|
+
"directory": "packages/react"
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://speechos.ai",
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/speechos-org/speechos/issues"
|
|
30
|
+
"url": "https://github.com/speechos-org/speechos-client/issues"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
+
"prepare": "npm run build",
|
|
33
34
|
"build": "tsdown",
|
|
34
35
|
"dev": "tsdown --watch",
|
|
35
36
|
"type-check": "tsc --noEmit",
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"author": "SpeechOS",
|
|
48
49
|
"license": "MIT",
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@speechos/client": "^0.2.
|
|
51
|
-
"@speechos/core": "^0.2.
|
|
51
|
+
"@speechos/client": "^0.2.4",
|
|
52
|
+
"@speechos/core": "^0.2.3",
|
|
52
53
|
"react": ">=18.0.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
@@ -68,6 +69,6 @@
|
|
|
68
69
|
"vitest": "^4.0.16"
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
71
|
-
"@speechos/core": "^0.2.
|
|
72
|
+
"@speechos/core": "^0.2.3"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useTranscription - Low-level hook for granular transcription control
|
|
3
|
-
*
|
|
4
|
-
* Provides direct access to the LiveKit connection lifecycle
|
|
5
|
-
* for advanced use cases that need fine-grained control.
|
|
6
|
-
*/
|
|
7
|
-
import type { SpeechOSState } from "@speechos/core";
|
|
8
|
-
/**
|
|
9
|
-
* Return type for useTranscription hook
|
|
10
|
-
*/
|
|
11
|
-
export interface UseTranscriptionResult {
|
|
12
|
-
/** Connect to LiveKit (establishes WebRTC connection) */
|
|
13
|
-
connect: () => Promise<void>;
|
|
14
|
-
/** Wait until the agent is ready to receive audio */
|
|
15
|
-
waitUntilReady: () => Promise<void>;
|
|
16
|
-
/** Enable microphone (start capturing audio) */
|
|
17
|
-
enableMicrophone: () => Promise<void>;
|
|
18
|
-
/** Stop recording and get the transcript */
|
|
19
|
-
getTranscript: () => Promise<string>;
|
|
20
|
-
/** Stop recording and get edited text */
|
|
21
|
-
getEdit: (originalText: string) => Promise<string>;
|
|
22
|
-
/** Disconnect from LiveKit */
|
|
23
|
-
disconnect: () => Promise<void>;
|
|
24
|
-
/** Cancel any ongoing operation */
|
|
25
|
-
cancel: () => Promise<void>;
|
|
26
|
-
/** Current connection state */
|
|
27
|
-
isConnected: boolean;
|
|
28
|
-
/** Current microphone state */
|
|
29
|
-
isMicEnabled: boolean;
|
|
30
|
-
/** Current recording state */
|
|
31
|
-
recordingState: SpeechOSState["recordingState"];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Low-level hook for granular transcription control
|
|
35
|
-
*
|
|
36
|
-
* Use this when you need fine-grained control over the LiveKit
|
|
37
|
-
* connection lifecycle. For most use cases, prefer useDictation()
|
|
38
|
-
* or useEdit() which provide simpler interfaces.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* function CustomVoiceUI() {
|
|
43
|
-
* const {
|
|
44
|
-
* connect,
|
|
45
|
-
* waitUntilReady,
|
|
46
|
-
* enableMicrophone,
|
|
47
|
-
* getTranscript,
|
|
48
|
-
* disconnect,
|
|
49
|
-
* isConnected,
|
|
50
|
-
* isMicEnabled,
|
|
51
|
-
* recordingState,
|
|
52
|
-
* } = useTranscription();
|
|
53
|
-
*
|
|
54
|
-
* const handleRecord = async () => {
|
|
55
|
-
* // Step 1: Connect to LiveKit
|
|
56
|
-
* await connect();
|
|
57
|
-
*
|
|
58
|
-
* // Step 2: Wait for agent to be ready
|
|
59
|
-
* await waitUntilReady();
|
|
60
|
-
*
|
|
61
|
-
* // Step 3: Enable microphone
|
|
62
|
-
* await enableMicrophone();
|
|
63
|
-
*
|
|
64
|
-
* // ... user speaks ...
|
|
65
|
-
*
|
|
66
|
-
* // Step 4: Get transcript
|
|
67
|
-
* const text = await getTranscript();
|
|
68
|
-
* console.log('Transcribed:', text);
|
|
69
|
-
*
|
|
70
|
-
* // Step 5: Cleanup
|
|
71
|
-
* await disconnect();
|
|
72
|
-
* };
|
|
73
|
-
*
|
|
74
|
-
* return (
|
|
75
|
-
* <div>
|
|
76
|
-
* <p>Connected: {isConnected ? 'Yes' : 'No'}</p>
|
|
77
|
-
* <p>Mic: {isMicEnabled ? 'On' : 'Off'}</p>
|
|
78
|
-
* <p>State: {recordingState}</p>
|
|
79
|
-
* <button onClick={handleRecord}>Record</button>
|
|
80
|
-
* </div>
|
|
81
|
-
* );
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @returns Low-level transcription controls and state
|
|
86
|
-
*/
|
|
87
|
-
export declare function useTranscription(): UseTranscriptionResult;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useTranscription - Low-level hook for granular transcription control
|
|
3
|
-
*
|
|
4
|
-
* Provides direct access to the LiveKit connection lifecycle
|
|
5
|
-
* for advanced use cases that need fine-grained control.
|
|
6
|
-
*/
|
|
7
|
-
import type { SpeechOSState } from "@speechos/core";
|
|
8
|
-
/**
|
|
9
|
-
* Return type for useTranscription hook
|
|
10
|
-
*/
|
|
11
|
-
export interface UseTranscriptionResult {
|
|
12
|
-
/** Connect to LiveKit (establishes WebRTC connection) */
|
|
13
|
-
connect: () => Promise<void>;
|
|
14
|
-
/** Wait until the agent is ready to receive audio */
|
|
15
|
-
waitUntilReady: () => Promise<void>;
|
|
16
|
-
/** Enable microphone (start capturing audio) */
|
|
17
|
-
enableMicrophone: () => Promise<void>;
|
|
18
|
-
/** Stop recording and get the transcript */
|
|
19
|
-
getTranscript: () => Promise<string>;
|
|
20
|
-
/** Stop recording and get edited text */
|
|
21
|
-
getEdit: (originalText: string) => Promise<string>;
|
|
22
|
-
/** Disconnect from LiveKit */
|
|
23
|
-
disconnect: () => Promise<void>;
|
|
24
|
-
/** Cancel any ongoing operation */
|
|
25
|
-
cancel: () => Promise<void>;
|
|
26
|
-
/** Current connection state */
|
|
27
|
-
isConnected: boolean;
|
|
28
|
-
/** Current microphone state */
|
|
29
|
-
isMicEnabled: boolean;
|
|
30
|
-
/** Current recording state */
|
|
31
|
-
recordingState: SpeechOSState["recordingState"];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Low-level hook for granular transcription control
|
|
35
|
-
*
|
|
36
|
-
* Use this when you need fine-grained control over the LiveKit
|
|
37
|
-
* connection lifecycle. For most use cases, prefer useDictation()
|
|
38
|
-
* or useEdit() which provide simpler interfaces.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* function CustomVoiceUI() {
|
|
43
|
-
* const {
|
|
44
|
-
* connect,
|
|
45
|
-
* waitUntilReady,
|
|
46
|
-
* enableMicrophone,
|
|
47
|
-
* getTranscript,
|
|
48
|
-
* disconnect,
|
|
49
|
-
* isConnected,
|
|
50
|
-
* isMicEnabled,
|
|
51
|
-
* recordingState,
|
|
52
|
-
* } = useTranscription();
|
|
53
|
-
*
|
|
54
|
-
* const handleRecord = async () => {
|
|
55
|
-
* // Step 1: Connect to LiveKit
|
|
56
|
-
* await connect();
|
|
57
|
-
*
|
|
58
|
-
* // Step 2: Wait for agent to be ready
|
|
59
|
-
* await waitUntilReady();
|
|
60
|
-
*
|
|
61
|
-
* // Step 3: Enable microphone
|
|
62
|
-
* await enableMicrophone();
|
|
63
|
-
*
|
|
64
|
-
* // ... user speaks ...
|
|
65
|
-
*
|
|
66
|
-
* // Step 4: Get transcript
|
|
67
|
-
* const text = await getTranscript();
|
|
68
|
-
* console.log('Transcribed:', text);
|
|
69
|
-
*
|
|
70
|
-
* // Step 5: Cleanup
|
|
71
|
-
* await disconnect();
|
|
72
|
-
* };
|
|
73
|
-
*
|
|
74
|
-
* return (
|
|
75
|
-
* <div>
|
|
76
|
-
* <p>Connected: {isConnected ? 'Yes' : 'No'}</p>
|
|
77
|
-
* <p>Mic: {isMicEnabled ? 'On' : 'Off'}</p>
|
|
78
|
-
* <p>State: {recordingState}</p>
|
|
79
|
-
* <button onClick={handleRecord}>Record</button>
|
|
80
|
-
* </div>
|
|
81
|
-
* );
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @returns Low-level transcription controls and state
|
|
86
|
-
*/
|
|
87
|
-
export declare function useTranscription(): UseTranscriptionResult;
|