Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283export function effortName(level: string): string { if (level === 'xhigh') return 'Extra high'; return level.charAt(0).toUpperCase() + level.slice(1);}
export function profileOverride( level: string | null | undefined,): string | null { return level && level !== 'inherit' && level !== 'default' ? level : null;}
/** Only real levels; retain a provider-default row when its level is unknown. */export function effortChoices( levels: readonly string[], current: string | null, modelDefault?: string | null, profile?: string | null,): string[] { const defaultLevel = effectiveEffort( current === 'default' ? 'default' : 'inherit', modelDefault, profile, ); const choices = [...levels]; if (defaultLevel && !choices.includes(defaultLevel)) choices.push(defaultLevel); if (!defaultLevel) choices.unshift('inherit'); if ( current && current !== 'inherit' && current !== 'default' && !choices.includes(current) ) choices.push(current); return choices;}
export function choiceForLevel( level: string, current: string | null, modelDefault?: string | null, profile?: string | null,): string { const mode = current === 'default' ? 'default' : 'inherit'; return level === 'inherit' || level === effectiveEffort(mode, modelDefault, profile) ? mode : level;}
/** * The choice a model row starts from: the carried one, unless the model lacks * the level it resolves to, which the daemon refuses. Then medium when the * model has it, else the model default. */export function startingEffort( choice: string | null, efforts: readonly string[], modelDefault?: string | null, defaultSource?: string | null, profile?: string | null,): string | null { const effective = effectiveEffort(choice, modelDefault, profile); const adapterDefault = defaultSource === 'albedo' && (choice === 'default' || (choice === 'inherit' && !profileOverride(profile))); if (!effective || efforts.includes(effective) || adapterDefault) return choice; return efforts.includes('medium') ? 'medium' : 'default';}
export function effectiveEffort( choice: string | null, modelDefault: string | null | undefined, profile: string | null | undefined,): string | null { if (choice === null) return null; if (choice === 'inherit') return profileOverride(profile) ?? modelDefault ?? null; return choice === 'default' ? (modelDefault ?? null) : choice;}