pre-release commit

This commit is contained in:
koalazf.99
2025-07-22 19:59:07 +08:00
parent c5dee4bb17
commit a9d6965bef
485 changed files with 111444 additions and 2 deletions

View File

@@ -0,0 +1,113 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Box, Newline, Text, useInput } from 'ink';
import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js';
import { usePrivacySettings } from '../hooks/usePrivacySettings.js';
import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js';
import { Config } from '@qwen/qwen-code-core';
import { Colors } from '../colors.js';
interface CloudFreePrivacyNoticeProps {
config: Config;
onExit: () => void;
}
export const CloudFreePrivacyNotice = ({
config,
onExit,
}: CloudFreePrivacyNoticeProps) => {
const { privacyState, updateDataCollectionOptIn } =
usePrivacySettings(config);
useInput((input, key) => {
if (privacyState.error && key.escape) {
onExit();
}
});
if (privacyState.isLoading) {
return <Text color={Colors.Gray}>Loading...</Text>;
}
if (privacyState.error) {
return (
<Box flexDirection="column" marginY={1}>
<Text color={Colors.AccentRed}>
Error loading Opt-in settings: {privacyState.error}
</Text>
<Text color={Colors.Gray}>Press Esc to exit.</Text>
</Box>
);
}
if (privacyState.isFreeTier === false) {
return <CloudPaidPrivacyNotice onExit={onExit} />;
}
const items = [
{ label: 'Yes', value: true },
{ label: 'No', value: false },
];
return (
<Box flexDirection="column" marginY={1}>
<Text bold color={Colors.AccentPurple}>
Gemini Code Assist for Individuals Privacy Notice
</Text>
<Newline />
<Text>
This notice and our Privacy Policy
<Text color={Colors.AccentBlue}>[1]</Text> describe how Gemini Code
Assist handles your data. Please read them carefully.
</Text>
<Newline />
<Text>
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.
</Text>
<Newline />
<Text>
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&apos;t submit
confidential information or any data you wouldn&apos;t want a reviewer
to see or Google to use to improve our products, services and
machine-learning technologies.
</Text>
<Newline />
<Box flexDirection="column">
<Text>
Allow Google to use this data to develop and improve our products?
</Text>
<RadioButtonSelect
items={items}
initialIndex={privacyState.dataCollectionOptIn ? 0 : 1}
onSelect={(value) => {
updateDataCollectionOptIn(value);
// Only exit if there was no error.
if (!privacyState.error) {
onExit();
}
}}
/>
</Box>
<Newline />
<Text>
<Text color={Colors.AccentBlue}>[1]</Text>{' '}
https://policies.google.com/privacy
</Text>
<Newline />
<Text color={Colors.Gray}>Press Enter to choose an option and exit.</Text>
</Box>
);
};

View File

@@ -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 (
<Box flexDirection="column" marginBottom={1}>
<Text bold color={Colors.AccentPurple}>
Vertex AI Notice
</Text>
<Newline />
<Text>
Service Specific Terms<Text color={Colors.AccentBlue}>[1]</Text> are
incorporated into the agreement under which Google has agreed to provide
Google Cloud Platform<Text color={Colors.AccentGreen}>[2]</Text> 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.
</Text>
<Newline />
<Text>
<Text color={Colors.AccentBlue}>[1]</Text>{' '}
https://cloud.google.com/terms/service-terms
</Text>
<Text>
<Text color={Colors.AccentGreen}>[2]</Text>{' '}
https://cloud.google.com/terms/services
</Text>
<Newline />
<Text color={Colors.Gray}>Press Esc to exit.</Text>
</Box>
);
};

View File

@@ -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 (
<Box flexDirection="column" marginBottom={1}>
<Text bold color={Colors.AccentPurple}>
Gemini API Key Notice
</Text>
<Newline />
<Text>
By using the Gemini API<Text color={Colors.AccentBlue}>[1]</Text>,
Google AI Studio
<Text color={Colors.AccentRed}>[2]</Text>, and the other Google
developer services that reference these terms (collectively, the
&quot;APIs&quot; or &quot;Services&quot;), you are agreeing to Google
APIs Terms of Service (the &quot;API Terms&quot;)
<Text color={Colors.AccentGreen}>[3]</Text>, and the Gemini API
Additional Terms of Service (the &quot;Additional Terms&quot;)
<Text color={Colors.AccentPurple}>[4]</Text>.
</Text>
<Newline />
<Text>
<Text color={Colors.AccentBlue}>[1]</Text>{' '}
https://ai.google.dev/docs/gemini_api_overview
</Text>
<Text>
<Text color={Colors.AccentRed}>[2]</Text> https://aistudio.google.com/
</Text>
<Text>
<Text color={Colors.AccentGreen}>[3]</Text>{' '}
https://developers.google.com/terms
</Text>
<Text>
<Text color={Colors.AccentPurple}>[4]</Text>{' '}
https://ai.google.dev/gemini-api/terms
</Text>
<Newline />
<Text color={Colors.Gray}>Press Esc to exit.</Text>
</Box>
);
};

View File

@@ -0,0 +1,42 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { Box } from 'ink';
import { type Config, AuthType } from '@qwen/qwen-code-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 <GeminiPrivacyNotice onExit={onExit} />;
case AuthType.USE_VERTEX_AI:
return <CloudPaidPrivacyNotice onExit={onExit} />;
case AuthType.LOGIN_WITH_GOOGLE:
default:
return <CloudFreePrivacyNotice config={config} onExit={onExit} />;
}
};
export const PrivacyNotice = ({ onExit, config }: PrivacyNoticeProps) => (
<Box borderStyle="round" padding={1} flexDirection="column">
<PrivacyNoticeText config={config} onExit={onExit} />
</Box>
);