/** * Where a page opens when no conversation is chosen (a first load, a new chapter, a remembered one that is gone): * the main agent's conversation, once the shared state and the main agents are known; 'create' when the main agent has no * conversation yet, as on a fresh preview. The root is only its history. */ export const landing = ( loaded: boolean, chosen: unknown, mainAgent: Readonly> | null | undefined, ): number | 'create' | undefined => { if (!loaded || chosen !== undefined || mainAgent === undefined) return undefined return mainAgent?.['$main-agent'] ?? 'create' }