chrome-devtools-frontend 1.0.1526630 → 1.0.1529186

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 (339) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/i18nImpl.ts +6 -1
  5. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  6. package/front_end/core/root/Runtime.ts +38 -4
  7. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  8. package/front_end/core/sdk/CSSRule.ts +35 -6
  9. package/front_end/core/sdk/Connections.ts +2 -1
  10. package/front_end/core/sdk/DOMModel.ts +4 -0
  11. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  12. package/front_end/core/sdk/NetworkManager.ts +267 -34
  13. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  14. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  15. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  16. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  17. package/front_end/core/sdk/SourceMap.ts +41 -11
  18. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  19. package/front_end/core/sdk/SourceMapScopesInfo.ts +49 -2
  20. package/front_end/core/sdk/TargetManager.ts +0 -22
  21. package/front_end/core/sdk/TraceObject.ts +8 -7
  22. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  23. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  24. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  25. package/front_end/entrypoints/main/MainImpl.ts +42 -28
  26. package/front_end/generated/InspectorBackendCommands.js +3 -2
  27. package/front_end/generated/SupportedCSSProperties.js +2 -0
  28. package/front_end/generated/protocol.ts +17 -3
  29. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  30. package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
  31. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  34. package/front_end/models/extensions/ExtensionView.ts +3 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +31 -27
  36. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  37. package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
  38. package/front_end/models/persistence/PersistenceImpl.ts +0 -5
  39. package/front_end/models/persistence/persistence-meta.ts +0 -31
  40. package/front_end/models/persistence/persistence.ts +0 -6
  41. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  42. package/front_end/models/stack_trace/Trie.ts +9 -0
  43. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  44. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  45. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  46. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  47. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  48. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  50. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  51. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  52. package/front_end/panels/application/CookieItemsView.ts +1 -0
  53. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  54. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  56. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  57. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  58. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  59. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  60. package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
  61. package/front_end/panels/common/common.ts +1 -0
  62. package/front_end/panels/console/ConsoleInsightTeaser.ts +369 -0
  63. package/front_end/panels/console/ConsolePanel.ts +2 -0
  64. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  65. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +12 -0
  67. package/front_end/panels/console/ConsoleViewMessage.ts +44 -0
  68. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  69. package/front_end/panels/console/console-meta.ts +14 -0
  70. package/front_end/panels/console/console.ts +6 -0
  71. package/front_end/panels/console/consoleInsightTeaser.css +83 -0
  72. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  73. package/front_end/panels/coverage/CoverageView.ts +292 -284
  74. package/front_end/panels/coverage/coverageView.css +17 -0
  75. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  76. package/front_end/panels/elements/LayoutPane.ts +1 -0
  77. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  79. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  80. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  81. package/front_end/panels/explain/ActionDelegate.ts +4 -2
  82. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  83. package/front_end/panels/explain/explain-meta.ts +7 -0
  84. package/front_end/panels/explain/explain.ts +0 -1
  85. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  86. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  87. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  88. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  89. package/front_end/panels/media/MainView.ts +1 -0
  90. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  91. package/front_end/panels/network/BlockedURLsPane.ts +237 -108
  92. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  93. package/front_end/panels/network/NetworkItemView.ts +1 -0
  94. package/front_end/panels/network/NetworkLogView.ts +9 -7
  95. package/front_end/panels/network/NetworkOverview.ts +1 -0
  96. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  97. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  98. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  99. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  100. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  101. package/front_end/panels/network/RequestResponseView.ts +1 -0
  102. package/front_end/panels/network/RequestTimingView.ts +2 -0
  103. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  104. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  105. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  106. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  107. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  108. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  109. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  110. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  111. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  112. package/front_end/panels/profiler/ProfileView.ts +1 -0
  113. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  114. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  115. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  116. package/front_end/panels/search/SearchView.ts +1 -0
  117. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  118. package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +3 -6
  119. package/front_end/panels/settings/WorkspaceSettingsTab.ts +4 -1
  120. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  121. package/front_end/panels/settings/settings.ts +2 -0
  122. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  123. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  124. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  125. package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
  126. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
  127. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  128. package/front_end/panels/sources/sources-meta.ts +15 -0
  129. package/front_end/panels/sources/sources.ts +2 -0
  130. package/front_end/panels/timeline/README.md +2 -2
  131. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  132. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  133. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  134. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  135. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  136. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  137. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  138. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  139. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  141. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  142. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  143. package/front_end/panels/utils/utils.ts +2 -1
  144. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/diff/diff_match_patch.js +1 -1
  147. package/front_end/third_party/lighthouse/README.chromium +2 -2
  148. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  149. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  150. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  151. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  156. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  158. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  159. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  160. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  161. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  163. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  164. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  167. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  169. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  172. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  174. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  176. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  178. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  179. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  180. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  181. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  182. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  183. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  184. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  185. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  186. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  187. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  188. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  189. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  190. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  191. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  192. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  193. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  194. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  195. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  196. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  197. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  198. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  199. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  200. package/front_end/third_party/web-vitals/README.chromium +5 -8
  201. package/front_end/third_party/web-vitals/package/README.md +191 -152
  202. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  203. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  204. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  205. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  206. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  207. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  208. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  209. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  210. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  211. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  212. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  215. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  219. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  220. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  221. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  222. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  223. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  224. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  225. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  226. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  227. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  228. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  229. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  230. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  231. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  232. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  233. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  234. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  235. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  236. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  237. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  238. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  239. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  240. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  241. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  242. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  243. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  244. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  245. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  246. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  247. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  248. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  249. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  250. package/front_end/third_party/web-vitals/package/package.json +4 -10
  251. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  252. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  253. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  254. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  255. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  256. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  257. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  258. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  259. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  260. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  261. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  262. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  263. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  264. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  265. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  266. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  267. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  268. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  269. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  270. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  271. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  272. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  273. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  274. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  275. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  276. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  277. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  278. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  279. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  280. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  281. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  282. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  283. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  284. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  285. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  286. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  287. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  288. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  289. package/front_end/ui/legacy/InspectorView.ts +2 -0
  290. package/front_end/ui/legacy/ListWidget.ts +2 -2
  291. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  292. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  293. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  294. package/front_end/ui/legacy/UIUtils.ts +8 -19
  295. package/front_end/ui/legacy/ViewManager.ts +1 -0
  296. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  297. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  298. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  299. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  300. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  301. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  302. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  303. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  304. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  305. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  306. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  307. package/front_end/ui/visual_logging/KnownContextValues.ts +25 -0
  308. package/mcp/README.md +7 -0
  309. package/mcp/mcp.ts +8 -0
  310. package/package.json +1 -1
  311. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  312. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  313. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  314. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  315. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  316. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  317. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  318. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  319. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  320. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  323. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  324. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  326. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  327. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  330. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  331. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  332. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  333. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  334. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  335. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  336. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  337. package/front_end/ui/legacy/inlineButton.css +0 -22
  338. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
  339. /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
@@ -0,0 +1,369 @@
1
+ // Copyright 2025 The Chromium Authors. All rights reserved.
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 '../../ui/components/tooltips/tooltips.js';
6
+
7
+ import * as Common from '../../core/common/common.js';
8
+ import * as Host from '../../core/host/host.js';
9
+ import * as i18n from '../../core/i18n/i18n.js';
10
+ import * as Root from '../../core/root/root.js';
11
+ import * as AiAssistanceModel from '../../models/ai_assistance/ai_assistance.js';
12
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
13
+ import * as UI from '../../ui/legacy/legacy.js';
14
+ import * as Lit from '../../ui/lit/lit.js';
15
+ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
16
+ import * as PanelCommon from '../common/common.js';
17
+
18
+ import consoleInsightTeaserStyles from './consoleInsightTeaser.css.js';
19
+ import {ConsoleViewMessage} from './ConsoleViewMessage.js';
20
+ import {PromptBuilder} from './PromptBuilder.js';
21
+
22
+ const {render, html} = Lit;
23
+
24
+ const UIStringsNotTranslate = {
25
+ /**
26
+ * @description Link text in the disclaimer dialog, linking to a settings page containing more information
27
+ */
28
+ learnMore: 'Learn more about AI summaries',
29
+ /**
30
+ * @description Description of the console insights feature
31
+ */
32
+ freDisclaimerHeader: 'Get explanations for console warnings and errors',
33
+ /**
34
+ * @description First item in the first-run experience dialog
35
+ */
36
+ freDisclaimerTextAiWontAlwaysGetItRight: 'This feature uses AI and won’t always get it right',
37
+ /**
38
+ * @description Explainer for which data is being sent by the console insights feature
39
+ */
40
+ consoleInsightsSendsData:
41
+ 'To generate explanations, the console message, associated stack trace, related source code, and the associated network headers are sent to Google. This data may be seen by human reviewers to improve this feature.',
42
+ /**
43
+ * @description Explainer for which data is being sent by the console insights feature
44
+ */
45
+ consoleInsightsSendsDataNoLogging:
46
+ 'To generate explanations, the console message, associated stack trace, related source code, and the associated network headers are sent to Google. This data will not be used to improve Google’s AI models. Your organization may change these settings at any time.',
47
+ /**
48
+ * @description Third item in the first-run experience dialog
49
+ */
50
+ freDisclaimerTextUseWithCaution: 'Use generated code snippets with caution',
51
+ /**
52
+ * @description Tooltip text for the console insights teaser
53
+ */
54
+ infoTooltipText:
55
+ 'The text above has been generated with AI on your local device. Clicking the button will send the console message, stack trace, related source code, and the associated network headers to Google to generate a more detailed explanation.',
56
+ /**
57
+ * @description Header text during loading state while an AI summary is being generated
58
+ */
59
+ summarizing: 'Summarizing…',
60
+ /**
61
+ * @description Label for an animation shown while an AI response is being generated
62
+ */
63
+ loading: 'Loading',
64
+ /**
65
+ * @description Label for a button which generates a more detailed explanation
66
+ */
67
+ tellMeMore: 'Tell me more',
68
+ /**
69
+ * @description Label for a checkbox which turns off the teaser explanation feature
70
+ */
71
+ dontShow: 'Don’t show',
72
+ } as const;
73
+
74
+ const lockedString = i18n.i18n.lockedString;
75
+
76
+ const CODE_SNIPPET_WARNING_URL = 'https://support.google.com/legal/answer/13505487';
77
+ const DATA_USAGE_URL = 'https://developer.chrome.com/docs/devtools/ai-assistance/get-started#data-use';
78
+ const EXPLAIN_TEASER_ACTION_ID = 'explain.console-message.teaser';
79
+
80
+ interface ViewInput {
81
+ onTellMeMoreClick: (event: Event) => void;
82
+ // If multiple ConsoleInsightTeasers exist, each one needs a unique id. Otherwise showing and
83
+ // hiding of the tooltip, and rendering the loading animation, does not work correctly.
84
+ uuid: string;
85
+ headerText: string;
86
+ mainText: string;
87
+ isInactive: boolean;
88
+ dontShowChanged: (e: Event) => void;
89
+ hasTellMeMoreButton: boolean;
90
+ }
91
+
92
+ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
93
+ if (input.isInactive) {
94
+ render(Lit.nothing, target);
95
+ return;
96
+ }
97
+
98
+ const showPlaceholder = !Boolean(input.mainText);
99
+ // clang-format off
100
+ render(html`
101
+ <style>${consoleInsightTeaserStyles}</style>
102
+ <devtools-tooltip
103
+ id=${'teaser-' + input.uuid}
104
+ hover-delay=500
105
+ variant="rich"
106
+ vertical-distance-increase=-6
107
+ prefer-span-left
108
+ >
109
+ <div class="teaser-tooltip-container">
110
+ ${showPlaceholder ? html`
111
+ <h2 tabindex="-1">${lockedString(UIStringsNotTranslate.summarizing)}</h2>
112
+ <div
113
+ role="presentation"
114
+ aria-label=${lockedString(UIStringsNotTranslate.loading)}
115
+ class="loader"
116
+ style="clip-path: url(${'#clipPath-' + input.uuid});"
117
+ >
118
+ <svg width="100%" height="52">
119
+ <defs>
120
+ <clipPath id=${'clipPath-' + input.uuid}>
121
+ <rect x="0" y="0" width="100%" height="12" rx="8"></rect>
122
+ <rect x="0" y="20" width="100%" height="12" rx="8"></rect>
123
+ <rect x="0" y="40" width="100%" height="12" rx="8"></rect>
124
+ </clipPath>
125
+ </defs>
126
+ </svg>
127
+ </div>
128
+ ` : html`
129
+ <h2 tabindex="-1">${input.headerText}</h2>
130
+ <div>${input.mainText}</div>
131
+ <div class="tooltip-footer">
132
+ ${input.hasTellMeMoreButton ? html`
133
+ <devtools-button
134
+ title=${lockedString(UIStringsNotTranslate.tellMeMore)}
135
+ .jslogContext=${'insights-teaser-tell-me-more'},
136
+ .variant=${Buttons.Button.Variant.PRIMARY}
137
+ @click=${input.onTellMeMoreClick}
138
+ >
139
+ <devtools-icon class="lightbulb-icon" name="lightbulb-spark"></devtools-icon>
140
+ ${lockedString(UIStringsNotTranslate.tellMeMore)}
141
+ </devtools-button>
142
+ ` : Lit.nothing}
143
+ <devtools-icon
144
+ name="info"
145
+ class="info-icon"
146
+ aria-details=${'teaser-info-tooltip-' + input.uuid}
147
+ ></devtools-icon>
148
+ <devtools-tooltip id=${'teaser-info-tooltip-' + input.uuid} variant="rich">
149
+ <div class="info-tooltip-text">${lockedString(UIStringsNotTranslate.infoTooltipText)}</div>
150
+ <div class="learn-more">
151
+ <x-link
152
+ class="devtools-link"
153
+ title=${lockedString(UIStringsNotTranslate.learnMore)}
154
+ href=${DATA_USAGE_URL}
155
+ jslog=${VisualLogging.link().track({click: true, keydown:'Enter|Space'}).context('explain.teaser.learn-more')}
156
+ >${lockedString(UIStringsNotTranslate.learnMore)}</x-link>
157
+ </div>
158
+ </devtools-tooltip>
159
+ <devtools-checkbox
160
+ @change=${input.dontShowChanged}
161
+ jslog=${VisualLogging.toggle('explain.teaser.dont-show').track({ change: true })}>
162
+ ${lockedString(UIStringsNotTranslate.dontShow)}
163
+ </devtools-checkbox>
164
+ </div>
165
+ `}
166
+ </div>
167
+ </devtools-tooltip>
168
+ `, target);
169
+ // clang-format on
170
+ };
171
+
172
+ export type View = typeof DEFAULT_VIEW;
173
+
174
+ export class ConsoleInsightTeaser extends UI.Widget.Widget {
175
+ #view: View;
176
+ #uuid: string;
177
+ #isGenerating = false;
178
+ #builtInAi: AiAssistanceModel.BuiltInAi.BuiltInAi|undefined;
179
+ #promptBuilder: PromptBuilder;
180
+ #headerText = '';
181
+ #mainText = '';
182
+ #consoleViewMessage: ConsoleViewMessage;
183
+ #isInactive = false;
184
+ #abortController: null|AbortController = null;
185
+
186
+ constructor(uuid: string, consoleViewMessage: ConsoleViewMessage, element?: HTMLElement, view?: View) {
187
+ super(element);
188
+ this.#view = view ?? DEFAULT_VIEW;
189
+ this.#uuid = uuid;
190
+ this.#promptBuilder = new PromptBuilder(consoleViewMessage);
191
+ this.#consoleViewMessage = consoleViewMessage;
192
+ this.requestUpdate();
193
+ }
194
+
195
+ #getConsoleInsightsEnabledSetting(): Common.Settings.Setting<boolean>|undefined {
196
+ try {
197
+ return Common.Settings.moduleSetting('console-insights-enabled') as Common.Settings.Setting<boolean>;
198
+ } catch {
199
+ return;
200
+ }
201
+ }
202
+
203
+ #getOnboardingCompletedSetting(): Common.Settings.Setting<boolean> {
204
+ return Common.Settings.Settings.instance().createLocalSetting('console-insights-onboarding-finished', true);
205
+ }
206
+
207
+ #executeConsoleInsightAction(): void {
208
+ UI.Context.Context.instance().setFlavor(ConsoleViewMessage, this.#consoleViewMessage);
209
+ const action = UI.ActionRegistry.ActionRegistry.instance().getAction(EXPLAIN_TEASER_ACTION_ID);
210
+ void action.execute();
211
+ }
212
+
213
+ #onTellMeMoreClick(event: Event): void {
214
+ event.stopPropagation();
215
+ if (this.#getConsoleInsightsEnabledSetting()?.getIfNotDisabled() &&
216
+ this.#getOnboardingCompletedSetting()?.getIfNotDisabled()) {
217
+ this.#executeConsoleInsightAction();
218
+ return;
219
+ }
220
+ void this.#showFreDialog();
221
+ }
222
+
223
+ async #showFreDialog(): Promise<void> {
224
+ const noLogging = Root.Runtime.hostConfig.aidaAvailability?.enterprisePolicyValue ===
225
+ Root.Runtime.GenAiEnterprisePolicyValue.ALLOW_WITHOUT_LOGGING;
226
+ const result = await PanelCommon.FreDialog.show({
227
+ header: {iconName: 'smart-assistant', text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
228
+ reminderItems: [
229
+ {
230
+ iconName: 'psychiatry',
231
+ content: lockedString(UIStringsNotTranslate.freDisclaimerTextAiWontAlwaysGetItRight),
232
+ },
233
+ {
234
+ iconName: 'google',
235
+ content: noLogging ? lockedString(UIStringsNotTranslate.consoleInsightsSendsDataNoLogging) :
236
+ lockedString(UIStringsNotTranslate.consoleInsightsSendsData),
237
+ },
238
+ {
239
+ iconName: 'warning',
240
+ // clang-format off
241
+ content: html`<x-link
242
+ href=${CODE_SNIPPET_WARNING_URL}
243
+ class="link devtools-link"
244
+ jslog=${VisualLogging.link('explain.teaser.code-snippets-explainer').track({
245
+ click: true
246
+ })}
247
+ >${lockedString(UIStringsNotTranslate.freDisclaimerTextUseWithCaution)}</x-link>`,
248
+ // clang-format on
249
+ }
250
+ ],
251
+ onLearnMoreClick: () => {
252
+ void UI.ViewManager.ViewManager.instance().showView('chrome-ai');
253
+ },
254
+ ariaLabel: lockedString(UIStringsNotTranslate.freDisclaimerHeader),
255
+ learnMoreButtonText: lockedString(UIStringsNotTranslate.learnMore),
256
+ });
257
+
258
+ if (result) {
259
+ this.#getConsoleInsightsEnabledSetting()?.set(true);
260
+ this.#getOnboardingCompletedSetting()?.set(true);
261
+ this.#executeConsoleInsightAction();
262
+ }
263
+ }
264
+
265
+ maybeGenerateTeaser(): void {
266
+ this.requestUpdate();
267
+ if (!this.#isInactive && !this.#isGenerating && !Boolean(this.#mainText) &&
268
+ Common.Settings.Settings.instance().moduleSetting('console-insight-teasers-enabled').get()) {
269
+ void this.#generateTeaserText();
270
+ }
271
+ }
272
+
273
+ abortTeaserGeneration(): void {
274
+ if (this.#abortController) {
275
+ this.#abortController.abort();
276
+ }
277
+ this.#isGenerating = false;
278
+ }
279
+
280
+ setInactive(isInactive: boolean): void {
281
+ if (this.#isInactive === isInactive) {
282
+ return;
283
+ }
284
+ this.#isInactive = isInactive;
285
+ this.requestUpdate();
286
+ }
287
+
288
+ async #generateTeaserText(): Promise<void> {
289
+ this.#isGenerating = true;
290
+ let teaserText = '';
291
+ try {
292
+ for await (const chunk of this.#getOnDeviceInsight()) {
293
+ teaserText += chunk;
294
+ }
295
+ } catch (err) {
296
+ // Ignore `AbortError` errors, which are thrown on mouse leave.
297
+ if (err.name !== 'AbortError') {
298
+ console.error(err.name, err.message);
299
+ }
300
+ this.#isGenerating = false;
301
+ return;
302
+ }
303
+
304
+ // TODO(crbug.com/443618746): Add user-facing error message instead of staying in loading state
305
+ let responseObject = {
306
+ header: null,
307
+ explanation: null,
308
+ };
309
+ try {
310
+ responseObject = JSON.parse(teaserText);
311
+ } catch (err) {
312
+ console.error(err.name, err.message);
313
+ }
314
+ this.#headerText = responseObject.header || '';
315
+ this.#mainText = responseObject.explanation || '';
316
+ this.#isGenerating = false;
317
+ this.requestUpdate();
318
+ }
319
+
320
+ async * #getOnDeviceInsight(): AsyncGenerator<string> {
321
+ const {prompt} = await this.#promptBuilder.buildPrompt();
322
+ if (!this.#builtInAi) {
323
+ this.#builtInAi = await AiAssistanceModel.BuiltInAi.BuiltInAi.instance();
324
+ if (!this.#builtInAi) {
325
+ this.#isInactive = true;
326
+ throw new Error('Cannot instantiate BuiltInAi');
327
+ }
328
+ }
329
+ this.#abortController = new AbortController();
330
+ const stream = this.#builtInAi.getConsoleInsight(prompt, this.#abortController);
331
+ for await (const chunk of stream) {
332
+ yield chunk;
333
+ }
334
+ this.#abortController = null;
335
+ }
336
+
337
+ #dontShowChanged(e: Event): void {
338
+ const showTeasers = !(e.target as HTMLInputElement).checked;
339
+ Common.Settings.Settings.instance().moduleSetting('console-insight-teasers-enabled').set(showTeasers);
340
+ }
341
+
342
+ #hasTellMeMoreButton(): boolean {
343
+ if (!UI.ActionRegistry.ActionRegistry.instance().hasAction(EXPLAIN_TEASER_ACTION_ID)) {
344
+ return false;
345
+ }
346
+ if (Root.Runtime.hostConfig.aidaAvailability?.blockedByAge || Root.Runtime.hostConfig.isOffTheRecord) {
347
+ return false;
348
+ }
349
+ if (!Host.AidaClient.AidaAccessPreconditions.AVAILABLE) {
350
+ return false;
351
+ }
352
+ return true;
353
+ }
354
+
355
+ override performUpdate(): Promise<void>|void {
356
+ this.#view(
357
+ {
358
+ onTellMeMoreClick: this.#onTellMeMoreClick.bind(this),
359
+ uuid: this.#uuid,
360
+ headerText: this.#headerText,
361
+ mainText: this.#mainText,
362
+ isInactive: this.#isInactive ||
363
+ !Common.Settings.Settings.instance().moduleSetting('console-insight-teasers-enabled').get(),
364
+ dontShowChanged: this.#dontShowChanged.bind(this),
365
+ hasTellMeMoreButton: this.#hasTellMeMoreButton(),
366
+ },
367
+ undefined, this.contentElement);
368
+ }
369
+ }
@@ -106,6 +106,7 @@ export class WrapperView extends UI.Widget.VBox {
106
106
  }
107
107
 
108
108
  override wasShown(): void {
109
+ super.wasShown();
109
110
  if (!ConsolePanel.instance().isShowing()) {
110
111
  this.showViewInWrapper();
111
112
  } else {
@@ -115,6 +116,7 @@ export class WrapperView extends UI.Widget.VBox {
115
116
  }
116
117
 
117
118
  override willHide(): void {
119
+ super.willHide();
118
120
  UI.InspectorView.InspectorView.instance().setDrawerMinimized(false);
119
121
  ConsolePanel.updateContextFlavor();
120
122
  }
@@ -608,8 +608,18 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
608
608
  }
609
609
 
610
610
  private isAiCodeCompletionEnabled(): boolean {
611
- return Boolean(
612
- Root.Runtime.hostConfig.aidaAvailability?.enabled && Root.Runtime.hostConfig.devToolsAiCodeCompletion?.enabled);
611
+ const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
612
+ const aidaAvailability = Root.Runtime.hostConfig.aidaAvailability;
613
+ if (!devtoolsLocale.locale.startsWith('en-')) {
614
+ return false;
615
+ }
616
+ if (aidaAvailability?.blockedByGeo) {
617
+ return false;
618
+ }
619
+ if (aidaAvailability?.blockedByAge) {
620
+ return false;
621
+ }
622
+ return Boolean(aidaAvailability?.enabled && Root.Runtime.hostConfig.devToolsAiCodeCompletion?.enabled);
613
623
  }
614
624
 
615
625
  private editorSetForTest(): void {
@@ -109,7 +109,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
109
109
  n: group.messageCount
110
110
  })}
111
111
  ${group.messageCount === 0 ? nothing : html`
112
- <ul role="group" ?hidden=${group.filter !== input.selectedFilter}>
112
+ <ul role="group" hidden>
113
113
  ${group.urlGroups.values().map(urlGroup => html`
114
114
  <li
115
115
  ${Directives.ref(element => element && nodeFilterMap.set(element, group.filter))}
@@ -767,6 +767,7 @@ export class ConsoleView extends UI.Widget.VBox implements
767
767
  }
768
768
 
769
769
  override willHide(): void {
770
+ super.willHide();
770
771
  this.hidePromptSuggestBox();
771
772
  }
772
773
 
@@ -1698,6 +1699,17 @@ export class ConsoleView extends UI.Widget.VBox implements
1698
1699
  }
1699
1700
 
1700
1701
  private isAiCodeCompletionEnabled(): boolean {
1702
+ const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
1703
+ const aidaAvailability = Root.Runtime.hostConfig.aidaAvailability;
1704
+ if (!devtoolsLocale.locale.startsWith('en-')) {
1705
+ return false;
1706
+ }
1707
+ if (aidaAvailability?.blockedByGeo) {
1708
+ return false;
1709
+ }
1710
+ if (aidaAvailability?.blockedByAge) {
1711
+ return false;
1712
+ }
1701
1713
  return Boolean(Root.Runtime.hostConfig.devToolsAiCodeCompletion?.enabled);
1702
1714
  }
1703
1715
  }
@@ -41,6 +41,7 @@ import * as Platform from '../../core/platform/platform.js';
41
41
  import * as Root from '../../core/root/root.js';
42
42
  import * as SDK from '../../core/sdk/sdk.js';
43
43
  import * as Protocol from '../../generated/protocol.js';
44
+ import * as AiAssistanceModel from '../../models/ai_assistance/ai_assistance.js';
44
45
  import * as Bindings from '../../models/bindings/bindings.js';
45
46
  import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
46
47
  import * as Logs from '../../models/logs/logs.js';
@@ -61,6 +62,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
61
62
  import * as Security from '../security/security.js';
62
63
 
63
64
  import {format, updateStyle} from './ConsoleFormat.js';
65
+ import {ConsoleInsightTeaser} from './ConsoleInsightTeaser.js';
64
66
  import consoleViewStyles from './consoleView.css.js';
65
67
  import type {ConsoleViewportElement} from './ConsoleViewport.js';
66
68
  import {augmentErrorStackWithScriptIds, parseSourcePositionsFromErrorStack} from './ErrorStackParser.js';
@@ -317,6 +319,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
317
319
  private requestResolver: Logs.RequestResolver.RequestResolver;
318
320
  private issueResolver: IssuesManager.IssueResolver.IssueResolver;
319
321
  #adjacentUserCommandResult = false;
322
+ #teaser: ConsoleInsightTeaser|undefined = undefined;
320
323
 
321
324
  /** Formatting Error#stack is asynchronous. Allow tests to wait for the result */
322
325
  #formatErrorStackPromiseForTest = Promise.resolve();
@@ -365,7 +368,9 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
365
368
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.InsightClosed);
366
369
  this.elementInternal?.classList.toggle('has-insight', false);
367
370
  this.elementInternal?.removeChild(insight);
371
+ this.#teaser?.setInactive(false);
368
372
  }, {once: true});
373
+ this.#teaser?.setInactive(true);
369
374
  }
370
375
 
371
376
  element(): HTMLElement {
@@ -374,6 +379,9 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
374
379
 
375
380
  wasShown(): void {
376
381
  this.isVisibleInternal = true;
382
+ if (this.elementInternal) {
383
+ this.#teaser?.show(this.elementInternal);
384
+ }
377
385
  }
378
386
 
379
387
  onResize(): void {
@@ -382,6 +390,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
382
390
  willHide(): void {
383
391
  this.isVisibleInternal = false;
384
392
  this.cachedHeight = this.element().offsetHeight;
393
+ this.#teaser?.detach();
385
394
  }
386
395
 
387
396
  isVisible(): boolean {
@@ -1334,6 +1343,17 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1334
1343
  return this.contentElementInternal;
1335
1344
  }
1336
1345
 
1346
+ #onMouseEnter(_event: MouseEvent): void {
1347
+ if (this.#teaser &&
1348
+ Common.Settings.Settings.instance().moduleSetting('console-insight-teasers-enabled').getIfNotDisabled()) {
1349
+ this.#teaser.maybeGenerateTeaser();
1350
+ }
1351
+ }
1352
+
1353
+ #onMouseLeave(): void {
1354
+ this.#teaser?.abortTeaserGeneration();
1355
+ }
1356
+
1337
1357
  toMessageElement(): HTMLElement {
1338
1358
  if (this.elementInternal) {
1339
1359
  return this.elementInternal;
@@ -1341,6 +1361,8 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1341
1361
  this.elementInternal = document.createElement('div');
1342
1362
  this.elementInternal.tabIndex = -1;
1343
1363
  this.elementInternal.addEventListener('keydown', (this.onKeyDown.bind(this) as EventListener));
1364
+ this.elementInternal.addEventListener('mouseenter', this.#onMouseEnter.bind(this));
1365
+ this.elementInternal.addEventListener('mouseleave', this.#onMouseLeave.bind(this));
1344
1366
  this.updateMessageElement();
1345
1367
  this.elementInternal.classList.toggle('console-adjacent-user-command-result', this.#adjacentUserCommandResult);
1346
1368
  return this.elementInternal;
@@ -1359,6 +1381,13 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1359
1381
  this.elementInternal.removeChildren();
1360
1382
  this.consoleRowWrapper = this.elementInternal.createChild('div');
1361
1383
  this.consoleRowWrapper.classList.add('console-row-wrapper');
1384
+
1385
+ if (this.shouldShowTeaser()) {
1386
+ const uuid = crypto.randomUUID();
1387
+ this.elementInternal.setAttribute('aria-details', `teaser-${uuid}`);
1388
+ this.#teaser = new ConsoleInsightTeaser(uuid, this);
1389
+ }
1390
+
1362
1391
  if (this.message.isGroupStartMessage()) {
1363
1392
  this.elementInternal.classList.add('console-group-title');
1364
1393
  }
@@ -1430,6 +1459,21 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1430
1459
  this.message.level === Protocol.Log.LogEntryLevel.Warning;
1431
1460
  }
1432
1461
 
1462
+ shouldShowTeaser(): boolean {
1463
+ if (!this.shouldShowInsights()) {
1464
+ return false;
1465
+ }
1466
+ if (!Common.Settings.Settings.instance().moduleSetting('console-insight-teasers-enabled').getIfNotDisabled() ||
1467
+ !AiAssistanceModel.BuiltInAi.BuiltInAi.cachedIsAvailable()) {
1468
+ return false;
1469
+ }
1470
+ const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
1471
+ if (!devtoolsLocale.locale.startsWith('en-')) {
1472
+ return false;
1473
+ }
1474
+ return true;
1475
+ }
1476
+
1433
1477
  getExplainLabel(): string {
1434
1478
  if (this.message.level === Protocol.Log.LogEntryLevel.Error) {
1435
1479
  return i18nString(UIStrings.explainThisError);
@@ -9,7 +9,8 @@ import * as Formatter from '../../models/formatter/formatter.js';
9
9
  import * as Logs from '../../models/logs/logs.js';
10
10
  import * as TextUtils from '../../models/text_utils/text_utils.js';
11
11
  import * as Components from '../../ui/legacy/components/utils/utils.js';
12
- import type * as Console from '../console/console.js';
12
+
13
+ import type {ConsoleViewMessage} from './ConsoleViewMessage.js';
13
14
 
14
15
  const MAX_MESSAGE_SIZE = 1000;
15
16
  const MAX_STACK_TRACE_SIZE = 1000;
@@ -28,9 +29,9 @@ export interface Source {
28
29
  }
29
30
 
30
31
  export class PromptBuilder {
31
- #consoleMessage: Console.ConsoleViewMessage.ConsoleViewMessage;
32
+ #consoleMessage: ConsoleViewMessage;
32
33
 
33
- constructor(consoleMessage: Console.ConsoleViewMessage.ConsoleViewMessage) {
34
+ constructor(consoleMessage: ConsoleViewMessage) {
34
35
  this.#consoleMessage = consoleMessage;
35
36
  }
36
37
 
@@ -270,14 +271,18 @@ export function formatNetworkRequest(
270
271
  string {
271
272
  return `Request: ${request.url()}
272
273
 
273
- ${AiAssistanceModel.NetworkRequestFormatter.formatHeaders('Request headers:', request.requestHeaders())}
274
+ ${
275
+ AiAssistanceModel.NetworkRequestFormatter.NetworkRequestFormatter.formatHeaders(
276
+ 'Request headers:', request.requestHeaders())}
274
277
 
275
- ${AiAssistanceModel.NetworkRequestFormatter.formatHeaders('Response headers:', request.responseHeaders)}
278
+ ${
279
+ AiAssistanceModel.NetworkRequestFormatter.NetworkRequestFormatter.formatHeaders(
280
+ 'Response headers:', request.responseHeaders)}
276
281
 
277
282
  Response status: ${request.statusCode} ${request.statusText}`;
278
283
  }
279
284
 
280
- export function formatConsoleMessage(message: Console.ConsoleViewMessage.ConsoleViewMessage): string {
285
+ export function formatConsoleMessage(message: ConsoleViewMessage): string {
281
286
  return message.toMessageTextString().substr(0, MAX_MESSAGE_SIZE);
282
287
  }
283
288
 
@@ -285,7 +290,7 @@ export function formatConsoleMessage(message: Console.ConsoleViewMessage.Console
285
290
  * This formats the stacktrace from the console message which might or might not
286
291
  * match the content of stacktrace(s) in the console message arguments.
287
292
  */
288
- export function formatStackTrace(message: Console.ConsoleViewMessage.ConsoleViewMessage): string {
293
+ export function formatStackTrace(message: ConsoleViewMessage): string {
289
294
  const previewContainer = message.contentElement().querySelector('.stack-preview-container');
290
295
 
291
296
  if (!previewContainer) {
@@ -133,6 +133,11 @@ const UIStrings = {
133
133
  * @description Title of a setting under the Console category in Settings that controls whether `console.trace()` messages appear collapsed by default.
134
134
  */
135
135
  collapseConsoleTraceMessagesByDefault: 'Do not automatically expand `console.trace()` messages',
136
+ /**
137
+ * @description Title of a setting under the Console category in Settings that controls whether AI summaries should
138
+ * be shown for console warnings/errors.
139
+ */
140
+ showConsoleInsightTeasers: 'Show AI summaries for console messages',
136
141
  } as const;
137
142
  const str_ = i18n.i18n.registerUIStrings('panels/console/console-meta.ts', UIStrings);
138
143
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
@@ -437,6 +442,15 @@ Common.Settings.registerSettingExtension({
437
442
  ],
438
443
  });
439
444
 
445
+ Common.Settings.registerSettingExtension({
446
+ category: Common.Settings.SettingCategory.CONSOLE,
447
+ storageType: Common.Settings.SettingStorageType.SYNCED,
448
+ title: i18nLazyString(UIStrings.showConsoleInsightTeasers),
449
+ settingName: 'console-insight-teasers-enabled',
450
+ settingType: Common.Settings.SettingType.BOOLEAN,
451
+ defaultValue: true,
452
+ });
453
+
440
454
  Common.Revealer.registerRevealer({
441
455
  contextTypes() {
442
456
  return [
@@ -5,6 +5,7 @@
5
5
  import './ConsoleContextSelector.js';
6
6
  import './ConsoleFilter.js';
7
7
  import './ConsoleFormat.js';
8
+ import './ConsoleInsightTeaser.js';
8
9
  import './ConsolePinPane.js';
9
10
  import './ConsoleSidebar.js';
10
11
  import './ConsoleViewport.js';
@@ -12,10 +13,12 @@ import './ConsoleViewMessage.js';
12
13
  import './ConsolePrompt.js';
13
14
  import './ConsoleView.js';
14
15
  import './ConsolePanel.js';
16
+ import './PromptBuilder.js';
15
17
 
16
18
  import * as ConsoleContextSelector from './ConsoleContextSelector.js';
17
19
  import * as ConsoleFilter from './ConsoleFilter.js';
18
20
  import * as ConsoleFormat from './ConsoleFormat.js';
21
+ import * as ConsoleInsightTeaser from './ConsoleInsightTeaser.js';
19
22
  import * as ConsolePanel from './ConsolePanel.js';
20
23
  import * as ConsolePinPane from './ConsolePinPane.js';
21
24
  import * as ConsolePrompt from './ConsolePrompt.js';
@@ -24,11 +27,13 @@ import * as ConsoleView from './ConsoleView.js';
24
27
  import * as ConsoleViewMessage from './ConsoleViewMessage.js';
25
28
  import * as ConsoleViewport from './ConsoleViewport.js';
26
29
  import * as ErrorStackParser from './ErrorStackParser.js';
30
+ import * as PromptBuilder from './PromptBuilder.js';
27
31
 
28
32
  export {
29
33
  ConsoleContextSelector,
30
34
  ConsoleFilter,
31
35
  ConsoleFormat,
36
+ ConsoleInsightTeaser,
32
37
  ConsolePanel,
33
38
  ConsolePinPane,
34
39
  ConsolePrompt,
@@ -37,4 +42,5 @@ export {
37
42
  ConsoleViewMessage,
38
43
  ConsoleViewport,
39
44
  ErrorStackParser,
45
+ PromptBuilder,
40
46
  };