@kernl-sdk/react 0.1.9 → 0.1.12
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +68 -0
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @kernl-sdk/react
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [adc9cf2]
|
|
8
|
+
- kernl@0.12.6
|
|
9
|
+
|
|
10
|
+
## 0.1.11
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [7fc129b]
|
|
15
|
+
- kernl@0.12.5
|
|
16
|
+
|
|
17
|
+
## 0.1.10
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [296c377]
|
|
22
|
+
- kernl@0.12.4
|
|
23
|
+
|
|
3
24
|
## 0.1.9
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @kernl-sdk/react
|
|
2
|
+
|
|
3
|
+
> **For AI agents**: These reference docs help coding agents understand the kernl SDK. If your agent gets stuck, share this page with it.
|
|
4
|
+
|
|
5
|
+
React hooks and components for building AI-powered interfaces.
|
|
6
|
+
|
|
7
|
+
## useRealtime
|
|
8
|
+
|
|
9
|
+
Connect to a realtime voice agent:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useRealtime } from '@kernl-sdk/react';
|
|
13
|
+
|
|
14
|
+
function VoiceChat() {
|
|
15
|
+
const { status, connect, disconnect } = useRealtime({
|
|
16
|
+
agent: 'voice-assistant',
|
|
17
|
+
credentials: async () => fetchCredentials(),
|
|
18
|
+
onMessage: (event) => console.log(event),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<button onClick={status === 'connected' ? disconnect : connect}>
|
|
23
|
+
{status === 'connected' ? 'Disconnect' : 'Connect'}
|
|
24
|
+
</button>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## useBrowserAudio
|
|
30
|
+
|
|
31
|
+
Capture microphone audio for voice input:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { useBrowserAudio } from '@kernl-sdk/react';
|
|
35
|
+
|
|
36
|
+
function AudioCapture() {
|
|
37
|
+
const { start, stop, isRecording } = useBrowserAudio({
|
|
38
|
+
onAudioData: (data) => sendToAgent(data),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<button onClick={isRecording ? stop : start}>
|
|
43
|
+
{isRecording ? 'Stop' : 'Start'} Recording
|
|
44
|
+
</button>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## LiveWaveform
|
|
50
|
+
|
|
51
|
+
Visualize audio input/output:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { LiveWaveform } from '@kernl-sdk/react';
|
|
55
|
+
|
|
56
|
+
<LiveWaveform source={audioSource} className="h-16 w-full" />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## BrowserChannel
|
|
60
|
+
|
|
61
|
+
Low-level WebSocket channel for custom realtime implementations:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { BrowserChannel } from '@kernl-sdk/react';
|
|
65
|
+
|
|
66
|
+
const channel = new BrowserChannel({ url: 'wss://...' });
|
|
67
|
+
await channel.connect();
|
|
68
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernl-sdk/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "React bindings for kernl",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kernl",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"kernl": "0.12.3",
|
|
35
34
|
"@kernl-sdk/protocol": "0.5.1",
|
|
36
|
-
"@kernl-sdk/shared": "0.4.0"
|
|
35
|
+
"@kernl-sdk/shared": "0.4.0",
|
|
36
|
+
"kernl": "0.12.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "^18 || ^19"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^24.10.0",
|
|
43
|
-
"@types/react": "^19.
|
|
43
|
+
"@types/react": "^19.2.8",
|
|
44
44
|
"react": "^19.1.0",
|
|
45
45
|
"tsc-alias": "^1.8.10",
|
|
46
46
|
"typescript": "5.9.2"
|