@personaai/react 0.8.1 → 0.10.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 +37 -10
- package/dist/index.cjs +1279 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +299 -3
- package/dist/index.d.ts +299 -3
- package/dist/index.js +1277 -129
- 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,20 @@ 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
|
+
| `useArchitectChat` | Streaming chat with the Agent Architect co-pilot — same mechanics as `useChat`, no `agentId` |
|
|
53
|
+
| `useWorkflowStream` | Live streaming workflow execution — real-time node state tracking, cancellation, and resume |
|
|
54
|
+
| `useWorkflows` | Workflow discovery & creation — list, paginate, filter, and create workflows |
|
|
55
|
+
| `useWorkflow` | Single workflow authoring — drafts, publishing, versions, and Mermaid diagrams |
|
|
56
|
+
| `useWorkflowRuns` | Workflow run history — list historical runs, get run details, and cancel in-flight runs |
|
|
57
|
+
| `useVoice` | Real-time voice calls (Gemini Live) — start/stop/mute, live transcript, tool calls |
|
|
58
|
+
| `useThreads` | Thread CRUD — list, create, delete, rename, reset, archive |
|
|
59
|
+
| `useFiles` | Upload management — list, upload, delete |
|
|
60
|
+
| `useMemory` | Persistent memory — read, write, delete |
|
|
61
|
+
| `useAgents` | Agent discovery — list available agents |
|
|
62
|
+
| `useConnection` | Health check — backend connectivity status |
|
|
58
63
|
|
|
59
64
|
## Voice
|
|
60
65
|
|
|
@@ -149,6 +154,28 @@ await chat.sendMessage("Hello") // auto POST /threads if threadId is undefined
|
|
|
149
154
|
|
|
150
155
|
`sendMessage` and `reload` now return `Promise<boolean>` (`true` sent, `false` dropped while streaming). `startNewChat()`, `currentThreadId` and `isEphemeral` are new returns on `useChat`.
|
|
151
156
|
|
|
157
|
+
## Agent Architect chat (0.10.0+)
|
|
158
|
+
|
|
159
|
+
`useArchitectChat` runs the Agent Architect co-pilot — a conversational agent that creates/edits
|
|
160
|
+
your own Agents via tool calls (`manage_agent`, `manage_skill`, ...). Same shape as `useChat` (same
|
|
161
|
+
streaming/interrupt/reload/ephemeral-thread mechanics), minus `agentId` (fixed target) and
|
|
162
|
+
`voice`/`sandboxCommands` (the Architect has neither):
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { useArchitectChat } from "@personaai/react";
|
|
166
|
+
|
|
167
|
+
const architect = useArchitectChat({ threadId });
|
|
168
|
+
|
|
169
|
+
await architect.sendMessage("Create a support bot that...");
|
|
170
|
+
if (architect.interrupt?.kind === "hitl") {
|
|
171
|
+
await architect.resumeInterrupt({ decisions: [{ type: "approve" }] }, "Approved");
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`threadId` resume only has an effect when the underlying credential asserts an external user
|
|
176
|
+
(`x-persona-external-user-id`) — a bare Project credential has no Subject for a Thread to belong to,
|
|
177
|
+
so the backend keeps its single deterministic per-Project conversation either way.
|
|
178
|
+
|
|
152
179
|
## Devtools
|
|
153
180
|
|
|
154
181
|
Floating panel for local debugging — inspect hooks, messages and threads with zero runtime changes. Dev-only, not bundled to production unless imported.
|