chrome-devtools-frontend 1.0.1675430 → 1.0.1678416

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 (308) hide show
  1. package/AUTHORS +1 -0
  2. package/WATCHLISTS +0 -4
  3. package/front_end/core/common/EventTarget.ts +0 -5
  4. package/front_end/core/common/Settings.ts +0 -66
  5. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  6. package/front_end/core/host/UserMetrics.ts +5 -0
  7. package/front_end/core/root/Runtime.ts +5 -5
  8. package/front_end/core/sdk/CSSMetadata.ts +5 -9
  9. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +16 -34
  10. package/front_end/core/sdk/DebuggerModel.ts +92 -57
  11. package/front_end/core/sdk/EmulationModel.ts +2 -1
  12. package/front_end/core/sdk/NetworkManager.ts +16 -2
  13. package/front_end/core/sdk/OverlayModel.ts +19 -9
  14. package/front_end/core/sdk/OverlayPersistentHighlighter.ts +10 -4
  15. package/front_end/core/sdk/ResourceTreeModel.ts +20 -1
  16. package/front_end/core/sdk/SDKSettings.ts +117 -0
  17. package/front_end/core/sdk/Script.ts +9 -53
  18. package/front_end/core/sdk/sdk-meta.ts +0 -431
  19. package/front_end/devtools_compatibility.js +1 -0
  20. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +213 -23
  21. package/front_end/entrypoints/inspector_main/InspectorMain.ts +6 -5
  22. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +14 -15
  23. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +157 -0
  24. package/front_end/entrypoints/main/MainImpl.ts +32 -0
  25. package/front_end/entrypoints/shell/shell.ts +0 -1
  26. package/front_end/foundation/Universe.ts +8 -0
  27. package/front_end/generated/InspectorBackendCommands.ts +8 -8
  28. package/front_end/generated/SupportedCSSProperties.ts +53 -4
  29. package/front_end/generated/protocol-mapping.d.ts +27 -21
  30. package/front_end/generated/protocol-proxy-api.d.ts +22 -17
  31. package/front_end/generated/protocol.ts +43 -18
  32. package/front_end/models/ai_assistance/AiAgent2.ts +47 -2
  33. package/front_end/models/ai_assistance/AiConversation.ts +22 -5
  34. package/front_end/models/ai_assistance/README.md +52 -26
  35. package/front_end/models/ai_assistance/agents/AiAgent.ts +54 -8
  36. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
  37. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +7 -194
  38. package/front_end/models/ai_assistance/agents/StorageAgent.ts +21 -87
  39. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
  40. package/front_end/models/ai_assistance/ai_assistance.ts +24 -0
  41. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +124 -0
  42. package/front_end/models/ai_assistance/contexts/StorageContext.ts +100 -0
  43. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +69 -1
  44. package/front_end/models/ai_assistance/skills/README.md +63 -1
  45. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  46. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +4 -0
  47. package/front_end/models/ai_assistance/skills/accessibility.md +7 -0
  48. package/front_end/models/ai_assistance/skills/performance.md +15 -1
  49. package/front_end/models/ai_assistance/skills/sources.md +16 -0
  50. package/front_end/models/ai_assistance/skills/storage.md +31 -0
  51. package/front_end/models/ai_assistance/tools/GetDetailedCallTree.ts +107 -0
  52. package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +122 -0
  53. package/front_end/models/ai_assistance/tools/GetResourceContent.ts +127 -0
  54. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +101 -0
  55. package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +83 -0
  56. package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +106 -0
  57. package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +104 -0
  58. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +95 -0
  59. package/front_end/models/ai_assistance/tools/ListSources.ts +116 -0
  60. package/front_end/models/ai_assistance/tools/RunLighthouse.ts +89 -0
  61. package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +90 -0
  62. package/front_end/models/ai_assistance/tools/Tool.ts +26 -1
  63. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +22 -0
  64. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -0
  65. package/front_end/models/bindings/CompilerScriptMapping.ts +4 -0
  66. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
  67. package/front_end/models/bindings/ResourceScriptMapping.ts +3 -201
  68. package/front_end/models/bindings/SASSSourceMapping.ts +6 -0
  69. package/front_end/models/breakpoints/BreakpointManager.ts +2 -49
  70. package/front_end/models/comment_manager/CommentManager.ts +141 -0
  71. package/front_end/models/comment_manager/comment_manager.ts +9 -0
  72. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +27 -0
  73. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +10 -2
  74. package/front_end/models/issues_manager/descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  75. package/front_end/models/issues_manager/descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  76. package/front_end/models/issues_manager/descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  77. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
  78. package/front_end/models/persistence/IsolatedFileSystem.ts +7 -8
  79. package/front_end/models/persistence/IsolatedFileSystemManager.ts +2 -2
  80. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  81. package/front_end/models/persistence/persistence-meta.ts +9 -9
  82. package/front_end/models/trace/types/TraceEvents.ts +36 -0
  83. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -3
  84. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +25 -0
  85. package/front_end/panels/accessibility/AccessibilityNodeView.ts +36 -36
  86. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +9 -0
  87. package/front_end/panels/accessibility/AccessibilityStrings.ts +168 -168
  88. package/front_end/panels/accessibility/SourceOrderView.ts +7 -7
  89. package/front_end/panels/accessibility/accessibility-meta.ts +2 -2
  90. package/front_end/panels/accessibility/accessibility.ts +2 -0
  91. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
  92. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -3
  93. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
  94. package/front_end/panels/ai_assistance/components/ChatMessage.ts +92 -12
  95. package/front_end/panels/ai_assistance/components/chatMessage.css +6 -0
  96. package/front_end/panels/application/ApplicationPanelSidebar.ts +10 -4
  97. package/front_end/panels/application/IndexedDBViews.ts +65 -63
  98. package/front_end/panels/application/StorageView.ts +116 -45
  99. package/front_end/panels/application/WebMCPView.ts +16 -7
  100. package/front_end/panels/application/application-meta.ts +11 -0
  101. package/front_end/panels/application/components/AdsView.ts +1 -1
  102. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +5 -5
  103. package/front_end/panels/common/BadgeNotification.ts +8 -8
  104. package/front_end/panels/common/ExtensionPanel.ts +9 -8
  105. package/front_end/panels/common/ExtensionServer.ts +21 -1
  106. package/front_end/panels/common/GdpSignUpDialog.ts +16 -16
  107. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +5 -6
  108. package/front_end/panels/common/PersistenceUtils.ts +2 -2
  109. package/front_end/panels/common/common.ts +0 -97
  110. package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -2
  111. package/front_end/panels/console/ConsolePanel.ts +4 -0
  112. package/front_end/panels/console/ConsolePinPane.ts +2 -2
  113. package/front_end/panels/console/ConsolePrompt.ts +12 -0
  114. package/front_end/panels/console/ConsoleView.ts +31 -20
  115. package/front_end/panels/console/ConsoleViewMessage.ts +37 -13
  116. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  117. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  118. package/front_end/panels/elements/ElementStatePaneWidget.ts +2 -1
  119. package/front_end/panels/elements/ElementsTreeElement.ts +455 -372
  120. package/front_end/panels/elements/LayoutPane.ts +2 -8
  121. package/front_end/panels/elements/StylePropertyTreeElement.ts +16 -15
  122. package/front_end/panels/elements/elements-meta.ts +152 -10
  123. package/front_end/panels/elements/elements.ts +0 -2
  124. package/front_end/panels/emulation/DeviceModeView.ts +9 -1
  125. package/front_end/panels/event_listeners/EventListenersView.ts +8 -4
  126. package/front_end/panels/issues/AffectedTrackingSitesView.ts +25 -14
  127. package/front_end/panels/lighthouse/LighthouseController.ts +3 -2
  128. package/front_end/panels/media/PlayerMessagesView.ts +149 -68
  129. package/front_end/panels/network/BinaryResourceView.ts +134 -81
  130. package/front_end/panels/network/EventSourceMessagesView.ts +10 -10
  131. package/front_end/panels/network/FetchHeaderCommenting.ts +291 -0
  132. package/front_end/panels/network/NetworkConfigView.ts +10 -10
  133. package/front_end/panels/network/NetworkDataGridNode.ts +14 -14
  134. package/front_end/panels/network/NetworkItemView.ts +27 -28
  135. package/front_end/panels/network/NetworkLogView.ts +137 -38
  136. package/front_end/panels/network/NetworkLogViewColumns.ts +35 -35
  137. package/front_end/panels/network/NetworkManageCustomHeadersView.ts +1 -1
  138. package/front_end/panels/network/NetworkPanel.ts +2 -2
  139. package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
  140. package/front_end/panels/network/RequestCookiesView.ts +4 -4
  141. package/front_end/panels/network/RequestHeadersView.ts +5 -5
  142. package/front_end/panels/network/RequestPayloadView.ts +4 -3
  143. package/front_end/panels/network/RequestTimingView.ts +8 -8
  144. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  145. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -1
  146. package/front_end/panels/network/ResourceWebSocketFrameView.ts +16 -16
  147. package/front_end/panels/network/binaryResourceView.css +14 -12
  148. package/front_end/panels/network/components/DirectSocketConnectionView.ts +2 -2
  149. package/front_end/panels/network/components/HeaderSectionRow.ts +1 -1
  150. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -2
  151. package/front_end/panels/network/network-meta.ts +1 -1
  152. package/front_end/panels/network/network.ts +2 -0
  153. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -1
  154. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -2
  155. package/front_end/panels/profiler/heapProfiler.css +0 -9
  156. package/front_end/panels/recorder/RecorderPanel.ts +2 -3
  157. package/front_end/panels/screencast/ScreencastView.ts +148 -138
  158. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -2
  159. package/front_end/panels/sources/BreakpointsView.ts +2 -2
  160. package/front_end/panels/sources/DebuggerPlugin.ts +10 -59
  161. package/front_end/panels/sources/NavigatorView.ts +2 -1
  162. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  163. package/front_end/panels/sources/SourcesPanel.ts +23 -73
  164. package/front_end/panels/sources/SourcesView.ts +248 -157
  165. package/front_end/panels/sources/TabbedEditorContainer.ts +118 -23
  166. package/front_end/panels/sources/UISourceCodeFrame.ts +5 -9
  167. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +4 -2
  168. package/front_end/panels/sources/sources-meta.ts +52 -0
  169. package/front_end/panels/timeline/TimelineController.ts +36 -64
  170. package/front_end/panels/timeline/TimelinePanel.ts +11 -8
  171. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
  172. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
  173. package/front_end/panels/timeline/timelinePanel.css +0 -10
  174. package/front_end/panels/utils/utils.ts +7 -7
  175. package/front_end/services/tracing/PerformanceTracing.ts +5 -17
  176. package/front_end/third_party/chromium/README.chromium +1 -1
  177. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  178. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  179. package/front_end/third_party/codemirror.next/package.json +2 -2
  180. package/front_end/third_party/codemirror.next/rebuild.sh +4 -1
  181. package/front_end/ui/comments/CommentAnchorResolver.ts +430 -35
  182. package/front_end/ui/comments/CommentOverlayManager.ts +635 -0
  183. package/front_end/ui/comments/CommentsOverlayWidget.ts +134 -0
  184. package/front_end/ui/comments/comments.ts +4 -0
  185. package/front_end/ui/comments/commentsOverlay.css +49 -0
  186. package/front_end/{panels/common → ui/components/dialogs}/FreDialog.ts +6 -6
  187. package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +96 -0
  188. package/front_end/ui/components/dialogs/dialogs.ts +4 -0
  189. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -3
  190. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionDisclaimer.ts +13 -13
  191. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +7 -6
  192. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionTeaser.ts +43 -46
  193. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +22 -26
  194. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationTeaser.ts +10 -10
  195. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationUpgradeDialog.ts +5 -5
  196. package/front_end/ui/components/text_editor/text_editor.ts +4 -0
  197. package/front_end/ui/legacy/Toolbar.ts +1 -1
  198. package/front_end/ui/legacy/UIUtils.ts +0 -56
  199. package/front_end/ui/legacy/View.ts +10 -4
  200. package/front_end/ui/legacy/Widget.ts +10 -1
  201. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +2 -1
  202. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +5 -4
  203. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +11 -3
  204. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +507 -209
  205. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +5 -0
  206. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -16
  207. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +5 -12
  208. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +38 -20
  209. package/front_end/ui/legacy/components/source_frame/JSONView.ts +12 -2
  210. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +3 -3
  211. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +37 -6
  212. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +22 -4
  213. package/front_end/ui/settings/SettingUIRegistration.ts +55 -6
  214. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  215. package/mcp/mcp.ts +6 -1
  216. package/package.json +6 -6
  217. package/front_end/Images/toolbarResizerVertical.png +0 -0
  218. package/front_end/emulated_devices/MotoG4-landscape.svg +0 -155
  219. package/front_end/emulated_devices/MotoG4-portrait.svg +0 -155
  220. package/front_end/emulated_devices/Nexus5X-landscape.svg +0 -19
  221. package/front_end/emulated_devices/Nexus5X-portrait.svg +0 -19
  222. package/front_end/emulated_devices/Nexus6P-landscape.svg +0 -50
  223. package/front_end/emulated_devices/Nexus6P-portrait.svg +0 -54
  224. package/front_end/emulated_devices/google-nest-hub-horizontal.png +0 -0
  225. package/front_end/emulated_devices/google-nest-hub-max-horizontal.png +0 -0
  226. package/front_end/emulated_devices/google-nexus-5-horizontal-default-1x.png +0 -0
  227. package/front_end/emulated_devices/google-nexus-5-horizontal-default-2x.png +0 -0
  228. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-1x.png +0 -0
  229. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-2x.png +0 -0
  230. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-1x.png +0 -0
  231. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-2x.png +0 -0
  232. package/front_end/emulated_devices/google-nexus-5-vertical-default-1x.png +0 -0
  233. package/front_end/emulated_devices/google-nexus-5-vertical-default-2x.png +0 -0
  234. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-1x.png +0 -0
  235. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-2x.png +0 -0
  236. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-1x.png +0 -0
  237. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-2x.png +0 -0
  238. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-1x.png +0 -0
  239. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-2x.png +0 -0
  240. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-1x.png +0 -0
  241. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-2x.png +0 -0
  242. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-1x.png +0 -0
  243. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-2x.png +0 -0
  244. package/front_end/emulated_devices/google-nexus-5x-vertical-default-1x.png +0 -0
  245. package/front_end/emulated_devices/google-nexus-5x-vertical-default-2x.png +0 -0
  246. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-1x.png +0 -0
  247. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-2x.png +0 -0
  248. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-1x.png +0 -0
  249. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-2x.png +0 -0
  250. package/front_end/emulated_devices/iPad-landscape.svg +0 -73
  251. package/front_end/emulated_devices/iPad-portrait.svg +0 -76
  252. package/front_end/emulated_devices/iPhone5-landscape.svg +0 -99
  253. package/front_end/emulated_devices/iPhone5-portrait.svg +0 -83
  254. package/front_end/emulated_devices/iPhone6-landscape.svg +0 -111
  255. package/front_end/emulated_devices/iPhone6-portrait.svg +0 -116
  256. package/front_end/emulated_devices/iPhone6Plus-landscape.svg +0 -118
  257. package/front_end/emulated_devices/iPhone6Plus-portrait.svg +0 -116
  258. package/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  259. package/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  260. package/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  261. package/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  262. package/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  263. package/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  264. package/front_end/emulated_devices/optimized/README.md +0 -9
  265. package/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
  266. package/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
  267. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  268. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  269. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  270. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  271. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  272. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  273. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  274. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  275. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  276. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  277. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  278. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  279. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  280. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  281. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  282. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  283. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  284. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  285. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  286. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  287. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  288. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  289. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  290. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  291. package/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
  292. package/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
  293. package/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  294. package/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  295. package/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  296. package/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  297. package/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  298. package/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  299. package/front_end/emulated_devices/optimized/optimized_images.gni +0 -53
  300. package/front_end/models/ai_assistance/agents/README.md +0 -136
  301. package/front_end/panels/elements/ElementsTreeOutlineRenderer.ts +0 -89
  302. package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -27
  303. /package/front_end/{panels/common → ui/components/dialogs}/freDialog.css +0 -0
  304. /package/front_end/{panels/common/common.css → ui/components/dialogs/typeToAllowDialog.css} +0 -0
  305. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionDisclaimer.css +0 -0
  306. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionTeaser.css +0 -0
  307. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationTeaser.css +0 -0
  308. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationUpgradeDialog.css +0 -0
@@ -14,12 +14,11 @@ import * as Tracing from '../../../services/tracing/tracing.js';
14
14
  import * as Logs from '../../logs/logs.js';
15
15
  import * as Trace from '../../trace/trace.js';
16
16
  import {canResourceContentsBeReadForTrace} from '../AiOrigins.js';
17
- import type {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
18
- import {sanitizeHeaders} from '../data_formatters/NetworkRequestFormatter.js';
17
+ import type {MainThreadSectionLabel, PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
19
18
  import {
20
19
  PerformanceInsightFormatter,
21
20
  } from '../data_formatters/PerformanceInsightFormatter.js';
22
- import {PerformanceTraceFormatter} from '../data_formatters/PerformanceTraceFormatter.js';
21
+ import {formatEventForAI, PerformanceTraceFormatter} from '../data_formatters/PerformanceTraceFormatter.js';
23
22
  import {debugLog} from '../debug.js';
24
23
  import {AICallTree} from '../performance/AICallTree.js';
25
24
  import type {AgentFocus} from '../performance/AIContext.js';
@@ -49,13 +48,6 @@ const UIStringsNotTranslated = {
49
48
  } as const;
50
49
  const lockedString = i18n.i18n.lockedString;
51
50
 
52
- /**
53
- * Labels used to identify specific periods or categories in the trace for getting main thread summary.
54
- * Supports hardcoded phases, dynamic navigation IDs (`NAVIGATION_X`), and insight models.
55
- */
56
- export type MainThreadSectionLabel = 'nav-to-lcp'|'lcp-ttfb'|'lcp-render-delay'|'trace-bounds'|'NO_NAVIGATION'|
57
- `NAVIGATION_${string}`|keyof Trace.Insights.Types.InsightModels;
58
-
59
51
  /**
60
52
  * WARNING: preamble defined in code is only used when userTier is
61
53
  * TESTERS. Otherwise, a server-side preamble is used (see
@@ -196,14 +188,6 @@ enum ScorePriority {
196
188
  // 16k Tokens * ~4 char per token.
197
189
  const MAX_FUNCTION_RESULT_BYTE_LENGTH = 16384 * 4;
198
190
 
199
- const STATIC_LABEL_NAMES: Record<string, string> = {
200
- 'nav-to-lcp': 'navigation to LCP',
201
- 'lcp-ttfb': 'LCP to TTFB',
202
- 'lcp-render-delay': 'LCP render delay',
203
- 'trace-bounds': 'the entire trace',
204
- NO_NAVIGATION: 'the period before the first navigation',
205
- };
206
-
207
191
  function getInsightModel(
208
192
  model: Trace.Insights.Types.InsightModels,
209
193
  key: string,
@@ -214,33 +198,6 @@ function getInsightModel(
214
198
  return undefined;
215
199
  }
216
200
 
217
- /**
218
- * Converts the label name we use in the code to a human readable one that is
219
- * shown to the user.
220
- */
221
- export function getLabelName(label: MainThreadSectionLabel, focus: AgentFocus): string {
222
- if (Object.prototype.hasOwnProperty.call(STATIC_LABEL_NAMES, label)) {
223
- return STATIC_LABEL_NAMES[label];
224
- }
225
-
226
- const {parsedTrace} = focus;
227
- const insightSetById = parsedTrace.insights?.get(label as Trace.Types.Events.NavigationId);
228
- if (insightSetById) {
229
- return `navigation to ${insightSetById.url.href}`;
230
- }
231
-
232
- // Go through all the insights we have to find the first one that matches to find the title.
233
- // TODO(b/505291090): make it easier to look up Insight titles from a key.
234
- for (const insightSet of parsedTrace.insights?.values() ?? []) {
235
- const model = getInsightModel(insightSet.model, label);
236
- if (model) {
237
- return `${model.title} insight`;
238
- }
239
- }
240
-
241
- return label;
242
- }
243
-
244
201
  export interface PerformanceAgentOptions extends AgentOptions {
245
202
  tracker?: Tracing.FreshRecording.Tracker;
246
203
  networkLog?: Logs.NetworkLog.NetworkLog;
@@ -816,9 +773,8 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
816
773
  const insightSet = parsedTrace.insights?.get(params.insightSetId);
817
774
  if (!insightSet) {
818
775
  const valid = ([...parsedTrace.insights?.values() ?? []])
819
- .map(
820
- insightSet => `id: ${insightSet.id}, url: ${insightSet.url}, bounds: ${
821
- this.#formatter?.serializeBounds(insightSet.bounds)}`)
776
+ .map(insightSet => `id: ${insightSet.id}, url: ${insightSet.url}, bounds: ${
777
+ this.#formatter?.serializeBounds(insightSet.bounds)}`)
822
778
  .join('; ');
823
779
  return {error: `Invalid insight set id. Valid insight set ids are: ${valid}`};
824
780
  }
@@ -939,20 +895,6 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
939
895
  },
940
896
  });
941
897
 
942
- const createBounds =
943
- (min?: Trace.Types.Timing.Micro, max?: Trace.Types.Timing.Micro): Trace.Types.Timing.TraceWindowMicro|null => {
944
- const {min: bMin, max: bMax} = parsedTrace.data.Meta.traceBounds;
945
- const clampedMin = Math.max(min ?? bMin, bMin);
946
- const clampedMax = Math.min(max ?? bMax, bMax);
947
-
948
- if (clampedMin > clampedMax) {
949
- return null;
950
- }
951
-
952
- return Trace.Helpers.Timing.traceWindowFromMicroSeconds(
953
- clampedMin as Trace.Types.Timing.Micro, clampedMax as Trace.Types.Timing.Micro);
954
- };
955
-
956
898
  this.declareFunction<{label: MainThreadSectionLabel}, {summary: string}>('getMainThreadTrackSummaryByLabel', {
957
899
  description:
958
900
  'Returns a focused, detailed summary of the main thread for a predefined labeled period. Use this to get more relevant detail than the initial trace summary before diagnosing issues.',
@@ -971,7 +913,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
971
913
  required: ['label'],
972
914
  },
973
915
  displayInfoFromArgs: args => {
974
- const labelName = getLabelName(args.label, focus);
916
+ const labelName = context.getLabelName(args.label);
975
917
  return {
976
918
  title: lockedString(`${UIStringsNotTranslated.mainThreadActivity}: ${labelName}`),
977
919
  action: `getMainThreadTrackSummaryByLabel('${args.label}')`,
@@ -980,7 +922,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
980
922
  handler: async args => {
981
923
  debugLog('Function call: getMainThreadTrackSummaryByLabel');
982
924
 
983
- const bounds = this.#getBoundsForLabel(args.label, focus);
925
+ const bounds = context.getBoundsForLabel(args.label);
984
926
  if (!bounds) {
985
927
  return {error: `Invalid label: ${args.label}`};
986
928
  }
@@ -1028,7 +970,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1028
970
  throw new Error('missing formatter');
1029
971
  }
1030
972
 
1031
- const bounds = createBounds(args.min, args.max);
973
+ const bounds = context.createBounds(args.min, args.max);
1032
974
  if (!bounds) {
1033
975
  return {error: 'invalid bounds'};
1034
976
  }
@@ -1326,67 +1268,6 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1326
1268
  });
1327
1269
  }
1328
1270
 
1329
- #getBoundsForLabel(label: MainThreadSectionLabel, focus: AgentFocus): Trace.Types.Timing.TraceWindowMicro|null {
1330
- const {parsedTrace} = focus;
1331
- const insightSet = focus.primaryInsightSet;
1332
-
1333
- if (label === 'nav-to-lcp') {
1334
- if (insightSet) {
1335
- const lcp = Trace.Insights.Common.getLCP(insightSet);
1336
- if (lcp) {
1337
- return Trace.Helpers.Timing.traceWindowFromMicroSeconds(
1338
- insightSet.bounds.min, lcp.event.ts as Trace.Types.Timing.Micro);
1339
- }
1340
- }
1341
- return null;
1342
- }
1343
-
1344
- if (label === 'lcp-ttfb') {
1345
- if (insightSet) {
1346
- const subparts = insightSet.model.LCPBreakdown?.subparts;
1347
- if (subparts?.ttfb) {
1348
- return subparts.ttfb;
1349
- }
1350
- }
1351
- return null;
1352
- }
1353
-
1354
- if (label === 'lcp-render-delay') {
1355
- if (insightSet) {
1356
- const subparts = insightSet.model.LCPBreakdown?.subparts;
1357
- if (subparts?.renderDelay) {
1358
- return subparts.renderDelay;
1359
- }
1360
- }
1361
- return null;
1362
- }
1363
-
1364
- if (label === 'trace-bounds') {
1365
- return parsedTrace.data.Meta.traceBounds;
1366
- }
1367
-
1368
- const insightSetById = parsedTrace.insights?.get(label as Trace.Types.Events.NavigationId);
1369
- if (insightSetById) {
1370
- return insightSetById.bounds;
1371
- }
1372
-
1373
- if (insightSet) {
1374
- const model = getInsightModel(insightSet.model, label);
1375
- if (model) {
1376
- return Trace.Insights.Common.insightBounds(model, insightSet.bounds);
1377
- }
1378
- }
1379
-
1380
- for (const is of parsedTrace.insights?.values() ?? []) {
1381
- const model = getInsightModel(is.model, label);
1382
- if (model) {
1383
- return Trace.Insights.Common.insightBounds(model, is.bounds);
1384
- }
1385
- }
1386
-
1387
- return null;
1388
- }
1389
-
1390
1271
  async #getNetworkRequestImageData(lcpRequest: Trace.Types.Events.SyntheticNetworkRequest):
1391
1272
  Promise<TextUtils.ContentData.ContentData|undefined> {
1392
1273
  const target = this.targetManager.primaryPageTarget();
@@ -1408,71 +1289,3 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1408
1289
  return undefined;
1409
1290
  }
1410
1291
  }
1411
-
1412
- /**
1413
- * Serializes a trace event to a JSON string for AI consumption,
1414
- * ensuring sensitive data (like headers and raw script source code)
1415
- * is sanitized or redacted.
1416
- */
1417
- function formatEventForAI(event: Trace.Types.Events.Event): string {
1418
- if (Trace.Types.Events.isSyntheticNetworkRequest(event)) {
1419
- return JSON.stringify({
1420
- ...event,
1421
- args: {
1422
- ...event.args,
1423
- data: {
1424
- ...event.args.data,
1425
- responseHeaders: event.args.data.responseHeaders ? sanitizeHeaders(event.args.data.responseHeaders) : null,
1426
- },
1427
- },
1428
- });
1429
- }
1430
-
1431
- if (Trace.Types.Events.isResourceReceiveResponse(event)) {
1432
- return JSON.stringify({
1433
- ...event,
1434
- args: {
1435
- ...event.args,
1436
- data: {
1437
- ...event.args.data,
1438
- headers: event.args.data.headers ? sanitizeHeaders(event.args.data.headers) : undefined,
1439
- },
1440
- },
1441
- });
1442
- }
1443
-
1444
- if (Trace.Types.Events.isRundownScriptSource(event)) {
1445
- // Redact sensitive cross-origin script source text.
1446
- const safeData: Omit<Trace.Types.Events.RundownScriptSource['args']['data'], 'sourceText'> = {
1447
- isolate: event.args.data.isolate,
1448
- scriptId: event.args.data.scriptId,
1449
- length: event.args.data.length,
1450
- };
1451
- return JSON.stringify({
1452
- ...event,
1453
- args: {
1454
- ...event.args,
1455
- data: safeData,
1456
- },
1457
- });
1458
- }
1459
-
1460
- if (Trace.Types.Events.isRundownScriptSourceLarge(event)) {
1461
- // Redact sensitive cross-origin script source text.
1462
- const safeData: Omit<Trace.Types.Events.RundownScriptSourceLarge['args']['data'], 'sourceText'> = {
1463
- isolate: event.args.data.isolate,
1464
- scriptId: event.args.data.scriptId,
1465
- splitIndex: event.args.data.splitIndex,
1466
- splitCount: event.args.data.splitCount,
1467
- };
1468
- return JSON.stringify({
1469
- ...event,
1470
- args: {
1471
- ...event.args,
1472
- data: safeData,
1473
- },
1474
- });
1475
- }
1476
-
1477
- return JSON.stringify(event);
1478
- }
@@ -14,8 +14,7 @@ import {
14
14
  type AgentOptions,
15
15
  AiAgent,
16
16
  type ContextResponse,
17
- ConversationContext,
18
- type ConversationSuggestions,
17
+ type ConversationContext,
19
18
  type RequestOptions,
20
19
  ResponseType,
21
20
  } from './AiAgent.js';
@@ -68,7 +67,7 @@ function isSamePrimaryPageOrigin(targetManager: SDK.TargetManager.TargetManager,
68
67
  return isSamePageOrigin(primaryPageTarget, context);
69
68
  }
70
69
 
71
- export function isSamePageOrigin(target: SDK.Target.Target|null, context?: ConversationContext<StorageItem>): boolean {
70
+ export function isSamePageOrigin(target: SDK.Target.Target|null, context?: ConversationContext<unknown>): boolean {
72
71
  if (!target || !context) {
73
72
  return false;
74
73
  }
@@ -85,84 +84,6 @@ function resolveTargetOrigins(context?: ConversationContext<StorageItem>, origin
85
84
  return uniqueOrigins.slice(0, MAX_TARGET_ORIGINS);
86
85
  }
87
86
 
88
- export class StorageContext extends ConversationContext<StorageItem> {
89
- #item: StorageItem;
90
-
91
- constructor(item: StorageItem) {
92
- super();
93
- this.#item = item;
94
- }
95
-
96
- override getURL(): string {
97
- return this.#item.primaryTargetOrigin;
98
- }
99
-
100
- override getItem(): StorageItem {
101
- return this.#item;
102
- }
103
-
104
- override getTitle(): string {
105
- if (this.#item instanceof CookieItem) {
106
- if (this.#item.name) {
107
- return `cookie: ${this.#item.name}${this.#item.origin ? ` ${this.#item.origin}` : ''}`;
108
- }
109
- return `cookies${this.#item.isGenericContext ? '' : `: ${this.#item.origin}`}`;
110
- }
111
- if (this.#item instanceof DOMStorageItem) {
112
- if (this.#item.key) {
113
- return `entry: ${this.#item.key}${this.#item.origin ? ` ${this.#item.origin}` : ''}`;
114
- }
115
- const prefix = this.#item.type === 'localStorage' ? 'local storage' : 'session storage';
116
- return `${prefix}${this.#item.isGenericContext ? '' : `: ${this.#item.origin}`}`;
117
- }
118
- return `Storage: ${this.getOrigin()}`;
119
- }
120
-
121
- override async getSuggestions(): Promise<ConversationSuggestions|undefined> {
122
- if (this.#item instanceof CookieItem) {
123
- if (this.#item.name) {
124
- return [
125
- {
126
- title: 'Why is this cookie set?',
127
- jslogContext: 'storage-cookie',
128
- },
129
- {
130
- title: 'Explain the value of this cookie',
131
- jslogContext: 'storage-cookie',
132
- },
133
- ];
134
- }
135
- return [
136
- {
137
- title: 'Explain the cookies set by this page',
138
- jslogContext: 'storage-cookie',
139
- },
140
- ];
141
- }
142
- if (this.#item instanceof DOMStorageItem) {
143
- if (this.#item.key) {
144
- return [
145
- {
146
- title: 'What is the purpose of this storage entry?',
147
- jslogContext: 'storage-domstorage',
148
- },
149
- {
150
- title: 'Explain the value of this storage entry',
151
- jslogContext: 'storage-domstorage',
152
- },
153
- ];
154
- }
155
- return [
156
- {
157
- title: 'Explain these storage items',
158
- jslogContext: 'storage-domstorage',
159
- },
160
- ];
161
- }
162
- return undefined;
163
- }
164
- }
165
-
166
87
  // Maximum character length of values allowed.
167
88
  const MAX_NUM_CHAR_LENGTH = 10000;
168
89
 
@@ -281,7 +202,7 @@ export class StorageAgent extends AiAgent<StorageItem> {
281
202
  },
282
203
 
283
204
  handler: async args => {
284
- this.disableServerSideLogging();
205
+ this.setServerSideLoggingActive(false);
285
206
  if (!isSamePrimaryPageOrigin(this.targetManager, this.context)) {
286
207
  return {error: 'No origin available or not allowed.'};
287
208
  }
@@ -367,7 +288,7 @@ export class StorageAgent extends AiAgent<StorageItem> {
367
288
  },
368
289
 
369
290
  handler: async (args, options) => {
370
- this.disableServerSideLogging();
291
+ this.setServerSideLoggingActive(false);
371
292
  if (!isSamePrimaryPageOrigin(this.targetManager, this.context)) {
372
293
  return {error: 'No origin available or not allowed.'};
373
294
  }
@@ -467,7 +388,7 @@ export class StorageAgent extends AiAgent<StorageItem> {
467
388
  };
468
389
  },
469
390
  handler: async args => {
470
- this.disableServerSideLogging();
391
+ this.setServerSideLoggingActive(false);
471
392
  if (!isSamePrimaryPageOrigin(this.targetManager, this.context)) {
472
393
  return {error: 'No origin available or not allowed.'};
473
394
  }
@@ -527,7 +448,7 @@ export class StorageAgent extends AiAgent<StorageItem> {
527
448
  };
528
449
  },
529
450
  handler: async (args, options) => {
530
- this.disableServerSideLogging();
451
+ this.setServerSideLoggingActive(false);
531
452
  if (!isSamePrimaryPageOrigin(this.targetManager, this.context)) {
532
453
  return {error: 'No origin available or not allowed.'};
533
454
  }
@@ -657,6 +578,19 @@ export class StorageAgent extends AiAgent<StorageItem> {
657
578
  result: {
658
579
  usageBreakdown,
659
580
  },
581
+ widgets: [
582
+ {
583
+ name: 'STORAGE_BREAKDOWN',
584
+ data: {
585
+ totalUsageBytes: response.usage,
586
+ totalQuotaBytes: response.quota,
587
+ usageBreakdown: rawUsageBreakdown.map(entry => ({
588
+ storageType: entry.storageType,
589
+ bytes: entry.rawUsage,
590
+ })),
591
+ },
592
+ },
593
+ ],
660
594
  };
661
595
  },
662
596
  });
@@ -684,9 +618,9 @@ export class StorageAgent extends AiAgent<StorageItem> {
684
618
  protected override async preRun(): Promise<void> {
685
619
  const item = this.context?.getItem();
686
620
  if (item instanceof CookieItem && Boolean(item.name)) {
687
- this.disableServerSideLogging();
621
+ this.setServerSideLoggingActive(false);
688
622
  } else if (item instanceof DOMStorageItem && Boolean(item.key)) {
689
- this.disableServerSideLogging();
623
+ this.setServerSideLoggingActive(false);
690
624
  }
691
625
  }
692
626
 
@@ -365,7 +365,8 @@ Content:
365
365
  "type": "action",
366
366
  "code": "console.log('hello');",
367
367
  "output": "hello",
368
- "canceled": false
368
+ "canceled": false,
369
+ "toolName": "executeJavaScript"
369
370
  },
370
371
  {
371
372
  "type": "querying"
@@ -22,6 +22,7 @@ import * as DOMNodeContext from './contexts/DOMNodeContext.js';
22
22
  import * as FileContext from './contexts/FileContext.js';
23
23
  import * as PerformanceTraceContext from './contexts/PerformanceTraceContext.js';
24
24
  import * as RequestContext from './contexts/RequestContext.js';
25
+ import * as StorageContext from './contexts/StorageContext.js';
25
26
  import * as ConversationSummary from './ConversationSummary.js';
26
27
  import * as FileFormatter from './data_formatters/FileFormatter.js';
27
28
  import * as LighthouseFormatter from './data_formatters/LighthouseFormatter.js';
@@ -39,13 +40,24 @@ import * as AIQueries from './performance/AIQueries.js';
39
40
  import * as PerformanceAnnotations from './PerformanceAnnotations.js';
40
41
  import * as StorageItem from './StorageItem.js';
41
42
  import * as ExecuteJavaScript from './tools/ExecuteJavaScript.js';
43
+ import * as GetDetailedCallTree from './tools/GetDetailedCallTree.js';
42
44
  import * as GetElementAccessibilityDetails from './tools/GetElementAccessibilityDetails.js';
45
+ import * as GetFunctionCode from './tools/GetFunctionCode.js';
43
46
  import * as GetLighthouseAudits from './tools/GetLighthouseAudits.js';
44
47
  import * as GetNetworkRequestDetails from './tools/GetNetworkRequestDetails.js';
48
+ import * as GetResourceContent from './tools/GetResourceContent.js';
49
+ import * as GetSourceContent from './tools/GetSourceContent.js';
45
50
  import * as GetStyles from './tools/GetStyles.js';
51
+ import * as GetTraceEventByKey from './tools/GetTraceEventByKey.js';
52
+ import * as GetTraceMainThreadSummary from './tools/GetTraceMainThreadSummary.js';
53
+ import * as GetTraceNetworkSummary from './tools/GetTraceNetworkSummary.js';
46
54
  import * as ListNetworkRequests from './tools/ListNetworkRequests.js';
55
+ import * as ListPageOrigins from './tools/ListPageOrigins.js';
56
+ import * as ListSources from './tools/ListSources.js';
47
57
  import * as RecordPerformanceTrace from './tools/RecordPerformanceTrace.js';
48
58
  import * as ResolveDevtoolsNodePath from './tools/ResolveDevtoolsNodePath.js';
59
+ import * as RunLighthouse from './tools/RunLighthouse.js';
60
+ import * as SelectTraceEventByKey from './tools/SelectTraceEventByKey.js';
49
61
  import * as Tool from './tools/Tool.js';
50
62
  import * as ToolRegistry from './tools/ToolRegistry.js';
51
63
 
@@ -74,13 +86,22 @@ export {
74
86
  FileAgent,
75
87
  FileContext,
76
88
  FileFormatter,
89
+ GetDetailedCallTree,
77
90
  GetElementAccessibilityDetails,
91
+ GetFunctionCode,
78
92
  GetLighthouseAudits,
79
93
  GetNetworkRequestDetails,
94
+ GetResourceContent,
95
+ GetSourceContent,
80
96
  GetStyles,
97
+ GetTraceEventByKey,
98
+ GetTraceMainThreadSummary,
99
+ GetTraceNetworkSummary,
81
100
  Injected,
82
101
  LighthouseFormatter,
83
102
  ListNetworkRequests,
103
+ ListPageOrigins,
104
+ ListSources,
84
105
  NetworkAgent,
85
106
  NetworkRequestFormatter,
86
107
  PerformanceAgent,
@@ -91,7 +112,10 @@ export {
91
112
  RecordPerformanceTrace,
92
113
  RequestContext,
93
114
  ResolveDevtoolsNodePath,
115
+ RunLighthouse,
116
+ SelectTraceEventByKey,
94
117
  StorageAgent,
118
+ StorageContext,
95
119
  StorageItem,
96
120
  StylingAgent,
97
121
  Tool,
@@ -23,6 +23,13 @@ import {PerformanceTraceFormatter} from '../data_formatters/PerformanceTraceForm
23
23
  import type {AICallTree} from '../performance/AICallTree.js';
24
24
  import {AgentFocus} from '../performance/AIContext.js';
25
25
 
26
+ /**
27
+ * Labels used to identify specific periods or categories in the trace for getting main thread summary.
28
+ * Supports hardcoded phases, dynamic navigation IDs (`NAVIGATION_X`), and insight models.
29
+ */
30
+ export type MainThreadSectionLabel = 'nav-to-lcp'|'lcp-ttfb'|'lcp-render-delay'|'trace-bounds'|'NO_NAVIGATION'|
31
+ `NAVIGATION_${string}`|keyof Trace.Insights.Types.InsightModels;
32
+
26
33
  /**
27
34
  * The conversation context for AI queries regarding performance traces.
28
35
  * Encapsulates the user's active trace selection/focus and handles formatting
@@ -339,4 +346,121 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
339
346
 
340
347
  return details.length > 0 ? (details as [ContextDetail, ...ContextDetail[]]) : null;
341
348
  }
349
+
350
+ getBoundsForLabel(label: MainThreadSectionLabel): Trace.Types.Timing.TraceWindowMicro|null {
351
+ const focus = this.#focus;
352
+ const {parsedTrace} = focus;
353
+ const insightSet = focus.primaryInsightSet;
354
+
355
+ if (label === 'nav-to-lcp') {
356
+ if (insightSet) {
357
+ const lcp = Trace.Insights.Common.getLCP(insightSet);
358
+ if (lcp) {
359
+ return Trace.Helpers.Timing.traceWindowFromMicroSeconds(insightSet.bounds.min,
360
+ lcp.event.ts as Trace.Types.Timing.Micro);
361
+ }
362
+ }
363
+ return null;
364
+ }
365
+
366
+ if (label === 'lcp-ttfb') {
367
+ if (insightSet) {
368
+ const subparts = insightSet.model.LCPBreakdown?.subparts;
369
+ if (subparts?.ttfb) {
370
+ return subparts.ttfb;
371
+ }
372
+ }
373
+ return null;
374
+ }
375
+
376
+ if (label === 'lcp-render-delay') {
377
+ if (insightSet) {
378
+ const subparts = insightSet.model.LCPBreakdown?.subparts;
379
+ if (subparts?.renderDelay) {
380
+ return subparts.renderDelay;
381
+ }
382
+ }
383
+ return null;
384
+ }
385
+
386
+ if (label === 'trace-bounds') {
387
+ return parsedTrace.data.Meta.traceBounds;
388
+ }
389
+
390
+ const insightSetById = parsedTrace.insights?.get(label as Trace.Types.Events.NavigationId);
391
+ if (insightSetById) {
392
+ return insightSetById.bounds;
393
+ }
394
+
395
+ if (insightSet) {
396
+ const model = getInsightModel(insightSet.model, label);
397
+ if (model) {
398
+ return Trace.Insights.Common.insightBounds(model, insightSet.bounds);
399
+ }
400
+ }
401
+
402
+ for (const is of parsedTrace.insights?.values() ?? []) {
403
+ const model = getInsightModel(is.model, label);
404
+ if (model) {
405
+ return Trace.Insights.Common.insightBounds(model, is.bounds);
406
+ }
407
+ }
408
+
409
+ return null;
410
+ }
411
+
412
+ getLabelName(label: MainThreadSectionLabel): string {
413
+ return getLabelName(label, this.#focus.parsedTrace);
414
+ }
415
+
416
+ createBounds(min?: number, max?: number): Trace.Types.Timing.TraceWindowMicro|null {
417
+ const {min: bMin, max: bMax} = this.#focus.parsedTrace.data.Meta.traceBounds;
418
+ const clampedMin = Math.round(Math.max(min ?? bMin, bMin));
419
+ const clampedMax = Math.round(Math.min(max ?? bMax, bMax));
420
+
421
+ if (clampedMin > clampedMax) {
422
+ return null;
423
+ }
424
+
425
+ return Trace.Helpers.Timing.traceWindowFromMicroSeconds(clampedMin as Trace.Types.Timing.Micro,
426
+ clampedMax as Trace.Types.Timing.Micro);
427
+ }
428
+ }
429
+
430
+ const STATIC_LABEL_NAMES: Record<string, string> = {
431
+ 'nav-to-lcp': 'navigation to LCP',
432
+ 'lcp-ttfb': 'LCP to TTFB',
433
+ 'lcp-render-delay': 'LCP render delay',
434
+ 'trace-bounds': 'the entire trace',
435
+ NO_NAVIGATION: 'the period before the first navigation',
436
+ };
437
+
438
+ function getInsightModel(
439
+ model: Trace.Insights.Types.InsightModels,
440
+ key: string,
441
+ ): Trace.Insights.Types.InsightModels[keyof Trace.Insights.Types.InsightModels]|undefined {
442
+ if (Object.prototype.hasOwnProperty.call(model, key)) {
443
+ return model[key as keyof Trace.Insights.Types.InsightModels];
444
+ }
445
+ return undefined;
446
+ }
447
+
448
+ function getLabelName(label: MainThreadSectionLabel, parsedTrace: Trace.TraceModel.ParsedTrace): string {
449
+ if (Object.prototype.hasOwnProperty.call(STATIC_LABEL_NAMES, label)) {
450
+ return STATIC_LABEL_NAMES[label];
451
+ }
452
+
453
+ const insightSetById = parsedTrace.insights?.get(label as Trace.Types.Events.NavigationId);
454
+ if (insightSetById) {
455
+ return `navigation to ${insightSetById.url.href}`;
456
+ }
457
+
458
+ for (const insightSet of parsedTrace.insights?.values() ?? []) {
459
+ const model = getInsightModel(insightSet.model, label);
460
+ if (model) {
461
+ return `${model.title} insight`;
462
+ }
463
+ }
464
+
465
+ return label;
342
466
  }