Skip to content

Commit c8540b5

Browse files
authored
feat(config): add isModelAvailabilityServiceEnabled setting (google-gemini#13777)
1 parent f6d97d4 commit c8540b5

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

docs/get-started/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,11 @@ their corresponding top-level category object in your `settings.json` file.
772772
- **Default:** `false`
773773
- **Requires restart:** Yes
774774

775+
- **`experimental.isModelAvailabilityServiceEnabled`** (boolean):
776+
- **Description:** Enable model routing using new availability service.
777+
- **Default:** `false`
778+
- **Requires restart:** Yes
779+
775780
- **`experimental.codebaseInvestigatorSettings.enabled`** (boolean):
776781
- **Description:** Enable the Codebase Investigator agent.
777782
- **Default:** `true`

packages/cli/src/config/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ export async function loadCliConfig(
636636
enabledExtensions: argv.extensions,
637637
extensionLoader: extensionManager,
638638
enableExtensionReloading: settings.experimental?.extensionReloading,
639+
enableModelAvailabilityService:
640+
settings.experimental?.isModelAvailabilityServiceEnabled,
639641
noBrowser: !!process.env['NO_BROWSER'],
640642
summarizeToolOutput: settings.model?.summarizeToolOutput,
641643
ideMode,

packages/cli/src/config/settingsSchema.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,21 @@ describe('SettingsSchema', () => {
345345
getSettingsSchema().general.properties.previewFeatures.description,
346346
).toBe('Enable preview features (e.g., preview models).');
347347
});
348+
349+
it('should have isModelAvailabilityServiceEnabled setting in schema', () => {
350+
const setting =
351+
getSettingsSchema().experimental.properties
352+
.isModelAvailabilityServiceEnabled;
353+
expect(setting).toBeDefined();
354+
expect(setting.type).toBe('boolean');
355+
expect(setting.category).toBe('Experimental');
356+
expect(setting.default).toBe(false);
357+
expect(setting.requiresRestart).toBe(true);
358+
expect(setting.showInDialog).toBe(false);
359+
expect(setting.description).toBe(
360+
'Enable model routing using new availability service.',
361+
);
362+
});
348363
});
349364

350365
it('has JSON schema definitions for every referenced ref', () => {

packages/cli/src/config/settingsSchema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,15 @@ const SETTINGS_SCHEMA = {
12911291
'Enables extension loading/unloading within the CLI session.',
12921292
showInDialog: false,
12931293
},
1294+
isModelAvailabilityServiceEnabled: {
1295+
type: 'boolean',
1296+
label: 'Enable Model Availability Service',
1297+
category: 'Experimental',
1298+
requiresRestart: true,
1299+
default: false,
1300+
description: 'Enable model routing using new availability service.',
1301+
showInDialog: false,
1302+
},
12941303
codebaseInvestigatorSettings: {
12951304
type: 'object',
12961305
label: 'Codebase Investigator Settings',

packages/core/src/config/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ export interface ConfigParameters {
305305
[K in HookEventName]?: HookDefinition[];
306306
};
307307
previewFeatures?: boolean;
308+
enableModelAvailabilityService?: boolean;
308309
}
309310

310311
export class Config {
@@ -420,6 +421,7 @@ export class Config {
420421

421422
private previewModelFallbackMode = false;
422423
private previewModelBypassMode = false;
424+
private readonly enableModelAvailabilityService: boolean;
423425

424426
constructor(params: ConfigParameters) {
425427
this.sessionId = params.sessionId;
@@ -477,6 +479,8 @@ export class Config {
477479
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
478480
this.bugCommand = params.bugCommand;
479481
this.model = params.model;
482+
this.enableModelAvailabilityService =
483+
params.enableModelAvailabilityService ?? false;
480484
this.previewFeatures = params.previewFeatures ?? undefined;
481485
this.maxSessionTurns = params.maxSessionTurns ?? -1;
482486
this.experimentalZedIntegration =
@@ -1140,6 +1144,10 @@ export class Config {
11401144
return this.enableExtensionReloading;
11411145
}
11421146

1147+
isModelAvailabilityServiceEnabled(): boolean {
1148+
return this.enableModelAvailabilityService;
1149+
}
1150+
11431151
getNoBrowser(): boolean {
11441152
return this.noBrowser;
11451153
}

schemas/settings.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,13 @@
12591259
"default": false,
12601260
"type": "boolean"
12611261
},
1262+
"isModelAvailabilityServiceEnabled": {
1263+
"title": "Enable Model Availability Service",
1264+
"description": "Enable model routing using new availability service.",
1265+
"markdownDescription": "Enable model routing using new availability service.\n\n- Category: `Experimental`\n- Requires restart: `yes`\n- Default: `false`",
1266+
"default": false,
1267+
"type": "boolean"
1268+
},
12621269
"codebaseInvestigatorSettings": {
12631270
"title": "Codebase Investigator Settings",
12641271
"description": "Configuration for Codebase Investigator.",

0 commit comments

Comments
 (0)