chrome-devtools-frontend 1.0.1555430 → 1.0.1556696
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +2 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +75 -7
- package/front_end/entrypoints/formatter_worker/Substitute.ts +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/protocol.ts +0 -1
- package/front_end/models/ai_assistance/AiConversation.ts +71 -10
- package/front_end/models/ai_assistance/ArtifactsManager.ts +67 -0
- package/front_end/models/ai_assistance/ConversationHandler.ts +3 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +17 -27
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +151 -3
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +0 -2
- package/front_end/models/annotations/AnnotationRepository.ts +2 -2
- package/front_end/models/greendev/Prototypes.ts +56 -0
- package/front_end/models/greendev/README.md +5 -0
- package/front_end/models/greendev/greendev.ts +5 -0
- package/front_end/models/trace/extras/TraceTree.ts +4 -2
- package/front_end/models/trace/insights/LCPDiscovery.ts +0 -2
- package/front_end/models/trace/types/TraceEvents.ts +0 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +96 -91
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +16 -0
- package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +109 -7
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
- package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +7 -8
- package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +15 -8
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +9 -9
- package/front_end/panels/ai_assistance/components/artifactsViewer.css +6 -1
- package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +5 -6
- package/front_end/panels/application/AppManifestView.ts +263 -205
- package/front_end/panels/application/ApplicationPanelSidebar.ts +24 -57
- package/front_end/panels/application/OpenedWindowDetailsView.ts +2 -0
- package/front_end/panels/application/ServiceWorkersView.ts +2 -0
- package/front_end/panels/application/StorageView.ts +1 -0
- package/front_end/panels/application/appManifestView.css +48 -0
- package/front_end/panels/application/components/ProtocolHandlersView.ts +2 -2
- package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +4 -8
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +148 -97
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +37 -35
- package/front_end/panels/settings/SettingsScreen.ts +133 -1
- package/front_end/panels/settings/settings-meta.ts +24 -0
- package/front_end/panels/settings/settingsScreen.css +4 -0
- package/front_end/panels/sources/UISourceCodeFrame.ts +3 -17
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -1
- package/front_end/third_party/acorn/estree-legacy.d.ts +2 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/CDPSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +21 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +15 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/CDPSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +21 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/api/Frame.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/bidi/core/Connection.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +29 -10
- package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/report_view/ReportView.docs.ts +37 -0
- package/front_end/ui/components/report_view/ReportView.ts +1 -4
- package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
- package/front_end/ui/legacy/Floaty.ts +5 -9
- package/front_end/ui/legacy/InspectorView.ts +2 -1
- package/front_end/ui/legacy/ReportView.ts +5 -4
- package/front_end/ui/legacy/Widget.ts +7 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -1
- package/front_end/ui/legacy/reportView.css +0 -24
- package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
- package/package.json +1 -1
|
@@ -10,8 +10,10 @@ import * as Root from '../../../core/root/root.js';
|
|
|
10
10
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
11
11
|
import * as Tracing from '../../../services/tracing/tracing.js';
|
|
12
12
|
import * as Annotations from '../../annotations/annotations.js';
|
|
13
|
+
import * as Logs from '../../logs/logs.js';
|
|
13
14
|
import * as SourceMapScopes from '../../source_map_scopes/source_map_scopes.js';
|
|
14
15
|
import * as Trace from '../../trace/trace.js';
|
|
16
|
+
import {ArtifactsManager} from '../ArtifactsManager.js';
|
|
15
17
|
import {
|
|
16
18
|
PerformanceInsightFormatter,
|
|
17
19
|
} from '../data_formatters/PerformanceInsightFormatter.js';
|
|
@@ -67,7 +69,49 @@ const greenDevAdditionalAnnotationsGuidelines = `
|
|
|
67
69
|
- The annotationMessage should be descriptive and relevant to why the element or network request is being highlighted.
|
|
68
70
|
`;
|
|
69
71
|
|
|
70
|
-
const
|
|
72
|
+
const getGreenDevAdditionalWidgetGuidelines = (): string => {
|
|
73
|
+
// GreenDev is experimenting with multiple ways to display widget:
|
|
74
|
+
// if widgetsFromFunctionCalls is true, then we use function calls to add widgets
|
|
75
|
+
// otherwise we use ai-insight tags
|
|
76
|
+
const widgetsFromFunctionCalls = true;
|
|
77
|
+
|
|
78
|
+
if (widgetsFromFunctionCalls) {
|
|
79
|
+
return `
|
|
80
|
+
- CRITICAL: You have access to three functions for adding rich, interactive widgets to your response:
|
|
81
|
+
\`addInsightWidget\`, \`addNetworkRequestWidget\`, and \`addFlameChartWidget\`.
|
|
82
|
+
You MUST use these functions whenever you refer to a corresponding entity.
|
|
83
|
+
|
|
84
|
+
- **\`addInsightWidget({insightType: '...'})\`**:
|
|
85
|
+
- **When to use**: Call this function every time you mention a specific performance insight (e.g., LCP, INP,
|
|
86
|
+
CLS culprits).
|
|
87
|
+
- **Purpose**: It embeds an interactive widget that provides a detailed breakdown and visualization of the
|
|
88
|
+
insight.
|
|
89
|
+
- **Example**: If you are explaining the causes of a poor LCP score, you MUST also call
|
|
90
|
+
\`addInsightWidget({insightType: 'LCPBreakdown'})\`. This provides the user with the data to explore
|
|
91
|
+
alongside your explanation.
|
|
92
|
+
- **\`addNetworkRequestWidget({eventKey: '...'})\`**:
|
|
93
|
+
- **When to use**: Call this function whenever you discuss a specific network request.
|
|
94
|
+
- **Purpose**: It adds a widget displaying the full details of the network request, such as its timing,
|
|
95
|
+
headers, and priority.
|
|
96
|
+
- **Critical**: The eventKey should be the trace event key (only the number, no letters prefix or -) of that
|
|
97
|
+
script's network request.
|
|
98
|
+
- **Example**: If you identify a render-blocking script, you MUST also call
|
|
99
|
+
\`addNetworkRequestWidget({eventKey: '...'})\` with the trace event key (only the number, no letters prefix
|
|
100
|
+
or -) of that script's network request.
|
|
101
|
+
- **\`addFlameChartWidget({start: ..., end: ...})\`**:
|
|
102
|
+
- **When to use**: Call this function to highlight a specific time range within the trace, especially when
|
|
103
|
+
discussing long tasks, specific events, or periods of high activity.
|
|
104
|
+
- **Purpose**: It embeds a focused flame chart visualization for the given time range (in microseconds).
|
|
105
|
+
- **Example**: If you find a long task that is blocking the main thread, you MUST also call
|
|
106
|
+
\`addFlameChartWidget({start: 123456, end: 789012})\`. This provides the user with the data to explore
|
|
107
|
+
alongside your explanation.
|
|
108
|
+
- **General Rules**:
|
|
109
|
+
- You MUST call these functions as soon as you identify the entity you are discussing.
|
|
110
|
+
- Do NOT add more than one widget for the same insight, network request, or time range to avoid redundancy.
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return `
|
|
71
115
|
- **Visualizing Insights**: When discussing the breakdown of specific metrics or a performance problem,
|
|
72
116
|
you must render the appropriate Insight Overview component. Use these tags on a new line within your response:
|
|
73
117
|
- For LCP breakdown: <ai-insight value="LCPBreakdown">
|
|
@@ -102,6 +146,7 @@ you must render the appropriate Insight Overview component. Use these tags on a
|
|
|
102
146
|
- For example, for LCP, the phases like Time to First Byte will be part of the insight widget, so you must not state them in the text. This applies to other insights and network request timings.
|
|
103
147
|
- Do not display any of the same widgets more than once. For example, if you have already displayed a network request widget for a specific event, do not display it again in the same response.
|
|
104
148
|
`;
|
|
149
|
+
};
|
|
105
150
|
|
|
106
151
|
/**
|
|
107
152
|
* Preamble clocks in at ~1341 tokens.
|
|
@@ -111,7 +156,7 @@ you must render the appropriate Insight Overview component. Use these tags on a
|
|
|
111
156
|
* Check token length in https://aistudio.google.com/
|
|
112
157
|
*/
|
|
113
158
|
const buildPreamble = (): string => {
|
|
114
|
-
const greenDevEnabled = Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled;
|
|
159
|
+
const greenDevEnabled = Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
|
|
115
160
|
const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled();
|
|
116
161
|
return `You are an assistant, expert in web performance and highly skilled with Chrome DevTools.
|
|
117
162
|
|
|
@@ -166,7 +211,7 @@ Note: if the user asks a specific question about the trace (such as "What is my
|
|
|
166
211
|
- Be direct and to the point. Avoid unnecessary introductory phrases or filler content. Focus on delivering actionable advice efficiently.
|
|
167
212
|
|
|
168
213
|
${annotationsEnabled ? greenDevAdditionalAnnotationsGuidelines : ''}
|
|
169
|
-
${greenDevEnabled ?
|
|
214
|
+
${greenDevEnabled ? getGreenDevAdditionalWidgetGuidelines() : ''}
|
|
170
215
|
|
|
171
216
|
## Strict Constraints
|
|
172
217
|
|
|
@@ -1200,6 +1245,109 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
|
|
|
1200
1245
|
},
|
|
1201
1246
|
});
|
|
1202
1247
|
}
|
|
1248
|
+
|
|
1249
|
+
if (Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled) {
|
|
1250
|
+
this.declareFunction<{insightType: Trace.Insights.Types.InsightKeys}>('addInsightWidget', {
|
|
1251
|
+
description:
|
|
1252
|
+
'Adds an insight widget to the response. When mentioning an insight, call this function to also display an appropriate widget.',
|
|
1253
|
+
parameters: {
|
|
1254
|
+
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
1255
|
+
description: '',
|
|
1256
|
+
nullable: false,
|
|
1257
|
+
properties: {
|
|
1258
|
+
insightType: {
|
|
1259
|
+
type: Host.AidaClient.ParametersTypes.STRING,
|
|
1260
|
+
description:
|
|
1261
|
+
'The name of the insight. Only use the insight names given in the "Available insights" list.',
|
|
1262
|
+
nullable: false,
|
|
1263
|
+
},
|
|
1264
|
+
},
|
|
1265
|
+
},
|
|
1266
|
+
handler: async _params => {
|
|
1267
|
+
ArtifactsManager.instance().addArtifact({type: 'insight', insightType: _params.insightType});
|
|
1268
|
+
return {result: {success: true}};
|
|
1269
|
+
},
|
|
1270
|
+
});
|
|
1271
|
+
|
|
1272
|
+
this.declareFunction<{eventKey: string}, object|{error: string}>('addNetworkRequestWidget', {
|
|
1273
|
+
description:
|
|
1274
|
+
'Adds a network request widget to the response. When mentioning a network request, call this function with its trace event key.',
|
|
1275
|
+
parameters: {
|
|
1276
|
+
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
1277
|
+
description: '',
|
|
1278
|
+
nullable: false,
|
|
1279
|
+
properties: {
|
|
1280
|
+
eventKey: {
|
|
1281
|
+
type: Host.AidaClient.ParametersTypes.STRING,
|
|
1282
|
+
description: 'The trace event key for the network request.',
|
|
1283
|
+
nullable: false,
|
|
1284
|
+
},
|
|
1285
|
+
},
|
|
1286
|
+
},
|
|
1287
|
+
handler: async _params => {
|
|
1288
|
+
const rawTraceEvent =
|
|
1289
|
+
Trace.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents().at(
|
|
1290
|
+
Number(_params.eventKey));
|
|
1291
|
+
// Get the trace event object if it is available.
|
|
1292
|
+
// If the trace is uploaded, we need to use the synthetic event.
|
|
1293
|
+
if (rawTraceEvent && Trace.Types.Events.isSyntheticNetworkRequest(rawTraceEvent)) {
|
|
1294
|
+
const rawTraceEventId = rawTraceEvent?.args?.data?.requestId;
|
|
1295
|
+
const rawTraceEventUrl = rawTraceEvent?.args?.data?.url;
|
|
1296
|
+
const networkRequest = rawTraceEvent ? Logs.NetworkLog.NetworkLog.instance()
|
|
1297
|
+
.requestsForId(rawTraceEventId)
|
|
1298
|
+
.find(r => r.url() === rawTraceEventUrl) :
|
|
1299
|
+
null;
|
|
1300
|
+
if (networkRequest) {
|
|
1301
|
+
ArtifactsManager.instance().addArtifact({type: 'network-request', request: networkRequest});
|
|
1302
|
+
return {result: {success: true}};
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
const syntheticRequest =
|
|
1307
|
+
Trace.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().syntheticEventForRawEventIndex(
|
|
1308
|
+
Number(_params.eventKey));
|
|
1309
|
+
|
|
1310
|
+
if (syntheticRequest && Trace.Types.Events.isSyntheticNetworkRequest(syntheticRequest)) {
|
|
1311
|
+
ArtifactsManager.instance().addArtifact({
|
|
1312
|
+
type: 'network-request',
|
|
1313
|
+
request: syntheticRequest,
|
|
1314
|
+
});
|
|
1315
|
+
return {result: {success: true}};
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
return {result: {error: 'Could not find network request'}};
|
|
1319
|
+
},
|
|
1320
|
+
});
|
|
1321
|
+
|
|
1322
|
+
this.declareFunction<{start: number, end: number}, object|{error: string}>('addFlameChartWidget', {
|
|
1323
|
+
description: 'Adds a flame chart widget to the response.',
|
|
1324
|
+
parameters: {
|
|
1325
|
+
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
1326
|
+
description: '',
|
|
1327
|
+
nullable: false,
|
|
1328
|
+
properties: {
|
|
1329
|
+
start: {
|
|
1330
|
+
type: Host.AidaClient.ParametersTypes.INTEGER,
|
|
1331
|
+
description: 'The start time of the flame chart in microseconds.',
|
|
1332
|
+
nullable: false,
|
|
1333
|
+
},
|
|
1334
|
+
end: {
|
|
1335
|
+
type: Host.AidaClient.ParametersTypes.INTEGER,
|
|
1336
|
+
description: 'The end time of the flame chart in microseconds.',
|
|
1337
|
+
nullable: false,
|
|
1338
|
+
},
|
|
1339
|
+
},
|
|
1340
|
+
},
|
|
1341
|
+
handler: async _params => {
|
|
1342
|
+
ArtifactsManager.instance().addArtifact({
|
|
1343
|
+
type: 'flamechart',
|
|
1344
|
+
start: Trace.Types.Timing.Micro(_params.start),
|
|
1345
|
+
end: Trace.Types.Timing.Micro(_params.end),
|
|
1346
|
+
});
|
|
1347
|
+
return {result: {success: true}};
|
|
1348
|
+
},
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1203
1351
|
}
|
|
1204
1352
|
|
|
1205
1353
|
async addElementAnnotation(elementId: string, annotationMessage: string):
|
|
@@ -275,7 +275,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
|
|
|
275
275
|
this.#changes = opts.changeManager || new ChangeManager();
|
|
276
276
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
277
277
|
this.#createExtensionScope = opts.createExtensionScope ?? ((changes: ChangeManager) => {
|
|
278
|
-
return new ExtensionScope(changes, this.
|
|
278
|
+
return new ExtensionScope(changes, this.sessionId, this.context?.getItem() ?? null);
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
this.declareFunction<{
|
|
@@ -13,6 +13,7 @@ import * as StylingAgent from './agents/StylingAgent.js';
|
|
|
13
13
|
import * as AiConversation from './AiConversation.js';
|
|
14
14
|
import * as AiHistoryStorage from './AiHistoryStorage.js';
|
|
15
15
|
import * as AiUtils from './AiUtils.js';
|
|
16
|
+
import * as ArtifactsManager from './ArtifactsManager.js';
|
|
16
17
|
import * as BuiltInAi from './BuiltInAi.js';
|
|
17
18
|
import * as ChangeManager from './ChangeManager.js';
|
|
18
19
|
import * as ConversationHandler from './ConversationHandler.js';
|
|
@@ -38,6 +39,7 @@ export {
|
|
|
38
39
|
AiHistoryStorage,
|
|
39
40
|
AIQueries,
|
|
40
41
|
AiUtils,
|
|
42
|
+
ArtifactsManager,
|
|
41
43
|
BuiltInAi,
|
|
42
44
|
ChangeManager,
|
|
43
45
|
ConversationHandler,
|
|
@@ -262,8 +262,6 @@ export class PerformanceInsightFormatter {
|
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
rootCauses.unsizedImages.forEach(img => {
|
|
265
|
-
// TODO(b/413284569): if we store a nice human readable name for this
|
|
266
|
-
// image in the trace metadata, we can do something much nicer here.
|
|
267
265
|
const url = img.paintImageEvent.args.data.url;
|
|
268
266
|
const nodeName = img.paintImageEvent.args.data.nodeName;
|
|
269
267
|
const extraText = url ? `url: ${this.#formatUrl(url)}` : `id: ${img.backendNodeId}`;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import type * as SDK from '../../core/sdk/sdk.js';
|
|
7
|
+
import * as GreenDev from '../greendev/greendev.js';
|
|
8
8
|
|
|
9
9
|
import {AnnotationType} from './AnnotationType.js';
|
|
10
10
|
|
|
@@ -63,7 +63,7 @@ export class AnnotationRepository {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
static annotationsEnabled(): boolean {
|
|
66
|
-
const enabled =
|
|
66
|
+
const enabled = GreenDev.Prototypes.instance().isEnabled('aiAnnotations');
|
|
67
67
|
// TODO(finnur): Fix race when Repository is created before feature flags have been set properly.
|
|
68
68
|
if (!enabled) {
|
|
69
69
|
this.#hasRepliedGreenDevDisabled = true;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import * as Root from '../../core/root/root.js';
|
|
7
|
+
|
|
8
|
+
let instance: Prototypes|null = null;
|
|
9
|
+
|
|
10
|
+
export interface GreenDevSettings {
|
|
11
|
+
inDevToolsFloaty: Common.Settings.Setting<boolean>;
|
|
12
|
+
inlineWidgets: Common.Settings.Setting<boolean>;
|
|
13
|
+
artifactViewer: Common.Settings.Setting<boolean>;
|
|
14
|
+
aiAnnotations: Common.Settings.Setting<boolean>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class Prototypes {
|
|
18
|
+
private constructor() {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static instance(): Prototypes {
|
|
22
|
+
if (instance) {
|
|
23
|
+
return instance;
|
|
24
|
+
}
|
|
25
|
+
instance = new Prototypes();
|
|
26
|
+
return instance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns true if the specific setting is turned on AND the GreenDev flag is enabled
|
|
31
|
+
*/
|
|
32
|
+
isEnabled(setting: keyof GreenDevSettings): boolean {
|
|
33
|
+
const greendevFlagEnabled = Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
|
|
34
|
+
|
|
35
|
+
return greendevFlagEnabled && this.settings()[setting].get();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
settings(): Readonly<GreenDevSettings> {
|
|
39
|
+
const settings = Common.Settings.Settings.instance();
|
|
40
|
+
const inDevToolsFloaty =
|
|
41
|
+
settings.createSetting('greendev-in-devtools-floaty-enabled', false, Common.Settings.SettingStorageType.LOCAL);
|
|
42
|
+
|
|
43
|
+
const inlineWidgets =
|
|
44
|
+
settings.createSetting('greendev-inline-widgets-enabled', false, Common.Settings.SettingStorageType.LOCAL);
|
|
45
|
+
|
|
46
|
+
const aiAnnotations = settings.createSetting(
|
|
47
|
+
'greendev-ai-annotations-enabled',
|
|
48
|
+
false,
|
|
49
|
+
Common.Settings.SettingStorageType.LOCAL,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const artifactViewer =
|
|
53
|
+
settings.createSetting('greendev-artifact-viewer-enabled', false, Common.Settings.SettingStorageType.LOCAL);
|
|
54
|
+
return {inDevToolsFloaty, inlineWidgets, aiAnnotations, artifactViewer};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# GreenDev Model
|
|
2
|
+
|
|
3
|
+
As part of GreenDev we are building a bunch of prototypes into DevTools to user test. This model holds which prototypes are enabled for a given user.
|
|
4
|
+
|
|
5
|
+
The settings is only stored in local storage, and not synced across devices or persisted in anyway beyond that.
|
|
@@ -493,8 +493,10 @@ export class BottomUpRootNode extends Node {
|
|
|
493
493
|
node.totalTime += totalTimeById.get(id) || 0;
|
|
494
494
|
totalTimeById.delete(id);
|
|
495
495
|
}
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
|
|
497
|
+
// An item on this stack means that this current node has a caller. Therefore,
|
|
498
|
+
// in a bottom-up view it has children.
|
|
499
|
+
if (idStack.length > 0) {
|
|
498
500
|
node.setHasChildren(true);
|
|
499
501
|
}
|
|
500
502
|
}
|
|
@@ -129,8 +129,6 @@ export function generateInsight(
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const initiatorUrl = lcpRequest.args.data.initiator?.url;
|
|
132
|
-
// TODO(b/372319476): Explore using trace event HTMLDocumentParser::FetchQueuedPreloads to determine if the request
|
|
133
|
-
// is discovered by the preload scanner.
|
|
134
132
|
const initiatedByMainDoc =
|
|
135
133
|
lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
|
|
136
134
|
const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
|
|
@@ -1078,7 +1078,6 @@ export interface ResourceSendRequest extends Instant {
|
|
|
1078
1078
|
resourceType?: Protocol.Network.ResourceType,
|
|
1079
1079
|
/** Added Feb 2024. https://crrev.com/c/5297615 */
|
|
1080
1080
|
fetchPriorityHint?: FetchPriorityHint,
|
|
1081
|
-
// TODO(crbug.com/1457985): change requestMethod to enum when confirm in the backend code.
|
|
1082
1081
|
requestMethod?: string,
|
|
1083
1082
|
renderBlocking?: RenderBlocking,
|
|
1084
1083
|
initiator?: Initiator,
|