Hook
useInflection
Chat state and actions from the nearest <InflectionProvider>: messages, streaming, tool activity, confirmations, nudges.
Install
npm i @inflection/sdk-react # or: bun add @inflection/sdk-reactA package, not a copy: this is protocol logic, so fixes reach you without re-copying files.
Usage
import { InflectionProvider, useInflection } from "@inflection/sdk-react"
function Chat() {
const { messages, streaming, busy, send } = useInflection()
return (
<>
<MessageList messages={messages} streaming={streaming} busy={busy} />
<Composer onSend={send} busy={busy} />
</>
)
}
export function App() {
return (
<InflectionProvider publishableKey="pk_live_…">
<Chat />
</InflectionProvider>
)
}Returns
| Name | Type | Description |
|---|---|---|
| messages | Message[] | The conversation so far, rehydrated on reload. |
| streaming | string | The in-flight reply's text, cleared once it settles into `messages`. |
| busy | boolean | A turn is in flight. |
| activity | string | null | Human-readable label for the tool call running now. |
| pendingConfirm | ConfirmRequest | null | An action waiting for approval. |
| nudge | { title, detail?, ask } | null | The latest declared per-screen suggestion. |
| error | string | null | The server's own sentence, not a status code. |
| agent | AgentInfo | null | Name, conversation starters, whether voice is on. |
| send | (text: string) => void | Send a message. Appends it optimistically. |
| confirm | (callId, approved) => void | Resolve a pending confirmation. |
| navigate | (path: string) => void | Report the in-app route, which drives per-screen nudges. |
| setAuthState | (state) => void | Report the host app's auth/wallet state. |