19 lines
781 B
JavaScript
19 lines
781 B
JavaScript
import { SEAT_GROUPS } from '../shared/roles.js'
|
|
import { AGENT_PRESETS } from '../shared/schema.js'
|
|
|
|
export function knownSessionPreset(value) {
|
|
return AGENT_PRESETS.includes(value) ? value : null
|
|
}
|
|
|
|
export function readSessionPreset(host, agent) {
|
|
if (!agent?.session) return null
|
|
return knownSessionPreset(host.agentPresets?.presetForSession(agent.session))
|
|
}
|
|
|
|
export function resolveSeatPreset(seatId, seat, globalPreset) {
|
|
if (seat?.agentPreset != null) return { configuredPreset: seat.agentPreset, presetSource: 'project' }
|
|
if (globalPreset != null) return { configuredPreset: globalPreset, presetSource: 'global' }
|
|
const configuredPreset = SEAT_GROUPS.liubu.includes(seatId) ? 'ops-ptc' : 'standard'
|
|
return { configuredPreset, presetSource: 'role-default' }
|
|
}
|