Skip to content

Commit 04eb476

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
[DrJones] implement launch flags
Bug: 376005394 Change-Id: I2f5dec9bcc0f464cb90dd6194f5d4a8d5bc343dc Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5971494 Reviewed-by: Wolfgang Beyer <[email protected]> Commit-Queue: Alex Rudenko <[email protected]>
1 parent 99dc5e1 commit 04eb476

File tree

11 files changed

+70
-36
lines changed

11 files changed

+70
-36
lines changed

front_end/core/root/Runtime.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,21 +334,21 @@ export interface HostConfigFreestyler {
334334
executionMode?: HostConfigFreestylerExecutionMode;
335335
}
336336

337-
export interface HostConfigExplainThisResourceDogfood {
337+
export interface HostConfigAiAssistanceNetworkAgent {
338338
modelId: string;
339339
temperature: number;
340340
enabled: boolean;
341341
userTier: string;
342342
}
343343

344-
export interface HostConfigAiAssistancePerformanceAgentDogfood {
344+
export interface HostConfigAiAssistancePerformanceAgent {
345345
modelId: string;
346346
temperature: number;
347347
enabled: boolean;
348348
userTier: string;
349349
}
350350

351-
export interface HostConfigAiAssistanceFileAgentDogfood {
351+
export interface HostConfigAiAssistanceFileAgent {
352352
modelId: string;
353353
temperature: number;
354354
enabled: boolean;
@@ -375,9 +375,12 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
375375
aidaAvailability: AidaAvailability,
376376
devToolsConsoleInsights: HostConfigConsoleInsights,
377377
devToolsFreestyler: HostConfigFreestyler,
378-
devToolsExplainThisResourceDogfood: HostConfigExplainThisResourceDogfood,
379-
devToolsAiAssistancePerformanceAgentDogfood: HostConfigAiAssistancePerformanceAgentDogfood,
380-
devToolsAiAssistanceFileAgentDogfood: HostConfigAiAssistanceFileAgentDogfood,
378+
devToolsExplainThisResourceDogfood: HostConfigAiAssistanceNetworkAgent,
379+
devToolsAiAssistanceNetworkAgent: HostConfigAiAssistanceNetworkAgent,
380+
devToolsAiAssistancePerformanceAgentDogfood: HostConfigAiAssistancePerformanceAgent,
381+
devToolsAiAssistanceFileAgent: HostConfigAiAssistanceFileAgent,
382+
devToolsAiAssistanceFileAgentDogfood: HostConfigAiAssistanceFileAgent,
383+
devToolsAiAssistancePerformanceAgent: HostConfigAiAssistancePerformanceAgent,
381384
devToolsVeLogging: HostConfigVeLogging,
382385
devToolsPrivacyUI: HostConfigPrivacyUI,
383386
/**

front_end/panels/freestyler/DrJonesFileAgent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {DrJonesFileAgent, formatSourceMapDetails, ResponseType} from './freestyl
2121
describeWithMockConnection('DrJonesFileAgent', () => {
2222
function mockHostConfig(modelId?: string, temperature?: number) {
2323
getGetHostConfigStub({
24-
devToolsAiAssistanceFileAgentDogfood: {
24+
devToolsAiAssistanceFileAgent: {
2525
modelId,
2626
temperature,
2727
},

front_end/panels/freestyler/DrJonesFileAgent.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ export class DrJonesFileAgent extends AiAgent<Workspace.UISourceCode.UISourceCod
7777
readonly clientFeature = Host.AidaClient.ClientFeature.CHROME_DRJONES_FILE_AGENT;
7878
get userTier(): string|undefined {
7979
const config = Common.Settings.Settings.instance().getHostConfig();
80-
return config.devToolsAiAssistanceFileAgentDogfood?.userTier;
80+
return config.devToolsAiAssistanceFileAgent?.userTier ?? config.devToolsAiAssistanceFileAgentDogfood?.userTier;
8181
}
8282
get options(): AidaRequestOptions {
8383
const config = Common.Settings.Settings.instance().getHostConfig();
84-
const temperature = config.devToolsAiAssistanceFileAgentDogfood?.temperature;
85-
const modelId = config.devToolsAiAssistanceFileAgentDogfood?.modelId;
84+
const temperature =
85+
config.devToolsAiAssistanceFileAgent?.temperature ?? config.devToolsAiAssistanceFileAgentDogfood?.temperature;
86+
const modelId =
87+
config.devToolsAiAssistanceFileAgent?.modelId ?? config.devToolsAiAssistanceFileAgentDogfood?.modelId;
8688

8789
return {
8890
temperature,

front_end/panels/freestyler/DrJonesNetworkAgent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describeWithMockConnection('DrJonesNetworkAgent', () => {
2424

2525
function mockHostConfig(modelId?: string, temperature?: number) {
2626
getGetHostConfigStub({
27-
devToolsExplainThisResourceDogfood: {
27+
devToolsAiAssistanceNetworkAgent: {
2828
modelId,
2929
temperature,
3030
},

front_end/panels/freestyler/DrJonesNetworkAgent.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ export class DrJonesNetworkAgent extends AiAgent<SDK.NetworkRequest.NetworkReque
105105
readonly clientFeature = Host.AidaClient.ClientFeature.CHROME_DRJONES_NETWORK_AGENT;
106106
get userTier(): string|undefined {
107107
const config = Common.Settings.Settings.instance().getHostConfig();
108-
return config.devToolsExplainThisResourceDogfood?.userTier;
108+
return config.devToolsAiAssistanceNetworkAgent?.userTier ?? config.devToolsExplainThisResourceDogfood?.userTier;
109109
}
110110
get options(): AidaRequestOptions {
111111
const config = Common.Settings.Settings.instance().getHostConfig();
112-
const temperature = config.devToolsExplainThisResourceDogfood?.temperature;
113-
const modelId = config.devToolsExplainThisResourceDogfood?.modelId;
112+
const temperature =
113+
config.devToolsAiAssistanceNetworkAgent?.temperature ?? config.devToolsExplainThisResourceDogfood?.temperature;
114+
const modelId =
115+
config.devToolsAiAssistanceNetworkAgent?.modelId ?? config.devToolsExplainThisResourceDogfood?.modelId;
114116

115117
return {
116118
temperature,

front_end/panels/freestyler/components/FreestylerChatUi.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ css
126126
devToolsFreestyler: {
127127
enabled: true,
128128
},
129-
devToolsExplainThisResourceDogfood: {
129+
devToolsAiAssistanceNetworkAgent: {
130130
enabled: true,
131131
},
132-
devToolsAiAssistanceFileAgentDogfood: {
132+
devToolsAiAssistanceFileAgent: {
133133
enabled: true,
134134
},
135-
devToolsAiAssistancePerformanceAgentDogfood: {
135+
devToolsAiAssistancePerformanceAgent: {
136136
enabled: true,
137137
},
138138
});

front_end/panels/freestyler/components/FreestylerChatUi.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,13 +1077,14 @@ export class FreestylerChatUi extends HTMLElement {
10771077

10781078
#getStringForConsentView(): string {
10791079
const config = Common.Settings.Settings.instance().getHostConfig();
1080-
if (config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
1080+
if (config.devToolsAiAssistancePerformanceAgent?.enabled ||
1081+
config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
10811082
return UIStrings.turnOnForStylesRequestsPerformanceAndFiles;
10821083
}
1083-
if (config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
1084+
if (config.devToolsAiAssistanceFileAgent?.enabled || config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
10841085
return UIStrings.turnOnForStylesRequestsAndFiles;
10851086
}
1086-
if (config.devToolsExplainThisResourceDogfood?.enabled) {
1087+
if (config.devToolsAiAssistanceNetworkAgent?.enabled || config.devToolsExplainThisResourceDogfood?.enabled) {
10871088
return UIStrings.turnOnForStylesAndRequests;
10881089
}
10891090
return UIStrings.turnOnForStyles;
@@ -1143,13 +1144,13 @@ export class FreestylerChatUi extends HTMLElement {
11431144
${config.devToolsFreestyler?.enabled ? html`
11441145
<p><strong>${lockedString(UIStringsNotTranslate.cssHelp)}</strong> ${lockedString(UIStringsNotTranslate.cssHelpExplainer)}</p>
11451146
` : LitHtml.nothing}
1146-
${config.devToolsAiAssistanceFileAgentDogfood?.enabled ? html`
1147+
${(config.devToolsAiAssistanceFileAgent?.enabled || config.devToolsAiAssistanceFileAgentDogfood?.enabled) ? html`
11471148
<p><strong>${lockedString(UIStringsNotTranslate.fileHelp)}</strong> ${lockedString(UIStringsNotTranslate.fileHelpExplainer)}</p>
11481149
` : LitHtml.nothing}
1149-
${config.devToolsExplainThisResourceDogfood?.enabled ? html`
1150+
${(config.devToolsAiAssistanceNetworkAgent?.enabled || config.devToolsExplainThisResourceDogfood?.enabled) ? html`
11501151
<p><strong>${lockedString(UIStringsNotTranslate.networkHelp)}</strong> ${lockedString(UIStringsNotTranslate.networkHelpExplainer)}</p>
11511152
` : LitHtml.nothing}
1152-
${config.devToolsAiAssistancePerformanceAgentDogfood?.enabled ? html`
1153+
${(config.devToolsAiAssistancePerformanceAgent?.enabled || config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) ? html`
11531154
<p><strong>${lockedString(UIStringsNotTranslate.performanceHelp)}</strong> ${lockedString(UIStringsNotTranslate.performanceHelpExplainer)}</p>
11541155
` : LitHtml.nothing}
11551156
</div>

front_end/panels/freestyler/freestyler-meta.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,21 @@ function isFreestylerFeatureAvailable(config?: Root.Runtime.HostConfig): boolean
8282
}
8383

8484
function isDrJonesNetworkFeatureAvailable(config?: Root.Runtime.HostConfig): boolean {
85-
return (config?.aidaAvailability?.enabled && config?.devToolsExplainThisResourceDogfood?.enabled) === true;
85+
return (config?.aidaAvailability?.enabled &&
86+
(config?.devToolsExplainThisResourceDogfood?.enabled ||
87+
config?.devToolsAiAssistanceNetworkAgent?.enabled)) === true;
8688
}
8789

8890
function isDrJonesPerformanceFeatureAvailable(config?: Root.Runtime.HostConfig): boolean {
89-
return (config?.aidaAvailability?.enabled && config?.devToolsAiAssistancePerformanceAgentDogfood?.enabled) === true;
91+
return (config?.aidaAvailability?.enabled &&
92+
(config?.devToolsAiAssistancePerformanceAgentDogfood?.enabled ||
93+
config?.devToolsAiAssistancePerformanceAgent?.enabled)) === true;
9094
}
9195

9296
function isDrJonesFileFeatureAvailable(config?: Root.Runtime.HostConfig): boolean {
93-
return (config?.aidaAvailability?.enabled && config?.devToolsAiAssistanceFileAgentDogfood?.enabled) === true;
97+
return (config?.aidaAvailability?.enabled &&
98+
(config?.devToolsAiAssistanceFileAgentDogfood?.enabled || config?.devToolsAiAssistanceFileAgent?.enabled)) ===
99+
true;
94100
}
95101

96102
function isAnyFeatureAvailable(config?: Root.Runtime.HostConfig): boolean {

front_end/panels/settings/AISettingsTab.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describeWithEnvironment('AISettingsTab', () => {
2424

2525
function mockHostConfigWithExplainThisResourceEnabled() {
2626
getGetHostConfigStub({
27-
devToolsExplainThisResourceDogfood: {
27+
devToolsAiAssistanceNetworkAgent: {
2828
enabled: true,
2929
modelId: 'test',
3030
},

front_end/panels/settings/AISettingsTab.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,27 +215,29 @@ export class AISettingsTab extends LegacyWrapper.LegacyWrapper.WrappableComponen
215215

216216
#getAiAssistanceSettingDescription(): Platform.UIString.LocalizedString {
217217
const config = Common.Settings.Settings.instance().getHostConfig();
218-
if (config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
218+
if (config.devToolsAiAssistancePerformanceAgent?.enabled ||
219+
config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
219220
return i18nString(UIStrings.helpUnderstandStylingNetworkPerformanceAndFile);
220221
}
221-
if (config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
222+
if (config.devToolsAiAssistanceFileAgent?.enabled || config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
222223
return i18nString(UIStrings.helpUnderstandStylingNetworkAndFile);
223224
}
224-
if (config.devToolsExplainThisResourceDogfood?.enabled) {
225+
if (config.devToolsAiAssistanceNetworkAgent?.enabled || config.devToolsExplainThisResourceDogfood?.enabled) {
225226
return i18nString(UIStrings.helpUnderstandStylingAndNetworkRequest);
226227
}
227228
return i18nString(UIStrings.helpUnderstandStyling);
228229
}
229230

230231
#getAiAssistanceSettingInfo(): Platform.UIString.LocalizedString {
231232
const config = Common.Settings.Settings.instance().getHostConfig();
232-
if (config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
233+
if (config.devToolsAiAssistancePerformanceAgent?.enabled ||
234+
config.devToolsAiAssistancePerformanceAgentDogfood?.enabled) {
233235
return i18nString(UIStrings.explainStylingNetworkPerformanceAndFile);
234236
}
235-
if (config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
237+
if (config.devToolsAiAssistanceFileAgent?.enabled || config.devToolsAiAssistanceFileAgentDogfood?.enabled) {
236238
return i18nString(UIStrings.explainStylingNetworkAndFile);
237239
}
238-
if (config.devToolsExplainThisResourceDogfood?.enabled) {
240+
if (config.devToolsAiAssistanceNetworkAgent?.enabled || config.devToolsExplainThisResourceDogfood?.enabled) {
239241
return i18nString(UIStrings.explainStylingAndNetworkRequest);
240242
}
241243
return i18nString(UIStrings.explainStyling);

0 commit comments

Comments
 (0)