Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | // lib/telemetry/policy.telemetry.ts import type { Policy } from '../core/policies/types'; import { recordEvolutionEvent, upsertEvolutionReport } from './evolution.telemetry'; export function logPolicyApplied(policy: Policy) { const payload = { ts: new Date().toISOString(), device: policy.device, ui: policy.ui, behavior: policy.behavior, data: policy.data, meta: policy.meta ?? { confidence: 0 }, }; // سجل محليّ خاص بالسياسة try { const key = 'OS_POLICY_LOGS'; const prev = JSON.parse(localStorage.getItem(key) || '[]'); prev.push(payload); localStorage.setItem(key, JSON.stringify(prev.slice(-50))); } catch {} // 🔗 توحيد مع Evolution Telemetry try { recordEvolutionEvent('policy_applied', { device: policy.device, perfMode: policy.behavior.perfMode, animations: policy.ui.animations, density: policy.ui.density, confidence: policy.meta?.confidence ?? 0, }); // تحديث تقرير التطوّر بآخر سياق معروف upsertEvolutionReport({ lastContext: { device: policy.device, perfMode: policy.behavior.perfMode, animations: policy.ui.animations, density: policy.ui.density, confidence: policy.meta?.confidence ?? 0, }, lastUpdated: payload.ts, }); } catch {} } |