@openharness/react package provides hooks that wire into AI SDK 5’s useChat and track OpenHarness-specific state like subagent activity, compaction, and turn lifecycle.
Setup
OpenHarnessProvider:
useOpenHarness
Creates a chat session connected to your API endpoint. Returns the same interface as AI SDK 5’s useChat (messages, sendMessage, status, stop, etc.), typed with OHUIMessage:
Resuming Streams
Pass a stableid and resume: true to reconnect to an active server-side stream when the component mounts:
GET ${endpoint}/${id}/stream. The server must own the active run and return the active stream or 204 when no stream is running.
AI SDK stream resumption is not compatible with treating browser request abort as cancellation. If a user needs to stop a background run, expose a separate server-side cancel action.
useSubagentStatus
Derives reactive state from data-oh:subagent.* events:
activeSubagents— currently running subagentsrecentSubagents— all subagents seen in this sessionhasActiveSubagents— boolean shorthand
useSessionStatus
Tracks turn index, compaction state, and retry info from data-oh:* events:
useTodos
Tracks the latest todo list from data-oh:todo.updated events emitted by the core todo tools: