@personaai/react 0.7.10 → 0.8.1
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/README.md +34 -10
- package/dist/index.cjs +206 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +206 -216
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
React SDK for [Persona](https://persona.hasanraiyan.me) — hooks and a context provider for building chat UIs against any Persona backend.
|
|
4
4
|
|
|
5
|
-
> **v0.
|
|
5
|
+
> **v0.8.0.** Requires React 18+. Client-side only — never holds a credential.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -46,15 +46,15 @@ function Chat() {
|
|
|
46
46
|
|
|
47
47
|
## Hooks
|
|
48
48
|
|
|
49
|
-
| Hook | Purpose
|
|
50
|
-
| --------------- |
|
|
51
|
-
| `useChat` | Streaming chat — messages, send, stop, reload, interrupts, workspace files |
|
|
52
|
-
| `useVoice` | Real-time voice calls (Gemini Live) — start/stop/mute, live transcript, tool calls
|
|
53
|
-
| `useThreads` | Thread CRUD — list, create, delete, rename, reset, archive
|
|
54
|
-
| `useFiles` | Upload management — list, upload, delete
|
|
55
|
-
| `useMemory` | Persistent memory — read, write, delete
|
|
56
|
-
| `useAgents` | Agent discovery — list available agents
|
|
57
|
-
| `useConnection` | Health check — backend connectivity status
|
|
49
|
+
| Hook | Purpose |
|
|
50
|
+
| --------------- | ----------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `useChat` | Streaming chat — messages, send, stop, reload, interrupts, workspace files, ephemeral new chat |
|
|
52
|
+
| `useVoice` | Real-time voice calls (Gemini Live) — start/stop/mute, live transcript, tool calls |
|
|
53
|
+
| `useThreads` | Thread CRUD — list, create, delete, rename, reset, archive |
|
|
54
|
+
| `useFiles` | Upload management — list, upload, delete |
|
|
55
|
+
| `useMemory` | Persistent memory — read, write, delete |
|
|
56
|
+
| `useAgents` | Agent discovery — list available agents |
|
|
57
|
+
| `useConnection` | Health check — backend connectivity status |
|
|
58
58
|
|
|
59
59
|
## Voice
|
|
60
60
|
|
|
@@ -125,6 +125,30 @@ as a text response). Injected messages get a `voice-`-prefixed id. You still cal
|
|
|
125
125
|
/ `voice.stop()` yourself — `useChat` only owns the transcript-to-feed sync, not the call
|
|
126
126
|
lifecycle.
|
|
127
127
|
|
|
128
|
+
## Ephemeral new chat (0.8.0+)
|
|
129
|
+
|
|
130
|
+
Create a new chat instantly without minting an empty thread. The real `threadId` is created lazily on the first `sendMessage`.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
const [threadId, setThreadId] = useState<string | undefined>()
|
|
134
|
+
const chat = useChat({
|
|
135
|
+
agentId,
|
|
136
|
+
threadId,
|
|
137
|
+
onThreadCreated: (id) => setThreadId(id), // sync sidebar after mint
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const handleNewChat = () => {
|
|
141
|
+
chat.startNewChat() // clears messages/files/todos, enters ephemeral mode
|
|
142
|
+
setThreadId(undefined)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// isEphemeral is true until first send mints
|
|
146
|
+
// chat.currentThreadId reflects the effective id (prop ?? minted)
|
|
147
|
+
await chat.sendMessage("Hello") // auto POST /threads if threadId is undefined
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`sendMessage` and `reload` now return `Promise<boolean>` (`true` sent, `false` dropped while streaming). `startNewChat()`, `currentThreadId` and `isEphemeral` are new returns on `useChat`.
|
|
151
|
+
|
|
128
152
|
## Devtools
|
|
129
153
|
|
|
130
154
|
Floating panel for local debugging — inspect hooks, messages and threads with zero runtime changes. Dev-only, not bundled to production unless imported.
|