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.
Files changed (146) hide show
  1. package/docs/get_the_code.md +1 -73
  2. package/front_end/Tests.js +0 -5
  3. package/front_end/core/host/AidaClientTypes.ts +24 -3
  4. package/front_end/core/host/AidaGcaTranslation.ts +29 -1
  5. package/front_end/core/platform/browser/HostRuntime.ts +5 -1
  6. package/front_end/core/sdk/DOMModel.ts +8 -3
  7. package/front_end/design_system_tokens.css +5 -0
  8. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
  9. package/front_end/generated/InspectorBackendCommands.ts +5 -5
  10. package/front_end/generated/SupportedCSSProperties.ts +8 -2
  11. package/front_end/generated/protocol.ts +29 -7
  12. package/front_end/models/ai-utils/debug.ts +127 -22
  13. package/front_end/models/ai_assistance/AiConversation.ts +1 -0
  14. package/front_end/models/ai_assistance/README.md +1 -1
  15. package/front_end/models/ai_assistance/agents/AiAgent.ts +69 -11
  16. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
  17. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
  18. package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +4 -2
  19. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +6 -0
  20. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +2 -0
  21. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  22. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
  23. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
  24. package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
  25. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
  26. package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
  27. package/front_end/models/trace/LanternComputationData.ts +4 -0
  28. package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
  29. package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
  30. package/front_end/models/web_mcp/WebMCPModel.ts +1 -1
  31. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +65 -15
  32. package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
  33. package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
  34. package/front_end/panels/ai_assistance/components/chatMessage.css +4 -5
  35. package/front_end/panels/ai_assistance/components/exploreWidget.css +3 -3
  36. package/front_end/panels/application/backgroundServiceView.css +2 -2
  37. package/front_end/panels/application/components/reportsGrid.css +1 -1
  38. package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
  39. package/front_end/panels/application/components/trustTokensView.css +1 -1
  40. package/front_end/panels/application/deviceBoundSessionsView.css +1 -1
  41. package/front_end/panels/application/frameDetailsReportView.css +0 -4
  42. package/front_end/panels/application/indexedDBViews.css +0 -4
  43. package/front_end/panels/application/resourcesPanel.css +0 -13
  44. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +3 -3
  45. package/front_end/panels/application/serviceWorkersView.css +3 -2
  46. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +346 -286
  47. package/front_end/panels/comments/CommentsPane.ts +2 -11
  48. package/front_end/panels/common/CommentThreadWidget.ts +11 -3
  49. package/front_end/panels/common/CommentsOverlayWidget.ts +3 -2
  50. package/front_end/panels/console/consoleContextSelector.css +1 -1
  51. package/front_end/panels/console/consolePinPane.css +1 -1
  52. package/front_end/panels/console/consolePrompt.css +4 -2
  53. package/front_end/panels/console/consoleView.css +1 -1
  54. package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
  55. package/front_end/panels/elements/PropertyRenderer.ts +7 -27
  56. package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
  57. package/front_end/panels/elements/components/cssPropertyDocsView.css +1 -1
  58. package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
  59. package/front_end/panels/elements/components/stylePropertyEditor.css +1 -5
  60. package/front_end/panels/elements/layoutPane.css +1 -1
  61. package/front_end/panels/elements/metricsSidebarPane.css +2 -2
  62. package/front_end/panels/elements/propertiesWidget.css +0 -5
  63. package/front_end/panels/elements/stylesSidebarPane.css +3 -2
  64. package/front_end/panels/emulation/deviceModeView.css +3 -3
  65. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  66. package/front_end/panels/explain/components/consoleInsight.css +2 -2
  67. package/front_end/panels/issues/issuesTree.css +10 -7
  68. package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
  69. package/front_end/panels/lighthouse/LighthousePanel.ts +16 -1
  70. package/front_end/panels/lighthouse/lighthousePanel.css +1 -1
  71. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +10 -6
  72. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +1 -26
  73. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
  74. package/front_end/panels/media/playerListView.css +11 -8
  75. package/front_end/panels/media/playerMessagesView.css +9 -5
  76. package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
  77. package/front_end/panels/network/networkConfigView.css +3 -3
  78. package/front_end/panels/network/networkLogView.css +5 -4
  79. package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
  80. package/front_end/panels/network/networkTimingTable.css +4 -8
  81. package/front_end/panels/network/requestPayloadView.css +1 -1
  82. package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
  83. package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
  84. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +114 -18
  85. package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
  86. package/front_end/panels/recorder/createRecordingView.css +2 -2
  87. package/front_end/panels/recorder/stepEditor.css +1 -1
  88. package/front_end/panels/recorder/stepView.css +0 -7
  89. package/front_end/panels/recorder/timelineSection.css +1 -1
  90. package/front_end/panels/screencast/screencastView.css +1 -1
  91. package/front_end/panels/search/searchResultsPane.css +1 -1
  92. package/front_end/panels/security/mainView.css +2 -2
  93. package/front_end/panels/security/originView.css +1 -1
  94. package/front_end/panels/settings/AISettingsTab.ts +1 -0
  95. package/front_end/panels/sources/NavigatorView.ts +120 -49
  96. package/front_end/panels/sources/breakpointsView.css +3 -3
  97. package/front_end/panels/sources/components/HeadersView.css +2 -2
  98. package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -1
  99. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
  100. package/front_end/panels/timeline/TimelinePanel.ts +24 -3
  101. package/front_end/panels/timeline/components/metricCard.css +1 -1
  102. package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
  103. package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
  104. package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
  105. package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
  106. package/front_end/panels/timeline/timelineMiniMap.css +3 -2
  107. package/front_end/panels/web_audio/WebAudioModel.ts +14 -5
  108. package/front_end/panels/web_audio/WebAudioView.ts +34 -1
  109. package/front_end/panels/web_audio/webAudio.css +17 -3
  110. package/front_end/panels/webauthn/webauthnPane.css +2 -4
  111. package/front_end/panels/whats_new/ReleaseNoteText.ts +19 -1
  112. package/front_end/panels/whats_new/ReleaseNoteView.ts +15 -1
  113. package/front_end/panels/whats_new/releaseNoteView.css +49 -0
  114. package/front_end/third_party/chromium/README.chromium +1 -1
  115. package/front_end/third_party/puppeteer-replay/README.chromium +9 -1
  116. package/front_end/third_party/puppeteer-replay/package/lib/main.d.ts +2 -2
  117. package/front_end/ui/components/buttons/button.css +0 -1
  118. package/front_end/ui/components/diff_view/diffView.css +1 -1
  119. package/front_end/ui/components/markdown_view/codeBlock.css +4 -4
  120. package/front_end/ui/components/markdown_view/markdownView.css +3 -7
  121. package/front_end/ui/components/panel_feedback/panelFeedback.css +3 -2
  122. package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
  123. package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
  124. package/front_end/ui/components/switch/switch.css +2 -1
  125. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  126. package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +10 -3
  127. package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
  128. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
  129. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
  130. package/front_end/ui/legacy/components/perf_ui/flameChart.css +5 -3
  131. package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +7 -4
  132. package/front_end/ui/legacy/components/perf_ui/pieChart.css +0 -1
  133. package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
  134. package/front_end/ui/legacy/inspectorCommon.css +11 -27
  135. package/front_end/ui/legacy/listWidget.css +1 -1
  136. package/front_end/ui/legacy/progressIndicator.css +1 -2
  137. package/front_end/ui/legacy/reportView.css +5 -2
  138. package/front_end/ui/legacy/searchableView.css +3 -2
  139. package/front_end/ui/legacy/suggestBox.css +2 -1
  140. package/front_end/ui/legacy/tabbedPane.css +8 -5
  141. package/front_end/ui/legacy/treeoutline.css +1 -1
  142. package/front_end/ui/legacy/viewContainers.css +1 -1
  143. package/front_end/ui/visual_logging/KnownContextValues.ts +11 -0
  144. package/package.json +1 -1
  145. package/front_end/models/ai_code_completion/debug.ts +0 -33
  146. 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
- isAIControlled: true,
925
- ...overrides,
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 (AiAssistanceModel.AiUtils.isAiV2Enabled() && !this.#conversation?.isReadOnly) {
1955
- if (data.toolName === 'learnSkills') {
1956
- for (const skill of data.loadedSkills ?? []) {
1957
- void VisualLogging.logFunctionCall('ai-v2-learn-skill', skill);
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
- } else if (data.toolName) {
1960
- void VisualLogging.logFunctionCall('ai-v2-tool-call',
1961
- Platform.StringUtilities.toKebabCase(data.toolName));
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 (AiAssistanceModel.AiUtils.isAiV2Enabled() && !this.#conversation?.isReadOnly && data.toolName) {
2034
- void VisualLogging.logFunctionCall('ai-v2-tool-call',
2035
- Platform.StringUtilities.toKebabCase(data.toolName));
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
- localStorage.setItem('aiAssistanceStructuredLogEnabled', 'true');
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: 'always-allow-execute-code',
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('side-effect-confirmation')}>
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: 'decline-execute-code',
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: 'accept-execute-code',
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
- /* Purposefully not using design system variables, this is a
168
- * specific size to indent the content in and align it with the
169
- * walkthrough CTA. */
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: 100px;
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: 18px;
101
- height: 18px;
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: 18px;
112
+ line-height: var(--sys-typescale-body4-line-height);
113
113
  }
114
114
  }
115
115
  }
@@ -40,8 +40,8 @@
40
40
  }
41
41
 
42
42
  .background-service-metadata-entry {
43
- padding-left: 10px;
44
- padding-bottom: 5px;
43
+ padding-left: var(--sys-size-5);
44
+ padding-bottom: var(--sys-size-3);
45
45
  }
46
46
 
47
47
  .background-service-metadata-name {
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .reporting-header {
21
- font-size: 15px;
21
+ font-size: var(--sys-typescale-headline5-size);
22
22
  background-color: var(--sys-color-surface2);
23
23
  padding: var(--sys-size-1) var(--sys-size-3);
24
24
  flex-shrink: 0;
@@ -6,7 +6,7 @@
6
6
  :host {
7
7
  display: block;
8
8
  white-space: normal;
9
- max-width: 400px;
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: 10px;
36
+ padding-left: var(--sys-size-5);
37
37
  }
38
38
 
39
39
  .condition,
@@ -11,7 +11,7 @@
11
11
  }
12
12
 
13
13
  .heading {
14
- font-size: 15px;
14
+ font-size: var(--sys-typescale-headline5-size);
15
15
  }
16
16
 
17
17
  devtools-data-grid {
@@ -4,7 +4,7 @@
4
4
  * found in the LICENSE file.
5
5
  */
6
6
  .device-bound-session-grid-wrapper {
7
- margin: 0 var(--sys-size-9) 5px;
7
+ margin: 0 var(--sys-size-9) var(--sys-size-3);
8
8
  }
9
9
 
10
10
  .device-bound-session-grid-wrapper devtools-data-grid {
@@ -37,10 +37,6 @@ button.link {
37
37
  height: var(--sys-size-8);
38
38
  }
39
39
 
40
- button.link:has(devtools-icon) {
41
- margin-top: 5px;
42
- }
43
-
44
40
  devtools-button.help-button {
45
41
  top: var(--sys-size-3);
46
42
  position: relative;
@@ -46,10 +46,6 @@
46
46
  font-size: unset !important; /* stylelint-disable-line declaration-no-important */
47
47
  }
48
48
 
49
- .resources-toolbar {
50
- padding-right: 10px;
51
- }
52
-
53
49
  .object-store-summary-bar {
54
50
  flex: 0 0 27px;
55
51
  line-height: 27px;
@@ -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
- top: 5px;
93
- height: 10px;
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: 10px;
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: 7px;
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
- padding: 0 var(--sys-size-9) 11px var(--sys-size-9);
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 {