AINative runtime coordinates state, events, rendering, and streaming for AI-driven interfaces.
- Create and own application state through
createAIApp. - Dispatch actions to
/ai/actionand/ai/stream. - Reconcile streamed tokens into assistant messages.
- Expose subscriptions so React components can re-render from model output.
runtime/app.ts: top-level application object and action execution.runtime/state.ts: state updates, message history, and undo support.runtime/events.ts: internal event bus for action and streaming events.runtime/reconciler.ts: state patch merge and replacement logic.runtime/streaming.ts: SSE-first streaming with WebSocket fallback support.
- User submits a message from
AIInput. AIApp.sendMessage()records the user message and starts a streamed action.- The streaming engine reads server events token by token.
- The current assistant placeholder message is updated as tokens arrive.
AIAppclears stream listeners when the stream ends or errors.
npm test --workspace @hari7261/ainative-client