98
*/
99
export function migrateCodexPermissionValues(
101
>
defaults: { approvalPolicy: CodexApprovalPolicy; sandboxMode: SandboxMode },
102
>
): Record<string, string> {
103
>
const explicitPreset = narrowCodexPermissionsPreset(config?.[CodexSessionConfigKey.PermissionsPreset]);
104
>
if (explicitPreset) {
105
return { [CodexSessionConfigKey.PermissionsPreset]: explicitPreset };
106
}
108
>
const equivalentPreset = presetForResolvedPermissions(resolved);
109
>
if (equivalentPreset) {
110
>
return { [CodexSessionConfigKey.PermissionsPreset]: equivalentPreset };
111
>
}
112
// `read-only` is more locked-down than any preset's sandbox and cannot be
113
// represented by one, so preserve the raw axes — surfacing a preset here