Files
sausage/extensions/subagents/landing.ts
T

14 lines
627 B
TypeScript

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