520
*/
521
export function normalizeManagedSettings(parsed: Record<string, unknown>, onWarn?: (msg: string) => void): ManagedSettingsData {
522
>
// Spread + delete (not for..in + assignment) so the scalar remainder keeps exact `{ ...rest }`
copilotManagedSettings.ts
523
>
// semantics: it never triggers the inherited `__proto__` setter for a source-sent own
524
>
// `__proto__` key, matching a destructuring rest. Structured keys may be nested (e.g.
525
>
// `telemetry.resourceAttributes`), so removal clones only the touched path.
526
>
let scalarRest: Record<string, unknown> = { ...parsed };
527
>
for (const setting of STRUCTURED_MANAGED_SETTINGS) {
528
>
scalarRest = withNestedManagedKeyDeleted(scalarRest, setting.key);
529
>
}
530
>
531
>
const result: Record<string, ManagedSettingValue> = { ...flattenManagedSettings(scalarRest) };
532
>
533
>
for (const setting of STRUCTURED_MANAGED_SETTINGS) {
534
>
const encoded = setting.encode(readNestedManagedKey(parsed, setting.key), onWarn);
535
>
if (encoded !== undefined) {
536
result[setting.key] = JSON.stringify(encoded);
537
}
539
>
540
>
return result;
541
>
}
542
543
/**