import type { Shell, ShellConfig } from '@astrale-os/shell' import type { ReactElement, ReactNode } from 'react' import { Suspense } from 'react' import type { ShellProviderProps } from '../session/provider.js' import { ShellProvider } from '../session/provider.js' import { ViewStage } from '../window/stage.js' import { defaultViewError, defaultViewLoading, ViewErrorBoundary } from './boundaries.js' const SANDBOXED_SHELL = Object.freeze({ mode: 'sandboxed' as const }) export interface AstraleProps { /** Defaults to the child-side sandbox handshake; pass a Shell for an embedded host or test. */ readonly config?: ShellConfig | Shell readonly fallback?: ReactNode readonly errorFallback?: ShellProviderProps['errorFallback'] readonly onError?: (error: unknown) => void readonly children: ReactNode } /** Complete Astrale runtime root without taking ownership of application routing. */ export function Astrale(props: AstraleProps): ReactElement { const loading = props.fallback ?? defaultViewLoading() const errorFallback = props.errorFallback ?? defaultViewError return ( props.onError?.(error)} > {props.children} ) }