import type { KernelClient } from '@astrale-os/shell' import { useContext } from 'react' import { ShellContext } from '../session/session.context.js' import { IdentityContext } from './act-as.context.js' export function useSessionKernel(): KernelClient { const identity = useContext(IdentityContext) const runtime = useContext(ShellContext) if (identity !== null) return identity.kernel if (runtime === null) throw new Error('session hooks must be used within a ') return runtime.shell.kernel }