chrome-devtools-frontend 1.0.1526630 → 1.0.1528866

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 (319) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/i18n/i18nImpl.ts +6 -1
  4. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  5. package/front_end/core/root/Runtime.ts +28 -4
  6. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  7. package/front_end/core/sdk/CSSRule.ts +35 -6
  8. package/front_end/core/sdk/Connections.ts +2 -1
  9. package/front_end/core/sdk/DOMModel.ts +4 -0
  10. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  11. package/front_end/core/sdk/NetworkManager.ts +214 -31
  12. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  13. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  14. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  15. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  16. package/front_end/core/sdk/SourceMap.ts +37 -11
  17. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  18. package/front_end/core/sdk/SourceMapScopesInfo.ts +17 -0
  19. package/front_end/core/sdk/TargetManager.ts +0 -22
  20. package/front_end/core/sdk/TraceObject.ts +8 -7
  21. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  22. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  23. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  24. package/front_end/entrypoints/main/MainImpl.ts +20 -25
  25. package/front_end/generated/InspectorBackendCommands.js +3 -2
  26. package/front_end/generated/protocol.ts +17 -3
  27. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  28. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  29. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  30. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  31. package/front_end/models/extensions/ExtensionView.ts +3 -0
  32. package/front_end/models/javascript_metadata/NativeFunctions.js +23 -27
  33. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  34. package/front_end/models/persistence/EditFileSystemView.ts +1 -0
  35. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  36. package/front_end/models/stack_trace/Trie.ts +9 -0
  37. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  38. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  39. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  40. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  41. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  42. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  43. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  44. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  45. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  46. package/front_end/panels/application/CookieItemsView.ts +1 -0
  47. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  48. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  49. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  50. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  51. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  52. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  53. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  54. package/front_end/panels/console/ConsoleInsightTeaser.ts +106 -0
  55. package/front_end/panels/console/ConsolePanel.ts +2 -0
  56. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  57. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  58. package/front_end/panels/console/ConsoleView.ts +12 -0
  59. package/front_end/panels/console/ConsoleViewMessage.ts +27 -0
  60. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  61. package/front_end/panels/console/console.ts +6 -0
  62. package/front_end/panels/console/consoleInsightTeaser.css +55 -0
  63. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  64. package/front_end/panels/coverage/CoverageView.ts +292 -284
  65. package/front_end/panels/coverage/coverageView.css +17 -0
  66. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  67. package/front_end/panels/elements/LayoutPane.ts +1 -0
  68. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  69. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  70. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  71. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  72. package/front_end/panels/explain/ActionDelegate.ts +1 -2
  73. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  74. package/front_end/panels/explain/explain.ts +0 -1
  75. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  76. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  77. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  78. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  79. package/front_end/panels/media/MainView.ts +1 -0
  80. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  81. package/front_end/panels/network/BlockedURLsPane.ts +111 -85
  82. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  83. package/front_end/panels/network/NetworkItemView.ts +1 -0
  84. package/front_end/panels/network/NetworkLogView.ts +9 -7
  85. package/front_end/panels/network/NetworkOverview.ts +1 -0
  86. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  87. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  88. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  89. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  90. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  91. package/front_end/panels/network/RequestResponseView.ts +1 -0
  92. package/front_end/panels/network/RequestTimingView.ts +2 -0
  93. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  94. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  95. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  96. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  97. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  98. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  99. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  100. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  101. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  102. package/front_end/panels/profiler/ProfileView.ts +1 -0
  103. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  104. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  105. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  106. package/front_end/panels/search/SearchView.ts +1 -0
  107. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  108. package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -0
  109. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  110. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  111. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  112. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  113. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  114. package/front_end/panels/timeline/README.md +2 -2
  115. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  116. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  117. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  118. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  119. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  120. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  121. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  122. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  123. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  124. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  125. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  126. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  127. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  128. package/front_end/third_party/chromium/README.chromium +1 -1
  129. package/front_end/third_party/lighthouse/README.chromium +2 -2
  130. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  131. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  132. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  133. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  134. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  135. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  136. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  137. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  138. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  139. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  140. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  141. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  142. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  143. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  144. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  145. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  146. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  147. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  148. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  149. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  150. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  151. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  156. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  158. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  159. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  160. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  161. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  163. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  164. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  167. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  169. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  172. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  174. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  176. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  178. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  179. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  180. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  181. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  182. package/front_end/third_party/web-vitals/README.chromium +5 -8
  183. package/front_end/third_party/web-vitals/package/README.md +191 -152
  184. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  185. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  186. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  187. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  188. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  189. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  190. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  191. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  192. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  193. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  194. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  195. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  196. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  197. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  198. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  199. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  200. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  201. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  202. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  203. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  204. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  205. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  206. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  207. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  208. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  209. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  210. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  211. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  212. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  215. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  219. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  220. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  221. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  222. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  223. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  224. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  225. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  226. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  227. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  228. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  229. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  230. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  231. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  232. package/front_end/third_party/web-vitals/package/package.json +4 -10
  233. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  234. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  235. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  236. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  237. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  238. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  239. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  240. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  241. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  242. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  243. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  244. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  245. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  246. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  247. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  248. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  249. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  250. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  251. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  252. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  253. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  254. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  255. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  256. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  257. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  258. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  259. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  260. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  261. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  262. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  263. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  264. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  265. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  266. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  267. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  268. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  269. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  270. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  271. package/front_end/ui/legacy/InspectorView.ts +2 -0
  272. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  273. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  274. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  275. package/front_end/ui/legacy/UIUtils.ts +8 -19
  276. package/front_end/ui/legacy/ViewManager.ts +1 -0
  277. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  278. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  279. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  280. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  281. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  282. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  283. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  284. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  285. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  286. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  287. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  288. package/front_end/ui/visual_logging/KnownContextValues.ts +17 -0
  289. package/mcp/README.md +7 -0
  290. package/mcp/mcp.ts +8 -0
  291. package/package.json +1 -1
  292. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  293. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  294. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  295. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  296. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  297. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  298. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  299. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  300. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  301. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  302. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  303. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  304. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  305. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  306. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  307. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  308. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  309. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  310. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  311. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  312. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  313. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  314. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  315. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  316. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  317. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  318. package/front_end/ui/legacy/inlineButton.css +0 -22
  319. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
@@ -190,7 +190,7 @@ type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
190
190
 
191
191
  export class PatchWidget extends UI.Widget.Widget {
192
192
  changeSummary = '';
193
- changeManager: AiAssistanceModel.ChangeManager|undefined;
193
+ changeManager: AiAssistanceModel.ChangeManager.ChangeManager|undefined;
194
194
  // Whether the user completed first run experience dialog or not.
195
195
  #aiPatchingFreCompletedSetting =
196
196
  Common.Settings.Settings.instance().createSetting('ai-assistance-patching-fre-completed', false);
@@ -519,6 +519,7 @@ export class PatchWidget extends UI.Widget.Widget {
519
519
  }
520
520
 
521
521
  override willHide(): void {
522
+ super.willHide();
522
523
  this.#applyToDisconnectedAutomaticWorkspace = false;
523
524
  if (isAiAssistancePatchingEnabled()) {
524
525
  this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectAdded, this.#onProjectAdded, this);
@@ -681,11 +682,11 @@ export class PatchWidget extends UI.Widget.Widget {
681
682
  // user already had other modified files, the widget will still transition to the
682
683
  // success state (displaying all current workspace modifications).
683
684
  const hasChanges = this.#modifiedFiles.length > 0;
684
- if (response?.type === AiAssistanceModel.ResponseType.ANSWER && hasChanges) {
685
+ if (response?.type === AiAssistanceModel.AiAgent.ResponseType.ANSWER && hasChanges) {
685
686
  this.#patchSuggestionState = PatchSuggestionState.SUCCESS;
686
687
  } else if (
687
- response?.type === AiAssistanceModel.ResponseType.ERROR &&
688
- response.error === AiAssistanceModel.ErrorType.ABORT) {
688
+ response?.type === AiAssistanceModel.AiAgent.ResponseType.ERROR &&
689
+ response.error === AiAssistanceModel.AiAgent.ErrorType.ABORT) {
689
690
  // If this is an abort error, we're returning back to the initial state.
690
691
  this.#patchSuggestionState = PatchSuggestionState.INITIAL;
691
692
  } else {
@@ -748,14 +749,14 @@ ${processedFiles.map(filename => `* ${filename}`).join('\n')}`;
748
749
  }
749
750
 
750
751
  async #applyPatch(changeSummary: string): Promise<{
751
- response: AiAssistanceModel.ResponseData | undefined,
752
+ response: AiAssistanceModel.AiAgent.ResponseData | undefined,
752
753
  processedFiles: string[],
753
754
  }> {
754
755
  if (!this.#project) {
755
756
  throw new Error('Project does not exist');
756
757
  }
757
758
  this.#applyPatchAbortController = new AbortController();
758
- const agent = new AiAssistanceModel.PatchAgent({
759
+ const agent = new AiAssistanceModel.PatchAgent.PatchAgent({
759
760
  aidaClient: this.#aidaClient,
760
761
  serverSideLoggingEnabled: false,
761
762
  project: this.#project,
@@ -798,7 +799,7 @@ window.aiAssistanceTestPatchPrompt =
798
799
  throw new Error('project not found');
799
800
  }
800
801
  const aidaClient = new Host.AidaClient.AidaClient();
801
- const agent = new AiAssistanceModel.PatchAgent({
802
+ const agent = new AiAssistanceModel.PatchAgent.PatchAgent({
802
803
  aidaClient,
803
804
  serverSideLoggingEnabled: false,
804
805
  project,
@@ -806,7 +807,7 @@ window.aiAssistanceTestPatchPrompt =
806
807
  try {
807
808
  const assertionFailures = [];
808
809
  const {processedFiles, responses} = await agent.applyChanges(changeSummary);
809
- if (responses.at(-1)?.type === AiAssistanceModel.ResponseType.ERROR) {
810
+ if (responses.at(-1)?.type === AiAssistanceModel.AiAgent.ResponseType.ERROR) {
810
811
  return {
811
812
  error: 'failed to patch',
812
813
  debugInfo: {
@@ -183,11 +183,13 @@ export class SelectWorkspaceDialog extends UI.Widget.VBox {
183
183
  }
184
184
 
185
185
  override wasShown(): void {
186
+ super.wasShown();
186
187
  this.#workspace.addEventListener(Workspace.Workspace.Events.ProjectAdded, this.#onProjectAdded, this);
187
188
  this.#workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this.#onProjectRemoved, this);
188
189
  }
189
190
 
190
191
  override willHide(): void {
192
+ super.willHide();
191
193
  this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectAdded, this.#onProjectAdded, this);
192
194
  this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectRemoved, this.#onProjectRemoved, this);
193
195
  }
@@ -225,7 +225,7 @@ export interface Step {
225
225
  output?: string;
226
226
  canceled?: boolean;
227
227
  sideEffect?: ConfirmSideEffectDialog;
228
- contextDetails?: [AiAssistanceModel.ContextDetail, ...AiAssistanceModel.ContextDetail[]];
228
+ contextDetails?: [AiAssistanceModel.AiAgent.ContextDetail, ...AiAssistanceModel.AiAgent.ContextDetail[]];
229
229
  }
230
230
 
231
231
  interface ConfirmSideEffectDialog {
@@ -243,7 +243,7 @@ export type ImageInputData = {
243
243
  isLoading: false,
244
244
  data: string,
245
245
  mimeType: string,
246
- inputType: AiAssistanceModel.MultimodalInputType,
246
+ inputType: AiAssistanceModel.AiAgent.MultimodalInputType,
247
247
  };
248
248
 
249
249
  export interface UserChatMessage {
@@ -256,7 +256,7 @@ export interface ModelChatMessage {
256
256
  steps: Step[];
257
257
  suggestions?: [string, ...string[]];
258
258
  answer?: string;
259
- error?: AiAssistanceModel.ErrorType;
259
+ error?: AiAssistanceModel.AiAgent.ErrorType;
260
260
  rpcId?: Host.AidaClient.RpcGlobalId;
261
261
  }
262
262
 
@@ -271,7 +271,7 @@ export const enum State {
271
271
  export interface Props {
272
272
  onTextSubmit:
273
273
  (text: string, imageInput?: Host.AidaClient.Part,
274
- multimodalInputType?: AiAssistanceModel.MultimodalInputType) => void;
274
+ multimodalInputType?: AiAssistanceModel.AiAgent.MultimodalInputType) => void;
275
275
  onInspectElementClick: () => void;
276
276
  onFeedbackSubmit: (rpcId: Host.AidaClient.RpcGlobalId, rate: Host.AidaClient.Rating, feedback?: string) => void;
277
277
  onCancelClick: () => void;
@@ -282,23 +282,23 @@ export interface Props {
282
282
  onRemoveImageInput?: () => void;
283
283
  onTextInputChange: (input: string) => void;
284
284
  onLoadImage?: (file: File) => Promise<void>;
285
- changeManager: AiAssistanceModel.ChangeManager;
285
+ changeManager: AiAssistanceModel.ChangeManager.ChangeManager;
286
286
  inspectElementToggled: boolean;
287
287
  state: State;
288
288
  aidaAvailability: Host.AidaClient.AidaAccessPreconditions;
289
289
  messages: ChatMessage[];
290
- selectedContext: AiAssistanceModel.ConversationContext<unknown>|null;
290
+ selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
291
291
  isLoading: boolean;
292
292
  canShowFeedbackForm: boolean;
293
293
  userInfo: Pick<Host.InspectorFrontendHostAPI.SyncInformation, 'accountImage'|'accountFullName'>;
294
- conversationType?: AiAssistanceModel.ConversationType;
294
+ conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType;
295
295
  isReadOnly: boolean;
296
296
  blockedByCrossOrigin: boolean;
297
297
  changeSummary?: string;
298
298
  multimodalInputEnabled?: boolean;
299
299
  imageInput?: ImageInputData;
300
300
  isTextInputDisabled: boolean;
301
- emptyStateSuggestions: AiAssistanceModel.ConversationSuggestion[];
301
+ emptyStateSuggestions: AiAssistanceModel.AiAgent.ConversationSuggestion[];
302
302
  inputPlaceholder: Platform.UIString.LocalizedString;
303
303
  disclaimerText: Platform.UIString.LocalizedString;
304
304
  isTextInputEmpty: boolean;
@@ -834,14 +834,14 @@ function renderError(message: ModelChatMessage): Lit.LitTemplate {
834
834
  if (message.error) {
835
835
  let errorMessage;
836
836
  switch (message.error) {
837
- case AiAssistanceModel.ErrorType.UNKNOWN:
838
- case AiAssistanceModel.ErrorType.BLOCK:
837
+ case AiAssistanceModel.AiAgent.ErrorType.UNKNOWN:
838
+ case AiAssistanceModel.AiAgent.ErrorType.BLOCK:
839
839
  errorMessage = UIStringsNotTranslate.systemError;
840
840
  break;
841
- case AiAssistanceModel.ErrorType.MAX_STEPS:
841
+ case AiAssistanceModel.AiAgent.ErrorType.MAX_STEPS:
842
842
  errorMessage = UIStringsNotTranslate.maxStepsError;
843
843
  break;
844
- case AiAssistanceModel.ErrorType.ABORT:
844
+ case AiAssistanceModel.AiAgent.ErrorType.ABORT:
845
845
  return html`<p class="aborted" jslog=${VisualLogging.section('aborted')}>${
846
846
  lockedString(UIStringsNotTranslate.stoppedResponse)}</p>`;
847
847
  }
@@ -952,7 +952,7 @@ function renderChatMessage({
952
952
  }
953
953
 
954
954
  function renderImageChatMessage(inlineData: Host.AidaClient.MediaBlob): Lit.LitTemplate {
955
- if (inlineData.data === AiAssistanceModel.NOT_FOUND_IMAGE_DATA) {
955
+ if (inlineData.data === AiAssistanceModel.AiHistoryStorage.NOT_FOUND_IMAGE_DATA) {
956
956
  // clang-format off
957
957
  return html`<div class="unavailable-image" title=${UIStringsNotTranslate.imageUnavailable}>
958
958
  <devtools-icon name='file-image'></devtools-icon>
@@ -970,7 +970,7 @@ function renderImageChatMessage(inlineData: Host.AidaClient.MediaBlob): Lit.LitT
970
970
  // clang-format on
971
971
  }
972
972
 
973
- function renderContextIcon(context: AiAssistanceModel.ConversationContext<unknown>|null): Lit.LitTemplate {
973
+ function renderContextIcon(context: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null): Lit.LitTemplate {
974
974
  if (!context) {
975
975
  return Lit.nothing;
976
976
  }
@@ -983,7 +983,7 @@ function renderContextIcon(context: AiAssistanceModel.ConversationContext<unknow
983
983
  if (item instanceof Workspace.UISourceCode.UISourceCode) {
984
984
  return PanelUtils.PanelUtils.getIconForSourceFile(item);
985
985
  }
986
- if (item instanceof AiAssistanceModel.AgentFocus) {
986
+ if (item instanceof AiAssistanceModel.AIContext.AgentFocus) {
987
987
  return html`<devtools-icon name="performance" title="Performance"></devtools-icon>`;
988
988
  }
989
989
  if (item instanceof SDK.DOMModel.DOMNode) {
@@ -993,12 +993,12 @@ function renderContextIcon(context: AiAssistanceModel.ConversationContext<unknow
993
993
  }
994
994
 
995
995
  function renderContextTitle(
996
- context: AiAssistanceModel.ConversationContext<unknown>, disabled: boolean): Lit.TemplateResult|string {
996
+ context: AiAssistanceModel.AiAgent.ConversationContext<unknown>, disabled: boolean): Lit.TemplateResult|string {
997
997
  const item = context.getItem();
998
998
  if (item instanceof SDK.DOMModel.DOMNode) {
999
999
  // FIXME: move this to the model code.
1000
- const hiddenClassList =
1001
- item.classNames().filter(className => className.startsWith(AiAssistanceModel.AI_ASSISTANCE_CSS_CLASS_NAME));
1000
+ const hiddenClassList = item.classNames().filter(
1001
+ className => className.startsWith(AiAssistanceModel.Injected.AI_ASSISTANCE_CSS_CLASS_NAME));
1002
1002
  return html`<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(ElementsPanel.DOMLinkifier.DOMNodeLink, {
1003
1003
  node: item,
1004
1004
  options: {hiddenClassList, disabled}
@@ -1015,19 +1015,19 @@ function renderSelection({
1015
1015
  onContextClick,
1016
1016
  onInspectElementClick,
1017
1017
  }: {
1018
- selectedContext: AiAssistanceModel.ConversationContext<unknown>|null,
1018
+ selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null,
1019
1019
  inspectElementToggled: boolean,
1020
1020
  isTextInputDisabled: boolean,
1021
1021
  onContextClick: () => void | Promise<void>,
1022
1022
  onInspectElementClick: () => void,
1023
- conversationType?: AiAssistanceModel.ConversationType,
1023
+ conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType,
1024
1024
  }): Lit.LitTemplate {
1025
1025
  if (!conversationType) {
1026
1026
  return Lit.nothing;
1027
1027
  }
1028
1028
 
1029
1029
  // TODO: currently the picker behavior is SDKNode specific.
1030
- const hasPickerBehavior = conversationType === AiAssistanceModel.ConversationType.STYLING;
1030
+ const hasPickerBehavior = conversationType === AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING;
1031
1031
 
1032
1032
  const resourceClass = Lit.Directives.classMap({
1033
1033
  'not-selected': !selectedContext,
@@ -1106,7 +1106,7 @@ function renderMessages({
1106
1106
  onCopyResponseClick: (message: ModelChatMessage) => void,
1107
1107
  onMessageContainerRef: (el: Element|undefined) => void,
1108
1108
  changeSummary?: string,
1109
- changeManager?: AiAssistanceModel.ChangeManager,
1109
+ changeManager?: AiAssistanceModel.ChangeManager.ChangeManager,
1110
1110
  }): Lit.TemplateResult {
1111
1111
  function renderPatchWidget(): Lit.LitTemplate {
1112
1112
  if (isLoading) {
@@ -1148,7 +1148,7 @@ function renderMessages({
1148
1148
 
1149
1149
  function renderEmptyState({isTextInputDisabled, suggestions, onSuggestionClick}: {
1150
1150
  isTextInputDisabled: boolean,
1151
- suggestions: AiAssistanceModel.ConversationSuggestion[],
1151
+ suggestions: AiAssistanceModel.AiAgent.ConversationSuggestion[],
1152
1152
  onSuggestionClick: (suggestion: string) => void,
1153
1153
  }): Lit.TemplateResult {
1154
1154
  // clang-format off
@@ -1184,7 +1184,7 @@ function renderEmptyState({isTextInputDisabled, suggestions, onSuggestionClick}:
1184
1184
 
1185
1185
  function renderReadOnlySection({onNewConversation, conversationType}: {
1186
1186
  onNewConversation: () => void,
1187
- conversationType?: AiAssistanceModel.ConversationType,
1187
+ conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType,
1188
1188
  }): Lit.LitTemplate {
1189
1189
  if (!conversationType) {
1190
1190
  return Lit.nothing;
@@ -1437,7 +1437,7 @@ function renderChatInput({
1437
1437
  isTextInputDisabled: boolean,
1438
1438
  inputPlaceholder: Platform.UIString.LocalizedString,
1439
1439
  state: State,
1440
- selectedContext: AiAssistanceModel.ConversationContext<unknown>|null,
1440
+ selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null,
1441
1441
  inspectElementToggled: boolean,
1442
1442
  isTextInputEmpty: boolean,
1443
1443
  aidaAvailability: Host.AidaClient.AidaAccessPreconditions,
@@ -1450,7 +1450,7 @@ function renderChatInput({
1450
1450
  onNewConversation: () => void,
1451
1451
  onTextInputChange: (input: string) => void,
1452
1452
  multimodalInputEnabled?: boolean,
1453
- conversationType?: AiAssistanceModel.ConversationType,
1453
+ conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType,
1454
1454
  imageInput?: ImageInputData,
1455
1455
  uploadImageInputEnabled?: boolean,
1456
1456
  onTakeScreenshot?: () => void,
@@ -1606,15 +1606,15 @@ function renderMainContents({
1606
1606
  isReadOnly: boolean,
1607
1607
  canShowFeedbackForm: boolean,
1608
1608
  isTextInputDisabled: boolean,
1609
- suggestions: AiAssistanceModel.ConversationSuggestion[],
1609
+ suggestions: AiAssistanceModel.AiAgent.ConversationSuggestion[],
1610
1610
  userInfo: Pick<Host.InspectorFrontendHostAPI.SyncInformation, 'accountImage'|'accountFullName'>,
1611
1611
  markdownRenderer: MarkdownLitRenderer,
1612
- changeManager: AiAssistanceModel.ChangeManager,
1612
+ changeManager: AiAssistanceModel.ChangeManager.ChangeManager,
1613
1613
  onSuggestionClick: (suggestion: string) => void,
1614
1614
  onFeedbackSubmit: (rpcId: Host.AidaClient.RpcGlobalId, rate: Host.AidaClient.Rating, feedback?: string) => void,
1615
1615
  onCopyResponseClick: (message: ModelChatMessage) => void,
1616
1616
  onMessageContainerRef: (el: Element|undefined) => void,
1617
- conversationType?: AiAssistanceModel.ConversationType,
1617
+ conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType,
1618
1618
  changeSummary?: string,
1619
1619
  }): Lit.LitTemplate {
1620
1620
  if (state === State.CONSENT_VIEW) {
@@ -363,6 +363,7 @@ export class UserActionRow extends UI.Widget.Widget implements UserActionRowWidg
363
363
  };
364
364
 
365
365
  override willHide(): void {
366
+ super.willHide();
366
367
  this.#suggestionsResizeObserver.disconnect();
367
368
  }
368
369
 
@@ -374,6 +374,7 @@ export class AnimationTimeline extends UI.Widget.VBox implements
374
374
  }
375
375
 
376
376
  override willHide(): void {
377
+ super.willHide();
377
378
  for (const animationModel of SDK.TargetManager.TargetManager.instance().models(
378
379
  SDK.AnimationModel.AnimationModel, {scoped: true})) {
379
380
  this.removeEventListeners(animationModel);
@@ -232,6 +232,7 @@ export class CookieItemsView extends UI.Widget.VBox {
232
232
  }
233
233
 
234
234
  override wasShown(): void {
235
+ super.wasShown();
235
236
  this.refreshItems();
236
237
  }
237
238
 
@@ -182,6 +182,7 @@ export abstract class KeyValueStorageItemsView extends UI.Widget.VBox {
182
182
  }
183
183
 
184
184
  override wasShown(): void {
185
+ super.wasShown();
185
186
  this.refreshItems();
186
187
  }
187
188
 
@@ -184,12 +184,14 @@ export class ServiceWorkerCacheView extends UI.View.SimpleView {
184
184
  }
185
185
 
186
186
  override wasShown(): void {
187
+ super.wasShown();
187
188
  this.model.addEventListener(
188
189
  SDK.ServiceWorkerCacheModel.Events.CACHE_STORAGE_CONTENT_UPDATED, this.cacheContentUpdated, this);
189
190
  void this.updateData(true);
190
191
  }
191
192
 
192
193
  override willHide(): void {
194
+ super.willHide();
193
195
  this.model.removeEventListener(
194
196
  SDK.ServiceWorkerCacheModel.Events.CACHE_STORAGE_CONTENT_UPDATED, this.cacheContentUpdated, this);
195
197
  }
@@ -258,6 +258,12 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
258
258
  // clang-format on
259
259
  }
260
260
 
261
+ #isPrerenderLike(speculationAction: Protocol.Preload.SpeculationAction): boolean {
262
+ return [
263
+ Protocol.Preload.SpeculationAction.Prerender, Protocol.Preload.SpeculationAction.PrerenderUntilScript
264
+ ].includes(speculationAction);
265
+ }
266
+
261
267
  #action(isFallbackToPrefetch: boolean): Lit.LitTemplate {
262
268
  assertNotNullOrUndefined(this.#data);
263
269
  const attempt = this.#data.pipeline.getOriginallyTriggered();
@@ -271,7 +277,7 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
271
277
 
272
278
  let maybeInspectButton: Lit.LitTemplate = Lit.nothing;
273
279
  (() => {
274
- if (attempt.action !== Protocol.Preload.SpeculationAction.Prerender) {
280
+ if (!this.#isPrerenderLike(attempt.action)) {
275
281
  return;
276
282
  }
277
283
 
@@ -359,8 +365,7 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
359
365
  #targetHint(): Lit.LitTemplate {
360
366
  assertNotNullOrUndefined(this.#data);
361
367
  const attempt = this.#data.pipeline.getOriginallyTriggered();
362
- const hasTargetHint =
363
- attempt.action === Protocol.Preload.SpeculationAction.Prerender && attempt.key.targetHint !== undefined;
368
+ const hasTargetHint = this.#isPrerenderLike(attempt.action) && attempt.key.targetHint !== undefined;
364
369
  if (!hasTargetHint) {
365
370
  return Lit.nothing;
366
371
  }
@@ -377,11 +382,12 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
377
382
  assertNotNullOrUndefined(this.#data);
378
383
  const attempt = this.#data.pipeline.getOriginallyTriggered();
379
384
 
380
- if (attempt.action !== Protocol.Preload.SpeculationAction.Prerender) {
385
+ if (!this.#isPrerenderLike(attempt.action)) {
381
386
  return Lit.nothing;
382
387
  }
383
388
 
384
- const failureReason = prerenderFailureReason(attempt);
389
+ const failureReason = prerenderFailureReason(
390
+ attempt as SDK.PreloadingModel.PrerenderAttempt | SDK.PreloadingModel.PrerenderUntilScriptAttempt);
385
391
  if (failureReason === null) {
386
392
  return Lit.nothing;
387
393
  }
@@ -39,12 +39,12 @@ const {render, html} = Lit;
39
39
 
40
40
  export class PreloadingMismatchedHeadersGrid extends LegacyWrapper.LegacyWrapper.WrappableComponent<UI.Widget.VBox> {
41
41
  readonly #shadow = this.attachShadow({mode: 'open'});
42
- #data: SDK.PreloadingModel.PrerenderAttempt|null = null;
42
+ #data: SDK.PreloadingModel.PrerenderAttempt|SDK.PreloadingModel.PrerenderUntilScriptAttempt|null = null;
43
43
  connectedCallback(): void {
44
44
  this.#render();
45
45
  }
46
46
 
47
- set data(data: SDK.PreloadingModel.PrerenderAttempt) {
47
+ set data(data: SDK.PreloadingModel.PrerenderAttempt|SDK.PreloadingModel.PrerenderUntilScriptAttempt) {
48
48
  if (data.mismatchedHeaders === null) {
49
49
  return;
50
50
  }
@@ -535,7 +535,8 @@ export function prefetchFailureReason({prefetchStatus}: SDK.PreloadingModel.Pref
535
535
  }
536
536
 
537
537
  /** Detailed failure reason for PrerenderFinalStatus. **/
538
- export function prerenderFailureReason(attempt: SDK.PreloadingModel.PrerenderAttempt): string|null {
538
+ export function prerenderFailureReason(
539
+ attempt: SDK.PreloadingModel.PrerenderAttempt|SDK.PreloadingModel.PrerenderUntilScriptAttempt): string|null {
539
540
  // If you face an error on rolling CDP changes, see
540
541
  // https://docs.google.com/document/d/1PnrfowsZMt62PX1EvvTp2Nqs3ji1zrklrAEe1JYbkTk
541
542
  switch (attempt.prerenderStatus) {
@@ -730,14 +731,13 @@ export function ruleSetTagOrLocationShort(
730
731
  }
731
732
 
732
733
  export function capitalizedAction(action: Protocol.Preload.SpeculationAction): Common.UIString.LocalizedString {
733
- // Use "prefetch"/"prerender" as is in SpeculationRules.
734
734
  switch (action) {
735
735
  case Protocol.Preload.SpeculationAction.Prefetch:
736
736
  return i18n.i18n.lockedString('Prefetch');
737
737
  case Protocol.Preload.SpeculationAction.Prerender:
738
738
  return i18n.i18n.lockedString('Prerender');
739
739
  case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
740
- return i18n.i18n.lockedString('PrerenderUntilScript');
740
+ return i18n.i18n.lockedString('Prerender until script');
741
741
  }
742
742
  }
743
743
 
@@ -778,8 +778,10 @@ export function composedStatus(attempt: SDK.PreloadingModel.PreloadingAttempt):
778
778
  const detail = prefetchFailureReason(attempt) ?? i18n.i18n.lockedString('Internal error');
779
779
  return short + ' - ' + detail;
780
780
  }
781
- case Protocol.Preload.SpeculationAction.Prerender: {
782
- const detail = prerenderFailureReason(attempt);
781
+ case Protocol.Preload.SpeculationAction.Prerender:
782
+ case Protocol.Preload.SpeculationAction.PrerenderUntilScript: {
783
+ const detail = prerenderFailureReason(
784
+ attempt as SDK.PreloadingModel.PrerenderAttempt | SDK.PreloadingModel.PrerenderUntilScriptAttempt);
783
785
  assertNotNullOrUndefined(detail);
784
786
  return short + ' - ' + detail;
785
787
  }
@@ -183,30 +183,40 @@ export class UsedPreloadingView extends LegacyWrapper.LegacyWrapper.WrappableCom
183
183
  // clang-format on
184
184
  }
185
185
 
186
+ #isPrerenderLike(speculationAction: Protocol.Preload.SpeculationAction): boolean {
187
+ return [
188
+ Protocol.Preload.SpeculationAction.Prerender, Protocol.Preload.SpeculationAction.PrerenderUntilScript
189
+ ].includes(speculationAction);
190
+ }
191
+
192
+ #isPrerenderAttempt(attempt: SDK.PreloadingModel.PreloadingAttempt):
193
+ attempt is SDK.PreloadingModel.PrerenderAttempt|SDK.PreloadingModel.PrerenderUntilScriptAttempt {
194
+ return this.#isPrerenderLike(attempt.action);
195
+ }
196
+
186
197
  #speculativeLoadingStatusForThisPageSections(): Lit.LitTemplate {
187
198
  const pageURL = Common.ParsedURL.ParsedURL.urlWithoutHash(this.#data.pageURL);
188
199
  const forThisPage = this.#data.previousAttempts.filter(
189
200
  attempt => Common.ParsedURL.ParsedURL.urlWithoutHash(attempt.key.url) === pageURL);
190
201
  const prefetch =
191
202
  forThisPage.filter(attempt => attempt.key.action === Protocol.Preload.SpeculationAction.Prefetch)[0];
192
- const prerender =
193
- forThisPage.filter(attempt => attempt.key.action === Protocol.Preload.SpeculationAction.Prerender)[0];
203
+ const prerenderLike = forThisPage.filter(attempt => this.#isPrerenderLike(attempt.action))[0];
194
204
 
195
205
  let kind = UsedKind.NO_PRELOADS;
196
206
  // Prerender -> prefetch downgrade case
197
207
  //
198
208
  // This code does not handle the case SpecRules designate these preloads rather than prerenderer automatically downgrade prerendering.
199
209
  // TODO(https://crbug.com/1410709): Improve this logic once automatic downgrade implemented.
200
- if (prerender?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
210
+ if (prerenderLike?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
201
211
  prefetch?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS) {
202
212
  kind = UsedKind.DOWNGRADED_PRERENDER_TO_PREFETCH_AND_USED;
203
213
  } else if (prefetch?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS) {
204
214
  kind = UsedKind.PREFETCH_USED;
205
- } else if (prerender?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS) {
215
+ } else if (prerenderLike?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS) {
206
216
  kind = UsedKind.PRERENDER_USED;
207
217
  } else if (prefetch?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE) {
208
218
  kind = UsedKind.PREFETCH_FAILED;
209
- } else if (prerender?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE) {
219
+ } else if (prerenderLike?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE) {
210
220
  kind = UsedKind.PRERENDER_FAILED;
211
221
  } else {
212
222
  kind = UsedKind.NO_PRELOADS;
@@ -246,8 +256,9 @@ export class UsedPreloadingView extends LegacyWrapper.LegacyWrapper.WrappableCom
246
256
  assertNotNullOrUndefined(prefetch);
247
257
  maybeFailureReasonMessage = prefetchFailureReason(prefetch as SDK.PreloadingModel.PrefetchAttempt);
248
258
  } else if (kind === UsedKind.PRERENDER_FAILED || kind === UsedKind.DOWNGRADED_PRERENDER_TO_PREFETCH_AND_USED) {
249
- assertNotNullOrUndefined(prerender);
250
- maybeFailureReasonMessage = prerenderFailureReason(prerender as SDK.PreloadingModel.PrerenderAttempt);
259
+ assertNotNullOrUndefined(prerenderLike);
260
+ maybeFailureReasonMessage = prerenderFailureReason(
261
+ prerenderLike as SDK.PreloadingModel.PrerenderAttempt | SDK.PreloadingModel.PrerenderUntilScriptAttempt);
251
262
  }
252
263
 
253
264
  let maybeFailureReason: Lit.LitTemplate = Lit.nothing;
@@ -323,8 +334,7 @@ export class UsedPreloadingView extends LegacyWrapper.LegacyWrapper.WrappableCom
323
334
 
324
335
  #maybeMismatchedHTTPHeadersSections(): Lit.LitTemplate {
325
336
  const attempt = this.#data.previousAttempts.find(
326
- attempt =>
327
- attempt.action === Protocol.Preload.SpeculationAction.Prerender && attempt.mismatchedHeaders !== null);
337
+ attempt => this.#isPrerenderAttempt(attempt) && attempt.mismatchedHeaders !== null);
328
338
  if (attempt === undefined) {
329
339
  return Lit.nothing;
330
340
  }
@@ -342,7 +352,9 @@ export class UsedPreloadingView extends LegacyWrapper.LegacyWrapper.WrappableCom
342
352
  <devtools-report-section-header>${i18nString(UIStrings.mismatchedHeadersDetail)}</devtools-report-section-header>
343
353
  <devtools-report-section>
344
354
  <devtools-resources-preloading-mismatched-headers-grid
345
- .data=${attempt as SDK.PreloadingModel.PrerenderAttempt}></devtools-resources-preloading-mismatched-headers-grid>
355
+ .data=${
356
+ attempt as SDK.PreloadingModel.PrerenderAttempt |
357
+ SDK.PreloadingModel.PrerenderUntilScriptAttempt}></devtools-resources-preloading-mismatched-headers-grid>
346
358
  </devtools-report-section>
347
359
  `;
348
360
  // clang-format on
@@ -140,6 +140,7 @@ export class CombinedDiffView extends UI.Widget.Widget {
140
140
  }
141
141
 
142
142
  override willHide(): void {
143
+ super.willHide();
143
144
  this.#workspaceDiff?.removeEventListener(
144
145
  WorkspaceDiff.WorkspaceDiff.Events.MODIFIED_STATUS_CHANGED, this.#onDiffModifiedStatusChanged, this);
145
146
  }
@@ -0,0 +1,106 @@
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 i18n from '../../core/i18n/i18n.js';
8
+ import * as UI from '../../ui/legacy/legacy.js';
9
+ import * as Lit from '../../ui/lit/lit.js';
10
+
11
+ import consoleInsightTeaserStyles from './consoleInsightTeaser.css.js';
12
+ import type {ConsoleViewMessage} from './ConsoleViewMessage.js';
13
+
14
+ const {render, html} = Lit;
15
+
16
+ const UIStringsNotTranslate = {
17
+ /**
18
+ * @description Header text during loading state while an AI summary is being generated
19
+ */
20
+ summarizing: 'Summarizing…',
21
+ /**
22
+ * @description Label for an animation shown while an AI response is being generated
23
+ */
24
+ loading: 'Loading',
25
+ } as const;
26
+
27
+ const lockedString = i18n.i18n.lockedString;
28
+
29
+ interface ViewInput {
30
+ // If multiple ConsoleInsightTeasers exist, each one needs a unique id. Otherwise showing and
31
+ // hiding of the tooltip, and rendering the loading animation, does not work correctly.
32
+ uuid: String;
33
+ isInactive: boolean;
34
+ }
35
+
36
+ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
37
+ if (input.isInactive) {
38
+ render(Lit.nothing, target);
39
+ return;
40
+ }
41
+
42
+ // clang-format off
43
+ render(html`
44
+ <style>${consoleInsightTeaserStyles}</style>
45
+ <devtools-tooltip
46
+ id=${'teaser-' + input.uuid}
47
+ hover-delay=500
48
+ variant="rich"
49
+ vertical-distance-increase=-6
50
+ prefer-span-left
51
+ >
52
+ <div class="teaser-tooltip-container">
53
+ <h2 tabindex="-1">${lockedString(UIStringsNotTranslate.summarizing)}</h2>
54
+ <div
55
+ role="presentation"
56
+ aria-label=${lockedString(UIStringsNotTranslate.loading)}
57
+ class="loader"
58
+ style="clip-path: url(${'#clipPath-' + input.uuid});"
59
+ >
60
+ <svg width="100%" height="52">
61
+ <defs>
62
+ <clipPath id=${'clipPath-' + input.uuid}>
63
+ <rect x="0" y="0" width="100%" height="12" rx="8"></rect>
64
+ <rect x="0" y="20" width="100%" height="12" rx="8"></rect>
65
+ <rect x="0" y="40" width="100%" height="12" rx="8"></rect>
66
+ </clipPath>
67
+ </defs>
68
+ </svg>
69
+ </div>
70
+ </div>
71
+ </devtools-tooltip>
72
+ `, target);
73
+ // clang-format on
74
+ };
75
+
76
+ export type View = typeof DEFAULT_VIEW;
77
+
78
+ export class ConsoleInsightTeaser extends UI.Widget.Widget {
79
+ #view: View;
80
+ #uuid: String;
81
+ #isInactive = false;
82
+
83
+ constructor(uuid: String, consoleViewMessage: ConsoleViewMessage, element?: HTMLElement, view?: View) {
84
+ super(element);
85
+ this.#view = view ?? DEFAULT_VIEW;
86
+ this.#uuid = uuid;
87
+ this.requestUpdate();
88
+ }
89
+
90
+ setInactive(isInactive: boolean): void {
91
+ if (this.#isInactive === isInactive) {
92
+ return;
93
+ }
94
+ this.#isInactive = isInactive;
95
+ this.requestUpdate();
96
+ }
97
+
98
+ override performUpdate(): Promise<void>|void {
99
+ this.#view(
100
+ {
101
+ uuid: this.#uuid,
102
+ isInactive: this.#isInactive,
103
+ },
104
+ undefined, this.contentElement);
105
+ }
106
+ }
@@ -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
  }