From a2a46c7c6700edc6840faa2675d92695d2d3104d Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Fri, 27 Jun 2025 12:07:38 -0700 Subject: Add privacy notice slash command (#2059) --- .../cli/src/ui/privacy/CloudFreePrivacyNotice.tsx | 104 +++++++++++++++++++++ .../cli/src/ui/privacy/CloudPaidPrivacyNotice.tsx | 55 +++++++++++ .../cli/src/ui/privacy/GeminiPrivacyNotice.tsx | 58 ++++++++++++ packages/cli/src/ui/privacy/PrivacyNotice.tsx | 42 +++++++++ 4 files changed, 259 insertions(+) create mode 100644 packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx create mode 100644 packages/cli/src/ui/privacy/CloudPaidPrivacyNotice.tsx create mode 100644 packages/cli/src/ui/privacy/GeminiPrivacyNotice.tsx create mode 100644 packages/cli/src/ui/privacy/PrivacyNotice.tsx (limited to 'packages/cli/src/ui/privacy') diff --git a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx new file mode 100644 index 00000000..f9341bf9 --- /dev/null +++ b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx @@ -0,0 +1,104 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Box, Newline, Text } from 'ink'; +import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js'; +import { usePrivacySettings } from '../hooks/usePrivacySettings.js'; +import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js'; +import { Config } from '@google/gemini-cli-core'; +import { Colors } from '../colors.js'; + +interface CloudFreePrivacyNoticeProps { + config: Config; + onExit: () => void; +} + +export const CloudFreePrivacyNotice = ({ + config, + onExit, +}: CloudFreePrivacyNoticeProps) => { + const { privacyState, updateDataCollectionOptIn } = + usePrivacySettings(config); + + if (privacyState.isLoading) { + return Loading...; + } + + if (privacyState.error) { + return ( + + Error loading Opt-in settings: {privacyState.error} + + ); + } + + if (privacyState.isFreeTier === false) { + return ; + } + + const items = [ + { label: 'Yes', value: true }, + { label: 'No', value: false }, + ]; + + return ( + + + Gemini Code Assist for Individuals Privacy Notice + + + + This notice and our Privacy Policy + [1] describe how Gemini Code + Assist handles your data. Please read them carefully. + + + + When you use Gemini Code Assist for individuals with Gemini CLI, Google + collects your prompts, related code, generated output, code edits, + related feature usage information, and your feedback to provide, + improve, and develop Google products and services and machine learning + technologies. + + + + To help with quality and improve our products (such as generative + machine-learning models), human reviewers may read, annotate, and + process the data collected above. We take steps to protect your privacy + as part of this process. This includes disconnecting the data from your + Google Account before reviewers see or annotate it, and storing those + disconnected copies for up to 18 months. Please don't submit + confidential information or any data you wouldn't want a reviewer + to see or Google to use to improve our products, services and + machine-learning technologies. + + + + + Allow Google to use this data to develop and improve our products? + + { + updateDataCollectionOptIn(value); + // Only exit if there was no error. + if (!privacyState.error) { + onExit(); + } + }} + /> + + + + [1]{' '} + https://policies.google.com/privacy + + + Press Enter to choose an option and exit. + + ); +}; diff --git a/packages/cli/src/ui/privacy/CloudPaidPrivacyNotice.tsx b/packages/cli/src/ui/privacy/CloudPaidPrivacyNotice.tsx new file mode 100644 index 00000000..e50dcd4b --- /dev/null +++ b/packages/cli/src/ui/privacy/CloudPaidPrivacyNotice.tsx @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Box, Newline, Text, useInput } from 'ink'; +import { Colors } from '../colors.js'; + +interface CloudPaidPrivacyNoticeProps { + onExit: () => void; +} + +export const CloudPaidPrivacyNotice = ({ + onExit, +}: CloudPaidPrivacyNoticeProps) => { + useInput((input, key) => { + if (key.escape) { + onExit(); + } + }); + + return ( + + + Vertex AI Notice + + + + Service Specific Terms[1] are + incorporated into the agreement under which Google has agreed to provide + Google Cloud Platform[2] to + Customer (the “Agreement”). If the Agreement authorizes the resale or + supply of Google Cloud Platform under a Google Cloud partner or reseller + program, then except for in the section entitled “Partner-Specific + Terms”, all references to Customer in the Service Specific Terms mean + Partner or Reseller (as applicable), and all references to Customer Data + in the Service Specific Terms mean Partner Data. Capitalized terms used + but not defined in the Service Specific Terms have the meaning given to + them in the Agreement. + + + + [1]{' '} + https://cloud.google.com/terms/service-terms + + + [2]{' '} + https://cloud.google.com/terms/services + + + Press Esc to exit. + + ); +}; diff --git a/packages/cli/src/ui/privacy/GeminiPrivacyNotice.tsx b/packages/cli/src/ui/privacy/GeminiPrivacyNotice.tsx new file mode 100644 index 00000000..57030ac3 --- /dev/null +++ b/packages/cli/src/ui/privacy/GeminiPrivacyNotice.tsx @@ -0,0 +1,58 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Box, Newline, Text, useInput } from 'ink'; +import { Colors } from '../colors.js'; + +interface GeminiPrivacyNoticeProps { + onExit: () => void; +} + +export const GeminiPrivacyNotice = ({ onExit }: GeminiPrivacyNoticeProps) => { + useInput((input, key) => { + if (key.escape) { + onExit(); + } + }); + + return ( + + + Gemini API Key Notice + + + + By using the Gemini API[1], + Google AI Studio + [2], and the other Google + developer services that reference these terms (collectively, the + "APIs" or "Services"), you are agreeing to Google + APIs Terms of Service (the "API Terms") + [3], and the Gemini API + Additional Terms of Service (the "Additional Terms") + [4]. + + + + [1]{' '} + https://ai.google.dev/docs/gemini_api_overview + + + [2] https://aistudio.google.com/ + + + [3]{' '} + https://developers.google.com/terms + + + [4]{' '} + https://ai.google.dev/gemini-api/terms + + + Press Esc to exit. + + ); +}; diff --git a/packages/cli/src/ui/privacy/PrivacyNotice.tsx b/packages/cli/src/ui/privacy/PrivacyNotice.tsx new file mode 100644 index 00000000..b12b3648 --- /dev/null +++ b/packages/cli/src/ui/privacy/PrivacyNotice.tsx @@ -0,0 +1,42 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Box } from 'ink'; +import { type Config, AuthType } from '@google/gemini-cli-core'; +import { GeminiPrivacyNotice } from './GeminiPrivacyNotice.js'; +import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js'; +import { CloudFreePrivacyNotice } from './CloudFreePrivacyNotice.js'; + +interface PrivacyNoticeProps { + onExit: () => void; + config: Config; +} + +const PrivacyNoticeText = ({ + config, + onExit, +}: { + config: Config; + onExit: () => void; +}) => { + const authType = config.getContentGeneratorConfig()?.authType; + + switch (authType) { + case AuthType.USE_GEMINI: + return ; + case AuthType.USE_VERTEX_AI: + return ; + case AuthType.LOGIN_WITH_GOOGLE_PERSONAL: + default: + return ; + } +}; + +export const PrivacyNotice = ({ onExit, config }: PrivacyNoticeProps) => ( + + + +); -- cgit v1.2.3