/**
* Root component: header with connection/session status, the conversation
* thread, and the composer. The WebSocket is injected so tests (and future
* embeddings) can supply a fake.
*
* @example
*
*/
import type { OriSocket } from "./ws";
import { useChatState } from "./store";
import { ChatThread } from "./components/ChatThread";
import { PermissionPrompt } from "./components/PermissionPrompt";
import { PlanView } from "./components/PlanView";
import { PromptInput } from "./components/PromptInput";
export function App({ socket }: { socket: OriSocket }) {
const state = useChatState();
return (
Ori
{state.connection}
{state.sessionId ? ` ยท ${state.sessionId}` : ""}
{state.permissions.map((request) => (
socket.send({ type: "permission_response", requestId, optionId })
}
/>
))}
socket.send({ type: "prompt", text })}
onCancel={() => socket.send({ type: "cancel" })}
/>
);
}