chrome-devtools-frontend 1.0.1550444 → 1.0.1555174

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 (466) hide show
  1. package/docs/styleguide/ux/components.md +34 -8
  2. package/eslint.config.mjs +7 -0
  3. package/front_end/Images/generate-css-vars.js +8 -4
  4. package/front_end/Images/src/spark.svg +10 -0
  5. package/front_end/core/common/Settings.ts +20 -8
  6. package/front_end/core/host/UserMetrics.ts +3 -1
  7. package/front_end/core/i18n/collect-ui-strings.js +19 -10
  8. package/front_end/core/i18n/generate-locales-js.js +4 -4
  9. package/front_end/core/protocol_client/CDPConnection.ts +1 -0
  10. package/front_end/core/protocol_client/InspectorBackend.ts +5 -1
  11. package/front_end/core/root/Runtime.ts +0 -12
  12. package/front_end/core/sdk/DOMModel.ts +38 -3
  13. package/front_end/core/sdk/DebuggerModel.ts +9 -4
  14. package/front_end/core/sdk/IsolateManager.ts +7 -0
  15. package/front_end/core/sdk/PageResourceLoader.ts +3 -3
  16. package/front_end/core/sdk/RehydratingConnection.ts +5 -2
  17. package/front_end/core/sdk/ResourceTreeModel.ts +0 -1
  18. package/front_end/entrypoints/main/MainImpl.ts +28 -10
  19. package/front_end/generated/SupportedCSSProperties.js +32 -0
  20. package/front_end/models/ai_assistance/AiConversation.ts +94 -4
  21. package/front_end/models/ai_assistance/agents/AiAgent.ts +30 -15
  22. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +179 -41
  23. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +5 -0
  24. package/front_end/models/ai_assistance/agents/StylingAgent.ts +62 -0
  25. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +2 -1
  26. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +1 -7
  27. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +124 -12
  28. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +125 -30
  29. package/front_end/models/ai_assistance/performance/AICallTree.ts +42 -0
  30. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +12 -0
  31. package/front_end/models/issues_manager/Issue.ts +1 -0
  32. package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
  33. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  34. package/front_end/models/issues_manager/PermissionElementIssue.ts +262 -0
  35. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabled.md +7 -0
  36. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  37. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  38. package/front_end/models/issues_manager/descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  39. package/front_end/models/issues_manager/descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  40. package/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooLarge.md +5 -0
  41. package/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooSmall.md +5 -0
  42. package/front_end/models/issues_manager/descriptions/permissionElementGeolocationDeprecated.md +5 -0
  43. package/front_end/models/issues_manager/descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  44. package/front_end/models/issues_manager/descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  45. package/front_end/models/issues_manager/descriptions/permissionElementInvalidSizeValue.md +5 -0
  46. package/front_end/models/issues_manager/descriptions/permissionElementInvalidType.md +5 -0
  47. package/front_end/models/issues_manager/descriptions/permissionElementInvalidTypeActivation.md +5 -0
  48. package/front_end/models/issues_manager/descriptions/permissionElementLowContrast.md +5 -0
  49. package/front_end/models/issues_manager/descriptions/permissionElementNonOpaqueColor.md +5 -0
  50. package/front_end/models/issues_manager/descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  51. package/front_end/models/issues_manager/descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  52. package/front_end/models/issues_manager/descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  53. package/front_end/models/issues_manager/descriptions/permissionElementRegistrationFailed.md +5 -0
  54. package/front_end/models/issues_manager/descriptions/permissionElementRequestInProgress.md +5 -0
  55. package/front_end/models/issues_manager/descriptions/permissionElementSecurityChecksFailed.md +5 -0
  56. package/front_end/models/issues_manager/descriptions/permissionElementTypeNotSupported.md +5 -0
  57. package/front_end/models/issues_manager/descriptions/permissionElementUntrustedEvent.md +7 -0
  58. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  59. package/front_end/models/javascript_metadata/NativeFunctions.js +23 -23
  60. package/front_end/models/stack_trace/StackTraceModel.ts +37 -18
  61. package/front_end/models/trace/Processor.ts +14 -15
  62. package/front_end/models/trace/insights/Common.ts +2 -8
  63. package/front_end/models/trace/insights/types.ts +12 -2
  64. package/front_end/models/trace/types/TraceEvents.ts +4 -1
  65. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +28 -6
  66. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +9 -23
  67. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  68. package/front_end/panels/ai_assistance/components/ChatView.ts +78 -2
  69. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +71 -0
  70. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +126 -0
  71. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +131 -2
  72. package/front_end/panels/ai_assistance/components/chatView.css +28 -0
  73. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +33 -0
  74. package/front_end/panels/application/AppManifestView.ts +1007 -521
  75. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -17
  76. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -6
  77. package/front_end/panels/application/ExtensionStorageItemsView.ts +3 -5
  78. package/front_end/panels/application/KeyValueStorageItemsView.ts +3 -2
  79. package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
  80. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +133 -118
  81. package/front_end/panels/application/preloading/PreloadingView.ts +46 -45
  82. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +80 -75
  83. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +169 -133
  84. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +74 -93
  85. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +142 -117
  86. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +51 -11
  87. package/front_end/panels/application/preloading/components/components.ts +0 -2
  88. package/front_end/panels/common/Annotation.ts +184 -0
  89. package/front_end/panels/common/AnnotationManager.ts +148 -11
  90. package/front_end/panels/common/ExtensionView.ts +47 -0
  91. package/front_end/panels/common/PersistenceUtils.ts +22 -25
  92. package/front_end/panels/common/annotation.css +40 -0
  93. package/front_end/panels/common/common.ts +1 -0
  94. package/front_end/panels/console/ConsoleInsightTeaser.ts +187 -5
  95. package/front_end/panels/console/ConsolePinPane.ts +437 -217
  96. package/front_end/panels/console/ConsolePrompt.ts +32 -223
  97. package/front_end/panels/console/ConsoleView.ts +67 -66
  98. package/front_end/panels/console/ConsoleViewMessage.ts +8 -3
  99. package/front_end/panels/console/consoleInsightTeaser.css +23 -0
  100. package/front_end/panels/console/consoleView.css +1 -1
  101. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +89 -0
  102. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +2 -2
  103. package/front_end/panels/elements/ComputedStyleWidget.ts +16 -5
  104. package/front_end/panels/elements/ElementsPanel.ts +38 -12
  105. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -3
  106. package/front_end/panels/elements/ElementsTreeElement.ts +313 -353
  107. package/front_end/panels/elements/ElementsTreeOutline.ts +39 -13
  108. package/front_end/panels/elements/StylePropertyTreeElement.ts +15 -14
  109. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  110. package/front_end/panels/emulation/MediaQueryInspector.ts +171 -125
  111. package/front_end/panels/explain/components/ConsoleInsight.ts +175 -150
  112. package/front_end/panels/explain/components/consoleInsight.css +348 -347
  113. package/front_end/panels/issues/AffectedPermissionElementsView.ts +46 -0
  114. package/front_end/panels/issues/IssueView.ts +2 -0
  115. package/front_end/panels/issues/IssuesPane.ts +6 -0
  116. package/front_end/panels/layer_viewer/LayerDetailsView.ts +165 -149
  117. package/front_end/panels/layer_viewer/Layers3DView.ts +131 -78
  118. package/front_end/panels/lighthouse/LighthouseStatusView.ts +149 -100
  119. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +90 -64
  120. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +25 -34
  121. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +60 -44
  122. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +170 -151
  123. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +50 -51
  124. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +0 -13
  125. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +20 -18
  126. package/front_end/panels/mobile_throttling/CalibrationController.ts +3 -1
  127. package/front_end/panels/network/NetworkDataGridNode.ts +14 -6
  128. package/front_end/panels/network/NetworkItemView.ts +42 -3
  129. package/front_end/panels/network/NetworkLogView.ts +10 -11
  130. package/front_end/panels/network/NetworkPanel.ts +63 -1
  131. package/front_end/panels/network/RequestInitiatorView.ts +146 -113
  132. package/front_end/panels/network/components/RequestHeaderSection.css +51 -50
  133. package/front_end/panels/network/components/RequestHeaderSection.ts +81 -71
  134. package/front_end/panels/network/components/RequestHeadersView.css +1 -1
  135. package/front_end/panels/network/components/RequestHeadersView.ts +26 -11
  136. package/front_end/panels/network/components/RequestTrustTokensView.css +24 -14
  137. package/front_end/panels/network/components/RequestTrustTokensView.ts +144 -140
  138. package/front_end/panels/profiler/IsolateSelector.ts +2 -1
  139. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +49 -33
  140. package/front_end/panels/recorder/RecorderController.ts +2 -3
  141. package/front_end/panels/recorder/components/ControlButton.ts +68 -34
  142. package/front_end/panels/recorder/components/CreateRecordingView.ts +9 -6
  143. package/front_end/panels/recorder/components/RecordingView.ts +81 -88
  144. package/front_end/panels/recorder/components/ReplaySection.ts +226 -145
  145. package/front_end/panels/recorder/{controllers → components}/SelectorPicker.ts +129 -52
  146. package/front_end/panels/recorder/components/StepEditor.ts +21 -67
  147. package/front_end/panels/recorder/components/StepView.ts +222 -180
  148. package/front_end/panels/recorder/components/TimelineSection.ts +69 -48
  149. package/front_end/panels/recorder/components/components.ts +2 -2
  150. package/front_end/panels/recorder/components/selectorPicker.css +14 -0
  151. package/front_end/panels/recorder/components/stepEditor.css +0 -5
  152. package/front_end/panels/recorder/components/stepView.css +196 -198
  153. package/front_end/panels/recorder/extensions/ExtensionManager.ts +4 -48
  154. package/front_end/panels/recorder/models/ScreenshotUtils.ts +17 -11
  155. package/front_end/panels/security/CookieControlsView.ts +30 -26
  156. package/front_end/panels/settings/components/SyncSection.ts +0 -1
  157. package/front_end/panels/sources/CSSPlugin.ts +3 -3
  158. package/front_end/panels/sources/CallStackSidebarPane.ts +60 -75
  159. package/front_end/panels/sources/SourcesPanel.ts +1 -11
  160. package/front_end/panels/sources/TabbedEditorContainer.ts +11 -8
  161. package/front_end/panels/sources/ThreadsSidebarPane.ts +96 -101
  162. package/front_end/panels/sources/threadsSidebarPane.css +6 -5
  163. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +0 -1
  164. package/front_end/panels/timeline/InteractionsTrackAppender.ts +2 -3
  165. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +23 -33
  166. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +4 -3
  167. package/front_end/panels/timeline/TimelineFlameChartView.ts +12 -0
  168. package/front_end/panels/timeline/TimelinePanel.ts +3 -5
  169. package/front_end/panels/timeline/components/IgnoreListSetting.ts +164 -142
  170. package/front_end/panels/timeline/components/InteractionBreakdown.ts +48 -28
  171. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +18 -23
  172. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +98 -73
  173. package/front_end/panels/timeline/components/Sidebar.ts +16 -7
  174. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +174 -137
  175. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +262 -291
  176. package/front_end/panels/timeline/components/Utils.ts +25 -0
  177. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +210 -146
  178. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +8 -20
  179. package/front_end/panels/timeline/components/insights/Cache.ts +0 -9
  180. package/front_end/panels/timeline/components/insights/Checklist.ts +53 -43
  181. package/front_end/panels/timeline/components/insights/DOMSize.ts +11 -33
  182. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +6 -12
  183. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +0 -9
  184. package/front_end/panels/timeline/components/insights/EventRef.ts +47 -109
  185. package/front_end/panels/timeline/components/insights/FontDisplay.ts +0 -9
  186. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +0 -9
  187. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +0 -9
  188. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -10
  189. package/front_end/panels/timeline/components/insights/ImageRef.ts +112 -0
  190. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +91 -0
  191. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +0 -9
  192. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +11 -14
  193. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +0 -9
  194. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +0 -9
  195. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +6 -21
  196. package/front_end/panels/timeline/components/insights/NodeLink.ts +68 -43
  197. package/front_end/panels/timeline/components/insights/README.md +2 -3
  198. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +0 -9
  199. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +0 -9
  200. package/front_end/panels/timeline/components/insights/ThirdParties.ts +0 -9
  201. package/front_end/panels/timeline/components/insights/Viewport.ts +7 -19
  202. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +5 -0
  203. package/front_end/panels/timeline/components/insights/insights.ts +2 -0
  204. package/front_end/panels/timeline/components/interactionBreakdown.css +15 -13
  205. package/front_end/panels/timeline/components/sidebarInsightsTab.css +50 -48
  206. package/front_end/panels/timeline/enable-easter-egg.js +7 -3
  207. package/front_end/third_party/chromium/README.chromium +1 -1
  208. package/front_end/third_party/puppeteer/README.chromium +2 -2
  209. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  210. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  211. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.js +8 -0
  212. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.js.map +1 -0
  213. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +87 -0
  214. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  215. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts +2 -6
  217. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js +5 -24
  219. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +5 -0
  221. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  222. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.d.ts +1 -0
  224. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.d.ts.map +1 -1
  225. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.js.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  227. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  228. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js +42 -0
  229. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  230. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts +4 -1
  231. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
  232. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +10 -0
  233. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
  234. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  235. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  236. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js +90 -0
  237. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  238. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts +3 -1
  239. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  240. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +3 -2
  241. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  242. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +4 -1
  243. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  244. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +5 -2
  245. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  246. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +4 -0
  247. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +14 -2
  249. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  250. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js +7 -0
  252. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -1
  254. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  256. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  257. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js +30 -0
  258. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  259. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +5 -2
  260. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +22 -3
  262. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts +1 -1
  264. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts +2 -3
  266. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js +4 -6
  268. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.d.ts +2 -2
  270. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js +1 -1
  272. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +2 -0
  274. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +8 -0
  276. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  278. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js +8 -3
  279. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js.map +1 -1
  280. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.d.ts +1 -0
  281. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.d.ts.map +1 -1
  282. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.js +1 -0
  283. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.js.map +1 -1
  284. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +30 -0
  285. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  286. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +15 -0
  287. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  289. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -13
  292. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  293. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +5 -3
  294. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.js +17 -0
  296. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  298. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  299. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  300. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  301. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +221 -4
  304. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +182 -95
  305. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  306. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  307. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.js +7 -0
  308. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.js.map +1 -0
  309. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +87 -0
  310. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  312. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts +2 -6
  313. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.js +4 -22
  315. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +5 -0
  317. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  318. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  319. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.d.ts +1 -0
  320. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.js.map +1 -1
  322. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  323. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  324. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.js +38 -0
  325. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  326. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts +4 -1
  327. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
  328. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +10 -0
  329. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
  330. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  331. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  332. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js +85 -0
  333. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  334. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts +3 -1
  335. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +3 -2
  337. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  338. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +4 -1
  339. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +5 -2
  341. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +4 -0
  343. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  344. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +14 -2
  345. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  346. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
  347. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js +7 -0
  348. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js.map +1 -1
  349. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -1
  350. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  352. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  353. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.js +26 -0
  354. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  355. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +5 -2
  356. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +22 -3
  358. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts +1 -1
  360. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts +2 -3
  362. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  363. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js +2 -4
  364. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  365. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.d.ts +2 -2
  366. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  367. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js +2 -2
  368. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
  369. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +2 -0
  370. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  371. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +8 -0
  372. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  373. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  374. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js +8 -3
  375. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js.map +1 -1
  376. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.d.ts +1 -0
  377. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.d.ts.map +1 -1
  378. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.js +1 -0
  379. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.js.map +1 -1
  380. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +31 -1
  381. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  382. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +15 -0
  383. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  384. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts +1 -1
  385. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  386. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -13
  387. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  388. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts +5 -3
  389. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  390. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js +16 -1
  391. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -1
  392. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  393. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  394. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  395. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  396. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  397. package/front_end/third_party/puppeteer/package/lib/types.d.ts +221 -4
  398. package/front_end/third_party/puppeteer/package/package.json +4 -4
  399. package/front_end/third_party/puppeteer/package/src/api/BluetoothEmulation.ts +103 -0
  400. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +96 -1
  401. package/front_end/third_party/puppeteer/package/src/api/DeviceRequestPrompt.ts +2 -10
  402. package/front_end/third_party/puppeteer/package/src/api/Page.ts +6 -0
  403. package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
  404. package/front_end/third_party/puppeteer/package/src/bidi/BluetoothEmulation.ts +52 -0
  405. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +15 -0
  406. package/front_end/third_party/puppeteer/package/src/bidi/DeviceRequestPrompt.ts +138 -0
  407. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +7 -3
  408. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +10 -2
  409. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +30 -2
  410. package/front_end/third_party/puppeteer/package/src/bidi/util.ts +8 -0
  411. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +1 -1
  412. package/front_end/third_party/puppeteer/package/src/cdp/BluetoothEmulation.ts +47 -0
  413. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +33 -3
  414. package/front_end/third_party/puppeteer/package/src/cdp/CdpSession.ts +1 -1
  415. package/front_end/third_party/puppeteer/package/src/cdp/DeviceRequestPrompt.ts +3 -8
  416. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +2 -2
  417. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +9 -4
  418. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +13 -0
  419. package/front_end/third_party/puppeteer/package/src/cdp/WebWorker.ts +8 -3
  420. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  421. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +45 -1
  422. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +20 -0
  423. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +5 -17
  424. package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +23 -7
  425. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  426. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  427. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +4 -0
  428. package/front_end/ui/components/annotations/AnnotationRepository.ts +153 -13
  429. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -6
  430. package/front_end/ui/components/snackbars/Snackbars.docs.ts +0 -1
  431. package/front_end/ui/components/text_editor/AiCodeCompletionTeaserPlaceholder.ts +12 -3
  432. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +182 -0
  433. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  434. package/front_end/ui/helpers/OpenInNewTab.ts +5 -1
  435. package/front_end/ui/i18n/i18n.ts +9 -9
  436. package/front_end/ui/kit/icons/Icon.docs.ts +22 -65
  437. package/front_end/ui/kit/kit.ts +1 -0
  438. package/front_end/ui/kit/link/Link.docs.ts +15 -0
  439. package/front_end/ui/kit/link/Link.ts +151 -0
  440. package/front_end/ui/kit/link/link.css +27 -0
  441. package/front_end/ui/legacy/EmptyWidget.ts +6 -0
  442. package/front_end/ui/legacy/Floaty.ts +442 -0
  443. package/front_end/ui/legacy/InspectorView.ts +12 -0
  444. package/front_end/ui/legacy/ReportView.ts +1 -1
  445. package/front_end/ui/legacy/SelectMenu.docs.ts +0 -1
  446. package/front_end/ui/legacy/TabbedPane.ts +150 -65
  447. package/front_end/ui/legacy/Widget.ts +1 -3
  448. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -1
  449. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +36 -36
  450. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +22 -37
  451. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +31 -1
  452. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -2
  453. package/front_end/ui/legacy/components/utils/Linkifier.ts +7 -11
  454. package/front_end/ui/legacy/floaty.css +77 -0
  455. package/front_end/ui/legacy/legacy.ts +2 -0
  456. package/front_end/ui/legacy/tabbedPane.css +4 -7
  457. package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
  458. package/inspector_overlay/loadCSS.rollup.js +5 -4
  459. package/package.json +2 -2
  460. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +0 -99
  461. package/front_end/panels/recorder/components/SelectButton.ts +0 -304
  462. package/front_end/panels/recorder/controllers/controllers.ts +0 -7
  463. package/front_end/ui/components/chrome_link/ChromeLink.ts +0 -76
  464. package/front_end/ui/components/chrome_link/chromeLink.css +0 -12
  465. package/front_end/ui/components/chrome_link/chrome_link.ts +0 -9
  466. /package/front_end/panels/recorder/components/{selectButton.css → replaySection.css} +0 -0
@@ -47,7 +47,6 @@ const UIStringsNotTranslated = {
47
47
  mainThreadActivity: 'Investigating main thread activity…',
48
48
  } as const;
49
49
  const lockedString = i18n.i18n.lockedString;
50
- const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled();
51
50
 
52
51
  /**
53
52
  * WARNING: preamble defined in code is only used when userTier is
@@ -55,14 +54,53 @@ const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled()
55
54
  * chrome_preambles.gcl). Sync local changes with the server-side.
56
55
  */
57
56
 
58
- const greenDevAdditionalFunction = `
59
- - CRITICAL:You also have access to a function called addElementAnnotation, which should be used to highlight elements.`;
57
+ const greenDevAdditionalAnnotationsFunction = `
58
+ - CRITICAL: You also have access to functions called addElementAnnotation and addNeworkRequestAnnotation,
59
+ which should be used to highlight elements and network requests (respectively).`;
60
+
61
+ const greenDevAdditionalAnnotationsGuidelines = `
62
+ - CRITICAL: Each time an element or a network request is mentioned, you MUST ALSO call the functions
63
+ addElementAnnotation (for an element) or addNeworkRequestAnnotation (for a network request).
64
+ - CRITICAL: Don't add more than one annotation per element or network request.
65
+ - These functions should be called as soon as you identify the entity that needs to be highlighted.
66
+ - In addition to this, the addElementAnnotation function should always be called for the LCP element, if known.
67
+ - The annotationMessage should be descriptive and relevant to why the element or network request is being highlighted.
68
+ `;
60
69
 
61
- const greenDevAdditionalGuidelines = `
62
- - CRITICAL: Each time an element with a nodeId is mentioned, you MUST ALSO call the function addElementAnnotation for that element.
63
- - The addElementAnnotation function should be called as soon as you identify an element that needs to be highlighted.
64
- - The addElementAnnotation function should always be called for the LCP element, if known.
65
- - The annotationMessage should be descriptive and relevant to why the element is being highlighted.
70
+ const greenDevAdditionalWidgetGuidelines = `
71
+ - **Visualizing Insights**: When discussing the breakdown of specific metrics or a performance problem,
72
+ you must render the appropriate Insight Overview component. Use these tags on a new line within your response:
73
+ - For LCP breakdown: <ai-insight value="LCPBreakdown">
74
+ - For INP breakdown: <ai-insight value="INPBreakdown">
75
+ - For CLS culprits: <ai-insight value="CLSCulprits">
76
+ - For third parties: <ai-insight value="ThirdParties">
77
+ - For document latency: <ai-insight value="DocumentLatency">
78
+ - For DOM size: <ai-insight value="DOMSize">
79
+ - For duplicate JavaScript: <ai-insight value="DuplicatedJavaScript">
80
+ - For font display: <ai-insight value="FontDisplay">
81
+ - For forced reflow: <ai-insight value="ForcedReflow">
82
+ - For image delivery: <ai-insight value="ImageDelivery">
83
+ - For LCP discovery: <ai-insight value="LCPDiscovery">
84
+ - For legacy JavaScript: <ai-insight value="LegacyJavaScript">
85
+ - For network dependency tree: <ai-insight value="NetworkDependencyTree">
86
+ - For render blocking: <ai-insight value="RenderBlocking">
87
+ - For slow CSS selector: <ai-insight value="SlowCSSSelector">
88
+ - For viewport: <ai-insight value="Viewport">
89
+ - For modern HTTP: <ai-insight value="ModernHTTP">
90
+ - For cache: <ai-insight value="Cache">
91
+ - Do not place the <ai-insight> tag inside markdown code blocks (backticks). Output the tag directly as raw text.
92
+ - **Visualizing Network Request Details**: When discussing a specific network request, represent its details in a structured widget for improved readability and focus.
93
+ - Use this tag on a new line within your response, replacing \`EVENT_KEY\` (only the number, no letters prefix or -) with the actual trace event key:
94
+ - For network event details: <network-request-widget value="EVENT_KEY">
95
+ - **Visualizing Flamechart**: When discussing an interesting part of the trace, represent its details in a structured widget for improved readability and focus.
96
+ - Use this tag on a new line within your response, replacing "MIN_MICROSECONDS" and "MAX_MICROSECONDS" with the actual start and end times in microseconds:
97
+ - For a flame chart of a specific time range: <flame-chart-widget start="MIN_MICROSECONDS" end="MAX_MICROSECONDS">
98
+ - CRITICAL: MIN_MICROSECONDS and MAX_MICROSECONDS must be within the flamechart bounds and in microseconds.
99
+ - When you mention a specific performance event like LCP, INP, or a long task, you MUST also include a flamechart widget focused on the exact time range of that event.
100
+ - This provides essential visual context to your explanation.
101
+ - CRITICAL: Avoid Redundancy - When using insight or network request widgets, do not repeat details in the text response.
102
+ - For example, for LCP, the phases like Time to First Byte will be part of the insight widget, so you must not state them in the text. This applies to other insights and network request timings.
103
+ - Do not display any of the same widgets more than once. For example, if you have already displayed a network request widget for a specific event, do not display it again in the same response.
66
104
  `;
67
105
 
68
106
  /**
@@ -72,7 +110,10 @@ const greenDevAdditionalGuidelines = `
72
110
  *
73
111
  * Check token length in https://aistudio.google.com/
74
112
  */
75
- const preamble = `You are an assistant, expert in web performance and highly skilled with Chrome DevTools.
113
+ const buildPreamble = (): string => {
114
+ const greenDevEnabled = Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled;
115
+ const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled();
116
+ return `You are an assistant, expert in web performance and highly skilled with Chrome DevTools.
76
117
 
77
118
  Your primary goal is to provide actionable advice to web developers about their web page by using the Chrome Performance Panel and analyzing a trace. You may need to diagnose problems yourself, or you may be given direction for what to focus on by the user.
78
119
 
@@ -82,7 +123,7 @@ Don't mention anything about an insight without first getting more data about it
82
123
 
83
124
  You have many functions available to learn more about the trace. Use these to confirm hypotheses, or to further explore the trace when diagnosing performance issues.
84
125
 
85
- ${annotationsEnabled ? greenDevAdditionalFunction : ''}
126
+ ${annotationsEnabled ? greenDevAdditionalAnnotationsFunction : ''}
86
127
 
87
128
  You will be given bounds representing a time range within the trace. Bounds include a min and a max time in microseconds. max is always bigger than min in a bounds.
88
129
 
@@ -124,7 +165,8 @@ Note: if the user asks a specific question about the trace (such as "What is my
124
165
  - Structure your response using markdown headings and bullet points for improved readability.
125
166
  - Be direct and to the point. Avoid unnecessary introductory phrases or filler content. Focus on delivering actionable advice efficiently.
126
167
 
127
- ${annotationsEnabled ? greenDevAdditionalGuidelines : ''}
168
+ ${annotationsEnabled ? greenDevAdditionalAnnotationsGuidelines : ''}
169
+ ${greenDevEnabled ? greenDevAdditionalWidgetGuidelines : ''}
128
170
 
129
171
  ## Strict Constraints
130
172
 
@@ -142,6 +184,7 @@ Adhere to the following critical requirements:
142
184
  - If asked about sensitive topics (religion, race, politics, sexuality, gender, etc.), respond with: "My expertise is limited to website performance analysis. I cannot provide information on that topic.".
143
185
  - Do not provide answers on non-web-development topics, such as legal, financial, medical, or personal advice.
144
186
  `;
187
+ };
145
188
 
146
189
  const extraPreambleWhenNotExternal = `Additional notes:
147
190
 
@@ -153,12 +196,27 @@ When referring to a trace event that has a corresponding \`eventKey\`, annotate
153
196
  When asking the user to make a choice between multiple options, output a list of choices at the end of your text response. The format is \`SUGGESTIONS: ["suggestion1", "suggestion2", "suggestion3"]\`. This MUST start on a newline, and be a single line.
154
197
  `;
155
198
 
156
- const greenDevAdditionalGuidelineFreshTrace = `
157
- When referring to an element for which you know the nodeId, always call the function addElementAnnotation, specifying the id and an annotation reason.
199
+ const buildExtraPreambleWhenFreshTrace = (): string => {
200
+ const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled();
201
+ const greenDevAdditionalGuidelineFreshTrace = `
202
+ When referring to an element for which you know the nodeId, always call the function addElementAnnotation, specifying
203
+ the id and an annotation reason.
204
+ When referring to a network request for which you know the eventKey for, always call the function
205
+ addNetworkRequestAnnotation, specifying the id and an annotation reason.
158
206
  - CRITICAL: Each time you add an annotating link you MUST ALSO call the function addElementAnnotation.
207
+ - CRITICAL: Each time you describe an element or network request as being problematic you MUST call the function
208
+ addElementAnnotation and specify an annotation reason.
209
+ - CRITICAL: Each time you describe a network request as being problematic you MUST call the function
210
+ addNetworkRequestAnnotation and specify an annotation reason.
211
+ - CRITICAL: If you spot ANY of the following problems:
212
+ - Render blocking elements/network requests.
213
+ - Significant long task (especially on main thread).
214
+ - Layout shifts (e.g. due to unsized images).
215
+ ... then you MUST call addNetworkRequestAnnotation for ALL network requests and addaddElementAnnotation for all
216
+ elements described in your conclusion.
159
217
  `;
160
218
 
161
- const extraPreambleWhenFreshTrace = `Additional notes:
219
+ const extraPreambleWhenFreshTrace = `Additional notes:
162
220
 
163
221
  When referring to an element for which you know the nodeId, annotate your output using markdown link syntax:
164
222
  - For example, if nodeId is 23: [LCP element](#node-23)
@@ -168,6 +226,9 @@ When referring to an element for which you know the nodeId, annotate your output
168
226
 
169
227
  ${annotationsEnabled ? greenDevAdditionalGuidelineFreshTrace : ''}`;
170
228
 
229
+ return extraPreambleWhenFreshTrace;
230
+ };
231
+
171
232
  enum ScorePriority {
172
233
  REQUIRED = 3,
173
234
  CRITICAL = 2,
@@ -313,7 +374,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
313
374
  metadata: {source: 'devtools', score: ScorePriority.CRITICAL}
314
375
  };
315
376
  #freshTraceExtraPreambleFact: Host.AidaClient.RequestFact = {
316
- text: extraPreambleWhenFreshTrace,
377
+ text: buildExtraPreambleWhenFreshTrace(),
317
378
  metadata: {source: 'devtools', score: ScorePriority.CRITICAL}
318
379
  };
319
380
  #networkDataDescriptionFact: Host.AidaClient.RequestFact = {
@@ -327,14 +388,16 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
327
388
  #traceFacts: Host.AidaClient.RequestFact[] = [];
328
389
 
329
390
  get preamble(): string {
330
- return preamble;
391
+ return buildPreamble();
331
392
  }
332
393
 
333
394
  get clientFeature(): Host.AidaClient.ClientFeature {
334
395
  return Host.AidaClient.ClientFeature.CHROME_PERFORMANCE_FULL_AGENT;
335
396
  }
336
397
  get userTier(): string|undefined {
337
- return annotationsEnabled ? 'TESTERS' : Root.Runtime.hostConfig.devToolsAiAssistancePerformanceAgent?.userTier;
398
+ return Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled) ?
399
+ 'TESTERS' :
400
+ Root.Runtime.hostConfig.devToolsAiAssistancePerformanceAgent?.userTier;
338
401
  }
339
402
  get options(): RequestOptions {
340
403
  const temperature = Root.Runtime.hostConfig.devToolsAiAssistancePerformanceAgent?.temperature;
@@ -513,7 +576,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
513
576
  // Clear any previous facts in case the user changed the active context.
514
577
  this.clearFacts();
515
578
  if (options.selected && focus) {
516
- this.#addFacts(options.selected);
579
+ await this.#addFacts(options.selected);
517
580
  }
518
581
 
519
582
  yield* super.run(initialQuery, options);
@@ -533,12 +596,12 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
533
596
  {text: `Trace summary:\n${text}`, metadata: {source: 'devtools', score: ScorePriority.REQUIRED}});
534
597
  }
535
598
 
536
- #createFactForCriticalRequests(): void {
599
+ async #createFactForCriticalRequests(): Promise<void> {
537
600
  if (!this.#formatter) {
538
601
  return;
539
602
  }
540
603
 
541
- const text = this.#formatter.formatCriticalRequests();
604
+ const text = await this.#formatter.formatCriticalRequests();
542
605
  if (!text) {
543
606
  return;
544
607
  }
@@ -549,12 +612,13 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
549
612
  });
550
613
  }
551
614
 
552
- #createFactForMainThreadBottomUpSummary(): void {
615
+ async #createFactForMainThreadBottomUpSummary(): Promise<void> {
553
616
  if (!this.#formatter) {
554
617
  return;
555
618
  }
556
619
 
557
- const text = this.#formatter.formatMainThreadBottomUpSummary();
620
+ const formatter = this.#formatter;
621
+ const text = await formatter.formatMainThreadBottomUpSummary();
558
622
  if (!text) {
559
623
  return;
560
624
  }
@@ -565,12 +629,12 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
565
629
  });
566
630
  }
567
631
 
568
- #createFactForThirdPartySummary(): void {
632
+ async #createFactForThirdPartySummary(): Promise<void> {
569
633
  if (!this.#formatter) {
570
634
  return;
571
635
  }
572
636
 
573
- const text = this.#formatter.formatThirdPartySummary();
637
+ const text = await this.#formatter.formatThirdPartySummary();
574
638
  if (!text) {
575
639
  return;
576
640
  }
@@ -581,12 +645,12 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
581
645
  });
582
646
  }
583
647
 
584
- #createFactForLongestTasks(): void {
648
+ async #createFactForLongestTasks(): Promise<void> {
585
649
  if (!this.#formatter) {
586
650
  return;
587
651
  }
588
652
 
589
- const text = this.#formatter.formatLongestTasks();
653
+ const text = await this.#formatter.formatLongestTasks();
590
654
  if (!text) {
591
655
  return;
592
656
  }
@@ -597,7 +661,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
597
661
  });
598
662
  }
599
663
 
600
- #addFacts(context: PerformanceTraceContext): void {
664
+ async #addFacts(context: PerformanceTraceContext): Promise<void> {
601
665
  const focus = context.getItem();
602
666
 
603
667
  if (!context.external) {
@@ -613,12 +677,26 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
613
677
  this.addFact(this.#networkDataDescriptionFact);
614
678
 
615
679
  if (!this.#traceFacts.length) {
680
+ const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
681
+ if (!target) {
682
+ throw new Error('missing target');
683
+ }
684
+
616
685
  this.#formatter = new PerformanceTraceFormatter(focus);
686
+ this.#formatter.resolveFunctionCode =
687
+ async (url: Platform.DevToolsPath.UrlString, line: number, column: number) => {
688
+ if (!target) {
689
+ return null;
690
+ }
691
+
692
+ return await SourceMapScopes.FunctionCodeResolver.getFunctionCodeFromLocation(
693
+ target, url, line, column, {contextLength: 200, contextLineLength: 5, appendProfileData: true});
694
+ };
617
695
  this.#createFactForTraceSummary();
618
- this.#createFactForCriticalRequests();
619
- this.#createFactForMainThreadBottomUpSummary();
620
- this.#createFactForThirdPartySummary();
621
- this.#createFactForLongestTasks();
696
+ await this.#createFactForCriticalRequests();
697
+ await this.#createFactForMainThreadBottomUpSummary();
698
+ await this.#createFactForThirdPartySummary();
699
+ await this.#createFactForLongestTasks();
622
700
  }
623
701
 
624
702
  for (const fact of this.#traceFacts) {
@@ -686,9 +764,9 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
686
764
  return {error: `Invalid insight set id. Valid insight set ids are: ${valid}`};
687
765
  }
688
766
 
689
- const insight = insightSet?.model[params.insightName as keyof Trace.Insights.Types.InsightModels];
767
+ const insight = insightSet.model[params.insightName as keyof Trace.Insights.Types.InsightModels];
690
768
  if (!insight) {
691
- const valid = Object.keys(insightSet?.model).join(', ');
769
+ const valid = Object.keys(insightSet.model).join(', ');
692
770
  return {error: `No insight available. Valid insight names are: ${valid}`};
693
771
  }
694
772
 
@@ -790,7 +868,8 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
790
868
  return {error: 'invalid bounds'};
791
869
  }
792
870
 
793
- const summary = this.#formatter.formatMainThreadTrackSummary(bounds);
871
+ const formatter = this.#formatter;
872
+ const summary = await formatter.formatMainThreadTrackSummary(bounds);
794
873
  if (this.#isFunctionResponseTooLarge(summary)) {
795
874
  return {
796
875
  error:
@@ -898,7 +977,8 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
898
977
  return {error: 'No call tree found'};
899
978
  }
900
979
 
901
- const callTree = this.#formatter.formatCallTree(tree);
980
+ const formatter = this.#formatter;
981
+ const callTree = await formatter.formatCallTree(tree);
902
982
 
903
983
  const key = `getDetailedCallTree(${args.eventKey})`;
904
984
  this.#cacheFunctionResult(focus, key, callTree);
@@ -907,7 +987,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
907
987
 
908
988
  });
909
989
 
910
- if (annotationsEnabled) {
990
+ if (Annotations.AnnotationRepository.annotationsEnabled()) {
911
991
  this.declareFunction<{
912
992
  elementId: string,
913
993
  annotationMessage: string,
@@ -935,10 +1015,41 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
935
1015
  return await this.addElementAnnotation(params.elementId, params.annotationMessage);
936
1016
  },
937
1017
  });
1018
+
1019
+ this.declareFunction<{
1020
+ eventKey: string,
1021
+ annotationMessage: string,
1022
+ }>('addNetworkRequestAnnotation', {
1023
+ description:
1024
+ 'Adds a visual annotation in the Network panel, attached to the request with the specific UID provided. ' +
1025
+ 'Use it to highlight requests in the Network panel and provide contextual suggestions to the user ' +
1026
+ 'related to their queries.',
1027
+ parameters: {
1028
+ type: Host.AidaClient.ParametersTypes.OBJECT,
1029
+ description: '',
1030
+ nullable: false,
1031
+ properties: {
1032
+ eventKey: {
1033
+ type: Host.AidaClient.ParametersTypes.STRING,
1034
+ description: 'The event key of the network request to annotate.',
1035
+ nullable: false,
1036
+ },
1037
+ annotationMessage: {
1038
+ type: Host.AidaClient.ParametersTypes.STRING,
1039
+ description: 'The message the annotation should show to the user.',
1040
+ nullable: false,
1041
+ },
1042
+ },
1043
+ },
1044
+ handler: async params => {
1045
+ return await this.addNetworkRequestAnnotation(params.eventKey, params.annotationMessage);
1046
+ },
1047
+ });
938
1048
  }
939
1049
 
940
1050
  this.declareFunction<{scriptUrl: string, line: number, column: number}, {result: string}>('getFunctionCode', {
941
- description: 'Returns the code for a function defined at the given location.',
1051
+ description:
1052
+ 'Returns the code for a function defined at the given location. The result is annotated with the runtime performance of each line of code.',
942
1053
  parameters: {
943
1054
  type: Host.AidaClient.ParametersTypes.OBJECT,
944
1055
  description: '',
@@ -988,8 +1099,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
988
1099
  }
989
1100
 
990
1101
  const url = args.scriptUrl as Platform.DevToolsPath.UrlString;
991
- const code = await SourceMapScopes.FunctionCodeResolver.getFunctionCodeFromLocation(
992
- target, url, args.line, args.column, {contextLength: 200, contextLineLength: 5, appendProfileData: true});
1102
+ const code = await this.#formatter.resolveFunctionCodeAtLocation(url, args.line, args.column);
993
1103
  if (!code) {
994
1104
  return {error: 'Could not find code'};
995
1105
  }
@@ -1007,7 +1117,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1007
1117
 
1008
1118
  this.declareFunction<{url: string}, {content: string}>('getResourceContent', {
1009
1119
  description:
1010
- 'Returns the content of the resource with the given url. Only use this for text resource types. Prefer getFunctionCode when possible.',
1120
+ 'Returns the content of the resource with the given url. Only use this for text resource types. This function is helpful for getting script contents in order to further analyze main thread activity and suggest code improvements. When analyzing the main thread activity, always call this function to get more detail. Always call this function when asked to provide specifics about what is happening in the code. Never ask permission to call this function, just do it.',
1011
1121
  parameters: {
1012
1122
  type: Host.AidaClient.ParametersTypes.OBJECT,
1013
1123
  description: '',
@@ -1095,7 +1205,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1095
1205
  async addElementAnnotation(elementId: string, annotationMessage: string):
1096
1206
  Promise<FunctionCallHandlerResult<unknown>> {
1097
1207
  if (!Annotations.AnnotationRepository.annotationsEnabled()) {
1098
- console.warn('Received agent request to add annotation with annotations disabled');
1208
+ console.warn('Received agent request to add element annotation with annotations disabled');
1099
1209
  return {error: 'Annotations are not currently enabled'};
1100
1210
  }
1101
1211
 
@@ -1104,4 +1214,32 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1104
1214
  Annotations.AnnotationRepository.instance().addElementsAnnotation(annotationMessage, elementId);
1105
1215
  return {result: {success: true}};
1106
1216
  }
1217
+
1218
+ async addNetworkRequestAnnotation(eventKey: string, annotationMessage: string):
1219
+ Promise<FunctionCallHandlerResult<unknown>> {
1220
+ if (!Annotations.AnnotationRepository.annotationsEnabled()) {
1221
+ console.warn('Received agent request to add network request annotation with annotations disabled');
1222
+ return {error: 'Annotations are not currently enabled'};
1223
+ }
1224
+
1225
+ // eslint-disable-next-line no-console
1226
+ console.log(
1227
+ `AI AGENT EVENT: Performance Agent adding annotation for network request ${eventKey}: '${annotationMessage}'`);
1228
+
1229
+ let requestId = undefined;
1230
+ const focus = this.context?.getItem();
1231
+ if (focus) {
1232
+ const event = focus.lookupEvent(eventKey as Trace.Types.File.SerializableKey);
1233
+ if (event && Trace.Types.Events.isSyntheticNetworkRequest(event)) {
1234
+ requestId = event.args.data.requestId;
1235
+ }
1236
+ }
1237
+
1238
+ if (!requestId) {
1239
+ console.warn('Unable to lookup requestId for request with event key', eventKey);
1240
+ }
1241
+
1242
+ Annotations.AnnotationRepository.instance().addNetworkRequestAnnotation(annotationMessage, requestId);
1243
+ return {result: {success: true}};
1244
+ }
1107
1245
  }
@@ -398,6 +398,11 @@ Content:
398
398
  {
399
399
  "type": "querying"
400
400
  },
401
+ {
402
+ "type": "answer",
403
+ "text": "this is my text before the actual answer",
404
+ "complete": true
405
+ },
401
406
  {
402
407
  "type": "thought",
403
408
  "thought": "I am thinking."
@@ -8,6 +8,7 @@ import * as Platform from '../../../core/platform/platform.js';
8
8
  import * as Root from '../../../core/root/root.js';
9
9
  import * as SDK from '../../../core/sdk/sdk.js';
10
10
  import type * as Protocol from '../../../generated/protocol.js';
11
+ import * as Annotations from '../../../ui/components/annotations/annotations.js';
11
12
  import {ChangeManager} from '../ChangeManager.js';
12
13
  import {debugLog} from '../debug.js';
13
14
  import {EvaluateAction, formatError, SideEffectError} from '../EvaluateAction.js';
@@ -410,6 +411,37 @@ const data = {
410
411
  return await this.executeAction(params.code, options);
411
412
  },
412
413
  });
414
+
415
+ if (Annotations.AnnotationRepository.annotationsEnabled()) {
416
+ this.declareFunction<{
417
+ elementId: string,
418
+ annotationMessage: string,
419
+ }>('addElementAnnotation', {
420
+ description: 'Adds a visual annotation in the Elements panel, attached to a node with ' +
421
+ 'the specific UID provided. Use it to highlight nodes in the Elements panel ' +
422
+ 'and provide contextual suggestions to the user related to their queries.',
423
+ parameters: {
424
+ type: Host.AidaClient.ParametersTypes.OBJECT,
425
+ description: '',
426
+ nullable: false,
427
+ properties: {
428
+ elementId: {
429
+ type: Host.AidaClient.ParametersTypes.STRING,
430
+ description: 'The UID of the element to annotate.',
431
+ nullable: false,
432
+ },
433
+ annotationMessage: {
434
+ type: Host.AidaClient.ParametersTypes.STRING,
435
+ description: 'The message the annotation should show to the user.',
436
+ nullable: false,
437
+ },
438
+ },
439
+ },
440
+ handler: async params => {
441
+ return await this.addElementAnnotation(params.elementId, params.annotationMessage);
442
+ },
443
+ });
444
+ }
413
445
  }
414
446
 
415
447
  async generateObservation(
@@ -681,6 +713,36 @@ const data = {
681
713
  }
682
714
  }
683
715
 
716
+ async addElementAnnotation(elementId: string, annotationMessage: string):
717
+ Promise<FunctionCallHandlerResult<unknown>> {
718
+ if (!Annotations.AnnotationRepository.annotationsEnabled()) {
719
+ console.warn('Received agent request to add annotation with annotations disabled');
720
+ return {error: 'Annotations are not currently enabled'};
721
+ }
722
+
723
+ // eslint-disable-next-line no-console
724
+ console.log(
725
+ `AI AGENT EVENT: Styling Agent adding annotation for element ${elementId} with message '${annotationMessage}'`);
726
+ const selectedNode = this.#getSelectedNode();
727
+ if (!selectedNode) {
728
+ return {error: 'Error: Unable to find currently selected element.'};
729
+ }
730
+ const domModel = selectedNode.domModel();
731
+ const backendNodeId = Number(elementId) as Protocol.DOM.BackendNodeId;
732
+ const nodeMap = await domModel.pushNodesByBackendIdsToFrontend(new Set([backendNodeId]));
733
+ const node = nodeMap?.get(backendNodeId);
734
+
735
+ if (!node) {
736
+ return {error: `Error: Could not find the element with backendNodeId=${elementId}`};
737
+ }
738
+
739
+ Annotations.AnnotationRepository.instance().addElementsAnnotation(annotationMessage, node);
740
+
741
+ return {
742
+ result: `Annotation added for element ${elementId}: ${annotationMessage}`,
743
+ };
744
+ }
745
+
684
746
  override async *
685
747
  handleContextDetails(selectedElement: ConversationContext<SDK.DOMModel.DOMNode>|null):
686
748
  AsyncGenerator<ContextResponse, void, void> {
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import type * as SDK from '../../../core/sdk/sdk.js';
6
+ import * as Annotations from '../../../ui/components/annotations/annotations.js';
6
7
  import * as Logs from '../../logs/logs.js';
7
8
  import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
8
9
  import * as TextUtils from '../../text_utils/text_utils.js';
@@ -105,7 +106,7 @@ export class NetworkRequestFormatter {
105
106
  }
106
107
 
107
108
  return `Request: ${this.#request.url()}
108
-
109
+ ${Annotations.AnnotationRepository.annotationsEnabled() ? `\nRequest ID: ${this.#request.requestId()}\n` : ''}
109
110
  ${this.formatRequestHeaders()}
110
111
 
111
112
  ${this.formatResponseHeaders()}${responseBody}
@@ -123,12 +123,6 @@ export class PerformanceInsightFormatter {
123
123
  }
124
124
 
125
125
  insightIsSupported(): boolean {
126
- // Although our types don't show it, Insights can end up as Errors if there
127
- // is an issue in the processing stage. In this case we should gracefully
128
- // ignore this error.
129
- if (this.#insight instanceof Error) {
130
- return false;
131
- }
132
126
  return this.#description().length > 0;
133
127
  }
134
128
 
@@ -206,7 +200,7 @@ export class PerformanceInsightFormatter {
206
200
  {title: 'How can I reduce the amount of legacy JavaScript on my page?'},
207
201
  ];
208
202
  default:
209
- throw new Error('Unknown insight key');
203
+ throw new Error(`Unknown insight key '${this.#insight.insightKey}'`);
210
204
  }
211
205
  }
212
206