chrome-devtools-frontend 1.0.1732418 → 1.0.1733843
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/docs/get_the_code.md +1 -73
- package/front_end/Tests.js +0 -5
- package/front_end/core/host/AidaClientTypes.ts +24 -3
- package/front_end/core/host/AidaGcaTranslation.ts +29 -1
- package/front_end/core/platform/browser/HostRuntime.ts +5 -1
- package/front_end/core/sdk/DOMModel.ts +8 -3
- package/front_end/design_system_tokens.css +5 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
- package/front_end/generated/InspectorBackendCommands.ts +5 -5
- package/front_end/generated/SupportedCSSProperties.ts +8 -2
- package/front_end/generated/protocol.ts +29 -7
- package/front_end/models/ai-utils/debug.ts +127 -22
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/README.md +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +69 -11
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
- package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +4 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +6 -0
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
- package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
- package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
- package/front_end/models/trace/LanternComputationData.ts +4 -0
- package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
- package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
- package/front_end/models/web_mcp/WebMCPModel.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +65 -15
- package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +4 -5
- package/front_end/panels/ai_assistance/components/exploreWidget.css +3 -3
- package/front_end/panels/application/backgroundServiceView.css +2 -2
- package/front_end/panels/application/components/reportsGrid.css +1 -1
- package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
- package/front_end/panels/application/components/trustTokensView.css +1 -1
- package/front_end/panels/application/deviceBoundSessionsView.css +1 -1
- package/front_end/panels/application/frameDetailsReportView.css +0 -4
- package/front_end/panels/application/indexedDBViews.css +0 -4
- package/front_end/panels/application/resourcesPanel.css +0 -13
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +3 -3
- package/front_end/panels/application/serviceWorkersView.css +3 -2
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +346 -286
- package/front_end/panels/comments/CommentsPane.ts +2 -11
- package/front_end/panels/common/CommentThreadWidget.ts +11 -3
- package/front_end/panels/common/CommentsOverlayWidget.ts +3 -2
- package/front_end/panels/console/consoleContextSelector.css +1 -1
- package/front_end/panels/console/consolePinPane.css +1 -1
- package/front_end/panels/console/consolePrompt.css +4 -2
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
- package/front_end/panels/elements/PropertyRenderer.ts +7 -27
- package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
- package/front_end/panels/elements/components/cssPropertyDocsView.css +1 -1
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +1 -5
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +2 -2
- package/front_end/panels/elements/propertiesWidget.css +0 -5
- package/front_end/panels/elements/stylesSidebarPane.css +3 -2
- package/front_end/panels/emulation/deviceModeView.css +3 -3
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +2 -2
- package/front_end/panels/issues/issuesTree.css +10 -7
- package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
- package/front_end/panels/lighthouse/LighthousePanel.ts +16 -1
- package/front_end/panels/lighthouse/lighthousePanel.css +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +10 -6
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +1 -26
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
- package/front_end/panels/media/playerListView.css +11 -8
- package/front_end/panels/media/playerMessagesView.css +9 -5
- package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
- package/front_end/panels/network/networkConfigView.css +3 -3
- package/front_end/panels/network/networkLogView.css +5 -4
- package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
- package/front_end/panels/network/networkTimingTable.css +4 -8
- package/front_end/panels/network/requestPayloadView.css +1 -1
- package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
- package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +114 -18
- package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
- package/front_end/panels/recorder/createRecordingView.css +2 -2
- package/front_end/panels/recorder/stepEditor.css +1 -1
- package/front_end/panels/recorder/stepView.css +0 -7
- package/front_end/panels/recorder/timelineSection.css +1 -1
- package/front_end/panels/screencast/screencastView.css +1 -1
- package/front_end/panels/search/searchResultsPane.css +1 -1
- package/front_end/panels/security/mainView.css +2 -2
- package/front_end/panels/security/originView.css +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +1 -0
- package/front_end/panels/sources/NavigatorView.ts +120 -49
- package/front_end/panels/sources/breakpointsView.css +3 -3
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -1
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
- package/front_end/panels/timeline/TimelinePanel.ts +24 -3
- package/front_end/panels/timeline/components/metricCard.css +1 -1
- package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
- package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
- package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
- package/front_end/panels/timeline/timelineMiniMap.css +3 -2
- package/front_end/panels/web_audio/WebAudioModel.ts +14 -5
- package/front_end/panels/web_audio/WebAudioView.ts +34 -1
- package/front_end/panels/web_audio/webAudio.css +17 -3
- package/front_end/panels/webauthn/webauthnPane.css +2 -4
- package/front_end/panels/whats_new/ReleaseNoteText.ts +19 -1
- package/front_end/panels/whats_new/ReleaseNoteView.ts +15 -1
- package/front_end/panels/whats_new/releaseNoteView.css +49 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer-replay/README.chromium +9 -1
- package/front_end/third_party/puppeteer-replay/package/lib/main.d.ts +2 -2
- package/front_end/ui/components/buttons/button.css +0 -1
- package/front_end/ui/components/diff_view/diffView.css +1 -1
- package/front_end/ui/components/markdown_view/codeBlock.css +4 -4
- package/front_end/ui/components/markdown_view/markdownView.css +3 -7
- package/front_end/ui/components/panel_feedback/panelFeedback.css +3 -2
- package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
- package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
- package/front_end/ui/components/switch/switch.css +2 -1
- package/front_end/ui/legacy/TabbedPane.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +10 -3
- package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/flameChart.css +5 -3
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +7 -4
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +0 -1
- package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +11 -27
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/progressIndicator.css +1 -2
- package/front_end/ui/legacy/reportView.css +5 -2
- package/front_end/ui/legacy/searchableView.css +3 -2
- package/front_end/ui/legacy/suggestBox.css +2 -1
- package/front_end/ui/legacy/tabbedPane.css +8 -5
- package/front_end/ui/legacy/treeoutline.css +1 -1
- package/front_end/ui/legacy/viewContainers.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +11 -0
- package/package.json +1 -1
- package/front_end/models/ai_code_completion/debug.ts +0 -33
- package/front_end/models/ai_code_generation/debug.ts +0 -33
|
@@ -16,6 +16,19 @@ import {
|
|
|
16
16
|
type MetricResult,
|
|
17
17
|
} from './Metric.js';
|
|
18
18
|
|
|
19
|
+
function stripUrlHash(urlStr: string): string {
|
|
20
|
+
if (!urlStr.includes('#')) {
|
|
21
|
+
return urlStr;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(urlStr);
|
|
25
|
+
url.hash = '';
|
|
26
|
+
return url.href;
|
|
27
|
+
} catch {
|
|
28
|
+
return urlStr;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
class LargestContentfulPaint extends Metric {
|
|
20
33
|
static override get coefficients(): MetricCoefficients {
|
|
21
34
|
return {
|
|
@@ -38,6 +51,80 @@ class LargestContentfulPaint extends Metric {
|
|
|
38
51
|
return !isImage || !isLowPriority;
|
|
39
52
|
}
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Finds the NetworkNode corresponding to the LCP image in the dependency graph, if LCP was an image.
|
|
56
|
+
*/
|
|
57
|
+
static findLcpNode(dependencyGraph: Graph.Node,
|
|
58
|
+
processedNavigation: Types.Simulation.ProcessedNavigation): Graph.NetworkNode|null {
|
|
59
|
+
const lcp = processedNavigation.timestamps.largestContentfulPaint;
|
|
60
|
+
if (!lcp) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const lcpEvent = processedNavigation.largestContentfulPaintEvt;
|
|
65
|
+
if (lcpEvent?.args?.data?.type && lcpEvent.args.data.type !== 'image') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const {lcpRequestId, lcpImageUrl} = processedNavigation;
|
|
70
|
+
if (!lcpRequestId && !lcpImageUrl) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (lcpRequestId) {
|
|
75
|
+
const idMatches: Graph.NetworkNode[] = [];
|
|
76
|
+
dependencyGraph.traverse(node => {
|
|
77
|
+
if (node.type !== 'network' || node.request.redirectDestination) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (node.request.finished === false || node.endTime < 0 || node.startTime > lcp) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const baseRequestId = node.request.requestId.replace(/(:redirect|:duplicate)+$/, '');
|
|
84
|
+
if (baseRequestId === lcpRequestId) {
|
|
85
|
+
idMatches.push(node);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (idMatches.length) {
|
|
89
|
+
idMatches.sort((a, b) => a.endTime - b.endTime);
|
|
90
|
+
return idMatches[0];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!lcpImageUrl) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const normalizedLcpUrl = stripUrlHash(lcpImageUrl);
|
|
99
|
+
const lcpFrameId = lcpEvent?.args?.frame;
|
|
100
|
+
const urlMatches: Graph.NetworkNode[] = [];
|
|
101
|
+
dependencyGraph.traverse(node => {
|
|
102
|
+
if (node.type !== 'network' || node.request.redirectDestination) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (node.request.finished === false || node.endTime < 0 || node.startTime > lcp) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (lcpFrameId && node.request.frameId && node.request.frameId !== lcpFrameId) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (node.request.resourceType && node.request.resourceType !== 'Image' && node.request.resourceType !== 'Media') {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const matchesUrl = node.request.url === lcpImageUrl || stripUrlHash(node.request.url) === normalizedLcpUrl ||
|
|
115
|
+
Boolean(node.request.redirects?.some(r => r.url === lcpImageUrl || stripUrlHash(r.url) === normalizedLcpUrl));
|
|
116
|
+
if (matchesUrl) {
|
|
117
|
+
urlMatches.push(node);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (!urlMatches.length) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
urlMatches.sort((a, b) => a.endTime - b.endTime);
|
|
125
|
+
return urlMatches[0];
|
|
126
|
+
}
|
|
127
|
+
|
|
41
128
|
static override getOptimisticGraph(
|
|
42
129
|
dependencyGraph: Graph.Node, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node {
|
|
43
130
|
const {firstContentfulPaint: fcp, largestContentfulPaint: lcp} = processedNavigation.timestamps;
|
|
@@ -48,6 +135,40 @@ class LargestContentfulPaint extends Metric {
|
|
|
48
135
|
return FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);
|
|
49
136
|
}
|
|
50
137
|
|
|
138
|
+
const lcpNode = LargestContentfulPaint.findLcpNode(dependencyGraph, processedNavigation);
|
|
139
|
+
if (lcpNode) {
|
|
140
|
+
const fcpOptimisticGraph = FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);
|
|
141
|
+
const criticalNodeIds = new Set<string>();
|
|
142
|
+
fcpOptimisticGraph.traverse(node => criticalNodeIds.add(node.id));
|
|
143
|
+
criticalNodeIds.add(lcpNode.id);
|
|
144
|
+
|
|
145
|
+
// PageDependencyGraph.linkCPUNodes does not add CPUNode -> Image edges, so if the LCP image
|
|
146
|
+
// has any Script dependencies (e.g. JS-injected hero image or JS-injected stylesheet),
|
|
147
|
+
// include the CPU tasks that evaluated those scripts prior to the LCP request.
|
|
148
|
+
const initiatorScriptUrls = new Set<string>();
|
|
149
|
+
lcpNode.traverse(node => {
|
|
150
|
+
if (node.type === 'network' && node.request.resourceType === 'Script') {
|
|
151
|
+
initiatorScriptUrls.add(node.request.url);
|
|
152
|
+
}
|
|
153
|
+
}, node => node.getDependencies());
|
|
154
|
+
|
|
155
|
+
if (initiatorScriptUrls.size) {
|
|
156
|
+
dependencyGraph.traverse(node => {
|
|
157
|
+
if (node.type !== 'cpu' || node.startTime > lcpNode.startTime) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
for (const url of node.getEvaluateScriptURLs()) {
|
|
161
|
+
if (initiatorScriptUrls.has(url)) {
|
|
162
|
+
criticalNodeIds.add(node.id);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return dependencyGraph.cloneWithRelationships(node => criticalNodeIds.has(node.id));
|
|
170
|
+
}
|
|
171
|
+
|
|
51
172
|
return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
|
|
52
173
|
cutoffTimestamp: lcp,
|
|
53
174
|
treatNodeAsRenderBlocking: LargestContentfulPaint.isNotLowPriorityImageNode,
|
|
@@ -72,7 +193,11 @@ class LargestContentfulPaint extends Metric {
|
|
|
72
193
|
});
|
|
73
194
|
}
|
|
74
195
|
|
|
75
|
-
static override getEstimateFromSimulation(simulationResult: Simulation.Result): Simulation.Result {
|
|
196
|
+
static override getEstimateFromSimulation(simulationResult: Simulation.Result, extras?: Extras): Simulation.Result {
|
|
197
|
+
if (extras?.optimistic) {
|
|
198
|
+
return simulationResult;
|
|
199
|
+
}
|
|
200
|
+
|
|
76
201
|
const nodeTimesNotOffscreenImages = Array.from(simulationResult.nodeTimings.entries())
|
|
77
202
|
.filter(entry => LargestContentfulPaint.isNotLowPriorityImageNode(entry[0]))
|
|
78
203
|
.map(entry => entry[1].endTime);
|
|
@@ -223,11 +223,14 @@ export namespace Simulation {
|
|
|
223
223
|
};
|
|
224
224
|
largestContentfulPaintEvt?: {
|
|
225
225
|
args: {
|
|
226
|
+
frame?: string,
|
|
226
227
|
data?: {
|
|
227
228
|
type?: string,
|
|
228
229
|
},
|
|
229
230
|
},
|
|
230
231
|
};
|
|
232
|
+
lcpRequestId?: string;
|
|
233
|
+
lcpImageUrl?: string;
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
export interface NodeTiming {
|
|
@@ -228,7 +228,7 @@ export class WebMCPModel extends SDK.SDKModel.SDKModel<EventTypes> implements Pr
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
toolInvoked(params: Protocol.WebMCP.ToolInvokedEvent): void {
|
|
231
|
-
const tool = this.#tools.get(params.frameId)?.get(params.toolName);
|
|
231
|
+
const tool = params.toolName ? this.#tools.get(params.frameId)?.get(params.toolName) : undefined;
|
|
232
232
|
if (!tool) {
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
@@ -916,14 +916,20 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
916
916
|
}
|
|
917
917
|
|
|
918
918
|
async #handlePerformanceRecordAndReload(): Promise<Trace.TraceModel.ParsedTrace> {
|
|
919
|
-
return await TimelinePanel.TimelinePanel.TimelinePanel.executeRecordAndReload(
|
|
919
|
+
return await TimelinePanel.TimelinePanel.TimelinePanel.executeRecordAndReload({
|
|
920
|
+
signal: this.#runAbortController.signal,
|
|
921
|
+
});
|
|
920
922
|
}
|
|
921
923
|
|
|
922
924
|
async #handleLighthouseRun(overrides?: LHModel.RunTypes.RunOverrides): Promise<LHModel.RunTypes.RunResult> {
|
|
923
|
-
return await LighthousePanel.LighthousePanel.LighthousePanel.executeLighthouseRecording(
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
925
|
+
return await LighthousePanel.LighthousePanel.LighthousePanel.executeLighthouseRecording(
|
|
926
|
+
{
|
|
927
|
+
isAIControlled: true,
|
|
928
|
+
...overrides,
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
signal: this.#runAbortController.signal,
|
|
932
|
+
});
|
|
927
933
|
}
|
|
928
934
|
|
|
929
935
|
#getDefaultConversationType(): AiAssistanceModel.AiHistoryStorage.ConversationType|undefined {
|
|
@@ -1117,6 +1123,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1117
1123
|
TimelinePanel.TimelinePanel.TimelinePanel, this.#bindTimelineTraceListener, this);
|
|
1118
1124
|
this.#bindTimelineTraceListener();
|
|
1119
1125
|
this.#selectDefaultAgentIfNeeded();
|
|
1126
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled()) {
|
|
1127
|
+
void VisualLogging.logFunctionCall('ai-allowed-tools-count', String(this.#alwaysAllowedTools.list().length));
|
|
1128
|
+
}
|
|
1120
1129
|
|
|
1121
1130
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.AiAssistancePanelOpened);
|
|
1122
1131
|
}
|
|
@@ -1853,6 +1862,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1853
1862
|
let announcedAnswerLoading = false;
|
|
1854
1863
|
let announcedAnswerReady = false;
|
|
1855
1864
|
for await (const data of items) {
|
|
1865
|
+
const toolNameForLogging = 'toolName' in data && data.toolName !== undefined ?
|
|
1866
|
+
Platform.StringUtilities.toKebabCase(data.toolName) :
|
|
1867
|
+
undefined;
|
|
1856
1868
|
switch (data.type) {
|
|
1857
1869
|
case AiAssistanceModel.AiAgent.ResponseType.USER_QUERY: {
|
|
1858
1870
|
this.#messages.push({
|
|
@@ -1886,6 +1898,19 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1886
1898
|
break;
|
|
1887
1899
|
}
|
|
1888
1900
|
case AiAssistanceModel.AiAgent.ResponseType.CONTEXT: {
|
|
1901
|
+
// Supersede stale context widgets of the same type (such as an older Lighthouse report)
|
|
1902
|
+
// within the current turn. Filter by widget name rather than clearing all widgets so
|
|
1903
|
+
// cross-domain context changes (such as starting on a performance trace and running
|
|
1904
|
+
// Lighthouse) preserve the earlier context's widgets.
|
|
1905
|
+
if (data.widgets?.length) {
|
|
1906
|
+
const newWidgetNames = new Set(data.widgets.map(widget => widget.name));
|
|
1907
|
+
for (const part of systemMessage.parts) {
|
|
1908
|
+
if (part.type === 'step' && part.step.contextDetails && part.step.widgets) {
|
|
1909
|
+
const remainingWidgets = part.step.widgets.filter(widget => !newWidgetNames.has(widget.name));
|
|
1910
|
+
part.step.widgets = remainingWidgets.length > 0 ? remainingWidgets : undefined;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1889
1914
|
step.title = lockedString(UIStringsNotTranslate.analyzingData);
|
|
1890
1915
|
step.contextDetails = data.details;
|
|
1891
1916
|
step.widgets = data.widgets;
|
|
@@ -1935,6 +1960,20 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1935
1960
|
performance.now() - promptShownAt < PERMISSION_PROMPT_INPUT_PROTECTION_MS) {
|
|
1936
1961
|
return;
|
|
1937
1962
|
}
|
|
1963
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() &&
|
|
1964
|
+
!this.#conversation?.isReadOnly) {
|
|
1965
|
+
switch (decision) {
|
|
1966
|
+
case AiAssistanceModel.Tool.PermissionDecision.REJECT:
|
|
1967
|
+
void VisualLogging.logFunctionCall('ai-permission-rejected', toolNameForLogging);
|
|
1968
|
+
break;
|
|
1969
|
+
case AiAssistanceModel.Tool.PermissionDecision.ALLOW_ONCE:
|
|
1970
|
+
void VisualLogging.logFunctionCall('ai-permission-allowed-once', toolNameForLogging);
|
|
1971
|
+
break;
|
|
1972
|
+
case AiAssistanceModel.Tool.PermissionDecision.ALLOW_ALWAYS:
|
|
1973
|
+
void VisualLogging.logFunctionCall('ai-permission-allowed-always', toolNameForLogging);
|
|
1974
|
+
break;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1938
1977
|
data.confirm(decision);
|
|
1939
1978
|
approvalStep.state = {type: 'completed'};
|
|
1940
1979
|
this.requestUpdate();
|
|
@@ -1942,6 +1981,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1942
1981
|
},
|
|
1943
1982
|
};
|
|
1944
1983
|
commitStep();
|
|
1984
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() && !this.#conversation?.isReadOnly) {
|
|
1985
|
+
void VisualLogging.logFunctionCall('ai-permission-prompt-shown', toolNameForLogging);
|
|
1986
|
+
}
|
|
1945
1987
|
break;
|
|
1946
1988
|
}
|
|
1947
1989
|
case AiAssistanceModel.AiAgent.ResponseType.ACTION: {
|
|
@@ -1951,14 +1993,18 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1951
1993
|
step.output ??= data.output;
|
|
1952
1994
|
step.widgets ??= data.widgets;
|
|
1953
1995
|
commitStep();
|
|
1954
|
-
if (
|
|
1955
|
-
if (
|
|
1956
|
-
|
|
1957
|
-
|
|
1996
|
+
if (!this.#conversation?.isReadOnly) {
|
|
1997
|
+
if (AiAssistanceModel.AiUtils.isAiV2Enabled()) {
|
|
1998
|
+
if (data.toolName === 'learnSkills') {
|
|
1999
|
+
for (const skill of data.loadedSkills ?? []) {
|
|
2000
|
+
void VisualLogging.logFunctionCall('ai-v2-learn-skill', skill);
|
|
2001
|
+
}
|
|
2002
|
+
} else if (toolNameForLogging) {
|
|
2003
|
+
void VisualLogging.logFunctionCall('ai-v2-tool-call', toolNameForLogging);
|
|
1958
2004
|
}
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
|
|
2005
|
+
}
|
|
2006
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() && data.autoApproved) {
|
|
2007
|
+
void VisualLogging.logFunctionCall('ai-permission-auto-allowed', toolNameForLogging);
|
|
1962
2008
|
}
|
|
1963
2009
|
}
|
|
1964
2010
|
break;
|
|
@@ -2030,9 +2076,13 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
2030
2076
|
}
|
|
2031
2077
|
|
|
2032
2078
|
case AiAssistanceModel.AiAgent.ResponseType.CONTEXT_CHANGE: {
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2035
|
-
|
|
2079
|
+
if (!this.#conversation?.isReadOnly) {
|
|
2080
|
+
if (AiAssistanceModel.AiUtils.isAiV2Enabled() && toolNameForLogging) {
|
|
2081
|
+
void VisualLogging.logFunctionCall('ai-v2-tool-call', toolNameForLogging);
|
|
2082
|
+
}
|
|
2083
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() && data.autoApproved) {
|
|
2084
|
+
void VisualLogging.logFunctionCall('ai-permission-auto-allowed', toolNameForLogging);
|
|
2085
|
+
}
|
|
2036
2086
|
}
|
|
2037
2087
|
this.#handleConversationContextChange(data.context);
|
|
2038
2088
|
step.state = {type: 'completed'};
|
|
@@ -55,7 +55,7 @@ export function getMatchingFlavorContext(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export async function handleExternalAIRequest(options: ExternalAIRequestOptions): Promise<unknown[]> {
|
|
58
|
-
|
|
58
|
+
AiAssistanceModel.Debug.setDevToolsAIDebug({assistance: true});
|
|
59
59
|
localStorage.removeItem('aiAssistanceStructuredLog');
|
|
60
60
|
|
|
61
61
|
const conversationType = resolveConversationType(options.context?.type);
|
|
@@ -119,7 +119,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
119
119
|
html`<devtools-button
|
|
120
120
|
.data=${{
|
|
121
121
|
variant: Buttons.Button.Variant.OUTLINED,
|
|
122
|
-
jslogContext: '
|
|
122
|
+
jslogContext: 'ai-permission-allow-always',
|
|
123
123
|
} as Buttons.Button.ButtonData}
|
|
124
124
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.ALLOW_ALWAYS)}
|
|
125
125
|
>${lockedString(UIStringsNotTranslate.allowAlways)}</devtools-button>` :
|
|
@@ -131,7 +131,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
131
131
|
// clang-format off
|
|
132
132
|
return html`${repeat([step], step => step, () => html`
|
|
133
133
|
<div class="permission-prompt"
|
|
134
|
-
jslog=${VisualLogging.section('
|
|
134
|
+
jslog=${VisualLogging.section('ai-permission-prompt')}>
|
|
135
135
|
<div class="permission-prompt-header">
|
|
136
136
|
<devtools-icon name="lock"></devtools-icon>
|
|
137
137
|
<h2 class="permission-prompt-title">${title}</h2>
|
|
@@ -142,7 +142,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
142
142
|
<devtools-button
|
|
143
143
|
.data=${{
|
|
144
144
|
variant: Buttons.Button.Variant.TEXT,
|
|
145
|
-
jslogContext: '
|
|
145
|
+
jslogContext: 'ai-permission-reject',
|
|
146
146
|
} as Buttons.Button.ButtonData}
|
|
147
147
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.REJECT)}
|
|
148
148
|
${ref(focusOnFirstRender)}
|
|
@@ -151,7 +151,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
151
151
|
<devtools-button
|
|
152
152
|
.data=${{
|
|
153
153
|
variant: Buttons.Button.Variant.PRIMARY,
|
|
154
|
-
jslogContext: '
|
|
154
|
+
jslogContext: 'ai-permission-allow-once',
|
|
155
155
|
} as Buttons.Button.ButtonData}
|
|
156
156
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.ALLOW_ONCE)}
|
|
157
157
|
>${lockedString(UIStringsNotTranslate.allowThisTime)}</devtools-button>
|
|
@@ -164,10 +164,9 @@
|
|
|
164
164
|
|
|
165
165
|
.answer-body-wrapper {
|
|
166
166
|
@container(min-width: 700px) {
|
|
167
|
-
/*
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
padding-left: 35px;
|
|
167
|
+
/* Indent the content to align with the walkthrough CTA
|
|
168
|
+
* (icon width + flex gap + button horizontal padding). */
|
|
169
|
+
padding-left: calc(var(--sys-size-9) + var(--sys-size-2) + var(--sys-size-6));
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
|
|
@@ -420,7 +419,7 @@
|
|
|
420
419
|
|
|
421
420
|
.styling-preview-widget {
|
|
422
421
|
width: 100%;
|
|
423
|
-
min-height:
|
|
422
|
+
min-height: var(--sys-size-19);
|
|
424
423
|
}
|
|
425
424
|
|
|
426
425
|
.main-widgets-wrapper {
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
border-radius: var(--sys-shape-corner-full);
|
|
98
98
|
|
|
99
99
|
devtools-icon {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
100
|
+
width: var(--sys-size-9);
|
|
101
|
+
height: var(--sys-size-9);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
p {
|
|
111
111
|
font: var(--sys-typescale-body4-regular);
|
|
112
|
-
line-height:
|
|
112
|
+
line-height: var(--sys-typescale-body4-line-height);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
white-space: normal;
|
|
9
|
-
max-width:
|
|
9
|
+
max-width: var(--sys-size-32);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.router-rules {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
.item {
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
|
-
padding-left:
|
|
36
|
+
padding-left: var(--sys-size-5);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.condition,
|
|
@@ -79,15 +79,6 @@
|
|
|
79
79
|
white-space: pre-wrap;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.prompt-icon {
|
|
83
|
-
position: absolute;
|
|
84
|
-
display: block;
|
|
85
|
-
left: 7px;
|
|
86
|
-
top: 9px;
|
|
87
|
-
margin-top: -7px;
|
|
88
|
-
user-select: none;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
82
|
.database-query-prompt-container .prompt-icon {
|
|
92
83
|
top: var(--sys-size-4);
|
|
93
84
|
}
|
|
@@ -122,10 +113,6 @@
|
|
|
122
113
|
user-select: text;
|
|
123
114
|
}
|
|
124
115
|
|
|
125
|
-
.database-query-result.error .prompt-icon {
|
|
126
|
-
margin-top: -9px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
116
|
.resources-sidebar {
|
|
130
117
|
padding: 0;
|
|
131
118
|
overflow-x: auto;
|
|
@@ -89,14 +89,14 @@
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.service-worker-update-timing-bar.install {
|
|
92
|
-
|
|
93
|
-
height:
|
|
92
|
+
margin-block: auto;
|
|
93
|
+
height: var(--sys-size-5);
|
|
94
94
|
background-color: var(--sys-color-cyan-bright);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.service-worker-update-timing-table > tbody > tr > td {
|
|
98
98
|
padding: var(--sys-size-3) 0;
|
|
99
|
-
padding-right:
|
|
99
|
+
padding-right: var(--sys-size-5);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
table.service-worker-update-timing-table > tbody > tr.service-worker-update-timing-table-header > td {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.service-worker-version:not(:last-child) {
|
|
33
|
-
margin-bottom:
|
|
33
|
+
margin-bottom: var(--sys-size-4);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.service-worker-version-string {
|
|
@@ -187,7 +187,8 @@ devtools-icon.error-icon {
|
|
|
187
187
|
.service-worker-section {
|
|
188
188
|
border-bottom: var(--sys-size-1) solid var(--sys-color-divider);
|
|
189
189
|
grid-column: 1 / 3;
|
|
190
|
-
|
|
190
|
+
/* 12px section bottom spacing (--sys-size-6) minus 1px bottom border (--sys-size-1). */
|
|
191
|
+
padding: 0 var(--sys-size-9) calc(var(--sys-size-6) - var(--sys-size-1)) var(--sys-size-9);
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
.service-worker-section-container {
|