export function addAgentPrinciples(knowledge, principles, nextId) {
    const isAgentProject = knowledge.stack.some((s) => ['@anthropic-ai/sdk', '@mastra/core', 'langgraph', 'crewai'].some((sig) => s.toLowerCase().includes(sig))) || (knowledge.framework ?? '').toLowerCase().includes('agent');
    if (!isAgentProject) {
        return;
    }
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'Agent responses must never expose PII, credentials, or system-internal data',
        rationale: 'AI agents process sensitive data and must not leak it into user-visible outputs.',
        enforceLevel: 'strict',
        autoEnforceable: false,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'All tool inputs must be validated before execution — never pass raw LLM output as tool input',
        rationale: 'Hallucinated or injected tool parameters can cause data corruption or security breaches.',
        enforceLevel: 'strict',
        autoEnforceable: true,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'quality',
        principle: 'Agent must enforce max_iterations limit to prevent infinite tool call loops',
        rationale: 'Without iteration limits, agents can run indefinitely and generate unexpected costs.',
        enforceLevel: 'strict',
        autoEnforceable: true,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'quality',
        principle: 'Agent must escalate to human when confidence < 0.7 on critical decisions',
        rationale: 'Low-confidence decisions can cause serious downstream harm in automated workflows.',
        enforceLevel: 'recommended',
        autoEnforceable: false,
        source: 'auto-detected',
        immutable: false,
    });
}
export function addElectronPrinciples(knowledge, principles, nextId) {
    const isElectronProject = knowledge.framework === 'electron' || knowledge.projectCategory === 'desktop';
    const stackHasElectron = Array.isArray(knowledge.stack) &&
        knowledge.stack.some((s) => s.toLowerCase().includes('electron'));
    if (!isElectronProject || !stackHasElectron) {
        return;
    }
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'contextIsolation must always be true in Electron BrowserWindow',
        rationale: 'contextIsolation prevents renderer process from accessing Node.js APIs directly. Disabling it is a critical vulnerability.',
        enforceLevel: 'strict',
        autoEnforceable: true,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'nodeIntegration must always be false in Electron renderer process',
        rationale: 'nodeIntegration: true in renderer allows attackers to execute arbitrary Node.js code via XSS. Use contextBridge instead.',
        enforceLevel: 'strict',
        autoEnforceable: true,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'webSecurity must always be true in Electron (never disabled)',
        rationale: 'webSecurity: false disables CORS and same-origin policy, exposing the app to cross-origin attacks.',
        enforceLevel: 'strict',
        autoEnforceable: true,
        source: 'auto-detected',
        immutable: true,
    });
    principles.push({
        id: nextId(),
        category: 'security',
        principle: 'IPC communication must only happen via contextBridge.exposeInMainWorld()',
        rationale: 'contextBridge is the only safe way to expose main process APIs to the renderer. nodeIntegration-based IPC is unsafe.',
        enforceLevel: 'strict',
        autoEnforceable: false,
        source: 'auto-detected',
        immutable: true,
    });
}
//# sourceMappingURL=platform-principles.js.map