mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
feat(core): Integrate remote experiments configuration (#12539)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { getReleaseChannel } from '../../utils/channel.js';
|
||||
import type { ClientMetadata, Platform } from './types.js';
|
||||
import type { ClientMetadata, ClientMetadataPlatform } from '../types.js';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'node:path';
|
||||
|
||||
@@ -15,7 +15,7 @@ const __dirname = path.dirname(__filename);
|
||||
// Cache all client metadata.
|
||||
let clientMetadataPromise: Promise<ClientMetadata> | undefined;
|
||||
|
||||
function getPlatform(): Platform {
|
||||
function getPlatform(): ClientMetadataPlatform {
|
||||
const platform = process.platform;
|
||||
const arch = process.arch;
|
||||
|
||||
@@ -45,10 +45,10 @@ function getPlatform(): Platform {
|
||||
export async function getClientMetadata(): Promise<ClientMetadata> {
|
||||
if (!clientMetadataPromise) {
|
||||
clientMetadataPromise = (async () => ({
|
||||
ide_type: 'GEMINI_CLI',
|
||||
ide_version: process.env['CLI_VERSION'] || process.version,
|
||||
ideName: 'GEMINI_CLI',
|
||||
ideVersion: process.env['CLI_VERSION'] || process.version,
|
||||
platform: getPlatform(),
|
||||
update_channel: await getReleaseChannel(__dirname),
|
||||
updateChannel: await getReleaseChannel(__dirname),
|
||||
}))();
|
||||
}
|
||||
return await clientMetadataPromise;
|
||||
|
||||
@@ -44,6 +44,6 @@ function parseExperiments(response: ListExperimentsResponse): Experiments {
|
||||
}
|
||||
return {
|
||||
flags,
|
||||
experimentIds: response.experiment_ids ?? [],
|
||||
experimentIds: response.experimentIds ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,26 +4,28 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { ClientMetadata } from '../types.js';
|
||||
|
||||
export interface ListExperimentsRequest {
|
||||
project: string;
|
||||
metadata?: ClientMetadata;
|
||||
}
|
||||
|
||||
export interface ListExperimentsResponse {
|
||||
experiment_ids?: number[];
|
||||
experimentIds?: number[];
|
||||
flags?: Flag[];
|
||||
filtered_flags?: FilteredFlag[];
|
||||
debug_string?: string;
|
||||
filteredFlags?: FilteredFlag[];
|
||||
debugString?: string;
|
||||
}
|
||||
|
||||
export interface Flag {
|
||||
name?: string;
|
||||
bool_value?: boolean;
|
||||
float_value?: number;
|
||||
int_value?: string; // int64
|
||||
string_value?: string;
|
||||
int32_list_value?: Int32List;
|
||||
string_list_value?: StringList;
|
||||
boolValue?: boolean;
|
||||
floatValue?: number;
|
||||
intValue?: string; // int64
|
||||
stringValue?: string;
|
||||
int32ListValue?: Int32List;
|
||||
stringListValue?: StringList;
|
||||
}
|
||||
|
||||
export interface Int32List {
|
||||
@@ -38,21 +40,3 @@ export interface FilteredFlag {
|
||||
name?: string;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface ClientMetadata {
|
||||
ide_type?: IdeType;
|
||||
ide_version?: string;
|
||||
platform?: Platform;
|
||||
update_channel?: 'nightly' | 'preview' | 'stable';
|
||||
duet_project?: string;
|
||||
}
|
||||
|
||||
export type IdeType = 'GEMINI_CLI';
|
||||
|
||||
export type Platform =
|
||||
| 'PLATFORM_UNSPECIFIED'
|
||||
| 'DARWIN_AMD64'
|
||||
| 'DARWIN_ARM64'
|
||||
| 'LINUX_AMD64'
|
||||
| 'LINUX_ARM64'
|
||||
| 'WINDOWS_AMD64';
|
||||
|
||||
Reference in New Issue
Block a user