@octoryn/ui-core
v0.2.0
Published
Framework-neutral Octoryn UI message and stream protocol.
Downloads
48
Readme
@octoryn/ui-core
Framework-neutral message types, stream codec and reducer for Octoryn UI SDKs.
import {
decodeUIStream,
reduceUIStream,
type UIStreamState,
} from "@octoryn/ui-core";
let state: UIStreamState = { messages: [] };
for await (const event of decodeUIStream(response.body!)) {
state = reduceUIStream(state, event);
}The protocol is plain SSE plus JSON and is shared by browser, iOS and Android clients.
OctorynChatController, OctorynCompletionController and
OctorynObjectController provide the shared
framework-neutral state machines used by the React, Vue, Svelte and Angular
packages. They own cancellation, error mapping, governance metadata and
message-part reduction. Chat supports edit, regenerate and cursor-aware
resume through UITransport; smoothTextStream is a composable normalized
stream transform. Run npm run build && node examples/advanced.mjs for the
content-free recovery and structured-object example.
