mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-13 15:40:57 -07:00
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import {
|
|
type PolicyEngineConfig,
|
|
type ApprovalMode,
|
|
type PolicyEngine,
|
|
type MessageBus,
|
|
type PolicySettings,
|
|
createPolicyEngineConfig as createCorePolicyEngineConfig,
|
|
createPolicyUpdater as createCorePolicyUpdater,
|
|
} from '@google/gemini-cli-core';
|
|
import { type Settings } from './settings.js';
|
|
|
|
export async function createPolicyEngineConfig(
|
|
settings: Settings,
|
|
approvalMode: ApprovalMode,
|
|
): Promise<PolicyEngineConfig> {
|
|
// Explicitly construct PolicySettings from Settings to ensure type safety
|
|
// and avoid accidental leakage of other settings properties.
|
|
const policySettings: PolicySettings = {
|
|
mcp: settings.mcp,
|
|
tools: settings.tools,
|
|
mcpServers: settings.mcpServers,
|
|
};
|
|
|
|
return createCorePolicyEngineConfig(policySettings, approvalMode);
|
|
}
|
|
|
|
export function createPolicyUpdater(
|
|
policyEngine: PolicyEngine,
|
|
messageBus: MessageBus,
|
|
) {
|
|
return createCorePolicyUpdater(policyEngine, messageBus);
|
|
}
|