@personaai/react 0.8.0 → 0.9.0
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 +38 -10
- package/dist/index.cjs +609 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -3
- package/dist/index.d.ts +227 -3
- package/dist/index.js +604 -6
- 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.9.0.** Requires React 18+. Client-side only — never holds a credential.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -46,15 +46,19 @@ function Chat() {
|
|
|
46
46
|
|
|
47
47
|
## Hooks
|
|
48
48
|
|
|
49
|
-
| Hook
|
|
50
|
-
|
|
|
51
|
-
| `useChat`
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
49
|
+
| Hook | Purpose |
|
|
50
|
+
| -------------------- | ----------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `useChat` | Streaming chat — messages, send, stop, reload, interrupts, workspace files, ephemeral new chat |
|
|
52
|
+
| `useWorkflowStream` | Live streaming workflow execution — real-time node state tracking, cancellation, and resume |
|
|
53
|
+
| `useWorkflows` | Workflow discovery & creation — list, paginate, filter, and create workflows |
|
|
54
|
+
| `useWorkflow` | Single workflow authoring — drafts, publishing, versions, and Mermaid diagrams |
|
|
55
|
+
| `useWorkflowRuns` | Workflow run history — list historical runs, get run details, and cancel in-flight runs |
|
|
56
|
+
| `useVoice` | Real-time voice calls (Gemini Live) — start/stop/mute, live transcript, tool calls |
|
|
57
|
+
| `useThreads` | Thread CRUD — list, create, delete, rename, reset, archive |
|
|
58
|
+
| `useFiles` | Upload management — list, upload, delete |
|
|
59
|
+
| `useMemory` | Persistent memory — read, write, delete |
|
|
60
|
+
| `useAgents` | Agent discovery — list available agents |
|
|
61
|
+
| `useConnection` | Health check — backend connectivity status |
|
|
58
62
|
|
|
59
63
|
## Voice
|
|
60
64
|
|
|
@@ -125,6 +129,30 @@ as a text response). Injected messages get a `voice-`-prefixed id. You still cal
|
|
|
125
129
|
/ `voice.stop()` yourself — `useChat` only owns the transcript-to-feed sync, not the call
|
|
126
130
|
lifecycle.
|
|
127
131
|
|
|
132
|
+
## Ephemeral new chat (0.8.0+)
|
|
133
|
+
|
|
134
|
+
Create a new chat instantly without minting an empty thread. The real `threadId` is created lazily on the first `sendMessage`.
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
const [threadId, setThreadId] = useState<string | undefined>()
|
|
138
|
+
const chat = useChat({
|
|
139
|
+
agentId,
|
|
140
|
+
threadId,
|
|
141
|
+
onThreadCreated: (id) => setThreadId(id), // sync sidebar after mint
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const handleNewChat = () => {
|
|
145
|
+
chat.startNewChat() // clears messages/files/todos, enters ephemeral mode
|
|
146
|
+
setThreadId(undefined)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// isEphemeral is true until first send mints
|
|
150
|
+
// chat.currentThreadId reflects the effective id (prop ?? minted)
|
|
151
|
+
await chat.sendMessage("Hello") // auto POST /threads if threadId is undefined
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`sendMessage` and `reload` now return `Promise<boolean>` (`true` sent, `false` dropped while streaming). `startNewChat()`, `currentThreadId` and `isEphemeral` are new returns on `useChat`.
|
|
155
|
+
|
|
128
156
|
## Devtools
|
|
129
157
|
|
|
130
158
|
Floating panel for local debugging — inspect hooks, messages and threads with zero runtime changes. Dev-only, not bundled to production unless imported.
|